summaryrefslogtreecommitdiff
path: root/sound/soc/codecs/rt5682s.c
Commit message (Collapse)AuthorAgeFilesLines
* ASoC: jz4752b: Capture fixesMark Brown2022-10-191-3/+1
|\ | | | | | | | | | | | | | | | | | | | | | | Merge series from Siarhei Volkau <lis8215@gmail.com>: The patchset fixes: - Line In path stays powered off during capturing or bypass to mixer. - incorrectly represented dB values in alsamixer, et al. - incorrect represented Capture input selector in alsamixer in Playback tab. - wrong control selected as Capture Master
| * Merge tag 'sound-6.1-rc1' of ↵Linus Torvalds2022-10-051-107/+158
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound Pull sound updates from Takashi Iwai: "The majority of changes are ASoC drivers (SOF, Intel, AMD, Mediatek, Qualcomm, TI, Apple Silicon, etc), while we see a few small fixes in ALSA / ASoC core side, too. Here are highlights: Core: - A new string helper parse_int_array_user() and cleanups with it - Continued cleanup of memory allocation helpers - PCM core optimization and hardening - Continued ASoC core code cleanups ASoC: - Improvements to the SOF IPC4 code, especially around trace - Support for AMD Rembrant DSPs, AMD Pink Sardine ACP 6.2, Apple Silicon systems, Everest ES8326, Intel Sky Lake and Kaby Lake, Mediatek MT8186 support, NXP i.MX8ULP DSPs, Qualcomm SC8280XP, SM8250 and SM8450 and Texas Instruments SRC4392 HD- and USB-audio: - Cleanups for unification of hda-ext bus - HD-audio HDMI codec driver cleanups - Continued endpoint management fixes for USB-audio - New quirks as usual" * tag 'sound-6.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (422 commits) ALSA: hda: Fix position reporting on Poulsbo ALSA: hda/hdmi: Don't skip notification handling during PM operation ASoC: rockchip: i2s: use regmap_read_poll_timeout_atomic to poll I2S_CLR ASoC: dt-bindings: Document audio OF graph dai-tdm-slot-num dai-tdm-slot-width props ASoC: qcom: fix unmet direct dependencies for SND_SOC_QDSP6 ALSA: usb-audio: Fix potential memory leaks ALSA: usb-audio: Fix NULL dererence at error path ASoC: mediatek: mt8192-mt6359: Set the driver name for the card ALSA: hda/realtek: More robust component matching for CS35L41 ASoC: Intel: sof_rt5682: remove SOF_RT1015_SPEAKER_AMP_100FS flag ASoC: nau8825: Add TDM support ASoC: core: clarify the driver name initialization ASoC: mt6660: Fix PM disable depth imbalance in mt6660_i2c_probe ASoC: wm5102: Fix PM disable depth imbalance in wm5102_probe ASoC: wm5110: Fix PM disable depth imbalance in wm5110_probe ASoC: wm8997: Fix PM disable depth imbalance in wm8997_probe ASoC: wcd-mbhc-v2: Revert "ASoC: wcd-mbhc-v2: use pm_runtime_resume_and_get()" ASoC: mediatek: mt8186: Fix spelling mistake "slect" -> "select" ALSA: hda/realtek: Add quirk for HP Zbook Firefly 14 G9 model ALSA: asihpi - Remove unused struct hpi_subsys_response ...
| * | i2c: Make remove callback return voidUwe Kleine-König2022-08-161-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | ASoC: rt5682s: Fix the TDM Tx settingsDerek Fang2022-10-131-2/+13
| |/ |/| | | | | | | | | | | | | Complete the missing and correct the TDM Tx settings. Signed-off-by: Derek Fang <derek.fang@realtek.com> Link: https://lore.kernel.org/r/20221012031320.6980-1-derek.fang@realtek.com Signed-off-by: Mark Brown <broonie@kernel.org>
* | ASoC: rt5682s: simplify the return of rt5682s_probe()Yang Yingliang2022-09-201-6/+1
| | | | | | | | | | | | | | | | | | | | After commit bfc5e8b860ad ("ASoC: rt5682s: Reduce coupling of Micbias and Vref2 settings"), the return of rt5682s_probe() can be simplified. No functional changed. Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Link: https://lore.kernel.org/r/20220920151413.3455255-1-yangyingliang@huawei.com Signed-off-by: Mark Brown <broonie@kernel.org>
* | ASoC: rt5682s: Reduce coupling of PLLB settingDerek Fang2022-09-191-43/+73
| | | | | | | | | | | | | | | | | | | | Some parts of rt5682s CCF function are implemented by 'PLLB' dapm widget. The coupling risk exists, so this patch fixes it. Signed-off-by: Derek Fang <derek.fang@realtek.com> Link: https://lore.kernel.org/r/20220913025658.5005-3-derek.fang@realtek.com Signed-off-by: Mark Brown <broonie@kernel.org>
* | ASoC: rt5682s: Reduce coupling of I2S1 settingDerek Fang2022-09-191-38/+66
| | | | | | | | | | | | | | | | | | | | Some parts of rt5682s CCF function are implemented by 'I2S1' dapm widget. The coupling risk exists, so this patch fixes it. Signed-off-by: Derek Fang <derek.fang@realtek.com> Link: https://lore.kernel.org/r/20220913025658.5005-2-derek.fang@realtek.com Signed-off-by: Mark Brown <broonie@kernel.org>
* | ASoC: rt5682s: Reduce coupling of Micbias and Vref2 settingsDerek Fang2022-09-191-28/+26
|/ | | | | | | | | | | | | Some parts of rt5682s CCF function are implemented by 'MICBIAS' and 'Vref2' dapm widgets. There is a risk of causing not expected behavior if we mix using dapm and CCF operations in machine specific code. This patch reduces the coupling. Signed-off-by: Derek Fang <derek.fang@realtek.com> Link: https://lore.kernel.org/r/20220913025658.5005-1-derek.fang@realtek.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: rt*: Remove now redundant non_legacy_dai_naming flagCharles Keepax2022-06-271-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>
* ASoC: rt*: use simple i2c probe functionStephen Kitt2022-04-061-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>
* ASoC: Pull in fixesMark Brown2022-04-051-7/+4
|\ | | | | | | | | | | | | cs35l41 is getting some active work and conflicts, plus some of the fixes are needed for my testing. Signed-off-by: Mark Brown <broonie@kernel.org>
| * codecs: rt5682s: fix an incorrect NULL check on list iteratorXiaomeng Tong2022-04-041-7/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The bug is here: if (!dai) { The list iterator value 'dai' will *always* be set and non-NULL by for_each_component_dais(), so it is incorrect to assume that the iterator value will be NULL if the list is empty or no element is found (In fact, it will be a bogus pointer to an invalid struct object containing the HEAD). Otherwise it will bypass the check 'if (!dai) {' (never call dev_err() and never return -ENODEV;) and lead to invalid memory access lately when calling 'rt5682s_set_bclk1_ratio(dai, factor);'. To fix the bug, just return rt5682s_set_bclk1_ratio(dai, factor); when found the 'dai', otherwise dev_err() and return -ENODEV; Cc: stable@vger.kernel.org Fixes: bdd229ab26be9 ("ASoC: rt5682s: Add driver for ALC5682I-VS codec") Signed-off-by: Xiaomeng Tong <xiam0nd.tong@gmail.com> Link: https://lore.kernel.org/r/20220327081300.12962-1-xiam0nd.tong@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
* | ASoC: rt5682s: Separate the regulator consumer controlsDerek Fang2022-04-051-5/+22
|/ | | | | | | | | Control the regulators separately instead of using regulator_bulk to accord to the timing request in the datasheet. Signed-off-by: Derek Fang <derek.fang@realtek.com> Link: https://lore.kernel.org/r/20220328053338.21441-1-derek.fang@realtek.com Signed-off-by: Mark Brown <broonie@kernel.org>
* Merge tag 'asoc-v5.18' of ↵Takashi Iwai2022-03-211-21/+26
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus ASoC: Updates for v5.18 Quite a quiet release for ASoC, lots of work on drivers and platforms but nothing too groundbreaking but not much on the core itself: - Start of moving SoF to support multiple IPC mechanisms. - Use of NHLT ACPI table to reduce the amount of quirking required for Intel systems. - Some building blocks for use in forthcoming Intel AVS driver for legacy Intel DSP firmwares. - Support for AMD PDM, Atmel PDMC, Awinic AW8738, i.MX cards with TLV320AIC31xx, Intel machines with CS35L41 and ESSX8336, Mediatek MT8181 wideband bluetooth, nVidia Tegra234, Qualcomm SC7280, Renesas RZ/V2L, Texas Instruments TAS585M
| * ASoC: rt5682s: Stabilize the combo jack detectionDerek Fang2022-03-071-21/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Changes: 1. Revise rt5682s_sar_power_mode and rt5682s_headset_detect to be more rational. 2. Manually set to the jack-unplugging state via rt5682s_headset_detect during going to suspend. Close unnecessary powers and prepare for re-detecting the CBJ during resuming. 3. Simplize rt5682s_resume. Signed-off-by: Derek Fang <derek.fang@realtek.com> Link: https://lore.kernel.org/r/20220307102154.26065-1-derek.fang@realtek.com Signed-off-by: Mark Brown <broonie@kernel.org>
* | ASoC: rt5682s: Fix the wrong jack type detectedDerek Fang2022-02-241-17/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some powers were changed during the jack insert detection and clk's enable/disable in CCF. If in parallel, the influence has a chance to detect the wrong jack type. We refer to the below commit of the variant codec (rt5682) to fix this issue. ASoC: rt5682: Fix deadlock on resume 1. Remove rt5682s_headset_detect in rt5682s_jd_check_handler and use jack_detect_work instead of. 2. Use dapm mutex used in CCF to protect most of jack_detect_work. Signed-off-by: Derek Fang <derek.fang@realtek.com> Link: https://lore.kernel.org/r/20220223101450.4577-1-derek.fang@realtek.com Signed-off-by: Mark Brown <broonie@kernel.org>
* | ASoC: rt5682s: do not block workqueue if card is unboundKai Vehmanen2022-02-081-5/+7
|/ | | | | | | | | | | | | | | | | | | | | | | | | | The current rt5682s_jack_detect_handler() assumes the component and card will always show up and implements an infinite usleep loop waiting for them to show up. This does not hold true if a codec interrupt (or other event) occurs when the card is unbound. The codec driver's remove or shutdown functions cannot cancel the workqueue due to the wait loop. As a result, code can either end up blocking the workqueue, or hit a kernel oops when the card is freed. Fix the issue by rescheduling the jack detect handler in case the card is not ready. In case card never shows up, the shutdown/remove/suspend calls can now cancel the detect task. Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com> Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com> Reviewed-by: Shuming Fan <shumingf@realtek.com> Link: https://lore.kernel.org/r/20220207153000.3452802-1-kai.vehmanen@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: rt5682s: add delay time to fix pop sound issueShuming Fan2021-12-081-3/+31
| | | | | | | | | There is a pop noise at the beginning of the capture data. This patch adds the delay time before stereo1 ADC unmute to fix the pop sound issue. Signed-off-by: Shuming Fan <shumingf@realtek.com> Link: https://lore.kernel.org/r/20211208101718.28945-1-shumingf@realtek.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: rt5682s: Fix crash due to out of scope stack varsRob Clark2021-11-261-4/+6
| | | | | | | | | | | | | | Move the declaration of temporary arrays to somewhere that won't go out of scope before the devm_clk_hw_register() call, lest we be at the whim of the compiler for whether those stack variables get overwritten. Fixes a crash seen with gcc version 11.2.1 20210728 (Red Hat 11.2.1-1) Fixes: bdd229ab26be ("ASoC: rt5682s: Add driver for ALC5682I-VS codec") Signed-off-by: Rob Clark <robdclark@chromium.org> Reviewed-by: Stephen Boyd <swboyd@chromium.org> Link: https://lore.kernel.org/r/20211118010453.843286-2-robdclark@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: rt5682s: use 'static' qualifierPierre-Louis Bossart2021-10-271-3/+3
| | | | | | | | | | | | | | | | | Sparse reports the following warnings: sound/soc/codecs/rt5682s.c:44:12: error: symbol 'rt5682s_supply_names' was not declared. Should it be static? sound/soc/codecs/rt5682s.c:74:26: error: symbol 'rt5682s_reg' was not declared. Should it be static? sound/soc/codecs/rt5682s.c:2841:30: error: symbol 'rt5682s_aif1_dai_ops' was not declared. Should it be static? Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20211025185933.144327-3-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: rt5682s: Downsizing the DAC volume scaleDerek Fang2021-10-231-2/+2
| | | | | | | | | Use 0.75db/step of DAC volume instead of 1.5 to get a more smooth volume curve. Signed-off-by: Derek Fang <derek.fang@realtek.com> Link: https://lore.kernel.org/r/20211021120303.4601-1-derek.fang@realtek.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: rt5682s: Fix hp pop produced immediately after resumingDerek Fang2021-10-071-7/+20
| | | | | | | | | | | | | | When the system plays a sound immediately after resuming from S3, it could hear a little pop from headphones. It is due to the HP was unmuted before the completion of jack re-detection finished in parallel. This patch adds a lock to make sure the HP unmute after jack detect handler, and adds a few depop changes. Signed-off-by: Derek Fang <derek.fang@realtek.com> Link: https://lore.kernel.org/r/20211007085519.12543-1-derek.fang@realtek.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: rt5682s: Fix HP noise caused by SAR mode switch when the system resumesDerek Fang2021-10-011-16/+10
| | | | | | | | | | | | | | | When the system resumes from S3, if the system plays a beep, there is continuous "Zizi.." noise from HP that could be heard. It is caused by the SAR mode switch during the combo jack re-detection which be executed parallelly in a workqueue after the system resumes. This patch changes the behavior of SAR mode switch to avoid this issue. Signed-off-by: Derek Fang <derek.fang@realtek.com> Link: https://lore.kernel.org/r/20211001074113.2223-2-derek.fang@realtek.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: rt5682s: Enable ASRC auto-disable to fix pop during jack plug-in while ↵Derek Fang2021-10-011-0/+3
| | | | | | | | | | | | | | | | | | | | | | | playback When codec's ASRC was enabled, the DA and AD filters use the reference clk which tracks the I2S clks. And if the I2S clks' timing of open and close are not expected, this patch allows the filters to switch to use sysclk if ASRC's ref clks disappeared and could fix the below possible issues: 1. Avoid DA filter to keep surplus samples. 2. Avoid that AD filter works failed during dapm's power on. For example, if I2S clks were closed before dacdat during playback off due to jack unplug, it causes ref clks disappeared and DA filter remained some samples which will produce pop noise on the next HP playback. ASRC auto-disable could clear the samples during the playback off. Signed-off-by: Derek Fang <derek.fang@realtek.com> Link: https://lore.kernel.org/r/20211001074113.2223-1-derek.fang@realtek.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: rt5682s: Use dev_dbg instead of pr_debugDerek Fang2021-09-301-1/+1
| | | | | | | | It could observe the debug messages more clearly by using dev_dbg. Signed-off-by: Derek Fang <derek.fang@realtek.com> Link: https://lore.kernel.org/r/20210930102928.28628-2-derek.fang@realtek.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: rt5682s: Remove the volatile SW reset register from reg_defaultDerek Fang2021-09-301-1/+0
| | | | | | | | | This reg is for SW reset. It shouldn't have default value, so remove. Signed-off-by: Derek Fang <derek.fang@realtek.com> Link: https://lore.kernel.org/r/20210930102928.28628-1-derek.fang@realtek.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: rt5682s: make rt5682s_aif2_dai_ops and rt5682s_soc_component_devJiapeng Chong2021-09-201-2/+2
| | | | | | | | | | | | | | | | | This symbol is not used outside of rt5682s.c, so marks it static. Fix the following sparse warning: sound/soc/codecs/rt5682s.c:2848:39: warning: symbol 'rt5682s_soc_component_dev' was not declared. Should it be static? sound/soc/codecs/rt5682s.c:2842:30: warning: symbol 'rt5682s_aif2_dai_ops' was not declared. Should it be static? Reported-by: Abaci Robot <abaci@linux.alibaba.com> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com> Link: https://lore.kernel.org/r/1631955726-77693-1-git-send-email-jiapeng.chong@linux.alibaba.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: rt5682s: Add driver for ALC5682I-VS codecDerek Fang2021-09-131-0/+3188
This is an initial codec driver for Realtek ALC5682I-VS codec. Signed-off-by: Derek Fang <derek.fang@realtek.com> Signed-off-by: Derek Fang <derek.fang@realtek.com<mailto:derek.fang@realtek.com>> Link: https://lore.kernel.org/r/20210831130258.19286-1-derek.fang@realtek.com Signed-off-by: Mark Brown <broonie@kernel.org>