[alsa-devel] [RFC] add a "private" field to the ac97 struct

William Pitcock nenolod at sacredspiral.co.uk
Thu Mar 6 18:12:37 CET 2008


Hi,

Why not modify ucb1400_detect_irq() to get an openfirmware handle on
PowerPC and read the resource tree at that time? This seems like a
better approach.

William

On Thu, 2008-03-06 at 17:42 +0100, Sebastian Siewior wrote:
> I have a PowerPC board with an AC97 controller and that one has an
> UCB1400 attached.
> Currently the UCB1400 driver discovers the interrupt via probing. This
> doesn't really work here. The resources are read from the device tree.
> I haven't found any other driver besides ucb1400_ts that uses the
> ac97_bus_type so I can't check where others get their HW information
> from.
> 
> My proposal is to introduce a new field in struct snd_ac97 where the
> AC97 driver can leave the required HW info regarding the attached (in my
> case the interrupt for the ucb1400) before calling snd_card_register().
> I attached just a single int field since I am not aware if multiple
> devices / resource are realistic / possible. In that case maybe a void *
> or struct platform_device would be a better choice.
> 
> Signed-off-by: Sebastian Siewior <sebastian at breakpoint.cc>
> ---
>  drivers/input/touchscreen/ucb1400_ts.c |   13 ++++++++-----
>  include/sound/ac97_codec.h             |    2 ++
>  2 files changed, 10 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/ucb1400_ts.c b/drivers/input/touchscreen/ucb1400_ts.c
> index 607f993..95d1fea 100644
> --- a/drivers/input/touchscreen/ucb1400_ts.c
> +++ b/drivers/input/touchscreen/ucb1400_ts.c
> @@ -492,11 +492,14 @@ static int ucb1400_ts_probe(struct device *dev)
>  		goto err_free_devs;
>  	}
>  
> -	error = ucb1400_detect_irq(ucb);
> -	if (error) {
> -		printk(KERN_ERR "UCB1400: IRQ probe failed\n");
> -		goto err_free_devs;
> -	}
> +	if (!ucb->ac97->device_irq) {
> +		error = ucb1400_detect_irq(ucb);
> +		if (error) {
> +			printk(KERN_ERR "UCB1400: IRQ probe failed\n");
> +			goto err_free_devs;
> +		}
> +	} else
> +		ucb->irq = ucb->ac97->device_irq;
>  
>  	error = request_irq(ucb->irq, ucb1400_hard_irq, IRQF_TRIGGER_RISING,
>  				"UCB1400", ucb);
> diff --git a/include/sound/ac97_codec.h b/include/sound/ac97_codec.h
> index 0148058..bf920a2 100644
> --- a/include/sound/ac97_codec.h
> +++ b/include/sound/ac97_codec.h
> @@ -474,6 +474,8 @@ struct snd_ac97 {
>  	struct snd_ac97_build_ops * build_ops;
>  	void *private_data;
>  	void (*private_free) (struct snd_ac97 *ac97);
> +	/* device attached to the AC97 bus */
> +	int device_irq;
>  	/* --- */
>  	struct snd_ac97_bus *bus;
>  	struct pci_dev *pci;	/* assigned PCI device - used for quirks */
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20080306/cf3ef8de/attachment.sig 


More information about the Alsa-devel mailing list