linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Ujfalusi <peter.ujfalusi@ti.com>
To: Tony Lindgren <tony@atomide.com>
Cc: Mark Brown <broonie@kernel.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	<alsa-devel@alsa-project.org>, <linux-kernel@vger.kernel.org>,
	<linux-omap@vger.kernel.org>, "Arthur D ." <spinal.by@gmail.com>,
	Merlijn Wajer <merlijn@wizzup.org>, Pavel Machek <pavel@ucw.cz>,
	Sebastian Reichel <sre@kernel.org>,
	Jarkko Nikula <jarkko.nikula@bitmer.com>
Subject: Re: [PATCH] ASoC: cpcap: Implement set_tdm_slot for voice call support
Date: Tue, 18 Feb 2020 17:15:52 +0200	[thread overview]
Message-ID: <8fc1dded-6d28-f5cd-f2f9-3a6810571119@ti.com> (raw)
In-Reply-To: <20200217232325.GD35972@atomide.com>

Hi Tony,

On 18/02/2020 1.23, Tony Lindgren wrote:
> * Peter Ujfalusi <peter.ujfalusi@ti.com> [200214 13:30]:
>> Hi Tony,
>>
>> On 12/02/2020 16.46, Tony Lindgren wrote:
>>> * Peter Ujfalusi <peter.ujfalusi@ti.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.
> 
> OK yeah seems at least bluetooth would need to be also handled
> in the set_tdm_slots.

set_tdm_slots() is for setting how the TDM slots supposed to be used by
the component and not really for things to configure different operating
modes.

If you hardwire things in set_tdm_slots() for the droid4 then how the
codec driver can be reused in other setups?

>>>> 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()?
> 
> Hmm does set_sysclk called from modem codec know that cpcap codec
> is the clock master based on bitclock-master and set the rate
> for cpcap codec?

Neither component should call set_sysclk, set_tdm_slots. The machine
driver should as it is the only one who know how things are wired...

> 
>>>> 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.
> 
> Sounds good to me.
> 
> Tony
> 

- Péter

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

  reply	other threads:[~2020-02-18 15:16 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-11 18:10 Tony Lindgren
2020-02-12  9:17 ` Peter Ujfalusi
2020-02-12 14:46   ` Tony Lindgren
2020-02-14 13:29     ` Peter Ujfalusi
2020-02-17 23:23       ` Tony Lindgren
2020-02-18 15:15         ` Peter Ujfalusi [this message]
2020-02-18 15:32           ` Tony Lindgren
2020-02-18 16:44             ` Mark Brown
2020-02-18 17:06             ` Sebastian Reichel
2020-02-18 17:42               ` Mark Brown
2020-02-19 17:39                 ` Tony Lindgren
2020-02-19 17:46                   ` Mark Brown
2020-02-19 18:49                     ` Tony Lindgren
2020-02-19 18:53               ` Tony Lindgren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8fc1dded-6d28-f5cd-f2f9-3a6810571119@ti.com \
    --to=peter.ujfalusi@ti.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=jarkko.nikula@bitmer.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=merlijn@wizzup.org \
    --cc=pavel@ucw.cz \
    --cc=perex@perex.cz \
    --cc=spinal.by@gmail.com \
    --cc=sre@kernel.org \
    --cc=tiwai@suse.com \
    --cc=tony@atomide.com \
    --subject='Re: [PATCH] ASoC: cpcap: Implement set_tdm_slot for voice call support' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).