History log of /linux-master/sound/soc/codecs/rt1011.c
Revision Date Author Comments
# a5c8e75b 12-Aug-2023 Linus Walleij <linus.walleij@linaro.org>

ASoC: rt1011: Drop GPIO includes

This driver include two GPIO legacy headers yet doesn't use
symbols from any of them. Drop the includes.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org
Link: https://lore.kernel.org/r/20230812-descriptors-asoc-v1-1-eb4dca1f68af@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org


# 39da3e15 10-Jun-2023 Mark Brown <broonie@kernel.org>

ASoC: rt1011: Use maple tree register cache

The rt1011 can only support single register read and write operations
so does not benefit from block writes. This means it gets no benefit from
using the rbtree register cache over the maple tree register cache so
convert it to use maple trees instead, it is more modern.

Signed-off-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20230609-asoc-rt-maple-v1-1-729c6553cdcf@kernel.org
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


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


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

ASoC: rt*: 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/20220405130326.2107293-1-steve@sk2.org
Signed-off-by: Mark Brown <broonie@kernel.org>


# a382285b 11-Nov-2021 Jack Yu <jack.yu@realtek.com>

ASoC: rt1011: revert 'I2S Reference' to SOC_ENUM_EXT

Revert 'I2S Reference' to SOC_ENUM_EXT because the settings are specific
for some platforms, the default setting for 'I2S Reference' does nothing,
only some SoC platform need to configure it.
Previous 'I2S Reference' in SOC_ENUM format only toggles one bit of
RT1011_TDM1_SET_1 register, which isn't enough for specific platform.

Signed-off-by: Jack Yu <jack.yu@realtek.com>
Link: https://lore.kernel.org/r/20211111091705.20879-1-jack.yu@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# f05a9b85 13-Oct-2021 Peter Ujfalusi <peter.ujfalusi@linux.intel.com>

ASoC: rt1011: Fix 'I2S Reference' enum control

There are several things the patch adding the support for 'I2S Reference'
got wrong:
- "None" selection is in fact equals to last selected reference
- The custom put overrides RX/TX len, TDM slot sizes, etc
- the enum is useless in most part for the reference tracking
- there is no need for EXT control as there is a single bit in
RT1011_TDM1_SET_1 register (bit 7) which selects the reference
- it was using ucontrol->value.integer.value[0] in the put/get callbacks
which causesed access to 'I2S Reference' enum with alsamixer to fail

Complements: c3de683c4d1d ("ASoC: rt1011: Fix 'I2S Reference' enum control caused error")
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20211013123300.11095-1-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# c3de683c 11-Oct-2021 Peter Ujfalusi <peter.ujfalusi@linux.intel.com>

ASoC: rt1011: Fix 'I2S Reference' enum control caused error

Access to 'I2S Reference' enum causes alsamixer to fail to load:
$ alsamixer
cannot load mixer controls: Invalid argument

cml_rt1011_rt5682 cml_rt1011_rt5682: control 2:0:0:TL I2S Reference:0: access overflow

The reason is that the original patch adding the code was using
ucontrol->value.integer.value[0]
instead the correct
ucontrol->value.enumerated.item[0]

for an ENUM control.

Fixes: 87f40af26c262 ("ASoC: rt1011: add i2s reference control for rt1011")
Reported-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20211011144518.2518-1-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 87f40af2 06-Sep-2021 Jack Yu <jack.yu@realtek.com>

ASoC: rt1011: add i2s reference control for rt1011

Add i2s reference control for rt1011 amp.

Signed-off-by: Jack Yu <jack.yu@realtek.com>
Link: https://lore.kernel.org/r/20210906101208.11585-1-jack.yu@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 44de8d80 08-Apr-2021 Jack Yu <jack.yu@realtek.com>

ASoC: rt1011: remove pack_id check in rt1011

For latest design, different package could use the same setting,
therefore the check of pack_id will no longer be used.

Signed-off-by: Jack Yu <jack.yu@realtek.com>
Link: https://lore.kernel.org/r/4cbe1cd3b8664140889132464c7dee7b@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>


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

ASoC: rt1011: clarify expression

cppcheck warning:

sound/soc/codecs/rt1011.c:1781:63: style: Boolean result is used in
bitwise operation. Clarify expression with
parentheses. [clarifyCondition]

(pll_code.m_bp ? 0 : pll_code.m_code) << RT1011_PLL1_QM_SFT |
^

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


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

ASoC: rt1011: remove redundant test

cppcheck warning:

sound/soc/codecs/rt1011.c:1994:6: style: Condition 'tx_slotnum' is
always true [knownConditionTrueFalse]
if (tx_slotnum)
^
sound/soc/codecs/rt1011.c:1895:24: note: Assuming that condition
'!tx_slotnum' is not redundant
if (tx_slotnum > 2 || !tx_slotnum) {
^
sound/soc/codecs/rt1011.c:1994:6: note: Condition 'tx_slotnum' is
always true
if (tx_slotnum)
^

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


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

ASoC: rt1011: use logical OR

cppcheck complains a lot about mixing booleans and bitwise operations.

There is no good reason to use && and |, fix with ||

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


# 3084e5f7 24-Feb-2021 Rikard Falkeborn <rikard.falkeborn@gmail.com>

ASoC: rt*: Constify static struct acpi_device_id

These are never modified, so make them const to allow the compiler to
put them in read-only memory.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Link: https://lore.kernel.org/r/20210224211918.39109-4-rikard.falkeborn@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# ee8a41cd 22-Jun-2020 Fred Oh <fred.oh@linux.intel.com>

ASoC: rt1011: fix KASAN out-of-bounds bug in find_next_bit()

KASAN throws the following warning in rt1011.c:
[ 170.777603] BUG: KASAN: stack-out-of-bounds in _find_next_bit.constprop.0+0x3e/0xf0

find_next_bit() relies on unsigned long pointer arguments, but this driver
uses a type cast that generates the KASAN warning. Replace find_next_bit()
and find_last_bit() with __ffs() and __fls() to pass the value and avoid
casting pointers to make the warning go away.

Signed-off-by: Fred Oh <fred.oh@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Link: https://lore.kernel.org/r/20200622151348.28063-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 0e4ba029 16-Jan-2020 Shuming Fan <shumingf@realtek.com>

ASoC: rt1011: set the different setting for QFN/WLCSP package

The QFN package is a new one.
There is a different initial setting to the chip of QFN and WLCSP package.

Signed-off-by: Shuming Fan <shumingf@realtek.com>
Link: https://lore.kernel.org/r/20200116091854.18095-1-shumingf@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 683b8515 31-Oct-2019 Shuming Fan <shumingf@realtek.com>

ASoC: rt1011: some minor changes to improve readability

There is no other code use the RT1011_INIT_REG_LEN definition,
except rt1011_reg_init().
Hence, we remove it and fix the typo.

Signed-off-by: Shuming Fan <shumingf@realtek.com>
Link: https://lore.kernel.org/r/20191031115446.21108-1-shumingf@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 98b6b8df 31-Oct-2019 Shuming Fan <shumingf@realtek.com>

ASoC: rt1011: add the range check for temperature_calib from device property

The driver will check the range for temperature_calib.
It should be from 1 to 255.

Signed-off-by: Shuming Fan <shumingf@realtek.com>
Link: https://lore.kernel.org/r/20191031115436.21055-1-shumingf@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 270d1b39 31-Oct-2019 Shuming Fan <shumingf@realtek.com>

ASoC: rt1011: remove unnecessary tabs using spaces instead

There are unnecessary tabs inside some statements.
It uses sapces instead.

Signed-off-by: Shuming Fan <shumingf@realtek.com>
Link: https://lore.kernel.org/r/20191031115425.21003-1-shumingf@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 5cf93491 31-Oct-2019 Shuming Fan <shumingf@realtek.com>

ASoC: rt1011: improve the rt1011_set_dai_fmt() function

If there is a wrong format setting,
the driver will goto the end of the function directly.

Signed-off-by: Shuming Fan <shumingf@realtek.com>
Link: https://lore.kernel.org/r/20191031115414.20951-1-shumingf@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# b9a3eea3 31-Oct-2019 Shuming Fan <shumingf@realtek.com>

ASoC: rt1011: remove redundant code in kcontrol

The !component->card->instantiated statement should remove in kcontrol.
It is no need to check the card->instantiated in kcontrol.

Signed-off-by: Shuming Fan <shumingf@realtek.com>
Link: https://lore.kernel.org/r/20191031115401.20898-1-shumingf@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 349959a9 18-Oct-2019 Colin Ian King <colin.king@canonical.com>

ASoC: rt1011: fix spelling mistake "temperture" -> "temperature"

There is a spelling mistake in a dev_dbg message. Fix it.

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


# 8de6e755 16-Oct-2019 Shuming Fan <shumingf@realtek.com>

ASoC: rt1011: Read and apply r0 and temperature device property

Typically, the r0 (calibration data) and temperature were measured in the factory.
This information is written into the non-volatile area
where keeps data whether factory reset or OS update.
In Chromium OS case, the coreboot will read the info from VPD and create
the device property for each rt1011.

Signed-off-by: Shuming Fan <shumingf@realtek.com>
Tested-By: Cheng-Yi Chiang <cychiang@chromium.org>
Link: https://lore.kernel.org/r/20191016085845.11672-1-shumingf@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 81bd644f 16-Oct-2019 Shuming Fan <shumingf@realtek.com>

ASoC: rt1011: set tx/rx slots from tx/rx_mask in TDM case

The TX/RX slot configuration use tx/rx_mask which requested
by the machine driver.

Signed-off-by: Shuming Fan <shumingf@realtek.com>
Link: https://lore.kernel.org/r/20191016085754.11614-1-shumingf@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 2b70d577 07-Sep-2019 Colin Ian King <colin.king@canonical.com>

ASoC: rt1011: make array pd static const, makes object smaller

Don't populate the array pd on the stack but instead make it
static const. Makes the object code smaller by 100 bytes.

Before:
text data bss dec hex filename
51463 13016 128 64607 fc5f sound/soc/codecs/rt1011.o

After:
text data bss dec hex filename
51299 13080 128 64507 fbfb sound/soc/codecs/rt1011.o

(gcc version 9.2.1, amd64)

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


# e9e897d5 26-Aug-2019 Shuming Fan <shumingf@realtek.com>

ASoC: rt1011: add mutex protection to set_fmt/set_tdm_slot

The calibration process at booting will reset registers and bypass cache
to make sure the calibration is done.
We add mutex protection to avoid unexpected settings while
the registration process and calibration are interleaved.

Signed-off-by: Shuming Fan <shumingf@realtek.com>
Link: https://lore.kernel.org/r/20190826090052.1875-1-shumingf@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 5b366753 15-Aug-2019 YueHaibing <yuehaibing@huawei.com>

ASoC: rt1011: remove unused variable 'dac_vol_tlv' and 'adc_vol_tlv'

sound/soc/codecs/rt1011.c:981:35: warning:
dac_vol_tlv defined but not used [-Wunused-const-variable=]
sound/soc/codecs/rt1011.c:982:35: warning:
adc_vol_tlv defined but not used [-Wunused-const-variable=]

They are never used, so can be removed.

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


# 0922c7a5 06-Aug-2019 Shuming Fan <shumingf@realtek.com>

ASoC: rt1011: Add a flag for the R0 calibration test

The factory test needs to know whether the calibration completed.
This flag helps to confirm the calibration completed or not.

Signed-off-by: Shuming Fan <shumingf@realtek.com>
Link: https://lore.kernel.org/r/20190806091459.14382-1-shumingf@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 3403b808 06-Aug-2019 Shuming Fan <shumingf@realtek.com>

ASoC: rt1011: Add R0 temperature and TDM1 ADC2DAT Swap control

- The user level application could set the R0 temperature after booting system.
The degree Celsius of R0 temperature store in the non-volatile space
when doing R0 calibration.
- TDM1 ADC2DAT Swap controls use to control TDM slot2/3 data

Signed-off-by: Shuming Fan <shumingf@realtek.com>
Link: https://lore.kernel.org/r/20190806091435.14329-1-shumingf@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 09297c2f 11-Jul-2019 Shuming Fan <shumingf@realtek.com>

ASoC: rt1011: fix DC calibration offset not applying

There are two issues to fix:
- DC offset calibration data will be reset after stopping playback.
- DC offset calibration data should be applied in the initial setting.

Signed-off-by: Shuming Fan <shumingf@realtek.com>
Link: https://lore.kernel.org/r/20190711082214.8142-1-shumingf@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 64429a87 06-Jun-2019 Shuming Fan <shumingf@realtek.com>

ASoC: rt1011: fix warning reported by kbuild test robot and minor issue

This patch fixes following issues:
- warning: this decimal constant is unsigned only in ISO C90
- sparse: incorrect type in assignment
- check if value.integer.value is zero for "R0 Load Mode" control

Signed-off-by: Shuming Fan <shumingf@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 83a6edbb 05-Jun-2019 Nathan Chancellor <nathan@kernel.org>

ASoC: rt1011: Mark format integer literals as unsigned

Clang warns:

sound/soc/codecs/rt1011.c:1291:12: warning: integer literal is too large
to be represented in type 'long', interpreting as 'unsigned long' per
C89; this literal will have type 'long long' in C99 onwards
[-Wc99-compat]
format = 2147483648; /* 2^24 * 128 */
^
sound/soc/codecs/rt1011.c:2123:13: warning: integer literal is too large
to be represented in type 'long', interpreting as 'unsigned long' per
C89; this literal will have type 'long long' in C99 onwards
[-Wc99-compat]
format = 2147483648; /* 2^24 * 128 */
^
2 warnings generated.

Mark the integer literals as unsigned explicitly so that if the kernel
does ever bump the C standard it uses, the behavior is consitent.

Fixes: d6e65bb7ff0d ("ASoC: rt1011: Add RT1011 amplifier driver")
Link: https://github.com/ClangBuiltLinux/linux/issues/506
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# d6e65bb7 27-May-2019 Shuming Fan <shumingf@realtek.com>

ASoC: rt1011: Add RT1011 amplifier driver

This is the initial amplifier driver for rt1011.

Signed-off-by: Shuming Fan <shumingf@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>