aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/sound/soc/codecs/rt1011.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2024-05-03ASoC: codecs: Drop explicit initialization of struct i2c_device_id::driver_data to 0Uwe Kleine-König1-1/+1
These drivers don't use the driver_data member of struct i2c_device_id, so don't explicitly initialize this member. This prepares putting driver_data in an anonymous union which requires either no initialization or named designators. But it's also a nice cleanup on its own. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20240502074722.1103986-2-u.kleine-koenig@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org>
2023-08-13ASoC: rt1011: Drop GPIO includesLinus Walleij1-2/+0
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
2023-06-19ASoC: rt1011: Use maple tree register cacheMark Brown1-1/+1
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>
2023-05-08ASoC: Switch i2c drivers back to use .probe()Uwe Kleine-König1-1/+1
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
2022-06-27ASoC: rt*: Remove now redundant non_legacy_dai_naming flagCharles Keepax1-1/+0
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>
2022-04-06ASoC: rt*: use simple i2c probe functionStephen Kitt1-3/+2
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>
2021-11-12ASoC: rt1011: revert 'I2S Reference' to SOC_ENUM_EXTJack Yu1-6/+49
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>
2021-10-13ASoC: rt1011: Fix 'I2S Reference' enum controlPeter Ujfalusi1-48/+5
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>
2021-10-12ASoC: rt1011: Fix 'I2S Reference' enum control caused errorPeter Ujfalusi1-6/+5
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>
2021-09-13ASoC: rt1011: add i2s reference control for rt1011Jack Yu1-0/+54
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>
2021-04-23Merge remote-tracking branch 'asoc/for-5.13' into asoc-nextMark Brown1-26/+23
2021-04-08ASoC: rt1011: remove pack_id check in rt1011Jack Yu1-14/+2
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>
2021-03-10ASoC: rt1011: clarify expressionPierre-Louis Bossart1-2/+3
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>
2021-03-10ASoC: rt1011: remove redundant testPierre-Louis Bossart1-4/+4
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>
2021-03-10ASoC: rt1011: use logical ORPierre-Louis Bossart1-19/+15
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>
2021-03-10ASoC: rt*: Constify static struct acpi_device_idRikard Falkeborn1-1/+1
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>
2020-06-23ASoC: rt1011: fix KASAN out-of-bounds bug in find_next_bit()Fred Oh1-7/+13
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>
2020-01-17ASoC: rt1011: set the different setting for QFN/WLCSP packageShuming Fan1-2/+15
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>
2019-10-31ASoC: rt1011: some minor changes to improve readabilityShuming Fan1-4/+5
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>
2019-10-31ASoC: rt1011: add the range check for temperature_calib from device propertyShuming Fan1-1/+2
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>
2019-10-31ASoC: rt1011: remove unnecessary tabs using spaces insteadShuming Fan1-23/+22
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>
2019-10-31ASoC: rt1011: improve the rt1011_set_dai_fmt() functionShuming Fan1-0/+4
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>
2019-10-31ASoC: rt1011: remove redundant code in kcontrolShuming Fan1-9/+0
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>
2019-10-18ASoC: rt1011: fix spelling mistake "temperture" -> "temperature"Colin Ian King1-1/+1
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>
2019-10-16ASoC: rt1011: Read and apply r0 and temperature device propertyShuming Fan1-1/+40
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>
2019-10-16ASoC: rt1011: set tx/rx slots from tx/rx_mask in TDM caseShuming Fan1-5/+137
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>
2019-09-09Merge branch 'asoc-5.4' into asoc-nextMark Brown1-6/+23
2019-09-09ASoC: rt1011: make array pd static const, makes object smallerColin Ian King1-1/+2
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>
2019-08-27ASoC: rt1011: add mutex protection to set_fmt/set_tdm_slotShuming Fan1-8/+19
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>
2019-08-15ASoC: rt1011: remove unused variable 'dac_vol_tlv' and 'adc_vol_tlv'YueHaibing1-3/+0
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>
2019-08-07ASoC: rt1011: Add a flag for the R0 calibration testShuming Fan1-1/+13
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>
2019-08-07ASoC: rt1011: Add R0 temperature and TDM1 ADC2DAT Swap controlShuming Fan1-1/+8
- 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>
2019-07-11ASoC: rt1011: fix DC calibration offset not applyingShuming Fan1-2/+2
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>
2019-06-06ASoC: rt1011: fix warning reported by kbuild test robot and minor issueShuming Fan1-4/+7
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>
2019-06-06ASoC: rt1011: Mark format integer literals as unsignedNathan Chancellor1-2/+2
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>
2019-06-04ASoC: rt1011: Add RT1011 amplifier driverShuming Fan1-0/+2241
This is the initial amplifier driver for rt1011. Signed-off-by: Shuming Fan <shumingf@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>