aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/88pm860x-codec.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/codecs/88pm860x-codec.c')
-rw-r--r--sound/soc/codecs/88pm860x-codec.c38
1 files changed, 13 insertions, 25 deletions
diff --git a/sound/soc/codecs/88pm860x-codec.c b/sound/soc/codecs/88pm860x-codec.c
index 5ca122e5118..9fd3b6827bb 100644
--- a/sound/soc/codecs/88pm860x-codec.c
+++ b/sound/soc/codecs/88pm860x-codec.c
@@ -861,7 +861,7 @@ static const struct snd_soc_dapm_widget pm860x_dapm_widgets[] = {
861 PM860X_DAPM_OUTPUT("RSYNC", pm860x_rsync_event), 861 PM860X_DAPM_OUTPUT("RSYNC", pm860x_rsync_event),
862}; 862};
863 863
864static const struct snd_soc_dapm_route audio_map[] = { 864static const struct snd_soc_dapm_route pm860x_dapm_routes[] = {
865 /* supply */ 865 /* supply */
866 {"Left DAC", NULL, "VCODEC"}, 866 {"Left DAC", NULL, "VCODEC"},
867 {"Right DAC", NULL, "VCODEC"}, 867 {"Right DAC", NULL, "VCODEC"},
@@ -1198,14 +1198,14 @@ static int pm860x_set_bias_level(struct snd_soc_codec *codec,
1198 return 0; 1198 return 0;
1199} 1199}
1200 1200
1201static struct snd_soc_dai_ops pm860x_pcm_dai_ops = { 1201static const struct snd_soc_dai_ops pm860x_pcm_dai_ops = {
1202 .digital_mute = pm860x_digital_mute, 1202 .digital_mute = pm860x_digital_mute,
1203 .hw_params = pm860x_pcm_hw_params, 1203 .hw_params = pm860x_pcm_hw_params,
1204 .set_fmt = pm860x_pcm_set_dai_fmt, 1204 .set_fmt = pm860x_pcm_set_dai_fmt,
1205 .set_sysclk = pm860x_set_dai_sysclk, 1205 .set_sysclk = pm860x_set_dai_sysclk,
1206}; 1206};
1207 1207
1208static struct snd_soc_dai_ops pm860x_i2s_dai_ops = { 1208static const struct snd_soc_dai_ops pm860x_i2s_dai_ops = {
1209 .digital_mute = pm860x_digital_mute, 1209 .digital_mute = pm860x_digital_mute,
1210 .hw_params = pm860x_i2s_hw_params, 1210 .hw_params = pm860x_i2s_hw_params,
1211 .set_fmt = pm860x_i2s_set_dai_fmt, 1211 .set_fmt = pm860x_i2s_set_dai_fmt,
@@ -1361,7 +1361,6 @@ EXPORT_SYMBOL_GPL(pm860x_mic_jack_detect);
1361static int pm860x_probe(struct snd_soc_codec *codec) 1361static int pm860x_probe(struct snd_soc_codec *codec)
1362{ 1362{
1363 struct pm860x_priv *pm860x = snd_soc_codec_get_drvdata(codec); 1363 struct pm860x_priv *pm860x = snd_soc_codec_get_drvdata(codec);
1364 struct snd_soc_dapm_context *dapm = &codec->dapm;
1365 int i, ret; 1364 int i, ret;
1366 1365
1367 pm860x->codec = codec; 1366 pm860x->codec = codec;
@@ -1388,11 +1387,6 @@ static int pm860x_probe(struct snd_soc_codec *codec)
1388 goto out; 1387 goto out;
1389 } 1388 }
1390 1389
1391 snd_soc_add_controls(codec, pm860x_snd_controls,
1392 ARRAY_SIZE(pm860x_snd_controls));
1393 snd_soc_dapm_new_controls(dapm, pm860x_dapm_widgets,
1394 ARRAY_SIZE(pm860x_dapm_widgets));
1395 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
1396 return 0; 1390 return 0;
1397 1391
1398out: 1392out:
@@ -1420,6 +1414,13 @@ static struct snd_soc_codec_driver soc_codec_dev_pm860x = {
1420 .reg_cache_size = REG_CACHE_SIZE, 1414 .reg_cache_size = REG_CACHE_SIZE,
1421 .reg_word_size = sizeof(u8), 1415 .reg_word_size = sizeof(u8),
1422 .set_bias_level = pm860x_set_bias_level, 1416 .set_bias_level = pm860x_set_bias_level,
1417
1418 .controls = pm860x_snd_controls,
1419 .num_controls = ARRAY_SIZE(pm860x_snd_controls),
1420 .dapm_widgets = pm860x_dapm_widgets,
1421 .num_dapm_widgets = ARRAY_SIZE(pm860x_dapm_widgets),
1422 .dapm_routes = pm860x_dapm_routes,
1423 .num_dapm_routes = ARRAY_SIZE(pm860x_dapm_routes),
1423}; 1424};
1424 1425
1425static int __devinit pm860x_codec_probe(struct platform_device *pdev) 1426static int __devinit pm860x_codec_probe(struct platform_device *pdev)
@@ -1429,7 +1430,8 @@ static int __devinit pm860x_codec_probe(struct platform_device *pdev)
1429 struct resource *res; 1430 struct resource *res;
1430 int i, ret; 1431 int i, ret;
1431 1432
1432 pm860x = kzalloc(sizeof(struct pm860x_priv), GFP_KERNEL); 1433 pm860x = devm_kzalloc(&pdev->dev, sizeof(struct pm860x_priv),
1434 GFP_KERNEL);
1433 if (pm860x == NULL) 1435 if (pm860x == NULL)
1434 return -ENOMEM; 1436 return -ENOMEM;
1435 1437
@@ -1458,17 +1460,13 @@ static int __devinit pm860x_codec_probe(struct platform_device *pdev)
1458 1460
1459out: 1461out:
1460 platform_set_drvdata(pdev, NULL); 1462 platform_set_drvdata(pdev, NULL);
1461 kfree(pm860x);
1462 return -EINVAL; 1463 return -EINVAL;
1463} 1464}
1464 1465
1465static int __devexit pm860x_codec_remove(struct platform_device *pdev) 1466static int __devexit pm860x_codec_remove(struct platform_device *pdev)
1466{ 1467{
1467 struct pm860x_priv *pm860x = platform_get_drvdata(pdev);
1468
1469 snd_soc_unregister_codec(&pdev->dev); 1468 snd_soc_unregister_codec(&pdev->dev);
1470 platform_set_drvdata(pdev, NULL); 1469 platform_set_drvdata(pdev, NULL);
1471 kfree(pm860x);
1472 return 0; 1470 return 0;
1473} 1471}
1474 1472
@@ -1481,17 +1479,7 @@ static struct platform_driver pm860x_codec_driver = {
1481 .remove = __devexit_p(pm860x_codec_remove), 1479 .remove = __devexit_p(pm860x_codec_remove),
1482}; 1480};
1483 1481
1484static __init int pm860x_init(void) 1482module_platform_driver(pm860x_codec_driver);
1485{
1486 return platform_driver_register(&pm860x_codec_driver);
1487}
1488module_init(pm860x_init);
1489
1490static __exit void pm860x_exit(void)
1491{
1492 platform_driver_unregister(&pm860x_codec_driver);
1493}
1494module_exit(pm860x_exit);
1495 1483
1496MODULE_DESCRIPTION("ASoC 88PM860x driver"); 1484MODULE_DESCRIPTION("ASoC 88PM860x driver");
1497MODULE_AUTHOR("Haojian Zhuang <haojian.zhuang@marvell.com>"); 1485MODULE_AUTHOR("Haojian Zhuang <haojian.zhuang@marvell.com>");