/*
*
*/
- int rk808_i2c_read(struct rk808 *rk808, char reg, int count,u16 *dest)
+ int rk808_i2c_read(struct rk808 *rk808, char reg, int count,u8 *dest)
{
struct i2c_client *i2c = rk808->i2c;
msgs[0].len = 1;
msgs[0].scl_rate = 200*1000;
- msgs[1].buf = (u8 *)dest;
+ msgs[1].buf = dest;
msgs[1].addr = i2c->addr;
msgs[1].flags = I2C_M_RD;
msgs[1].len = count;
return 0;
}
-int rk808_i2c_write(struct rk808 *rk808, char reg, int count, const u16 src)
+int rk808_i2c_write(struct rk808 *rk808, char reg, int count, const u8 src)
{
int ret=-1;
struct i2c_client *i2c = rk808->i2c;
u8 rk808_reg_read(struct rk808 *rk808, u8 reg)
{
- u16 val = 0;
+ u8 val = 0;
mutex_lock(&rk808->io_lock);
}
EXPORT_SYMBOL_GPL(rk808_reg_write);
- int rk808_set_bits(struct rk808 *rk808, u8 reg, u16 mask, u16 val)
+ int rk808_set_bits(struct rk808 *rk808, u8 reg, u8 mask, u8 val)
{
- u16 tmp;
+ u8 tmp;
int ret;
mutex_lock(&rk808->io_lock);
int ret;
#if defined(CONFIG_MFD_RK610)
- int i; //Solve communication conflict when rk610 and 808 on the same i2c
+ int i; //Solve communication conflict when rk610 and rk808 on the same i2c
mutex_lock(&rk808->io_lock);
for(i=0; i<count; i++){
#else
mutex_lock(&rk808->io_lock);
- ret = rk808_i2c_read(rk808, reg, count, buf);
+ ret = rk808->read(rk808, reg, count, buf);
mutex_unlock(&rk808->io_lock);
#endif
#else
mutex_lock(&rk808->io_lock);
- ret = rk808_i2c_write(rk808, reg, count, buf);
+ ret = rk808->write(rk808, reg, count, buf);
mutex_unlock(&rk808->io_lock);
#endif
u32 getdata[8];
u16 regAddr;
u8 data;
- int ret=0;
char cmd;
const char *buftmp = buf;
struct rk808 *rk808 = g_rk808;
rk808->i2c = i2c;
rk808->dev = &i2c->dev;
i2c_set_clientdata(i2c, rk808);
+ rk808->read = rk808_i2c_read;
+ rk808->write = rk808_i2c_write;
mutex_init(&rk808->io_lock);
ret = mfd_add_devices(rk808->dev, -1,
}
//for rtc irq test
+ /*
rk808_set_bits(rk808_rtc->rk808, RK808_RTC_STATUS_REG,(0x1<< 6),(0x1 <<6));
rk808_set_bits(rk808_rtc->rk808, RK808_RTC_INT_REG,0x0c,0x0c);
rk808_set_bits(rk808_rtc->rk808,RK808_INT_STS_REG1,(0x3 << 5),(0x3 <<5));
rk808_set_bits(rk808_rtc->rk808, RK808_INT_STS_MSK_REG1,(0x3 <<5),0);
-
+*/
enable_irq_wake(alm_irq); // so rk808 alarm irq can wake up system
rk808_pdev = pdev;
int irq_num;
int chip_irq;
u32 irq_mask;
+ int (*read)(struct rk808 *rk808, u8 reg, int size, void *dest);
+ int (*write)(struct rk808 *rk808, u8 reg, int size, void *src);
};
struct rk808_platform_data {
};
int rk808_irq_init(struct rk808 *rk808, int irq,struct rk808_platform_data *pdata);
- int rk808_i2c_read(struct rk808 *rk808, char reg, int count,u16 *dest);
+ int rk808_i2c_read(struct rk808 *rk808, char reg, int count,u8 *dest);
//int rk808_i2c_read(struct i2c_client *i2c, char reg, int count,u16 *dest);
// int rk808_i2c_read(struct rk808 *rk808 , u8 reg, int bytes,void *dest);
-int rk808_i2c_write(struct rk808 *rk808, char reg, int count, const u16 src);
-int rk808_set_bits(struct rk808 *rk808, u8 reg, u16 mask, u16 val);
+int rk808_i2c_write(struct rk808 *rk808, char reg, int count, const u8 src);
+int rk808_set_bits(struct rk808 *rk808, u8 reg, u8 mask, u8 val);
int rk808_clear_bits(struct rk808 *rk808, u8 reg, u8 mask);
u8 rk808_reg_read(struct rk808 *rk808, u8 reg);
int rk808_reg_write(struct rk808 *rk808, u8 reg, u8 val);