clear-pkgs-linux-iot-lts2018/0332-ASoC-Intel-Board-Add-B...

283 lines
8.8 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: "Schweikhardt, Markus" <markus.schweikhardt@intel.com>
Date: Tue, 9 May 2017 23:00:20 +0530
Subject: [PATCH] ASoC: Intel: Board: Add BXTP MRB machine driver for NXP
TDF8532
This is the machine driver for NXP TDF8532
Change-Id: Ieee7ba1fc2dab6fbe43836b65def88c81360d48f
Signed-off-by: Mohit Sinha <mohit.sinha@intel.com>
Signed-off-by: Markus Schweikhardt <markus.schweikhardt@intel.com>
Reviewed-on:
Reviewed-by: Shaik, Kareem M <kareem.m.shaik@intel.com>
Reviewed-by: B, Jayachandran <jayachandran.b@intel.com>
Reviewed-by: Koul, Vinod <vinod.koul@intel.com>
Tested-by: Sm, Bhadur A <bhadur.a.sm@intel.com>
---
sound/soc/intel/boards/Kconfig | 10 ++
sound/soc/intel/boards/Makefile | 2 +
sound/soc/intel/boards/bxt_tdf8532.c | 209 +++++++++++++++++++++++++++
3 files changed, 221 insertions(+)
create mode 100644 sound/soc/intel/boards/bxt_tdf8532.c
diff --git a/sound/soc/intel/boards/Kconfig b/sound/soc/intel/boards/Kconfig
index 69e1081966a8..d8b639c426fa 100644
--- a/sound/soc/intel/boards/Kconfig
+++ b/sound/soc/intel/boards/Kconfig
@@ -339,6 +339,16 @@ config SND_SOC_INTEL_CNL_RT274_MACH
with RT274 I2S audio codec.
Say Y or m if you have such a device. This is a recommended option.
If unsure select "N".
+
+config SND_SOC_INTEL_BXT_TDF8532_MACH
+ tristate "Broxton with TDF8532 I2S mode"
+ depends on MFD_INTEL_LPSS && I2C && ACPI
+ select SND_SOC_TDF8532
+ help
+ This adds support for ASoC machine driver for Broxton IVI GP MRB
+ platforms with TDF8532 I2S audio codec.
+ Say Y or m if you have such a device. This is a recommended option.
+ If unsure select "N".
endif ## SND_SOC_INTEL_SKYLAKE
endif ## SND_SOC_INTEL_MACH
diff --git a/sound/soc/intel/boards/Makefile b/sound/soc/intel/boards/Makefile
index 72dfb2ccdb61..dcd898c0b4a2 100644
--- a/sound/soc/intel/boards/Makefile
+++ b/sound/soc/intel/boards/Makefile
@@ -7,6 +7,7 @@ snd-soc-sst-broadwell-objs := broadwell.o
snd-soc-sst-bxt-da7219_max98357a-objs := bxt_da7219_max98357a.o
snd-soc-sst-bxt-rt298-objs := bxt_rt298.o
snd-soc-sst-glk-rt5682_max98357a-objs := glk_rt5682_max98357a.o
+snd-soc-sst_bxt_tdf8532-objs := bxt_tdf8532.o
snd-soc-sst-bytcr-rt5640-objs := bytcr_rt5640.o
snd-soc-sst-bytcr-rt5651-objs := bytcr_rt5651.o
snd-soc-sst-cht-bsw-rt5672-objs := cht_bsw_rt5672.o
@@ -33,6 +34,7 @@ obj-$(CONFIG_SND_SOC_INTEL_BYT_MAX98090_MACH) += snd-soc-sst-byt-max98090-mach.o
obj-$(CONFIG_SND_SOC_INTEL_BXT_DA7219_MAX98357A_MACH) += snd-soc-sst-bxt-da7219_max98357a.o
obj-$(CONFIG_SND_SOC_INTEL_BXT_RT298_MACH) += snd-soc-sst-bxt-rt298.o
obj-$(CONFIG_SND_SOC_INTEL_GLK_RT5682_MAX98357A_MACH) += snd-soc-sst-glk-rt5682_max98357a.o
+obj-$(CONFIG_SND_SOC_INTEL_BXT_TDF8532_MACH) += snd-soc-sst_bxt_tdf8532.o
obj-$(CONFIG_SND_SOC_INTEL_BROADWELL_MACH) += snd-soc-sst-broadwell.o
obj-$(CONFIG_SND_SOC_INTEL_BDW_RT5677_MACH) += snd-soc-sst-bdw-rt5677-mach.o
obj-$(CONFIG_SND_SOC_INTEL_BYTCR_RT5640_MACH) += snd-soc-sst-bytcr-rt5640.o
diff --git a/sound/soc/intel/boards/bxt_tdf8532.c b/sound/soc/intel/boards/bxt_tdf8532.c
new file mode 100644
index 000000000000..027060b17322
--- /dev/null
+++ b/sound/soc/intel/boards/bxt_tdf8532.c
@@ -0,0 +1,209 @@
+/*
+ * Intel Broxton-P I2S Machine Driver for IVI reference platform
+ * Copyright (c) 2017, Intel Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ */
+
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <sound/core.h>
+#include <sound/pcm.h>
+#include <sound/soc.h>
+#include <sound/pcm_params.h>
+
+static const struct snd_kcontrol_new broxton_tdf8532_controls[] = {
+ SOC_DAPM_PIN_SWITCH("Speaker"),
+};
+
+static const struct snd_soc_dapm_widget broxton_tdf8532_widgets[] = {
+ SND_SOC_DAPM_SPK("Speaker", NULL),
+ SND_SOC_DAPM_MIC("DiranaCp", NULL),
+ SND_SOC_DAPM_HP("DiranaPb", NULL),
+ SND_SOC_DAPM_MIC("HdmiIn", NULL),
+ SND_SOC_DAPM_MIC("TestPinCp", NULL),
+ SND_SOC_DAPM_HP("TestPinPb", NULL),
+ SND_SOC_DAPM_MIC("BtHfpDl", NULL),
+ SND_SOC_DAPM_HP("BtHfpUl", NULL),
+ SND_SOC_DAPM_MIC("ModemDl", NULL),
+ SND_SOC_DAPM_HP("ModemUl", NULL),
+};
+
+static const struct snd_soc_dapm_route broxton_tdf8532_map[] = {
+
+ /* Speaker BE connections */
+ { "Speaker", NULL, "ssp4 Tx"},
+ { "ssp4 Tx", NULL, "codec0_out"},
+
+ { "dirana_in", NULL, "ssp2 Rx"},
+ { "ssp2 Rx", NULL, "DiranaCp"},
+
+ { "dirana_aux_in", NULL, "ssp2 Rx"},
+ { "ssp2 Rx", NULL, "DiranaCp"},
+
+ { "dirana_tuner_in", NULL, "ssp2 Rx"},
+ { "ssp2 Rx", NULL, "DiranaCp"},
+
+ { "DiranaPb", NULL, "ssp2 Tx"},
+ { "ssp2 Tx", NULL, "dirana_out"},
+
+ { "hdmi_ssp1_in", NULL, "ssp1 Rx"},
+ { "ssp1 Rx", NULL, "HdmiIn"},
+
+ { "TestPin_ssp5_in", NULL, "ssp5 Rx"},
+ { "ssp5 Rx", NULL, "TestPinCp"},
+
+ { "TestPinPb", NULL, "ssp5 Tx"},
+ { "ssp5 Tx", NULL, "TestPin_ssp5_out"},
+
+ { "BtHfp_ssp0_in", NULL, "ssp0 Rx"},
+ { "ssp0 Rx", NULL, "BtHfpDl"},
+
+ { "BtHfpUl", NULL, "ssp0 Tx"},
+ { "ssp0 Tx", NULL, "BtHfp_ssp0_out"},
+
+ { "Modem_ssp3_in", NULL, "ssp3 Rx"},
+ { "ssp3 Rx", NULL, "ModemDl"},
+
+ { "ModemUl", NULL, "ssp3 Tx"},
+ { "ssp3 Tx", NULL, "Modem_ssp3_out"},
+};
+
+/* broxton digital audio interface glue - connects codec <--> CPU */
+static struct snd_soc_dai_link broxton_tdf8532_dais[] = {
+ /* Back End DAI links */
+ {
+ /* SSP0 - BT */
+ .name = "SSP0-Codec",
+ .id = 0,
+ .cpu_dai_name = "SSP0 Pin",
+ .codec_name = "snd-soc-dummy",
+ .codec_dai_name = "snd-soc-dummy-dai",
+ .platform_name = "0000:00:0e.0",
+ .ignore_suspend = 1,
+ .dpcm_capture = 1,
+ .dpcm_playback = 1,
+ .no_pcm = 1,
+ },
+ {
+ /* SSP1 - HDMI-In */
+ .name = "SSP1-Codec",
+ .id = 1,
+ .cpu_dai_name = "SSP1 Pin",
+ .codec_name = "snd-soc-dummy",
+ .codec_dai_name = "snd-soc-dummy-dai",
+ .platform_name = "0000:00:0e.0",
+ .ignore_suspend = 1,
+ .dpcm_capture = 1,
+ .no_pcm = 1,
+ },
+ {
+ /* SSP2 - Dirana */
+ .name = "SSP2-Codec",
+ .id = 2,
+ .cpu_dai_name = "SSP2 Pin",
+ .codec_name = "snd-soc-dummy",
+ .codec_dai_name = "snd-soc-dummy-dai",
+ .platform_name = "0000:00:0e.0",
+ .ignore_suspend = 1,
+ .dpcm_capture = 1,
+ .dpcm_playback = 1,
+ .no_pcm = 1,
+ },
+ {
+ /* SSP3 - Modem */
+ .name = "SSP3-Codec",
+ .id = 3,
+ .cpu_dai_name = "SSP3 Pin",
+ .codec_name = "snd-soc-dummy",
+ .codec_dai_name = "snd-soc-dummy-dai",
+ .platform_name = "0000:00:0e.0",
+ .ignore_suspend = 1,
+ .dpcm_capture = 1,
+ .dpcm_playback = 1,
+ .no_pcm = 1,
+ },
+ {
+ /* SSP4 - Amplifier */
+ .name = "SSP4-Codec",
+ .id = 4,
+ .cpu_dai_name = "SSP4 Pin",
+ .codec_name = "i2c-INT34C3:00",
+ .codec_dai_name = "tdf8532-hifi",
+ .platform_name = "0000:00:0e.0",
+ .ignore_suspend = 1,
+ .dpcm_playback = 1,
+ .no_pcm = 1,
+ },
+ {
+ /* SSP5 - TestPin */
+ .name = "SSP5-Codec",
+ .id = 5,
+ .cpu_dai_name = "SSP5 Pin",
+ .codec_name = "snd-soc-dummy",
+ .codec_dai_name = "snd-soc-dummy-dai",
+ .platform_name = "0000:00:0e.0",
+ .ignore_suspend = 1,
+ .dpcm_capture = 1,
+ .dpcm_playback = 1,
+ .no_pcm = 1,
+ },
+};
+
+static int bxt_add_dai_link(struct snd_soc_card *card,
+ struct snd_soc_dai_link *link)
+{
+ link->platform_name = "0000:00:0e.0";
+ link->nonatomic = 1;
+ return 0;
+}
+
+/* broxton audio machine driver for TDF8532 */
+static struct snd_soc_card broxton_tdf8532 = {
+ .name = "broxton_tdf8532",
+ .dai_link = broxton_tdf8532_dais,
+ .num_links = ARRAY_SIZE(broxton_tdf8532_dais),
+ .controls = broxton_tdf8532_controls,
+ .num_controls = ARRAY_SIZE(broxton_tdf8532_controls),
+ .dapm_widgets = broxton_tdf8532_widgets,
+ .num_dapm_widgets = ARRAY_SIZE(broxton_tdf8532_widgets),
+ .dapm_routes = broxton_tdf8532_map,
+ .num_dapm_routes = ARRAY_SIZE(broxton_tdf8532_map),
+ .fully_routed = true,
+ .add_dai_link = bxt_add_dai_link,
+};
+
+static int broxton_tdf8532_audio_probe(struct platform_device *pdev)
+{
+ dev_info(&pdev->dev, "%s registering %s\n", __func__, pdev->name);
+ broxton_tdf8532.dev = &pdev->dev;
+ return snd_soc_register_card(&broxton_tdf8532);
+}
+
+static int broxton_tdf8532_audio_remove(struct platform_device *pdev)
+{
+ snd_soc_unregister_card(&broxton_tdf8532);
+ return 0;
+}
+
+static struct platform_driver broxton_tdf8532_audio = {
+ .probe = broxton_tdf8532_audio_probe,
+ .remove = broxton_tdf8532_audio_remove,
+ .driver = {
+ .name = "bxt_tdf8532",
+ },
+};
+
+module_platform_driver(broxton_tdf8532_audio)
+
+/* Module information */
+MODULE_DESCRIPTION("Intel SST Audio for Broxton GP MRB");
+MODULE_LICENSE("GPL v2");
+MODULE_ALIAS("platform:gpmrb_machine");
--
https://clearlinux.org