summaryrefslogtreecommitdiff
path: root/sound/soc/codecs/sgtl5000.c
AgeCommit message (Collapse)Author
2019-09-06apalis-tk1: fix record/playback for sgtl5000 codecOleksandr Suvorov
According to the manual [1], SYS_MCLK should base on SYS_FS, not on sample rate. Calculating SYS_MCLK using sample rate only prevents playing/recording samples with rate < 16 kHz: --------------------------------------------------------------- root@apalis-tk1:~# aplay test-8k-sample.wav Playing WAVE 'test-8k-sample.wav' : Signed 16 bit [...] tegra-snd-apalis-tk1-sgtl5000 tegra-snd-apalis-tk1-sgtl5000.0: ASoC: machine hw_params failed: -22 Little Endian, Rate 8000 Hz, Stereo aplay: set_params:1403: Unable to install hw params: ... --------------------------------------------------------------- Using the helper from sgtl5000.h fixes this issue. To keep determination of sys_fs solid, use a helper in device driver. [1] https://www.nxp.com/docs/en/data-sheet/SGTL5000.pdf Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>
2019-09-06ASoC: sgtl5000: Add ADC switch controlOleksandr Suvorov
This makes able to switch ADC on automatically when recording starts. Commit 6b01f0b022a (Fix enabling ZCD for HP and ADC) fixes initial setting of SGTL5000_CHIP_ANA_CTRL, keeping muted HP, DAC and ADC blocks on probing device. HP and DAC mute issue was fixed with 60f67ac489 (Add on/off control for HP/LINE out). This commit fixes ADC mute issue in the same manner as HP/DAC. Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>
2019-05-16ASoC: sgtl5000: Heavy anti-pop workOleksandr Suvorov
Add handlers for HP/DAC/ADC power on/off event. Mute outputs on power on/off of any chip block to avoid pops. Improve logic for VAG to power on/off to avoid muxing pops. Fix DAPM widgets' definitions to use new handlers. Related to: #48500 Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>
2019-05-03ASoC: sgtl5000: Add on/off control for HP/LINE outOleksandr Suvorov
- adding mute/unmute controls for headphone and lineout allows alsa-compatible sound players automatically unmute output port to play music. Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>
2019-05-03ASoC: sgtl5000: Fix leading and trailing popsOleksandr Suvorov
- increase trailing delay after VAG power down to reduce trailing pop; - mute HP/LINE output before VAG power up. Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>
2019-05-03ASoC: sgtl5000: Fix setting power registersOleksandr Suvorov
- set VDDD voltage ONLY if use internal ldo regulator; - assign manually the source of charge pump ONLY if automatic selection can't perform. Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>
2019-05-03ASoC: sgtl5000: Fix enabling ZCD for HP and ADCOleksandr Suvorov
- change HP_ZCD_EN/ADC_ZCD_EN bits only in CHIP_ANA_CTRL register. Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>
2019-05-03ASoC: sgtl5000: Fix control of SMALL_POPOleksandr Suvorov
- define the SMALL_POP as a 1-bit mask, not value; - properly set the SMALL_POP on device probing. Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>
2019-05-03ASoC: sgtl5000: Fix possible dereference crashOleksandr Suvorov
- ldo_regulator_remove() doesn't reset sgtl5000->ldo so it is possible to dereference members of previously freed struct ldo. Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>
2019-05-03ASoC: sgtl5000: Name mux control correctlyOleksandr Suvorov
- Name headphone mux related data objects correctly. Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>
2019-05-02ASoC: sgtl5000: Don't fallback to ldo regulatorOleksandr Suvorov
- the code to fallback to internal ldo regulator instead of external vddd is completely wrong. According to TDM and Errata of sgtl5000 chips revision < 0x11 strongly need to use external vddd due to ER1. For chips revision >= 0x11 there is no limitation to use either external vddd or internal ldo regulator. - fix logical error in cleanup sequence. Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>
2019-04-26ASoC: sgtl5000: Fix SMALL_POP bit definitionFabio Estevam
commit c251ea7bd7a04f1f2575467e0de76e803cf59149 upstream On a mx28evk with a sgtl5000 codec we notice a loud 'click' sound to happen 5 seconds after the end of a playback. The SMALL_POP bit should fix this, but its definition is incorrect: according to the sgtl5000 manual it is bit 0 of CHIP_REF_CTRL register, not bit 1. Fix the definition accordingly and enable the bit as intended per the code comment. After applying this change, no loud 'click' sound is heard after playback Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Mark Brown <broonie@kernel.org> Cc: stable@vger.kernel.org
2019-04-26ASoC: sgtl5000: prevent playback to be muted when terminating concurrent captureLothar Waßmann
commit f091f3f07328f75d20a2a5970d1f8b58d95fc990 upstream When a sound capture/playback is terminated while a playback/capture is running, power_vag_event() will clear SGTL5000_CHIP_ANA_POWER in the SND_SOC_DAPM_PRE_PMD event, thus muting the respective other channel. Don't clear SGTL5000_CHIP_ANA_POWER when both DAC and ADC are active to prevent this. Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de> Reviewed-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2019-04-26ASoC: sgtl5000: Fix VAG_POWER enabling/disabling orderMarek Vasut
commit dd4d2d6dfb49e8916064f2cb07f0ad7b32a82fb7 upstream The VAG_POWER must be enabled after all other bits in CHIP_ANA_POWER and disabled before any other bit in CHIP_ANA_POWER. See the SGTL5000 datasheet (Table 31, BIT 7, page 42-43). Failing to follow this order will result in ugly loud "POP" noise at the end of playback. To achieve such order, use the _PRE and _POST DAPM widgets to trigger the power_vag_event, where the event type check has to be fixed accordingly as well. Signed-off-by: Marek Vasut <marex@denx.de> Signed-off-by: Mark Brown <broonie@linaro.org>
2013-08-04ASoC: sglt5000: Fix the default value of CHIP_SSS_CTRLFabio Estevam
commit 016fcab8ff46fca29375d484226ec91932aa4a07 upstream. According to the sgtl5000 reference manual, the default value of CHIP_SSS_CTRL is 0x10. Reported-by: Oskar Schirmer <oskar@scara.com> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Mark Brown <broonie@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-12-24ASoC: sgtl5000: Fix maximum value for microphone gainFabio Estevam
sgtl5000 microphone gain only has 2 bits of resolution, so maximum value is 3. From Eric Nelson: "We also found that for the microphones we have here (commodity PC boom mics) a default value of 2 for the gain gives the best results." So change the default microphone gain as well. Signed-off-by: Eric Nelson <eric.nelson@boundarydevices.com> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-12-10ASoC: codecs: remove __dev* attributesBill Pemberton
CONFIG_HOTPLUG is going away as an option. As result the __dev* markings will be going away. Remove use of __devinit, __devexit_p, __devinitdata, __devinitconst, and __devexit. Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-07-31ASoC: sgtl5000: enable VAG_POWER for LINE_INDong Aisheng
LINE_IN also needs VAG_POWER on or we may hear noise when directly route LINE_IN to Headphone Mux. Tested on imx28evk. Signed-off-by: Dong Aisheng <dong.aisheng@linaro.org> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-07-24ASoC: sgtl5000: remove unneeded snd_soc_dapm_new_widgets in probeDong Aisheng
There's a driver bug that sgtl5000 dapm widget kcontrols do not work. e.g. can not select capture mux with amixer tool(no error info prompted). The root cause is that we still call snd_soc_dapm_new_widgets in codec driver probe function afer converting to table based widgets. This will cause the card dapm widgets are instantiated before the dapm_routes are registered. Then, no available dapm widget pathes can be found during instantiation which finally will cause soc_dapm_mux_update_power to fail(can not find correct path with kcontrol) in snd_soc_dapm_put_enum_double function. Here we remove the unneeded snd_soc_dapm_new_widgets in codec probe and let the soc core to handle the register sequence properly. Then we can fix above issue. Signed-off-by: Dong Aisheng <dong.aisheng@linaro.org> Acked-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-05-23Merge tag 'sound-3.5' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound Pull sound updates from Takashi Iwai: "This is the first big chunk for 3.5 merges of sound stuff. There are a few big changes in different areas. First off, the streaming logic of USB-audio endpoints has been largely rewritten for the better support of "implicit feedback". If anything about USB got broken, this change has to be checked. For HD-audio, the resume procedure was changed; instead of delaying the resume of the hardware until the first use, now waking up immediately at resume. This is for buggy BIOS. For ASoC, dynamic PCM support and the improved support for digital links between off-SoC devices are major framework changes. Some highlights are below: * HD-audio - Avoid accesses of invalid pin-control bits that may stall the codec - V-ref setup cleanups - Fix the races in power-saving code - Fix the races in codec cache hashes and connection lists - Split some common codes for BIOS auto-parser to hda_auto_parser.c - Changed the PM resume code to wake up immediately for buggy BIOS - Creative SoundCore3D support - Add Conexant CX20751/2/3/4 codec support * ASoC - Dynamic PCM support, allowing support for SoCs with internal routing through components with tight sequencing and formatting constraints within their internal paths or where there are multiple components connected with CPU managed DMA controllers inside the SoC. - Greatly improved support for direct digital links between off-SoC devices, providing a much simpler way of connecting things like digital basebands to CODECs. - Much more fine grained and robust locking, cleaning up some of the confusion that crept in with multi-component. - CPU support for nVidia Tegra 30 I2S and audio hub controllers and ST-Ericsson MSP I2S controolers - New CODEC drivers for Cirrus CS42L52, LAPIS Semiconductor ML26124, Texas Instruments LM49453. - Some regmap changes needed by the Tegra I2S driver. - mc13783 audio support. * Misc - Rewrite with module_pci_driver() - Xonar DGX support for snd-oxygen - Improvement of packet handling in snd-firewire driver - New USB-endpoint streaming logic - Enhanced M-audio FTU quirks and relevant cleanups - Increment the support of OSS devices to 256 - snd-aloop accuracy improvement There are a few more pending changes for 3.5, but they will be sent slightly later as partly depending on the changes of DRM." Fix up conflicts in regmap (due to duplicate patches, with some further updates then having already come in from the regmap tree). Also some fairly trivial context conflicts in the imx and mcx soc drivers. * tag 'sound-3.5' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (280 commits) ALSA: snd-usb: fix stream info output in /proc ALSA: pcm - Add proper state checks to snd_pcm_drain() ALSA: sh: Fix up namespace collision in sh_dac_audio. ALSA: hda/realtek - Fix unused variable compile warning ASoC: sh: fsi: enable chip specific data transfer mode ASoC: sh: fsi: call fsi_hw_startup/shutdown from fsi_dai_trigger() ASoC: sh: fsi: use same format for IN/OUT ASoC: sh: fsi: add fsi_version() and removed meaningless version check ASoC: sh: fsi: use register field macro name on IN/OUT_DMAC ASoC: tegra: Add machine driver for WM8753 codec ALSA: hda - Fix possible races of accesses to connection list array ASoC: OMAP: HDMI: Introduce codec ARM: mx31_3ds: Add sound support ASoC: imx-mc13783 cleanup mx31moboard: Add sound support ASoC: mc13783 codec cleanups ASoC: add imx-mc13783 sound support ASoC: Add mc13783 codec mfd: mc13xxx: add codec platform data ASoC: don't flip master of DT-instantiated DAI links ...
2012-05-12Merge remote-tracking branches 'regulator/topic/core', ↵Mark Brown
'regulator/topic/regmap' and 'regulator/topic/register' into regulator-next
2012-04-16ASoC: Merge tag 'v3.4-rc3' into for-3.5Mark Brown
Linux 3.4-rc3 contains a bunch of Tegra changes which are conflicting annoyingly with the new development that's going on for Tegra so merge it up to resolve those conflicts. Conflicts: sound/soc/soc-core.c sound/soc/tegra/tegra_i2s.c sound/soc/tegra/tegra_spdif.c
2012-04-09regulator: core: Use a struct to pass in regulator runtime configurationMark Brown
Rather than adding new arguments to regulator_register() every time we want to add a new bit of dynamic information at runtime change the function to take these via a struct. By doing this we avoid needing to do further changes like the recent addition of device tree support which required each regulator driver to be updated to take an additional parameter. The regulator_desc which should (mostly) be static data is still passed separately as most drivers are able to configure this statically at build time. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-04ASoC: codecs: Remove rtd->codec usage from CODEC driversMark Brown
In order to support CODEC<->CODEC links remove the assumption that there is only a single CODEC on a DAI link by removing the use of the CODEC pointer in the rtd from the CODEC drivers. They are already being passed their DAI whenever they are passed an rtd and can get the CODEC from there. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-04ASoC: sgtl5000: Convert to module_i2c_driver()Mark Brown
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-04ASoC: sgtl5000: Fix warning due to the lack of REGULATOR_CHANGE_VOLTAGEFabio Estevam
Fix the following warning during kernel boot: 0-000a: 850 <--> 1600 mV at 1200 mV normal 0-000a: Voltage range but no REGULATOR_CHANGE_VOLTAGE Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-02ASoC: sgtl5000: Enable VAG when DAC/ADC upZeng Zhaoming
As manual described, VAG is an internal voltage reference of DAC/ADC, So enabled it before DAC/ADC up. One more thing should care about is VAG fully ramped down requires 400ms, wait it to avoid pop. Signed-off-by: Zeng Zhaoming <zengzm.kernel@gmail.com> Signed-off-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-01ASoC: sgtl5000: Convert mic bias to a supply widgetMark Brown
No current users and it's the last user of MICBIAS_E(). Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Dong Aisheng <dong.aisheng@linaro.org> Acked-by: Zeng Zhaoming <zengzm.kernel@gmail.com> Tested-by: Shawn Guo <shawn.guo@linaro.org>
2012-01-23ASoC: sgtl5000: It's sgtl5000 not sgtl500Mark Brown
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-01-22ASoC: sgtl5000: Convert to table based DAPM and control initFabio Estevam
Convert to table based DAPM and control init. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-01-20ASoC: sgtl5000: Print revision number in hexFabio Estevam
Throughout the sgtl5000 driver source code and also in the sgtl5000 datasheet the revision code is shown in hexadecimal. Print it hex format, for consistency. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-01-20ASoC: sgtl5000: Fix wrong register name in restoreZeng Zhaoming
Correct SGTL5000_CHIP_CLK_CTRL to SGTL5000_CHIP_REF_CTRL in sgtl5000_restore_regs(), and add comment to explain the restore order. Reported-by: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Zeng Zhaoming <zengzm.kernel@gmail.com> Acked-by: Dong Aisheng <dong.aisheng@linaro.org> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-01-18Merge branch 'fix/asoc' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound * 'fix/asoc' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: ASoC: Wait for WM8993 FLL to stabilise ASoC: core - Free platform DAPM context at platform removal. ASoC: dapm - Fix check for codec context in dapm_power_widgets(). ASoC: sgtl5000: update author email address ASoC: Fix DMA channel leak in imx-pcm-dma-mx2 driver.
2012-01-16ASoC: sgtl5000: update author email addressZeng Zhaoming
Update MODULE_AUTHOR email address. Signed-off-by: Zeng Zhaoming <zengzm.kernel@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-01-12Merge branch 'for-linus' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (526 commits) ASoC: twl6040 - Add method to query optimum PDM_DL1 gain ALSA: hda - Fix the lost power-setup of seconary pins after PM resume ALSA: usb-audio: add Yamaha MOX6/MOX8 support ALSA: virtuoso: add S/PDIF input support for all Xonars ALSA: ice1724 - Support for ooAoo SQ210a ALSA: ice1724 - Allow card info based on model only ALSA: ice1724 - Create capture pcm only for ADC-enabled configurations ALSA: hdspm - Provide unique driver id based on card serial ASoC: Dynamically allocate the rtd device for a non-empty release() ASoC: Fix recursive dependency due to select ATMEL_SSC in SND_ATMEL_SOC_SSC ALSA: hda - Fix the detection of "Loopback Mixing" control for VIA codecs ALSA: hda - Return the error from get_wcaps_type() for invalid NIDs ALSA: hda - Use auto-parser for HP laptops with cx20459 codec ALSA: asihpi - Fix potential Oops in snd_asihpi_cmode_info() ALSA: hdsp - Fix potential Oops in snd_hdsp_info_pref_sync_ref() ALSA: hda/cirrus - support for iMac12,2 model ASoC: cx20442: add bias control over a platform provided regulator ALSA: usb-audio - Avoid flood of frame-active debug messages ALSA: snd-usb-us122l: Delete calls to preempt_disable mfd: Put WM8994 into cache only mode when suspending ... Fix up trivial conflicts in: - arch/arm/mach-s3c64xx/mach-crag6410.c: renamed speyside_wm8962 to tobermory, added littlemill right next to it - drivers/base/regmap/{regcache.c,regmap.c}: duplicate diff that had already come in with other changes in the regmap tree
2012-01-10Merge branch 'for-linus' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: (40 commits) regulator: set constraints.apply_uV to 0 in of_get_fixed_voltage_config regulator: max8925: fix enabled/disabled judgement mistake regulator: add regulator_bulk_force_disable function regulator: pass regulator_register of_node in fixed voltage driver regulator: add regulator_force_disable() definition for !CONFIG_REGULATOR regulator: Enable supply regulator if child rail is enabled. regulator: mc13892: Convert to devm_kzalloc() regulator: mc13783: Convert to devm_kzalloc() regulator: Fix checking return value of create_regulator regulator: Fix the error handling if create_regulator fails regulator: Export regulator_is_supported_voltage() regulator: mc13892: add device tree probe support regulator: mc13892: remove the unnecessary prefix from regulator name regulator: Convert wm831x regulator drivers to devm_kzalloc() regulator: da9052: Staticize non-exported symbols regulator: Replace kzalloc with devm_kzalloc and if-else with a switch-case for da9052-regulator regulator: Update da9052-regulator for DT changes regulator: DA9052/53 Regulator support regulator: pass device_node to of_get_regulator_init_data() regulator: If a single voltage is set with device tree then set apply_uV ...
2011-12-28ASoC: Convert sgtl5000 to use devm_kzalloc()Fabio Estevam
Convert sgtl5000 codec driver to use devm_kzalloc(). Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-12-28ASoC: sgtl5000: Fix voltage units in dev_err messageFabio Estevam
vdda, vddio and vddd are voltages expressed in milivolts (mV), so use the proper annotation. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-12-02ASoC: Drop unused state parameter from CODEC suspend callbackLars-Peter Clausen
The existence of this parameter is purely historical. None of the CODEC drivers uses it and we always pass in the same value anyway, so it should be safe to remove it. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Acked-by: Liam Girdwood <lrg@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-27ASoC: Remove unneeded platform_device.h inclusions from CODECsMark Brown
They've not been needed for a long time if they were ever required. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-23regulator: pass additional of_node to regulator_register()Rajendra Nayak
With device tree support for regulators, its needed that the regulator_dev->dev device has the right of_node attached. To be able to do this add an additional parameter to the regulator_register() api, wherein the dt-adapted driver can then pass this additional info onto the regulator core. Signed-off-by: Rajendra Nayak <rnayak@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-23ASoC: Constify snd_soc_dai_ops structsLars-Peter Clausen
Commit 1ee46ebd("ASoC: Make the DAI ops constant in the DAI structure") introduced the possibility to have constant DAI ops structures, yet this is barley used in both existing drivers and also new drivers being submitted, although none of them modifies its DAI ops structure. The later is not surprising since existing drivers are often used as templates for new drivers. So this patch just constifies all existing snd_soc_dai_ops structs to eliminate the issue altogether. The patch was generated with the following coccinelle semantic patch: // <smpl> @@ identifier ops; @@ -struct snd_soc_dai_ops ops = +const struct snd_soc_dai_ops ops = { ... }; // </smpl> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-20ASoC: sgtl5000: fix DB_RANGE sizeClemens Ladisch
Give the correct number of entries to TLV_DB_RANGE_HEAD to prevent reading more data than actually is in the array. Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2011-10-22ASoC: sgtl5000: Fix wrong mask in some snd_soc_update_bits callsAxel Lin
Ensure all mask bits are clear before setting new value. Signed-off-by: Axel Lin <axel.lin@gmail.com> Acked-by: Dong Aisheng <b29396@freescale.com> Acked-by: Liam Girdwood <lrg@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-10-21ASoC: Use SGTL5000_LINREG_VDDD_MASK instead of hardcoded mask valueAxel Lin
We have defined SGTL5000_LINREG_VDDD_MASK in sgtl5000.h, use it instead of hardcoded (0x1 << 4) - 1 for the mask. Signed-off-by: Axel Lin <axel.lin@gmail.com> Acked-by: Wolfram Sang <w.sang@pengutronix.de> Acked-by: Liam Girdwood <lrg@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-10-21ASoC: Set sgtl5000->ldo in ldo_regulator_registerAxel Lin
Otherwise calling ldo_regulator_remove() does not unregister regulator and free memories. Signed-off-by: Axel Lin <axel.lin@gmail.com> Acked-by: Wolfram Sang <w.sang@pengutronix.de> Acked-by: Liam Girdwood <lrg@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-10-19ASoC: sgtl5000: Fix setting mic bias resistorAxel Lin
According to the datasheet: CHIP_MIC_CTRL 0x002A BITS[9:8] BIAS_RESISTOR 0x0 = Powerd off 0x1 = 2.0 kohm 0x2 = 4.0 kohm 0x3 = 8.0 kohm To set mic bias resistor, we need to update bits[9:8] of SGTL5000_CHIP_MIC_CTRL register. Signed-off-by: Axel Lin <axel.lin@gmail.com> Acked-by: Wolfram Sang <w.sang@pengutronix.de> Acked-by: Liam Girdwood <lrg@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-08-12ASoC: sgtl5000: fix module device table type for sgtl5000_dt_idsAxel Lin
The module device table for of_device_id should use "of" type. Signed-off-by: Axel Lin <axel.lin@gmail.com> Acked-by: Liam Girdwood <lrg@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-08-08Merge branch 'for-3.1' into for-3.2Mark Brown
Conflict due to the fix for the register map failure - taken the for-3.1 version. Conflicts: sound/soc/codecs/sgtl5000.c
2011-08-03ASoC: sgtl5000: fix cache handlingWolfram Sang
Cache handling in this driver is broken. The chip has 16-bit registers, yet the register numbers also increase by 2 per register, i.e. there are only even-numbered registers. The cache in this driver, though, simply increments register numbers, so it does need some mapping as seen in sgtl5000_restore_regs(), note the '>> 1': snd_soc_write(codec, SGTL5000_CHIP_LINREG_CTRL, cache[SGTL5000_CHIP_LINREG_CTRL >> 1]); That, of course, won't work with snd_soc_update_bits(). (Thus, we won't even notice the missing register 0x1c in the default regs which shifted all follwing registers to wrong values.) Noticed on the MX28EVK where enabling the regulators simply locked up the chip. Refactor the routines and use a properly sized default_regs array which matches the register layout of the underlying chip, i.e. create a truly flat cache. This also saves some code which should make up for the bigger array a little. When soc-core will somewhen have another cache type which handles a step size, this conversion will also ease the transition. Signed-off-by: Wolfram Sang <w.sang@pengutronix.de> Tested-by: Dong Aisheng <b29396@freescale.com> Tested-by: Shawn Guo <shawn.guo@linaro.org> Acked-by: Liam Girdwood <lrg@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Cc: stable@kernel.org