aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/intel/mfld_machine.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/intel/mfld_machine.c')
-rw-r--r--sound/soc/intel/mfld_machine.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/sound/soc/intel/mfld_machine.c b/sound/soc/intel/mfld_machine.c
index 90b7a57713a0..49c09a0add79 100644
--- a/sound/soc/intel/mfld_machine.c
+++ b/sound/soc/intel/mfld_machine.c
@@ -228,10 +228,13 @@ static void mfld_jack_check(unsigned int intr_status)
228{ 228{
229 struct mfld_jack_data jack_data; 229 struct mfld_jack_data jack_data;
230 230
231 if (!mfld_codec)
232 return;
233
231 jack_data.mfld_jack = &mfld_jack; 234 jack_data.mfld_jack = &mfld_jack;
232 jack_data.intr_id = intr_status; 235 jack_data.intr_id = intr_status;
233 236
234 sn95031_jack_detection(&jack_data); 237 sn95031_jack_detection(mfld_codec, &jack_data);
235 /* TODO: add american headset detection post gpiolib support */ 238 /* TODO: add american headset detection post gpiolib support */
236} 239}
237 240
@@ -240,8 +243,6 @@ static int mfld_init(struct snd_soc_pcm_runtime *runtime)
240 struct snd_soc_dapm_context *dapm = &runtime->card->dapm; 243 struct snd_soc_dapm_context *dapm = &runtime->card->dapm;
241 int ret_val; 244 int ret_val;
242 245
243 mfld_codec = runtime->codec;
244
245 /* default is earpiece pin, userspace sets it explcitly */ 246 /* default is earpiece pin, userspace sets it explcitly */
246 snd_soc_dapm_disable_pin(dapm, "Headphones"); 247 snd_soc_dapm_disable_pin(dapm, "Headphones");
247 /* default is lineout NC, userspace sets it explcitly */ 248 /* default is lineout NC, userspace sets it explcitly */
@@ -254,20 +255,15 @@ static int mfld_init(struct snd_soc_pcm_runtime *runtime)
254 snd_soc_dapm_disable_pin(dapm, "LINEINR"); 255 snd_soc_dapm_disable_pin(dapm, "LINEINR");
255 256
256 /* Headset and button jack detection */ 257 /* Headset and button jack detection */
257 ret_val = snd_soc_jack_new(mfld_codec, "Intel(R) MID Audio Jack", 258 ret_val = snd_soc_card_jack_new(runtime->card,
258 SND_JACK_HEADSET | SND_JACK_BTN_0 | 259 "Intel(R) MID Audio Jack", SND_JACK_HEADSET |
259 SND_JACK_BTN_1, &mfld_jack); 260 SND_JACK_BTN_0 | SND_JACK_BTN_1, &mfld_jack,
261 mfld_jack_pins, ARRAY_SIZE(mfld_jack_pins));
260 if (ret_val) { 262 if (ret_val) {
261 pr_err("jack creation failed\n"); 263 pr_err("jack creation failed\n");
262 return ret_val; 264 return ret_val;
263 } 265 }
264 266
265 ret_val = snd_soc_jack_add_pins(&mfld_jack,
266 ARRAY_SIZE(mfld_jack_pins), mfld_jack_pins);
267 if (ret_val) {
268 pr_err("adding jack pins failed\n");
269 return ret_val;
270 }
271 ret_val = snd_soc_jack_add_zones(&mfld_jack, 267 ret_val = snd_soc_jack_add_zones(&mfld_jack,
272 ARRAY_SIZE(mfld_zones), mfld_zones); 268 ARRAY_SIZE(mfld_zones), mfld_zones);
273 if (ret_val) { 269 if (ret_val) {
@@ -275,6 +271,8 @@ static int mfld_init(struct snd_soc_pcm_runtime *runtime)
275 return ret_val; 271 return ret_val;
276 } 272 }
277 273
274 mfld_codec = runtime->codec;
275
278 /* we want to check if anything is inserted at boot, 276 /* we want to check if anything is inserted at boot,
279 * so send a fake event to codec and it will read adc 277 * so send a fake event to codec and it will read adc
280 * to find if anything is there or not */ 278 * to find if anything is there or not */
@@ -359,8 +357,6 @@ static irqreturn_t snd_mfld_jack_detection(int irq, void *data)
359{ 357{
360 struct mfld_mc_private *mc_drv_ctx = (struct mfld_mc_private *) data; 358 struct mfld_mc_private *mc_drv_ctx = (struct mfld_mc_private *) data;
361 359
362 if (mfld_jack.codec == NULL)
363 return IRQ_HANDLED;
364 mfld_jack_check(mc_drv_ctx->interrupt_status); 360 mfld_jack_check(mc_drv_ctx->interrupt_status);
365 361
366 return IRQ_HANDLED; 362 return IRQ_HANDLED;