~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/sound/ac97/codec.h

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0
  2  *
  3  *  Copyright (C) 2016 Robert Jarzmik <robert.jarzmik@free.fr>
  4  */
  5 
  6 #ifndef __SOUND_AC97_CODEC2_H
  7 #define __SOUND_AC97_CODEC2_H
  8 
  9 #include <linux/device.h>
 10 
 11 #define AC97_ID(vendor_id1, vendor_id2) \
 12         ((((vendor_id1) & 0xffff) << 16) | ((vendor_id2) & 0xffff))
 13 #define AC97_DRIVER_ID(vendor_id1, vendor_id2, mask_id1, mask_id2, _data) \
 14         { .id = (((vendor_id1) & 0xffff) << 16) | ((vendor_id2) & 0xffff), \
 15           .mask = (((mask_id1) & 0xffff) << 16) | ((mask_id2) & 0xffff), \
 16           .data = (_data) }
 17 
 18 struct ac97_controller;
 19 struct clk;
 20 
 21 /**
 22  * struct ac97_id - matches a codec device and driver on an ac97 bus
 23  * @id: The significant bits if the codec vendor ID1 and ID2
 24  * @mask: Bitmask specifying which bits of the id field are significant when
 25  *        matching. A driver binds to a device when :
 26  *        ((vendorID1 << 8 | vendorID2) & (mask_id1 << 8 | mask_id2)) == id.
 27  * @data: Private data used by the driver.
 28  */
 29 struct ac97_id {
 30         unsigned int            id;
 31         unsigned int            mask;
 32         void                    *data;
 33 };
 34 
 35 /**
 36  * ac97_codec_device - a ac97 codec
 37  * @dev: the core device
 38  * @vendor_id: the vendor_id of the codec, as sensed on the AC-link
 39  * @num: the codec number, 0 is primary, 1 is first slave, etc ...
 40  * @clk: the clock BIT_CLK provided by the codec
 41  * @ac97_ctrl: ac97 digital controller on the same AC-link
 42  *
 43  * This is the device instantiated for each codec living on a AC-link. There are
 44  * normally 0 to 4 codec devices per AC-link, and all of them are controlled by
 45  * an AC97 digital controller.
 46  */
 47 struct ac97_codec_device {
 48         struct device           dev;
 49         unsigned int            vendor_id;
 50         unsigned int            num;
 51         struct clk              *clk;
 52         struct ac97_controller  *ac97_ctrl;
 53 };
 54 
 55 /**
 56  * ac97_codec_driver - a ac97 codec driver
 57  * @driver: the device driver structure
 58  * @probe: the function called when a ac97_codec_device is matched
 59  * @remove: the function called when the device is unbound/removed
 60  * @shutdown: shutdown function (might be NULL)
 61  * @id_table: ac97 vendor_id match table, { } member terminated
 62  */
 63 struct ac97_codec_driver {
 64         struct device_driver    driver;
 65         int                     (*probe)(struct ac97_codec_device *);
 66         void                    (*remove)(struct ac97_codec_device *dev);
 67         void                    (*shutdown)(struct ac97_codec_device *);
 68         const struct ac97_id    *id_table;
 69 };
 70 
 71 static inline struct ac97_codec_device *to_ac97_device(struct device *d)
 72 {
 73         return container_of(d, struct ac97_codec_device, dev);
 74 }
 75 
 76 #define to_ac97_driver(__drv) container_of_const(__drv, struct ac97_codec_driver, driver)
 77 
 78 #if IS_ENABLED(CONFIG_AC97_BUS_NEW)
 79 int snd_ac97_codec_driver_register(struct ac97_codec_driver *drv);
 80 void snd_ac97_codec_driver_unregister(struct ac97_codec_driver *drv);
 81 #else
 82 static inline int
 83 snd_ac97_codec_driver_register(struct ac97_codec_driver *drv)
 84 {
 85         return 0;
 86 }
 87 static inline void
 88 snd_ac97_codec_driver_unregister(struct ac97_codec_driver *drv)
 89 {
 90 }
 91 #endif
 92 
 93 
 94 static inline struct device *
 95 ac97_codec_dev2dev(struct ac97_codec_device *adev)
 96 {
 97         return &adev->dev;
 98 }
 99 
100 static inline void *ac97_get_drvdata(struct ac97_codec_device *adev)
101 {
102         return dev_get_drvdata(ac97_codec_dev2dev(adev));
103 }
104 
105 static inline void ac97_set_drvdata(struct ac97_codec_device *adev,
106                                     void *data)
107 {
108         dev_set_drvdata(ac97_codec_dev2dev(adev), data);
109 }
110 
111 void *snd_ac97_codec_get_platdata(const struct ac97_codec_device *adev);
112 
113 #endif
114 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php