Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: codecs: rt286: Reorganize jack detect handling

Clean up in order to use and expose .set_jack callback.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://lore.kernel.org/r/20220609133541.3984886-3-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Cezary Rojewski and committed by
Mark Brown
3082afe0 a43b4394

+10 -17
+6 -11
sound/soc/codecs/rt286.c
··· 311 311 SND_JACK_MICROPHONE | SND_JACK_HEADPHONE); 312 312 } 313 313 314 - int rt286_mic_detect(struct snd_soc_component *component, struct snd_soc_jack *jack) 314 + static int rt286_mic_detect(struct snd_soc_component *component, 315 + struct snd_soc_jack *jack, void *data) 315 316 { 316 317 struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); 317 318 struct rt286_priv *rt286 = snd_soc_component_get_drvdata(component); ··· 336 335 337 336 return 0; 338 337 } 339 - EXPORT_SYMBOL_GPL(rt286_mic_detect); 340 338 341 339 static int is_mclk_mode(struct snd_soc_dapm_widget *source, 342 340 struct snd_soc_dapm_widget *sink) ··· 947 947 struct rt286_priv *rt286 = snd_soc_component_get_drvdata(component); 948 948 949 949 rt286->component = component; 950 + INIT_DELAYED_WORK(&rt286->jack_detect_work, rt286_jack_detect_work); 950 951 951 - if (rt286->i2c->irq) { 952 - regmap_update_bits(rt286->regmap, 953 - RT286_IRQ_CTRL, 0x2, 0x2); 954 - 955 - INIT_DELAYED_WORK(&rt286->jack_detect_work, 956 - rt286_jack_detect_work); 952 + if (rt286->i2c->irq) 957 953 schedule_delayed_work(&rt286->jack_detect_work, 958 - msecs_to_jiffies(1250)); 959 - } 960 - 954 + msecs_to_jiffies(50)); 961 955 return 0; 962 956 } 963 957 ··· 1049 1055 .suspend = rt286_suspend, 1050 1056 .resume = rt286_resume, 1051 1057 .set_bias_level = rt286_set_bias_level, 1058 + .set_jack = rt286_mic_detect, 1052 1059 .controls = rt286_snd_controls, 1053 1060 .num_controls = ARRAY_SIZE(rt286_snd_controls), 1054 1061 .dapm_widgets = rt286_dapm_widgets,
-2
sound/soc/codecs/rt286.h
··· 196 196 RT286_AIFS, 197 197 }; 198 198 199 - int rt286_mic_detect(struct snd_soc_component *component, struct snd_soc_jack *jack); 200 - 201 199 #endif /* __RT286_H__ */ 202 200
+3 -3
sound/soc/intel/boards/broadwell.c
··· 75 75 if (ret) 76 76 return ret; 77 77 78 - rt286_mic_detect(component, &broadwell_headset); 78 + snd_soc_component_set_jack(component, &broadwell_headset, NULL); 79 79 return 0; 80 80 } 81 81 ··· 235 235 if (!strcmp(component->name, "i2c-INT343A:00")) { 236 236 237 237 dev_dbg(component->dev, "disabling jack detect before going to suspend.\n"); 238 - rt286_mic_detect(component, NULL); 238 + snd_soc_component_set_jack(component, NULL, NULL); 239 239 break; 240 240 } 241 241 } ··· 255 255 if (!strcmp(component->name, "i2c-INT343A:00")) { 256 256 257 257 dev_dbg(component->dev, "enabling jack detect for resume.\n"); 258 - rt286_mic_detect(component, &broadwell_headset); 258 + snd_soc_component_set_jack(component, &broadwell_headset, NULL); 259 259 break; 260 260 } 261 261 }
+1 -1
sound/soc/intel/boards/skl_rt286.c
··· 133 133 if (ret) 134 134 return ret; 135 135 136 - rt286_mic_detect(component, &skylake_headset); 136 + snd_soc_component_set_jack(component, &skylake_headset, NULL); 137 137 138 138 snd_soc_dapm_ignore_suspend(&rtd->card->dapm, "SoC DMIC"); 139 139