>
> Support MAX98390 speaker amplifier on cometlake platform. Driver now
> detects amplifier type in the probe function and installs corresponding
> controls and DAPM widgets/routes in the late_probe function.
>
> Signed-off-by: Brent Lu
This patch is from Chrome-v4.19 branch to support the combination of DA7219
and MAX98390 on a CML Chromebook. It reuses the topology file
sof-cml-da7219-max98357a.tplg
> ---
> sound/soc/intel/boards/Kconfig| 20
> sound/soc/intel/boards/bxt_da7219_max98357a.c | 129
> --
> sound/soc/intel/common/soc-acpi-intel-cml-match.c | 4 +-
> 3 files changed, 139 insertions(+), 14 deletions(-)
>
> diff --git a/sound/soc/intel/boards/Kconfig
> b/sound/soc/intel/boards/Kconfig index 3d820e1..b3b863e 100644
> --- a/sound/soc/intel/boards/Kconfig
> +++ b/sound/soc/intel/boards/Kconfig
> @@ -291,9 +291,17 @@ config
> SND_SOC_INTEL_DA7219_MAX98357A_GENERIC
> select SND_SOC_DMIC
> select SND_SOC_HDAC_HDMI
>
> +config SND_SOC_INTEL_DA7219_MAX98390_GENERIC
> + tristate
> + select SND_SOC_DA7219
> + select SND_SOC_MAX98390
> + select SND_SOC_DMIC
> + select SND_SOC_HDAC_HDMI
> +
> config SND_SOC_INTEL_BXT_DA7219_MAX98357A_COMMON
> tristate
> select SND_SOC_INTEL_DA7219_MAX98357A_GENERIC
> + select SND_SOC_INTEL_DA7219_MAX98390_GENERIC
>
> if SND_SOC_INTEL_APL
>
> @@ -309,6 +317,18 @@ config
> SND_SOC_INTEL_BXT_DA7219_MAX98357A_MACH
> Say Y or m if you have such a device. This is a recommended option.
> If unsure select "N".
>
> +config SND_SOC_INTEL_BXT_DA7219_MAX98390_MACH
> + tristate "Broxton with DA7219 and MAX98390 in I2S Mode"
> + depends on I2C && ACPI && GPIOLIB
> + depends on MFD_INTEL_LPSS || COMPILE_TEST
> + depends on SND_HDA_CODEC_HDMI
> + select SND_SOC_INTEL_BXT_DA7219_MAX98357A_COMMON
> + help
> +This adds support for ASoC machine driver for Broxton-P platforms
> +with DA7219 + MAX98390 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_RT298_MACH
> tristate "Broxton with RT298 I2S mode"
> depends on I2C && ACPI && GPIOLIB
> diff --git a/sound/soc/intel/boards/bxt_da7219_max98357a.c
> b/sound/soc/intel/boards/bxt_da7219_max98357a.c
> index 44016c1..12f07e1 100644
> --- a/sound/soc/intel/boards/bxt_da7219_max98357a.c
> +++ b/sound/soc/intel/boards/bxt_da7219_max98357a.c
> @@ -25,9 +25,14 @@
>
> #define BXT_DIALOG_CODEC_DAI "da7219-hifi"
> #define BXT_MAXIM_CODEC_DAI "HiFi"
> +#define MAX98390_DEV0_NAME "i2c-MX98390:00"
> +#define MAX98390_DEV1_NAME "i2c-MX98390:01"
> #define DUAL_CHANNEL 2
> #define QUAD_CHANNEL 4
>
> +#define SPKAMP_MAX98357A 1
> +#define SPKAMP_MAX98390 2
> +
> static struct snd_soc_jack broxton_headset; static struct snd_soc_jack
> broxton_hdmi[3];
>
> @@ -40,6 +45,7 @@ struct bxt_hdmi_pcm {
> struct bxt_card_private {
> struct list_head hdmi_pcm_list;
> bool common_hdmi_codec_drv;
> + int spkamp;
> };
>
> enum {
> @@ -85,13 +91,20 @@ static int platform_clock_control(struct
> snd_soc_dapm_widget *w, static const struct snd_kcontrol_new
> broxton_controls[] = {
> SOC_DAPM_PIN_SWITCH("Headphone Jack"),
> SOC_DAPM_PIN_SWITCH("Headset Mic"),
> +};
> +
> +static const struct snd_kcontrol_new max98357a_controls[] = {
> SOC_DAPM_PIN_SWITCH("Spk"),
> };
>
> +static const struct snd_kcontrol_new max98390_controls[] = {
> + SOC_DAPM_PIN_SWITCH("Left Spk"),
> + SOC_DAPM_PIN_SWITCH("Right Spk"),
> +};
> +
> static const struct snd_soc_dapm_widget broxton_widgets[] = {
> SND_SOC_DAPM_HP("Headphone Jack", NULL),
> SND_SOC_DAPM_MIC("Headset Mic", NULL),
> - SND_SOC_DAPM_SPK("Spk", NULL),
> SND_SOC_DAPM_MIC("SoC DMIC", NULL),
> SND_SOC_DAPM_SPK("HDMI1", NULL),
> SND_SOC_DAPM_SPK("HDMI2", NULL),
> @@ -100,14 +113,20 @@ 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_widget max98357a_widgets[] = {
> + SND_SOC_DAPM_SPK("Spk", NULL),
> +};
> +
> +static const struct snd_soc_dapm_widget max98390_widgets[] = {
> + SND_SOC_DAPM_SPK("Left Spk", NULL),
> + SND_SOC_DAPM_SPK("Right Spk", NULL),
> +};
> +
> 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"},
>
> - /* speaker */
> - {"Spk", NULL, "Speaker"},
> -
> /* other jacks */
> {"MIC", NULL, "Headset Mic"},
>
> @@ -134,6 +153,17 @@ static const struct snd_soc_dapm_route audio_map[]
> = {
> { "Headset Mic", NULL, "Platform Clock" }, };
>
> +static const struct