summaryrefslogtreecommitdiff
path: root/sound/soc/codecs/cpcap.c
AgeCommit message (Collapse)AuthorFilesLines
2021-02-05Merge branch 'asoc-5.11' into asoc-5.12Mark Brown1-6/+6
2021-02-01ASoC: cpcap: fix microphone timeslot maskSebastian Reichel1-6/+6
The correct mask is 0x1f8 (Bit 3-8), but due to missing BIT() 0xf (Bit 0-3) was set instead. This means setting of CPCAP_BIT_MIC1_RX_TIMESLOT0 (Bit 3) still worked (part of both masks). On the other hand the code does not properly clear the other MIC timeslot bits. I think this is not a problem, since they are probably initialized to 0 and not touched by the driver anywhere else. But the mask also contains some wrong bits, that will be cleared. Bit 0 (CPCAP_BIT_SMB_CDC) should be safe, since the driver enforces it to be 0 anyways. Bit 1-2 are CPCAP_BIT_FS_INV and CPCAP_BIT_CLK_INV. This means enabling audio recording forces the codec into SND_SOC_DAIFMT_NB_NF mode, which is obviously bad. The bug probably remained undetected, because there are not many use cases for routing microphone to the CPU on platforms using cpcap and user base is small. I do remember having some issues with bad sound quality when testing voice recording back when I wrote the driver. It probably was this bug. Fixes: f6cdf2d3445d ("ASoC: cpcap: new codec") Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Sebastian Reichel <sre@kernel.org> Reviewed-by: Tony Lindgren <tony@atomide.com> Link: https://lore.kernel.org/r/20210123172945.3958622-1-sre@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
2021-01-19ASoC: cpcap: Implement set_tdm_slot for voice call supportTony Lindgren1-2/+125
ASoC: cpcap: Implement set_tdm_slot for voice call support For using cpcap for voice calls, we need to route audio directly from the modem to cpcap for TDM (Time Division Multiplexing). The voice call is direct data between the modem and cpcap with no CPU involvment. In this mode, the cpcap related audio mixer controls work for the speaker selection and volume though. To do this, we need to implement standard snd_soc_dai_set_tdm_slot() for cpcap. Then the modem codec driver can use snd_soc_dai_set_sysclk(), snd_soc_dai_set_fmt(), and snd_soc_dai_set_tdm_slot() to configure a voice call. Let's add cpcap_voice_set_tdm_slot() for this, and cpcap_voice_call() helper to configure the additional registers needed for voice call. Let's also clear CPCAP_REG_VAUDIOC on init in case we have the bit for CPCAP_BIT_VAUDIO_MODE0 set on init. Signed-off-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Pavel Machek <pavel@ucw.cz> Link: https://lore.kernel.org/r/20210112174704.GA13496@duo.ucw.cz Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-17ASoC: codecs: merge .digital_mute() into .mute_stream()Kuninori Morimoto1-4/+7
snd_soc_dai_digital_mute() is internally using both mute_stream() (1) or digital_mute() (2), but the difference between these 2 are only handling direction. We can merge digital_mute() into mute_stream int snd_soc_dai_digital_mute(xxx, int direction) { ... else if (dai->driver->ops->mute_stream) (1) return dai->driver->ops->mute_stream(xxx, direction); else if (direction == SNDRV_PCM_STREAM_PLAYBACK && dai->driver->ops->digital_mute) (2) return dai->driver->ops->digital_mute(xxx); ... } Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Reviewed-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Link: https://lore.kernel.org/r/875zaxxxi4.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2018-03-28ASoC: cpcap: replace codec to componentKuninori Morimoto1-79/+73
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 = 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>
2018-02-27ASoC: cpcap: new codecSebastian Reichel1-0/+1568
Motorola CPCAP is a PMIC with audio functionality, that can be found on Motorola Droid 4 and probably a few other phones from Motorola's Droid series. The driver has been written from scratch using Motorola's Android driver, register dumps from running Android and datasheet for NXP MC13783UG (which is similar to Motorola CPCAP, but not the same). The chip provides two audio interfaces, that can be muxed to two different audio codecs. One provides support for stereo output (named StDAC or HiFi), while the other only provides mono output (named Voice). Only the Voice codec provides a Capture interface. Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk> Acked-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Mark Brown <broonie@kernel.org>