[PATCH v2 1/2] soundwire: qcom: set the bus mclk_freq property
Jorijn van der Graaf <[email protected]>
| Newsgroups | org.kernel.vger.linux-sound,org.kernel.vger.linux-arm-msm,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
sdw_slave_get_scale_index() needs bus->prop.mclk_freq to compute the SCP bus-clock base and scale register values, and fails with "no bus MCLK" when it is unset. The qcom controller never set it, so slave initialization cannot program the clock registers on this bus: it would fail outright for an SDCA-class slave, and a slave driver declaring clock_reg_supported hits the same error. The pending WCD9378 codec driver hand-rolls these writes as a workaround, following its downstream counterpart. Report the controller clock, letting the core derive the same values the hand-rolled writes program: 19.2 MHz base and the scale matching the bus clock (half the double rate). Assisted-by: Claude:claude-fable-5 Signed-off-by: Jorijn van der Graaf <[email protected]> Tested-by: Srinivas Kandagatla <[email protected]> Reviewed-by: Srinivas Kandagatla <[email protected]> --- v2: no code change; added Srinivas's Tested-by/Reviewed-by. v1: https://lore.kernel.org/all/[email protected]/ This is the soundwire side of the plan from the WCD9378 v1 review discussion [1]; the codec's v2 will set prop.clock_reg_supported and delete its hand-rolled base/scale writes, relying on this property. Patch 2 is the helper extension requested in that thread. Validated on the Fairphone 6 (SM7635, WCD9378): with the hand-rolled writes deleted, the core reports "Configured bus base 1, scale 2, mclk 19200000, curr_freq 9600000" for both slaves at enumeration, the codec's SDCA sequencer powers up on those values, and capture works, across reboots. No behavior change for existing devices: without a class_id or clock_reg_supported, sdw_slave_set_frequency() returns before reading mclk_freq. [1] https://lore.kernel.org/all/[email protected]/ drivers/soundwire/qcom.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c index 3562802f4204..55678a30cd4a 100644 --- a/drivers/soundwire/qcom.c +++ b/drivers/soundwire/qcom.c @@ -1633,6 +1633,7 @@ static int qcom_swrm_probe(struct platform_device *pdev) prop = &ctrl->bus.prop; prop->max_clk_freq = DEFAULT_CLK_FREQ; + prop->mclk_freq = DEFAULT_CLK_FREQ; prop->num_clk_gears = 0; prop->num_clk_freq = MAX_FREQ_NUM; prop->clk_freq = &qcom_swrm_freq_tbl[0]; base-commit: 6409292ab5f7d1a60a6f8948bd6dcd8633c36dfe -- 2.55.0