History log of /linux-master/sound/soc/codecs/tas2770.c
Revision Date Author Comments
# 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


# e59bf547 27-Oct-2022 Martin Povišer <povik+lin@cutebit.org>

ASoC: tas2770: Fix set_tdm_slot in case of single slot

There's a special branch in the set_tdm_slot op for the case of nslots
being 1, but:

(1) That branch can never work (there's a check for tx_mask being
non-zero, later there's another check for it *being* zero; one or
the other always throws -EINVAL).

(2) The intention of the branch seems to be what the general other
branch reduces to in case of nslots being 1.

For those reasons remove the 'nslots being 1' special case.

Fixes: 1a476abc723e ("tas2770: add tas2770 smart PA kernel driver")
Suggested-by: Jos Dehaes <jos.dehaes@gmail.com>
Signed-off-by: Martin Povišer <povik+lin@cutebit.org>
Link: https://lore.kernel.org/r/20221027095800.16094-1-povik+lin@cutebit.org
Signed-off-by: Mark Brown <broonie@kernel.org>


# 0a0342ed 19-Sep-2022 Martin Povišer <povik+lin@cutebit.org>

ASoC: tas2770: Reinit regcache on reset

On probe of the ASoC component, the device is reset but the regcache is
retained. This means the regcache gets out of sync if the codec is
rebound to a sound card for a second time. Fix it by reinitializing the
regcache to defaults after the device is reset.

Fixes: b0bcbe615756 ("ASoC: tas2770: Fix calling reset in probe")
Signed-off-by: Martin Povišer <povik+lin@cutebit.org>
Link: https://lore.kernel.org/r/20220919173453.84292-1-povik+lin@cutebit.org
Signed-off-by: Mark Brown <broonie@kernel.org>


# 1e5907bc 08-Aug-2022 Martin Povišer <povik+lin@cutebit.org>

ASoC: tas2770: Fix handling of mute/unmute

Because the PWR_CTRL field is modeled as the power state of the DAC
widget, and at the same time it is used to implement mute/unmute, we
need some additional book-keeping to have the right end result no matter
the sequence of calls. Without this fix, one can mute an ongoing stream
by toggling a speaker pin control.

Fixes: 1a476abc723e ("tas2770: add tas2770 smart PA kernel driver")
Signed-off-by: Martin Povišer <povik+lin@cutebit.org>
Link: https://lore.kernel.org/r/20220808141246.5749-5-povik+lin@cutebit.org
Signed-off-by: Mark Brown <broonie@kernel.org>


# 482c23fb 08-Aug-2022 Martin Povišer <povik+lin@cutebit.org>

ASoC: tas2770: Drop conflicting set_bias_level power setting

The driver is setting the PWR_CTRL field in both the set_bias_level
callback and on DAPM events of the DAC widget (and also in the
mute_stream method). Drop the set_bias_level callback altogether as the
power setting it does is in conflict with the other code paths.

Fixes: 1a476abc723e ("tas2770: add tas2770 smart PA kernel driver")
Signed-off-by: Martin Povišer <povik+lin@cutebit.org>
Link: https://lore.kernel.org/r/20220808141246.5749-4-povik+lin@cutebit.org
Signed-off-by: Mark Brown <broonie@kernel.org>


# bf54d97a 08-Aug-2022 Martin Povišer <povik+lin@cutebit.org>

ASoC: tas2770: Allow mono streams

The part is a mono speaker amp, but it can do downmix and switch between
left and right channel, so the right channel range is 1 to 2.

Fixes: 1a476abc723e ("tas2770: add tas2770 smart PA kernel driver")
Signed-off-by: Martin Povišer <povik+lin@cutebit.org>
Link: https://lore.kernel.org/r/20220808141246.5749-3-povik+lin@cutebit.org
Signed-off-by: Mark Brown <broonie@kernel.org>


# e9ac31f0 08-Aug-2022 Martin Povišer <povik+lin@cutebit.org>

ASoC: tas2770: Set correct FSYNC polarity

Fix setting of FSYNC polarity for DAI formats other than I2S. Also
add support for polarity inversion.

Fixes: 1a476abc723e ("tas2770: add tas2770 smart PA kernel driver")
Signed-off-by: Martin Povišer <povik+lin@cutebit.org>
Link: https://lore.kernel.org/r/20220808141246.5749-2-povik+lin@cutebit.org
Signed-off-by: Mark Brown <broonie@kernel.org>


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

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


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

ASoC: tas2770: Use modern ASoC DAI format terminology

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

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


# ad11678f 05-Apr-2022 Stephen Kitt <steve@sk2.org>

ASoC: tas*: use simple i2c probe function

The i2c probe functions here don't use the id information provided in
their second argument, so the single-parameter i2c probe function
("probe_new") can be used instead.

This avoids scanning the identifier tables during probes.

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


# 307f3145 04-Feb-2022 Martin Povišer <povik+lin@cutebit.org>

ASoC: tas2770: Insert post reset delay

Per TAS2770 datasheet there must be a 1 ms delay from reset to first
command. So insert delays into the driver where appropriate.

Fixes: 1a476abc723e ("tas2770: add tas2770 smart PA kernel driver")
Signed-off-by: Martin Povišer <povik+lin@cutebit.org>
Link: https://lore.kernel.org/r/20220204095301.5554-1-povik+lin@cutebit.org
Signed-off-by: Mark Brown <broonie@kernel.org>


# 80d5be1a 06-Dec-2021 Martin Povišer <povik@protonmail.com>

ASoC: tas2770: Fix setting of high sample rates

Although the codec advertises support for 176.4 and 192 ksps, without
this fix setting those sample rates fails with EINVAL at hw_params time.

Signed-off-by: Martin Povišer <povik@protonmail.com>
Link: https://lore.kernel.org/r/20211206224529.74656-1-povik@protonmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# f2ec1ebb 08-Apr-2021 Ye Bin <yebin10@huawei.com>

ASoC: tas2770: Constify static struct snd_soc_dai_ops

The snd_soc_dai_ops structures is only stored in the ops field of a
snd_soc_dai_driver structure, so make the snd_soc_dai_ops structure
const to allow the compiler to put it in read-only memory.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Ye Bin <yebin10@huawei.com>
Link: https://lore.kernel.org/r/20210408062646.803053-1-yebin10@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>


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

ASoC: tas2770: remove useless initialization

cppcheck warning:

sound/soc/codecs/tas2770.c:109:10: style: Variable 'ret' is assigned a
value that is never used. [unreadVariable]
int ret = 0;
^

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


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

ASoC: tas*: 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/877doeolgk.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 3121420c 23-Sep-2020 Dan Murphy <dmurphy@ti.com>

ASoC: tas2770: Remove unused variables

Remove unused variables in the private struct and the code as these
variables are initially set and then there is no additional code
utilizing these variables.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
Link: https://lore.kernel.org/r/20200923132600.10652-6-dmurphy@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# dd7d9052 23-Sep-2020 Dan Murphy <dmurphy@ti.com>

ASoC: tas2770: Remove ti,asi-format code

Remove the code to support the asi-format binding property. The code
does nothing except read the property and set a variable. No additional
action is taken except to reset the variable. The property is supposed
to set the rising or falling RX edge detection of the SBCLK but this
edge detection is done by checking the DAI_FMT_INV_MASK.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
Link: https://lore.kernel.org/r/20200923132600.10652-5-dmurphy@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# c0a30e2e 23-Sep-2020 Dan Murphy <dmurphy@ti.com>

ASoC: tas2770: Set regcache when shutting down and waking device

Set the regcache to cache data and mark cache as dirty when the device
is shutdown when suspend is called. When the device is woken up then
sync the cache and set to not caching the data.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
Link: https://lore.kernel.org/r/20200923132600.10652-3-dmurphy@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 5d0b9dfe 23-Sep-2020 Dan Murphy <dmurphy@ti.com>

ASoC: tas2770: Add shutdown capability via a GPIO

Add the hardware shutdown mechanism to shutdown and wake up the device
via a GPIO.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
Link: https://lore.kernel.org/r/20200923132600.10652-2-dmurphy@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# be05ab41 18-Sep-2020 Dan Murphy <dmurphy@ti.com>

ASoC: tas2770: Refactor sample rate function

Refactor the tas2770_set_samplerate to simplify the code and access the
I2C bus only once per rate request. The ramp rate and sample rate bits
are contained in the same register so a single call to the
snd_soc_update_bits function is all that is needed

Signed-off-by: Dan Murphy <dmurphy@ti.com>
Link: https://lore.kernel.org/r/20200918190548.12598-9-dmurphy@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# d3964aff 18-Sep-2020 Dan Murphy <dmurphy@ti.com>

ASoC: tas2770: Fix the spacing and new lines

Fix up the spacing for argument alignment and add new lines to separate
code. Eliminate unneccessary goto statements when the error code could
just be returned.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
Link: https://lore.kernel.org/r/20200918190548.12598-8-dmurphy@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# d3d71c99 18-Sep-2020 Dan Murphy <dmurphy@ti.com>

ASoC: tas2770: Fix unbalanced calls to pm_runtime

Fix the unbalanced call to the pm_runtime_disable when removing the
module. pm_runtime_enable is not called nor is the pm_runtime setup in
the code. Remove the i2c_remove function and the pm_runtime_disable.

Fixes: 1a476abc723e6 ("tas2770: add tas2770 smart PA kernel driver")
Signed-off-by: Dan Murphy <dmurphy@ti.com>
Link: https://lore.kernel.org/r/20200918190548.12598-5-dmurphy@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# cadab0ae 18-Sep-2020 Dan Murphy <dmurphy@ti.com>

ASoC: tas2770: Fix error handling with update_bits

snd_soc_update_bits returns a 1 when the bit was successfully updated,
returns a 0 is no update was needed and a negative if the call failed.
The code is currently failing the case of a successful update by just
checking for a non-zero number. Modify these checks and return the error
code only if there is a negative.

Fixes: 1a476abc723e6 ("tas2770: add tas2770 smart PA kernel driver")
Signed-off-by: Dan Murphy <dmurphy@ti.com>
Link: https://lore.kernel.org/r/20200918190548.12598-7-dmurphy@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 4b8ab8a7 18-Sep-2020 Dan Murphy <dmurphy@ti.com>

ASoC: tas2770: Fix required DT properties in the code

The devicetree binding indicates that the ti,asi-format, ti,imon-slot-no
and ti,vmon-slot-no are not required but the driver requires them or it
fails to probe. Honor the binding and allow these entries to be optional
and set the corresponding values to the default values for each as defined
in the data sheet.

Fixes: 1a476abc723e6 ("tas2770: add tas2770 smart PA kernel driver")
Signed-off-by: Dan Murphy <dmurphy@ti.com>
Link: https://lore.kernel.org/r/20200918190548.12598-4-dmurphy@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 4272caf3 18-Sep-2020 Dan Murphy <dmurphy@ti.com>

ASoC: tas2770: Add missing bias level power states

Add the BIAS_STANDBY and BIAS_PREPARE to the set_bias_level or else the
driver will return -EINVAL which is not correct as they are valid
states.

Fixes: 1a476abc723e6 ("tas2770: add tas2770 smart PA kernel driver")
Signed-off-by: Dan Murphy <dmurphy@ti.com>
Link: https://lore.kernel.org/r/20200918190548.12598-2-dmurphy@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# b0bcbe61 18-Sep-2020 Dan Murphy <dmurphy@ti.com>

ASoC: tas2770: Fix calling reset in probe

tas2770_reset is called during i2c probe. The reset calls the
snd_soc_component_write which depends on the tas2770->component being
available. The component pointer is not set until codec_probe so move
the reset to the codec_probe after the pointer is set.

Fixes: 1a476abc723e6 ("tas2770: add tas2770 smart PA kernel driver")
Signed-off-by: Dan Murphy <dmurphy@ti.com>
Link: https://lore.kernel.org/r/20200918190548.12598-1-dmurphy@ti.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>


# 58b868f5 20-Jul-2020 Dan Murphy <dmurphy@ti.com>

ASoC: tas2770: Fix reset gpio property name

Fix the reset property name when allocating the GPIO descriptor.
The gpiod_get_optional appends either the -gpio or -gpios suffix to the
name.

Fixes: 1a476abc723e6 ("tas2770: add tas2770 smart PA kernel driver")
Signed-off-by: Dan Murphy <dmurphy@ti.com>
Link: https://lore.kernel.org/r/20200720181202.31000-2-dmurphy@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>


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

ASoC: codecs: tas*: 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/873661xxhu.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# b26eb517 12-Nov-2019 Colin Ian King <colin.king@canonical.com>

ASoC: tas2770: clean up an indentation issue

There is a block that is indented too deeply, remove
the extraneous tabs.

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


# edd6d539 06-Oct-2019 Dan Murphy <dmurphy@ti.com>

ASoC: tas2770: Fix snd_soc_update_bits error handling

According the documentation for snd_soc_update_bits the API
will return a 1 if the update was successful with a value change,
a 0 if the update was successful with no value change or a negative
if the command just failed.

So the value of return in the driver needs to be checked for being less
then 0 or the caller may indicate failure when the value actually
changed.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
Link: https://lore.kernel.org/r/20191007171157.17813-1-dmurphy@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 5911e672 06-Oct-2019 Dan Murphy <dmurphy@ti.com>

ASoC: tas2770: Remove unneeded read of the TDM_CFG3 register

Remove the unneeded and incorrect read of the TDM_CFG3 register.
The read is done but the value is never used.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
Link: https://lore.kernel.org/r/20191007171157.17813-2-dmurphy@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 03fe492e 06-Oct-2019 YueHaibing <yuehaibing@huawei.com>

ASoc: tas2770: Fix build error without GPIOLIB

If GPIOLIB is not set, building fails:

sound/soc/codecs/tas2770.c: In function tas2770_reset:
sound/soc/codecs/tas2770.c:38:3: error: implicit declaration of function gpiod_set_value_cansleep; did you mean gpio_set_value_cansleep? [-Werror=implicit-function-declaration]
gpiod_set_value_cansleep(tas2770->reset_gpio, 0);
^~~~~~~~~~~~~~~~~~~~~~~~
gpio_set_value_cansleep
sound/soc/codecs/tas2770.c: In function tas2770_i2c_probe:
sound/soc/codecs/tas2770.c:749:24: error: implicit declaration of function devm_gpiod_get_optional; did you mean devm_regulator_get_optional? [-Werror=implicit-function-declaration]
tas2770->reset_gpio = devm_gpiod_get_optional(tas2770->dev,
^~~~~~~~~~~~~~~~~~~~~~~
devm_regulator_get_optional
sound/soc/codecs/tas2770.c:751:13: error: GPIOD_OUT_HIGH undeclared (first use in this function); did you mean GPIOF_INIT_HIGH?
GPIOD_OUT_HIGH);
^~~~~~~~~~~~~~
GPIOF_INIT_HIGH

Reported-by: Hulk Robot <hulkci@huawei.com>
Fixes: 1a476abc723e ("tas2770: add tas2770 smart PA kernel driver")
Suggested-by: Ladislav Michl <ladis@linux-mips.org>
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Link: https://lore.kernel.org/r/20191006104631.60608-1-yuehaibing@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 5a742399 01-Oct-2019 kbuild test robot <lkp@intel.com>

tas2770: fix platform_no_drv_owner.cocci warnings

sound/soc/codecs/tas2770.c:796:3-8: No need to set .owner here. The core will do it.

Remove .owner field if calls are used which set it automatically

Generated by: scripts/coccinelle/api/platform_no_drv_owner.cocci

Fixes: 1a476abc723e ("tas2770: add tas2770 smart PA kernel driver")
CC: Frank Shi <shifu0704@thundersoft.com>
Signed-off-by: kbuild test robot <lkp@intel.com>
Link: https://lore.kernel.org/r/20191001175504.ufhyxh66psrht42k@332d0cec05f4
Signed-off-by: Mark Brown <broonie@kernel.org>


# 1a476abc 20-Sep-2019 Frank Shi <shifu0704@thundersoft.com>

tas2770: add tas2770 smart PA kernel driver

add tas2770 smart PA kernel driver

Signed-off-by: Frank Shi <shifu0704@thundersoft.com>
Link: https://lore.kernel.org/r/1568962709-19185-2-git-send-email-shifu0704@thundersoft.com
Signed-off-by: Mark Brown <broonie@kernel.org>