diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2018-01-28 23:20:09 -0500 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2018-02-12 04:54:38 -0500 |
commit | 7480389fb0d873ed78619542bf5d2717a7ad7786 (patch) | |
tree | 7ca259d39d3ae5f0ac7affd3102af552a42aed65 | |
parent | 7928b2cbe55b2a410a0f5c1f154610059c57b1b2 (diff) |
ASoC: twl6040: replace codec to component
Now we can replace Codec to Component. Let's do it.
Note:
xxx_codec_xxx() -> xxx_component_xxx()
.idle_bias_off = 0 -> .idle_bias_on = 1
.ignore_pmdown_time = 1 -> .use_pmdown_time = 0
- -> .endianness = 1
- -> .non_legacy_dai_naming = 1
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | sound/soc/codecs/twl6040.c | 269 | ||||
-rw-r--r-- | sound/soc/codecs/twl6040.h | 10 | ||||
-rw-r--r-- | sound/soc/omap/omap-abe-twl6040.c | 8 |
3 files changed, 139 insertions, 148 deletions
diff --git a/sound/soc/codecs/twl6040.c b/sound/soc/codecs/twl6040.c index 573a523ed0b3..9bf23f8e7162 100644 --- a/sound/soc/codecs/twl6040.c +++ b/sound/soc/codecs/twl6040.c | |||
@@ -76,7 +76,7 @@ struct twl6040_data { | |||
76 | unsigned int clk_in; | 76 | unsigned int clk_in; |
77 | unsigned int sysclk; | 77 | unsigned int sysclk; |
78 | struct twl6040_jack_data hs_jack; | 78 | struct twl6040_jack_data hs_jack; |
79 | struct snd_soc_codec *codec; | 79 | struct snd_soc_component *component; |
80 | struct mutex mutex; | 80 | struct mutex mutex; |
81 | }; | 81 | }; |
82 | 82 | ||
@@ -106,12 +106,12 @@ static const struct snd_pcm_hw_constraint_list sysclk_constraints[] = { | |||
106 | { .count = ARRAY_SIZE(hp_rates), .list = hp_rates, }, | 106 | { .count = ARRAY_SIZE(hp_rates), .list = hp_rates, }, |
107 | }; | 107 | }; |
108 | 108 | ||
109 | #define to_twl6040(codec) dev_get_drvdata((codec)->dev->parent) | 109 | #define to_twl6040(component) dev_get_drvdata((component)->dev->parent) |
110 | 110 | ||
111 | static unsigned int twl6040_read(struct snd_soc_codec *codec, unsigned int reg) | 111 | static unsigned int twl6040_read(struct snd_soc_component *component, unsigned int reg) |
112 | { | 112 | { |
113 | struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); | 113 | struct twl6040_data *priv = snd_soc_component_get_drvdata(component); |
114 | struct twl6040 *twl6040 = to_twl6040(codec); | 114 | struct twl6040 *twl6040 = to_twl6040(component); |
115 | u8 value; | 115 | u8 value; |
116 | 116 | ||
117 | if (reg >= TWL6040_CACHEREGNUM) | 117 | if (reg >= TWL6040_CACHEREGNUM) |
@@ -133,10 +133,10 @@ static unsigned int twl6040_read(struct snd_soc_codec *codec, unsigned int reg) | |||
133 | return value; | 133 | return value; |
134 | } | 134 | } |
135 | 135 | ||
136 | static bool twl6040_can_write_to_chip(struct snd_soc_codec *codec, | 136 | static bool twl6040_can_write_to_chip(struct snd_soc_component *component, |
137 | unsigned int reg) | 137 | unsigned int reg) |
138 | { | 138 | { |
139 | struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); | 139 | struct twl6040_data *priv = snd_soc_component_get_drvdata(component); |
140 | 140 | ||
141 | switch (reg) { | 141 | switch (reg) { |
142 | case TWL6040_REG_HSLCTL: | 142 | case TWL6040_REG_HSLCTL: |
@@ -152,10 +152,10 @@ static bool twl6040_can_write_to_chip(struct snd_soc_codec *codec, | |||
152 | } | 152 | } |
153 | } | 153 | } |
154 | 154 | ||
155 | static inline void twl6040_update_dl12_cache(struct snd_soc_codec *codec, | 155 | static inline void twl6040_update_dl12_cache(struct snd_soc_component *component, |
156 | u8 reg, u8 value) | 156 | u8 reg, u8 value) |
157 | { | 157 | { |
158 | struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); | 158 | struct twl6040_data *priv = snd_soc_component_get_drvdata(component); |
159 | 159 | ||
160 | switch (reg) { | 160 | switch (reg) { |
161 | case TWL6040_REG_HSLCTL: | 161 | case TWL6040_REG_HSLCTL: |
@@ -170,54 +170,54 @@ static inline void twl6040_update_dl12_cache(struct snd_soc_codec *codec, | |||
170 | } | 170 | } |
171 | } | 171 | } |
172 | 172 | ||
173 | static int twl6040_write(struct snd_soc_codec *codec, | 173 | static int twl6040_write(struct snd_soc_component *component, |
174 | unsigned int reg, unsigned int value) | 174 | unsigned int reg, unsigned int value) |
175 | { | 175 | { |
176 | struct twl6040 *twl6040 = to_twl6040(codec); | 176 | struct twl6040 *twl6040 = to_twl6040(component); |
177 | 177 | ||
178 | if (reg >= TWL6040_CACHEREGNUM) | 178 | if (reg >= TWL6040_CACHEREGNUM) |
179 | return -EIO; | 179 | return -EIO; |
180 | 180 | ||
181 | twl6040_update_dl12_cache(codec, reg, value); | 181 | twl6040_update_dl12_cache(component, reg, value); |
182 | if (twl6040_can_write_to_chip(codec, reg)) | 182 | if (twl6040_can_write_to_chip(component, reg)) |
183 | return twl6040_reg_write(twl6040, reg, value); | 183 | return twl6040_reg_write(twl6040, reg, value); |
184 | else | 184 | else |
185 | return 0; | 185 | return 0; |
186 | } | 186 | } |
187 | 187 | ||
188 | static void twl6040_init_chip(struct snd_soc_codec *codec) | 188 | static void twl6040_init_chip(struct snd_soc_component *component) |
189 | { | 189 | { |
190 | twl6040_read(codec, TWL6040_REG_TRIM1); | 190 | twl6040_read(component, TWL6040_REG_TRIM1); |
191 | twl6040_read(codec, TWL6040_REG_TRIM2); | 191 | twl6040_read(component, TWL6040_REG_TRIM2); |
192 | twl6040_read(codec, TWL6040_REG_TRIM3); | 192 | twl6040_read(component, TWL6040_REG_TRIM3); |
193 | twl6040_read(codec, TWL6040_REG_HSOTRIM); | 193 | twl6040_read(component, TWL6040_REG_HSOTRIM); |
194 | twl6040_read(codec, TWL6040_REG_HFOTRIM); | 194 | twl6040_read(component, TWL6040_REG_HFOTRIM); |
195 | 195 | ||
196 | /* Change chip defaults */ | 196 | /* Change chip defaults */ |
197 | /* No imput selected for microphone amplifiers */ | 197 | /* No imput selected for microphone amplifiers */ |
198 | twl6040_write(codec, TWL6040_REG_MICLCTL, 0x18); | 198 | twl6040_write(component, TWL6040_REG_MICLCTL, 0x18); |
199 | twl6040_write(codec, TWL6040_REG_MICRCTL, 0x18); | 199 | twl6040_write(component, TWL6040_REG_MICRCTL, 0x18); |
200 | 200 | ||
201 | /* | 201 | /* |
202 | * We need to lower the default gain values, so the ramp code | 202 | * We need to lower the default gain values, so the ramp code |
203 | * can work correctly for the first playback. | 203 | * can work correctly for the first playback. |
204 | * This reduces the pop noise heard at the first playback. | 204 | * This reduces the pop noise heard at the first playback. |
205 | */ | 205 | */ |
206 | twl6040_write(codec, TWL6040_REG_HSGAIN, 0xff); | 206 | twl6040_write(component, TWL6040_REG_HSGAIN, 0xff); |
207 | twl6040_write(codec, TWL6040_REG_EARCTL, 0x1e); | 207 | twl6040_write(component, TWL6040_REG_EARCTL, 0x1e); |
208 | twl6040_write(codec, TWL6040_REG_HFLGAIN, 0x1d); | 208 | twl6040_write(component, TWL6040_REG_HFLGAIN, 0x1d); |
209 | twl6040_write(codec, TWL6040_REG_HFRGAIN, 0x1d); | 209 | twl6040_write(component, TWL6040_REG_HFRGAIN, 0x1d); |
210 | twl6040_write(codec, TWL6040_REG_LINEGAIN, 0); | 210 | twl6040_write(component, TWL6040_REG_LINEGAIN, 0); |
211 | } | 211 | } |
212 | 212 | ||
213 | /* set headset dac and driver power mode */ | 213 | /* set headset dac and driver power mode */ |
214 | static int headset_power_mode(struct snd_soc_codec *codec, int high_perf) | 214 | static int headset_power_mode(struct snd_soc_component *component, int high_perf) |
215 | { | 215 | { |
216 | int hslctl, hsrctl; | 216 | int hslctl, hsrctl; |
217 | int mask = TWL6040_HSDRVMODE | TWL6040_HSDACMODE; | 217 | int mask = TWL6040_HSDRVMODE | TWL6040_HSDACMODE; |
218 | 218 | ||
219 | hslctl = twl6040_read(codec, TWL6040_REG_HSLCTL); | 219 | hslctl = twl6040_read(component, TWL6040_REG_HSLCTL); |
220 | hsrctl = twl6040_read(codec, TWL6040_REG_HSRCTL); | 220 | hsrctl = twl6040_read(component, TWL6040_REG_HSRCTL); |
221 | 221 | ||
222 | if (high_perf) { | 222 | if (high_perf) { |
223 | hslctl &= ~mask; | 223 | hslctl &= ~mask; |
@@ -227,8 +227,8 @@ static int headset_power_mode(struct snd_soc_codec *codec, int high_perf) | |||
227 | hsrctl |= mask; | 227 | hsrctl |= mask; |
228 | } | 228 | } |
229 | 229 | ||
230 | twl6040_write(codec, TWL6040_REG_HSLCTL, hslctl); | 230 | twl6040_write(component, TWL6040_REG_HSLCTL, hslctl); |
231 | twl6040_write(codec, TWL6040_REG_HSRCTL, hsrctl); | 231 | twl6040_write(component, TWL6040_REG_HSRCTL, hsrctl); |
232 | 232 | ||
233 | return 0; | 233 | return 0; |
234 | } | 234 | } |
@@ -236,7 +236,7 @@ static int headset_power_mode(struct snd_soc_codec *codec, int high_perf) | |||
236 | static int twl6040_hs_dac_event(struct snd_soc_dapm_widget *w, | 236 | static int twl6040_hs_dac_event(struct snd_soc_dapm_widget *w, |
237 | struct snd_kcontrol *kcontrol, int event) | 237 | struct snd_kcontrol *kcontrol, int event) |
238 | { | 238 | { |
239 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); | 239 | struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); |
240 | u8 hslctl, hsrctl; | 240 | u8 hslctl, hsrctl; |
241 | 241 | ||
242 | /* | 242 | /* |
@@ -244,8 +244,8 @@ static int twl6040_hs_dac_event(struct snd_soc_dapm_widget *w, | |||
244 | * Both HS DAC need to be turned on (before the HS driver) and off at | 244 | * Both HS DAC need to be turned on (before the HS driver) and off at |
245 | * the same time. | 245 | * the same time. |
246 | */ | 246 | */ |
247 | hslctl = twl6040_read(codec, TWL6040_REG_HSLCTL); | 247 | hslctl = twl6040_read(component, TWL6040_REG_HSLCTL); |
248 | hsrctl = twl6040_read(codec, TWL6040_REG_HSRCTL); | 248 | hsrctl = twl6040_read(component, TWL6040_REG_HSRCTL); |
249 | if (SND_SOC_DAPM_EVENT_ON(event)) { | 249 | if (SND_SOC_DAPM_EVENT_ON(event)) { |
250 | hslctl |= TWL6040_HSDACENA; | 250 | hslctl |= TWL6040_HSDACENA; |
251 | hsrctl |= TWL6040_HSDACENA; | 251 | hsrctl |= TWL6040_HSDACENA; |
@@ -253,8 +253,8 @@ static int twl6040_hs_dac_event(struct snd_soc_dapm_widget *w, | |||
253 | hslctl &= ~TWL6040_HSDACENA; | 253 | hslctl &= ~TWL6040_HSDACENA; |
254 | hsrctl &= ~TWL6040_HSDACENA; | 254 | hsrctl &= ~TWL6040_HSDACENA; |
255 | } | 255 | } |
256 | twl6040_write(codec, TWL6040_REG_HSLCTL, hslctl); | 256 | twl6040_write(component, TWL6040_REG_HSLCTL, hslctl); |
257 | twl6040_write(codec, TWL6040_REG_HSRCTL, hsrctl); | 257 | twl6040_write(component, TWL6040_REG_HSRCTL, hsrctl); |
258 | 258 | ||
259 | msleep(1); | 259 | msleep(1); |
260 | return 0; | 260 | return 0; |
@@ -263,17 +263,17 @@ static int twl6040_hs_dac_event(struct snd_soc_dapm_widget *w, | |||
263 | static int twl6040_ep_drv_event(struct snd_soc_dapm_widget *w, | 263 | static int twl6040_ep_drv_event(struct snd_soc_dapm_widget *w, |
264 | struct snd_kcontrol *kcontrol, int event) | 264 | struct snd_kcontrol *kcontrol, int event) |
265 | { | 265 | { |
266 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); | 266 | struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); |
267 | struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); | 267 | struct twl6040_data *priv = snd_soc_component_get_drvdata(component); |
268 | int ret = 0; | 268 | int ret = 0; |
269 | 269 | ||
270 | if (SND_SOC_DAPM_EVENT_ON(event)) { | 270 | if (SND_SOC_DAPM_EVENT_ON(event)) { |
271 | /* Earphone doesn't support low power mode */ | 271 | /* Earphone doesn't support low power mode */ |
272 | priv->hs_power_mode_locked = 1; | 272 | priv->hs_power_mode_locked = 1; |
273 | ret = headset_power_mode(codec, 1); | 273 | ret = headset_power_mode(component, 1); |
274 | } else { | 274 | } else { |
275 | priv->hs_power_mode_locked = 0; | 275 | priv->hs_power_mode_locked = 0; |
276 | ret = headset_power_mode(codec, priv->hs_power_mode); | 276 | ret = headset_power_mode(component, priv->hs_power_mode); |
277 | } | 277 | } |
278 | 278 | ||
279 | msleep(1); | 279 | msleep(1); |
@@ -281,16 +281,16 @@ static int twl6040_ep_drv_event(struct snd_soc_dapm_widget *w, | |||
281 | return ret; | 281 | return ret; |
282 | } | 282 | } |
283 | 283 | ||
284 | static void twl6040_hs_jack_report(struct snd_soc_codec *codec, | 284 | static void twl6040_hs_jack_report(struct snd_soc_component *component, |
285 | struct snd_soc_jack *jack, int report) | 285 | struct snd_soc_jack *jack, int report) |
286 | { | 286 | { |
287 | struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); | 287 | struct twl6040_data *priv = snd_soc_component_get_drvdata(component); |
288 | int status; | 288 | int status; |
289 | 289 | ||
290 | mutex_lock(&priv->mutex); | 290 | mutex_lock(&priv->mutex); |
291 | 291 | ||
292 | /* Sync status */ | 292 | /* Sync status */ |
293 | status = twl6040_read(codec, TWL6040_REG_STATUS); | 293 | status = twl6040_read(component, TWL6040_REG_STATUS); |
294 | if (status & TWL6040_PLUGCOMP) | 294 | if (status & TWL6040_PLUGCOMP) |
295 | snd_soc_jack_report(jack, report, report); | 295 | snd_soc_jack_report(jack, report, report); |
296 | else | 296 | else |
@@ -299,16 +299,16 @@ static void twl6040_hs_jack_report(struct snd_soc_codec *codec, | |||
299 | mutex_unlock(&priv->mutex); | 299 | mutex_unlock(&priv->mutex); |
300 | } | 300 | } |
301 | 301 | ||
302 | void twl6040_hs_jack_detect(struct snd_soc_codec *codec, | 302 | void twl6040_hs_jack_detect(struct snd_soc_component *component, |
303 | struct snd_soc_jack *jack, int report) | 303 | struct snd_soc_jack *jack, int report) |
304 | { | 304 | { |
305 | struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); | 305 | struct twl6040_data *priv = snd_soc_component_get_drvdata(component); |
306 | struct twl6040_jack_data *hs_jack = &priv->hs_jack; | 306 | struct twl6040_jack_data *hs_jack = &priv->hs_jack; |
307 | 307 | ||
308 | hs_jack->jack = jack; | 308 | hs_jack->jack = jack; |
309 | hs_jack->report = report; | 309 | hs_jack->report = report; |
310 | 310 | ||
311 | twl6040_hs_jack_report(codec, hs_jack->jack, hs_jack->report); | 311 | twl6040_hs_jack_report(component, hs_jack->jack, hs_jack->report); |
312 | } | 312 | } |
313 | EXPORT_SYMBOL_GPL(twl6040_hs_jack_detect); | 313 | EXPORT_SYMBOL_GPL(twl6040_hs_jack_detect); |
314 | 314 | ||
@@ -316,17 +316,17 @@ static void twl6040_accessory_work(struct work_struct *work) | |||
316 | { | 316 | { |
317 | struct twl6040_data *priv = container_of(work, | 317 | struct twl6040_data *priv = container_of(work, |
318 | struct twl6040_data, hs_jack.work.work); | 318 | struct twl6040_data, hs_jack.work.work); |
319 | struct snd_soc_codec *codec = priv->codec; | 319 | struct snd_soc_component *component = priv->component; |
320 | struct twl6040_jack_data *hs_jack = &priv->hs_jack; | 320 | struct twl6040_jack_data *hs_jack = &priv->hs_jack; |
321 | 321 | ||
322 | twl6040_hs_jack_report(codec, hs_jack->jack, hs_jack->report); | 322 | twl6040_hs_jack_report(component, hs_jack->jack, hs_jack->report); |
323 | } | 323 | } |
324 | 324 | ||
325 | /* audio interrupt handler */ | 325 | /* audio interrupt handler */ |
326 | static irqreturn_t twl6040_audio_handler(int irq, void *data) | 326 | static irqreturn_t twl6040_audio_handler(int irq, void *data) |
327 | { | 327 | { |
328 | struct snd_soc_codec *codec = data; | 328 | struct snd_soc_component *component = data; |
329 | struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); | 329 | struct twl6040_data *priv = snd_soc_component_get_drvdata(component); |
330 | 330 | ||
331 | queue_delayed_work(system_power_efficient_wq, | 331 | queue_delayed_work(system_power_efficient_wq, |
332 | &priv->hs_jack.work, msecs_to_jiffies(200)); | 332 | &priv->hs_jack.work, msecs_to_jiffies(200)); |
@@ -337,12 +337,12 @@ static irqreturn_t twl6040_audio_handler(int irq, void *data) | |||
337 | static int twl6040_soc_dapm_put_vibra_enum(struct snd_kcontrol *kcontrol, | 337 | static int twl6040_soc_dapm_put_vibra_enum(struct snd_kcontrol *kcontrol, |
338 | struct snd_ctl_elem_value *ucontrol) | 338 | struct snd_ctl_elem_value *ucontrol) |
339 | { | 339 | { |
340 | struct snd_soc_codec *codec = snd_soc_dapm_kcontrol_codec(kcontrol); | 340 | struct snd_soc_component *component = snd_soc_dapm_kcontrol_component(kcontrol); |
341 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; | 341 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; |
342 | unsigned int val; | 342 | unsigned int val; |
343 | 343 | ||
344 | /* Do not allow changes while Input/FF efect is running */ | 344 | /* Do not allow changes while Input/FF efect is running */ |
345 | val = twl6040_read(codec, e->reg); | 345 | val = twl6040_read(component, e->reg); |
346 | if (val & TWL6040_VIBENA && !(val & TWL6040_VIBSEL)) | 346 | if (val & TWL6040_VIBENA && !(val & TWL6040_VIBSEL)) |
347 | return -EBUSY; | 347 | return -EBUSY; |
348 | 348 | ||
@@ -486,8 +486,8 @@ static SOC_ENUM_SINGLE_EXT_DECL(twl6040_power_mode_enum, | |||
486 | static int twl6040_headset_power_get_enum(struct snd_kcontrol *kcontrol, | 486 | static int twl6040_headset_power_get_enum(struct snd_kcontrol *kcontrol, |
487 | struct snd_ctl_elem_value *ucontrol) | 487 | struct snd_ctl_elem_value *ucontrol) |
488 | { | 488 | { |
489 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); | 489 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); |
490 | struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); | 490 | struct twl6040_data *priv = snd_soc_component_get_drvdata(component); |
491 | 491 | ||
492 | ucontrol->value.enumerated.item[0] = priv->hs_power_mode; | 492 | ucontrol->value.enumerated.item[0] = priv->hs_power_mode; |
493 | 493 | ||
@@ -497,13 +497,13 @@ static int twl6040_headset_power_get_enum(struct snd_kcontrol *kcontrol, | |||
497 | static int twl6040_headset_power_put_enum(struct snd_kcontrol *kcontrol, | 497 | static int twl6040_headset_power_put_enum(struct snd_kcontrol *kcontrol, |
498 | struct snd_ctl_elem_value *ucontrol) | 498 | struct snd_ctl_elem_value *ucontrol) |
499 | { | 499 | { |
500 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); | 500 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); |
501 | struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); | 501 | struct twl6040_data *priv = snd_soc_component_get_drvdata(component); |
502 | int high_perf = ucontrol->value.enumerated.item[0]; | 502 | int high_perf = ucontrol->value.enumerated.item[0]; |
503 | int ret = 0; | 503 | int ret = 0; |
504 | 504 | ||
505 | if (!priv->hs_power_mode_locked) | 505 | if (!priv->hs_power_mode_locked) |
506 | ret = headset_power_mode(codec, high_perf); | 506 | ret = headset_power_mode(component, high_perf); |
507 | 507 | ||
508 | if (!ret) | 508 | if (!ret) |
509 | priv->hs_power_mode = high_perf; | 509 | priv->hs_power_mode = high_perf; |
@@ -514,8 +514,8 @@ static int twl6040_headset_power_put_enum(struct snd_kcontrol *kcontrol, | |||
514 | static int twl6040_pll_get_enum(struct snd_kcontrol *kcontrol, | 514 | static int twl6040_pll_get_enum(struct snd_kcontrol *kcontrol, |
515 | struct snd_ctl_elem_value *ucontrol) | 515 | struct snd_ctl_elem_value *ucontrol) |
516 | { | 516 | { |
517 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); | 517 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); |
518 | struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); | 518 | struct twl6040_data *priv = snd_soc_component_get_drvdata(component); |
519 | 519 | ||
520 | ucontrol->value.enumerated.item[0] = priv->pll_power_mode; | 520 | ucontrol->value.enumerated.item[0] = priv->pll_power_mode; |
521 | 521 | ||
@@ -525,17 +525,17 @@ static int twl6040_pll_get_enum(struct snd_kcontrol *kcontrol, | |||
525 | static int twl6040_pll_put_enum(struct snd_kcontrol *kcontrol, | 525 | static int twl6040_pll_put_enum(struct snd_kcontrol *kcontrol, |
526 | struct snd_ctl_elem_value *ucontrol) | 526 | struct snd_ctl_elem_value *ucontrol) |
527 | { | 527 | { |
528 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); | 528 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); |
529 | struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); | 529 | struct twl6040_data *priv = snd_soc_component_get_drvdata(component); |
530 | 530 | ||
531 | priv->pll_power_mode = ucontrol->value.enumerated.item[0]; | 531 | priv->pll_power_mode = ucontrol->value.enumerated.item[0]; |
532 | 532 | ||
533 | return 0; | 533 | return 0; |
534 | } | 534 | } |
535 | 535 | ||
536 | int twl6040_get_dl1_gain(struct snd_soc_codec *codec) | 536 | int twl6040_get_dl1_gain(struct snd_soc_component *component) |
537 | { | 537 | { |
538 | struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); | 538 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); |
539 | 539 | ||
540 | if (snd_soc_dapm_get_pin_status(dapm, "EP")) | 540 | if (snd_soc_dapm_get_pin_status(dapm, "EP")) |
541 | return -1; /* -1dB */ | 541 | return -1; /* -1dB */ |
@@ -543,7 +543,7 @@ int twl6040_get_dl1_gain(struct snd_soc_codec *codec) | |||
543 | if (snd_soc_dapm_get_pin_status(dapm, "HSOR") || | 543 | if (snd_soc_dapm_get_pin_status(dapm, "HSOR") || |
544 | snd_soc_dapm_get_pin_status(dapm, "HSOL")) { | 544 | snd_soc_dapm_get_pin_status(dapm, "HSOL")) { |
545 | 545 | ||
546 | u8 val = twl6040_read(codec, TWL6040_REG_HSLCTL); | 546 | u8 val = twl6040_read(component, TWL6040_REG_HSLCTL); |
547 | if (val & TWL6040_HSDACMODE) | 547 | if (val & TWL6040_HSDACMODE) |
548 | /* HSDACL in LP mode */ | 548 | /* HSDACL in LP mode */ |
549 | return -8; /* -8dB */ | 549 | return -8; /* -8dB */ |
@@ -555,26 +555,26 @@ int twl6040_get_dl1_gain(struct snd_soc_codec *codec) | |||
555 | } | 555 | } |
556 | EXPORT_SYMBOL_GPL(twl6040_get_dl1_gain); | 556 | EXPORT_SYMBOL_GPL(twl6040_get_dl1_gain); |
557 | 557 | ||
558 | int twl6040_get_clk_id(struct snd_soc_codec *codec) | 558 | int twl6040_get_clk_id(struct snd_soc_component *component) |
559 | { | 559 | { |
560 | struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); | 560 | struct twl6040_data *priv = snd_soc_component_get_drvdata(component); |
561 | 561 | ||
562 | return priv->pll_power_mode; | 562 | return priv->pll_power_mode; |
563 | } | 563 | } |
564 | EXPORT_SYMBOL_GPL(twl6040_get_clk_id); | 564 | EXPORT_SYMBOL_GPL(twl6040_get_clk_id); |
565 | 565 | ||
566 | int twl6040_get_trim_value(struct snd_soc_codec *codec, enum twl6040_trim trim) | 566 | int twl6040_get_trim_value(struct snd_soc_component *component, enum twl6040_trim trim) |
567 | { | 567 | { |
568 | if (unlikely(trim >= TWL6040_TRIM_INVAL)) | 568 | if (unlikely(trim >= TWL6040_TRIM_INVAL)) |
569 | return -EINVAL; | 569 | return -EINVAL; |
570 | 570 | ||
571 | return twl6040_read(codec, TWL6040_REG_TRIM1 + trim); | 571 | return twl6040_read(component, TWL6040_REG_TRIM1 + trim); |
572 | } | 572 | } |
573 | EXPORT_SYMBOL_GPL(twl6040_get_trim_value); | 573 | EXPORT_SYMBOL_GPL(twl6040_get_trim_value); |
574 | 574 | ||
575 | int twl6040_get_hs_step_size(struct snd_soc_codec *codec) | 575 | int twl6040_get_hs_step_size(struct snd_soc_component *component) |
576 | { | 576 | { |
577 | struct twl6040 *twl6040 = to_twl6040(codec); | 577 | struct twl6040 *twl6040 = to_twl6040(component); |
578 | 578 | ||
579 | if (twl6040_get_revid(twl6040) < TWL6040_REV_ES1_3) | 579 | if (twl6040_get_revid(twl6040) < TWL6040_REV_ES1_3) |
580 | /* For ES under ES_1.3 HS step is 2 mV */ | 580 | /* For ES under ES_1.3 HS step is 2 mV */ |
@@ -829,11 +829,11 @@ static const struct snd_soc_dapm_route intercon[] = { | |||
829 | {"VIBRAR", NULL, "Vibra Right Driver"}, | 829 | {"VIBRAR", NULL, "Vibra Right Driver"}, |
830 | }; | 830 | }; |
831 | 831 | ||
832 | static int twl6040_set_bias_level(struct snd_soc_codec *codec, | 832 | static int twl6040_set_bias_level(struct snd_soc_component *component, |
833 | enum snd_soc_bias_level level) | 833 | enum snd_soc_bias_level level) |
834 | { | 834 | { |
835 | struct twl6040 *twl6040 = to_twl6040(codec); | 835 | struct twl6040 *twl6040 = to_twl6040(component); |
836 | struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); | 836 | struct twl6040_data *priv = snd_soc_component_get_drvdata(component); |
837 | int ret = 0; | 837 | int ret = 0; |
838 | 838 | ||
839 | switch (level) { | 839 | switch (level) { |
@@ -856,7 +856,7 @@ static int twl6040_set_bias_level(struct snd_soc_codec *codec, | |||
856 | priv->codec_powered = 1; | 856 | priv->codec_powered = 1; |
857 | 857 | ||
858 | /* Set external boost GPO */ | 858 | /* Set external boost GPO */ |
859 | twl6040_write(codec, TWL6040_REG_GPOCTL, 0x02); | 859 | twl6040_write(component, TWL6040_REG_GPOCTL, 0x02); |
860 | break; | 860 | break; |
861 | case SND_SOC_BIAS_OFF: | 861 | case SND_SOC_BIAS_OFF: |
862 | if (!priv->codec_powered) | 862 | if (!priv->codec_powered) |
@@ -873,8 +873,8 @@ static int twl6040_set_bias_level(struct snd_soc_codec *codec, | |||
873 | static int twl6040_startup(struct snd_pcm_substream *substream, | 873 | static int twl6040_startup(struct snd_pcm_substream *substream, |
874 | struct snd_soc_dai *dai) | 874 | struct snd_soc_dai *dai) |
875 | { | 875 | { |
876 | struct snd_soc_codec *codec = dai->codec; | 876 | struct snd_soc_component *component = dai->component; |
877 | struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); | 877 | struct twl6040_data *priv = snd_soc_component_get_drvdata(component); |
878 | 878 | ||
879 | snd_pcm_hw_constraint_list(substream->runtime, 0, | 879 | snd_pcm_hw_constraint_list(substream->runtime, 0, |
880 | SNDRV_PCM_HW_PARAM_RATE, | 880 | SNDRV_PCM_HW_PARAM_RATE, |
@@ -887,8 +887,8 @@ static int twl6040_hw_params(struct snd_pcm_substream *substream, | |||
887 | struct snd_pcm_hw_params *params, | 887 | struct snd_pcm_hw_params *params, |
888 | struct snd_soc_dai *dai) | 888 | struct snd_soc_dai *dai) |
889 | { | 889 | { |
890 | struct snd_soc_codec *codec = dai->codec; | 890 | struct snd_soc_component *component = dai->component; |
891 | struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); | 891 | struct twl6040_data *priv = snd_soc_component_get_drvdata(component); |
892 | int rate; | 892 | int rate; |
893 | 893 | ||
894 | rate = params_rate(params); | 894 | rate = params_rate(params); |
@@ -899,7 +899,7 @@ static int twl6040_hw_params(struct snd_pcm_substream *substream, | |||
899 | case 88200: | 899 | case 88200: |
900 | /* These rates are not supported when HPPLL is in use */ | 900 | /* These rates are not supported when HPPLL is in use */ |
901 | if (unlikely(priv->pll == TWL6040_SYSCLK_SEL_HPPLL)) { | 901 | if (unlikely(priv->pll == TWL6040_SYSCLK_SEL_HPPLL)) { |
902 | dev_err(codec->dev, "HPPLL does not support rate %d\n", | 902 | dev_err(component->dev, "HPPLL does not support rate %d\n", |
903 | rate); | 903 | rate); |
904 | return -EINVAL; | 904 | return -EINVAL; |
905 | } | 905 | } |
@@ -913,7 +913,7 @@ static int twl6040_hw_params(struct snd_pcm_substream *substream, | |||
913 | priv->sysclk = 19200000; | 913 | priv->sysclk = 19200000; |
914 | break; | 914 | break; |
915 | default: | 915 | default: |
916 | dev_err(codec->dev, "unsupported rate %d\n", rate); | 916 | dev_err(component->dev, "unsupported rate %d\n", rate); |
917 | return -EINVAL; | 917 | return -EINVAL; |
918 | } | 918 | } |
919 | 919 | ||
@@ -923,20 +923,20 @@ static int twl6040_hw_params(struct snd_pcm_substream *substream, | |||
923 | static int twl6040_prepare(struct snd_pcm_substream *substream, | 923 | static int twl6040_prepare(struct snd_pcm_substream *substream, |
924 | struct snd_soc_dai *dai) | 924 | struct snd_soc_dai *dai) |
925 | { | 925 | { |
926 | struct snd_soc_codec *codec = dai->codec; | 926 | struct snd_soc_component *component = dai->component; |
927 | struct twl6040 *twl6040 = to_twl6040(codec); | 927 | struct twl6040 *twl6040 = to_twl6040(component); |
928 | struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); | 928 | struct twl6040_data *priv = snd_soc_component_get_drvdata(component); |
929 | int ret; | 929 | int ret; |
930 | 930 | ||
931 | if (!priv->sysclk) { | 931 | if (!priv->sysclk) { |
932 | dev_err(codec->dev, | 932 | dev_err(component->dev, |
933 | "no mclk configured, call set_sysclk() on init\n"); | 933 | "no mclk configured, call set_sysclk() on init\n"); |
934 | return -EINVAL; | 934 | return -EINVAL; |
935 | } | 935 | } |
936 | 936 | ||
937 | ret = twl6040_set_pll(twl6040, priv->pll, priv->clk_in, priv->sysclk); | 937 | ret = twl6040_set_pll(twl6040, priv->pll, priv->clk_in, priv->sysclk); |
938 | if (ret) { | 938 | if (ret) { |
939 | dev_err(codec->dev, "Can not set PLL (%d)\n", ret); | 939 | dev_err(component->dev, "Can not set PLL (%d)\n", ret); |
940 | return -EPERM; | 940 | return -EPERM; |
941 | } | 941 | } |
942 | 942 | ||
@@ -946,8 +946,8 @@ static int twl6040_prepare(struct snd_pcm_substream *substream, | |||
946 | static int twl6040_set_dai_sysclk(struct snd_soc_dai *codec_dai, | 946 | static int twl6040_set_dai_sysclk(struct snd_soc_dai *codec_dai, |
947 | int clk_id, unsigned int freq, int dir) | 947 | int clk_id, unsigned int freq, int dir) |
948 | { | 948 | { |
949 | struct snd_soc_codec *codec = codec_dai->codec; | 949 | struct snd_soc_component *component = codec_dai->component; |
950 | struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); | 950 | struct twl6040_data *priv = snd_soc_component_get_drvdata(component); |
951 | 951 | ||
952 | switch (clk_id) { | 952 | switch (clk_id) { |
953 | case TWL6040_SYSCLK_SEL_LPPLL: | 953 | case TWL6040_SYSCLK_SEL_LPPLL: |
@@ -956,26 +956,26 @@ static int twl6040_set_dai_sysclk(struct snd_soc_dai *codec_dai, | |||
956 | priv->clk_in = freq; | 956 | priv->clk_in = freq; |
957 | break; | 957 | break; |
958 | default: | 958 | default: |
959 | dev_err(codec->dev, "unknown clk_id %d\n", clk_id); | 959 | dev_err(component->dev, "unknown clk_id %d\n", clk_id); |
960 | return -EINVAL; | 960 | return -EINVAL; |
961 | } | 961 | } |
962 | 962 | ||
963 | return 0; | 963 | return 0; |
964 | } | 964 | } |
965 | 965 | ||
966 | static void twl6040_mute_path(struct snd_soc_codec *codec, enum twl6040_dai_id id, | 966 | static void twl6040_mute_path(struct snd_soc_component *component, enum twl6040_dai_id id, |
967 | int mute) | 967 | int mute) |
968 | { | 968 | { |
969 | struct twl6040 *twl6040 = to_twl6040(codec); | 969 | struct twl6040 *twl6040 = to_twl6040(component); |
970 | struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); | 970 | struct twl6040_data *priv = snd_soc_component_get_drvdata(component); |
971 | int hslctl, hsrctl, earctl; | 971 | int hslctl, hsrctl, earctl; |
972 | int hflctl, hfrctl; | 972 | int hflctl, hfrctl; |
973 | 973 | ||
974 | switch (id) { | 974 | switch (id) { |
975 | case TWL6040_DAI_DL1: | 975 | case TWL6040_DAI_DL1: |
976 | hslctl = twl6040_read(codec, TWL6040_REG_HSLCTL); | 976 | hslctl = twl6040_read(component, TWL6040_REG_HSLCTL); |
977 | hsrctl = twl6040_read(codec, TWL6040_REG_HSRCTL); | 977 | hsrctl = twl6040_read(component, TWL6040_REG_HSRCTL); |
978 | earctl = twl6040_read(codec, TWL6040_REG_EARCTL); | 978 | earctl = twl6040_read(component, TWL6040_REG_EARCTL); |
979 | 979 | ||
980 | if (mute) { | 980 | if (mute) { |
981 | /* Power down drivers and DACs */ | 981 | /* Power down drivers and DACs */ |
@@ -991,8 +991,8 @@ static void twl6040_mute_path(struct snd_soc_codec *codec, enum twl6040_dai_id i | |||
991 | priv->dl1_unmuted = !mute; | 991 | priv->dl1_unmuted = !mute; |
992 | break; | 992 | break; |
993 | case TWL6040_DAI_DL2: | 993 | case TWL6040_DAI_DL2: |
994 | hflctl = twl6040_read(codec, TWL6040_REG_HFLCTL); | 994 | hflctl = twl6040_read(component, TWL6040_REG_HFLCTL); |
995 | hfrctl = twl6040_read(codec, TWL6040_REG_HFRCTL); | 995 | hfrctl = twl6040_read(component, TWL6040_REG_HFRCTL); |
996 | 996 | ||
997 | if (mute) { | 997 | if (mute) { |
998 | /* Power down drivers and DACs */ | 998 | /* Power down drivers and DACs */ |
@@ -1015,12 +1015,12 @@ static int twl6040_digital_mute(struct snd_soc_dai *dai, int mute) | |||
1015 | { | 1015 | { |
1016 | switch (dai->id) { | 1016 | switch (dai->id) { |
1017 | case TWL6040_DAI_LEGACY: | 1017 | case TWL6040_DAI_LEGACY: |
1018 | twl6040_mute_path(dai->codec, TWL6040_DAI_DL1, mute); | 1018 | twl6040_mute_path(dai->component, TWL6040_DAI_DL1, mute); |
1019 | twl6040_mute_path(dai->codec, TWL6040_DAI_DL2, mute); | 1019 | twl6040_mute_path(dai->component, TWL6040_DAI_DL2, mute); |
1020 | break; | 1020 | break; |
1021 | case TWL6040_DAI_DL1: | 1021 | case TWL6040_DAI_DL1: |
1022 | case TWL6040_DAI_DL2: | 1022 | case TWL6040_DAI_DL2: |
1023 | twl6040_mute_path(dai->codec, dai->id, mute); | 1023 | twl6040_mute_path(dai->component, dai->id, mute); |
1024 | break; | 1024 | break; |
1025 | default: | 1025 | default: |
1026 | break; | 1026 | break; |
@@ -1107,23 +1107,23 @@ static struct snd_soc_dai_driver twl6040_dai[] = { | |||
1107 | }, | 1107 | }, |
1108 | }; | 1108 | }; |
1109 | 1109 | ||
1110 | static int twl6040_probe(struct snd_soc_codec *codec) | 1110 | static int twl6040_probe(struct snd_soc_component *component) |
1111 | { | 1111 | { |
1112 | struct twl6040_data *priv; | 1112 | struct twl6040_data *priv; |
1113 | struct platform_device *pdev = to_platform_device(codec->dev); | 1113 | struct platform_device *pdev = to_platform_device(component->dev); |
1114 | int ret = 0; | 1114 | int ret = 0; |
1115 | 1115 | ||
1116 | priv = devm_kzalloc(codec->dev, sizeof(*priv), GFP_KERNEL); | 1116 | priv = devm_kzalloc(component->dev, sizeof(*priv), GFP_KERNEL); |
1117 | if (priv == NULL) | 1117 | if (priv == NULL) |
1118 | return -ENOMEM; | 1118 | return -ENOMEM; |
1119 | 1119 | ||
1120 | snd_soc_codec_set_drvdata(codec, priv); | 1120 | snd_soc_component_set_drvdata(component, priv); |
1121 | 1121 | ||
1122 | priv->codec = codec; | 1122 | priv->component = component; |
1123 | 1123 | ||
1124 | priv->plug_irq = platform_get_irq(pdev, 0); | 1124 | priv->plug_irq = platform_get_irq(pdev, 0); |
1125 | if (priv->plug_irq < 0) { | 1125 | if (priv->plug_irq < 0) { |
1126 | dev_err(codec->dev, "invalid irq: %d\n", priv->plug_irq); | 1126 | dev_err(component->dev, "invalid irq: %d\n", priv->plug_irq); |
1127 | return priv->plug_irq; | 1127 | return priv->plug_irq; |
1128 | } | 1128 | } |
1129 | 1129 | ||
@@ -1134,64 +1134,55 @@ static int twl6040_probe(struct snd_soc_codec *codec) | |||
1134 | ret = request_threaded_irq(priv->plug_irq, NULL, | 1134 | ret = request_threaded_irq(priv->plug_irq, NULL, |
1135 | twl6040_audio_handler, | 1135 | twl6040_audio_handler, |
1136 | IRQF_NO_SUSPEND | IRQF_ONESHOT, | 1136 | IRQF_NO_SUSPEND | IRQF_ONESHOT, |
1137 | "twl6040_irq_plug", codec); | 1137 | "twl6040_irq_plug", component); |
1138 | if (ret) { | 1138 | if (ret) { |
1139 | dev_err(codec->dev, "PLUG IRQ request failed: %d\n", ret); | 1139 | dev_err(component->dev, "PLUG IRQ request failed: %d\n", ret); |
1140 | return ret; | 1140 | return ret; |
1141 | } | 1141 | } |
1142 | 1142 | ||
1143 | snd_soc_codec_force_bias_level(codec, SND_SOC_BIAS_STANDBY); | 1143 | snd_soc_component_force_bias_level(component, SND_SOC_BIAS_STANDBY); |
1144 | twl6040_init_chip(codec); | 1144 | twl6040_init_chip(component); |
1145 | 1145 | ||
1146 | return 0; | 1146 | return 0; |
1147 | } | 1147 | } |
1148 | 1148 | ||
1149 | static int twl6040_remove(struct snd_soc_codec *codec) | 1149 | static void twl6040_remove(struct snd_soc_component *component) |
1150 | { | 1150 | { |
1151 | struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); | 1151 | struct twl6040_data *priv = snd_soc_component_get_drvdata(component); |
1152 | 1152 | ||
1153 | free_irq(priv->plug_irq, codec); | 1153 | free_irq(priv->plug_irq, component); |
1154 | |||
1155 | return 0; | ||
1156 | } | 1154 | } |
1157 | 1155 | ||
1158 | static const struct snd_soc_codec_driver soc_codec_dev_twl6040 = { | 1156 | static const struct snd_soc_component_driver soc_component_dev_twl6040 = { |
1159 | .probe = twl6040_probe, | 1157 | .probe = twl6040_probe, |
1160 | .remove = twl6040_remove, | 1158 | .remove = twl6040_remove, |
1161 | .read = twl6040_read, | 1159 | .read = twl6040_read, |
1162 | .write = twl6040_write, | 1160 | .remove = twl6040_remove, |
1163 | .set_bias_level = twl6040_set_bias_level, | 1161 | .set_bias_level = twl6040_set_bias_level, |
1164 | .suspend_bias_off = true, | 1162 | .controls = twl6040_snd_controls, |
1165 | .ignore_pmdown_time = true, | 1163 | .num_controls = ARRAY_SIZE(twl6040_snd_controls), |
1166 | 1164 | .dapm_widgets = twl6040_dapm_widgets, | |
1167 | .component_driver = { | 1165 | .num_dapm_widgets = ARRAY_SIZE(twl6040_dapm_widgets), |
1168 | .controls = twl6040_snd_controls, | 1166 | .dapm_routes = intercon, |
1169 | .num_controls = ARRAY_SIZE(twl6040_snd_controls), | 1167 | .num_dapm_routes = ARRAY_SIZE(intercon), |
1170 | .dapm_widgets = twl6040_dapm_widgets, | 1168 | .suspend_bias_off = 1, |
1171 | .num_dapm_widgets = ARRAY_SIZE(twl6040_dapm_widgets), | 1169 | .idle_bias_on = 1, |
1172 | .dapm_routes = intercon, | 1170 | .endianness = 1, |
1173 | .num_dapm_routes = ARRAY_SIZE(intercon), | 1171 | .non_legacy_dai_naming = 1, |
1174 | }, | ||
1175 | }; | 1172 | }; |
1176 | 1173 | ||
1177 | static int twl6040_codec_probe(struct platform_device *pdev) | 1174 | static int twl6040_codec_probe(struct platform_device *pdev) |
1178 | { | 1175 | { |
1179 | return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_twl6040, | 1176 | return devm_snd_soc_register_component(&pdev->dev, |
1177 | &soc_component_dev_twl6040, | ||
1180 | twl6040_dai, ARRAY_SIZE(twl6040_dai)); | 1178 | twl6040_dai, ARRAY_SIZE(twl6040_dai)); |
1181 | } | 1179 | } |
1182 | 1180 | ||
1183 | static int twl6040_codec_remove(struct platform_device *pdev) | ||
1184 | { | ||
1185 | snd_soc_unregister_codec(&pdev->dev); | ||
1186 | return 0; | ||
1187 | } | ||
1188 | |||
1189 | static struct platform_driver twl6040_codec_driver = { | 1181 | static struct platform_driver twl6040_codec_driver = { |
1190 | .driver = { | 1182 | .driver = { |
1191 | .name = "twl6040-codec", | 1183 | .name = "twl6040-codec", |
1192 | }, | 1184 | }, |
1193 | .probe = twl6040_codec_probe, | 1185 | .probe = twl6040_codec_probe, |
1194 | .remove = twl6040_codec_remove, | ||
1195 | }; | 1186 | }; |
1196 | 1187 | ||
1197 | module_platform_driver(twl6040_codec_driver); | 1188 | module_platform_driver(twl6040_codec_driver); |
diff --git a/sound/soc/codecs/twl6040.h b/sound/soc/codecs/twl6040.h index 0611406ca7c0..3d9f957077ef 100644 --- a/sound/soc/codecs/twl6040.h +++ b/sound/soc/codecs/twl6040.h | |||
@@ -34,11 +34,11 @@ enum twl6040_trim { | |||
34 | #define TWL6040_HSF_TRIM_LEFT(x) (x & 0x0f) | 34 | #define TWL6040_HSF_TRIM_LEFT(x) (x & 0x0f) |
35 | #define TWL6040_HSF_TRIM_RIGHT(x) ((x >> 4) & 0x0f) | 35 | #define TWL6040_HSF_TRIM_RIGHT(x) ((x >> 4) & 0x0f) |
36 | 36 | ||
37 | int twl6040_get_dl1_gain(struct snd_soc_codec *codec); | 37 | int twl6040_get_dl1_gain(struct snd_soc_component *component); |
38 | void twl6040_hs_jack_detect(struct snd_soc_codec *codec, | 38 | void twl6040_hs_jack_detect(struct snd_soc_component *component, |
39 | struct snd_soc_jack *jack, int report); | 39 | struct snd_soc_jack *jack, int report); |
40 | int twl6040_get_clk_id(struct snd_soc_codec *codec); | 40 | int twl6040_get_clk_id(struct snd_soc_component *component); |
41 | int twl6040_get_trim_value(struct snd_soc_codec *codec, enum twl6040_trim trim); | 41 | int twl6040_get_trim_value(struct snd_soc_component *component, enum twl6040_trim trim); |
42 | int twl6040_get_hs_step_size(struct snd_soc_codec *codec); | 42 | int twl6040_get_hs_step_size(struct snd_soc_component *component); |
43 | 43 | ||
44 | #endif /* End of __TWL6040_H__ */ | 44 | #endif /* End of __TWL6040_H__ */ |
diff --git a/sound/soc/omap/omap-abe-twl6040.c b/sound/soc/omap/omap-abe-twl6040.c index 614b18d2f631..15ccbf479c96 100644 --- a/sound/soc/omap/omap-abe-twl6040.c +++ b/sound/soc/omap/omap-abe-twl6040.c | |||
@@ -52,7 +52,7 @@ static int omap_abe_hw_params(struct snd_pcm_substream *substream, | |||
52 | int clk_id, freq; | 52 | int clk_id, freq; |
53 | int ret; | 53 | int ret; |
54 | 54 | ||
55 | clk_id = twl6040_get_clk_id(rtd->codec); | 55 | clk_id = twl6040_get_clk_id(codec_dai->component); |
56 | if (clk_id == TWL6040_SYSCLK_SEL_HPPLL) | 56 | if (clk_id == TWL6040_SYSCLK_SEL_HPPLL) |
57 | freq = priv->mclk_freq; | 57 | freq = priv->mclk_freq; |
58 | else if (clk_id == TWL6040_SYSCLK_SEL_LPPLL) | 58 | else if (clk_id == TWL6040_SYSCLK_SEL_LPPLL) |
@@ -166,7 +166,7 @@ static const struct snd_soc_dapm_route audio_map[] = { | |||
166 | 166 | ||
167 | static int omap_abe_twl6040_init(struct snd_soc_pcm_runtime *rtd) | 167 | static int omap_abe_twl6040_init(struct snd_soc_pcm_runtime *rtd) |
168 | { | 168 | { |
169 | struct snd_soc_codec *codec = rtd->codec; | 169 | struct snd_soc_component *component = rtd->codec_dai->component; |
170 | struct snd_soc_card *card = rtd->card; | 170 | struct snd_soc_card *card = rtd->card; |
171 | struct abe_twl6040 *priv = snd_soc_card_get_drvdata(card); | 171 | struct abe_twl6040 *priv = snd_soc_card_get_drvdata(card); |
172 | int hs_trim; | 172 | int hs_trim; |
@@ -176,7 +176,7 @@ static int omap_abe_twl6040_init(struct snd_soc_pcm_runtime *rtd) | |||
176 | * Configure McPDM offset cancellation based on the HSOTRIM value from | 176 | * Configure McPDM offset cancellation based on the HSOTRIM value from |
177 | * twl6040. | 177 | * twl6040. |
178 | */ | 178 | */ |
179 | hs_trim = twl6040_get_trim_value(codec, TWL6040_TRIM_HSOTRIM); | 179 | hs_trim = twl6040_get_trim_value(component, TWL6040_TRIM_HSOTRIM); |
180 | omap_mcpdm_configure_dn_offsets(rtd, TWL6040_HSF_TRIM_LEFT(hs_trim), | 180 | omap_mcpdm_configure_dn_offsets(rtd, TWL6040_HSF_TRIM_LEFT(hs_trim), |
181 | TWL6040_HSF_TRIM_RIGHT(hs_trim)); | 181 | TWL6040_HSF_TRIM_RIGHT(hs_trim)); |
182 | 182 | ||
@@ -189,7 +189,7 @@ static int omap_abe_twl6040_init(struct snd_soc_pcm_runtime *rtd) | |||
189 | if (ret) | 189 | if (ret) |
190 | return ret; | 190 | return ret; |
191 | 191 | ||
192 | twl6040_hs_jack_detect(codec, &hs_jack, SND_JACK_HEADSET); | 192 | twl6040_hs_jack_detect(component, &hs_jack, SND_JACK_HEADSET); |
193 | } | 193 | } |
194 | 194 | ||
195 | return 0; | 195 | return 0; |