All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] snd-opti9xx: fixes for MED3931 card (opti931)
@ 2012-06-15 18:55 Ondrej Zary
  2012-06-18  7:44   ` Takashi Iwai
  0 siblings, 1 reply; 3+ messages in thread
From: Ondrej Zary @ 2012-06-15 18:55 UTC (permalink / raw)
  To: alsa-devel; +Cc: Kernel development list

MED3931 card did not work (failed with "OPTI chip not found") because
snd-opti9xx gets mc_indir_index from pnp by adding 2 to the pnp-reported port.
It probably works for some cards but not for this one. Datasheet says that
the port is always at 0xe?e so just force the lowest nibble to be 0xe.

Also this card powers up with (ugly) 3D sound enabled. As there's no mixer
control for this, just disable it.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>

--- a/sound/isa/opti9xx/opti92x-ad1848.c
+++ b/sound/isa/opti9xx/opti92x-ad1848.c
@@ -135,7 +135,6 @@ struct snd_opti9xx {
 	unsigned long mc_base_size;
 #ifdef OPTi93X
 	unsigned long mc_indir_index;
-	unsigned long mc_indir_size;
 	struct resource *res_mc_indir;
 	struct snd_wss *codec;
 #endif	/* OPTi93X */
@@ -245,10 +244,8 @@ static int __devinit snd_opti9xx_init(struct snd_opti9xx *chip,
 	case OPTi9XX_HW_82C931:
 	case OPTi9XX_HW_82C933:
 		chip->mc_base = (hardware == OPTi9XX_HW_82C930) ? 0xf8f : 0xf8d;
-		if (!chip->mc_indir_index) {
+		if (!chip->mc_indir_index)
 			chip->mc_indir_index = 0xe0e;
-			chip->mc_indir_size = 2;
-		}
 		chip->password = 0xe4;
 		chip->pwd_reg = 0;
 		break;
@@ -403,7 +400,9 @@ static int __devinit snd_opti9xx_configure(struct snd_opti9xx *chip,
 
 #else	/* OPTi93X */
 	case OPTi9XX_HW_82C931:
-	case OPTi9XX_HW_82C933:
+		/* disable 3D sound (set GPIO1 as output, low) */
+		snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(20), 0x04, 0x0c);
+	case OPTi9XX_HW_82C933: /* FALL THROUGH */
 		/*
 		 * The BTC 1817DW has QS1000 wavetable which is connected
 		 * to the serial digital input of the OPTI931.
@@ -696,8 +695,7 @@ static int __devinit snd_opti9xx_read_check(struct snd_opti9xx *chip)
 		if (value == snd_opti9xx_read(chip, OPTi9XX_MC_REG(1)))
 			return 0;
 #else	/* OPTi93X */
-	chip->res_mc_indir = request_region(chip->mc_indir_index,
-					    chip->mc_indir_size,
+	chip->res_mc_indir = request_region(chip->mc_indir_index, 2,
 					    "OPTi93x MC");
 	if (chip->res_mc_indir == NULL)
 		return -EBUSY;
@@ -770,8 +768,9 @@ static int __devinit snd_card_opti9xx_pnp(struct snd_opti9xx *chip,
 #ifdef OPTi93X
 	port = pnp_port_start(pdev, 0) - 4;
 	fm_port = pnp_port_start(pdev, 1) + 8;
-	chip->mc_indir_index = pnp_port_start(pdev, 3) + 2;
-	chip->mc_indir_size = pnp_port_len(pdev, 3) - 2;
+	/* adjust mc_indir_index - some cards report it at 0xe?d,
+	   other at 0xe?c but it really is always at 0xe?e */
+	chip->mc_indir_index = (pnp_port_start(pdev, 3) & ~0xf) | 0xe;
 #else
 	devmc = pnp_request_card_device(card, pid->devs[2].id, NULL);
 	if (devmc == NULL)

-- 
Ondrej Zary

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [alsa-devel] [PATCH] snd-opti9xx: fixes for MED3931 card (opti931)
  2012-06-15 18:55 [PATCH] snd-opti9xx: fixes for MED3931 card (opti931) Ondrej Zary
@ 2012-06-18  7:44   ` Takashi Iwai
  0 siblings, 0 replies; 3+ messages in thread
From: Takashi Iwai @ 2012-06-18  7:44 UTC (permalink / raw)
  To: Ondrej Zary; +Cc: alsa-devel, Kernel development list

At Fri, 15 Jun 2012 20:55:54 +0200,
Ondrej Zary wrote:
> 
> MED3931 card did not work (failed with "OPTI chip not found") because
> snd-opti9xx gets mc_indir_index from pnp by adding 2 to the pnp-reported port.
> It probably works for some cards but not for this one. Datasheet says that
> the port is always at 0xe?e so just force the lowest nibble to be 0xe.
> 
> Also this card powers up with (ugly) 3D sound enabled. As there's no mixer
> control for this, just disable it.
> 
> Signed-off-by: Ondrej Zary <linux@rainbow-software.org>

Applied.  Thanks.


Takashi


> 
> --- a/sound/isa/opti9xx/opti92x-ad1848.c
> +++ b/sound/isa/opti9xx/opti92x-ad1848.c
> @@ -135,7 +135,6 @@ struct snd_opti9xx {
>  	unsigned long mc_base_size;
>  #ifdef OPTi93X
>  	unsigned long mc_indir_index;
> -	unsigned long mc_indir_size;
>  	struct resource *res_mc_indir;
>  	struct snd_wss *codec;
>  #endif	/* OPTi93X */
> @@ -245,10 +244,8 @@ static int __devinit snd_opti9xx_init(struct snd_opti9xx *chip,
>  	case OPTi9XX_HW_82C931:
>  	case OPTi9XX_HW_82C933:
>  		chip->mc_base = (hardware == OPTi9XX_HW_82C930) ? 0xf8f : 0xf8d;
> -		if (!chip->mc_indir_index) {
> +		if (!chip->mc_indir_index)
>  			chip->mc_indir_index = 0xe0e;
> -			chip->mc_indir_size = 2;
> -		}
>  		chip->password = 0xe4;
>  		chip->pwd_reg = 0;
>  		break;
> @@ -403,7 +400,9 @@ static int __devinit snd_opti9xx_configure(struct snd_opti9xx *chip,
>  
>  #else	/* OPTi93X */
>  	case OPTi9XX_HW_82C931:
> -	case OPTi9XX_HW_82C933:
> +		/* disable 3D sound (set GPIO1 as output, low) */
> +		snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(20), 0x04, 0x0c);
> +	case OPTi9XX_HW_82C933: /* FALL THROUGH */
>  		/*
>  		 * The BTC 1817DW has QS1000 wavetable which is connected
>  		 * to the serial digital input of the OPTI931.
> @@ -696,8 +695,7 @@ static int __devinit snd_opti9xx_read_check(struct snd_opti9xx *chip)
>  		if (value == snd_opti9xx_read(chip, OPTi9XX_MC_REG(1)))
>  			return 0;
>  #else	/* OPTi93X */
> -	chip->res_mc_indir = request_region(chip->mc_indir_index,
> -					    chip->mc_indir_size,
> +	chip->res_mc_indir = request_region(chip->mc_indir_index, 2,
>  					    "OPTi93x MC");
>  	if (chip->res_mc_indir == NULL)
>  		return -EBUSY;
> @@ -770,8 +768,9 @@ static int __devinit snd_card_opti9xx_pnp(struct snd_opti9xx *chip,
>  #ifdef OPTi93X
>  	port = pnp_port_start(pdev, 0) - 4;
>  	fm_port = pnp_port_start(pdev, 1) + 8;
> -	chip->mc_indir_index = pnp_port_start(pdev, 3) + 2;
> -	chip->mc_indir_size = pnp_port_len(pdev, 3) - 2;
> +	/* adjust mc_indir_index - some cards report it at 0xe?d,
> +	   other at 0xe?c but it really is always at 0xe?e */
> +	chip->mc_indir_index = (pnp_port_start(pdev, 3) & ~0xf) | 0xe;
>  #else
>  	devmc = pnp_request_card_device(card, pid->devs[2].id, NULL);
>  	if (devmc == NULL)
> 
> -- 
> Ondrej Zary
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] snd-opti9xx: fixes for MED3931 card (opti931)
@ 2012-06-18  7:44   ` Takashi Iwai
  0 siblings, 0 replies; 3+ messages in thread
From: Takashi Iwai @ 2012-06-18  7:44 UTC (permalink / raw)
  To: Ondrej Zary; +Cc: alsa-devel, Kernel development list

At Fri, 15 Jun 2012 20:55:54 +0200,
Ondrej Zary wrote:
> 
> MED3931 card did not work (failed with "OPTI chip not found") because
> snd-opti9xx gets mc_indir_index from pnp by adding 2 to the pnp-reported port.
> It probably works for some cards but not for this one. Datasheet says that
> the port is always at 0xe?e so just force the lowest nibble to be 0xe.
> 
> Also this card powers up with (ugly) 3D sound enabled. As there's no mixer
> control for this, just disable it.
> 
> Signed-off-by: Ondrej Zary <linux@rainbow-software.org>

Applied.  Thanks.


Takashi


> 
> --- a/sound/isa/opti9xx/opti92x-ad1848.c
> +++ b/sound/isa/opti9xx/opti92x-ad1848.c
> @@ -135,7 +135,6 @@ struct snd_opti9xx {
>  	unsigned long mc_base_size;
>  #ifdef OPTi93X
>  	unsigned long mc_indir_index;
> -	unsigned long mc_indir_size;
>  	struct resource *res_mc_indir;
>  	struct snd_wss *codec;
>  #endif	/* OPTi93X */
> @@ -245,10 +244,8 @@ static int __devinit snd_opti9xx_init(struct snd_opti9xx *chip,
>  	case OPTi9XX_HW_82C931:
>  	case OPTi9XX_HW_82C933:
>  		chip->mc_base = (hardware == OPTi9XX_HW_82C930) ? 0xf8f : 0xf8d;
> -		if (!chip->mc_indir_index) {
> +		if (!chip->mc_indir_index)
>  			chip->mc_indir_index = 0xe0e;
> -			chip->mc_indir_size = 2;
> -		}
>  		chip->password = 0xe4;
>  		chip->pwd_reg = 0;
>  		break;
> @@ -403,7 +400,9 @@ static int __devinit snd_opti9xx_configure(struct snd_opti9xx *chip,
>  
>  #else	/* OPTi93X */
>  	case OPTi9XX_HW_82C931:
> -	case OPTi9XX_HW_82C933:
> +		/* disable 3D sound (set GPIO1 as output, low) */
> +		snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(20), 0x04, 0x0c);
> +	case OPTi9XX_HW_82C933: /* FALL THROUGH */
>  		/*
>  		 * The BTC 1817DW has QS1000 wavetable which is connected
>  		 * to the serial digital input of the OPTI931.
> @@ -696,8 +695,7 @@ static int __devinit snd_opti9xx_read_check(struct snd_opti9xx *chip)
>  		if (value == snd_opti9xx_read(chip, OPTi9XX_MC_REG(1)))
>  			return 0;
>  #else	/* OPTi93X */
> -	chip->res_mc_indir = request_region(chip->mc_indir_index,
> -					    chip->mc_indir_size,
> +	chip->res_mc_indir = request_region(chip->mc_indir_index, 2,
>  					    "OPTi93x MC");
>  	if (chip->res_mc_indir == NULL)
>  		return -EBUSY;
> @@ -770,8 +768,9 @@ static int __devinit snd_card_opti9xx_pnp(struct snd_opti9xx *chip,
>  #ifdef OPTi93X
>  	port = pnp_port_start(pdev, 0) - 4;
>  	fm_port = pnp_port_start(pdev, 1) + 8;
> -	chip->mc_indir_index = pnp_port_start(pdev, 3) + 2;
> -	chip->mc_indir_size = pnp_port_len(pdev, 3) - 2;
> +	/* adjust mc_indir_index - some cards report it at 0xe?d,
> +	   other at 0xe?c but it really is always at 0xe?e */
> +	chip->mc_indir_index = (pnp_port_start(pdev, 3) & ~0xf) | 0xe;
>  #else
>  	devmc = pnp_request_card_device(card, pid->devs[2].id, NULL);
>  	if (devmc == NULL)
> 
> -- 
> Ondrej Zary
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-06-18  7:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-15 18:55 [PATCH] snd-opti9xx: fixes for MED3931 card (opti931) Ondrej Zary
2012-06-18  7:44 ` [alsa-devel] " Takashi Iwai
2012-06-18  7:44   ` Takashi Iwai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.