Re: [PATCH 2/2] ASoC: Add LPASS VA CSR heartbeat pulse clock

From: Konrad Dybcio

Date: Tue Jul 14 2026 - 02:54:43 EST


On 7/13/26 10:05 PM, Sarath Ganapathiraju via B4 Relay wrote:
> From: Sarath Ganapathiraju <sarath.ganapathiraju@xxxxxxxxxxxxxxxx>
>
> 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@xxxxxxxxxxxxxxxx>
> ---

[...]

> +#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