diff mbox

ASoC: nau8825: assign DAC Ch to match headset L/R

Message ID 1459321031-2365-1-git-send-email-KCHSU0@nuvoton.com (mailing list archive)
State Accepted
Commit 3f039169ddc3edb2ecad03034843833d5b5a455f
Headers show

Commit Message

AS50 KCHSU0 March 30, 2016, 6:57 a.m. UTC
The default value of DAC channel select is reverse in codec.
For normal usage, switch the channel select when codec bootup.

Signed-off-by: John Hsu <KCHSU0@nuvoton.com>
---
 sound/soc/codecs/nau8825.c | 5 +++++
 sound/soc/codecs/nau8825.h | 6 ++++++
 2 files changed, 11 insertions(+)

Comments

Mark Brown March 30, 2016, 5:39 p.m. UTC | #1
On Wed, Mar 30, 2016 at 02:57:11PM +0800, John Hsu wrote:
> The default value of DAC channel select is reverse in codec.
> For normal usage, switch the channel select when codec bootup.

I would expect this to be exposed as DAPM routing?
Ben Zhang March 30, 2016, 10:55 p.m. UTC | #2
On Wed, Mar 30, 2016 at 10:39 AM, Mark Brown <broonie@kernel.org> wrote:
> On Wed, Mar 30, 2016 at 02:57:11PM +0800, John Hsu wrote:
>> The default value of DAC channel select is reverse in codec.
>> For normal usage, switch the channel select when codec bootup.
>
> I would expect this to be exposed as DAPM routing?

The channel selection is already exposed by DAPM widget "DACL Mux" and
"DACR Mux". The issue is that hardware default register values after
reset have the channels reversed as R/L. This patch is for
initializing to the normal L/R channels after boot. The default should
be normal L/R from userspace point of view. If userspace wants some
other settings later, it can set the muxes to get R/L, L/L, or R/R.
Mark Brown March 30, 2016, 11:32 p.m. UTC | #3
On Wed, Mar 30, 2016 at 03:55:49PM -0700, Ben Zhang wrote:

> The channel selection is already exposed by DAPM widget "DACL Mux" and
> "DACR Mux". The issue is that hardware default register values after
> reset have the channels reversed as R/L. This patch is for

And nobody managed to notice that this might be a problem before the
part was released and relabel things?  Yay.

> initializing to the normal L/R channels after boot. The default should
> be normal L/R from userspace point of view. If userspace wants some
> other settings later, it can set the muxes to get R/L, L/L, or R/R.

This is yet another case where clearer changelogs would really help.
It is a lot easier to review changes if they are clearly described.
diff mbox

Patch

diff --git a/sound/soc/codecs/nau8825.c b/sound/soc/codecs/nau8825.c
index 3e7bee2..1a99a25 100644
--- a/sound/soc/codecs/nau8825.c
+++ b/sound/soc/codecs/nau8825.c
@@ -905,6 +905,11 @@  static void nau8825_init_regs(struct nau8825 *nau8825)
 		NAU8825_RDAC_CLK_DELAY_MASK | NAU8825_RDAC_VREF_MASK,
 		(0x2 << NAU8825_RDAC_CLK_DELAY_SFT) |
 		(0x3 << NAU8825_RDAC_VREF_SFT));
+	/* Config L/R channel */
+	regmap_update_bits(nau8825->regmap, NAU8825_REG_DACL_CTRL,
+		NAU8825_DACL_CH_SEL_MASK, NAU8825_DACL_CH_SEL_L);
+	regmap_update_bits(nau8825->regmap, NAU8825_REG_DACR_CTRL,
+		NAU8825_DACL_CH_SEL_MASK, NAU8825_DACL_CH_SEL_R);
 }
 
 static const struct regmap_config nau8825_regmap_config = {
diff --git a/sound/soc/codecs/nau8825.h b/sound/soc/codecs/nau8825.h
index 5fe009d..fcf0d0a 100644
--- a/sound/soc/codecs/nau8825.h
+++ b/sound/soc/codecs/nau8825.h
@@ -256,9 +256,15 @@ 
 
 /* DACL_CTRL (0x33) */
 #define NAU8825_DACL_CH_SEL_SFT	9
+#define NAU8825_DACL_CH_SEL_MASK (0x1 << NAU8825_DACL_CH_SEL_SFT)
+#define NAU8825_DACL_CH_SEL_L    (0x0 << NAU8825_DACL_CH_SEL_SFT)
+#define NAU8825_DACL_CH_SEL_R    (0x1 << NAU8825_DACL_CH_SEL_SFT)
 
 /* DACR_CTRL (0x34) */
 #define NAU8825_DACR_CH_SEL_SFT	9
+#define NAU8825_DACR_CH_SEL_MASK (0x1 << NAU8825_DACR_CH_SEL_SFT)
+#define NAU8825_DACR_CH_SEL_L    (0x0 << NAU8825_DACR_CH_SEL_SFT)
+#define NAU8825_DACR_CH_SEL_R    (0x1 << NAU8825_DACR_CH_SEL_SFT)
 
 /* CLASSG_CTRL (0x50) */
 #define NAU8825_CLASSG_TIMER_SFT	8