move tca6424_reset_itr from tca6424.c to board-infosdk.c,this is used in i2c-rk2818 for extgpio interrupt

This commit is contained in:
宋秀杰
2010-08-18 05:57:42 -07:00
parent 5b6f84f810
commit fdd38da677
4 changed files with 28 additions and 23 deletions

View File

@@ -316,6 +316,23 @@ struct rk2818_gpio_expander_info extgpio_tca6424_settinginfo[] = {
},
};
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,
@@ -325,6 +342,7 @@ struct tca6424_platform_data rk2818_tca6424_data={
.settinginfo=extgpio_tca6424_settinginfo,
.settinginfolen=ARRAY_SIZE(extgpio_tca6424_settinginfo),
.names="extend_gpio_tca6424",
.reseti2cpin = tca6424_reset_itr,
};
#endif

View File

@@ -135,6 +135,7 @@ struct tca6424_platform_data {
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);
};

View File

@@ -834,22 +834,6 @@ int tca6424_init_pintype(struct tca6424_chip *chip,struct i2c_client *client)
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)
{
@@ -871,6 +855,8 @@ static int __devinit tca6424_probe(struct i2c_client *client,const struct i2c_de
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;
@@ -905,7 +891,6 @@ static int __devinit tca6424_probe(struct i2c_client *client,const struct i2c_de
tca6424_gpio_irq_setup(chip);
i2c_set_clientdata(client, chip);
chip->client = client;
return 0;
out_failed:

View File

@@ -35,10 +35,6 @@
#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)
@@ -421,7 +417,10 @@ static int rk2818_xfer_msg(struct i2c_adapter *adap,
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)
{
@@ -467,7 +466,9 @@ exit:
if(msg->flags & I2C_M_RD)
{
#if defined (CONFIG_IOEXTEND_TCA6424)
tca6424_reset_itr( );
if (pdata && pdata->reseti2cpin) {
pdata->reseti2cpin();
}
#endif
}