Skip to contentSkip to conversation

Baytrail followup

PATCH In review Pierre-Louis Bossart 2 participants 16 messages Jan 4, 2016 – Jan 6, 2016

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v2 cover Baytrail followup

Thanks to Mark for merging most of the patches in the first batch. Resending update for patches that where not merged.
No additional functionalitity, only correction in first patch to refer to correct SHA1 and copy/paste fixes in bytcr_rt5651 machine driver

Acknowledgements:
Keyon Jie for his MinnowBoard validation
Francisco Mendez for his help with the MCLK and jack detection Jack Yu and Bard Liao for their codec support

Known issues:
noise on startup when using speakers

Once this batch is merged, the following updates will be provided:
MCLK support to fix noise issues
BYT-CR fixes
jack detection

Jack Yu (1):
ASoC: rt5640: add ASRC support

Jorge Fernandez Monteagudo (1):
ASoC: Intel: Atom: Add support for HP ElitePad 1000 G2

Pierre-Louis Bossart (6):
ASoC: Intel: fix ACPI probe regression with Atom DPCM driver
ASoC: Intel: add bytct-rt5651 machine driver
ASoC: intel: boards: add card for MinnowBoard I2S access
ASoC: Intel: bytcr-rt5640: enable ASRC
ASoC: Intel: bytcr_rt5640: fixup DAI codec_name with HID
ASoC: Intel: Atom: add support for RT5642

 sound/soc/codecs/rt5640.c              | 103 ++++++++++
 sound/soc/codecs/rt5640.h              |  17 ++
 sound/soc/intel/Kconfig                |  24 +++
 sound/soc/intel/atom/sst/sst_acpi.c    |  23 ++-
 sound/soc/intel/boards/Makefile        |   4 +
 sound/soc/intel/boards/bytcr_nocodec.c | 233 +++++++++++++++++++++++
 sound/soc/intel/boards/bytcr_rt5640.c  |  25 ++-
 sound/soc/intel/boards/bytcr_rt5651.c  | 332 +++++++++++++++++++++++++++++++++
 sound/soc/intel/common/Makefile        |   5 +
 9 files changed, 760 insertions(+), 6 deletions(-)
 create mode 100644 sound/soc/intel/boards/bytcr_nocodec.c
 create mode 100644 sound/soc/intel/boards/bytcr_rt5651.c
Signature · 1 line
1.9.1
#1 lore raw

PATCH v2 1/8 ASoC: Intel: fix ACPI probe regression with Atom DPCM driver

The commit 95f098014815b330838b1173d3d7bcea3b481242 "ASoC: Intel: Move apci find machine routines"

introduced a regression in ACPI probe of the DPCM driver. Fix by conditionally compiling sst-acpi when the DPCM driver is not selected

---
 sound/soc/intel/common/Makefile | 5 +++++
 1 file changed, 5 insertions(+)
sound/soc/intel/common/Makefile +5 -0
index 3b9332e..668fdee 100644
@@ -1,5 +1,10 @@
 snd-soc-sst-dsp-objs := sst-dsp.o
+ifneq ($(CONFIG_SND_SST_IPC_ACPI),)
+snd-soc-sst-acpi-objs := sst-match-acpi.o
+else
 snd-soc-sst-acpi-objs := sst-acpi.o sst-match-acpi.o
+endif
+
 snd-soc-sst-ipc-objs := sst-ipc.o
 
 snd-soc-sst-dsp-$(CONFIG_DW_DMAC_CORE) += sst-firmware.o
Signature · 1 line
1.9.1
#2 lore raw

PATCH v2 2/8 ASoC: Intel: add bytct-rt5651 machine driver

In reply to Pierre-Louis Bossart

based on bytcr-rt5640 with changes only on codec side Quirk logic is kept as placeholder.

---
 sound/soc/intel/Kconfig               |  12 ++
 sound/soc/intel/atom/sst/sst_acpi.c   |   3 +
 sound/soc/intel/boards/Makefile       |   2 +
 sound/soc/intel/boards/bytcr_rt5651.c | 332 ++++++++++++++++++++++++++++++++++
 4 files changed, 349 insertions(+)
 create mode 100644 sound/soc/intel/boards/bytcr_rt5651.c
sound/soc/intel/Kconfig +12 -0
index 337e178..803f95e 100644
@@ -103,6 +103,18 @@ config SND_SOC_INTEL_BYTCR_RT5640_MACH
           Say Y if you have such a device
           If unsure select "N".
 
+config SND_SOC_INTEL_BYTCR_RT5651_MACH
+        tristate "ASoC Audio driver for Intel Baytrail and Baytrail-CR with RT5651 codec"
+	depends on X86 && I2C
+	select SND_SOC_RT5651
+	select SND_SST_MFLD_PLATFORM
+	select SND_SST_IPC_ACPI
+	help
+          This adds support for ASoC machine driver for Intel(R) Baytrail and Baytrail-CR
+          platforms with RT5651 audio codec.
+          Say Y if you have such a device
+          If unsure select "N".
+
 config SND_SOC_INTEL_CHT_BSW_RT5672_MACH
         tristate "ASoC Audio driver for Intel Cherrytrail & Braswell with RT5672 codec"
         depends on X86_INTEL_LPSS && I2C
sound/soc/intel/atom/sst/sst_acpi.c +3 -0
index f424460..b6ea0a5 100644
@@ -316,6 +316,9 @@ static int sst_acpi_remove(struct platform_device *pdev)
 static struct sst_acpi_mach sst_acpi_bytcr[] = {
 	{"10EC5640", "bytcr_rt5640", "intel/fw_sst_0f28.bin", "bytcr_rt5640", NULL,
 						&byt_rvp_platform_data },
+	{"10EC5651", "bytcr_rt5651", "intel/fw_sst_0f28.bin", "bytcr_rt5651", NULL,
+						&byt_rvp_platform_data },
+
 	{},
 };
 
sound/soc/intel/boards/Makefile +2 -0
index 2485ea9..3310c0f 100644
@@ -3,6 +3,7 @@ snd-soc-sst-byt-rt5640-mach-objs := byt-rt5640.o
 snd-soc-sst-byt-max98090-mach-objs := byt-max98090.o
 snd-soc-sst-broadwell-objs := broadwell.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
 snd-soc-sst-cht-bsw-rt5645-objs := cht_bsw_rt5645.o
 snd-soc-sst-cht-bsw-max98090_ti-objs := cht_bsw_max98090_ti.o
@@ -15,6 +16,7 @@ obj-$(CONFIG_SND_SOC_INTEL_BYT_RT5640_MACH) += snd-soc-sst-byt-rt5640-mach.o
 obj-$(CONFIG_SND_SOC_INTEL_BYT_MAX98090_MACH) += snd-soc-sst-byt-max98090-mach.o
 obj-$(CONFIG_SND_SOC_INTEL_BROADWELL_MACH) += snd-soc-sst-broadwell.o
 obj-$(CONFIG_SND_SOC_INTEL_BYTCR_RT5640_MACH) += snd-soc-sst-bytcr-rt5640.o
+obj-$(CONFIG_SND_SOC_INTEL_BYTCR_RT5651_MACH) += snd-soc-sst-bytcr-rt5651.o
 obj-$(CONFIG_SND_SOC_INTEL_CHT_BSW_RT5672_MACH) += snd-soc-sst-cht-bsw-rt5672.o
 obj-$(CONFIG_SND_SOC_INTEL_CHT_BSW_RT5645_MACH) += snd-soc-sst-cht-bsw-rt5645.o
 obj-$(CONFIG_SND_SOC_INTEL_CHT_BSW_MAX98090_TI_MACH) += snd-soc-sst-cht-bsw-max98090_ti.o
sound/soc/intel/boards/bytcr_rt5651.c new file +332 -0

332 lines not on this page · raw message

Signature · 1 line
1.9.1
maintainer
#3 lore raw

Applied "ASoC: Intel: add bytct-rt5651 machine driver" to the asoc tree

The patch

ASoC: Intel: add bytct-rt5651 machine driver

has been applied to the asoc tree at

git://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

Quoted 1 line

From 2bd5bd15a51858866d792c678f0fe9280c4e8fa7 Mon Sep 17 00:00:00 2001

From: Pierre-Louis Bossart <[email protected]>
Date: Mon, 4 Jan 2016 17:20:24 -0600
Subject: [PATCH] ASoC: Intel: add bytct-rt5651 machine driver

based on bytcr-rt5640 with changes only on codec side Quirk logic is kept as placeholder.

---
 sound/soc/intel/Kconfig               |  12 ++
 sound/soc/intel/atom/sst/sst_acpi.c   |   3 +
 sound/soc/intel/boards/Makefile       |   2 +
 sound/soc/intel/boards/bytcr_rt5651.c | 332 ++++++++++++++++++++++++++++++++++
 4 files changed, 349 insertions(+)
 create mode 100644 sound/soc/intel/boards/bytcr_rt5651.c
sound/soc/intel/Kconfig +12 -0
index 337e178c1acb..803f95e40679 100644
@@ -103,6 +103,18 @@ config SND_SOC_INTEL_BYTCR_RT5640_MACH
           Say Y if you have such a device
           If unsure select "N".
 
+config SND_SOC_INTEL_BYTCR_RT5651_MACH
+        tristate "ASoC Audio driver for Intel Baytrail and Baytrail-CR with RT5651 codec"
+	depends on X86 && I2C
+	select SND_SOC_RT5651
+	select SND_SST_MFLD_PLATFORM
+	select SND_SST_IPC_ACPI
+	help
+          This adds support for ASoC machine driver for Intel(R) Baytrail and Baytrail-CR
+          platforms with RT5651 audio codec.
+          Say Y if you have such a device
+          If unsure select "N".
+
 config SND_SOC_INTEL_CHT_BSW_RT5672_MACH
         tristate "ASoC Audio driver for Intel Cherrytrail & Braswell with RT5672 codec"
         depends on X86_INTEL_LPSS && I2C
sound/soc/intel/atom/sst/sst_acpi.c +3 -0
index f424460b917e..b6ea0a58f9d3 100644
@@ -316,6 +316,9 @@ static int sst_acpi_remove(struct platform_device *pdev)
 static struct sst_acpi_mach sst_acpi_bytcr[] = {
 	{"10EC5640", "bytcr_rt5640", "intel/fw_sst_0f28.bin", "bytcr_rt5640", NULL,
 						&byt_rvp_platform_data },
+	{"10EC5651", "bytcr_rt5651", "intel/fw_sst_0f28.bin", "bytcr_rt5651", NULL,
+						&byt_rvp_platform_data },
+
 	{},
 };
 
sound/soc/intel/boards/Makefile +2 -0
index 2485ea9434ad..3310c0f9c356 100644
@@ -3,6 +3,7 @@ snd-soc-sst-byt-rt5640-mach-objs := byt-rt5640.o
 snd-soc-sst-byt-max98090-mach-objs := byt-max98090.o
 snd-soc-sst-broadwell-objs := broadwell.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
 snd-soc-sst-cht-bsw-rt5645-objs := cht_bsw_rt5645.o
 snd-soc-sst-cht-bsw-max98090_ti-objs := cht_bsw_max98090_ti.o
@@ -15,6 +16,7 @@ obj-$(CONFIG_SND_SOC_INTEL_BYT_RT5640_MACH) += snd-soc-sst-byt-rt5640-mach.o
 obj-$(CONFIG_SND_SOC_INTEL_BYT_MAX98090_MACH) += snd-soc-sst-byt-max98090-mach.o
 obj-$(CONFIG_SND_SOC_INTEL_BROADWELL_MACH) += snd-soc-sst-broadwell.o
 obj-$(CONFIG_SND_SOC_INTEL_BYTCR_RT5640_MACH) += snd-soc-sst-bytcr-rt5640.o
+obj-$(CONFIG_SND_SOC_INTEL_BYTCR_RT5651_MACH) += snd-soc-sst-bytcr-rt5651.o
 obj-$(CONFIG_SND_SOC_INTEL_CHT_BSW_RT5672_MACH) += snd-soc-sst-cht-bsw-rt5672.o
 obj-$(CONFIG_SND_SOC_INTEL_CHT_BSW_RT5645_MACH) += snd-soc-sst-cht-bsw-rt5645.o
 obj-$(CONFIG_SND_SOC_INTEL_CHT_BSW_MAX98090_TI_MACH) += snd-soc-sst-cht-bsw-max98090_ti.o
sound/soc/intel/boards/bytcr_rt5651.c new file +332 -0

332 lines not on this page · raw message

Signature · 1 line
2.7.0.rc3
#4 lore raw

PATCH v2 3/8 ASoC: intel: boards: add card for MinnowBoard I2S access

In reply to Pierre-Louis Bossart

Add card with dummy codec and DAI to make I2S signals observable. Uses Mic and Speaker pins/widgets to control DAPM

---
 sound/soc/intel/Kconfig                |  12 ++
 sound/soc/intel/boards/Makefile        |   2 +
 sound/soc/intel/boards/bytcr_nocodec.c | 233 +++++++++++++++++++++++++++++++++
 3 files changed, 247 insertions(+)
 create mode 100644 sound/soc/intel/boards/bytcr_nocodec.c
sound/soc/intel/Kconfig +12 -0
index 803f95e..5be63c7 100644
@@ -115,6 +115,18 @@ config SND_SOC_INTEL_BYTCR_RT5651_MACH
           Say Y if you have such a device
           If unsure select "N".
 
+config SND_SOC_INTEL_BYTCR_NOCODEC_MACH
+        tristate "ASoC Audio driver for Intel Baytrail and Baytrail-CR with no codec (MinnowBoard MAX)"
+	depends on X86 && I2C
+	select SND_SST_MFLD_PLATFORM
+	select SND_SST_IPC_ACPI
+	help
+          This adds support for ASoC machine driver for the MinnowBoard Max
+	  and provides access to I2S signals on the Low-Speed connector
+          Say Y if you have such a device
+          If unsure select "N".
+
+
 config SND_SOC_INTEL_CHT_BSW_RT5672_MACH
         tristate "ASoC Audio driver for Intel Cherrytrail & Braswell with RT5672 codec"
         depends on X86_INTEL_LPSS && I2C
sound/soc/intel/boards/Makefile +2 -0
index 3310c0f..c825d2c 100644
@@ -4,6 +4,7 @@ snd-soc-sst-byt-max98090-mach-objs := byt-max98090.o
 snd-soc-sst-broadwell-objs := broadwell.o
 snd-soc-sst-bytcr-rt5640-objs := bytcr_rt5640.o
 snd-soc-sst-bytcr-rt5651-objs := bytcr_rt5651.o
+snd-soc-sst-bytcr-nocodec-objs := bytcr_nocodec.o
 snd-soc-sst-cht-bsw-rt5672-objs := cht_bsw_rt5672.o
 snd-soc-sst-cht-bsw-rt5645-objs := cht_bsw_rt5645.o
 snd-soc-sst-cht-bsw-max98090_ti-objs := cht_bsw_max98090_ti.o
@@ -17,6 +18,7 @@ obj-$(CONFIG_SND_SOC_INTEL_BYT_MAX98090_MACH) += snd-soc-sst-byt-max98090-mach.o
 obj-$(CONFIG_SND_SOC_INTEL_BROADWELL_MACH) += snd-soc-sst-broadwell.o
 obj-$(CONFIG_SND_SOC_INTEL_BYTCR_RT5640_MACH) += snd-soc-sst-bytcr-rt5640.o
 obj-$(CONFIG_SND_SOC_INTEL_BYTCR_RT5651_MACH) += snd-soc-sst-bytcr-rt5651.o
+obj-$(CONFIG_SND_SOC_INTEL_BYTCR_NOCODEC_MACH) += snd-soc-sst-bytcr-nocodec.o
 obj-$(CONFIG_SND_SOC_INTEL_CHT_BSW_RT5672_MACH) += snd-soc-sst-cht-bsw-rt5672.o
 obj-$(CONFIG_SND_SOC_INTEL_CHT_BSW_RT5645_MACH) += snd-soc-sst-cht-bsw-rt5645.o
 obj-$(CONFIG_SND_SOC_INTEL_CHT_BSW_MAX98090_TI_MACH) += snd-soc-sst-cht-bsw-max98090_ti.o
sound/soc/intel/boards/bytcr_nocodec.c new file +233 -0

233 lines not on this page · raw message

Signature · 1 line
1.9.1
maintainer
#5 lore raw

Re: [PATCH v2 3/8] ASoC: intel: boards: add card for MinnowBoard I2S access

Quoted 2 lines · Pierre-Louis Bossart

Add card with dummy codec and DAI to make I2S signals observable. Uses Mic and Speaker pins/widgets to control DAPM

I'm wondering how this is going to get loaded (I don't see what creates the platform device) and how we handle systems with a CODEC connected on the expansion headers?

#6 lore raw

Re: [PATCH v2 3/8] ASoC: intel: boards: add card for MinnowBoard I2S access

Quoted 7 lines · Mark Brown
Quoted 2 lines · Pierre-Louis Bossart

Add card with dummy codec and DAI to make I2S signals observable. Uses Mic and Speaker pins/widgets to control DAPM

I'm wondering how this is going to get loaded (I don't see what creates the platform device) and how we handle systems with a CODEC connected on the expansion headers?

Good question.

On the minnowmax we can't use the default firmware since users may use different codecs and the pins may be used for different non-audio functions and lures. The firmare team also didn't want to maintain tons of options. Generating the image from source is possible but it requires a fair amount of work to keep track of unrelated non-audio firmware updates.

To solve this audio is disabled by default, and we have an EFI application loaded by the startup.nsh file that sets the relevant codec information in the SSDT table so that you can swap codec cards at will. The EFI application will be open-sourced so that additional codecs can be added as needed with changes in the ASL code. The whole thing was tested with experimental releases in three different setups for now but will be formally released next month.

On probe the sst_acpi part checks for the presence of known codecs and registers the platform driver. For the case where no codec is present I just added an entry at the end of the table that always works (checks for an SOC-side HID) and is selected if no other codec was found. I need to add this patch and submit it, forgot to add it in this batch.

maintainer
#7 lore raw

Re: [PATCH v2 3/8] ASoC: intel: boards: add card for MinnowBoard I2S access

Quoted 8 lines · Pierre-Louis Bossart
Quoted 3 lines · Mark Brown

I'm wondering how this is going to get loaded (I don't see what creates the platform device) and how we handle systems with a CODEC connected on the expansion headers?

Good question.

Quoted 7 lines

To solve this audio is disabled by default, and we have an EFI application loaded by the startup.nsh file that sets the relevant codec information in the SSDT table so that you can swap codec cards at will. The EFI application will be open-sourced so that additional codecs can be added as needed with changes in the ASL code. The whole thing was tested with experimental releases in three different setups for now but will be formally released next month.

Sets the relevant codec information by...?

Quoted 5 lines

On probe the sst_acpi part checks for the presence of known codecs and registers the platform driver. For the case where no codec is present I just added an entry at the end of the table that always works (checks for an SOC-side HID) and is selected if no other codec was found. I need to add this patch and submit it, forgot to add it in this batch.

Can we punt on this until we've got the rest of the infrastructure to look at? I'd feel safer and it sounds like it's going to need some manual hacking to get working anyway until the other bits are lined up.

#8 lore raw

Re: [PATCH v2 3/8] ASoC: intel: boards: add card for MinnowBoard I2S access

Quoted 17 lines · Mark Brown
Quoted 8 lines · Pierre-Louis Bossart
Quoted 3 lines · Mark Brown

I'm wondering how this is going to get loaded (I don't see what creates the platform device) and how we handle systems with a CODEC connected on the expansion headers?

Good question.

Quoted 7 lines

To solve this audio is disabled by default, and we have an EFI application loaded by the startup.nsh file that sets the relevant codec information in the SSDT table so that you can swap codec cards at will. The EFI application will be open-sourced so that additional codecs can be added as needed with changes in the ASL code. The whole thing was tested with experimental releases in three different setups for now but will be formally released next month.

Quoted 1 line

Sets the relevant codec information by...?

exposing devices and dependencies, setting the _HID, codec I2C address, Gpio lines, DSD properties if needed. Nothing new compared to a normal DSDT table except that you only add the audio-related information yourself.

Quoted 10 lines
Quoted 6 lines

On probe the sst_acpi part checks for the presence of known codecs and registers the platform driver. For the case where no codec is present I just added an entry at the end of the table that always works (checks for an SOC-side HID) and is selected if no other codec was found. I need to add this patch and submit it, forgot to add it in this batch.

Can we punt on this until we've got the rest of the infrastructure to look at? I'd feel safer and it sounds like it's going to need some manual hacking to get working anyway until the other bits are lined up.

that's fine, i will provide more documentation to explain the steps later this month. The 'infrastructure' isn't that bad really - and since the SSDT update application is open-source for once you can't blame the BIOS if your audio doesn't work :-)

#9 lore raw

PATCH v2 4/8 ASoC: rt5640: add ASRC support

In reply to Pierre-Louis Bossart

From: Jack Yu <[email protected]>

---
 sound/soc/codecs/rt5640.c | 102 ++++++++++++++++++++++++++++++++++++++++++++++
 sound/soc/codecs/rt5640.h |  17 ++++++++
 2 files changed, 119 insertions(+)
sound/soc/codecs/rt5640.c +102 -0
index f2beb1a..18f2d3b 100644
@@ -488,6 +488,18 @@ static int is_sys_clk_from_pll(struct snd_soc_dapm_widget *source,
 		return 0;
 }
 
+static int is_using_asrc(struct snd_soc_dapm_widget *source,
+			 struct snd_soc_dapm_widget *sink)
+{
+	struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm);
+	struct rt5640_priv *rt5640 = snd_soc_codec_get_drvdata(codec);
+
+	if (!rt5640->asrc_en)
+		return 0;
+
+	return 1;
+}
+
 /* Digital Mixer */
 static const struct snd_kcontrol_new rt5640_sto_adc_l_mix[] = {
 	SOC_DAPM_SINGLE("ADC1 Switch", RT5640_STO_ADC_MIXER,
@@ -1059,6 +1071,20 @@ static int rt5640_hp_post_event(struct snd_soc_dapm_widget *w,
 static const struct snd_soc_dapm_widget rt5640_dapm_widgets[] = {
 	SND_SOC_DAPM_SUPPLY("PLL1", RT5640_PWR_ANLG2,
 			RT5640_PWR_PLL_BIT, 0, NULL, 0),
+
+	/* ASRC */
+	SND_SOC_DAPM_SUPPLY_S("Stereo Filter ASRC", 1, RT5640_ASRC_1,
+			 15, 0, NULL, 0),
+	SND_SOC_DAPM_SUPPLY_S("I2S2 Filter ASRC", 1, RT5640_ASRC_1,
+			 12, 0, NULL, 0),
+	SND_SOC_DAPM_SUPPLY_S("I2S2 ASRC", 1, RT5640_ASRC_1,
+			 11, 0, NULL, 0),
+	SND_SOC_DAPM_SUPPLY_S("DMIC1 ASRC", 1, RT5640_ASRC_1,
+			 9, 0, NULL, 0),
+	SND_SOC_DAPM_SUPPLY_S("DMIC2 ASRC", 1, RT5640_ASRC_1,
+			 8, 0, NULL, 0),
+
+
 	/* Input Side */
 	/* micbias */
 	SND_SOC_DAPM_SUPPLY("LDO2", RT5640_PWR_ANLG1,
@@ -1319,6 +1345,12 @@ static const struct snd_soc_dapm_widget rt5639_specific_dapm_widgets[] = {
 };
 
 static const struct snd_soc_dapm_route rt5640_dapm_routes[] = {
+	{ "I2S1", NULL, "Stereo Filter ASRC", is_using_asrc },
+	{ "I2S2", NULL, "I2S2 ASRC", is_using_asrc },
+	{ "I2S2", NULL, "I2S2 Filter ASRC", is_using_asrc },
+	{ "DMIC1", NULL, "DMIC1 ASRC", is_using_asrc },
+	{ "DMIC2", NULL, "DMIC2 ASRC", is_using_asrc },
+
 	{"IN1P", NULL, "LDO2"},
 	{"IN2P", NULL, "LDO2"},
 	{"IN3P", NULL, "LDO2"},
@@ -1981,6 +2013,76 @@ int rt5640_dmic_enable(struct snd_soc_codec *codec,
 }
 EXPORT_SYMBOL_GPL(rt5640_dmic_enable);
 
+int rt5640_sel_asrc_clk_src(struct snd_soc_codec *codec,
+		unsigned int filter_mask, unsigned int clk_src)
+{
+	struct rt5640_priv *rt5640 = snd_soc_codec_get_drvdata(codec);
+	unsigned int asrc2_mask = 0;
+	unsigned int asrc2_value = 0;
+
+	switch (clk_src) {
+	case RT5640_CLK_SEL_SYS:
+	case RT5640_CLK_SEL_ASRC:
+		break;
+
+	default:
+		return -EINVAL;
+	}
+
+	if (!filter_mask)
+		return -EINVAL;
+
+	if (filter_mask & RT5640_DA_STEREO_FILTER) {
+		asrc2_mask |= RT5640_STO_DAC_M_MASK;
+		asrc2_value = (asrc2_value & ~RT5640_STO_DAC_M_MASK)
+			| (clk_src << RT5640_STO_DAC_M_SFT);
+	}
+
+	if (filter_mask & RT5640_DA_MONO_L_FILTER) {
+		asrc2_mask |= RT5640_MDA_L_M_MASK;
+		asrc2_value = (asrc2_value & ~RT5640_MDA_L_M_MASK)
+			| (clk_src << RT5640_MDA_L_M_SFT);
+	}
+
+	if (filter_mask & RT5640_DA_MONO_R_FILTER) {
+		asrc2_mask |= RT5640_MDA_R_M_MASK;
+		asrc2_value = (asrc2_value & ~RT5640_MDA_R_M_MASK)
+			| (clk_src << RT5640_MDA_R_M_SFT);
+	}
+
+	if (filter_mask & RT5640_AD_STEREO_FILTER) {
+		asrc2_mask |= RT5640_ADC_M_MASK;
+		asrc2_value = (asrc2_value & ~RT5640_ADC_M_MASK)
+			| (clk_src << RT5640_ADC_M_SFT);
+	}
+
+	if (filter_mask & RT5640_AD_MONO_L_FILTER) {
+		asrc2_mask |= RT5640_MAD_L_M_MASK;
+		asrc2_value = (asrc2_value & ~RT5640_MAD_L_M_MASK)
+			| (clk_src << RT5640_MAD_L_M_SFT);
+	}
+
+	if (filter_mask & RT5640_AD_MONO_R_FILTER)  {
+		asrc2_mask |= RT5640_MAD_R_M_MASK;
+		asrc2_value = (asrc2_value & ~RT5640_MAD_R_M_MASK)
+			| (clk_src << RT5640_MAD_R_M_SFT);
+	}
+
+	snd_soc_update_bits(codec, RT5640_ASRC_2,
+		asrc2_mask, asrc2_value);
+
+	if (snd_soc_read(codec, RT5640_ASRC_2)) {
+		rt5640->asrc_en = true;
+		snd_soc_update_bits(codec, RT5640_JD_CTRL, 0x3, 0x3);
+	} else {
+		rt5640->asrc_en = false;
+		snd_soc_update_bits(codec, RT5640_JD_CTRL, 0x3, 0x0);
+	}
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(rt5640_sel_asrc_clk_src);
+
 static int rt5640_probe(struct snd_soc_codec *codec)
 {
 	struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
sound/soc/codecs/rt5640.h +17 -0
index 3deb8ba..83a7150 100644
@@ -1033,6 +1033,10 @@
 #define RT5640_DMIC_2_M_NOR			(0x0 << 8)
 #define RT5640_DMIC_2_M_ASYN			(0x1 << 8)
 
+/* ASRC clock source selection (0x84) */
+#define RT5640_CLK_SEL_SYS			(0x0)
+#define RT5640_CLK_SEL_ASRC			(0x1)
+
 /* ASRC Control 2 (0x84) */
 #define RT5640_MDA_L_M_MASK			(0x1 << 15)
 #define RT5640_MDA_L_M_SFT			15
@@ -2079,6 +2083,16 @@ enum {
 	RT5640_DMIC2,
 };
 
+/* filter mask */
+enum {
+	RT5640_DA_STEREO_FILTER = 0x1,
+	RT5640_DA_MONO_L_FILTER = (0x1 << 1),
+	RT5640_DA_MONO_R_FILTER = (0x1 << 2),
+	RT5640_AD_STEREO_FILTER = (0x1 << 3),
+	RT5640_AD_MONO_L_FILTER = (0x1 << 4),
+	RT5640_AD_MONO_R_FILTER = (0x1 << 5),
+};
+
 struct rt5640_priv {
 	struct snd_soc_codec *codec;
 	struct rt5640_platform_data pdata;
@@ -2095,9 +2109,12 @@ struct rt5640_priv {
 	int pll_out;
 
 	bool hp_mute;
+	bool asrc_en;
 };
 
 int rt5640_dmic_enable(struct snd_soc_codec *codec,
 		       bool dmic1_data_pin, bool dmic2_data_pin);
+int rt5640_sel_asrc_clk_src(struct snd_soc_codec *codec,
+		unsigned int filter_mask, unsigned int clk_src);
 
 #endif
Signature · 1 line
1.9.1
#10 lore raw

PATCH v2 5/8 ASoC: Intel: bytcr-rt5640: enable ASRC

In reply to Pierre-Louis Bossart

Sound is noisy when using BCLK as reference, enable ASRC in rt5640 codec

---
 sound/soc/intel/boards/bytcr_rt5640.c | 5 +++++
 1 file changed, 5 insertions(+)
sound/soc/intel/boards/bytcr_rt5640.c +5 -0
index a81389d..0f2385f 100644
@@ -153,6 +153,11 @@ static int byt_rt5640_init(struct snd_soc_pcm_runtime *runtime)
 
 	card->dapm.idle_bias_off = true;
 
+	rt5640_sel_asrc_clk_src(codec,
+				RT5640_DA_STEREO_FILTER |
+				RT5640_AD_STEREO_FILTER,
+				RT5640_CLK_SEL_ASRC);
+
 	ret = snd_soc_add_card_controls(card, byt_rt5640_controls,
 					ARRAY_SIZE(byt_rt5640_controls));
 	if (ret) {
Signature · 1 line
1.9.1
#11 lore raw

PATCH v2 6/8 ASoC: Intel: bytcr_rt5640: fixup DAI codec_name with HID

In reply to Pierre-Louis Bossart

Codec name is hard-coded in machine driver, pass information from actual ACPI HID to help support BIOS variations

---
 sound/soc/intel/atom/sst/sst_acpi.c   | 17 ++++++++++++-----
 sound/soc/intel/boards/bytcr_rt5640.c | 10 ++++++++++
 2 files changed, 22 insertions(+), 5 deletions(-)
sound/soc/intel/atom/sst/sst_acpi.c +12 -5
index b6ea0a5..f61e531 100644
@@ -247,16 +247,23 @@ static int sst_acpi_probe(struct platform_device *pdev)
 
 	dev_dbg(dev, "ACPI device id: %x\n", dev_id);
 
-	plat_dev = platform_device_register_data(dev, pdata->platform, -1, NULL, 0);
+	plat_dev = platform_device_register_data(dev, pdata->platform, -1,
+						NULL, 0);
 	if (IS_ERR(plat_dev)) {
-		dev_err(dev, "Failed to create machine device: %s\n", pdata->platform);
+		dev_err(dev, "Failed to create machine device: %s\n",
+			pdata->platform);
 		return PTR_ERR(plat_dev);
 	}
 
-	/* Create platform device for sst machine driver */
-	mdev = platform_device_register_data(dev, mach->drv_name, -1, NULL, 0);
+	/*
+	 * Create platform device for sst machine driver,
+	 * pass machine info as pdata
+	 */
+	mdev = platform_device_register_data(dev, mach->drv_name, -1,
+					(const void *)mach, sizeof(*mach));
 	if (IS_ERR(mdev)) {
-		dev_err(dev, "Failed to create machine device: %s\n", mach->drv_name);
+		dev_err(dev, "Failed to create machine device: %s\n",
+			mach->drv_name);
 		return PTR_ERR(mdev);
 	}
 
sound/soc/intel/boards/bytcr_rt5640.c +10 -0
index 0f2385f..74bb7cc 100644
@@ -30,6 +30,7 @@
 #include <sound/jack.h>
 #include "../../codecs/rt5640.h"
 #include "../atom/sst-atom-controls.h"
+#include "../common/sst-acpi.h"
 
 static const struct snd_soc_dapm_widget byt_rt5640_widgets[] = {
 	SND_SOC_DAPM_HP("Headphone", NULL),
@@ -326,12 +327,21 @@ static struct snd_soc_card byt_rt5640_card = {
 	.fully_routed = true,
 };
 
+static char byt_rt5640_codec_name[16]; /* i2c-<HID>:00 with HID being 8 chars */
+
 static int snd_byt_rt5640_mc_probe(struct platform_device *pdev)
 {
 	int ret_val = 0;
+	struct sst_acpi_mach *mach;
 
 	/* register the soc card */
 	byt_rt5640_card.dev = &pdev->dev;
+	mach = byt_rt5640_card.dev->platform_data;
+
+	/* fixup codec name based on HID */
+	snprintf(byt_rt5640_codec_name, sizeof(byt_rt5640_codec_name),
+		 "%s%s%s", "i2c-", mach->id, ":00");
+	byt_rt5640_dais[MERR_DPCM_COMPR+1].codec_name = byt_rt5640_codec_name;
 
 	ret_val = devm_snd_soc_register_card(&pdev->dev, &byt_rt5640_card);
 
Signature · 1 line
1.9.1
#12 lore raw

PATCH v2 7/8 ASoC: Intel: Atom: add support for RT5642

In reply to Pierre-Louis Bossart

The machine driver is not loaded when the BIOS uses the 10EC5642 _HID. Add it to the white list of known _HIDs, codec_name is already taken care of by previous commit

Tested on Asus T100TAF.

---
 sound/soc/intel/atom/sst/sst_acpi.c   | 2 ++
 sound/soc/intel/boards/bytcr_rt5640.c | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)
sound/soc/intel/atom/sst/sst_acpi.c +2 -0
index f61e531..510826f 100644
@@ -323,6 +323,8 @@ static int sst_acpi_remove(struct platform_device *pdev)
 static struct sst_acpi_mach sst_acpi_bytcr[] = {
 	{"10EC5640", "bytcr_rt5640", "intel/fw_sst_0f28.bin", "bytcr_rt5640", NULL,
 						&byt_rvp_platform_data },
+	{"10EC5642", "bytcr_rt5640", "intel/fw_sst_0f28.bin", "bytcr_rt5640", NULL,
+						&byt_rvp_platform_data },
 	{"10EC5651", "bytcr_rt5651", "intel/fw_sst_0f28.bin", "bytcr_rt5651", NULL,
 						&byt_rvp_platform_data },
 
sound/soc/intel/boards/bytcr_rt5640.c +1 -1
index 74bb7cc..5b0cdad 100644
@@ -302,7 +302,7 @@ static struct snd_soc_dai_link byt_rt5640_dais[] = {
 		.platform_name = "sst-mfld-platform",
 		.no_pcm = 1,
 		.codec_dai_name = "rt5640-aif1",
-		.codec_name = "i2c-10EC5640:00",
+		.codec_name = "i2c-10EC5640:00", /* overwritten with HID */
 		.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
 						| SND_SOC_DAIFMT_CBS_CFS,
 		.be_hw_params_fixup = byt_rt5640_codec_fixup,
Signature · 1 line
1.9.1
#13 lore raw

PATCH v2 8/8 ASoC: Intel: Atom: Add support for HP ElitePad 1000 G2

In reply to Pierre-Louis Bossart

From: Jorge Fernandez Monteagudo <[email protected]>

The BIOS for the HP ElitePad 1000 G2 uses an unexpected HID, (INTCCFFD), add it to the white list of knowns HIDs.

---
 sound/soc/codecs/rt5640.c             | 1 +
 sound/soc/intel/atom/sst/sst_acpi.c   | 3 ++-
 sound/soc/intel/boards/bytcr_rt5640.c | 8 ++++++++
 3 files changed, 11 insertions(+), 1 deletion(-)
sound/soc/codecs/rt5640.c +1 -0
index 18f2d3b..11d032c 100644
@@ -2277,6 +2277,7 @@ static const struct acpi_device_id rt5640_acpi_match[] = {
 	{ "INT33CA", 0 },
 	{ "10EC5640", 0 },
 	{ "10EC5642", 0 },
+	{ "INTCCFFD", 0 },
 	{ },
 };
 MODULE_DEVICE_TABLE(acpi, rt5640_acpi_match);
sound/soc/intel/atom/sst/sst_acpi.c +2 -1
index 510826f..4fce03f 100644
@@ -325,9 +325,10 @@ static struct sst_acpi_mach sst_acpi_bytcr[] = {
 						&byt_rvp_platform_data },
 	{"10EC5642", "bytcr_rt5640", "intel/fw_sst_0f28.bin", "bytcr_rt5640", NULL,
 						&byt_rvp_platform_data },
+	{"INTCCFFD", "bytcr_rt5640", "intel/fw_sst_0f28.bin", "bytcr_rt5640", NULL,
+						&byt_rvp_platform_data },
 	{"10EC5651", "bytcr_rt5651", "intel/fw_sst_0f28.bin", "bytcr_rt5651", NULL,
 						&byt_rvp_platform_data },
-
 	{},
 };
 
sound/soc/intel/boards/bytcr_rt5640.c +8 -0
index 5b0cdad..9a1752d 100644
@@ -141,6 +141,14 @@ static const struct dmi_system_id byt_rt5640_quirk_table[] = {
 		.driver_data = (unsigned long *)(BYT_RT5640_DMIC2_MAP |
 						 BYT_RT5640_DMIC_EN),
 	},
+	{
+		.callback = byt_rt5640_quirk_cb,
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "HP ElitePad 1000 G2"),
+		},
+		.driver_data = (unsigned long *)BYT_RT5640_IN1_MAP,
+	},
 	{}
 };
 
Signature · 1 line
1.9.1
maintainer
#14 lore raw
In reply to Pierre-Louis Bossart
Quoted 4 lines · Pierre-Louis Bossart

Thanks to Mark for merging most of the patches in the first batch. Resending update for patches that where not merged.
No additional functionalitity, only correction in first patch to refer to correct SHA1 and copy/paste fixes in bytcr_rt5651 machine driver

For future reference if you're sending a bunch of unrelated patches it's easier to send them separately to make it clear that there are no dependencies.

#15 lore raw
Quoted 9 lines · Mark Brown
Quoted 4 lines · Pierre-Louis Bossart

Thanks to Mark for merging most of the patches in the first batch. Resending update for patches that where not merged.
No additional functionalitity, only correction in first patch to refer to correct SHA1 and copy/paste fixes in bytcr_rt5651 machine driver

For future reference if you're sending a bunch of unrelated patches it's easier to send them separately to make it clear that there are no dependencies.

Will do. It was convenient for me since I could keep track of a single patch list and test the same kernel on multiple Baytrail platforms but yes they are not related.