mirror of
https://github.com/dikeckaan/mu300-linux.git
synced 2026-12-06 08:03:36 +00:00
kernel/patches/mcdt-enable-clock.patch: check_agcp_mcdt_clock() reads BIT_MCDT_EN and, when it is clear, every MCDT accessor returns early without touching the hardware - so MCDT gets configured into a void while setup still looks like it worked. Nothing in the driver set writes that bit. Since the driver already holds the regmap and knows the bit, have it enable the block it is about to program. The write only happens when the bit is clear and the result is read back, so a controller that genuinely cannot be enabled still reports false. mu300-audio-dsp gains a "profiles" command. The kernel takes the DSP parameters through request_firmware(), so tools/vbc-profile's output in /lib/firmware is all it needs, and the select value matters: (mode << 24) | (param_id << 16) | dsp_case does nothing visible with param_id 0, but with 0x5e - what a working device of this family carries - the mode is copied into the DSP's shared memory at sprd,shmaddr-dsp-vbc. The mode numbers are call scenes (Handset, Handsfree, Headset, BTHS, ... each NB/WB/SWB/FB/VOIP); there is no media mode in there at all, which is worth knowing before chasing media playback through them. FINDINGS records the reference comparison. A ZTE MU5358 registers the same sprdphone-sc2730 card and does carry call audio; between idle and an active call exactly 18 of its controls move, all routing and output. Applying the same shape here - every S_*_CODEC switch at once, the codec output tree, agdsp_access_en - changes nothing. Neither the F50's own Android nor a U30 Air (same ums9620) has any audio to compare against, but the U30 Air does carry the native UMS9620 parameter XMLs, which are a better source than the community's donor copies. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017Z17MBkdHmZPvNPNSLxcHk
61 lines
2.4 KiB
Diff
61 lines
2.4 KiB
Diff
mcdt: turn the MCDT clock on instead of giving up when it is off
|
|
|
|
check_agcp_mcdt_clock() reads BIT_MCDT_EN out of the AGCP AHB status register and,
|
|
when the bit is clear, every MCDT register accessor returns early without touching
|
|
the hardware - mcdt_reg_read, mcdt_reg_raw_write and mcdt_reg_update alike. Nothing
|
|
in the audio driver set ever sets that bit; they only read it. On this board it is
|
|
clear, so MCDT is configured into a void: setup appears to succeed, the pr_info in
|
|
mcdt_dac_dma_enable still prints its channel number, and the only hint is an
|
|
"agcp mcdt clocl not available" line that shows up during teardown, where it is
|
|
easy to mistake for an artifact of the power domain going down.
|
|
|
|
Whoever enables it on Android is not in this source. Since the driver already holds
|
|
the regmap and already knows the bit, have it enable the block it is about to
|
|
program rather than silently skip it. The write only happens when the bit is clear,
|
|
and the result is read back, so a controller that genuinely cannot be enabled still
|
|
reports false and nothing changes for boards where something else did it first.
|
|
|
|
The register lives inside the AGDSP power domain, so this is only reachable with
|
|
that domain up - which is the case whenever MCDT is being programmed for a stream,
|
|
because the ASoC path enables it before touching the DAI.
|
|
|
|
--- a/sprd_audio/mcdt/mcdt_r2p0/mcdt_hw_r2p0.c
|
|
+++ b/sprd_audio/mcdt/mcdt_r2p0/mcdt_hw_r2p0.c
|
|
@@ -52,12 +52,31 @@
|
|
u32 val;
|
|
int ret;
|
|
|
|
- if (agcp_ahb_gpr) {
|
|
- ret = regmap_read(agcp_ahb_gpr, REG_AGCP_AHB_MODULE_EB0_STS,
|
|
- &val);
|
|
- if (!ret)
|
|
- return (val & BIT_MCDT_EN) ? true : false;
|
|
+ if (!agcp_ahb_gpr)
|
|
+ return true;
|
|
+
|
|
+ ret = regmap_read(agcp_ahb_gpr, REG_AGCP_AHB_MODULE_EB0_STS, &val);
|
|
+ if (ret)
|
|
+ return true;
|
|
+ if (val & BIT_MCDT_EN)
|
|
+ return true;
|
|
+
|
|
+ /* Nothing else in this driver set writes this bit, and on some boards
|
|
+ * nothing writes it at all - which leaves every MCDT access below a
|
|
+ * silent no-op. Enable the block instead of skipping the work.
|
|
+ */
|
|
+ ret = regmap_update_bits(agcp_ahb_gpr, REG_AGCP_AHB_MODULE_EB0_STS,
|
|
+ BIT_MCDT_EN, BIT_MCDT_EN);
|
|
+ if (ret)
|
|
+ return false;
|
|
+ ret = regmap_read(agcp_ahb_gpr, REG_AGCP_AHB_MODULE_EB0_STS, &val);
|
|
+ if (ret || !(val & BIT_MCDT_EN)) {
|
|
+ pr_err("%s: agcp mcdt clock would not enable (eb0=%#x)\n",
|
|
+ __func__, val);
|
|
+ return false;
|
|
}
|
|
+ pr_info("%s: enabled the agcp mcdt clock (eb0=%#x)\n", __func__, val);
|
|
+
|
|
return true;
|
|
}
|
|
|