diff options
Diffstat (limited to 'sound/soc/codecs/ak4641.c')
-rw-r--r-- | sound/soc/codecs/ak4641.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/sound/soc/codecs/ak4641.c b/sound/soc/codecs/ak4641.c index 77838586f358..c4d165a4bddf 100644 --- a/sound/soc/codecs/ak4641.c +++ b/sound/soc/codecs/ak4641.c | |||
@@ -17,7 +17,6 @@ | |||
17 | #include <linux/gpio.h> | 17 | #include <linux/gpio.h> |
18 | #include <linux/pm.h> | 18 | #include <linux/pm.h> |
19 | #include <linux/i2c.h> | 19 | #include <linux/i2c.h> |
20 | #include <linux/platform_device.h> | ||
21 | #include <linux/slab.h> | 20 | #include <linux/slab.h> |
22 | #include <sound/core.h> | 21 | #include <sound/core.h> |
23 | #include <sound/pcm.h> | 22 | #include <sound/pcm.h> |
@@ -340,6 +339,7 @@ static int ak4641_pcm_set_dai_fmt(struct snd_soc_dai *codec_dai, | |||
340 | { | 339 | { |
341 | struct snd_soc_codec *codec = codec_dai->codec; | 340 | struct snd_soc_codec *codec = codec_dai->codec; |
342 | u8 btif; | 341 | u8 btif; |
342 | int ret; | ||
343 | 343 | ||
344 | /* interface format */ | 344 | /* interface format */ |
345 | switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { | 345 | switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { |
@@ -359,7 +359,11 @@ static int ak4641_pcm_set_dai_fmt(struct snd_soc_dai *codec_dai, | |||
359 | return -EINVAL; | 359 | return -EINVAL; |
360 | } | 360 | } |
361 | 361 | ||
362 | return snd_soc_update_bits(codec, AK4641_BTIF, (0x3 << 5), btif); | 362 | ret = snd_soc_update_bits(codec, AK4641_BTIF, (0x3 << 5), btif); |
363 | if (ret < 0) | ||
364 | return ret; | ||
365 | |||
366 | return 0; | ||
363 | } | 367 | } |
364 | 368 | ||
365 | static int ak4641_i2s_set_dai_fmt(struct snd_soc_dai *codec_dai, | 369 | static int ak4641_i2s_set_dai_fmt(struct snd_soc_dai *codec_dai, |
@@ -442,14 +446,14 @@ static int ak4641_set_bias_level(struct snd_soc_codec *codec, | |||
442 | SNDRV_PCM_RATE_16000) | 446 | SNDRV_PCM_RATE_16000) |
443 | #define AK4641_FORMATS (SNDRV_PCM_FMTBIT_S16_LE) | 447 | #define AK4641_FORMATS (SNDRV_PCM_FMTBIT_S16_LE) |
444 | 448 | ||
445 | static struct snd_soc_dai_ops ak4641_i2s_dai_ops = { | 449 | static const struct snd_soc_dai_ops ak4641_i2s_dai_ops = { |
446 | .hw_params = ak4641_i2s_hw_params, | 450 | .hw_params = ak4641_i2s_hw_params, |
447 | .set_fmt = ak4641_i2s_set_dai_fmt, | 451 | .set_fmt = ak4641_i2s_set_dai_fmt, |
448 | .digital_mute = ak4641_mute, | 452 | .digital_mute = ak4641_mute, |
449 | .set_sysclk = ak4641_set_dai_sysclk, | 453 | .set_sysclk = ak4641_set_dai_sysclk, |
450 | }; | 454 | }; |
451 | 455 | ||
452 | static struct snd_soc_dai_ops ak4641_pcm_dai_ops = { | 456 | static const struct snd_soc_dai_ops ak4641_pcm_dai_ops = { |
453 | .hw_params = NULL, /* rates are controlled by BT chip */ | 457 | .hw_params = NULL, /* rates are controlled by BT chip */ |
454 | .set_fmt = ak4641_pcm_set_dai_fmt, | 458 | .set_fmt = ak4641_pcm_set_dai_fmt, |
455 | .digital_mute = ak4641_mute, | 459 | .digital_mute = ak4641_mute, |
@@ -499,7 +503,7 @@ static struct snd_soc_dai_driver ak4641_dai[] = { | |||
499 | }, | 503 | }, |
500 | }; | 504 | }; |
501 | 505 | ||
502 | static int ak4641_suspend(struct snd_soc_codec *codec, pm_message_t state) | 506 | static int ak4641_suspend(struct snd_soc_codec *codec) |
503 | { | 507 | { |
504 | ak4641_set_bias_level(codec, SND_SOC_BIAS_OFF); | 508 | ak4641_set_bias_level(codec, SND_SOC_BIAS_OFF); |
505 | return 0; | 509 | return 0; |
@@ -603,7 +607,8 @@ static int __devinit ak4641_i2c_probe(struct i2c_client *i2c, | |||
603 | struct ak4641_priv *ak4641; | 607 | struct ak4641_priv *ak4641; |
604 | int ret; | 608 | int ret; |
605 | 609 | ||
606 | ak4641 = kzalloc(sizeof(struct ak4641_priv), GFP_KERNEL); | 610 | ak4641 = devm_kzalloc(&i2c->dev, sizeof(struct ak4641_priv), |
611 | GFP_KERNEL); | ||
607 | if (!ak4641) | 612 | if (!ak4641) |
608 | return -ENOMEM; | 613 | return -ENOMEM; |
609 | 614 | ||
@@ -611,16 +616,12 @@ static int __devinit ak4641_i2c_probe(struct i2c_client *i2c, | |||
611 | 616 | ||
612 | ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_ak4641, | 617 | ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_ak4641, |
613 | ak4641_dai, ARRAY_SIZE(ak4641_dai)); | 618 | ak4641_dai, ARRAY_SIZE(ak4641_dai)); |
614 | if (ret < 0) | ||
615 | kfree(ak4641); | ||
616 | |||
617 | return ret; | 619 | return ret; |
618 | } | 620 | } |
619 | 621 | ||
620 | static int __devexit ak4641_i2c_remove(struct i2c_client *i2c) | 622 | static int __devexit ak4641_i2c_remove(struct i2c_client *i2c) |
621 | { | 623 | { |
622 | snd_soc_unregister_codec(&i2c->dev); | 624 | snd_soc_unregister_codec(&i2c->dev); |
623 | kfree(i2c_get_clientdata(i2c)); | ||
624 | return 0; | 625 | return 0; |
625 | } | 626 | } |
626 | 627 | ||