History log of /linux-master/sound/soc/codecs/rt5677.c
Revision Date Author Comments
# ea1c1019 30-Jun-2023 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

ASoC: rt5677: Sort headers alphabetically

It's hard to see what's included and what's not on the glance.
Sort headers alphabetically to improve maintenance.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20230630172155.83754-5-andriy.shevchenko@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 043bb9c0 30-Jun-2023 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

ASoC: rt5677: Use device_get_match_data()

Use device_get_match_data() to simplify the code.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20230630172155.83754-4-andriy.shevchenko@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# c3d42d7b 30-Jun-2023 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

ASoC: rt5677: Use agnostic irq_domain_create_linear()

Instead of irq_domain_add_linear() that requires of_node,
use irq_domain_create_linear() that works outside of OF world.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20230630172155.83754-3-andriy.shevchenko@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 5512ffd9 30-Jun-2023 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

ASoC: rt5677: Refactor GPIO support code

After compiler complains:

sound/soc/codecs/rt5677.c:4748:30: warning: dubious: x | !y

I looked into the code and realized that we can refactor it
for better reading and fixing above issue at the same time.
Hence this change. It does not imply any functional changes.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20230630172155.83754-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 0f9c14e5 16-Jun-2023 Juerg Haefliger <juerg.haefliger@canonical.com>

ASoC: rt5677: Add MODULE_FIRMWARE macro

The module loads firmware so add a MODULE_FIRMWARE macro to provide that
information via modinfo.

Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
Link: https://lore.kernel.org/r/20230616115549.1011903-1-juerg.haefliger@canonical.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 9abcd240 25-Apr-2023 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

ASoC: Switch i2c drivers back to use .probe()

After commit b8a1a4cd5a98 ("i2c: Provide a temporary .probe_new()
call-back type"), all drivers being converted to .probe_new() and then
03c835f498b5 ("i2c: Switch .probe() to not take an id parameter") convert
back to (the new) .probe() to be able to eventually drop .probe_new() from
struct i2c_driver.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de
Link: https://lore.kernel.org/r/20230425095716.331419-1-u.kleine-koenig@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org


# 70e79866 28-Feb-2023 Alexey Dobriyan <adobriyan@gmail.com>

ELF: fix all "Elf" typos

ELF is acronym and therefore should be spelled in all caps.

I left one exception at Documentation/arm/nwfpe/nwfpe.rst which looks like
being written in the first person.

Link: https://lkml.kernel.org/r/Y/3wGWQviIOkyLJW@p183
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>


# ed5c2f5f 15-Aug-2022 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

i2c: Make remove callback return void

The value returned by an i2c driver's remove function is mostly ignored.
(Only an error message is printed if the value is non-zero that the
error is ignored.)

So change the prototype of the remove function to return no value. This
way driver authors are not tempted to assume that passing an error to
the upper layer is a good idea. All drivers are adapted accordingly.
There is no intended change of behaviour, all callbacks were prepared to
return 0 before.

Reviewed-by: Peter Senna Tschudin <peter.senna@gmail.com>
Reviewed-by: Jeremy Kerr <jk@codeconstruct.com.au>
Reviewed-by: Benjamin Mugnier <benjamin.mugnier@foss.st.com>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Crt Mori <cmo@melexis.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Marek Behún <kabel@kernel.org> # for leds-turris-omnia
Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Petr Machata <petrm@nvidia.com> # for mlxsw
Reviewed-by: Maximilian Luz <luzmaximilian@gmail.com> # for surface3_power
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> # for bmc150-accel-i2c + kxcjk-1013
Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> # for media/* + staging/media/*
Acked-by: Miguel Ojeda <ojeda@kernel.org> # for auxdisplay/ht16k33 + auxdisplay/lcd2s
Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com> # for versaclock5
Reviewed-by: Ajay Gupta <ajayg@nvidia.com> # for ucsi_ccg
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> # for iio
Acked-by: Peter Rosin <peda@axentia.se> # for i2c-mux-*, max9860
Acked-by: Adrien Grassein <adrien.grassein@gmail.com> # for lontium-lt8912b
Reviewed-by: Jean Delvare <jdelvare@suse.de> # for hwmon, i2c-core and i2c/muxes
Acked-by: Corey Minyard <cminyard@mvista.com> # for IPMI
Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Acked-by: Sebastian Reichel <sebastian.reichel@collabora.com> # for drivers/power
Acked-by: Krzysztof Hałasa <khalasa@piap.pl>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Wolfram Sang <wsa@kernel.org>


# a524837d 23-Jun-2022 Charles Keepax <ckeepax@opensource.cirrus.com>

ASoC: rt*: Remove now redundant non_legacy_dai_naming flag

The ASoC core has now been changed to default to the non-legacy DAI
naming, as such drivers using the new scheme no longer need to specify
the non_legacy_dai_naming flag.

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


# a4db95b2 24-Sep-2021 Colin Ian King <colin.king@canonical.com>

ASoC: codecs: Fix spelling mistake "Unsupport" -> "Unsupported"

There are spelling mistakes in dev_err error messages. Fix them.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Link: https://lore.kernel.org/r/20210924231003.144502-1-colin.king@canonical.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 51cb94f6 02-Mar-2021 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: rt5677: remove useless assignment

cppcheck warning:

sound/soc/codecs/rt5677.c:5335:10: style: Variable 'ret' is assigned a
value that is never used. [unreadVariable]
int ret = 0, loop, i, reg_irq, virq;
^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210302212527.55158-22-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# ae052909 02-Mar-2021 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: rt5677: clarify expression

cppcheck warning:

sound/soc/codecs/rt5677.c:4571:61: style: Boolean result is used in
bitwise operation. Clarify expression with
parentheses. [clarifyCondition]
(pll_code.m_bp ? 0 : pll_code.m_code) << RT5677_PLL_M_SFT |
^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210302212527.55158-21-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 3e146b55 08-Jul-2020 Gustavo A. R. Silva <gustavoars@kernel.org>

ASoC: codecs: Use fallthrough pseudo-keyword

Replace the existing /* fall through */ comments and its variants with
the new pseudo-keyword macro fallthrough[1].

[1] https://www.kernel.org/doc/html/latest/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through

Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Link: https://lore.kernel.org/r/20200709010359.GA18971@embeddedor
Signed-off-by: Mark Brown <broonie@kernel.org>


# a3b9ed55 14-Nov-2019 kbuild test robot <lkp@intel.com>

ASoC: rt5677: rt5677_check_hotword() can be static

Fixes: 21c00e5df439 ("ASoC: rt5677: Enable jack detect while DSP is running")
Signed-off-by: kbuild test robot <lkp@intel.com>
Link: https://lore.kernel.org/r/20191114153304.n4pyix7qadu76tx4@4978f4969bb8
Signed-off-by: Mark Brown <broonie@kernel.org>


# 9da776ba 05-Nov-2019 Curtis Malainey <cujomalainey@chromium.org>

ASoC: rt5677: Wait for DSP to boot before loading firmware

Wait for hardware to startup. If we load before hardware is ready we
could end up corrupting the firmware.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Link: https://lore.kernel.org/r/20191106011335.223061-12-cujomalainey@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>


# ba0b3a97 05-Nov-2019 Curtis Malainey <cujomalainey@chromium.org>

ASoC: rt5677: Set ADC clock to use PLL and enable ASRC

Use the PLL to kept the correct 24M clock rate so frequency shift does
not occur when using the DSP VAD.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Link: https://lore.kernel.org/r/20191106011335.223061-11-cujomalainey@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>


# 395f02ef 05-Nov-2019 Curtis Malainey <cujomalainey@chromium.org>

ASoC: rt5677: Allow VAD to be shut on/off at all times

Due to limitations of the clocking configuration, we have no way of
scheduling our hibernation before the bdw dsp hibernates. This causes
issues when the system suspends with an open stream. We need userspace
to toggle the kcontrol before we are suspended so that any writes on
suspend are not lost and we don't corrupt the regmap.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Link: https://lore.kernel.org/r/20191106011335.223061-9-cujomalainey@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>


# ee0be4a9 05-Nov-2019 Ben Zhang <benzh@chromium.org>

ASoC: rt5677: Disable irq at suspend

The irq is disabled at suspend to avoid running the threaded irq
handler after the codec has been powered off. At resume, codec irq is
re-enabled and the interrupt status register is checked to see if
headphone has been pluggnd/unplugged while the device is suspended.

There is still a chance that the headphone gets enabled or disabled
after the codec is suspended. disable_irq syncs the threaded irq
handler, but soc-jack's threaded irq handler schedules a delayed
work to poll gpios (for debounce). This is still OK. The codec won't
be powered back on again because all audio paths have been suspended,
and there are no force enabled supply widgets (MICBIAS1 is disabled).
The gpio status read after codec power off could be wrong, so the
gpio values are checked again after resume.

Signed-off-by: Ben Zhang <benzh@chromium.org>
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Link: https://lore.kernel.org/r/20191106011335.223061-8-cujomalainey@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>


# 3f81068d 05-Nov-2019 Ben Zhang <benzh@chromium.org>

ASoC: rt5677: Stop and restart DSP over suspend/resume

MCLK1 gets disabled at suspend and re-enabled at resume. Before
MCLK1 is re-enabled, if the DSP is already on (either the DSP was
left on during suspend, or the DSP is turned on early at resume),
i2c register read returns garbage and corrupts the regmap cache.

This patch stops the DSP before suspend and restarts it after
resume with a dalay to ensure MCLK is on while loading firmware.

Signed-off-by: Ben Zhang <benzh@chromium.org>
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Link: https://lore.kernel.org/r/20191106011335.223061-7-cujomalainey@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>


# eabf424f 05-Nov-2019 Ben Zhang <benzh@chromium.org>

ASoC: rt5677: Mark reg RT5677_PWR_ANLG2 as volatile

The codec dies when RT5677_PWR_ANLG2(MX-64h) is set to 0xACE1
while it's streaming audio over SPI. The DSP firmware turns
on PLL2 (MX-64 bit 8) when SPI streaming starts. However regmap
does not believe that register can change by itself. When
BST1 (bit 15) is turned on with regmap_update_bits(), it doesn't
read the register first before write, so PLL2 power bit is
cleared by accident.

Marking MX-64h as volatile in regmap solved the issue.

Signed-off-by: Ben Zhang <benzh@chromium.org>
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Link: https://lore.kernel.org/r/20191106011335.223061-6-cujomalainey@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>


# 29073ae4 05-Nov-2019 Ben Zhang <benzh@chromium.org>

ASoC: rt5677: Add DAPM audio path for hotword stream

Add a DAPM audio path from "DMIC L1" to "DSP Buffer" so that
when hotwording is enabled, DAPM does not power off the codec
with SND_SOC_BIAS_OFF.

Signed-off-by: Ben Zhang <benzh@chromium.org>
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Link: https://lore.kernel.org/r/20191106011335.223061-5-cujomalainey@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>


# 21c00e5d 05-Nov-2019 Ben Zhang <benzh@chromium.org>

ASoC: rt5677: Enable jack detect while DSP is running

Before a hotword is detected, GPIO1 pin is configured as IRQ
output so that jack detect works. When a hotword is detected,
the DSP firmware configures the GPIO1 pin as GPIO1 and
drives a 1. rt5677_irq() is called after a rising edge on
the GPIO1 pin, due to either jack detect event or hotword
event, or both. All possible events are checked and handled
in rt5677_irq() where GPIO1 pin is configured back to IRQ
output if a hotword is detected.

Signed-off-by: Ben Zhang <benzh@chromium.org>
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Link: https://lore.kernel.org/r/20191106011335.223061-4-cujomalainey@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>


# 461c6232 05-Nov-2019 Ben Zhang <benzh@chromium.org>

ASoC: rt5677: Load firmware via SPI using delayed work

The firmware rt5677_elf_vad is an ELF binary obtained from
request_firmware(). Sections of the ELF are loaded to
the DSP via SPI. A model (e.g. en_us.mmap) can optionally be
loaded to the DSP at RT5677_MODEL_ADDR to overwrite the
baked-in model in rt5677_elf_vad.

Then we switch to DSP mode, load firmware, and let DSP run.
When a hotword is detected, an interrupt is fired and
rt5677_irq() is called. When 'DSP VAD Switch' is turned off,
the codec is set back to normal mode.

The kcontrol 'DSP VAD Switch' is automatically enabled/disabled
when the hotwording PCM stream is opened/closed.

Signed-off-by: Ben Zhang <benzh@chromium.org>
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Link: https://lore.kernel.org/r/20191106011335.223061-2-cujomalainey@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>


# dfe58f20 06-Sep-2019 Ben Zhang <benzh@chromium.org>

ASoC: rt5677: keep analog power register at SND_SOC_BIAS_OFF

Instead of clearing RT5677_PWR_ANLG2 (MX-64h) to 0 at SND_SOC_BIAS_OFF,
we only clear the RT5677_PWR_CORE bit which is set at SND_SOC_BIAS_PREPARE.
MICBIAS control bits are left unchanged.

This fixed the bug where if MICBIAS1 widget is forced on, MICBIAS
control bits will be cleared at suspend and never turned back on again,
since DAPM thinks the widget is always on.

Signed-off-by: Ben Zhang <benzh@chromium.org>
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Link: https://lore.kernel.org/r/20190906194636.217881-3-cujomalainey@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>


# 33b773dc 06-Sep-2019 Curtis Malainey <cujomalainey@chromium.org>

ASoC: rt5677: Remove magic number register writes

In order to simplify understanding what register values are being
written to the codec for debugging more advanced features (such as
hotwording) it is best to remove magic numbers

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Link: https://lore.kernel.org/r/20190906194636.217881-2-cujomalainey@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>


# ae032156 09-Aug-2019 Curtis Malainey <cujomalainey@chromium.org>

ASoC: rt5677: Revert remove superfluous set

Commit 4dc057a786dc23 ("ASoC: rt5677: remove superfluous set") was an
attempted code cleanup but was incorrectly tested before sent and
actually breaks the interrupt since it never resets the value on each
loop now. The breakage is most testable when hotwording code is added
and also uses the interrupt.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Link: https://lore.kernel.org/r/20190809215952.155660-1-cujomalainey@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>


# 4dc057a7 10-Jul-2019 Curtis Malainey <cujomalainey@chromium.org>

ASoC: rt5677: remove superfluous set

We define this variable with the same value, no need to set it twice

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Link: https://lore.kernel.org/r/20190711002838.35363-1-cujomalainey@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>


# 24043d60 24-Jun-2019 Curtis Malainey <cujomalainey@chromium.org>

ASoC: rt5677: depop stereo dac

Upon enabling the ASRC DAC we need a delay to avoid popping the
speakers.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Cc: Ross Zwisler <zwisler@chromium.org>
Tested-by: Ross Zwisler <zwisler@google.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# d2912cb1 04-Jun-2019 Thomas Gleixner <tglx@linutronix.de>

treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500

Based on 2 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 version 2 as
published by the free software foundation

this program is free software you can redistribute it and or modify
it under the terms of the gnu general public license version 2 as
published by the free software foundation #

extracted by the scancode license scanner the SPDX license identifier

GPL-2.0-only

has been chosen to replace the boilerplate/reference in 4122 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Enrico Weigelt <info@metux.net>
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Allison Randal <allison@lohutok.net>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190604081206.933168790@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# df9091e9 18-Jun-2019 Ben Zhang <benzh@chromium.org>

ASoC: rt5677: handle concurrent interrupts

The rt5677 driver writes to the IRQ control register within the IRQ
handler in order to flip the polarity of the interrupts that have been
signalled. If an interrupt fires in the interval between the
regmap_read and the regmap_write, it will not trigger a new call to
rt5677_irq.

Add a bounded loop to rt5677_irq that keeps checking interrupts until
none are seen, so that any interrupts that are signalled in that
interval are correctly handled.

Signed-off-by: Ben Zhang <benzh@chromium.org>
Signed-off-by: Fletcher Woodruff <fletcherw@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 4f7b018b 18-Jun-2019 Ben Zhang <benzh@chromium.org>

ASoC: rt5677: clear interrupts by polarity flip

The rt5677 jack detection function has a requirement that the polarity
of an interrupt be flipped after it fires in order to clear the
interrupt.

This patch implements an irq_chip with irq_domain directly instead of
using regmap-irq, so that interrupt source line polarities can be
flipped in the irq handler.

The reason that this patch does not add this feature within regmap-irq
is that future patches will add hotword detection support to this irq
handler. Those patches will require adding additional logic that would
not make sense to have in regmap-irq.

Signed-off-by: Ben Zhang <benzh@chromium.org>
Signed-off-by: Fletcher Woodruff <fletcherw@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 24180064 14-Jun-2019 Fletcher Woodruff <fletcherw@chromium.org>

ASoC: rt5677: move jack-detect init to i2c probe

This patch moves the code to select the gpios for jack detection
from rt5677_probe to rt5677_init_irq (called from rt5677_i2c_probe).

It also sets some registers to fix bugs related to jack detection, and
adds some constants and comments to make it easier to understand what
certain register settings are controlling.

Signed-off-by: Ben Zhang <benzh@chromium.org>
Signed-off-by: Fletcher Woodruff <fletcherw@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 8893cba2 14-Jun-2019 Fletcher Woodruff <fletcherw@chromium.org>

ASoC: rt5677: fall back to DT prop names on error

The rt5677 driver uses ACPI-style property names to read from the
device API. However, these do not match the property names in _DSD
used on the Chromebook Pixel 2015, which are closer to the Device Tree
style. Unify the two functions for reading from the device API so that
they try ACPI-style names first and fall back to the DT names on error.

With this patch, plugging and unplugging the headphone jack switches
between headphones and speakers automatically.

Signed-off-by: Fletcher Woodruff <fletcherw@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 893d1a9c 07-May-2019 Curtis Malainey <cujomalainey@chromium.org>

ASoC: rt5677: Add component driver name

Add name to component driver so it is possible to lookup the component
when needed.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 753c36a4 06-May-2019 Dylan Reid <dgreid@chromium.org>

ASoC: rt5677: use more of the volume range from DACs

The DACs volume can go over 0, both according to the data sheet and
real world testing. The control can go up to +30dB.

This was tested by playing audio at full volume on a samus chromebook.

Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
Signed-off-by: Ross Zwisler <zwisler@google.com>
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>


# dc22a409 04-Jan-2019 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: codecs: fix kernel doc descriptions

Missing or spurious parameter descriptions. Fix warnings with W=1

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


# f861e3e2 07-Aug-2018 Matthias Kaehlcke <mka@chromium.org>

ASoC: rt5677: Fix initialization of rt5677_of_match.data

The driver expects to find the device id in rt5677_of_match.data, however
it is currently assigned to rt5677_of_match.type. Fix this.

The problem was found with the help of clang:
sound/soc/codecs/rt5677.c:5010:36: warning: expression which evaluates to
zero treated as a null pointer constant of type 'const void *'
[-Wnon-literal-null-conversion]
{ .compatible = "realtek,rt5677", RT5677 },
^~~~~~

Fixes: ddc9e69b9dc2 ("ASoC: rt5677: Hide platform data in the module sources")
Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
Reviewed-by: Guenter Roeck <groeck@chromium.org>
Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 43a26bd0 01-Aug-2018 Gustavo A. R. Silva <gustavo@embeddedor.com>

ASoC: rt5677: Mark expected switch fall-through

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Addresses-Coverity-ID: 1271174 ("Missing break in switch")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 3a4f4f29 18-May-2018 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

ASoC: rt5677: Convert I2C driver to ->probe_new()

There is no platform code that uses i2c module table.
Remove it altogether and adjust ->probe() to be ->probe_new().

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


# 9ce76511 22-Aug-2017 Tom Rini <trini@konsulko.com>

ASoC: rt5677: Reintroduce I2C device IDs

Not all devices with ACPI and this combination of sound devices will
have the required information provided via ACPI. Reintroduce the I2C
device ID to restore sound functionality on on the Chromebook 'Samus'
model.

[ More background note:
the commit a36afb0ab648 ("ASoC: rt5677: Introduce proper table...")
moved the i2c ID probed via ACPI ("RT5677CE:00") to a proper
acpi_device_id table. Although the action itself is correct per se,
the overseen issue is the reference id->driver_data at
rt5677_i2c_probe() for retrieving the corresponding chip model for
the given id. Since id=NULL is passed for ACPI matching case, we get
an Oops now.

We already have queued more fixes for 4.14 and they already address
the issue, but they are bigger changes that aren't preferable for the
late 4.13-rc stage. So, this patch just papers over the bug as a
once-off quick fix for a particular ACPI matching. -- tiwai ]

Fixes: a36afb0ab648 ("ASoC: rt5677: Introduce proper table for ACPI enumeration")
Signed-off-by: Tom Rini <trini@konsulko.com>
Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# a180ba45 03-Aug-2017 Bhumika Goyal <bhumirks@gmail.com>

ASoC: codecs: add const to snd_soc_codec_driver structures

Declare snd_soc_codec_driver structures as const as they are only passed
as an argument to the function snd_soc_register_codec. This argument is
of type const, so declare the structures with this property as const.
In file codecs/sn95031.c, snd_soc_codec_driver structure is also used in
a copy operation along with getting passed to snd_soc_register_codec.
So, it can be made const too.
Done using Coccinelle:

@match disable optional_qualifier@
identifier s;
position p;
@@
static struct snd_soc_codec_driver s@p={...};

@good1@
identifier match.s;
position p;
@@
snd_soc_register_codec(...,&s@p,...)

@bad@
identifier match.s;
position p!={match.p,good1.p};
@@
s@p

@depends on !bad disable optional_qualifier@
identifier match.s;
@@
static
+const
struct snd_soc_codec_driver s={...};

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# c0d1cb83 18-Jul-2017 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

ASoC: rt5677: Remove never used variables

There are two variables that have never been used.

sound/soc/codecs/rt5677.c:785:35: warning: ‘in_vol_tlv’ defined but not used [-Wunused-const-variable=]
static const DECLARE_TLV_DB_SCALE(in_vol_tlv, -3450, 150, 0);

sound/soc/codecs/rt5677.c:783:35: warning: ‘out_vol_tlv’ defined but not used [-Wunused-const-variable=]
static const DECLARE_TLV_DB_SCALE(out_vol_tlv, -4650, 150, 0);

Simple remove them.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# d4e753d3 18-Jul-2017 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

ASoC: rt5677: Refactor code to avoid comparison unsigned >= 0

rt5677_to_irq() has couple of redundant conditionals, one of which
compares unsigned variable to be great than or equal to zero which
is always true as compiler notices:

sound/soc/codecs/rt5677.c: In function ‘rt5677_to_irq’:
sound/soc/codecs/rt5677.c:4626:13: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]

Refactor the code by removing redundant conditionals.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# ddc9e69b 18-Jul-2017 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

ASoC: rt5677: Hide platform data in the module sources

There is no user of legacy platform data.

Remove separate header and hide its content inside module sources.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 55e59aa0 15-Jun-2017 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

ASoC: rt5677: Move platform code to board file

GPIO ACPI mapping table is defined on platform basis. Codec driver
shouldn't have known what platform is using it.

Make codec driver more generic by moving platform code to where it
belongs.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# a36afb0a 15-Jun-2017 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

ASoC: rt5677: Introduce proper table for ACPI enumeration

I2C devices are enumerated by IDs, and not by instances.
Make it clear by using proper module device table for ACPI case.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 7b87463e 04-Apr-2017 Javier Martinez Canillas <javier@osg.samsung.com>

ASoC: rt5677: Add OF device ID table

The driver doesn't have a struct of_device_id table but supported devices
are registered via Device Trees. This is working on the assumption that a
I2C device registered via OF will always match a legacy I2C device ID and
that the MODALIAS reported will always be of the form i2c:<device>.

But this could change in the future so the correct approach is to have an
OF device ID table if the devices are registered via OF.

Before this patch:

$ modinfo sound/soc/codecs/snd-soc-rt5677.ko | grep alias
alias: i2c:RT5677CE:00
alias: i2c:rt5676
alias: i2c:rt5677

After this patch:

$ modinfo sound/soc/codecs/snd-soc-rt5677.ko | grep alias
alias: of:N*T*Crealtek,rt5677C*
alias: of:N*T*Crealtek,rt5677
alias: i2c:RT5677CE:00
alias: i2c:rt5676
alias: i2c:rt5677

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 89128534 24-Aug-2016 John Keeping <john@metanate.com>

ASoC: rt5677: Add ACPI support

The Chromebook Pixel 2015 uses this codec with the ACPI ID RT5677CE, but
does not use the standard DT property names so add a new function to
parse the codec properties from these ACPI properties.

Also, the GPIOs are only available by index, so we need to register a
mapping to allow machine drivers to access the GPIOs by name.

Signed-off-by: John Keeping <john@metanate.com>
Tested-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# c59b24f8 11-Sep-2016 Julia Lawall <Julia.Lawall@lip6.fr>

ASoC: constify gpio_chip structures

These structures are only used to copy into other structures, so declare
them as const.

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 gpio_chip i@p = { ... };

@ok@
identifier r.i;
expression e;
position p;
@@
e = i@p;

@bad@
position p != {r.p,ok.p};
identifier r.i;
struct gpio_chip e;
@@
e@i@p

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

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


# 1ec95a57 08-Aug-2016 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: codec duplicated callback function goes to component on rt5677

codec driver and component driver has duplicated callback functions,
and codec side functions are just copied to component side when
register timing. This was quick-hack, but no longer needed.
This patch moves these functions from codec driver to component driver.

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


# 14900363 08-Dec-2015 Linus Walleij <linus.walleij@linaro.org>

ASoC: rt5677: use gpiochip data pointer

This makes the driver use the data pointer added to the gpio_chip
to store a pointer to the state container instead of relying on
container_of().

Cc: Bard Liao <bardliao@realtek.com>
Cc: Oder Chiou <oder_chiou@realtek.com>
Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: alsa-devel@alsa-project.org
Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>


# 2dfadff6 30-Mar-2016 Axel Lin <axel.lin@ingics.com>

ASoC: rt5677: Avoid duplicate the same test in each switch case

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


# d0d1eedd 17-Dec-2015 Bard Liao <bardliao@realtek.com>

ASoC: rt5677: set PLL_CTRL2 non-volatile

There is a status bit on RT5677_PLL1_CTRL2 and RT5677_PLL2_CTRL2.
That's why those registers are set volatile. However, the status
bit is currently not used by codec driver. So, it should be no
problem if we set them non-volatile.
The purpose of setting them non-volatile is to restore the setting
after a syspend/resume cycle.

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


# 1aa844cd 15-Dec-2015 Ben Zhang <benzh@chromium.org>

ASoC: rt5677: Reconfigure PLL1 after resume

Sometimes PLL1 stops working if the codec loses power
during suspend (when pow-ldo2 or reset gpio is used).
MX-7Bh(RT5677_PLL1_CTRL2) is cleared and won't be restored
by regcache since it's volatile. MX-7Bh has one status bit
and M code for PLL1. rt5677_set_dai_pll doesn't reconfigure
PLL1 after resume because it thinks the PLL params are not
changed.

This patch clears the cached PLL params at resume so that
rt5677_set_dai_pll can reconfigure the PLL after resume.

Signed-off-by: Ben Zhang <benzh@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 58383c78 04-Nov-2015 Linus Walleij <linus.walleij@linaro.org>

gpio: change member .dev to .parent

The name .dev in a struct is normally reserved for a struct device
that is let us say a superclass to the thing described by the struct.
struct gpio_chip stands out by confusingly using a struct device *dev
to point to the parent device (such as a platform_device) that
represents the hardware. As we want to give gpio_chip:s real devices,
this is not working. We need to rename this member to parent.

This was done by two coccinelle scripts, I guess it is possible to
combine them into one, but I don't know such stuff. They look like
this:

@@
struct gpio_chip *var;
@@
-var->dev
+var->parent

and:

@@
struct gpio_chip var;
@@
-var.dev
+var.parent

and:

@@
struct bgpio_chip *var;
@@
-var->gc.dev
+var->gc.parent

Plus a few instances of bgpio that I couldn't figure out how
to teach Coccinelle to rewrite.

This patch hits all over the place, but I *strongly* prefer this
solution to any piecemal approaches that just exercise patch
mechanics all over the place. It mainly hits drivers/gpio and
drivers/pinctrl which is my own backyard anyway.

Cc: Haavard Skinnemoen <hskinnemoen@gmail.com>
Cc: Rafał Miłecki <zajec5@gmail.com>
Cc: Richard Purdie <rpurdie@rpsys.net>
Cc: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Cc: Alek Du <alek.du@intel.com>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Jiri Kosina <jkosina@suse.cz>
Acked-by: Hans-Christian Egtvedt <egtvedt@samfundet.no>
Acked-by: Jacek Anaszewski <j.anaszewski@samsung.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>


# cdab0d4e 29-Oct-2015 Anatol Pomozov <anatol.pomozov@gmail.com>

ASoC: rt5677: use 'active low' logic for reset pin

According to the datasheet RESET is active low pin, i.e. system goes to
reset state when pin signal is low.

The previous implementeation was assuming the pin is configured as
'active high' in DTS. Changle the gpio handling code and DTS configuration
to 'active low'.

Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# c22d7666 09-Nov-2015 Oder Chiou <oder_chiou@realtek.com>

ASoC: rt5677: Avoid the pop sound that comes from the filter power

The patch changes the type of DACs mixer to AUTODISABLE and add the delay
time after power up to avoid the pop sound that comes from the filter
power.

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 7d4d443e 21-Aug-2015 Ben Zhang <benzh@chromium.org>

ASoC: rt5677: Allow arbitrary block read/write via SPI

Added rt5677_spi_read() and refactored rt5677_spi_write() so that
an arbitrary block in the DSP address space can be read/written
via SPI. For example, this allows us to load an ELF DSP firmware
with sparse sections, and stream audio samples from DSP ring buffer.

Signed-off-by: Ben Zhang <benzh@chromium.org>
Acked-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 53f28609 02-Aug-2015 Lars-Peter Clausen <lars@metafoo.de>

ASoC: rt5677: Replace TLV_DB_RANGE_HEAD with DECLARE_TLV_DB_RANGE

DECLARE_TLV_DB_RANGE() has the advantage over using TLV_DB_RANGE_HEAD()
that it automatically calculates the number of items in the TLV and is
hence less prone to manual error.

Generate using the following coccinelle script

// <smpl>
@@
declarer name DECLARE_TLV_DB_RANGE;
identifier tlv;
constant x;
@@
-unsigned int tlv[] = {
- TLV_DB_RANGE_HEAD(x),
+DECLARE_TLV_DB_RANGE(tlv,
...
-};
+);
// </smpl>

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 00a6d6e5 04-Aug-2015 Oder Chiou <oder_chiou@realtek.com>

ASoC: Add function "rl6231_get_pre_div" to correct the dmic clock calculation

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


# f8163c86 24-Jul-2015 Axel Lin <axel.lin@ingics.com>

ASoC: rt5677: Return error if devm_gpiod_get_optional return ERR_PTR

If devm_gpiod_get_optional() return ERR_PTR, it means something wrong
so request gpio fails. We had better return error in such case.

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


# f285f161 23-Jul-2015 Axel Lin <axel.lin@ingics.com>

ASoC: rt5677: Remove NULL test for desc before gpiod_set_value_cansleep call

It's safe to call gpiod_set_value_cansleep() with NULL desc.

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


# 8019ff6c 16-Jul-2015 Nariman Poushin <nariman@opensource.wolfsonmicro.com>

regmap: Use reg_sequence for multi_reg_write / register_patch

Separate the functionality using sequences of register writes from the
functions that take register defaults. This change renames the arguments
in order to support the extension of reg_sequence to take an optional
delay to be applied after any given register in a sequence is written.
This avoids adding an int to all register defaults, which could
substantially increase memory usage for regmaps with large default tables.

This also updates all the clients of multi_reg_write/register_patch.

Signed-off-by: Nariman Poushin <nariman@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 1c07a4de 14-Jul-2015 Krzysztof Kozlowski <krzk@kernel.org>

ASoC: drivers: Drop owner assignment from i2c_driver

i2c_driver does not need to set an owner because i2c_register_driver()
will set it.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 64793047 15-Jul-2015 Axel Lin <axel.lin@ingics.com>

ASoC: Constify snd_soc_dai_ops variables

The snd_soc_dai_ops variables are not modified after initialization in
these drivers, so make them const.

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


# 9bfde721 22-Jun-2015 Ben Zhang <benzh@chromium.org>

ASoC: rt5677: Switch to use unified device property API

This patch makes the driver use the unified device property API
so that platform data can be provided by Device Tree, ACPI
or board files.

Signed-off-by: Ben Zhang <benzh@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>


# efd901ee 22-Jun-2015 Ben Zhang <benzh@chromium.org>

ASoC: rt5677: Switch to use descriptor-based gpiod API

This patch makes the driver use the new descriptor-based gpiod API
so that gpio assignment info can be provided by Device Tree, ACPI
or board files.

Signed-off-by: Ben Zhang <benzh@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>


# aa0bcc5c 25-Jun-2015 Jarkko Nikula <jarkko.nikula@linux.intel.com>

ASoC: rt5677: Prefix hexadecimal ID register value with 0x in error print

Make it obvious that unexpected value read from ID register is printed in
hexadecimal.

Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 6b43c2eb 19-May-2015 Lars-Peter Clausen <lars@metafoo.de>

ASoC: rt5677: Replace direct snd_soc_codec dapm field access

The dapm field of the snd_soc_codec struct is eventually going to be
removed, in preparation for this replace all manual access to
codec->dapm.bias_level with snd_soc_codec_get_bias_level() and replace all
other manual access to codec->dapm with snd_soc_codec_get_dapm().

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>


# b3b10e99 13-May-2015 Anatol Pomozov <anatol.pomozov@gmail.com>

ASoC: rt5677: Add reset-gpio dts option

It allows to configure codec's RESET pin gpio

Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 5220f7fb 07-May-2015 Oder Chiou <oder_chiou@realtek.com>

ASoC: rt5677: Add DMIC ASRC detect function

The patch adds DMIC ASRC detect function to dominate whether the DMIC ASRC
enable or not.

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 16ab6e18 27-Apr-2015 Bard Liao <bardliao@realtek.com>

ASoC: rt5677: add i2s asrc clk src selection

The ASRC source of i2s are also configurable. We add the selection
in the existing rt5677_sel_asrc_clk_src API.

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


# 60a8d62b 27-Apr-2015 Bard Liao <bardliao@realtek.com>

ASoC: rt5677: fixed wrong DMIC ref clock

DMIC clock source is not from codec system clock directly. it is
generated from the division of system clock. And it should be 256 *
sample rate of AIF1.

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


# f4bf8d77 27-Apr-2015 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Move bias level update to the core

All drivers have the same line at the end of the set_bias_level callback to
update the bias_level state. Move this update into
snd_soc_dapm_force_bias_level() and remove them from the drivers.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>


# bd1204cb 27-Apr-2015 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Route all bias level updates through the core

Use the new snd_soc_codec_force_bias_level() helper function to invoke the
bias_level callback of a driver instead of calling the callback by hand.
Currently the effect of this is the same, but having all bias level updates
go through a central place will allow us to move more of the bias level
management into the DAPM core.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 74d6ea52 24-Apr-2015 Bard Liao <bardliao@realtek.com>

ASoC: rt5677: add register patch for PLL

The PLL output will be unstable in some cases. We can fix it by
setting some registers.

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


# c36aa0a1 16-Mar-2015 Oder Chiou <oder_chiou@realtek.com>

ASoC: rt5677: add API to select ASRC clock source

This patch defines an API to select the clock source for specified filters.

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# cbca4076 25-Feb-2015 Oder Chiou <oder_chiou@realtek.com>

ASoC: rt5677: Keep the LDO2 powered while used in the suspend mode

The patch keeps the ldo2 power while the DSP function of "Voice Wake Up" used
in the suspend mode.

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# ab1f7095 11-Feb-2015 Oder Chiou <oder_chiou@realtek.com>

ASoC: rt5677: Add the chip type to distinguish the setting of the clock source

There is only one clock source in the rt5676, so the chip type is added to
distinguish the setting of the clock source in the VAD function.

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 70068776 25-Feb-2015 Oder Chiou <oder_chiou@realtek.com>

ASoC: rt5677: Correct the routing paths of that after IF1/2 DACx Mux

The patch corrects the routing paths of that after IF1/2 DACx Mux

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 4c121129 28-Jan-2015 Arnd Bergmann <arnd@arndb.de>

ASoC: rt5677: fix SPI dependency

The rt5677 codec has gained code that requires SPI to work correctly,
but there is no provision in Kconfig to prevent the driver from
being used when SPI is disabled or a loadable module, resulting
in this build error:

sound/built-in.o: In function `rt5677_spi_write':
:(.text+0xa7ba0): undefined reference to `spi_sync'
sound/built-in.o: In function `rt5677_spi_driver_init':
:(.init.text+0x253c): undefined reference to `spi_register_driver'

ERROR: "spi_sync" [sound/soc/codecs/snd-soc-rt5677-spi.ko] undefined!
ERROR: "spi_register_driver" [sound/soc/codecs/snd-soc-rt5677-spi.ko] undefined!

This makes the SPI portion of the driver depend on the SPI subsystem,
and disables the function that uses SPI for firmware download if SPI
is disabled. The latter may not be the correct solution, but I could
not come up with a better one.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: af48f1d08a54741 ("ASoC: rt5677: Support DSP function for VAD application")
Signed-off-by: Mark Brown <broonie@kernel.org>


# 46f20872 14-Jan-2015 Lars-Peter Clausen <lars@metafoo.de>

ASoC: rt5677: Replace w->codec snd_soc_dapm_to_codec(w->dapm)

The codec field of the snd_soc_widget struct is eventually going to be
removed, use snd_soc_dapm_to_codec(w->dapm) instead.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 9913b9f5 12-Jan-2015 Oder Chiou <oder_chiou@realtek.com>

ASoC: rt5677: Add the slot_width "25" support in the TDM mode

Add the slot_width "25" support in the TDM mode for the Intel platform.

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# e4b7e6a8 12-Jan-2015 Oder Chiou <oder_chiou@realtek.com>

ASoC: rt5677: Use the regmap functions instead of the snd_soc functions

The patch uses the regmap functions instead of the snd_soc functions in some
cases.

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# bdfbf255 07-Jan-2015 Oder Chiou <oder_chiou@realtek.com>

ASoC: rt5677: Modify the behavior that updates the PLL parameter.

The patch modified the behavior that updates the PLL parameter. It set the
update bit before the PLL power up.

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 277880a3 07-Jan-2015 Oder Chiou <oder_chiou@realtek.com>

ASoC: rt5677: Add the MICBIAS VDD setting in the platform data

The patch adds the MICBIAS VDD setting in the platform data. It can be set to
1V8 or 3V3 in the MICBIAS VDD.

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 38d595e2 22-Dec-2014 Oder Chiou <oder_chiou@realtek.com>

ASoC: rt5677: Adjust the routing of "PLL1"

Remove the duplicated PLL1 connections of the adc stereo filters,
and remove the PLL1 connections of the DACs because the PLL1 should be
connected to dac filters.

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 5a8c7c26 22-Dec-2014 Oder Chiou <oder_chiou@realtek.com>

ASoC: rt5677: Add the ASRC support

Add the ASRC support

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 6800b5ba 22-Dec-2014 Oder Chiou <oder_chiou@realtek.com>

ASoC: rt5677: Revise the filter powers

Add the filter powers of the dac mono3 and mono4, and remove the connection
of dac stereo1 filter that connect to DAC1 MIX.

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 6087fcab 23-Dec-2014 Fang, Yang A <yang.a.fang@intel.com>

ASoC: rt5677: fixed rt5677_dsp_vad_put rt5677_dsp_vad_get panic

snd_kcontrol_chip should return snd_soc_component instead of
snd_soc_codec

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


# 40e3262e 04-Dec-2014 Dylan Reid <dgreid@chromium.org>

ASoC: rt5677: make volume TLV closer to reality

The volume blocks have an step of 0.375dB, but TLV uses 0.01dB for
units. Only use the resolution supported, ignoring the LSB of the
volume register. This results in half the steps and 0.75dB per step,
but reports accurate levels through TLV. Update the masks to reflect
that these are registers have the LSB ignored.

Signed-off-by: Dylan Reid <dgreid@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 6fe17da0 24-Nov-2014 Oder Chiou <oder_chiou@realtek.com>

ASoC: rt5677: Fix the issue that the regmap_range "rt5677_ranges" cannot be accessed

After the patch "ASoC: rt5677: Use specific r/w function for DSP mode", the
regmap_range "rt5677_ranges" was not registered in rt5677_regmap_physical, and
it caused that the regmap_range "rt5677_ranges" cannot be accessed by the
specific r/w function. The patch fixes this issue.

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 683996cb 18-Nov-2014 Oder Chiou <oder_chiou@realtek.com>

ASoC: rt5677: Set the slow charge of the vref in the end of the power sequences

Set the slow charge of the vref in the end of the power sequences

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 35d40d10 18-Nov-2014 Oder Chiou <oder_chiou@realtek.com>

ASoC: rt5677: Follow the gpio naming rule to rename the irq function

Follow the gpio naming rule to rename the irq function.

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 2dfe2b08 18-Nov-2014 Oder Chiou <oder_chiou@realtek.com>

ASoC: rt5677: Align the reg_default table with tab character

Align the reg_default table with tab character

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 86ae04b1 16-Nov-2014 Oder Chiou <oder_chiou@realtek.com>

ASoC: rt5677: Modify the default value of the MX-8E[4] for ASRC function

Modify the default value of the MX-8E[4] to 1 for ASRC function. It could
prevent the pop noise with ASRC function.

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 91159eca 11-Nov-2014 Oder Chiou <oder_chiou@realtek.com>

ASoC: rt5677: Add TDM channel mux in DAC side of IF1 and IF2

It is the slot selection in DAC side of IF1 and IF2.

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 19ba484d 04-Nov-2014 Oder Chiou <oder_chiou@realtek.com>

ASoC: rt5677: Use specific r/w function for DSP mode

In DSP mode, the register r/w should use the specific function to access
that is invoked by address mapping of the DSP.

The MX-65[1] is for switching DSP or codec mode.

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# d65fd3a4 04-Nov-2014 Oder Chiou <oder_chiou@realtek.com>

ASoC: rt5677: Minor coding style and typo fix

Minor coding style and typo fix

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# e6f6ebc1 22-Oct-2014 Oder Chiou <oder_chiou@realtek.com>

ASoC: rt5677: Add TDM channel mapping function

It is for channel to slot mapping, and it is not only for 8 channels mapping,
but also in 2, 4 and 6 channels mapping. If we want to use the 2 channels in
the stereo2 adc path, we need to set the item "2/1/3/4" or "2/3/1/4".

It also adds for stereo channel swap. It can map the sterero channels "L/R"
to "R/L", "L/L" or R/R.

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 2d27deb4 22-Oct-2014 kbuild test robot <fengguang.wu@intel.com>

ASoC: rt5677: rt5677_irq_init() can be static

sound/soc/codecs/rt5677.c:4017:5: sparse: symbol 'rt5677_irq_init' was not declared. Should it be static?
sound/soc/codecs/rt5677.c:4044:6: sparse: symbol 'rt5677_irq_exit' was not declared. Should it be static?

Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 5e3363ad 16-Oct-2014 Oder Chiou <oder_chiou@realtek.com>

ASoC: rt5677: add GPIO IRQ support

This allows to enable Mic Jack detection feature

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Modified-by: Anatol Pomozov <anatol.pomozov@gmail.com>
Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 45b6e1d3 16-Oct-2014 Anatol Pomozov <anatol.pomozov@gmail.com>

ASoC: rt5677: fix build when kernel compiled without GPIOLIB support

Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 8a4bd60a 15-Oct-2014 Anatol Pomozov <anatol.pomozov@gmail.com>

ASoC: rt5677: Print more information if setting DAI clock failed

Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# af48f1d0 06-Oct-2014 Oder Chiou <oder_chiou@realtek.com>

ASoC: rt5677: Support DSP function for VAD application

The ALC5677 has a programmable DSP, and there is a SPI that is dadicated for DSP
firmware loading. Therefore, the patch includes a SPI driver for writing the DSP
firmware. The VAD(Voice Activaty Detection) has be implemented and use the DSP to
recognize the key phase.

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 40eb90a1 10-Oct-2014 Anatol Pomozov <anatol.pomozov@gmail.com>

ASoC: rt5677: Add option to configure gpio as floating/pullup/pulldown

gpio_config is array of 6 elements that allows to set GPIO as
floating, pullup, pulldown.

Sponsored: Google ChromeOS
Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 6f67c380 26-Sep-2014 Anatol Pomozov <anatol.pomozov@gmail.com>

ASoC: rt5677: Add dts properties for input/output differential configuration

Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# f9f6a592 17-Sep-2014 Anatol Pomozov <anatol.pomozov@gmail.com>

ASoC: rt5677: Add a configuration option for LDO2_POW pin

Some boards have this pin statically tied and do not require any configuration,
some other boards allow to enable chip using GPIO.

Add an option that tells which GPIO is used to power the audio codec.

Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 90bdbb46 18-Sep-2014 Oder Chiou <oder_chiou@realtek.com>

ASoC: rt5677: Add sidetone function

Add sidetone function

Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 48561afe 17-Sep-2014 Oder Chiou <oder_chiou@realtek.com>

ASoC: rt5677: Add the TDM function

The patch adds the TDM function.

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 5d5e63af 17-Sep-2014 Axel Lin <axel.lin@ingics.com>

ASoC: Remove return value checking for gpiochip_remove()

gpiochip_remove() will return void eventually.
Thus this patch removes return value checking for gpiochip_remove().

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


# 44caf764 15-Sep-2014 Oder Chiou <oder_chiou@realtek.com>

ASoC: rt5677: Add the GPIO function

The patch adds the GPIO function.

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 2d15d974 27-Aug-2014 Bard Liao <bardliao@realtek.com>

ASoC: rt5677: Add DMIC2 clock selection

There are two pins can be used for rt5677's DMIC2 clock. This patch
add the select options for it.

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


# 22e51345 27-Aug-2014 Bard Liao <bardliao@realtek.com>

ASoC: rt5677: correct mismatch widget name

We name MICBIAS1 in dapm widget, but micbias1 in route table.

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


# f18803a3 07-Jul-2014 Oder Chiou <oder_chiou@realtek.com>

ASoC: rt5677: Modify the voltage level in the BIAS OFF stage

The patch modifies the voltage level in the BIAS OFF stage

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 099d334e 16-Jun-2014 Axel Lin <axel.lin@ingics.com>

ASoC: rt5677: Convert to use rl6231_pll_calc

The implementation of rt5677_pll_calc() has the same logic of rl6231_pll_calc().
The only difference is the lower boundary checking for freq_in.

This patch calls rl6231_pll_calc() instead of open-coded.
The k_bp of struct rt5677_pll_code is always false, thus also remove the
code to check pll_code.k_bp.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Tested-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# f58c3b91 10-Jun-2014 Oder Chiou <oder_chiou@realtek.com>

ASoC: rt5677: Add a PMD case to MICBIAS1 event

The patch adds a PMD case to MICBIAS1 event.

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 80220f29 10-Jun-2014 Oder Chiou <oder_chiou@realtek.com>

ASoC: rt5677: Replace the string "Gain" to "Volume"

The patch replaces the string "Gain" to "Volume".

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 1b7fd76a 10-Jun-2014 Oder Chiou <oder_chiou@realtek.com>

ASoC: rt5677: Replace the string "source" to "Source"

The patch replaces the string "source" to "Source".

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 3d0c03d9 10-Jun-2014 Oder Chiou <oder_chiou@realtek.com>

ASoC: rt5677: Replace the string "micbias1" to "MICBIAS1"

The patch replaces the string "micbias1" to "MICBIAS1".

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# d0bdcb91 09-Jun-2014 Axel Lin <axel.lin@ingics.com>

ASoC: rt5677: Remove unneeded goto in rt5677_i2c_probe

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


# 9a53581e 02-Jun-2014 Axel Lin <axel.lin@ingics.com>

ASoC: rt5677: Convert to use rl6231_calc_dmic_clk

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Tested-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 30f14b43 09-Jun-2014 Axel Lin <axel.lin@ingics.com>

ASoC: rt5677: Convert to use rl6231_get_clk_info

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Tested-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# c8cfbec8 02-Jun-2014 Axel Lin <axel.lin@ingics.com>

ASoC: rt5677: Convert to use module_i2c_driver

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Tested-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 0e826e86 26-May-2014 Oder Chiou <oder_chiou@realtek.com>

ASoC: add RT5677 CODEC driver

This patch adds the Realtek ALC5677 codec driver.

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@linaro.org>