[alsa-devel] [PATCH 0/5] ASoC: Intel: geminilake: Adds da7219+max98537 machine driver support
Patch adds required changes in bxt machine & corresponding driver entry in machine to use MAX98357A codec as speaker on SSP1 and DA7219 codec as headset on SSP2 for GLK board.
Naveen Manohar (5): ASoC: Intel: broxton: reduce machine name for bxt_da7219_max98357a ASoC: Intel: Headset button support in broxton machine driver ASoC: Intel: Add Geminilake Dialog Maxim machine driver support ASoC: Intel: glk: Add DAI links for Multi-Playback ASoC: Intel: Add Geminilake Dialog+Maxim machine driver entry
sound/soc/intel/boards/bxt_da7219_max98357a.c | 308 ++++++++++++++++++++++++-- sound/soc/intel/skylake/skl.c | 9 +- 2 files changed, 297 insertions(+), 20 deletions(-)
Use truncated names in bxt id table and bxt_da7219_max98357a machine as platform device id table expects names to be less then 20chars.
Signed-off-by: Naveen Manohar naveen.m@intel.com --- sound/soc/intel/boards/bxt_da7219_max98357a.c | 4 ++-- sound/soc/intel/skylake/skl.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/soc/intel/boards/bxt_da7219_max98357a.c b/sound/soc/intel/boards/bxt_da7219_max98357a.c index 668c093..ce021a3 100644 --- a/sound/soc/intel/boards/bxt_da7219_max98357a.c +++ b/sound/soc/intel/boards/bxt_da7219_max98357a.c @@ -586,7 +586,7 @@ static int broxton_audio_probe(struct platform_device *pdev) static struct platform_driver broxton_audio = { .probe = broxton_audio_probe, .driver = { - .name = "bxt_da7219_max98357a_i2s", + .name = "bxt_da7219_max98357a", .pm = &snd_soc_pm_ops, }, }; @@ -599,4 +599,4 @@ MODULE_AUTHOR("Rohit Ainapure rohit.m.ainapure@intel.com"); MODULE_AUTHOR("Harsha Priya harshapriya.n@intel.com"); MODULE_AUTHOR("Conrad Cooke conrad.cooke@intel.com"); MODULE_LICENSE("GPL v2"); -MODULE_ALIAS("platform:bxt_da7219_max98357a_i2s"); +MODULE_ALIAS("platform:bxt_da7219_max98357a"); diff --git a/sound/soc/intel/skylake/skl.c b/sound/soc/intel/skylake/skl.c index abf3247..d50c2ee 100644 --- a/sound/soc/intel/skylake/skl.c +++ b/sound/soc/intel/skylake/skl.c @@ -1086,7 +1086,7 @@ static struct snd_soc_acpi_mach sst_bxtp_devdata[] = { }, { .id = "DLGS7219", - .drv_name = "bxt_da7219_max98357a_i2s", + .drv_name = "bxt_da7219_max98357a", .fw_filename = "intel/dsp_fw_bxtn.bin", .machine_quirk = snd_soc_acpi_codec_list, .quirk_data = &bxt_codecs,
The patch
ASoC: Intel: broxton: reduce machine name for bxt_da7219_max98357a
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks, Mark
From 95555f580dca21fac5ea35c10fa92fa034bd403f Mon Sep 17 00:00:00 2001
From: Naveen Manohar naveen.m@intel.com Date: Mon, 18 Jun 2018 13:29:35 -0500 Subject: [PATCH] ASoC: Intel: broxton: reduce machine name for bxt_da7219_max98357a
Use truncated names in bxt id table and bxt_da7219_max98357a machine as platform device id table expects names to be less then 20chars.
Signed-off-by: Naveen Manohar naveen.m@intel.com Signed-off-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/intel/boards/bxt_da7219_max98357a.c | 4 ++-- sound/soc/intel/skylake/skl.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/soc/intel/boards/bxt_da7219_max98357a.c b/sound/soc/intel/boards/bxt_da7219_max98357a.c index 40eb979d5ac1..3aba5bcf806a 100644 --- a/sound/soc/intel/boards/bxt_da7219_max98357a.c +++ b/sound/soc/intel/boards/bxt_da7219_max98357a.c @@ -586,7 +586,7 @@ static int broxton_audio_probe(struct platform_device *pdev) static struct platform_driver broxton_audio = { .probe = broxton_audio_probe, .driver = { - .name = "bxt_da7219_max98357a_i2s", + .name = "bxt_da7219_max98357a", .pm = &snd_soc_pm_ops, }, }; @@ -599,4 +599,4 @@ MODULE_AUTHOR("Rohit Ainapure rohit.m.ainapure@intel.com"); MODULE_AUTHOR("Harsha Priya harshapriya.n@intel.com"); MODULE_AUTHOR("Conrad Cooke conrad.cooke@intel.com"); MODULE_LICENSE("GPL v2"); -MODULE_ALIAS("platform:bxt_da7219_max98357a_i2s"); +MODULE_ALIAS("platform:bxt_da7219_max98357a"); diff --git a/sound/soc/intel/skylake/skl.c b/sound/soc/intel/skylake/skl.c index f0d9793f872a..0a8f0768e987 100644 --- a/sound/soc/intel/skylake/skl.c +++ b/sound/soc/intel/skylake/skl.c @@ -1093,7 +1093,7 @@ static struct snd_soc_acpi_mach sst_bxtp_devdata[] = { }, { .id = "DLGS7219", - .drv_name = "bxt_da7219_max98357a_i2s", + .drv_name = "bxt_da7219_max98357a", .fw_filename = "intel/dsp_fw_bxtn.bin", .machine_quirk = snd_soc_acpi_codec_list, .quirk_data = &bxt_codecs,
Patch adds headset button support for broxton machine driver (bxt_da7219_max98357a).
Signed-off-by: Naveen Manohar naveen.m@intel.com --- sound/soc/intel/boards/bxt_da7219_max98357a.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/sound/soc/intel/boards/bxt_da7219_max98357a.c b/sound/soc/intel/boards/bxt_da7219_max98357a.c index ce021a3..1c1e70c 100644 --- a/sound/soc/intel/boards/bxt_da7219_max98357a.c +++ b/sound/soc/intel/boards/bxt_da7219_max98357a.c @@ -16,6 +16,7 @@ * GNU General Public License for more details. */
+#include <linux/input.h> #include <linux/module.h> #include <linux/platform_device.h> #include <sound/core.h> @@ -168,6 +169,7 @@ static int broxton_ssp_fixup(struct snd_soc_pcm_runtime *rtd, static int broxton_da7219_codec_init(struct snd_soc_pcm_runtime *rtd) { int ret; + struct snd_soc_jack *jack; struct snd_soc_dai *codec_dai = rtd->codec_dai; struct snd_soc_component *component = rtd->codec_dai->component;
@@ -192,7 +194,12 @@ static int broxton_da7219_codec_init(struct snd_soc_pcm_runtime *rtd) return ret; }
- da7219_aad_jack_det(component, &broxton_headset); + jack = &broxton_headset; + snd_jack_set_key(jack->jack, SND_JACK_BTN_0, KEY_MEDIA); + snd_jack_set_key(jack->jack, SND_JACK_BTN_1, KEY_VOICECOMMAND); + snd_jack_set_key(jack->jack, SND_JACK_BTN_2, KEY_VOLUMEUP); + snd_jack_set_key(jack->jack, SND_JACK_BTN_3, KEY_VOLUMEDOWN); + da7219_aad_jack_det(component, jack);
snd_soc_dapm_ignore_suspend(&rtd->card->dapm, "SoC DMIC");
Hi Naveen,
On Wed, Apr 04, 2018 at 10:16:56AM +0530, Naveen Manohar wrote:
Patch adds headset button support for broxton machine driver (bxt_da7219_max98357a).
Signed-off-by: Naveen Manohar naveen.m@intel.com
sound/soc/intel/boards/bxt_da7219_max98357a.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/sound/soc/intel/boards/bxt_da7219_max98357a.c b/sound/soc/intel/boards/bxt_da7219_max98357a.c index ce021a3..1c1e70c 100644 --- a/sound/soc/intel/boards/bxt_da7219_max98357a.c +++ b/sound/soc/intel/boards/bxt_da7219_max98357a.c @@ -16,6 +16,7 @@
- GNU General Public License for more details.
*/
+#include <linux/input.h> #include <linux/module.h> #include <linux/platform_device.h> #include <sound/core.h> @@ -168,6 +169,7 @@ static int broxton_ssp_fixup(struct snd_soc_pcm_runtime *rtd, static int broxton_da7219_codec_init(struct snd_soc_pcm_runtime *rtd) { int ret;
- struct snd_soc_jack *jack; struct snd_soc_dai *codec_dai = rtd->codec_dai; struct snd_soc_component *component = rtd->codec_dai->component;
@@ -192,7 +194,12 @@ static int broxton_da7219_codec_init(struct snd_soc_pcm_runtime *rtd) return ret; }
- da7219_aad_jack_det(component, &broxton_headset);
- jack = &broxton_headset;
- snd_jack_set_key(jack->jack, SND_JACK_BTN_0, KEY_MEDIA);
I recently made a set of changes that replaced KEY_MEDIA usage for BTN_0 with KEY_PLAYPAUSE. See https://lkml.org/lkml/2017/11/22/586
Since this patch may be destined for Chrome OS, you should definitely use KEY_PLAYPAUSE, as the Chrome OS user space doesn't respond to KEY_MEDIA but does respond to KEY_PLAYPAUSE.
Thanks, Benson
On Thu, Apr 05, 2018 at 05:30:33PM -0700, Benson Leung wrote:
Hi Naveen,
On Wed, Apr 04, 2018 at 10:16:56AM +0530, Naveen Manohar wrote:
Patch adds headset button support for broxton machine driver (bxt_da7219_max98357a).
Signed-off-by: Naveen Manohar naveen.m@intel.com
sound/soc/intel/boards/bxt_da7219_max98357a.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/sound/soc/intel/boards/bxt_da7219_max98357a.c b/sound/soc/intel/boards/bxt_da7219_max98357a.c index ce021a3..1c1e70c 100644 --- a/sound/soc/intel/boards/bxt_da7219_max98357a.c +++ b/sound/soc/intel/boards/bxt_da7219_max98357a.c @@ -16,6 +16,7 @@
- GNU General Public License for more details.
*/
+#include <linux/input.h> #include <linux/module.h> #include <linux/platform_device.h> #include <sound/core.h> @@ -168,6 +169,7 @@ static int broxton_ssp_fixup(struct snd_soc_pcm_runtime *rtd, static int broxton_da7219_codec_init(struct snd_soc_pcm_runtime *rtd) { int ret;
- struct snd_soc_jack *jack; struct snd_soc_dai *codec_dai = rtd->codec_dai; struct snd_soc_component *component = rtd->codec_dai->component;
@@ -192,7 +194,12 @@ static int broxton_da7219_codec_init(struct snd_soc_pcm_runtime *rtd) return ret; }
- da7219_aad_jack_det(component, &broxton_headset);
- jack = &broxton_headset;
- snd_jack_set_key(jack->jack, SND_JACK_BTN_0, KEY_MEDIA);
I recently made a set of changes that replaced KEY_MEDIA usage for BTN_0 with KEY_PLAYPAUSE. See https://lkml.org/lkml/2017/11/22/586
Since this patch may be destined for Chrome OS, you should definitely use KEY_PLAYPAUSE, as the Chrome OS user space doesn't respond to KEY_MEDIA but does respond to KEY_PLAYPAUSE.
Thanks, Benson
Thanks for the review and update. Shall correct this in V2. Also there are other machines which still use KEY_MEDIA - kbl_da7219_max98357a.c, cht_bsw_nau8824.c Shall correct these too.
-- Benson Leung Staff Software Engineer Chrome OS Kernel Google Inc. bleung@google.com Chromium OS Project bleung@chromium.org
--
On Fri, 2018-04-06 at 06:45 +0530, Naveen M wrote:
Thanks for the review and update. Shall correct this in V2. Also there are other machines which still use KEY_MEDIA - kbl_da7219_max98357a.c, cht_bsw_nau8824.c Shall correct these too.
kbl_da7219_max98357a and rk3399_gru_sound also seem to have KEY_VOICECOMMAND on BTN_3 and volume up/down on 1/2; is that correct?
Until I spotted that, I was going to suggest a generic helper to set all four, since they should *all* be setting the four events to KEY_PLAYPAUSE, KEY_VOICECOMMAND, KEY_VOLUMEUP, KEY_VOLUMEDOWN respectively.
On Fri, Apr 06, 2018 at 08:28:35AM +0100, David Woodhouse wrote:
On Fri, 2018-04-06 at 06:45 +0530, Naveen M wrote:
Thanks for the review and update. Shall correct this in V2. Also there are other machines which still use KEY_MEDIA - kbl_da7219_max98357a.c, cht_bsw_nau8824.c Shall correct these too.
kbl_da7219_max98357a and rk3399_gru_sound also seem to have KEY_VOICECOMMAND on BTN_3 and volume up/down on 1/2; is that correct?
Until I spotted that, I was going to suggest a generic helper to set all four, since they should *all* be setting the four events to KEY_PLAYPAUSE, KEY_VOICECOMMAND, KEY_VOLUMEUP, KEY_VOLUMEDOWN respectively.
Headsets are very system specific, it's going to depend on both how the manufacturer headset is labelled and how the hardware interprets the buttons on it. There's a diversity of standards for both unfortunately and no way to identify what's plugged in usefully.
Patch adds required changes in bxt machine to use MAX98357A codec as speaker on SSP1 & DA7219 codec as headset on SSP2 on GLK board.
Signed-off-by: Naveen Manohar naveen.m@intel.com --- sound/soc/intel/boards/bxt_da7219_max98357a.c | 283 ++++++++++++++++++++++++-- 1 file changed, 267 insertions(+), 16 deletions(-)
diff --git a/sound/soc/intel/boards/bxt_da7219_max98357a.c b/sound/soc/intel/boards/bxt_da7219_max98357a.c index 1c1e70c..7725aa1 100644 --- a/sound/soc/intel/boards/bxt_da7219_max98357a.c +++ b/sound/soc/intel/boards/bxt_da7219_max98357a.c @@ -16,6 +16,7 @@ * GNU General Public License for more details. */
+#include <asm/cpu_device_id.h> #include <linux/input.h> #include <linux/module.h> #include <linux/platform_device.h> @@ -33,6 +34,7 @@ #define DUAL_CHANNEL 2 #define QUAD_CHANNEL 4
+static struct snd_soc_card *audio_card; static struct snd_soc_jack broxton_headset; static struct snd_soc_jack broxton_hdmi[3];
@@ -103,7 +105,7 @@ static const struct snd_soc_dapm_widget broxton_widgets[] = { platform_clock_control, SND_SOC_DAPM_POST_PMD|SND_SOC_DAPM_PRE_PMU), };
-static const struct snd_soc_dapm_route broxton_map[] = { +static const struct snd_soc_dapm_route audio_map[] = { /* HP jack connectors - unknown if we have jack detection */ {"Headphone Jack", NULL, "HPL"}, {"Headphone Jack", NULL, "HPR"}, @@ -118,15 +120,6 @@ static const struct snd_soc_dapm_route broxton_map[] = { {"DMic", NULL, "SoC DMIC"},
/* CODEC BE connections */ - {"HiFi Playback", NULL, "ssp5 Tx"}, - {"ssp5 Tx", NULL, "codec0_out"}, - - {"Playback", NULL, "ssp1 Tx"}, - {"ssp1 Tx", NULL, "codec1_out"}, - - {"codec0_in", NULL, "ssp1 Rx"}, - {"ssp1 Rx", NULL, "Capture"}, - {"HDMI1", NULL, "hif5-0 Output"}, {"HDMI2", NULL, "hif6-0 Output"}, {"HDMI2", NULL, "hif7-0 Output"}, @@ -146,6 +139,28 @@ static const struct snd_soc_dapm_route broxton_map[] = { { "Headset Mic", NULL, "Platform Clock" }, };
+static const struct snd_soc_dapm_route broxton_map[] = { + {"HiFi Playback", NULL, "ssp5 Tx"}, + {"ssp5 Tx", NULL, "codec0_out"}, + + {"Playback", NULL, "ssp1 Tx"}, + {"ssp1 Tx", NULL, "codec1_out"}, + + {"codec0_in", NULL, "ssp1 Rx"}, + {"ssp1 Rx", NULL, "Capture"}, +}; + +static const struct snd_soc_dapm_route gemini_map[] = { + {"HiFi Playback", NULL, "ssp1 Tx"}, + {"ssp1 Tx", NULL, "codec0_out"}, + + {"Playback", NULL, "ssp2 Tx"}, + {"ssp2 Tx", NULL, "codec1_out"}, + + {"codec0_in", NULL, "ssp2 Rx"}, + {"ssp2 Rx", NULL, "Capture"}, +}; + static int broxton_ssp_fixup(struct snd_soc_pcm_runtime *rtd, struct snd_pcm_hw_params *params) { @@ -524,6 +539,199 @@ static struct snd_soc_dai_link broxton_dais[] = { }, };
+/* geminilake digital audio interface glue - connects codec <--> CPU */ +static struct snd_soc_dai_link geminilake_dais[] = { + /* Front End DAI links */ + [BXT_DPCM_AUDIO_PB] = { + .name = "Bxt Audio Port", + .stream_name = "Audio", + .cpu_dai_name = "System Pin", + .platform_name = "0000:00:0e.0", + .dynamic = 1, + .codec_name = "snd-soc-dummy", + .codec_dai_name = "snd-soc-dummy-dai", + .nonatomic = 1, + .init = broxton_da7219_fe_init, + .trigger = { + SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST}, + .dpcm_playback = 1, + .ops = &broxton_da7219_fe_ops, + }, + [BXT_DPCM_AUDIO_CP] = { + .name = "Bxt Audio Capture Port", + .stream_name = "Audio Record", + .cpu_dai_name = "System Pin", + .platform_name = "0000:00:0e.0", + .dynamic = 1, + .codec_name = "snd-soc-dummy", + .codec_dai_name = "snd-soc-dummy-dai", + .nonatomic = 1, + .trigger = { + SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST}, + .dpcm_capture = 1, + .ops = &broxton_da7219_fe_ops, + }, + [BXT_DPCM_AUDIO_REF_CP] = { + .name = "Bxt Audio Reference cap", + .stream_name = "Refcap", + .cpu_dai_name = "Reference Pin", + .codec_name = "snd-soc-dummy", + .codec_dai_name = "snd-soc-dummy-dai", + .platform_name = "0000:00:0e.0", + .init = NULL, + .dpcm_capture = 1, + .nonatomic = 1, + .dynamic = 1, + .ops = &broxton_refcap_ops, + }, + [BXT_DPCM_AUDIO_DMIC_CP] = { + .name = "Bxt Audio DMIC cap", + .stream_name = "dmiccap", + .cpu_dai_name = "DMIC Pin", + .codec_name = "snd-soc-dummy", + .codec_dai_name = "snd-soc-dummy-dai", + .platform_name = "0000:00:0e.0", + .init = NULL, + .dpcm_capture = 1, + .nonatomic = 1, + .dynamic = 1, + .ops = &broxton_dmic_ops, + }, + [BXT_DPCM_AUDIO_HDMI1_PB] = { + .name = "Bxt HDMI Port1", + .stream_name = "Hdmi1", + .cpu_dai_name = "HDMI1 Pin", + .codec_name = "snd-soc-dummy", + .codec_dai_name = "snd-soc-dummy-dai", + .platform_name = "0000:00:0e.0", + .dpcm_playback = 1, + .init = NULL, + .trigger = { + SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST}, + .nonatomic = 1, + .dynamic = 1, + }, + [BXT_DPCM_AUDIO_HDMI2_PB] = { + .name = "Bxt HDMI Port2", + .stream_name = "Hdmi2", + .cpu_dai_name = "HDMI2 Pin", + .codec_name = "snd-soc-dummy", + .codec_dai_name = "snd-soc-dummy-dai", + .platform_name = "0000:00:0e.0", + .dpcm_playback = 1, + .init = NULL, + .trigger = { + SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST}, + .nonatomic = 1, + .dynamic = 1, + }, + [BXT_DPCM_AUDIO_HDMI3_PB] = { + .name = "Bxt HDMI Port3", + .stream_name = "Hdmi3", + .cpu_dai_name = "HDMI3 Pin", + .codec_name = "snd-soc-dummy", + .codec_dai_name = "snd-soc-dummy-dai", + .platform_name = "0000:00:0e.0", + .trigger = { + SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST}, + .dpcm_playback = 1, + .init = NULL, + .nonatomic = 1, + .dynamic = 1, + }, + /* Back End DAI links */ + { + /* SSP1 - Codec */ + .name = "SSP1-Codec", + .id = 0, + .cpu_dai_name = "SSP1 Pin", + .platform_name = "0000:00:0e.0", + .no_pcm = 1, + .codec_name = "MX98357A:00", + .codec_dai_name = BXT_MAXIM_CODEC_DAI, + .dai_fmt = SND_SOC_DAIFMT_I2S | + SND_SOC_DAIFMT_NB_NF | + SND_SOC_DAIFMT_CBS_CFS, + .ignore_pmdown_time = 1, + .be_hw_params_fixup = broxton_ssp_fixup, + .dpcm_playback = 1, + }, + { + /* SSP2 - Codec */ + .name = "SSP2-Codec", + .id = 1, + .cpu_dai_name = "SSP2 Pin", + .platform_name = "0000:00:0e.0", + .no_pcm = 1, + .codec_name = "i2c-DLGS7219:00", + .codec_dai_name = BXT_DIALOG_CODEC_DAI, + .init = broxton_da7219_codec_init, + .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | + SND_SOC_DAIFMT_CBS_CFS, + .ignore_pmdown_time = 1, + .be_hw_params_fixup = broxton_ssp_fixup, + .dpcm_playback = 1, + .dpcm_capture = 1, + }, + { + .name = "dmic01", + .id = 2, + .cpu_dai_name = "DMIC01 Pin", + .codec_name = "dmic-codec", + .codec_dai_name = "dmic-hifi", + .platform_name = "0000:00:0e.0", + .ignore_suspend = 1, + .be_hw_params_fixup = broxton_dmic_fixup, + .dpcm_capture = 1, + .no_pcm = 1, + }, + { + .name = "iDisp1", + .id = 3, + .cpu_dai_name = "iDisp1 Pin", + .codec_name = "ehdaudio0D2", + .codec_dai_name = "intel-hdmi-hifi1", + .platform_name = "0000:00:0e.0", + .init = broxton_hdmi_init, + .dpcm_playback = 1, + .no_pcm = 1, + }, + { + .name = "iDisp2", + .id = 4, + .cpu_dai_name = "iDisp2 Pin", + .codec_name = "ehdaudio0D2", + .codec_dai_name = "intel-hdmi-hifi2", + .platform_name = "0000:00:0e.0", + .init = broxton_hdmi_init, + .dpcm_playback = 1, + .no_pcm = 1, + }, + { + .name = "iDisp3", + .id = 5, + .cpu_dai_name = "iDisp3 Pin", + .codec_name = "ehdaudio0D2", + .codec_dai_name = "intel-hdmi-hifi3", + .platform_name = "0000:00:0e.0", + .init = broxton_hdmi_init, + .dpcm_playback = 1, + .no_pcm = 1, + }, +}; + +static int is_geminilake(void) +{ + static const struct x86_cpu_id cpu_ids[] = { + { X86_VENDOR_INTEL, 6, 0x7A }, /* Geminilake CPU_ID */ + {} + }; + + if (x86_match_cpu(cpu_ids)) + return true; + return false; +} + #define NAME_SIZE 32 static int bxt_card_late_probe(struct snd_soc_card *card) { @@ -533,6 +741,13 @@ static int bxt_card_late_probe(struct snd_soc_card *card) int err, i = 0; char jack_name[NAME_SIZE];
+ if (is_geminilake()) + snd_soc_dapm_add_routes(&card->dapm, gemini_map, + ARRAY_SIZE(gemini_map)); + else + snd_soc_dapm_add_routes(&card->dapm, broxton_map, + ARRAY_SIZE(broxton_map)); + list_for_each_entry(pcm, &ctx->hdmi_pcm_list, head) { component = pcm->codec_dai->component; snprintf(jack_name, sizeof(jack_name), @@ -559,7 +774,7 @@ static int bxt_card_late_probe(struct snd_soc_card *card) }
/* broxton audio machine driver for SPT + da7219 */ -static struct snd_soc_card broxton_audio_card = { +static struct snd_soc_card bxt_audio_card_da7219_m98357a = { .name = "bxtda7219max", .owner = THIS_MODULE, .dai_link = broxton_dais, @@ -568,8 +783,24 @@ static struct snd_soc_card broxton_audio_card = { .num_controls = ARRAY_SIZE(broxton_controls), .dapm_widgets = broxton_widgets, .num_dapm_widgets = ARRAY_SIZE(broxton_widgets), - .dapm_routes = broxton_map, - .num_dapm_routes = ARRAY_SIZE(broxton_map), + .dapm_routes = audio_map, + .num_dapm_routes = ARRAY_SIZE(audio_map), + .fully_routed = true, + .late_probe = bxt_card_late_probe, +}; + +/* geminilake audio machine driver for SPT + DA7219 */ +static struct snd_soc_card glk_audio_card_da7219_m98357a = { + .name = "glkda7219max", + .owner = THIS_MODULE, + .dai_link = geminilake_dais, + .num_links = ARRAY_SIZE(geminilake_dais), + .controls = broxton_controls, + .num_controls = ARRAY_SIZE(broxton_controls), + .dapm_widgets = broxton_widgets, + .num_dapm_widgets = ARRAY_SIZE(broxton_widgets), + .dapm_routes = audio_map, + .num_dapm_routes = ARRAY_SIZE(audio_map), .fully_routed = true, .late_probe = bxt_card_late_probe, }; @@ -584,18 +815,36 @@ static int broxton_audio_probe(struct platform_device *pdev)
INIT_LIST_HEAD(&ctx->hdmi_pcm_list);
- broxton_audio_card.dev = &pdev->dev; - snd_soc_card_set_drvdata(&broxton_audio_card, ctx); + audio_card = + (struct snd_soc_card *)pdev->id_entry->driver_data; + + audio_card->dev = &pdev->dev; + snd_soc_card_set_drvdata(audio_card, ctx);
- return devm_snd_soc_register_card(&pdev->dev, &broxton_audio_card); + return devm_snd_soc_register_card(&pdev->dev, audio_card); }
+static const struct platform_device_id bxt_board_ids[] = { + { + .name = "bxt_da7219_max98357a", + .driver_data = + (kernel_ulong_t)&bxt_audio_card_da7219_m98357a, + }, + { + .name = "glk_da7219_max98357a", + .driver_data = + (kernel_ulong_t)&glk_audio_card_da7219_m98357a, + }, + { } +}; + static struct platform_driver broxton_audio = { .probe = broxton_audio_probe, .driver = { .name = "bxt_da7219_max98357a", .pm = &snd_soc_pm_ops, }, + .id_table = bxt_board_ids, }; module_platform_driver(broxton_audio)
@@ -605,5 +854,7 @@ MODULE_AUTHOR("Sathyanarayana Nujella sathyanarayana.nujella@intel.com"); MODULE_AUTHOR("Rohit Ainapure rohit.m.ainapure@intel.com"); MODULE_AUTHOR("Harsha Priya harshapriya.n@intel.com"); MODULE_AUTHOR("Conrad Cooke conrad.cooke@intel.com"); +MODULE_AUTHOR("Naveen Manohar naveen.m@intel.com"); MODULE_LICENSE("GPL v2"); MODULE_ALIAS("platform:bxt_da7219_max98357a"); +MODULE_ALIAS("platform:glk_da7219_max98357a");
On 4/3/18 11:46 PM, Naveen Manohar wrote:
Patch adds required changes in bxt machine to use MAX98357A codec as speaker on SSP1 & DA7219 codec as headset on SSP2 on GLK board.
Signed-off-by: Naveen Manohar naveen.m@intel.com
sound/soc/intel/boards/bxt_da7219_max98357a.c | 283 ++++++++++++++++++++++++-- 1 file changed, 267 insertions(+), 16 deletions(-)
diff --git a/sound/soc/intel/boards/bxt_da7219_max98357a.c b/sound/soc/intel/boards/bxt_da7219_max98357a.c index 1c1e70c..7725aa1 100644 --- a/sound/soc/intel/boards/bxt_da7219_max98357a.c +++ b/sound/soc/intel/boards/bxt_da7219_max98357a.c @@ -16,6 +16,7 @@
- GNU General Public License for more details.
*/
+#include <asm/cpu_device_id.h> #include <linux/input.h> #include <linux/module.h> #include <linux/platform_device.h> @@ -33,6 +34,7 @@ #define DUAL_CHANNEL 2 #define QUAD_CHANNEL 4
+static struct snd_soc_card *audio_card; static struct snd_soc_jack broxton_headset; static struct snd_soc_jack broxton_hdmi[3];
@@ -103,7 +105,7 @@ static const struct snd_soc_dapm_widget broxton_widgets[] = { platform_clock_control, SND_SOC_DAPM_POST_PMD|SND_SOC_DAPM_PRE_PMU), };
-static const struct snd_soc_dapm_route broxton_map[] = { +static const struct snd_soc_dapm_route audio_map[] = { /* HP jack connectors - unknown if we have jack detection */ {"Headphone Jack", NULL, "HPL"}, {"Headphone Jack", NULL, "HPR"}, @@ -118,15 +120,6 @@ static const struct snd_soc_dapm_route broxton_map[] = { {"DMic", NULL, "SoC DMIC"},
/* CODEC BE connections */
- {"HiFi Playback", NULL, "ssp5 Tx"},
- {"ssp5 Tx", NULL, "codec0_out"},
- {"Playback", NULL, "ssp1 Tx"},
- {"ssp1 Tx", NULL, "codec1_out"},
- {"codec0_in", NULL, "ssp1 Rx"},
- {"ssp1 Rx", NULL, "Capture"},
- {"HDMI1", NULL, "hif5-0 Output"}, {"HDMI2", NULL, "hif6-0 Output"}, {"HDMI2", NULL, "hif7-0 Output"},
@@ -146,6 +139,28 @@ static const struct snd_soc_dapm_route broxton_map[] = { { "Headset Mic", NULL, "Platform Clock" }, };
+static const struct snd_soc_dapm_route broxton_map[] = {
- {"HiFi Playback", NULL, "ssp5 Tx"},
- {"ssp5 Tx", NULL, "codec0_out"},
- {"Playback", NULL, "ssp1 Tx"},
- {"ssp1 Tx", NULL, "codec1_out"},
- {"codec0_in", NULL, "ssp1 Rx"},
- {"ssp1 Rx", NULL, "Capture"},
+};
+static const struct snd_soc_dapm_route gemini_map[] = {
- {"HiFi Playback", NULL, "ssp1 Tx"},
- {"ssp1 Tx", NULL, "codec0_out"},
- {"Playback", NULL, "ssp2 Tx"},
- {"ssp2 Tx", NULL, "codec1_out"},
- {"codec0_in", NULL, "ssp2 Rx"},
- {"ssp2 Rx", NULL, "Capture"},
+};
- static int broxton_ssp_fixup(struct snd_soc_pcm_runtime *rtd, struct snd_pcm_hw_params *params) {
@@ -524,6 +539,199 @@ static struct snd_soc_dai_link broxton_dais[] = { }, };
+/* geminilake digital audio interface glue - connects codec <--> CPU */ +static struct snd_soc_dai_link geminilake_dais[] = {
- /* Front End DAI links */
- [BXT_DPCM_AUDIO_PB] = {
.name = "Bxt Audio Port",
.stream_name = "Audio",
.cpu_dai_name = "System Pin",
.platform_name = "0000:00:0e.0",
.dynamic = 1,
.codec_name = "snd-soc-dummy",
.codec_dai_name = "snd-soc-dummy-dai",
.nonatomic = 1,
.init = broxton_da7219_fe_init,
.trigger = {
SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
.dpcm_playback = 1,
.ops = &broxton_da7219_fe_ops,
- },
- [BXT_DPCM_AUDIO_CP] = {
.name = "Bxt Audio Capture Port",
.stream_name = "Audio Record",
.cpu_dai_name = "System Pin",
.platform_name = "0000:00:0e.0",
.dynamic = 1,
.codec_name = "snd-soc-dummy",
.codec_dai_name = "snd-soc-dummy-dai",
.nonatomic = 1,
.trigger = {
SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
.dpcm_capture = 1,
.ops = &broxton_da7219_fe_ops,
- },
- [BXT_DPCM_AUDIO_REF_CP] = {
.name = "Bxt Audio Reference cap",
.stream_name = "Refcap",
.cpu_dai_name = "Reference Pin",
.codec_name = "snd-soc-dummy",
.codec_dai_name = "snd-soc-dummy-dai",
.platform_name = "0000:00:0e.0",
.init = NULL,
.dpcm_capture = 1,
.nonatomic = 1,
.dynamic = 1,
.ops = &broxton_refcap_ops,
- },
- [BXT_DPCM_AUDIO_DMIC_CP] = {
.name = "Bxt Audio DMIC cap",
.stream_name = "dmiccap",
.cpu_dai_name = "DMIC Pin",
.codec_name = "snd-soc-dummy",
.codec_dai_name = "snd-soc-dummy-dai",
.platform_name = "0000:00:0e.0",
.init = NULL,
.dpcm_capture = 1,
.nonatomic = 1,
.dynamic = 1,
.ops = &broxton_dmic_ops,
- },
- [BXT_DPCM_AUDIO_HDMI1_PB] = {
.name = "Bxt HDMI Port1",
.stream_name = "Hdmi1",
.cpu_dai_name = "HDMI1 Pin",
.codec_name = "snd-soc-dummy",
.codec_dai_name = "snd-soc-dummy-dai",
.platform_name = "0000:00:0e.0",
.dpcm_playback = 1,
.init = NULL,
.trigger = {
SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
.nonatomic = 1,
.dynamic = 1,
- },
- [BXT_DPCM_AUDIO_HDMI2_PB] = {
.name = "Bxt HDMI Port2",
.stream_name = "Hdmi2",
.cpu_dai_name = "HDMI2 Pin",
.codec_name = "snd-soc-dummy",
.codec_dai_name = "snd-soc-dummy-dai",
.platform_name = "0000:00:0e.0",
.dpcm_playback = 1,
.init = NULL,
.trigger = {
SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
.nonatomic = 1,
.dynamic = 1,
- },
- [BXT_DPCM_AUDIO_HDMI3_PB] = {
.name = "Bxt HDMI Port3",
.stream_name = "Hdmi3",
.cpu_dai_name = "HDMI3 Pin",
.codec_name = "snd-soc-dummy",
.codec_dai_name = "snd-soc-dummy-dai",
.platform_name = "0000:00:0e.0",
.trigger = {
SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
.dpcm_playback = 1,
.init = NULL,
.nonatomic = 1,
.dynamic = 1,
- },
- /* Back End DAI links */
- {
/* SSP1 - Codec */
.name = "SSP1-Codec",
.id = 0,
.cpu_dai_name = "SSP1 Pin",
.platform_name = "0000:00:0e.0",
.no_pcm = 1,
.codec_name = "MX98357A:00",
.codec_dai_name = BXT_MAXIM_CODEC_DAI,
.dai_fmt = SND_SOC_DAIFMT_I2S |
SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBS_CFS,
.ignore_pmdown_time = 1,
.be_hw_params_fixup = broxton_ssp_fixup,
.dpcm_playback = 1,
- },
- {
/* SSP2 - Codec */
.name = "SSP2-Codec",
.id = 1,
.cpu_dai_name = "SSP2 Pin",
.platform_name = "0000:00:0e.0",
.no_pcm = 1,
.codec_name = "i2c-DLGS7219:00",
.codec_dai_name = BXT_DIALOG_CODEC_DAI,
.init = broxton_da7219_codec_init,
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBS_CFS,
.ignore_pmdown_time = 1,
.be_hw_params_fixup = broxton_ssp_fixup,
.dpcm_playback = 1,
.dpcm_capture = 1,
- },
As I mentioned it in my earlier reviews, you could have kept the same dailinks for the two platforms and just update the first backend to be SSP5 for BXT and SSP1 for GLK, and the second as SSP1 for BXT and SSP2 for Dialog. These updates would just be string replacements which can be done dynamically. No need to copy the same structure when all you are about is 4 strings that change the routing.
- {
.name = "dmic01",
.id = 2,
.cpu_dai_name = "DMIC01 Pin",
.codec_name = "dmic-codec",
.codec_dai_name = "dmic-hifi",
.platform_name = "0000:00:0e.0",
.ignore_suspend = 1,
.be_hw_params_fixup = broxton_dmic_fixup,
.dpcm_capture = 1,
.no_pcm = 1,
- },
- {
.name = "iDisp1",
.id = 3,
.cpu_dai_name = "iDisp1 Pin",
.codec_name = "ehdaudio0D2",
.codec_dai_name = "intel-hdmi-hifi1",
.platform_name = "0000:00:0e.0",
.init = broxton_hdmi_init,
.dpcm_playback = 1,
.no_pcm = 1,
- },
- {
.name = "iDisp2",
.id = 4,
.cpu_dai_name = "iDisp2 Pin",
.codec_name = "ehdaudio0D2",
.codec_dai_name = "intel-hdmi-hifi2",
.platform_name = "0000:00:0e.0",
.init = broxton_hdmi_init,
.dpcm_playback = 1,
.no_pcm = 1,
- },
- {
.name = "iDisp3",
.id = 5,
.cpu_dai_name = "iDisp3 Pin",
.codec_name = "ehdaudio0D2",
.codec_dai_name = "intel-hdmi-hifi3",
.platform_name = "0000:00:0e.0",
.init = broxton_hdmi_init,
.dpcm_playback = 1,
.no_pcm = 1,
- },
+};
+static int is_geminilake(void) +{
- static const struct x86_cpu_id cpu_ids[] = {
{ X86_VENDOR_INTEL, 6, 0x7A }, /* Geminilake CPU_ID */
{}
- };
- if (x86_match_cpu(cpu_ids))
return true;
- return false;
+}
- #define NAME_SIZE 32 static int bxt_card_late_probe(struct snd_soc_card *card) {
@@ -533,6 +741,13 @@ static int bxt_card_late_probe(struct snd_soc_card *card) int err, i = 0; char jack_name[NAME_SIZE];
- if (is_geminilake())
snd_soc_dapm_add_routes(&card->dapm, gemini_map,
ARRAY_SIZE(gemini_map));
- else
snd_soc_dapm_add_routes(&card->dapm, broxton_map,
ARRAY_SIZE(broxton_map));
- list_for_each_entry(pcm, &ctx->hdmi_pcm_list, head) { component = pcm->codec_dai->component; snprintf(jack_name, sizeof(jack_name),
@@ -559,7 +774,7 @@ static int bxt_card_late_probe(struct snd_soc_card *card) }
/* broxton audio machine driver for SPT + da7219 */ -static struct snd_soc_card broxton_audio_card = { +static struct snd_soc_card bxt_audio_card_da7219_m98357a = { .name = "bxtda7219max", .owner = THIS_MODULE, .dai_link = broxton_dais, @@ -568,8 +783,24 @@ static struct snd_soc_card broxton_audio_card = { .num_controls = ARRAY_SIZE(broxton_controls), .dapm_widgets = broxton_widgets, .num_dapm_widgets = ARRAY_SIZE(broxton_widgets),
- .dapm_routes = broxton_map,
- .num_dapm_routes = ARRAY_SIZE(broxton_map),
- .dapm_routes = audio_map,
- .num_dapm_routes = ARRAY_SIZE(audio_map),
- .fully_routed = true,
- .late_probe = bxt_card_late_probe,
+};
+/* geminilake audio machine driver for SPT + DA7219 */ +static struct snd_soc_card glk_audio_card_da7219_m98357a = {
- .name = "glkda7219max",
- .owner = THIS_MODULE,
- .dai_link = geminilake_dais,
- .num_links = ARRAY_SIZE(geminilake_dais),
- .controls = broxton_controls,
- .num_controls = ARRAY_SIZE(broxton_controls),
- .dapm_widgets = broxton_widgets,
- .num_dapm_widgets = ARRAY_SIZE(broxton_widgets),
- .dapm_routes = audio_map,
- .num_dapm_routes = ARRAY_SIZE(audio_map), .fully_routed = true, .late_probe = bxt_card_late_probe, };
@@ -584,18 +815,36 @@ static int broxton_audio_probe(struct platform_device *pdev)
INIT_LIST_HEAD(&ctx->hdmi_pcm_list);
- broxton_audio_card.dev = &pdev->dev;
- snd_soc_card_set_drvdata(&broxton_audio_card, ctx);
- audio_card =
(struct snd_soc_card *)pdev->id_entry->driver_data;
- audio_card->dev = &pdev->dev;
- snd_soc_card_set_drvdata(audio_card, ctx);
- return devm_snd_soc_register_card(&pdev->dev, &broxton_audio_card);
- return devm_snd_soc_register_card(&pdev->dev, audio_card); }
+static const struct platform_device_id bxt_board_ids[] = {
- {
.name = "bxt_da7219_max98357a",
.driver_data =
(kernel_ulong_t)&bxt_audio_card_da7219_m98357a,
- },
- {
.name = "glk_da7219_max98357a",
.driver_data =
(kernel_ulong_t)&glk_audio_card_da7219_m98357a,
- },
- { }
+};
- static struct platform_driver broxton_audio = { .probe = broxton_audio_probe, .driver = { .name = "bxt_da7219_max98357a", .pm = &snd_soc_pm_ops, },
- .id_table = bxt_board_ids, }; module_platform_driver(broxton_audio)
@@ -605,5 +854,7 @@ MODULE_AUTHOR("Sathyanarayana Nujella sathyanarayana.nujella@intel.com"); MODULE_AUTHOR("Rohit Ainapure rohit.m.ainapure@intel.com"); MODULE_AUTHOR("Harsha Priya harshapriya.n@intel.com"); MODULE_AUTHOR("Conrad Cooke conrad.cooke@intel.com"); +MODULE_AUTHOR("Naveen Manohar naveen.m@intel.com"); MODULE_LICENSE("GPL v2"); MODULE_ALIAS("platform:bxt_da7219_max98357a"); +MODULE_ALIAS("platform:glk_da7219_max98357a");
Add new FE DAI link to support: Parallel playback on 2 ports simultaneously
Signed-off-by: Naveen Manohar naveen.m@intel.com --- sound/soc/intel/boards/bxt_da7219_max98357a.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
diff --git a/sound/soc/intel/boards/bxt_da7219_max98357a.c b/sound/soc/intel/boards/bxt_da7219_max98357a.c index 7725aa1..5ead754 100644 --- a/sound/soc/intel/boards/bxt_da7219_max98357a.c +++ b/sound/soc/intel/boards/bxt_da7219_max98357a.c @@ -51,6 +51,7 @@ struct bxt_card_private { enum { BXT_DPCM_AUDIO_PB = 0, BXT_DPCM_AUDIO_CP, + BXT_DPCM_AUDIO_HS_PB, BXT_DPCM_AUDIO_REF_CP, BXT_DPCM_AUDIO_DMIC_CP, BXT_DPCM_AUDIO_HDMI1_PB, @@ -571,6 +572,17 @@ static struct snd_soc_dai_link geminilake_dais[] = { .dpcm_capture = 1, .ops = &broxton_da7219_fe_ops, }, + [BXT_DPCM_AUDIO_HS_PB] = { + .name = "Bxt Audio Headset Playback", + .stream_name = "Headset Playback", + .cpu_dai_name = "System Pin2", + .platform_name = "0000:00:0e.0", + .codec_name = "snd-soc-dummy", + .codec_dai_name = "snd-soc-dummy-dai", + .dpcm_playback = 1, + .nonatomic = 1, + .dynamic = 1, + }, [BXT_DPCM_AUDIO_REF_CP] = { .name = "Bxt Audio Reference cap", .stream_name = "Refcap",
This patch adds da7219_max98357a machine driver entry into machine table
Signed-off-by: Naveen Manohar naveen.m@intel.com --- sound/soc/intel/skylake/skl.c | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/sound/soc/intel/skylake/skl.c b/sound/soc/intel/skylake/skl.c index d50c2ee..96eeb1d 100644 --- a/sound/soc/intel/skylake/skl.c +++ b/sound/soc/intel/skylake/skl.c @@ -1155,6 +1155,13 @@ static struct snd_soc_acpi_mach sst_glk_devdata[] = { .drv_name = "glk_alc298s_i2s", .fw_filename = "intel/dsp_fw_glk.bin", }, + { + .id = "DLGS7219", + .drv_name = "glk_da7219_max98357a", + .fw_filename = "intel/dsp_fw_glk.bin", + .machine_quirk = snd_soc_acpi_codec_list, + .quirk_data = &bxt_codecs, + }, {} };
participants (6)
-
Benson Leung
-
David Woodhouse
-
Mark Brown
-
Naveen M
-
Naveen Manohar
-
Pierre-Louis Bossart