Repository navigation
Shikra mbhc - #1323
Shikra mbhc#1323mohsRafi wants to merge 4 commits into
Conversation
…perties The binding already describes qcom,mbhc-buttons-vthreshold-microvolt, but not the rest of the data the MBHC block needs to detect a 3.5mm jack, even though wcd_dt_parse_mbhc_data() reads all of it from the codec node and the schema has unevaluatedProperties set to false. A board that describes its jack is therefore rejected by the schema. Document the remaining four properties, matching the descriptions used for the same properties in qcom,wcd93xx-common.yaml: - qcom,hphl-jack-type-normally-closed and qcom,ground-jack-type-normally-closed describe the board's jack switches. The MBHC logic has to know the idle state of the HPHL and ground switches to tell an insertion from a removal. - qcom,mbhc-headset-vthreshold-microvolt and qcom,mbhc-headphone-vthreshold-microvolt are the ADC thresholds that separate a headset from a headphone and a headphone from a floating jack. They are board specific because they depend on the jack wiring and on the microphone bias voltage they are measured against. All four stay optional, as they are for the wcd93xx codecs: the driver derives the thresholds from the microphone bias voltage when they are absent and assumes normally open switches, so existing device trees keep working unchanged. Assisted-by: Claude Opus 5 Link: https://lore.kernel.org/all/20261015-pm4125_mbhc_support-v1-1-8bc1212db6f7@oss.qualcomm.com/ Signed-off-by: Mohammad Rafi Shaik <mohammad.rafi.shaik@oss.qualcomm.com>
pm4125_mbhc_program_btn_thr() pre-shifts the computed threshold by two bits before handing it to snd_soc_component_write_field(). That helper already shifts the value by the number of trailing zeroes of the mask, so with PM4125_ANA_MBHC_BTN0_THRESHOLD_MASK being GENMASK(7, 2) the value gets shifted twice. The two most significant bits of the threshold are shifted out past the mask and the remaining bits land four times too high, so every button voltage is programmed wrong and button presses on a headset are either missed or reported as the wrong button. Pass the unshifted value and let the helper place it in the field. Link: https://lore.kernel.org/all/20261015-pm4125_mbhc_support-v1-2-8bc1212db6f7@oss.qualcomm.com/ Fixes: 8ad5294 ("ASoC: codecs: add new pm4125 audio codec driver") Assisted-by: Claude Opus 5 Signed-off-by: Mohammad Rafi Shaik <mohammad.rafi.shaik@oss.qualcomm.com>
…nced The analog master bias is shared between the microphone bias supplies and the playback and capture paths, so pm4125_global_mbias_enable() and pm4125_global_mbias_disable() reference count it and only touch PM4125_ANA_MBIAS_EN for the first user and the last one. MICB_DISABLE clamps the per-supply reference count at zero but then evaluates the enable and pull-up counts regardless, so a release that has no matching request still reaches pm4125_global_mbias_disable() and drops a reference it never took. The MBHC framework issues exactly such a release: it takes MIC_BIAS_2 once when it starts detecting a plug type and releases it both at the end of the correction work and again from wcd_micbias_disable(). Inserting a jack while a stream is running therefore switches the analog master bias off underneath it, leaving the path up but silent, and it stays silent until another stream takes the first reference again. Return early when there is nothing to release, so the hardware is only touched for a request that was actually made. While at it, use atomic_dec_if_positive() for the global count. atomic_dec_and_test() lets it go negative, and once it is negative the next enable increments it to zero instead of one and never re-arms the bias at all. Link: https://lore.kernel.org/all/20261015-pm4125_mbhc_support-v1-3-8bc1212db6f7@oss.qualcomm.com/ Assisted-by: Claude Opus 5 Signed-off-by: Mohammad Rafi Shaik <mohammad.rafi.shaik@oss.qualcomm.com>
…k detection The codec only hands the MBHC framework the electrical bias and button threshold callbacks, and leaves the rest of struct wcd_mbhc_cb empty. The framework falls back to driving the shared register fields itself for some of them, but it has no fallback at all for the ones that control hardware it cannot describe generically, so plug type detection runs without the RCO clock, without a micbias ramp and without the headset ground detection comparator, and never gets a usable ADC reading. Add the callbacks the ADC based detection logic needs: - clk_setup() enables the MBHC RCO, which clocks the detection FSM. - micbias_enable_status() lets the framework tell whether MIC_BIAS_2 is already up for recording, so it does not switch the button current source on underneath a capture stream. - hph_pull_up_control() selects the HPHL pull up current used while sensing an insertion, defaulting to 3uA as the hardware expects. - mbhc_micbias_control() routes the framework's MIC_BIAS_2 requests through pm4125_micbias_control() so they share the reference count with the DAPM micbias widgets and with the analog master bias. - mbhc_micb_ramp_control() ramps MIC_BIAS_2 instead of stepping it, which is required before the cross connection check reads the Schmitt trigger outputs. - mbhc_micb_ctrl_thr_mic() raises MIC_BIAS_2 to the threshold needed to tell a special headset from an extension cable, and puts it back afterwards. - get_micbias_val() reports the programmed MIC_BIAS_2 voltage. The generic path assumes a 1V base, while this codec starts at 1.6V in 50mV steps, so the framework would scale every threshold wrongly. - mbhc_gnd_det_ctrl() enables the headset ground pull up comparator together with ground detection, in that order on the way up and the reverse on the way down. - hph_pull_down_ctrl() parks the headphone outputs in a pull down while no jack is being driven. pm4125_mbhc_micb_adjust_voltage() changes MIC_BIAS_2 while it is enabled, which has to be done with the output briefly pulled up, so serialise it against concurrent requests with a mutex. Link: https://lore.kernel.org/all/20261015-pm4125_mbhc_support-v1-4-8bc1212db6f7@oss.qualcomm.com/ Assisted-by: Claude Opus 5 Signed-off-by: Mohammad Rafi Shaik <mohammad.rafi.shaik@oss.qualcomm.com>
PR #1323 — validate-patchPR: #1323
Final Summary
|
PR #1323 — checker-log-analyzerPR: #1323
Detailed report: Full report
|
Shikra headphone mbhc support support
Enable PM4125 MBHC settings.
CRs-Fixed: 4674032