AnsweredAssumed Answered

Adding gpio expander (pca9555) to imx6 linux

Question asked by j-g on Jan 21, 2014
Latest reply on Jan 28, 2014 by j-g

Hello,

I am trying to add three pca9555 i2c gpio expanders by adding them to my board file (board-mx6q_qmx6.c) and have some issues I hope someone could help me with.  I've already enabled pca953x in the kernel config and added the below to the board file.  My first question is can someone explain what to place in for .gpio_base specific to the imx6?  I placed in -1 as I saw in a post elsewhere but there were complaints.  I also tried some static values thinking that these must be past the last gpio, 232 for ext1_pdata, 248 for ext2_pdata and 254 for ext3_pdata, but only the first one showed up in /sys/class/gpio/ and got complaints about the other two.  Thank you.

 

Complaints:

pca953x 0-0021: failed to request irq 0

pca953x: probe of 0-0021 failed with error -16

pca953x 0-0022: failed to request irq 0

pca953x: probe of 0-0022 failed with error -16

 

What I put in the board file:

/* PCA9555 */

static struct imxi2c_platform_data mx6q_qmx6_i2c_data = {
.bitrate = 100000,
};


static struct pca953x_platform_data gpio_ext1_pdata = {
.gpio_base = ?,
};

 

static struct pca953x_platform_data gpio_ext2_pdata = {
.gpio_base = ?,
};

 

static struct pca953x_platform_data gpio_ext3_pdata = {
.gpio_base = ?,
};

 

static struct i2c_board_info mxc_i2c0_board_info[] __initdata = {
{
  I2C_BOARD_INFO("pca9555", 0x20),
  .platform_data = &gpio_ext1_pdata,
},
{
  I2C_BOARD_INFO("pca9555", 0x21),
  .platform_data = &gpio_ext2_pdata,
},
{
  I2C_BOARD_INFO("pca9555", 0x22),
  .platform_data = &gpio_ext3_pdata,
},
};

 

Place this in board specific initialization function:   static void __init_mx6_qmx6_board_init(void)

/* I2C */

imx6q_add_imx_i2c(0, &mx6q_qmx6_i2c_data);

Outcomes