Received: by 10.213.65.68 with SMTP id h4csp1426438imn; Mon, 26 Mar 2018 07:20:04 -0700 (PDT) X-Google-Smtp-Source: AG47ELsm3ETkTF7LDu88Xj7P8SE9xFLOQdPVSgq046zGcOJt1hnRjPRGd4Cpe3RWjIrHdXcmILhc X-Received: by 10.99.142.201 with SMTP id k192mr28508355pge.278.1522074004598; Mon, 26 Mar 2018 07:20:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522074004; cv=none; d=google.com; s=arc-20160816; b=QzkR7/bjyFQZireOJPM4TxTKnWNpkjNF1R12kFK/kBTSxk7kHl7vzfLZjMp2rU9AQf cQN8D95u8NsNEJ6zUASDTFFo1mPYFeuiF7Qvcl0m2yT5eoSfFNMVK+PVyMne3u0ohjLY TuCed6dCWlZpEl4h7BGdGNLTHpCJNFDWEJZQPdWLuA6mKxhHYf7oqlE7EEKjnHc2QLWk HXpLSQH/kx6sPK25a4dF/Z9zKppTGffbg+MDui4GbHjrfr5nqcM3tOn9uXjNPw9RDePj 6ZTQVlVLZFOvVR03xEC6PaXL5etLz9V1kIxup8WTjvG+YYnyXc+dWSx7+LOQXIxY1VYA 6SdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=QiM/u2NT+eEioo1FL+C89bellzeFb9SXJ7Os+oiEqsU=; b=GavvcaLsKXozgAkDOQ1lQ8DYg08J6j1hnCjUvxEPJIpHiF3OahLD3wYvb0A+Hau6Yl YGJcwYeowUlJfBkpJ9DF+bN7zwoQjectZC2Di1PSi/I5cXLSIZ5fCgVjs7WAn+UHt3Eo Krk9piGYH0zXv5v23v/HfQUWxUGqYHOCnlvnemwWWxPZmq3bHgFaD7+FIk5ZyegDMKOL FJ1fZ+VG9O98VtS0InGCTwSO3aizXQAyujjbKQbnwVldlic6wpftLc7yQs5MmwjTTzPC nRGDZJ0c3ZfbTwY04rgJpf0oW43xwzUEQzexOModFzfcbMzqyGzyc89NcnEQr4/v7ifL 0WgQ== 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 c15si3743765pgv.251.2018.03.26.07.19.48; Mon, 26 Mar 2018 07:20:04 -0700 (PDT) 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 S1752708AbeCZOQn (ORCPT + 99 others); Mon, 26 Mar 2018 10:16:43 -0400 Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:41235 "EHLO atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752036AbeCZOQl (ORCPT ); Mon, 26 Mar 2018 10:16:41 -0400 Received: by atrey.karlin.mff.cuni.cz (Postfix, from userid 512) id 33C188038A; Mon, 26 Mar 2018 16:16:39 +0200 (CEST) Date: Mon, 26 Mar 2018 16:16:38 +0200 From: Pavel Machek To: Sebastian Reichel Cc: Liam Girdwood , Mark Brown , Rob Herring , Tony Lindgren , Lee Jones , Jaroslav Kysela , Takashi Iwai , alsa-devel@alsa-project.org, linux-omap@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@collabora.com Subject: omap4-droid4: voice call support was Re: [PATCHv5,5/5] ARM: dts: omap4-droid4: add soundcard Message-ID: <20180326141638.GB1450@amd> References: <20180223200254.25685-6-sebastian.reichel@collabora.co.uk> <20180322204804.GA26871@amd> <20180322234832.o24ut5ahon46mdu4@earth.universe> <20180323100930.GA21644@amd> <20180323103006.alymgb3ywftb4gek@earth.universe> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="nVMJ2NtxeReIH9PS" Content-Disposition: inline In-Reply-To: <20180323103006.alymgb3ywftb4gek@earth.universe> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --nVMJ2NtxeReIH9PS Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! Do you have any ideas what needs to be done for voice calls support? I can talk to the modem and start a call. Then something like this (untested!) is certainly needed. Probably more... Thanks, Pavel diff --git a/sound/soc/codecs/cpcap.c b/sound/soc/codecs/cpcap.c index aedb267..7646f68 100644 --- a/sound/soc/codecs/cpcap.c +++ b/sound/soc/codecs/cpcap.c @@ -1280,6 +1280,60 @@ static int cpcap_voice_hw_params(struct snd_pcm_subs= tream *substream, return 0; } =20 +static int cpcap_incall_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params, + struct snd_soc_dai *dai) +{ + struct snd_soc_codec *codec =3D dai->codec; + struct device *dev =3D codec->dev; + struct cpcap_audio *cpcap =3D snd_soc_codec_get_drvdata(codec); + static const u16 reg_cdi =3D CPCAP_REG_CDI; + int rate =3D params_rate(params); + int channels =3D params_channels(params); + int direction =3D substream->stream; + u16 val, mask; + int err; + + dev_dbg(dev, "Incall setup HW params: rate=3D%d, direction=3D%d, chan=3D%= d", + rate, direction, channels); + + /* codec, 1 in original code is CPCAP_REG_CC + codec, 2 is CPCAP_REG_CDI + codec, 5 is CPCAP_REG_TXI */ + + if (/* cpcap->codec_strm_cnt =3D=3D */ 1) { + /* + if (pdata->voice_type !=3D VOICE_TYPE_QC) + printk("FIXME: Only MDM6600 support is implemented here.\n"); + */ + + err =3D regmap_update_bits(cpcap->regmap, CPCAP_REG_CDI, 0xffff, 0xAE02); + if (err) printk("cpcap error %d\n", __LINE__); + + err =3D regmap_update_bits(cpcap->regmap, CPCAP_REG_CC, 0xffff, 0x6120); + if (err) printk("cpcap error %d\n", __LINE__); + + err =3D cpcap_set_samprate(cpcap, CPCAP_DAI_VOICE, rate); + printk("Configured stream\n"); + } + + /* (direction =3D=3D SNDRV_PCM_STREAM_CAPTURE) ?? */ + if (substream->stream) { /* up link */ + unsigned int set =3D CPCAP_BIT_AUDIHPF_1 | CPCAP_BIT_AUDIHPF_0; + err =3D regmap_update_bits(cpcap->regmap, CPCAP_REG_CC, set, set); + if (err) printk("cpcap error %d\n", __LINE__); + + set =3D CPCAP_BIT_MB_ON1L | CPCAP_BIT_MB_ON1R; + err =3D regmap_update_bits(cpcap->regmap, CPCAP_REG_TXI, set, set); + } else { /* down link */ + unsigned int set =3D CPCAP_BIT_AUDOHPF_1 | CPCAP_BIT_AUDOHPF_0; + err =3D regmap_update_bits(cpcap->regmap, CPCAP_REG_CC, set, set); + if (err) printk("cpcap error %d\n", __LINE__); + } + + return err; +} + static int cpcap_voice_set_dai_sysclk(struct snd_soc_dai *codec_dai, int c= lk_id, unsigned int freq, int dir) { @@ -1394,6 +1448,14 @@ static const struct snd_soc_dai_ops cpcap_dai_voice_= ops =3D { .digital_mute =3D cpcap_voice_set_mute, }; =20 +static const struct snd_soc_dai_ops cpcap_dai_incall_ops =3D { + /* FIXME */ + .hw_params =3D cpcap_incall_hw_params, + .set_sysclk =3D cpcap_voice_set_dai_sysclk, + .set_fmt =3D cpcap_voice_set_dai_fmt, + .digital_mute =3D cpcap_voice_set_mute, +}; + static struct snd_soc_dai_driver cpcap_dai[] =3D { { .id =3D 0, @@ -1426,6 +1488,26 @@ static struct snd_soc_dai_driver cpcap_dai[] =3D { }, .ops =3D &cpcap_dai_voice_ops, }, +{ + .id =3D 2, + .name =3D "cpcap in-call", + .playback =3D { + .stream_name =3D "InCall DL", + .channels_min =3D 1, + .channels_max =3D 2, + .rates =3D SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000, + .formats =3D SNDRV_PCM_FMTBIT_S16_LE, + }, + .capture =3D { + .stream_name =3D "Capture", + .channels_min =3D 1, + .channels_max =3D 2, + .rates =3D SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000, + .formats =3D SNDRV_PCM_FMTBIT_S16_LE, + }, + .ops =3D &cpcap_dai_incall_ops, +}, +/* FIXME: this misses bt-call, cpcap bt, BPvoice, FM */ }; =20 static int cpcap_dai_mux(struct cpcap_audio *cpcap, bool swap_dai_configur= ation) --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --nVMJ2NtxeReIH9PS Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlq5AMYACgkQMOfwapXb+vLk1QCfaPPp7awZ3duJtvTBMiP2AJvO Fw8AnRvnuNKcbngbLVzUqgbFrQMx6ITd =oK5w -----END PGP SIGNATURE----- --nVMJ2NtxeReIH9PS--