aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/wm8974.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2012-03-27 10:32:29 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-03-27 10:32:29 -0400
commit50953e0640b3473dcb409d5d0d938c2742c93b0d (patch)
tree3b0dc374e61564fbbd8adff92c8fae16fdeb423a /sound/soc/codecs/wm8974.c
parentf92c97c8bd77992ff8bd6ef29a23dc82dca799cb (diff)
parent626cf236608505d376e4799adb4f7eb00a8594af (diff)
Merge branch 'poll' into staging/for_v3.4
* poll: (5970 commits) poll: add poll_requested_events() and poll_does_not_wait() functions crc32: select an algorithm via Kconfig crc32: add self-test code for crc32c crypto: crc32c should use library implementation crc32: bolt on crc32c crc32: add note about this patchset to crc32.c crc32: optimize loop counter for x86 crc32: add slice-by-8 algorithm to existing code crc32: make CRC_*_BITS definition correspond to actual bit counts crc32: fix mixing of endian-specific types crc32: miscellaneous cleanups crc32: simplify unit test code crc32: move long comment about crc32 fundamentals to Documentation/ crc32: remove two instances of trailing whitespaces checkpatch: check for quoted strings broken across lines checkpatch: whitespace - add/remove blank lines checkpatch: warn on use of yield() checkpatch: add --strict tests for braces, comments and casts checkpatch: add [] to type extensions checkpatch: high precedence operators do not require additional parentheses in #defines ...
Diffstat (limited to 'sound/soc/codecs/wm8974.c')
-rw-r--r--sound/soc/codecs/wm8974.c45
1 files changed, 10 insertions, 35 deletions
diff --git a/sound/soc/codecs/wm8974.c b/sound/soc/codecs/wm8974.c
index 4a6a7b5a61b..d93c03f820c 100644
--- a/sound/soc/codecs/wm8974.c
+++ b/sound/soc/codecs/wm8974.c
@@ -48,10 +48,6 @@ static const u16 wm8974_reg[WM8974_CACHEREGNUM] = {
48#define WM8974_POWER1_BIASEN 0x08 48#define WM8974_POWER1_BIASEN 0x08
49#define WM8974_POWER1_BUFIOEN 0x04 49#define WM8974_POWER1_BUFIOEN 0x04
50 50
51struct wm8974_priv {
52 enum snd_soc_control_type control_type;
53};
54
55#define wm8974_reset(c) snd_soc_write(c, WM8974_RESET, 0) 51#define wm8974_reset(c) snd_soc_write(c, WM8974_RESET, 0)
56 52
57static const char *wm8974_companding[] = {"Off", "NC", "u-law", "A-law" }; 53static const char *wm8974_companding[] = {"Off", "NC", "u-law", "A-law" };
@@ -235,7 +231,7 @@ SND_SOC_DAPM_OUTPUT("SPKOUTP"),
235SND_SOC_DAPM_OUTPUT("SPKOUTN"), 231SND_SOC_DAPM_OUTPUT("SPKOUTN"),
236}; 232};
237 233
238static const struct snd_soc_dapm_route audio_map[] = { 234static const struct snd_soc_dapm_route wm8974_dapm_routes[] = {
239 /* Mono output mixer */ 235 /* Mono output mixer */
240 {"Mono Mixer", "PCM Playback Switch", "DAC"}, 236 {"Mono Mixer", "PCM Playback Switch", "DAC"},
241 {"Mono Mixer", "Aux Playback Switch", "Aux Input"}, 237 {"Mono Mixer", "Aux Playback Switch", "Aux Input"},
@@ -269,17 +265,6 @@ static const struct snd_soc_dapm_route audio_map[] = {
269 {"Aux Input", NULL, "AUX"}, 265 {"Aux Input", NULL, "AUX"},
270}; 266};
271 267
272static int wm8974_add_widgets(struct snd_soc_codec *codec)
273{
274 struct snd_soc_dapm_context *dapm = &codec->dapm;
275
276 snd_soc_dapm_new_controls(dapm, wm8974_dapm_widgets,
277 ARRAY_SIZE(wm8974_dapm_widgets));
278 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
279
280 return 0;
281}
282
283struct pll_ { 268struct pll_ {
284 unsigned int pre_div:1; 269 unsigned int pre_div:1;
285 unsigned int n:4; 270 unsigned int n:4;
@@ -611,9 +596,6 @@ static int wm8974_probe(struct snd_soc_codec *codec)
611 } 596 }
612 597
613 wm8974_set_bias_level(codec, SND_SOC_BIAS_STANDBY); 598 wm8974_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
614 snd_soc_add_controls(codec, wm8974_snd_controls,
615 ARRAY_SIZE(wm8974_snd_controls));
616 wm8974_add_widgets(codec);
617 599
618 return ret; 600 return ret;
619} 601}
@@ -634,32 +616,30 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8974 = {
634 .reg_cache_size = ARRAY_SIZE(wm8974_reg), 616 .reg_cache_size = ARRAY_SIZE(wm8974_reg),
635 .reg_word_size = sizeof(u16), 617 .reg_word_size = sizeof(u16),
636 .reg_cache_default = wm8974_reg, 618 .reg_cache_default = wm8974_reg,
619
620 .controls = wm8974_snd_controls,
621 .num_controls = ARRAY_SIZE(wm8974_snd_controls),
622 .dapm_widgets = wm8974_dapm_widgets,
623 .num_dapm_widgets = ARRAY_SIZE(wm8974_dapm_widgets),
624 .dapm_routes = wm8974_dapm_routes,
625 .num_dapm_routes = ARRAY_SIZE(wm8974_dapm_routes),
637}; 626};
638 627
639#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
640static __devinit int wm8974_i2c_probe(struct i2c_client *i2c, 628static __devinit int wm8974_i2c_probe(struct i2c_client *i2c,
641 const struct i2c_device_id *id) 629 const struct i2c_device_id *id)
642{ 630{
643 struct wm8974_priv *wm8974;
644 int ret; 631 int ret;
645 632
646 wm8974 = kzalloc(sizeof(struct wm8974_priv), GFP_KERNEL);
647 if (wm8974 == NULL)
648 return -ENOMEM;
649
650 i2c_set_clientdata(i2c, wm8974);
651
652 ret = snd_soc_register_codec(&i2c->dev, 633 ret = snd_soc_register_codec(&i2c->dev,
653 &soc_codec_dev_wm8974, &wm8974_dai, 1); 634 &soc_codec_dev_wm8974, &wm8974_dai, 1);
654 if (ret < 0) 635
655 kfree(wm8974);
656 return ret; 636 return ret;
657} 637}
658 638
659static __devexit int wm8974_i2c_remove(struct i2c_client *client) 639static __devexit int wm8974_i2c_remove(struct i2c_client *client)
660{ 640{
661 snd_soc_unregister_codec(&client->dev); 641 snd_soc_unregister_codec(&client->dev);
662 kfree(i2c_get_clientdata(client)); 642
663 return 0; 643 return 0;
664} 644}
665 645
@@ -678,27 +658,22 @@ static struct i2c_driver wm8974_i2c_driver = {
678 .remove = __devexit_p(wm8974_i2c_remove), 658 .remove = __devexit_p(wm8974_i2c_remove),
679 .id_table = wm8974_i2c_id, 659 .id_table = wm8974_i2c_id,
680}; 660};
681#endif
682 661
683static int __init wm8974_modinit(void) 662static int __init wm8974_modinit(void)
684{ 663{
685 int ret = 0; 664 int ret = 0;
686#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
687 ret = i2c_add_driver(&wm8974_i2c_driver); 665 ret = i2c_add_driver(&wm8974_i2c_driver);
688 if (ret != 0) { 666 if (ret != 0) {
689 printk(KERN_ERR "Failed to register wm8974 I2C driver: %d\n", 667 printk(KERN_ERR "Failed to register wm8974 I2C driver: %d\n",
690 ret); 668 ret);
691 } 669 }
692#endif
693 return ret; 670 return ret;
694} 671}
695module_init(wm8974_modinit); 672module_init(wm8974_modinit);
696 673
697static void __exit wm8974_exit(void) 674static void __exit wm8974_exit(void)
698{ 675{
699#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
700 i2c_del_driver(&wm8974_i2c_driver); 676 i2c_del_driver(&wm8974_i2c_driver);
701#endif
702} 677}
703module_exit(wm8974_exit); 678module_exit(wm8974_exit);
704 679