Re: [PATCH v9 1/4] ASoC: SDCA: Add PDE verification reusable helper

Charles Keepax
2026-04-20T09:58:58Z

On Fri, Apr 17, 2026 at 06:43:58PM +0530, Niranjan H Y wrote:
> Implement sdca_asoc_pde_ensure_ps() helper function to poll for PDE
> power state transitions. Per SDCA specification, after writing
> REQUESTED_PS, drivers must poll ACTUAL_PS until the target power state
> is reached.
>
> Changes include:
> - Add sdca_asoc_pde_ensure_ps() to handle ACTUAL_PS polling with
> support for device-specific delay tables or default intervals
> - Export function via sdca_asoc.h for use by SDCA-compliant drivers
> - Refactor entity_pde_event() in sdca_asoc.c to use the helper
>
> Signed-off-by: Niranjan H Y <niranjan.hy@ti.com>
> ---
> --- a/include/sound/sdca_asoc.h
> +++ b/include/sound/sdca_asoc.h
> @@ -99,4 +99,13 @@ int sdca_asoc_q78_put_volsw(struct snd_kcontrol *kcontrol,
> struct snd_ctl_elem_value *ucontrol);
> int sdca_asoc_q78_get_volsw(struct snd_kcontrol *kcontrol,
> struct snd_ctl_elem_value *ucontrol);
> +
> +struct device;
> +struct sdca_pde_delay;

sdca_pde_delay should go at the top of the file with the others,
device is already there so can be removed.

> +int sdca_asoc_pde_ensure_ps(struct device *dev, struct regmap *regmap,

Perhaps sdca_asoc_pde_poll_ps, but I don't feel super strongly on
that.

> + int function_id, int entity_id,
> + int from_ps, int to_ps,
> + const struct sdca_pde_delay *pde_delays,
> + int num_delays)
> +{
> + static const int polls = 100;
> + static const int default_poll_us = 1000;
> + unsigned int reg, val;
> + int i, poll_us = default_poll_us;

Put poll_us on its own line, and do all the assigned variables
first. I would combine i and ret on the same line instead.

Other than those minor nitpicks this looks good to me though.

Thanks,
Charles