Received: by 10.213.65.68 with SMTP id h4csp47478imn; Tue, 3 Apr 2018 15:12:38 -0700 (PDT) X-Google-Smtp-Source: AIpwx48/F+ZqGFR0I1z9y704G6xR0WoiCKkH5jtfIqz/6caTDRcKLLog2O5mI3trjunyHtzOmp9d X-Received: by 2002:a17:902:a608:: with SMTP id u8-v6mr16049221plq.25.1522793558770; Tue, 03 Apr 2018 15:12:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522793558; cv=none; d=google.com; s=arc-20160816; b=x6bnMrTjk1p3IhMxsnEFRQ2a2/V9hxvNeJKiU0G4PXcokdEoL52pRwTHAeJ9/3cejT g3sLNYBXFa1rdoVT9u4OOuoVzxjditE1b5LntrINk/k1s8TF80MFgyh716CT7AfJeXYm ZasidA977rxnVngYQTu0glI1kj4VbJW0C7ZDSnQZbryvJQ8WpAAoW0IX8vOjfmubB/Ib wkDK+0ymiHSKcK8q4E8Q14/qp4ME/tJkJ0ORBW1d4PCg+AlznX6LuBI5LcrdlAdOIzY3 9SB63fKsVvHKLBKrJCK0RcUBWDrIAwDC7JPZYpY+Ip6HnPafQ0dFJ/zD2GhOlhAmE3dG nYQA== 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=Ojat7rDteAyd4FHJRTAvewOYEgS5f/na7V+HUwjeBJ4=; b=mtU0aNnaOJ+gohCmjF0Mb4/wN04aoZvmi48/ws5eBDJBptlZD/XRPyeB0w/jI6KkNr +JhBmc8e61myCCxjRizUVBQgoT6XpVKKm46E27E2db9N9XVJ4j2gP71cglBCl4vqZLoc 0ZAozllBwe5oYkN1U+W2uDasqzrmQi4mhyR/aBh2lD3fg18kosgy1zQJcXYZCbUs4CM0 sNjOcu9n6FY8FtgKBc8qW25bvsTyIaZH1fkDKAyWZ1LfiNTxEPU/7dVxCL1OW+cNqoaG /UGcjZuw1nCGYTIbKHCV9CQjuuAC3J+dtCEOc30nz7Azyh7yZq84NM+B2U/O+kFfYI1b 4nUQ== 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 p12si2801823pff.280.2018.04.03.15.12.23; Tue, 03 Apr 2018 15:12:38 -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 S1753688AbeDCWLR (ORCPT + 99 others); Tue, 3 Apr 2018 18:11:17 -0400 Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:46482 "EHLO atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753289AbeDCWLP (ORCPT ); Tue, 3 Apr 2018 18:11:15 -0400 Received: by atrey.karlin.mff.cuni.cz (Postfix, from userid 512) id CD9BE8043E; Wed, 4 Apr 2018 00:11:13 +0200 (CEST) Date: Wed, 4 Apr 2018 00:11:13 +0200 From: Pavel Machek To: Tony Lindgren Cc: Sebastian Reichel , Mark Brown , Liam Girdwood , Rob Herring , 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, Dan Williams Subject: Re: call/normal switch was Re: omap4-droid4: voice call support was Message-ID: <20180403221113.GA9463@amd> References: <20180328140219.f6667up5evrrafkv@earth.universe> <20180329014507.GM5700@atomide.com> <20180331145531.GA10404@amd> <20180331181935.GX5700@atomide.com> <20180331191939.GA8999@amd> <20180331194616.GA19388@amd> <20180331195524.GB19388@amd> <20180331234314.GZ5700@atomide.com> <20180401131852.GA11086@amd> <20180401153631.GA5700@atomide.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="ReaqsoxgOBHFXBhH" Content-Disposition: inline In-Reply-To: <20180401153631.GA5700@atomide.com> 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 --ReaqsoxgOBHFXBhH Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > > If you had a register dump from android with mics working, preferably > > not in speaker mode, perhaps I could try to figure it out? >=20 > OK here are four diffs against starting the phone app for regular > call, speaker call, and muted versions of them: >=20 > http://muru.com/linux/d4/cpcap/ >=20 > Also, I'm connected over cdma right now, not 3g, but I doubt > that makes a difference for the microphone. Thanks! When I apply register settings directly, I indeed get working "normal" call working. Good. Diff for illustration is below. Clearly needs some improvements. And it shows that alsa mixers are expected to be simple and obvious on D4 -- they just do not work. Current version of phone gui is at https://github.com/pavelmachek/unicsy_demo - ofono interface should be usable - AT commands need a lot more work, and they'll probably never work nicely in this design. They are just a temporary hack. (ouch, and it should be rewritten, in Vala or better Rust...) Pavel commit 06acc26c318558ed6a50b5a22afffeb9abbe7553 Author: Pavel Date: Wed Apr 4 00:04:34 2018 +0200 Add support for "normal" (not handsfree) call. diff --git a/sound/soc/codecs/cpcap.c b/sound/soc/codecs/cpcap.c index 7aaa4db..59c02b7 100644 --- a/sound/soc/codecs/cpcap.c +++ b/sound/soc/codecs/cpcap.c @@ -331,7 +331,7 @@ static const char * const cpcap_in_left_mux_texts[] =3D= { }; =20 static const char * const cpcap_mode_texts[] =3D { - "Normal", "Call" + "Normal", "Handsfree", "Call", }; =20 =20 @@ -464,25 +464,11 @@ static int cpcap_mode_get_enum(struct snd_kcontrol *k= control, return 0; } =20 -static int cpcap_mode_put_enum(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_value *ucontrol) +static int enable_call(struct cpcap_audio *cpcap, int on) { - struct snd_soc_codec *codec =3D snd_soc_dapm_kcontrol_codec(kcontrol); - struct cpcap_audio *cpcap =3D snd_soc_codec_get_drvdata(codec); - struct snd_soc_dapm_context *dapm =3D - snd_soc_dapm_kcontrol_dapm(kcontrol); - struct soc_enum *e =3D (struct soc_enum *)kcontrol->private_value; - unsigned int muxval =3D ucontrol->value.enumerated.item[0]; - unsigned int mask =3D BIT(e->shift_l); int err; - - printk("Requested mode %d\n", muxval); - - mode =3D muxval; - - switch (muxval) { - case 1: - + unsigned long mask; +=09 err =3D regmap_update_bits(cpcap->regmap, CPCAP_REG_VAUDIOC, 0xffff, 0x0025); // OK if (err) @@ -516,6 +502,56 @@ static int cpcap_mode_put_enum(struct snd_kcontrol *kc= ontrol, 0x0400, 0x0400); if (err) printk("error #1\n"); + + return 0; +out: + printk("Error!\n"); + return -EIO; +} + +static int cpcap_mode_put_enum(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_codec *codec =3D snd_soc_dapm_kcontrol_codec(kcontrol); + struct cpcap_audio *cpcap =3D snd_soc_codec_get_drvdata(codec); + struct snd_soc_dapm_context *dapm =3D + snd_soc_dapm_kcontrol_dapm(kcontrol); + struct soc_enum *e =3D (struct soc_enum *)kcontrol->private_value; + unsigned int muxval =3D ucontrol->value.enumerated.item[0]; + unsigned int mask =3D BIT(e->shift_l); + int err; + + printk("Requested mode %d\n", muxval); + + mode =3D muxval; + + switch (muxval) { + case 1: + enable_call(cpcap, 1); + break; + case 2: + enable_call(cpcap, 1); + + err =3D regmap_update_bits(cpcap->regmap, CPCAP_REG_TXI, + 0xffff, 0x0cc6); + if (err) + goto out; + + err =3D regmap_update_bits(cpcap->regmap, CPCAP_REG_TXMP, + 0xffff, 0x0673); + if (err) + goto out; + + + err =3D regmap_update_bits(cpcap->regmap, CPCAP_REG_RXOA, + 0xffff, 0x0001); + if (err) + goto out; + =09 + err =3D regmap_update_bits(cpcap->regmap, CPCAP_REG_RXCOA, + 0xffff, 0x0601); + if (err) + goto out; =09 default: break; --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --ReaqsoxgOBHFXBhH Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlrD/AEACgkQMOfwapXb+vKvAQCeK77gxTe+RBIJ3N/CjjJ3OWAN oMYAoIonr0IkrxqyFhQ9wu4KmOi9ob7o =1m4h -----END PGP SIGNATURE----- --ReaqsoxgOBHFXBhH--