diff options
-rw-r--r-- | .SRCINFO | 24 | ||||
-rw-r--r-- | 0002-ASoC-max98090-reduce-verbosity-on-PLL-unlock.patch | 30 | ||||
-rw-r--r-- | 0003-ASoC-Intel-cht_bsw_max98090-Fix-I2S-config-unused-code.patch | 35 | ||||
-rw-r--r-- | 0004-ASoC-Intel-cht_bsw_max98090-add-support-for-Baytrail.patch | 154 | ||||
-rw-r--r-- | 0005-ASoC-Intel-atom-use-cht_bsw_max98090-for-Baytrail-Chromebooks.patch | 34 | ||||
-rw-r--r-- | 0006-ASoC-ts3a227e-add-acpi-table.patch | 48 | ||||
-rw-r--r-- | 0007-ASoc-Intel-cht_bsw_max98090_ti-Fix-jack-initialization.patch | 87 | ||||
-rw-r--r-- | 0008-ASoC-Intel-cht_bsw_max98090-add-gpio-based-jack-detection.patch | 112 | ||||
-rw-r--r-- | PKGBUILD | 42 | ||||
-rw-r--r-- | config | 23 |
10 files changed, 559 insertions, 30 deletions
@@ -1,5 +1,5 @@ pkgbase = linux-max98090 - pkgver = 4.14.2 + pkgver = 4.14.3 pkgrel = 1 url = https://www.kernel.org/ arch = x86_64 @@ -14,24 +14,38 @@ pkgbase = linux-max98090 options = !strip source = https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.14.tar.xz source = https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.14.tar.sign - source = https://www.kernel.org/pub/linux/kernel/v4.x/patch-4.14.2.xz - source = https://www.kernel.org/pub/linux/kernel/v4.x/patch-4.14.2.sign + source = https://www.kernel.org/pub/linux/kernel/v4.x/patch-4.14.3.xz + source = https://www.kernel.org/pub/linux/kernel/v4.x/patch-4.14.3.sign source = config source = 60-linux.hook source = 90-linux.hook source = linux.preset source = 0001-platform-x86-hp-wmi-Fix-tablet-mode-detection-for-co.patch + source = 0002-ASoC-max98090-reduce-verbosity-on-PLL-unlock.patch + source = 0003-ASoC-Intel-cht_bsw_max98090-Fix-I2S-config-unused-code.patch + source = 0004-ASoC-Intel-cht_bsw_max98090-add-support-for-Baytrail.patch + source = 0005-ASoC-Intel-atom-use-cht_bsw_max98090-for-Baytrail-Chromebooks.patch + source = 0006-ASoC-ts3a227e-add-acpi-table.patch + source = 0007-ASoc-Intel-cht_bsw_max98090_ti-Fix-jack-initialization.patch + source = 0008-ASoC-Intel-cht_bsw_max98090-add-gpio-based-jack-detection.patch validpgpkeys = ABAF11C65A2970B130ABE3C479BE3E4300411886 validpgpkeys = 647F28654894E3BD457199BE38DBBDC86092693E sha256sums = f81d59477e90a130857ce18dc02f4fbe5725854911db1e7ba770c7cd350f96a7 sha256sums = SKIP - sha256sums = 2dc86272e55d31c55bdeaa47b3d44fbd6235a396e37d82c2b47aa27f6ba82ee3 + sha256sums = e13995c11d0c2d3379c887666dbfaca619200fb8853db6d5d67f97d47fd959b7 sha256sums = SKIP - sha256sums = 83a0dd958b5ea2e5893e87b9877ebef467af8aaf2d31ea46055b46337636fd57 + sha256sums = 02b2ed3fd7765fb311845a54ed3c5b9ba4088b48233995ba42faa4f97dc953ea sha256sums = ae2e95db94ef7176207c690224169594d49445e04249d2499e9d2fbc117a0b21 sha256sums = 75f99f5239e03238f88d1a834c50043ec32b1dc568f2cc291b07d04718483919 sha256sums = ad6344badc91ad0630caacde83f7f9b97276f80d26a20619a87952be65492c65 sha256sums = 6f1d9b6a119bfab150a0bc1f550609dd9290328df709b67c984f0a6b0abe8afd + sha256sums = f372da78745f49e5709f2739a1166c39298c91d5eb08d6fb362603481d8395b5 + sha256sums = a1766026aa04cd650da0229399121fc547620617699bbc573c250360182504ed + sha256sums = fef99b00f76a623a78c2871a204e673d8522f54c4623a529d4839389afefc857 + sha256sums = f09c970935ae9788db015e4ddc2949e909bbd1be81b219ccad0c701e3546cbf7 + sha256sums = 2f19a7f5c9e01516da222f69b40599fabd4e5b3c87aeac3ada78012a6d2904b8 + sha256sums = 60fabf5d05e1176361cceff6ec1720935762e27e3d590b1a267fa9eb7739a607 + sha256sums = b2b20af5ea14de866b0af3e2cbe27ed517bf22c5c97b51b3bcc778062d4b7217 pkgname = linux-max98090 pkgdesc = The Archlinux kernel and modules with a fix for baytrail max98090 sound diff --git a/0002-ASoC-max98090-reduce-verbosity-on-PLL-unlock.patch b/0002-ASoC-max98090-reduce-verbosity-on-PLL-unlock.patch new file mode 100644 index 000000000000..5ad5c6dd6da9 --- /dev/null +++ b/0002-ASoC-max98090-reduce-verbosity-on-PLL-unlock.patch @@ -0,0 +1,30 @@ +'commit b8a3ee820f7b ("ASoC: max98090: Add recovery for PLL lock failure")' +enabled a workaround PLL unlocked issues, but generates annoying +dev_info "PLL unlocked" messages at a 10ms rate, usually on startup. + +Move to dev_info_ratelimited. This issue doesn't seem to impact audio +functionality. This trace is commented out in the GalliumOS patches, +it's better to keep it to check on potential quality issues + +Tested on Lenovo 100s (Baytrail Chromebook) + +Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart at linux.intel.com> +--- + sound/soc/codecs/max98090.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c +index 13bcfb1..f5075d1 100644 +--- a/sound/soc/codecs/max98090.c ++++ b/sound/soc/codecs/max98090.c +@@ -2115,7 +2115,7 @@ static void max98090_pll_work(struct work_struct *work) + if (!snd_soc_codec_is_active(codec)) + return; + +- dev_info(codec->dev, "PLL unlocked\n"); ++ dev_info_ratelimited(codec->dev, "PLL unlocked\n"); + + /* Toggle shutdown OFF then ON */ + snd_soc_update_bits(codec, M98090_REG_DEVICE_SHUTDOWN, +-- +2.9.3 diff --git a/0003-ASoC-Intel-cht_bsw_max98090-Fix-I2S-config-unused-code.patch b/0003-ASoC-Intel-cht_bsw_max98090-Fix-I2S-config-unused-code.patch new file mode 100644 index 000000000000..48c8ed925e19 --- /dev/null +++ b/0003-ASoC-Intel-cht_bsw_max98090-Fix-I2S-config-unused-code.patch @@ -0,0 +1,35 @@ +This driver probably never worked, the slots are configured +for 2ch 16 bit and the SSP2 as 24 bits, the cpu_dai configured as +LEFT_J and the codec_dai as I2S. + +Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart at linux.intel.com> +--- + sound/soc/intel/boards/cht_bsw_max98090_ti.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/sound/soc/intel/boards/cht_bsw_max98090_ti.c b/sound/soc/intel/boards/cht_bsw_max98090_ti.c +index 20755ec..455a55a 100644 +--- a/sound/soc/intel/boards/cht_bsw_max98090_ti.c ++++ b/sound/soc/intel/boards/cht_bsw_max98090_ti.c +@@ -160,7 +160,7 @@ static int cht_codec_fixup(struct snd_soc_pcm_runtime *rtd, + return ret; + } + +- fmt = SND_SOC_DAIFMT_LEFT_J | SND_SOC_DAIFMT_NB_NF ++ fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF + | SND_SOC_DAIFMT_CBS_CFS; + + ret = snd_soc_dai_set_fmt(rtd->cpu_dai, fmt); +@@ -173,8 +173,8 @@ static int cht_codec_fixup(struct snd_soc_pcm_runtime *rtd, + rate->min = rate->max = 48000; + channels->min = channels->max = 2; + +- /* set SSP2 to 24-bit */ +- params_set_format(params, SNDRV_PCM_FORMAT_S24_LE); ++ /* set SSP2 to 16-bit */ ++ params_set_format(params, SNDRV_PCM_FORMAT_S16_LE); + return 0; + } + +-- +2.9.3 diff --git a/0004-ASoC-Intel-cht_bsw_max98090-add-support-for-Baytrail.patch b/0004-ASoC-Intel-cht_bsw_max98090-add-support-for-Baytrail.patch new file mode 100644 index 000000000000..69128757c1f8 --- /dev/null +++ b/0004-ASoC-Intel-cht_bsw_max98090-add-support-for-Baytrail.patch @@ -0,0 +1,154 @@ +Distributions such as Fedora, Ubuntu and Gallium don't currently +have a means to support Baytrail Chromebooks and other platforms +with the same build [1][2] due to incompatible platform drivers. + +Add MCLK management to reuse this machine driver for Baytrail +platforms and solve this coexistence problem at last. UCM files are +provided at [3] and will eventually be submitted to the new repo. + +The legacy byt-max98090 machine driver is still maintained but can +only be used when the other Atom/DPCM driver is not compiled in, or +when users don't want to configure extra mixers required by the +Atom/sst driver. + +Tested on Lenovo 100s Baytrail Chromebook w/ Mr. Chromebox BOOT_STUB +firmware and Acer R11 Cherrytrail Chromebook + +[1] https://bugzilla.redhat.com/show_bug.cgi?id=1335196 +[2] http://mailman.alsa-project.org/pipermail/alsa-devel/2016-August/ +111641.html +[3] https://github.com/plbossart/UCM/tree/master/byt-max98090 + +Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart at linux.intel.com> +--- + sound/soc/intel/boards/cht_bsw_max98090_ti.c | 78 ++++++++++++++++++++++++++++ + 1 file changed, 78 insertions(+) + +diff --git a/sound/soc/intel/boards/cht_bsw_max98090_ti.c b/sound/soc/intel/boards/cht_bsw_max98090_ti.c +index 455a55a..01bacca 100644 +--- a/sound/soc/intel/boards/cht_bsw_max98090_ti.c ++++ b/sound/soc/intel/boards/cht_bsw_max98090_ti.c +@@ -23,6 +23,7 @@ + #include <linux/platform_device.h> + #include <linux/slab.h> + #include <linux/acpi.h> ++#include <linux/clk.h> + #include <sound/pcm.h> + #include <sound/pcm_params.h> + #include <sound/soc.h> +@@ -35,15 +36,60 @@ + #define CHT_CODEC_DAI "HiFi" + + struct cht_mc_private { ++ struct clk *mclk; + struct snd_soc_jack jack; + bool ts3a227e_present; + }; + ++static inline struct snd_soc_dai *cht_get_codec_dai(struct snd_soc_card *card) ++{ ++ struct snd_soc_pcm_runtime *rtd; ++ ++ list_for_each_entry(rtd, &card->rtd_list, list) { ++ if (!strncmp(rtd->codec_dai->name, CHT_CODEC_DAI, ++ strlen(CHT_CODEC_DAI))) ++ return rtd->codec_dai; ++ } ++ return NULL; ++} ++ ++static int platform_clock_control(struct snd_soc_dapm_widget *w, ++ struct snd_kcontrol *k, int event) ++{ ++ struct snd_soc_dapm_context *dapm = w->dapm; ++ struct snd_soc_card *card = dapm->card; ++ struct snd_soc_dai *codec_dai; ++ struct cht_mc_private *ctx = snd_soc_card_get_drvdata(card); ++ int ret; ++ ++ codec_dai = cht_get_codec_dai(card); ++ if (!codec_dai) { ++ dev_err(card->dev, "Codec dai not found; Unable to set platform clock\n"); ++ return -EIO; ++ } ++ ++ if (SND_SOC_DAPM_EVENT_ON(event)) { ++ ret = clk_prepare_enable(ctx->mclk); ++ if (ret < 0) { ++ dev_err(card->dev, ++ "could not configure MCLK state"); ++ return ret; ++ } ++ } else { ++ clk_disable_unprepare(ctx->mclk); ++ } ++ ++ return 0; ++} ++ + static const struct snd_soc_dapm_widget cht_dapm_widgets[] = { + SND_SOC_DAPM_HP("Headphone", NULL), + SND_SOC_DAPM_MIC("Headset Mic", NULL), + SND_SOC_DAPM_MIC("Int Mic", NULL), + SND_SOC_DAPM_SPK("Ext Spk", NULL), ++ SND_SOC_DAPM_SUPPLY("Platform Clock", SND_SOC_NOPM, 0, 0, ++ platform_clock_control, SND_SOC_DAPM_PRE_PMU | ++ SND_SOC_DAPM_POST_PMD), + }; + + static const struct snd_soc_dapm_route cht_audio_map[] = { +@@ -60,6 +106,10 @@ static const struct snd_soc_dapm_route cht_audio_map[] = { + {"codec_in0", NULL, "ssp2 Rx" }, + {"codec_in1", NULL, "ssp2 Rx" }, + {"ssp2 Rx", NULL, "HiFi 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[] = { +@@ -141,6 +191,25 @@ static int cht_codec_init(struct snd_soc_pcm_runtime *runtime) + if (ctx->ts3a227e_present) + snd_soc_jack_notifier_register(jack, &cht_jack_nb); + ++ /* ++ * The firmware might enable the clock at ++ * boot (this information may or may not ++ * be reflected in the enable clock register). ++ * To change the rate we must disable the clock ++ * first to cover these cases. Due to common ++ * clock framework restrictions that do not allow ++ * to disable a clock that has not been enabled, ++ * we need to enable the clock first. ++ */ ++ ret = clk_prepare_enable(ctx->mclk); ++ if (!ret) ++ clk_disable_unprepare(ctx->mclk); ++ ++ ret = clk_set_rate(ctx->mclk, CHT_PLAT_CLK_3_HZ); ++ ++ if (ret) ++ dev_err(runtime->dev, "unable to set MCLK rate\n"); ++ + return ret; + } + +@@ -294,6 +363,15 @@ static int snd_cht_mc_probe(struct platform_device *pdev) + /* register the soc card */ + snd_soc_card_cht.dev = &pdev->dev; + snd_soc_card_set_drvdata(&snd_soc_card_cht, drv); ++ ++ drv->mclk = devm_clk_get(&pdev->dev, "pmc_plt_clk_3"); ++ if (IS_ERR(drv->mclk)) { ++ dev_err(&pdev->dev, ++ "Failed to get MCLK from pmc_plt_clk_3: %ld\n", ++ PTR_ERR(drv->mclk)); ++ return PTR_ERR(drv->mclk); ++ } ++ + ret_val = devm_snd_soc_register_card(&pdev->dev, &snd_soc_card_cht); + if (ret_val) { + dev_err(&pdev->dev, +-- +2.9.3 diff --git a/0005-ASoC-Intel-atom-use-cht_bsw_max98090-for-Baytrail-Chromebooks.patch b/0005-ASoC-Intel-atom-use-cht_bsw_max98090-for-Baytrail-Chromebooks.patch new file mode 100644 index 000000000000..0447122036d1 --- /dev/null +++ b/0005-ASoC-Intel-atom-use-cht_bsw_max98090-for-Baytrail-Chromebooks.patch @@ -0,0 +1,34 @@ +Baytrail Chromebooks used to be managed with legacy driver which +is not compatible with atom/sst drivers. Reuse CHT driver to +handle max98098 codec and allow distributions to support all +Atom platforms with the same build. + +The legacy byt-max98090 can still be used but in a build for +Baytrail+max98090 only. + +Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart at linux.intel.com> +--- + sound/soc/intel/atom/sst/sst_acpi.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/sound/soc/intel/atom/sst/sst_acpi.c b/sound/soc/intel/atom/sst/sst_acpi.c +index 0e928d5..ff4a517 100644 +--- a/sound/soc/intel/atom/sst/sst_acpi.c ++++ b/sound/soc/intel/atom/sst/sst_acpi.c +@@ -536,6 +536,14 @@ static struct sst_acpi_mach sst_acpi_bytcr[] = { + .board = "cht-bsw", + .pdata = &byt_rvp_platform_data + }, ++ /* use CHT driver to Baytrail Chromebooks */ ++ { ++ .id = "193C9890", ++ .drv_name = "cht-bsw-max98090", ++ .fw_filename = "intel/fw_sst_0f28.bin", ++ .board = "cht-bsw", ++ .pdata = &byt_rvp_platform_data ++ }, + #if IS_ENABLED(CONFIG_SND_SOC_INTEL_BYT_CHT_NOCODEC_MACH) + /* + * This is always last in the table so that it is selected only when +-- +2.9.3 diff --git a/0006-ASoC-ts3a227e-add-acpi-table.patch b/0006-ASoC-ts3a227e-add-acpi-table.patch new file mode 100644 index 000000000000..90c5190f2e75 --- /dev/null +++ b/0006-ASoC-ts3a227e-add-acpi-table.patch @@ -0,0 +1,48 @@ +From: "Fang, Yang A" <yang.a.fang at intel.com> + +This patch adds the acpi match table for the ts3a227e audio accessory +detection device. This enables headset features like jack plug/unplug +notifications, mic presence, and button pressed events. + +Signed-off-by: Fang, Yang A <yang.a.fang at intel.com> +Signed-off-by: Thierry Escande <thierry.escande at collabora.com> +Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart at linux.intel.com> +--- + sound/soc/codecs/ts3a227e.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/sound/soc/codecs/ts3a227e.c b/sound/soc/codecs/ts3a227e.c +index 4356843..738e04b 100644 +--- a/sound/soc/codecs/ts3a227e.c ++++ b/sound/soc/codecs/ts3a227e.c +@@ -15,6 +15,7 @@ + #include <linux/module.h> + #include <linux/of_gpio.h> + #include <linux/regmap.h> ++#include <linux/acpi.h> + + #include <sound/core.h> + #include <sound/jack.h> +@@ -374,11 +375,20 @@ static const struct of_device_id ts3a227e_of_match[] = { + }; + MODULE_DEVICE_TABLE(of, ts3a227e_of_match); + ++#ifdef CONFIG_ACPI ++static struct acpi_device_id ts3a227e_acpi_match[] = { ++ { "104C227E", 0 }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(acpi, ts3a227e_acpi_match); ++#endif ++ + static struct i2c_driver ts3a227e_driver = { + .driver = { + .name = "ts3a227e", + .pm = &ts3a227e_pm, + .of_match_table = of_match_ptr(ts3a227e_of_match), ++ .acpi_match_table = ACPI_PTR(ts3a227e_acpi_match), + }, + .probe = ts3a227e_i2c_probe, + .id_table = ts3a227e_i2c_ids, +-- +2.9.3 diff --git a/0007-ASoc-Intel-cht_bsw_max98090_ti-Fix-jack-initialization.patch b/0007-ASoc-Intel-cht_bsw_max98090_ti-Fix-jack-initialization.patch new file mode 100644 index 000000000000..9d5ac83a3aae --- /dev/null +++ b/0007-ASoc-Intel-cht_bsw_max98090_ti-Fix-jack-initialization.patch @@ -0,0 +1,87 @@ +From: Thierry Escande <thierry.escande at collabora.com> + +If the ts3a227e audio accessory detection hardware is present and its +driver probed, the jack needs to be created before enabling jack +detection in the ts3a227e driver. With this patch, the jack is +instantiated in the max98090 headset init function if the ts3a227e is +present. This fixes a null pointer dereference as the jack detection +enabling function in the ts3a driver was called before the jack is +created. + +[minor correction to keep error handling on jack creation the same +as before by Pierre Bossart] + +Signed-off-by: Thierry Escande <thierry.escande at collabora.com> +Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart at linux.intel.com> +--- + sound/soc/intel/boards/cht_bsw_max98090_ti.c | 45 +++++++++++++++++++--------- + 1 file changed, 31 insertions(+), 14 deletions(-) + +diff --git a/sound/soc/intel/boards/cht_bsw_max98090_ti.c b/sound/soc/intel/boards/cht_bsw_max98090_ti.c +index 01bacca..a1502c7 100644 +--- a/sound/soc/intel/boards/cht_bsw_max98090_ti.c ++++ b/sound/soc/intel/boards/cht_bsw_max98090_ti.c +@@ -166,23 +166,19 @@ static int cht_codec_init(struct snd_soc_pcm_runtime *runtime) + struct cht_mc_private *ctx = snd_soc_card_get_drvdata(runtime->card); + struct snd_soc_jack *jack = &ctx->jack; + +- /** +- * TI supports 4 butons headset detection +- * KEY_MEDIA +- * KEY_VOICECOMMAND +- * KEY_VOLUMEUP +- * KEY_VOLUMEDOWN +- */ +- if (ctx->ts3a227e_present) +- jack_type = SND_JACK_HEADPHONE | SND_JACK_MICROPHONE | +- SND_JACK_BTN_0 | SND_JACK_BTN_1 | +- SND_JACK_BTN_2 | SND_JACK_BTN_3; +- else +- jack_type = SND_JACK_HEADPHONE | SND_JACK_MICROPHONE; ++ if (ctx->ts3a227e_present) { ++ /* ++ * The jack has already been created in the ++ * cht_max98090_headset_init() function. ++ */ ++ snd_soc_jack_notifier_register(jack, &cht_jack_nb); ++ return 0; ++ } ++ ++ jack_type = SND_JACK_HEADPHONE | SND_JACK_MICROPHONE; + + ret = snd_soc_card_jack_new(runtime->card, "Headset Jack", + jack_type, jack, NULL, 0); +- + if (ret) { + dev_err(runtime->dev, "Headset Jack creation failed %d\n", ret); + return ret; +@@ -257,6 +253,27 @@ static int cht_max98090_headset_init(struct snd_soc_component *component) + { + struct snd_soc_card *card = component->card; + struct cht_mc_private *ctx = snd_soc_card_get_drvdata(card); ++ struct snd_soc_jack *jack = &ctx->jack; ++ int jack_type; ++ int ret; ++ ++ /* ++ * TI supports 4 butons headset detection ++ * KEY_MEDIA ++ * KEY_VOICECOMMAND ++ * KEY_VOLUMEUP ++ * KEY_VOLUMEDOWN ++ */ ++ jack_type = SND_JACK_HEADPHONE | SND_JACK_MICROPHONE | ++ SND_JACK_BTN_0 | SND_JACK_BTN_1 | ++ SND_JACK_BTN_2 | SND_JACK_BTN_3; ++ ++ ret = snd_soc_card_jack_new(card, "Headset Jack", jack_type, ++ jack, NULL, 0); ++ if (ret) { ++ dev_err(card->dev, "Headset Jack creation failed %d\n", ret); ++ return ret; ++ } + + return ts3a227e_enable_jack_detect(component, &ctx->jack); + } +-- +2.9.3 diff --git a/0008-ASoC-Intel-cht_bsw_max98090-add-gpio-based-jack-detection.patch b/0008-ASoC-Intel-cht_bsw_max98090-add-gpio-based-jack-detection.patch new file mode 100644 index 000000000000..93c4a0b8b030 --- /dev/null +++ b/0008-ASoC-Intel-cht_bsw_max98090-add-gpio-based-jack-detection.patch @@ -0,0 +1,112 @@ +Jacks are created but only enabled when the external TI chip is +present, this probably never worked as well. Forklift the gpio-based +code from the legacy byt-max98090 driver, with however a less strict +error check. It's fine to let users enjoy their device even if +jack detection doesn't work - it almost never does without quirks... + +Tested on Lenovo100s + +CC: Andy Shevchenko <andriy.shevchenko at linux.intel.com> +Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart at linux.intel.com> +--- + sound/soc/intel/boards/cht_bsw_max98090_ti.c | 56 +++++++++++++++++++++++++++- + 1 file changed, 55 insertions(+), 1 deletion(-) + +diff --git a/sound/soc/intel/boards/cht_bsw_max98090_ti.c b/sound/soc/intel/boards/cht_bsw_max98090_ti.c +index a1502c7..74c047a 100644 +--- a/sound/soc/intel/boards/cht_bsw_max98090_ti.c ++++ b/sound/soc/intel/boards/cht_bsw_max98090_ti.c +@@ -159,6 +159,40 @@ static struct notifier_block cht_jack_nb = { + .notifier_call = cht_ti_jack_event, + }; + ++static struct snd_soc_jack_pin hs_jack_pins[] = { ++ { ++ .pin = "Headphone", ++ .mask = SND_JACK_HEADPHONE, ++ }, ++ { ++ .pin = "Headset Mic", ++ .mask = SND_JACK_MICROPHONE, ++ }, ++}; ++ ++static struct snd_soc_jack_gpio hs_jack_gpios[] = { ++ { ++ .name = "hp", ++ .report = SND_JACK_HEADPHONE | SND_JACK_LINEOUT, ++ .debounce_time = 200, ++ }, ++ { ++ .name = "mic", ++ .invert = 1, ++ .report = SND_JACK_MICROPHONE, ++ .debounce_time = 200, ++ }, ++}; ++ ++static const struct acpi_gpio_params hp_gpios = { 0, 0, false }; ++static const struct acpi_gpio_params mic_gpios = { 1, 0, false }; ++ ++static const struct acpi_gpio_mapping acpi_max98090_gpios[] = { ++ { "hp-gpios", &hp_gpios, 1 }, ++ { "mic-gpios", &mic_gpios, 1 }, ++ {}, ++}; ++ + static int cht_codec_init(struct snd_soc_pcm_runtime *runtime) + { + int ret; +@@ -178,15 +212,29 @@ static int cht_codec_init(struct snd_soc_pcm_runtime *runtime) + jack_type = SND_JACK_HEADPHONE | SND_JACK_MICROPHONE; + + ret = snd_soc_card_jack_new(runtime->card, "Headset Jack", +- jack_type, jack, NULL, 0); ++ jack_type, jack, ++ hs_jack_pins, ARRAY_SIZE(hs_jack_pins)); + if (ret) { + dev_err(runtime->dev, "Headset Jack creation failed %d\n", ret); + return ret; + } + ++ + if (ctx->ts3a227e_present) + snd_soc_jack_notifier_register(jack, &cht_jack_nb); + ++ ret = snd_soc_jack_add_gpiods(runtime->card->dev->parent, jack, ++ ARRAY_SIZE(hs_jack_gpios), ++ hs_jack_gpios); ++ if (ret) { ++ /* ++ * flag error but don't bail if jack detect is broken ++ * due to platform issues or bad BIOS/configuration ++ */ ++ dev_err(runtime->dev, ++ "jack detection gpios not added, error %d\n", ret); ++ } ++ + /* + * The firmware might enable the clock at + * boot (this information may or may not +@@ -363,6 +411,7 @@ static struct snd_soc_card snd_soc_card_cht = { + + static int snd_cht_mc_probe(struct platform_device *pdev) + { ++ struct device *dev = &pdev->dev; + int ret_val = 0; + struct cht_mc_private *drv; + +@@ -375,6 +424,11 @@ static int snd_cht_mc_probe(struct platform_device *pdev) + /* no need probe TI jack detection chip */ + snd_soc_card_cht.aux_dev = NULL; + snd_soc_card_cht.num_aux_devs = 0; ++ ++ ret_val = devm_acpi_dev_add_driver_gpios(dev->parent, ++ acpi_max98090_gpios); ++ if (ret_val) ++ dev_dbg(dev, "Unable to add GPIO mapping table\n"); + } + + /* register the soc card */ +-- +2.9.3 @@ -3,13 +3,23 @@ pkgbase=linux-max98090 _srcname=linux-4.14 -pkgver=4.14.2 +pkgver=4.14.3 pkgrel=1 arch=('x86_64') url="https://www.kernel.org/" license=('GPL2') makedepends=('xmlto' 'kmod' 'inetutils' 'bc' 'libelf' 'patch' 'make') options=('!strip') +_patches=( + '0001-platform-x86-hp-wmi-Fix-tablet-mode-detection-for-co.patch' + '0002-ASoC-max98090-reduce-verbosity-on-PLL-unlock.patch' + '0003-ASoC-Intel-cht_bsw_max98090-Fix-I2S-config-unused-code.patch' + '0004-ASoC-Intel-cht_bsw_max98090-add-support-for-Baytrail.patch' + '0005-ASoC-Intel-atom-use-cht_bsw_max98090-for-Baytrail-Chromebooks.patch' + '0006-ASoC-ts3a227e-add-acpi-table.patch' + '0007-ASoc-Intel-cht_bsw_max98090_ti-Fix-jack-initialization.patch' + '0008-ASoC-Intel-cht_bsw_max98090-add-gpio-based-jack-detection.patch' +) source=( "https://www.kernel.org/pub/linux/kernel/v4.x/${_srcname}.tar.xz" "https://www.kernel.org/pub/linux/kernel/v4.x/${_srcname}.tar.sign" @@ -19,24 +29,29 @@ source=( '60-linux.hook' # pacman hook for depmod '90-linux.hook' # pacman hook for initramfs regeneration 'linux.preset' # standard config files for mkinitcpio ramdisk - '0001-platform-x86-hp-wmi-Fix-tablet-mode-detection-for-co.patch' - #'HiFi.conf' - #'byt-max98090.conf' - #'orco-bytmax98090.state' + "${_patches[@]}" ) + validpgpkeys=( 'ABAF11C65A2970B130ABE3C479BE3E4300411886' # Linus Torvalds '647F28654894E3BD457199BE38DBBDC86092693E' # Greg Kroah-Hartman ) sha256sums=('f81d59477e90a130857ce18dc02f4fbe5725854911db1e7ba770c7cd350f96a7' 'SKIP' - '2dc86272e55d31c55bdeaa47b3d44fbd6235a396e37d82c2b47aa27f6ba82ee3' + 'e13995c11d0c2d3379c887666dbfaca619200fb8853db6d5d67f97d47fd959b7' 'SKIP' - '83a0dd958b5ea2e5893e87b9877ebef467af8aaf2d31ea46055b46337636fd57' + '02b2ed3fd7765fb311845a54ed3c5b9ba4088b48233995ba42faa4f97dc953ea' 'ae2e95db94ef7176207c690224169594d49445e04249d2499e9d2fbc117a0b21' '75f99f5239e03238f88d1a834c50043ec32b1dc568f2cc291b07d04718483919' 'ad6344badc91ad0630caacde83f7f9b97276f80d26a20619a87952be65492c65' - '6f1d9b6a119bfab150a0bc1f550609dd9290328df709b67c984f0a6b0abe8afd') + '6f1d9b6a119bfab150a0bc1f550609dd9290328df709b67c984f0a6b0abe8afd' + 'f372da78745f49e5709f2739a1166c39298c91d5eb08d6fb362603481d8395b5' + 'a1766026aa04cd650da0229399121fc547620617699bbc573c250360182504ed' + 'fef99b00f76a623a78c2871a204e673d8522f54c4623a529d4839389afefc857' + 'f09c970935ae9788db015e4ddc2949e909bbd1be81b219ccad0c701e3546cbf7' + '2f19a7f5c9e01516da222f69b40599fabd4e5b3c87aeac3ada78012a6d2904b8' + '60fabf5d05e1176361cceff6ec1720935762e27e3d590b1a267fa9eb7739a607' + 'b2b20af5ea14de866b0af3e2cbe27ed517bf22c5c97b51b3bcc778062d4b7217') _kernelname=${pkgbase#linux} @@ -52,7 +67,11 @@ prepare() { # http://git.kernel.org/?p=linux/kernel/git/stable/stable-queue.git # https://bugs.archlinux.org/task/56207 - patch -Np1 -i ../0001-platform-x86-hp-wmi-Fix-tablet-mode-detection-for-co.patch + +for file in "${_patches[@]}"; do + echo "Applying patch $(basename $file)..." + patch -Np1 <"$srcdir/$(basename ${file})" + done cp -Tf ../config .config @@ -144,11 +163,6 @@ _package() { install -Dm644 /dev/stdin "${pkgdir}/usr/share/libalpm/hooks/60-${pkgbase}.hook" sed "${_subst}" ../90-linux.hook | install -Dm644 /dev/stdin "${pkgdir}/usr/share/libalpm/hooks/90-${pkgbase}.hook" - # install ucm files for max98090 - #install -d "${pkgdir}/usr/share/alsa/ucm/byt-max98090" - #install -Dm644 "${srcdir}/HiFi.conf" "${pkgdir}/usr/share/alsa/ucm/byt-max98090" - #install -Dm644 "${srcdir}/byt-max98090.conf" "${pkgdir}/usr/share/alsa/ucm/byt-max98090" - #install -Dm644 "${srcdir}/orco-bytmax98090.state" "${pkgdir}/usr/share/alsa/ucm/byt-max98090" } _package-headers() { @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/x86 4.14.2-1 Kernel Configuration +# Linux/x86 4.14.3-1 Kernel Configuration # CONFIG_64BIT=y CONFIG_X86_64=y @@ -411,12 +411,12 @@ CONFIG_IOSCHED_NOOP=y CONFIG_IOSCHED_DEADLINE=y CONFIG_IOSCHED_CFQ=y CONFIG_CFQ_GROUP_IOSCHED=y -# CONFIG_DEFAULT_DEADLINE is not set -CONFIG_DEFAULT_CFQ=y +CONFIG_DEFAULT_DEADLINE=y +# CONFIG_DEFAULT_CFQ is not set # CONFIG_DEFAULT_NOOP is not set -CONFIG_DEFAULT_IOSCHED="cfq" +CONFIG_DEFAULT_IOSCHED="deadline" CONFIG_MQ_IOSCHED_DEADLINE=y -CONFIG_MQ_IOSCHED_KYBER=y +# CONFIG_MQ_IOSCHED_KYBER is not set CONFIG_IOSCHED_BFQ=y CONFIG_BFQ_GROUP_IOSCHED=y CONFIG_PREEMPT_NOTIFIERS=y @@ -2973,7 +2973,7 @@ CONFIG_GENERIC_PINCONF=y # CONFIG_PINCTRL_MCP23S08 is not set # CONFIG_PINCTRL_SX150X is not set CONFIG_PINCTRL_BAYTRAIL=y -# CONFIG_PINCTRL_CHERRYVIEW is not set +CONFIG_PINCTRL_CHERRYVIEW=m # CONFIG_PINCTRL_BROXTON is not set # CONFIG_PINCTRL_CANNONLAKE is not set # CONFIG_PINCTRL_DENVERTON is not set @@ -4173,6 +4173,7 @@ CONFIG_SND_PCM_IEC958=y CONFIG_SND_HWDEP=m CONFIG_SND_SEQ_DEVICE=m CONFIG_SND_RAWMIDI=m +CONFIG_SND_COMPRESS_OFFLOAD=m CONFIG_SND_JACK=y CONFIG_SND_JACK_INPUT_DEV=y # CONFIG_SND_OSSEMUL is not set @@ -4321,6 +4322,7 @@ CONFIG_SND_USB_TONEPORT=m CONFIG_SND_USB_VARIAX=m CONFIG_SND_SOC=m CONFIG_SND_SOC_AC97_BUS=y +CONFIG_SND_SOC_COMPRESS=y # CONFIG_SND_SOC_AMD_ACP is not set # CONFIG_SND_ATMEL_SOC is not set # CONFIG_SND_DESIGNWARE_I2S is not set @@ -4340,23 +4342,22 @@ CONFIG_SND_SOC_AC97_BUS=y # CONFIG_SND_SOC_IMX_AUDMUX is not set # CONFIG_SND_I2S_HI6210_I2S is not set # CONFIG_SND_SOC_IMG is not set +CONFIG_SND_SST_ATOM_HIFI2_PLATFORM=m +CONFIG_SND_SST_IPC=m +CONFIG_SND_SST_IPC_ACPI=m CONFIG_SND_SOC_INTEL_SST=m -CONFIG_SND_SOC_INTEL_SST_FIRMWARE=m CONFIG_SND_SOC_INTEL_SST_ACPI=m CONFIG_SND_SOC_INTEL_SST_MATCH=m -CONFIG_SND_SOC_INTEL_BAYTRAIL=m # CONFIG_SND_SOC_INTEL_HASWELL_MACH is not set # CONFIG_SND_SOC_INTEL_BXT_DA7219_MAX98357A_MACH is not set # CONFIG_SND_SOC_INTEL_BXT_RT298_MACH is not set -# CONFIG_SND_SOC_INTEL_BYT_RT5640_MACH is not set -CONFIG_SND_SOC_INTEL_BYT_MAX98090_MACH=m # CONFIG_SND_SOC_INTEL_BDW_RT5677_MACH is not set # CONFIG_SND_SOC_INTEL_BROADWELL_MACH is not set # CONFIG_SND_SOC_INTEL_BYTCR_RT5640_MACH is not set # CONFIG_SND_SOC_INTEL_BYTCR_RT5651_MACH is not set # CONFIG_SND_SOC_INTEL_CHT_BSW_RT5672_MACH is not set # CONFIG_SND_SOC_INTEL_CHT_BSW_RT5645_MACH is not set -# CONFIG_SND_SOC_INTEL_CHT_BSW_MAX98090_TI_MACH is not set +CONFIG_SND_SOC_INTEL_CHT_BSW_MAX98090_TI_MACH=m # CONFIG_SND_SOC_INTEL_BYT_CHT_DA7213_MACH is not set # CONFIG_SND_SOC_INTEL_BYT_CHT_ES8316_MACH is not set # CONFIG_SND_SOC_INTEL_BYT_CHT_NOCODEC_MACH is not set |