diff options
Diffstat (limited to 'sound/pci/hda/hda_codec.c')
-rw-r--r-- | sound/pci/hda/hda_codec.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 9a8adc600a57..eaa8b5676eae 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
@@ -107,6 +107,52 @@ static void hda_keep_power_on(struct hda_codec *codec); | |||
107 | static inline void hda_keep_power_on(struct hda_codec *codec) {} | 107 | static inline void hda_keep_power_on(struct hda_codec *codec) {} |
108 | #endif | 108 | #endif |
109 | 109 | ||
110 | const char *snd_hda_get_jack_location(u32 cfg) | ||
111 | { | ||
112 | static char *bases[7] = { | ||
113 | "N/A", "Rear", "Front", "Left", "Right", "Top", "Bottom", | ||
114 | }; | ||
115 | static unsigned char specials_idx[] = { | ||
116 | 0x07, 0x08, | ||
117 | 0x17, 0x18, 0x19, | ||
118 | 0x37, 0x38 | ||
119 | }; | ||
120 | static char *specials[] = { | ||
121 | "Rear Panel", "Drive Bar", | ||
122 | "Riser", "HDMI", "ATAPI", | ||
123 | "Mobile-In", "Mobile-Out" | ||
124 | }; | ||
125 | int i; | ||
126 | cfg = (cfg & AC_DEFCFG_LOCATION) >> AC_DEFCFG_LOCATION_SHIFT; | ||
127 | if ((cfg & 0x0f) < 7) | ||
128 | return bases[cfg & 0x0f]; | ||
129 | for (i = 0; i < ARRAY_SIZE(specials_idx); i++) { | ||
130 | if (cfg == specials_idx[i]) | ||
131 | return specials[i]; | ||
132 | } | ||
133 | return "UNKNOWN"; | ||
134 | } | ||
135 | |||
136 | const char *snd_hda_get_jack_connectivity(u32 cfg) | ||
137 | { | ||
138 | static char *jack_locations[4] = { "Ext", "Int", "Sep", "Oth" }; | ||
139 | |||
140 | return jack_locations[(cfg >> (AC_DEFCFG_LOCATION_SHIFT + 4)) & 3]; | ||
141 | } | ||
142 | |||
143 | const char *snd_hda_get_jack_type(u32 cfg) | ||
144 | { | ||
145 | static char *jack_types[16] = { | ||
146 | "Line Out", "Speaker", "HP Out", "CD", | ||
147 | "SPDIF Out", "Digital Out", "Modem Line", "Modem Hand", | ||
148 | "Line In", "Aux", "Mic", "Telephony", | ||
149 | "SPDIF In", "Digitial In", "Reserved", "Other" | ||
150 | }; | ||
151 | |||
152 | return jack_types[(cfg & AC_DEFCFG_DEVICE) | ||
153 | >> AC_DEFCFG_DEVICE_SHIFT]; | ||
154 | } | ||
155 | |||
110 | /** | 156 | /** |
111 | * snd_hda_codec_read - send a command and get the response | 157 | * snd_hda_codec_read - send a command and get the response |
112 | * @codec: the HDA codec | 158 | * @codec: the HDA codec |