[alsa-devel] asoc: s3c24xx+uda1380 - some questions

Mark Brown broonie at sirena.org.uk
Tue Jan 27 21:00:52 CET 2009


On Tue, Jan 27, 2009 at 06:22:25PM +0200, Vasily Khoruzhick wrote:

> Btw, on rx1950 there're 4 gpio pins involved:
> GPJ0 controls codec power
> GPA1 controls amplifier power
> GPG12 is jack sense pin, it's value depends whether headphone jack is inserted 
You might want to have a look at the jack reporting API that was
recently added, it should save you a bit of code:

	http://git.kernel.org/?p=linux/kernel/git/broonie/sound-2.6.git;a=commit;h=8a2cd6180f8fa00111843c2f4a4f4361995358e0

It'll need a little helper for GPIOs adding to the core but that should
be reusable.

> 	down(&rx1950_power_mutex);
> 	printk("%s: enable == %d\n", __func__, enable);
> 	if (enable) {
> 		if (s3c2410_gpio_getpin(S3C2440_GPJ0))
> 			goto done;
> 		//spin_lock(&cmpl_lock);
> 		//waiting_for_completion = 1;
> 		//spin_unlock(&cmpl_lock);
> 		s3c2410_gpio_setpin(S3C2410_GPD0, 0);
> 		s3c2410_gpio_setpin(S3C2440_GPJ0, 0);
> 		s3c2410_gpio_setpin(S3C2440_GPJ0, 1);
> 
> 		/* Wait for EINT20 irq to ensure uda1380 is powered */
> 		//printk("%s: waiting for compeltion...\n", __func__);
> 		//wait_for_completion(&rx1950_sound_completion);
> 		//printk("%s: completed\n", __func__);
> 		//printk("%s: GPG12: %d\n", __func__,
> 		//	s3c2410_gpio_getpin(S3C2410_GPG12));
> 		mdelay(50);
> 		s3c2410_gpio_setpin(S3C2410_GPD0, 1);
> 		s3c2410_gpio_setpin(S3C2410_GPD0, 0);

Hrm.  The completion makes this look more like it could use a full blown
regulator - it's certainly a pattern that will get reused often enough.

> 	/* configure some gpios */
> 	s3c2410_gpio_cfgpin(S3C2410_GPD0, S3C2410_GPIO_OUTPUT);
> 	s3c2410_gpio_cfgpin(S3C2410_GPG12, S3C2410_GPIO_IRQ);
> 	s3c2410_gpio_cfgpin(S3C2440_GPJ0, S3C2410_GPIO_OUTPUT);

The S3C24xx now supports gpiolib so you should be able to use that - the
platform specific GPIO API will probably get killed at some point.


More information about the Alsa-devel mailing list