[alsa-devel] [PATCH] ASoC: SDP3430: Add support for EXTMUTE using TWL GPIO6

Peter Ujfalusi peter.ujfalusi at nokia.com
Tue Aug 4 08:58:15 CEST 2009


On Wednesday 15 July 2009 04:04:08 ext Candelaria Villareal, Jorge wrote:
> Board sdp3430 has hardware support for EXTMUTE using TWL4030 GPIO6
> line, controlled by register INTBR_PMBR1. Machine driver takes care
> of enabling gpio line through i2c and codec driver manipulates the
> line during headset ramp up/down sequence.
>
> +#define TWL4030_INTBR_PMBR1	0x0D
> +#define EXTMUTE(value)		(value << 2)

This is confusing, should it be something like this?:
#define GPIO6_PWM0_MUX(value)		(value << 2)

> +	/* Set TWL4030 GPIO6 as EXTMUTE signal */
> +	twl4030_i2c_write_u8(TWL4030_MODULE_INTBR, EXTMUTE(0x02),
> +							TWL4030_MODULE_INTBR);

I think you meant this:
twl4030_i2c_write_u8(TWL4030_MODULE_INTBR, EXTMUTE(0x02),
							TWL4030_INTBR_PMBR1);

Furthermore, since you are modifying pin muxing register, I think it is safer 
to do something like this here to avoid changing other pin's function:

u8 pin_mux;

twl4030_i2c_read_u8(TWL4030_MODULE_INTBR, &pin_mux,
							TWL4030_INTBR_PMBR1);
pin_mux &= ~GPIO6_PWM0_MUX(0x3);
pin_mux |= GPIO6_PWM0_MUX(0x2);
twl4030_i2c_write_u8(TWL4030_MODULE_INTBR, pin_mux,
							TWL4030_INTBR_PMBR1);


-- 
Péter


More information about the Alsa-devel mailing list