imx233: add pinctrl debug code to track pin uses

Past development has proved that one can mistakely use
the same pin for two uses without noticing. Since this
causes extremely hard to find bugs, the infrastructure
will allow to register pin uses and panic when a conflict
is detected. The pinctrl debug now shows the pin uses
when its support is compiled in.

Change-Id: Idb2d5235ce09207d77aa474d6f158e72b933761a
This commit is contained in:
Amaury Pouly 2012-05-10 00:08:03 +02:00
parent d29a11b7a8
commit 645680d62b
13 changed files with 122 additions and 6 deletions

View file

@ -41,6 +41,7 @@ void _backlight_set_brightness(int brightness)
bool _backlight_init(void)
{
imx233_pinctrl_acquire_pin(1, 28, "backlight");
imx233_set_pin_function(1, 28, PINCTRL_FUNCTION_GPIO);
imx233_set_pin_drive_strength(1, 28, PINCTRL_DRIVE_8mA);
imx233_enable_gpio_output(1, 28, true);

View file

@ -301,7 +301,8 @@ void button_init_device(void)
* The B0P26 line seems to be related to the touchpad
*/
/* touchpad CE ? */
/* touchpad power */
imx233_pinctrl_acquire_pin(0, 26, "touchpad power");
imx233_set_pin_function(0, 26, PINCTRL_FUNCTION_GPIO);
imx233_enable_gpio_output(0, 26, false);
imx233_set_pin_drive_strength(0, 26, PINCTRL_DRIVE_8mA);
@ -324,10 +325,12 @@ void button_init_device(void)
create_thread(rmi_thread, rmi_stack, sizeof(rmi_stack), 0,
rmi_thread_name IF_PRIO(, PRIORITY_USER_INTERFACE) IF_COP(, CPU));
/* enable interrupt */
imx233_pinctrl_acquire_pin(0, 27, "touchpad int");
imx233_set_pin_function(0, 27, PINCTRL_FUNCTION_GPIO);
imx233_enable_gpio_output(0, 27, false);
imx233_setup_pin_irq(0, 27, true, true, false, &rmi_attn_cb);
/* Volume down */
imx233_pinctrl_acquire_pin(1, 30, "volume down");
imx233_set_pin_function(1, 30, PINCTRL_FUNCTION_GPIO);
imx233_enable_gpio_output(1, 30, false);
}
@ -336,6 +339,10 @@ void button_init_device(void)
void button_init_device(void)
{
/* Volume down */
imx233_pinctrl_acquire_pin(1, 30, "volume down");
imx233_set_pin_function(1, 30, PINCTRL_FUNCTION_GPIO);
imx233_enable_gpio_output(1, 30, false);
}
int touchpad_read_device(void)

View file

@ -87,6 +87,8 @@ struct i2c_interface fmradio_i2c =
void fmradio_i2c_init(void)
{
imx233_pinctrl_acquire_pin(1, 24, "fmradio i2c");
imx233_pinctrl_acquire_pin(1, 22, "fmradio i2c");
imx233_set_pin_function(1, 24, PINCTRL_FUNCTION_GPIO);
imx233_set_pin_function(1, 22, PINCTRL_FUNCTION_GPIO);
fmradio_i2c_bus = i2c_add_node(&fmradio_i2c);

View file

@ -56,6 +56,13 @@ static void setup_lcd_pins(bool use_lcdif)
/* WARNING
* the B1P22 and B1P24 pins are used by the tuner i2c! Do NOT drive
* them as lcd_dotclk and lcd_hsync or it will break the tuner! */
imx233_pinctrl_acquire_pin(1, 18, "lcd reset");
imx233_pinctrl_acquire_pin(1, 19, "lcd rs");
imx233_pinctrl_acquire_pin(1, 20, "lcd wr");
imx233_pinctrl_acquire_pin(1, 21, "lcd cs");
imx233_pinctrl_acquire_pin(1, 23, "lcd enable");
imx233_pinctrl_acquire_pin(1, 25, "lcd vsync");
imx233_pinctrl_acquire_pin_mask(1, 0x3ffff, "lcd data");
if(use_lcdif)
{
imx233_set_pin_function(1, 25, PINCTRL_FUNCTION_GPIO); /* lcd_vsync */
@ -71,7 +78,7 @@ static void setup_lcd_pins(bool use_lcdif)
else
{
__REG_SET(HW_PINCTRL_MUXSEL(2)) = 0xffffffff; /* lcd_d{0-15} */
imx233_enable_gpio_output_mask(1, 0x3ffffff, false); /* lcd_{d{0-17},reset,rs,wr,cs,dotclk,enable,hsync,vsync} */
imx233_enable_gpio_output_mask(1, 0x2bfffff, false); /* lcd_{d{0-17},reset,rs,wr,cs,enable,vsync} */
imx233_set_pin_function(1, 16, PINCTRL_FUNCTION_GPIO); /* lcd_d16 */
imx233_set_pin_function(1, 17, PINCTRL_FUNCTION_GPIO); /* lcd_d17 */
imx233_set_pin_function(1, 19, PINCTRL_FUNCTION_GPIO); /* lcd_rs */

View file

@ -33,6 +33,7 @@ bool tuner_power(bool enable)
if(enable != tuner_enable)
{
/* CE is B029 (active high) */
imx233_pinctrl_acquire_pin(0, 29, "tuner power");
imx233_set_pin_function(0, 29, PINCTRL_FUNCTION_GPIO);
imx233_set_pin_drive_strength(0, 29, PINCTRL_DRIVE_4mA);
imx233_enable_gpio_output(0, 29, enable);