Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1240165 > unrolled thread

[PATCH 0/2] *** wm8962 regmap related fix ***

Started byJiada Wang <jiada_wang@mentor.com>
First post2015-10-06 09:10 +0200
Last post2015-10-08 03:40 +0200
Articles 7 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/2] *** wm8962 regmap related fix *** Jiada Wang <jiada_wang@mentor.com> - 2015-10-06 09:10 +0200
    [PATCH 2/2] ASoC: Codec: wm8962: declare ALC Coefficients as 4 separate registers Jiada Wang <jiada_wang@mentor.com> - 2015-10-06 09:10 +0200
      Re: [PATCH 2/2] ASoC: Codec: wm8962: declare ALC Coefficients as 4  separate registers Mark Brown <broonie@kernel.org> - 2015-10-06 13:10 +0200
        Re: [PATCH 2/2] ASoC: Codec: wm8962: declare ALC Coefficients as  4 separate registers Jiada Wang <jiada_wang@mentor.com> - 2015-10-08 05:20 +0200
    [PATCH 1/2] ASoC: WM8962: mark cache_dirty flag after software reset in pm_resume Jiada Wang <jiada_wang@mentor.com> - 2015-10-06 09:10 +0200
      Re: [PATCH 1/2] ASoC: WM8962: mark cache_dirty flag after software  reset in pm_resume Mark Brown <broonie@kernel.org> - 2015-10-06 13:10 +0200
        Re: [PATCH 1/2] ASoC: WM8962: mark cache_dirty flag after software  reset in pm_resume Jiada Wang <jiada_wang@mentor.com> - 2015-10-08 03:40 +0200

#1240165 — [PATCH 0/2] *** wm8962 regmap related fix ***

FromJiada Wang <jiada_wang@mentor.com>
Date2015-10-06 09:10 +0200
Subject[PATCH 0/2] *** wm8962 regmap related fix ***
Message-ID<qguxP-7kY-3@gated-at.bofh.it>
This patch set aims to fix issues in wm8962 codec driver related to regmap,
currently any attempt to read from ALC Coefficient register will fail
when wm8962 is in suspend mode. As ALC2 register is volatile register,
it can't be read when cache_only flag is set.

Another issue is, if wm8962's regulator is set to 'regulator-always-on'
mode, then after wm8962 is resumed from suspend, wm8962 codec is reset,
but cache_dirty flag isn't set, this cause difference between actual wm8962
HW and regmap cache.

Jiada Wang (2):
  ASoC: WM8962: mark cache_dirty flag after software reset in pm_resume
  ASoC: Codec: wm8962: declare ALC Coefficients as 4 separate registers

 sound/soc/codecs/wm8962.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

-- 
2.4.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1240166 — [PATCH 2/2] ASoC: Codec: wm8962: declare ALC Coefficients as 4 separate registers

FromJiada Wang <jiada_wang@mentor.com>
Date2015-10-06 09:10 +0200
Subject[PATCH 2/2] ASoC: Codec: wm8962: declare ALC Coefficients as 4 separate registers
Message-ID<qguxP-7kY-1@gated-at.bofh.it>
In reply to#1240165
As ALC2 register is volatile, declare it as one of ALC Coefficients
register together with other non-volatile registers will cause issue,
in case wm8962 has enter suspend mode, and cache_only flag is set,
any attempt to read from ALC2 will fail.

Instead of declaring one ALC Coefficients register which contains
ALC1 ~ ALC3 and Noise Gate, this patch declares 4 separate registers,
so that regmap can handle these registers differently based on their
classification.

Signed-off-by: Jiada Wang <jiada_wang@mentor.com>
---
 sound/soc/codecs/wm8962.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c
index 319ee38..1201efd 100644
--- a/sound/soc/codecs/wm8962.c
+++ b/sound/soc/codecs/wm8962.c
@@ -1782,8 +1782,11 @@ SND_SOC_BYTES("HD Bass Coefficients", WM8962_HDBASS_AI_1, 30),
 
 SOC_DOUBLE("ALC Switch", WM8962_ALC1, WM8962_ALCL_ENA_SHIFT,
 		WM8962_ALCR_ENA_SHIFT, 1, 0),
-SND_SOC_BYTES_MASK("ALC Coefficients", WM8962_ALC1, 4,
+SND_SOC_BYTES_MASK("ALC1", WM8962_ALC1, 1,
 		WM8962_ALCL_ENA_MASK | WM8962_ALCR_ENA_MASK),
+SND_SOC_BYTES("ALC2", WM8962_ALC2, 1),
+SND_SOC_BYTES("ALC3", WM8962_ALC3, 1),
+SND_SOC_BYTES("Noise Gate", WM8962_NOISE_GATE, 1),
 };
 
 static const struct snd_kcontrol_new wm8962_spk_mono_controls[] = {
-- 
2.4.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1240370 — Re: [PATCH 2/2] ASoC: Codec: wm8962: declare ALC Coefficients as 4 separate registers

FromMark Brown <broonie@kernel.org>
Date2015-10-06 13:10 +0200
SubjectRe: [PATCH 2/2] ASoC: Codec: wm8962: declare ALC Coefficients as 4 separate registers
Message-ID<qgyi6-4m5-23@gated-at.bofh.it>
In reply to#1240166

[Multipart message — attachments visible in raw view] — view raw

On Tue, Oct 06, 2015 at 04:06:55PM +0900, Jiada Wang wrote:

> As ALC2 register is volatile, declare it as one of ALC Coefficients
> register together with other non-volatile registers will cause issue,
> in case wm8962 has enter suspend mode, and cache_only flag is set,
> any attempt to read from ALC2 will fail.

> Instead of declaring one ALC Coefficients register which contains
> ALC1 ~ ALC3 and Noise Gate, this patch declares 4 separate registers,
> so that regmap can handle these registers differently based on their
> classification.

I don't understand this commit log.  Why does regmap care how these
registers are presented to userspace, and how does splitting the
controls up address the problem with one of the registers being volatile?
Surely that register still has the same problem?

[toc] | [prev] | [next] | [standalone]


#1241939 — Re: [PATCH 2/2] ASoC: Codec: wm8962: declare ALC Coefficients as 4 separate registers

FromJiada Wang <jiada_wang@mentor.com>
Date2015-10-08 05:20 +0200
SubjectRe: [PATCH 2/2] ASoC: Codec: wm8962: declare ALC Coefficients as 4 separate registers
Message-ID<qh9Um-7XH-3@gated-at.bofh.it>
In reply to#1240370
Hi


On 10/06/2015 08:01 PM, Mark Brown wrote:
> On Tue, Oct 06, 2015 at 04:06:55PM +0900, Jiada Wang wrote:
>
>> As ALC2 register is volatile, declare it as one of ALC Coefficients
>> register together with other non-volatile registers will cause issue,
>> in case wm8962 has enter suspend mode, and cache_only flag is set,
>> any attempt to read from ALC2 will fail.
>
>> Instead of declaring one ALC Coefficients register which contains
>> ALC1 ~ ALC3 and Noise Gate, this patch declares 4 separate registers,
>> so that regmap can handle these registers differently based on their
>> classification.
>
> I don't understand this commit log.  Why does regmap care how these
> registers are presented to userspace, and how does splitting the
> controls up address the problem with one of the registers being volatile?
> Surely that register still has the same problem?
>
.get callback function will call regmap_raw_read() to read register
value from these registers, when these 4 regsters are declared as one
"ALC coefficient" register, condition check of regmap_volatile_range()
will return false, thus regmap will go word by word for the cache from
each register of "ALC Coefficient", the failure scenario is, when
wm8962 is in suspend mode (cache_only flag is set), as ALC2 doesn't
have cached value, then any attempt to read from it fails,

By splitting these registers, regmap can handle ALC2 as a single
volatile register, and always read from HW

Thanks,
Jiada

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1240169 — [PATCH 1/2] ASoC: WM8962: mark cache_dirty flag after software reset in pm_resume

FromJiada Wang <jiada_wang@mentor.com>
Date2015-10-06 09:10 +0200
Subject[PATCH 1/2] ASoC: WM8962: mark cache_dirty flag after software reset in pm_resume
Message-ID<qguxP-7kY-11@gated-at.bofh.it>
In reply to#1240165
By doing software reset of wm8962 in pm_resume, all registers which
have already been set will be reset to default value without regmap
interface be involved, thus driver need to mark cache_dirty flag,
to let regcache can be updated by regcache_sync().

Signed-off-by: Jiada Wang <jiada_wang@mentor.com>
---
 sound/soc/codecs/wm8962.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c
index 293e47a..319ee38 100644
--- a/sound/soc/codecs/wm8962.c
+++ b/sound/soc/codecs/wm8962.c
@@ -3805,6 +3805,13 @@ static int wm8962_runtime_resume(struct device *dev)
 
 	wm8962_reset(wm8962);
 
+	/* All registers have been reset to default value without calling
+	 * to regmap interface, even if reset fails, some registers
+	 * maybe in intermediate status, so we need to mark regmap
+	 * cache_dirty flag.
+	 */
+	regcache_mark_dirty(wm8962->regmap);
+
 	/* SYSCLK defaults to on; make sure it is off so we can safely
 	 * write to registers if the device is declocked.
 	 */
-- 
2.4.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1240368 — Re: [PATCH 1/2] ASoC: WM8962: mark cache_dirty flag after software reset in pm_resume

FromMark Brown <broonie@kernel.org>
Date2015-10-06 13:10 +0200
SubjectRe: [PATCH 1/2] ASoC: WM8962: mark cache_dirty flag after software reset in pm_resume
Message-ID<qgyi5-4m5-13@gated-at.bofh.it>
In reply to#1240169

[Multipart message — attachments visible in raw view] — view raw

On Tue, Oct 06, 2015 at 04:06:54PM +0900, Jiada Wang wrote:

> +	/* All registers have been reset to default value without calling
> +	 * to regmap interface, even if reset fails, some registers
> +	 * maybe in intermediate status, so we need to mark regmap
> +	 * cache_dirty flag.
> +	 */
> +	regcache_mark_dirty(wm8962->regmap);

This is a standard thing that applies to almost all devices, there
should be no need for such an extensive comment (which would normally
flag up that there's something weird and surprising going on).

[toc] | [prev] | [next] | [standalone]


#1241922 — Re: [PATCH 1/2] ASoC: WM8962: mark cache_dirty flag after software reset in pm_resume

FromJiada Wang <jiada_wang@mentor.com>
Date2015-10-08 03:40 +0200
SubjectRe: [PATCH 1/2] ASoC: WM8962: mark cache_dirty flag after software reset in pm_resume
Message-ID<qh8lz-5yB-5@gated-at.bofh.it>
In reply to#1240368
Hi

On 10/06/2015 07:59 PM, Mark Brown wrote:
> On Tue, Oct 06, 2015 at 04:06:54PM +0900, Jiada Wang wrote:
>
>> +	/* All registers have been reset to default value without calling
>> +	 * to regmap interface, even if reset fails, some registers
>> +	 * maybe in intermediate status, so we need to mark regmap
>> +	 * cache_dirty flag.
>> +	 */
>> +	regcache_mark_dirty(wm8962->regmap);
>
> This is a standard thing that applies to almost all devices, there
> should be no need for such an extensive comment (which would normally
> flag up that there's something weird and surprising going on).
>

Will remove the comment in next update
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web