ASoC: Add LPASS VA CSR HeartBeat pulse clock support
Subsystems (5)
cover ASoC: Add LPASS VA CSR HeartBeat pulse clock support
The LPASS VA CSR block contains rate generator hardware that produces a HeartBeat Pulse (also known as RateGen Pulse). This pulse synchronizes the start of the DMAs and Codec Interfaces for the audio usecases and can serve as a periodic wakeup source for the DSP.
This series adds the DT binding and driver support to model this rate generator as a clock provider, and extends the VA macro binding with a new hawi variant that consumes the heartbeatpulse clock alongside its existing mclk, macro, and dcodec clocks.
Patch 1 adds the YAML binding for the new qcom,hawi-lpass-va-csr clock provider node and extends qcom,lpass-va-macro to describe the new qcom,hawi-lpass-va-macro compatible with its four-clock constraint.
Patch 2 adds the lpass-va-csr driver that registers the lpass_heartbeat_pulse clock and enables/disables the rate generator via regmap when the clock consumer requests it.
---
Sarath Ganapathiraju (2):
ASoC: dt-bindings: qcom,lpass-va-csr: Add HeartBeat pulse clock
ASoC: Add LPASS VA CSR heartbeat pulse clock
.../bindings/sound/qcom,lpass-va-csr.yaml | 47 +++++++ .../bindings/sound/qcom,lpass-va-macro.yaml | 18 +++ sound/soc/codecs/Kconfig | 13 ++ sound/soc/codecs/Makefile | 2 + sound/soc/codecs/lpass-va-csr.c | 143 +++++++++++++++++++++ 5 files changed, 223 insertions(+)
---
base-commit: bee763d5f341b99cf472afeb508d4988f62a6ca1
change-id: 20260714-master-ca87b5f19ae0
Best regards,
Signature · 1 line
Sarath Ganapathiraju <[email protected]>
PATCH 1/2 ASoC: dt-bindings: qcom,lpass-va-csr: Add HeartBeat pulse clock
Add Qualcomm LPASS VA CSR rate generator node that exposes the lpass_heartbeat_pulse clock on hawi. Also extend the qcom,lpass-va-macro binding to add qcom,hawi-lpass-va-macro with its four-clock constraint (mclk, macro, dcodec, heartbeatpulse).
The HeartBeat Pulse (also known as RateGen Pulse) synchronizes the start of the DMAs and Codec Interfaces for the audio usecase and can serve as a periodic wakeup source for the DSP.
--- .../bindings/sound/qcom,lpass-va-csr.yaml | 47 ++++++++++++++++++++++ .../bindings/sound/qcom,lpass-va-macro.yaml | 18 +++++++++ 2 files changed, 65 insertions(+)
Documentation/devicetree/bindings/sound/qcom,lpass-va-csr.yaml new file +47 -0
@@ -0,0 +1,47 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/sound/qcom,lpass-va-csr.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Qualcomm LPASS VA CSR heartbeat pulse clock provider + +maintainers: + - Srinivas Kandagatla <[email protected]> + - Sarath Ganapathiraju <[email protected]> + +description: + The LPASS VA CSR block contains the rate generator hardware which + produces the heartbeatpulse consumed by the Bolero codec macros + (rx, tx, wsa, va). It is modelled as a clock provider + so consumers can reference it by name in their clocks list. + +properties: + compatible: + enum: + - qcom,hawi-lpass-va-csr + + reg: + maxItems: 1 + description: Must cover the full VA CSR block (base 0x7EE0000, size 0xE000). + + "#clock-cells": + const: 0 + description: + Single clock output "lpass_heartbeat_pulse". Consumers reference + it by clock-name "heartbeatpulse" in their clocks list. + +required: + - compatible + - reg + - "#clock-cells" + +unevaluatedProperties: false + +examples: + - | + va-csr@7ee0000 { + compatible = "qcom,hawi-lpass-va-csr"; + reg = <0x0 0x07ee0000 0x0 0xe000>; + #clock-cells = <0>; + };
Documentation/devicetree/bindings/sound/qcom,lpass-va-macro.yaml +18 -0
@@ -19,6 +19,7 @@ properties: - qcom,sm8450-lpass-va-macro - qcom,sm8550-lpass-va-macro - qcom,sc8280xp-lpass-va-macro + - qcom,hawi-lpass-va-macro - items: - enum: - qcom,eliza-lpass-va-macro
@@ -168,6 +169,23 @@ allOf: - const: macro - const: dcodec + - if: + properties: + compatible: + contains: + const: qcom,hawi-lpass-va-macro + then: + properties: + clocks: + minItems: 4 + maxItems: 4 + clock-names: + items: + - const: mclk + - const: macro + - const: dcodec + - const: heartbeatpulse + unevaluatedProperties: false examples:
Signature · 1 line
2.34.1
[email protected]
AI reviewRe: [PATCH 1/2] ASoC: dt-bindings: qcom,lpass-va-csr: Add HeartBeat pulse clock
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] Schema validation failure in example due to missing #address-cells and #size-cells parent node --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Schema validation failure in example due to missing #address-cells and #size-cells parent node --
--- Patch [1]: [PATCH 1/2] ASoC: dt-bindings: qcom,lpass-va-csr: Add HeartBeat pulse clock --- commit 9f770d5091cc6e0fe9a0f15696b43becc2db0bc2
Author: Sarath Ganapathiraju <[email protected]>
ASoC: dt-bindings: qcom,lpass-va-csr: Add HeartBeat pulse clock
This commit adds the Qualcomm LPASS VA CSR rate generator node binding to expose the heartbeat pulse clock. It also extends the qcom,lpass-va-macro binding to incorporate this new clock as a constraint.
Quoted 5 lines
Documentation/devicetree/bindings/sound/qcom,lpass-va-csr.yaml new file +0
-0
[ ... ]
Documentation/devicetree/bindings/sound/qcom,lpass-va-csr.yaml line 45
Quoted 5 lines
Documentation/devicetree/bindings/sound/qcom,lpass-va-csr.yaml new file +5
-0+examples: + - | + va-csr@7ee0000 { + compatible = "qcom,hawi-lpass-va-csr"; + reg = <0x0 0x07ee0000 0x0 0xe000>;
[Severity: Low]
Will this example fail dt_binding_check validation?
By default, the root node in DT schema examples assumes #address-cells = <1> and #size-cells = <1>. Because of this, the 4-cell reg property here parses as two items (two address/size pairs of 1 cell each).
Since the schema explicitly constrains reg with maxItems: 1 earlier in the file, does this need a dummy parent node specifying #address-cells = <2> and #size-cells = <2> to pass validation?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Rob Herring (Arm)
maintainerRe: [PATCH 1/2] ASoC: dt-bindings: qcom,lpass-va-csr: Add HeartBeat pulse clock
In reply to Sarath GanapathirajuQuoted 9 lines · Sarath Ganapathiraju
Add Qualcomm LPASS VA CSR rate generator node that exposes the
lpass_heartbeat_pulseclock on hawi. Also extend the qcom,lpass-va-macro binding to add qcom,hawi-lpass-va-macro with its four-clock constraint (mclk, macro, dcodec, heartbeatpulse).The HeartBeat Pulse (also known as RateGen Pulse) synchronizes the start of the DMAs and Codec Interfaces for the audio usecase and can serve as a periodic wakeup source for the DSP.
Quoted 6 lines
Signed-off-by Sarath Ganapathiraju <[email protected]>--- .../bindings/sound/qcom,lpass-va-csr.yaml | 47 ++++++++++++++++++++++ .../bindings/sound/qcom,lpass-va-macro.yaml | 18 +++++++++ 2 files changed, 65 insertions(+)
My bot found errors running 'make dt_binding_check' on your patch:
yamllint warnings/errors:
dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/sound/qcom,lpass-va-csr.example.dtb: va-csr@7ee0000 (qcom,hawi-lpass-va-csr): reg: [[0, 133038080], [0, 57344]] is too long
from schema $id: http://devicetree.org/schemas/sound/qcom,lpass-va-csr.yaml
doc reference errors (make refcheckdocs):
See https://patchwork.kernel.org/project/devicetree/patch/[email protected]
The base for the series is generally the latest rc1. A different dependency should be noted in *this* patch.
If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:
pip3 install dtschema --upgrade
Please check and re-submit after running the above command yourself. Note that DT_SCHEMA_FILES can be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema.
Re: [PATCH 1/2] ASoC: dt-bindings: qcom,lpass-va-csr: Add HeartBeat pulse clock
In reply to Sarath GanapathirajuQuoted 7 lines · On 7/13/26 9:05 PM, Sarath Ganapathiraju via B4 Relay wrote:
From: Sarath Ganapathiraju <[email protected]>
Add Qualcomm LPASS VA CSR rate generator node that exposes the
lpass_heartbeat_pulseclock on hawi. Also extend the qcom,lpass-va-macro binding to add qcom,hawi-lpass-va-macro with its four-clock constraint (mclk, macro, dcodec, heartbeatpulse).
Quoted 8 lines
The HeartBeat Pulse (also known as RateGen Pulse) synchronizes the start of the DMAs and Codec Interfaces for the audio usecase and can serve as a periodic wakeup source for the DSP.
Signed-off-by Sarath Ganapathiraju <[email protected]>--- .../bindings/sound/qcom,lpass-va-csr.yaml | 47 ++++++++++++++++++++++ .../bindings/sound/qcom,lpass-va-macro.yaml | 18 +++++++++
Please split these into two patches, as you are adding two things in here.
--srini
Quoted 92 lines
2 files changed, 65 insertions(+)Documentation/devicetree/bindings/sound/qcom,lpass-va-csr.yaml new file +47
-0@@ -0,0 +1,47 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/sound/qcom,lpass-va-csr.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Qualcomm LPASS VA CSR heartbeat pulse clock provider + +maintainers: + - Srinivas Kandagatla <[email protected]> + - Sarath Ganapathiraju <[email protected]> + +description: + The LPASS VA CSR block contains the rate generator hardware which + produces the heartbeatpulse consumed by the Bolero codec macros + (rx, tx, wsa, va). It is modelled as a clock provider + so consumers can reference it by name in their clocks list. + +properties: + compatible: + enum: + - qcom,hawi-lpass-va-csr + + reg: + maxItems: 1 + description: Must cover the full VA CSR block (base 0x7EE0000, size 0xE000). + + "#clock-cells": + const: 0 + description: + Single clock output "lpass_heartbeat_pulse". Consumers reference + it by clock-name "heartbeatpulse" in their clocks list. + +required: + - compatible + - reg + - "#clock-cells" + +unevaluatedProperties: false + +examples: + - | + va-csr@7ee0000 { + compatible = "qcom,hawi-lpass-va-csr"; + reg = <0x0 0x07ee0000 0x0 0xe000>; + #clock-cells = <0>; + };Documentation/devicetree/bindings/sound/qcom,lpass-va-macro.yaml +18
-0@@ -19,6 +19,7 @@ properties: - qcom,sm8450-lpass-va-macro - qcom,sm8550-lpass-va-macro - qcom,sc8280xp-lpass-va-macro + - qcom,hawi-lpass-va-macro - items: - enum: - qcom,eliza-lpass-va-macro@@ -168,6 +169,23 @@ allOf: - const: macro - const: dcodec + - if: + properties: + compatible: + contains: + const: qcom,hawi-lpass-va-macro + then: + properties: + clocks: + minItems: 4 + maxItems: 4 + clock-names: + items: + - const: mclk + - const: macro + - const: dcodec + - const: heartbeatpulse + unevaluatedProperties: false examples:
PATCH 2/2 ASoC: Add LPASS VA CSR heartbeat pulse clock
In reply to Sarath GanapathirajuThe HeartBeat Pulse (also known as RateGen Pulse) synchronizes the start of the DMAs and Codec Interfaces for the audio usecases and can serve as a periodic wakeup source for the DSP.
Add the LPASS VA CSR driver that models the rate generator as a clock provider so it is enabled and disabled automatically alongside the other clocks during runtime PM resume and suspend.
--- sound/soc/codecs/Kconfig | 13 ++++ sound/soc/codecs/Makefile | 2 + sound/soc/codecs/lpass-va-csr.c | 143 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 158 insertions(+)
sound/soc/codecs/Kconfig +13 -0
@@ -2902,11 +2902,24 @@ config SND_SOC_LPASS_WSA_MACRO select SND_SOC_LPASS_MACRO_COMMON tristate "Qualcomm WSA Macro in LPASS(Low Power Audio SubSystem)" +config SND_SOC_LPASS_VA_CSR + depends on COMMON_CLK + select REGMAP_MMIO + tristate "Qualcomm LPASS VA CSR heartbeat pulse clock provider" + help + Qualcomm LPASS VA CSR block contains the rate generator hardware + that produces the HeartBeat Pulse (also known as RateGen Pulse). + This driver models the rate generator as a clock provider so + that consumers can enable or disable it via the common clock + framework, and it can be used to synchronize the start of DMAs + and Codec Interfaces or as a periodic wakeup source for the DSP. + config SND_SOC_LPASS_VA_MACRO depends on COMMON_CLK depends on PM_CLK select REGMAP_MMIO select SND_SOC_LPASS_MACRO_COMMON + select SND_SOC_LPASS_VA_CSR tristate "Qualcomm VA Macro in LPASS(Low Power Audio SubSystem)" config SND_SOC_LPASS_RX_MACRO
sound/soc/codecs/Makefile +2 -0
@@ -163,6 +163,7 @@ snd-soc-lpass-rx-macro-y := lpass-rx-macro.o snd-soc-lpass-tx-macro-y := lpass-tx-macro.o snd-soc-lpass-wsa-macro-y := lpass-wsa-macro.o snd-soc-lpass-va-macro-y := lpass-va-macro.o +snd-soc-lpass-va-csr-y := lpass-va-csr.o snd-soc-madera-y := madera.o snd-soc-max9759-y := max9759.o snd-soc-max9768-y := max9768.o
@@ -886,6 +887,7 @@ obj-$(CONFIG_SND_SOC_TPA6130A2) += snd-soc-tpa6130a2.o obj-$(CONFIG_SND_SOC_LPASS_MACRO_COMMON) += snd-soc-lpass-macro-common.o obj-$(CONFIG_SND_SOC_LPASS_WSA_MACRO) += snd-soc-lpass-wsa-macro.o obj-$(CONFIG_SND_SOC_LPASS_VA_MACRO) += snd-soc-lpass-va-macro.o +obj-$(CONFIG_SND_SOC_LPASS_VA_CSR) += snd-soc-lpass-va-csr.o obj-$(CONFIG_SND_SOC_LPASS_RX_MACRO) += snd-soc-lpass-rx-macro.o obj-$(CONFIG_SND_SOC_LPASS_TX_MACRO) += snd-soc-lpass-tx-macro.o
sound/soc/codecs/lpass-va-csr.c new file +143 -0
143 lines not on this page · raw message
Signature · 1 line
2.34.1
[email protected]
AI reviewRe: [PATCH 2/2] ASoC: Add LPASS VA CSR heartbeat pulse clock
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider: - [High] Uninitialized stack variable `val` is evaluated if `regmap_read()` fails in…
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [High] Uninitialized stack variable val is evaluated if regmap_read() fails in heartbeat_pulse_is_enabled().
- [High] The clock enable/disable callbacks use a standard regmap and Maple Tree cache, leading to lock nesting violations and 'sleeping in atomic context' panics on PREEMPT_RT.
- [Medium] The return values of regmap_write and regmap_update_bits are silently ignored in heartbeat_pulse_enable.
--
--- Patch [2]: [PATCH 2/2] ASoC: Add LPASS VA CSR heartbeat pulse clock --- commit 7fe84986850c91283daded46e6a43a50beacfb9f
Author: Sarath Ganapathiraju <[email protected]>
ASoC: Add LPASS VA CSR heartbeat pulse clock
This commit adds the LPASS VA CSR driver to model the rate generator as a clock provider. This enables automatic enable and disable via the clock framework during runtime PM resume and suspend.
Quoted 5 lines
sound/soc/codecs/lpass-va-csr.c new file +0
-0
[ ... ]
sound/soc/codecs/lpass-va-csr.c line 57
Quoted 10 lines
sound/soc/codecs/lpass-va-csr.c new file +10
-0+static int heartbeat_pulse_enable (struct clk_hw *hw) +{ +struct lpass_va_csr *csr =to_lpass_va_csr (hw); + +regmap_write (csr->regmap,LPASS_RATE_GEN_COUNTER_0 , csr->data->counter_0); +regmap_write (csr->regmap,LPASS_RATE_GEN_DELAY , csr->data->delay); +regmap_update_bits (csr->regmap,LPASS_RATE_GEN_CTRL , +LPASS_RG_CTRL_EN ,LPASS_RG_CTRL_EN ); + +return 0 ;
[Severity: Medium]
Does this function unintentionally mask hardware or cache errors? By ignoring the return values from regmap_write() and regmap_update_bits() and unconditionally returning 0, the clock framework might assume the clock is enabled even if the hardware write or cache allocation failed.
Quoted 1 line
+}
[ ... ]
sound/soc/codecs/lpass-va-csr.c line 75
Quoted 8 lines
sound/soc/codecs/lpass-va-csr.c new file +8
-0+static int heartbeat_pulse_is_enabled (struct clk_hw *hw) +{ +struct lpass_va_csr *csr =to_lpass_va_csr (hw); +unsigned int val; + +regmap_read (csr->regmap,LPASS_RATE_GEN_CTRL , &val); + +return !!(val &LPASS_RG_CTRL_EN );
[Severity: High]
Could this evaluate uninitialized memory if the regmap read fails? If regmap_read() returns an error, the stack variable val is left untouched, which might result in the clock framework registering an incorrect initial hardware state.
sound/soc/codecs/lpass-va-csr.c line 82
Quoted 7 lines
sound/soc/codecs/lpass-va-csr.c new file +7
-0+} + +static const struct clk_ops heartbeat_pulse_ops = { + .enable = heartbeat_pulse_enable, + .disable = heartbeat_pulse_disable, + .is_enabled = heartbeat_pulse_is_enabled, +};
[Severity: High]
Is it safe to use a standard regmap and maple tree cache in atomic clock callbacks? The common clock framework invokes .enable, .disable, and .is_enabled callbacks under the enable_lock raw spinlock with interrupts disabled.
However, the regmap configuration omits use_raw_spinlock = true:
static const struct regmap_config lpass_rate_gen_regmap_config = {
...
.cache_type = REGCACHE_MAPLE,
};This means the regmap operations rely on a standard spinlock. On preempt-rt kernels, a standard spinlock is a sleepable rt_mutex, which could cause lock nesting violations and kernel panics when acquired inside an atomic context. Additionally, the REGCACHE_MAPLE cache type allocates memory and uses its own standard spinlock.
Should these callbacks be moved to .prepare and .unprepare instead, which run under a sleepable mutex context?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
Re: [PATCH 2/2] ASoC: Add LPASS VA CSR heartbeat pulse clock
In reply to Sarath GanapathirajuQuoted 12 lines · On 7/13/26 10:05 PM, Sarath Ganapathiraju via B4 Relay wrote:
From: Sarath Ganapathiraju <[email protected]>
The HeartBeat Pulse (also known as RateGen Pulse) synchronizes the start of the DMAs and Codec Interfaces for the audio usecases and can serve as a periodic wakeup source for the DSP.
Add the LPASS VA CSR driver that models the rate generator as a clock provider so it is enabled and disabled automatically alongside the other clocks during runtime PM resume and suspend.
Signed-off-by Sarath Ganapathiraju <[email protected]>---
[...]
sound/soc/codecs/lpass-va-csr.c line 15
Quoted 3 lines
sound/soc/codecs/lpass-va-csr.c new file +3
-0+#define LPASS_RATE_GEN_CTRL 0xD000 +#define LPASS_RATE_GEN_COUNTER_0 0xD004 +#define LPASS_RATE_GEN_DELAY 0xD010
lowercase hex, please
Quoted 30 lines
sound/soc/codecs/lpass-va-csr.c new file +30
-0+ +#define LPASS_RATE_GEN_MAX_REG LPASS_RATE_GEN_DELAY + +#define LPASS_RG_CTRL_EN BIT(0) + +struct lpass_va_csr_data { +u32 counter_0; +u32 delay; +}; + +static const struct lpass_va_csr_data hawi_csr_data = { + .counter_0 =0x960 , + .delay =0x16 , +}; + +static const struct regmap_config lpass_rate_gen_regmap_config = { + .name ="lpass_rate_gen" , + .reg_bits =32 , + .val_bits =32 , + .reg_stride =4 , + .max_register =LPASS_RATE_GEN_MAX_REG , + .cache_type =REGCACHE_MAPLE , +}; + +struct lpass_va_csr { +struct regmap *regmap; +const struct lpass_va_csr_data *data; +struct clk_hw hb_hw; +}; +
sound/soc/codecs/lpass-va-csr.c line 55
Quoted 10 lines
sound/soc/codecs/lpass-va-csr.c new file +10
-0+#define to_lpass_va_csr (_hw) container_of(_hw, struct lpass_va_csr, hb_hw) + +static int heartbeat_pulse_enable (struct clk_hw *hw) +{ +struct lpass_va_csr *csr =to_lpass_va_csr (hw); + +regmap_write (csr->regmap,LPASS_RATE_GEN_COUNTER_0 , csr->data->counter_0); +regmap_write (csr->regmap,LPASS_RATE_GEN_DELAY , csr->data->delay); +regmap_update_bits (csr->regmap,LPASS_RATE_GEN_CTRL , +LPASS_RG_CTRL_EN ,LPASS_RG_CTRL_EN );
regmap_set_bits()
sound/soc/codecs/lpass-va-csr.c line 65
Quoted 10 lines
sound/soc/codecs/lpass-va-csr.c new file +10
-0+ +return 0 ; +} + +static void heartbeat_pulse_disable (struct clk_hw *hw) +{ +struct lpass_va_csr *csr =to_lpass_va_csr (hw); + +regmap_update_bits (csr->regmap,LPASS_RATE_GEN_CTRL , +LPASS_RG_CTRL_EN ,0 );
regmap_clear_bits()
sound/soc/codecs/lpass-va-csr.c line 75
Quoted 10 lines
sound/soc/codecs/lpass-va-csr.c new file +10
-0+} + +static int heartbeat_pulse_is_enabled (struct clk_hw *hw) +{ +struct lpass_va_csr *csr =to_lpass_va_csr (hw); +unsigned int val; + +regmap_read (csr->regmap,LPASS_RATE_GEN_CTRL , &val); + +return !!(val &LPASS_RG_CTRL_EN );
regmap_test_bits()
Konrad