diff options
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/codecs/Kconfig | 3 | ||||
-rw-r--r-- | sound/soc/codecs/wm8753.c | 3 | ||||
-rw-r--r-- | sound/soc/codecs/wm8985.c | 143 | ||||
-rw-r--r-- | sound/soc/codecs/wm8985.h | 38 |
4 files changed, 149 insertions, 38 deletions
diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig index d54604fecd7f..1cd6ab344d67 100644 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig | |||
@@ -1002,7 +1002,8 @@ config SND_SOC_WM8983 | |||
1002 | tristate | 1002 | tristate |
1003 | 1003 | ||
1004 | config SND_SOC_WM8985 | 1004 | config SND_SOC_WM8985 |
1005 | tristate | 1005 | tristate "Wolfson Microelectronics WM8985 and WM8758 codec driver" |
1006 | depends on SND_SOC_I2C_AND_SPI | ||
1006 | 1007 | ||
1007 | config SND_SOC_WM8988 | 1008 | config SND_SOC_WM8988 |
1008 | tristate | 1009 | tristate |
diff --git a/sound/soc/codecs/wm8753.c b/sound/soc/codecs/wm8753.c index 6f1024f48b19..cdcc91282e8a 100644 --- a/sound/soc/codecs/wm8753.c +++ b/sound/soc/codecs/wm8753.c | |||
@@ -32,7 +32,6 @@ | |||
32 | */ | 32 | */ |
33 | 33 | ||
34 | #include <linux/module.h> | 34 | #include <linux/module.h> |
35 | #include <linux/moduleparam.h> | ||
36 | #include <linux/kernel.h> | 35 | #include <linux/kernel.h> |
37 | #include <linux/init.h> | 36 | #include <linux/init.h> |
38 | #include <linux/delay.h> | 37 | #include <linux/delay.h> |
@@ -486,7 +485,7 @@ SND_SOC_DAPM_DAC("Voice DAC", "Voice Playback", WM8753_PWR1, 4, 0), | |||
486 | SND_SOC_DAPM_OUTPUT("MONO1"), | 485 | SND_SOC_DAPM_OUTPUT("MONO1"), |
487 | SND_SOC_DAPM_MUX("Mono 2 Mux", SND_SOC_NOPM, 0, 0, &wm8753_mono2_controls), | 486 | SND_SOC_DAPM_MUX("Mono 2 Mux", SND_SOC_NOPM, 0, 0, &wm8753_mono2_controls), |
488 | SND_SOC_DAPM_OUTPUT("MONO2"), | 487 | SND_SOC_DAPM_OUTPUT("MONO2"), |
489 | SND_SOC_DAPM_MIXER("Out3 Left + Right", -1, 0, 0, NULL, 0), | 488 | SND_SOC_DAPM_MIXER("Out3 Left + Right", SND_SOC_NOPM, 0, 0, NULL, 0), |
490 | SND_SOC_DAPM_MUX("Out3 Mux", SND_SOC_NOPM, 0, 0, &wm8753_out3_controls), | 489 | SND_SOC_DAPM_MUX("Out3 Mux", SND_SOC_NOPM, 0, 0, &wm8753_out3_controls), |
491 | SND_SOC_DAPM_PGA("Out 3", WM8753_PWR3, 4, 0, NULL, 0), | 490 | SND_SOC_DAPM_PGA("Out 3", WM8753_PWR3, 4, 0, NULL, 0), |
492 | SND_SOC_DAPM_OUTPUT("OUT3"), | 491 | SND_SOC_DAPM_OUTPUT("OUT3"), |
diff --git a/sound/soc/codecs/wm8985.c b/sound/soc/codecs/wm8985.c index 6ac76fe116b0..7347abff4b2c 100644 --- a/sound/soc/codecs/wm8985.c +++ b/sound/soc/codecs/wm8985.c | |||
@@ -1,10 +1,13 @@ | |||
1 | /* | 1 | /* |
2 | * wm8985.c -- WM8985 ALSA SoC Audio driver | 2 | * wm8985.c -- WM8985 / WM8758 ALSA SoC Audio driver |
3 | * | 3 | * |
4 | * Copyright 2010 Wolfson Microelectronics plc | 4 | * Copyright 2010 Wolfson Microelectronics plc |
5 | * | ||
6 | * Author: Dimitris Papastamos <dp@opensource.wolfsonmicro.com> | 5 | * Author: Dimitris Papastamos <dp@opensource.wolfsonmicro.com> |
7 | * | 6 | * |
7 | * WM8758 support: | ||
8 | * Copyright: 2016 Barix AG | ||
9 | * Author: Petr Kulhavy <petr@barix.com> | ||
10 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | 11 | * This program is free software; you can redistribute it and/or modify |
9 | * it under the terms of the GNU General Public License version 2 as | 12 | * it under the terms of the GNU General Public License version 2 as |
10 | * published by the Free Software Foundation. | 13 | * published by the Free Software Foundation. |
@@ -40,6 +43,11 @@ static const char *wm8985_supply_names[WM8985_NUM_SUPPLIES] = { | |||
40 | "AVDD2" | 43 | "AVDD2" |
41 | }; | 44 | }; |
42 | 45 | ||
46 | enum wm8985_type { | ||
47 | WM8985, | ||
48 | WM8758, | ||
49 | }; | ||
50 | |||
43 | static const struct reg_default wm8985_reg_defaults[] = { | 51 | static const struct reg_default wm8985_reg_defaults[] = { |
44 | { 1, 0x0000 }, /* R1 - Power management 1 */ | 52 | { 1, 0x0000 }, /* R1 - Power management 1 */ |
45 | { 2, 0x0000 }, /* R2 - Power management 2 */ | 53 | { 2, 0x0000 }, /* R2 - Power management 2 */ |
@@ -181,6 +189,7 @@ static const int volume_update_regs[] = { | |||
181 | struct wm8985_priv { | 189 | struct wm8985_priv { |
182 | struct regmap *regmap; | 190 | struct regmap *regmap; |
183 | struct regulator_bulk_data supplies[WM8985_NUM_SUPPLIES]; | 191 | struct regulator_bulk_data supplies[WM8985_NUM_SUPPLIES]; |
192 | enum wm8985_type dev_type; | ||
184 | unsigned int sysclk; | 193 | unsigned int sysclk; |
185 | unsigned int bclk; | 194 | unsigned int bclk; |
186 | }; | 195 | }; |
@@ -289,7 +298,7 @@ static const char *depth_3d_text[] = { | |||
289 | }; | 298 | }; |
290 | static SOC_ENUM_SINGLE_DECL(depth_3d, WM8985_3D_CONTROL, 0, depth_3d_text); | 299 | static SOC_ENUM_SINGLE_DECL(depth_3d, WM8985_3D_CONTROL, 0, depth_3d_text); |
291 | 300 | ||
292 | static const struct snd_kcontrol_new wm8985_snd_controls[] = { | 301 | static const struct snd_kcontrol_new wm8985_common_snd_controls[] = { |
293 | SOC_SINGLE("Digital Loopback Switch", WM8985_COMPANDING_CONTROL, | 302 | SOC_SINGLE("Digital Loopback Switch", WM8985_COMPANDING_CONTROL, |
294 | 0, 1, 0), | 303 | 0, 1, 0), |
295 | 304 | ||
@@ -355,10 +364,6 @@ static const struct snd_kcontrol_new wm8985_snd_controls[] = { | |||
355 | SOC_ENUM("High Pass Filter Mode", filter_mode), | 364 | SOC_ENUM("High Pass Filter Mode", filter_mode), |
356 | SOC_SINGLE("High Pass Filter Cutoff", WM8985_ADC_CONTROL, 4, 7, 0), | 365 | SOC_SINGLE("High Pass Filter Cutoff", WM8985_ADC_CONTROL, 4, 7, 0), |
357 | 366 | ||
358 | SOC_DOUBLE_R_TLV("Aux Bypass Volume", | ||
359 | WM8985_LEFT_MIXER_CTRL, WM8985_RIGHT_MIXER_CTRL, 6, 7, 0, | ||
360 | aux_tlv), | ||
361 | |||
362 | SOC_DOUBLE_R_TLV("Input PGA Bypass Volume", | 367 | SOC_DOUBLE_R_TLV("Input PGA Bypass Volume", |
363 | WM8985_LEFT_MIXER_CTRL, WM8985_RIGHT_MIXER_CTRL, 2, 7, 0, | 368 | WM8985_LEFT_MIXER_CTRL, WM8985_RIGHT_MIXER_CTRL, 2, 7, 0, |
364 | bypass_tlv), | 369 | bypass_tlv), |
@@ -379,20 +384,30 @@ static const struct snd_kcontrol_new wm8985_snd_controls[] = { | |||
379 | SOC_SINGLE_TLV("EQ5 Volume", WM8985_EQ5_HIGH_SHELF, 0, 24, 1, eq_tlv), | 384 | SOC_SINGLE_TLV("EQ5 Volume", WM8985_EQ5_HIGH_SHELF, 0, 24, 1, eq_tlv), |
380 | 385 | ||
381 | SOC_ENUM("3D Depth", depth_3d), | 386 | SOC_ENUM("3D Depth", depth_3d), |
387 | }; | ||
388 | |||
389 | static const struct snd_kcontrol_new wm8985_specific_snd_controls[] = { | ||
390 | SOC_DOUBLE_R_TLV("Aux Bypass Volume", | ||
391 | WM8985_LEFT_MIXER_CTRL, WM8985_RIGHT_MIXER_CTRL, 6, 7, 0, | ||
392 | aux_tlv), | ||
382 | 393 | ||
383 | SOC_ENUM("Speaker Mode", speaker_mode) | 394 | SOC_ENUM("Speaker Mode", speaker_mode) |
384 | }; | 395 | }; |
385 | 396 | ||
386 | static const struct snd_kcontrol_new left_out_mixer[] = { | 397 | static const struct snd_kcontrol_new left_out_mixer[] = { |
387 | SOC_DAPM_SINGLE("Line Switch", WM8985_LEFT_MIXER_CTRL, 1, 1, 0), | 398 | SOC_DAPM_SINGLE("Line Switch", WM8985_LEFT_MIXER_CTRL, 1, 1, 0), |
388 | SOC_DAPM_SINGLE("Aux Switch", WM8985_LEFT_MIXER_CTRL, 5, 1, 0), | ||
389 | SOC_DAPM_SINGLE("PCM Switch", WM8985_LEFT_MIXER_CTRL, 0, 1, 0), | 399 | SOC_DAPM_SINGLE("PCM Switch", WM8985_LEFT_MIXER_CTRL, 0, 1, 0), |
400 | |||
401 | /* --- WM8985 only --- */ | ||
402 | SOC_DAPM_SINGLE("Aux Switch", WM8985_LEFT_MIXER_CTRL, 5, 1, 0), | ||
390 | }; | 403 | }; |
391 | 404 | ||
392 | static const struct snd_kcontrol_new right_out_mixer[] = { | 405 | static const struct snd_kcontrol_new right_out_mixer[] = { |
393 | SOC_DAPM_SINGLE("Line Switch", WM8985_RIGHT_MIXER_CTRL, 1, 1, 0), | 406 | SOC_DAPM_SINGLE("Line Switch", WM8985_RIGHT_MIXER_CTRL, 1, 1, 0), |
394 | SOC_DAPM_SINGLE("Aux Switch", WM8985_RIGHT_MIXER_CTRL, 5, 1, 0), | ||
395 | SOC_DAPM_SINGLE("PCM Switch", WM8985_RIGHT_MIXER_CTRL, 0, 1, 0), | 407 | SOC_DAPM_SINGLE("PCM Switch", WM8985_RIGHT_MIXER_CTRL, 0, 1, 0), |
408 | |||
409 | /* --- WM8985 only --- */ | ||
410 | SOC_DAPM_SINGLE("Aux Switch", WM8985_RIGHT_MIXER_CTRL, 5, 1, 0), | ||
396 | }; | 411 | }; |
397 | 412 | ||
398 | static const struct snd_kcontrol_new left_input_mixer[] = { | 413 | static const struct snd_kcontrol_new left_input_mixer[] = { |
@@ -410,6 +425,8 @@ static const struct snd_kcontrol_new right_input_mixer[] = { | |||
410 | static const struct snd_kcontrol_new left_boost_mixer[] = { | 425 | static const struct snd_kcontrol_new left_boost_mixer[] = { |
411 | SOC_DAPM_SINGLE_TLV("L2 Volume", WM8985_LEFT_ADC_BOOST_CTRL, | 426 | SOC_DAPM_SINGLE_TLV("L2 Volume", WM8985_LEFT_ADC_BOOST_CTRL, |
412 | 4, 7, 0, boost_tlv), | 427 | 4, 7, 0, boost_tlv), |
428 | |||
429 | /* --- WM8985 only --- */ | ||
413 | SOC_DAPM_SINGLE_TLV("AUXL Volume", WM8985_LEFT_ADC_BOOST_CTRL, | 430 | SOC_DAPM_SINGLE_TLV("AUXL Volume", WM8985_LEFT_ADC_BOOST_CTRL, |
414 | 0, 7, 0, boost_tlv) | 431 | 0, 7, 0, boost_tlv) |
415 | }; | 432 | }; |
@@ -417,11 +434,13 @@ static const struct snd_kcontrol_new left_boost_mixer[] = { | |||
417 | static const struct snd_kcontrol_new right_boost_mixer[] = { | 434 | static const struct snd_kcontrol_new right_boost_mixer[] = { |
418 | SOC_DAPM_SINGLE_TLV("R2 Volume", WM8985_RIGHT_ADC_BOOST_CTRL, | 435 | SOC_DAPM_SINGLE_TLV("R2 Volume", WM8985_RIGHT_ADC_BOOST_CTRL, |
419 | 4, 7, 0, boost_tlv), | 436 | 4, 7, 0, boost_tlv), |
437 | |||
438 | /* --- WM8985 only --- */ | ||
420 | SOC_DAPM_SINGLE_TLV("AUXR Volume", WM8985_RIGHT_ADC_BOOST_CTRL, | 439 | SOC_DAPM_SINGLE_TLV("AUXR Volume", WM8985_RIGHT_ADC_BOOST_CTRL, |
421 | 0, 7, 0, boost_tlv) | 440 | 0, 7, 0, boost_tlv) |
422 | }; | 441 | }; |
423 | 442 | ||
424 | static const struct snd_soc_dapm_widget wm8985_dapm_widgets[] = { | 443 | static const struct snd_soc_dapm_widget wm8985_common_dapm_widgets[] = { |
425 | SND_SOC_DAPM_DAC("Left DAC", "Left Playback", WM8985_POWER_MANAGEMENT_3, | 444 | SND_SOC_DAPM_DAC("Left DAC", "Left Playback", WM8985_POWER_MANAGEMENT_3, |
426 | 0, 0), | 445 | 0, 0), |
427 | SND_SOC_DAPM_DAC("Right DAC", "Right Playback", WM8985_POWER_MANAGEMENT_3, | 446 | SND_SOC_DAPM_DAC("Right DAC", "Right Playback", WM8985_POWER_MANAGEMENT_3, |
@@ -431,21 +450,11 @@ static const struct snd_soc_dapm_widget wm8985_dapm_widgets[] = { | |||
431 | SND_SOC_DAPM_ADC("Right ADC", "Right Capture", WM8985_POWER_MANAGEMENT_2, | 450 | SND_SOC_DAPM_ADC("Right ADC", "Right Capture", WM8985_POWER_MANAGEMENT_2, |
432 | 1, 0), | 451 | 1, 0), |
433 | 452 | ||
434 | SND_SOC_DAPM_MIXER("Left Output Mixer", WM8985_POWER_MANAGEMENT_3, | ||
435 | 2, 0, left_out_mixer, ARRAY_SIZE(left_out_mixer)), | ||
436 | SND_SOC_DAPM_MIXER("Right Output Mixer", WM8985_POWER_MANAGEMENT_3, | ||
437 | 3, 0, right_out_mixer, ARRAY_SIZE(right_out_mixer)), | ||
438 | |||
439 | SND_SOC_DAPM_MIXER("Left Input Mixer", WM8985_POWER_MANAGEMENT_2, | 453 | SND_SOC_DAPM_MIXER("Left Input Mixer", WM8985_POWER_MANAGEMENT_2, |
440 | 2, 0, left_input_mixer, ARRAY_SIZE(left_input_mixer)), | 454 | 2, 0, left_input_mixer, ARRAY_SIZE(left_input_mixer)), |
441 | SND_SOC_DAPM_MIXER("Right Input Mixer", WM8985_POWER_MANAGEMENT_2, | 455 | SND_SOC_DAPM_MIXER("Right Input Mixer", WM8985_POWER_MANAGEMENT_2, |
442 | 3, 0, right_input_mixer, ARRAY_SIZE(right_input_mixer)), | 456 | 3, 0, right_input_mixer, ARRAY_SIZE(right_input_mixer)), |
443 | 457 | ||
444 | SND_SOC_DAPM_MIXER("Left Boost Mixer", WM8985_POWER_MANAGEMENT_2, | ||
445 | 4, 0, left_boost_mixer, ARRAY_SIZE(left_boost_mixer)), | ||
446 | SND_SOC_DAPM_MIXER("Right Boost Mixer", WM8985_POWER_MANAGEMENT_2, | ||
447 | 5, 0, right_boost_mixer, ARRAY_SIZE(right_boost_mixer)), | ||
448 | |||
449 | SND_SOC_DAPM_PGA("Left Capture PGA", WM8985_LEFT_INP_PGA_GAIN_CTRL, | 458 | SND_SOC_DAPM_PGA("Left Capture PGA", WM8985_LEFT_INP_PGA_GAIN_CTRL, |
450 | 6, 1, NULL, 0), | 459 | 6, 1, NULL, 0), |
451 | SND_SOC_DAPM_PGA("Right Capture PGA", WM8985_RIGHT_INP_PGA_GAIN_CTRL, | 460 | SND_SOC_DAPM_PGA("Right Capture PGA", WM8985_RIGHT_INP_PGA_GAIN_CTRL, |
@@ -468,8 +477,6 @@ static const struct snd_soc_dapm_widget wm8985_dapm_widgets[] = { | |||
468 | SND_SOC_DAPM_INPUT("LIP"), | 477 | SND_SOC_DAPM_INPUT("LIP"), |
469 | SND_SOC_DAPM_INPUT("RIN"), | 478 | SND_SOC_DAPM_INPUT("RIN"), |
470 | SND_SOC_DAPM_INPUT("RIP"), | 479 | SND_SOC_DAPM_INPUT("RIP"), |
471 | SND_SOC_DAPM_INPUT("AUXL"), | ||
472 | SND_SOC_DAPM_INPUT("AUXR"), | ||
473 | SND_SOC_DAPM_INPUT("L2"), | 480 | SND_SOC_DAPM_INPUT("L2"), |
474 | SND_SOC_DAPM_INPUT("R2"), | 481 | SND_SOC_DAPM_INPUT("R2"), |
475 | SND_SOC_DAPM_OUTPUT("HPL"), | 482 | SND_SOC_DAPM_OUTPUT("HPL"), |
@@ -478,13 +485,42 @@ static const struct snd_soc_dapm_widget wm8985_dapm_widgets[] = { | |||
478 | SND_SOC_DAPM_OUTPUT("SPKR") | 485 | SND_SOC_DAPM_OUTPUT("SPKR") |
479 | }; | 486 | }; |
480 | 487 | ||
481 | static const struct snd_soc_dapm_route wm8985_dapm_routes[] = { | 488 | static const struct snd_soc_dapm_widget wm8985_dapm_widgets[] = { |
489 | SND_SOC_DAPM_MIXER("Left Output Mixer", WM8985_POWER_MANAGEMENT_3, | ||
490 | 2, 0, left_out_mixer, ARRAY_SIZE(left_out_mixer)), | ||
491 | SND_SOC_DAPM_MIXER("Right Output Mixer", WM8985_POWER_MANAGEMENT_3, | ||
492 | 3, 0, right_out_mixer, ARRAY_SIZE(right_out_mixer)), | ||
493 | |||
494 | SND_SOC_DAPM_MIXER("Left Boost Mixer", WM8985_POWER_MANAGEMENT_2, | ||
495 | 4, 0, left_boost_mixer, ARRAY_SIZE(left_boost_mixer)), | ||
496 | SND_SOC_DAPM_MIXER("Right Boost Mixer", WM8985_POWER_MANAGEMENT_2, | ||
497 | 5, 0, right_boost_mixer, ARRAY_SIZE(right_boost_mixer)), | ||
498 | |||
499 | SND_SOC_DAPM_INPUT("AUXL"), | ||
500 | SND_SOC_DAPM_INPUT("AUXR"), | ||
501 | }; | ||
502 | |||
503 | static const struct snd_soc_dapm_widget wm8758_dapm_widgets[] = { | ||
504 | SND_SOC_DAPM_MIXER("Left Output Mixer", WM8985_POWER_MANAGEMENT_3, | ||
505 | 2, 0, left_out_mixer, | ||
506 | ARRAY_SIZE(left_out_mixer) - 1), | ||
507 | SND_SOC_DAPM_MIXER("Right Output Mixer", WM8985_POWER_MANAGEMENT_3, | ||
508 | 3, 0, right_out_mixer, | ||
509 | ARRAY_SIZE(right_out_mixer) - 1), | ||
510 | |||
511 | SND_SOC_DAPM_MIXER("Left Boost Mixer", WM8985_POWER_MANAGEMENT_2, | ||
512 | 4, 0, left_boost_mixer, | ||
513 | ARRAY_SIZE(left_boost_mixer) - 1), | ||
514 | SND_SOC_DAPM_MIXER("Right Boost Mixer", WM8985_POWER_MANAGEMENT_2, | ||
515 | 5, 0, right_boost_mixer, | ||
516 | ARRAY_SIZE(right_boost_mixer) - 1), | ||
517 | }; | ||
518 | |||
519 | static const struct snd_soc_dapm_route wm8985_common_dapm_routes[] = { | ||
482 | { "Right Output Mixer", "PCM Switch", "Right DAC" }, | 520 | { "Right Output Mixer", "PCM Switch", "Right DAC" }, |
483 | { "Right Output Mixer", "Aux Switch", "AUXR" }, | ||
484 | { "Right Output Mixer", "Line Switch", "Right Boost Mixer" }, | 521 | { "Right Output Mixer", "Line Switch", "Right Boost Mixer" }, |
485 | 522 | ||
486 | { "Left Output Mixer", "PCM Switch", "Left DAC" }, | 523 | { "Left Output Mixer", "PCM Switch", "Left DAC" }, |
487 | { "Left Output Mixer", "Aux Switch", "AUXL" }, | ||
488 | { "Left Output Mixer", "Line Switch", "Left Boost Mixer" }, | 524 | { "Left Output Mixer", "Line Switch", "Left Boost Mixer" }, |
489 | 525 | ||
490 | { "Right Headphone Out", NULL, "Right Output Mixer" }, | 526 | { "Right Headphone Out", NULL, "Right Output Mixer" }, |
@@ -501,13 +537,11 @@ static const struct snd_soc_dapm_route wm8985_dapm_routes[] = { | |||
501 | 537 | ||
502 | { "Right ADC", NULL, "Right Boost Mixer" }, | 538 | { "Right ADC", NULL, "Right Boost Mixer" }, |
503 | 539 | ||
504 | { "Right Boost Mixer", "AUXR Volume", "AUXR" }, | ||
505 | { "Right Boost Mixer", NULL, "Right Capture PGA" }, | 540 | { "Right Boost Mixer", NULL, "Right Capture PGA" }, |
506 | { "Right Boost Mixer", "R2 Volume", "R2" }, | 541 | { "Right Boost Mixer", "R2 Volume", "R2" }, |
507 | 542 | ||
508 | { "Left ADC", NULL, "Left Boost Mixer" }, | 543 | { "Left ADC", NULL, "Left Boost Mixer" }, |
509 | 544 | ||
510 | { "Left Boost Mixer", "AUXL Volume", "AUXL" }, | ||
511 | { "Left Boost Mixer", NULL, "Left Capture PGA" }, | 545 | { "Left Boost Mixer", NULL, "Left Capture PGA" }, |
512 | { "Left Boost Mixer", "L2 Volume", "L2" }, | 546 | { "Left Boost Mixer", "L2 Volume", "L2" }, |
513 | 547 | ||
@@ -522,6 +556,38 @@ static const struct snd_soc_dapm_route wm8985_dapm_routes[] = { | |||
522 | { "Left Input Mixer", "MicN Switch", "LIN" }, | 556 | { "Left Input Mixer", "MicN Switch", "LIN" }, |
523 | { "Left Input Mixer", "MicP Switch", "LIP" }, | 557 | { "Left Input Mixer", "MicP Switch", "LIP" }, |
524 | }; | 558 | }; |
559 | static const struct snd_soc_dapm_route wm8985_aux_dapm_routes[] = { | ||
560 | { "Right Output Mixer", "Aux Switch", "AUXR" }, | ||
561 | { "Left Output Mixer", "Aux Switch", "AUXL" }, | ||
562 | |||
563 | { "Right Boost Mixer", "AUXR Volume", "AUXR" }, | ||
564 | { "Left Boost Mixer", "AUXL Volume", "AUXL" }, | ||
565 | }; | ||
566 | |||
567 | static int wm8985_add_widgets(struct snd_soc_codec *codec) | ||
568 | { | ||
569 | struct wm8985_priv *wm8985 = snd_soc_codec_get_drvdata(codec); | ||
570 | struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); | ||
571 | |||
572 | switch (wm8985->dev_type) { | ||
573 | case WM8758: | ||
574 | snd_soc_dapm_new_controls(dapm, wm8758_dapm_widgets, | ||
575 | ARRAY_SIZE(wm8758_dapm_widgets)); | ||
576 | break; | ||
577 | |||
578 | case WM8985: | ||
579 | snd_soc_add_codec_controls(codec, wm8985_specific_snd_controls, | ||
580 | ARRAY_SIZE(wm8985_specific_snd_controls)); | ||
581 | |||
582 | snd_soc_dapm_new_controls(dapm, wm8985_dapm_widgets, | ||
583 | ARRAY_SIZE(wm8985_dapm_widgets)); | ||
584 | snd_soc_dapm_add_routes(dapm, wm8985_aux_dapm_routes, | ||
585 | ARRAY_SIZE(wm8985_aux_dapm_routes)); | ||
586 | break; | ||
587 | } | ||
588 | |||
589 | return 0; | ||
590 | } | ||
525 | 591 | ||
526 | static int eqmode_get(struct snd_kcontrol *kcontrol, | 592 | static int eqmode_get(struct snd_kcontrol *kcontrol, |
527 | struct snd_ctl_elem_value *ucontrol) | 593 | struct snd_ctl_elem_value *ucontrol) |
@@ -999,6 +1065,8 @@ static int wm8985_probe(struct snd_soc_codec *codec) | |||
999 | snd_soc_update_bits(codec, WM8985_BIAS_CTRL, WM8985_BIASCUT, | 1065 | snd_soc_update_bits(codec, WM8985_BIAS_CTRL, WM8985_BIASCUT, |
1000 | WM8985_BIASCUT); | 1066 | WM8985_BIASCUT); |
1001 | 1067 | ||
1068 | wm8985_add_widgets(codec); | ||
1069 | |||
1002 | return 0; | 1070 | return 0; |
1003 | 1071 | ||
1004 | err_reg_enable: | 1072 | err_reg_enable: |
@@ -1042,12 +1110,12 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8985 = { | |||
1042 | .set_bias_level = wm8985_set_bias_level, | 1110 | .set_bias_level = wm8985_set_bias_level, |
1043 | .suspend_bias_off = true, | 1111 | .suspend_bias_off = true, |
1044 | 1112 | ||
1045 | .controls = wm8985_snd_controls, | 1113 | .controls = wm8985_common_snd_controls, |
1046 | .num_controls = ARRAY_SIZE(wm8985_snd_controls), | 1114 | .num_controls = ARRAY_SIZE(wm8985_common_snd_controls), |
1047 | .dapm_widgets = wm8985_dapm_widgets, | 1115 | .dapm_widgets = wm8985_common_dapm_widgets, |
1048 | .num_dapm_widgets = ARRAY_SIZE(wm8985_dapm_widgets), | 1116 | .num_dapm_widgets = ARRAY_SIZE(wm8985_common_dapm_widgets), |
1049 | .dapm_routes = wm8985_dapm_routes, | 1117 | .dapm_routes = wm8985_common_dapm_routes, |
1050 | .num_dapm_routes = ARRAY_SIZE(wm8985_dapm_routes), | 1118 | .num_dapm_routes = ARRAY_SIZE(wm8985_common_dapm_routes), |
1051 | }; | 1119 | }; |
1052 | 1120 | ||
1053 | static const struct regmap_config wm8985_regmap = { | 1121 | static const struct regmap_config wm8985_regmap = { |
@@ -1074,6 +1142,8 @@ static int wm8985_spi_probe(struct spi_device *spi) | |||
1074 | 1142 | ||
1075 | spi_set_drvdata(spi, wm8985); | 1143 | spi_set_drvdata(spi, wm8985); |
1076 | 1144 | ||
1145 | wm8985->dev_type = WM8985; | ||
1146 | |||
1077 | wm8985->regmap = devm_regmap_init_spi(spi, &wm8985_regmap); | 1147 | wm8985->regmap = devm_regmap_init_spi(spi, &wm8985_regmap); |
1078 | if (IS_ERR(wm8985->regmap)) { | 1148 | if (IS_ERR(wm8985->regmap)) { |
1079 | ret = PTR_ERR(wm8985->regmap); | 1149 | ret = PTR_ERR(wm8985->regmap); |
@@ -1115,6 +1185,8 @@ static int wm8985_i2c_probe(struct i2c_client *i2c, | |||
1115 | 1185 | ||
1116 | i2c_set_clientdata(i2c, wm8985); | 1186 | i2c_set_clientdata(i2c, wm8985); |
1117 | 1187 | ||
1188 | wm8985->dev_type = id->driver_data; | ||
1189 | |||
1118 | wm8985->regmap = devm_regmap_init_i2c(i2c, &wm8985_regmap); | 1190 | wm8985->regmap = devm_regmap_init_i2c(i2c, &wm8985_regmap); |
1119 | if (IS_ERR(wm8985->regmap)) { | 1191 | if (IS_ERR(wm8985->regmap)) { |
1120 | ret = PTR_ERR(wm8985->regmap); | 1192 | ret = PTR_ERR(wm8985->regmap); |
@@ -1135,7 +1207,8 @@ static int wm8985_i2c_remove(struct i2c_client *i2c) | |||
1135 | } | 1207 | } |
1136 | 1208 | ||
1137 | static const struct i2c_device_id wm8985_i2c_id[] = { | 1209 | static const struct i2c_device_id wm8985_i2c_id[] = { |
1138 | { "wm8985", 0 }, | 1210 | { "wm8985", WM8985 }, |
1211 | { "wm8758", WM8758 }, | ||
1139 | { } | 1212 | { } |
1140 | }; | 1213 | }; |
1141 | MODULE_DEVICE_TABLE(i2c, wm8985_i2c_id); | 1214 | MODULE_DEVICE_TABLE(i2c, wm8985_i2c_id); |
@@ -1183,6 +1256,6 @@ static void __exit wm8985_exit(void) | |||
1183 | } | 1256 | } |
1184 | module_exit(wm8985_exit); | 1257 | module_exit(wm8985_exit); |
1185 | 1258 | ||
1186 | MODULE_DESCRIPTION("ASoC WM8985 driver"); | 1259 | MODULE_DESCRIPTION("ASoC WM8985 / WM8758 driver"); |
1187 | MODULE_AUTHOR("Dimitris Papastamos <dp@opensource.wolfsonmicro.com>"); | 1260 | MODULE_AUTHOR("Dimitris Papastamos <dp@opensource.wolfsonmicro.com>"); |
1188 | MODULE_LICENSE("GPL"); | 1261 | MODULE_LICENSE("GPL"); |
diff --git a/sound/soc/codecs/wm8985.h b/sound/soc/codecs/wm8985.h index 2e71ff507638..41b1048e3c97 100644 --- a/sound/soc/codecs/wm8985.h +++ b/sound/soc/codecs/wm8985.h | |||
@@ -290,6 +290,9 @@ | |||
290 | #define WM8985_GPIO1GPD_MASK 0x0040 /* GPIO1GPD */ | 290 | #define WM8985_GPIO1GPD_MASK 0x0040 /* GPIO1GPD */ |
291 | #define WM8985_GPIO1GPD_SHIFT 6 /* GPIO1GPD */ | 291 | #define WM8985_GPIO1GPD_SHIFT 6 /* GPIO1GPD */ |
292 | #define WM8985_GPIO1GPD_WIDTH 1 /* GPIO1GPD */ | 292 | #define WM8985_GPIO1GPD_WIDTH 1 /* GPIO1GPD */ |
293 | #define WM8758_OPCLKDIV_MASK 0x0030 /* OPCLKDIV - [1:0] */ | ||
294 | #define WM8758_OPCLKDIV_SHIFT 4 /* OPCLKDIV - [1:0] */ | ||
295 | #define WM8758_OPCLKDIV_WIDTH 2 /* OPCLKDIV - [1:0] */ | ||
293 | #define WM8985_GPIO1POL 0x0008 /* GPIO1POL */ | 296 | #define WM8985_GPIO1POL 0x0008 /* GPIO1POL */ |
294 | #define WM8985_GPIO1POL_MASK 0x0008 /* GPIO1POL */ | 297 | #define WM8985_GPIO1POL_MASK 0x0008 /* GPIO1POL */ |
295 | #define WM8985_GPIO1POL_SHIFT 3 /* GPIO1POL */ | 298 | #define WM8985_GPIO1POL_SHIFT 3 /* GPIO1POL */ |
@@ -301,6 +304,12 @@ | |||
301 | /* | 304 | /* |
302 | * R9 (0x09) - Jack Detect Control 1 | 305 | * R9 (0x09) - Jack Detect Control 1 |
303 | */ | 306 | */ |
307 | #define WM8758_JD_VMID1_MASK 0x0100 /* JD_VMID1 */ | ||
308 | #define WM8758_JD_VMID1_SHIFT 8 /* JD_VMID1 */ | ||
309 | #define WM8758_JD_VMID1_WIDTH 1 /* JD_VMID1 */ | ||
310 | #define WM8758_JD_VMID0_MASK 0x0080 /* JD_VMID0 */ | ||
311 | #define WM8758_JD_VMID0_SHIFT 7 /* JD_VMID0 */ | ||
312 | #define WM8758_JD_VMID0_WIDTH 1 /* JD_VMID0 */ | ||
304 | #define WM8985_JD_EN 0x0040 /* JD_EN */ | 313 | #define WM8985_JD_EN 0x0040 /* JD_EN */ |
305 | #define WM8985_JD_EN_MASK 0x0040 /* JD_EN */ | 314 | #define WM8985_JD_EN_MASK 0x0040 /* JD_EN */ |
306 | #define WM8985_JD_EN_SHIFT 6 /* JD_EN */ | 315 | #define WM8985_JD_EN_SHIFT 6 /* JD_EN */ |
@@ -649,6 +658,12 @@ | |||
649 | #define WM8985_OUT4_2LNR_MASK 0x0020 /* OUT4_2LNR */ | 658 | #define WM8985_OUT4_2LNR_MASK 0x0020 /* OUT4_2LNR */ |
650 | #define WM8985_OUT4_2LNR_SHIFT 5 /* OUT4_2LNR */ | 659 | #define WM8985_OUT4_2LNR_SHIFT 5 /* OUT4_2LNR */ |
651 | #define WM8985_OUT4_2LNR_WIDTH 1 /* OUT4_2LNR */ | 660 | #define WM8985_OUT4_2LNR_WIDTH 1 /* OUT4_2LNR */ |
661 | #define WM8758_VMIDTOG_MASK 0x0010 /* VMIDTOG */ | ||
662 | #define WM8758_VMIDTOG_SHIFT 4 /* VMIDTOG */ | ||
663 | #define WM8758_VMIDTOG_WIDTH 1 /* VMIDTOG */ | ||
664 | #define WM8758_OUT2DEL_MASK 0x0008 /* OUT2DEL */ | ||
665 | #define WM8758_OUT2DEL_SHIFT 3 /* OUT2DEL */ | ||
666 | #define WM8758_OUT2DEL_WIDTH 1 /* OUT2DEL */ | ||
652 | #define WM8985_POBCTRL 0x0004 /* POBCTRL */ | 667 | #define WM8985_POBCTRL 0x0004 /* POBCTRL */ |
653 | #define WM8985_POBCTRL_MASK 0x0004 /* POBCTRL */ | 668 | #define WM8985_POBCTRL_MASK 0x0004 /* POBCTRL */ |
654 | #define WM8985_POBCTRL_SHIFT 2 /* POBCTRL */ | 669 | #define WM8985_POBCTRL_SHIFT 2 /* POBCTRL */ |
@@ -684,6 +699,9 @@ | |||
684 | #define WM8985_BEEPVOL_MASK 0x000E /* BEEPVOL - [3:1] */ | 699 | #define WM8985_BEEPVOL_MASK 0x000E /* BEEPVOL - [3:1] */ |
685 | #define WM8985_BEEPVOL_SHIFT 1 /* BEEPVOL - [3:1] */ | 700 | #define WM8985_BEEPVOL_SHIFT 1 /* BEEPVOL - [3:1] */ |
686 | #define WM8985_BEEPVOL_WIDTH 3 /* BEEPVOL - [3:1] */ | 701 | #define WM8985_BEEPVOL_WIDTH 3 /* BEEPVOL - [3:1] */ |
702 | #define WM8758_DELEN2_MASK 0x0004 /* DELEN2 */ | ||
703 | #define WM8758_DELEN2_SHIFT 2 /* DELEN2 */ | ||
704 | #define WM8758_DELEN2_WIDTH 1 /* DELEN2 */ | ||
687 | #define WM8985_BEEPEN 0x0001 /* BEEPEN */ | 705 | #define WM8985_BEEPEN 0x0001 /* BEEPEN */ |
688 | #define WM8985_BEEPEN_MASK 0x0001 /* BEEPEN */ | 706 | #define WM8985_BEEPEN_MASK 0x0001 /* BEEPEN */ |
689 | #define WM8985_BEEPEN_SHIFT 0 /* BEEPEN */ | 707 | #define WM8985_BEEPEN_SHIFT 0 /* BEEPEN */ |
@@ -790,6 +808,14 @@ | |||
790 | /* | 808 | /* |
791 | * R49 (0x31) - Output ctrl | 809 | * R49 (0x31) - Output ctrl |
792 | */ | 810 | */ |
811 | #define WM8758_HP_COM 0x0100 /* HP_COM */ | ||
812 | #define WM8758_HP_COM_MASK 0x0100 /* HP_COM */ | ||
813 | #define WM8758_HP_COM_SHIFT 8 /* HP_COM */ | ||
814 | #define WM8758_HP_COM_WIDTH 1 /* HP_COM */ | ||
815 | #define WM8758_LINE_COM 0x0080 /* LINE_COM */ | ||
816 | #define WM8758_LINE_COM_MASK 0x0080 /* LINE_COM */ | ||
817 | #define WM8758_LINE_COM_SHIFT 7 /* LINE_COM */ | ||
818 | #define WM8758_LINE_COM_WIDTH 1 /* LINE_COM */ | ||
793 | #define WM8985_DACL2RMIX 0x0040 /* DACL2RMIX */ | 819 | #define WM8985_DACL2RMIX 0x0040 /* DACL2RMIX */ |
794 | #define WM8985_DACL2RMIX_MASK 0x0040 /* DACL2RMIX */ | 820 | #define WM8985_DACL2RMIX_MASK 0x0040 /* DACL2RMIX */ |
795 | #define WM8985_DACL2RMIX_SHIFT 6 /* DACL2RMIX */ | 821 | #define WM8985_DACL2RMIX_SHIFT 6 /* DACL2RMIX */ |
@@ -806,6 +832,14 @@ | |||
806 | #define WM8985_OUT3BOOST_MASK 0x0008 /* OUT3BOOST */ | 832 | #define WM8985_OUT3BOOST_MASK 0x0008 /* OUT3BOOST */ |
807 | #define WM8985_OUT3BOOST_SHIFT 3 /* OUT3BOOST */ | 833 | #define WM8985_OUT3BOOST_SHIFT 3 /* OUT3BOOST */ |
808 | #define WM8985_OUT3BOOST_WIDTH 1 /* OUT3BOOST */ | 834 | #define WM8985_OUT3BOOST_WIDTH 1 /* OUT3BOOST */ |
835 | #define WM8758_OUT4ENDEL 0x0010 /* OUT4ENDEL */ | ||
836 | #define WM8758_OUT4ENDEL_MASK 0x0010 /* OUT4ENDEL */ | ||
837 | #define WM8758_OUT4ENDEL_SHIFT 4 /* OUT4ENDEL */ | ||
838 | #define WM8758_OUT4ENDEL_WIDTH 1 /* OUT4ENDEL */ | ||
839 | #define WM8758_OUT3ENDEL 0x0008 /* OUT3ENDEL */ | ||
840 | #define WM8758_OUT3ENDEL_MASK 0x0008 /* OUT3ENDEL */ | ||
841 | #define WM8758_OUT3ENDEL_SHIFT 3 /* OUT3ENDEL */ | ||
842 | #define WM8758_OUT3ENDEL_WIDTH 1 /* OUT3ENDEL */ | ||
809 | #define WM8985_TSOPCTRL 0x0004 /* TSOPCTRL */ | 843 | #define WM8985_TSOPCTRL 0x0004 /* TSOPCTRL */ |
810 | #define WM8985_TSOPCTRL_MASK 0x0004 /* TSOPCTRL */ | 844 | #define WM8985_TSOPCTRL_MASK 0x0004 /* TSOPCTRL */ |
811 | #define WM8985_TSOPCTRL_SHIFT 2 /* TSOPCTRL */ | 845 | #define WM8985_TSOPCTRL_SHIFT 2 /* TSOPCTRL */ |
@@ -1021,6 +1055,10 @@ | |||
1021 | #define WM8985_HALFIPBIAS_MASK 0x0080 /* HALFIPBIAS */ | 1055 | #define WM8985_HALFIPBIAS_MASK 0x0080 /* HALFIPBIAS */ |
1022 | #define WM8985_HALFIPBIAS_SHIFT 7 /* HALFIPBIAS */ | 1056 | #define WM8985_HALFIPBIAS_SHIFT 7 /* HALFIPBIAS */ |
1023 | #define WM8985_HALFIPBIAS_WIDTH 1 /* HALFIPBIAS */ | 1057 | #define WM8985_HALFIPBIAS_WIDTH 1 /* HALFIPBIAS */ |
1058 | #define WM8758_HALFIPBIAS 0x0040 /* HALFI_IPGA */ | ||
1059 | #define WM8758_HALFI_IPGA_MASK 0x0040 /* HALFI_IPGA */ | ||
1060 | #define WM8758_HALFI_IPGA_SHIFT 6 /* HALFI_IPGA */ | ||
1061 | #define WM8758_HALFI_IPGA_WIDTH 1 /* HALFI_IPGA */ | ||
1024 | #define WM8985_VBBIASTST_MASK 0x0060 /* VBBIASTST - [6:5] */ | 1062 | #define WM8985_VBBIASTST_MASK 0x0060 /* VBBIASTST - [6:5] */ |
1025 | #define WM8985_VBBIASTST_SHIFT 5 /* VBBIASTST - [6:5] */ | 1063 | #define WM8985_VBBIASTST_SHIFT 5 /* VBBIASTST - [6:5] */ |
1026 | #define WM8985_VBBIASTST_WIDTH 2 /* VBBIASTST - [6:5] */ | 1064 | #define WM8985_VBBIASTST_WIDTH 2 /* VBBIASTST - [6:5] */ |