Commit aa4f76ef authored by Shengjiu Wang's avatar Shengjiu Wang Committed by Mark Brown

ASoC: fsl_micfil: Differentiate register access permission for platforms

On i.MX9x platforms, the REG_MICFIL_FSYNC_CTRL, REG_MICFIL_VERID,
REG_MICFIL_PARAM are added, but they are not existed on i.MX8x
platforms.

Use the existed micfil->soc->use_verid to distinguish the access
permission for these platforms.
Signed-off-by: default avatarShengjiu Wang <shengjiu.wang@nxp.com>
Link: https://patch.msgid.link/1721897694-6088-3-git-send-email-shengjiu.wang@nxp.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 4ddd51cc
...@@ -855,6 +855,8 @@ static const struct reg_default fsl_micfil_reg_defaults[] = { ...@@ -855,6 +855,8 @@ static const struct reg_default fsl_micfil_reg_defaults[] = {
static bool fsl_micfil_readable_reg(struct device *dev, unsigned int reg) static bool fsl_micfil_readable_reg(struct device *dev, unsigned int reg)
{ {
struct fsl_micfil *micfil = dev_get_drvdata(dev);
switch (reg) { switch (reg) {
case REG_MICFIL_CTRL1: case REG_MICFIL_CTRL1:
case REG_MICFIL_CTRL2: case REG_MICFIL_CTRL2:
...@@ -872,9 +874,6 @@ static bool fsl_micfil_readable_reg(struct device *dev, unsigned int reg) ...@@ -872,9 +874,6 @@ static bool fsl_micfil_readable_reg(struct device *dev, unsigned int reg)
case REG_MICFIL_DC_CTRL: case REG_MICFIL_DC_CTRL:
case REG_MICFIL_OUT_CTRL: case REG_MICFIL_OUT_CTRL:
case REG_MICFIL_OUT_STAT: case REG_MICFIL_OUT_STAT:
case REG_MICFIL_FSYNC_CTRL:
case REG_MICFIL_VERID:
case REG_MICFIL_PARAM:
case REG_MICFIL_VAD0_CTRL1: case REG_MICFIL_VAD0_CTRL1:
case REG_MICFIL_VAD0_CTRL2: case REG_MICFIL_VAD0_CTRL2:
case REG_MICFIL_VAD0_STAT: case REG_MICFIL_VAD0_STAT:
...@@ -883,6 +882,12 @@ static bool fsl_micfil_readable_reg(struct device *dev, unsigned int reg) ...@@ -883,6 +882,12 @@ static bool fsl_micfil_readable_reg(struct device *dev, unsigned int reg)
case REG_MICFIL_VAD0_NDATA: case REG_MICFIL_VAD0_NDATA:
case REG_MICFIL_VAD0_ZCD: case REG_MICFIL_VAD0_ZCD:
return true; return true;
case REG_MICFIL_FSYNC_CTRL:
case REG_MICFIL_VERID:
case REG_MICFIL_PARAM:
if (micfil->soc->use_verid)
return true;
fallthrough;
default: default:
return false; return false;
} }
...@@ -890,6 +895,8 @@ static bool fsl_micfil_readable_reg(struct device *dev, unsigned int reg) ...@@ -890,6 +895,8 @@ static bool fsl_micfil_readable_reg(struct device *dev, unsigned int reg)
static bool fsl_micfil_writeable_reg(struct device *dev, unsigned int reg) static bool fsl_micfil_writeable_reg(struct device *dev, unsigned int reg)
{ {
struct fsl_micfil *micfil = dev_get_drvdata(dev);
switch (reg) { switch (reg) {
case REG_MICFIL_CTRL1: case REG_MICFIL_CTRL1:
case REG_MICFIL_CTRL2: case REG_MICFIL_CTRL2:
...@@ -899,7 +906,6 @@ static bool fsl_micfil_writeable_reg(struct device *dev, unsigned int reg) ...@@ -899,7 +906,6 @@ static bool fsl_micfil_writeable_reg(struct device *dev, unsigned int reg)
case REG_MICFIL_DC_CTRL: case REG_MICFIL_DC_CTRL:
case REG_MICFIL_OUT_CTRL: case REG_MICFIL_OUT_CTRL:
case REG_MICFIL_OUT_STAT: /* Write 1 to Clear */ case REG_MICFIL_OUT_STAT: /* Write 1 to Clear */
case REG_MICFIL_FSYNC_CTRL:
case REG_MICFIL_VAD0_CTRL1: case REG_MICFIL_VAD0_CTRL1:
case REG_MICFIL_VAD0_CTRL2: case REG_MICFIL_VAD0_CTRL2:
case REG_MICFIL_VAD0_STAT: /* Write 1 to Clear */ case REG_MICFIL_VAD0_STAT: /* Write 1 to Clear */
...@@ -907,6 +913,10 @@ static bool fsl_micfil_writeable_reg(struct device *dev, unsigned int reg) ...@@ -907,6 +913,10 @@ static bool fsl_micfil_writeable_reg(struct device *dev, unsigned int reg)
case REG_MICFIL_VAD0_NCONFIG: case REG_MICFIL_VAD0_NCONFIG:
case REG_MICFIL_VAD0_ZCD: case REG_MICFIL_VAD0_ZCD:
return true; return true;
case REG_MICFIL_FSYNC_CTRL:
if (micfil->soc->use_verid)
return true;
fallthrough;
default: default:
return false; return false;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment