summaryrefslogtreecommitdiffstats
path: root/sound/soc/intel/boards/bytcr_rt5651.c
AgeCommit message (Collapse)AuthorFilesLines
2019-06-05treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 285Thomas Gleixner1-9/+1
Based on 1 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms of the gnu general public license as published by the free software foundation version 2 of the license this program is distributed in the hope that 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 extracted by the scancode license scanner the SPDX license identifier GPL-2.0-only has been chosen to replace the boilerplate/reference in 100 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Alexios Zavras <alexios.zavras@intel.com> Reviewed-by: Allison Randal <allison@lohutok.net> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190529141900.918357685@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-25ASoC: Intel: bytcr_rt5651: align quirk override handlingPierre-Louis Bossart1-3/+3
As discussed on alsa-devel, a zero value is useful to get rid of all quirks. Set default to -1 and align types as done in other machine drivers. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-04-02Merge branch 'acpi-utils' of ↵Mark Brown1-6/+8
git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm into asoc-5.2
2019-04-01ASoC: Intel: bytcr_rt5651: Convert to use acpi_dev_get_first_match_dev()Andy Shevchenko1-6/+8
acpi_dev_get_first_match_name() is deprecated and going to be removed because it leaks a reference. Convert the driver to use acpi_dev_get_first_match_dev() instead. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2019-03-18ASoC: Intel: bytcr_rt5651: Add BYT_RT5651_JD_NOT_INV quirkHans de Goede1-2/+20
Add BYT_RT5651_JD_NOT_INV quirk for devices with an inverted (active-high instead of the normal active-low) jack-detect switch. And add a quirk for the Complet Electro Serv MY8307 tablet which has an inverted jack-detect switch (and a mono-speaker). Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-02-08gpiolib: acpi: Introduce ACPI_GPIO_QUIRK_ONLY_GPIOIOAndy Shevchenko1-65/+9
New quirk enforces search for GPIO based on its type, i.e. iterate over GpioIo resources only. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com> Acked-by: Linus Walleij <linus.walleij@linaro.org> Tested-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-01-28ASoC: Intel: bytcr_rt5651: platform name fixup supportPierre-Louis Bossart1-0/+9
Add helper to override dailink platform name, if passed as parameter Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-01-24ASoC: Intel: make const arrays static, reduces object code sizeColin Ian King1-1/+1
Don't populate the const arrays on the stack but instead make it static. Makes the object code smaller, for example: Before: text data bss dec hex filename 14107 8832 224 23163 5a7b bytcht_es8316.o After: text data bss dec hex filename 14015 8896 224 23135 5a5f bytcht_es8316.o (gcc version 8.2.0 x86_64) Signed-off-by: Colin Ian King <colin.king@canonical.com> Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-01-07ASoC: Intel: bytcr_rt5651: Add quirk for PoV TAB-P1006W-232 (v1.0) tabletHans de Goede1-5/+43
Add a DMI quirk for the Point of View TAB-P1006W-232 (v1.0) tablet, this tablet is special in a number of ways: 1) It uses the 2nd GPIO resource in the ACPI tables for jack-detect rather then using the rt5651 codec's builtin jack-detect functionality 2) It uses the 3th GPIO resource in the ACPI tables to control the external amplifier rather then the usual first non GpioInt resource and the GPIO is active-low. 3) It is a BYTCR device, without a CHAN package and it uses SSP0-AIF1 rather then the default SSP0-AIF2. 4) Its internal mic is a digital mic (the first x86 rt5651 device that I'm aware of which does this), combined with having its headset-mic connected to IN2. Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-01-07ASoC: Intel: bytcr_rt5651: Add support for jack-detect using an external GPIOHans de Goede1-7/+36
Some board designs hook the jack-detect up to an external GPIO, rather then to one of the codec pins, add support for this. Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-01-07ASoC: Intel: bytcr_rt5651: Add quirks module parameterHans de Goede1-0/+10
Add quirks module parameter to allow manually specifying quirks from the kernel commandline (or modprobe.conf). Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-01-07ASoC: Intel: bytcr_rt5651: Revert "Fix DMIC map headsetmic mapping"Hans de Goede1-1/+1
Commit 37c7401e8c1f ("ASoC: Intel: bytcr_rt5651: Fix DMIC map headsetmic mapping"), changed the headsetmic mapping from IN3P to IN2P, this was based on the observation that all bytcr_rt5651 devices I have access to (7 devices) where all using IN3P for the headsetmic. This was an attempt to unifify / simplify the mapping, but it was wrong. None of those devices was actually using a digital internal mic. Now I've access to a Point of View TAB-P1006W-232 (v1.0) tabler, which does use a DMIC and it does have its headsetmic connected to IN2P, showing that the original mapping was correct, so this commit reverts the change changing the mapping back to IN2P. Fixes: 37c7401e8c1f ("ASoC: Intel: bytcr_rt5651: Fix DMIC map ... mapping") Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-11-06ASoC: Intel: use standard interface for Atom machine driversPierre-Louis Bossart1-5/+1
Don't rely on internal Atom/SST-specific data structures, use generic interface to let other drivers use the same machine drivers as is, e.g. SOF to support BYT-CR devices Tested-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-10-25Merge tag 'sound-4.20-rc1' of ↵Linus Torvalds1-2/+2
git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound Pull sound updates from Takashi Iwai: "There have been little changes in ALSA core stuff, but ASoC core still kept rolling for the continued restructuring. The rest are lots of small driver-specific changes and some minor API updates. Here are highlights: General: - Appropriate fall-through annotations everywhere - Some code cleanup in memalloc code, handling non-cacahed pages more commonly in the helper - Deployment of SNDRV_PCM_INFO_SYNC_APPLPTR flag consistently Drivers: - More HD-audio CA0132 codec improvement for supporting other Creative boards - Plumbing legacy HD-audio codecs as ASoC BE on Intel SST; this will give move support of existing HD-audio devices with DSP - A few device-specific HD-audio quirks as usual - New quirk for RME CC devices and correction for B&W PX for USB-audio - FireWire: code refactoring including devres usages ASoC Core: - Continued componentization works; it's almost done! - A bunch of new for_each_foo macros - Cleanups and fixes in DAPM code ASoC Drivers: - MCLK support for several different devices, including CS42L51, STM32 SAI, and MAX98373 - Support for Allwinner A64 CODEC analog, Intel boards with DA7219 and MAX98927, Meson AXG PDM inputs, Nuvoton NAU8822, Renesas R8A7744 and TI PCM3060" * tag 'sound-4.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (299 commits) ASoC: stm32: sai: fix master clock naming ASoC: stm32: add clock dependency for sai ALSA: hda/ca0132 - Actually fix microphone issue ASoC: sun4i-i2s: move code from startup/shutdown hooks into pm_runtime hooks ASoC: wm2000: Remove wm2000_read helper function ASoC: cs42l51: fix mclk support ASoC: wm_adsp: Log addresses as 8 digits in wm_adsp_buffer_populate ASoC: wm_adsp: Rename memory fields in wm_adsp_buffer ASoC: cs42l51: add mclk support ASoC: stm32: sai: set sai as mclk clock provider ASoC: dt-bindings: add mclk support to cs42l51 ASoC: dt-bindings: add mclk provider support to stm32 sai ASoC: soc-core: fix trivial checkpatch issues ASoC: dapm: Add support for hw_free on CODEC to CODEC links ASoC: Intel: kbl_da7219_max98927: minor white space clean up ALSA: i2c/cs8427: Fix int to char conversion ALSA: doc: Brush up the old writing-an-alsa-driver ASoC: rsnd: tidyup SSICR::SWSP for TDM ASoC: rsnd: enable TDM settings for SSI parent ASoC: pcm3168a: add hw constraint for capture channel ...
2018-10-02x86/cpu: Sanitize FAM6_ATOM namingPeter Zijlstra1-1/+1
Going primarily by: https://en.wikipedia.org/wiki/List_of_Intel_Atom_microprocessors with additional information gleaned from other related pages; notably: - Bonnell shrink was called Saltwell - Moorefield is the Merriefield refresh which makes it Airmont The general naming scheme is: FAM6_ATOM_UARCH_SOCTYPE for i in `git grep -l FAM6_ATOM` ; do sed -i -e 's/ATOM_PINEVIEW/ATOM_BONNELL/g' \ -e 's/ATOM_LINCROFT/ATOM_BONNELL_MID/' \ -e 's/ATOM_PENWELL/ATOM_SALTWELL_MID/g' \ -e 's/ATOM_CLOVERVIEW/ATOM_SALTWELL_TABLET/g' \ -e 's/ATOM_CEDARVIEW/ATOM_SALTWELL/g' \ -e 's/ATOM_SILVERMONT1/ATOM_SILVERMONT/g' \ -e 's/ATOM_SILVERMONT2/ATOM_SILVERMONT_X/g' \ -e 's/ATOM_MERRIFIELD/ATOM_SILVERMONT_MID/g' \ -e 's/ATOM_MOOREFIELD/ATOM_AIRMONT_MID/g' \ -e 's/ATOM_DENVERTON/ATOM_GOLDMONT_X/g' \ -e 's/ATOM_GEMINI_LAKE/ATOM_GOLDMONT_PLUS/g' ${i} done Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Vince Weaver <vincent.weaver@maine.edu> Cc: dave.hansen@linux.intel.com Cc: len.brown@intel.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
2018-09-20ASoC: add for_each_card_components() macroKuninori Morimoto1-2/+2
To be more readable code, this patch adds new for_each_card_components() macro, and replace existing code to it. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-07-19ASoC: Intel: bytcr_rt5651: Add quirk table entries for various devicesHans de Goede1-0/+28
Add quirk table entries for the following tablets: ITWorks TW701 Ployer Momo7w Trekstor win7 Yours 8" These all use the default settings, except that they only have a single speaker and thus need the mono-speaker quirk. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-07-19ASoC: Intel: bytcr_rt5651: Add mono speaker quirkHans de Goede1-4/+11
During my initial round of bytcr_rt5651 long-name patches I did not include a difference for mono vs stereo speaker setups in the longname because it seems that all 5651 devices with only a single speaker do some mixing of left + right on the PCB. However further testing has shown that while this works great when only playing audio on the left or right channel, the output becomes garbled when using both channels at once. Something which does not happen when using the Stereo DAC MIXL / MIXR switches to mix the channels together inside the codec and then only outputting on a single channel. So we need to have separate UCM profiles and thus separate long-names for devices with a mono speaker vs stereo speakers. Just as we already have for the bytcr_rt5640 case. This commit adds a new BYT_RT5651_MONO_SPEAKER quirk and adds "stereo-spk" or "mono-spk" to the long-name based on this and enables this mapping on devices with a mono speaker. Changing the long-name like this is ok for now, since I'm still working on the UCM profiles, so they are not in upstream alsa-lib yet. This brings the long-name naming scheme fully in sync with the bytcr_rt5640 case, which is good from a consistency pov. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-07-19ASoC: Intel: bytcr_rt5651: Add IN2 input mappingHans de Goede1-5/+18
During the recent cleanup series 3 of the 6 input mappings where removed from the bytcr_rt5651 machine driver because testing showed that none of them were used. However some devices do actually have their internal mic on IN2 (and only IN2, not IN1 and IN2), this did not show during previous tests due to a bug in the userspace UCM input device switching code. This commit re-adds the IN2 mapping for devices with the internal mic. on IN2 and the headser mic on IN3 and enables this mapping on devices with their internal mic on IN2. This commit also changes the default internal mic input to IN2, because all my 7 test devices have their mic there. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-07-19ASoC: Intel: bytcr_rt5651: Set OVCD limit for VIOS LTH17 to 2000uAHans de Goede1-2/+5
With the default over current detect limit of 1500uA headsets on often get detected as headphones on the VIOS LTH17 and even when detected as headset the OVCD current triggers often while plugged in, resulting in false-positive button press detection. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-07-19ASoC: Intel: bytcr_rt5651: Fix using the wrong GPIO for the ext-amp on some ↵Hans de Goede1-4/+65
boards Some boards have I2cSerialBusV2, GpioIo, GpioInt as ACPI resources, other boards may have I2cSerialBusV2, GpioInt, GpioIo instead. We want the GpioIo one for the ext-amp-enable-gpio. So far we've been assuming that the GpioIo one always comes first, this commit adds code to detect which one comes first and to add the right gpio-mapping. This fixes sound not working on the Vios LTH17 laptop. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-07-10ASoC: Intel: bytcr_rt5651: Reporting button pressesHans de Goede1-2/+7
Enable reporting of button presses now that the codec driver recently has gotten support for this. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-07-10ASoC: Intel: bytcr_rt5651: Disable jack-detect over suspend/resumeHans de Goede1-5/+44
Disable jack-detection and thus the codec IRQ over suspend/resume. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-07-10ASoC: Intel: bytcr_rt5651: Add support for externar amplifier enable GPIOHans de Goede1-3/+62
The rt5651 does not have a built-in speaker amplifier, so it is often used together with an external amplifier. On Cherry Trail boards this external amplifier's enable pin is driven through a GPIO, which is given as the first GPIO in the ACPI resources of the codec fwnode. This commit adds support to the bytcr_rt5651 for this GPIO, fixing the speaker not working on CHT devices with a rt5651 codec. Cc: Carlo Caione <carlo@endlessm.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-07-10ASoC: Intel: bytcr_rt5651: Move getting of codec_dev into probe()Hans de Goede1-12/+11
Move the getting of the codec_dev, to add device-props to it, out of byt_rt5651_add_codec_device_props() and into its caller, snd_byt_rt5651_mc_probe(). This is a preparation patch for adding support for an external amplifier enable GPIO, which requires further accesses to the codec_dev. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-07-10ASoC: Intel: bytcr_rt5651: Remove is_valleyview helperHans de Goede1-12/+6
Remove is_valleyview helper, this is not necessary, we can simply call x86_match_cpu() directly instead. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-06-27ASoC: Intel: bytcr_rt5651: Sort DMI table entries alphabeticallyHans de Goede1-19/+22
As we get more entries in the DMI quirk table it is nice to have some sort of ordering in the table, sort it alphabetically. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-06-27ASoC: Intel: bytcr_rt5651: Add BYT_RT5651_HP_LR_SWAPPED quirkHans de Goede1-4/+23
One some models (Chuwi Vi8 Plus, Chuwi Hi8 Pro) the headphone output has left and right swapped. This can be fixed in with special mixer settings in the UCM profile, bit this requires these devices loading a different UCM profile. This commit adds a BYT_RT5651_HP_LR_SWAPPED quirk for this and postfixes the longname with "-hp-swapped" if set, so that a different UCM profile will be loaded. We can safely do this without causing regressions (UCM profile not found due to the longname change) as the UCM profiles are not in upstream alsa-lib yet. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-06-27ASoC: Intel: bytcr_rt5651: Simplify card long-nameHans de Goede1-6/+4
Now that the headset-mic is always IN3 there is no reason to have the headset-mic mapping in the long-name. This commit simplifies the long name to "bytcr-rt5651-<intmic-map>-mic". We can safely do this without causing regressions (UCM profile not found due to the longname change) as the UCM profiles are not in upstream alsa-lib yet. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-06-27ASoC: Intel: bytcr_rt5651: Fix DMIC map headsetmic mappingHans de Goede1-2/+2
The initial bytcr_rt5651 machine driver commit mapped IN2 as the headset mic. In retrospect this is not correct as all known boards have the headset mic on IN3. This commit fixes the original DMIC mapping to correctly have the headset mic on IN3. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-06-27ASoC: Intel: bytcr_rt5651: Fix IN1 map headsetmic mappingHans de Goede1-22/+7
The initial bytcr_rt5651 machine driver commit mapped IN2 as the headset mic. In retrospect this is not correct as all known boards have the headset mic on IN3. To workaround this special IN?_HS_IN3 mappings were added. This commit fixes the original IN1 mapping to correctly have the headset mic on IN3, moves all users of the IN1_HS_IN3 mapping over to the fixed IN1_MAP and drops the now no longer needed IN1_HS_IN3 mapping. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-06-27ASoC: Intel: bytcr_rt5651: Remove IN2 input mappingsHans de Goede1-28/+2
BYT_RT5651_IN2_MAP was introduced in commit 39712db878a4 ("SoC: intel: byt: Introduce new custom IN2 map"), uses in commit 2fe30129b0a6 ("ASoC: intel: byt: Enable IN2 map quirk for a KIANO laptop"), only to be replaced by a new BYT_RT5651_IN1_IN2_MAP quirk in commit ea261bd02a67 ("ASoC: intel: byt: Introduce new map for dual mics") quickly afterwards, because the KIANO laptop has 2 internal mics on IN1 and IN2 and the headset mic is not in IN1 where the BYT_RT5651_IN2_MAP maps it, but on IN3. Now that the KIANO quirk entry uses BYT_RT5651_IN1_IN2_MAP, there are no users of BYT_RT5651_IN2_MAP left. This makes sense since the headset mic seems to always be connected to IN3, so BYT_RT5651_IN2_MAP is not useful. To deal with BYT_RT5651_IN2_MAP wrongly mapping the headset mic to IN1, BYT_RT5651_IN2_HS_IN3_MAP was added in commit f026e0631780 ("ASoC: Intel: bytcr_rt5651: Add new IN2_HS_IN3 input map and a quirk using it"). This was based on the assumption then some devices have the internal mic connected to IN2 only. Further testing has shown that this is wrong and the internal mic is always connected to IN1 and sometimes to both IN1 and IN2. TL;DR: Both BYT_RT5651_IN2_MAP and BYT_RT5651_IN2_HS_IN3_MAP are based on on wrong assumptions from the past and are no longer useful now, so they can both be removed. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-06-27ASoC: Intel: bytcr_rt5651: Fix IN1_IN2_MAP quirk not being loggedHans de Goede1-0/+2
Fix the quirk logging code not logging the IN1_IN2_MAP quirk. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-06-27ASoC: Intel: bytcr_rt5651: Change default input map from in2 to in1Hans de Goede1-3/+3
Further testing on all 6 model x86 tablets with a rt5651 which I have access to for testing has shown that their single (mono) microphone is connected to both IN1 *and* IN2. The previous default mapping of IN2 was based on testing on the same 6 tablets, where the internal mic works fine with a mapping of IN2. But it works fine too with a mapping of IN1. This commit changes the default input mapping to to use IN1 instead of IN2, to match the mapping used for the other mono devices in the DMI quirk table. So that we need less different mappings. The same change is made to the Chuwi Vi8 Plus quirks, which is one of the 6 models tested. This is a preparation patch for simplifying the maps in a follow-up commit. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-06-27ASoC: Intel: bytcr_rt5651: Add BYT_RT5651_DEFAULT_QUIRKS defineHans de Goede1-16/+9
Almost all boards use the mclk and use the same jack-detect settings, add a BYT_RT5651_DEFAULT_QUIRKS define for this. This shaves of some lines and makes it easier to see which settings are unique to a certain model. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-06-05Merge branch 'asoc-4.17' into asoc-4.18 merge windowMark Brown1-2/+3
2018-05-31ASoC: Intel: bytcr_rt5651: Set card long_name based on quirksHans de Goede1-0/+11
Many X86 devices using a BYT SoC + RT5651 codec are cheap devices with generic DMI strings, causing snd_soc_set_dmi_name() to fail to set a long_name, making it impossible for userspace to have a correct UCM profile which knowns which input is connected to the internal mic, which input is connected to the hsmic (for correct jack-based switching) and which inputs are unused. Our quirks already specify which inputs the internal and headset mic are connected to. This commit sets a long_name based on the quirks so that userspace can have UCM profiles doing the right thing based on the long_name. Note that if we ever encounter the need for a special UCM profile for some device we can add a quirk to set a specific long_name for the device, Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-05-03ASoC: Intel: bytcr_rt565: fix missing assignment to ret_valColin Ian King1-2/+3
Currently, the check that ret_val is not -ENOENT is always true and the quirk bit BYT_RY5651_MCLK_EN is never being cleared because ret_val is always zero at this point from a previous assignment earlier on. I believe that ret_val should actually be assigned to the return from devm_clk_get() as this can return -ENOENT (from a deeper call to clk_get_sys) and that was the original intention to check this. Detected by CoverityScan, CID#1460228 ("Logically dead code") Fixes: 02c0a3b3047f ("ASoC: Intel: bytcr_rt5651: add MCLK, quirks and cleanups") Signed-off-by: Colin Ian King <colin.king@canonical.com> Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-04-20ASoC: Intel: bytcr_rt5651: Replace GFP_ATOMIC with GFP_KERNELVinod Koul1-1/+1
In snd_byt_rt5651_mc_probe which is not atomic context, we use GFP_ATOMIC flag with memory allocation, fix that by using GFP_KERNEL. Signed-off-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-03-28ASoC: Intel: bytcr_rt5651: don't use codec anymoreKuninori Morimoto1-2/+2
commit aeec6cc08215 ("ASoC: Intel: bytcr_rt5651: Configure PLL1 before using it") is using codec->dev, but codec is replaced to component. Let's use component Fixes: aeec6cc08215 ("ASoC: Intel: bytcr_rt5651: Configure PLL1 before using it") Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-03-07ASoC: Intel: bytcr_rt5651: Select RCCLK on init()Hans de Goede1-0/+5
When the BYT_RT5651_MCLK_EN quirk is set, we disable the MCLK from byt_rt5651_init(), we need to select the RCCLK as sysclk before doing this to make sure that jack-detect works directly after boot. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-03-07ASoC: Intel: bytcr_rt5651: Change defaults to enable jack-detect, analog micsHans de Goede1-9/+6
Change the default quirk settings to enable jack-detect, analog mics. The old default input mapping of DMIC for non Bay Trail CR devices seems like a poor default as I'm not aware of any Intel SST + rt5651 using devices with a DMIC. All Cherry Trail devices using the bytcr_rt5651 machine driver seem to be modelled after BYT-CR devices, And the only non CR Bay Trail devices with a rt5651 codec I'm aware of are the Minnow boards for which we already have board specific quirks. So it seems better to me to use the BYT-CR defaults everywhere. This e.g. makes the Chuwi Hi8 Pro (CWI513) work ootb without needing a quirk. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-03-07ASoC: Intel: bytcr_rt5651: Add quirk for the VIOS LTH17 laptopHans de Goede1-0/+13
Add a quirk setting up jack-detect and input routing for the VIOS LTH17 laptop. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-03-07ASoC: Intel: bytcr_rt5651: Add support for Bay Trail CR / SSP0 using boardsHans de Goede1-16/+201
Despite its name being prefixed with bytcr, before this commit the bytcr_rt5651 machine driver could not work with Bay Trail CR boards, as those only have SSP0 and it only supported SSP0-AIF1 setups. This commit adds support for this, autodetecting AIF1 vs AIF2 based on BIOS tables. While at it also add support for SSP2-AIF2 setups, as that requires only minimal extra code on top of the code adding SSP0-AIF1 / SSP0-AIF2 support. Note this code is all copy-pasted from bytcr_rt5640.c. I've looked into merging the 2 machine drivers into 1 to avoid copy-pasting, but there are enough subtile differences to make this hard *and* with all the quirks the machine driver already is full with if (variant-foo) then ... else ... constructs adding more of these is going to make the code unreadable. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-03-07ASoC: Intel: bytcr_rt5651: Add new IN2_HS_IN3 input map and a quirk using itHans de Goede1-0/+26
Add a new IN2_HS_IN3 input map and add a quirk for the input mapping and jack-detect source for the Chuwi Vi8 Plus tablet, which uses this new map. Note the Chuwi Vi8 Plus lists an extra GPIO in its codecs ACPI resources which needs to be driven high to enable the external speaker amplifier, this is not supported yet and will be fixed in a future patch. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-03-07ASoC: Intel: bytcr_rt5651: Rename IN3_MAP to IN1_HS_IN3_MAPHans de Goede1-11/+11
All the mappings are named for where the internal mic is routed and in that sense the newly added in3_map really is the same as in1_map, what makes it different is that it maps the headset mic at IN3 rather then at IN2. Rename in3_map to in1_hs_in3_map to better reflect what it actually does. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-03-07ASoC: Intel: bytcr_rt5651: Drop snd_soc_dai_set_bclk_ratio() callHans de Goede1-2/+0
Drop the snd_soc_dai_set_bclk_ratio() call, the rt5651 dai does not have a set_bclk_ratio() op, so it is a nop (and returns -EINVAL). Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-03-07ASoC: Intel: bytcr_rt5651: Configure PLL1 before using itHans de Goede1-38/+35
When platform_clock_control() first selects PLL1 as sysclk the PLL_CTRL registers have not been setup yet and we effectively have an invalid clock configuration until byt_rt5651_aif1_hw_params() gets called. Add a new byt_rt5651_prepare_and_enable_pll1() helper and use that from both platform_clock_control() and byt_rt5651_aif1_hw_params() to fix this. Tested-by: Carlo Caione <carlo@endlessm.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-03-07ASoC: Intel: bytcr_rt5651: Add quirk micbias OVCD configurationHans de Goede1-3/+31
Add support for setting the micbias OVCD limits device-properties through quirks. And set the limits for this to 2000uA with a scale-factor of 0.75 for the KIANO SlimNote 14.2 device, which is the only device on which jack-detection is currently enabled. Tested-by: Carlo Caione <carlo@endlessm.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-03-07ASoC: Intel: bytcr_rt5651: Only create jack if we have a jack-detect sourceHans de Goede1-7/+11
Only create the jack if we have a valid jack-detect source and properly check the snd_soc_component_set_jack() return value. Tested-by: Carlo Caione <carlo@endlessm.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mark Brown <broonie@kernel.org>