diff options
| author | Takashi Iwai <tiwai@suse.de> | 2015-03-03 04:07:24 -0500 |
|---|---|---|
| committer | Takashi Iwai <tiwai@suse.de> | 2015-03-23 08:17:17 -0400 |
| commit | 7639a06c23c7d4cda34c2546bd7290d8753849ca (patch) | |
| tree | e3ede67363b832c068f3e5e9ca6d1654824146a8 /include | |
| parent | d068ebc25e6e1360510ad8023fe7bca3dacd204e (diff) | |
ALSA: hda - Move a part of hda_codec stuff into hdac_device
Now some codes and functionalities of hda_codec struct are moved to
hdac_device struct. A few basic attributes like the codec address,
vendor ID number, FG numbers, etc are moved to hdac_device, and they
are accessed like codec->core.addr. The basic verb exec functions are
moved, too.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'include')
| -rw-r--r-- | include/sound/hdaudio.h | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/include/sound/hdaudio.h b/include/sound/hdaudio.h index 848ab6e68099..b81b4bec6f05 100644 --- a/include/sound/hdaudio.h +++ b/include/sound/hdaudio.h | |||
| @@ -8,6 +8,9 @@ | |||
| 8 | #include <linux/device.h> | 8 | #include <linux/device.h> |
| 9 | #include <sound/hda_verbs.h> | 9 | #include <sound/hda_verbs.h> |
| 10 | 10 | ||
| 11 | /* codec node id */ | ||
| 12 | typedef u16 hda_nid_t; | ||
| 13 | |||
| 11 | struct hdac_bus; | 14 | struct hdac_bus; |
| 12 | struct hdac_device; | 15 | struct hdac_device; |
| 13 | struct hdac_driver; | 16 | struct hdac_driver; |
| @@ -26,6 +29,30 @@ struct hdac_device { | |||
| 26 | struct hdac_bus *bus; | 29 | struct hdac_bus *bus; |
| 27 | unsigned int addr; /* codec address */ | 30 | unsigned int addr; /* codec address */ |
| 28 | struct list_head list; /* list point for bus codec_list */ | 31 | struct list_head list; /* list point for bus codec_list */ |
| 32 | |||
| 33 | hda_nid_t afg; /* AFG node id */ | ||
| 34 | hda_nid_t mfg; /* MFG node id */ | ||
| 35 | |||
| 36 | /* ids */ | ||
| 37 | unsigned int vendor_id; | ||
| 38 | unsigned int subsystem_id; | ||
| 39 | unsigned int revision_id; | ||
| 40 | unsigned int afg_function_id; | ||
| 41 | unsigned int mfg_function_id; | ||
| 42 | unsigned int afg_unsol:1; | ||
| 43 | unsigned int mfg_unsol:1; | ||
| 44 | |||
| 45 | unsigned int power_caps; /* FG power caps */ | ||
| 46 | |||
| 47 | const char *vendor_name; /* codec vendor name */ | ||
| 48 | const char *chip_name; /* codec chip name */ | ||
| 49 | |||
| 50 | /* widgets */ | ||
| 51 | unsigned int num_nodes; | ||
| 52 | hda_nid_t start_nid, end_nid; | ||
| 53 | |||
| 54 | /* misc flags */ | ||
| 55 | atomic_t in_pm; /* suspend/resume being performed */ | ||
| 29 | }; | 56 | }; |
| 30 | 57 | ||
| 31 | /* device/driver type used for matching */ | 58 | /* device/driver type used for matching */ |
| @@ -34,8 +61,37 @@ enum { | |||
| 34 | HDA_DEV_LEGACY, | 61 | HDA_DEV_LEGACY, |
| 35 | }; | 62 | }; |
| 36 | 63 | ||
| 64 | /* direction */ | ||
| 65 | enum { | ||
| 66 | HDA_INPUT, HDA_OUTPUT | ||
| 67 | }; | ||
| 68 | |||
| 37 | #define dev_to_hdac_dev(_dev) container_of(_dev, struct hdac_device, dev) | 69 | #define dev_to_hdac_dev(_dev) container_of(_dev, struct hdac_device, dev) |
| 38 | 70 | ||
| 71 | int snd_hdac_device_init(struct hdac_device *dev, struct hdac_bus *bus, | ||
| 72 | const char *name, unsigned int addr); | ||
| 73 | void snd_hdac_device_exit(struct hdac_device *dev); | ||
| 74 | |||
| 75 | int snd_hdac_refresh_widgets(struct hdac_device *codec); | ||
| 76 | |||
| 77 | unsigned int snd_hdac_make_cmd(struct hdac_device *codec, hda_nid_t nid, | ||
| 78 | unsigned int verb, unsigned int parm); | ||
| 79 | int snd_hdac_read(struct hdac_device *codec, hda_nid_t nid, | ||
| 80 | unsigned int verb, unsigned int parm, unsigned int *res); | ||
| 81 | int snd_hdac_read_parm(struct hdac_device *codec, hda_nid_t nid, int parm); | ||
| 82 | int snd_hdac_get_connections(struct hdac_device *codec, hda_nid_t nid, | ||
| 83 | hda_nid_t *conn_list, int max_conns); | ||
| 84 | int snd_hdac_get_sub_nodes(struct hdac_device *codec, hda_nid_t nid, | ||
| 85 | hda_nid_t *start_id); | ||
| 86 | |||
| 87 | #ifdef CONFIG_PM | ||
| 88 | void snd_hdac_power_up(struct hdac_device *codec); | ||
| 89 | void snd_hdac_power_down(struct hdac_device *codec); | ||
| 90 | #else | ||
| 91 | static inline void snd_hdac_power_up(struct hdac_device *codec) {} | ||
| 92 | static inline void snd_hdac_power_down(struct hdac_device *codec) {} | ||
| 93 | #endif | ||
| 94 | |||
| 39 | /* | 95 | /* |
| 40 | * HD-audio codec base driver | 96 | * HD-audio codec base driver |
| 41 | */ | 97 | */ |
| @@ -100,4 +156,14 @@ int snd_hdac_bus_add_device(struct hdac_bus *bus, struct hdac_device *codec); | |||
| 100 | void snd_hdac_bus_remove_device(struct hdac_bus *bus, | 156 | void snd_hdac_bus_remove_device(struct hdac_bus *bus, |
| 101 | struct hdac_device *codec); | 157 | struct hdac_device *codec); |
| 102 | 158 | ||
| 159 | static inline void snd_hdac_codec_link_up(struct hdac_device *codec) | ||
| 160 | { | ||
| 161 | set_bit(codec->addr, &codec->bus->codec_powered); | ||
| 162 | } | ||
| 163 | |||
| 164 | static inline void snd_hdac_codec_link_down(struct hdac_device *codec) | ||
| 165 | { | ||
| 166 | clear_bit(codec->addr, &codec->bus->codec_powered); | ||
| 167 | } | ||
| 168 | |||
| 103 | #endif /* __SOUND_HDAUDIO_H */ | 169 | #endif /* __SOUND_HDAUDIO_H */ |
