History log of /linux-master/sound/soc/codecs/tlv320aic31xx.c
Revision Date Author Comments
# 897d8e86 19-Oct-2023 Marco Felsch <m.felsch@pengutronix.de>

ASoC: tlv320aic31xx: switch to gpiod_set_value_cansleep

Switch to gpiod_set_value_cansleep() to support gpiochips which can
sleep like i2c gpio expanders.

Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
Link: https://lore.kernel.org/r/20231019131806.381280-1-m.felsch@pengutronix.de
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


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

ASoC: tlv320*: 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-63-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 2fd8298a 02-Jun-2022 Mark Brown <broonie@kernel.org>

ASoC: tlv320aic31xx: Use modern ASoC DAI format terminology

As part of moving to remove the old style defines for the bus clocks update
the tlv320aic31xx driver to use more modern terminology for clocking.

Signed-off-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20220602135316.3554400-18-broonie@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>


# 988e6870 15-Apr-2022 Stephen Kitt <steve@sk2.org>

ASoC: tlv320*: use i2c_match_id and simple i2c probe

As part of the ongoing i2c transition to the simple probe
("probe_new"), this patch uses i2c_match_id to retrieve the
driver_data for the probed device. The id parameter is thus no longer
necessary and the simple probe can be used instead.

In the context of an i2c probe, i2c_match_id with the module id table
and the probed client never returns null, so removing the null check
on the i2c_device_id pointer is safe.

The i2c id tables are moved up before the probe function, as
suggested by Wolfram Sang, except where the existing code already had
a declaration for the of_device_id table.

Signed-off-by: Stephen Kitt <steve@sk2.org>
Link: https://lore.kernel.org/r/20220415160613.148882-7-steve@sk2.org
Signed-off-by: Mark Brown <broonie@kernel.org>


# 85f856f7 17-Jan-2022 Ariel D'Alessandro <ariel.dalessandro@collabora.com>

ASoC: Rename tlv320aic31xx-micbias.h as tlv320aic31xx.h

Let's use a more generic name, so other definitions for tlv320aic31xx
can be included.

Signed-off-by: Ariel D'Alessandro <ariel.dalessandro@collabora.com>
Acked-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20220117132109.283365-2-ariel.dalessandro@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 7ff27fae 13-Dec-2021 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: codecs: tlv320aic31xx: Use dev_err_probe() helper

Use the dev_err_probe() helper, instead of open-coding the same
operation.

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


# c5d22d5e 18-Nov-2021 Ariel D'Alessandro <ariel.dalessandro@collabora.com>

ASoC: tlv320aic31xx: Handle BCLK set as PLL input configuration

If BCLK is used as PLL input, the sysclk is determined by the hw
params. So it must be updated here to match the input frequency, based
on sample rate, format and channels.

Signed-off-by: Ariel D'Alessandro <ariel.dalessandro@collabora.com>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
Link: https://lore.kernel.org/r/20211119153248.419802-5-ariel.dalessandro@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 6e6752a9 18-Nov-2021 Ariel D'Alessandro <ariel.dalessandro@collabora.com>

ASoC: tlv320aic31xx: Add divs for bclk as clk_in

Add divisors for rates needed when the clk_in is set to BCLK.

Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
Signed-off-by: Ariel D'Alessandro <ariel.dalessandro@collabora.com>
Link: https://lore.kernel.org/r/20211119153248.419802-4-ariel.dalessandro@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 2664b24a 18-Nov-2021 Ariel D'Alessandro <ariel.dalessandro@collabora.com>

ASoC: tlv320aic31xx: Add support for pll_r coefficient

When the clock used by the codec is BCLK, the operation parameters need
to be calculated from input sample rate and format. Low frequency rates
required different r multipliers, in order to achieve a higher PLL
output frequency.

Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
Signed-off-by: Ariel D'Alessandro <ariel.dalessandro@collabora.com>
Link: https://lore.kernel.org/r/20211119153248.419802-3-ariel.dalessandro@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 2c39ca68 23-Jul-2021 Mark Brown <broonie@kernel.org>

ASoC: tlv320aic31xx: Fix jack detection after suspend

The tlv320aic31xx driver relies on regcache_sync() to restore the register
contents after going to _BIAS_OFF, for example during system suspend. This
does not work for the jack detection configuration since that is configured
via the same register that status is read back from so the register is
volatile and not cached. This can also cause issues during init if the jack
detection ends up getting set up before the CODEC is initially brought out
of _BIAS_OFF, we will reset the CODEC and resync the cache as part of that
process.

Fix this by explicitly reapplying the jack detection configuration after
resyncing the register cache during power on.

This issue was found by an engineer working off-list on a product
kernel, I just wrote up the upstream fix.

Signed-off-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20210723180200.25105-1-broonie@kernel.org
Cc: stable@vger.kernel.org


# 6c621b81 07-Jul-2021 Mark Brown <broonie@kernel.org>

ASoC: tlv320aic31xx: Make regmap cache only on probe()

Currently the tlv320aic31xx driver has regulator support but does not
enable the regulators during probe, deferring this until something causes
ASoC to make the card active. It does put the device into cache only mode
but only when the component level probe is called, however if interrupts
are in use the driver will access the regmap before then which if the
regulators are not powered on would cause I/O problems.

Signed-off-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20210707160234.16253-1-broonie@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>


# a9aef184 14-Jan-2021 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: tlv*: sync parameter naming (rate/sample_bits)

This patch syncs naming rule.

- xxx_rates;
+ xxx_rate;

- xxx_samplebits;
+ xxx_sample_bits;

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


# 5856d8bd 19-Jul-2020 Alexander A. Klimov <grandmaster@al2klimov.de>

ASoC: Replace HTTP links with HTTPS ones

Rationale:
Reduces attack surface on kernel devs opening the links for MITM
as HTTPS traffic is much harder to manipulate.

Deterministic algorithm:
For each file:
If not .svg:
For each line:
If doesn't contain `\bxmlns\b`:
For each link, `\bhttp://[^# \t\r\n]*(?:\w|/)`:
If neither `\bgnu\.org/license`, nor `\bmozilla\.org/MPL\b`:
If both the HTTP and HTTPS versions
return 200 OK and serve the same content:
Replace HTTP with HTTPS.

Signed-off-by: Alexander A. Klimov <grandmaster@al2klimov.de>
Acked-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20200719153822.59788-1-grandmaster@al2klimov.de
Signed-off-by: Mark Brown <broonie@kernel.org>


# 960af79d 08-Jul-2020 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: codecs: tlv*: merge .digital_mute() into .mute_stream()

snd_soc_dai_digital_mute() is internally using both
mute_stream() (1) or digital_mute() (2), but the difference between
these 2 are only handling direction.
We can merge digital_mute() into mute_stream

int snd_soc_dai_digital_mute(xxx, int direction)
{
...
else if (dai->driver->ops->mute_stream)
(1) return dai->driver->ops->mute_stream(xxx, direction);
else if (direction == SNDRV_PCM_STREAM_PLAYBACK &&
dai->driver->ops->digital_mute)
(2) return dai->driver->ops->digital_mute(xxx);
...
}

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Link: https://lore.kernel.org/r/874kqhxxhz.wl-kuninori.morimoto.gx@renesas.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>


# 3176f94c 29-Nov-2019 Nikita Yushchenko <nikita.yoush@cogentembedded.com>

ASoC: tlv320aic31xx: Add Volume Soft Stepping control

Chip supports soft stepping of volume changes and it is enabled by
default.

This patch adds a control for it, so it could be either made slower
(two sample periods per step instead of one), or disabled.

Signed-off-by: Nikita Yushchenko <nikita.yoush@cogentembedded.com>
Link: https://lore.kernel.org/r/20191129132719.11603-1-nikita.yoush@cogentembedded.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 0bb1306f 28-Nov-2019 Nikita Yushchenko <nikita.yoush@cogentembedded.com>

ASoC: tlv320aic31xx: Add HP output driver pop reduction controls

HP output driver has two parameters that can be configured to reduce
pop noise: power-on delay and ramp-up step time. Two new kcontrols
have been added to set these parameters.

Also have to alter timeout in aic31xx_dapm_power_event() because default
timeout does fire when higher supported power-on delay are configured.

Signed-off-by: Nikita Yushchenko <nikita.yoush@cogentembedded.com>
Link: https://lore.kernel.org/r/20191128135447.26458-1-nikita.yoush@cogentembedded.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# e48fdb53 18-Nov-2019 Lucas Stach <l.stach@pengutronix.de>

ASoC: tlv320aic31xx: configure output common-mode voltage

The tlv320aic31xx devices allow to adjust the output common-mode voltage
for best analog performance. The datasheet states that the common mode
voltage should be set to be <= AVDD/2.

This changes allows to configure the output common-mode voltage via a DT
property. If the property is absent the voltage is automatically chosen
as the highest voltage below/equal to AVDD/2.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Link: https://lore.kernel.org/r/20191118151207.28576-1-l.stach@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>


# 6d6376b1 15-Aug-2019 YueHaibing <yuehaibing@huawei.com>

ASoC: tlv320aic31xx: remove unused variable 'cm_m_enum'

sound/soc/codecs/tlv320aic31xx.c:261:29: warning:
cm_m_enum defined but not used [-Wunused-const-variable=]

It is never used, so can be removed.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Link: https://lore.kernel.org/r/20190815091738.21680-1-yuehaibing@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# b7e814de 19-Jul-2019 Lucas Stach <l.stach@pengutronix.de>

ASoC: tlv320aic31xx: suppress error message for EPROBE_DEFER

Both the supplies and reset GPIO might need a probe deferral for the
resource to be available. Don't print a error message in that case, as
it is a normal operating condition.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Acked-by: Andrew F. Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20190719143637.2018-1-l.stach@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>


# 7742a5b4 02-Apr-2019 kbuild test robot <lkp@intel.com>

ASoC: tlv320aic31xx: aic31xx_set_jack() can be static

Fixes: ebf3326cd969 ("ASoC: tlv320aic31xx: Add headphone/headset detection")
Signed-off-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 90f0202b 01-Apr-2019 Andrew F. Davis <afd@ti.com>

ASoC: tlv320aic31xx: Add button press detection

This device can optionally detect headset or microphone button presses.
Add support for this by passing this event to the jack layer.

Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# ebf3326c 01-Apr-2019 Andrew F. Davis <afd@ti.com>

ASoC: tlv320aic31xx: Add headphone/headset detection

This device can detect the insertion/removal of headphones and headsets.
Enable reporting this status by enabling this interrupt and forwarding
this to upper-layers if a jack has been defined.

This jack definition and the resulting operation from a jack detection
event must currently be defined by sound card platform code until CODEC
outputs to jack mappings can be defined generically.

Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 0bb423f2 08-Feb-2019 Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>

ASoC: regulator notifier registration should be managed

Regulator notifiers, that were registered during codec driver probing,
must be unregistered during driver release, or device managed versions
have to be used. This patch fixes codec drivers, that weren't explicitly
unregistering notifiers and simplifies those, that did that manually.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 7806869c 16-Nov-2018 Colin Ian King <colin.king@canonical.com>

ASoC: tlv320aic31xx: asihpi: clean up indentation, remove extraneous tab

The return statement is indented too much by one level, fix this by
removing an extraneous tab.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 18d545bb 04-Sep-2018 Andrew F. Davis <afd@ti.com>

ASoC: tlv320aic31xx: Add overflow detection support

Similar to short circuit detection, when the ADC/DAC is saturated and
overflows poor audio quality can result and should be reported to the
user. This device support Automatic Dynamic Range Compression (DRC)
to reduce this but it is not enabled currently in this driver.

Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 80863ee2 31-Aug-2018 Andrew F. Davis <afd@ti.com>

ASoC: tlv320aic31xx: Add short circuit detection support

These devices support detecting and reporting short circuits across
the output stages. Add support for reporting these issue. Do this
by registering an interrupt if available and enabling this error
to trigger that interrupt in the device.

Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# a16be2a6 19-Feb-2018 Peter Ujfalusi <peter.ujfalusi@ti.com>

ASoC: tlv320aic31xx: Do not force power on the DAC/ADC in clock master mode

With P0 R29, Bit2 set the I2S clocks will be running when the DAC/ADC is
powered down, but still the codec need to be powered up by needing at least
one complete DAPM path for the stream.

If the AIF is not needed (analog loopback for example) the I2S clocks will
not run as they are not needed.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Suggested-by: Stefan Müller-Klieser <s.mueller-klieser@phytec.de>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 7d41bc28 19-Feb-2018 Peter Ujfalusi <peter.ujfalusi@ti.com>

ASoC: tlv320aic31xx: Rename AIF_IN from 'DAC IN' to 'AIF IN'

The audio interface is not really the DAC input. Use more generic name for
it.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# d460b3f8 14-Feb-2018 Peter Ujfalusi <peter.ujfalusi@ti.com>

ASoC: tlv320aic31xx: Fix master mode clock I2S bus clocks

In the reset state of the codec we do not have complete playback or capture
routes.

The audio playback/capture will not work due to missing clock signals on
the I2S bus if PLL, MDAC/NDAC/DAC MADC/NADC/ADC is powered down.

To make sure that even if all output/input is disconnected the codec is
generating clocks, we need to have valid DAPM route in every case to power
up the must needed parts of the codec.

I have verified that switching DAC (during playback) or ADC (during
capture) will stop the I2S clocks, so the only solution is to connect the
'Off' routes as well to output/input.

The routes will be only added if the codec is clock master. In case the
role changes runtime, the applied routes are removed.

Tested on am43x-epos-evm with aic3111 codec in master mode.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Reviewed-by: Jyri Sarha <jsarha@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


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

ASoC: tlv320aic31xx: replace codec to component

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

Note:
xxx_codec_xxx() -> xxx_component_xxx()
.idle_bias_off = 0 -> .idle_bias_on = 1
.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>


# 0ce918c9 07-Dec-2017 Andrew F. Davis <afd@ti.com>

ASoC: tlv320aic31xx: Reset registers during power up

Add a reset function that toggles the reset line if available or uses
the software reset command otherwise. Use this in power up to ensure the
registers are in a sane state. This is useful when the driver module
is reloaded, or after Kexec, warm-reboots, etc..

Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# cd15da88 07-Dec-2017 Andrew F. Davis <afd@ti.com>

ASoC: tlv320aic31xx: Use fwnode APIs over raw OF calls

Use fwnode_* API instead of of_*, the results are the same but
fwnode_* is cleaner and we get ACPI support.

Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 283c3506 07-Dec-2017 Andrew F. Davis <afd@ti.com>

ASoC: tlv320aic31xx: Fix GPIO header includes

Use of gpiod_* needs <linux/gpio/consumer.h>, add this here.

Fixes: b6b247cd5e37 ("ASoC: tlv320aic31xx: Switch GPIO handling to use gpiod_* API")
Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# dcb407b2 29-Nov-2017 Andrew F. Davis <afd@ti.com>

ASoC: tlv320aic31xx: Handle inverted BCLK in non-DSP modes

Currently BCLK inverting is only handled when the DAI format is
DSP, but the BCLK may be inverted in any supported mode. Without
this using this CODEC in any other mode than DSP with the BCLK
inverted leads to bad sampling timing and very poor audio quality.

Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 77f8b3cf 29-Nov-2017 Andrew F. Davis <afd@ti.com>

ASoC: tlv320aic31xx: Add CODEC clock slave support

This CODEC supports being the WCLK and/or BCLK slave, add
support for this here.

Also make the alert into an error as alert is more urgent
than needed here and is rarely used.

Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# c6b8c779 29-Nov-2017 Andrew F. Davis <afd@ti.com>

ASoC: tlv320aic31xx: Check clock and divider before division

If our set_sysclk DAI callback has not been called yet p_div will be 0
and dividing by this will cause an error. Print an error message and
leave before this.

Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# b6b247cd 29-Nov-2017 Andrew F. Davis <afd@ti.com>

ASoC: tlv320aic31xx: Switch GPIO handling to use gpiod_* API

Move to using newer gpiod_* GPIO handling functions. This simplifies
the code and eases dropping platform data in the next patch. Also
remember GPIO are active low, so set "1" to reset.

Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# e88c3881 29-Nov-2017 Andrew F. Davis <afd@ti.com>

ASoC: tlv320aic31xx: Merge init function into probe

The function aic31xx_device_init() is only called from probe and
does nothing that logically shouldn't be in probe, remove this
unneeded function call and move its code into probe where it was called.

Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# ca7840fb 29-Nov-2017 Andrew F. Davis <afd@ti.com>

ASoC: tlv320aic31xx: General source formatting cleanup

Simple non-functional changes including:

* Fix spelling errors
* Reformat code for easier reading
* Remove unneeded code
* Remove assignments that are always overridden
* Normalize function return paths

Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 09303601 29-Nov-2017 Andrew F. Davis <afd@ti.com>

ASoC: tlv320aic31xx: Move ACPI table next to OF table

Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# c7734e8e 29-Nov-2017 Andrew F. Davis <afd@ti.com>

ASoC: tlv320aic31xx: Change aic31xx_power_off return type to void

The return value is not checked, and even if it was there is nothing
we could do about it and messages are already printed.

Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# b1c52b7e 29-Nov-2017 Andrew F. Davis <afd@ti.com>

ASoC: tlv320aic31xx: File header and copyright cleanup

Fix header copyright tags, while we are here, also switch to SPDX
and fixup MODULE tags to match.

Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# a825f31f 29-Nov-2017 Andrew F. Davis <afd@ti.com>

ASoC: tlv320aic31xx: Use standard reset GPIO OF name

The correct DT property for specifying a GPIO used for reset
is "reset-gpios", fix this here.

[Retitled for accuracy -- broonie]

Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 09fc38c1 08-Nov-2017 Gustavo A. R. Silva <garsilva@embeddedor.com>

ASoC: tlv320dac31xx: mark expected switch fall-through

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

Addresses-Coverity-ID: 1195220
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 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>


# 51827c41 12-May-2017 Tomas Vilda <tomas.vilda@gmail.com>

ASoC: tlv320dac31xx: Fix mistype in tlv320dac31xx codec

Signed-off-by: Tomas Vilda <tomas.vilda@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 4e2cc814 10-Nov-2016 Peter Ujfalusi <peter.ujfalusi@ti.com>

ASoC: tlv320aic31xx: Add support for tlv320dac3101

The DAC3101 is mostly identical to DAC3100 with the exception that it has
stereo speaker AMP instead of mono used in DAC3100.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# a4a1d79e 10-Nov-2016 Peter Ujfalusi <peter.ujfalusi@ti.com>

ASoC: tlv320aic31xx: Add missing of_device_id for dac3100

The compatible table was not updated when the support for DAC3100 was added.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Reviewed-by: Jyri Sarha <jsarha@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 3520646d 27-Sep-2016 Nikita Yushchenko <nikita.yoush@cogentembedded.com>

ASoC: tlv320aic31xx: do not declare support for mono DAI

This hardware supports only 2-channel DAI, even mono ADC digital output
has two channels with the same data.

Having min_channels=1 results in broken playback of mono files in setups
where CPU DAI supports mono.

Signed-off-by: Nikita Yushchenko <nikita.yoush@cogentembedded.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# ef9656b6 23-Sep-2016 Nikita Yushchenko <nikita.yoush@cogentembedded.com>

ASoC: tlv320aic31xx: add explicit support for tlv320dac31xx

tlv320dac31xx is a subset of tlv320aic31xx:
- it does not have MIC inputs and ADC, thus capture is not supported,
- it has analog inputs AIN1/AIN2 that can be mixed into output.

Although tlv320dac31xx does work with tlv320aic31xx driver, this setup
does register non-existent widgets and non-existent capture stream.
Thus userspace lists non-existent objects in user interfaces, an can
access these, causing operations with device registers that are
declared as "reserved" in tlv320dac31xx datasheet.

This patch fixes this situation by separating controls/widgets/routes
into common, aic31xx-specific, and dac31xx-specific parts. Only parts
that match actual hardware (as declared in "compatible" device tree
property) are registered.

Changes from v1:
- update device tree binding documentation,
- rebased on top of "ASoC: codec duplicated callback function goes to
component on tlv320aic31xx" commit.

Signed-off-by: Nikita Yushchenko <nikita.yoush@cogentembedded.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


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

ASoC: codec duplicated callback function goes to component on tlv320aic31xx

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>


# 11f9192c 19-Apr-2016 Bastien Nocera <hadess@hadess.net>

ASoC: tlv320aix31xx: Add ACPI match for Lenovo 100S

The Lenovo 100S netbook has a codec controller for which there is a
driver, but doesn't know how to access the device. This adds the
necessary ACPI table for the driver to find the device.

Device (TTLV)
{
Name (_ADR, Zero) // _ADR: Address
Name (_HID, "10TI3100") // _HID: Hardware ID
Name (_CID, "10TI3100") // _CID: Compatible ID
Name (_DDN, "TI TLV320AIC3100 Codec Controller ") // _DDN: DOS Device Name
Name (_UID, One) // _UID: Unique ID

Signed-off-by: Bastien Nocera <hadess@hadess.net>
Tested-by: Jan Schmidt <jan@centricular.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# f5cc1772 19-Apr-2016 Bastien Nocera <hadess@hadess.net>

ASoC: tlv320aix31xx: Add ACPI match for Lenovo 100S

The Lenovo 100S netbook has a codec controller for which there is a
driver, but doesn't know how to access the device. This adds the
necessary ACPI table for the driver to find the device.

Device (TTLV)
{
Name (_ADR, Zero) // _ADR: Address
Name (_HID, "10TI3100") // _HID: Hardware ID
Name (_CID, "10TI3100") // _CID: Compatible ID
Name (_DDN, "TI TLV320AIC3100 Codec Controller ") // _DDN: DOS Device Name
Name (_UID, One) // _UID: Unique ID

Signed-off-by: Bastien Nocera <hadess@hadess.net>
Tested-by: Jan Schmidt <jan@centricular.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>


# 378d1e43 14-May-2015 Lars-Peter Clausen <lars@metafoo.de>

ASoC: tlv320aix31xx: 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>


# 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>


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

ASoC: tlv320aic31xx: 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>


# a43a2629 26-Nov-2014 Lars-Peter Clausen <lars@metafoo.de>

ASoC: tlv320aix31xx: Cleanup manual bias level transitions

Set the CODEC driver's suspend_bias_off flag rather than manually going to
SND_SOC_BIAS_OFF in suspend and SND_SOC_BIAS_STANDBY in resume. This makes
the code a bit shorter and cleaner.

Since the ASoC core now takes care of setting the bias level to
SND_SOC_BIAS_OFF when removing the CODEC there is no need to do it manually
anymore either.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Jyri Sarha <jsarha@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# bbc686b3 24-Nov-2014 Jyri Sarha <jsarha@ti.com>

ASoC: tlv320aic31xx: Fix off by one error in the loop stucture.

Fix off by one read beyond the end of a table.

Reported-by: David Binderman <dcb314@hotmail.com>
Signed-off-by: Jyri Sarha <jsarha@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org


# 7ed36e96 03-Sep-2014 Jyri Sarha <jsarha@ti.com>

ASoC: tlv320aic31xx: Choose PLL p divider automatically

This simplifies aic31xx_divs table. There is no more need for p_val or
separate lines for 12 and 24 MHz mclks.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
Tested-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 03be88ee 03-Sep-2014 Jyri Sarha <jsarha@ti.com>

ASoC: tlv320aic31xx: Fix 24bit samples with I2S format and 12MHz mclk

I2S format requires bitclock to have an exact amount of cycles in a
frame for audio to work cleanly. With dsp formats that is not so
important.

Updates aic31xx_setup_pll() to look for a line in aic31xx_divs table
that produces the best match for the bitclock and adds lines to
aic31xx_divs for 12MHz mclk and 24bit samples.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
Tested-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 085f3ec6 31-Aug-2014 Peter Ujfalusi <peter.ujfalusi@ti.com>

ASoC: tlv320aic31xx: Correct interface register 2 variable name

Rename iface_reg3 to iface_reg2 since this variable is actually used for
interface register 2.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 88be681b 30-Jul-2014 Mark Brown <broonie@linaro.org>

ASoC: tlv320aic31xx: Convert to params_width()

The CODEC doesn't care how data is laid out in memory.

Signed-off-by: Mark Brown <broonie@linaro.org>


# a72d2abb 25-Jul-2014 Peter Ujfalusi <peter.ujfalusi@ti.com>

ASoC: tlv320aic31xx: Do not ignore errors in aic31xx_device_init()

We need to return the error codes from aic31xx_device_init() and return
from the i2c_probe with the error code.
We will have kernel panic (NULL pointer dereference) in
regulator_register_notifier() in case the devm_regulator_bulk_get() fails
(with -EPROBE_DEFER for example).

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Cc: stable@vger.kernel.org


# 423ca88e 13-Jun-2014 Shahina Shaik <sharab.shaik@gmail.com>

ASoC: tlv320aic31xx: Fixed Coding Style Issues

Fixed coding style issues of "Missing Blank line after declaration"

Signed-off-by: Shahina Shaik <sharab.shaik@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 914bc160 19-Jun-2014 Lars-Peter Clausen <lars@metafoo.de>

ASoC: tlv320aic31xx: Remove duplicate const

SOC_ENUM_SINGLE_DECL() already adds the const qualifier, so there is no need to
manually specify it.

Fixes the following warnings from sparse:
sound/soc/codecs/tlv320aic31xx.c:253:1: warning: duplicate const
sound/soc/codecs/tlv320aic31xx.c:255:1: warning: duplicate const
sound/soc/codecs/tlv320aic31xx.c:257:1: warning: duplicate const
sound/soc/codecs/tlv320aic31xx.c:260:1: warning: duplicate const
sound/soc/codecs/tlv320aic31xx.c:262:1: warning: duplicate const

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


# 2a1c23e3 24-Apr-2014 Joe Perches <joe@perches.com>

ASoC: tlv320aic31xx: Convert /n to \n

Use a newline character appropriately.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 0faabc4f 03-Apr-2014 Sachin Kamat <sachin.kamat@linaro.org>

ASoC: tlv320aic23: Include of.h

of_match_ptr is defined in of.h. Include it explicitly.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Mark Brown <broonie@linaro.org>


# ab64246c 13-Mar-2014 Lars-Peter Clausen <lars@metafoo.de>

ASoC: codecs: Replace instances of rtd->codec with dai->codec

With CODEC to CODEC links rtd->codec does not necessarily point to the driver's
CODEC. CODEC drivers should always use dai->codec and never even look at the PCM
runtime.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Acked-by: Jyri Sarha <jsarha@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# dac7e404 16-Mar-2014 Axel Lin <axel.lin@ingics.com>

ASoC: tlv320aic31xx: Don't call kfree for memory allocated by devm_kzalloc

The kfree call is not necessary, but we need to call snd_soc_unregister_codec()
in remove().

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


# fd218aa3 17-Mar-2014 Jyri Sarha <jsarha@ti.com>

ASoC: tlv320aic31xx: Turn power off only once.

Regulator code keep count of enables and disables. Double disable
causes an ugly warning.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 9296f4da 13-Mar-2014 Mark Brown <broonie@linaro.org>

ASoC: tlv320aic31xx: Staticise non-exported symbols

Signed-off-by: Mark Brown <broonie@linaro.org>


# bc236fa7 13-Mar-2014 Jyri Sarha <jsarha@ti.com>

ASoC: tlv320aic31xx: Remove snd_soc_codec_set_cache_io() call

Remove snd_soc_codec_set_cache_io(codec, 8, 8, SND_SOC_REGMAP) call
and codec->control_data = aic31xx->regmap assignment since that
already done by core.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# a2d57678 13-Mar-2014 Jyri Sarha <jsarha@ti.com>

ASoC: tlv320aic31xx: Fix unused variable warning from aic31xx_clk_off

Fix "warning: unused variable 'aic31xx'" from function 'aic31xx_clk_off'.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# e00447fa 10-Mar-2014 Jyri Sarha <jsarha@ti.com>

ASoC: tlv320aic31xx: Add basic codec driver implementation

This commit adds a bare bones driver support for TLV320AIC31XX family
audio codecs. The driver adds basic stereo playback trough headphone
and speaker outputs and mono capture trough microphone inputs.

The driver is currently missing support at least for mini DSP features
and jack detection. I have tested the driver only on TLV320AIC3111,
but based on the data sheets TLV320AIC3100, TLV320AIC3110, and
TLV320AIC3120 should work Ok too.

The base for the implementation was taken from:
git@gitorious.org:ti-codecs/ti-codecs.git ajitk/topics/k3.10.1-aic31xx
-branch at commit 77504eba0294764e9e63b4a0c696b44db187cd13.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>