diff options
author | Yong Zhi <yong.zhi@intel.com> | 2016-05-27 00:30:15 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2016-05-30 13:16:44 -0400 |
commit | f65cf7d666371562ef83b487a31e73642f3a3564 (patch) | |
tree | f63d27e08341700cb221106be3d180172e1ed892 /sound/soc/intel/skylake | |
parent | 0c7941a63a0f46cfd4c41f30e5fcd55e678d535c (diff) |
ASoC: Intel: Skylake: Add api to retrieve dmic array info from nhlt
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>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/intel/skylake')
-rw-r--r-- | sound/soc/intel/skylake/skl-nhlt.c | 40 | ||||
-rw-r--r-- | sound/soc/intel/skylake/skl-nhlt.h | 22 | ||||
-rw-r--r-- | sound/soc/intel/skylake/skl.c | 12 | ||||
-rw-r--r-- | sound/soc/intel/skylake/skl.h | 6 |
4 files changed, 78 insertions, 2 deletions
diff --git a/sound/soc/intel/skylake/skl-nhlt.c b/sound/soc/intel/skylake/skl-nhlt.c index 7d73648e5f9a..3f8e6f0b7eb5 100644 --- a/sound/soc/intel/skylake/skl-nhlt.c +++ b/sound/soc/intel/skylake/skl-nhlt.c | |||
@@ -17,6 +17,7 @@ | |||
17 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | 17 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
18 | * | 18 | * |
19 | */ | 19 | */ |
20 | #include <linux/pci.h> | ||
20 | #include "skl.h" | 21 | #include "skl.h" |
21 | 22 | ||
22 | /* Unique identification for getting NHLT blobs */ | 23 | /* Unique identification for getting NHLT blobs */ |
@@ -149,6 +150,45 @@ struct nhlt_specific_cfg | |||
149 | return NULL; | 150 | return NULL; |
150 | } | 151 | } |
151 | 152 | ||
153 | int skl_get_dmic_geo(struct skl *skl) | ||
154 | { | ||
155 | struct nhlt_acpi_table *nhlt = (struct nhlt_acpi_table *)skl->nhlt; | ||
156 | struct nhlt_endpoint *epnt; | ||
157 | struct nhlt_dmic_array_config *cfg; | ||
158 | struct device *dev = &skl->pci->dev; | ||
159 | unsigned int dmic_geo = 0; | ||
160 | u8 j; | ||
161 | |||
162 | epnt = (struct nhlt_endpoint *)nhlt->desc; | ||
163 | |||
164 | for (j = 0; j < nhlt->endpoint_count; j++) { | ||
165 | if (epnt->linktype == NHLT_LINK_DMIC) { | ||
166 | cfg = (struct nhlt_dmic_array_config *) | ||
167 | (epnt->config.caps); | ||
168 | switch (cfg->array_type) { | ||
169 | case NHLT_MIC_ARRAY_2CH_SMALL: | ||
170 | case NHLT_MIC_ARRAY_2CH_BIG: | ||
171 | dmic_geo |= MIC_ARRAY_2CH; | ||
172 | break; | ||
173 | |||
174 | case NHLT_MIC_ARRAY_4CH_1ST_GEOM: | ||
175 | case NHLT_MIC_ARRAY_4CH_L_SHAPED: | ||
176 | case NHLT_MIC_ARRAY_4CH_2ND_GEOM: | ||
177 | dmic_geo |= MIC_ARRAY_4CH; | ||
178 | break; | ||
179 | |||
180 | default: | ||
181 | dev_warn(dev, "undefined DMIC array_type 0x%0x\n", | ||
182 | cfg->array_type); | ||
183 | |||
184 | } | ||
185 | } | ||
186 | epnt = (struct nhlt_endpoint *)((u8 *)epnt + epnt->length); | ||
187 | } | ||
188 | |||
189 | return dmic_geo; | ||
190 | } | ||
191 | |||
152 | static void skl_nhlt_trim_space(struct skl *skl) | 192 | static void skl_nhlt_trim_space(struct skl *skl) |
153 | { | 193 | { |
154 | char *s = skl->tplg_name; | 194 | char *s = skl->tplg_name; |
diff --git a/sound/soc/intel/skylake/skl-nhlt.h b/sound/soc/intel/skylake/skl-nhlt.h index 3769f9fefe2b..116534e7b3c5 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 { | |||
103 | u64 length; | 103 | u64 length; |
104 | } __packed; | 104 | } __packed; |
105 | 105 | ||
106 | #define MIC_ARRAY_2CH 2 | ||
107 | #define MIC_ARRAY_4CH 4 | ||
108 | |||
109 | struct nhlt_tdm_config { | ||
110 | u8 virtual_slot; | ||
111 | u8 config_type; | ||
112 | } __packed; | ||
113 | |||
114 | struct nhlt_dmic_array_config { | ||
115 | struct nhlt_tdm_config tdm_config; | ||
116 | u8 array_type; | ||
117 | } __packed; | ||
118 | |||
119 | enum { | ||
120 | NHLT_MIC_ARRAY_2CH_SMALL = 0xa, | ||
121 | NHLT_MIC_ARRAY_2CH_BIG = 0xb, | ||
122 | NHLT_MIC_ARRAY_4CH_1ST_GEOM = 0xc, | ||
123 | NHLT_MIC_ARRAY_4CH_L_SHAPED = 0xd, | ||
124 | NHLT_MIC_ARRAY_4CH_2ND_GEOM = 0xe, | ||
125 | NHLT_MIC_ARRAY_VENDOR_DEFINED = 0xf, | ||
126 | }; | ||
127 | |||
106 | #endif | 128 | #endif |
diff --git a/sound/soc/intel/skylake/skl.c b/sound/soc/intel/skylake/skl.c index 06d8c263c68f..b0f7226b878f 100644 --- a/sound/soc/intel/skylake/skl.c +++ b/sound/soc/intel/skylake/skl.c | |||
@@ -35,6 +35,8 @@ | |||
35 | #include "skl-sst-dsp.h" | 35 | #include "skl-sst-dsp.h" |
36 | #include "skl-sst-ipc.h" | 36 | #include "skl-sst-ipc.h" |
37 | 37 | ||
38 | static struct skl_machine_pdata skl_dmic_data; | ||
39 | |||
38 | /* | 40 | /* |
39 | * initialize the PCI registers | 41 | * initialize the PCI registers |
40 | */ | 42 | */ |
@@ -397,6 +399,10 @@ static int skl_machine_device_register(struct skl *skl, void *driver_data) | |||
397 | platform_device_put(pdev); | 399 | platform_device_put(pdev); |
398 | return -EIO; | 400 | return -EIO; |
399 | } | 401 | } |
402 | |||
403 | if (mach->pdata) | ||
404 | dev_set_drvdata(&pdev->dev, mach->pdata); | ||
405 | |||
400 | skl->i2s_dev = pdev; | 406 | skl->i2s_dev = pdev; |
401 | 407 | ||
402 | return 0; | 408 | return 0; |
@@ -666,6 +672,8 @@ static int skl_probe(struct pci_dev *pci, | |||
666 | 672 | ||
667 | pci_set_drvdata(skl->pci, ebus); | 673 | pci_set_drvdata(skl->pci, ebus); |
668 | 674 | ||
675 | skl_dmic_data.dmic_num = skl_get_dmic_geo(skl); | ||
676 | |||
669 | /* check if dsp is there */ | 677 | /* check if dsp is there */ |
670 | if (ebus->ppcap) { | 678 | if (ebus->ppcap) { |
671 | err = skl_machine_device_register(skl, | 679 | err = skl_machine_device_register(skl, |
@@ -787,9 +795,9 @@ static void skl_remove(struct pci_dev *pci) | |||
787 | static struct sst_acpi_mach sst_skl_devdata[] = { | 795 | static struct sst_acpi_mach sst_skl_devdata[] = { |
788 | { "INT343A", "skl_alc286s_i2s", "intel/dsp_fw_release.bin", NULL, NULL, NULL }, | 796 | { "INT343A", "skl_alc286s_i2s", "intel/dsp_fw_release.bin", NULL, NULL, NULL }, |
789 | { "INT343B", "skl_nau88l25_ssm4567_i2s", "intel/dsp_fw_release.bin", | 797 | { "INT343B", "skl_nau88l25_ssm4567_i2s", "intel/dsp_fw_release.bin", |
790 | NULL, NULL, NULL }, | 798 | NULL, NULL, &skl_dmic_data }, |
791 | { "MX98357A", "skl_nau88l25_max98357a_i2s", "intel/dsp_fw_release.bin", | 799 | { "MX98357A", "skl_nau88l25_max98357a_i2s", "intel/dsp_fw_release.bin", |
792 | NULL, NULL, NULL }, | 800 | NULL, NULL, &skl_dmic_data }, |
793 | {} | 801 | {} |
794 | }; | 802 | }; |
795 | 803 | ||
diff --git a/sound/soc/intel/skylake/skl.h b/sound/soc/intel/skylake/skl.h index 4b4b3876aea9..f66be173f86b 100644 --- a/sound/soc/intel/skylake/skl.h +++ b/sound/soc/intel/skylake/skl.h | |||
@@ -90,6 +90,11 @@ struct skl_dma_params { | |||
90 | u8 stream_tag; | 90 | u8 stream_tag; |
91 | }; | 91 | }; |
92 | 92 | ||
93 | /* to pass dmic data */ | ||
94 | struct skl_machine_pdata { | ||
95 | u32 dmic_num; | ||
96 | }; | ||
97 | |||
93 | struct skl_dsp_ops { | 98 | struct skl_dsp_ops { |
94 | int id; | 99 | int id; |
95 | struct skl_dsp_loader_ops (*loader_ops)(void); | 100 | struct skl_dsp_loader_ops (*loader_ops)(void); |
@@ -108,6 +113,7 @@ void skl_nhlt_free(struct nhlt_acpi_table *addr); | |||
108 | struct nhlt_specific_cfg *skl_get_ep_blob(struct skl *skl, u32 instance, | 113 | struct nhlt_specific_cfg *skl_get_ep_blob(struct skl *skl, u32 instance, |
109 | u8 link_type, u8 s_fmt, u8 no_ch, u32 s_rate, u8 dirn); | 114 | u8 link_type, u8 s_fmt, u8 no_ch, u32 s_rate, u8 dirn); |
110 | 115 | ||
116 | int skl_get_dmic_geo(struct skl *skl); | ||
111 | int skl_nhlt_update_topology_bin(struct skl *skl); | 117 | int skl_nhlt_update_topology_bin(struct skl *skl); |
112 | int skl_init_dsp(struct skl *skl); | 118 | int skl_init_dsp(struct skl *skl); |
113 | int skl_free_dsp(struct skl *skl); | 119 | int skl_free_dsp(struct skl *skl); |