Re: [PATCH] Half duplex support for PnP ESS-18xx

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

 



At Mon, 19 Feb 2007 22:27:23 +0100,
Rask Ingemann Lambertsen wrote:
> 
>    Hi.
> 
>    It seems that PnP configured ESS-18xx devices don't have half-duplex
> support. Attached are two patches (against linux-2.6.20) to address this.
> 
>    The first patch allows the driver to recognize a PnP configured card at
> half duplex.
> 
>    The second patch corrects the PnP configuration information for cards
> such as mine which have no configuration option with only one DMA channel.
> 
>    My /proc/asound/cards looks like this:
> 
>  0 [CMI8738        ]: CMI8738 - C-Media PCI CMI8738
>                       C-Media PCI CMI8738 (model 37) at 0xd800, irq 9
>  1 [AZT2320        ]: AZT2320 - Aztech AZT2320
>                       Aztech AZT2320, WSS at 0x400, irq 5, dma 0&1
>  2 [ES1868         ]: ES1868 - ESS AudioDrive ES1868
>                       ESS AudioDrive ES1868 at 0x220, irq 11, dma 3
> 
>    PCM and FM playback works in this configuration. I have not tried PCM
> recording.

The patch looks OK to me, but the change is rather in pnp layer.
Could you send it to Adam Belay <ambx1@xxxxxxxxxx>, the maintainer of
pnp layer?


thanks,

Takashi

> 
> -- 
> Rask Ingemann Lambertsen
> [2 es18xx-half-duplex-patch1 <text/plain; us-ascii (7bit)>]
> --- sound/isa/es18xx.c-orig	2007-02-18 10:16:52.000000000 +0100
> +++ sound/isa/es18xx.c	2007-02-18 10:16:52.000000000 +0100
> @@ -2091,6 +2091,8 @@ static int __devinit snd_audiodrive_pnp_
>  	mpu_port[dev] = pnp_port_start(pdev, 2);
>  	dma1[dev] = pnp_dma(pdev, 0);
>  	dma2[dev] = pnp_dma(pdev, 1);
> +	if (dma2[dev] == -1)
> +		dma2[dev] = dma1[dev];
>  	irq[dev] = pnp_irq(pdev, 0);
>  	snd_printdd("PnP ES18xx: port=0x%lx, fm port=0x%lx, mpu port=0x%lx\n", port[dev], fm_port[dev], mpu_port[dev]);
>  	snd_printdd("PnP ES18xx: dma1=%i, dma2=%i, irq=%i\n", dma1[dev], dma2[dev], irq[dev]);
> [3 es18xx-half-duplex-patch2 <text/plain; us-ascii (7bit)>]
> --- drivers/pnp/quirks.c.orig	2007-02-04 19:44:54.000000000 +0100
> +++ drivers/pnp/quirks.c	2007-02-19 21:24:57.000000000 +0100
> @@ -106,6 +107,64 @@ static void quirk_sb16audio_resources(st
>  	return;
>  }
>  
> +static void quirk_ess1868_audio_resources(struct pnp_dev *dev)
> +{
> +	struct pnp_port *port1, *port2, *port3;
> +	struct pnp_irq *irq1;
> +	struct pnp_dma *dma1;
> +	struct pnp_option *res, *last, *new;
> +	unsigned int n = 0;
> +
> +	/*
> +	 * The card works with only one DMA channel at half duplex, but all
> +	 * configuration options require two DMA channels. Create a new con-
> +	 * figuration option which requires only one DMA channel for half
> +	 * duplex operation.
> +	 */
> +	if (!dev->dependent)
> +		return;
> +	for (res = dev->dependent; res; last = res, res = res->next)
> +		if (!res->dma->next)
> +			return;
> +
> +	if (n == 0 && (port1 = pnp_alloc (sizeof (struct pnp_port))))
> +		n++;
> +	if (n == 1 && (port2 = pnp_alloc (sizeof (struct pnp_port))))
> +		n++;
> +	if (n == 2 && (port3 = pnp_alloc (sizeof (struct pnp_port))))
> +		n++;
> +	if (n == 3 && (irq1 = pnp_alloc (sizeof (struct pnp_irq))))
> +		n++;
> +	if (n == 4 && (dma1 = pnp_alloc (sizeof (struct pnp_dma))))
> +		n++;
> +	if (n == 5 && (new = pnp_register_dependent_option (dev, PNP_RES_PRIORITY_FUNCTIONAL)))
> +		n ++;
> +	switch (n) {
> +		case 5:	 kfree (dma1);	/* fall through */
> +		case 4:  kfree (irq1);	/* fall through */
> +		case 3:	 kfree (port3);	/* fall through */
> +		case 2:  kfree (port2);	/* fall through */
> +		case 1:  kfree (port1);	/* fall through */
> +		case 0:  return;
> +		default: break;
> +	}
> +	memcpy (port1, last->port,		sizeof (struct pnp_port));
> +	port1->next = port2;
> +	memcpy (port2, last->port->next,	sizeof (struct pnp_port));
> +	port2->next = port3;
> +	memcpy (port3, last->port->next->next,	sizeof (struct pnp_port));
> +	port3->next = NULL;
> +	memcpy (irq1,  last->irq,		sizeof (struct pnp_irq));
> +	irq1->next = NULL;
> +	memcpy (dma1,  last->dma,		sizeof (struct pnp_dma));
> +	dma1->next = NULL;
> +	pnp_register_port_resource (new, port1);
> +	pnp_register_irq_resource (new, irq1);
> +	pnp_register_dma_resource (new, dma1);
> +
> +	printk(KERN_INFO "pnp: ESS1868 audio device quirk - enabling half duplex\n");
> +}
> +
>  /*
>   *  PnP Quirks
>   *  Cards or devices that need some tweaking due to incomplete resource info
> @@ -126,6 +185,8 @@ static struct pnp_fixup pnp_fixups[] = {
>  	{ "CTL0043", quirk_sb16audio_resources },
>  	{ "CTL0044", quirk_sb16audio_resources },
>  	{ "CTL0045", quirk_sb16audio_resources },
> +	/* ESS1868 audio device DMA quirk. */
> +	{ "ESS1868", quirk_ess1868_audio_resources },
>  	{ "" }
>  };
>  
> [4  <text/plain; us-ascii (7bit)>]
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys-and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> [5  <text/plain; us-ascii (7bit)>]
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@xxxxxxxxxxxxxxxxxxxxx
> https://lists.sourceforge.net/lists/listinfo/alsa-devel

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/alsa-devel

[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux