aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sound/soc/codecs/wm8958-dsp2.c28
-rw-r--r--sound/soc/codecs/wm8994.c28
-rw-r--r--sound/soc/codecs/wm8994.h1
-rw-r--r--sound/soc/codecs/wm_hubs.c2
-rw-r--r--sound/soc/codecs/wm_hubs.h2
5 files changed, 33 insertions, 28 deletions
diff --git a/sound/soc/codecs/wm8958-dsp2.c b/sound/soc/codecs/wm8958-dsp2.c
index 1332692ef81b..00121ba36597 100644
--- a/sound/soc/codecs/wm8958-dsp2.c
+++ b/sound/soc/codecs/wm8958-dsp2.c
@@ -946,7 +946,7 @@ void wm8958_dsp2_init(struct snd_soc_codec *codec)
946 wm8994->mbc_texts = kmalloc(sizeof(char *) 946 wm8994->mbc_texts = kmalloc(sizeof(char *)
947 * pdata->num_mbc_cfgs, GFP_KERNEL); 947 * pdata->num_mbc_cfgs, GFP_KERNEL);
948 if (!wm8994->mbc_texts) { 948 if (!wm8994->mbc_texts) {
949 dev_err(wm8994->codec->dev, 949 dev_err(wm8994->hubs.codec->dev,
950 "Failed to allocate %d MBC config texts\n", 950 "Failed to allocate %d MBC config texts\n",
951 pdata->num_mbc_cfgs); 951 pdata->num_mbc_cfgs);
952 return; 952 return;
@@ -958,9 +958,10 @@ void wm8958_dsp2_init(struct snd_soc_codec *codec)
958 wm8994->mbc_enum.max = pdata->num_mbc_cfgs; 958 wm8994->mbc_enum.max = pdata->num_mbc_cfgs;
959 wm8994->mbc_enum.texts = wm8994->mbc_texts; 959 wm8994->mbc_enum.texts = wm8994->mbc_texts;
960 960
961 ret = snd_soc_add_codec_controls(wm8994->codec, control, 1); 961 ret = snd_soc_add_codec_controls(wm8994->hubs.codec,
962 control, 1);
962 if (ret != 0) 963 if (ret != 0)
963 dev_err(wm8994->codec->dev, 964 dev_err(wm8994->hubs.codec->dev,
964 "Failed to add MBC mode controls: %d\n", ret); 965 "Failed to add MBC mode controls: %d\n", ret);
965 } 966 }
966 967
@@ -974,7 +975,7 @@ void wm8958_dsp2_init(struct snd_soc_codec *codec)
974 wm8994->vss_texts = kmalloc(sizeof(char *) 975 wm8994->vss_texts = kmalloc(sizeof(char *)
975 * pdata->num_vss_cfgs, GFP_KERNEL); 976 * pdata->num_vss_cfgs, GFP_KERNEL);
976 if (!wm8994->vss_texts) { 977 if (!wm8994->vss_texts) {
977 dev_err(wm8994->codec->dev, 978 dev_err(wm8994->hubs.codec->dev,
978 "Failed to allocate %d VSS config texts\n", 979 "Failed to allocate %d VSS config texts\n",
979 pdata->num_vss_cfgs); 980 pdata->num_vss_cfgs);
980 return; 981 return;
@@ -986,9 +987,10 @@ void wm8958_dsp2_init(struct snd_soc_codec *codec)
986 wm8994->vss_enum.max = pdata->num_vss_cfgs; 987 wm8994->vss_enum.max = pdata->num_vss_cfgs;
987 wm8994->vss_enum.texts = wm8994->vss_texts; 988 wm8994->vss_enum.texts = wm8994->vss_texts;
988 989
989 ret = snd_soc_add_codec_controls(wm8994->codec, control, 1); 990 ret = snd_soc_add_codec_controls(wm8994->hubs.codec,
991 control, 1);
990 if (ret != 0) 992 if (ret != 0)
991 dev_err(wm8994->codec->dev, 993 dev_err(wm8994->hubs.codec->dev,
992 "Failed to add VSS mode controls: %d\n", ret); 994 "Failed to add VSS mode controls: %d\n", ret);
993 } 995 }
994 996
@@ -1003,7 +1005,7 @@ void wm8958_dsp2_init(struct snd_soc_codec *codec)
1003 wm8994->vss_hpf_texts = kmalloc(sizeof(char *) 1005 wm8994->vss_hpf_texts = kmalloc(sizeof(char *)
1004 * pdata->num_vss_hpf_cfgs, GFP_KERNEL); 1006 * pdata->num_vss_hpf_cfgs, GFP_KERNEL);
1005 if (!wm8994->vss_hpf_texts) { 1007 if (!wm8994->vss_hpf_texts) {
1006 dev_err(wm8994->codec->dev, 1008 dev_err(wm8994->hubs.codec->dev,
1007 "Failed to allocate %d VSS HPF config texts\n", 1009 "Failed to allocate %d VSS HPF config texts\n",
1008 pdata->num_vss_hpf_cfgs); 1010 pdata->num_vss_hpf_cfgs);
1009 return; 1011 return;
@@ -1015,9 +1017,10 @@ void wm8958_dsp2_init(struct snd_soc_codec *codec)
1015 wm8994->vss_hpf_enum.max = pdata->num_vss_hpf_cfgs; 1017 wm8994->vss_hpf_enum.max = pdata->num_vss_hpf_cfgs;
1016 wm8994->vss_hpf_enum.texts = wm8994->vss_hpf_texts; 1018 wm8994->vss_hpf_enum.texts = wm8994->vss_hpf_texts;
1017 1019
1018 ret = snd_soc_add_codec_controls(wm8994->codec, control, 1); 1020 ret = snd_soc_add_codec_controls(wm8994->hubs.codec,
1021 control, 1);
1019 if (ret != 0) 1022 if (ret != 0)
1020 dev_err(wm8994->codec->dev, 1023 dev_err(wm8994->hubs.codec->dev,
1021 "Failed to add VSS HPFmode controls: %d\n", 1024 "Failed to add VSS HPFmode controls: %d\n",
1022 ret); 1025 ret);
1023 } 1026 }
@@ -1033,7 +1036,7 @@ void wm8958_dsp2_init(struct snd_soc_codec *codec)
1033 wm8994->enh_eq_texts = kmalloc(sizeof(char *) 1036 wm8994->enh_eq_texts = kmalloc(sizeof(char *)
1034 * pdata->num_enh_eq_cfgs, GFP_KERNEL); 1037 * pdata->num_enh_eq_cfgs, GFP_KERNEL);
1035 if (!wm8994->enh_eq_texts) { 1038 if (!wm8994->enh_eq_texts) {
1036 dev_err(wm8994->codec->dev, 1039 dev_err(wm8994->hubs.codec->dev,
1037 "Failed to allocate %d enhanced EQ config texts\n", 1040 "Failed to allocate %d enhanced EQ config texts\n",
1038 pdata->num_enh_eq_cfgs); 1041 pdata->num_enh_eq_cfgs);
1039 return; 1042 return;
@@ -1045,9 +1048,10 @@ void wm8958_dsp2_init(struct snd_soc_codec *codec)
1045 wm8994->enh_eq_enum.max = pdata->num_enh_eq_cfgs; 1048 wm8994->enh_eq_enum.max = pdata->num_enh_eq_cfgs;
1046 wm8994->enh_eq_enum.texts = wm8994->enh_eq_texts; 1049 wm8994->enh_eq_enum.texts = wm8994->enh_eq_texts;
1047 1050
1048 ret = snd_soc_add_codec_controls(wm8994->codec, control, 1); 1051 ret = snd_soc_add_codec_controls(wm8994->hubs.codec,
1052 control, 1);
1049 if (ret != 0) 1053 if (ret != 0)
1050 dev_err(wm8994->codec->dev, 1054 dev_err(wm8994->hubs.codec->dev,
1051 "Failed to add enhanced EQ controls: %d\n", 1055 "Failed to add enhanced EQ controls: %d\n",
1052 ret); 1056 ret);
1053 } 1057 }
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c
index 2c9b8b7fdf3d..1237c11c8c35 100644
--- a/sound/soc/codecs/wm8994.c
+++ b/sound/soc/codecs/wm8994.c
@@ -3036,7 +3036,7 @@ static int wm8994_codec_resume(struct snd_soc_codec *codec)
3036 3036
3037static void wm8994_handle_retune_mobile_pdata(struct wm8994_priv *wm8994) 3037static void wm8994_handle_retune_mobile_pdata(struct wm8994_priv *wm8994)
3038{ 3038{
3039 struct snd_soc_codec *codec = wm8994->codec; 3039 struct snd_soc_codec *codec = wm8994->hubs.codec;
3040 struct wm8994_pdata *pdata = wm8994->pdata; 3040 struct wm8994_pdata *pdata = wm8994->pdata;
3041 struct snd_kcontrol_new controls[] = { 3041 struct snd_kcontrol_new controls[] = {
3042 SOC_ENUM_EXT("AIF1.1 EQ Mode", 3042 SOC_ENUM_EXT("AIF1.1 EQ Mode",
@@ -3094,16 +3094,16 @@ static void wm8994_handle_retune_mobile_pdata(struct wm8994_priv *wm8994)
3094 wm8994->retune_mobile_enum.max = wm8994->num_retune_mobile_texts; 3094 wm8994->retune_mobile_enum.max = wm8994->num_retune_mobile_texts;
3095 wm8994->retune_mobile_enum.texts = wm8994->retune_mobile_texts; 3095 wm8994->retune_mobile_enum.texts = wm8994->retune_mobile_texts;
3096 3096
3097 ret = snd_soc_add_codec_controls(wm8994->codec, controls, 3097 ret = snd_soc_add_codec_controls(wm8994->hubs.codec, controls,
3098 ARRAY_SIZE(controls)); 3098 ARRAY_SIZE(controls));
3099 if (ret != 0) 3099 if (ret != 0)
3100 dev_err(wm8994->codec->dev, 3100 dev_err(wm8994->hubs.codec->dev,
3101 "Failed to add ReTune Mobile controls: %d\n", ret); 3101 "Failed to add ReTune Mobile controls: %d\n", ret);
3102} 3102}
3103 3103
3104static void wm8994_handle_pdata(struct wm8994_priv *wm8994) 3104static void wm8994_handle_pdata(struct wm8994_priv *wm8994)
3105{ 3105{
3106 struct snd_soc_codec *codec = wm8994->codec; 3106 struct snd_soc_codec *codec = wm8994->hubs.codec;
3107 struct wm8994_pdata *pdata = wm8994->pdata; 3107 struct wm8994_pdata *pdata = wm8994->pdata;
3108 int ret, i; 3108 int ret, i;
3109 3109
@@ -3132,10 +3132,10 @@ static void wm8994_handle_pdata(struct wm8994_priv *wm8994)
3132 }; 3132 };
3133 3133
3134 /* We need an array of texts for the enum API */ 3134 /* We need an array of texts for the enum API */
3135 wm8994->drc_texts = devm_kzalloc(wm8994->codec->dev, 3135 wm8994->drc_texts = devm_kzalloc(wm8994->hubs.codec->dev,
3136 sizeof(char *) * pdata->num_drc_cfgs, GFP_KERNEL); 3136 sizeof(char *) * pdata->num_drc_cfgs, GFP_KERNEL);
3137 if (!wm8994->drc_texts) { 3137 if (!wm8994->drc_texts) {
3138 dev_err(wm8994->codec->dev, 3138 dev_err(wm8994->hubs.codec->dev,
3139 "Failed to allocate %d DRC config texts\n", 3139 "Failed to allocate %d DRC config texts\n",
3140 pdata->num_drc_cfgs); 3140 pdata->num_drc_cfgs);
3141 return; 3141 return;
@@ -3147,10 +3147,10 @@ static void wm8994_handle_pdata(struct wm8994_priv *wm8994)
3147 wm8994->drc_enum.max = pdata->num_drc_cfgs; 3147 wm8994->drc_enum.max = pdata->num_drc_cfgs;
3148 wm8994->drc_enum.texts = wm8994->drc_texts; 3148 wm8994->drc_enum.texts = wm8994->drc_texts;
3149 3149
3150 ret = snd_soc_add_codec_controls(wm8994->codec, controls, 3150 ret = snd_soc_add_codec_controls(wm8994->hubs.codec, controls,
3151 ARRAY_SIZE(controls)); 3151 ARRAY_SIZE(controls));
3152 if (ret != 0) 3152 if (ret != 0)
3153 dev_err(wm8994->codec->dev, 3153 dev_err(wm8994->hubs.codec->dev,
3154 "Failed to add DRC mode controls: %d\n", ret); 3154 "Failed to add DRC mode controls: %d\n", ret);
3155 3155
3156 for (i = 0; i < WM8994_NUM_DRC; i++) 3156 for (i = 0; i < WM8994_NUM_DRC; i++)
@@ -3163,7 +3163,7 @@ static void wm8994_handle_pdata(struct wm8994_priv *wm8994)
3163 if (pdata->num_retune_mobile_cfgs) 3163 if (pdata->num_retune_mobile_cfgs)
3164 wm8994_handle_retune_mobile_pdata(wm8994); 3164 wm8994_handle_retune_mobile_pdata(wm8994);
3165 else 3165 else
3166 snd_soc_add_codec_controls(wm8994->codec, wm8994_eq_controls, 3166 snd_soc_add_codec_controls(wm8994->hubs.codec, wm8994_eq_controls,
3167 ARRAY_SIZE(wm8994_eq_controls)); 3167 ARRAY_SIZE(wm8994_eq_controls));
3168 3168
3169 for (i = 0; i < ARRAY_SIZE(pdata->micbias); i++) { 3169 for (i = 0; i < ARRAY_SIZE(pdata->micbias); i++) {
@@ -3318,7 +3318,7 @@ static void wm8994_mic_work(struct work_struct *work)
3318static irqreturn_t wm8994_mic_irq(int irq, void *data) 3318static irqreturn_t wm8994_mic_irq(int irq, void *data)
3319{ 3319{
3320 struct wm8994_priv *priv = data; 3320 struct wm8994_priv *priv = data;
3321 struct snd_soc_codec *codec = priv->codec; 3321 struct snd_soc_codec *codec = priv->hubs.codec;
3322 3322
3323#ifndef CONFIG_SND_SOC_WM8994_MODULE 3323#ifndef CONFIG_SND_SOC_WM8994_MODULE
3324 trace_snd_soc_jack_irq(dev_name(codec->dev)); 3324 trace_snd_soc_jack_irq(dev_name(codec->dev));
@@ -3431,7 +3431,7 @@ static void wm8958_default_micdet(u16 status, void *data)
3431static irqreturn_t wm1811_jackdet_irq(int irq, void *data) 3431static irqreturn_t wm1811_jackdet_irq(int irq, void *data)
3432{ 3432{
3433 struct wm8994_priv *wm8994 = data; 3433 struct wm8994_priv *wm8994 = data;
3434 struct snd_soc_codec *codec = wm8994->codec; 3434 struct snd_soc_codec *codec = wm8994->hubs.codec;
3435 int reg; 3435 int reg;
3436 bool present; 3436 bool present;
3437 3437
@@ -3609,7 +3609,7 @@ EXPORT_SYMBOL_GPL(wm8958_mic_detect);
3609static irqreturn_t wm8958_mic_irq(int irq, void *data) 3609static irqreturn_t wm8958_mic_irq(int irq, void *data)
3610{ 3610{
3611 struct wm8994_priv *wm8994 = data; 3611 struct wm8994_priv *wm8994 = data;
3612 struct snd_soc_codec *codec = wm8994->codec; 3612 struct snd_soc_codec *codec = wm8994->hubs.codec;
3613 int reg, count; 3613 int reg, count;
3614 3614
3615 /* 3615 /*
@@ -3699,13 +3699,11 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec)
3699 unsigned int reg; 3699 unsigned int reg;
3700 int ret, i; 3700 int ret, i;
3701 3701
3702 wm8994->codec = codec; 3702 wm8994->hubs.codec = codec;
3703 codec->control_data = control->regmap; 3703 codec->control_data = control->regmap;
3704 3704
3705 snd_soc_codec_set_cache_io(codec, 16, 16, SND_SOC_REGMAP); 3705 snd_soc_codec_set_cache_io(codec, 16, 16, SND_SOC_REGMAP);
3706 3706
3707 wm8994->codec = codec;
3708
3709 mutex_init(&wm8994->accdet_lock); 3707 mutex_init(&wm8994->accdet_lock);
3710 INIT_DELAYED_WORK(&wm8994->mic_work, wm8994_mic_work); 3708 INIT_DELAYED_WORK(&wm8994->mic_work, wm8994_mic_work);
3711 3709
diff --git a/sound/soc/codecs/wm8994.h b/sound/soc/codecs/wm8994.h
index 19068d8fa301..e6d8209b8f29 100644
--- a/sound/soc/codecs/wm8994.h
+++ b/sound/soc/codecs/wm8994.h
@@ -73,7 +73,6 @@ struct wm8994;
73struct wm8994_priv { 73struct wm8994_priv {
74 struct wm_hubs_data hubs; 74 struct wm_hubs_data hubs;
75 struct wm8994 *wm8994; 75 struct wm8994 *wm8994;
76 struct snd_soc_codec *codec;
77 int sysclk[2]; 76 int sysclk[2];
78 int sysclk_rate[2]; 77 int sysclk_rate[2];
79 int mclk[2]; 78 int mclk[2];
diff --git a/sound/soc/codecs/wm_hubs.c b/sound/soc/codecs/wm_hubs.c
index 61baa48823cb..728a18010a49 100644
--- a/sound/soc/codecs/wm_hubs.c
+++ b/sound/soc/codecs/wm_hubs.c
@@ -1112,6 +1112,8 @@ int wm_hubs_add_analogue_routes(struct snd_soc_codec *codec,
1112 struct wm_hubs_data *hubs = snd_soc_codec_get_drvdata(codec); 1112 struct wm_hubs_data *hubs = snd_soc_codec_get_drvdata(codec);
1113 struct snd_soc_dapm_context *dapm = &codec->dapm; 1113 struct snd_soc_dapm_context *dapm = &codec->dapm;
1114 1114
1115 hubs->codec = codec;
1116
1115 INIT_LIST_HEAD(&hubs->dcs_cache); 1117 INIT_LIST_HEAD(&hubs->dcs_cache);
1116 init_completion(&hubs->dcs_done); 1118 init_completion(&hubs->dcs_done);
1117 1119
diff --git a/sound/soc/codecs/wm_hubs.h b/sound/soc/codecs/wm_hubs.h
index da2dc899ce6d..a5a09e6f87d5 100644
--- a/sound/soc/codecs/wm_hubs.h
+++ b/sound/soc/codecs/wm_hubs.h
@@ -46,6 +46,8 @@ struct wm_hubs_data {
46 46
47 bool dcs_done_irq; 47 bool dcs_done_irq;
48 struct completion dcs_done; 48 struct completion dcs_done;
49
50 struct snd_soc_codec *codec;
49}; 51};
50 52
51extern int wm_hubs_add_analogue_controls(struct snd_soc_codec *); 53extern int wm_hubs_add_analogue_controls(struct snd_soc_codec *);