[alsa-devel] [PATCH] sscape: support for audio part of VIVO cards

Takashi Iwai tiwai at suse.de
Mon Sep 17 14:30:22 CEST 2007


At Sun, 16 Sep 2007 22:50:24 +0200,
Krzysztof Helt wrote:
> 
> From: Krzysztof Helt <krzysztof.h1 at wp.pl>
> 
> This patch adds support for audio part of the Ensoniq
> SoundScape VIVO cards. The MIDI part is not supported.
> 
> Signed-off-by: Krzysztof Helt <krzysztof.h1 at wp.pl>
> ---
> 
> This patch requires the previous sscape patch (extension
> to new settings).
> 
> I created waiting loop and the previous magic write
> after the code in the OSS driver. The whole detection
> is magic from the OSS driver.
> 
> The MPU is not created on VIVO cards as it does not work.
> 
> The linear frequency setting for the AD1845 does not work
> for me (the frequency is incorrectly set). IMO, it is better 
> to move extended AD1845 support into the CS4231 library.

Sounds good.  I have no objectin if it doesn't conflict with other
drivers.


> --- linux-2.6.22.old/sound/isa/sscape.c	2007-09-16 07:53:56.000000000 +0200
> +++ linux-2.6.22/sound/isa/sscape.c	2007-09-16 20:20:48.000000000 +0200
> @@ -142,10 +142,12 @@ enum card_type {
>  struct soundscape {
>  	spinlock_t lock;
>  	unsigned io_base;
> +	unsigned wss_base;
>  	int codec_type;
>  	int ic_type;
>  	enum card_type type;
>  	struct resource *io_res;
> +	struct resource *wss_res;
>  	struct snd_cs4231 *chip;
>  	struct snd_mpu401 *mpu;
>  	struct snd_hwdep *hw;
> @@ -358,6 +360,8 @@ static void soundscape_free(struct snd_c
>  {
>  	register struct soundscape *sscape = get_card_soundscape(c);
>  	release_and_free_resource(sscape->io_res);
> +	if (sscape->wss_res)
> +		release_and_free_resource(sscape->wss_res);

You don't need NULL check here.

> +	d  = sscape_read_unsafe(s->io_base, GA_HMCTL_REG) & 0x3f;
> +	sscape_write_unsafe(s->io_base, GA_HMCTL_REG, d | 0xc0);
> +
> +	if (s->type == SSCAPE_VIVO)
> +		codec += 4;
> +	/* wait for WSS codec */
> +	for (d = 0; d < 500; d++) {
> +		if ((inb(codec) & 0x80) == 0) break;

Break a line please.


> @@ -1104,12 +1151,13 @@ static int __devinit create_ad1845(struc
>   */
>  static int __devinit create_sscape(int dev, struct snd_card *card)
>  {
> -	register struct soundscape *sscape;
> +	register struct soundscape *sscape = get_card_soundscape(card);

Let's get rid of register prefix.


>  	register unsigned dma_cfg;

Ditto.

> @@ -1133,13 +1181,24 @@ static int __devinit create_sscape(int d
>  	 * Grab IO ports that we will need to probe so that we
>  	 * can detect and control this hardware ...
>  	 */
> -	if ((io_res = request_region(xport, 8, "SoundScape")) == NULL) {
> +	io_res = request_region(xport, 8, "SoundScape");
> +	if (!io_res) {
>  		snd_printk(KERN_ERR "sscape: can't grab port 0x%x\n", xport);
>  		return -EBUSY;
>  	}
> +	wss_res = 0;

Better to use NULL.

> @@ -1253,6 +1323,8 @@ _release_dma:
>  	free_dma(dma1[dev]);
>  
>  _release_region:
> +	if (wss_res)
> +		release_and_free_resource(wss_res);

No need for NULL check.


thanks,

Takashi


More information about the Alsa-devel mailing list