Skip to content

Commit

Permalink
ASoC: fsl_micfil: Differentiate register access permission for platforms
Browse files Browse the repository at this point in the history
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: Shengjiu Wang <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Mark Brown <[email protected]>
  • Loading branch information
TE-N-ShengjiuWang authored and broonie committed Jul 29, 2024
1 parent 4ddd51c commit aa4f76e
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions sound/soc/fsl/fsl_micfil.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
struct fsl_micfil *micfil = dev_get_drvdata(dev);

switch (reg) {
case REG_MICFIL_CTRL1:
case REG_MICFIL_CTRL2:
Expand All @@ -872,9 +874,6 @@ static bool fsl_micfil_readable_reg(struct device *dev, unsigned int reg)
case REG_MICFIL_DC_CTRL:
case REG_MICFIL_OUT_CTRL:
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_CTRL2:
case REG_MICFIL_VAD0_STAT:
Expand All @@ -883,13 +882,21 @@ static bool fsl_micfil_readable_reg(struct device *dev, unsigned int reg)
case REG_MICFIL_VAD0_NDATA:
case REG_MICFIL_VAD0_ZCD:
return true;
case REG_MICFIL_FSYNC_CTRL:
case REG_MICFIL_VERID:
case REG_MICFIL_PARAM:
if (micfil->soc->use_verid)
return true;
fallthrough;
default:
return false;
}
}

static bool fsl_micfil_writeable_reg(struct device *dev, unsigned int reg)
{
struct fsl_micfil *micfil = dev_get_drvdata(dev);

switch (reg) {
case REG_MICFIL_CTRL1:
case REG_MICFIL_CTRL2:
Expand All @@ -899,14 +906,17 @@ static bool fsl_micfil_writeable_reg(struct device *dev, unsigned int reg)
case REG_MICFIL_DC_CTRL:
case REG_MICFIL_OUT_CTRL:
case REG_MICFIL_OUT_STAT: /* Write 1 to Clear */
case REG_MICFIL_FSYNC_CTRL:
case REG_MICFIL_VAD0_CTRL1:
case REG_MICFIL_VAD0_CTRL2:
case REG_MICFIL_VAD0_STAT: /* Write 1 to Clear */
case REG_MICFIL_VAD0_SCONFIG:
case REG_MICFIL_VAD0_NCONFIG:
case REG_MICFIL_VAD0_ZCD:
return true;
case REG_MICFIL_FSYNC_CTRL:
if (micfil->soc->use_verid)
return true;
fallthrough;
default:
return false;
}
Expand Down

0 comments on commit aa4f76e

Please sign in to comment.