ASoC: Intel: ACPI support and machines
Subsystems (3)
v3 cover ASoC: Intel: ACPI support and machines
This is third rev of patch series which fixes the modules split as discussed in ML. The core part is now module along with PCI and ACPI one. Added fix reported by Dan as well. Also added the BYTCR machine driver and MERR machine driver
Updates in v3:
- Fix export fo few more symbols
- fix cleanup of probe and setup code
- add MERR machine code
Subhransu S. Prusty (1):
ASoC: Intel: add BYTCR machine driver with RT5640
Vinod Koul (5):
ASoC: Intel: mrfld - remove unnecessary check for pointer
ASoC: Intel: mrfld - create separate module for pci part
ASoC: Intel: mrfld - add shim save restore
ASoC: Intel: mrfld- add ACPI module
ASoC: Intel: Add Merrifield machine driver
sound/soc/intel/Kconfig | 37 +++- sound/soc/intel/Makefile | 4 + sound/soc/intel/bytcr_dpcm_rt5640.c | 258 ++++++++++++++++++++++ sound/soc/intel/merr_dpcm_wm8958.c | 416 +++++++++++++++++++++++++++++++++++ sound/soc/intel/sst-atom-controls.c | 2 +- sound/soc/intel/sst/Makefile | 8 +- sound/soc/intel/sst/sst.c | 254 +++++---------------- sound/soc/intel/sst/sst.h | 9 +- sound/soc/intel/sst/sst_acpi.c | 377 +++++++++++++++++++++++++++++++ sound/soc/intel/sst/sst_pci.c | 209 ++++++++++++++++++ sound/soc/intel/sst/sst_pvt.c | 3 + 11 files changed, 1378 insertions(+), 199 deletions(-) create mode 100644 sound/soc/intel/bytcr_dpcm_rt5640.c create mode 100644 sound/soc/intel/merr_dpcm_wm8958.c create mode 100644 sound/soc/intel/sst/sst_acpi.c create mode 100644 sound/soc/intel/sst/sst_pci.c
PATCH v3 1/6 ASoC: Intel: mrfld - remove unnecessary check for pointer
the 'platform' pointer in sst_map_modules_to_pipe() is deref in caller function so we need to check for it in this function
--- sound/soc/intel/sst-atom-controls.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
sound/soc/intel/sst-atom-controls.c +1 -1
@@ -1351,7 +1351,7 @@ static int sst_map_modules_to_pipe(struct snd_soc_platform *platform)int ret =0 ;list_for_each_entry (w, &platform->component.card->widgets, list) { -if (platform &&is_sst_dapm_widget (w) && (w->priv)) { +if (is_sst_dapm_widget (w) && (w->priv)) {struct sst_ids *ids = w->priv; dev_dbg(platform->dev, "widget type=%d name=%s\n",
Signature · 1 line
1.7.0.4
Re: [PATCH v3 1/6] ASoC: Intel: mrfld - remove unnecessary check for pointer
Quoted 2 lines · Vinod Koul
the 'platform' pointer in
sst_map_modules_to_pipe()is deref in caller function so we need to check for it in this function
Applied, thanks.
PATCH v3 2/6 ASoC: Intel: mrfld - create separate module for pci part
In reply to Vinod KoulNow the SST_IPC will support both ACPI and PCI, separate into core module and PCI module. This also move probe function into PCI module and exports the required symbols from core module
--- sound/soc/intel/Kconfig | 6 +- sound/soc/intel/sst/Makefile | 8 +- sound/soc/intel/sst/sst.c | 212 +++------------------------------------- sound/soc/intel/sst/sst.h | 6 + sound/soc/intel/sst/sst_pci.c | 209 ++++++++++++++++++++++++++++++++++++++++ sound/soc/intel/sst/sst_pvt.c | 1 + 6 files changed, 243 insertions(+), 199 deletions(-) create mode 100644 sound/soc/intel/sst/sst_pci.c
sound/soc/intel/Kconfig +5 -1
@@ -3,7 +3,7 @@ config SND_MFLD_MACHINE depends on INTEL_SCU_IPC select SND_SOC_SN95031 select SND_SST_MFLD_PLATFORM - select SND_SST_IPC + select SND_SST_IPC_PCI help This adds support for ASoC machine driver for Intel(R) MID Medfield platform used as alsa device in audio substem in Intel(R) MID devices
@@ -16,6 +16,10 @@ config SND_SST_MFLD_PLATFORM config SND_SST_IPC tristate +config SND_SST_IPC_PCI + tristate + select SND_SST_IPC + config SND_SOC_INTEL_SST tristate "ASoC support for Intel(R) Smart Sound Technology" select SND_SOC_INTEL_SST_ACPI if ACPI
sound/soc/intel/sst/Makefile +6 -2
@@ -1,3 +1,7 @@ -snd-intel-sst-objs := sst.o sst_ipc.o sst_stream.o sst_drv_interface.o sst_loader.o sst_pvt.o +snd-intel-sst-core-objs := sst.o sst_ipc.o sst_stream.o sst_drv_interface.o sst_loader.o sst_pvt.o +snd-intel-sst-pci-objs += sst_pci.o + + +obj-$(CONFIG_SND_SST_IPC) += snd-intel-sst-core.o +obj-$(CONFIG_SND_SST_IPC_PCI) += snd-intel-sst-pci.o -obj-$(CONFIG_SND_SST_IPC) += snd-intel-sst.o
sound/soc/intel/sst/sst.c +16 -196
268 lines not on this page · raw message
sound/soc/intel/sst/sst.h +6 -0
@@ -40,6 +40,7 @@#define MRFLD_FW_FEATURE_BASE_OFFSET 0x4#define MRFLD_FW_BSS_RESET_BIT 0 +extern const struct dev_pm_ops intel_sst_pm;enum sst_states {SST_FW_LOADING =1 ,SST_FW_RUNNING ,
@@ -537,4 +538,9 @@ void sst_fill_header_dsp(struct ipc_dsp_hdr *dsp, int msg,int sst_register (struct device *);int sst_unregister (struct device *); +int sst_alloc_drv_context (struct intel_sst_drv **ctx, +struct device *dev,unsigned int dev_id); +int sst_context_init (struct intel_sst_drv *ctx); +void sst_context_cleanup (struct intel_sst_drv *ctx); +void sst_configure_runtime_pm (struct intel_sst_drv *ctx);#endif
sound/soc/intel/sst/sst_pci.c new file +209 -0
209 lines not on this page · raw message
sound/soc/intel/sst/sst_pvt.c +1 -0
@@ -433,6 +433,7 @@ u32 relocate_imr_addr_mrfld(u32 base_addr) base_addr =MRFLD_FW_VIRTUAL_BASE + (base_addr % (512 *1024 *1024 ));return base_addr; } +EXPORT_SYMBOL_GPL (relocate_imr_addr_mrfld);void sst_add_to_dispatch_list_and_post (struct intel_sst_drv *sst,struct ipc_post *msg)
Signature · 1 line
1.7.0.4
Re: [PATCH v3 2/6] ASoC: Intel: mrfld - create separate module for pci part
Quoted 3 lines · Vinod Koul
Now the
SST_IPCwill support both ACPI and PCI, separate into core module and PCI module. This also move probe function into PCI module and exports the required symbols from core module
Applied, thanks.
PATCH v3 3/6 ASoC: Intel: mrfld - add shim save restore
In reply to Vinod KoulIn ACPI platform we need to save few registers of Shim on suspend and restore them on resume, so add handlers to do this
--- sound/soc/intel/sst/sst.c | 28 ++++++++++++++++++++++++++++ 1 files changed, 28 insertions(+), 0 deletions(-)
sound/soc/intel/sst/sst.c +28 -0
@@ -339,6 +339,34 @@ void sst_context_cleanup(struct intel_sst_drv *ctx) }EXPORT_SYMBOL_GPL (sst_context_cleanup); +static inline void sst_save_shim64 (struct intel_sst_drv *ctx, +void __iomem *shim, +struct sst_shim_regs64 *shim_regs) +{ +unsigned long irq_flags; + +spin_lock_irqsave (&ctx->ipc_spin_lock, irq_flags); + + shim_regs->imrx =sst_shim_read64 (shim,SST_IMRX ), + +spin_unlock_irqrestore (&ctx->ipc_spin_lock, irq_flags); +} + +static inline void sst_restore_shim64 (struct intel_sst_drv *ctx, +void __iomem *shim, +struct sst_shim_regs64 *shim_regs) +{ +unsigned long irq_flags; + +/* +* we only need to restore IMRX for this case, rest will be +* initialize by FW or driver when firmware is loaded +*/ +spin_lock_irqsave (&ctx->ipc_spin_lock, irq_flags); +sst_shim_write64 (shim,SST_IMRX , shim_regs->imrx), +spin_unlock_irqrestore (&ctx->ipc_spin_lock, irq_flags); +} +void sst_configure_runtime_pm (struct intel_sst_drv *ctx) {pm_runtime_set_autosuspend_delay (ctx->dev,SST_SUSPEND_DELAY );
Signature · 1 line
1.7.0.4
Re: [PATCH v3 3/6] ASoC: Intel: mrfld - add shim save restore
Quoted 2 lines · Vinod Koul
In ACPI platform we need to save few registers of Shim on suspend and restore them on resume, so add handlers to do this
Applied, thanks.
PATCH v3 4/6 ASoC: Intel: mrfld- add ACPI module
In reply to Vinod KoulAdd the last ACPI module support which also uses core module like the PCI part
--- sound/soc/intel/Kconfig | 4 + sound/soc/intel/sst/Makefile | 4 +- sound/soc/intel/sst/sst.c | 20 ++ sound/soc/intel/sst/sst.h | 3 +- sound/soc/intel/sst/sst_acpi.c | 377 ++++++++++++++++++++++++++++++++++++++++ sound/soc/intel/sst/sst_pvt.c | 2 + 6 files changed, 406 insertions(+), 4 deletions(-) create mode 100644 sound/soc/intel/sst/sst_acpi.c
sound/soc/intel/Kconfig +4 -0
@@ -20,6 +20,10 @@ config SND_SST_IPC_PCI tristate select SND_SST_IPC +config SND_SST_IPC_ACPI + tristate + select SND_SST_IPC + config SND_SOC_INTEL_SST tristate "ASoC support for Intel(R) Smart Sound Technology" select SND_SOC_INTEL_SST_ACPI if ACPI
sound/soc/intel/sst/Makefile +2 -2
@@ -1,7 +1,7 @@ snd-intel-sst-core-objs := sst.o sst_ipc.o sst_stream.o sst_drv_interface.o sst_loader.o sst_pvt.o snd-intel-sst-pci-objs += sst_pci.o - +snd-intel-sst-acpi-objs += sst_acpi.o obj-$(CONFIG_SND_SST_IPC) += snd-intel-sst-core.o obj-$(CONFIG_SND_SST_IPC_PCI) += snd-intel-sst-pci.o - +obj-$(CONFIG_SND_SST_IPC_ACPI) += snd-intel-sst-acpi.o
sound/soc/intel/sst/sst.c +20 -0
@@ -181,6 +181,7 @@ int sst_driver_ops(struct intel_sst_drv *sst)switch (sst->dev_id) {case SST_MRFLD_PCI_ID : +case SST_BYT_ACPI_ID : sst->tstamp =SST_TIME_STAMP_MRFLD ; sst->ops = &mrfld_ops;return 0 ;
@@ -323,7 +324,11 @@ EXPORT_SYMBOL_GPL(sst_context_init);void sst_context_cleanup (struct intel_sst_drv *ctx) {pm_runtime_get_noresume (ctx->dev); +#if IS_ENABLED (CONFIG_ACPI ) +pm_runtime_disable (ctx->dev); +#else pm_runtime_forbid (ctx->dev); +#endif sst_unregister (ctx->dev);sst_set_fw_state_locked (ctx,SST_SHUTDOWN );flush_scheduled_work ();
@@ -371,8 +376,19 @@ void sst_configure_runtime_pm(struct intel_sst_drv *ctx) {pm_runtime_set_autosuspend_delay (ctx->dev,SST_SUSPEND_DELAY );pm_runtime_use_autosuspend (ctx->dev); +#if IS_ENABLED (CONFIG_ACPI ) +/* +* For acpi devices, the actual physical device state is +* initially active. So change the state to active before +* enabling the pm +*/ +pm_runtime_set_active (ctx->dev); +pm_runtime_enable (ctx->dev); +sst_save_shim64 (ctx, ctx->shim, ctx->shim_regs64); +#else pm_runtime_allow (ctx->dev);pm_runtime_put_noidle (ctx->dev); +#endif }EXPORT_SYMBOL_GPL (sst_configure_runtime_pm);
@@ -395,6 +411,10 @@ static int intel_sst_runtime_suspend(struct device *dev)synchronize_irq (ctx->irq_num);flush_workqueue (ctx->post_msg_wq); +/* save the shim registers because PMC doesn't save state */ +if (ctx->dev_id ==SST_BYT_ACPI_ID ) +sst_save_shim64 (ctx, ctx->shim, ctx->shim_regs64); +return ret; }
sound/soc/intel/sst/sst.h +1 -2
@@ -29,6 +29,7 @@/* driver names */ #define SST_DRV_NAME "intel_sst_driver"#define SST_MRFLD_PCI_ID 0x119A +#define SST_BYT_ACPI_ID 0x80860F28#define SST_SUSPEND_DELAY 2000#define FW_CONTEXT_MEM (64*1024)
@@ -508,8 +509,6 @@ int sst_prepare_and_post_msg(struct intel_sst_drv *sst, size_t mbox_data_len, const void *mbox_data, void **data, bool large, bool fill_dsp, bool sync, bool response); -void sst_save_shim64 (struct intel_sst_drv *ctx,void __iomem *shim, -struct sst_shim_regs64 *shim_regs);void sst_process_pending_msg (struct work_struct *work);int sst_assign_pvt_id (struct intel_sst_drv *sst_drv_ctx); void sst_init_stream(struct stream_info *stream,
sound/soc/intel/sst/sst_acpi.c new file +377 -0
377 lines not on this page · raw message
sound/soc/intel/sst/sst_pvt.c +2 -0
@@ -117,6 +117,7 @@ unsigned long long read_shim_data(struct intel_sst_drv *sst, int addr)switch (sst->dev_id) {case SST_MRFLD_PCI_ID : +case SST_BYT_ACPI_ID : val =sst_shim_read64 (sst->shim, addr);break ; }
@@ -128,6 +129,7 @@ void write_shim_data(struct intel_sst_drv *sst, int addr, {switch (sst->dev_id) {case SST_MRFLD_PCI_ID : +case SST_BYT_ACPI_ID :sst_shim_write64 (sst->shim, addr, (u64 ) data);break ; }
Signature · 1 line
1.7.0.4
Mark Brown
maintainerRe: [PATCH v3 4/6] ASoC: Intel: mrfld- add ACPI module
sound/soc/intel/sst/sst.c EXPORT_SYMBOL_GPL(sst_context_init); · line 334
Quoted 12 lines · Vinod Koul
sound/soc/intel/sst/sst.c +4
-0@@ -323,7 +324,11 @@ EXPORT_SYMBOL_GPL(sst_context_init);void sst_context_cleanup (struct intel_sst_drv *ctx) {pm_runtime_get_noresume (ctx->dev); +#if IS_ENABLED (CONFIG_ACPI ) +pm_runtime_disable (ctx->dev); +#else pm_runtime_forbid (ctx->dev); +#endif sst_unregister (ctx->dev);sst_set_fw_state_locked (ctx,SST_SHUTDOWN );flush_scheduled_work ();
No, we should be able to build a kernel which runs with or without ACPI
- make this a runtime check if it's required (a comment might be in order too since this is a weird thing to do).
Quoted 7 lines
sound/soc/intel/sst/sst.c +3
-0@@ -371,8 +376,19 @@ void sst_configure_runtime_pm(struct intel_sst_drv *ctx) {pm_runtime_set_autosuspend_delay (ctx->dev,SST_SUSPEND_DELAY );pm_runtime_use_autosuspend (ctx->dev); +#if IS_ENABLED (CONFIG_ACPI ) +/* +* For acpi devices, the actual physical device state is
sound/soc/intel/sst/sst.c void sst_configure_runtime_pm(struct intel_sst_drv *ctx) · line 391
Quoted 10 lines
sound/soc/intel/sst/sst.c +8
-0+* initially active. So change the state to active before +* enabling the pm +*/ +pm_runtime_set_active (ctx->dev); +pm_runtime_enable (ctx->dev); +sst_save_shim64 (ctx, ctx->shim, ctx->shim_regs64); +#else pm_runtime_allow (ctx->dev);pm_runtime_put_noidle (ctx->dev); +#endif
The general idiom for runtime PM is that we should default to bringing the device to power up anyway, that way the kernel continues to work if runtime PM has been disabled.
sound/soc/intel/sst/sst.c static int intel_sst_runtime_suspend(struct device *dev) · line 416
Quoted 3 lines
sound/soc/intel/sst/sst.c +3
-0+/* save the shim registers because PMC doesn't save state */ +if (ctx->dev_id ==SST_BYT_ACPI_ID ) +sst_save_shim64 (ctx, ctx->shim, ctx->shim_regs64);
Is there any harm in doing this unconditionally?
Quoted 8 lines
sound/soc/intel/sst/sst_acpi.c new file +8
-0+static acpi_status sst_acpi_mach_match (acpi_handle handle,u32 level, +void *context,void **ret) +{ + *(bool *)context = true; +return AE_OK ; +} + +static struct sst_machines *sst_acpi_find_machine(
sound/soc/intel/sst/sst_acpi.c line 235
Quoted 10 lines
sound/soc/intel/sst/sst_acpi.c new file +10
-0+ struct sst_machines *machines) +{ +struct sst_machines *mach; +bool found = false; + +for (mach = machines; mach->codec_id; mach++) +if (ACPI_SUCCESS (acpi_get_devices (mach->codec_id, + sst_acpi_mach_match, + &found,NULL )) && found) +return mach;
acpi_get_devices() seems painful.
sound/soc/intel/sst/sst_acpi.c line 347
Quoted 11 lines
sound/soc/intel/sst/sst_acpi.c new file +11
-0+#else +int sst_acpi_probe (struct platform_device *pdev) +{ +return -EINVAL ; +} + +int sst_acpi_remove (struct platform_device *pdev) +{ +return -EINVAL ; +} +#endif
Why not just not build this file if !CONFIG_ACPI?
sound/soc/intel/sst/sst_acpi.c line 353
Quoted 5 lines
sound/soc/intel/sst/sst_acpi.c new file +5
-0+static struct sst_machines sst_acpi_bytcr[] = { + {"10EC5640" ,"T100" ,"bytt100_rt5640" ,NULL ,"fw_sst_0f28.bin" , + &byt_rvp_platform_data }, + {}, +};
Yay. Much win. Not that there's much that can be done at this point.
Re: [PATCH v3 4/6] ASoC: Intel: mrfld- add ACPI module
Quoted 18 lines · Mark Brown
sound/soc/intel/sst/sst.c EXPORT_SYMBOL_GPL(sst_context_init); · line 334
Quoted 12 lines · Vinod Koul
sound/soc/intel/sst/sst.c +4
-0@@ -323,7 +324,11 @@ EXPORT_SYMBOL_GPL(sst_context_init);void sst_context_cleanup (struct intel_sst_drv *ctx) {pm_runtime_get_noresume (ctx->dev); +#if IS_ENABLED (CONFIG_ACPI ) +pm_runtime_disable (ctx->dev); +#else pm_runtime_forbid (ctx->dev); +#endif sst_unregister (ctx->dev);sst_set_fw_state_locked (ctx,SST_SHUTDOWN );flush_scheduled_work ();No, we should be able to build a kernel which runs with or without ACPI
- make this a runtime check if it's required (a comment might be in order too since this is a weird thing to do).
yes that is doable by adding a parameter and setting that in specfic probe, will add.
Quoted 14 lines
Quoted 14 lines
sound/soc/intel/sst/sst.c +9
-0@@ -371,8 +376,19 @@ void sst_configure_runtime_pm(struct intel_sst_drv *ctx) {pm_runtime_set_autosuspend_delay (ctx->dev,SST_SUSPEND_DELAY );pm_runtime_use_autosuspend (ctx->dev); +#if IS_ENABLED (CONFIG_ACPI ) +/* +* For acpi devices, the actual physical device state is +* initially active. So change the state to active before +* enabling the pm +*/ +pm_runtime_set_active (ctx->dev); +pm_runtime_enable (ctx->dev); +sst_save_shim64 (ctx, ctx->shim, ctx->shim_regs64);
Quoted 8 lines
sound/soc/intel/sst/sst.c void sst_configure_runtime_pm(struct intel_sst_drv *ctx) · line 391
Quoted 4 lines
sound/soc/intel/sst/sst.c +2
-0+#else pm_runtime_allow (ctx->dev);pm_runtime_put_noidle (ctx->dev); +#endif The general idiom for runtime PM is that we should default to bringing the device to power up anyway, that way the kernel continues to work if runtime PM has been disabled.
ok
Quoted 6 lines
sound/soc/intel/sst/sst.c static int intel_sst_runtime_suspend(struct device *dev) · line 416
Quoted 4 lines
sound/soc/intel/sst/sst.c +3
-0+/* save the shim registers because PMC doesn't save state */ +if (ctx->dev_id ==SST_BYT_ACPI_ID ) +sst_save_shim64 (ctx, ctx->shim, ctx->shim_regs64);Is there any harm in doing this unconditionally?
Shouldnt be, let me verify
Quoted 22 lines
Quoted 9 lines
sound/soc/intel/sst/sst_acpi.c new file +8
-0+static acpi_status sst_acpi_mach_match (acpi_handle handle,u32 level, +void *context,void **ret) +{ + *(bool *)context = true; +return AE_OK ; +} + +static struct sst_machines *sst_acpi_find_machine(sound/soc/intel/sst/sst_acpi.c line 235
Quoted 10 lines
sound/soc/intel/sst/sst_acpi.c new file +10
-0+ struct sst_machines *machines) +{ +struct sst_machines *mach; +bool found = false; + +for (mach = machines; mach->codec_id; mach++) +if (ACPI_SUCCESS (acpi_get_devices (mach->codec_id, + sst_acpi_mach_match, + &found,NULL )) && found) +return mach;
acpi_get_devices()seems painful.
Quoted 13 lines
sound/soc/intel/sst/sst_acpi.c line 347
Quoted 11 lines
sound/soc/intel/sst/sst_acpi.c new file +11
-0+#else +int sst_acpi_probe (struct platform_device *pdev) +{ +return -EINVAL ; +} + +int sst_acpi_remove (struct platform_device *pdev) +{ +return -EINVAL ; +} +#endif Why not just not build this file if !CONFIG_ACPI?
Yes, anway this is only for ACPI systems.
Quoted 8 lines
sound/soc/intel/sst/sst_acpi.c line 353
Quoted 6 lines
sound/soc/intel/sst/sst_acpi.c new file +5
-0+static struct sst_machines sst_acpi_bytcr[] = { + {"10EC5640" ,"T100" ,"bytt100_rt5640" ,NULL ,"fw_sst_0f28.bin" , + &byt_rvp_platform_data }, + {}, +};Yay. Much win. Not that there's much that can be done at this point.
Yup, hopefully _DSD migration will help us here
Signature · 1 line
~Vinod
Mark Brown
maintainerRe: [PATCH v3 4/6] ASoC: Intel: mrfld- add ACPI module
Quoted 9 lines · Vinod Koul
Quoted 5 lines · Mark Brown
On Tue, Nov 04, 2014 at 04:25:18PM +0530, Vinod Koul wrote:
No, we should be able to build a kernel which runs with or without ACPI
- make this a runtime check if it's required (a comment might be in order too since this is a weird thing to do).yes that is doable by adding a parameter and setting that in specfic probe, will add.
There's a variable acpi_disabled you can check.
Re: [PATCH v3 4/6] ASoC: Intel: mrfld- add ACPI module
Quoted 4 lines · Mark Brown
Quoted 2 lines · Vinod Koul
Quoted 1 line · Mark Brown
On Tue, Nov 04, 2014 at 04:25:18PM +0530, Vinod Koul wrote:
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
No, we should be able to build a kernel which runs with or without ACPI
- make this a runtime check if it's required (a comment might be in order too since this is a weird thing to do).yes that is doable by adding a parameter and setting that in specfic probe, will add.
There's a variable
acpi_disabledyou can check.
Thanks, thats a very good suggestion indeed :)
Signature · 1 line
~Vinod
PATCH v3 5/6 ASoC: Intel: add BYTCR machine driver with RT5640
In reply to Vinod KoulFrom: Subhransu S. Prusty <[email protected]>
--- sound/soc/intel/Kconfig | 12 ++ sound/soc/intel/Makefile | 2 + sound/soc/intel/bytcr_dpcm_rt5640.c | 258 +++++++++++++++++++++++++++++++++++ 3 files changed, 272 insertions(+), 0 deletions(-) create mode 100644 sound/soc/intel/bytcr_dpcm_rt5640.c
sound/soc/intel/Kconfig +12 -0
@@ -85,3 +85,15 @@ config SND_SOC_INTEL_BROADWELL_MACH Ultrabook platforms. Say Y if you have such a device If unsure select "N". + +config SND_SOC_INTEL_BYTCR_RT5640_MACH + tristate "ASoC Audio DSP Support for MID BYT Platform" + depends on X86 + select SND_SOC_RT5640 + select SND_SST_MFLD_PLATFORM + select SND_SST_IPC_ACPI + help + This adds support for ASoC machine driver for Intel(R) MID Baytrail platform + used as alsa device in audio substem in Intel(R) MID devices + Say Y if you have such a device + If unsure select "N".
sound/soc/intel/Makefile +2 -0
@@ -26,11 +26,13 @@ snd-soc-sst-haswell-objs := haswell.o snd-soc-sst-byt-rt5640-mach-objs := byt-rt5640.o snd-soc-sst-byt-max98090-mach-objs := byt-max98090.o snd-soc-sst-broadwell-objs := broadwell.o +snd-soc-sst-bytcr-dpcm-rt5640-objs := bytcr_dpcm_rt5640.o obj-$(CONFIG_SND_SOC_INTEL_HASWELL_MACH) += snd-soc-sst-haswell.o obj-$(CONFIG_SND_SOC_INTEL_BYT_RT5640_MACH) += snd-soc-sst-byt-rt5640-mach.o obj-$(CONFIG_SND_SOC_INTEL_BYT_MAX98090_MACH) += snd-soc-sst-byt-max98090-mach.o obj-$(CONFIG_SND_SOC_INTEL_BROADWELL_MACH) += snd-soc-sst-broadwell.o +obj-$(CONFIG_SND_SOC_INTEL_BYTCR_RT5640_MACH) += snd-soc-sst-bytcr-dpcm-rt5640.o # DSP driver obj-$(CONFIG_SND_SST_IPC) += sst/
sound/soc/intel/bytcr_dpcm_rt5640.c new file +258 -0
258 lines not on this page · raw message
Signature · 1 line
1.7.0.4
Mark Brown
maintainerRe: [PATCH v3 5/6] ASoC: Intel: add BYTCR machine driver with RT5640
sound/soc/intel/bytcr_dpcm_rt5640.c line 76
Quoted 9 lines · Vinod Koul
sound/soc/intel/bytcr_dpcm_rt5640.c new file +9
-0+static int byt_aif1_hw_params (struct snd_pcm_substream *substream, +struct snd_pcm_hw_params *params) +{ +struct snd_soc_pcm_runtime *rtd = substream->private_data; +struct snd_soc_dai *codec_dai = rtd->codec_dai; +int ret; + +if (strncmp (codec_dai->name,"rt5640-aif1" ,11 )) +return 0 ;
This looks wrong... fairly sure I queried this on an earlier version of the patch and was told it wasn't required.
sound/soc/intel/bytcr_dpcm_rt5640.c line 85
Quoted 8 lines
sound/soc/intel/bytcr_dpcm_rt5640.c new file +8
-0+ ret =snd_soc_dai_set_sysclk (codec_dai,RT5640_SCLK_S_PLL1 , +params_rate (params) *512 , +SND_SOC_CLOCK_IN ); +if (ret <0 ) { +dev_err (rtd->dev,"can't set codec clock %d\n" , ret); +return ret; + } + ret = snd_soc_dai_set_pll(codec_dai, 0, RT5640_PLL1_S_BCLK1,
Missing blank line here and in several places throughout the file. I'd expect the PLL to be enabled before the sysclk is told to use it, error checking might kick in otherwise.
Quoted 10 lines
sound/soc/intel/bytcr_dpcm_rt5640.c new file +10
-0+#ifdef CONFIG_PM_SLEEP +static int snd_byt_prepare (struct device *dev) +{ +return snd_soc_suspend (dev); +} + +static void snd_byt_complete (struct device *dev) +{ +snd_soc_resume (dev); +}
sound/soc/intel/bytcr_dpcm_rt5640.c line 207
Quoted 10 lines
sound/soc/intel/bytcr_dpcm_rt5640.c new file +10
-0+ +static int snd_byt_poweroff (struct device *dev) +{ +return snd_soc_poweroff (dev); +} +#else +#define snd_byt_prepare NULL +#define snd_byt_complete NULL +#define snd_byt_poweroff NULL +#endif
Don't bother with the wrapper functions, they're not adding anything. Why are we using prepare() and complete() here - other machine drivers don't need to do that? Comments might be helpful...
Re: [PATCH v3 5/6] ASoC: Intel: add BYTCR machine driver with RT5640
Quoted 14 lines · Mark Brown
sound/soc/intel/bytcr_dpcm_rt5640.c line 76
Quoted 9 lines · Vinod Koul
sound/soc/intel/bytcr_dpcm_rt5640.c new file +9
-0+static int byt_aif1_hw_params (struct snd_pcm_substream *substream, +struct snd_pcm_hw_params *params) +{ +struct snd_soc_pcm_runtime *rtd = substream->private_data; +struct snd_soc_dai *codec_dai = rtd->codec_dai; +int ret; + +if (strncmp (codec_dai->name,"rt5640-aif1" ,11 )) +return 0 ;This looks wrong... fairly sure I queried this on an earlier version of the patch and was told it wasn't required.
This was supposed to be removed, not sure why it creeped back in, will fix now
Quoted 13 lines
sound/soc/intel/bytcr_dpcm_rt5640.c line 85
Quoted 9 lines
sound/soc/intel/bytcr_dpcm_rt5640.c new file +8
-0+ ret =snd_soc_dai_set_sysclk (codec_dai,RT5640_SCLK_S_PLL1 , +params_rate (params) *512 , +SND_SOC_CLOCK_IN ); +if (ret <0 ) { +dev_err (rtd->dev,"can't set codec clock %d\n" , ret); +return ret; + } + ret = snd_soc_dai_set_pll(codec_dai, 0, RT5640_PLL1_S_BCLK1,Missing blank line here and in several places throughout the file. I'd expect the PLL to be enabled before the sysclk is told to use it, error checking might kick in otherwise.
ok
Quoted 17 lines
Quoted 17 lines
sound/soc/intel/bytcr_dpcm_rt5640.c new file +16
-0+#ifdef CONFIG_PM_SLEEP +static int snd_byt_prepare (struct device *dev) +{ +return snd_soc_suspend (dev); +} + +static void snd_byt_complete (struct device *dev) +{ +snd_soc_resume (dev); +} + +static int snd_byt_poweroff (struct device *dev) +{ +return snd_soc_poweroff (dev); +} +#else
Quoted 8 lines
sound/soc/intel/bytcr_dpcm_rt5640.c line 207
Quoted 4 lines
sound/soc/intel/bytcr_dpcm_rt5640.c new file +4
-0+#define snd_byt_prepare NULL +#define snd_byt_complete NULL +#define snd_byt_poweroff NULL +#endif Don't bother with the wrapper functions, they're not adding anything. Why are we using
prepare()andcomplete()here - other machine drivers don't need to do that? Comments might be helpful...
due to I2C. We have seen that codec is resumed but I2C is still not ready causing i2c failures, so moving to complete and prepare helps. I will add this comment. Will remove wrappers.
Thanks
Signature · 1 line
~Vinod
Mark Brown
maintainerRe: [PATCH v3 5/6] ASoC: Intel: add BYTCR machine driver with RT5640
Quoted 9 lines · Vinod Koul
Quoted 3 lines · Mark Brown
Don't bother with the wrapper functions, they're not adding anything. Why are we using
prepare()andcomplete()here - other machine drivers don't need to do that? Comments might be helpful...due to I2C. We have seen that codec is resumed but I2C is still not ready causing i2c failures, so moving to complete and prepare helps. I will add this comment. Will remove wrappers.
That doesn't sound right - this would affect almost all systems. Deferred probe should ensure that the machine driver can't load until after all the component devices (including the CODEC driver) are instantiated and we should be suspending in the reverse order that we probe the devices.
Re: [PATCH v3 5/6] ASoC: Intel: add BYTCR machine driver with RT5640
Quoted 11 lines · Mark Brown
Quoted 9 lines · Vinod Koul
Quoted 3 lines · Mark Brown
Don't bother with the wrapper functions, they're not adding anything. Why are we using
prepare()andcomplete()here - other machine drivers don't need to do that? Comments might be helpful...due to I2C. We have seen that codec is resumed but I2C is still not ready causing i2c failures, so moving to complete and prepare helps. I will add this comment. Will remove wrappers.
Quoted 5 lines
That doesn't sound right - this would affect almost all systems. Deferred probe should ensure that the machine driver can't load until after all the component devices (including the CODEC driver) are instantiated and we should be suspending in the reverse order that we probe the devices.
Yes defer probe is the right solution here. But in machine driver loading how does it ensure that codec and platform are already loaded, should the sound card registration be treated as failure and deferred?
Thanks
Signature · 1 line
~Vinod
Mark Brown
maintainerRe: [PATCH v3 5/6] ASoC: Intel: add BYTCR machine driver with RT5640
Quoted 11 lines · Vinod Koul
Quoted 5 lines · Mark Brown
That doesn't sound right - this would affect almost all systems. Deferred probe should ensure that the machine driver can't load until after all the component devices (including the CODEC driver) are instantiated and we should be suspending in the reverse order that we probe the devices.
Yes defer probe is the right solution here. But in machine driver loading how does it ensure that codec and platform are already loaded, should the sound card registration be treated as failure and deferred?
Yes, the sound card registration will give you an -EPROBE_DEFER if one of the components isn't registered.
PATCH v3 6/6 ASoC: Intel: Add Merrifield machine driver
In reply to Vinod KoulThis patch adds machine driver support for Merrifield platform. Patch has dependency on Merrifield DSP driver.
--- sound/soc/intel/Kconfig | 15 ++ sound/soc/intel/Makefile | 2 + sound/soc/intel/merr_dpcm_wm8958.c | 416 ++++++++++++++++++++++++++++++++++++ 3 files changed, 433 insertions(+), 0 deletions(-) create mode 100644 sound/soc/intel/merr_dpcm_wm8958.c
sound/soc/intel/Kconfig +15 -0
@@ -97,3 +97,18 @@ config SND_SOC_INTEL_BYTCR_RT5640_MACH used as alsa device in audio substem in Intel(R) MID devices Say Y if you have such a device If unsure select "N". + +config SND_SOC_INTEL_MRFLD_WM8958_MACH + tristate "SOC Machine Audio driver for Intel Merrifield MID platform" + depends on X86 + select SND_SOC_WM8994 + select MFD_CORE + select MFD_WM8994 + select REGULATOR_WM8994 + select SND_SST_MFLD_PLATFORM + select SND_SST_IPC_PCI + help + This adds support for ASoC machine driver for Intel(R) MID Merrifield platform + used as alsa device in audio substem in Intel(R) MID devices + Say Y if you have such a device + If unsure select "N".
sound/soc/intel/Makefile +2 -0
@@ -27,12 +27,14 @@ snd-soc-sst-byt-rt5640-mach-objs := byt-rt5640.o snd-soc-sst-byt-max98090-mach-objs := byt-max98090.o snd-soc-sst-broadwell-objs := broadwell.o snd-soc-sst-bytcr-dpcm-rt5640-objs := bytcr_dpcm_rt5640.o +snd-soc-sst-merr-dpcm-wm8958-objs := merr_dpcm_wm8958.o obj-$(CONFIG_SND_SOC_INTEL_HASWELL_MACH) += snd-soc-sst-haswell.o obj-$(CONFIG_SND_SOC_INTEL_BYT_RT5640_MACH) += snd-soc-sst-byt-rt5640-mach.o obj-$(CONFIG_SND_SOC_INTEL_BYT_MAX98090_MACH) += snd-soc-sst-byt-max98090-mach.o obj-$(CONFIG_SND_SOC_INTEL_BROADWELL_MACH) += snd-soc-sst-broadwell.o obj-$(CONFIG_SND_SOC_INTEL_BYTCR_RT5640_MACH) += snd-soc-sst-bytcr-dpcm-rt5640.o +obj-$(CONFIG_SND_SOC_INTEL_MRFLD_WM8958_MACH) += snd-soc-sst-merr-dpcm-wm8958.o # DSP driver obj-$(CONFIG_SND_SST_IPC) += sst/
sound/soc/intel/merr_dpcm_wm8958.c new file +416 -0
416 lines not on this page · raw message
Signature · 1 line
1.7.0.4
Mark Brown
maintainerRe: [PATCH v3 6/6] ASoC: Intel: Add Merrifield machine driver
sound/soc/intel/merr_dpcm_wm8958.c line 122
Quoted 10 lines · Vinod Koul
sound/soc/intel/merr_dpcm_wm8958.c new file +10
-0+static int mrfld_wm8958_set_clk (struct snd_soc_dai *codec_dai) +{ +int ret =0 ; +struct snd_soc_card *card = codec_dai->card; + + ret =snd_soc_dai_set_tdm_slot (codec_dai,0xf0 ,0xf0 ,4 ,24 ); +if (ret <0 ) { +dev_err (card->dev,"can't set codec pcm format %d\n" , ret); +return ret; + }
We already set this on init - why do we need to set it each time here too?
Re: [PATCH v3 6/6] ASoC: Intel: Add Merrifield machine driver
Quoted 15 lines · Mark Brown
sound/soc/intel/merr_dpcm_wm8958.c line 122
Quoted 10 lines · Vinod Koul
sound/soc/intel/merr_dpcm_wm8958.c new file +10
-0+static int mrfld_wm8958_set_clk (struct snd_soc_dai *codec_dai) +{ +int ret =0 ; +struct snd_soc_card *card = codec_dai->card; + + ret =snd_soc_dai_set_tdm_slot (codec_dai,0xf0 ,0xf0 ,4 ,24 ); +if (ret <0 ) { +dev_err (card->dev,"can't set codec pcm format %d\n" , ret); +return ret; + }We already set this on init - why do we need to set it each time here too?
It is not required, will remove.
--
~Vinod