Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp5232066ybv; Mon, 17 Feb 2020 15:25:21 -0800 (PST) X-Google-Smtp-Source: APXvYqw31JRSPPQ55GASOOTIpm/ZgYUV4VbCUEj0IQ9RmXu/BPbMt+xfFBETHLa/TJzm+eOAOqer X-Received: by 2002:aca:190b:: with SMTP id l11mr934631oii.65.1581981921026; Mon, 17 Feb 2020 15:25:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581981921; cv=none; d=google.com; s=arc-20160816; b=fAnFK2sd/11c5tODSahK9xrTYJNEiDhgm0QOFJG/eJM6NFGpP2yG0NuJMQEyuJ69g8 +Ys3CC9UIZpXpvI5HGXaUkHhpSWwQ9BIGiu4fynIXGVPzC7F/UML4UYRgN3XTgqjZ1Lu 59Cuu4dCCYH0LFyyAuH2yllLddwO4BTt4G/ZZe8bVRKOTaMPWAO+GCsW+IaMaM4hBxMy tLs1ObU2UejE5kbT1N04gmQQrg4lt0wrDRIPwJBcyf1BcKufZEBk4cspjsiJXDIap63B Xs+U+WJ00LKJCy14P1aCBb0uzj83oW06pp/1iaiqPtgLApB4dIWZ6AIrvIETRoYQXpll Rrjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=85wLvj9Jf3DOKtevtXaU8ai9xx/dJU/HK1B8TS6inL0=; b=qWk1Qz83DuUkDHWCClWejyyIZZO9qlUxspu6tU6AEi68GURN9R8vaHUx02+t4zipCa ih7zUuVSECQK9gSRVvEUddmvEAKl96/lg1Wt5jwMOp/asNkZ320xn3iDzgp50M/iRT7Q R8Y1VKGEER4eNvhu8DJgDdpmGU0C9N33x01wZE+BziRiDf6eYVE3LH3drtI5eAeyvzZl Y1gwvKYSGSNHnO4s6rFPfMcXfbLtdUp67i9RXkDwJBwyu9GWpsOvslzvI0UbG+phGtMV Xpva5iSRc0abq7VCCLWimD39oOhu0mpE+Elkp0PV2YiXQNzKMNvJnNLx8eo9+CGKN2XQ IV+A== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c130si7321305oib.182.2020.02.17.15.25.08; Mon, 17 Feb 2020 15:25:21 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726171AbgBQXXa (ORCPT + 99 others); Mon, 17 Feb 2020 18:23:30 -0500 Received: from muru.com ([72.249.23.125]:55768 "EHLO muru.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726107AbgBQXXa (ORCPT ); Mon, 17 Feb 2020 18:23:30 -0500 Received: from atomide.com (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTPS id 7CBE68087; Mon, 17 Feb 2020 23:24:12 +0000 (UTC) Date: Mon, 17 Feb 2020 15:23:25 -0800 From: Tony Lindgren To: Peter Ujfalusi Cc: Mark Brown , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, "Arthur D ." , Merlijn Wajer , Pavel Machek , Sebastian Reichel , Jarkko Nikula Subject: Re: [PATCH] ASoC: cpcap: Implement set_tdm_slot for voice call support Message-ID: <20200217232325.GD35972@atomide.com> References: <20200211181005.54008-1-tony@atomide.com> <20200212144620.GJ64767@atomide.com> <9a060430-5a3e-61e1-3d2c-f89819d9436f@ti.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9a060430-5a3e-61e1-3d2c-f89819d9436f@ti.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * 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. > >> 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? > >> 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