History log of /linux-master/sound/soc/intel/boards/cht_bsw_rt5645.c
Revision Date Author Comments
# 930375d3 10-Feb-2024 Hans de Goede <hdegoede@redhat.com>

ASoC: Intel: cht_bsw_rt5645: Cleanup codec_name handling

4 fixes / cleanups to the rt5645 mc driver's codec_name handling:

1. In the for loop looking for the dai_index for the codec, replace
card->dai_link[i] with cht_dailink[i]. The for loop already uses
ARRAY_SIZE(cht_dailink) as bound and card->dai_link is just a pointer to
cht_dailink using card->dai_link only obfuscates that cht_dailink is being
modified directly rather then say a copy of cht_dailink. Using
cht_dailink[i] also makes the code consistent with other machine drivers.

2. Don't set cht_dailink[dai_index].codecs->name in the for loop,
this immediately gets overridden using acpi_dev_name(adev) directly
below the loop.

3. Add a missing break to the loop.

4. Remove the now no longer used (only set, never read) codec_name field
from struct cht_mc_private.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20240210134400.24913-3-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 7d99a70b 10-Feb-2024 Hans de Goede <hdegoede@redhat.com>

ASoC: Intel: Boards: Fix NULL pointer deref in BYT/CHT boards

Since commit 13f58267cda3 ("ASoC: soc.h: don't create dummy Component
via COMP_DUMMY()") dummy snd_soc_dai_link.codecs entries no longer
have a name set.

This means that when looking for the codec dai_link the machine
driver can no longer unconditionally run strcmp() on
snd_soc_dai_link.codecs[0].name since this may now be NULL.

Add a check for snd_soc_dai_link.codecs[0].name being NULL to all
BYT/CHT machine drivers to avoid NULL pointer dereferences in
their probe() methods.

Fixes: 13f58267cda3 ("ASoC: soc.h: don't create dummy Component via COMP_DUMMY()")
Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20240210134400.24913-2-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# f87b4402 26-Nov-2023 Hans de Goede <hdegoede@redhat.com>

ASoC: Intel: cht_bsw_rt5645: Set card.components string

Set the card.components string using the new rt5645_components() helper
which returns a components string based on the DMI quirks inside the
rt5645 codec driver.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://msgid.link/r/20231126214024.300505-8-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# a2c1125e 26-Sep-2023 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: intel: convert not to use asoc_xxx()

ASoC is now unified asoc_xxx() into snd_soc_xxx().
This patch convert asoc_xxx() to snd_soc_xxx().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87zg19fo4o.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 5360a1c0 02-Jan-2023 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

ASoC: Intel: cht_bsw_rt5645: Replace open coded acpi_dev_put()

Instead of calling put_device(&adev->dev) where adev is a pointer
to an ACPI device, use specific call, i.e. acpi_dev_put().

Also move it out of the conditional to make it more visible in case
some other code will be added which may use that pointer. We need
to keep a reference as long as we use the pointer.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230102203037.16120-3-andriy.shevchenko@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 4088355a 24-Oct-2022 Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>

ASoC: Intel: boards: Fix typo in comments

It keeps propagating through machine boards, fix it once and for all.

Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20221024190841.31572-2-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 9972773c 20-May-2022 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: Intel: boards: reset acpi_chan_package

cppcheck complains about possible tests of uninitialized 'aif_value'
members. This isn't really possible but static analysis cannot know
what ACPICA does, so make sure the acpi_chan_package structure is
reset prior to use to make the warning go away.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20220520211719.607543-10-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# add9ee8c 19-May-2022 Charles Keepax <ckeepax@opensource.cirrus.com>

ASoC: Intel: Update to use set_fmt_new callback

As part of updating the core to directly tell drivers if they are clock
provider or consumer update these CPU side drivers to use the new direct
callback.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220519154318.2153729-12-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 19aed2d6 07-Apr-2022 Akihiko Odaki <akihiko.odaki@gmail.com>

ASoC: soc-card: Create jack kcontrol without pins

snd_soc_card_jack_new() allowed to create jack kcontrol without pins,
but did not create kcontrols. The jack would not have kcontrols if pins
were not going to be added.

This renames the old snd_soc_card_jack_new() to
snd_soc_card_jack_new_pins() for use when pins are provided or will be
added later. The new snd_soc_card_jack_new() appropriately creates a
jack for use without pins and adds a kcontrol.

Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com>
Link: https://lore.kernel.org/r/20220408041114.6024-1-akihiko.odaki@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# f1eebb3b 01-Mar-2022 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: Intel: boards: fix spelling in comments

copy/paste spelling issues with platforms and buttons.

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: FRED OH <fred.oh@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220301194903.60859-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 5374b921 20-Sep-2021 Peter Ujfalusi <peter.ujfalusi@linux.intel.com>

ASoC: Intel: boards: Update to modern clocking terminology

As part of the effort to remove our old APIs based on outdated terminology
update the Intel board drivers to use modern terminology.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com
Link: https://lore.kernel.org/r/20210920065508.7854-1-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 3b316e22 05-May-2021 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: Intel: boards: remove .nonatomic for BE dailinks

Somehow with copy/paste and inertia we keep re-adding this field for
BE dailinks, when it's only required for hard-coded FE links.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20210505163705.305616-9-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 05ff312b 12-Nov-2020 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: Intel: byt/cht: set pm ops dynamically

The Atom/SST driver does not rely on ASoC power management, but the
SOF driver does. Rather than using a hard-coded build-time assignment,
we can set this pm_ops dynamically depending on what the parent
is. That will remove the last build-time dependency and allow for
coexistence of both SST and SOF drivers for Baytrail/Cherrytrail.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Link: https://lore.kernel.org/r/20201112223825.39765-7-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 41656c3d 12-Nov-2020 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: Intel: boards: byt/cht: set card and driver name at run time

To avoid hard-coded variations between SOF and SST drivers, set the
card name and driver dynamically depending on the parent type. This is
the first pass required to let distributions select which drivers to
use with kernel parameters instead of build-time selection.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Link: https://lore.kernel.org/r/20201112223825.39765-6-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 2207b93b 26-Jul-2020 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: intel/boards: use asoc_substream_to_rtd()

Now we can use asoc_substream_to_rtd() macro,
let's use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/87v9i9yddc.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 7bfbddfc 17-Jun-2020 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: Intel: cht*: simplify card names for SOF uses

Blindly adding an sof- prefix to the card name is not user friendly
and causes UCM issues with a driver name truncated to 16 characters.

Simplify to use "sof-bytcht <codec_name>" pattern for all cht* machine
drivers. The sof- prefix is added by the core. A generic "SOF" driver
name is used, and UCMv2 will detect the configuration for this driver
by testing the card name.

Legacy uses are unmodified.

Suggested-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20200617165616.18511-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 68224376 26-May-2020 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: Intel: byt/cht: add .pm_ops

Add required .pm_ops to support suspend/resume on baytrail/cherrytrail
machines.

This .pm_ops is conditionally-added to avoid impacting the legacy
driver where power management is handled differently.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Tested-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20200526203640.25980-5-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 0d1571c1 22-Mar-2020 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: intel: use asoc_rtd_to_cpu() / asoc_rtd_to_codec() macro for DAI pointer

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/87r1xjir7a.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 42432196 12-Mar-2020 Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>

ASoC: Intel: (cosmetic) simplify structure member access

Fix a clumsy structure member dereference in all machine drivers.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200312194859.4051-8-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 791a0059 15-Jan-2020 Damian van Soelen <dj.vsoelen@gmail.com>

ASoC: Intel: cht_bsw_rt5645: Remove unnecessary string buffers and snprintf calls

The snprintf calls filling cht_rt5645_cpu_dai_name /
cht_rt5645_codec_aif_name always fill them with the same string
("ssp0-port" resp "rt5645-aif2") so instead of keeping these buffers
around and making cpus->dai_name / codecs->dai_name point to this,
simply update the *->dai_name pointers to directly point to a string
constant containing the desired string.

Signed-off-by: Damian van Soelen <dj.vsoelen@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20200115164619.101705-5-hdegoede@redhat.com
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# adebb111 16-Sep-2019 Sam McNally <sammc@chromium.org>

ASoC: Intel: cht_bsw_rt5645: Add quirk for boards using pmc_plt_clk_0

As of commit 648e921888ad ("clk: x86: Stop marking clocks as
CLK_IS_CRITICAL"), the cht_bsw_rt5645 driver needs to enable the clock
it's using for the codec's mclk. It does this from commit 7735bce05a9c
("ASoC: Intel: boards: use devm_clk_get() unconditionally"), enabling
pmc_plt_clk_3. However, Strago family Chromebooks use pmc_plt_clk_0 for
the codec mclk, resulting in white noise with some digital microphones.
Add a DMI-based quirk for Strago family Chromebooks to use pmc_plt_clk_0
instead - mirroring the changes made to cht_bsw_max98090_ti in
commit a182ecd3809c ("ASoC: intel: cht_bsw_max98090_ti: Add quirk for
boards using pmc_plt_clk_0") and making use of the existing
dmi_check_system() call and related infrastructure added in
commit 22af29114eb4 ("ASoC: Intel: cht-bsw-rt5645: add quirks for
SSP0/AIF1/AIF2 routing").

Signed-off-by: Sam McNally <sammc@chromium.org>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20190917054933.209335-1-sammc@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>


# 75909d7e 05-Jun-2019 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: Intel: cht_bsw_rt5645: use modern dai_link style

ASoC is now supporting modern style dai_link
(= snd_soc_dai_link_component) for CPU/Codec/Platform.
This patch switches to use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 8e8e69d6 29-May-2019 Thomas Gleixner <tglx@linutronix.de>

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>


# 536cfd2f 30-May-2019 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: Intel: use common helpers to detect CPUs

We have duplicated code in multiple locations (atom, machine drivers,
SOF) to detect Baytrail, Cherrytrail and other SOCs. This is not very
elegant, and introduces dependencies on CONFIG_X86 that prevent
COMPILE_TEST from working.

Add common helpers to provide same functionality in a cleaner
way. This will also help support the DMI-based quirks being introduced
to handle SOF/SST autodetection.

Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# fe4c283a 28-Mar-2019 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

ASoC: Intel: cht_bsw_rt5645: 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>


# 3a934e7c 25-Jan-2019 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: Intel: cht_bsw_rt5645: 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>


# 3ee1cd4f 01-Nov-2018 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

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>


# f3cc330a 09-Apr-2018 Jia-Ju Bai <baijiaju1990@gmail.com>

ASoC: intel: cht_bsw_rt5645: Replace GFP_ATOMIC with GFP_KERNEL in snd_cht_mc_probe

snd_cht_mc_probe() is never called in atomic context.
This function is only set as ".probe" in "struct platform_driver".

Despite never getting called from atomic context,
snd_cht_mc_probe() calls devm_kzalloc() with GFP_ATOMIC,
which waits busily for allocation.
GFP_ATOMIC is not necessary and can be replaced with GFP_KERNEL,
to avoid busy waiting and improve the possibility of sucessful allocation.

This is found by a static analysis tool named DCNS written by myself.

Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 79223bf1 28-Jan-2018 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rt5645/rt5677: replace codec to component

Now we can replace Codec to Component. Let's do it.

Because Intel/Mediatek platforms are using rt5645/rt5677,
we need to update these all related drivers in same time.
Otherwise compile error/warning happen

rt5645:
xxx_codec_xxx() -> xxx_component_xxx()
.idle_bias_off = 1 -> .idle_bias_on = 0
.ignore_pmdown_time = 0 -> .use_pmdown_time = 1
- -> .endianness = 1
- -> .non_legacy_dai_naming = 1

rt5677:
xxx_codec_xxx() -> xxx_component_xxx()
.idle_bias_off = 1 -> .idle_bias_on = 0
.ignore_pmdown_time = 0 -> .use_pmdown_time = 1
- -> .endianness = 1
- -> .non_legacy_dai_naming = 1

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 3a147959 12-Jan-2018 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

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>


# 2be2d579 11-Jan-2018 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

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>


# b70b3099 02-Jan-2018 Hans de Goede <hdegoede@redhat.com>

ASoC: Intel: cht_bsw_rt5645: Analog Mic support

Various Cherry Trail boards with a rt5645 codec have an analog mic
connected to IN2P + IN2N. The mic on this boards also needs micbias to
be enabled, on some boards micbias1 is used and on others micbias2, so
we enable both.

This commit adds a new "Int Analog Mic" DAPM widget for this, so that we
do not end up enabling micbias on boards with a digital mic which uses
the already present "Int Mic" widget. Some existing UCM files already
refer to "Int Mic" for their "Internal Analog Microphones" SectionDevice,
but these don't work anyways since they enable the RECMIX BST1 Switch
instead of the BST2 switch.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 7feb2f78 12-Oct-2017 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

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>


# 2193eb96 12-Oct-2017 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

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>


# 149f7757 12-Oct-2017 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

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>


# dfb6ec7a 12-Oct-2017 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: Intel: boards: use helper to get codec_dai

Remove duplicate code with a common helper in all Intel machine drivers.

Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Suggested-by: Takashi Iwai <tiwai@suse.de>
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>


# 6cdf01a5 12-Oct-2017 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: Intel: cht_bsw_rt5645: cosmetic fixes

Reorder variable names, change MCLK test, change quirks
No functional change

Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
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>


# 7735bce0 07-Sep-2017 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: Intel: boards: use devm_clk_get() unconditionally

The clock framework was only used in Baytrail, on Cherrytrail
the firmware takes care of the MCLK/plt_clk_3.

With the fix in 'commit d31fd43c0f9a
("clk: x86: Do not gate clocks enabled by the firmware")'

the firmware-managed clocks are not impacted by enable/disable
requests make at the driver level, and the rates are identical.

Remove all checks for Baytrail and use devm_clk_get()
unconditionally. Tested on Asus T100HA (CHT) and Asus T100TAF (BYT)

Note that the RT5640 and RT5645 machine drivers need to keep some
checks for Valleyview to check for Baytrail-CR.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Acked-By: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 77e546b7 31-Jan-2017 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: cht-bsw-rt5645: fix unused variable compiler warning

Missed unused variable in previous changes, oops.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 7bde09df 26-Jan-2017 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: Intel: cht-bsw-rt5645: fix DAI formats

Remove default and set I2S mode correctly both on codec and
cpu sides

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# bf92c6ef 26-Jan-2017 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: Intel: add support for ALC3270 codec

Use ACPI ID 10EC3270 to load machine driver for cht-bsw-rt5645
and add reference to 3270 to use the rt5645 mode

Tested on Asus T100HA

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# d74390b5 26-Jan-2017 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: Intel: cht-bsw-rt5645: select ASRC source based on routing quirk

Some platforms use AIF2, use routing information to set ASRC as needed

Suggested-by: Bard Liao <bardliao@realtek.com>
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=95681
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 22af2911 26-Jan-2017 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: Intel: cht-bsw-rt5645: add quirks for SSP0/AIF1/AIF2 routing

This driver may be used on Baytrail CR platforms where SSP2 is
not available.

Add quirks and routing detection based on work done for RT5640.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 42648c22 26-Jan-2017 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: Intel: cht_bsw_rt5645: harden ACPI device detection

Fix classic issue of having multiple codecs listed in DSDT
but a single one actually enabled. The previous code did
not handle such errors and could also lead to uninitalized
configurations

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 11ad8089 26-Jan-2017 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: rt5645: add support for RT5648

add ACPI ID 10EC5648 found e.g on Asus X205TA and use
rt5645 driver

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# a50477e5 26-Jan-2017 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: Intel: cht_bsw_rt5645: add Baytrail MCLK support

The existing code assumes a 19.2 MHz MCLK as the default
hardware configuration. This is valid for CherryTrail but
not for Baytrail.

Add explicit MCLK configuration to set the 19.2 clock on/off
depending on DAPM events.

This is a prerequisite step to enable devices with Baytrail
and RT5645 such as Asus X205TA

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# a823a179 22-Nov-2016 Takashi Iwai <tiwai@suse.de>

ASoC: cht_bsw_rt5645: Fix leftover kmalloc

cht_bsw_rt5645 driver allocates the own codec_id string but doesn't
release it. For simplicity, put the string in cht_mc_private; then
the string is allocated in a shot and released altogether.

Fixes: c8560b7c917f ("ASoC: cht_bsw_rt5645: Fix writing to string literal")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 9b6fdef6 15-Oct-2016 Julia Lawall <Julia.Lawall@lip6.fr>

ASoC: constify snd_soc_ops structures

Check for snd_soc_ops structures that are only stored in the ops field of a
snd_soc_dai_link structure. This field is declared const, so snd_soc_ops
structures that have this property can be declared as const also.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@r disable optional_qualifier@
identifier i;
position p;
@@
static struct snd_soc_ops i@p = { ... };

@ok1@
identifier r.i;
struct snd_soc_dai_link e;
position p;
@@
e.ops = &i@p;

@ok2@
identifier r.i, e;
position p;
@@
struct snd_soc_dai_link e[] = { ..., { .ops = &i@p, }, ..., };

@bad@
position p != {r.p,ok1.p,ok2.p};
identifier r.i;
struct snd_soc_ops e;
@@
e@i@p

@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
struct snd_soc_ops i = { ... };
// </smpl>

The effect on the layout of the .o files is shown by the following output
of the size command, first before then after the transformation:

text data bss dec hex filename
4500 696 0 5196 144c sound/soc/generic/simple-card.o
4564 632 0 5196 144c sound/soc/generic/simple-card.o

text data bss dec hex filename
3018 608 0 3626 e2a sound/soc/generic/simple-scu-card.o
3074 544 0 3618 e22 sound/soc/generic/simple-scu-card.o

text data bss dec hex filename
4148 2448 768 7364 1cc4 sound/soc/intel/boards/bdw-rt5677.o
4212 2384 768 7364 1cc4 sound/soc/intel/boards/bdw-rt5677.o

text data bss dec hex filename
5403 4628 384 10415 28af sound/soc/intel/boards/bxt_da7219_max98357a.o
5531 4516 384 10431 28bf sound/soc/intel/boards/bxt_da7219_max98357a.o

text data bss dec hex filename
5275 4496 384 10155 27ab sound/soc/intel/boards/bxt_rt298.o
5403 4368 384 10155 27ab sound/soc/intel/boards/bxt_rt298.o

text data bss dec hex filename
10017 2344 48 12409 3079 sound/soc/intel/boards/bytcr_rt5640.o
10145 2232 48 12425 3089 sound/soc/intel/boards/bytcr_rt5640.o

text data bss dec hex filename
3719 2356 0 6075 17bb sound/soc/intel/boards/bytcr_rt5651.o
3847 2244 0 6091 17cb sound/soc/intel/boards/bytcr_rt5651.o

text data bss dec hex filename
3598 2392 0 5990 1766 sound/soc/intel/boards/cht_bsw_max98090_ti.o
3726 2280 0 6006 1776 sound/soc/intel/boards/cht_bsw_max98090_ti.o

text data bss dec hex filename
5343 3624 16 8983 2317 sound/soc/intel/boards/cht_bsw_rt5645.o
5471 3496 16 8983 2317 sound/soc/intel/boards/cht_bsw_rt5645.o

text data bss dec hex filename
4662 2592 384 7638 1dd6 sound/soc/intel/boards/cht_bsw_rt5672.o
4790 2464 384 7638 1dd6 sound/soc/intel/boards/cht_bsw_rt5672.o

text data bss dec hex filename
1595 2528 0 4123 101b sound/soc/intel/boards/haswell.o
1659 2472 0 4131 1023 sound/soc/intel/boards/haswell.o

text data bss dec hex filename
6272 4760 416 11448 2cb8 sound/soc/intel/boards/skl_nau88l25_max98357a.o
6464 4568 416 11448 2cb8 sound/soc/intel/boards/skl_nau88l25_max98357a.o

text data bss dec hex filename
7075 4888 416 12379 305b sound/soc/intel/boards/skl_nau88l25_ssm4567.o
7267 4696 416 12379 305b sound/soc/intel/boards/skl_nau88l25_ssm4567.o

text data bss dec hex filename
5659 4496 384 10539 292b sound/soc/intel/boards/skl_rt286.o
5787 4368 384 10539 292b sound/soc/intel/boards/skl_rt286.o

text data bss dec hex filename
1721 2048 0 3769 eb9 sound/soc/kirkwood/armada-370-db.o
1769 1976 0 3745 ea1 sound/soc/kirkwood/armada-370-db.o

text data bss dec hex filename
1363 1792 0 3155 c53 sound/soc/mxs/mxs-sgtl5000.o
1427 1728 0 3155 c53 sound/soc/mxs/mxs-sgtl5000.o

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 5d554ea4 08-Jul-2016 Vinod Koul <vkoul@kernel.org>

ASoC: Intel: cht: fix uninit variable warning

Kbuild bot reports that we might use dai_index uninitialized.

sound/soc/intel/boards/cht_bsw_rt5645.c:391:37: warning: 'dai_index' may be used uninitialized in this function [-Wmaybe-uninitialized]

Since it is theoretically possible, set it while initializing.

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 07d5c17b 08-Jul-2016 Vinod Koul <vkoul@kernel.org>

ASoC: Intel: Add surface3 entry in CHT-RT5645 machine

Surface3 device is a CHT machine, so add entry for it.
Also update the HID from BIOS.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=98001
Signed-off-by: Sachin Mokashi <sachinx.mokashi@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 2f0ad491 18-Apr-2016 Mengdong Lin <mengdong.lin@linux.intel.com>

ASoC: Change DAI link's be_id to a generic id

The generic ID can be used by topology:
- Toplogy can create FE links and set their ID, machine drivers will
be notified and check this ID for machine-specific init.
- Toplogy can use the ID to find existing BE & CC links and further
configure them.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# c68ae33e 24-Mar-2016 Lukas Wunner <lukas@wunner.de>

ACPI / utils: Rename acpi_dev_present()

acpi_dev_present() was originally named after pci_dev_present()
to signify the similarity of the two functions.

However Rafael J. Wysocki pointed out that the exported function
acpi_dev_present() is easily confused with the non-exported
acpi_device_is_present(). Additionally in ACPI parlance the term
"present" usually refers to the "device is present" bit returned
by the _STA control method, yet acpi_dev_present() merely checks
presence in the namespace. It does not invoke _STA at all, let
alone check the "device is present" bit.

As suggested by Rafael, rename the function to acpi_dev_found()
and adjust all existing call sites.

Signed-off-by: Lukas Wunner <lukas@wunner.de>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>


# c8560b7c 23-Feb-2016 Carlo Caione <carlo@endlessm.com>

ASoC: cht_bsw_rt5645: Fix writing to string literal

We cannot use strcpy() to write to a const char * location. This is
causing a 'BUG: unable to handle kernel paging request' error at boot
when using the cht-bsw-rt5645 driver.

With this patch we also fix a wrong indexing in the driver where the
codec_name of the wrong dai_link is being overwritten.

Signed-off-by: Carlo Caione <carlo@endlessm.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 2303b32f 16-Feb-2016 Carlo Caione <carlo@endlessm.com>

ASoC: cht_bsw_rt5645: Enable jack detection

Add missing DAPM pins and enable jack detection on those pins for
Cherrytrail and Braswell.

Signed-off-by: Carlo Caione <carlo@endlessm.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 6f08cbda 14-Jan-2016 Lukas Wunner <lukas@wunner.de>

ASoC: Intel: Use acpi_dev_present()

Use shiny new acpi_dev_present() and remove all the boilerplate
to search for a particular ACPI device. No functional change.
Cf. 2d12b6b381ba ("ACPI / utils: Add acpi_dev_present()").

Signed-off-by: Lukas Wunner <lukas@wunner.de>
Signed-off-by: Mark Brown <broonie@kernel.org>


# d35eb96a 17-Dec-2015 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: Intel: boards: add DEEP_BUFFER support for BYT/CHT/BSW

Add dai links to enable additional playback stream with deeper
buffer for lower power consumption.
The normal and DEEP_buffer streams are not mutually exclusive,
content will be mixed by the DSP.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 1a497983 18-Nov-2015 Mengdong Lin <mengdong.lin@linux.intel.com>

ASoC: Change the PCM runtime array to a list

Currently the number of DAI links is statically defined by the machine
driver at build time using an array. This makes it difficult to shrink/
grow the number of DAI links at runtime in order to reflect any changes
in topology.

We can change the DAI link array in the core to a list so that PCMs and
FE DAI links can be added and deleted at runtime to reflect changes in
use case and DSP topology. The machine driver can still register DAI links
as an array.

As the 1st step, this patch change the PCM runtime array to a list. A new
PCM runtime is added to the list when a DAI link is bound successfully.

Later patches will further implement the DAI link list.

More:
- define snd_soc_new/free_pcm_runtime() to create/free a runtime.
- define soc_add_pcm_runtime() to add a runtime to the rtd list.
- define soc_remove_pcm_runtimes() to clean up the runtime list.

- traverse the rtd list to probe the link components and dais.

- Add a field "num" to PCM runtime struct, used to specify the device
number when creating the pcm device, and for a soc card to access
its dai_props array.

- The following 3rd party machine/platform drivers iterate the rtd list
to check the runtimes:
sound/soc/intel/atom/sst-mfld-platform-pcm.c
sound/soc/intel/boards/cht_bsw_rt5645.c
sound/soc/intel/boards/cht_bsw_rt5672.c
sound/soc/intel/boards/cht_bsw_max98090_ti.c

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 3d6a76c4 18-Oct-2015 Lars-Peter Clausen <lars@metafoo.de>

ASoC: cht_bsw_rt5645: Use snd_pcm_hw_constraint_single()

Use the new snd_pcm_hw_constraint_single() helper function rather than
installing a list constraint with a single value. Since
snd_pcm_hw_constraint_single() sets a static constraint while
snd_pcm_hw_constraint_list() sets a dynamic constraint the former is
slightly more efficient and it also needs less code.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 54d8697f 21-Aug-2015 Axel Lin <axel.lin@ingics.com>

ASoC: Set missing card owner field

Set the card owner field to prevent the module from being removed from
underneath its users.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 673c4f89 05-May-2015 Fang, Yang A <yang.a.fang@intel.com>

ASoC: Intel: Enabled button jack for BSW platform with rt5650 codec

rt5650 codec supports 4 buttons detections so enabled it

Signed-off-by: Fang, Yang A <yang.a.fang@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# c4ba51ba 23-Apr-2015 Fang, Yang A <yang.a.fang@intel.com>

ASoC: Intel: Support rt5650 codec for Cherrytrail & Braswell

rt5650 and rt5645 are similar codec so reuse the cht_bsw_rt5645 driver

Signed-off-by: Fang, Yang A <yang.a.fang@intel.com>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 6e747d53 27-Apr-2015 Bard Liao <bardliao@realtek.com>

ASoC: rt5645: Adds push button support for rt5650

rt5650 support headset button detection. Currently, the button detection
is only implemented for rt5650 codec. The button detection configuration
register's default value is different from rt5645.
And we didn't touch the register in the driver, so we will get the wrong
value when we dump the registers. We will fix it in another patch.

Signed-off-by: Bard Liao <bardliao@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# b97169da 02-Apr-2015 Jie Yang <yang.jie@intel.com>

ASoC: Intel: create atom folder and move atom platform files in

Restructure the sound/soc/intel/ directory: create atom folder, and move
sst atom platform files here.

Signed-off-by: Jie Yang <yang.jie@intel.com>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# e56c72d5 02-Apr-2015 Jie Yang <yang.jie@intel.com>

ASoC: Intel: create boards folder and move sst boards files in

Restructure the sound/soc/intel/ directory: create boards folder, and move
sst boards files here.

Signed-off-by: Jie Yang <yang.jie@intel.com>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Tested-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>