aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sound/soc/codecs/cx20442.c89
-rw-r--r--sound/soc/omap/ams-delta.c20
2 files changed, 51 insertions, 58 deletions
diff --git a/sound/soc/codecs/cx20442.c b/sound/soc/codecs/cx20442.c
index 95bb10ba80dc..07dd33b09596 100644
--- a/sound/soc/codecs/cx20442.c
+++ b/sound/soc/codecs/cx20442.c
@@ -89,10 +89,10 @@ static const struct snd_soc_dapm_route cx20442_audio_map[] = {
89 {"ADC", NULL, "Input Mixer"}, 89 {"ADC", NULL, "Input Mixer"},
90}; 90};
91 91
92static unsigned int cx20442_read_reg_cache(struct snd_soc_codec *codec, 92static unsigned int cx20442_read_reg_cache(struct snd_soc_component *component,
93 unsigned int reg) 93 unsigned int reg)
94{ 94{
95 struct cx20442_priv *cx20442 = snd_soc_codec_get_drvdata(codec); 95 struct cx20442_priv *cx20442 = snd_soc_component_get_drvdata(component);
96 96
97 if (reg >= 1) 97 if (reg >= 1)
98 return -EINVAL; 98 return -EINVAL;
@@ -153,10 +153,10 @@ static int cx20442_pm_to_v253_vsp(u8 value)
153 return (value & (1 << CX20442_AGC)) ? -EINVAL : 0; 153 return (value & (1 << CX20442_AGC)) ? -EINVAL : 0;
154} 154}
155 155
156static int cx20442_write(struct snd_soc_codec *codec, unsigned int reg, 156static int cx20442_write(struct snd_soc_component *component, unsigned int reg,
157 unsigned int value) 157 unsigned int value)
158{ 158{
159 struct cx20442_priv *cx20442 = snd_soc_codec_get_drvdata(codec); 159 struct cx20442_priv *cx20442 = snd_soc_component_get_drvdata(component);
160 int vls, vsp, old, len; 160 int vls, vsp, old, len;
161 char buf[18]; 161 char buf[18];
162 162
@@ -193,7 +193,7 @@ static int cx20442_write(struct snd_soc_codec *codec, unsigned int reg,
193 if (unlikely(len > (ARRAY_SIZE(buf) - 1))) 193 if (unlikely(len > (ARRAY_SIZE(buf) - 1)))
194 return -ENOMEM; 194 return -ENOMEM;
195 195
196 dev_dbg(codec->dev, "%s: %s\n", __func__, buf); 196 dev_dbg(component->dev, "%s: %s\n", __func__, buf);
197 if (cx20442->tty->ops->write(cx20442->tty, buf, len) != len) 197 if (cx20442->tty->ops->write(cx20442->tty, buf, len) != len)
198 return -EIO; 198 return -EIO;
199 199
@@ -240,19 +240,19 @@ err:
240/* Line discipline .close() */ 240/* Line discipline .close() */
241static void v253_close(struct tty_struct *tty) 241static void v253_close(struct tty_struct *tty)
242{ 242{
243 struct snd_soc_codec *codec = tty->disc_data; 243 struct snd_soc_component *component = tty->disc_data;
244 struct cx20442_priv *cx20442; 244 struct cx20442_priv *cx20442;
245 245
246 tty->disc_data = NULL; 246 tty->disc_data = NULL;
247 247
248 if (!codec) 248 if (!component)
249 return; 249 return;
250 250
251 cx20442 = snd_soc_codec_get_drvdata(codec); 251 cx20442 = snd_soc_component_get_drvdata(component);
252 252
253 /* Prevent the codec driver from further accessing the modem */ 253 /* Prevent the codec driver from further accessing the modem */
254 cx20442->tty = NULL; 254 cx20442->tty = NULL;
255 codec->component.card->pop_time = 0; 255 component->card->pop_time = 0;
256} 256}
257 257
258/* Line discipline .hangup() */ 258/* Line discipline .hangup() */
@@ -266,20 +266,20 @@ static int v253_hangup(struct tty_struct *tty)
266static void v253_receive(struct tty_struct *tty, 266static void v253_receive(struct tty_struct *tty,
267 const unsigned char *cp, char *fp, int count) 267 const unsigned char *cp, char *fp, int count)
268{ 268{
269 struct snd_soc_codec *codec = tty->disc_data; 269 struct snd_soc_component *component = tty->disc_data;
270 struct cx20442_priv *cx20442; 270 struct cx20442_priv *cx20442;
271 271
272 if (!codec) 272 if (!component)
273 return; 273 return;
274 274
275 cx20442 = snd_soc_codec_get_drvdata(codec); 275 cx20442 = snd_soc_component_get_drvdata(component);
276 276
277 if (!cx20442->tty) { 277 if (!cx20442->tty) {
278 /* First modem response, complete setup procedure */ 278 /* First modem response, complete setup procedure */
279 279
280 /* Set up codec driver access to modem controls */ 280 /* Set up codec driver access to modem controls */
281 cx20442->tty = tty; 281 cx20442->tty = tty;
282 codec->component.card->pop_time = 1; 282 component->card->pop_time = 1;
283 } 283 }
284} 284}
285 285
@@ -323,15 +323,15 @@ static struct snd_soc_dai_driver cx20442_dai = {
323 }, 323 },
324}; 324};
325 325
326static int cx20442_set_bias_level(struct snd_soc_codec *codec, 326static int cx20442_set_bias_level(struct snd_soc_component *component,
327 enum snd_soc_bias_level level) 327 enum snd_soc_bias_level level)
328{ 328{
329 struct cx20442_priv *cx20442 = snd_soc_codec_get_drvdata(codec); 329 struct cx20442_priv *cx20442 = snd_soc_component_get_drvdata(component);
330 int err = 0; 330 int err = 0;
331 331
332 switch (level) { 332 switch (level) {
333 case SND_SOC_BIAS_PREPARE: 333 case SND_SOC_BIAS_PREPARE:
334 if (snd_soc_codec_get_bias_level(codec) != SND_SOC_BIAS_STANDBY) 334 if (snd_soc_component_get_bias_level(component) != SND_SOC_BIAS_STANDBY)
335 break; 335 break;
336 if (IS_ERR(cx20442->por)) 336 if (IS_ERR(cx20442->por))
337 err = PTR_ERR(cx20442->por); 337 err = PTR_ERR(cx20442->por);
@@ -339,7 +339,7 @@ static int cx20442_set_bias_level(struct snd_soc_codec *codec,
339 err = regulator_enable(cx20442->por); 339 err = regulator_enable(cx20442->por);
340 break; 340 break;
341 case SND_SOC_BIAS_STANDBY: 341 case SND_SOC_BIAS_STANDBY:
342 if (snd_soc_codec_get_bias_level(codec) != SND_SOC_BIAS_PREPARE) 342 if (snd_soc_component_get_bias_level(component) != SND_SOC_BIAS_PREPARE)
343 break; 343 break;
344 if (IS_ERR(cx20442->por)) 344 if (IS_ERR(cx20442->por))
345 err = PTR_ERR(cx20442->por); 345 err = PTR_ERR(cx20442->por);
@@ -353,7 +353,7 @@ static int cx20442_set_bias_level(struct snd_soc_codec *codec,
353 return err; 353 return err;
354} 354}
355 355
356static int cx20442_codec_probe(struct snd_soc_codec *codec) 356static int cx20442_component_probe(struct snd_soc_component *component)
357{ 357{
358 struct cx20442_priv *cx20442; 358 struct cx20442_priv *cx20442;
359 359
@@ -361,21 +361,21 @@ static int cx20442_codec_probe(struct snd_soc_codec *codec)
361 if (cx20442 == NULL) 361 if (cx20442 == NULL)
362 return -ENOMEM; 362 return -ENOMEM;
363 363
364 cx20442->por = regulator_get(codec->dev, "POR"); 364 cx20442->por = regulator_get(component->dev, "POR");
365 if (IS_ERR(cx20442->por)) 365 if (IS_ERR(cx20442->por))
366 dev_warn(codec->dev, "failed to get the regulator"); 366 dev_warn(component->dev, "failed to get the regulator");
367 cx20442->tty = NULL; 367 cx20442->tty = NULL;
368 368
369 snd_soc_codec_set_drvdata(codec, cx20442); 369 snd_soc_component_set_drvdata(component, cx20442);
370 codec->component.card->pop_time = 0; 370 component->card->pop_time = 0;
371 371
372 return 0; 372 return 0;
373} 373}
374 374
375/* power down chip */ 375/* power down chip */
376static int cx20442_codec_remove(struct snd_soc_codec *codec) 376static void cx20442_component_remove(struct snd_soc_component *component)
377{ 377{
378 struct cx20442_priv *cx20442 = snd_soc_codec_get_drvdata(codec); 378 struct cx20442_priv *cx20442 = snd_soc_component_get_drvdata(component);
379 379
380 if (cx20442->tty) { 380 if (cx20442->tty) {
381 struct tty_struct *tty = cx20442->tty; 381 struct tty_struct *tty = cx20442->tty;
@@ -387,36 +387,30 @@ static int cx20442_codec_remove(struct snd_soc_codec *codec)
387 regulator_put(cx20442->por); 387 regulator_put(cx20442->por);
388 } 388 }
389 389
390 snd_soc_codec_set_drvdata(codec, NULL); 390 snd_soc_component_set_drvdata(component, NULL);
391 kfree(cx20442); 391 kfree(cx20442);
392 return 0;
393} 392}
394 393
395static const struct snd_soc_codec_driver cx20442_codec_dev = { 394static const struct snd_soc_component_driver cx20442_component_dev = {
396 .probe = cx20442_codec_probe, 395 .probe = cx20442_component_probe,
397 .remove = cx20442_codec_remove, 396 .remove = cx20442_component_remove,
398 .set_bias_level = cx20442_set_bias_level, 397 .set_bias_level = cx20442_set_bias_level,
399 .read = cx20442_read_reg_cache, 398 .read = cx20442_read_reg_cache,
400 .write = cx20442_write, 399 .write = cx20442_write,
401 400 .dapm_widgets = cx20442_dapm_widgets,
402 .component_driver = { 401 .num_dapm_widgets = ARRAY_SIZE(cx20442_dapm_widgets),
403 .dapm_widgets = cx20442_dapm_widgets, 402 .dapm_routes = cx20442_audio_map,
404 .num_dapm_widgets = ARRAY_SIZE(cx20442_dapm_widgets), 403 .num_dapm_routes = ARRAY_SIZE(cx20442_audio_map),
405 .dapm_routes = cx20442_audio_map, 404 .idle_bias_on = 1,
406 .num_dapm_routes = ARRAY_SIZE(cx20442_audio_map), 405 .use_pmdown_time = 1,
407 }, 406 .endianness = 1,
407 .non_legacy_dai_naming = 1,
408}; 408};
409 409
410static int cx20442_platform_probe(struct platform_device *pdev) 410static int cx20442_platform_probe(struct platform_device *pdev)
411{ 411{
412 return snd_soc_register_codec(&pdev->dev, 412 return devm_snd_soc_register_component(&pdev->dev,
413 &cx20442_codec_dev, &cx20442_dai, 1); 413 &cx20442_component_dev, &cx20442_dai, 1);
414}
415
416static int cx20442_platform_remove(struct platform_device *pdev)
417{
418 snd_soc_unregister_codec(&pdev->dev);
419 return 0;
420} 414}
421 415
422static struct platform_driver cx20442_platform_driver = { 416static struct platform_driver cx20442_platform_driver = {
@@ -424,7 +418,6 @@ static struct platform_driver cx20442_platform_driver = {
424 .name = "cx20442-codec", 418 .name = "cx20442-codec",
425 }, 419 },
426 .probe = cx20442_platform_probe, 420 .probe = cx20442_platform_probe,
427 .remove = cx20442_platform_remove,
428}; 421};
429 422
430module_platform_driver(cx20442_platform_driver); 423module_platform_driver(cx20442_platform_driver);
diff --git a/sound/soc/omap/ams-delta.c b/sound/soc/omap/ams-delta.c
index cb72c1e57da0..77a30f0f0c96 100644
--- a/sound/soc/omap/ams-delta.c
+++ b/sound/soc/omap/ams-delta.c
@@ -93,7 +93,7 @@ static unsigned short ams_delta_audio_agc;
93 * Used for passing a codec structure pointer 93 * Used for passing a codec structure pointer
94 * from the board initialization code to the tty line discipline. 94 * from the board initialization code to the tty line discipline.
95 */ 95 */
96static struct snd_soc_codec *cx20442_codec; 96static struct snd_soc_component *cx20442_codec;
97 97
98static int ams_delta_set_audio_mode(struct snd_kcontrol *kcontrol, 98static int ams_delta_set_audio_mode(struct snd_kcontrol *kcontrol,
99 struct snd_ctl_elem_value *ucontrol) 99 struct snd_ctl_elem_value *ucontrol)
@@ -105,7 +105,7 @@ static int ams_delta_set_audio_mode(struct snd_kcontrol *kcontrol,
105 int pin, changed = 0; 105 int pin, changed = 0;
106 106
107 /* Refuse any mode changes if we are not able to control the codec. */ 107 /* Refuse any mode changes if we are not able to control the codec. */
108 if (!cx20442_codec->component.card->pop_time) 108 if (!cx20442_codec->card->pop_time)
109 return -EUNATCH; 109 return -EUNATCH;
110 110
111 if (ucontrol->value.enumerated.item[0] >= control->items) 111 if (ucontrol->value.enumerated.item[0] >= control->items)
@@ -300,15 +300,15 @@ static int cx81801_open(struct tty_struct *tty)
300/* Line discipline .close() */ 300/* Line discipline .close() */
301static void cx81801_close(struct tty_struct *tty) 301static void cx81801_close(struct tty_struct *tty)
302{ 302{
303 struct snd_soc_codec *codec = tty->disc_data; 303 struct snd_soc_component *component = tty->disc_data;
304 struct snd_soc_dapm_context *dapm = &codec->component.card->dapm; 304 struct snd_soc_dapm_context *dapm = &component->card->dapm;
305 305
306 del_timer_sync(&cx81801_timer); 306 del_timer_sync(&cx81801_timer);
307 307
308 /* Prevent the hook switch from further changing the DAPM pins */ 308 /* Prevent the hook switch from further changing the DAPM pins */
309 INIT_LIST_HEAD(&ams_delta_hook_switch.pins); 309 INIT_LIST_HEAD(&ams_delta_hook_switch.pins);
310 310
311 if (!codec) 311 if (!component)
312 return; 312 return;
313 313
314 v253_ops.close(tty); 314 v253_ops.close(tty);
@@ -338,14 +338,14 @@ static int cx81801_hangup(struct tty_struct *tty)
338static void cx81801_receive(struct tty_struct *tty, 338static void cx81801_receive(struct tty_struct *tty,
339 const unsigned char *cp, char *fp, int count) 339 const unsigned char *cp, char *fp, int count)
340{ 340{
341 struct snd_soc_codec *codec = tty->disc_data; 341 struct snd_soc_component *component = tty->disc_data;
342 const unsigned char *c; 342 const unsigned char *c;
343 int apply, ret; 343 int apply, ret;
344 344
345 if (!codec) 345 if (!component)
346 return; 346 return;
347 347
348 if (!codec->component.card->pop_time) { 348 if (!component->card->pop_time) {
349 /* First modem response, complete setup procedure */ 349 /* First modem response, complete setup procedure */
350 350
351 /* Initialize timer used for config pulse generation */ 351 /* Initialize timer used for config pulse generation */
@@ -358,7 +358,7 @@ static void cx81801_receive(struct tty_struct *tty,
358 ARRAY_SIZE(ams_delta_hook_switch_pins), 358 ARRAY_SIZE(ams_delta_hook_switch_pins),
359 ams_delta_hook_switch_pins); 359 ams_delta_hook_switch_pins);
360 if (ret) 360 if (ret)
361 dev_warn(codec->dev, 361 dev_warn(component->dev,
362 "Failed to link hook switch to DAPM pins, " 362 "Failed to link hook switch to DAPM pins, "
363 "will continue with hook switch unlinked.\n"); 363 "will continue with hook switch unlinked.\n");
364 364
@@ -467,7 +467,7 @@ static int ams_delta_cx20442_init(struct snd_soc_pcm_runtime *rtd)
467 /* Codec is ready, now add/activate board specific controls */ 467 /* Codec is ready, now add/activate board specific controls */
468 468
469 /* Store a pointer to the codec structure for tty ldisc use */ 469 /* Store a pointer to the codec structure for tty ldisc use */
470 cx20442_codec = rtd->codec; 470 cx20442_codec = rtd->codec_dai->component;
471 471
472 /* Set up digital mute if not provided by the codec */ 472 /* Set up digital mute if not provided by the codec */
473 if (!codec_dai->driver->ops) { 473 if (!codec_dai->driver->ops) {