Commit Graph

24 Commits

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
1fb1e93a1d
ASoC: Intel: bytcht_es8316: fix compilation warning
Remove warning below, align with other machine drivers.

bytcht_es8316.c:508:11: warning: cast from pointer to integer of
different size [-Wpointer-to-int-cast]

   quirk = (int)dmi_id->driver_data;
           ^
Fixes: a8d218f4fe ('ASoC: Intel: bytcht_es8316: Add quirk for the Teclast X98+ II')
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:03 +01:00
Paul Cercueil
a8d218f4fe
ASoC: Intel: bytcht_es8316: Add quirk for the Teclast X98+ II
The Teclast X98+ II is a Cherrytrail tablet, which require two quirks:
- it has stereo speakers,
- its jack detection mechanism is inverted.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-04-08 13:59:14 +07:00
Paul Cercueil
ba49cf6f8e
ASoC: Intel: bytcht_es8316: Add quirk for inverted jack detect
Add a quirk to support boards whose jack detection mechanism is
inverted.

It will set the 'everest,jack-detect-inverted' boolean device property
for the es8316 codec driver.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-04-08 13:58:39 +07:00
Andy Shevchenko
645056da67 ASoC: Intel: bytcht_es8316: 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
Pierre-Louis Bossart
e4bc6b1195
ASoC: Intel: bytcht_es8316: 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:32 +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
Wei Yongjun
f833fe2056
ASoC: Intel: bytcht_es8316: use correct drvdata in snd_byt_cht_es8316_mc_remove()
The snd_byt_cht_es8316_mc_remove() use the platform drvdata as a type
of 'struct byt_cht_es8316_private', but snd_byt_cht_es8316_mc_probe()
set it to 'struct snd_soc_card', as suggested by Dan Carpenter, fix
the usage in snd_byt_cht_es8316_mc_remove().

Fixes: 0d3e91da07 ("ASoC: Intel: bytcht_es8316: Add external speaker mux support")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Acked-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-01-10 10:53:35 +00:00
Hans de Goede
249d2fc9e5
ASoC: Intel: bytcht_es8316: Set card long_name based on quirks
Depending on the input-map and on if 1 or 2 speakers are connected,
userspace needs to use a different UCM profile.

Since we already deal with quirks in the kernel driver and set the
input-map from the kernel, add a quirk for devices with a single / mono
speaker and set the card's long_name based on the input and speaker
quirks, so that userspace can use the long_name to pick the right UCM
profile.

This change, including how the long_name is build-up mirrors how we do
this in the bytcr_rt5640 and bytcr_rt5651 machine drivers.

Note since all devices I have access to use a mono speaker setup I've
chosen to default the speaker setting to mono.

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>
2019-01-04 15:15:43 +00:00
Hans de Goede
730501a91d
ASoC: Intel: bytcht_es8316: Add input-map support
After adding jack-detect support we have 3 microphone input switches:
"Microphone 1", "Microphone 2" and "Headset Mic". But the ES8316 has only
2 microphone inputs.

In the app-note explaining how to use the codec and on the 3 boards I
have one input is used for an internal microphone and one for the headset
microphone. On the 2 CHT boards I have the internal mic is on on MIC1 and
the headset mic is on MIC2, on the BYTCR board I have it is the other way
around.

This commit replaces the 2 "Microphone 1" and "Microphone 2" input switches
with a single "Internal Mic" switch and adds support for selecting either
possible input mapping.

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>
2019-01-04 15:15:37 +00:00
Hans de Goede
0d3e91da07
ASoC: Intel: bytcht_es8316: Add external speaker mux support
The ES8316 only has a single (amplified) output. The ES8316 appnote showing
the intended usage uses a jack-receptacle which physically disconnects the
speakers from the output when a jack is plugged in.

But all 3 devices using the es8316 which I have (2 Cherry Trail devices and
one Bay Trail CR device), use an analog mux to disconnect the speakers,
driven by a GPIO.

This commit adds support for this, modelling this as a separate speaker
widget / dapm pin-switch which sets the mux to drive the speakers when
selected.

The intend is for userspace to use the recently added jack-detect support
and then automatically select either the Headphone or Speaker output based
on that.

Note this commit includes a workaround for an ACPI table bug which is
present on 2 of the 3 devices I have, see the added comment in the code.

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>
2019-01-04 15:15:32 +00:00
Hans de Goede
4bf538b429
ASoC: Intel: bytcht_es8316: Add jack-detect support
Hookup the jack-detect support added to the codec driver.

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>
2019-01-04 15:15:28 +00:00
Hans de Goede
349e13862c
ASoC: Intel: bytcht_es8316: Add support for SSP0 (BYTCR)
Add support for having the codec connected to SSP0 instead of SSP2. This
is controlled through a new quirk parameter, similar to how this is done
in the bytcr_rt5640 and bytcr_rt5651 machine drivers.

Bay Trail CR (cost reduced) SoCs do not have an SSP2, so we default to SSP0
there.

Note the SPP0 quirk gets BIT(16) because bits 0-15 are reserved for non
boolean quirks like the input-map added in a later commit in this series.

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>
2019-01-04 15:15:24 +00:00
Hans de Goede
86909c8f77
ASoC: Intel: bytcht_es8316: Minor refactoring
Some minor refactoring:
1) Group the code setting the card dev and prive pointers together with
   registering the card
2) Properly put the comment about registering the card at the place where
   we actually register the card and add a new comment for getting the clk
3) Add a struct device *dev helper variable (this will be used more in
   follow up commits)
4) Reword error message to have the same "foo failed: %d" wording as others

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>
2019-01-04 15:15:20 +00:00
Hans de Goede
6ca382c436
ASoC: Intel: bytcht_es8316: Sort includes alphabetically
For lack of a better (non-random) way of sorting includes more and more
files in the kernel are moving over to sorting the includes alphabetically.

Move the bytcht_es8316 driver over to this sorting before we add a
bunch of more includes.

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>
2019-01-04 15:15:12 +00:00
Vinod Koul
d441b8588c
ASoC: Intel: bytcht_es8316: Replace GFP_ATOMIC with GFP_KERNEL
In snd_byt_cht_es8316_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:00 +01:00
Andy Shevchenko
3a1479599a
ASoC: Intel - Convert to use acpi_dev_get_first_match_name()
Instead of home grown snd_soc_acpi_find_name_from_hid() use
acpi_dev_get_first_match_name().

Tested-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-01-12 21:20:29 +00:00
Pierre-Louis Bossart
2be2d57986
ASoC: acpi: remove hard-coded i2c-device name length
Remove hard-codec [16] array size, replace with clearer description and
dependency on ACPI_ID_LEN
No functionality change

Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-By: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-01-12 21:05:41 +00:00
Pierre-Louis Bossart
3c22a73fb8
ASoC: Intel: bytcht_es8316: fix HID handling
Same problem as with previous machine drivers, the codec dai
uses a hard-coded name of "i2c-ESSX8316:00" but ACPI provides
"i2c-ESSX8316:01" in some systems.

Fix by overriding the hard-coded value with the codec name derived
from the HID information

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=189261
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-By: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-01-12 21:05:17 +00:00
Pierre-Louis Bossart
7feb2f786a ASoC: move ACPI common code out of Intel/sst tree
ACPI support is not specific to the Intel/SST driver. Move the enumeration
and matching code which is not hardware-dependent to sound/soc and rename
relevant sst_acpi_ structures and functions with snd_soc_acpi_ prefix

soc-acpi.h is protected by a #ifndef __LINUX_SND_SOC_ACPI_H for
consistency with all other SoC .h files:

grep -L __LINUX include/sound/soc* | wc -l
0
grep __LINUX include/sound/soc* | wc -l
14

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-10-21 11:21:09 +01:00
Pierre-Louis Bossart
2193eb9631 ASoC: Intel: boards: remove hard-coded compressed dailinks
The hard-coded compressed dailinks are not supported using
publicly-available firmwares, which creates unnecessary user
confusion [1]. Even if the firmware was available, the mainline
code does not have the required .dynamic=1 and .dpcm_playback=1
fields so probably never worked as is, and last and they conflict
with topology-defined streams.

Remove them and move on. This can be re-enabled with SOF later
in a more flexible manner.

[1] http://mailman.alsa-project.org/pipermail/alsa-devel/2017-August/124868.html

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-10-18 12:30:29 +01:00
Pierre-Louis Bossart
149f775759 ASoC: Intel: boards: fix off-by-one dailink id
For some reason the Atom/HiFi2 machine drivers use an id=1 instead
of zero as done on all other platforms. This gets in the way of
topology-based matching, realign for consistency. This should
not have any functional impact on existing solutions with don't rely
on topology.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-10-18 12:30:25 +01:00
Pierre-Louis Bossart
8a2eca50c6 ASoC: Intel: bytcht_es8316: remove useless code
get_codec_dai() is not used, remove it

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-10-18 12:30:18 +01:00
Daniel Drake
a03bdaa565 ASoC: Intel: add machine driver for BYT/CHT + ES8316
Add new machine driver, tested with Weibu F3C MiniPC.

Based heavily on code provided by David Yang @ Everest, and other
machine drivers in the same directory.

Signed-off-by: David Yang <yangxiaohua@everest-semi.com>
[drake@endlessm.com: cleanups and modernization]
Signed-off-by: Daniel Drake <drake@endlessm.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-06-13 19:31:19 +01:00