Skip to contentSkip to conversation

ASoC: Intel: Add support for surface3 tablet

PATCH In review Vinod Koul 5 participants 14 messages Jul 8, 2016 – Jul 20, 2016

Subsystems (4)
lore
Share & tools
lore

Vinod Koul

author
#0 lore raw

cover ASoC: Intel: Add support for surface3 tablet

Surface3 tablet is CHT based device which used RT5645 codec. But the ACPI ID is 10EC5640 which belong to RT5640 codec :(
So we add quirk support to load cht-machine driver for surface tablet combination, add the ACPI id and DMI fix for jack detect in codec and finally machine update.

This fixes Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=98001
Please verify and send your tested-by.

Vinod Koul (3):
ASoC: Intel: Atom: Add quirk for Surface 3
ASoC: rt5645: Add ACPI ID 10EC5640
ASoC: Intel: Add surface3 entry in CHT-RT5645 machine

 sound/soc/codecs/rt5645.c               |  7 ++++++
 sound/soc/intel/atom/sst/sst_acpi.c     | 44 ++++++++++++++++++++++++++++++++-
 sound/soc/intel/boards/cht_bsw_rt5645.c | 20 ++++++++++++++-
 sound/soc/intel/common/sst-acpi.h       |  2 +-
 4 files changed, 70 insertions(+), 3 deletions(-)
Signature · 1 line
1.9.1
author
#1 lore raw

PATCH 1/3 ASoC: Intel: Atom: Add quirk for Surface 3

Surface 3 is CHT based device which shows up with RT5645 codec. But the BIOS reports ACPI ID as 5640!

To solve this, add a DMI overide for cht-5640 machine.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=98001

---
 sound/soc/intel/atom/sst/sst_acpi.c | 44 ++++++++++++++++++++++++++++++++++++-
 sound/soc/intel/common/sst-acpi.h   |  2 +-
 2 files changed, 44 insertions(+), 2 deletions(-)
sound/soc/intel/atom/sst/sst_acpi.c +43 -1
index 3bc4b63b2f9d..82a374d885a7 100644
@@ -28,6 +28,7 @@
 #include <linux/firmware.h>
 #include <linux/pm_runtime.h>
 #include <linux/pm_qos.h>
+#include <linux/dmi.h>
 #include <linux/acpi.h>
 #include <asm/platform_sst_audio.h>
 #include <sound/core.h>
@@ -237,6 +238,9 @@ static int sst_acpi_probe(struct platform_device *pdev)
 		dev_err(dev, "No matching machine driver found\n");
 		return -ENODEV;
 	}
+	if (mach->machine_quirk)
+		mach = mach->machine_quirk(mach);
+
 	pdata = mach->pdata;
 
 	ret = kstrtouint(id->id, 16, &dev_id);
@@ -320,6 +324,44 @@ static int sst_acpi_remove(struct platform_device *pdev)
 	return 0;
 }
 
+static unsigned long cht_machine_id;
+
+#define CHT_SURFACE_MACH 1
+
+static int cht_surface_quirk_cb(const struct dmi_system_id *id)
+{
+	cht_machine_id = CHT_SURFACE_MACH;
+	return 1;
+}
+
+
+static const struct dmi_system_id cht_table[] = {
+	{
+		.callback = cht_surface_quirk_cb,
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "Surface 3"),
+		},
+	},
+};
+
+
+static struct sst_acpi_mach cht_surface_mach = {
+	"10EC5640", "cht-bsw-rt5645", "intel/fw_sst_22a8.bin", "cht-bsw", NULL,
+								&chv_platform_data };
+
+struct sst_acpi_mach *cht_quirk(void *arg)
+{
+	struct sst_acpi_mach *mach = arg;
+
+	dmi_check_system(cht_table);
+
+	if (cht_machine_id == CHT_SURFACE_MACH)
+		return &cht_surface_mach;
+	else
+		return mach;
+}
+
 static struct sst_acpi_mach sst_acpi_bytcr[] = {
 	{"10EC5640", "bytcr_rt5640", "intel/fw_sst_0f28.bin", "bytcr_rt5640", NULL,
 						&byt_rvp_platform_data },
@@ -343,7 +385,7 @@ static struct sst_acpi_mach sst_acpi_chv[] = {
 	{"193C9890", "cht-bsw-max98090", "intel/fw_sst_22a8.bin", "cht-bsw", NULL,
 						&chv_platform_data },
 	/* some CHT-T platforms rely on RT5640, use Baytrail machine driver */
-	{"10EC5640", "bytcr_rt5640", "intel/fw_sst_22a8.bin", "bytcr_rt5640", NULL,
+	{"10EC5640", "bytcr_rt5640", "intel/fw_sst_22a8.bin", "bytcr_rt5640", cht_quirk,
 						&chv_platform_data },
 
 	{},
sound/soc/intel/common/sst-acpi.h +1 -1
index 8398cb227ba9..504b0e4fedd4 100644
@@ -40,6 +40,6 @@ struct sst_acpi_mach {
 
 	/* board name */
 	const char *board;
-	void (*machine_quirk)(void);
+	struct sst_acpi_mach * (*machine_quirk)(void *arg);
 	void *pdata;
 };
Signature · 1 line
1.9.1
maintainer
#2 lore raw

Applied "ASoC: Intel: Atom: Add quirk for Surface 3" to the asoc tree

The patch

ASoC: Intel: Atom: Add quirk for Surface 3

has been applied to the asoc tree at

git://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

Quoted 1 line

From 73a33f6f6d44db203d0324b67ffed1d86d4c1c9a Mon Sep 17 00:00:00 2001

From: Vinod Koul <[email protected]>
Date: Fri, 8 Jul 2016 15:39:49 +0530
Subject: [PATCH] ASoC: Intel: Atom: Add quirk for Surface 3

Surface 3 is CHT based device which shows up with RT5645 codec. But the BIOS reports ACPI ID as 5640!

To solve this, add a DMI overide for cht-5640 machine.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=98001

---
 sound/soc/intel/atom/sst/sst_acpi.c | 44 ++++++++++++++++++++++++++++++++++++-
 sound/soc/intel/common/sst-acpi.h   |  2 +-
 2 files changed, 44 insertions(+), 2 deletions(-)
sound/soc/intel/atom/sst/sst_acpi.c +43 -1
index 3bc4b63b2f9d..82a374d885a7 100644
@@ -28,6 +28,7 @@
 #include <linux/firmware.h>
 #include <linux/pm_runtime.h>
 #include <linux/pm_qos.h>
+#include <linux/dmi.h>
 #include <linux/acpi.h>
 #include <asm/platform_sst_audio.h>
 #include <sound/core.h>
@@ -237,6 +238,9 @@ static int sst_acpi_probe(struct platform_device *pdev)
 		dev_err(dev, "No matching machine driver found\n");
 		return -ENODEV;
 	}
+	if (mach->machine_quirk)
+		mach = mach->machine_quirk(mach);
+
 	pdata = mach->pdata;
 
 	ret = kstrtouint(id->id, 16, &dev_id);
@@ -320,6 +324,44 @@ static int sst_acpi_remove(struct platform_device *pdev)
 	return 0;
 }
 
+static unsigned long cht_machine_id;
+
+#define CHT_SURFACE_MACH 1
+
+static int cht_surface_quirk_cb(const struct dmi_system_id *id)
+{
+	cht_machine_id = CHT_SURFACE_MACH;
+	return 1;
+}
+
+
+static const struct dmi_system_id cht_table[] = {
+	{
+		.callback = cht_surface_quirk_cb,
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "Surface 3"),
+		},
+	},
+};
+
+
+static struct sst_acpi_mach cht_surface_mach = {
+	"10EC5640", "cht-bsw-rt5645", "intel/fw_sst_22a8.bin", "cht-bsw", NULL,
+								&chv_platform_data };
+
+struct sst_acpi_mach *cht_quirk(void *arg)
+{
+	struct sst_acpi_mach *mach = arg;
+
+	dmi_check_system(cht_table);
+
+	if (cht_machine_id == CHT_SURFACE_MACH)
+		return &cht_surface_mach;
+	else
+		return mach;
+}
+
 static struct sst_acpi_mach sst_acpi_bytcr[] = {
 	{"10EC5640", "bytcr_rt5640", "intel/fw_sst_0f28.bin", "bytcr_rt5640", NULL,
 						&byt_rvp_platform_data },
@@ -343,7 +385,7 @@ static struct sst_acpi_mach sst_acpi_chv[] = {
 	{"193C9890", "cht-bsw-max98090", "intel/fw_sst_22a8.bin", "cht-bsw", NULL,
 						&chv_platform_data },
 	/* some CHT-T platforms rely on RT5640, use Baytrail machine driver */
-	{"10EC5640", "bytcr_rt5640", "intel/fw_sst_22a8.bin", "bytcr_rt5640", NULL,
+	{"10EC5640", "bytcr_rt5640", "intel/fw_sst_22a8.bin", "bytcr_rt5640", cht_quirk,
 						&chv_platform_data },
 
 	{},
sound/soc/intel/common/sst-acpi.h +1 -1
index b02f12900b93..5d2949324d0e 100644
@@ -40,6 +40,6 @@ struct sst_acpi_mach {
 
 	/* board name */
 	const char *board;
-	void (*machine_quirk)(void);
+	struct sst_acpi_mach * (*machine_quirk)(void *arg);
 	void *pdata;
 };
Signature · 1 line
2.8.1
author
#3 lore raw

PATCH 2/3 ASoC: rt5645: Add ACPI ID 10EC5640

In reply to Vinod Koul

Some CHT platforms use RT5645 codec which has entry 10EC5640 so add it. Also add DMI quirk for jack detection.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=98001

---
 sound/soc/codecs/rt5645.c | 7 +++++++
 1 file changed, 7 insertions(+)
sound/soc/codecs/rt5645.c +7 -0
index 3c6594da6c9c..761ca88c4cdd 100644
@@ -3531,6 +3531,7 @@ MODULE_DEVICE_TABLE(i2c, rt5645_i2c_id);
 static const struct acpi_device_id rt5645_acpi_match[] = {
 	{ "10EC5645", 0 },
 	{ "10EC5650", 0 },
+	{ "10EC5640", 0 },
 	{},
 };
 MODULE_DEVICE_TABLE(acpi, rt5645_acpi_match);
@@ -3561,6 +3562,12 @@ static const struct dmi_system_id dmi_platform_intel_braswell[] = {
 			DMI_MATCH(DMI_PRODUCT_NAME, "Setzer"),
 		},
 	},
+	{
+		.ident = "Microsoft Surface 3",
+		.matches = {
+			DMI_MATCH(DMI_PRODUCT_NAME, "Surface 3"),
+		},
+	},
 	{ }
 };
 
Signature · 1 line
1.9.1
author
#4 lore raw

PATCH 3/3 ASoC: Intel: Add surface3 entry in CHT-RT5645 machine

In reply to Vinod Koul

Surface3 device is a CHT machine, so add entry for it. Also update the HID from BIOS.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=98001

---
 sound/soc/intel/boards/cht_bsw_rt5645.c | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)
sound/soc/intel/boards/cht_bsw_rt5645.c +19 -1
index d7ef292c402d..f26c7b8545ae 100644
@@ -30,6 +30,7 @@
 #include <sound/jack.h>
 #include "../../codecs/rt5645.h"
 #include "../atom/sst-atom-controls.h"
+#include "../common/sst-acpi.h"
 
 #define CHT_PLAT_CLK_3_HZ	19200000
 #define CHT_CODEC_DAI	"rt5645-aif1"
@@ -340,10 +341,13 @@ static struct snd_soc_card snd_soc_card_chtrt5650 = {
 };
 
 static struct cht_acpi_card snd_soc_cards[] = {
+	{"10EC5640", CODEC_TYPE_RT5645, &snd_soc_card_chtrt5645},
 	{"10EC5645", CODEC_TYPE_RT5645, &snd_soc_card_chtrt5645},
 	{"10EC5650", CODEC_TYPE_RT5650, &snd_soc_card_chtrt5650},
 };
 
+static char cht_rt5640_codec_name[16]; /* i2c-<HID>:00 with HID being 8 chars */
+
 static int snd_cht_mc_probe(struct platform_device *pdev)
 {
 	int ret_val = 0;
@@ -351,6 +355,9 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
 	struct cht_mc_private *drv;
 	struct snd_soc_card *card = snd_soc_cards[0].soc_card;
 	char codec_name[16];
+	struct sst_acpi_mach *mach;
+	const char *i2c_name = NULL;
+	int dai_index;
 
 	drv = devm_kzalloc(&pdev->dev, sizeof(*drv), GFP_ATOMIC);
 	if (!drv)
@@ -366,12 +373,23 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
 		}
 	}
 	card->dev = &pdev->dev;
+	mach = card->dev->platform_data;
 	sprintf(codec_name, "i2c-%s:00", drv->acpi_card->codec_id);
 
 	/* set correct codec name */
 	for (i = 0; i < ARRAY_SIZE(cht_dailink); i++)
-		if (!strcmp(card->dai_link[i].codec_name, "i2c-10EC5645:00"))
+		if (!strcmp(card->dai_link[i].codec_name, "i2c-10EC5645:00")) {
 			card->dai_link[i].codec_name = kstrdup(codec_name, GFP_KERNEL);
+			dai_index = i;
+		}
+
+	/* fixup codec name based on HID */
+	i2c_name = sst_acpi_find_name_from_hid(mach->id);
+	if (i2c_name != NULL) {
+		snprintf(cht_rt5640_codec_name, sizeof(cht_rt5640_codec_name),
+			"%s%s", "i2c-", i2c_name);
+		cht_dailink[dai_index].codec_name = cht_rt5640_codec_name;
+	}
 
 	snd_soc_card_set_drvdata(card, drv);
 	ret_val = devm_snd_soc_register_card(&pdev->dev, card);
Signature · 1 line
1.9.1
maintainer
#5 lore raw

Applied "ASoC: Intel: Add surface3 entry in CHT-RT5645 machine" to the asoc tree

The patch

ASoC: Intel: Add surface3 entry in CHT-RT5645 machine

has been applied to the asoc tree at

git://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

Quoted 1 line

From 07d5c17b80f67d1b2cc2c8243590e2abed4bd7ae Mon Sep 17 00:00:00 2001

From: Vinod Koul <[email protected]>
Date: Fri, 8 Jul 2016 15:39:51 +0530
Subject: [PATCH] ASoC: Intel: Add surface3 entry in CHT-RT5645 machine

Surface3 device is a CHT machine, so add entry for it. Also update the HID from BIOS.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=98001

---
 sound/soc/intel/boards/cht_bsw_rt5645.c | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)
sound/soc/intel/boards/cht_bsw_rt5645.c +19 -1
index d7ef292c402d..f26c7b8545ae 100644
@@ -30,6 +30,7 @@
 #include <sound/jack.h>
 #include "../../codecs/rt5645.h"
 #include "../atom/sst-atom-controls.h"
+#include "../common/sst-acpi.h"
 
 #define CHT_PLAT_CLK_3_HZ	19200000
 #define CHT_CODEC_DAI	"rt5645-aif1"
@@ -340,10 +341,13 @@ static struct snd_soc_card snd_soc_card_chtrt5650 = {
 };
 
 static struct cht_acpi_card snd_soc_cards[] = {
+	{"10EC5640", CODEC_TYPE_RT5645, &snd_soc_card_chtrt5645},
 	{"10EC5645", CODEC_TYPE_RT5645, &snd_soc_card_chtrt5645},
 	{"10EC5650", CODEC_TYPE_RT5650, &snd_soc_card_chtrt5650},
 };
 
+static char cht_rt5640_codec_name[16]; /* i2c-<HID>:00 with HID being 8 chars */
+
 static int snd_cht_mc_probe(struct platform_device *pdev)
 {
 	int ret_val = 0;
@@ -351,6 +355,9 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
 	struct cht_mc_private *drv;
 	struct snd_soc_card *card = snd_soc_cards[0].soc_card;
 	char codec_name[16];
+	struct sst_acpi_mach *mach;
+	const char *i2c_name = NULL;
+	int dai_index;
 
 	drv = devm_kzalloc(&pdev->dev, sizeof(*drv), GFP_ATOMIC);
 	if (!drv)
@@ -366,12 +373,23 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
 		}
 	}
 	card->dev = &pdev->dev;
+	mach = card->dev->platform_data;
 	sprintf(codec_name, "i2c-%s:00", drv->acpi_card->codec_id);
 
 	/* set correct codec name */
 	for (i = 0; i < ARRAY_SIZE(cht_dailink); i++)
-		if (!strcmp(card->dai_link[i].codec_name, "i2c-10EC5645:00"))
+		if (!strcmp(card->dai_link[i].codec_name, "i2c-10EC5645:00")) {
 			card->dai_link[i].codec_name = kstrdup(codec_name, GFP_KERNEL);
+			dai_index = i;
+		}
+
+	/* fixup codec name based on HID */
+	i2c_name = sst_acpi_find_name_from_hid(mach->id);
+	if (i2c_name != NULL) {
+		snprintf(cht_rt5640_codec_name, sizeof(cht_rt5640_codec_name),
+			"%s%s", "i2c-", i2c_name);
+		cht_dailink[dai_index].codec_name = cht_rt5640_codec_name;
+	}
 
 	snd_soc_card_set_drvdata(card, drv);
 	ret_val = devm_snd_soc_register_card(&pdev->dev, card);
Signature · 1 line
2.8.1
#6 lore raw

Re: [PATCH 3/3] ASoC: Intel: Add surface3 entry in CHT-RT5645 machine

In reply to Vinod Koul
Quoted 58 lines · Vinod Koul

Surface3 device is a CHT machine, so add entry for it. Also update the HID from BIOS.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=98001

---
 sound/soc/intel/boards/cht_bsw_rt5645.c | 20 +++++++++++++++++++-

 1 file changed, 19 insertions(+), 1 deletion(-)
sound/soc/intel/boards/cht_bsw_rt5645.c +1 -0
index d7ef292c402d..f26c7b8545ae 100644
@@ -30,6 +30,7 @@
  #include 
  #include "../../codecs/rt5645.h"
  #include "../atom/sst-atom-controls.h"
+#include "../common/sst-acpi.h"


 #define CHT_PLAT_CLK_3_HZ 19200000
 #define CHT_CODEC_DAI "rt5645-aif1"

sound/soc/intel/boards/cht_bsw_rt5645.c +0 -0
@@ -340,10 +341,13 @@ static struct snd_soc_card snd_soc_card_chtrt5650 = {
  };


 static struct cht_acpi_card snd_soc_cards[] = {

sound/soc/intel/boards/cht_bsw_rt5645.c +1 -0
+	{"10EC5640", CODEC_TYPE_RT5645, &snd_soc_card_chtrt5645},

  {"10EC5645", CODEC_TYPE_RT5645, &snd_soc_card_chtrt5645}, {"10EC5650", CODEC_TYPE_RT5650, &snd_soc_card_chtrt5650}, };

sound/soc/intel/boards/cht_bsw_rt5645.c +2 -0
+static char cht_rt5640_codec_name[16]; /* i2c-:00 with HID being 8 chars */
+

 static int snd_cht_mc_probe(struct platform_device *pdev) {
  int ret_val = 0;

sound/soc/intel/boards/cht_bsw_rt5645.c +3 -0
@@ -351,6 +355,9 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
  	struct cht_mc_private *drv;
  	struct snd_soc_card *card = snd_soc_cards[0].soc_card;
  	char codec_name[16];
+	struct sst_acpi_mach *mach;
+	const char *i2c_name = NULL;
+	int dai_index;


  drv = devm_kzalloc(&pdev->dev, sizeof(*drv), GFP_ATOMIC); if (!drv)

sound/soc/intel/boards/cht_bsw_rt5645.c +1 -0
@@ -366,12 +373,23 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
  		}
  	}
  	card->dev = &pdev->dev;
+	mach = card->dev->platform_data;
  	sprintf(codec_name, "i2c-%s:00", drv->acpi_card->codec_id);


  /* set correct codec name */
  for (i = 0; i < ARRAY_SIZE(cht_dailink); i++)

sound/soc/intel/boards/cht_bsw_rt5645.c +1 -1
-		if (!strcmp(card->dai_link[i].codec_name, "i2c-10EC5645:00"))
+		if (!strcmp(card->dai_link[i].codec_name, "i2c-10EC5645:00")) {

  card->dai_link[i].codec_name = kstrdup(codec_name, GFP_KERNEL);

sound/soc/intel/boards/cht_bsw_rt5645.c static int snd_cht_mc_probe(struct platform_device *pdev) · line 391

Quoted 9 lines
sound/soc/intel/boards/cht_bsw_rt5645.c +9 -0
+			dai_index = i;
+		}
+
+	/* fixup codec name based on HID */
+	i2c_name = sst_acpi_find_name_from_hid(mach->id);
+	if (i2c_name != NULL) {
+		snprintf(cht_rt5640_codec_name, sizeof(cht_rt5640_codec_name),
+			"%s%s", "i2c-", i2c_name);
+		cht_dailink[dai_index].codec_name = cht_rt5640_codec_name;

FWIW, I get:
sound/soc/intel/boards/cht_bsw_rt5645.c: In function 'snd_cht_mc_probe':
sound/soc/intel/boards/cht_bsw_rt5645.c:391:37: warning: 'dai_index' may be used uninitialized in this function [-Wmaybe-uninitialized] cht_dailink[dai_index].codec_name = cht_rt5640_codec_name; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~

Quoted 4 lines
sound/soc/intel/boards/cht_bsw_rt5645.c +1 -0
+	}


  snd_soc_card_set_drvdata(card, drv);
  ret_val = devm_snd_soc_register_card(&pdev->dev, card);

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

author
#7 lore raw

Re: [PATCH 3/3] ASoC: Intel: Add surface3 entry in CHT-RT5645 machine

Quoted 4 lines · Bastien Nocera
Quoted 4 lines
sound/soc/intel/boards/cht_bsw_rt5645.c +4 -0
+	/* fixup codec name based on HID */
+	i2c_name = sst_acpi_find_name_from_hid(mach->id);
+	if (i2c_name != NULL) {
+		snprintf(cht_rt5640_codec_name, sizeof(cht_rt5640_codec_name),
Quoted 8 lines

sound/soc/intel/boards/cht_bsw_rt5645.c static int snd_cht_mc_probe(struct platform_device *pdev) · line 391

Quoted 2 lines
sound/soc/intel/boards/cht_bsw_rt5645.c +2 -0
+			"%s%s", "i2c-", i2c_name);
+		cht_dailink[dai_index].codec_name = cht_rt5640_codec_name;

FWIW, I get:
sound/soc/intel/boards/cht_bsw_rt5645.c: In function 'snd_cht_mc_probe':
sound/soc/intel/boards/cht_bsw_rt5645.c:391:37: warning: 'dai_index' may be used uninitialized in this function [-Wmaybe-uninitialized] cht_dailink[dai_index].codec_name = cht_rt5640_codec_name; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~

Yeah I notice them a bit later. The fixes are already in mark's-next.

Signature · 1 line
~Vinod
#8 lore raw

Re: [PATCH 3/3] ASoC: Intel: Add surface3 entry in CHT-RT5645 machine

Quoted 19 lines · Vinod Koul
Quoted 9 lines · Bastien Nocera
Quoted 8 lines
sound/soc/intel/boards/cht_bsw_rt5645.c +4 -0
+	/* fixup codec name based on HID */
+	i2c_name = sst_acpi_find_name_from_hid(mach->id);
+	if (i2c_name != NULL) {
+		snprintf(cht_rt5640_codec_name,

sizeof(cht_rt5640_codec_name),

(quoted diff) +2 -0
+			"%s%s", "i2c-", i2c_name);
+		cht_dailink[dai_index].codec_name =

cht_rt5640_codec_name;

Quoted 8 lines

FWIW, I get:
sound/soc/intel/boards/cht_bsw_rt5645.c: In function 'snd_cht_mc_probe':
sound/soc/intel/boards/cht_bsw_rt5645.c:391:37: warning:
'dai_index' may be used uninitialized in this function [-Wmaybe- uninitialized]
   cht_dailink[dai_index].codec_name = cht_rt5640_codec_name; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~

Quoted 1 line

Yeah I notice them a bit later. The fixes are already in mark's-next.

Care to be a bit more specific. Kind of hard to know which Mark you're talking about when there's no one of that name in the CC: list above.
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#9 lore raw

Re: [PATCH 3/3] ASoC: Intel: Add surface3 entry in CHT-RT5645 machine

Mark Brown is the maintainer of sound tree. He is included in cc: [email protected] :)

-----Original Message-----
From: Bastien Nocera [mailto:[email protected]]
Sent: Wednesday, July 20, 2016 4:57 PM
To: Koul, Vinod <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; Patches Audio <[email protected]>; Stephen Just <[email protected]>; Pierre-Louis Bossart <[email protected]>; [email protected]; [email protected]; Mokashi, SachinX <[email protected]>
Subject: Re: [PATCH 3/3] ASoC: Intel: Add surface3 entry in CHT-RT5645 machine

Quoted 19 lines · Vinod Koul
Quoted 9 lines · Bastien Nocera
Quoted 8 lines
sound/soc/intel/boards/cht_bsw_rt5645.c +4 -0
+	/* fixup codec name based on HID */
+	i2c_name = sst_acpi_find_name_from_hid(mach->id);
+	if (i2c_name != NULL) {
+		snprintf(cht_rt5640_codec_name,

sizeof(cht_rt5640_codec_name),

(quoted diff) +2 -0
+			"%s%s", "i2c-", i2c_name);
+		cht_dailink[dai_index].codec_name =

cht_rt5640_codec_name;

Quoted 8 lines

FWIW, I get:
sound/soc/intel/boards/cht_bsw_rt5645.c: In function 'snd_cht_mc_probe':
sound/soc/intel/boards/cht_bsw_rt5645.c:391:37: warning:
'dai_index' may be used uninitialized in this function [-Wmaybe- uninitialized]
   cht_dailink[dai_index].codec_name = cht_rt5640_codec_name; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~

Quoted 1 line

Yeah I notice them a bit later. The fixes are already in mark's-next.

Care to be a bit more specific. Kind of hard to know which Mark you're talking about when there's no one of that name in the CC: list above.
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#10 lore raw

Re: [PATCH 3/3] ASoC: Intel: Add surface3 entry in CHT-RT5645 machine

#11 lore raw
In reply to Vinod Koul
Quoted 10 lines · Vinod Koul

Surface3 tablet is CHT based device which used RT5645 codec. But the ACPI ID
is 10EC5640 which belong to RT5640 codec :(
So we add quirk support to load cht-machine driver for surface tablet combination, add the ACPI id and DMI fix for jack detect in codec and finally machine update.

This fixes Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=9800
1
Please verify and send your tested-by.

Did anyone test this?

I get this output:

Jul 20 16:20:32 surface kernel: rt5640 i2c-10EC5640:00: Device with ID register 0x6308 is not rt5640/39
Jul 20 16:20:34 surface kernel: cht-bsw-rt5645 cht-bsw-rt5645: snd-soc-dummy-dai <-> media-cpu-dai mapping ok
Jul 20 16:20:34 surface kernel: cht-bsw-rt5645 cht-bsw-rt5645: snd-soc-dummy-dai <-> deepbuffer-cpu-dai mapping ok
Jul 20 16:20:34 surface kernel: compress asoc: snd-soc-dummy-dai <-> compress-cpu-dai mapping ok
Jul 20 16:20:34 surface kernel: cht-bsw-rt5645 cht-bsw-rt5645: rt5645-aif1 <-> ssp2-port mapping ok
Jul 20 16:20:34 surface kernel: input: chtrt5645 Headset as /devices/pci0000:00/808622A8:00/cht-bsw-rt5645/sound/card0/input25

With the early warning telling me it's probably not going through the quirks, though the rest of the output makes me think otherwise.

After PulseAudio starts I get:

Jul 20 16:20:40 surface pulseaudio[1315]: [pulseaudio] module-alsa-card.c: Failed to find a working profile.
Jul 20 16:41:32 surface pulseaudio[1315]: [pulseaudio] module.c: Failed to load module "module-alsa-card" (argument: "device_id="0" name="platform-cht-bsw-rt5645" card_name="alsa_card.platform-cht-bsw-rt5645" namereg_fail=false tsched=yes fixed_latency_range=no ignore_dB=no deferred_volume=yes use_ucm=yes card_properties="module-udev-detect.discovered=1""): initialization failed.
Jul 20 16:20:40 surface kernel:  Audio Port: ASoC: no backend DAIs enabled for Audio Port

[and plenty more of that last line]

$ journalctl -b | grep "Audio Port: ASoC: no backend DAIs enabled for Audio Port" | wc -l
1802

Ideas?
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#12 lore raw
Quoted 9 lines · Bastien Nocera
Quoted 7 lines · Vinod Koul

Surface3 tablet is CHT based device which used RT5645 codec. But the ACPI ID
is 10EC5640 which belong to RT5640 codec :(
So we add quirk support to load cht-machine driver for surface tablet combination, add the ACPI id and DMI fix for jack detect in codec and finally machine update.

Quoted 6 lines
Quoted 3 lines

This fixes Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=9800
1
Please verify and send your tested-by.

Did anyone test this?

At least I did

Quoted 2 lines

I get this output:

Jul 20 16:20:32 surface kernel: rt5640 i2c-10EC5640:00: Device with ID

register 0x6308 is not rt5640/39

Quoted 1 line
Jul 20 16:20:34 surface kernel: cht-bsw-rt5645 cht-bsw-rt5645:

snd-soc-dummy-dai <-> media-cpu-dai mapping ok

Quoted 1 line
Jul 20 16:20:34 surface kernel: cht-bsw-rt5645 cht-bsw-rt5645:

snd-soc-dummy-dai <-> deepbuffer-cpu-dai mapping ok

Quoted 1 line
Jul 20 16:20:34 surface kernel: compress asoc: snd-soc-dummy-dai <->

compress-cpu-dai mapping ok

Quoted 1 line
Jul 20 16:20:34 surface kernel: cht-bsw-rt5645 cht-bsw-rt5645:

rt5645-aif1 <-> ssp2-port mapping ok

Quoted 1 line
Jul 20 16:20:34 surface kernel: input: chtrt5645 Headset as

/devices/pci0000:00/808622A8:00/cht-bsw-rt5645/sound/card0/input25

Quoted 3 lines

With the early warning telling me it's probably not going through the quirks, though the rest of the output makes me think otherwise.

Both rt5640 and rt5645 drivers pick up the sound chip, but only the correct one succeeds.

Quoted 3 lines

After PulseAudio starts I get:

Jul 20 16:20:40 surface pulseaudio[1315]: [pulseaudio]

module-alsa-card.c: Failed to find a working profile.

Quoted 1 line
Jul 20 16:41:32 surface pulseaudio[1315]: [pulseaudio] module.c: Failed

to load module "module-alsa-card" (argument: "device_id="0" name="platform-cht-bsw-rt5645" card_name="alsa_card.platform-cht-bsw-rt5645" namereg_fail=false tsched=yes fixed_latency_range=no ignore_dB=no deferred_volume=yes use_ucm=yes card_properties="module-udev-detect.discovered=1""): initialization failed.

Quoted 1 line
Jul 20 16:20:40 surface kernel:  Audio Port: ASoC: no backend DAIs

enabled for Audio Port

Quoted 3 lines

[and plenty more of that last line]

$ journalctl -b | grep "Audio Port: ASoC: no backend DAIs enabled for

Audio Port" | wc -l

Quoted 3 lines

1802

Ideas?

Are you using the alsa-lib patch to add UCM configuration too [1]? Pulseaudio needs it to initialize properly (without other manual intervention described in the bugzilla ticket for these patches).

[1]
http://git.alsa-project.org/?p=alsa-lib.git;a=commit;h=b6c69d7067a1818e53da774bdbdc3023f299d579

#13 lore raw
Quoted 13 lines · Stephen J
Quoted 3 lines · Bastien Nocera
Quoted 1 line · Vinod Koul

Surface3 tablet is CHT based device which used RT5645 codec. But

the

Quoted 3 lines
Quoted 3 lines

ACPI ID
is 10EC5640 which belong to RT5640 codec :(
So we add quirk support to load cht-machine driver for surface

tablet

Quoted 1 line
Quoted 1 line

combination, add the ACPI id and DMI fix for jack detect in codec

and

Quoted 2 lines
Quoted 2 lines

finally machine update.

Quoted 8 lines
Quoted 1 line
Quoted 1 line

This fixes Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=

9800

Quoted 5 lines
Quoted 2 lines

1
Please verify and send your tested-by.

Did anyone test this?

At least I did

Fair enough.

Quoted 11 lines
Quoted 2 lines

I get this output:

Jul 20 16:20:32 surface kernel: rt5640 i2c-10EC5640:00: Device with

ID register 0x6308 is not rt5640/39

Quoted 1 line
Jul 20 16:20:34 surface kernel: cht-bsw-rt5645 cht-bsw-rt5645: snd-

soc-dummy-dai <-> media-cpu-dai mapping ok

Quoted 1 line
Jul 20 16:20:34 surface kernel: cht-bsw-rt5645 cht-bsw-rt5645: snd-

soc-dummy-dai <-> deepbuffer-cpu-dai mapping ok

Quoted 3 lines
Jul 20 16:20:34 surface kernel: compress asoc: snd-soc-dummy-dai <-
compress-cpu-dai mapping ok
Jul 20 16:20:34 surface kernel: cht-bsw-rt5645 cht-bsw-rt5645:

rt5645-aif1 <-> ssp2-port mapping ok

Quoted 8 lines
Quoted 1 line
Jul 20 16:20:34 surface kernel: input: chtrt5645 Headset as

/devices/pci0000:00/808622A8:00/cht-bsw-rt5645/sound/card0/input25

Quoted 2 lines

With the early warning telling me it's probably not going through

the

Quoted 1 line

quirks, though the rest of the output makes me think otherwise.

Both rt5640 and rt5645 drivers pick up the sound chip, but only the correct one succeeds.

Good then.

Quoted 16 lines
Quoted 3 lines

After PulseAudio starts I get:

Jul 20 16:20:40 surface pulseaudio[1315]: [pulseaudio] module-alsa-

card.c: Failed to find a working profile.

Quoted 1 line
Jul 20 16:41:32 surface pulseaudio[1315]: [pulseaudio] module.c:

Failed to load module "module-alsa-card" (argument: "device_id="0" name="platform-cht-bsw-rt5645" card_name="alsa_card.platform-cht-bsw- rt5645" namereg_fail=false tsched=yes fixed_latency_range=no ignore_dB=no deferred_volume=yes use_ucm=yes card_properties="module- udev-detect.discovered=1""): initialization failed.

Quoted 1 line
Jul 20 16:20:40 surface kernel:  Audio Port: ASoC: no backend DAIs

enabled for Audio Port

Quoted 3 lines

[and plenty more of that last line]

$ journalctl -b | grep "Audio Port: ASoC: no backend DAIs enabled

for Audio Port" | wc -l

Quoted 8 lines
Quoted 3 lines

1802

Ideas?

Are you using the alsa-lib patch to add UCM configuration too [1]? Pulseaudio needs it to initialize properly (without other manual intervention described in the bugzilla ticket for these patches).
[1] http://git.alsa-project.org/?p=alsa-lib.git;a=commit;h=b6c69d7067
a1818e53da774bdbdc3023f299d579

Looks like I cocked up the patch application in my updated alsa-ucm package. It works correctly afterwards, including the internal microphone and speakers, and headset output (mic + headphones).

I also noticed that alsa-ucm isn't in the default Fedora package set.

Sorry about the spam.
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel