diff options
Diffstat (limited to 'sound/soc/intel/common')
-rw-r--r-- | sound/soc/intel/common/Makefile | 7 | ||||
-rw-r--r-- | sound/soc/intel/common/sst-acpi.c | 41 | ||||
-rw-r--r-- | sound/soc/intel/common/sst-acpi.h | 33 | ||||
-rw-r--r-- | sound/soc/intel/common/sst-dsp-priv.h | 8 | ||||
-rw-r--r-- | sound/soc/intel/common/sst-dsp.c | 2 | ||||
-rw-r--r-- | sound/soc/intel/common/sst-dsp.h | 2 | ||||
-rw-r--r-- | sound/soc/intel/common/sst-firmware.c | 20 | ||||
-rw-r--r-- | sound/soc/intel/common/sst-match-acpi.c | 43 |
8 files changed, 107 insertions, 49 deletions
diff --git a/sound/soc/intel/common/Makefile b/sound/soc/intel/common/Makefile index d9105584c51f..3b9332e7a094 100644 --- a/sound/soc/intel/common/Makefile +++ b/sound/soc/intel/common/Makefile | |||
@@ -1,11 +1,8 @@ | |||
1 | snd-soc-sst-dsp-objs := sst-dsp.o | 1 | snd-soc-sst-dsp-objs := sst-dsp.o |
2 | snd-soc-sst-acpi-objs := sst-acpi.o | 2 | snd-soc-sst-acpi-objs := sst-acpi.o sst-match-acpi.o |
3 | snd-soc-sst-ipc-objs := sst-ipc.o | 3 | snd-soc-sst-ipc-objs := sst-ipc.o |
4 | 4 | ||
5 | ifneq ($(CONFIG_DW_DMAC_CORE),) | 5 | snd-soc-sst-dsp-$(CONFIG_DW_DMAC_CORE) += sst-firmware.o |
6 | snd-soc-sst-dsp-objs += sst-firmware.o | ||
7 | endif | ||
8 | 6 | ||
9 | obj-$(CONFIG_SND_SOC_INTEL_SST) += snd-soc-sst-dsp.o snd-soc-sst-ipc.o | 7 | obj-$(CONFIG_SND_SOC_INTEL_SST) += snd-soc-sst-dsp.o snd-soc-sst-ipc.o |
10 | obj-$(CONFIG_SND_SOC_INTEL_SST_ACPI) += snd-soc-sst-acpi.o | 8 | obj-$(CONFIG_SND_SOC_INTEL_SST_ACPI) += snd-soc-sst-acpi.o |
11 | |||
diff --git a/sound/soc/intel/common/sst-acpi.c b/sound/soc/intel/common/sst-acpi.c index 67b6d3d52f57..7a85c576dad3 100644 --- a/sound/soc/intel/common/sst-acpi.c +++ b/sound/soc/intel/common/sst-acpi.c | |||
@@ -21,21 +21,12 @@ | |||
21 | #include <linux/platform_device.h> | 21 | #include <linux/platform_device.h> |
22 | 22 | ||
23 | #include "sst-dsp.h" | 23 | #include "sst-dsp.h" |
24 | #include "sst-acpi.h" | ||
24 | 25 | ||
25 | #define SST_LPT_DSP_DMA_ADDR_OFFSET 0x0F0000 | 26 | #define SST_LPT_DSP_DMA_ADDR_OFFSET 0x0F0000 |
26 | #define SST_WPT_DSP_DMA_ADDR_OFFSET 0x0FE000 | 27 | #define SST_WPT_DSP_DMA_ADDR_OFFSET 0x0FE000 |
27 | #define SST_LPT_DSP_DMA_SIZE (1024 - 1) | 28 | #define SST_LPT_DSP_DMA_SIZE (1024 - 1) |
28 | 29 | ||
29 | /* Descriptor for SST ASoC machine driver */ | ||
30 | struct sst_acpi_mach { | ||
31 | /* ACPI ID for the matching machine driver. Audio codec for instance */ | ||
32 | const u8 id[ACPI_ID_LEN]; | ||
33 | /* machine driver name */ | ||
34 | const char *drv_name; | ||
35 | /* firmware file name */ | ||
36 | const char *fw_filename; | ||
37 | }; | ||
38 | |||
39 | /* Descriptor for setting up SST platform data */ | 30 | /* Descriptor for setting up SST platform data */ |
40 | struct sst_acpi_desc { | 31 | struct sst_acpi_desc { |
41 | const char *drv_name; | 32 | const char *drv_name; |
@@ -88,28 +79,6 @@ static void sst_acpi_fw_cb(const struct firmware *fw, void *context) | |||
88 | return; | 79 | return; |
89 | } | 80 | } |
90 | 81 | ||
91 | static acpi_status sst_acpi_mach_match(acpi_handle handle, u32 level, | ||
92 | void *context, void **ret) | ||
93 | { | ||
94 | *(bool *)context = true; | ||
95 | return AE_OK; | ||
96 | } | ||
97 | |||
98 | static struct sst_acpi_mach *sst_acpi_find_machine( | ||
99 | struct sst_acpi_mach *machines) | ||
100 | { | ||
101 | struct sst_acpi_mach *mach; | ||
102 | bool found = false; | ||
103 | |||
104 | for (mach = machines; mach->id[0]; mach++) | ||
105 | if (ACPI_SUCCESS(acpi_get_devices(mach->id, | ||
106 | sst_acpi_mach_match, | ||
107 | &found, NULL)) && found) | ||
108 | return mach; | ||
109 | |||
110 | return NULL; | ||
111 | } | ||
112 | |||
113 | static int sst_acpi_probe(struct platform_device *pdev) | 82 | static int sst_acpi_probe(struct platform_device *pdev) |
114 | { | 83 | { |
115 | const struct acpi_device_id *id; | 84 | const struct acpi_device_id *id; |
@@ -211,7 +180,7 @@ static int sst_acpi_remove(struct platform_device *pdev) | |||
211 | } | 180 | } |
212 | 181 | ||
213 | static struct sst_acpi_mach haswell_machines[] = { | 182 | static struct sst_acpi_mach haswell_machines[] = { |
214 | { "INT33CA", "haswell-audio", "intel/IntcSST1.bin" }, | 183 | { "INT33CA", "haswell-audio", "intel/IntcSST1.bin", NULL, NULL, NULL }, |
215 | {} | 184 | {} |
216 | }; | 185 | }; |
217 | 186 | ||
@@ -229,7 +198,7 @@ static struct sst_acpi_desc sst_acpi_haswell_desc = { | |||
229 | }; | 198 | }; |
230 | 199 | ||
231 | static struct sst_acpi_mach broadwell_machines[] = { | 200 | static struct sst_acpi_mach broadwell_machines[] = { |
232 | { "INT343A", "broadwell-audio", "intel/IntcSST2.bin" }, | 201 | { "INT343A", "broadwell-audio", "intel/IntcSST2.bin", NULL, NULL, NULL }, |
233 | {} | 202 | {} |
234 | }; | 203 | }; |
235 | 204 | ||
@@ -247,8 +216,8 @@ static struct sst_acpi_desc sst_acpi_broadwell_desc = { | |||
247 | }; | 216 | }; |
248 | 217 | ||
249 | static struct sst_acpi_mach baytrail_machines[] = { | 218 | static struct sst_acpi_mach baytrail_machines[] = { |
250 | { "10EC5640", "byt-rt5640", "intel/fw_sst_0f28.bin-48kHz_i2s_master" }, | 219 | { "10EC5640", "byt-rt5640", "intel/fw_sst_0f28.bin-48kHz_i2s_master", NULL, NULL, NULL }, |
251 | { "193C9890", "byt-max98090", "intel/fw_sst_0f28.bin-48kHz_i2s_master" }, | 220 | { "193C9890", "byt-max98090", "intel/fw_sst_0f28.bin-48kHz_i2s_master", NULL, NULL, NULL }, |
252 | {} | 221 | {} |
253 | }; | 222 | }; |
254 | 223 | ||
diff --git a/sound/soc/intel/common/sst-acpi.h b/sound/soc/intel/common/sst-acpi.h new file mode 100644 index 000000000000..3ee3b7ab5d03 --- /dev/null +++ b/sound/soc/intel/common/sst-acpi.h | |||
@@ -0,0 +1,33 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2013-15, Intel Corporation. All rights reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License version | ||
6 | * 2 as published by the Free Software Foundation. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, | ||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | * | ||
13 | */ | ||
14 | |||
15 | #include <linux/acpi.h> | ||
16 | |||
17 | /* acpi match */ | ||
18 | struct sst_acpi_mach *sst_acpi_find_machine(struct sst_acpi_mach *machines); | ||
19 | |||
20 | /* Descriptor for SST ASoC machine driver */ | ||
21 | struct sst_acpi_mach { | ||
22 | /* ACPI ID for the matching machine driver. Audio codec for instance */ | ||
23 | const u8 id[ACPI_ID_LEN]; | ||
24 | /* machine driver name */ | ||
25 | const char *drv_name; | ||
26 | /* firmware file name */ | ||
27 | const char *fw_filename; | ||
28 | |||
29 | /* board name */ | ||
30 | const char *board; | ||
31 | void (*machine_quirk)(void); | ||
32 | void *pdata; | ||
33 | }; | ||
diff --git a/sound/soc/intel/common/sst-dsp-priv.h b/sound/soc/intel/common/sst-dsp-priv.h index 2151652d37b7..81aa1ed64201 100644 --- a/sound/soc/intel/common/sst-dsp-priv.h +++ b/sound/soc/intel/common/sst-dsp-priv.h | |||
@@ -243,7 +243,7 @@ struct sst_mem_block { | |||
243 | u32 size; /* block size */ | 243 | u32 size; /* block size */ |
244 | u32 index; /* block index 0..N */ | 244 | u32 index; /* block index 0..N */ |
245 | enum sst_mem_type type; /* block memory type IRAM/DRAM */ | 245 | enum sst_mem_type type; /* block memory type IRAM/DRAM */ |
246 | struct sst_block_ops *ops; /* block operations, if any */ | 246 | const struct sst_block_ops *ops;/* block operations, if any */ |
247 | 247 | ||
248 | /* block status */ | 248 | /* block status */ |
249 | u32 bytes_used; /* bytes in use by modules */ | 249 | u32 bytes_used; /* bytes in use by modules */ |
@@ -308,6 +308,8 @@ struct sst_dsp { | |||
308 | 308 | ||
309 | /* SKL data */ | 309 | /* SKL data */ |
310 | 310 | ||
311 | const char *fw_name; | ||
312 | |||
311 | /* To allocate CL dma buffers */ | 313 | /* To allocate CL dma buffers */ |
312 | struct skl_dsp_loader_ops dsp_ops; | 314 | struct skl_dsp_loader_ops dsp_ops; |
313 | struct skl_dsp_fw_ops fw_ops; | 315 | struct skl_dsp_fw_ops fw_ops; |
@@ -376,8 +378,8 @@ void sst_block_free_scratch(struct sst_dsp *dsp); | |||
376 | 378 | ||
377 | /* Register the DSPs memory blocks - would be nice to read from ACPI */ | 379 | /* Register the DSPs memory blocks - would be nice to read from ACPI */ |
378 | struct sst_mem_block *sst_mem_block_register(struct sst_dsp *dsp, u32 offset, | 380 | struct sst_mem_block *sst_mem_block_register(struct sst_dsp *dsp, u32 offset, |
379 | u32 size, enum sst_mem_type type, struct sst_block_ops *ops, u32 index, | 381 | u32 size, enum sst_mem_type type, const struct sst_block_ops *ops, |
380 | void *private); | 382 | u32 index, void *private); |
381 | void sst_mem_block_unregister_all(struct sst_dsp *dsp); | 383 | void sst_mem_block_unregister_all(struct sst_dsp *dsp); |
382 | 384 | ||
383 | /* Create/Free DMA resources */ | 385 | /* Create/Free DMA resources */ |
diff --git a/sound/soc/intel/common/sst-dsp.c b/sound/soc/intel/common/sst-dsp.c index c9452e02e0dd..b5bbdf4fe93a 100644 --- a/sound/soc/intel/common/sst-dsp.c +++ b/sound/soc/intel/common/sst-dsp.c | |||
@@ -420,7 +420,7 @@ void sst_dsp_inbox_read(struct sst_dsp *sst, void *message, size_t bytes) | |||
420 | } | 420 | } |
421 | EXPORT_SYMBOL_GPL(sst_dsp_inbox_read); | 421 | EXPORT_SYMBOL_GPL(sst_dsp_inbox_read); |
422 | 422 | ||
423 | #if IS_ENABLED(CONFIG_DW_DMAC_CORE) | 423 | #ifdef CONFIG_DW_DMAC_CORE |
424 | struct sst_dsp *sst_dsp_new(struct device *dev, | 424 | struct sst_dsp *sst_dsp_new(struct device *dev, |
425 | struct sst_dsp_device *sst_dev, struct sst_pdata *pdata) | 425 | struct sst_dsp_device *sst_dev, struct sst_pdata *pdata) |
426 | { | 426 | { |
diff --git a/sound/soc/intel/common/sst-dsp.h b/sound/soc/intel/common/sst-dsp.h index 859f0de00339..0b84c719ec48 100644 --- a/sound/soc/intel/common/sst-dsp.h +++ b/sound/soc/intel/common/sst-dsp.h | |||
@@ -216,7 +216,7 @@ struct sst_pdata { | |||
216 | void *dsp; | 216 | void *dsp; |
217 | }; | 217 | }; |
218 | 218 | ||
219 | #if IS_ENABLED(CONFIG_DW_DMAC_CORE) | 219 | #ifdef CONFIG_DW_DMAC_CORE |
220 | /* Initialization */ | 220 | /* Initialization */ |
221 | struct sst_dsp *sst_dsp_new(struct device *dev, | 221 | struct sst_dsp *sst_dsp_new(struct device *dev, |
222 | struct sst_dsp_device *sst_dev, struct sst_pdata *pdata); | 222 | struct sst_dsp_device *sst_dev, struct sst_pdata *pdata); |
diff --git a/sound/soc/intel/common/sst-firmware.c b/sound/soc/intel/common/sst-firmware.c index 1636a1eeb002..ef4881e7753a 100644 --- a/sound/soc/intel/common/sst-firmware.c +++ b/sound/soc/intel/common/sst-firmware.c | |||
@@ -51,8 +51,22 @@ struct sst_dma { | |||
51 | 51 | ||
52 | static inline void sst_memcpy32(volatile void __iomem *dest, void *src, u32 bytes) | 52 | static inline void sst_memcpy32(volatile void __iomem *dest, void *src, u32 bytes) |
53 | { | 53 | { |
54 | u32 tmp = 0; | ||
55 | int i, m, n; | ||
56 | const u8 *src_byte = src; | ||
57 | |||
58 | m = bytes / 4; | ||
59 | n = bytes % 4; | ||
60 | |||
54 | /* __iowrite32_copy use 32bit size values so divide by 4 */ | 61 | /* __iowrite32_copy use 32bit size values so divide by 4 */ |
55 | __iowrite32_copy((void *)dest, src, bytes/4); | 62 | __iowrite32_copy((void *)dest, src, m); |
63 | |||
64 | if (n) { | ||
65 | for (i = 0; i < n; i++) | ||
66 | tmp |= (u32)*(src_byte + m * 4 + i) << (i * 8); | ||
67 | __iowrite32_copy((void *)(dest + m * 4), &tmp, 1); | ||
68 | } | ||
69 | |||
56 | } | 70 | } |
57 | 71 | ||
58 | static void sst_dma_transfer_complete(void *arg) | 72 | static void sst_dma_transfer_complete(void *arg) |
@@ -1014,8 +1028,8 @@ EXPORT_SYMBOL_GPL(sst_module_runtime_restore); | |||
1014 | 1028 | ||
1015 | /* register a DSP memory block for use with FW based modules */ | 1029 | /* register a DSP memory block for use with FW based modules */ |
1016 | struct sst_mem_block *sst_mem_block_register(struct sst_dsp *dsp, u32 offset, | 1030 | struct sst_mem_block *sst_mem_block_register(struct sst_dsp *dsp, u32 offset, |
1017 | u32 size, enum sst_mem_type type, struct sst_block_ops *ops, u32 index, | 1031 | u32 size, enum sst_mem_type type, const struct sst_block_ops *ops, |
1018 | void *private) | 1032 | u32 index, void *private) |
1019 | { | 1033 | { |
1020 | struct sst_mem_block *block; | 1034 | struct sst_mem_block *block; |
1021 | 1035 | ||
diff --git a/sound/soc/intel/common/sst-match-acpi.c b/sound/soc/intel/common/sst-match-acpi.c new file mode 100644 index 000000000000..dd077e116d25 --- /dev/null +++ b/sound/soc/intel/common/sst-match-acpi.c | |||
@@ -0,0 +1,43 @@ | |||
1 | /* | ||
2 | * sst_match_apci.c - SST (LPE) match for ACPI enumeration. | ||
3 | * | ||
4 | * Copyright (c) 2013-15, Intel Corporation. | ||
5 | * | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify it | ||
8 | * under the terms and conditions of the GNU General Public License, | ||
9 | * version 2, as published by the Free Software Foundation. | ||
10 | * | ||
11 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
14 | * more details. | ||
15 | */ | ||
16 | #include <linux/acpi.h> | ||
17 | #include <linux/device.h> | ||
18 | #include <linux/module.h> | ||
19 | #include <linux/platform_device.h> | ||
20 | |||
21 | #include "sst-acpi.h" | ||
22 | |||
23 | static acpi_status sst_acpi_mach_match(acpi_handle handle, u32 level, | ||
24 | void *context, void **ret) | ||
25 | { | ||
26 | *(bool *)context = true; | ||
27 | return AE_OK; | ||
28 | } | ||
29 | |||
30 | struct sst_acpi_mach *sst_acpi_find_machine(struct sst_acpi_mach *machines) | ||
31 | { | ||
32 | struct sst_acpi_mach *mach; | ||
33 | bool found = false; | ||
34 | |||
35 | for (mach = machines; mach->id[0]; mach++) | ||
36 | if (ACPI_SUCCESS(acpi_get_devices(mach->id, | ||
37 | sst_acpi_mach_match, | ||
38 | &found, NULL)) && found) | ||
39 | return mach; | ||
40 | |||
41 | return NULL; | ||
42 | } | ||
43 | EXPORT_SYMBOL_GPL(sst_acpi_find_machine); | ||