[21/35] ASoC: Intel: Expose ACPI loading members
diff mbox series

Message ID 20190822190425.23001-22-cezary.rojewski@intel.com
State New
Headers show
Series
  • ASoC: Intel: Clenaup SST initialization
Related show

Commit Message

Cezary Rojewski Aug. 22, 2019, 7:04 p.m. UTC
No framework should know upfront about specifics of its inheriting
members. sst-acpi contains Baytrail and Haswell specific data. In order
to prevent circular dependency, it's compiled into separate module.

Let's do it right and obey inheritance rule. As a first step, elevate
sst-acpi members so they could be shared by Haswell and
Baytrail-specific handlers - this is to prevent code duplication.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
 sound/soc/intel/common/sst-acpi.c | 23 ++++-------------------
 sound/soc/intel/common/sst-dsp.h  | 21 +++++++++++++++++++++
 2 files changed, 25 insertions(+), 19 deletions(-)

Comments

Pierre-Louis Bossart Aug. 23, 2019, 7:32 p.m. UTC | #1
> diff --git a/sound/soc/intel/common/sst-dsp.h b/sound/soc/intel/common/sst-dsp.h
> index 63c29bb45cf1..a2ac7998fbdb 100644
> --- a/sound/soc/intel/common/sst-dsp.h
> +++ b/sound/soc/intel/common/sst-dsp.h
> @@ -166,6 +166,27 @@
>   #define SST_PMCS_PS_MASK	0x3
>   
>   struct sst_dsp;
> +struct platform_device;

that should be handled with an include, not redefining a type here.

> +
> +/* Descriptor for setting up SST platform data */
> +struct sst_acpi_desc {
> +	const char *drv_name;
> +	struct snd_soc_acpi_mach *machines;
> +	/* Platform resource indexes. Must set to -1 if not used */
> +	int resindex_lpe_base;
> +	int resindex_pcicfg_base;
> +	int resindex_fw_base;
> +	int irqindex_host_ipc;
> +	int resindex_dma_base;
> +	/* Unique number identifying the SST core on platform */
> +	int sst_id;
> +	/* DMA only valid when resindex_dma_base != -1*/
> +	int dma_engine;
> +	int dma_size;
> +};
> +
> +int sst_acpi_probe(struct platform_device *pdev);
> +int sst_acpi_remove(struct platform_device *pdev);
>   
>   /*
>    * SST Platform Data.
>
Cezary Rojewski Aug. 24, 2019, 9:58 a.m. UTC | #2
On 2019-08-23 21:32, Pierre-Louis Bossart wrote:
> 
>> diff --git a/sound/soc/intel/common/sst-dsp.h 
>> b/sound/soc/intel/common/sst-dsp.h
>> index 63c29bb45cf1..a2ac7998fbdb 100644
>> --- a/sound/soc/intel/common/sst-dsp.h
>> +++ b/sound/soc/intel/common/sst-dsp.h
>> @@ -166,6 +166,27 @@
>>   #define SST_PMCS_PS_MASK    0x3
>>   struct sst_dsp;
>> +struct platform_device;
> 
> that should be handled with an include, not redefining a type here.
> 

Ack.

>> +
>> +/* Descriptor for setting up SST platform data */
>> +struct sst_acpi_desc {
>> +    const char *drv_name;
>> +    struct snd_soc_acpi_mach *machines;
>> +    /* Platform resource indexes. Must set to -1 if not used */
>> +    int resindex_lpe_base;
>> +    int resindex_pcicfg_base;
>> +    int resindex_fw_base;
>> +    int irqindex_host_ipc;
>> +    int resindex_dma_base;
>> +    /* Unique number identifying the SST core on platform */
>> +    int sst_id;
>> +    /* DMA only valid when resindex_dma_base != -1*/
>> +    int dma_engine;
>> +    int dma_size;
>> +};
>> +
>> +int sst_acpi_probe(struct platform_device *pdev);
>> +int sst_acpi_remove(struct platform_device *pdev);
>>   /*
>>    * SST Platform Data.
>>

Patch
diff mbox series

diff --git a/sound/soc/intel/common/sst-acpi.c b/sound/soc/intel/common/sst-acpi.c
index 0e8e0a7a11df..42f9b02f2ea3 100644
--- a/sound/soc/intel/common/sst-acpi.c
+++ b/sound/soc/intel/common/sst-acpi.c
@@ -19,23 +19,6 @@ 
 #define SST_WPT_DSP_DMA_ADDR_OFFSET	0x0FE000
 #define SST_LPT_DSP_DMA_SIZE		(1024 - 1)
 
-/* Descriptor for setting up SST platform data */
-struct sst_acpi_desc {
-	const char *drv_name;
-	struct snd_soc_acpi_mach *machines;
-	/* Platform resource indexes. Must set to -1 if not used */
-	int resindex_lpe_base;
-	int resindex_pcicfg_base;
-	int resindex_fw_base;
-	int irqindex_host_ipc;
-	int resindex_dma_base;
-	/* Unique number identifying the SST core on platform */
-	int sst_id;
-	/* DMA only valid when resindex_dma_base != -1*/
-	int dma_engine;
-	int dma_size;
-};
-
 struct sst_acpi_priv {
 	struct platform_device *pdev_mach;
 	struct platform_device *pdev_pcm;
@@ -71,7 +54,7 @@  static void sst_acpi_fw_cb(const struct firmware *fw, void *context)
 	return;
 }
 
-static int sst_acpi_probe(struct platform_device *pdev)
+int sst_acpi_probe(struct platform_device *pdev)
 {
 	const struct acpi_device_id *id;
 	struct device *dev = &pdev->dev;
@@ -157,8 +140,9 @@  static int sst_acpi_probe(struct platform_device *pdev)
 
 	return ret;
 }
+EXPORT_SYMBOL_GPL(sst_acpi_probe);
 
-static int sst_acpi_remove(struct platform_device *pdev)
+int sst_acpi_remove(struct platform_device *pdev)
 {
 	struct sst_acpi_priv *sst_acpi = platform_get_drvdata(pdev);
 	struct sst_pdata *sst_pdata = &sst_acpi->sst_pdata;
@@ -170,6 +154,7 @@  static int sst_acpi_remove(struct platform_device *pdev)
 
 	return 0;
 }
+EXPORT_SYMBOL_GPL(sst_acpi_remove);
 
 static struct sst_acpi_desc sst_acpi_haswell_desc = {
 	.drv_name = "haswell-pcm-audio",
diff --git a/sound/soc/intel/common/sst-dsp.h b/sound/soc/intel/common/sst-dsp.h
index 63c29bb45cf1..a2ac7998fbdb 100644
--- a/sound/soc/intel/common/sst-dsp.h
+++ b/sound/soc/intel/common/sst-dsp.h
@@ -166,6 +166,27 @@ 
 #define SST_PMCS_PS_MASK	0x3
 
 struct sst_dsp;
+struct platform_device;
+
+/* Descriptor for setting up SST platform data */
+struct sst_acpi_desc {
+	const char *drv_name;
+	struct snd_soc_acpi_mach *machines;
+	/* Platform resource indexes. Must set to -1 if not used */
+	int resindex_lpe_base;
+	int resindex_pcicfg_base;
+	int resindex_fw_base;
+	int irqindex_host_ipc;
+	int resindex_dma_base;
+	/* Unique number identifying the SST core on platform */
+	int sst_id;
+	/* DMA only valid when resindex_dma_base != -1*/
+	int dma_engine;
+	int dma_size;
+};
+
+int sst_acpi_probe(struct platform_device *pdev);
+int sst_acpi_remove(struct platform_device *pdev);
 
 /*
  * SST Platform Data.