Re: call/normal switch was Re: omap4-droid4: voice call support was

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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?
> 
> OK here are four diffs against starting the phone app for regular
> call, speaker call, and muted versions of them:
> 
> http://muru.com/linux/d4/cpcap/
> 
> 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 <pavel@xxxxxx>
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[] = {
 };
 
 static const char * const cpcap_mode_texts[] = {
-	"Normal", "Call"
+	"Normal", "Handsfree", "Call",
 };
 
 
@@ -464,25 +464,11 @@ static int cpcap_mode_get_enum(struct snd_kcontrol *kcontrol,
 	return 0;
 }
 
-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 = snd_soc_dapm_kcontrol_codec(kcontrol);
-	struct cpcap_audio *cpcap = snd_soc_codec_get_drvdata(codec);
-	struct snd_soc_dapm_context *dapm =
-		snd_soc_dapm_kcontrol_dapm(kcontrol);
-	struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
-	unsigned int muxval = ucontrol->value.enumerated.item[0];
-	unsigned int mask = BIT(e->shift_l);
 	int err;
-
-	printk("Requested mode %d\n", muxval);
-
-	mode = muxval;
-
-	switch (muxval) {
-	case 1:
-
+	unsigned long mask;
+	
 		err = 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 *kcontrol,
 				   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 = snd_soc_dapm_kcontrol_codec(kcontrol);
+	struct cpcap_audio *cpcap = snd_soc_codec_get_drvdata(codec);
+	struct snd_soc_dapm_context *dapm =
+		snd_soc_dapm_kcontrol_dapm(kcontrol);
+	struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
+	unsigned int muxval = ucontrol->value.enumerated.item[0];
+	unsigned int mask = BIT(e->shift_l);
+	int err;
+
+	printk("Requested mode %d\n", muxval);
+
+	mode = muxval;
+
+	switch (muxval) {
+	case 1:
+		enable_call(cpcap, 1);
+		break;
+	case 2:
+		enable_call(cpcap, 1);
+
+		err = regmap_update_bits(cpcap->regmap, CPCAP_REG_TXI,
+					 0xffff, 0x0cc6);
+		if (err)
+			goto out;
+
+		err = regmap_update_bits(cpcap->regmap, CPCAP_REG_TXMP,
+					 0xffff, 0x0673);
+		if (err)
+			goto out;
+
+
+		err = regmap_update_bits(cpcap->regmap, CPCAP_REG_RXOA,
+					 0xffff, 0x0001);
+		if (err)
+			goto out;
+		
+		err = regmap_update_bits(cpcap->regmap, CPCAP_REG_RXCOA,
+					 0xffff, 0x0601);
+		if (err)
+			goto out;
 		
 	default:
 		break;

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux