* [PATCH] ASoC: add api to retrieve dmic array info from coreboot nhlt
@ 2016-05-18 15:33 Yong Zhi
0 siblings, 0 replies; 6+ messages in thread
From: Yong Zhi @ 2016-05-18 15:33 UTC (permalink / raw)
To: broonie
Cc: alsa-devel, srinivas.sripathi, vinod.koul, marc.herbert,
yang.a.fang, sathya.prakash.m.r, jeeja.kp, vedang.patel, Yong Zhi
skylake can be configured with either both 2 and 4 channel DMIC
array, or 2 channel DMIC array only, this patch provides an API to
retrieve the DMIC info from nhlt.
Signed-off-by: Yong Zhi <yong.zhi@intel.com>
---
sound/soc/intel/skylake/skl-nhlt.c | 37 +++++++++++++++++++++++++++++++++++++
sound/soc/intel/skylake/skl-nhlt.h | 22 ++++++++++++++++++++++
sound/soc/intel/skylake/skl.c | 10 +++++++++-
sound/soc/intel/skylake/skl.h | 6 ++++++
4 files changed, 74 insertions(+), 1 deletion(-)
diff --git a/sound/soc/intel/skylake/skl-nhlt.c b/sound/soc/intel/skylake/skl-nhlt.c
index 7d73648..5448a48 100644
--- a/sound/soc/intel/skylake/skl-nhlt.c
+++ b/sound/soc/intel/skylake/skl-nhlt.c
@@ -149,6 +149,43 @@ struct nhlt_specific_cfg
return NULL;
}
+int skl_get_ep_dmic(struct skl *skl)
+{
+ struct nhlt_acpi_table *nhlt = (struct nhlt_acpi_table *)skl->nhlt;
+ struct nhlt_endpoint *epnt;
+ struct nhlt_dmic_array_config *cfg;
+ struct hdac_bus *bus = ebus_to_hbus(&skl->ebus);
+ struct device *dev = bus->dev;
+ unsigned int dmic_geo = 0;
+ u8 j;
+
+ epnt = (struct nhlt_endpoint *)nhlt->desc;
+
+ for (j = 0; j < nhlt->endpoint_count; j++) {
+ if (epnt->linktype == NHLT_LINK_DMIC) {
+ cfg = (struct nhlt_dmic_array_config *)
+ (epnt->config.caps);
+ switch (cfg->array_type) {
+ case NHLT_MIC_ARRAY_2CH_SMALL:
+ case NHLT_MIC_ARRAY_2CH_BIG:
+ dmic_geo |= MIC_ARRAY_2CH;
+ break;
+ case NHLT_MIC_ARRAY_4CH_1ST_GEOM:
+ case NHLT_MIC_ARRAY_4CH_L_SHAPED:
+ case NHLT_MIC_ARRAY_4CH_2ND_GEOM:
+ dmic_geo |= MIC_ARRAY_4CH;
+ break;
+ default:
+ dev_warn(dev, "undefined DMIC array_type 0x%0x\n",
+ cfg->array_type);
+ }
+ }
+ epnt = (struct nhlt_endpoint *)((u8 *)epnt + epnt->length);
+ }
+
+ return dmic_geo;
+}
+
static void skl_nhlt_trim_space(struct skl *skl)
{
char *s = skl->tplg_name;
diff --git a/sound/soc/intel/skylake/skl-nhlt.h b/sound/soc/intel/skylake/skl-nhlt.h
index 3769f9f..8da502b 100644
--- a/sound/soc/intel/skylake/skl-nhlt.h
+++ b/sound/soc/intel/skylake/skl-nhlt.h
@@ -103,4 +103,26 @@ struct nhlt_resource_desc {
u64 length;
} __packed;
+#define MIC_ARRAY_2CH 2
+#define MIC_ARRAY_4CH 4
+
+struct nhlt_tdm_config {
+ uint8_t virtual_slot;
+ uint8_t config_type;
+} __packed;
+
+struct nhlt_dmic_array_config {
+ struct nhlt_tdm_config tdm_config;
+ uint8_t array_type;
+} __packed;
+
+enum {
+ NHLT_MIC_ARRAY_2CH_SMALL = 0xa,
+ NHLT_MIC_ARRAY_2CH_BIG = 0xb,
+ NHLT_MIC_ARRAY_4CH_1ST_GEOM = 0xc,
+ NHLT_MIC_ARRAY_4CH_L_SHAPED = 0xd,
+ NHLT_MIC_ARRAY_4CH_2ND_GEOM = 0xe,
+ NHLT_MIC_ARRAY_VENDOR_DEFINED = 0xf,
+};
+
#endif
diff --git a/sound/soc/intel/skylake/skl.c b/sound/soc/intel/skylake/skl.c
index 06d8c26..a75b05f 100644
--- a/sound/soc/intel/skylake/skl.c
+++ b/sound/soc/intel/skylake/skl.c
@@ -35,6 +35,8 @@
#include "skl-sst-dsp.h"
#include "skl-sst-ipc.h"
+static struct skl_dmic_info skl_dmic_data;
+
/*
* initialize the PCI registers
*/
@@ -397,6 +399,10 @@ static int skl_machine_device_register(struct skl *skl, void *driver_data)
platform_device_put(pdev);
return -EIO;
}
+
+ if (mach->pdata)
+ dev_set_drvdata(&pdev->dev, mach->pdata);
+
skl->i2s_dev = pdev;
return 0;
@@ -666,6 +672,8 @@ static int skl_probe(struct pci_dev *pci,
pci_set_drvdata(skl->pci, ebus);
+ skl_dmic_data.dmic_num = skl_get_ep_dmic(skl);
+
/* check if dsp is there */
if (ebus->ppcap) {
err = skl_machine_device_register(skl,
@@ -789,7 +797,7 @@ static struct sst_acpi_mach sst_skl_devdata[] = {
{ "INT343B", "skl_nau88l25_ssm4567_i2s", "intel/dsp_fw_release.bin",
NULL, NULL, NULL },
{ "MX98357A", "skl_nau88l25_max98357a_i2s", "intel/dsp_fw_release.bin",
- NULL, NULL, NULL },
+ NULL, NULL, &skl_dmic_data},
{}
};
diff --git a/sound/soc/intel/skylake/skl.h b/sound/soc/intel/skylake/skl.h
index 4b4b387..889ec30 100644
--- a/sound/soc/intel/skylake/skl.h
+++ b/sound/soc/intel/skylake/skl.h
@@ -90,6 +90,11 @@ struct skl_dma_params {
u8 stream_tag;
};
+/* to pass dmic data */
+struct skl_dmic_info {
+ u32 dmic_num;
+};
+
struct skl_dsp_ops {
int id;
struct skl_dsp_loader_ops (*loader_ops)(void);
@@ -108,6 +113,7 @@ void skl_nhlt_free(struct nhlt_acpi_table *addr);
struct nhlt_specific_cfg *skl_get_ep_blob(struct skl *skl, u32 instance,
u8 link_type, u8 s_fmt, u8 no_ch, u32 s_rate, u8 dirn);
+int skl_get_ep_dmic(struct skl *skl);
int skl_nhlt_update_topology_bin(struct skl *skl);
int skl_init_dsp(struct skl *skl);
int skl_free_dsp(struct skl *skl);
--
1.9.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH] ASoC: add api to retrieve dmic array info from coreboot nhlt
@ 2016-05-19 15:58 Yong Zhi
2016-05-19 16:01 ` Mark Brown
0 siblings, 1 reply; 6+ messages in thread
From: Yong Zhi @ 2016-05-19 15:58 UTC (permalink / raw)
To: broonie
Cc: alsa-devel, srinivas.sripathi, vinod.koul, marc.herbert,
yang.a.fang, sathya.prakash.m.r, jeeja.kp, vedang.patel, Yong Zhi
skylake can be configured with either both 2 and 4 channel DMIC
array, or 2 channel DMIC array only, this patch provides an API to
retrieve the DMIC info from nhlt.
Signed-off-by: Yong Zhi <yong.zhi@intel.com>
---
sound/soc/intel/skylake/skl-nhlt.c | 37 +++++++++++++++++++++++++++++++++++++
sound/soc/intel/skylake/skl-nhlt.h | 22 ++++++++++++++++++++++
sound/soc/intel/skylake/skl.c | 12 ++++++++++--
sound/soc/intel/skylake/skl.h | 6 ++++++
4 files changed, 75 insertions(+), 2 deletions(-)
diff --git a/sound/soc/intel/skylake/skl-nhlt.c b/sound/soc/intel/skylake/skl-nhlt.c
index 7d73648..be4c4a3 100644
--- a/sound/soc/intel/skylake/skl-nhlt.c
+++ b/sound/soc/intel/skylake/skl-nhlt.c
@@ -18,6 +18,7 @@
*
*/
#include "skl.h"
+#include <linux/pci.h>
/* Unique identification for getting NHLT blobs */
static u8 OSC_UUID[16] = {0x6E, 0x88, 0x9F, 0xA6, 0xEB, 0x6C, 0x94, 0x45,
@@ -149,6 +150,42 @@ struct nhlt_specific_cfg
return NULL;
}
+int skl_get_dmic_geo(struct skl *skl)
+{
+ struct nhlt_acpi_table *nhlt = (struct nhlt_acpi_table *)skl->nhlt;
+ struct nhlt_endpoint *epnt;
+ struct nhlt_dmic_array_config *cfg;
+ struct device *dev = &(skl->pci->dev);
+ unsigned int dmic_geo = 0;
+ u8 j;
+
+ epnt = (struct nhlt_endpoint *)nhlt->desc;
+
+ for (j = 0; j < nhlt->endpoint_count; j++) {
+ if (epnt->linktype == NHLT_LINK_DMIC) {
+ cfg = (struct nhlt_dmic_array_config *)
+ (epnt->config.caps);
+ switch (cfg->array_type) {
+ case NHLT_MIC_ARRAY_2CH_SMALL:
+ case NHLT_MIC_ARRAY_2CH_BIG:
+ dmic_geo |= MIC_ARRAY_2CH;
+ break;
+ case NHLT_MIC_ARRAY_4CH_1ST_GEOM:
+ case NHLT_MIC_ARRAY_4CH_L_SHAPED:
+ case NHLT_MIC_ARRAY_4CH_2ND_GEOM:
+ dmic_geo |= MIC_ARRAY_4CH;
+ break;
+ default:
+ dev_warn(dev, "undefined DMIC array_type 0x%0x\n",
+ cfg->array_type);
+ }
+ }
+ epnt = (struct nhlt_endpoint *)((u8 *)epnt + epnt->length);
+ }
+
+ return dmic_geo;
+}
+
static void skl_nhlt_trim_space(struct skl *skl)
{
char *s = skl->tplg_name;
diff --git a/sound/soc/intel/skylake/skl-nhlt.h b/sound/soc/intel/skylake/skl-nhlt.h
index 3769f9f..116534e7 100644
--- a/sound/soc/intel/skylake/skl-nhlt.h
+++ b/sound/soc/intel/skylake/skl-nhlt.h
@@ -103,4 +103,26 @@ struct nhlt_resource_desc {
u64 length;
} __packed;
+#define MIC_ARRAY_2CH 2
+#define MIC_ARRAY_4CH 4
+
+struct nhlt_tdm_config {
+ u8 virtual_slot;
+ u8 config_type;
+} __packed;
+
+struct nhlt_dmic_array_config {
+ struct nhlt_tdm_config tdm_config;
+ u8 array_type;
+} __packed;
+
+enum {
+ NHLT_MIC_ARRAY_2CH_SMALL = 0xa,
+ NHLT_MIC_ARRAY_2CH_BIG = 0xb,
+ NHLT_MIC_ARRAY_4CH_1ST_GEOM = 0xc,
+ NHLT_MIC_ARRAY_4CH_L_SHAPED = 0xd,
+ NHLT_MIC_ARRAY_4CH_2ND_GEOM = 0xe,
+ NHLT_MIC_ARRAY_VENDOR_DEFINED = 0xf,
+};
+
#endif
diff --git a/sound/soc/intel/skylake/skl.c b/sound/soc/intel/skylake/skl.c
index 06d8c26..b0f7226 100644
--- a/sound/soc/intel/skylake/skl.c
+++ b/sound/soc/intel/skylake/skl.c
@@ -35,6 +35,8 @@
#include "skl-sst-dsp.h"
#include "skl-sst-ipc.h"
+static struct skl_machine_pdata skl_dmic_data;
+
/*
* initialize the PCI registers
*/
@@ -397,6 +399,10 @@ static int skl_machine_device_register(struct skl *skl, void *driver_data)
platform_device_put(pdev);
return -EIO;
}
+
+ if (mach->pdata)
+ dev_set_drvdata(&pdev->dev, mach->pdata);
+
skl->i2s_dev = pdev;
return 0;
@@ -666,6 +672,8 @@ static int skl_probe(struct pci_dev *pci,
pci_set_drvdata(skl->pci, ebus);
+ skl_dmic_data.dmic_num = skl_get_dmic_geo(skl);
+
/* check if dsp is there */
if (ebus->ppcap) {
err = skl_machine_device_register(skl,
@@ -787,9 +795,9 @@ static void skl_remove(struct pci_dev *pci)
static struct sst_acpi_mach sst_skl_devdata[] = {
{ "INT343A", "skl_alc286s_i2s", "intel/dsp_fw_release.bin", NULL, NULL, NULL },
{ "INT343B", "skl_nau88l25_ssm4567_i2s", "intel/dsp_fw_release.bin",
- NULL, NULL, NULL },
+ NULL, NULL, &skl_dmic_data },
{ "MX98357A", "skl_nau88l25_max98357a_i2s", "intel/dsp_fw_release.bin",
- NULL, NULL, NULL },
+ NULL, NULL, &skl_dmic_data },
{}
};
diff --git a/sound/soc/intel/skylake/skl.h b/sound/soc/intel/skylake/skl.h
index 4b4b387..f66be17 100644
--- a/sound/soc/intel/skylake/skl.h
+++ b/sound/soc/intel/skylake/skl.h
@@ -90,6 +90,11 @@ struct skl_dma_params {
u8 stream_tag;
};
+/* to pass dmic data */
+struct skl_machine_pdata {
+ u32 dmic_num;
+};
+
struct skl_dsp_ops {
int id;
struct skl_dsp_loader_ops (*loader_ops)(void);
@@ -108,6 +113,7 @@ void skl_nhlt_free(struct nhlt_acpi_table *addr);
struct nhlt_specific_cfg *skl_get_ep_blob(struct skl *skl, u32 instance,
u8 link_type, u8 s_fmt, u8 no_ch, u32 s_rate, u8 dirn);
+int skl_get_dmic_geo(struct skl *skl);
int skl_nhlt_update_topology_bin(struct skl *skl);
int skl_init_dsp(struct skl *skl);
int skl_free_dsp(struct skl *skl);
--
1.9.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] ASoC: add api to retrieve dmic array info from coreboot nhlt
2016-05-19 15:58 Yong Zhi
@ 2016-05-19 16:01 ` Mark Brown
2016-05-19 16:17 ` Zhi, Yong
0 siblings, 1 reply; 6+ messages in thread
From: Mark Brown @ 2016-05-19 16:01 UTC (permalink / raw)
To: Yong Zhi
Cc: alsa-devel, srinivas.sripathi, vinod.koul, marc.herbert,
yang.a.fang, sathya.prakash.m.r, jeeja.kp, vedang.patel
[-- Attachment #1.1: Type: text/plain, Size: 316 bytes --]
On Thu, May 19, 2016 at 08:58:59AM -0700, Yong Zhi wrote:
> skylake can be configured with either both 2 and 4 channel DMIC
> array, or 2 channel DMIC array only, this patch provides an API to
> retrieve the DMIC info from nhlt.
What's the difference between this and the similarly titled patch you
sent yesterday?
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ASoC: add api to retrieve dmic array info from coreboot nhlt
2016-05-19 16:01 ` Mark Brown
@ 2016-05-19 16:17 ` Zhi, Yong
2016-05-23 5:47 ` Vinod Koul
0 siblings, 1 reply; 6+ messages in thread
From: Zhi, Yong @ 2016-05-19 16:17 UTC (permalink / raw)
To: Mark Brown
Cc: alsa-devel@alsa-project.org, Sripathi, Srinivas, Koul, Vinod,
Fang, Yang A, M R, Sathya Prakash, Kp, Jeeja, Patel, Vedang
-----Original Message-----
From: Mark Brown [mailto:broonie@kernel.org]
Sent: Thursday, May 19, 2016 9:02 AM
To: Zhi, Yong <yong.zhi@intel.com>
Cc: alsa-devel@alsa-project.org; Koul, Vinod <vinod.koul@intel.com>; Kp, Jeeja <jeeja.kp@intel.com>; Patel, Vedang <vedang.patel@intel.com>; Fang, Yang A <yang.a.fang@intel.com>; M R, Sathya Prakash <sathya.prakash.m.r@intel.com>; Herbert, Marc <marc.herbert@intel.com>; Sripathi, Srinivas <srinivas.sripathi@intel.com>
Subject: Re: [PATCH] ASoC: add api to retrieve dmic array info from coreboot nhlt
On Thu, May 19, 2016 at 08:58:59AM -0700, Yong Zhi wrote:
> skylake can be configured with either both 2 and 4 channel DMIC array,
> or 2 channel DMIC array only, this patch provides an API to retrieve
> the DMIC info from nhlt.
What's the difference between this and the similarly titled patch you sent yesterday?
[YZ], Hi, Mark, the only function change is at line 143 below, found another product that also needs to get DMIC config info yesterday.
{ "INT343B", "skl_nau88l25_ssm4567_i2s", "intel/dsp_fw_release.bin",
- NULL, NULL, NULL },
+ NULL, NULL, &skl_dmic_data },
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ASoC: add api to retrieve dmic array info from coreboot nhlt
2016-05-19 16:17 ` Zhi, Yong
@ 2016-05-23 5:47 ` Vinod Koul
2016-05-23 17:01 ` Mark Brown
0 siblings, 1 reply; 6+ messages in thread
From: Vinod Koul @ 2016-05-23 5:47 UTC (permalink / raw)
To: Zhi, Yong
Cc: alsa-devel@alsa-project.org, Sripathi, Srinivas, Fang, Yang A,
Mark Brown, M R, Sathya Prakash, Kp, Jeeja, Patel, Vedang
On Thu, May 19, 2016 at 09:47:41PM +0530, Zhi, Yong wrote:
> -----Original Message-----
> From: Mark Brown [mailto:broonie@kernel.org]
> Sent: Thursday, May 19, 2016 9:02 AM
> To: Zhi, Yong <yong.zhi@intel.com>
> Cc: alsa-devel@alsa-project.org; Koul, Vinod <vinod.koul@intel.com>; Kp, Jeeja <jeeja.kp@intel.com>; Patel, Vedang <vedang.patel@intel.com>; Fang, Yang A <yang.a.fang@intel.com>; M R, Sathya Prakash <sathya.prakash.m.r@intel.com>; Herbert, Marc <marc.herbert@intel.com>; Sripathi, Srinivas <srinivas.sripathi@intel.com>
> Subject: Re: [PATCH] ASoC: add api to retrieve dmic array info from coreboot nhlt
>
> On Thu, May 19, 2016 at 08:58:59AM -0700, Yong Zhi wrote:
> > skylake can be configured with either both 2 and 4 channel DMIC array,
> > or 2 channel DMIC array only, this patch provides an API to retrieve
> > the DMIC info from nhlt.
>
> What's the difference between this and the similarly titled patch you sent yesterday?
>
> [YZ], Hi, Mark, the only function change is at line 143 below, found another product that also needs to get DMIC config info yesterday.
Yong,
You please wrap you replies..
The patches are doing two different things, so they should have different
titles mentioning the work the patch is doing.
Also you should consider posting them as a series.
Please update this and post the updated v2.
Thanks
--
~Vinod
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ASoC: add api to retrieve dmic array info from coreboot nhlt
2016-05-23 5:47 ` Vinod Koul
@ 2016-05-23 17:01 ` Mark Brown
0 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2016-05-23 17:01 UTC (permalink / raw)
To: Vinod Koul
Cc: alsa-devel@alsa-project.org, Sripathi, Srinivas, Fang, Yang A,
M R, Sathya Prakash, Kp, Jeeja, Patel, Vedang, Zhi, Yong
[-- Attachment #1.1: Type: text/plain, Size: 516 bytes --]
On Mon, May 23, 2016 at 11:17:33AM +0530, Vinod Koul wrote:
> > [YZ], Hi, Mark, the only function change is at line 143 below, found another product that also needs to get DMIC config info yesterday.
> The patches are doing two different things, so they should have different
> titles mentioning the work the patch is doing.
> Also you should consider posting them as a series.
> Please update this and post the updated v2.
Definitely, please - I misunderstood the above reply and discarded the
original patch.
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-05-23 17:01 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-18 15:33 [PATCH] ASoC: add api to retrieve dmic array info from coreboot nhlt Yong Zhi
-- strict thread matches above, loose matches on Subject: below --
2016-05-19 15:58 Yong Zhi
2016-05-19 16:01 ` Mark Brown
2016-05-19 16:17 ` Zhi, Yong
2016-05-23 5:47 ` Vinod Koul
2016-05-23 17:01 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).