1
0
Fork 0
Commit Graph

80 Commits (8e8e69d67e5fad1a1edf97acebd649a6c8f1febd)

Author SHA1 Message Date
Thomas Gleixner 8e8e69d67e treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 285
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-06-05 17:36:37 +02:00
Pierre-Louis Bossart fb45befa7e
ASoC: Intel: bytcr_rt5651: align quirk override handling
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-25 20:23:21 +01:00
Mark Brown 6d5e2bf9d2
Merge branch 'acpi-utils' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm into asoc-5.2 2019-04-02 16:20:47 +07:00
Andy Shevchenko 7075e9babb ASoC: Intel: bytcr_rt5651: Convert to use acpi_dev_get_first_match_dev()
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-04-01 11:00:16 +02:00
Hans de Goede a0cb2d4357
ASoC: Intel: bytcr_rt5651: Add BYT_RT5651_JD_NOT_INV quirk
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-03-18 12:08:16 +00:00
Andy Shevchenko 4d1f7a6eab
gpiolib: acpi: Introduce ACPI_GPIO_QUIRK_ONLY_GPIOIO
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-02-08 17:29:51 +00:00
Pierre-Louis Bossart 0b2c2093fc
ASoC: Intel: bytcr_rt5651: platform name fixup support
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-28 18:08:14 +00:00
Colin Ian King 4ffdca62e2
ASoC: Intel: make const arrays static, reduces object code size
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-24 19:27:30 +00:00
Hans de Goede fee3e1cbd6
ASoC: Intel: bytcr_rt5651: Add quirk for PoV TAB-P1006W-232 (v1.0) tablet
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-07 19:24:19 +00:00
Hans de Goede 90768eaf06
ASoC: Intel: bytcr_rt5651: Add support for jack-detect using an external GPIO
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-07 19:24:10 +00:00
Hans de Goede 7eb187313e
ASoC: Intel: bytcr_rt5651: Add quirks module parameter
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-07 19:24:01 +00:00
Hans de Goede aee48a9ffa
ASoC: Intel: bytcr_rt5651: Revert "Fix DMIC map headsetmic mapping"
Commit 37c7401e8c ("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: 37c7401e8c ("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>
2019-01-07 19:23:52 +00:00
Pierre-Louis Bossart 3ee1cd4f81
ASoC: Intel: use standard interface for Atom machine drivers
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-11-06 17:24:05 +00:00
Linus Torvalds 3acbd2de6b sound updates for 4.20
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
 -----BEGIN PGP SIGNATURE-----
 
 iQJCBAABCAAsFiEEIXTw5fNLNI7mMiVaLtJE4w1nLE8FAlvRbLkOHHRpd2FpQHN1
 c2UuZGUACgkQLtJE4w1nLE9FMg//eGuq13WyoNn4OrgncGdxP4U+Dd3qXj7h6wmo
 af8ZebRSZht5jswJz5TEmYM5zR8jfKfDCN6bDKIV99Ondp9bN1vEqxBa2mUx9T/C
 mhY17dPJX0Fwdk951TkAANfOvIqECjqWj9qMI4QdigfVqVXaIxdPSnA4tKDtq6++
 Ocr4+GtC01Nmd/jWzpC4fDh9k+mwTAG0VZjeLFCjsv61U9DKbic+UcRni7YTvRGg
 pUXWNNUxIa6FMYEpsHClBJkCCUi4+ZT9nQe7Dy/W4lMq0uVBrPBqDYQJKDdjwf4p
 VEptmlhEpMcY/bG1yW7l5YOHgYs8Cx5YYygBag+3YCE6a6KItuxNp9UbgxGqZ7GD
 Svh4vPn8n4+UZfMbS04IlYvJP8bTiIfHRLkUBSHgC2egco0TjDEZiH71ucxFOq9q
 3cVKlSfLvcSMCAnUiDP18EfBq6ayGJmzJsFzU1RZLW/r+RcuMzPuwAbCuC83mlI4
 bobNLXCyEArJlvQyrAAIXrX/j4GhFzheL26hXQ96tQ9Y/nNX9tE/cL8bWtm45i4s
 +EuPnWosfZbo5JtPASosEQhilVrrOK/VmqAA6xHURKxspdqwIVyOvAa6kPLRJx8T
 LvczeX9pK3PwvZhDU+eg+HpcPNSWH8BtPvShutsNd0lp9UGBFeBUB5gc4s0iYqLq
 rMnbzwg=
 =3LrT
 -----END PGP SIGNATURE-----

Merge tag 'sound-4.20-rc1' of 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-25 09:00:15 -07:00
Peter Zijlstra f2c4db1bd8 x86/cpu: Sanitize FAM6_ATOM naming
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-10-02 10:14:32 +02:00
Kuninori Morimoto f70f18f7d4
ASoC: add for_each_card_components() macro
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-09-20 10:22:58 -07:00
Hans de Goede 06aa6e5127
ASoC: Intel: bytcr_rt5651: Add quirk table entries for various devices
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-19 16:04:41 +01:00
Hans de Goede a0d1d867c2
ASoC: Intel: bytcr_rt5651: Add mono speaker quirk
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-19 16:04:35 +01:00
Hans de Goede ac275ee5aa
ASoC: Intel: bytcr_rt5651: Add IN2 input mapping
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-19 16:04:32 +01:00
Hans de Goede 8627fb257e
ASoC: Intel: bytcr_rt5651: Set OVCD limit for VIOS LTH17 to 2000uA
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-19 16:04:28 +01:00
Hans de Goede 0a3badd141
ASoC: Intel: bytcr_rt5651: Fix using the wrong GPIO for the ext-amp on some 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-19 16:04:13 +01:00
Hans de Goede caed9d636e
ASoC: Intel: bytcr_rt5651: Reporting button presses
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-10 18:49:28 +01:00
Hans de Goede b91f432cbc
ASoC: Intel: bytcr_rt5651: Disable jack-detect over suspend/resume
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-10 18:49:27 +01:00
Hans de Goede 5f6fb23d2e
ASoC: Intel: bytcr_rt5651: Add support for externar amplifier enable GPIO
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-10 18:49:23 +01:00
Hans de Goede 2c375204bf
ASoC: Intel: bytcr_rt5651: Move getting of codec_dev into probe()
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-10 18:49:17 +01:00
Hans de Goede fbea16dbc0
ASoC: Intel: bytcr_rt5651: Remove is_valleyview helper
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-07-10 18:49:13 +01:00
Hans de Goede 55d69c0309
ASoC: Intel: bytcr_rt5651: Sort DMI table entries alphabetically
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-27 12:11:34 +01:00
Hans de Goede 8f250e7009
ASoC: Intel: bytcr_rt5651: Add BYT_RT5651_HP_LR_SWAPPED quirk
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-27 12:11:29 +01:00
Hans de Goede 8e69cd6400
ASoC: Intel: bytcr_rt5651: Simplify card long-name
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-27 12:11:25 +01:00
Hans de Goede 37c7401e8c
ASoC: Intel: bytcr_rt5651: Fix DMIC map headsetmic mapping
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-27 12:11:21 +01:00
Hans de Goede de23147983
ASoC: Intel: bytcr_rt5651: Fix IN1 map headsetmic mapping
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-27 12:11:15 +01:00
Hans de Goede fcdf1391ca
ASoC: Intel: bytcr_rt5651: Remove IN2 input mappings
BYT_RT5651_IN2_MAP was introduced in commit 39712db878 ("SoC: intel: byt:
Introduce new custom IN2 map"), uses in commit 2fe30129b0 ("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 ea261bd02a ("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 f026e06317 ("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-27 12:11:08 +01:00
Hans de Goede 366780df3e
ASoC: Intel: bytcr_rt5651: Fix IN1_IN2_MAP quirk not being logged
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-27 12:11:03 +01:00
Hans de Goede 10876d24eb
ASoC: Intel: bytcr_rt5651: Change default input map from in2 to in1
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-27 12:10:58 +01:00
Hans de Goede fc7c460fbb
ASoC: Intel: bytcr_rt5651: Add BYT_RT5651_DEFAULT_QUIRKS define
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-27 12:10:53 +01:00
Mark Brown aac521e880
Merge branch 'asoc-4.17' into asoc-4.18 merge window 2018-06-05 15:25:41 +01:00
Hans de Goede 64484ccee7
ASoC: Intel: bytcr_rt5651: Set card long_name based on quirks
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-31 11:28:57 +01:00
Colin Ian King de5afce2a2
ASoC: Intel: bytcr_rt565: fix missing assignment to ret_val
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: 02c0a3b304 ("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-05-03 10:23:54 +09:00
Vinod Koul aa5398e1e9
ASoC: Intel: bytcr_rt5651: Replace GFP_ATOMIC with GFP_KERNEL
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-04-20 17:29:08 +01:00
Kuninori Morimoto 2759ba9bf8
ASoC: Intel: bytcr_rt5651: don't use codec anymore
commit aeec6cc082 ("ASoC: Intel: bytcr_rt5651: Configure PLL1 before
using it") is using codec->dev, but codec is replaced to component.
Let's use component

Fixes: aeec6cc082 ("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-28 10:10:49 +08:00
Hans de Goede c22969d70f
ASoC: Intel: bytcr_rt5651: Select RCCLK on init()
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-07 14:19:51 +00:00
Hans de Goede b4b6377e07
ASoC: Intel: bytcr_rt5651: Change defaults to enable jack-detect, analog mics
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-07 14:19:47 +00:00
Hans de Goede f9877eb598
ASoC: Intel: bytcr_rt5651: Add quirk for the VIOS LTH17 laptop
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-07 14:19:40 +00:00
Hans de Goede 8a880a2014
ASoC: Intel: bytcr_rt5651: Add support for Bay Trail CR / SSP0 using boards
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-07 14:19:22 +00:00
Hans de Goede f026e06317
ASoC: Intel: bytcr_rt5651: Add new IN2_HS_IN3 input map and a quirk using it
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-07 14:19:00 +00:00
Hans de Goede 7f2e2299cf
ASoC: Intel: bytcr_rt5651: Rename IN3_MAP to IN1_HS_IN3_MAP
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-07 14:18:44 +00:00
Hans de Goede 3fdae070e6
ASoC: Intel: bytcr_rt5651: Drop snd_soc_dai_set_bclk_ratio() call
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-07 14:18:24 +00:00
Hans de Goede aeec6cc082
ASoC: Intel: bytcr_rt5651: Configure PLL1 before using it
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-07 14:18:18 +00:00
Hans de Goede 8ffaa6a136
ASoC: Intel: bytcr_rt5651: Add quirk micbias OVCD configuration
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-07 14:18:13 +00:00
Hans de Goede aed859a2c7
ASoC: Intel: bytcr_rt5651: Only create jack if we have a jack-detect source
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>
2018-03-07 14:18:09 +00:00