Skip to contentSkip to conversation

complete the AK5365 support

PATCH Applied Jochen Voss 2 participants 4 messages Aug 8, 2006 – Aug 22, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 complete the AK5365 support

Complete the AK5365 support.

This adds a boolean control to toggle the soft mute feature of the AK5365 chip.

alsa-kernel/i2c/other/ak4xxx-adda.c +72 -0
diff -ur alsa-driver-1.0.12rc2.orig/alsa-kernel/i2c/other/ak4xxx-adda.c alsa-driver-1.0.12rc2/alsa-kernel/i2c/other/ak4xxx-adda.c
@@ -472,6 +472,57 @@
 	return change;
 }
 
+static int ak4xxx_switch_info(struct snd_kcontrol *kcontrol,
+			      struct snd_ctl_elem_info *uinfo)
+{
+	uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
+	uinfo->count = 1;
+	uinfo->value.integer.min = 0;
+	uinfo->value.integer.max = 1;
+	return 0;
+}
+
+static int ak4xxx_switch_get(struct snd_kcontrol *kcontrol,
+			     struct snd_ctl_elem_value *ucontrol)
+{
+	struct snd_akm4xxx *ak = snd_kcontrol_chip(kcontrol);
+	int chip = AK_GET_CHIP(kcontrol->private_value);
+	int addr = AK_GET_ADDR(kcontrol->private_value);
+	int shift = AK_GET_SHIFT(kcontrol->private_value);
+	int invert = AK_GET_INVERT(kcontrol->private_value);
+	unsigned char val = snd_akm4xxx_get(ak, chip, addr);
+
+	if (invert)
+		val = ! val;
+	ucontrol->value.integer.value[0] = (val & (1<<shift)) != 0;
+	return 0;
+}
+
+static int ak4xxx_switch_put(struct snd_kcontrol *kcontrol,
+			     struct snd_ctl_elem_value *ucontrol)
+{
+	struct snd_akm4xxx *ak = snd_kcontrol_chip(kcontrol);
+	int chip = AK_GET_CHIP(kcontrol->private_value);
+	int addr = AK_GET_ADDR(kcontrol->private_value);
+	int shift = AK_GET_SHIFT(kcontrol->private_value);
+	int invert = AK_GET_INVERT(kcontrol->private_value);
+	long flag = ucontrol->value.integer.value[0];
+	unsigned char val, oval;
+	int change;
+
+	if (invert)
+		flag = ! flag;
+	oval = snd_akm4xxx_get(ak, chip, addr);
+	if (flag)
+		val = oval | (1<<shift);
+	else
+		val = oval & ~(1<<shift);
+	change = (oval != val);
+	if (change)
+		snd_akm4xxx_write(ak, chip, addr, val);
+	return change;
+}
+
 /*
  * build AK4xxx controls
  */
@@ -621,6 +672,27 @@
 					      SNDRV_CTL_ELEM_ACCESS_WRITE));
 		if (err < 0)
 			goto __error;
+
+		memset(ctl, 0, sizeof(*ctl));
+		if (ak->channel_names == NULL)
+			strcpy(ctl->id.name, "Capture Switch");
+		else
+			strcpy(ctl->id.name, ak->channel_names[1]);
+		ctl->id.index = ak->idx_offset * 2;
+		ctl->id.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
+		ctl->count = 1;
+		ctl->info = ak4xxx_switch_info;
+		ctl->get = ak4xxx_switch_get;
+		ctl->put = ak4xxx_switch_put;
+		/* register 2, bit 0 (SMUTE): 0 = normal operation, 1 = mute */
+		ctl->private_value =
+			AK_COMPOSE(0, 2, 0, 0) | AK_INVERT;
+		ctl->private_data = ak;
+		err = snd_ctl_add(ak->card,
+				  snd_ctl_new(ctl, SNDRV_CTL_ELEM_ACCESS_READ|
+					      SNDRV_CTL_ELEM_ACCESS_WRITE));
+		if (err < 0)
+			goto __error;
 	}
 
 	if (ak->type == SND_AK4355 || ak->type == SND_AK4358)
alsa-kernel/pci/ice1712/revo.c +1 -1
diff -ur alsa-driver-1.0.12rc2.orig/alsa-kernel/pci/ice1712/revo.c alsa-driver-1.0.12rc2/alsa-kernel/pci/ice1712/revo.c
@@ -99,7 +99,7 @@
 					"PCM LFE Playback Volume", "PCM Rear Playback Volume"};
 
 static unsigned int revo51_adc_num_stereo[] = {2};
-static char *revo51_adc_channel_names[] = {"PCM Capture Volume"};
+static char *revo51_adc_channel_names[] = {"PCM Capture Volume","PCM Capture Switch"};
 
 static struct snd_akm4xxx akm_revo_front __devinitdata = {
 	.type = SND_AK4381,

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

_______________________________________________
Alsa-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

Applied
#1 lore raw

At Tue, 8 Aug 2006 23:59:09 +0100,

Quoted 7 lines · Jochen Voss

Complete the AK5365 support.

This adds a boolean control to toggle the soft mute feature of the AK5365 chip.

Thanks, applied to ALSA HG tree.

One missing thing I found is that AK5365 isn't in snd_akm4xxx_init(). When CONFIG_SND_DEBUG=y, this will cause an error message (in
default: case). Could you add a proper init sequence there?

Takashi

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

#2 lore raw

Hi Takashi,

Quoted 3 lines · Takashi Iwai

One missing thing I found is that AK5365 isn't in snd_akm4xxx_init(). When CONFIG_SND_DEBUG=y, this will cause an error message (in
default: case). Could you add a proper init sequence there?

Currently I am travelling, with no good internet connection and no access to the machine in question. I will prepare something in once I am back (in two weeks or so).

All the best and sorry about the delay,
Jochen

Signature · 1 line
http://seehuhn.de/

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

_______________________________________________
Alsa-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

#3 lore raw
In reply to Takashi Iwai

Hi Takashi,

Quoted 3 lines · Takashi Iwai

One missing thing I found is that AK5365 isn't in snd_akm4xxx_init(). When CONFIG_SND_DEBUG=y, this will cause an error message (in
default: case). Could you add a proper init sequence there?

Ok, I am back now. I see that in the mean time somebody added the following:

alsa-kernel/i2c/other/ak4xxx-adda.c 2006-08-14 11:55:24.000000000 +0100 renamed from alsa-kernel/i2c/other/ak4xxx-adda.c 2006-08-08 23:53:09.000000000 +0100 +2 -0
diff -ur alsa-driver-1.0.12rc2/alsa-kernel/i2c/other/ak4xxx-adda.c alsa-driver-1.0.12rc3/alsa-kernel/i2c/other/ak4xxx-adda.c
@@ -137,6 +137,8 @@
        case SND_AK4381:
                ak4381_reset(ak, state);
                break;
+       default:
+               break;
        }
 }
 

From the data sheet of the chip it seems to me that there is no way to initialise the chip via register settings. Should I add a procedure which writes the default values from the data sheet to all registers instead? Or is the current way (doing nothing) ok?

All the best,
Jochen

Signature · 1 line
http://seehuhn.de/

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

_______________________________________________
Alsa-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-devel