* [PATCH] ASoC: rt5677: Fix the issue that the private value cannot be accessed
@ 2014-11-21 1:54 Oder Chiou
2014-11-21 18:15 ` Mark Brown
0 siblings, 1 reply; 2+ messages in thread
From: Oder Chiou @ 2014-11-21 1:54 UTC (permalink / raw)
To: broonie, lgirdwood
Cc: Oder Chiou, alsa-devel, john.lin, benzh, anatol, bardliao, flove
Fix the issue that the private value cannot be accessed.
Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
---
sound/soc/codecs/rt5677.c | 37 ++++++++++++++++++++++++++++++-------
sound/soc/codecs/rt5677.h | 2 +-
2 files changed, 31 insertions(+), 8 deletions(-)
diff --git a/sound/soc/codecs/rt5677.c b/sound/soc/codecs/rt5677.c
index f2211f1..133010d 100644
--- a/sound/soc/codecs/rt5677.c
+++ b/sound/soc/codecs/rt5677.c
@@ -4287,6 +4287,7 @@ static int rt5677_probe(struct snd_soc_codec *codec)
}
mutex_init(&rt5677->dsp_cmd_lock);
+ mutex_init(&rt5677->dsp_pri_lock);
return 0;
}
@@ -4344,10 +4345,19 @@ static int rt5677_read(void *context, unsigned int reg, unsigned int *val)
struct i2c_client *client = context;
struct rt5677_priv *rt5677 = i2c_get_clientdata(client);
- if (rt5677->is_dsp_mode)
- rt5677_dsp_mode_i2c_read(rt5677, reg, val);
- else
+ if (rt5677->is_dsp_mode) {
+ if (reg > 0xff) {
+ mutex_lock(&rt5677->dsp_pri_lock);
+ rt5677_dsp_mode_i2c_write(rt5677, RT5677_PRIV_INDEX,
+ reg & 0xff);
+ rt5677_dsp_mode_i2c_read(rt5677, RT5677_PRIV_DATA, val);
+ mutex_unlock(&rt5677->dsp_pri_lock);
+ } else {
+ rt5677_dsp_mode_i2c_read(rt5677, reg, val);
+ }
+ } else {
regmap_read(rt5677->regmap_physical, reg, val);
+ }
return 0;
}
@@ -4357,10 +4367,20 @@ static int rt5677_write(void *context, unsigned int reg, unsigned int val)
struct i2c_client *client = context;
struct rt5677_priv *rt5677 = i2c_get_clientdata(client);
- if (rt5677->is_dsp_mode)
- rt5677_dsp_mode_i2c_write(rt5677, reg, val);
- else
+ if (rt5677->is_dsp_mode) {
+ if (reg > 0xff) {
+ mutex_lock(&rt5677->dsp_pri_lock);
+ rt5677_dsp_mode_i2c_write(rt5677, RT5677_PRIV_INDEX,
+ reg & 0xff);
+ rt5677_dsp_mode_i2c_write(rt5677, RT5677_PRIV_DATA,
+ val);
+ mutex_unlock(&rt5677->dsp_pri_lock);
+ } else {
+ rt5677_dsp_mode_i2c_write(rt5677, reg, val);
+ }
+ } else {
regmap_write(rt5677->regmap_physical, reg, val);
+ }
return 0;
}
@@ -4495,10 +4515,13 @@ static const struct regmap_config rt5677_regmap_physical = {
.reg_bits = 8,
.val_bits = 16,
- .max_register = RT5677_VENDOR_ID2 + 1,
+ .max_register = RT5677_VENDOR_ID2 + 1 + (ARRAY_SIZE(rt5677_ranges) *
+ RT5677_PR_SPACING),
.readable_reg = rt5677_readable_register,
.cache_type = REGCACHE_NONE,
+ .ranges = rt5677_ranges,
+ .num_ranges = ARRAY_SIZE(rt5677_ranges),
};
static const struct regmap_config rt5677_regmap = {
diff --git a/sound/soc/codecs/rt5677.h b/sound/soc/codecs/rt5677.h
index a02f64c..dbd9ffd 100644
--- a/sound/soc/codecs/rt5677.h
+++ b/sound/soc/codecs/rt5677.h
@@ -1670,7 +1670,7 @@ struct rt5677_priv {
struct rt5677_platform_data pdata;
struct regmap *regmap, *regmap_physical;
const struct firmware *fw1, *fw2;
- struct mutex dsp_cmd_lock;
+ struct mutex dsp_cmd_lock, dsp_pri_lock;
int sysclk;
int sysclk_src;
--
1.8.1.1.439.g50a6b54
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ASoC: rt5677: Fix the issue that the private value cannot be accessed
2014-11-21 1:54 [PATCH] ASoC: rt5677: Fix the issue that the private value cannot be accessed Oder Chiou
@ 2014-11-21 18:15 ` Mark Brown
0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2014-11-21 18:15 UTC (permalink / raw)
To: Oder Chiou
Cc: alsa-devel, lgirdwood, john.lin, anatol, bardliao, benzh, flove
[-- Attachment #1.1: Type: text/plain, Size: 209 bytes --]
On Fri, Nov 21, 2014 at 09:54:38AM +0800, Oder Chiou wrote:
> Fix the issue that the private value cannot be accessed.
Please provide a better changelog - what is the problem and how does
this change fix it?
[-- 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] 2+ messages in thread
end of thread, other threads:[~2014-11-21 18:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-21 1:54 [PATCH] ASoC: rt5677: Fix the issue that the private value cannot be accessed Oder Chiou
2014-11-21 18:15 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox