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 67113C2BA83 for ; Wed, 12 Feb 2020 14:47:40 +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 E261120873 for ; Wed, 12 Feb 2020 14:47:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="hktV/CB5" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E261120873 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 2B4B1166D; Wed, 12 Feb 2020 15:46:48 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 2B4B1166D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1581518858; bh=CvB7LaFDJvzxDSEteabJzqmvbFbIAwbvIhklu9vY6kg=; h=Date:From:To:References:In-Reply-To:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=hktV/CB5gxSlHBkkv5E5MisY+OQ6t7O9JPyfEAfJvERHlURvuVdpfzl+aO5wdVTeq PBIzQQGls3LQ72RJr14r8NTZelBHWcuWElfJs0xE4FPDm0S3ShRo3HfvdCGdCJo8Da wJT5fEvu2UxbdlLRywCmhhmUZqqJt2RLrMJjOljM= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 96FCDF8014F; Wed, 12 Feb 2020 15:46:47 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 37EBBF80157; Wed, 12 Feb 2020 15:46:46 +0100 (CET) Received: from muru.com (muru.com [72.249.23.125]) by alsa1.perex.cz (Postfix) with ESMTP id 2160AF80125 for ; Wed, 12 Feb 2020 15:46:25 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 2160AF80125 Received: from atomide.com (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTPS id 4A8A680F6; Wed, 12 Feb 2020 14:47:07 +0000 (UTC) Date: Wed, 12 Feb 2020 06:46:20 -0800 From: Tony Lindgren To: Peter Ujfalusi Message-ID: <20200212144620.GJ64767@atomide.com> References: <20200211181005.54008-1-tony@atomide.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: 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 Subject: Re: [alsa-devel] [PATCH] ASoC: cpcap: Implement set_tdm_slot for voice call support 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" * 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 and maybe you have some better check in mind. 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. > > + > > + 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. > > + > > + 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? Regards, Tony _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org https://mailman.alsa-project.org/mailman/listinfo/alsa-devel From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tony Lindgren Subject: Re: [PATCH] ASoC: cpcap: Implement set_tdm_slot for voice call support Date: Wed, 12 Feb 2020 06:46:20 -0800 Message-ID: <20200212144620.GJ64767@atomide.com> References: <20200211181005.54008-1-tony@atomide.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from muru.com ([72.249.23.125]:54896 "EHLO muru.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727526AbgBLOqZ (ORCPT ); Wed, 12 Feb 2020 09:46:25 -0500 Content-Disposition: inline In-Reply-To: Sender: linux-omap-owner@vger.kernel.org List-Id: linux-omap@vger.kernel.org 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 * 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 and maybe you have some better check in mind. 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. > > + > > + 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. > > + > > + 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? Regards, Tony