Skip to contentSkip to conversation

Add mute support for FM-only card with FM801 PCI to tuner bridge

PATCH Applied Andy Shevchenko 2 participants 2 messages Jan 24, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add mute support for FM-only card with FM801 PCI to tuner bridge

This is improvement of the early support of the FM-only cards where the fm801 chip represents the PCI to tuner bridge.

The tuner initialization isn't included the mute on as well as mute support via V4L request. Proposed patch should fix this at least for 64-PCR model.

alsa-kernel/i2c/other/tea575x-tuner.c renamed from alsa-kernel/i2c/other/tea575x-tuner.c.mute-fix +8 -0
@@ -158,6 +158,10 @@ static int snd_tea575x_ioctl(struct inod
 			struct video_audio v;
 			if(copy_from_user(&v, arg, sizeof(v))) 
 				return -EFAULT;	
+			if (tea->ops->mute)
+				tea->ops->mute(tea,
+					       (v.flags &
+						VIDEO_AUDIO_MUTE) ? 1 : 0);
 			if(v.audio) 
 				return -EINVAL;
 			return 0;
@@ -205,6 +209,10 @@ void snd_tea575x_init(struct snd_tea575x
 	tea->freq = 90500 * 16;		/* 90.5Mhz default */
 
 	snd_tea575x_set_freq(tea);
+
+	/* mute on init */
+	if (tea->ops->mute)
+		tea->ops->mute(tea, 1);
 }
 
 void snd_tea575x_exit(struct snd_tea575x *tea)
alsa-kernel/pci/fm801.c renamed from alsa-kernel/pci/fm801.c.mute-fix +24 -0
@@ -978,21 +978,45 @@ static unsigned int snd_fm801_tea575x_64
 	return val;
 }
 
+static void snd_fm801_tea575x_64pcr_mute(struct snd_tea575x *tea,
+					  unsigned int mute)
+{
+	struct fm801 *chip = tea->private_data;
+	unsigned short reg;
+
+	spin_lock_irq(&chip->reg_lock);
+
+	reg = inw(FM801_REG(chip, GPIO_CTRL));
+	if (mute)
+		/* 0xf800 (mute) */
+		reg &= ~FM801_GPIO_GP(TEA_64PCR_WRITE_ENABLE);
+	else
+		/* 0xf802 (unmute) */
+		reg |= FM801_GPIO_GP(TEA_64PCR_WRITE_ENABLE);
+	outw(reg, FM801_REG(chip, GPIO_CTRL));
+	udelay(1);
+
+	spin_unlock_irq(&chip->reg_lock);
+}
+
 static struct snd_tea575x_ops snd_fm801_tea_ops[3] = {
 	{
 		/* 1 = MediaForte 256-PCS */
 		.write = snd_fm801_tea575x_256pcs_write,
 		.read = snd_fm801_tea575x_256pcs_read,
+		.mute = NULL,
 	},
 	{
 		/* 2 = MediaForte 256-PCPR */
 		.write = snd_fm801_tea575x_256pcpr_write,
 		.read = snd_fm801_tea575x_256pcpr_read,
+		.mute = NULL,
 	},
 	{
 		/* 3 = MediaForte 64-PCR */
 		.write = snd_fm801_tea575x_64pcr_write,
 		.read = snd_fm801_tea575x_64pcr_read,
+		.mute = snd_fm801_tea575x_64pcr_mute,
 	}
 };
 #endif
alsa-kernel/include/tea575x-tuner.h renamed from alsa-kernel/include/tea575x-tuner.h.mute-fix +1 -0
@@ -30,6 +30,7 @@ struct snd_tea575x;
 struct snd_tea575x_ops {
 	void (*write)(struct snd_tea575x *tea, unsigned int val);
 	unsigned int (*read)(struct snd_tea575x *tea);
+	void (*mute)(struct snd_tea575x *tea, unsigned int mute);
 };
 
 struct snd_tea575x {
Signature · 2 lines
With best regards,
Andy Shevchenko.      mailto: [email protected]
Applied
#1 lore raw

At Thu, 24 Jan 2008 19:00:04 +0200,

Quoted 9 lines · Andy Shevchenko

This is improvement of the early support of the FM-only cards where the fm801 chip represents the PCI to tuner bridge.

The tuner initialization isn't included the mute on as well as mute support via V4L request. Proposed patch should fix this at least for 64-PCR model.

Applied. Thanks.

Takashi