Skip to contentSkip to conversation

ASoC: Intel: mrfld- add ACPI module

PATCH Applied Vinod Koul 2 participants 2 messages Nov 11, 2014 – Nov 14, 2014

Subsystems (3)
lore
Share & tools
lore

Vinod Koul

author
#0 lore raw

PATCH v4 1/1 ASoC: Intel: mrfld- add ACPI module

Add the last ACPI module support which also uses core module like the PCI part

---
 sound/soc/intel/Kconfig        |    5 +
 sound/soc/intel/sst/Makefile   |    4 +-
 sound/soc/intel/sst/sst.c      |   22 ++-
 sound/soc/intel/sst/sst.h      |    1 +
 sound/soc/intel/sst/sst_acpi.c |  362 ++++++++++++++++++++++++++++++++++++++++
 sound/soc/intel/sst/sst_pvt.c  |    2 +
 6 files changed, 391 insertions(+), 5 deletions(-)
 create mode 100644 sound/soc/intel/sst/sst_acpi.c
sound/soc/intel/Kconfig +5 -0
index c963a5d..a992e85 100644
@@ -20,6 +20,11 @@ config SND_SST_IPC_PCI
 	tristate
 	select SND_SST_IPC
 
+config SND_SST_IPC_ACPI
+	tristate
+	select SND_SST_IPC
+	depends on ACPI
+
 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
index b8aa1d3..fd21726 100644
@@ -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 +19 -3
index b97c231..b2b5604 100644
@@ -26,6 +26,7 @@
 #include <linux/pm_runtime.h>
 #include <linux/pm_qos.h>
 #include <linux/async.h>
+#include <linux/acpi.h>
 #include <sound/core.h>
 #include <sound/soc.h>
 #include <asm/platform_sst_audio.h>
@@ -181,6 +182,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 +325,7 @@ EXPORT_SYMBOL_GPL(sst_context_init);
 void sst_context_cleanup(struct intel_sst_drv *ctx)
 {
 	pm_runtime_get_noresume(ctx->dev);
-	pm_runtime_forbid(ctx->dev);
+	pm_runtime_disable(ctx->dev);
 	sst_unregister(ctx->dev);
 	sst_set_fw_state_locked(ctx, SST_SHUTDOWN);
 	flush_scheduled_work();
@@ -371,8 +373,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);
-	pm_runtime_allow(ctx->dev);
-	pm_runtime_put_noidle(ctx->dev);
+	/*
+	 * For acpi devices, the actual physical device state is
+	 * initially active. So change the state to active before
+	 * enabling the pm
+	 */
+	if (acpi_disabled) {
+		pm_runtime_set_active(ctx->dev);
+		pm_runtime_enable(ctx->dev);
+	} else {
+		pm_runtime_allow(ctx->dev);
+		pm_runtime_put_noidle(ctx->dev);
+	}
+	sst_save_shim64(ctx, ctx->shim, ctx->shim_regs64);
 }
 EXPORT_SYMBOL_GPL(sst_configure_runtime_pm);
 
@@ -395,6 +408,9 @@ 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 */
+	sst_save_shim64(ctx, ctx->shim, ctx->shim_regs64);
+
 	return ret;
 }
 
sound/soc/intel/sst/sst.h +1 -0
index 2dcbf47..683dc71 100644
@@ -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)
sound/soc/intel/sst/sst_acpi.c new file +362 -0

362 lines not on this page · raw message

sound/soc/intel/sst/sst_pvt.c +2 -0
index 9a5df19..4b77208 100644
@@ -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
maintainer Applied
#1 lore raw
Quoted 2 lines · Vinod Koul

Add the last ACPI module support which also uses core module like the PCI part

Applied, thanks.