summaryrefslogtreecommitdiff
path: root/sound/soc/codecs/tlv320adcx140.c
AgeCommit message (Collapse)AuthorFilesLines
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
2023-02-13ASoC: tlv320adcx140: fix 'ti,gpio-config' DT property initSteffen Aschbacher1-1/+1
When the 'ti,gpio-config' property is not defined, the device_property_count_u32() will return an error, rather than zero. The current check, only handles a return value of zero, which assumes that the property is defined and has nothing defined. This change extends the check to also check for an error case (most likely to be hit by the case that the 'ti,gpio-config' is not defined). In case that the 'ti,gpio-config' and the returned 'gpio_count' is not correct, there is a 'if (gpio_count != ADCX140_NUM_GPIO_CFGS)' check, a few lines lower that will return -EINVAL. This means that someone tried to define 'ti,gpio-config', but with the wrong number of GPIOs. Fixes: d5214321498a ("ASoC: tlv320adcx140: Add support for configuring GPIO pin") Signed-off-by: Steffen Aschbacher <steffen.aschbacher@stihl.de> Signed-off-by: Alexandru Ardelean <alex@shruggie.ro> Link: https://lore.kernel.org/r/20230213073805.14640-1-alex@shruggie.ro Signed-off-by: Mark Brown <broonie@kernel.org>
2022-08-17ASoC: tlv320adcx140: Add a new kcontrolKevin Lu1-0/+59
Add a new kcontrol for phase calib Signed-off-by: Kevin Lu <luminlong@139.com> Link: https://lore.kernel.org/r/20220815112715.21617-1-luminlong@139.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-07-11ASoC: Merge up fixesMark Brown1-7/+6
Needed for the Rockchip driver.
2022-07-07ASoC: tlv320adcx140: Fix tx_mask checkSascha Hauer1-7/+6
The tx_mask check doesn't reflect what the driver and the chip support. The check currently checks for exactly two slots being enabled. The tlv320adcx140 supports anything between one and eight channels, so relax the check accordingly. The tlv320adcx140 supports arbitrary tx_mask settings, but the driver currently only supports adjacent slots beginning with the first slot, so extend the check to check that the first slot is being used and that there are no holes in the tx_mask. Leave a comment to make it's the driver that limits the tx_mask settings, not the chip itself. While at it remove the set-but-unused struct adcx140p_priv::tdm_delay field. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.kernel.org/r/20220624105716.2579539-1-s.hauer@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org>
2022-06-27ASoC: tlv320*: 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-63-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-06-06ASoC: tlv320adcx140: Use modern ASoC DAI format terminologyMark Brown1-6/+4
As part of moving to remove the old style defines for the bus clocks update the tlv320adcx140 driver to use more modern terminology for clocking. Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20220602135316.3554400-15-broonie@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
2022-05-10ASoC: tlv320adcx140: Register a callback to disable the regulator_disableZheyu Ma1-0/+11
The driver should register a callback that will deal with the disabling when it fails to probe. Signed-off-by: Zheyu Ma <zheyuma97@gmail.com> Link: https://lore.kernel.org/r/20220510053031.1685337-1-zheyuma97@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-04-11ASoC: tlv320*: 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/20220405165836.2165310-13-steve@sk2.org Signed-off-by: Mark Brown <broonie@kernel.org>
2021-01-21ASoC: tlv*: sync parameter naming (rate/sample_bits)Kuninori Morimoto1-1/+1
This patch syncs naming rule. - xxx_rates; + xxx_rate; - xxx_samplebits; + xxx_sample_bits; Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87bldqolgw.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-11-26ASoC: tlv320: skip of_device_id table when !CONFIG_OFKrzysztof Kozlowski1-0/+2
The driver can match by multiple methods. Its of_device_id table is referenced via of_match_ptr() so it will be unused for !CONFIG_OF builds: sound/soc/codecs/tlv320aic23-i2c.c:38:34: warning: ‘tlv320aic23_of_match’ defined but not used [-Wunused-const-variable=] sound/soc/codecs/tlv320adcx140.c:1076:34: warning: ‘tlv320adcx140_of_match’ defined but not used [-Wunused-const-variable=] Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Link: https://lore.kernel.org/r/20201125164452.89239-32-krzk@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-18ASoC: tlv320adcx140: Add support for configuring GPIO pinCamel Guo1-0/+40
Add support to configure the GPIO pin to the specific configuration. The GPIO pin can be configured as GPO, IRQ, SDOUT2, PDMCLK, MICBASE_EN, GPI, MCLK, SDIN, PDMDIN1, PDMDIN2, PDMDIN3 or PDMDIN4 and the output drive can be configured with various configuration. Signed-off-by: Camel Guo <camelg@axis.com> Link: https://lore.kernel.org/r/20200918114025.18205-2-camel.guo@axis.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-17ASoC: tlv320adcx140: Add the config to configure Tx ASI outputDan Murphy1-0/+11
Add code to allow the ASI Tx output to be placed into High-z mode during unused ASI cycles. This allows for other devices that may be on the bus to drive the ASI out. By default the 320adcx140 sends 0's for unused cycles. Signed-off-by: Dan Murphy <dmurphy@ti.com> Link: https://lore.kernel.org/r/20200915190606.1744-4-dmurphy@ti.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-17Merge branch 'asoc-5.9' into asoc-5.10Mark Brown1-46/+71
2020-09-17ASoC: tlv320adcx140: Fix BCLK inversion for DSP modesDan Murphy1-21/+23
Fix the BCLK inversion for DSP modes This is how it is defined by ASoC: * BCLK: * - "normal" polarity means signal is available at rising edge of BCLK * - "inverted" polarity means signal is available at falling edge of BCLK The adcx140 defines the BCLK edge based on coding type. The PCM (DSP_A/B) should drive on rising and sample on falling edge, so from ASoC pov, it is IB_NF. But from the codec pov if it is configured in DSP mode, then the BCLK should not be inverted, defaults to the coding standard. For i2s, it is NB_NF from ASoC pov (drive on falling, sample on rising). >From the codec's pov BCLK should not invert either, as this is the default for the coding. So, inversion must take the format into account: IB_NF + DSP_A/B == the codec bclk inversion should be disabled NB_NF + DSP_A/B == the codec bclk inversion should be enabled NB_NF + I2S == the codec bclk inversion should be disabled Signed-off-by: Dan Murphy <dmurphy@ti.com> Link: https://lore.kernel.org/r/20200915190606.1744-2-dmurphy@ti.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-17ASoC: tlv320adcx140: Idle the device while writing registersDan Murphy1-11/+32
It was observed that if the device was active and register writes were performed there were some unwanted behaviors particularly when writing the word length and some filter options. So when writing to the device the device should be placed in sleep mode and then exit sleep mode once the register update is complete. Signed-off-by: Dan Murphy <dmurphy@ti.com> Link: https://lore.kernel.org/r/20200915190606.1744-1-dmurphy@ti.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-17ASoC: tlv320adcx140: Fix digital gain rangeCamel Guo1-1/+1
According to its datasheet, the digital gain should be -100 dB when CHx_DVOL is 1 and 27 dB when CHx_DVOL is 255. But with the current dig_vol_tlv, "Digital CHx Out Volume" shows 27.5 dB if CHx_DVOL is 255 and -95.5 dB if CHx_DVOL is 1. This commit fixes this bug. Fixes: 689c7655b50c ("ASoC: tlv320adcx140: Add the tlv320adcx140 codec driver family") Signed-off-by: Camel Guo <camelg@axis.com> Link: https://lore.kernel.org/r/20200908090417.16695-1-camel.guo@axis.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-08ASoC: tlv320adcx140: Wake up codec before accessing registerCamel Guo1-12/+12
According to its datasheet, after reset this codec goes into sleep mode. In this mode, any register accessing should be avoided except for exiting sleep mode. Hence this commit moves SLEEP_CFG access before any register accessing. Signed-off-by: Camel Guo <camelg@axis.com> Acked-by: Dan Murphy <dmurphy@ti.com> Link: https://lore.kernel.org/r/20200908083521.14105-2-camel.guo@axis.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-01ASoC: tlv320adcx140: Fix accessing uninitialized adcx140->devCamel Guo1-1/+3
In adcx140_i2c_probe, adcx140->dev is accessed before its initialization. This commit fixes this bug. Fixes: 689c7655b50c ("ASoC: tlv320adcx140: Add the tlv320adcx140 codec driver family") Acked-by: Dan Murphy <dmurphy@ti.com> Signed-off-by: Camel Guo <camel.guo@axis.com> Link: https://lore.kernel.org/r/20200901135736.32036-1-camel.guo@axis.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-08-28ASoC: tlv320adcx140: Add digital mic channel enable routingDan Murphy1-0/+37
Add the audio routing map to enable the digital mic paths when the analog mic paths are not enabled. Signed-off-by: Dan Murphy <dmurphy@ti.com> Link: https://lore.kernel.org/r/20200828112855.10112-1-dmurphy@ti.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-30ASoC: tlv320adcx140: Move device reset to before programmingDan Murphy1-4/+4
Reset the device before programming the registers or all programming will be lost as the device resets registers to default settings. Signed-off-by: Dan Murphy <dmurphy@ti.com> Link: https://lore.kernel.org/r/20200730142419.28205-2-dmurphy@ti.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-30ASoC: tlv320adcx140: Fix GPO register start addressDan Murphy1-1/+1
The header was updated to align with the data sheet to start the GPO_CFG at GPO_CFG0. The code was not updated to the change and therefore the GPO_CFG0 register was not written to. Fixes: 6617cff6a05e ("ASoC: tlv320adcx140: Add GPO configuration and drive output config") Signed-off-by: Dan Murphy <dmurphy@ti.com> Link: https://lore.kernel.org/r/20200730142419.28205-1-dmurphy@ti.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-29ASoC: tlv320adcx140: Add GPO configuration and drive output configDan Murphy1-1/+49
Add General Purpose Output (GPO) configuration and driver output configuration. The GPOs can be configured as a GPO, IRQ, SDOUT or a PDMCLK output. In addition the output drive can be configured with various configurations. Signed-off-by: Dan Murphy <dmurphy@ti.com> Link: https://lore.kernel.org/r/20200728160833.24130-2-dmurphy@ti.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-29ASoC: tlv320adcx140: Fix various style errors and warningsDan Murphy1-6/+6
Fix white space issues and remove else case where it was not needed. Convert "static const char *" to "static const char * const" Fixes: 689c7655b50 ("ASoC: tlv320adcx140: Add the tlv320adcx140 codec driver family") Signed-off-by: Dan Murphy <dmurphy@ti.com> Link: https://lore.kernel.org/r/20200728164339.16841-1-dmurphy@ti.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-22ASoC: Replace HTTP links with HTTPS onesAlexander A. Klimov1-1/+1
Rationale: Reduces attack surface on kernel devs opening the links for MITM as HTTPS traffic is much harder to manipulate. Deterministic algorithm: For each file: If not .svg: For each line: If doesn't contain `\bxmlns\b`: For each link, `\bhttp://[^# \t\r\n]*(?:\w|/)`: If neither `\bgnu\.org/license`, nor `\bmozilla\.org/MPL\b`: If both the HTTP and HTTPS versions return 200 OK and serve the same content: Replace HTTP with HTTPS. Signed-off-by: Alexander A. Klimov <grandmaster@al2klimov.de> Acked-by: Rob Herring <robh@kernel.org> Link: https://lore.kernel.org/r/20200719153822.59788-1-grandmaster@al2klimov.de Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-10ASoC: tlv320adcx140: Add tx offset slot programmingDan Murphy1-30/+10
Add the TX offset slot programming. There is no RX offset slot register. Since there is no RX offset the check for slot symmetry can be removed. Signed-off-by: Dan Murphy <dmurphy@ti.com> Link: https://lore.kernel.org/r/20200709185129.10505-2-dmurphy@ti.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-10ASoC: tlv320adcx140: Add ASI enable for channel 5-8Dan Murphy1-0/+22
Add the ALSA controls to enable the ASI for channels 5-8 Signed-off-by: Dan Murphy <dmurphy@ti.com> Link: https://lore.kernel.org/r/20200709185129.10505-1-dmurphy@ti.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-05-27ASoC: tlv320adcx140: Fix warnings when using W=1Dan Murphy1-5/+3
Fix the warnings when using the W=1 compiler flag. sound/soc/codecs/tlv320adcx140.c: In function ‘adcx140_reset’: sound/soc/codecs/tlv320adcx140.c:570:6: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable] 570 | int ret = 0; | ^~~ This was set but only used in case where the reset GPIO is not defined. Have the function return the value of ret. sound/soc/codecs/tlv320adcx140.c: In function ‘adcx140_codec_probe’: sound/soc/codecs/tlv320adcx140.c:778:18: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits] 778 | if (bias_source < ADCX140_MIC_BIAS_VAL_VREF || | ^ sound/soc/codecs/tlv320adcx140.c:789:18: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits] 789 | if (vref_source < ADCX140_MIC_BIAS_VREF_275V || This condition will not occur since if the dt property is not set then the *_source variable is set to the default value. So there is no way that *_source can be less then 0. Which is what each #define is set to. The code just needs to make sure that the dt property is not out of the upper bounds. Reported-by: kbuild test robot <lkp@intel.com> Signed-off-by: Dan Murphy <dmurphy@ti.com> Link: https://lore.kernel.org/r/20200526175247.15309-1-dmurphy@ti.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-05-27ASoC: tlv320adcx140: Add support for configuring GPI pinsDan Murphy1-0/+28
Add support to configure the GPI pins to the specific configuration. The pins can be disabled or be configured as data input for any of the digital mic channels. In addition the GPI can be used a a general purpose input, a Master clock input or an ASI input for daisy chaining devices. Signed-off-by: Dan Murphy <dmurphy@ti.com> Link: https://lore.kernel.org/r/20200526200917.10385-2-dmurphy@ti.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-05-14Merge branch 'for-5.7' of ↵Mark Brown1-6/+7
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-5.8
2020-05-14ASoC: tlv320adcx140: Configure PDM sampling edgeDan Murphy1-0/+22
Configure the PDM sampling edges based on the values from the firmware. Signed-off-by: Dan Murphy <dmurphy@ti.com> Link: https://lore.kernel.org/r/20200514123338.20392-3-dmurphy@ti.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-05-14ASoC: tlv320adcx140: Add controls for PDM clkDan Murphy1-0/+19
Add ALSA controls to configure the PDM clocks. The clocks need to be configurable to accommodate various microphones that use clocks for low power/low resolution modes to high power/high resolution modes. Signed-off-by: Dan Murphy <dmurphy@ti.com> Link: https://lore.kernel.org/r/20200514123338.20392-1-dmurphy@ti.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-05-13ASoC: tlv320adcx140: Fix bias config valuesDan Murphy1-6/+7
The device tree binding declares the ti,mic-bias-source and the ti,vref-source properties as u32. The code reads them as u8 which is incorrect. Since the device tree binding indicates them as u32 the conde needs to be updated to read u32. In addition the bias source needs to be shifted 4 bits to correctly write the register. driver family") Fixes: 37bde5acf040 ("ASoC: tlv320adcx140: Add the tlv320adcx140 codec Signed-off-by: Dan Murphy <dmurphy@ti.com> Link: https://lore.kernel.org/r/20200513142807.11802-1-dmurphy@ti.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-04-28ASoC: tlv320adcx140: Fix mic gain registersDan Murphy1-3/+3
Fix the mic gain registers for channels 2-4. The incorret register was being set as it was touching the CH1 config registers. Fixes: 37bde5acf040 ("ASoC: tlv320adcx140: Add the tlv320adcx140 codec driver family") Signed-off-by: Dan Murphy <dmurphy@ti.com> Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20200427203608.7031-1-dmurphy@ti.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-03-05ASoC: tlv320adcx140: Fix mic_bias and vref device tree verificationDan Murphy1-6/+4
Fix the range verification check for the mic_bias and vref device tree entries. Fixes 37bde5acf040 ("ASoC: tlv320adcx140: Add the tlv320adcx140 codec driver family") Signed-off-by: Dan Murphy <dmurphy@ti.com> Link: https://lore.kernel.org/r/20200304193427.16886-1-dmurphy@ti.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-02-21ASoC: tlv320adcx140: Add decimation filter supportDan Murphy1-0/+18
Add decimation filter selection support. Per Section 8.3.6.7 the Digital Decimation Filter is selectable between a Linear Phase, Low Latency, and Ultra Low Latency filer. Signed-off-by: Dan Murphy <dmurphy@ti.com> Link: https://lore.kernel.org/r/20200221181358.22526-2-dmurphy@ti.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-02-21ASoC: tlv320adcx140: Add DRE and AGC supportDan Murphy1-0/+55
The TLV320ADCx140 parts support Dynamic Range Enhancer (DRE) as defined in Section 8.3.2 of the data sheets. The DRE achieves a complete-channel dynamic range as high as 120 dB. At a system level, the DRE scheme enables far-field, high-fidelity recording of audio signals in very quiet environments and low-distortion recording in loud environments. There are 2 enables for DRE. The first is a global setting that enables the DRE engine in the device and the other enable is per channel. If the DRE is enabled globally then either DRE or AGC can be used per each configured channel. If global DRE is disabled then even setting the DRE enable bit in the channel config register will have no effect. Signed-off-by: Dan Murphy <dmurphy@ti.com> Link: https://lore.kernel.org/r/20200221181358.22526-1-dmurphy@ti.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-02-21ASoC: tlv320adcx140: Add the tlv320adcx140 codec driver familyDan Murphy1-0/+849
Add the tlv320adcx140 codec driver family. The TLV320ADCx140 is a Burr-Brown™ highperformance, audio analog-to-digital converter (ADC) that supports simultaneous sampling of up to four analog channels or eight digital channels for the pulse density modulation (PDM) microphone input. The device supports line and microphone inputs, and allows for both single-ended and differential input configurations. Signed-off-by: Dan Murphy <dmurphy@ti.com> Link: https://lore.kernel.org/r/20200220210759.31466-3-dmurphy@ti.com Signed-off-by: Mark Brown <broonie@kernel.org>