All of lore.kernel.org
 help / color / mirror / Atom feed
* [[PATCH 0/9] ASoC: Intel: bytcr_rt5651: Cleanup (input mapping quirks)
@ 2018-06-24 14:06 Hans de Goede
  2018-06-24 14:06 ` [PATCH 1/9] ASoC: Intel: bytcr_rt5651: Add BYT_RT5651_DEFAULT_QUIRKS define Hans de Goede
                   ` (9 more replies)
  0 siblings, 10 replies; 23+ messages in thread
From: Hans de Goede @ 2018-06-24 14:06 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Bard Liao, Oder Chiou
  Cc: Hans de Goede, alsa-devel, Pierre-Louis Bossart, Carlo Caione

Hi Mark,

This series is mainly a cleanup series. In the beginning of the rt5651
machine driver some wrong assumptions were made, such as the headset
mic being attached to IN2 (it is on IN3 on the 7 machines I have access
to and on all otherwise known machines).

And also adding a quirk for a machine with the intmic on IN2, which
later got fixed with a new quirk for machines with 2 internal mics
on both IN1 and IN2 and moving the one machine with the IN2 quirk
over to the new IN1_IN2 quirk, leaving the IN2 quirk as an orphan
quirk for non existing hardware.

Then I made a similar mistake adding the IN2_HS_IN3 quirk, while I
should have used the IN1_HS_IN3 (which itself only exists because
the original IN1 quirk has the headset input mapping wrong),

TL;DR: it is a bit of a mess due to a number of wrong assumptions
about how the inputs where actually routed in the past.

This series cleans this all up in small commits / one bit a time and
refers the original commit messages in its commit messages.

Note patch 10/11 is not a cleanup patch, but is more or less the
reason I took a second look at all the quirks.

Regards,

Hans

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [PATCH 1/9] ASoC: Intel: bytcr_rt5651: Add BYT_RT5651_DEFAULT_QUIRKS define
  2018-06-24 14:06 [[PATCH 0/9] ASoC: Intel: bytcr_rt5651: Cleanup (input mapping quirks) Hans de Goede
@ 2018-06-24 14:06 ` Hans de Goede
  2018-06-27 11:32   ` Applied "ASoC: Intel: bytcr_rt5651: Add BYT_RT5651_DEFAULT_QUIRKS define" to the asoc tree Mark Brown
  2018-06-24 14:06 ` [PATCH 2/9] ASoC: Intel: bytcr_rt5651: Change default input map from in2 to in1 Hans de Goede
                   ` (8 subsequent siblings)
  9 siblings, 1 reply; 23+ messages in thread
From: Hans de Goede @ 2018-06-24 14:06 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Bard Liao, Oder Chiou
  Cc: Hans de Goede, alsa-devel, Pierre-Louis Bossart, Carlo Caione

Almost all boards use the mclk and use the same jack-detect settings, add
a BYT_RT5651_DEFAULT_QUIRKS define for this.

This shaves of some lines and makes it easier to see which settings are
unique to a certain model.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 sound/soc/intel/boards/bytcr_rt5651.c | 25 +++++++++----------------
 1 file changed, 9 insertions(+), 16 deletions(-)

diff --git a/sound/soc/intel/boards/bytcr_rt5651.c b/sound/soc/intel/boards/bytcr_rt5651.c
index 925dfb46b4fe..c45ad99d7ac6 100644
--- a/sound/soc/intel/boards/bytcr_rt5651.c
+++ b/sound/soc/intel/boards/bytcr_rt5651.c
@@ -79,6 +79,11 @@ enum {
 #define BYT_RT5651_SSP0_AIF1		BIT(20)
 #define BYT_RT5651_SSP0_AIF2		BIT(21)
 
+#define BYT_RT5651_DEFAULT_QUIRKS	(BYT_RT5651_MCLK_EN | \
+					 BYT_RT5651_JD1_1   | \
+					 BYT_RT5651_OVCD_TH_2000UA | \
+					 BYT_RT5651_OVCD_SF_0P75)
+
 /* jack-detect-source + dmic-en + ovcd-th + -sf + terminating empty entry */
 #define MAX_NO_PROPS 5
 
@@ -88,10 +93,7 @@ struct byt_rt5651_private {
 };
 
 /* Default: jack-detect on JD1_1, internal mic on in2, headsetmic on in3 */
-static unsigned long byt_rt5651_quirk = BYT_RT5651_MCLK_EN |
-					BYT_RT5651_JD1_1 |
-					BYT_RT5651_OVCD_TH_2000UA |
-					BYT_RT5651_OVCD_SF_0P75 |
+static unsigned long byt_rt5651_quirk = BYT_RT5651_DEFAULT_QUIRKS |
 					BYT_RT5651_IN2_HS_IN3_MAP;
 
 static void log_quirks(struct device *dev)
@@ -381,10 +383,7 @@ static const struct dmi_system_id byt_rt5651_quirk_table[] = {
 			DMI_MATCH(DMI_SYS_VENDOR, "KIANO"),
 			DMI_MATCH(DMI_PRODUCT_NAME, "KIANO SlimNote 14.2"),
 		},
-		.driver_data = (void *)(BYT_RT5651_MCLK_EN |
-					BYT_RT5651_JD1_1 |
-					BYT_RT5651_OVCD_TH_2000UA |
-					BYT_RT5651_OVCD_SF_0P75 |
+		.driver_data = (void *)(BYT_RT5651_DEFAULT_QUIRKS |
 					BYT_RT5651_IN1_IN2_MAP),
 	},
 	{
@@ -394,10 +393,7 @@ static const struct dmi_system_id byt_rt5651_quirk_table[] = {
 			DMI_MATCH(DMI_SYS_VENDOR, "Hampoo"),
 			DMI_MATCH(DMI_PRODUCT_NAME, "D2D3_Vi8A1"),
 		},
-		.driver_data = (void *)(BYT_RT5651_MCLK_EN |
-					BYT_RT5651_JD1_1 |
-					BYT_RT5651_OVCD_TH_2000UA |
-					BYT_RT5651_OVCD_SF_0P75 |
+		.driver_data = (void *)(BYT_RT5651_DEFAULT_QUIRKS |
 					BYT_RT5651_IN2_HS_IN3_MAP),
 	},
 	{
@@ -407,10 +403,7 @@ static const struct dmi_system_id byt_rt5651_quirk_table[] = {
 			DMI_MATCH(DMI_SYS_VENDOR, "VIOS"),
 			DMI_MATCH(DMI_PRODUCT_NAME, "LTH17"),
 		},
-		.driver_data = (void *)(BYT_RT5651_MCLK_EN |
-					BYT_RT5651_JD1_1 |
-					BYT_RT5651_OVCD_TH_2000UA |
-					BYT_RT5651_OVCD_SF_1P0 |
+		.driver_data = (void *)(BYT_RT5651_DEFAULT_QUIRKS |
 					BYT_RT5651_IN1_IN2_MAP),
 	},
 	{}
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 2/9] ASoC: Intel: bytcr_rt5651: Change default input map from in2 to in1
  2018-06-24 14:06 [[PATCH 0/9] ASoC: Intel: bytcr_rt5651: Cleanup (input mapping quirks) Hans de Goede
  2018-06-24 14:06 ` [PATCH 1/9] ASoC: Intel: bytcr_rt5651: Add BYT_RT5651_DEFAULT_QUIRKS define Hans de Goede
@ 2018-06-24 14:06 ` Hans de Goede
  2018-06-27 11:32   ` Applied "ASoC: Intel: bytcr_rt5651: Change default input map from in2 to in1" to the asoc tree Mark Brown
  2018-06-24 14:06 ` [PATCH 3/9] ASoC: Intel: bytcr_rt5651: Fix IN1_IN2_MAP quirk not being logged Hans de Goede
                   ` (7 subsequent siblings)
  9 siblings, 1 reply; 23+ messages in thread
From: Hans de Goede @ 2018-06-24 14:06 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Bard Liao, Oder Chiou
  Cc: Hans de Goede, alsa-devel, Pierre-Louis Bossart, Carlo Caione

Further testing on all 6 model x86 tablets with a rt5651 which I have
access to for testing has shown that their single (mono) microphone is
connected to both IN1 *and* IN2.

The previous default mapping of IN2 was based on testing on the same 6
tablets, where the internal mic works fine with a mapping of IN2. But it
works fine too with a mapping of IN1.

This commit changes the default input mapping to to use IN1 instead of
IN2, to match the mapping used for the other mono devices in the DMI quirk
table. So that we need less different mappings.

The same change is made to the Chuwi Vi8 Plus quirks, which is one of the
6 models tested.

This is a preparation patch for simplifying the maps in a follow-up commit.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 sound/soc/intel/boards/bytcr_rt5651.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sound/soc/intel/boards/bytcr_rt5651.c b/sound/soc/intel/boards/bytcr_rt5651.c
index c45ad99d7ac6..28f9304ea041 100644
--- a/sound/soc/intel/boards/bytcr_rt5651.c
+++ b/sound/soc/intel/boards/bytcr_rt5651.c
@@ -92,9 +92,9 @@ struct byt_rt5651_private {
 	struct snd_soc_jack jack;
 };
 
-/* Default: jack-detect on JD1_1, internal mic on in2, headsetmic on in3 */
+/* Default: jack-detect on JD1_1, internal mic on in1, headsetmic on in3 */
 static unsigned long byt_rt5651_quirk = BYT_RT5651_DEFAULT_QUIRKS |
-					BYT_RT5651_IN2_HS_IN3_MAP;
+					BYT_RT5651_IN1_HS_IN3_MAP;
 
 static void log_quirks(struct device *dev)
 {
@@ -394,7 +394,7 @@ static const struct dmi_system_id byt_rt5651_quirk_table[] = {
 			DMI_MATCH(DMI_PRODUCT_NAME, "D2D3_Vi8A1"),
 		},
 		.driver_data = (void *)(BYT_RT5651_DEFAULT_QUIRKS |
-					BYT_RT5651_IN2_HS_IN3_MAP),
+					BYT_RT5651_IN1_HS_IN3_MAP),
 	},
 	{
 		/* VIOS LTH17 */
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 3/9] ASoC: Intel: bytcr_rt5651: Fix IN1_IN2_MAP quirk not being logged
  2018-06-24 14:06 [[PATCH 0/9] ASoC: Intel: bytcr_rt5651: Cleanup (input mapping quirks) Hans de Goede
  2018-06-24 14:06 ` [PATCH 1/9] ASoC: Intel: bytcr_rt5651: Add BYT_RT5651_DEFAULT_QUIRKS define Hans de Goede
  2018-06-24 14:06 ` [PATCH 2/9] ASoC: Intel: bytcr_rt5651: Change default input map from in2 to in1 Hans de Goede
@ 2018-06-24 14:06 ` Hans de Goede
  2018-06-27 11:32   ` Applied "ASoC: Intel: bytcr_rt5651: Fix IN1_IN2_MAP quirk not being logged" to the asoc tree Mark Brown
  2018-06-24 14:06 ` [PATCH 4/9] ASoC: Intel: bytcr_rt5651: Remove IN2 input mappings Hans de Goede
                   ` (6 subsequent siblings)
  9 siblings, 1 reply; 23+ messages in thread
From: Hans de Goede @ 2018-06-24 14:06 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Bard Liao, Oder Chiou
  Cc: Hans de Goede, alsa-devel, Pierre-Louis Bossart, Carlo Caione

Fix the quirk logging code not logging the IN1_IN2_MAP quirk.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 sound/soc/intel/boards/bytcr_rt5651.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sound/soc/intel/boards/bytcr_rt5651.c b/sound/soc/intel/boards/bytcr_rt5651.c
index 28f9304ea041..57de730f74dd 100644
--- a/sound/soc/intel/boards/bytcr_rt5651.c
+++ b/sound/soc/intel/boards/bytcr_rt5651.c
@@ -104,6 +104,8 @@ static void log_quirks(struct device *dev)
 		dev_info(dev, "quirk IN1_MAP enabled");
 	if (BYT_RT5651_MAP(byt_rt5651_quirk) == BYT_RT5651_IN2_MAP)
 		dev_info(dev, "quirk IN2_MAP enabled");
+	if (BYT_RT5651_MAP(byt_rt5651_quirk) == BYT_RT5651_IN1_IN2_MAP)
+		dev_info(dev, "quirk IN1_IN2_MAP enabled");
 	if (BYT_RT5651_MAP(byt_rt5651_quirk) == BYT_RT5651_IN1_HS_IN3_MAP)
 		dev_info(dev, "quirk IN1_HS_IN3_MAP enabled");
 	if (BYT_RT5651_MAP(byt_rt5651_quirk) == BYT_RT5651_IN2_HS_IN3_MAP)
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 4/9] ASoC: Intel: bytcr_rt5651: Remove IN2 input mappings
  2018-06-24 14:06 [[PATCH 0/9] ASoC: Intel: bytcr_rt5651: Cleanup (input mapping quirks) Hans de Goede
                   ` (2 preceding siblings ...)
  2018-06-24 14:06 ` [PATCH 3/9] ASoC: Intel: bytcr_rt5651: Fix IN1_IN2_MAP quirk not being logged Hans de Goede
@ 2018-06-24 14:06 ` Hans de Goede
  2018-06-27 11:31   ` Applied "ASoC: Intel: bytcr_rt5651: Remove IN2 input mappings" to the asoc tree Mark Brown
  2018-06-24 14:06 ` [PATCH 5/9] ASoC: Intel: bytcr_rt5651: Fix IN1 map headsetmic mapping Hans de Goede
                   ` (5 subsequent siblings)
  9 siblings, 1 reply; 23+ messages in thread
From: Hans de Goede @ 2018-06-24 14:06 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Bard Liao, Oder Chiou
  Cc: Hans de Goede, alsa-devel, Pierre-Louis Bossart, Carlo Caione

BYT_RT5651_IN2_MAP was introduced in commit 39712db878a4 ("SoC: intel: byt:
Introduce new custom IN2 map"), uses in commit 2fe30129b0a6 ("ASoC: intel:
byt: Enable IN2 map quirk for a KIANO laptop"), only to be replaced by a
new BYT_RT5651_IN1_IN2_MAP quirk in commit ea261bd02a67 ("ASoC: intel:
byt: Introduce new map for dual mics") quickly afterwards, because the
KIANO laptop has 2 internal mics on IN1 and IN2 and the headset mic is
not in IN1 where the BYT_RT5651_IN2_MAP maps it, but on IN3.

Now that the KIANO quirk entry uses BYT_RT5651_IN1_IN2_MAP, there are no
users of BYT_RT5651_IN2_MAP left. This makes sense since the headset mic
seems to always be connected to IN3, so BYT_RT5651_IN2_MAP is not useful.

To deal with BYT_RT5651_IN2_MAP wrongly mapping the headset mic to IN1,
BYT_RT5651_IN2_HS_IN3_MAP was added in commit f026e0631780 ("ASoC: Intel:
bytcr_rt5651: Add new IN2_HS_IN3 input map and a quirk using it"). This
was based on the assumption then some devices have the internal mic
connected to IN2 only. Further testing has shown that this is wrong and the
internal mic is always connected to IN1 and sometimes to both IN1 and IN2.

TL;DR: Both BYT_RT5651_IN2_MAP and BYT_RT5651_IN2_HS_IN3_MAP are based on
on wrong assumptions from the past and are no longer useful now, so they
can both be removed.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 sound/soc/intel/boards/bytcr_rt5651.c | 30 ++-------------------------
 1 file changed, 2 insertions(+), 28 deletions(-)

diff --git a/sound/soc/intel/boards/bytcr_rt5651.c b/sound/soc/intel/boards/bytcr_rt5651.c
index 57de730f74dd..c1bc3d4df841 100644
--- a/sound/soc/intel/boards/bytcr_rt5651.c
+++ b/sound/soc/intel/boards/bytcr_rt5651.c
@@ -42,10 +42,8 @@
 enum {
 	BYT_RT5651_DMIC_MAP,
 	BYT_RT5651_IN1_MAP,
-	BYT_RT5651_IN2_MAP,
 	BYT_RT5651_IN1_IN2_MAP,
 	BYT_RT5651_IN1_HS_IN3_MAP,
-	BYT_RT5651_IN2_HS_IN3_MAP,
 };
 
 enum {
@@ -102,14 +100,10 @@ static void log_quirks(struct device *dev)
 		dev_info(dev, "quirk DMIC_MAP enabled");
 	if (BYT_RT5651_MAP(byt_rt5651_quirk) == BYT_RT5651_IN1_MAP)
 		dev_info(dev, "quirk IN1_MAP enabled");
-	if (BYT_RT5651_MAP(byt_rt5651_quirk) == BYT_RT5651_IN2_MAP)
-		dev_info(dev, "quirk IN2_MAP enabled");
 	if (BYT_RT5651_MAP(byt_rt5651_quirk) == BYT_RT5651_IN1_IN2_MAP)
 		dev_info(dev, "quirk IN1_IN2_MAP enabled");
 	if (BYT_RT5651_MAP(byt_rt5651_quirk) == BYT_RT5651_IN1_HS_IN3_MAP)
 		dev_info(dev, "quirk IN1_HS_IN3_MAP enabled");
-	if (BYT_RT5651_MAP(byt_rt5651_quirk) == BYT_RT5651_IN2_HS_IN3_MAP)
-		dev_info(dev, "quirk IN2_HS_IN3_MAP enabled");
 	if (BYT_RT5651_JDSRC(byt_rt5651_quirk)) {
 		dev_info(dev, "quirk realtek,jack-detect-source %ld\n",
 			 BYT_RT5651_JDSRC(byt_rt5651_quirk));
@@ -258,12 +252,6 @@ static const struct snd_soc_dapm_route byt_rt5651_intmic_in1_map[] = {
 	{"IN2P", NULL, "Headset Mic"},
 };
 
-static const struct snd_soc_dapm_route byt_rt5651_intmic_in2_map[] = {
-	{"Internal Mic", NULL, "micbias1"},
-	{"IN1P", NULL, "Headset Mic"},
-	{"IN2P", NULL, "Internal Mic"},
-};
-
 static const struct snd_soc_dapm_route byt_rt5651_intmic_in1_in2_map[] = {
 	{"Internal Mic", NULL, "micbias1"},
 	{"IN1P", NULL, "Internal Mic"},
@@ -277,12 +265,6 @@ static const struct snd_soc_dapm_route byt_rt5651_intmic_in1_hs_in3_map[] = {
 	{"IN3P", NULL, "Headset Mic"},
 };
 
-static const struct snd_soc_dapm_route byt_rt5651_intmic_in2_hs_in3_map[] = {
-	{"Internal Mic", NULL, "micbias1"},
-	{"IN2P", NULL, "Internal Mic"},
-	{"IN3P", NULL, "Headset Mic"},
-};
-
 static const struct snd_soc_dapm_route byt_rt5651_ssp0_aif1_map[] = {
 	{"ssp0 Tx", NULL, "modem_out"},
 	{"modem_in", NULL, "ssp0 Rx"},
@@ -483,10 +465,6 @@ static int byt_rt5651_init(struct snd_soc_pcm_runtime *runtime)
 		custom_map = byt_rt5651_intmic_in1_map;
 		num_routes = ARRAY_SIZE(byt_rt5651_intmic_in1_map);
 		break;
-	case BYT_RT5651_IN2_MAP:
-		custom_map = byt_rt5651_intmic_in2_map;
-		num_routes = ARRAY_SIZE(byt_rt5651_intmic_in2_map);
-		break;
 	case BYT_RT5651_IN1_IN2_MAP:
 		custom_map = byt_rt5651_intmic_in1_in2_map;
 		num_routes = ARRAY_SIZE(byt_rt5651_intmic_in1_in2_map);
@@ -495,10 +473,6 @@ static int byt_rt5651_init(struct snd_soc_pcm_runtime *runtime)
 		custom_map = byt_rt5651_intmic_in1_hs_in3_map;
 		num_routes = ARRAY_SIZE(byt_rt5651_intmic_in1_hs_in3_map);
 		break;
-	case BYT_RT5651_IN2_HS_IN3_MAP:
-		custom_map = byt_rt5651_intmic_in2_hs_in3_map;
-		num_routes = ARRAY_SIZE(byt_rt5651_intmic_in2_hs_in3_map);
-		break;
 	default:
 		custom_map = byt_rt5651_intmic_dmic_map;
 		num_routes = ARRAY_SIZE(byt_rt5651_intmic_dmic_map);
@@ -744,9 +718,9 @@ struct acpi_chan_package {   /* ACPICA seems to require 64 bit integers */
 static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
 {
 	const char * const intmic_name[] =
-		{ "dmic", "in1", "in2", "in12", "in1", "in2" };
+		{ "dmic", "in1", "in12", "in1" };
 	const char * const hsmic_name[] =
-		{  "in2", "in2", "in1",  "in3", "in3", "in3" };
+		{  "in2", "in2", "in3", "in3" };
 	struct byt_rt5651_private *priv;
 	struct snd_soc_acpi_mach *mach;
 	const char *i2c_name = NULL;
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 5/9] ASoC: Intel: bytcr_rt5651: Fix IN1 map headsetmic mapping
  2018-06-24 14:06 [[PATCH 0/9] ASoC: Intel: bytcr_rt5651: Cleanup (input mapping quirks) Hans de Goede
                   ` (3 preceding siblings ...)
  2018-06-24 14:06 ` [PATCH 4/9] ASoC: Intel: bytcr_rt5651: Remove IN2 input mappings Hans de Goede
@ 2018-06-24 14:06 ` Hans de Goede
  2018-06-27 11:31   ` Applied "ASoC: Intel: bytcr_rt5651: Fix IN1 map headsetmic mapping" to the asoc tree Mark Brown
  2018-06-24 14:06 ` [PATCH 6/9] ASoC: Intel: bytcr_rt5651: Fix DMIC map headsetmic mapping Hans de Goede
                   ` (4 subsequent siblings)
  9 siblings, 1 reply; 23+ messages in thread
From: Hans de Goede @ 2018-06-24 14:06 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Bard Liao, Oder Chiou
  Cc: Hans de Goede, alsa-devel, Pierre-Louis Bossart, Carlo Caione

The initial bytcr_rt5651 machine driver commit mapped IN2 as the headset
mic. In retrospect this is not correct as all known boards have the headset
mic on IN3. To workaround this special IN?_HS_IN3 mappings were added.

This commit fixes the original IN1 mapping to correctly have the headset
mic on IN3, moves all users of the IN1_HS_IN3 mapping over to the fixed
IN1_MAP and drops the now no longer needed IN1_HS_IN3 mapping.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 sound/soc/intel/boards/bytcr_rt5651.c | 29 +++++++--------------------
 1 file changed, 7 insertions(+), 22 deletions(-)

diff --git a/sound/soc/intel/boards/bytcr_rt5651.c b/sound/soc/intel/boards/bytcr_rt5651.c
index c1bc3d4df841..70067e31a33e 100644
--- a/sound/soc/intel/boards/bytcr_rt5651.c
+++ b/sound/soc/intel/boards/bytcr_rt5651.c
@@ -43,7 +43,6 @@ enum {
 	BYT_RT5651_DMIC_MAP,
 	BYT_RT5651_IN1_MAP,
 	BYT_RT5651_IN1_IN2_MAP,
-	BYT_RT5651_IN1_HS_IN3_MAP,
 };
 
 enum {
@@ -92,7 +91,7 @@ struct byt_rt5651_private {
 
 /* Default: jack-detect on JD1_1, internal mic on in1, headsetmic on in3 */
 static unsigned long byt_rt5651_quirk = BYT_RT5651_DEFAULT_QUIRKS |
-					BYT_RT5651_IN1_HS_IN3_MAP;
+					BYT_RT5651_IN1_MAP;
 
 static void log_quirks(struct device *dev)
 {
@@ -102,8 +101,6 @@ static void log_quirks(struct device *dev)
 		dev_info(dev, "quirk IN1_MAP enabled");
 	if (BYT_RT5651_MAP(byt_rt5651_quirk) == BYT_RT5651_IN1_IN2_MAP)
 		dev_info(dev, "quirk IN1_IN2_MAP enabled");
-	if (BYT_RT5651_MAP(byt_rt5651_quirk) == BYT_RT5651_IN1_HS_IN3_MAP)
-		dev_info(dev, "quirk IN1_HS_IN3_MAP enabled");
 	if (BYT_RT5651_JDSRC(byt_rt5651_quirk)) {
 		dev_info(dev, "quirk realtek,jack-detect-source %ld\n",
 			 BYT_RT5651_JDSRC(byt_rt5651_quirk));
@@ -249,7 +246,7 @@ static const struct snd_soc_dapm_route byt_rt5651_intmic_dmic_map[] = {
 static const struct snd_soc_dapm_route byt_rt5651_intmic_in1_map[] = {
 	{"Internal Mic", NULL, "micbias1"},
 	{"IN1P", NULL, "Internal Mic"},
-	{"IN2P", NULL, "Headset Mic"},
+	{"IN3P", NULL, "Headset Mic"},
 };
 
 static const struct snd_soc_dapm_route byt_rt5651_intmic_in1_in2_map[] = {
@@ -259,12 +256,6 @@ static const struct snd_soc_dapm_route byt_rt5651_intmic_in1_in2_map[] = {
 	{"IN3P", NULL, "Headset Mic"},
 };
 
-static const struct snd_soc_dapm_route byt_rt5651_intmic_in1_hs_in3_map[] = {
-	{"Internal Mic", NULL, "micbias1"},
-	{"IN1P", NULL, "Internal Mic"},
-	{"IN3P", NULL, "Headset Mic"},
-};
-
 static const struct snd_soc_dapm_route byt_rt5651_ssp0_aif1_map[] = {
 	{"ssp0 Tx", NULL, "modem_out"},
 	{"modem_in", NULL, "ssp0 Rx"},
@@ -350,7 +341,7 @@ static const struct dmi_system_id byt_rt5651_quirk_table[] = {
 			DMI_MATCH(DMI_SYS_VENDOR, "Circuitco"),
 			DMI_MATCH(DMI_PRODUCT_NAME, "Minnowboard Max B3 PLATFORM"),
 		},
-		.driver_data = (void *)(BYT_RT5651_IN1_HS_IN3_MAP),
+		.driver_data = (void *)(BYT_RT5651_IN1_MAP),
 	},
 	{
 		.callback = byt_rt5651_quirk_cb,
@@ -359,7 +350,7 @@ static const struct dmi_system_id byt_rt5651_quirk_table[] = {
 			DMI_MATCH(DMI_PRODUCT_NAME, "Minnowboard Turbot"),
 		},
 		.driver_data = (void *)(BYT_RT5651_MCLK_EN |
-					BYT_RT5651_IN1_HS_IN3_MAP),
+					BYT_RT5651_IN1_MAP),
 	},
 	{
 		.callback = byt_rt5651_quirk_cb,
@@ -378,7 +369,7 @@ static const struct dmi_system_id byt_rt5651_quirk_table[] = {
 			DMI_MATCH(DMI_PRODUCT_NAME, "D2D3_Vi8A1"),
 		},
 		.driver_data = (void *)(BYT_RT5651_DEFAULT_QUIRKS |
-					BYT_RT5651_IN1_HS_IN3_MAP),
+					BYT_RT5651_IN1_MAP),
 	},
 	{
 		/* VIOS LTH17 */
@@ -469,10 +460,6 @@ static int byt_rt5651_init(struct snd_soc_pcm_runtime *runtime)
 		custom_map = byt_rt5651_intmic_in1_in2_map;
 		num_routes = ARRAY_SIZE(byt_rt5651_intmic_in1_in2_map);
 		break;
-	case BYT_RT5651_IN1_HS_IN3_MAP:
-		custom_map = byt_rt5651_intmic_in1_hs_in3_map;
-		num_routes = ARRAY_SIZE(byt_rt5651_intmic_in1_hs_in3_map);
-		break;
 	default:
 		custom_map = byt_rt5651_intmic_dmic_map;
 		num_routes = ARRAY_SIZE(byt_rt5651_intmic_dmic_map);
@@ -717,10 +704,8 @@ struct acpi_chan_package {   /* ACPICA seems to require 64 bit integers */
 
 static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
 {
-	const char * const intmic_name[] =
-		{ "dmic", "in1", "in12", "in1" };
-	const char * const hsmic_name[] =
-		{  "in2", "in2", "in3", "in3" };
+	const char * const intmic_name[] = { "dmic", "in1", "in12" };
+	const char * const hsmic_name[] = { "in2", "in3", "in3" };
 	struct byt_rt5651_private *priv;
 	struct snd_soc_acpi_mach *mach;
 	const char *i2c_name = NULL;
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 6/9] ASoC: Intel: bytcr_rt5651: Fix DMIC map headsetmic mapping
  2018-06-24 14:06 [[PATCH 0/9] ASoC: Intel: bytcr_rt5651: Cleanup (input mapping quirks) Hans de Goede
                   ` (4 preceding siblings ...)
  2018-06-24 14:06 ` [PATCH 5/9] ASoC: Intel: bytcr_rt5651: Fix IN1 map headsetmic mapping Hans de Goede
@ 2018-06-24 14:06 ` Hans de Goede
  2018-06-27 11:31   ` Applied "ASoC: Intel: bytcr_rt5651: Fix DMIC map headsetmic mapping" to the asoc tree Mark Brown
  2018-06-24 14:06 ` [PATCH 7/9] ASoC: Intel: bytcr_rt5651: Simplify card long-name Hans de Goede
                   ` (3 subsequent siblings)
  9 siblings, 1 reply; 23+ messages in thread
From: Hans de Goede @ 2018-06-24 14:06 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Bard Liao, Oder Chiou
  Cc: Hans de Goede, alsa-devel, Pierre-Louis Bossart, Carlo Caione

The initial bytcr_rt5651 machine driver commit mapped IN2 as the headset
mic. In retrospect this is not correct as all known boards have the headset
mic on IN3.

This commit fixes the original DMIC mapping to correctly have the headset
mic on IN3.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 sound/soc/intel/boards/bytcr_rt5651.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/intel/boards/bytcr_rt5651.c b/sound/soc/intel/boards/bytcr_rt5651.c
index 70067e31a33e..4499960e1c21 100644
--- a/sound/soc/intel/boards/bytcr_rt5651.c
+++ b/sound/soc/intel/boards/bytcr_rt5651.c
@@ -238,9 +238,9 @@ static const struct snd_soc_dapm_route byt_rt5651_audio_map[] = {
 };
 
 static const struct snd_soc_dapm_route byt_rt5651_intmic_dmic_map[] = {
-	{"IN2P", NULL, "Headset Mic"},
 	{"DMIC L1", NULL, "Internal Mic"},
 	{"DMIC R1", NULL, "Internal Mic"},
+	{"IN3P", NULL, "Headset Mic"},
 };
 
 static const struct snd_soc_dapm_route byt_rt5651_intmic_in1_map[] = {
@@ -705,7 +705,7 @@ struct acpi_chan_package {   /* ACPICA seems to require 64 bit integers */
 static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
 {
 	const char * const intmic_name[] = { "dmic", "in1", "in12" };
-	const char * const hsmic_name[] = { "in2", "in3", "in3" };
+	const char * const hsmic_name[] = { "in3", "in3", "in3" };
 	struct byt_rt5651_private *priv;
 	struct snd_soc_acpi_mach *mach;
 	const char *i2c_name = NULL;
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 7/9] ASoC: Intel: bytcr_rt5651: Simplify card long-name
  2018-06-24 14:06 [[PATCH 0/9] ASoC: Intel: bytcr_rt5651: Cleanup (input mapping quirks) Hans de Goede
                   ` (5 preceding siblings ...)
  2018-06-24 14:06 ` [PATCH 6/9] ASoC: Intel: bytcr_rt5651: Fix DMIC map headsetmic mapping Hans de Goede
@ 2018-06-24 14:06 ` Hans de Goede
  2018-06-27 11:31   ` Applied "ASoC: Intel: bytcr_rt5651: Simplify card long-name" to the asoc tree Mark Brown
  2018-06-24 14:06 ` [PATCH 8/9] ASoC: Intel: bytcr_rt5651: Add BYT_RT5651_HP_LR_SWAPPED quirk Hans de Goede
                   ` (2 subsequent siblings)
  9 siblings, 1 reply; 23+ messages in thread
From: Hans de Goede @ 2018-06-24 14:06 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Bard Liao, Oder Chiou
  Cc: Hans de Goede, alsa-devel, Pierre-Louis Bossart, Carlo Caione

Now that the headset-mic is always IN3 there is no reason to have
the headset-mic mapping in the long-name.

This commit simplifies the long name to "bytcr-rt5651-<intmic-map>-mic".

We can safely do this without causing regressions (UCM profile not found
due to the longname change) as the UCM profiles are not in upstream
alsa-lib yet.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 sound/soc/intel/boards/bytcr_rt5651.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/sound/soc/intel/boards/bytcr_rt5651.c b/sound/soc/intel/boards/bytcr_rt5651.c
index 4499960e1c21..45a11799c008 100644
--- a/sound/soc/intel/boards/bytcr_rt5651.c
+++ b/sound/soc/intel/boards/bytcr_rt5651.c
@@ -683,7 +683,7 @@ static struct snd_soc_card byt_rt5651_card = {
 static char byt_rt5651_codec_name[SND_ACPI_I2C_ID_LEN];
 static char byt_rt5651_codec_aif_name[12]; /*  = "rt5651-aif[1|2]" */
 static char byt_rt5651_cpu_dai_name[10]; /*  = "ssp[0|2]-port" */
-static char byt_rt5651_long_name[40]; /* = "bytcr-rt5651-*-spk-*-mic" */
+static char byt_rt5651_long_name[40]; /* = "bytcr-rt5651-*-mic" */
 
 static bool is_valleyview(void)
 {
@@ -704,8 +704,7 @@ struct acpi_chan_package {   /* ACPICA seems to require 64 bit integers */
 
 static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
 {
-	const char * const intmic_name[] = { "dmic", "in1", "in12" };
-	const char * const hsmic_name[] = { "in3", "in3", "in3" };
+	const char * const mic_name[] = { "dmic", "in1", "in12" };
 	struct byt_rt5651_private *priv;
 	struct snd_soc_acpi_mach *mach;
 	const char *i2c_name = NULL;
@@ -852,9 +851,8 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
 	}
 
 	snprintf(byt_rt5651_long_name, sizeof(byt_rt5651_long_name),
-		 "bytcr-rt5651-%s-intmic-%s-hsmic",
-		 intmic_name[BYT_RT5651_MAP(byt_rt5651_quirk)],
-		 hsmic_name[BYT_RT5651_MAP(byt_rt5651_quirk)]);
+		 "bytcr-rt5651-%s-mic",
+		 mic_name[BYT_RT5651_MAP(byt_rt5651_quirk)]);
 	byt_rt5651_card.long_name = byt_rt5651_long_name;
 
 	ret_val = devm_snd_soc_register_card(&pdev->dev, &byt_rt5651_card);
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 8/9] ASoC: Intel: bytcr_rt5651: Add BYT_RT5651_HP_LR_SWAPPED quirk
  2018-06-24 14:06 [[PATCH 0/9] ASoC: Intel: bytcr_rt5651: Cleanup (input mapping quirks) Hans de Goede
                   ` (6 preceding siblings ...)
  2018-06-24 14:06 ` [PATCH 7/9] ASoC: Intel: bytcr_rt5651: Simplify card long-name Hans de Goede
@ 2018-06-24 14:06 ` Hans de Goede
  2018-06-27 11:30   ` Applied "ASoC: Intel: bytcr_rt5651: Add BYT_RT5651_HP_LR_SWAPPED quirk" to the asoc tree Mark Brown
  2018-06-24 14:06 ` [PATCH 9/9] ASoC: Intel: bytcr_rt5651: Sort DMI table entries alphabetically Hans de Goede
  2018-06-25 20:01 ` [[PATCH 0/9] ASoC: Intel: bytcr_rt5651: Cleanup (input mapping quirks) Pierre-Louis Bossart
  9 siblings, 1 reply; 23+ messages in thread
From: Hans de Goede @ 2018-06-24 14:06 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Bard Liao, Oder Chiou
  Cc: Hans de Goede, alsa-devel, Pierre-Louis Bossart, Carlo Caione

One some models (Chuwi Vi8 Plus, Chuwi Hi8 Pro) the headphone output has
left and right swapped. This can be fixed in with special mixer settings
in the UCM profile, bit this requires these devices loading a different
UCM profile.

This commit adds a BYT_RT5651_HP_LR_SWAPPED quirk for this and postfixes
the longname with "-hp-swapped" if set, so that a different UCM profile
will be loaded.

We can safely do this without causing regressions (UCM profile not found
due to the longname change) as the UCM profiles are not in upstream
alsa-lib yet.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 sound/soc/intel/boards/bytcr_rt5651.c | 27 +++++++++++++++++++++++----
 1 file changed, 23 insertions(+), 4 deletions(-)

diff --git a/sound/soc/intel/boards/bytcr_rt5651.c b/sound/soc/intel/boards/bytcr_rt5651.c
index 45a11799c008..bc93020c7a05 100644
--- a/sound/soc/intel/boards/bytcr_rt5651.c
+++ b/sound/soc/intel/boards/bytcr_rt5651.c
@@ -75,6 +75,7 @@ enum {
 #define BYT_RT5651_SSP2_AIF2		BIT(19) /* default is using AIF1  */
 #define BYT_RT5651_SSP0_AIF1		BIT(20)
 #define BYT_RT5651_SSP0_AIF2		BIT(21)
+#define BYT_RT5651_HP_LR_SWAPPED	BIT(22)
 
 #define BYT_RT5651_DEFAULT_QUIRKS	(BYT_RT5651_MCLK_EN | \
 					 BYT_RT5651_JD1_1   | \
@@ -361,6 +362,17 @@ static const struct dmi_system_id byt_rt5651_quirk_table[] = {
 		.driver_data = (void *)(BYT_RT5651_DEFAULT_QUIRKS |
 					BYT_RT5651_IN1_IN2_MAP),
 	},
+	{
+		/* Chuwi Hi8 Pro (CWI513) */
+		.callback = byt_rt5651_quirk_cb,
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "Hampoo"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "X1D3_C806N"),
+		},
+		.driver_data = (void *)(BYT_RT5651_DEFAULT_QUIRKS |
+					BYT_RT5651_IN1_MAP |
+					BYT_RT5651_HP_LR_SWAPPED),
+	},
 	{
 		/* Chuwi Vi8 Plus (CWI519) */
 		.callback = byt_rt5651_quirk_cb,
@@ -369,7 +381,8 @@ static const struct dmi_system_id byt_rt5651_quirk_table[] = {
 			DMI_MATCH(DMI_PRODUCT_NAME, "D2D3_Vi8A1"),
 		},
 		.driver_data = (void *)(BYT_RT5651_DEFAULT_QUIRKS |
-					BYT_RT5651_IN1_MAP),
+					BYT_RT5651_IN1_MAP |
+					BYT_RT5651_HP_LR_SWAPPED),
 	},
 	{
 		/* VIOS LTH17 */
@@ -683,7 +696,7 @@ static struct snd_soc_card byt_rt5651_card = {
 static char byt_rt5651_codec_name[SND_ACPI_I2C_ID_LEN];
 static char byt_rt5651_codec_aif_name[12]; /*  = "rt5651-aif[1|2]" */
 static char byt_rt5651_cpu_dai_name[10]; /*  = "ssp[0|2]-port" */
-static char byt_rt5651_long_name[40]; /* = "bytcr-rt5651-*-mic" */
+static char byt_rt5651_long_name[40]; /* = "bytcr-rt5651-*-mic[-swapped-hp]" */
 
 static bool is_valleyview(void)
 {
@@ -708,6 +721,7 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
 	struct byt_rt5651_private *priv;
 	struct snd_soc_acpi_mach *mach;
 	const char *i2c_name = NULL;
+	const char *hp_swapped;
 	bool is_bytcr = false;
 	int ret_val = 0;
 	int dai_index = 0;
@@ -850,9 +864,14 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
 		}
 	}
 
+	if (byt_rt5651_quirk & BYT_RT5651_HP_LR_SWAPPED)
+		hp_swapped = "-hp-swapped";
+	else
+		hp_swapped = "";
+
 	snprintf(byt_rt5651_long_name, sizeof(byt_rt5651_long_name),
-		 "bytcr-rt5651-%s-mic",
-		 mic_name[BYT_RT5651_MAP(byt_rt5651_quirk)]);
+		 "bytcr-rt5651-%s-mic%s",
+		 mic_name[BYT_RT5651_MAP(byt_rt5651_quirk)], hp_swapped);
 	byt_rt5651_card.long_name = byt_rt5651_long_name;
 
 	ret_val = devm_snd_soc_register_card(&pdev->dev, &byt_rt5651_card);
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 9/9] ASoC: Intel: bytcr_rt5651: Sort DMI table entries alphabetically
  2018-06-24 14:06 [[PATCH 0/9] ASoC: Intel: bytcr_rt5651: Cleanup (input mapping quirks) Hans de Goede
                   ` (7 preceding siblings ...)
  2018-06-24 14:06 ` [PATCH 8/9] ASoC: Intel: bytcr_rt5651: Add BYT_RT5651_HP_LR_SWAPPED quirk Hans de Goede
@ 2018-06-24 14:06 ` Hans de Goede
  2018-06-27 11:30   ` Applied "ASoC: Intel: bytcr_rt5651: Sort DMI table entries alphabetically" to the asoc tree Mark Brown
  2018-06-25 20:01 ` [[PATCH 0/9] ASoC: Intel: bytcr_rt5651: Cleanup (input mapping quirks) Pierre-Louis Bossart
  9 siblings, 1 reply; 23+ messages in thread
From: Hans de Goede @ 2018-06-24 14:06 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Bard Liao, Oder Chiou
  Cc: Hans de Goede, alsa-devel, Pierre-Louis Bossart, Carlo Caione

As we get more entries in the DMI quirk table it is nice to have some
sort of ordering in the table, sort it alphabetically.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 sound/soc/intel/boards/bytcr_rt5651.c | 41 ++++++++++++++-------------
 1 file changed, 22 insertions(+), 19 deletions(-)

diff --git a/sound/soc/intel/boards/bytcr_rt5651.c b/sound/soc/intel/boards/bytcr_rt5651.c
index bc93020c7a05..f63e3698cb80 100644
--- a/sound/soc/intel/boards/bytcr_rt5651.c
+++ b/sound/soc/intel/boards/bytcr_rt5651.c
@@ -337,23 +337,29 @@ static int byt_rt5651_quirk_cb(const struct dmi_system_id *id)
 
 static const struct dmi_system_id byt_rt5651_quirk_table[] = {
 	{
+		/* Chuwi Hi8 Pro (CWI513) */
 		.callback = byt_rt5651_quirk_cb,
 		.matches = {
-			DMI_MATCH(DMI_SYS_VENDOR, "Circuitco"),
-			DMI_MATCH(DMI_PRODUCT_NAME, "Minnowboard Max B3 PLATFORM"),
+			DMI_MATCH(DMI_SYS_VENDOR, "Hampoo"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "X1D3_C806N"),
 		},
-		.driver_data = (void *)(BYT_RT5651_IN1_MAP),
+		.driver_data = (void *)(BYT_RT5651_DEFAULT_QUIRKS |
+					BYT_RT5651_IN1_MAP |
+					BYT_RT5651_HP_LR_SWAPPED),
 	},
 	{
+		/* Chuwi Vi8 Plus (CWI519) */
 		.callback = byt_rt5651_quirk_cb,
 		.matches = {
-			DMI_MATCH(DMI_SYS_VENDOR, "ADI"),
-			DMI_MATCH(DMI_PRODUCT_NAME, "Minnowboard Turbot"),
+			DMI_MATCH(DMI_SYS_VENDOR, "Hampoo"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "D2D3_Vi8A1"),
 		},
-		.driver_data = (void *)(BYT_RT5651_MCLK_EN |
-					BYT_RT5651_IN1_MAP),
+		.driver_data = (void *)(BYT_RT5651_DEFAULT_QUIRKS |
+					BYT_RT5651_IN1_MAP |
+					BYT_RT5651_HP_LR_SWAPPED),
 	},
 	{
+		/* KIANO SlimNote 14.2 */
 		.callback = byt_rt5651_quirk_cb,
 		.matches = {
 			DMI_MATCH(DMI_SYS_VENDOR, "KIANO"),
@@ -363,26 +369,23 @@ static const struct dmi_system_id byt_rt5651_quirk_table[] = {
 					BYT_RT5651_IN1_IN2_MAP),
 	},
 	{
-		/* Chuwi Hi8 Pro (CWI513) */
+		/* Minnowboard Max B3 */
 		.callback = byt_rt5651_quirk_cb,
 		.matches = {
-			DMI_MATCH(DMI_SYS_VENDOR, "Hampoo"),
-			DMI_MATCH(DMI_PRODUCT_NAME, "X1D3_C806N"),
+			DMI_MATCH(DMI_SYS_VENDOR, "Circuitco"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "Minnowboard Max B3 PLATFORM"),
 		},
-		.driver_data = (void *)(BYT_RT5651_DEFAULT_QUIRKS |
-					BYT_RT5651_IN1_MAP |
-					BYT_RT5651_HP_LR_SWAPPED),
+		.driver_data = (void *)(BYT_RT5651_IN1_MAP),
 	},
 	{
-		/* Chuwi Vi8 Plus (CWI519) */
+		/* Minnowboard Turbot */
 		.callback = byt_rt5651_quirk_cb,
 		.matches = {
-			DMI_MATCH(DMI_SYS_VENDOR, "Hampoo"),
-			DMI_MATCH(DMI_PRODUCT_NAME, "D2D3_Vi8A1"),
+			DMI_MATCH(DMI_SYS_VENDOR, "ADI"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "Minnowboard Turbot"),
 		},
-		.driver_data = (void *)(BYT_RT5651_DEFAULT_QUIRKS |
-					BYT_RT5651_IN1_MAP |
-					BYT_RT5651_HP_LR_SWAPPED),
+		.driver_data = (void *)(BYT_RT5651_MCLK_EN |
+					BYT_RT5651_IN1_MAP),
 	},
 	{
 		/* VIOS LTH17 */
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* Re: [[PATCH 0/9] ASoC: Intel: bytcr_rt5651: Cleanup (input mapping quirks)
  2018-06-24 14:06 [[PATCH 0/9] ASoC: Intel: bytcr_rt5651: Cleanup (input mapping quirks) Hans de Goede
                   ` (8 preceding siblings ...)
  2018-06-24 14:06 ` [PATCH 9/9] ASoC: Intel: bytcr_rt5651: Sort DMI table entries alphabetically Hans de Goede
@ 2018-06-25 20:01 ` Pierre-Louis Bossart
  2018-06-26  9:47   ` Hans de Goede
  9 siblings, 1 reply; 23+ messages in thread
From: Pierre-Louis Bossart @ 2018-06-25 20:01 UTC (permalink / raw)
  To: Hans de Goede, Liam Girdwood, Mark Brown, Bard Liao, Oder Chiou
  Cc: alsa-devel, Carlo Caione

On 6/24/18 9:06 AM, Hans de Goede wrote:
> Hi Mark,
> 
> This series is mainly a cleanup series. In the beginning of the rt5651
> machine driver some wrong assumptions were made, such as the headset
> mic being attached to IN2 (it is on IN3 on the 7 machines I have access
> to and on all otherwise known machines).

We use a rt5651 reference board for this codec connector to the 
MinnowBoard. I am pretty sure for that board IN2 is used for the 
headset. Please give me a couple of days to double-check.

> 
> And also adding a quirk for a machine with the intmic on IN2, which
> later got fixed with a new quirk for machines with 2 internal mics
> on both IN1 and IN2 and moving the one machine with the IN2 quirk
> over to the new IN1_IN2 quirk, leaving the IN2 quirk as an orphan
> quirk for non existing hardware.
> 
> Then I made a similar mistake adding the IN2_HS_IN3 quirk, while I
> should have used the IN1_HS_IN3 (which itself only exists because
> the original IN1 quirk has the headset input mapping wrong),
> 
> TL;DR: it is a bit of a mess due to a number of wrong assumptions
> about how the inputs where actually routed in the past.
> 
> This series cleans this all up in small commits / one bit a time and
> refers the original commit messages in its commit messages.
> 
> Note patch 10/11 is not a cleanup patch, but is more or less the
> reason I took a second look at all the quirks.
> 
> Regards,
> 
> Hans
> 
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
> 

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [[PATCH 0/9] ASoC: Intel: bytcr_rt5651: Cleanup (input mapping quirks)
  2018-06-25 20:01 ` [[PATCH 0/9] ASoC: Intel: bytcr_rt5651: Cleanup (input mapping quirks) Pierre-Louis Bossart
@ 2018-06-26  9:47   ` Hans de Goede
  2018-06-27  4:40     ` Pierre-Louis Bossart
  0 siblings, 1 reply; 23+ messages in thread
From: Hans de Goede @ 2018-06-26  9:47 UTC (permalink / raw)
  To: Pierre-Louis Bossart, Liam Girdwood, Mark Brown, Bard Liao,
	Oder Chiou
  Cc: alsa-devel, Carlo Caione

Hi,

On 25-06-18 22:01, Pierre-Louis Bossart wrote:
> On 6/24/18 9:06 AM, Hans de Goede wrote:
>> Hi Mark,
>>
>> This series is mainly a cleanup series. In the beginning of the rt5651
>> machine driver some wrong assumptions were made, such as the headset
>> mic being attached to IN2 (it is on IN3 on the 7 machines I have access
>> to and on all otherwise known machines).
> 
> We use a rt5651 reference board for this codec connector to the MinnowBoard. I am pretty sure for that board IN2 is used for the headset. Please give me a couple of days to double-check.

According to this commit:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/sound/soc/intel/boards/bytcr_rt5651.c?id=60e3b52e9354550c28090237b083b20bbabed598

It is connected to IN3 on the Minnowboard Max with Realtek rt5651 eval board.

And you yourself added a quirk for it being on IN3 for the MinnowBoard Turbot:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/sound/soc/intel/boards/bytcr_rt5651.c?id=416f2b51119b8cdd899b226e4cf683d000797a8b

Note I later renamed the IN3_MAP to IN1_HS_IN3 to make clear that it
is for internal mic on IN1, hs-mis on IN3, as can be seen in:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/sound/soc/intel/boards/bytcr_rt5651.c?id=60e3b52e9354550c28090237b083b20bbabed598
(which is the commit adding both the quirk and updating the Minnowboard Max
  DMI entry to use this quirk).

Regards,

Hans



>> And also adding a quirk for a machine with the intmic on IN2, which
>> later got fixed with a new quirk for machines with 2 internal mics
>> on both IN1 and IN2 and moving the one machine with the IN2 quirk
>> over to the new IN1_IN2 quirk, leaving the IN2 quirk as an orphan
>> quirk for non existing hardware.
>>
>> Then I made a similar mistake adding the IN2_HS_IN3 quirk, while I
>> should have used the IN1_HS_IN3 (which itself only exists because
>> the original IN1 quirk has the headset input mapping wrong),
>>
>> TL;DR: it is a bit of a mess due to a number of wrong assumptions
>> about how the inputs where actually routed in the past.
>>
>> This series cleans this all up in small commits / one bit a time and
>> refers the original commit messages in its commit messages.
>>
>> Note patch 10/11 is not a cleanup patch, but is more or less the
>> reason I took a second look at all the quirks.
>>
>> Regards,
>>
>> Hans
>>
>> _______________________________________________
>> Alsa-devel mailing list
>> Alsa-devel@alsa-project.org
>> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
>>
> 

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [[PATCH 0/9] ASoC: Intel: bytcr_rt5651: Cleanup (input mapping quirks)
  2018-06-26  9:47   ` Hans de Goede
@ 2018-06-27  4:40     ` Pierre-Louis Bossart
  2018-06-27  7:16       ` Hans de Goede
  0 siblings, 1 reply; 23+ messages in thread
From: Pierre-Louis Bossart @ 2018-06-27  4:40 UTC (permalink / raw)
  To: Hans de Goede, Liam Girdwood, Mark Brown, Bard Liao, Oder Chiou
  Cc: alsa-devel, Carlo Caione

On 6/26/18 2:47 AM, Hans de Goede wrote:
> Hi,
> 
> On 25-06-18 22:01, Pierre-Louis Bossart wrote:
>> On 6/24/18 9:06 AM, Hans de Goede wrote:
>>> Hi Mark,
>>>
>>> This series is mainly a cleanup series. In the beginning of the rt5651
>>> machine driver some wrong assumptions were made, such as the headset
>>> mic being attached to IN2 (it is on IN3 on the 7 machines I have access
>>> to and on all otherwise known machines).
>>
>> We use a rt5651 reference board for this codec connector to the 
>> MinnowBoard. I am pretty sure for that board IN2 is used for the 
>> headset. Please give me a couple of days to double-check.
> 
> According to this commit:
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/sound/soc/intel/boards/bytcr_rt5651.c?id=60e3b52e9354550c28090237b083b20bbabed598 
> 
> 
> It is connected to IN3 on the Minnowboard Max with Realtek rt5651 eval 
> board.
> 
> And you yourself added a quirk for it being on IN3 for the MinnowBoard 
> Turbot:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/sound/soc/intel/boards/bytcr_rt5651.c?id=416f2b51119b8cdd899b226e4cf683d000797a8b 
> 
> 
> Note I later renamed the IN3_MAP to IN1_HS_IN3 to make clear that it
> is for internal mic on IN1, hs-mis on IN3, as can be seen in:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/sound/soc/intel/boards/bytcr_rt5651.c?id=60e3b52e9354550c28090237b083b20bbabed598 
> 
> (which is the commit adding both the quirk and updating the Minnowboard Max
>   DMI entry to use this quirk).

Yes, you are right that headset is connected on IN3 but I wasn't 
completely crazy with IN2 - it's used for the line in, I just confused 
connectors...

The cleanups look ok and well documented, I just find that the 
simplification of patch 7/9 goes one bridge too far. If we ever get a 
quirk where the headset is not on IN3 we'll have limited ways of finding 
the right UCM files. Keeping hs-in3 in the filename is not big deal - 
your call really.

FWIW, all
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

> 
> Regards,
> 
> Hans
> 
> 
> 
>>> And also adding a quirk for a machine with the intmic on IN2, which
>>> later got fixed with a new quirk for machines with 2 internal mics
>>> on both IN1 and IN2 and moving the one machine with the IN2 quirk
>>> over to the new IN1_IN2 quirk, leaving the IN2 quirk as an orphan
>>> quirk for non existing hardware.
>>>
>>> Then I made a similar mistake adding the IN2_HS_IN3 quirk, while I
>>> should have used the IN1_HS_IN3 (which itself only exists because
>>> the original IN1 quirk has the headset input mapping wrong),
>>>
>>> TL;DR: it is a bit of a mess due to a number of wrong assumptions
>>> about how the inputs where actually routed in the past.
>>>
>>> This series cleans this all up in small commits / one bit a time and
>>> refers the original commit messages in its commit messages.
>>>
>>> Note patch 10/11 is not a cleanup patch, but is more or less the
>>> reason I took a second look at all the quirks.
>>>
>>> Regards,
>>>
>>> Hans
>>>
>>> _______________________________________________
>>> Alsa-devel mailing list
>>> Alsa-devel@alsa-project.org
>>> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
>>>
>>
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [[PATCH 0/9] ASoC: Intel: bytcr_rt5651: Cleanup (input mapping quirks)
  2018-06-27  4:40     ` Pierre-Louis Bossart
@ 2018-06-27  7:16       ` Hans de Goede
  0 siblings, 0 replies; 23+ messages in thread
From: Hans de Goede @ 2018-06-27  7:16 UTC (permalink / raw)
  To: Pierre-Louis Bossart, Liam Girdwood, Mark Brown, Bard Liao,
	Oder Chiou
  Cc: alsa-devel, Carlo Caione

Hi,

On 27-06-18 06:40, Pierre-Louis Bossart wrote:
> On 6/26/18 2:47 AM, Hans de Goede wrote:
>> Hi,
>>
>> On 25-06-18 22:01, Pierre-Louis Bossart wrote:
>>> On 6/24/18 9:06 AM, Hans de Goede wrote:
>>>> Hi Mark,
>>>>
>>>> This series is mainly a cleanup series. In the beginning of the rt5651
>>>> machine driver some wrong assumptions were made, such as the headset
>>>> mic being attached to IN2 (it is on IN3 on the 7 machines I have access
>>>> to and on all otherwise known machines).
>>>
>>> We use a rt5651 reference board for this codec connector to the MinnowBoard. I am pretty sure for that board IN2 is used for the headset. Please give me a couple of days to double-check.
>>
>> According to this commit:
>>
>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/sound/soc/intel/boards/bytcr_rt5651.c?id=60e3b52e9354550c28090237b083b20bbabed598
>>
>> It is connected to IN3 on the Minnowboard Max with Realtek rt5651 eval board.
>>
>> And you yourself added a quirk for it being on IN3 for the MinnowBoard Turbot:
>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/sound/soc/intel/boards/bytcr_rt5651.c?id=416f2b51119b8cdd899b226e4cf683d000797a8b
>>
>> Note I later renamed the IN3_MAP to IN1_HS_IN3 to make clear that it
>> is for internal mic on IN1, hs-mis on IN3, as can be seen in:
>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/sound/soc/intel/boards/bytcr_rt5651.c?id=60e3b52e9354550c28090237b083b20bbabed598
>> (which is the commit adding both the quirk and updating the Minnowboard Max
>>   DMI entry to use this quirk).
> 
> Yes, you are right that headset is connected on IN3 but I wasn't completely crazy with IN2 - it's used for the line in, I just confused connectors...
> 
> The cleanups look ok and well documented, I just find that the simplification of patch 7/9 goes one bridge too far. If we ever get a quirk where the headset is not on IN3 we'll have limited ways of finding the right UCM files. Keeping hs-in3 in the filename is not big deal - your call really.

Not having the hs-in3 in the longname matches what we are doing for
the rt5640, where the headset mic also always is on the same input.

For consistency I think it is good to drop it, so lets keep this patch
set as is.

> FWIW, all
> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

Thanks.

Regards,

Hans



>>>> And also adding a quirk for a machine with the intmic on IN2, which
>>>> later got fixed with a new quirk for machines with 2 internal mics
>>>> on both IN1 and IN2 and moving the one machine with the IN2 quirk
>>>> over to the new IN1_IN2 quirk, leaving the IN2 quirk as an orphan
>>>> quirk for non existing hardware.
>>>>
>>>> Then I made a similar mistake adding the IN2_HS_IN3 quirk, while I
>>>> should have used the IN1_HS_IN3 (which itself only exists because
>>>> the original IN1 quirk has the headset input mapping wrong),
>>>>
>>>> TL;DR: it is a bit of a mess due to a number of wrong assumptions
>>>> about how the inputs where actually routed in the past.
>>>>
>>>> This series cleans this all up in small commits / one bit a time and
>>>> refers the original commit messages in its commit messages.
>>>>
>>>> Note patch 10/11 is not a cleanup patch, but is more or less the
>>>> reason I took a second look at all the quirks.
>>>>
>>>> Regards,
>>>>
>>>> Hans
>>>>
>>>> _______________________________________________
>>>> Alsa-devel mailing list
>>>> Alsa-devel@alsa-project.org
>>>> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
>>>>
>>>
>> _______________________________________________
>> Alsa-devel mailing list
>> Alsa-devel@alsa-project.org
>> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
> 
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Applied "ASoC: Intel: bytcr_rt5651: Sort DMI table entries alphabetically" to the asoc tree
  2018-06-24 14:06 ` [PATCH 9/9] ASoC: Intel: bytcr_rt5651: Sort DMI table entries alphabetically Hans de Goede
@ 2018-06-27 11:30   ` Mark Brown
  0 siblings, 0 replies; 23+ messages in thread
From: Mark Brown @ 2018-06-27 11:30 UTC (permalink / raw)
  To: Hans de Goede
  Cc: Oder Chiou, alsa-devel, Pierre-Louis Bossart, Liam Girdwood,
	Mark Brown, Carlo Caione, Bard Liao

The patch

   ASoC: Intel: bytcr_rt5651: Sort DMI table entries alphabetically

has been applied to the asoc tree at

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 55d69c0309acea65fb3dd99a05a665b51630362d Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Sun, 24 Jun 2018 16:06:34 +0200
Subject: [PATCH] ASoC: Intel: bytcr_rt5651: Sort DMI table entries
 alphabetically

As we get more entries in the DMI quirk table it is nice to have some
sort of ordering in the table, sort it alphabetically.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/intel/boards/bytcr_rt5651.c | 41 ++++++++++++++-------------
 1 file changed, 22 insertions(+), 19 deletions(-)

diff --git a/sound/soc/intel/boards/bytcr_rt5651.c b/sound/soc/intel/boards/bytcr_rt5651.c
index ffd62eb5c266..ba2753e0e12a 100644
--- a/sound/soc/intel/boards/bytcr_rt5651.c
+++ b/sound/soc/intel/boards/bytcr_rt5651.c
@@ -335,23 +335,29 @@ static int byt_rt5651_quirk_cb(const struct dmi_system_id *id)
 
 static const struct dmi_system_id byt_rt5651_quirk_table[] = {
 	{
+		/* Chuwi Hi8 Pro (CWI513) */
 		.callback = byt_rt5651_quirk_cb,
 		.matches = {
-			DMI_MATCH(DMI_SYS_VENDOR, "Circuitco"),
-			DMI_MATCH(DMI_PRODUCT_NAME, "Minnowboard Max B3 PLATFORM"),
+			DMI_MATCH(DMI_SYS_VENDOR, "Hampoo"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "X1D3_C806N"),
 		},
-		.driver_data = (void *)(BYT_RT5651_IN1_MAP),
+		.driver_data = (void *)(BYT_RT5651_DEFAULT_QUIRKS |
+					BYT_RT5651_IN1_MAP |
+					BYT_RT5651_HP_LR_SWAPPED),
 	},
 	{
+		/* Chuwi Vi8 Plus (CWI519) */
 		.callback = byt_rt5651_quirk_cb,
 		.matches = {
-			DMI_MATCH(DMI_SYS_VENDOR, "ADI"),
-			DMI_MATCH(DMI_PRODUCT_NAME, "Minnowboard Turbot"),
+			DMI_MATCH(DMI_SYS_VENDOR, "Hampoo"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "D2D3_Vi8A1"),
 		},
-		.driver_data = (void *)(BYT_RT5651_MCLK_EN |
-					BYT_RT5651_IN1_MAP),
+		.driver_data = (void *)(BYT_RT5651_DEFAULT_QUIRKS |
+					BYT_RT5651_IN1_MAP |
+					BYT_RT5651_HP_LR_SWAPPED),
 	},
 	{
+		/* KIANO SlimNote 14.2 */
 		.callback = byt_rt5651_quirk_cb,
 		.matches = {
 			DMI_MATCH(DMI_SYS_VENDOR, "KIANO"),
@@ -361,26 +367,23 @@ static const struct dmi_system_id byt_rt5651_quirk_table[] = {
 					BYT_RT5651_IN1_IN2_MAP),
 	},
 	{
-		/* Chuwi Hi8 Pro (CWI513) */
+		/* Minnowboard Max B3 */
 		.callback = byt_rt5651_quirk_cb,
 		.matches = {
-			DMI_MATCH(DMI_SYS_VENDOR, "Hampoo"),
-			DMI_MATCH(DMI_PRODUCT_NAME, "X1D3_C806N"),
+			DMI_MATCH(DMI_SYS_VENDOR, "Circuitco"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "Minnowboard Max B3 PLATFORM"),
 		},
-		.driver_data = (void *)(BYT_RT5651_DEFAULT_QUIRKS |
-					BYT_RT5651_IN1_MAP |
-					BYT_RT5651_HP_LR_SWAPPED),
+		.driver_data = (void *)(BYT_RT5651_IN1_MAP),
 	},
 	{
-		/* Chuwi Vi8 Plus (CWI519) */
+		/* Minnowboard Turbot */
 		.callback = byt_rt5651_quirk_cb,
 		.matches = {
-			DMI_MATCH(DMI_SYS_VENDOR, "Hampoo"),
-			DMI_MATCH(DMI_PRODUCT_NAME, "D2D3_Vi8A1"),
+			DMI_MATCH(DMI_SYS_VENDOR, "ADI"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "Minnowboard Turbot"),
 		},
-		.driver_data = (void *)(BYT_RT5651_DEFAULT_QUIRKS |
-					BYT_RT5651_IN1_MAP |
-					BYT_RT5651_HP_LR_SWAPPED),
+		.driver_data = (void *)(BYT_RT5651_MCLK_EN |
+					BYT_RT5651_IN1_MAP),
 	},
 	{
 		/* VIOS LTH17 */
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* Applied "ASoC: Intel: bytcr_rt5651: Add BYT_RT5651_HP_LR_SWAPPED quirk" to the asoc tree
  2018-06-24 14:06 ` [PATCH 8/9] ASoC: Intel: bytcr_rt5651: Add BYT_RT5651_HP_LR_SWAPPED quirk Hans de Goede
@ 2018-06-27 11:30   ` Mark Brown
  0 siblings, 0 replies; 23+ messages in thread
From: Mark Brown @ 2018-06-27 11:30 UTC (permalink / raw)
  To: Hans de Goede
  Cc: Oder Chiou, alsa-devel, Pierre-Louis Bossart, Liam Girdwood,
	Mark Brown, Carlo Caione, Bard Liao

The patch

   ASoC: Intel: bytcr_rt5651: Add BYT_RT5651_HP_LR_SWAPPED quirk

has been applied to the asoc tree at

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 8f250e7009d71e6f3f3aeb95a540c36fc9c03398 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Sun, 24 Jun 2018 16:06:33 +0200
Subject: [PATCH] ASoC: Intel: bytcr_rt5651: Add BYT_RT5651_HP_LR_SWAPPED quirk

One some models (Chuwi Vi8 Plus, Chuwi Hi8 Pro) the headphone output has
left and right swapped. This can be fixed in with special mixer settings
in the UCM profile, bit this requires these devices loading a different
UCM profile.

This commit adds a BYT_RT5651_HP_LR_SWAPPED quirk for this and postfixes
the longname with "-hp-swapped" if set, so that a different UCM profile
will be loaded.

We can safely do this without causing regressions (UCM profile not found
due to the longname change) as the UCM profiles are not in upstream
alsa-lib yet.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/intel/boards/bytcr_rt5651.c | 27 +++++++++++++++++++++++----
 1 file changed, 23 insertions(+), 4 deletions(-)

diff --git a/sound/soc/intel/boards/bytcr_rt5651.c b/sound/soc/intel/boards/bytcr_rt5651.c
index e778142b8a6e..ffd62eb5c266 100644
--- a/sound/soc/intel/boards/bytcr_rt5651.c
+++ b/sound/soc/intel/boards/bytcr_rt5651.c
@@ -73,6 +73,7 @@ enum {
 #define BYT_RT5651_SSP2_AIF2		BIT(19) /* default is using AIF1  */
 #define BYT_RT5651_SSP0_AIF1		BIT(20)
 #define BYT_RT5651_SSP0_AIF2		BIT(21)
+#define BYT_RT5651_HP_LR_SWAPPED	BIT(22)
 
 #define BYT_RT5651_DEFAULT_QUIRKS	(BYT_RT5651_MCLK_EN | \
 					 BYT_RT5651_JD1_1   | \
@@ -359,6 +360,17 @@ static const struct dmi_system_id byt_rt5651_quirk_table[] = {
 		.driver_data = (void *)(BYT_RT5651_DEFAULT_QUIRKS |
 					BYT_RT5651_IN1_IN2_MAP),
 	},
+	{
+		/* Chuwi Hi8 Pro (CWI513) */
+		.callback = byt_rt5651_quirk_cb,
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "Hampoo"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "X1D3_C806N"),
+		},
+		.driver_data = (void *)(BYT_RT5651_DEFAULT_QUIRKS |
+					BYT_RT5651_IN1_MAP |
+					BYT_RT5651_HP_LR_SWAPPED),
+	},
 	{
 		/* Chuwi Vi8 Plus (CWI519) */
 		.callback = byt_rt5651_quirk_cb,
@@ -367,7 +379,8 @@ static const struct dmi_system_id byt_rt5651_quirk_table[] = {
 			DMI_MATCH(DMI_PRODUCT_NAME, "D2D3_Vi8A1"),
 		},
 		.driver_data = (void *)(BYT_RT5651_DEFAULT_QUIRKS |
-					BYT_RT5651_IN1_MAP),
+					BYT_RT5651_IN1_MAP |
+					BYT_RT5651_HP_LR_SWAPPED),
 	},
 	{
 		/* VIOS LTH17 */
@@ -662,7 +675,7 @@ static struct snd_soc_card byt_rt5651_card = {
 static char byt_rt5651_codec_name[SND_ACPI_I2C_ID_LEN];
 static char byt_rt5651_codec_aif_name[12]; /*  = "rt5651-aif[1|2]" */
 static char byt_rt5651_cpu_dai_name[10]; /*  = "ssp[0|2]-port" */
-static char byt_rt5651_long_name[40]; /* = "bytcr-rt5651-*-mic" */
+static char byt_rt5651_long_name[40]; /* = "bytcr-rt5651-*-mic[-swapped-hp]" */
 
 static bool is_valleyview(void)
 {
@@ -687,6 +700,7 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
 	struct byt_rt5651_private *priv;
 	struct snd_soc_acpi_mach *mach;
 	const char *i2c_name = NULL;
+	const char *hp_swapped;
 	bool is_bytcr = false;
 	int ret_val = 0;
 	int dai_index = 0;
@@ -829,9 +843,14 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
 		}
 	}
 
+	if (byt_rt5651_quirk & BYT_RT5651_HP_LR_SWAPPED)
+		hp_swapped = "-hp-swapped";
+	else
+		hp_swapped = "";
+
 	snprintf(byt_rt5651_long_name, sizeof(byt_rt5651_long_name),
-		 "bytcr-rt5651-%s-mic",
-		 mic_name[BYT_RT5651_MAP(byt_rt5651_quirk)]);
+		 "bytcr-rt5651-%s-mic%s",
+		 mic_name[BYT_RT5651_MAP(byt_rt5651_quirk)], hp_swapped);
 	byt_rt5651_card.long_name = byt_rt5651_long_name;
 
 	ret_val = devm_snd_soc_register_card(&pdev->dev, &byt_rt5651_card);
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* Applied "ASoC: Intel: bytcr_rt5651: Simplify card long-name" to the asoc tree
  2018-06-24 14:06 ` [PATCH 7/9] ASoC: Intel: bytcr_rt5651: Simplify card long-name Hans de Goede
@ 2018-06-27 11:31   ` Mark Brown
  0 siblings, 0 replies; 23+ messages in thread
From: Mark Brown @ 2018-06-27 11:31 UTC (permalink / raw)
  To: Hans de Goede
  Cc: Oder Chiou, alsa-devel, Pierre-Louis Bossart, Liam Girdwood,
	Mark Brown, Carlo Caione, Bard Liao

The patch

   ASoC: Intel: bytcr_rt5651: Simplify card long-name

has been applied to the asoc tree at

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 8e69cd640097fa7af53fb476dbd3597608f32b10 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Sun, 24 Jun 2018 16:06:32 +0200
Subject: [PATCH] ASoC: Intel: bytcr_rt5651: Simplify card long-name

Now that the headset-mic is always IN3 there is no reason to have
the headset-mic mapping in the long-name.

This commit simplifies the long name to "bytcr-rt5651-<intmic-map>-mic".

We can safely do this without causing regressions (UCM profile not found
due to the longname change) as the UCM profiles are not in upstream
alsa-lib yet.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/intel/boards/bytcr_rt5651.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/sound/soc/intel/boards/bytcr_rt5651.c b/sound/soc/intel/boards/bytcr_rt5651.c
index 042334d9be32..e778142b8a6e 100644
--- a/sound/soc/intel/boards/bytcr_rt5651.c
+++ b/sound/soc/intel/boards/bytcr_rt5651.c
@@ -662,7 +662,7 @@ static struct snd_soc_card byt_rt5651_card = {
 static char byt_rt5651_codec_name[SND_ACPI_I2C_ID_LEN];
 static char byt_rt5651_codec_aif_name[12]; /*  = "rt5651-aif[1|2]" */
 static char byt_rt5651_cpu_dai_name[10]; /*  = "ssp[0|2]-port" */
-static char byt_rt5651_long_name[40]; /* = "bytcr-rt5651-*-spk-*-mic" */
+static char byt_rt5651_long_name[40]; /* = "bytcr-rt5651-*-mic" */
 
 static bool is_valleyview(void)
 {
@@ -683,8 +683,7 @@ struct acpi_chan_package {   /* ACPICA seems to require 64 bit integers */
 
 static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
 {
-	const char * const intmic_name[] = { "dmic", "in1", "in12" };
-	const char * const hsmic_name[] = { "in3", "in3", "in3" };
+	const char * const mic_name[] = { "dmic", "in1", "in12" };
 	struct byt_rt5651_private *priv;
 	struct snd_soc_acpi_mach *mach;
 	const char *i2c_name = NULL;
@@ -831,9 +830,8 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
 	}
 
 	snprintf(byt_rt5651_long_name, sizeof(byt_rt5651_long_name),
-		 "bytcr-rt5651-%s-intmic-%s-hsmic",
-		 intmic_name[BYT_RT5651_MAP(byt_rt5651_quirk)],
-		 hsmic_name[BYT_RT5651_MAP(byt_rt5651_quirk)]);
+		 "bytcr-rt5651-%s-mic",
+		 mic_name[BYT_RT5651_MAP(byt_rt5651_quirk)]);
 	byt_rt5651_card.long_name = byt_rt5651_long_name;
 
 	ret_val = devm_snd_soc_register_card(&pdev->dev, &byt_rt5651_card);
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* Applied "ASoC: Intel: bytcr_rt5651: Fix DMIC map headsetmic mapping" to the asoc tree
  2018-06-24 14:06 ` [PATCH 6/9] ASoC: Intel: bytcr_rt5651: Fix DMIC map headsetmic mapping Hans de Goede
@ 2018-06-27 11:31   ` Mark Brown
  0 siblings, 0 replies; 23+ messages in thread
From: Mark Brown @ 2018-06-27 11:31 UTC (permalink / raw)
  To: Hans de Goede
  Cc: Oder Chiou, alsa-devel, Pierre-Louis Bossart, Liam Girdwood,
	Mark Brown, Carlo Caione, Bard Liao

The patch

   ASoC: Intel: bytcr_rt5651: Fix DMIC map headsetmic mapping

has been applied to the asoc tree at

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 37c7401e8c1f583d197c096152fc87a58f460277 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Sun, 24 Jun 2018 16:06:31 +0200
Subject: [PATCH] ASoC: Intel: bytcr_rt5651: Fix DMIC map headsetmic mapping

The initial bytcr_rt5651 machine driver commit mapped IN2 as the headset
mic. In retrospect this is not correct as all known boards have the headset
mic on IN3.

This commit fixes the original DMIC mapping to correctly have the headset
mic on IN3.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/intel/boards/bytcr_rt5651.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/intel/boards/bytcr_rt5651.c b/sound/soc/intel/boards/bytcr_rt5651.c
index bf2adb36f455..042334d9be32 100644
--- a/sound/soc/intel/boards/bytcr_rt5651.c
+++ b/sound/soc/intel/boards/bytcr_rt5651.c
@@ -236,9 +236,9 @@ static const struct snd_soc_dapm_route byt_rt5651_audio_map[] = {
 };
 
 static const struct snd_soc_dapm_route byt_rt5651_intmic_dmic_map[] = {
-	{"IN2P", NULL, "Headset Mic"},
 	{"DMIC L1", NULL, "Internal Mic"},
 	{"DMIC R1", NULL, "Internal Mic"},
+	{"IN3P", NULL, "Headset Mic"},
 };
 
 static const struct snd_soc_dapm_route byt_rt5651_intmic_in1_map[] = {
@@ -684,7 +684,7 @@ struct acpi_chan_package {   /* ACPICA seems to require 64 bit integers */
 static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
 {
 	const char * const intmic_name[] = { "dmic", "in1", "in12" };
-	const char * const hsmic_name[] = { "in2", "in3", "in3" };
+	const char * const hsmic_name[] = { "in3", "in3", "in3" };
 	struct byt_rt5651_private *priv;
 	struct snd_soc_acpi_mach *mach;
 	const char *i2c_name = NULL;
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* Applied "ASoC: Intel: bytcr_rt5651: Fix IN1 map headsetmic mapping" to the asoc tree
  2018-06-24 14:06 ` [PATCH 5/9] ASoC: Intel: bytcr_rt5651: Fix IN1 map headsetmic mapping Hans de Goede
@ 2018-06-27 11:31   ` Mark Brown
  0 siblings, 0 replies; 23+ messages in thread
From: Mark Brown @ 2018-06-27 11:31 UTC (permalink / raw)
  To: Hans de Goede
  Cc: Oder Chiou, alsa-devel, Pierre-Louis Bossart, Liam Girdwood,
	Mark Brown, Carlo Caione, Bard Liao

The patch

   ASoC: Intel: bytcr_rt5651: Fix IN1 map headsetmic mapping

has been applied to the asoc tree at

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From de23147983013591bc4d6812ce441f351dec6b9d Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Sun, 24 Jun 2018 16:06:30 +0200
Subject: [PATCH] ASoC: Intel: bytcr_rt5651: Fix IN1 map headsetmic mapping

The initial bytcr_rt5651 machine driver commit mapped IN2 as the headset
mic. In retrospect this is not correct as all known boards have the headset
mic on IN3. To workaround this special IN?_HS_IN3 mappings were added.

This commit fixes the original IN1 mapping to correctly have the headset
mic on IN3, moves all users of the IN1_HS_IN3 mapping over to the fixed
IN1_MAP and drops the now no longer needed IN1_HS_IN3 mapping.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/intel/boards/bytcr_rt5651.c | 29 +++++++--------------------
 1 file changed, 7 insertions(+), 22 deletions(-)

diff --git a/sound/soc/intel/boards/bytcr_rt5651.c b/sound/soc/intel/boards/bytcr_rt5651.c
index b8ca7137d8b2..bf2adb36f455 100644
--- a/sound/soc/intel/boards/bytcr_rt5651.c
+++ b/sound/soc/intel/boards/bytcr_rt5651.c
@@ -41,7 +41,6 @@ enum {
 	BYT_RT5651_DMIC_MAP,
 	BYT_RT5651_IN1_MAP,
 	BYT_RT5651_IN1_IN2_MAP,
-	BYT_RT5651_IN1_HS_IN3_MAP,
 };
 
 enum {
@@ -90,7 +89,7 @@ struct byt_rt5651_private {
 
 /* Default: jack-detect on JD1_1, internal mic on in1, headsetmic on in3 */
 static unsigned long byt_rt5651_quirk = BYT_RT5651_DEFAULT_QUIRKS |
-					BYT_RT5651_IN1_HS_IN3_MAP;
+					BYT_RT5651_IN1_MAP;
 
 static void log_quirks(struct device *dev)
 {
@@ -100,8 +99,6 @@ static void log_quirks(struct device *dev)
 		dev_info(dev, "quirk IN1_MAP enabled");
 	if (BYT_RT5651_MAP(byt_rt5651_quirk) == BYT_RT5651_IN1_IN2_MAP)
 		dev_info(dev, "quirk IN1_IN2_MAP enabled");
-	if (BYT_RT5651_MAP(byt_rt5651_quirk) == BYT_RT5651_IN1_HS_IN3_MAP)
-		dev_info(dev, "quirk IN1_HS_IN3_MAP enabled");
 	if (BYT_RT5651_JDSRC(byt_rt5651_quirk)) {
 		dev_info(dev, "quirk realtek,jack-detect-source %ld\n",
 			 BYT_RT5651_JDSRC(byt_rt5651_quirk));
@@ -247,7 +244,7 @@ static const struct snd_soc_dapm_route byt_rt5651_intmic_dmic_map[] = {
 static const struct snd_soc_dapm_route byt_rt5651_intmic_in1_map[] = {
 	{"Internal Mic", NULL, "micbias1"},
 	{"IN1P", NULL, "Internal Mic"},
-	{"IN2P", NULL, "Headset Mic"},
+	{"IN3P", NULL, "Headset Mic"},
 };
 
 static const struct snd_soc_dapm_route byt_rt5651_intmic_in1_in2_map[] = {
@@ -257,12 +254,6 @@ static const struct snd_soc_dapm_route byt_rt5651_intmic_in1_in2_map[] = {
 	{"IN3P", NULL, "Headset Mic"},
 };
 
-static const struct snd_soc_dapm_route byt_rt5651_intmic_in1_hs_in3_map[] = {
-	{"Internal Mic", NULL, "micbias1"},
-	{"IN1P", NULL, "Internal Mic"},
-	{"IN3P", NULL, "Headset Mic"},
-};
-
 static const struct snd_soc_dapm_route byt_rt5651_ssp0_aif1_map[] = {
 	{"ssp0 Tx", NULL, "modem_out"},
 	{"modem_in", NULL, "ssp0 Rx"},
@@ -348,7 +339,7 @@ static const struct dmi_system_id byt_rt5651_quirk_table[] = {
 			DMI_MATCH(DMI_SYS_VENDOR, "Circuitco"),
 			DMI_MATCH(DMI_PRODUCT_NAME, "Minnowboard Max B3 PLATFORM"),
 		},
-		.driver_data = (void *)(BYT_RT5651_IN1_HS_IN3_MAP),
+		.driver_data = (void *)(BYT_RT5651_IN1_MAP),
 	},
 	{
 		.callback = byt_rt5651_quirk_cb,
@@ -357,7 +348,7 @@ static const struct dmi_system_id byt_rt5651_quirk_table[] = {
 			DMI_MATCH(DMI_PRODUCT_NAME, "Minnowboard Turbot"),
 		},
 		.driver_data = (void *)(BYT_RT5651_MCLK_EN |
-					BYT_RT5651_IN1_HS_IN3_MAP),
+					BYT_RT5651_IN1_MAP),
 	},
 	{
 		.callback = byt_rt5651_quirk_cb,
@@ -376,7 +367,7 @@ static const struct dmi_system_id byt_rt5651_quirk_table[] = {
 			DMI_MATCH(DMI_PRODUCT_NAME, "D2D3_Vi8A1"),
 		},
 		.driver_data = (void *)(BYT_RT5651_DEFAULT_QUIRKS |
-					BYT_RT5651_IN1_HS_IN3_MAP),
+					BYT_RT5651_IN1_MAP),
 	},
 	{
 		/* VIOS LTH17 */
@@ -448,10 +439,6 @@ static int byt_rt5651_init(struct snd_soc_pcm_runtime *runtime)
 		custom_map = byt_rt5651_intmic_in1_in2_map;
 		num_routes = ARRAY_SIZE(byt_rt5651_intmic_in1_in2_map);
 		break;
-	case BYT_RT5651_IN1_HS_IN3_MAP:
-		custom_map = byt_rt5651_intmic_in1_hs_in3_map;
-		num_routes = ARRAY_SIZE(byt_rt5651_intmic_in1_hs_in3_map);
-		break;
 	default:
 		custom_map = byt_rt5651_intmic_dmic_map;
 		num_routes = ARRAY_SIZE(byt_rt5651_intmic_dmic_map);
@@ -696,10 +683,8 @@ struct acpi_chan_package {   /* ACPICA seems to require 64 bit integers */
 
 static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
 {
-	const char * const intmic_name[] =
-		{ "dmic", "in1", "in12", "in1" };
-	const char * const hsmic_name[] =
-		{  "in2", "in2", "in3", "in3" };
+	const char * const intmic_name[] = { "dmic", "in1", "in12" };
+	const char * const hsmic_name[] = { "in2", "in3", "in3" };
 	struct byt_rt5651_private *priv;
 	struct snd_soc_acpi_mach *mach;
 	const char *i2c_name = NULL;
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* Applied "ASoC: Intel: bytcr_rt5651: Remove IN2 input mappings" to the asoc tree
  2018-06-24 14:06 ` [PATCH 4/9] ASoC: Intel: bytcr_rt5651: Remove IN2 input mappings Hans de Goede
@ 2018-06-27 11:31   ` Mark Brown
  0 siblings, 0 replies; 23+ messages in thread
From: Mark Brown @ 2018-06-27 11:31 UTC (permalink / raw)
  To: Hans de Goede
  Cc: Oder Chiou, alsa-devel, Pierre-Louis Bossart, Liam Girdwood,
	Mark Brown, Carlo Caione, Bard Liao

The patch

   ASoC: Intel: bytcr_rt5651: Remove IN2 input mappings

has been applied to the asoc tree at

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From fcdf1391caa6f7f01de56eea63e070555771fac7 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Sun, 24 Jun 2018 16:06:29 +0200
Subject: [PATCH] ASoC: Intel: bytcr_rt5651: Remove IN2 input mappings

BYT_RT5651_IN2_MAP was introduced in commit 39712db878a4 ("SoC: intel: byt:
Introduce new custom IN2 map"), uses in commit 2fe30129b0a6 ("ASoC: intel:
byt: Enable IN2 map quirk for a KIANO laptop"), only to be replaced by a
new BYT_RT5651_IN1_IN2_MAP quirk in commit ea261bd02a67 ("ASoC: intel:
byt: Introduce new map for dual mics") quickly afterwards, because the
KIANO laptop has 2 internal mics on IN1 and IN2 and the headset mic is
not in IN1 where the BYT_RT5651_IN2_MAP maps it, but on IN3.

Now that the KIANO quirk entry uses BYT_RT5651_IN1_IN2_MAP, there are no
users of BYT_RT5651_IN2_MAP left. This makes sense since the headset mic
seems to always be connected to IN3, so BYT_RT5651_IN2_MAP is not useful.

To deal with BYT_RT5651_IN2_MAP wrongly mapping the headset mic to IN1,
BYT_RT5651_IN2_HS_IN3_MAP was added in commit f026e0631780 ("ASoC: Intel:
bytcr_rt5651: Add new IN2_HS_IN3 input map and a quirk using it"). This
was based on the assumption then some devices have the internal mic
connected to IN2 only. Further testing has shown that this is wrong and the
internal mic is always connected to IN1 and sometimes to both IN1 and IN2.

TL;DR: Both BYT_RT5651_IN2_MAP and BYT_RT5651_IN2_HS_IN3_MAP are based on
on wrong assumptions from the past and are no longer useful now, so they
can both be removed.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/intel/boards/bytcr_rt5651.c | 30 ++-------------------------
 1 file changed, 2 insertions(+), 28 deletions(-)

diff --git a/sound/soc/intel/boards/bytcr_rt5651.c b/sound/soc/intel/boards/bytcr_rt5651.c
index 7cc6e36b7c47..b8ca7137d8b2 100644
--- a/sound/soc/intel/boards/bytcr_rt5651.c
+++ b/sound/soc/intel/boards/bytcr_rt5651.c
@@ -40,10 +40,8 @@
 enum {
 	BYT_RT5651_DMIC_MAP,
 	BYT_RT5651_IN1_MAP,
-	BYT_RT5651_IN2_MAP,
 	BYT_RT5651_IN1_IN2_MAP,
 	BYT_RT5651_IN1_HS_IN3_MAP,
-	BYT_RT5651_IN2_HS_IN3_MAP,
 };
 
 enum {
@@ -100,14 +98,10 @@ static void log_quirks(struct device *dev)
 		dev_info(dev, "quirk DMIC_MAP enabled");
 	if (BYT_RT5651_MAP(byt_rt5651_quirk) == BYT_RT5651_IN1_MAP)
 		dev_info(dev, "quirk IN1_MAP enabled");
-	if (BYT_RT5651_MAP(byt_rt5651_quirk) == BYT_RT5651_IN2_MAP)
-		dev_info(dev, "quirk IN2_MAP enabled");
 	if (BYT_RT5651_MAP(byt_rt5651_quirk) == BYT_RT5651_IN1_IN2_MAP)
 		dev_info(dev, "quirk IN1_IN2_MAP enabled");
 	if (BYT_RT5651_MAP(byt_rt5651_quirk) == BYT_RT5651_IN1_HS_IN3_MAP)
 		dev_info(dev, "quirk IN1_HS_IN3_MAP enabled");
-	if (BYT_RT5651_MAP(byt_rt5651_quirk) == BYT_RT5651_IN2_HS_IN3_MAP)
-		dev_info(dev, "quirk IN2_HS_IN3_MAP enabled");
 	if (BYT_RT5651_JDSRC(byt_rt5651_quirk)) {
 		dev_info(dev, "quirk realtek,jack-detect-source %ld\n",
 			 BYT_RT5651_JDSRC(byt_rt5651_quirk));
@@ -256,12 +250,6 @@ static const struct snd_soc_dapm_route byt_rt5651_intmic_in1_map[] = {
 	{"IN2P", NULL, "Headset Mic"},
 };
 
-static const struct snd_soc_dapm_route byt_rt5651_intmic_in2_map[] = {
-	{"Internal Mic", NULL, "micbias1"},
-	{"IN1P", NULL, "Headset Mic"},
-	{"IN2P", NULL, "Internal Mic"},
-};
-
 static const struct snd_soc_dapm_route byt_rt5651_intmic_in1_in2_map[] = {
 	{"Internal Mic", NULL, "micbias1"},
 	{"IN1P", NULL, "Internal Mic"},
@@ -275,12 +263,6 @@ static const struct snd_soc_dapm_route byt_rt5651_intmic_in1_hs_in3_map[] = {
 	{"IN3P", NULL, "Headset Mic"},
 };
 
-static const struct snd_soc_dapm_route byt_rt5651_intmic_in2_hs_in3_map[] = {
-	{"Internal Mic", NULL, "micbias1"},
-	{"IN2P", NULL, "Internal Mic"},
-	{"IN3P", NULL, "Headset Mic"},
-};
-
 static const struct snd_soc_dapm_route byt_rt5651_ssp0_aif1_map[] = {
 	{"ssp0 Tx", NULL, "modem_out"},
 	{"modem_in", NULL, "ssp0 Rx"},
@@ -462,10 +444,6 @@ static int byt_rt5651_init(struct snd_soc_pcm_runtime *runtime)
 		custom_map = byt_rt5651_intmic_in1_map;
 		num_routes = ARRAY_SIZE(byt_rt5651_intmic_in1_map);
 		break;
-	case BYT_RT5651_IN2_MAP:
-		custom_map = byt_rt5651_intmic_in2_map;
-		num_routes = ARRAY_SIZE(byt_rt5651_intmic_in2_map);
-		break;
 	case BYT_RT5651_IN1_IN2_MAP:
 		custom_map = byt_rt5651_intmic_in1_in2_map;
 		num_routes = ARRAY_SIZE(byt_rt5651_intmic_in1_in2_map);
@@ -474,10 +452,6 @@ static int byt_rt5651_init(struct snd_soc_pcm_runtime *runtime)
 		custom_map = byt_rt5651_intmic_in1_hs_in3_map;
 		num_routes = ARRAY_SIZE(byt_rt5651_intmic_in1_hs_in3_map);
 		break;
-	case BYT_RT5651_IN2_HS_IN3_MAP:
-		custom_map = byt_rt5651_intmic_in2_hs_in3_map;
-		num_routes = ARRAY_SIZE(byt_rt5651_intmic_in2_hs_in3_map);
-		break;
 	default:
 		custom_map = byt_rt5651_intmic_dmic_map;
 		num_routes = ARRAY_SIZE(byt_rt5651_intmic_dmic_map);
@@ -723,9 +697,9 @@ struct acpi_chan_package {   /* ACPICA seems to require 64 bit integers */
 static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
 {
 	const char * const intmic_name[] =
-		{ "dmic", "in1", "in2", "in12", "in1", "in2" };
+		{ "dmic", "in1", "in12", "in1" };
 	const char * const hsmic_name[] =
-		{  "in2", "in2", "in1",  "in3", "in3", "in3" };
+		{  "in2", "in2", "in3", "in3" };
 	struct byt_rt5651_private *priv;
 	struct snd_soc_acpi_mach *mach;
 	const char *i2c_name = NULL;
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* Applied "ASoC: Intel: bytcr_rt5651: Fix IN1_IN2_MAP quirk not being logged" to the asoc tree
  2018-06-24 14:06 ` [PATCH 3/9] ASoC: Intel: bytcr_rt5651: Fix IN1_IN2_MAP quirk not being logged Hans de Goede
@ 2018-06-27 11:32   ` Mark Brown
  0 siblings, 0 replies; 23+ messages in thread
From: Mark Brown @ 2018-06-27 11:32 UTC (permalink / raw)
  To: Hans de Goede
  Cc: Oder Chiou, alsa-devel, Pierre-Louis Bossart, Liam Girdwood,
	Mark Brown, Carlo Caione, Bard Liao

The patch

   ASoC: Intel: bytcr_rt5651: Fix IN1_IN2_MAP quirk not being logged

has been applied to the asoc tree at

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 366780df3e2d40533cc95a4bf25ddd3b934b5fd3 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Sun, 24 Jun 2018 16:06:28 +0200
Subject: [PATCH] ASoC: Intel: bytcr_rt5651: Fix IN1_IN2_MAP quirk not being
 logged

Fix the quirk logging code not logging the IN1_IN2_MAP quirk.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/intel/boards/bytcr_rt5651.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sound/soc/intel/boards/bytcr_rt5651.c b/sound/soc/intel/boards/bytcr_rt5651.c
index 910890de38b0..7cc6e36b7c47 100644
--- a/sound/soc/intel/boards/bytcr_rt5651.c
+++ b/sound/soc/intel/boards/bytcr_rt5651.c
@@ -102,6 +102,8 @@ static void log_quirks(struct device *dev)
 		dev_info(dev, "quirk IN1_MAP enabled");
 	if (BYT_RT5651_MAP(byt_rt5651_quirk) == BYT_RT5651_IN2_MAP)
 		dev_info(dev, "quirk IN2_MAP enabled");
+	if (BYT_RT5651_MAP(byt_rt5651_quirk) == BYT_RT5651_IN1_IN2_MAP)
+		dev_info(dev, "quirk IN1_IN2_MAP enabled");
 	if (BYT_RT5651_MAP(byt_rt5651_quirk) == BYT_RT5651_IN1_HS_IN3_MAP)
 		dev_info(dev, "quirk IN1_HS_IN3_MAP enabled");
 	if (BYT_RT5651_MAP(byt_rt5651_quirk) == BYT_RT5651_IN2_HS_IN3_MAP)
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* Applied "ASoC: Intel: bytcr_rt5651: Change default input map from in2 to in1" to the asoc tree
  2018-06-24 14:06 ` [PATCH 2/9] ASoC: Intel: bytcr_rt5651: Change default input map from in2 to in1 Hans de Goede
@ 2018-06-27 11:32   ` Mark Brown
  0 siblings, 0 replies; 23+ messages in thread
From: Mark Brown @ 2018-06-27 11:32 UTC (permalink / raw)
  To: Hans de Goede
  Cc: Oder Chiou, alsa-devel, Pierre-Louis Bossart, Liam Girdwood,
	Mark Brown, Carlo Caione, Bard Liao

The patch

   ASoC: Intel: bytcr_rt5651: Change default input map from in2 to in1

has been applied to the asoc tree at

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 10876d24eb40c6bfaa0aabd97e3e143258176c53 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Sun, 24 Jun 2018 16:06:27 +0200
Subject: [PATCH] ASoC: Intel: bytcr_rt5651: Change default input map from in2
 to in1

Further testing on all 6 model x86 tablets with a rt5651 which I have
access to for testing has shown that their single (mono) microphone is
connected to both IN1 *and* IN2.

The previous default mapping of IN2 was based on testing on the same 6
tablets, where the internal mic works fine with a mapping of IN2. But it
works fine too with a mapping of IN1.

This commit changes the default input mapping to to use IN1 instead of
IN2, to match the mapping used for the other mono devices in the DMI quirk
table. So that we need less different mappings.

The same change is made to the Chuwi Vi8 Plus quirks, which is one of the
6 models tested.

This is a preparation patch for simplifying the maps in a follow-up commit.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/intel/boards/bytcr_rt5651.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sound/soc/intel/boards/bytcr_rt5651.c b/sound/soc/intel/boards/bytcr_rt5651.c
index 735b8312e275..910890de38b0 100644
--- a/sound/soc/intel/boards/bytcr_rt5651.c
+++ b/sound/soc/intel/boards/bytcr_rt5651.c
@@ -90,9 +90,9 @@ struct byt_rt5651_private {
 	struct snd_soc_jack jack;
 };
 
-/* Default: jack-detect on JD1_1, internal mic on in2, headsetmic on in3 */
+/* Default: jack-detect on JD1_1, internal mic on in1, headsetmic on in3 */
 static unsigned long byt_rt5651_quirk = BYT_RT5651_DEFAULT_QUIRKS |
-					BYT_RT5651_IN2_HS_IN3_MAP;
+					BYT_RT5651_IN1_HS_IN3_MAP;
 
 static void log_quirks(struct device *dev)
 {
@@ -392,7 +392,7 @@ static const struct dmi_system_id byt_rt5651_quirk_table[] = {
 			DMI_MATCH(DMI_PRODUCT_NAME, "D2D3_Vi8A1"),
 		},
 		.driver_data = (void *)(BYT_RT5651_DEFAULT_QUIRKS |
-					BYT_RT5651_IN2_HS_IN3_MAP),
+					BYT_RT5651_IN1_HS_IN3_MAP),
 	},
 	{
 		/* VIOS LTH17 */
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* Applied "ASoC: Intel: bytcr_rt5651: Add BYT_RT5651_DEFAULT_QUIRKS define" to the asoc tree
  2018-06-24 14:06 ` [PATCH 1/9] ASoC: Intel: bytcr_rt5651: Add BYT_RT5651_DEFAULT_QUIRKS define Hans de Goede
@ 2018-06-27 11:32   ` Mark Brown
  0 siblings, 0 replies; 23+ messages in thread
From: Mark Brown @ 2018-06-27 11:32 UTC (permalink / raw)
  To: Hans de Goede
  Cc: Oder Chiou, alsa-devel, Pierre-Louis Bossart, Liam Girdwood,
	Mark Brown, Carlo Caione, Bard Liao

The patch

   ASoC: Intel: bytcr_rt5651: Add BYT_RT5651_DEFAULT_QUIRKS define

has been applied to the asoc tree at

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From fc7c460fbb4003bf3f5d2b435079c85888644663 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Sun, 24 Jun 2018 16:06:26 +0200
Subject: [PATCH] ASoC: Intel: bytcr_rt5651: Add BYT_RT5651_DEFAULT_QUIRKS
 define

Almost all boards use the mclk and use the same jack-detect settings, add
a BYT_RT5651_DEFAULT_QUIRKS define for this.

This shaves of some lines and makes it easier to see which settings are
unique to a certain model.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/intel/boards/bytcr_rt5651.c | 25 +++++++++----------------
 1 file changed, 9 insertions(+), 16 deletions(-)

diff --git a/sound/soc/intel/boards/bytcr_rt5651.c b/sound/soc/intel/boards/bytcr_rt5651.c
index 987720e203f9..735b8312e275 100644
--- a/sound/soc/intel/boards/bytcr_rt5651.c
+++ b/sound/soc/intel/boards/bytcr_rt5651.c
@@ -77,6 +77,11 @@ enum {
 #define BYT_RT5651_SSP0_AIF1		BIT(20)
 #define BYT_RT5651_SSP0_AIF2		BIT(21)
 
+#define BYT_RT5651_DEFAULT_QUIRKS	(BYT_RT5651_MCLK_EN | \
+					 BYT_RT5651_JD1_1   | \
+					 BYT_RT5651_OVCD_TH_2000UA | \
+					 BYT_RT5651_OVCD_SF_0P75)
+
 /* jack-detect-source + dmic-en + ovcd-th + -sf + terminating empty entry */
 #define MAX_NO_PROPS 5
 
@@ -86,10 +91,7 @@ struct byt_rt5651_private {
 };
 
 /* Default: jack-detect on JD1_1, internal mic on in2, headsetmic on in3 */
-static unsigned long byt_rt5651_quirk = BYT_RT5651_MCLK_EN |
-					BYT_RT5651_JD1_1 |
-					BYT_RT5651_OVCD_TH_2000UA |
-					BYT_RT5651_OVCD_SF_0P75 |
+static unsigned long byt_rt5651_quirk = BYT_RT5651_DEFAULT_QUIRKS |
 					BYT_RT5651_IN2_HS_IN3_MAP;
 
 static void log_quirks(struct device *dev)
@@ -379,10 +381,7 @@ static const struct dmi_system_id byt_rt5651_quirk_table[] = {
 			DMI_MATCH(DMI_SYS_VENDOR, "KIANO"),
 			DMI_MATCH(DMI_PRODUCT_NAME, "KIANO SlimNote 14.2"),
 		},
-		.driver_data = (void *)(BYT_RT5651_MCLK_EN |
-					BYT_RT5651_JD1_1 |
-					BYT_RT5651_OVCD_TH_2000UA |
-					BYT_RT5651_OVCD_SF_0P75 |
+		.driver_data = (void *)(BYT_RT5651_DEFAULT_QUIRKS |
 					BYT_RT5651_IN1_IN2_MAP),
 	},
 	{
@@ -392,10 +391,7 @@ static const struct dmi_system_id byt_rt5651_quirk_table[] = {
 			DMI_MATCH(DMI_SYS_VENDOR, "Hampoo"),
 			DMI_MATCH(DMI_PRODUCT_NAME, "D2D3_Vi8A1"),
 		},
-		.driver_data = (void *)(BYT_RT5651_MCLK_EN |
-					BYT_RT5651_JD1_1 |
-					BYT_RT5651_OVCD_TH_2000UA |
-					BYT_RT5651_OVCD_SF_0P75 |
+		.driver_data = (void *)(BYT_RT5651_DEFAULT_QUIRKS |
 					BYT_RT5651_IN2_HS_IN3_MAP),
 	},
 	{
@@ -405,10 +401,7 @@ static const struct dmi_system_id byt_rt5651_quirk_table[] = {
 			DMI_MATCH(DMI_SYS_VENDOR, "VIOS"),
 			DMI_MATCH(DMI_PRODUCT_NAME, "LTH17"),
 		},
-		.driver_data = (void *)(BYT_RT5651_MCLK_EN |
-					BYT_RT5651_JD1_1 |
-					BYT_RT5651_OVCD_TH_2000UA |
-					BYT_RT5651_OVCD_SF_1P0 |
+		.driver_data = (void *)(BYT_RT5651_DEFAULT_QUIRKS |
 					BYT_RT5651_IN1_IN2_MAP),
 	},
 	{}
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2018-06-27 11:32 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-24 14:06 [[PATCH 0/9] ASoC: Intel: bytcr_rt5651: Cleanup (input mapping quirks) Hans de Goede
2018-06-24 14:06 ` [PATCH 1/9] ASoC: Intel: bytcr_rt5651: Add BYT_RT5651_DEFAULT_QUIRKS define Hans de Goede
2018-06-27 11:32   ` Applied "ASoC: Intel: bytcr_rt5651: Add BYT_RT5651_DEFAULT_QUIRKS define" to the asoc tree Mark Brown
2018-06-24 14:06 ` [PATCH 2/9] ASoC: Intel: bytcr_rt5651: Change default input map from in2 to in1 Hans de Goede
2018-06-27 11:32   ` Applied "ASoC: Intel: bytcr_rt5651: Change default input map from in2 to in1" to the asoc tree Mark Brown
2018-06-24 14:06 ` [PATCH 3/9] ASoC: Intel: bytcr_rt5651: Fix IN1_IN2_MAP quirk not being logged Hans de Goede
2018-06-27 11:32   ` Applied "ASoC: Intel: bytcr_rt5651: Fix IN1_IN2_MAP quirk not being logged" to the asoc tree Mark Brown
2018-06-24 14:06 ` [PATCH 4/9] ASoC: Intel: bytcr_rt5651: Remove IN2 input mappings Hans de Goede
2018-06-27 11:31   ` Applied "ASoC: Intel: bytcr_rt5651: Remove IN2 input mappings" to the asoc tree Mark Brown
2018-06-24 14:06 ` [PATCH 5/9] ASoC: Intel: bytcr_rt5651: Fix IN1 map headsetmic mapping Hans de Goede
2018-06-27 11:31   ` Applied "ASoC: Intel: bytcr_rt5651: Fix IN1 map headsetmic mapping" to the asoc tree Mark Brown
2018-06-24 14:06 ` [PATCH 6/9] ASoC: Intel: bytcr_rt5651: Fix DMIC map headsetmic mapping Hans de Goede
2018-06-27 11:31   ` Applied "ASoC: Intel: bytcr_rt5651: Fix DMIC map headsetmic mapping" to the asoc tree Mark Brown
2018-06-24 14:06 ` [PATCH 7/9] ASoC: Intel: bytcr_rt5651: Simplify card long-name Hans de Goede
2018-06-27 11:31   ` Applied "ASoC: Intel: bytcr_rt5651: Simplify card long-name" to the asoc tree Mark Brown
2018-06-24 14:06 ` [PATCH 8/9] ASoC: Intel: bytcr_rt5651: Add BYT_RT5651_HP_LR_SWAPPED quirk Hans de Goede
2018-06-27 11:30   ` Applied "ASoC: Intel: bytcr_rt5651: Add BYT_RT5651_HP_LR_SWAPPED quirk" to the asoc tree Mark Brown
2018-06-24 14:06 ` [PATCH 9/9] ASoC: Intel: bytcr_rt5651: Sort DMI table entries alphabetically Hans de Goede
2018-06-27 11:30   ` Applied "ASoC: Intel: bytcr_rt5651: Sort DMI table entries alphabetically" to the asoc tree Mark Brown
2018-06-25 20:01 ` [[PATCH 0/9] ASoC: Intel: bytcr_rt5651: Cleanup (input mapping quirks) Pierre-Louis Bossart
2018-06-26  9:47   ` Hans de Goede
2018-06-27  4:40     ` Pierre-Louis Bossart
2018-06-27  7:16       ` Hans de Goede

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.