* [PATCH 1/2] ASoC: adau17x1: Mark DSP parameter memory as readable and precious
@ 2014-11-21 17:53 Lars-Peter Clausen
2014-11-21 17:53 ` [PATCH 2/2] ASoC: sigmadsp: Fix endianness conversion Lars-Peter Clausen
2014-11-21 18:18 ` [PATCH 1/2] ASoC: adau17x1: Mark DSP parameter memory as readable and precious Mark Brown
0 siblings, 2 replies; 3+ messages in thread
From: Lars-Peter Clausen @ 2014-11-21 17:53 UTC (permalink / raw)
To: Mark Brown, Liam Girdwood; +Cc: alsa-devel, Lars-Peter Clausen
To be able to read back data from the DSP parameter memory the register
range needs to be marked as readable. At the same time we do not want them
to e.g. appear in debugfs output so mark them as precious as well.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
sound/soc/codecs/adau1761.c | 1 +
sound/soc/codecs/adau1781.c | 1 +
sound/soc/codecs/adau17x1.c | 14 ++++++++++++++
sound/soc/codecs/adau17x1.h | 1 +
4 files changed, 17 insertions(+)
diff --git a/sound/soc/codecs/adau1761.c b/sound/soc/codecs/adau1761.c
index 109fd78..a1baeee 100644
--- a/sound/soc/codecs/adau1761.c
+++ b/sound/soc/codecs/adau1761.c
@@ -798,6 +798,7 @@ const struct regmap_config adau1761_regmap_config = {
.num_reg_defaults = ARRAY_SIZE(adau1761_reg_defaults),
.readable_reg = adau1761_readable_register,
.volatile_reg = adau17x1_volatile_register,
+ .precious_reg = adau17x1_precious_register,
.cache_type = REGCACHE_RBTREE,
};
EXPORT_SYMBOL_GPL(adau1761_regmap_config);
diff --git a/sound/soc/codecs/adau1781.c b/sound/soc/codecs/adau1781.c
index 17966b6..35581f4 100644
--- a/sound/soc/codecs/adau1781.c
+++ b/sound/soc/codecs/adau1781.c
@@ -472,6 +472,7 @@ const struct regmap_config adau1781_regmap_config = {
.num_reg_defaults = ARRAY_SIZE(adau1781_reg_defaults),
.readable_reg = adau1781_readable_register,
.volatile_reg = adau17x1_volatile_register,
+ .precious_reg = adau17x1_precious_register,
.cache_type = REGCACHE_RBTREE,
};
EXPORT_SYMBOL_GPL(adau1781_regmap_config);
diff --git a/sound/soc/codecs/adau17x1.c b/sound/soc/codecs/adau17x1.c
index d49bc7e..fa2e690 100644
--- a/sound/soc/codecs/adau17x1.c
+++ b/sound/soc/codecs/adau17x1.c
@@ -707,8 +707,22 @@ int adau17x1_set_micbias_voltage(struct snd_soc_codec *codec,
}
EXPORT_SYMBOL_GPL(adau17x1_set_micbias_voltage);
+bool adau17x1_precious_register(struct device *dev, unsigned int reg)
+{
+ /* SigmaDSP parameter memory */
+ if (reg < 0x400)
+ return true;
+
+ return false;
+}
+EXPORT_SYMBOL_GPL(adau17x1_precious_register);
+
bool adau17x1_readable_register(struct device *dev, unsigned int reg)
{
+ /* SigmaDSP parameter memory */
+ if (reg < 0x400)
+ return true;
+
switch (reg) {
case ADAU17X1_CLOCK_CONTROL:
case ADAU17X1_PLL_CONTROL:
diff --git a/sound/soc/codecs/adau17x1.h b/sound/soc/codecs/adau17x1.h
index 6861aa3..e13583e 100644
--- a/sound/soc/codecs/adau17x1.h
+++ b/sound/soc/codecs/adau17x1.h
@@ -56,6 +56,7 @@ int adau17x1_set_micbias_voltage(struct snd_soc_codec *codec,
enum adau17x1_micbias_voltage micbias);
bool adau17x1_readable_register(struct device *dev, unsigned int reg);
bool adau17x1_volatile_register(struct device *dev, unsigned int reg);
+bool adau17x1_precious_register(struct device *dev, unsigned int reg);
int adau17x1_resume(struct snd_soc_codec *codec);
extern const struct snd_soc_dai_ops adau17x1_dai_ops;
--
1.8.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] ASoC: sigmadsp: Fix endianness conversion
2014-11-21 17:53 [PATCH 1/2] ASoC: adau17x1: Mark DSP parameter memory as readable and precious Lars-Peter Clausen
@ 2014-11-21 17:53 ` Lars-Peter Clausen
2014-11-21 18:18 ` [PATCH 1/2] ASoC: adau17x1: Mark DSP parameter memory as readable and precious Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Lars-Peter Clausen @ 2014-11-21 17:53 UTC (permalink / raw)
To: Mark Brown, Liam Girdwood; +Cc: alsa-devel, Lars-Peter Clausen
Make sure to always convert the firmware data to local endianness before
using it.
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Fixes: a35daac77a03 ("ASoC: sigmadsp: Add support for fw v2")
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
sound/soc/codecs/sigmadsp.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/soc/codecs/sigmadsp.c b/sound/soc/codecs/sigmadsp.c
index 55af596..6abefd2 100644
--- a/sound/soc/codecs/sigmadsp.c
+++ b/sound/soc/codecs/sigmadsp.c
@@ -235,7 +235,7 @@ static int sigma_fw_load_control(struct sigmadsp *sigmadsp,
ctrl->addr = le16_to_cpu(ctrl_chunk->addr);
ctrl->num_bytes = num_bytes;
- ctrl->samplerates = chunk->samplerates;
+ ctrl->samplerates = le32_to_cpu(chunk->samplerates);
list_add_tail(&ctrl->head, &sigmadsp->ctrl_list);
@@ -266,7 +266,7 @@ static int sigma_fw_load_data(struct sigmadsp *sigmadsp,
data->addr = le16_to_cpu(data_chunk->addr);
data->length = length;
- data->samplerates = chunk->samplerates;
+ data->samplerates = le32_to_cpu(chunk->samplerates);
memcpy(data->data, data_chunk->data, length);
list_add_tail(&data->head, &sigmadsp->data_list);
@@ -329,7 +329,7 @@ static int sigmadsp_fw_load_v2(struct sigmadsp *sigmadsp,
if (length > fw->size - pos || length < sizeof(*chunk))
return -EINVAL;
- switch (chunk->tag) {
+ switch (le32_to_cpu(chunk->tag)) {
case SIGMA_FW_CHUNK_TYPE_DATA:
ret = sigma_fw_load_data(sigmadsp, chunk, length);
break;
--
1.8.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] ASoC: adau17x1: Mark DSP parameter memory as readable and precious
2014-11-21 17:53 [PATCH 1/2] ASoC: adau17x1: Mark DSP parameter memory as readable and precious Lars-Peter Clausen
2014-11-21 17:53 ` [PATCH 2/2] ASoC: sigmadsp: Fix endianness conversion Lars-Peter Clausen
@ 2014-11-21 18:18 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2014-11-21 18:18 UTC (permalink / raw)
To: Lars-Peter Clausen; +Cc: alsa-devel, Liam Girdwood
[-- Attachment #1.1: Type: text/plain, Size: 311 bytes --]
On Fri, Nov 21, 2014 at 06:53:51PM +0100, Lars-Peter Clausen wrote:
> To be able to read back data from the DSP parameter memory the register
> range needs to be marked as readable. At the same time we do not want them
> to e.g. appear in debugfs output so mark them as precious as well.
Applied both, thanks.
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-11-21 18:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-21 17:53 [PATCH 1/2] ASoC: adau17x1: Mark DSP parameter memory as readable and precious Lars-Peter Clausen
2014-11-21 17:53 ` [PATCH 2/2] ASoC: sigmadsp: Fix endianness conversion Lars-Peter Clausen
2014-11-21 18:18 ` [PATCH 1/2] ASoC: adau17x1: Mark DSP parameter memory as readable and precious Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox