Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp5963224ybv; Tue, 18 Feb 2020 07:16:54 -0800 (PST) X-Google-Smtp-Source: APXvYqx4iVw8MYRLr2HtnsH4SxI6Ht/Kze2o3FHQiMJNj4tpTSnoPZoMy57I5X73aeyA0y4OMsQe X-Received: by 2002:aca:100e:: with SMTP id 14mr1575885oiq.88.1582039009515; Tue, 18 Feb 2020 07:16:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582039009; cv=none; d=google.com; s=arc-20160816; b=skkliA0n6Ndmvx8TavMc118sp47gpn97+jWno8Oj1yUabb85G26/JcN48UmzzVjKzY JfF48r1IJzkm5ZqwgaAJNcoxz6OlCCiIgzNUang7gLIosyE4DKRD2nFmEuxpjy6qM49B l3GprLHE7XJTgIO8gjusQRTc+mFzaBJTWg34mIn3HMIc0t1iF56OnD+AFZlmdF98qvbd JGL4YcAcy9zuD/R4xOXHqX0DKaqlNdBgX4K5UYfqC62K+pmytnPdWaXGS7PGLSqTBJHK 6ySd9UEOfuXP8crnypd6RaSEtufCUPJcOntX7KR4tCfWZeoEBER49L5As6tFXk6ctugW QPIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=g7CZ22E9Atxx53T54UZaa8VzKxWPPc31ojdRcNza8bc=; b=Zqkcea0W/pnyThSRBaPHSmlRU34LuI8ODQQnpCzrGBH/T7CeIxgKJnYq+e5A5tUYga WITFOtZ6H8eac64FrFfpj7wtC1h0R+rrmVxSnJKcUsaSWpNeIT/6wmXWR4h/vLTXV1OK 3ugdCavHX/1V8I72rgl1mwAxXiLhMnTJ4jd/BPfhzpkrB+EYqz5+R0dNF/Sht2pDu1N9 Br3Mq9dZX78C82Z1aogBtLd+uUqQC+tK2BiZ1AYYeYFeT1U2SZoVT2DKCi7q0KkHTDSx dUIsX06op+fMhVMGEby9BqDcYfMhWNcPywdOtDH3ErSivskVPe2pCxgIZjiqhgb9FbrY lktg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=zJ9PC+sa; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h2si7979221oie.151.2020.02.18.07.16.36; Tue, 18 Feb 2020 07:16:49 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=zJ9PC+sa; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726761AbgBRPQS (ORCPT + 99 others); Tue, 18 Feb 2020 10:16:18 -0500 Received: from fllv0016.ext.ti.com ([198.47.19.142]:55782 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726666AbgBRPQS (ORCPT ); Tue, 18 Feb 2020 10:16:18 -0500 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 01IFFmX6090741; Tue, 18 Feb 2020 09:15:48 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1582038948; bh=g7CZ22E9Atxx53T54UZaa8VzKxWPPc31ojdRcNza8bc=; h=Subject:To:CC:References:From:Date:In-Reply-To; b=zJ9PC+saejh46Of6QW2dFH2redqRaK99p/OiX29Vdpq2bwpD+bHlq+E3Fh8yopM99 I/26yU3sNuM0HI+54L04lAYpSpW/EcebdbbpnYSFjq8ocZPAFnrgffwUIOYmM5gpUu Uep1knp/sByK6quH10wI4ngBFPboc5v2sPld0XM4= Received: from DLEE109.ent.ti.com (dlee109.ent.ti.com [157.170.170.41]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 01IFFmUB055288 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 18 Feb 2020 09:15:48 -0600 Received: from DLEE102.ent.ti.com (157.170.170.32) by DLEE109.ent.ti.com (157.170.170.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3; Tue, 18 Feb 2020 09:15:47 -0600 Received: from lelv0326.itg.ti.com (10.180.67.84) by DLEE102.ent.ti.com (157.170.170.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3 via Frontend Transport; Tue, 18 Feb 2020 09:15:47 -0600 Received: from [192.168.2.6] (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id 01IFFi7U067542; Tue, 18 Feb 2020 09:15:44 -0600 Subject: Re: [PATCH] ASoC: cpcap: Implement set_tdm_slot for voice call support To: Tony Lindgren CC: Mark Brown , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , , , , "Arthur D ." , Merlijn Wajer , Pavel Machek , Sebastian Reichel , Jarkko Nikula References: <20200211181005.54008-1-tony@atomide.com> <20200212144620.GJ64767@atomide.com> <9a060430-5a3e-61e1-3d2c-f89819d9436f@ti.com> <20200217232325.GD35972@atomide.com> From: Peter Ujfalusi Message-ID: <8fc1dded-6d28-f5cd-f2f9-3a6810571119@ti.com> Date: Tue, 18 Feb 2020 17:15:52 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <20200217232325.GD35972@atomide.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 8bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Tony, On 18/02/2020 1.23, Tony Lindgren wrote: > * Peter Ujfalusi [200214 13:30]: >> Hi Tony, >> >> On 12/02/2020 16.46, Tony Lindgren wrote: >>> * Peter Ujfalusi [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