[PATCH 0/6] ASoC: rt5670/Intel: Add support for Bay Trail CR / Dell Venue 10 Pro 5055 tablet
Hi All,
Here is a patch series to enable sound on the Dell Venue 10 Pro 5055 tablet this series also includes 2 generic improvements to rt5672 support:
1. Add support for boards using Bay Trail CR (SSP0) in combination with a rt5672 codec 2. Set the card's components string based on the DMI info, so that we don't need to duplicate the DMI quirks in userspace (in the UCM profile)
I've a patch to add support for the components string to the UCM profile for these boards available here: https://github.com/jwrdegoede/alsa-ucm-conf/commit/fedacc2bdc530b6febac665db...
I will submit this upstream once the kernel side has landed.
Regards,
Hans
Hans de Goede (6): ASoC: Intel: Unify the thinkpad10 and aegex10 byt-match quirks ASoC: Intel: Baytrail: Add quirk for the Dell Venue 10 Pro 5055 tablet ASoC: Intel: cht_bsw_rt5672: Add support for Bay Trail CR / SSP0 ASoC: rt5670: Add a quirk for the Dell Venue 10 Pro 5055 ASoC: rt5670: Add a rt5670_components() helper ASoC: Intel: cht_bsw_rt5672: Set card.components string
sound/soc/codecs/rt5670.c | 51 ++++++++++++ sound/soc/codecs/rt5670.h | 2 + sound/soc/intel/boards/cht_bsw_rt5672.c | 77 +++++++++++++++---- .../intel/common/soc-acpi-intel-byt-match.c | 40 +++++----- 4 files changed, 136 insertions(+), 34 deletions(-)
There is no reason to have separate quirk-handlers / byt_machine_id-s for these.
These are both cases of BYT devices with a 10EC5640 ACPI HID while using a rt5672 codec.
The Dell Venue 10 Pro 5055 is another example of such a device, instead of adding a third byt_machine_id definition for this Dell model, make change the 2 existing cases into a generic BYT_RT5672 byt_machine_id in preparation for adding a quirk for the Dell Venue 10 Pro 5055.
Signed-off-by: Hans de Goede hdegoede@redhat.com --- .../intel/common/soc-acpi-intel-byt-match.c | 32 +++++++------------ 1 file changed, 12 insertions(+), 20 deletions(-)
diff --git a/sound/soc/intel/common/soc-acpi-intel-byt-match.c b/sound/soc/intel/common/soc-acpi-intel-byt-match.c index d1febbb53b70..4596d128fff5 100644 --- a/sound/soc/intel/common/soc-acpi-intel-byt-match.c +++ b/sound/soc/intel/common/soc-acpi-intel-byt-match.c @@ -11,13 +11,12 @@
static unsigned long byt_machine_id;
-#define BYT_THINKPAD_10 1 +#define BYT_RT5672 1 #define BYT_POV_P1006W 2 -#define BYT_AEGEX_10 3
-static int byt_thinkpad10_quirk_cb(const struct dmi_system_id *id) +static int byt_rt5672_quirk_cb(const struct dmi_system_id *id) { - byt_machine_id = BYT_THINKPAD_10; + byt_machine_id = BYT_RT5672; return 1; }
@@ -27,36 +26,30 @@ static int byt_pov_p1006w_quirk_cb(const struct dmi_system_id *id) return 1; }
-static int byt_aegex10_quirk_cb(const struct dmi_system_id *id) -{ - byt_machine_id = BYT_AEGEX_10; - return 1; -} - static const struct dmi_system_id byt_table[] = { { - .callback = byt_thinkpad10_quirk_cb, + .callback = byt_rt5672_quirk_cb, .matches = { DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad 8"), }, }, { - .callback = byt_thinkpad10_quirk_cb, + .callback = byt_rt5672_quirk_cb, .matches = { DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad 10"), }, }, { - .callback = byt_thinkpad10_quirk_cb, + .callback = byt_rt5672_quirk_cb, .matches = { DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad Tablet B"), }, }, { - .callback = byt_thinkpad10_quirk_cb, + .callback = byt_rt5672_quirk_cb, .matches = { DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo Miix 2 10"), @@ -75,7 +68,7 @@ static const struct dmi_system_id byt_table[] = { }, { /* Aegex 10 tablet (RU2) */ - .callback = byt_aegex10_quirk_cb, + .callback = byt_rt5672_quirk_cb, .matches = { DMI_MATCH(DMI_SYS_VENDOR, "AEGEX"), DMI_MATCH(DMI_PRODUCT_VERSION, "RU2"), @@ -84,8 +77,8 @@ static const struct dmi_system_id byt_table[] = { { } };
-/* The Thinkapd 10 and Aegex 10 tablets have the same ID problem */ -static struct snd_soc_acpi_mach byt_thinkpad_10 = { +/* Various devices use an ACPI id of 10EC5640 while using a rt5672 codec */ +static struct snd_soc_acpi_mach byt_rt5672 = { .id = "10EC5640", .drv_name = "cht-bsw-rt5672", .fw_filename = "intel/fw_sst_0f28.bin", @@ -110,9 +103,8 @@ static struct snd_soc_acpi_mach *byt_quirk(void *arg) dmi_check_system(byt_table);
switch (byt_machine_id) { - case BYT_THINKPAD_10: - case BYT_AEGEX_10: - return &byt_thinkpad_10; + case BYT_RT5672: + return &byt_rt5672; case BYT_POV_P1006W: return &byt_pov_p1006w; default:
The Dell Venue 10 Pro 5055 tablet uses an ACPI HID of 10EC5640 while using a rt5672 codec (instead of a rt5640 codec). Add a quirk for this.
Signed-off-by: Hans de Goede hdegoede@redhat.com --- sound/soc/intel/common/soc-acpi-intel-byt-match.c | 8 ++++++++ 1 file changed, 8 insertions(+)
diff --git a/sound/soc/intel/common/soc-acpi-intel-byt-match.c b/sound/soc/intel/common/soc-acpi-intel-byt-match.c index 4596d128fff5..510a5f38b7f1 100644 --- a/sound/soc/intel/common/soc-acpi-intel-byt-match.c +++ b/sound/soc/intel/common/soc-acpi-intel-byt-match.c @@ -74,6 +74,14 @@ static const struct dmi_system_id byt_table[] = { DMI_MATCH(DMI_PRODUCT_VERSION, "RU2"), }, }, + { + /* Dell Venue 10 Pro 5055 */ + .callback = byt_rt5672_quirk_cb, + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), + DMI_MATCH(DMI_PRODUCT_NAME, "Venue 10 Pro 5055"), + }, + }, { } };
The rt5672 codec is used on some Bay Trail CR boards, on these SoCs SSP2 is not available and SSP0 should be used instead. At support for this.
This has been tested on a Dell Venue 10 Pro 5055.
Signed-off-by: Hans de Goede hdegoede@redhat.com --- sound/soc/intel/boards/cht_bsw_rt5672.c | 75 ++++++++++++++++++++----- 1 file changed, 61 insertions(+), 14 deletions(-)
diff --git a/sound/soc/intel/boards/cht_bsw_rt5672.c b/sound/soc/intel/boards/cht_bsw_rt5672.c index 10c88ef2f85d..10d5ed20e4e8 100644 --- a/sound/soc/intel/boards/cht_bsw_rt5672.c +++ b/sound/soc/intel/boards/cht_bsw_rt5672.c @@ -21,6 +21,7 @@ #include <sound/soc-acpi.h> #include "../../codecs/rt5670.h" #include "../atom/sst-atom-controls.h" +#include "../common/soc-intel-quirks.h"
/* The platform clock #3 outputs 19.2Mhz clock to codec as I2S MCLK */ @@ -31,6 +32,7 @@ struct cht_mc_private { struct snd_soc_jack headset; char codec_name[SND_ACPI_I2C_ID_LEN]; struct clk *mclk; + bool use_ssp0; };
/* Headset jack detection DAPM pins */ @@ -121,16 +123,26 @@ static const struct snd_soc_dapm_route cht_audio_map[] = { {"Ext Spk", NULL, "SPOLN"}, {"Ext Spk", NULL, "SPORP"}, {"Ext Spk", NULL, "SPORN"}, + {"Headphone", NULL, "Platform Clock"}, + {"Headset Mic", NULL, "Platform Clock"}, + {"Int Mic", NULL, "Platform Clock"}, + {"Ext Spk", NULL, "Platform Clock"}, +}; + +static const struct snd_soc_dapm_route cht_audio_ssp0_map[] = { + {"AIF1 Playback", NULL, "ssp0 Tx"}, + {"ssp0 Tx", NULL, "modem_out"}, + {"modem_in", NULL, "ssp0 Rx"}, + {"ssp0 Rx", NULL, "AIF1 Capture"}, +}; + +static const struct snd_soc_dapm_route cht_audio_ssp2_map[] = { {"AIF1 Playback", NULL, "ssp2 Tx"}, {"ssp2 Tx", NULL, "codec_out0"}, {"ssp2 Tx", NULL, "codec_out1"}, {"codec_in0", NULL, "ssp2 Rx"}, {"codec_in1", NULL, "ssp2 Rx"}, {"ssp2 Rx", NULL, "AIF1 Capture"}, - {"Headphone", NULL, "Platform Clock"}, - {"Headset Mic", NULL, "Platform Clock"}, - {"Int Mic", NULL, "Platform Clock"}, - {"Ext Spk", NULL, "Platform Clock"}, };
static const struct snd_kcontrol_new cht_mc_controls[] = { @@ -197,6 +209,18 @@ static int cht_codec_init(struct snd_soc_pcm_runtime *runtime) | RT5670_AD_MONO_R_FILTER, RT5670_CLK_SEL_I2S1_ASRC);
+ if (ctx->use_ssp0) { + ret = snd_soc_dapm_add_routes(&runtime->card->dapm, + cht_audio_ssp0_map, + ARRAY_SIZE(cht_audio_ssp0_map)); + } else { + ret = snd_soc_dapm_add_routes(&runtime->card->dapm, + cht_audio_ssp2_map, + ARRAY_SIZE(cht_audio_ssp2_map)); + } + if (ret) + return ret; + ret = snd_soc_card_jack_new(runtime->card, "Headset", SND_JACK_HEADSET | SND_JACK_BTN_0 | SND_JACK_BTN_1 | SND_JACK_BTN_2, @@ -239,18 +263,26 @@ static int cht_codec_init(struct snd_soc_pcm_runtime *runtime) static int cht_codec_fixup(struct snd_soc_pcm_runtime *rtd, struct snd_pcm_hw_params *params) { + struct cht_mc_private *ctx = snd_soc_card_get_drvdata(rtd->card); struct snd_interval *rate = hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE); struct snd_interval *channels = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS); - int ret; + int ret, bits;
/* The DSP will covert the FE rate to 48k, stereo, 24bits */ rate->min = rate->max = 48000; channels->min = channels->max = 2;
- /* set SSP2 to 24-bit */ - params_set_format(params, SNDRV_PCM_FORMAT_S24_LE); + if (ctx->use_ssp0) { + /* set SSP0 to 16-bit */ + params_set_format(params, SNDRV_PCM_FORMAT_S16_LE); + bits = 16; + } else { + /* set SSP2 to 24-bit */ + params_set_format(params, SNDRV_PCM_FORMAT_S24_LE); + bits = 24; + }
/* * The default mode for the cpu-dai is TDM 4 slot. The default mode @@ -274,6 +306,12 @@ static int cht_codec_fixup(struct snd_soc_pcm_runtime *rtd, return ret; }
+ ret = snd_soc_dai_set_tdm_slot(asoc_rtd_to_cpu(rtd, 0), 0x3, 0x3, 2, bits); + if (ret < 0) { + dev_err(rtd->dev, "can't set I2S config, err %d\n", ret); + return ret; + } + return 0; }
@@ -414,6 +452,7 @@ static int snd_cht_mc_probe(struct platform_device *pdev) const char *platform_name; struct acpi_device *adev; bool sof_parent; + int dai_index = 0; int i;
drv = devm_kzalloc(&pdev->dev, sizeof(*drv), GFP_KERNEL); @@ -422,19 +461,27 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
strcpy(drv->codec_name, RT5672_I2C_DEFAULT);
+ /* find index of codec dai */ + for (i = 0; i < ARRAY_SIZE(cht_dailink); i++) { + if (!strcmp(cht_dailink[i].codecs->name, RT5672_I2C_DEFAULT)) { + dai_index = i; + break; + } + } + /* fixup codec name based on HID */ adev = acpi_dev_get_first_match_dev(mach->id, NULL, -1); if (adev) { snprintf(drv->codec_name, sizeof(drv->codec_name), "i2c-%s", acpi_dev_name(adev)); put_device(&adev->dev); - for (i = 0; i < ARRAY_SIZE(cht_dailink); i++) { - if (!strcmp(cht_dailink[i].codecs->name, - RT5672_I2C_DEFAULT)) { - cht_dailink[i].codecs->name = drv->codec_name; - break; - } - } + cht_dailink[dai_index].codecs->name = drv->codec_name; + } + + /* Use SSP0 on Bay Trail CR devices */ + if (soc_intel_is_byt() && mach->mach_params.acpi_ipc_irq_index == 0) { + cht_dailink[dai_index].cpus->dai_name = "ssp0-port"; + drv->use_ssp0 = true; }
/* override plaform name, if required */
Add a quirk with the jack-detect and dmic settings necessary to make jack-detect and the builtin mic work on Dell Venue 10 Pro 5055 tablets.
Signed-off-by: Hans de Goede hdegoede@redhat.com --- sound/soc/codecs/rt5670.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
diff --git a/sound/soc/codecs/rt5670.c b/sound/soc/codecs/rt5670.c index 4063aac2a443..dd69d874bad2 100644 --- a/sound/soc/codecs/rt5670.c +++ b/sound/soc/codecs/rt5670.c @@ -2980,6 +2980,18 @@ static const struct dmi_system_id dmi_platform_intel_quirks[] = { RT5670_GPIO1_IS_IRQ | RT5670_JD_MODE3), }, + { + .callback = rt5670_quirk_cb, + .ident = "Dell Venue 10 Pro 5055", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), + DMI_MATCH(DMI_PRODUCT_NAME, "Venue 10 Pro 5055"), + }, + .driver_data = (unsigned long *)(RT5670_DMIC_EN | + RT5670_DMIC2_INR | + RT5670_GPIO1_IS_IRQ | + RT5670_JD_MODE1), + }, { .callback = rt5670_quirk_cb, .ident = "Aegex 10 tablet (RU2)",
The rt5670 codec driver uses DMI quirks to configure the DMIC data-pins, which means that it knows which DMIC interface is used on a specific device.
ATM we duplicate this DMI matching inside the UCM profiles to select the right DMIC interface. Add a rt5670_components() helper which the machine-driver can use to set the components string of the card so that UCM can get the info from the components string.
This way we only need to add new DMI quirks in one place.
Signed-off-by: Hans de Goede hdegoede@redhat.com --- sound/soc/codecs/rt5670.c | 39 +++++++++++++++++++++++++++++++++++++++ sound/soc/codecs/rt5670.h | 2 ++ 2 files changed, 41 insertions(+)
diff --git a/sound/soc/codecs/rt5670.c b/sound/soc/codecs/rt5670.c index dd69d874bad2..db7b33e8ce8a 100644 --- a/sound/soc/codecs/rt5670.c +++ b/sound/soc/codecs/rt5670.c @@ -3007,6 +3007,45 @@ static const struct dmi_system_id dmi_platform_intel_quirks[] = { {} };
+const char *rt5670_components(void) +{ + unsigned long quirk; + bool dmic1 = false; + bool dmic2 = false; + bool dmic3 = false; + + if (quirk_override) { + quirk = quirk_override; + } else { + dmi_check_system(dmi_platform_intel_quirks); + quirk = rt5670_quirk; + } + + if ((quirk & RT5670_DMIC1_IN2P) || + (quirk & RT5670_DMIC1_GPIO6) || + (quirk & RT5670_DMIC1_GPIO7)) + dmic1 = true; + + if ((quirk & RT5670_DMIC2_INR) || + (quirk & RT5670_DMIC2_GPIO8)) + dmic2 = true; + + if (quirk & RT5670_DMIC3_GPIO5) + dmic3 = true; + + if (dmic1 && dmic2) + return "cfg-spk:2 cfg-mic:dmics12"; + else if (dmic1) + return "cfg-spk:2 cfg-mic:dmic1"; + else if (dmic2) + return "cfg-spk:2 cfg-mic:dmic2"; + else if (dmic3) + return "cfg-spk:2 cfg-mic:dmic3"; + + return NULL; +} +EXPORT_SYMBOL_GPL(rt5670_components); + static int rt5670_i2c_probe(struct i2c_client *i2c, const struct i2c_device_id *id) { diff --git a/sound/soc/codecs/rt5670.h b/sound/soc/codecs/rt5670.h index 6fb3c369ee98..5b230897f630 100644 --- a/sound/soc/codecs/rt5670.h +++ b/sound/soc/codecs/rt5670.h @@ -2024,4 +2024,6 @@ void rt5670_jack_suspend(struct snd_soc_component *component); void rt5670_jack_resume(struct snd_soc_component *component); int rt5670_set_jack_detect(struct snd_soc_component *component, struct snd_soc_jack *jack); +const char *rt5670_components(void); + #endif /* __RT5670_H__ */
Set the card.components string using the new rt5670_components() helper which returns a components string based on the DMI quirks inside the rt5670 codec driver.
Signed-off-by: Hans de Goede hdegoede@redhat.com --- sound/soc/intel/boards/cht_bsw_rt5672.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/sound/soc/intel/boards/cht_bsw_rt5672.c b/sound/soc/intel/boards/cht_bsw_rt5672.c index 10d5ed20e4e8..e358632f50d7 100644 --- a/sound/soc/intel/boards/cht_bsw_rt5672.c +++ b/sound/soc/intel/boards/cht_bsw_rt5672.c @@ -493,6 +493,8 @@ static int snd_cht_mc_probe(struct platform_device *pdev) if (ret_val) return ret_val;
+ snd_soc_card_cht.components = rt5670_components(); + drv->mclk = devm_clk_get(&pdev->dev, "pmc_plt_clk_3"); if (IS_ERR(drv->mclk)) { dev_err(&pdev->dev,
On 4/2/21 9:07 AM, Hans de Goede wrote:
Hi All,
Here is a patch series to enable sound on the Dell Venue 10 Pro 5055 tablet this series also includes 2 generic improvements to rt5672 support:
- Add support for boards using Bay Trail CR (SSP0) in combination with a rt5672 codec
- Set the card's components string based on the DMI info, so that we don't need to
duplicate the DMI quirks in userspace (in the UCM profile)
I've a patch to add support for the components string to the UCM profile for these boards available here: https://github.com/jwrdegoede/alsa-ucm-conf/commit/fedacc2bdc530b6febac665db...
I will submit this upstream once the kernel side has landed.
LGTM, thanks Hans
Acked-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com
On Fri, 2 Apr 2021 16:07:41 +0200, Hans de Goede wrote:
Here is a patch series to enable sound on the Dell Venue 10 Pro 5055 tablet this series also includes 2 generic improvements to rt5672 support:
- Add support for boards using Bay Trail CR (SSP0) in combination with a rt5672 codec
- Set the card's components string based on the DMI info, so that we don't need to
duplicate the DMI quirks in userspace (in the UCM profile)
[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/6] ASoC: Intel: Unify the thinkpad10 and aegex10 byt-match quirks commit: ebbb165d2c0c44ffbf480e209f745ed4b0d5560a [2/6] ASoC: Intel: Baytrail: Add quirk for the Dell Venue 10 Pro 5055 tablet commit: 17d49b07a8bb3fdc630a44240c7d7e2a18e14b93 [3/6] ASoC: Intel: cht_bsw_rt5672: Add support for Bay Trail CR / SSP0 commit: c9b3c63392e578ea74411b29a720ace77ae9041f [4/6] ASoC: rt5670: Add a quirk for the Dell Venue 10 Pro 5055 commit: 84cb0d5581b6a7bd5d96013f67e9f2eb0c7b4378 [5/6] ASoC: rt5670: Add a rt5670_components() helper commit: 3d534537648bd7d7a82f2becc9ded99a4b228a6a [6/6] ASoC: Intel: cht_bsw_rt5672: Set card.components string commit: e992a51b1d14317f414d4b9935966dca96ac0b36
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
participants (3)
-
Hans de Goede
-
Mark Brown
-
Pierre-Louis Bossart