aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2014-08-20 07:08:48 -0400
committerMark Brown <broonie@linaro.org>2014-09-06 09:44:33 -0400
commit923976a30b36ce0970e88f53ed2f2b5b61aeeb73 (patch)
tree45f6103eb1890dde470fd46c114dbcb4aaeacd3e
parentbd033808e2b160bab61cfe18b0ecb4ccc7809516 (diff)
ASoC: sst-haswell-pcm: Move controls and DAPM elements to component
The sst-haswell-pcm driver registers both a snd_soc_component and a snd_soc_platform and expects that the DAPM widgets for the DAIs registered by component are added to the DAPM context of the platform. This requires us to have a hack in the ASoC core which does so. Moving the DAPM elements over to the component allows us to remove this hack. While we are at it also move the controls over to the component. The controls don't need the platform for anything other than snd_soc_platform_get_drvdata(), this can easily be replaced by snd_soc_component_get_drvdata(). As the long term goal is to register only a single component this is a step in the right direction. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
-rw-r--r--sound/soc/intel/sst-haswell-pcm.c32
1 files changed, 15 insertions, 17 deletions
diff --git a/sound/soc/intel/sst-haswell-pcm.c b/sound/soc/intel/sst-haswell-pcm.c
index 1de095876857..33fc5c3abf55 100644
--- a/sound/soc/intel/sst-haswell-pcm.c
+++ b/sound/soc/intel/sst-haswell-pcm.c
@@ -138,11 +138,10 @@ static inline unsigned int hsw_ipc_to_mixer(u32 value)
138static int hsw_stream_volume_put(struct snd_kcontrol *kcontrol, 138static int hsw_stream_volume_put(struct snd_kcontrol *kcontrol,
139 struct snd_ctl_elem_value *ucontrol) 139 struct snd_ctl_elem_value *ucontrol)
140{ 140{
141 struct snd_soc_platform *platform = snd_soc_kcontrol_platform(kcontrol); 141 struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
142 struct hsw_priv_data *pdata = snd_soc_component_get_drvdata(cmpnt);
142 struct soc_mixer_control *mc = 143 struct soc_mixer_control *mc =
143 (struct soc_mixer_control *)kcontrol->private_value; 144 (struct soc_mixer_control *)kcontrol->private_value;
144 struct hsw_priv_data *pdata =
145 snd_soc_platform_get_drvdata(platform);
146 struct hsw_pcm_data *pcm_data = &pdata->pcm[mc->reg]; 145 struct hsw_pcm_data *pcm_data = &pdata->pcm[mc->reg];
147 struct sst_hsw *hsw = pdata->hsw; 146 struct sst_hsw *hsw = pdata->hsw;
148 u32 volume; 147 u32 volume;
@@ -176,11 +175,10 @@ static int hsw_stream_volume_put(struct snd_kcontrol *kcontrol,
176static int hsw_stream_volume_get(struct snd_kcontrol *kcontrol, 175static int hsw_stream_volume_get(struct snd_kcontrol *kcontrol,
177 struct snd_ctl_elem_value *ucontrol) 176 struct snd_ctl_elem_value *ucontrol)
178{ 177{
179 struct snd_soc_platform *platform = snd_soc_kcontrol_platform(kcontrol); 178 struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
179 struct hsw_priv_data *pdata = snd_soc_component_get_drvdata(cmpnt);
180 struct soc_mixer_control *mc = 180 struct soc_mixer_control *mc =
181 (struct soc_mixer_control *)kcontrol->private_value; 181 (struct soc_mixer_control *)kcontrol->private_value;
182 struct hsw_priv_data *pdata =
183 snd_soc_platform_get_drvdata(platform);
184 struct hsw_pcm_data *pcm_data = &pdata->pcm[mc->reg]; 182 struct hsw_pcm_data *pcm_data = &pdata->pcm[mc->reg];
185 struct sst_hsw *hsw = pdata->hsw; 183 struct sst_hsw *hsw = pdata->hsw;
186 u32 volume; 184 u32 volume;
@@ -208,8 +206,8 @@ static int hsw_stream_volume_get(struct snd_kcontrol *kcontrol,
208static int hsw_volume_put(struct snd_kcontrol *kcontrol, 206static int hsw_volume_put(struct snd_kcontrol *kcontrol,
209 struct snd_ctl_elem_value *ucontrol) 207 struct snd_ctl_elem_value *ucontrol)
210{ 208{
211 struct snd_soc_platform *platform = snd_soc_kcontrol_platform(kcontrol); 209 struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
212 struct hsw_priv_data *pdata = snd_soc_platform_get_drvdata(platform); 210 struct hsw_priv_data *pdata = snd_soc_component_get_drvdata(cmpnt);
213 struct sst_hsw *hsw = pdata->hsw; 211 struct sst_hsw *hsw = pdata->hsw;
214 u32 volume; 212 u32 volume;
215 213
@@ -233,8 +231,8 @@ static int hsw_volume_put(struct snd_kcontrol *kcontrol,
233static int hsw_volume_get(struct snd_kcontrol *kcontrol, 231static int hsw_volume_get(struct snd_kcontrol *kcontrol,
234 struct snd_ctl_elem_value *ucontrol) 232 struct snd_ctl_elem_value *ucontrol)
235{ 233{
236 struct snd_soc_platform *platform = snd_soc_kcontrol_platform(kcontrol); 234 struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
237 struct hsw_priv_data *pdata = snd_soc_platform_get_drvdata(platform); 235 struct hsw_priv_data *pdata = snd_soc_component_get_drvdata(cmpnt);
238 struct sst_hsw *hsw = pdata->hsw; 236 struct sst_hsw *hsw = pdata->hsw;
239 unsigned int volume = 0; 237 unsigned int volume = 0;
240 238
@@ -839,16 +837,16 @@ static struct snd_soc_platform_driver hsw_soc_platform = {
839 .ops = &hsw_pcm_ops, 837 .ops = &hsw_pcm_ops,
840 .pcm_new = hsw_pcm_new, 838 .pcm_new = hsw_pcm_new,
841 .pcm_free = hsw_pcm_free, 839 .pcm_free = hsw_pcm_free,
842 .controls = hsw_volume_controls,
843 .num_controls = ARRAY_SIZE(hsw_volume_controls),
844 .dapm_widgets = widgets,
845 .num_dapm_widgets = ARRAY_SIZE(widgets),
846 .dapm_routes = graph,
847 .num_dapm_routes = ARRAY_SIZE(graph),
848}; 840};
849 841
850static const struct snd_soc_component_driver hsw_dai_component = { 842static const struct snd_soc_component_driver hsw_dai_component = {
851 .name = "haswell-dai", 843 .name = "haswell-dai",
844 .controls = hsw_volume_controls,
845 .num_controls = ARRAY_SIZE(hsw_volume_controls),
846 .dapm_widgets = widgets,
847 .num_dapm_widgets = ARRAY_SIZE(widgets),
848 .dapm_routes = graph,
849 .num_dapm_routes = ARRAY_SIZE(graph),
852}; 850};
853 851
854static int hsw_pcm_dev_probe(struct platform_device *pdev) 852static int hsw_pcm_dev_probe(struct platform_device *pdev)