diff options
Diffstat (limited to 'sound/soc/codecs/uda134x.c')
-rw-r--r-- | sound/soc/codecs/uda134x.c | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/sound/soc/codecs/uda134x.c b/sound/soc/codecs/uda134x.c index 3e99fe5131dd..28aac53c97bb 100644 --- a/sound/soc/codecs/uda134x.c +++ b/sound/soc/codecs/uda134x.c | |||
@@ -15,6 +15,7 @@ | |||
15 | 15 | ||
16 | #include <linux/module.h> | 16 | #include <linux/module.h> |
17 | #include <linux/delay.h> | 17 | #include <linux/delay.h> |
18 | #include <linux/slab.h> | ||
18 | #include <sound/pcm.h> | 19 | #include <sound/pcm.h> |
19 | #include <sound/pcm_params.h> | 20 | #include <sound/pcm_params.h> |
20 | #include <sound/soc.h> | 21 | #include <sound/soc.h> |
@@ -174,7 +175,7 @@ static int uda134x_startup(struct snd_pcm_substream *substream, | |||
174 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 175 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
175 | struct snd_soc_device *socdev = rtd->socdev; | 176 | struct snd_soc_device *socdev = rtd->socdev; |
176 | struct snd_soc_codec *codec = socdev->card->codec; | 177 | struct snd_soc_codec *codec = socdev->card->codec; |
177 | struct uda134x_priv *uda134x = codec->private_data; | 178 | struct uda134x_priv *uda134x = snd_soc_codec_get_drvdata(codec); |
178 | struct snd_pcm_runtime *master_runtime; | 179 | struct snd_pcm_runtime *master_runtime; |
179 | 180 | ||
180 | if (uda134x->master_substream) { | 181 | if (uda134x->master_substream) { |
@@ -207,7 +208,7 @@ static void uda134x_shutdown(struct snd_pcm_substream *substream, | |||
207 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 208 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
208 | struct snd_soc_device *socdev = rtd->socdev; | 209 | struct snd_soc_device *socdev = rtd->socdev; |
209 | struct snd_soc_codec *codec = socdev->card->codec; | 210 | struct snd_soc_codec *codec = socdev->card->codec; |
210 | struct uda134x_priv *uda134x = codec->private_data; | 211 | struct uda134x_priv *uda134x = snd_soc_codec_get_drvdata(codec); |
211 | 212 | ||
212 | if (uda134x->master_substream == substream) | 213 | if (uda134x->master_substream == substream) |
213 | uda134x->master_substream = uda134x->slave_substream; | 214 | uda134x->master_substream = uda134x->slave_substream; |
@@ -222,7 +223,7 @@ static int uda134x_hw_params(struct snd_pcm_substream *substream, | |||
222 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 223 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
223 | struct snd_soc_device *socdev = rtd->socdev; | 224 | struct snd_soc_device *socdev = rtd->socdev; |
224 | struct snd_soc_codec *codec = socdev->card->codec; | 225 | struct snd_soc_codec *codec = socdev->card->codec; |
225 | struct uda134x_priv *uda134x = codec->private_data; | 226 | struct uda134x_priv *uda134x = snd_soc_codec_get_drvdata(codec); |
226 | u8 hw_params; | 227 | u8 hw_params; |
227 | 228 | ||
228 | if (substream == uda134x->slave_substream) { | 229 | if (substream == uda134x->slave_substream) { |
@@ -294,7 +295,7 @@ static int uda134x_set_dai_sysclk(struct snd_soc_dai *codec_dai, | |||
294 | int clk_id, unsigned int freq, int dir) | 295 | int clk_id, unsigned int freq, int dir) |
295 | { | 296 | { |
296 | struct snd_soc_codec *codec = codec_dai->codec; | 297 | struct snd_soc_codec *codec = codec_dai->codec; |
297 | struct uda134x_priv *uda134x = codec->private_data; | 298 | struct uda134x_priv *uda134x = snd_soc_codec_get_drvdata(codec); |
298 | 299 | ||
299 | pr_debug("%s clk_id: %d, freq: %u, dir: %d\n", __func__, | 300 | pr_debug("%s clk_id: %d, freq: %u, dir: %d\n", __func__, |
300 | clk_id, freq, dir); | 301 | clk_id, freq, dir); |
@@ -316,7 +317,7 @@ static int uda134x_set_dai_fmt(struct snd_soc_dai *codec_dai, | |||
316 | unsigned int fmt) | 317 | unsigned int fmt) |
317 | { | 318 | { |
318 | struct snd_soc_codec *codec = codec_dai->codec; | 319 | struct snd_soc_codec *codec = codec_dai->codec; |
319 | struct uda134x_priv *uda134x = codec->private_data; | 320 | struct uda134x_priv *uda134x = snd_soc_codec_get_drvdata(codec); |
320 | 321 | ||
321 | pr_debug("%s fmt: %08X\n", __func__, fmt); | 322 | pr_debug("%s fmt: %08X\n", __func__, fmt); |
322 | 323 | ||
@@ -431,6 +432,14 @@ SOC_ENUM("PCM Playback De-emphasis", uda134x_mixer_enum[1]), | |||
431 | SOC_SINGLE("DC Filter Enable Switch", UDA134X_STATUS0, 0, 1, 0), | 432 | SOC_SINGLE("DC Filter Enable Switch", UDA134X_STATUS0, 0, 1, 0), |
432 | }; | 433 | }; |
433 | 434 | ||
435 | static const struct snd_kcontrol_new uda1345_snd_controls[] = { | ||
436 | SOC_SINGLE("Master Playback Volume", UDA134X_DATA000, 0, 0x3F, 1), | ||
437 | |||
438 | SOC_ENUM("PCM Playback De-emphasis", uda134x_mixer_enum[1]), | ||
439 | |||
440 | SOC_SINGLE("DC Filter Enable Switch", UDA134X_STATUS0, 0, 1, 0), | ||
441 | }; | ||
442 | |||
434 | static struct snd_soc_dai_ops uda134x_dai_ops = { | 443 | static struct snd_soc_dai_ops uda134x_dai_ops = { |
435 | .startup = uda134x_startup, | 444 | .startup = uda134x_startup, |
436 | .shutdown = uda134x_shutdown, | 445 | .shutdown = uda134x_shutdown, |
@@ -486,6 +495,7 @@ static int uda134x_soc_probe(struct platform_device *pdev) | |||
486 | case UDA134X_UDA1340: | 495 | case UDA134X_UDA1340: |
487 | case UDA134X_UDA1341: | 496 | case UDA134X_UDA1341: |
488 | case UDA134X_UDA1344: | 497 | case UDA134X_UDA1344: |
498 | case UDA134X_UDA1345: | ||
489 | break; | 499 | break; |
490 | default: | 500 | default: |
491 | printk(KERN_ERR "UDA134X SoC codec: " | 501 | printk(KERN_ERR "UDA134X SoC codec: " |
@@ -503,7 +513,7 @@ static int uda134x_soc_probe(struct platform_device *pdev) | |||
503 | uda134x = kzalloc(sizeof(struct uda134x_priv), GFP_KERNEL); | 513 | uda134x = kzalloc(sizeof(struct uda134x_priv), GFP_KERNEL); |
504 | if (uda134x == NULL) | 514 | if (uda134x == NULL) |
505 | goto priv_err; | 515 | goto priv_err; |
506 | codec->private_data = uda134x; | 516 | snd_soc_codec_set_drvdata(codec, uda134x); |
507 | 517 | ||
508 | codec->reg_cache = kmemdup(uda134x_reg, sizeof(uda134x_reg), | 518 | codec->reg_cache = kmemdup(uda134x_reg, sizeof(uda134x_reg), |
509 | GFP_KERNEL); | 519 | GFP_KERNEL); |
@@ -551,6 +561,10 @@ static int uda134x_soc_probe(struct platform_device *pdev) | |||
551 | ret = snd_soc_add_controls(codec, uda1341_snd_controls, | 561 | ret = snd_soc_add_controls(codec, uda1341_snd_controls, |
552 | ARRAY_SIZE(uda1341_snd_controls)); | 562 | ARRAY_SIZE(uda1341_snd_controls)); |
553 | break; | 563 | break; |
564 | case UDA134X_UDA1345: | ||
565 | ret = snd_soc_add_controls(codec, uda1345_snd_controls, | ||
566 | ARRAY_SIZE(uda1345_snd_controls)); | ||
567 | break; | ||
554 | default: | 568 | default: |
555 | printk(KERN_ERR "%s unknown codec type: %d", | 569 | printk(KERN_ERR "%s unknown codec type: %d", |
556 | __func__, pd->model); | 570 | __func__, pd->model); |
@@ -567,7 +581,7 @@ static int uda134x_soc_probe(struct platform_device *pdev) | |||
567 | pcm_err: | 581 | pcm_err: |
568 | kfree(codec->reg_cache); | 582 | kfree(codec->reg_cache); |
569 | reg_err: | 583 | reg_err: |
570 | kfree(codec->private_data); | 584 | kfree(snd_soc_codec_get_drvdata(codec)); |
571 | priv_err: | 585 | priv_err: |
572 | kfree(codec); | 586 | kfree(codec); |
573 | return ret; | 587 | return ret; |
@@ -585,7 +599,7 @@ static int uda134x_soc_remove(struct platform_device *pdev) | |||
585 | snd_soc_free_pcms(socdev); | 599 | snd_soc_free_pcms(socdev); |
586 | snd_soc_dapm_free(socdev); | 600 | snd_soc_dapm_free(socdev); |
587 | 601 | ||
588 | kfree(codec->private_data); | 602 | kfree(snd_soc_codec_get_drvdata(codec)); |
589 | kfree(codec->reg_cache); | 603 | kfree(codec->reg_cache); |
590 | kfree(codec); | 604 | kfree(codec); |
591 | 605 | ||