summaryrefslogtreecommitdiff
path: root/sound/soc/codecs/rt5663.c
AgeCommit message (Collapse)Author
2021-09-27ASoC: codecs: Fix spelling mistake "Unsupport" -> "Unsupported"Colin Ian King
There are spelling mistakes in dev_err error messages. Fix them. Signed-off-by: Colin Ian King <colin.king@canonical.com> Link: https://lore.kernel.org/r/20210924231003.144502-1-colin.king@canonical.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-03-10ASoC: rt5663: clarify expressionPierre-Louis Bossart
cppcheck warning: bitwise operation. Clarify expression with parentheses. [clarifyCondition] (pll_code.m_bp ? 0 : pll_code.m_code) << RT5663_PLL_M_SHIFT | ^ sound/soc/codecs/rt5663.c:2955:63: style: Boolean result is used in Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20210302212527.55158-16-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-06-22ASoC: codecs: rt*: rename to snd_soc_component_read()Kuninori Morimoto
We need to use snd_soc_component_read() instead of snd_soc_component_read32() This patch renames _read32() to _read() Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87d05z4mce.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2019-10-01ASoC: rt5663: clean up indentation issuesColin Ian King
There are two break statements that are indented one level too deeply, remove the extraneous tabs. Signed-off-by: Colin Ian King <colin.king@canonical.com> Link: https://lore.kernel.org/r/20190925100330.20695-1-colin.king@canonical.com Signed-off-by: Mark Brown <broonie@kernel.org>
2019-06-19treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500Thomas Gleixner
Based on 2 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms of the gnu general public license version 2 as published by the free software foundation this program is free software you can redistribute it and or modify it under the terms of the gnu general public license version 2 as published by the free software foundation # extracted by the scancode license scanner the SPDX license identifier GPL-2.0-only has been chosen to replace the boilerplate/reference in 4122 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Enrico Weigelt <info@metux.net> Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org> Reviewed-by: Allison Randal <allison@lohutok.net> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190604081206.933168790@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-16ASoC: rt5663: Fix error handling of regulator_set_loadCheng-Yi Chiang
The default implementation of regulator_set_load returns REGULATOR_MODE_NORMAL, which is positive. [This was a bug which is being fixed but the change is valid anyway -- bronie] rt5663_i2c_probe should only do error handling when return value of regulator_set_load is negative. In this case, rt5663_i2c_probe should return error. Also, consolidate err_irq into err_enable. Fix the missing goto for temporary regmap and rt5663->regmap. Signed-off-by: Cheng-Yi Chiang <cychiang@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-11-15ASoC: rt5663: Add regulator supportCheng-Yi Chiang
Add regulator support to turn on cpvdd and avdd in probe. If a regulator is not given from device tree, a dummy regulator will be used. Signed-off-by: Cheng-Yi Chiang <cychiang@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-10-25Merge tag 'sound-4.20-rc1' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound Pull sound updates from Takashi Iwai: "There have been little changes in ALSA core stuff, but ASoC core still kept rolling for the continued restructuring. The rest are lots of small driver-specific changes and some minor API updates. Here are highlights: General: - Appropriate fall-through annotations everywhere - Some code cleanup in memalloc code, handling non-cacahed pages more commonly in the helper - Deployment of SNDRV_PCM_INFO_SYNC_APPLPTR flag consistently Drivers: - More HD-audio CA0132 codec improvement for supporting other Creative boards - Plumbing legacy HD-audio codecs as ASoC BE on Intel SST; this will give move support of existing HD-audio devices with DSP - A few device-specific HD-audio quirks as usual - New quirk for RME CC devices and correction for B&W PX for USB-audio - FireWire: code refactoring including devres usages ASoC Core: - Continued componentization works; it's almost done! - A bunch of new for_each_foo macros - Cleanups and fixes in DAPM code ASoC Drivers: - MCLK support for several different devices, including CS42L51, STM32 SAI, and MAX98373 - Support for Allwinner A64 CODEC analog, Intel boards with DA7219 and MAX98927, Meson AXG PDM inputs, Nuvoton NAU8822, Renesas R8A7744 and TI PCM3060" * tag 'sound-4.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (299 commits) ASoC: stm32: sai: fix master clock naming ASoC: stm32: add clock dependency for sai ALSA: hda/ca0132 - Actually fix microphone issue ASoC: sun4i-i2s: move code from startup/shutdown hooks into pm_runtime hooks ASoC: wm2000: Remove wm2000_read helper function ASoC: cs42l51: fix mclk support ASoC: wm_adsp: Log addresses as 8 digits in wm_adsp_buffer_populate ASoC: wm_adsp: Rename memory fields in wm_adsp_buffer ASoC: cs42l51: add mclk support ASoC: stm32: sai: set sai as mclk clock provider ASoC: dt-bindings: add mclk support to cs42l51 ASoC: dt-bindings: add mclk provider support to stm32 sai ASoC: soc-core: fix trivial checkpatch issues ASoC: dapm: Add support for hw_free on CODEC to CODEC links ASoC: Intel: kbl_da7219_max98927: minor white space clean up ALSA: i2c/cs8427: Fix int to char conversion ALSA: doc: Brush up the old writing-an-alsa-driver ASoC: rsnd: tidyup SSICR::SWSP for TDM ASoC: rsnd: enable TDM settings for SSI parent ASoC: pcm3168a: add hw constraint for capture channel ...
2018-09-20ASoC: rt5663: Remove the boost volume in the beginning of playbackOder Chiou
The patch removes the boost volume in the beginning of playback while the DAC volume set to lower. Signed-off-by: Oder Chiou <oder_chiou@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-09-07regmap: split up regmap_config.use_single_rwDavid Frey
Split regmap_config.use_single_rw into use_single_read and use_single_write. This change enables drivers of devices which only support bulk operations in one direction to use the regmap_bulk_*() functions for both directions and have their bulk operation split into single operations only when necessary. Update all struct regmap_config instances where use_single_rw==true to instead set both use_single_read and use_single_write. No attempt was made to evaluate whether it is possible to set only one of use_single_read or use_single_write. Signed-off-by: David Frey <dpfrey@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-05-17ASoC: rt5663: rt5663_set_jack_detect() can be statickbuild test robot
Fixes: 9958e8afbcad ("ASoC: rt5663: Use the set_jack() instead of the export function") Signed-off-by: Fengguang Wu <fengguang.wu@intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-05-17ASoC: rt5663: Use the set_jack() instead of the export functionOder Chiou
The patch replaces the export function with the new API set_jack(). Signed-off-by: Oder Chiou <oder_chiou@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-05-05ASoC: rt5663: Optimize the power consumptionoder_chiou@realtek.com
The patch optimizes the power consumption. Signed-off-by: Oder Chiou <oder_chiou@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-02-12ASoC: hdac_hdmi/nau8825/rt286/rt298/rt5663/da7219: replace codec to componentKuninori Morimoto
Now we can replace Codec to Component. Let's do it. Because intal/rockchip boards are using multi-codecs in 1 driver, we need to update these all related drivers in same time. Otherwise compile error/warning happen Note: hdac_hdmi xxx_codec_xxx() -> xxx_component_xxx() .idle_bias_off = 1 -> .idle_bias_on = 0 .ignore_pmdown_time = 0 -> .use_pmdown_time = 1 - -> .endianness = 1 - -> .non_legacy_dai_naming = 1 nau8825 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 rt286 xxx_codec_xxx() -> xxx_component_xxx() .idle_bias_off = 1 -> .idle_bias_on = 0 .ignore_pmdown_time = 0 -> .use_pmdown_time = 1 - -> .endianness = 1 - -> .non_legacy_dai_naming = 1 rt298 xxx_codec_xxx() -> xxx_component_xxx() .idle_bias_off = 1 -> .idle_bias_on = 0 .ignore_pmdown_time = 0 -> .use_pmdown_time = 1 - -> .endianness = 1 - -> .non_legacy_dai_naming = 1 rt5663 xxx_codec_xxx() -> xxx_component_xxx() .idle_bias_off = 1 -> .idle_bias_on = 0 .ignore_pmdown_time = 0 -> .use_pmdown_time = 1 - -> .endianness = 1 - -> .non_legacy_dai_naming = 1 da7219 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>
2017-12-14ASoC: rt5663: Fix the wrong result of the first jack detectionoder_chiou@realtek.com
In the first jack detection while booting, the result will always show as headset, even we insert the headphone. Signed-off-by: Oder Chiou <oder_chiou@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-11-10Merge remote-tracking branches 'asoc/topic/rt5645', 'asoc/topic/rt5651', ↵Mark Brown
'asoc/topic/rt5659', 'asoc/topic/rt5663' and 'asoc/topic/rt5670' into asoc-next
2017-11-10ASoC: rt5663: Check the JD status in the button pushingoder_chiou@realtek.com
Check the JD status in the button pushing to prevent the IRQ that is locked by button pushing event while the jack unpluging. Signed-off-by: Oder Chiou <oder_chiou@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-11-09ASoC: rt5663: Delay and retry reading rt5663 ID registerOder Chiou
In the probe, the codec may not be ready for I2C reading or there are some glitches on the i2c line. So if the i2c reading value is incorrect, it will read again after delay. This issue is similar the patch https://patchwork.kernel.org/patch/9681421/. In current project, these 2 devices were connected to the same i2c line, and they met the same problem. Signed-off-by: Oder Chiou <oder_chiou@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-09-25ASoC: rt5663: Change the dev getting function in rt5663_irqoder_chiou@realtek.com
In the irq handler "rt5663_irq", while the codec is not initialized, rt5663->codec will be null, and it will cause the kernel panic in the debug print enabled. Signed-off-by: Oder Chiou <oder_chiou@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-09-19ASoC: rt5663: Add the function of impedance sensingOder Chiou
Support the function of impedance sensing. It could be set the matrix row number of the impedance sensing table and the related parameters in the DTS. Signed-off-by: Oder Chiou <oder_chiou@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-09-01Merge remote-tracking branches 'asoc/topic/rt5563', 'asoc/topic/rt5616', ↵Mark Brown
'asoc/topic/rt5645', 'asoc/topic/rt5659' and 'asoc/topic/rt5663' into asoc-next
2017-08-30ASoC: rt5663: Add delay for jack plug inoder_chiou@realtek.com
Codec initialize takes some time when 3.5mm jack plugged in. Add a delay to report jack plugged event to user space to avoid pop noise. Signed-off-by: Hsinyu Chao <hychao@chromium.org> Signed-off-by: Oder Chiou <oder_chiou@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-21Merge branch 'topic/msm8916' of ↵Mark Brown
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-const
2017-08-21Merge tag 'v4.13-rc6' into asoc-msm8916Mark Brown
Linux 4.13-rc6
2017-08-18ASoC: codecs: constify snd_soc_dai_ops structuresArvind Yadav
snd_soc_dai_ops are not supposed to change at runtime. All functions working with snd_soc_dai_ops provided by <sound/soc-dai.h> work with const snd_soc_dai_ops. So mark the non-const structs as const. Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-14ASoC: rt5663: Fine tune for the headphone output pop soundoder_chiou@realtek.com
The patch fine tunes for the headphone output pop sound. Signed-off-by: Oder Chiou <oder_chiou@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-10ASoC: codecs: add const to snd_soc_codec_driver structuresBhumika Goyal
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>
2017-08-02ASoC: rt5663: Seprate the DC offset between headphone and headsetoder_chiou@realtek.com
The patch seprates the DC offset between headphone and headset. Signed-off-by: Oder Chiou <oder_chiou@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-01ASoC: rt5663: Add the delay time to correct the calibrationoder_chiou@realtek.com
The patch adds the delay time to correct the calibration. Signed-off-by: Oder Chiou <oder_chiou@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-07-24ASoC: rt5663: constify acpi_device_id.Arvind Yadav
acpi_device_id are not supposed to change at runtime. All functions working with acpi_device_id provided by <acpi/acpi_bus.h> work with const acpi_device_id. So mark the non-const structs as const. Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-07-19ASoC: rt5663: Correct the mixer switch setting and remove redundant routing pathoder_chiou@realtek.com
The patch corrects the mixer siwtch setting that was the mistake in the previous commitment. And remove the redundant routing paths. Signed-off-by: Oder Chiou <oder_chiou@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-07-18ASoC: rt5663: Modify the default value for ASRC functionoder_chiou@realtek.com
The patch modifies the default value for ASRC function. It could prevent the pop noise and recording no sound with ASRC function. Signed-off-by: Oder Chiou <oder_chiou@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-07-17ASoC: rt5663: constify snd_soc_dai_ops structureGustavo A. R. Silva
This structure is only stored in the ops field of a snd_soc_dai_driver structure. That field is declared const, so snd_soc_dai_ops structures that have this property can be declared as const also. Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-07-17ASoC: rt5663: Add the manual offset field to compensate the DC offsetoder_chiou@realtek.com
The patch adds the manual offset field in the devicetree to compensate the DC offset that will be different between the PCB layout. It only can be measured by the real production. Signed-off-by: Oder Chiou <oder_chiou@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-07-17ASoC: rt5663: add in missing loop counter to avoid infinite loopColin Ian King
The loop counter 'count' is missing an increment, so we could end up with an infinite loop. Add in a pre-increment to count to fix this. Detected by CoverityScan, CID#1450120 ("Logically Dead Code") Fixes: 1a425dbf1a10 ("ASoC: rt5663: Update the calibration funciton") Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-07-17ASoC: rt5663: Modify the power sequence for reducing the pop soundoder_chiou@realtek.com
The patch modifies the power sequence for reducing the pop sound. Signed-off-by: Oder Chiou <oder_chiou@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-07-17ASoC: rt5663: Optimize the Jack Type detectionoder_chiou@realtek.com
The patch optimizes the Jack Type detection. Signed-off-by: Oder Chiou <oder_chiou@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-07-17ASoC: rt5663: Update the calibration funcitonoder_chiou@realtek.com
The patch updates the calibration funciton for getting the correct DC offset of headphone output. Signed-off-by: Oder Chiou <oder_chiou@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-07-10ASoC: rt5663: Update the HW default values based on the shipping versionoder_chiou@realtek.com
The patch update the HW default values based on the shipping version. Signed-off-by: Oder Chiou <oder_chiou@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-06-13ASoC: rt5663: Check the JD status in the resume functionOder Chiou
In the suspend, the IRQ function will not work in some machines. So the JD status should be checked in the resume function. Signed-off-by: Oder Chiou <oder_chiou@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-06-06ASoC: rt5663: Fix the IRQ issueOder Chiou
The patch fixed the IRQ issue. Signed-off-by: Oder Chiou <oder_chiou@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-12-12Merge remote-tracking branches 'asoc/topic/rt5514', 'asoc/topic/rt5616', ↵Mark Brown
'asoc/topic/rt5640', 'asoc/topic/rt5660' and 'asoc/topic/rt5663' into asoc-next
2016-10-24ASoC: rt5663: rename rt5668 as rt5663 v2Bard Liao
The "rt5668" codec supported in this driver is actually a revision of "rt5663". So the patch is renamed to "rt5663 v2" Signed-off-by: Bard Liao <bardliao@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-10-21ASoC: Add jd function for rt5663.Jack Yu
Add initial setting for rt5663 jd to irq. Signed-off-by: Jack Yu <jack.yu@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-10-13ASoC: rt5663: fix a debug statementDan Carpenter
We increment "i" before printing the debug statement. That makes it the wrong sleep_time[] information and Smatch complains that the last increment could be beyond the end of the array. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Bard Liao <bardliao@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-09-20ASoC: rt5663: fix platform_no_drv_owner.cocci warningskbuild test robot
sound/soc/codecs/rt5663.c:3203: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 Signed-off-by: Fengguang Wu <fengguang.wu@intel.com> Acked-by: Bard Liao <bardliao@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-09-20ASoC: rt5663: fix sparse warningsWei Yongjun
Fixes the following sparse warnings: sound/soc/codecs/rt5663.c:1367:14: warning: duplicate const sound/soc/codecs/rt5663.c:1577:5: warning: symbol 'rt5663_button_detect' was not declared. Should it be static? sound/soc/codecs/rt5663.c:2857:24: warning: symbol 'rt5663_aif_dai_ops' was not declared. Should it be static? sound/soc/codecs/rt5663.c:2866:27: warning: symbol 'rt5663_dai' was not declared. Should it be static? sound/soc/codecs/rt5663.c:3193:6: warning: symbol 'rt5663_i2c_shutdown' was not declared. Should it be static? sound/soc/codecs/rt5663.c:3200:19: warning: symbol 'rt5663_i2c_driver' was not declared. Should it be static? Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-09-16ASoC: rt5663: refine error handlingArnd Bergmann
The newly added rt5663 codec driver introduces a couple of warnings when built with -Wmaybe-uninitialized: codecs/rt5663.c: In function 'rt5663_set_tdm_slot': codecs/rt5663.c:2680:2: error: 'reg' may be used uninitialized in this function [-Werror=maybe-uninitialized] codecs/rt5663.c: In function 'rt5663_set_dai_pll': codecs/rt5663.c:2556:12: error: 'shift' may be used uninitialized in this function [-Werror=maybe-uninitialized] codecs/rt5663.c:2596:2: error: 'mask' may be used uninitialized in this function [-Werror=maybe-uninitialized] We can avoid those warnings by always returning an error from the switch() statements instead of falling through with an uninitialized variable when we hit an unexpected case. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Fixes: df7c52168ee1 ("ASoC: add rt5663 codec driver") Signed-off-by: Mark Brown <broonie@kernel.org>
2016-09-14ASoC: add rt5663 codec driverBard Liao
This is the initial codec driver for both rt5663 rt5668 codec. Signed-off-by: John Lin <john.lin@realtek.com> Signed-off-by: Jack Yu <jack.yu@realtek.com> Signed-off-by: Bard Liao <bardliao@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>