From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> To: alsa-devel@alsa-project.org Cc: linux-kernel@vger.kernel.org, tiwai@suse.de, broonie@kernel.org, vkoul@kernel.org, gregkh@linuxfoundation.org, jank@cadence.com, srinivas.kandagatla@linaro.org, slawomir.blauciak@intel.com, Bard liao <yung-chuan.liao@linux.intel.com>, Rander Wang <rander.wang@linux.intel.com>, Ranjani Sridharan <ranjani.sridharan@linux.intel.com>, Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>, Liam Girdwood <lgirdwood@gmail.com>, Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>, YueHaibing <yuehaibing@huawei.com>, Zhu Yingjiang <yingjiang.zhu@linux.intel.com>, Kai Vehmanen <kai.vehmanen@linux.intel.com>, Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>, Arnd Bergmann <arnd@arndb.de>, Pan Xiuli <xiuli.pan@linux.intel.com>, Fred Oh <fred.oh@linux.intel.com>, Daniel Baluta <daniel.baluta@nxp.com> Subject: [RFC PATCH 2/5] ASoC: SOF: Intel: hda: add helper to initialize SoundWire IP Date: Wed, 21 Aug 2019 15:17:17 -0500 [thread overview] Message-ID: <20190821201720.17768-3-pierre-louis.bossart@linux.intel.com> (raw) In-Reply-To: <20190821201720.17768-1-pierre-louis.bossart@linux.intel.com> The helper calls the SoundWire initializations and sets the resource structure defined as an interface with the platform driver. The resource deals with PCI base address, interrupts and the callback for the stream configuration. The interrupts are gated/ungated at the top-level with the ADSPIPC2.SNDW field Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> --- sound/soc/sof/intel/hda.c | 63 +++++++++++++++++++++++++++++++++++++++ sound/soc/sof/intel/hda.h | 1 + 2 files changed, 64 insertions(+) diff --git a/sound/soc/sof/intel/hda.c b/sound/soc/sof/intel/hda.c index c72e9a09eee1..a968890d0754 100644 --- a/sound/soc/sof/intel/hda.c +++ b/sound/soc/sof/intel/hda.c @@ -18,7 +18,9 @@ #include <sound/hdaudio_ext.h> #include <sound/hda_register.h> +#include <linux/acpi.h> #include <linux/module.h> +#include <linux/soundwire/sdw_intel.h> #include <sound/intel-nhlt.h> #include <sound/sof.h> #include <sound/sof/xtensa.h> @@ -35,6 +37,67 @@ #define IS_CFL(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0xa348) #define IS_CNL(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0x9dc8) +#if IS_ENABLED(CONFIG_SOUNDWIRE_INTEL) + +static void hda_sdw_int_enable(struct snd_sof_dev *sdev, bool enable) +{ + if (enable) + snd_sof_dsp_update_bits(sdev, HDA_DSP_BAR, + HDA_DSP_REG_ADSPIC2, + HDA_DSP_ADSPIC2_SNDW, + HDA_DSP_ADSPIC2_SNDW); + else + snd_sof_dsp_update_bits(sdev, HDA_DSP_BAR, + HDA_DSP_REG_ADSPIC2, + HDA_DSP_ADSPIC2_SNDW, + 0); +} + +static int hda_sdw_init(struct snd_sof_dev *sdev) +{ + acpi_handle handle; + struct sdw_intel_res res; + + handle = ACPI_HANDLE(sdev->dev); + + memset(&res, 0, sizeof(res)); + + res.mmio_base = sdev->bar[HDA_DSP_BAR]; + res.irq = sdev->ipc_irq; + res.parent = sdev->dev; + + hda_sdw_int_enable(sdev, true); + + sdev->sdw = sdw_intel_init(handle, &res); + if (!sdev->sdw) { + dev_err(sdev->dev, "SDW Init failed\n"); + return -EIO; + } + + return 0; +} + +static int hda_sdw_exit(struct snd_sof_dev *sdev) +{ + hda_sdw_int_enable(sdev, false); + + if (sdev->sdw) + sdw_intel_exit(sdev->sdw); + + return 0; +} +#else +static int hda_sdw_init(struct snd_sof_dev *sdev) +{ + return 0; +} + +static int hda_sdw_exit(struct snd_sof_dev *sdev) +{ + return 0; +} +#endif + /* * Debug */ diff --git a/sound/soc/sof/intel/hda.h b/sound/soc/sof/intel/hda.h index 5591841a1b6f..c8f93317aeb4 100644 --- a/sound/soc/sof/intel/hda.h +++ b/sound/soc/sof/intel/hda.h @@ -211,6 +211,7 @@ #define HDA_DSP_ADSPIC_IPC 1 #define HDA_DSP_ADSPIS_IPC 1 +#define HDA_DSP_ADSPIC2_SNDW BIT(5) /* Intel HD Audio General DSP Registers */ #define HDA_DSP_GEN_BASE 0x0 -- 2.20.1
WARNING: multiple messages have this Message-ID (diff)
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> To: alsa-devel@alsa-project.org Cc: linux-kernel@vger.kernel.org, tiwai@suse.de, broonie@kernel.org, vkoul@kernel.org, gregkh@linuxfoundation.org, jank@cadence.com, srinivas.kandagatla@linaro.org, slawomir.blauciak@intel.com, Bard liao <yung-chuan.liao@linux.intel.com>, Rander Wang <rander.wang@linux.intel.com>, Ranjani Sridharan <ranjani.sridharan@linux.intel.com>, Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>, Liam Girdwood <lgirdwood@gmail.com>, Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>, YueHaibing <yuehaibing@huawei.com>, Zhu Yingjiang <yingjiang.zhu@linux.intel.com>, Kai Vehmanen <kai.vehmanen@linux.intel.com>, Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>, Arnd Bergmann <arnd@arndb.de>, Pan Xiuli <xiuli.pan@linux.intel.com>, Fred Oh <fr> Subject: [RFC PATCH 2/5] ASoC: SOF: Intel: hda: add helper to initialize SoundWire IP Date: Wed, 21 Aug 2019 15:17:17 -0500 [thread overview] Message-ID: <20190821201720.17768-3-pierre-louis.bossart@linux.intel.com> (raw) In-Reply-To: <20190821201720.17768-1-pierre-louis.bossart@linux.intel.com> The helper calls the SoundWire initializations and sets the resource structure defined as an interface with the platform driver. The resource deals with PCI base address, interrupts and the callback for the stream configuration. The interrupts are gated/ungated at the top-level with the ADSPIPC2.SNDW field Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> --- sound/soc/sof/intel/hda.c | 63 +++++++++++++++++++++++++++++++++++++++ sound/soc/sof/intel/hda.h | 1 + 2 files changed, 64 insertions(+) diff --git a/sound/soc/sof/intel/hda.c b/sound/soc/sof/intel/hda.c index c72e9a09eee1..a968890d0754 100644 --- a/sound/soc/sof/intel/hda.c +++ b/sound/soc/sof/intel/hda.c @@ -18,7 +18,9 @@ #include <sound/hdaudio_ext.h> #include <sound/hda_register.h> +#include <linux/acpi.h> #include <linux/module.h> +#include <linux/soundwire/sdw_intel.h> #include <sound/intel-nhlt.h> #include <sound/sof.h> #include <sound/sof/xtensa.h> @@ -35,6 +37,67 @@ #define IS_CFL(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0xa348) #define IS_CNL(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0x9dc8) +#if IS_ENABLED(CONFIG_SOUNDWIRE_INTEL) + +static void hda_sdw_int_enable(struct snd_sof_dev *sdev, bool enable) +{ + if (enable) + snd_sof_dsp_update_bits(sdev, HDA_DSP_BAR, + HDA_DSP_REG_ADSPIC2, + HDA_DSP_ADSPIC2_SNDW, + HDA_DSP_ADSPIC2_SNDW); + else + snd_sof_dsp_update_bits(sdev, HDA_DSP_BAR, + HDA_DSP_REG_ADSPIC2, + HDA_DSP_ADSPIC2_SNDW, + 0); +} + +static int hda_sdw_init(struct snd_sof_dev *sdev) +{ + acpi_handle handle; + struct sdw_intel_res res; + + handle = ACPI_HANDLE(sdev->dev); + + memset(&res, 0, sizeof(res)); + + res.mmio_base = sdev->bar[HDA_DSP_BAR]; + res.irq = sdev->ipc_irq; + res.parent = sdev->dev; + + hda_sdw_int_enable(sdev, true); + + sdev->sdw = sdw_intel_init(handle, &res); + if (!sdev->sdw) { + dev_err(sdev->dev, "SDW Init failed\n"); + return -EIO; + } + + return 0; +} + +static int hda_sdw_exit(struct snd_sof_dev *sdev) +{ + hda_sdw_int_enable(sdev, false); + + if (sdev->sdw) + sdw_intel_exit(sdev->sdw); + + return 0; +} +#else +static int hda_sdw_init(struct snd_sof_dev *sdev) +{ + return 0; +} + +static int hda_sdw_exit(struct snd_sof_dev *sdev) +{ + return 0; +} +#endif + /* * Debug */ diff --git a/sound/soc/sof/intel/hda.h b/sound/soc/sof/intel/hda.h index 5591841a1b6f..c8f93317aeb4 100644 --- a/sound/soc/sof/intel/hda.h +++ b/sound/soc/sof/intel/hda.h @@ -211,6 +211,7 @@ #define HDA_DSP_ADSPIC_IPC 1 #define HDA_DSP_ADSPIS_IPC 1 +#define HDA_DSP_ADSPIC2_SNDW BIT(5) /* Intel HD Audio General DSP Registers */ #define HDA_DSP_GEN_BASE 0x0 -- 2.20.1
next prev parent reply other threads:[~2019-08-21 20:17 UTC|newest] Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-08-21 20:17 [RFC PATCH 0/5] ASoC: SOF: Intel: SoundWire initial integration Pierre-Louis Bossart 2019-08-21 20:17 ` [RFC PATCH 1/5] ASoC: SOF: IPC: dai-intel: move ALH declarations in header file Pierre-Louis Bossart 2019-08-21 20:17 ` Pierre-Louis Bossart [this message] 2019-08-21 20:17 ` [RFC PATCH 2/5] ASoC: SOF: Intel: hda: add helper to initialize SoundWire IP Pierre-Louis Bossart 2019-08-21 20:17 ` [RFC PATCH 3/5] ASoC: SOF: Intel: hda: add SoundWire IP support Pierre-Louis Bossart 2019-08-21 20:17 ` Pierre-Louis Bossart 2019-09-04 7:21 ` Vinod Koul 2019-09-04 7:21 ` [alsa-devel] " Vinod Koul 2019-09-04 13:25 ` Pierre-Louis Bossart 2019-09-04 13:25 ` Pierre-Louis Bossart 2019-09-04 16:51 ` Vinod Koul 2019-09-04 16:51 ` Vinod Koul 2019-09-04 17:47 ` Pierre-Louis Bossart 2019-09-04 17:47 ` Pierre-Louis Bossart 2019-08-21 20:17 ` [RFC PATCH 4/5] ASoC: SOF: Intel: hda: add SoundWire stream config/free callbacks Pierre-Louis Bossart 2019-08-22 7:18 ` Guennadi Liakhovetski 2019-08-22 7:23 ` Guennadi Liakhovetski 2019-08-22 13:53 ` Pierre-Louis Bossart 2019-08-22 15:11 ` Guennadi Liakhovetski 2019-09-04 7:35 ` Vinod Koul 2019-09-04 7:35 ` [alsa-devel] " Vinod Koul 2019-09-04 13:31 ` Pierre-Louis Bossart 2019-09-04 13:31 ` Pierre-Louis Bossart 2019-09-04 16:55 ` Vinod Koul 2019-09-04 16:55 ` Vinod Koul 2019-09-04 17:49 ` Pierre-Louis Bossart 2019-09-04 17:49 ` Pierre-Louis Bossart 2019-08-21 20:17 ` [RFC PATCH 5/5] ASoC: SOF: Intel: add support for SoundWire suspend/resume Pierre-Louis Bossart 2019-08-21 20:17 ` Pierre-Louis Bossart 2019-08-22 15:19 ` [alsa-devel] [RFC PATCH 0/5] ASoC: SOF: Intel: SoundWire initial integration Guennadi Liakhovetski 2019-08-22 16:00 ` Pierre-Louis Bossart
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20190821201720.17768-3-pierre-louis.bossart@linux.intel.com \ --to=pierre-louis.bossart@linux.intel.com \ --cc=alsa-devel@alsa-project.org \ --cc=arnd@arndb.de \ --cc=broonie@kernel.org \ --cc=daniel.baluta@nxp.com \ --cc=fred.oh@linux.intel.com \ --cc=gregkh@linuxfoundation.org \ --cc=guennadi.liakhovetski@linux.intel.com \ --cc=jank@cadence.com \ --cc=kai.vehmanen@linux.intel.com \ --cc=lgirdwood@gmail.com \ --cc=linux-kernel@vger.kernel.org \ --cc=perex@perex.cz \ --cc=rander.wang@linux.intel.com \ --cc=ranjani.sridharan@linux.intel.com \ --cc=slawomir.blauciak@intel.com \ --cc=srinivas.kandagatla@linaro.org \ --cc=tiwai@suse.com \ --cc=tiwai@suse.de \ --cc=vkoul@kernel.org \ --cc=xiuli.pan@linux.intel.com \ --cc=yingjiang.zhu@linux.intel.com \ --cc=yuehaibing@huawei.com \ --cc=yung-chuan.liao@linux.intel.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.