[PATCH v5 4/6] reset: imx8mp-audiomix: Extend the driver usage

Laurentiu Mihalcea laurentiumihalcea111 at gmail.com
Fri Nov 21 01:29:48 PST 2025


On 11/14/2025 8:02 AM, Philipp Zabel wrote:
> On Fr, 2025-11-14 at 05:37 -0800, Laurentiu Mihalcea wrote:
>> From: Laurentiu Mihalcea <laurentiu.mihalcea at nxp.com>
>>
>> Switch to per-device reset map to allow reusing the driver for other NXP
>> block control IPs.
>>
>> Reviewed-by: Daniel Baluta <daniel.baluta at nxp.com>
>> Reviewed-by: Frank Li <Frank.Li at nxp.com>
>> Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea at nxp.com>
>> ---
>>  drivers/reset/reset-imx8mp-audiomix.c | 18 ++++++++++++++++--
>>  1 file changed, 16 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/reset/reset-imx8mp-audiomix.c b/drivers/reset/reset-imx8mp-audiomix.c
>> index 35df9bd5f71a..d3396f37d1ff 100644
>> --- a/drivers/reset/reset-imx8mp-audiomix.c
>> +++ b/drivers/reset/reset-imx8mp-audiomix.c
>> @@ -24,7 +24,12 @@ struct imx8mp_reset_map {
>>  	bool active_low;
>>  };
>>  
>> -static const struct imx8mp_reset_map reset_map[] = {
>> +struct imx8mp_reset_info {
>> +	const struct imx8mp_reset_map *map;
>> +	int num_lines;
>> +};
>> +
>> +static const struct imx8mp_reset_map imx8mp_reset_map[] = {
>>  	[IMX8MP_AUDIOMIX_EARC_RESET] = {
>>  		.offset	= IMX8MP_AUDIOMIX_EARC_RESET_OFFSET,
>>  		.bit = 0,
>> @@ -42,9 +47,15 @@ static const struct imx8mp_reset_map reset_map[] = {
>>  	},
>>  };
>>  
>> +static const struct imx8mp_reset_info imx8mp_reset_info = {
>> +	.map = imx8mp_reset_map,
>> +	.num_lines = ARRAY_SIZE(imx8mp_reset_map),
>> +};
>> +
>>  struct imx8mp_audiomix_reset {
>>  	struct reset_controller_dev rcdev;
>>  	struct regmap *regmap;
>> +	const struct imx8mp_reset_info *rinfo;
> Since only rinfo->map is used in imx8mp_audiomix_update(), you could
> directly store a
>
> 	const struct imx8mp_reset_map *map;


hm, that is true, but I wonder if instead of replacing "rinfo" with "map", it would be better to

keep "rinfo" and add an out-of-bounds check for the reset ID in imx8mp_audiomix_update().

Something like:


                if (id >= priv->rinfo->num_lines)

                    return -EINVAL;


we are stuck with "struct imx8mp_reset_info" so might as well fully make use of it?


>
>
> regards
> Philipp



More information about the linux-arm-kernel mailing list