aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/wm_hubs.c
diff options
context:
space:
mode:
authorLiam Girdwood <lrg@slimlogic.co.uk>2010-11-05 09:53:46 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2010-11-06 11:28:29 -0400
commitce6120cca2589ede530200c7cfe11ac9f144333c (patch)
tree6ea7c26ce64dd4753e7cf9a3b048e74614b169dc /sound/soc/codecs/wm_hubs.c
parent22e2fda5660cdf62513acabdb5c82a5af415f838 (diff)
ASoC: Decouple DAPM from CODECs
Decoupling Dynamic Audio Power Management (DAPM) from codec devices is required when developing ASoC further. Such as for other ASoC components to have DAPM widgets or when extending DAPM to handle cross-device paths. This patch decouples DAPM related variables from struct snd_soc_codec and moves them to new struct snd_soc_dapm_context that is used to encapsulate DAPM context of a device. ASoC core and API of DAPM functions are modified to use DAPM context instead of codec. This patch does not change current functionality and a large part of changes come because of structure and internal API changes. Core implementation is from Liam Girdwood <lrg@slimlogic.co.uk> with some minor core changes, codecs and machine driver conversions from Jarkko Nikula <jhnikula@gmail.com>. Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk> Signed-off-by: Jarkko Nikula <jhnikula@gmail.com> Cc: Nicolas Ferre <nicolas.ferre@atmel.com> Cc: Manuel Lauss <manuel.lauss@googlemail.com> Cc: Mike Frysinger <vapier.adi@gmail.com> Cc: Cliff Cai <cliff.cai@analog.com> Cc: Kevin Hilman <khilman@deeprootsystems.com> Cc: Ryan Mallon <ryan@bluewatersys.com> Cc: Timur Tabi <timur@freescale.com> Cc: Sascha Hauer <s.hauer@pengutronix.de> Cc: Lars-Peter Clausen <lars@metafoo.de> Cc: Arnaud Patard (Rtp) <arnaud.patard@rtp-net.org> Cc: Wan ZongShun <mcuos.com@gmail.com> Cc: Eric Miao <eric.y.miao@gmail.com> Cc: Jassi Brar <jassi.brar@samsung.com> Cc: Daniel Gloeckner <dg@emlix.com> Cc: Kuninori Morimoto <morimoto.kuninori@renesas.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/codecs/wm_hubs.c')
-rw-r--r--sound/soc/codecs/wm_hubs.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/sound/soc/codecs/wm_hubs.c b/sound/soc/codecs/wm_hubs.c
index 008b1f27aea8..8aff0efe72f5 100644
--- a/sound/soc/codecs/wm_hubs.c
+++ b/sound/soc/codecs/wm_hubs.c
@@ -814,6 +814,8 @@ static const struct snd_soc_dapm_route lineout2_se_routes[] = {
814 814
815int wm_hubs_add_analogue_controls(struct snd_soc_codec *codec) 815int wm_hubs_add_analogue_controls(struct snd_soc_codec *codec)
816{ 816{
817 struct snd_soc_dapm_context *dapm = &codec->dapm;
818
817 /* Latch volume update bits & default ZC on */ 819 /* Latch volume update bits & default ZC on */
818 snd_soc_update_bits(codec, WM8993_LEFT_LINE_INPUT_1_2_VOLUME, 820 snd_soc_update_bits(codec, WM8993_LEFT_LINE_INPUT_1_2_VOLUME,
819 WM8993_IN1_VU, WM8993_IN1_VU); 821 WM8993_IN1_VU, WM8993_IN1_VU);
@@ -842,7 +844,7 @@ int wm_hubs_add_analogue_controls(struct snd_soc_codec *codec)
842 snd_soc_add_controls(codec, analogue_snd_controls, 844 snd_soc_add_controls(codec, analogue_snd_controls,
843 ARRAY_SIZE(analogue_snd_controls)); 845 ARRAY_SIZE(analogue_snd_controls));
844 846
845 snd_soc_dapm_new_controls(codec, analogue_dapm_widgets, 847 snd_soc_dapm_new_controls(dapm, analogue_dapm_widgets,
846 ARRAY_SIZE(analogue_dapm_widgets)); 848 ARRAY_SIZE(analogue_dapm_widgets));
847 return 0; 849 return 0;
848} 850}
@@ -851,24 +853,26 @@ EXPORT_SYMBOL_GPL(wm_hubs_add_analogue_controls);
851int wm_hubs_add_analogue_routes(struct snd_soc_codec *codec, 853int wm_hubs_add_analogue_routes(struct snd_soc_codec *codec,
852 int lineout1_diff, int lineout2_diff) 854 int lineout1_diff, int lineout2_diff)
853{ 855{
854 snd_soc_dapm_add_routes(codec, analogue_routes, 856 struct snd_soc_dapm_context *dapm = &codec->dapm;
857
858 snd_soc_dapm_add_routes(dapm, analogue_routes,
855 ARRAY_SIZE(analogue_routes)); 859 ARRAY_SIZE(analogue_routes));
856 860
857 if (lineout1_diff) 861 if (lineout1_diff)
858 snd_soc_dapm_add_routes(codec, 862 snd_soc_dapm_add_routes(dapm,
859 lineout1_diff_routes, 863 lineout1_diff_routes,
860 ARRAY_SIZE(lineout1_diff_routes)); 864 ARRAY_SIZE(lineout1_diff_routes));
861 else 865 else
862 snd_soc_dapm_add_routes(codec, 866 snd_soc_dapm_add_routes(dapm,
863 lineout1_se_routes, 867 lineout1_se_routes,
864 ARRAY_SIZE(lineout1_se_routes)); 868 ARRAY_SIZE(lineout1_se_routes));
865 869
866 if (lineout2_diff) 870 if (lineout2_diff)
867 snd_soc_dapm_add_routes(codec, 871 snd_soc_dapm_add_routes(dapm,
868 lineout2_diff_routes, 872 lineout2_diff_routes,
869 ARRAY_SIZE(lineout2_diff_routes)); 873 ARRAY_SIZE(lineout2_diff_routes));
870 else 874 else
871 snd_soc_dapm_add_routes(codec, 875 snd_soc_dapm_add_routes(dapm,
872 lineout2_se_routes, 876 lineout2_se_routes,
873 ARRAY_SIZE(lineout2_se_routes)); 877 ARRAY_SIZE(lineout2_se_routes));
874 878
@@ -895,7 +899,7 @@ int wm_hubs_handle_analogue_pdata(struct snd_soc_codec *codec,
895 * VMID as an output and can disable it. 899 * VMID as an output and can disable it.
896 */ 900 */
897 if (lineout1_diff && lineout2_diff) 901 if (lineout1_diff && lineout2_diff)
898 codec->idle_bias_off = 1; 902 codec->dapm.idle_bias_off = 1;
899 903
900 if (lineout1fb) 904 if (lineout1fb)
901 snd_soc_update_bits(codec, WM8993_ADDITIONAL_CONTROL, 905 snd_soc_update_bits(codec, WM8993_ADDITIONAL_CONTROL,