Re: [PATCH 2/5] reset: imx8mp-audiomix: Prepare the code for more reset bits

From: Peng Fan
Date: Tue Feb 18 2025 - 09:05:17 EST


On Tue, Feb 18, 2025 at 10:57:09AM +0200, Daniel Baluta wrote:
>Current code supports EARC PHY Software Reset and EARC Software
>Reset but it is not easily extensible to more reset bits.
>
>So, refactor the code in order to easily allow more reset bits
>in the future.
>
>Signed-off-by: Daniel Baluta <daniel.baluta@xxxxxxx>
>---
> drivers/reset/reset-imx8mp-audiomix.c | 53 ++++++++++++++++++++++-----
> 1 file changed, 43 insertions(+), 10 deletions(-)
>
>diff --git a/drivers/reset/reset-imx8mp-audiomix.c b/drivers/reset/reset-imx8mp-audiomix.c
>index 1fe21980a66c..6b1666c4e069 100644
>--- a/drivers/reset/reset-imx8mp-audiomix.c
>+++ b/drivers/reset/reset-imx8mp-audiomix.c
>@@ -12,7 +12,30 @@
> #include <linux/reset-controller.h>
>
> #define IMX8MP_AUDIOMIX_EARC_OFFSET 0x200
>-#define IMX8MP_AUDIOMIX_EARC_RESET_MASK 0x3
>+#define IMX8MP_AUDIOMIX_EARC_RESET_MASK 0x1
>+#define IMX8MP_AUDIOMIX_EARC_PHY_RESET_MASK 0x2
>+
>+#define IMX8MP_AUDIOMIX_EARC 0
>+#define IMX8MP_AUDIOMIX_EARC_PHY 1

Should this two lines be put in dt-bindings?

>+
>+#define IMX8MP_AUDIOMIX_RESET_NUM 2
>+
>+struct imx8mp_reset_map {
>+ unsigned int offset;
>+ unsigned int mask;
>+};
>+
>+static const struct imx8mp_reset_map reset_map[IMX8MP_AUDIOMIX_RESET_NUM] = {
>+ [IMX8MP_AUDIOMIX_EARC] = {
>+ .offset = IMX8MP_AUDIOMIX_EARC_OFFSET,
>+ .mask = IMX8MP_AUDIOMIX_EARC_RESET_MASK,
>+ },
>+ [IMX8MP_AUDIOMIX_EARC_PHY] = {
>+ .offset = IMX8MP_AUDIOMIX_EARC_OFFSET,
>+ .mask = IMX8MP_AUDIOMIX_EARC_PHY_RESET_MASK,
>+ },
>+

blank line

>+};
>

Regards,
Peng