From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AA863C34026 for ; Tue, 18 Feb 2020 15:33:13 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2F19322527 for ; Tue, 18 Feb 2020 15:33:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="vFD3WACi" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2F19322527 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=atomide.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 7925E168A; Tue, 18 Feb 2020 16:32:21 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 7925E168A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1582039991; bh=nclSHjLYccvgwHZomC+w1jjFHcCyZkWP79A3CjaZwZo=; h=Date:From:To:Subject:References:In-Reply-To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=vFD3WACiwfUz0YZv3JaQw2w1gU+SO2K7a8O+tO3m/eJBvyzTIiT9NxcZwRH83+/+5 wbz2CGJmJNF7yJrPJ7NzZ/+jvnn7DE6Aok8qIl6XNpIQizt6MXNnv5Txi+eEnh7ySB 5e2QKPYvvCjBGo3DMUoYSkHOVwBw2mMyGIIRmhP0= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 112A3F80148; Tue, 18 Feb 2020 16:32:21 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 1FA72F8014A; Tue, 18 Feb 2020 16:32:20 +0100 (CET) Received: from muru.com (muru.com [72.249.23.125]) by alsa1.perex.cz (Postfix) with ESMTP id E8656F80145 for ; Tue, 18 Feb 2020 16:32:16 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz E8656F80145 Received: from atomide.com (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTPS id 069CF8043; Tue, 18 Feb 2020 15:32:58 +0000 (UTC) Date: Tue, 18 Feb 2020 07:32:11 -0800 From: Tony Lindgren To: Peter Ujfalusi Subject: Re: [PATCH] ASoC: cpcap: Implement set_tdm_slot for voice call support Message-ID: <20200218153211.GI35972@atomide.com> References: <20200211181005.54008-1-tony@atomide.com> <20200212144620.GJ64767@atomide.com> <9a060430-5a3e-61e1-3d2c-f89819d9436f@ti.com> <20200217232325.GD35972@atomide.com> <8fc1dded-6d28-f5cd-f2f9-3a6810571119@ti.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8fc1dded-6d28-f5cd-f2f9-3a6810571119@ti.com> Cc: alsa-devel@alsa-project.org, linux-omap@vger.kernel.org, Liam Girdwood , Merlijn Wajer , linux-kernel@vger.kernel.org, Takashi Iwai , Mark Brown , Pavel Machek , Sebastian Reichel , "Arthur D ." , Jarkko Nikula X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" * Peter Ujfalusi [200218 15:16]: > 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? Right, I'm all go for better solutions :) > >>>> 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... OK, but so what's the machine driver part in this case? Regards, Tony From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C9079C34026 for ; Tue, 18 Feb 2020 15:32:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A339321D56 for ; Tue, 18 Feb 2020 15:32:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726411AbgBRPcQ (ORCPT ); Tue, 18 Feb 2020 10:32:16 -0500 Received: from muru.com ([72.249.23.125]:55942 "EHLO muru.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726373AbgBRPcP (ORCPT ); Tue, 18 Feb 2020 10:32:15 -0500 Received: from atomide.com (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTPS id 069CF8043; Tue, 18 Feb 2020 15:32:58 +0000 (UTC) Date: Tue, 18 Feb 2020 07:32:11 -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: <20200218153211.GI35972@atomide.com> References: <20200211181005.54008-1-tony@atomide.com> <20200212144620.GJ64767@atomide.com> <9a060430-5a3e-61e1-3d2c-f89819d9436f@ti.com> <20200217232325.GD35972@atomide.com> <8fc1dded-6d28-f5cd-f2f9-3a6810571119@ti.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8fc1dded-6d28-f5cd-f2f9-3a6810571119@ti.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org * Peter Ujfalusi [200218 15:16]: > 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? Right, I'm all go for better solutions :) > >>>> 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... OK, but so what's the machine driver part in this case? Regards, Tony