Skip to contentSkip to conversation

ASoC: Intel: Skylake: Skylake driver updates

PATCH In review Guneshwor Singh 3 participants 13 messages Dec 6, 2017 – Dec 7, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v2 cover ASoC: Intel: Skylake: Skylake driver updates

This series includes fixes for HDMI widgets sysfs not updating, shim read optimization, fixes for dmic dev_type check and feature to configure DSP clock source.

Guneshwor Singh (1):
ASoC: Intel: Skylake: Do not check dev_type for dmic link type

Pradeep Tewani (2):
ASoC: Intel: Skylake: Parse vendor tokens to build A-State table
ASoC: Intel: Skylake: Configure DSP clock source

Puneeth Prabhu (2):
ASoC: hdac_hdmi: Refresh sysfs during hdmi device probe
ASoC: hdac_hdmi: Remove redundant assignments

Subhransu S. Prusty (1):
ASoC: Intel: Skylake: Remove second shim read in register_poll

 include/uapi/sound/snd_sst_tokens.h    | 17 ++++++++++++-
 sound/soc/codecs/hdac_hdmi.c           |  8 ++-----
 sound/soc/intel/common/sst-dsp.c       |  4 +---
 sound/soc/intel/skylake/skl-messages.c | 18 ++++++++++++++
 sound/soc/intel/skylake/skl-nhlt.c     | 15 ++++++++----
 sound/soc/intel/skylake/skl-pcm.c      |  6 +++++
 sound/soc/intel/skylake/skl-sst-dsp.h  |  3 +++
 sound/soc/intel/skylake/skl-topology.c | 44 +++++++++++++++++++++++++++++++++-
 sound/soc/intel/skylake/skl.h          | 17 +++++++++++++
 9 files changed, 116 insertions(+), 16 deletions(-)
Signature · 1 line
2.15.1
#1 lore raw

PATCH v2 1/6 ASoC: Intel: Skylake: Remove second shim read in register_poll

From: "Subhransu S. Prusty" <[email protected]>

No need to read the register again if the value read has already matched the target during the loop. So remove the second shim read.

---
 sound/soc/intel/common/sst-dsp.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
sound/soc/intel/common/sst-dsp.c +1 -3
index 11c0805393ff..fd82f4b1d4a0 100644
@@ -269,7 +269,7 @@ int sst_dsp_register_poll(struct sst_dsp *ctx, u32 offset, u32 mask,
 	 */
 
 	timeout = jiffies + msecs_to_jiffies(time);
-	while (((sst_dsp_shim_read_unlocked(ctx, offset) & mask) != target)
+	while ((((reg = sst_dsp_shim_read_unlocked(ctx, offset)) & mask) != target)
 		&& time_before(jiffies, timeout)) {
 		k++;
 		if (k > 10)
@@ -278,8 +278,6 @@ int sst_dsp_register_poll(struct sst_dsp *ctx, u32 offset, u32 mask,
 		usleep_range(s, 2*s);
 	}
 
-	reg = sst_dsp_shim_read_unlocked(ctx, offset);
-
 	if ((reg & mask) == target) {
 		dev_dbg(ctx->dev, "FW Poll Status: reg=%#x %s successful\n",
 					reg, operation);
Signature · 1 line
2.15.1
#2 lore raw

PATCH v2 2/6 ASoC: Intel: Skylake: Parse vendor tokens to build A-State table

In reply to Guneshwor Singh

From: Pradeep Tewani <[email protected]>

A-State table is a power management table which allows the driver to configure the DSP clock source corresponding to various load thresholds. The table contains upto 3 A-State entries. The patch adds and parses the corresponding A-State tokens to build the table.

---
 include/uapi/sound/snd_sst_tokens.h    | 17 ++++++++++++-
 sound/soc/intel/skylake/skl-topology.c | 44 +++++++++++++++++++++++++++++++++-
 sound/soc/intel/skylake/skl.h          | 17 +++++++++++++
 3 files changed, 76 insertions(+), 2 deletions(-)
include/uapi/sound/snd_sst_tokens.h +16 -1
index 326054a72bc7..8ba0112e5336 100644
@@ -222,6 +222,17 @@
  * %SKL_TKN_MM_U32_NUM_IN_FMT:  Number of input formats
  * %SKL_TKN_MM_U32_NUM_OUT_FMT: Number of output formats
  *
+ * %SKL_TKN_U32_ASTATE_IDX:     Table Index for the A-State entry to be filled
+ *                              with kcps and clock source
+ *
+ * %SKL_TKN_U32_ASTATE_COUNT:   Number of valid entries in A-State table
+ *
+ * %SKL_TKN_U32_ASTATE_KCPS:    Specifies the core load threshold (in kilo
+ *                              cycles per second) below which DSP is clocked
+ *                              from source specified by clock source.
+ *
+ * %SKL_TKN_U32_ASTATE_CLK_SRC: Clock source for A-State entry
+ *
  * module_id and loadable flags dont have tokens as these values will be
  * read from the DSP FW manifest
  *
@@ -309,7 +320,11 @@ enum SKL_TKNS {
 	SKL_TKN_MM_U32_NUM_IN_FMT,
 	SKL_TKN_MM_U32_NUM_OUT_FMT,
 
-	SKL_TKN_MAX = SKL_TKN_MM_U32_NUM_OUT_FMT,
+	SKL_TKN_U32_ASTATE_IDX,
+	SKL_TKN_U32_ASTATE_COUNT,
+	SKL_TKN_U32_ASTATE_KCPS,
+	SKL_TKN_U32_ASTATE_CLK_SRC,
+	SKL_TKN_MAX = SKL_TKN_U32_ASTATE_CLK_SRC,
 };
 
 #endif
sound/soc/intel/skylake/skl-topology.c +43 -1

60 lines not on this page · raw message

sound/soc/intel/skylake/skl.h +17 -0
index 554ad6b5a823..46dda88ba139 100644
@@ -29,6 +29,8 @@
 
 #define SKL_SUSPEND_DELAY 2000
 
+#define SKL_MAX_ASTATE_CFG		3
+
 #define AZX_PCIREG_PGCTL		0x44
 #define AZX_PGCTL_LSRMD_MASK		(1 << 4)
 #define AZX_PCIREG_CGCTL		0x48
@@ -46,6 +48,20 @@ struct skl_dsp_resource {
 
 struct skl_debug;
 
+struct skl_astate_param {
+	u32 kcps;
+	u32 clk_src;
+};
+
+struct skl_astate_config {
+	u32 count;
+	struct skl_astate_param astate_table[0];
+};
+
+struct skl_fw_config {
+	struct skl_astate_config *astate_cfg;
+};
+
 struct skl {
 	struct hdac_ext_bus ebus;
 	struct pci_dev *pci;
@@ -77,6 +93,7 @@ struct skl {
 	u8 nr_modules;
 	struct skl_module **modules;
 	bool use_tplg_pcm;
+	struct skl_fw_config cfg;
 };
 
 #define skl_to_ebus(s)	(&(s)->ebus)
Signature · 1 line
2.15.1
#3 lore raw

PATCH v2 3/6 ASoC: Intel: Skylake: Configure DSP clock source

In reply to Guneshwor Singh

From: Pradeep Tewani <[email protected]>

DSP clock source is configured by sending the A-State table to the FW. Add the large config set IPC to configure the desired clock source

---
 sound/soc/intel/skylake/skl-messages.c | 18 ++++++++++++++++++
 sound/soc/intel/skylake/skl-pcm.c      |  6 ++++++
 sound/soc/intel/skylake/skl-sst-dsp.h  |  3 +++
 3 files changed, 27 insertions(+)
sound/soc/intel/skylake/skl-messages.c +18 -0
index 61b5bfa79d13..81ee1118ed71 100644
@@ -55,6 +55,19 @@ static int skl_free_dma_buf(struct device *dev, struct snd_dma_buffer *dmab)
 	return 0;
 }
 
+#define SKL_ASTATE_PARAM_ID	4
+
+void skl_dsp_set_astate_cfg(struct skl_sst *ctx, u32 cnt, void *data)
+{
+	struct skl_ipc_large_config_msg	msg = {0};
+
+	msg.large_param_id = SKL_ASTATE_PARAM_ID;
+	msg.param_data_size = (cnt * sizeof(struct skl_astate_param) +
+				sizeof(cnt));
+
+	skl_ipc_set_large_config(&ctx->ipc, &msg, data);
+}
+
 #define NOTIFICATION_PARAM_ID 3
 #define NOTIFICATION_MASK 0xf
 
@@ -409,6 +422,11 @@ int skl_resume_dsp(struct skl *skl)
 		return ret;
 
 	skl_dsp_enable_notification(skl->skl_sst, false);
+
+	if (skl->cfg.astate_cfg != NULL) {
+		skl_dsp_set_astate_cfg(skl->skl_sst, skl->cfg.astate_cfg->count,
+					skl->cfg.astate_cfg);
+	}
 	return ret;
 }
 
sound/soc/intel/skylake/skl-pcm.c +6 -0
index 1dd97479e0c0..07150860680f 100644
@@ -1351,6 +1351,12 @@ static int skl_platform_soc_probe(struct snd_soc_platform *platform)
 		skl_populate_modules(skl);
 		skl->skl_sst->update_d0i3c = skl_update_d0i3c;
 		skl_dsp_enable_notification(skl->skl_sst, false);
+
+		if (skl->cfg.astate_cfg != NULL) {
+			skl_dsp_set_astate_cfg(skl->skl_sst,
+					skl->cfg.astate_cfg->count,
+					skl->cfg.astate_cfg);
+		}
 	}
 	pm_runtime_mark_last_busy(platform->dev);
 	pm_runtime_put_autosuspend(platform->dev);
sound/soc/intel/skylake/skl-sst-dsp.h +3 -0
index eba20d37ba8c..b8e799ed65ef 100644
@@ -251,6 +251,9 @@ void skl_freeup_uuid_list(struct skl_sst *ctx);
 
 int skl_dsp_strip_extended_manifest(struct firmware *fw);
 void skl_dsp_enable_notification(struct skl_sst *ctx, bool enable);
+
+void skl_dsp_set_astate_cfg(struct skl_sst *ctx, u32 cnt, void *data);
+
 int skl_sst_ctx_init(struct device *dev, int irq, const char *fw_name,
 		struct skl_dsp_loader_ops dsp_ops, struct skl_sst **dsp,
 		struct sst_dsp_device *skl_dev);
Signature · 1 line
2.15.1
#4 lore raw

PATCH v2 4/6 ASoC: Intel: Skylake: Do not check dev_type for dmic link type

In reply to Guneshwor Singh

Some BIOS have inconsistent dev_type value for DMIC link type. Since there is only one device type for DMIC link type, remove device type check if link type is NHLT_LINK_DMIC.

---
 sound/soc/intel/skylake/skl-nhlt.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
sound/soc/intel/skylake/skl-nhlt.c +10 -5
index afa557a1c031..e2121ddc8ef0 100644
@@ -120,11 +120,16 @@ static bool skl_check_ep_match(struct device *dev, struct nhlt_endpoint *epnt,
 
 	if ((epnt->virtual_bus_id == instance_id) &&
 			(epnt->linktype == link_type) &&
-			(epnt->direction == dirn) &&
-			(epnt->device_type == dev_type))
-		return true;
-	else
-		return false;
+			(epnt->direction == dirn)) {
+		/* do not check dev_type for DMIC link type */
+		if (epnt->linktype == NHLT_LINK_DMIC)
+			return true;
+
+		if (epnt->device_type == dev_type)
+			return true;
+	}
+
+	return false;
 }
 
 struct nhlt_specific_cfg
Signature · 1 line
2.15.1
maintainer
#5 lore raw

Applied "ASoC: Intel: Skylake: Do not check dev_type for dmic link type" to the asoc tree

The patch

ASoC: Intel: Skylake: Do not check dev_type for dmic link type

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

Quoted 1 line

From e02b03303f13b6a571f01b4d84b69440696d2dde Mon Sep 17 00:00:00 2001

From: Guneshwor Singh <[email protected]>
Date: Wed, 6 Dec 2017 16:34:04 +0530
Subject: [PATCH] ASoC: Intel: Skylake: Do not check dev_type for dmic link
type

Some BIOS have inconsistent dev_type value for DMIC link type. Since there is only one device type for DMIC link type, remove device type check if link type is NHLT_LINK_DMIC.

---
 sound/soc/intel/skylake/skl-nhlt.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
sound/soc/intel/skylake/skl-nhlt.c +10 -5
index d14c50a60289..3eaac41090ca 100644
@@ -119,11 +119,16 @@ static bool skl_check_ep_match(struct device *dev, struct nhlt_endpoint *epnt,
 
 	if ((epnt->virtual_bus_id == instance_id) &&
 			(epnt->linktype == link_type) &&
-			(epnt->direction == dirn) &&
-			(epnt->device_type == dev_type))
-		return true;
-	else
-		return false;
+			(epnt->direction == dirn)) {
+		/* do not check dev_type for DMIC link type */
+		if (epnt->linktype == NHLT_LINK_DMIC)
+			return true;
+
+		if (epnt->device_type == dev_type)
+			return true;
+	}
+
+	return false;
 }
 
 struct nhlt_specific_cfg
Signature · 1 line
2.15.0
#6 lore raw

PATCH v2 5/6 ASoC: hdac_hdmi: Refresh sysfs during hdmi device probe

In reply to Guneshwor Singh

From: Puneeth Prabhu <[email protected]>

All nodes of hdmi codec widgets are not updated in sysfs interface (/sys/bus/hdaudio/devices/<dev>/widgets/) as the vendor widget is not programmed to enable all the converters and pins during init. So, refresh the sysfs widget interface after enabling all pins and converters.

---
 sound/soc/codecs/hdac_hdmi.c | 1 +
 1 file changed, 1 insertion(+)
sound/soc/codecs/hdac_hdmi.c +1 -0
index 18bf959a3d59..ab1889f55227 100644
@@ -2042,6 +2042,7 @@ static int hdac_hdmi_dev_probe(struct hdac_ext_device *edev)
 			"Failed in parse and map nid with err: %d\n", ret);
 		return ret;
 	}
+	snd_hdac_refresh_widgets(hdev, true);
 
 	/* ASoC specific initialization */
 	ret = snd_soc_register_codec(&hdev->dev, &hdmi_hda_codec,
Signature · 1 line
2.15.1
maintainer
#7 lore raw

Applied "ASoC: hdac_hdmi: Refresh sysfs during hdmi device probe" to the asoc tree

The patch

ASoC: hdac_hdmi: Refresh sysfs during hdmi device probe

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

Quoted 1 line

From 0fb02ba36d01a04dab03c0a424607844ef4dadbf Mon Sep 17 00:00:00 2001

From: Puneeth Prabhu <[email protected]>
Date: Wed, 6 Dec 2017 16:34:05 +0530
Subject: [PATCH] ASoC: hdac_hdmi: Refresh sysfs during hdmi device probe

All nodes of hdmi codec widgets are not updated in sysfs interface (/sys/bus/hdaudio/devices/<dev>/widgets/) as the vendor widget is not programmed to enable all the converters and pins during init. So, refresh the sysfs widget interface after enabling all pins and converters.

---
 sound/soc/codecs/hdac_hdmi.c | 1 +
 1 file changed, 1 insertion(+)
sound/soc/codecs/hdac_hdmi.c +1 -0
index 3a35ede7027d..b706547c46d5 100644
@@ -2042,6 +2042,7 @@ static int hdac_hdmi_dev_probe(struct hdac_ext_device *edev)
 			"Failed in parse and map nid with err: %d\n", ret);
 		return ret;
 	}
+	snd_hdac_refresh_widgets(hdev, true);
 
 	/* ASoC specific initialization */
 	ret = snd_soc_register_codec(&hdev->dev, &hdmi_hda_codec,
Signature · 1 line
2.15.0
#8 lore raw

PATCH v2 6/6 ASoC: hdac_hdmi: Remove redundant assignments

In reply to Guneshwor Singh

From: Puneeth Prabhu <[email protected]>

Assignments for start_nid, end_nid and num_nodes of hdac_device structure are already done in init. So, remove the redundant assignments.

---
 sound/soc/codecs/hdac_hdmi.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
sound/soc/codecs/hdac_hdmi.c +1 -6
index ab1889f55227..69d7404dfbc4 100644
@@ -1465,10 +1465,7 @@ static int hdac_hdmi_parse_and_map_nid(struct hdac_ext_device *edev,
 		return -EINVAL;
 	}
 
-	hdev->num_nodes = num_nodes;
-	hdev->start_nid = nid;
-
-	for (i = 0; i < hdev->num_nodes; i++, nid++) {
+	for (i = 0; i < num_nodes; i++, nid++) {
 		unsigned int caps;
 		unsigned int type;
 
@@ -1494,8 +1491,6 @@ static int hdac_hdmi_parse_and_map_nid(struct hdac_ext_device *edev,
 		}
 	}
 
-	hdev->end_nid = nid;
-
 	if (!hdmi->num_pin || !hdmi->num_cvt) {
 		ret = -EIO;
 		goto free_widgets;
Signature · 1 line
2.15.1
maintainer
#9 lore raw

Applied "ASoC: hdac_hdmi: Remove redundant assignments" to the asoc tree

The patch

ASoC: hdac_hdmi: Remove redundant assignments

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

Quoted 1 line

From 45a6008bfcdc3e620dcf1b2330766345097afe9c Mon Sep 17 00:00:00 2001

From: Puneeth Prabhu <[email protected]>
Date: Wed, 6 Dec 2017 16:34:06 +0530
Subject: [PATCH] ASoC: hdac_hdmi: Remove redundant assignments

Assignments for start_nid, end_nid and num_nodes of hdac_device structure are already done in init. So, remove the redundant assignments.

---
 sound/soc/codecs/hdac_hdmi.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
sound/soc/codecs/hdac_hdmi.c +1 -6
index b706547c46d5..68a4a6b4e68e 100644
@@ -1465,10 +1465,7 @@ static int hdac_hdmi_parse_and_map_nid(struct hdac_ext_device *edev,
 		return -EINVAL;
 	}
 
-	hdev->num_nodes = num_nodes;
-	hdev->start_nid = nid;
-
-	for (i = 0; i < hdev->num_nodes; i++, nid++) {
+	for (i = 0; i < num_nodes; i++, nid++) {
 		unsigned int caps;
 		unsigned int type;
 
@@ -1494,8 +1491,6 @@ static int hdac_hdmi_parse_and_map_nid(struct hdac_ext_device *edev,
 		}
 	}
 
-	hdev->end_nid = nid;
-
 	if (!hdmi->num_pin || !hdmi->num_cvt) {
 		ret = -EIO;
 		goto free_widgets;
Signature · 1 line
2.15.0
maintainer
#11 lore raw
In reply to Guneshwor Singh
Quoted 3 lines · Guneshwor Singh

This series includes fixes for HDMI widgets sysfs not updating, shim read optimization, fixes for dmic dev_type check and feature to configure DSP clock source.

Please don't throw together a bunch of unrelated things into a patch series, if a patch is a standalone thing that isn't really related to and doesn't depend on the rest of the series just send it separately. This makes it much easier to follow what's going on and avoids changes getting held up by other, unrelated, changes. For example here the DSP clock scaling stuff is a three patch series, if there were problems with this probably the rest of the series would take longer to get looked at.

#12 lore raw
Quoted 5 lines · Mark Brown
Quoted 3 lines · Guneshwor Singh

This series includes fixes for HDMI widgets sysfs not updating, shim read optimization, fixes for dmic dev_type check and feature to configure DSP clock source.

Quoted 7 lines

Please don't throw together a bunch of unrelated things into a patch series, if a patch is a standalone thing that isn't really related to and doesn't depend on the rest of the series just send it separately. This makes it much easier to follow what's going on and avoids changes getting held up by other, unrelated, changes. For example here the DSP clock scaling stuff is a three patch series, if there were problems with this probably the rest of the series would take longer to get looked at.

Makes sense. I will take care of this in my future posts.