path: root/sound
AgeCommit message (Collapse)Author
2019-09-09apalis/colibri t30: fix record/playback for sgtl5000 codecOleksandr Suvorov
Backported commit f997df18c0e4c988de49e984329cefdf6e13ed86 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-t30:~# 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] Signed-off-by: Oleksandr Suvorov <>
2019-09-09ASoC: sgtl5000: add helpers to calculate mclkOleksandr Suvorov
Calculate SYS_MCLK using sample rate or SYS_FS. These helpers allow to simplify a code to set up external system clock for different sample rates. Signed-off-by: Oleksandr Suvorov <>
2019-09-09ASoC: sgtl5000: Fix charge pump source assignmentOleksandr Suvorov
Backported commit 8326ab1285e71e24481d8e1eee3e72a6b3abbb38 If VDDA != VDDIO and any of them is greater than 3.1V, charge pump source can be assigned automatically [1]. [1] Signed-off-by: Oleksandr Suvorov <> Reviewed-by: Marcel Ziswiler <> Reviewed-by: Igor Opaniuk <> Reviewed-by: Fabio Estevam <>
2019-09-09ASoC: sgtl5000: Fix of unmute outputs on probOleksandr Suvorov
Backported commit 8337f764b45e122bd17b8c84b7ac26da3086fe26 To enable "zero cross detect" for ADC/HP, change HP_ZCD_EN/ADC_ZCD_EN bits only instead of writing the whole CHIP_ANA_CTRL register. Signed-off-by: Oleksandr Suvorov <> Reviewed-by: Marcel Ziswiler <> Reviewed-by: Igor Opaniuk <> Reviewed-by: Fabio Estevam <>
2019-09-09ASoC: sgtl5000: add ADC/HP/LINEOUT mute controlOleksandr Suvorov
Backported from commit 19a1d41649f695658a67898dcb9312de02878eb1. This control mute/unmute the ADC input of SGTL5000 using its CHIP_ANA_CTRL register. Tuned: add Headphone and Line-Out mute/unmute controlling. Signed-off-by: Oleksandr Suvorov <> Reviewed-by: Marcel Ziswiler <> Reviewed-by: Igor Opaniuk <> Reviewed-by: Fabio Estevam <>
2019-09-09ASoC: sgtl5000: Fix definition of VAG Ramp ControlOleksandr Suvorov
Backported from commit 55e23d488cd1367638ee304bd8bb6210f53d13db. SGTL5000_SMALL_POP is a bit mask, not a value. Usage of correct definition makes device probing code more clear. Signed-off-by: Oleksandr Suvorov <> Reviewed-by: Marcel Ziswiler <> Reviewed-by: Igor Opaniuk <> Reviewed-by: Fabio Estevam <>
2019-09-09ASoC: sgtl5000: Improve VAG power and mute controlOleksandr Suvorov
Backported from commit e6e98e2e05baa3862ac7d1d2334f88ec927c8f66. VAG power control is improved to fit the manual [1]. This patch fixes as minimum one bug: if customer muxes Headphone to Line-In right after boot, the VAG power remains off that leads to poor sound quality from line-in. I.e. after boot: - Connect sound source to Line-In jack; - Connect headphone to HP jack; - Run following commands: $ amixer set 'Headphone' 80% $ amixer set 'Headphone Mux' LINE_IN Change VAG power on/off control according to the following algorithm: - turn VAG power ON on the 1st incoming event. - keep it ON if there is any active VAG consumer (ADC/DAC/HP/Line-In). - turn VAG power OFF when there is the latest consumer's pre-down event come. - always delay after VAG power OFF to avoid pop. - delay after VAG power ON if the initiative consumer is Line-In, this prevents pop during line-in muxing. According to the data sheet [1], to avoid any pops/clicks, the outputs should be muted during input/output routing changes. [1] Fixes: 9b34e6cc3bc2 ("ASoC: Add Freescale SGTL5000 codec support") Signed-off-by: Oleksandr Suvorov <> Reviewed-by: Marcel Ziswiler <> Reviewed-by: Fabio Estevam <>
2016-09-29asoc: tegra: fix gcc-6 compilationMarcel Ziswiler
sound/soc/tegra/tegra30_dam.c: In function 'tegra30_dam_probe': sound/soc/tegra/tegra30_dam.c:620:3: error: this 'if' clause does not guard... [-Werror=misleading-indentation] if ((i == TEGRA30_DAM_CTRL_RSVD_6) || ^~ sound/soc/tegra/tegra30_dam.c:624:4: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'if' dam->reg_cache[i] = ^~~ Signed-off-by: Marcel Ziswiler <> Acked-by: Max Krummenacher <>
2015-05-13ASoC: sgtl5000: Fix SMALL_POP bit definitionColibri_T30_LinuxImageV2.4Beta1_20150518Colibri_T20_LinuxImageV2.4Beta1_20150518Apalis_T30_LinuxImageV2.4Beta1_20150518Fabio Estevam
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 <> Signed-off-by: Mark Brown <> Cc: (cherry picked from commit c251ea7bd7a04f1f2575467e0de76e803cf59149)
2015-05-13ASoC: sgtl5000: remove useless register write clearingEric Nelson
CHRGPUMP_POWERUP The SGTL5000_CHIP_ANA_POWER register is cached. Update the cached value instead of writing it directly. Upstream-status: sent Signed-off-by: Eric Nelson <> (cherry picked from commit 309abdeda8c9331013f25b1a1209d9ce8334237b) (cherry picked from commit 8a8b303a7431e66a7ec6ec52bc0e04ed0a1335d0)
2014-09-16ASoC: sgtl5000: Fix the cache handlingFabio Estevam
Since commit e5d80e82e32e (ASoC: sgtl5000: Convert to use regmap directly) a kernel oops is observed after a suspend/resume sequence. The kernel oops happens inside sgtl5000_restore_regs() as codec->reg_cache is no longer a valid pointer. Add the remaining register entries into sgtl5000_reg_defaults[] and remove sgtl5000_restore_regs() completely, which allows suspend/resume to work fine and make the code simpler. Tested on a im53-qsb board. Reported-by: Shawn Guo <> Signed-off-by: Fabio Estevam <> Tested-by: Shawn Guo <> Signed-off-by: Mark Brown <> (cherry picked from commit 29aa37cddfb9b721013ff28608200d73a9426368)
2014-09-16ASoC: sgtl5000: fix codec clock source transition to avoid clockless momentOskar Schirmer
Powering down PLL before switching to a mode that does not use it is a bad idea. It would cause the SGTL5000 be without internal clock supply, especially on the I2C interface, which would make subsequent access to it fail. Thus, in case of not using PLL any longer, first set the mode control, then power down PLL. Signed-off-by: Oskar Schirmer <> Signed-off-by: Mark Brown <> (cherry picked from commit e06e4c2d530fd4995c41083009647263ccd77d3b)
2014-09-16ASoC: sgtl5000: fix buggy 'Capture Attenuate Switch' controlLothar Waßmann
The SGTL5000 Capture Attenuate Switch (or "ADC Volume Range Reduction" as it is called in the manual) is single bit only. Signed-off-by: Lothar Waßmann <> Reviewed-by: Fabio Estevam <> Signed-off-by: Mark Brown <> (cherry picked from commit 65f2b226763bc348a9b9145aa5e17e7e3f6d8c35)
2014-09-16ASoC: sgtl5000: prevent playback to be muted when terminating concurrent captureLothar Waßmann
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 <> Reviewed-by: Fabio Estevam <> Signed-off-by: Mark Brown <> (cherry picked from commit f091f3f07328f75d20a2a5970d1f8b58d95fc990)
2014-09-16ASoC: sglt5000: Fix the default value of CHIP_SSS_CTRLFabio Estevam
According to the sgtl5000 reference manual, the default value of CHIP_SSS_CTRL is 0x10. Reported-by: Oskar Schirmer <> Signed-off-by: Fabio Estevam <> Signed-off-by: Mark Brown <> Cc: (cherry picked from commit 016fcab8ff46fca29375d484226ec91932aa4a07)
2014-09-16ASoC: sgtl5000: Fix VAG_POWER enabling/disabling orderMarek Vasut
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 <> Signed-off-by: Mark Brown <> (cherry picked from commit dd4d2d6dfb49e8916064f2cb07f0ad7b32a82fb7)
2014-09-16ASoC: sgtl5000: Fix driver probe after resetFabio Estevam
After a 'reboot' command in Linux or after pressing the system's reset button the sgtl5000 driver fails to probe: sgtl5000 0-000a: Device with ID register ffff is not a sgtl5000 sgtl5000 0-000a: ASoC: failed to probe CODEC -19 imx-sgtl5000 sound.12: ASoC: failed to instantiate card -19 imx-sgtl5000 sound.12: snd_soc_register_card failed (-19) sgtl5000 codec does not have a reset line, nor a reset command in software, so after a system reset the codec does not contain the default register values from sgtl5000_reg_defaults[] anymore, as these are only valid after a power-on-reset cycle. Fix this issue by explicitly reading all the reset register values from sgtl5000_reg_defaults[] and writing them back into sgtl5000 to ensure a sane state. Signed-off-by: Fabio Estevam <> Tested-by: Eric Nelson <> Signed-off-by: Mark Brown <> (cherry picked from commit af8ee11209e749c75eabf32b2a4ca631f396acf8) Conflicts: sound/soc/codecs/sgtl5000.c
2014-07-26Revert "asoc: tegra20_ac97: fix sampling rate"Marcel Ziswiler
This reverts commit f162e88fc6aac0fef03c49c1ac596995a03ff134. Somehow NVIDIA's media player does not like it to be fixed as it starts stuttering like crazy at times. Still keep the dangerous time out handling clean-up. While at it get rid of the excessive dev_info() logging as well.
2014-07-25apalis/colibri t30: use hda hdmi audio and split sound initMarcel Ziswiler
Use HDA HDMI audio now on Colibri T30 as well allowing for up to 7.1 multi-channel playback. Split board sound initialisation between Apalis and Colibri T30 in order to distinguish better between default SPDIF being supported out-of-the-box on Apalis vs. this being an optional feature for the Colibri. Therefore remove SPDIF for the Colibri T30. While at it add csus clock required for vi_sensor camera master clock on Apalis T30 and clk_out_2/extern2 for Colibri T30, fix debug UART1 initialisation, get rid of spurious CONFIG_SND_USB enable and further clean-up both board platform data files.
2014-07-25apalis/colibri t30: make hda 2nd sound card hackMarcel Ziswiler
Hack HDA driver to make it the 2nd rather than the first sound card as the first one should be the SGTL5000 which is always present on our T30 modules. Especially on Ixora where there is no HDA codec on the carrier board HDA being the first sound card does not make much sense even more though as there was no primary device (e.g. device=hw:0,0).
2014-07-23apalis/colibri t30: fix issue with slow spdif clockMarcel Ziswiler
Fix issue with slow SPDIF clock by just doubling desired rate prior to doing any further calculations on it. BTW: A proper fix might involve overall clock doubler configuration.
2014-07-08asoc: tegra20_ac97: fix sampling rateMarcel Ziswiler
The AC97 sampling rate is really fixed to 48 kHz at all times. While at it clean-up dangerous time out handling.
2014-07-08Linux playback channel fixDaniel Kochmanski
2014-07-08AC97 working capture deviceDaniel Kochmanski
2013-11-12ASoC: colibri_t20: Fix device registrationStefan Agner
Fix errors when registration fails, correctly unregister the platform device.
2013-06-24alsa: hda: silence extensive HDMI HDA audio messagesMarcel Ziswiler
Avoid extensive HDMI messages during boot. [ 30.234829] HDMI hot plug event: Codec=3 Pin=5 Presence_Detect=1 ELD_Valid=0 [ 30.253652] HDMI status: Codec=3 Pin=5 Presence_Detect=1 ELD_Valid=1 [ 32.333657] HDMI: detected monitor SyncMaster at connection type HDMI [ 32.340116] HDMI: available speakers: FL/FR [ 32.344616] HDMI: supports coding type LPCM: channels = 2, rates = 44100 48000 88200, bits = 16 20 24
2013-03-14apalis_t30: Realtek HDA hackApalis_T30_LinuxImageV2.0Alpha1_20130315Marcel Ziswiler
Hack for Realtek HDA driver not to crash due to PCI structure not being initialised as expected.
2013-03-03Conflicts:Marcel Ziswiler
arch/arm/mach-tegra/common.c drivers/ata/ahci-tegra.c
2013-01-24asoc: colibri_t30: prepare for apalis_t30 interoperabilityMarcel Ziswiler
Prepare Kconfig for Colibri T30 ALSA SoC SGTL5000 board driver to be usable on Apalis T30 as well.
2013-01-21ASoC: sgtl5000: Fix maximum value for microphone gainT30_LinuxImageV2.0Alpha1_20130122Fabio 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 <> Signed-off-by: Fabio Estevam <> Signed-off-by: Mark Brown <>
2013-01-21ASoC: 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 <> Signed-off-by: Mark Brown <>
2013-01-21ASoC: 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 <> Signed-off-by: Zeng Zhaoming <> Acked-by: Dong Aisheng <> Signed-off-by: Mark Brown <>
2013-01-21ASoC: 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 <> Signed-off-by: Shawn Guo <> Signed-off-by: Mark Brown <>
2013-01-21ASoC: 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 <>
2013-01-21ASoC: 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 <> Acked-by: Dong Aisheng <> Acked-by: Liam Girdwood <> Signed-off-by: Mark Brown <>
2013-01-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 <> Acked-by: Wolfram Sang <> Acked-by: Liam Girdwood <> Signed-off-by: Mark Brown <>
2013-01-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 <> Acked-by: Wolfram Sang <> Acked-by: Liam Girdwood <> Signed-off-by: Mark Brown <>
2013-01-21ASoC: 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 <> Acked-by: Wolfram Sang <> Acked-by: Liam Girdwood <> Signed-off-by: Mark Brown <>
2013-01-21ASoC: sgtl5000: Fix define for SGTL5000_BIAS_R_MASKAxel 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 Thus SGTL5000_BIAS_R_MASK should be defined as 0x0300 instead of 0x0200. Signed-off-by: Axel Lin <> Acked-by: Wolfram Sang <> Acked-by: Liam Girdwood <> Signed-off-by: Mark Brown <>
2013-01-21ASoC: 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 <> Acked-by: Liam Girdwood <> Signed-off-by: Mark Brown <>
2013-01-21Conflict due to the fix for the register map failure - taken the for-3.1 ↵Mark Brown
version. Conflicts: sound/soc/codecs/sgtl5000.c
2012-12-17ARM: tegra3: pm315/beaver: enable Realtek ALC5640 audio codec supportBryan Wu
- select RT5640 ASoC support in Cardhu machine Kconfig - enable RT5640 ASoC driver in tegra3_defconfig - select RT5639 ASoC codec when selecting RT5640, othwise kernel linking will fail Bug 1190823 Change-Id: I1046c30667d4ca8276080f1b3174eccd0b25328c Signed-off-by: Bryan Wu <> Reviewed-on: http://git-master/r/168884 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Winnie Hsu <>
2012-11-15colibri_t30: integration of i2s slave mode supportMarcel Ziswiler
Add configurability support for i2s parameters. See 907bac80691c7df5b5b57cbf27f91e8bb1dcf434.
2012-11-12Merge branch 'l4t/l4t-r16-r2' into colibriMarcel Ziswiler
Conflicts: arch/arm/mach-tegra/tegra3_usb_phy.c arch/arm/mach-tegra/usb_phy.c drivers/usb/gadget/tegra_udc.c drivers/usb/otg/Makefile drivers/video/tegra/fb.c sound/soc/tegra/tegra_pcm.c
2012-10-09asoc: tegra: WAR: Check AVP id before setting DMAShashank Sharma
WAR to check souncard data's avp_id before trying to set DMA address. An invalid avp_id can cause invlaid rtd, causing panic in control ioctl calls. Bug 1046249 Bug 1044761 Bug 1049940 Bug 1050152 Change-Id: Ib536220fdb92f8256c777d6fa14b66e47bc6b7be Signed-off-by: Shashank Sharma <> Reviewed-on: http://git-master/r/134426 (cherry picked from commit 007fd7b1ae101c5be2a3d35ad11e7190862c04ca) Reviewed-on: http://git-master/r/142493 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Tested-by: Matthew Pedro <> Reviewed-by: Winnie Hsu <>
2012-10-03asoc: colibri_t30: initial sgtl5000 codec integrationMarcel Ziswiler
Integrate ALSA SoC SGTL5000 codec on Toradex Colibri T30.
2012-10-01asoc: tegra20_ac97: remove tegra_gpio_enb/disableMarcel Ziswiler
Removing tegra_gpio_enable and disable calls as they are supported through set direction calls in the driver.
2012-09-25asoc: colibri_t20: activate microphone biasMarcel Ziswiler
Activate microphone bias which is used to enable microphone ground on Colibri T20.
2012-09-10Merge branch 'l4t/l4t-r16' into colibriMarcel Ziswiler
Merge with latest NVIDIA L4T R16. Only real conflict concerning inverted VBUS gpio support.
2012-09-04ASoC: Tegra: Add ALSA ctl to set DMA addressSumit Bhattacharya
Add support for setting of DMA address through alsa control for AVP rendering. This is required to directly do DMA from IRAM to I2S. Bug 1024403 Change-Id: I6b79ae6e9a562160a19d238b817e1a8b407ac208 Signed-off-by: Sumit Bhattacharya <> Reviewed-on: http://git-master/r/127436 (cherry picked from commit f270f46bef98a56f44432e608041adb617c22559) Signed-off-by: Chandrakanth Gorantla <> Change-Id: I195aae9043f967273283579f44d5367fe73d542f Reviewed-on: http://git-master/r/129159 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Scott Peterson <>