Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp6141347ybv; Wed, 12 Feb 2020 06:46:57 -0800 (PST) X-Google-Smtp-Source: APXvYqyWLA1EykFnAnlsZGrnsZvyKMshP5SSp0TQ/KlD5k58ianEofBc1r+QABpM/mI1uWdPKfG5 X-Received: by 2002:a9d:7842:: with SMTP id c2mr3698518otm.252.1581518817300; Wed, 12 Feb 2020 06:46:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581518817; cv=none; d=google.com; s=arc-20160816; b=VRB7CMnsoElNH1+3KAW6Y7cO3uUuParDFCXhftsyu1ZPXr+XXboWXAb1utCRMLXQX0 NB2ZxqglHLeu5MdRIOJoHhYGqeNPcM6VfnyEwfYvHaQ19bZXOaemsygo5pcc04+DydNe ZgMke03Zr8X0F3zl9upjzi8+GY+26I3aFeCw9xRmWN2fgP/OLA4xkGjIiHML9mF/4IMh gWgK/3hiCbfxvGkIPrDP49WW2DxKi325LsUUpOmZHzglmpeKMzw7SU4JXYy3lsd4hcCx mo352YwxScgvASZ6djrXYTte1DBJROjWOFEqHFqwoSzBXf8ApRqZLFeKifTBWG3/upQM tsOQ== 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=MmOUo3RxLdv5zi5LOnJY4FEkbJl4TqgEFH7mPCMi5SQ=; b=y6R/xzIn3LJklAszZGgi5eB2v4cgjCdONuDK3JhXlUIHbyC1iXqgwlAaDYFGMonYIO JVMAqioJ0HjlEk2IEHx8LElEYYKWcPr58SfsWANYLeRec3sijk+PI9rIkHOrYW+3Btz1 NVCSggdm+v3sFBRuUcq1gJ5/KPPPnxp7d4Hd3LIAWk0XGDLpd6M9N3f6mkBWtT/0awOi ymEK6k/rlxK4cU9sESAMIcHs2VD1dKbzncRO/2/veOCRJK5EEcPQD0lsOtiFUCIgJ577 Qbq1lUu2vvH+OjJhRSLiCHnigDvXom2+N3O4K9txohTmCrEpp/369iygbSQ8N1m887H8 bFGg== 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 m24si320849otn.67.2020.02.12.06.46.44; Wed, 12 Feb 2020 06:46:57 -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 S1728094AbgBLOqZ (ORCPT + 99 others); Wed, 12 Feb 2020 09:46:25 -0500 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 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 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: <20200212144620.GJ64767@atomide.com> References: <20200211181005.54008-1-tony@atomide.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * 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