},
};
+void tca6424_reset_itr(void)
+{
+ rk2818_mux_api_set(GPIOE_U1IR_I2C1_NAME, IOMUXA_GPIO1_A67);
+ gpio_request(RK2818_PIN_PE6,NULL);
+ gpio_request(RK2818_PIN_PE7,NULL);
+
+ gpio_direction_output(RK2818_PIN_PE6,GPIO_HIGH);
+ gpio_direction_output(RK2818_PIN_PE7,GPIO_LOW);
+ udelay(3);
+ gpio_set_value(RK2818_PIN_PE7,GPIO_HIGH);
+ udelay(1);
+
+ gpio_free(RK2818_PIN_PE6);
+ gpio_free(RK2818_PIN_PE7);
+ rk2818_mux_api_set(GPIOE_U1IR_I2C1_NAME, IOMUXA_I2C1);
+}
+
struct tca6424_platform_data rk2818_tca6424_data={
.gpio_base=GPIO_EXPANDER_BASE,
.gpio_pin_num=CONFIG_EXPANDED_GPIO_NUM,
.settinginfo=extgpio_tca6424_settinginfo,
.settinginfolen=ARRAY_SIZE(extgpio_tca6424_settinginfo),
.names="extend_gpio_tca6424",
+ .reseti2cpin = tca6424_reset_itr,
};
#endif
int (*setup)(struct i2c_client *client,unsigned gpio, unsigned ngpio,void *context);
int (*teardown)(struct i2c_client *client,unsigned gpio, unsigned ngpio,void *context);
char **names;
+ void (*reseti2cpin)(void);
};
return 0;
}
-void tca6424_reset_itr(void)
-{
- rk2818_mux_api_set(GPIOE_U1IR_I2C1_NAME, IOMUXA_GPIO1_A67);
- gpio_request(RK2818_PIN_PE6,NULL);
- gpio_request(RK2818_PIN_PE7,NULL);
-
- gpio_direction_output(RK2818_PIN_PE6,GPIO_HIGH);
- gpio_direction_output(RK2818_PIN_PE7,GPIO_LOW);
- udelay(3);
- gpio_set_value(RK2818_PIN_PE7,GPIO_HIGH);
- udelay(1);
- rk2818_mux_api_set(GPIOE_U1IR_I2C1_NAME, IOMUXA_I2C1);
-
- gpio_free(RK2818_PIN_PE6);
- gpio_free(RK2818_PIN_PE7);
-}
static int __devinit tca6424_probe(struct i2c_client *client,const struct i2c_device_id *id)
{
ret = -EINVAL;
goto out_failed;
}
+
+ client->adapter->dev.platform_data = pdata;
chip->gpio_start = pdata->gpio_base;
chip->gpio_irq_start =pdata->gpio_irq_start;
tca6424_gpio_irq_setup(chip);
i2c_set_clientdata(client, chip);
chip->client = client;
-
return 0;
out_failed:
#define RK2818_I2C_TIMEOUT (msecs_to_jiffies(500))
#define RK2818_DELAY_TIME 2
-#if defined (CONFIG_IOEXTEND_TCA6424)
- void tca6424_reset_itr(void);
-#endif
-
#if 0
#define i2c_dbg(dev, format, arg...) \
dev_printk(KERN_INFO , dev , format , ## arg)
struct rk2818_i2c_data *i2c = (struct rk2818_i2c_data *)adap->algo_data;
unsigned long conr = readl(i2c->regs + I2C_CONR);
int ret = 0;
-
+
+ #if defined (CONFIG_IOEXTEND_TCA6424)
+ struct tca6424_platform_data *pdata = adap->dev.platform_data;
+ #endif
if(msg->len == 0)
{
if(msg->flags & I2C_M_RD)
{
#if defined (CONFIG_IOEXTEND_TCA6424)
- tca6424_reset_itr( );
+ if (pdata && pdata->reseti2cpin) {
+ pdata->reseti2cpin();
+ }
#endif
}