* [PATCH 0/2] ASoC: Add LPASS VA CSR HeartBeat pulse clock support
@ 2026-07-13 20:05 ` Sarath Ganapathiraju
0 siblings, 0 replies; 11+ messages in thread
From: Sarath Ganapathiraju via B4 Relay @ 2026-07-13 20:05 UTC (permalink / raw)
To: Srinivas Kandagatla, Liam Girdwood, Mark Brown, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Jaroslav Kysela, Takashi Iwai
Cc: Srinivas Kandagatla, linux-sound, linux-arm-msm, devicetree,
linux-kernel, prasad.kumpatla, Sarath Ganapathiraju
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.
Signed-off-by: Sarath Ganapathiraju <sarath.ganapathiraju@oss.qualcomm.com>
---
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,
--
Sarath Ganapathiraju <sarath.ganapathiraju@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 11+ messages in thread* [PATCH 0/2] ASoC: Add LPASS VA CSR HeartBeat pulse clock support @ 2026-07-13 20:05 ` Sarath Ganapathiraju 0 siblings, 0 replies; 11+ messages in thread From: Sarath Ganapathiraju @ 2026-07-13 20:05 UTC (permalink / raw) To: Srinivas Kandagatla, Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Jaroslav Kysela, Takashi Iwai Cc: Srinivas Kandagatla, linux-sound, linux-arm-msm, devicetree, linux-kernel, prasad.kumpatla, Sarath Ganapathiraju 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. Signed-off-by: Sarath Ganapathiraju <sarath.ganapathiraju@oss.qualcomm.com> --- 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, -- Sarath Ganapathiraju <sarath.ganapathiraju@oss.qualcomm.com> ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 1/2] ASoC: dt-bindings: qcom,lpass-va-csr: Add HeartBeat pulse clock 2026-07-13 20:05 ` Sarath Ganapathiraju @ 2026-07-13 20:05 ` Sarath Ganapathiraju -1 siblings, 0 replies; 11+ messages in thread From: Sarath Ganapathiraju via B4 Relay @ 2026-07-13 20:05 UTC (permalink / raw) To: Srinivas Kandagatla, Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Jaroslav Kysela, Takashi Iwai Cc: Srinivas Kandagatla, linux-sound, linux-arm-msm, devicetree, linux-kernel, prasad.kumpatla, Sarath Ganapathiraju From: Sarath Ganapathiraju <sarath.ganapathiraju@oss.qualcomm.com> 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. Signed-off-by: Sarath Ganapathiraju <sarath.ganapathiraju@oss.qualcomm.com> --- .../bindings/sound/qcom,lpass-va-csr.yaml | 47 ++++++++++++++++++++++ .../bindings/sound/qcom,lpass-va-macro.yaml | 18 +++++++++ 2 files changed, 65 insertions(+) diff --git a/Documentation/devicetree/bindings/sound/qcom,lpass-va-csr.yaml b/Documentation/devicetree/bindings/sound/qcom,lpass-va-csr.yaml new file mode 100644 index 000000000..794da92ad --- /dev/null +++ b/Documentation/devicetree/bindings/sound/qcom,lpass-va-csr.yaml @@ -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 <srinivas.kandagatla@oss.qualcomm.com> + - Sarath Ganapathiraju <sarath.ganapathiraju@oss.qualcomm.com> + +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>; + }; diff --git a/Documentation/devicetree/bindings/sound/qcom,lpass-va-macro.yaml b/Documentation/devicetree/bindings/sound/qcom,lpass-va-macro.yaml index aea31fbda..ae4df8967 100644 --- a/Documentation/devicetree/bindings/sound/qcom,lpass-va-macro.yaml +++ b/Documentation/devicetree/bindings/sound/qcom,lpass-va-macro.yaml @@ -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: -- 2.34.1 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 1/2] ASoC: dt-bindings: qcom,lpass-va-csr: Add HeartBeat pulse clock @ 2026-07-13 20:05 ` Sarath Ganapathiraju 0 siblings, 0 replies; 11+ messages in thread From: Sarath Ganapathiraju @ 2026-07-13 20:05 UTC (permalink / raw) To: Srinivas Kandagatla, Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Jaroslav Kysela, Takashi Iwai Cc: Srinivas Kandagatla, linux-sound, linux-arm-msm, devicetree, linux-kernel, prasad.kumpatla, Sarath Ganapathiraju 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. Signed-off-by: Sarath Ganapathiraju <sarath.ganapathiraju@oss.qualcomm.com> --- .../bindings/sound/qcom,lpass-va-csr.yaml | 47 ++++++++++++++++++++++ .../bindings/sound/qcom,lpass-va-macro.yaml | 18 +++++++++ 2 files changed, 65 insertions(+) diff --git a/Documentation/devicetree/bindings/sound/qcom,lpass-va-csr.yaml b/Documentation/devicetree/bindings/sound/qcom,lpass-va-csr.yaml new file mode 100644 index 000000000..794da92ad --- /dev/null +++ b/Documentation/devicetree/bindings/sound/qcom,lpass-va-csr.yaml @@ -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 <srinivas.kandagatla@oss.qualcomm.com> + - Sarath Ganapathiraju <sarath.ganapathiraju@oss.qualcomm.com> + +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>; + }; diff --git a/Documentation/devicetree/bindings/sound/qcom,lpass-va-macro.yaml b/Documentation/devicetree/bindings/sound/qcom,lpass-va-macro.yaml index aea31fbda..ae4df8967 100644 --- a/Documentation/devicetree/bindings/sound/qcom,lpass-va-macro.yaml +++ b/Documentation/devicetree/bindings/sound/qcom,lpass-va-macro.yaml @@ -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: -- 2.34.1 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 1/2] ASoC: dt-bindings: qcom,lpass-va-csr: Add HeartBeat pulse clock 2026-07-13 20:05 ` Sarath Ganapathiraju (?) @ 2026-07-13 20:13 ` sashiko-bot -1 siblings, 0 replies; 11+ messages in thread From: sashiko-bot @ 2026-07-13 20:13 UTC (permalink / raw) To: Sarath Ganapathiraju; +Cc: devicetree, conor+dt, robh 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 <sarath.ganapathiraju@oss.qualcomm.com> 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. > diff --git a/Documentation/devicetree/bindings/sound/qcom,lpass-va-csr.yaml b/Documentation/devicetree/bindings/sound/qcom,lpass-va-csr.yaml > new file mode 100644 > index 0000000000000..794da92adcf88 > --- /dev/null > +++ b/Documentation/devicetree/bindings/sound/qcom,lpass-va-csr.yaml [ ... ] > +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? -- Sashiko AI review · https://sashiko.dev/#/patchset/20260714-master-v1-0-1ebe5993225e@oss.qualcomm.com?part=1 ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/2] ASoC: dt-bindings: qcom,lpass-va-csr: Add HeartBeat pulse clock 2026-07-13 20:05 ` Sarath Ganapathiraju (?) (?) @ 2026-07-13 21:22 ` Rob Herring (Arm) -1 siblings, 0 replies; 11+ messages in thread From: Rob Herring (Arm) @ 2026-07-13 21:22 UTC (permalink / raw) To: Sarath Ganapathiraju Cc: Krzysztof Kozlowski, linux-sound, Srinivas Kandagatla, Conor Dooley, Liam Girdwood, linux-arm-msm, prasad.kumpatla, Mark Brown, linux-kernel, Takashi Iwai, Srinivas Kandagatla, devicetree, Jaroslav Kysela On Tue, 14 Jul 2026 01:35:32 +0530, Sarath Ganapathiraju wrote: > 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. > > Signed-off-by: Sarath Ganapathiraju <sarath.ganapathiraju@oss.qualcomm.com> > --- > .../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/20260714-master-v1-1-1ebe5993225e@oss.qualcomm.com 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. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/2] ASoC: dt-bindings: qcom,lpass-va-csr: Add HeartBeat pulse clock 2026-07-13 20:05 ` Sarath Ganapathiraju ` (2 preceding siblings ...) (?) @ 2026-07-14 8:07 ` Srinivas Kandagatla -1 siblings, 0 replies; 11+ messages in thread From: Srinivas Kandagatla @ 2026-07-14 8:07 UTC (permalink / raw) To: sarath.ganapathiraju, Srinivas Kandagatla, Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Jaroslav Kysela, Takashi Iwai Cc: Srinivas Kandagatla, linux-sound, linux-arm-msm, devicetree, linux-kernel, prasad.kumpatla On 7/13/26 9:05 PM, Sarath Ganapathiraju via B4 Relay wrote: > From: Sarath Ganapathiraju <sarath.ganapathiraju@oss.qualcomm.com> > > 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. > > Signed-off-by: Sarath Ganapathiraju <sarath.ganapathiraju@oss.qualcomm.com> > --- > .../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 > 2 files changed, 65 insertions(+) > > diff --git a/Documentation/devicetree/bindings/sound/qcom,lpass-va-csr.yaml b/Documentation/devicetree/bindings/sound/qcom,lpass-va-csr.yaml > new file mode 100644 > index 000000000..794da92ad > --- /dev/null > +++ b/Documentation/devicetree/bindings/sound/qcom,lpass-va-csr.yaml > @@ -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 <srinivas.kandagatla@oss.qualcomm.com> > + - Sarath Ganapathiraju <sarath.ganapathiraju@oss.qualcomm.com> > + > +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>; > + }; > diff --git a/Documentation/devicetree/bindings/sound/qcom,lpass-va-macro.yaml b/Documentation/devicetree/bindings/sound/qcom,lpass-va-macro.yaml > index aea31fbda..ae4df8967 100644 > --- a/Documentation/devicetree/bindings/sound/qcom,lpass-va-macro.yaml > +++ b/Documentation/devicetree/bindings/sound/qcom,lpass-va-macro.yaml > @@ -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: > ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 2/2] ASoC: Add LPASS VA CSR heartbeat pulse clock 2026-07-13 20:05 ` Sarath Ganapathiraju @ 2026-07-13 20:05 ` Sarath Ganapathiraju -1 siblings, 0 replies; 11+ messages in thread From: Sarath Ganapathiraju via B4 Relay @ 2026-07-13 20:05 UTC (permalink / raw) To: Srinivas Kandagatla, Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Jaroslav Kysela, Takashi Iwai Cc: Srinivas Kandagatla, linux-sound, linux-arm-msm, devicetree, linux-kernel, prasad.kumpatla, Sarath Ganapathiraju From: Sarath Ganapathiraju <sarath.ganapathiraju@oss.qualcomm.com> 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 <sarath.ganapathiraju@oss.qualcomm.com> --- sound/soc/codecs/Kconfig | 13 ++++ sound/soc/codecs/Makefile | 2 + sound/soc/codecs/lpass-va-csr.c | 143 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 158 insertions(+) diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig index a41d0f508..e898c34a6 100644 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig @@ -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 diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile index aa0396e5b..3e86c1bbf 100644 --- a/sound/soc/codecs/Makefile +++ b/sound/soc/codecs/Makefile @@ -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 diff --git a/sound/soc/codecs/lpass-va-csr.c b/sound/soc/codecs/lpass-va-csr.c new file mode 100644 index 000000000..14aec8f94 --- /dev/null +++ b/sound/soc/codecs/lpass-va-csr.c @@ -0,0 +1,143 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. + */ + +#include <linux/clk-provider.h> +#include <linux/device.h> +#include <linux/module.h> +#include <linux/of_clk.h> +#include <linux/platform_device.h> +#include <linux/regmap.h> + +#define LPASS_RATE_GEN_CTRL 0xD000 +#define LPASS_RATE_GEN_COUNTER_0 0xD004 +#define LPASS_RATE_GEN_DELAY 0xD010 + +#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; +}; + +#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); + + 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); +} + +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); +} + +static const struct clk_ops heartbeat_pulse_ops = { + .enable = heartbeat_pulse_enable, + .disable = heartbeat_pulse_disable, + .is_enabled = heartbeat_pulse_is_enabled, +}; + +static int lpass_va_csr_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct lpass_va_csr *csr; + struct clk_init_data init = { + .name = "lpass_heartbeat_pulse", + .ops = &heartbeat_pulse_ops, + }; + void __iomem *base; + int ret; + + csr = devm_kzalloc(dev, sizeof(*csr), GFP_KERNEL); + if (!csr) + return -ENOMEM; + + csr->data = of_device_get_match_data(dev); + if (!csr->data) + return dev_err_probe(dev, -EINVAL, "no variant data for compatible\n"); + + base = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(base)) + return PTR_ERR(base); + + csr->regmap = devm_regmap_init_mmio(dev, base, + &lpass_rate_gen_regmap_config); + if (IS_ERR(csr->regmap)) + return dev_err_probe(dev, PTR_ERR(csr->regmap), + "failed to init regmap\n"); + + csr->hb_hw.init = &init; + + ret = devm_clk_hw_register(dev, &csr->hb_hw); + if (ret) + return dev_err_probe(dev, ret, "failed to register heartbeat clock\n"); + + ret = devm_of_clk_add_hw_provider(dev, of_clk_hw_simple_get, &csr->hb_hw); + if (ret) + return dev_err_probe(dev, ret, "failed to add clock provider\n"); + + return 0; +} + +static const struct of_device_id lpass_va_csr_dt_match[] = { + { .compatible = "qcom,hawi-lpass-va-csr", .data = &hawi_csr_data }, + {} +}; +MODULE_DEVICE_TABLE(of, lpass_va_csr_dt_match); + +static struct platform_driver lpass_va_csr_driver = { + .driver = { + .name = "qcom-lpass-va-csr", + .of_match_table = lpass_va_csr_dt_match, + }, + .probe = lpass_va_csr_probe, +}; + +module_platform_driver(lpass_va_csr_driver); + +MODULE_DESCRIPTION("Qualcomm LPASS VA CSR heartbeat pulse clock provider"); +MODULE_LICENSE("GPL"); -- 2.34.1 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 2/2] ASoC: Add LPASS VA CSR heartbeat pulse clock @ 2026-07-13 20:05 ` Sarath Ganapathiraju 0 siblings, 0 replies; 11+ messages in thread From: Sarath Ganapathiraju @ 2026-07-13 20:05 UTC (permalink / raw) To: Srinivas Kandagatla, Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Jaroslav Kysela, Takashi Iwai Cc: Srinivas Kandagatla, linux-sound, linux-arm-msm, devicetree, linux-kernel, prasad.kumpatla, Sarath Ganapathiraju 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 <sarath.ganapathiraju@oss.qualcomm.com> --- sound/soc/codecs/Kconfig | 13 ++++ sound/soc/codecs/Makefile | 2 + sound/soc/codecs/lpass-va-csr.c | 143 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 158 insertions(+) diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig index a41d0f508..e898c34a6 100644 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig @@ -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 diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile index aa0396e5b..3e86c1bbf 100644 --- a/sound/soc/codecs/Makefile +++ b/sound/soc/codecs/Makefile @@ -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 diff --git a/sound/soc/codecs/lpass-va-csr.c b/sound/soc/codecs/lpass-va-csr.c new file mode 100644 index 000000000..14aec8f94 --- /dev/null +++ b/sound/soc/codecs/lpass-va-csr.c @@ -0,0 +1,143 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. + */ + +#include <linux/clk-provider.h> +#include <linux/device.h> +#include <linux/module.h> +#include <linux/of_clk.h> +#include <linux/platform_device.h> +#include <linux/regmap.h> + +#define LPASS_RATE_GEN_CTRL 0xD000 +#define LPASS_RATE_GEN_COUNTER_0 0xD004 +#define LPASS_RATE_GEN_DELAY 0xD010 + +#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; +}; + +#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); + + 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); +} + +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); +} + +static const struct clk_ops heartbeat_pulse_ops = { + .enable = heartbeat_pulse_enable, + .disable = heartbeat_pulse_disable, + .is_enabled = heartbeat_pulse_is_enabled, +}; + +static int lpass_va_csr_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct lpass_va_csr *csr; + struct clk_init_data init = { + .name = "lpass_heartbeat_pulse", + .ops = &heartbeat_pulse_ops, + }; + void __iomem *base; + int ret; + + csr = devm_kzalloc(dev, sizeof(*csr), GFP_KERNEL); + if (!csr) + return -ENOMEM; + + csr->data = of_device_get_match_data(dev); + if (!csr->data) + return dev_err_probe(dev, -EINVAL, "no variant data for compatible\n"); + + base = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(base)) + return PTR_ERR(base); + + csr->regmap = devm_regmap_init_mmio(dev, base, + &lpass_rate_gen_regmap_config); + if (IS_ERR(csr->regmap)) + return dev_err_probe(dev, PTR_ERR(csr->regmap), + "failed to init regmap\n"); + + csr->hb_hw.init = &init; + + ret = devm_clk_hw_register(dev, &csr->hb_hw); + if (ret) + return dev_err_probe(dev, ret, "failed to register heartbeat clock\n"); + + ret = devm_of_clk_add_hw_provider(dev, of_clk_hw_simple_get, &csr->hb_hw); + if (ret) + return dev_err_probe(dev, ret, "failed to add clock provider\n"); + + return 0; +} + +static const struct of_device_id lpass_va_csr_dt_match[] = { + { .compatible = "qcom,hawi-lpass-va-csr", .data = &hawi_csr_data }, + {} +}; +MODULE_DEVICE_TABLE(of, lpass_va_csr_dt_match); + +static struct platform_driver lpass_va_csr_driver = { + .driver = { + .name = "qcom-lpass-va-csr", + .of_match_table = lpass_va_csr_dt_match, + }, + .probe = lpass_va_csr_probe, +}; + +module_platform_driver(lpass_va_csr_driver); + +MODULE_DESCRIPTION("Qualcomm LPASS VA CSR heartbeat pulse clock provider"); +MODULE_LICENSE("GPL"); -- 2.34.1 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 2/2] ASoC: Add LPASS VA CSR heartbeat pulse clock 2026-07-13 20:05 ` Sarath Ganapathiraju (?) @ 2026-07-13 20:16 ` sashiko-bot -1 siblings, 0 replies; 11+ messages in thread From: sashiko-bot @ 2026-07-13 20:16 UTC (permalink / raw) To: Sarath Ganapathiraju; +Cc: conor+dt, devicetree, robh 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 <sarath.ganapathiraju@oss.qualcomm.com> 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. > diff --git a/sound/soc/codecs/lpass-va-csr.c b/sound/soc/codecs/lpass-va-csr.c > new file mode 100644 > index 0000000000000..14aec8f941008 > --- /dev/null > +++ b/sound/soc/codecs/lpass-va-csr.c [ ... ] > +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. > +} [ ... ] > +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. > +} > + > +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? -- Sashiko AI review · https://sashiko.dev/#/patchset/20260714-master-v1-0-1ebe5993225e@oss.qualcomm.com?part=2 ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/2] ASoC: Add LPASS VA CSR heartbeat pulse clock 2026-07-13 20:05 ` Sarath Ganapathiraju (?) (?) @ 2026-07-14 6:53 ` Konrad Dybcio -1 siblings, 0 replies; 11+ messages in thread From: Konrad Dybcio @ 2026-07-14 6:53 UTC (permalink / raw) To: sarath.ganapathiraju, Srinivas Kandagatla, Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Jaroslav Kysela, Takashi Iwai Cc: Srinivas Kandagatla, linux-sound, linux-arm-msm, devicetree, linux-kernel, prasad.kumpatla On 7/13/26 10:05 PM, Sarath Ganapathiraju via B4 Relay wrote: > From: Sarath Ganapathiraju <sarath.ganapathiraju@oss.qualcomm.com> > > 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 <sarath.ganapathiraju@oss.qualcomm.com> > --- [...] > +#define LPASS_RATE_GEN_CTRL 0xD000 > +#define LPASS_RATE_GEN_COUNTER_0 0xD004 > +#define LPASS_RATE_GEN_DELAY 0xD010 lowercase hex, please > + > +#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; > +}; > + > +#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() > + > + 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() > +} > + > +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 ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2026-07-14 8:07 UTC | newest] Thread overview: 11+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-07-13 20:05 [PATCH 0/2] ASoC: Add LPASS VA CSR HeartBeat pulse clock support Sarath Ganapathiraju via B4 Relay 2026-07-13 20:05 ` Sarath Ganapathiraju 2026-07-13 20:05 ` [PATCH 1/2] ASoC: dt-bindings: qcom,lpass-va-csr: Add HeartBeat pulse clock Sarath Ganapathiraju via B4 Relay 2026-07-13 20:05 ` Sarath Ganapathiraju 2026-07-13 20:13 ` sashiko-bot 2026-07-13 21:22 ` Rob Herring (Arm) 2026-07-14 8:07 ` Srinivas Kandagatla 2026-07-13 20:05 ` [PATCH 2/2] ASoC: Add LPASS VA CSR heartbeat " Sarath Ganapathiraju via B4 Relay 2026-07-13 20:05 ` Sarath Ganapathiraju 2026-07-13 20:16 ` sashiko-bot 2026-07-14 6:53 ` Konrad Dybcio
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.