Commit 01278cb6 authored by Pierre-Louis Bossart's avatar Pierre-Louis Bossart Committed by Mark Brown

ASoC: SOF: ops: fallback to mmio in helpers

Returning an error when a read/write is not implemented makes no
sense, especially on read where no return value makes sense.

Change the logic to directly fallback to mmio. If a platform truly
wants other read/writes that are not plain vanilla mmio, it needs to
implement its own routines.
Signed-off-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: default avatarRanjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: default avatarRander Wang <rander.wang@intel.com>
Reviewed-by: default avatarPéter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20221024165310.246183-2-pierre-louis.bossart@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 2cfcc108
...@@ -305,23 +305,19 @@ static inline int snd_sof_debugfs_add_region_item(struct snd_sof_dev *sdev, ...@@ -305,23 +305,19 @@ static inline int snd_sof_debugfs_add_region_item(struct snd_sof_dev *sdev,
static inline void snd_sof_dsp_write(struct snd_sof_dev *sdev, u32 bar, static inline void snd_sof_dsp_write(struct snd_sof_dev *sdev, u32 bar,
u32 offset, u32 value) u32 offset, u32 value)
{ {
if (sof_ops(sdev)->write) { if (sof_ops(sdev)->write)
sof_ops(sdev)->write(sdev, sdev->bar[bar] + offset, value); sof_ops(sdev)->write(sdev, sdev->bar[bar] + offset, value);
return; else
} writel(value, sdev->bar[bar] + offset);
dev_err_ratelimited(sdev->dev, "error: %s not defined\n", __func__);
} }
static inline void snd_sof_dsp_write64(struct snd_sof_dev *sdev, u32 bar, static inline void snd_sof_dsp_write64(struct snd_sof_dev *sdev, u32 bar,
u32 offset, u64 value) u32 offset, u64 value)
{ {
if (sof_ops(sdev)->write64) { if (sof_ops(sdev)->write64)
sof_ops(sdev)->write64(sdev, sdev->bar[bar] + offset, value); sof_ops(sdev)->write64(sdev, sdev->bar[bar] + offset, value);
return; else
} writeq(value, sdev->bar[bar] + offset);
dev_err_ratelimited(sdev->dev, "error: %s not defined\n", __func__);
} }
static inline u32 snd_sof_dsp_read(struct snd_sof_dev *sdev, u32 bar, static inline u32 snd_sof_dsp_read(struct snd_sof_dev *sdev, u32 bar,
...@@ -329,9 +325,8 @@ static inline u32 snd_sof_dsp_read(struct snd_sof_dev *sdev, u32 bar, ...@@ -329,9 +325,8 @@ static inline u32 snd_sof_dsp_read(struct snd_sof_dev *sdev, u32 bar,
{ {
if (sof_ops(sdev)->read) if (sof_ops(sdev)->read)
return sof_ops(sdev)->read(sdev, sdev->bar[bar] + offset); return sof_ops(sdev)->read(sdev, sdev->bar[bar] + offset);
else
dev_err(sdev->dev, "error: %s not defined\n", __func__); return readl(sdev->bar[bar] + offset);
return -ENOTSUPP;
} }
static inline u64 snd_sof_dsp_read64(struct snd_sof_dev *sdev, u32 bar, static inline u64 snd_sof_dsp_read64(struct snd_sof_dev *sdev, u32 bar,
...@@ -339,9 +334,8 @@ static inline u64 snd_sof_dsp_read64(struct snd_sof_dev *sdev, u32 bar, ...@@ -339,9 +334,8 @@ static inline u64 snd_sof_dsp_read64(struct snd_sof_dev *sdev, u32 bar,
{ {
if (sof_ops(sdev)->read64) if (sof_ops(sdev)->read64)
return sof_ops(sdev)->read64(sdev, sdev->bar[bar] + offset); return sof_ops(sdev)->read64(sdev, sdev->bar[bar] + offset);
else
dev_err(sdev->dev, "error: %s not defined\n", __func__); return readq(sdev->bar[bar] + offset);
return -ENOTSUPP;
} }
/* block IO */ /* block IO */
......
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