lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9a060430-5a3e-61e1-3d2c-f89819d9436f@ti.com>
Date:   Fri, 14 Feb 2020 15:29:21 +0200
From:   Peter Ujfalusi <peter.ujfalusi@...com>
To:     Tony Lindgren <tony@...mide.com>
CC:     Mark Brown <broonie@...nel.org>,
        Liam Girdwood <lgirdwood@...il.com>,
        Jaroslav Kysela <perex@...ex.cz>,
        Takashi Iwai <tiwai@...e.com>, <alsa-devel@...a-project.org>,
        <linux-kernel@...r.kernel.org>, <linux-omap@...r.kernel.org>,
        "Arthur D ." <spinal.by@...il.com>,
        Merlijn Wajer <merlijn@...zup.org>,
        Pavel Machek <pavel@....cz>,
        Sebastian Reichel <sre@...nel.org>,
        Jarkko Nikula <jarkko.nikula@...mer.com>
Subject: Re: [PATCH] ASoC: cpcap: Implement set_tdm_slot for voice call
 support

Hi Tony,

On 12/02/2020 16.46, Tony Lindgren wrote:
> * Peter Ujfalusi <peter.ujfalusi@...com> [200212 09:18]:
>> On 11/02/2020 20.10, Tony Lindgren wrote:
>>> +static int cpcap_voice_set_tdm_slot(struct snd_soc_dai *dai,
>>> +				    unsigned int tx_mask, unsigned int rx_mask,
>>> +				    int slots, int slot_width)
>>> +{
>>> +	struct snd_soc_component *component = dai->component;
>>> +	struct cpcap_audio *cpcap = snd_soc_component_get_drvdata(component);
>>> +	int err, ts_mask, mask;
>>> +	bool voice_call;
>>> +
>>> +	/*
>>> +	 * Primitive test for voice call, probably needs more checks
>>> +	 * later on for 16-bit calls detected, Bluetooth headset etc.
>>> +	 */
>>> +	if (tx_mask == 0 && rx_mask == 1 && slot_width == 8)
>>> +		voice_call = true;
>>> +	else
>>> +		voice_call = false;
>>
>> You only have voice call if only rx slot0 is in use?
> 
> Yeah so it seems. Then there's the modem to wlcore bluetooth path that
> I have not looked at. But presumably that's again just configuring some
> tdm slot on the PMIC.
> 
>> If you record mono on the voice DAI, then rx_mask is also 1, no?
> 
> It is above :) But maybe I don't follow what you're asking here

If you arecrod -Dvoice_pcm -c1 -fS8 > /dev/null
then it is reasonable that the machine driver will set rx_mask = 1

> and maybe you have some better check in mind.

Not sure, but relying on set_tdm_slots to decide if we are in a call
case does not sound right.

> I have no idea where we would implement recording voice calls for
> example, I guess mcbsp could do that somewhere to dump out a tdm slot
> specific traffic.

Need to check how things are wired and how they expected to work ;)

>>> +
>>> +	ts_mask = 0x7 << CPCAP_BIT_MIC2_TIMESLOT0;
>>> +	ts_mask |= 0x7 << CPCAP_BIT_MIC1_RX_TIMESLOT0;
>>> +
>>> +	mask = (tx_mask & 0x7) << CPCAP_BIT_MIC2_TIMESLOT0;
>>> +	mask |= (rx_mask & 0x7) << CPCAP_BIT_MIC1_RX_TIMESLOT0;
>>> +
>>> +	err = regmap_update_bits(cpcap->regmap, CPCAP_REG_CDI,
>>> +				 ts_mask, mask);
>>> +	if (err)
>>> +		return err;
>>> +
>>> +	err = cpcap_set_samprate(cpcap, CPCAP_DAI_VOICE, slot_width * 1000);
>>> +	if (err)
>>> +		return err;
>>
>> You will also set the sampling rate for voice in
>> cpcap_voice_hw_params(), but that is for normal playback/capture, right?
> 
> Yeah so normal playback/capture is already working with cpcap codec driver
> with mainline Linux. The voice call needs to set rate to 8000.

But if you have a voice call initiated should not the rate be set by the
set_sysclk()?


>>> +
>>> +	err = cpcap_voice_call(cpcap, dai, voice_call);
>>> +	if (err)
>>> +		return err;
>>
>> It feels like that these should be done via DAPM with codec to codec route?
> 
> Sure if you have some better way of doing it :) Do you have an example to
> point me to?

Something along the lines of:
https://mailman.alsa-project.org/pipermail/alsa-devel/2020-February/162915.html

The it is a matter of building and connecting the DAPM routes between
the two codec and with a flip of the switch you would have audio flowing
between them.

> 
> Regards,
> 
> Tony
> 

- Péter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ