aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/cs42l42.h (follow)
AgeCommit message (Collapse)AuthorFilesLines
2021-10-25ASoC: cs42l42: Prevent NULL pointer deref in interrupt handlerRichard Fitzgerald1-1/+1
The interrupt handling code was getting the struct device* from a struct snd_soc_component* stored in struct cs42l42_private. If the interrupt was asserted before ASoC calls component_probe() the snd_soc_component* will be NULL. The stored snd_soc_component* is not actually used for anything other than indirectly getting the struct device*. Remove it, and store the struct device* in struct cs42l42_private. Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Link: https://lore.kernel.org/r/20211025112258.9282-1-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-18Merge branch 'asoc-5.15' into asoc-5.16Mark Brown1-0/+3
2021-10-15ASoC: cs42l42: Set correct SRC MCLKRichard Fitzgerald1-0/+1
According to the datasheet the SRC MCLK must be as near as possible to (125 * sample rate). This means it should be ~6MHz for rates up to 48k and ~12MHz for rates above that. As per datasheet table 4-21. Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Link: https://lore.kernel.org/r/20211015133619.4698-14-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-15ASoC: cs42l42: Allow time for HP/ADC to power-up after enableRichard Fitzgerald1-0/+2
After enabling the HP or ADC by writing the corresponding PDN=0, it takes around 20 milliseconds for it to power up and the midrail supply to be stable. Add this wait into a DAPM widget callback. If HP and ADC are both powering up in a DAPM sequence, there's no need to do the wait twice. The widget will perform one wait in the POST_PMU if there was a PRE_PMU for one or both. Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Link: https://lore.kernel.org/r/20211015133619.4698-13-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-09-27ASoC: cs42l42: Use two thresholds and increased wait time for manual type detectionStefan Binding1-0/+5
Some headsets require very different comparator thresholds for type detection, as well as longer settling times. In order to detect a larger number of headsets, use 2 thresholds to give maximum coverage (1.25V and 1.75V), as well as a longer settling time of 100ms. This will not affect default audotodetect mode and applies to manual mode type detection only. Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com> Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com> Link: https://lore.kernel.org/r/20210927111437.18113-1-vitalyr@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-09-16ASoC: cs42l42: Implement Manual Type detection as fallbackStefan Binding1-0/+54
Some headsets are not detected correctly by Automatic Type Detection on cs42l42. Instead, Manual Type Detection can be used to give a more accurate value. Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com> Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com> Link: https://lore.kernel.org/r/20210916102750.9212-2-vitalyr@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-08-06Merge tag 'asoc-fix-v5.14-rc4' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linusTakashi Iwai1-0/+3
ASoC: Fixes for v5.14 Quite a lot of fixes here, the biggest set being for the cs42l42 driver which is reasonably old but has seen a sudden uptick in activity. There's also some fixes for correctly referencing PCM buffer addresses and the removal of some driver-local bodges that had been done for the lack of prefix handling in DAPM which were broken by the core handling that as expected.
2021-08-06Merge some cs42l42 patches into asoc-5.15Mark Brown1-0/+3
2021-08-05ASoC: cs42l42: Fix mono playbackRichard Fitzgerald1-0/+2
I2S always has two LRCLK phases and both CH1 and CH2 of the RX must be enabled (corresponding to the low and high phases of LRCLK.) The selection of the valid data channels is done by setting the DAC CHA_SEL and CHB_SEL. CHA_SEL is always the first (left) channel, CHB_SEL depends on the number of active channels. Previously for mono ASP CH2 was not enabled, the result was playing mono data would not produce any audio output. Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Fixes: 621d65f3b868 ("ASoC: cs42l42: Provide finer control on playback path") Link: https://lore.kernel.org/r/20210805161111.10410-4-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-08-05ASoC: cs42l42: PLL must be running when changing MCLK_SRC_SELRichard Fitzgerald1-0/+1
Both SCLK and PLL clocks must be running to drive the glitch-free mux behind MCLK_SRC_SEL and complete the switchover. This patch moves the writing of MCLK_SRC_SEL to when the PLL is started and stopped, so that it only transitions while the PLL is running. The unconditional write MCLK_SRC_SEL=0 in cs42l42_mute_stream() is safe because if the PLL is not running MCLK_SRC_SEL is already 0. Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Fixes: 43fc357199f9 ("ASoC: cs42l42: Set clock source for both ways of stream") Link: https://lore.kernel.org/r/20210805161111.10410-1-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-06-25Merge remote-tracking branch 'asoc/for-5.14' into asoc-nextMark Brown1-1/+4
2021-06-16ASoC: cs42l42: Correct definition of CS42L42_ADC_PDN_MASKRichard Fitzgerald1-1/+1
The definition of CS42L42_ADC_PDN_MASK was incorrectly defined as the HP_PDN bit. Fixes: 2c394ca79604 ("ASoC: Add support for CS42L42 codec") Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Link: https://lore.kernel.org/r/20210616135604.19363-1-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-05-25ASoC: cs42l42: Fix 1536000 Bit Clock instabilityLucas Tanure1-0/+2
The 16 Bits, 2 channels, 48K sample rate use case needs to configure a safer pll_divout during the start of PLL After 800us from the start of PLL the correct pll_divout can be set Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com> Reviewed-by: Richard Fitzgerald <rf@opensource.cirrus.com> Message-Id: <20210525090822.64577-1-tanureal@opensource.cirrus.com> Signed-off-by: Mark Brown <broonie@sirena.org.uk>
2021-05-12ASoC: cs42l42: make HSBIAS_SENSE_EN optionalVitaly Rodionov1-0/+1
HSBIAS_SENSE_EN configures HSBIAS output current sense through the external 2.21-k resistor. HSBIAS_SENSE is hardware feature to reduce the potential pop noise during the headset plug out slowly. But on some platforms ESD voltage will affect it causing test to fail, especially with CTIA headset type. For different hardware setups, a designer might want to tweak default behavior. Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com> Link: https://lore.kernel.org/r/20210511145220.125760-1-vitalyr@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-05-10ASoC: cs42l42: Add support for set_jack callsLucas Tanure1-1/+1
Replace the internal jack creation by set_jack call, so users can map buttons in their machine driver Also only enable jack detection IRQ after set_jack call Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com> Link: https://lore.kernel.org/r/20210426155303.853236-1-tanureal@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-03-10ASoC: cs42l42: Wait for PLL to lock before switching to itRichard Fitzgerald1-0/+2
The PLL should have locked before using it to supply MCLK. Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com> Link: https://lore.kernel.org/r/20210306185553.62053-16-tanureal@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-03-10ASoC: cs42l42: Wait at least 150us after writing SCLK_PRESENTRichard Fitzgerald1-0/+1
There must be a delay of at least 150us after writing SCLK_PRESENT before issuing another I2C write. This is done using struct reg_sequence because it can specify a delay after the write and the whole sequence is written atomically. Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com> Link: https://lore.kernel.org/r/20210306185553.62053-14-tanureal@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-03-10ASoC: cs42l42: Use bclk from hw_params if set_sysclk was not calledLucas Tanure1-0/+1
Add support for reading the source clock from snd_soc_params_to_bclk so the machine driver is not required to call cs42l42_set_sysclk Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com> Link: https://lore.kernel.org/r/20210306185553.62053-13-tanureal@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-03-10ASoC: cs42l42: Report jack and button detectionLucas Tanure1-0/+3
Report the Jack events to the user space through ALSA. Also moves request_threaded_irq() to component_probe so it don't get interrupts before the initialization the struct snd_soc_jack. Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com> Link: https://lore.kernel.org/r/20210306185553.62053-12-tanureal@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-03-10ASoC: cs42l42: Add Capture SupportLucas Tanure1-0/+12
Add support for capture path on headseat pins Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com> Link: https://lore.kernel.org/r/20210306185553.62053-11-tanureal@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-03-10ASoC: cs42l42: Set clock source for both ways of streamLucas Tanure1-0/+1
Move the enable/disable of clocks to cs42l42_mute_stream so the record path also get clocks. Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com> Link: https://lore.kernel.org/r/20210306185553.62053-10-tanureal@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-03-10ASoC: cs42l42: Provide finer control on playback pathLucas Tanure1-4/+4
Removing cs42l42_hpdrv_evt that enables the entire chain and replace by a set of widgets that can better define the codec Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com> Link: https://lore.kernel.org/r/20210306185553.62053-9-tanureal@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-03-10ASoC: cs42l42: Always wait at least 3ms after resetLucas Tanure1-0/+1
This delay is part of the power-up sequence defined in the datasheet. A runtime_resume is a power-up so must also include the delay. Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com> Link: https://lore.kernel.org/r/20210305173442.195740-6-tanureal@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-03-10ASoC: cs42l42: Fix channel width supportLucas Tanure1-1/+0
Remove the hard coded 32 bits width and replace with the correct width calculated by params_width. Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com> Link: https://lore.kernel.org/r/20210305173442.195740-3-tanureal@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-03-10ASoC: cs42l42: Fix Bitclock polarity inversionLucas Tanure1-5/+6
The driver was setting bit clock polarity opposite to intended polarity. Also simplify the code by grouping ADC and DAC clock configurations into a single field. Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com> Link: https://lore.kernel.org/r/20210305173442.195740-2-tanureal@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2019-06-19treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500Thomas Gleixner1-5/+1
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-02-12ASoC: cs42l42: replace codec to componentKuninori Morimoto1-1/+1
Now we can replace Codec to Component. Let's do it. Note: xxx_codec_xxx() -> xxx_component_xxx() .idle_bias_off = 0 -> .idle_bias_on = 1 .ignore_pmdown_time = 1 -> .use_pmdown_time = 0 - -> .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>
2016-11-09ASoC: Add support for CS42L42 codecJames Schulman1-0/+776
Add support for Cirrus Logic CS42L42 codec. SoundWire support is not enabled. Features support for I2C control and I2S audio. Signed-off-by: James Schulman <james.schulman@cirrus.com> Signed-off-by: Mark Brown <broonie@kernel.org>