From d4c35cbe4a7ce24697407980566121d83c092764 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E5=BC=A0=E6=99=B4?= Date: Sun, 7 Apr 2013 11:54:55 +0800 Subject: [PATCH] rk808:modify some warning --- drivers/mfd/rk808.c | 21 +++++++++++---------- drivers/rtc/rtc-rk808.c | 3 ++- include/linux/mfd/rk808.h | 8 +++++--- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/drivers/mfd/rk808.c b/drivers/mfd/rk808.c index 6f921142b642..30bae3db1e71 100755 --- a/drivers/mfd/rk808.c +++ b/drivers/mfd/rk808.c @@ -608,7 +608,7 @@ static struct regulator_desc regulators[] = { /* * */ - 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; @@ -630,7 +630,7 @@ static struct regulator_desc regulators[] = { 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; @@ -642,7 +642,7 @@ static struct regulator_desc regulators[] = { 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; @@ -671,7 +671,7 @@ int rk808_i2c_write(struct rk808 *rk808, char reg, int count, const u16 src) u8 rk808_reg_read(struct rk808 *rk808, u8 reg) { - u16 val = 0; + u8 val = 0; mutex_lock(&rk808->io_lock); @@ -700,9 +700,9 @@ int rk808_reg_write(struct rk808 *rk808, u8 reg, u8 val) } 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); @@ -751,7 +751,7 @@ int rk808_bulk_read(struct rk808 *rk808, u8 reg, 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; iio_lock); - ret = rk808_i2c_read(rk808, reg, count, buf); + ret = rk808->read(rk808, reg, count, buf); mutex_unlock(&rk808->io_lock); #endif @@ -798,7 +798,7 @@ int rk808_bulk_write(struct rk808 *rk808, u8 reg, #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 @@ -815,7 +815,6 @@ static ssize_t rk808_test_store(struct kobject *kobj, struct kobj_attribute *att u32 getdata[8]; u16 regAddr; u8 data; - int ret=0; char cmd; const char *buftmp = buf; struct rk808 *rk808 = g_rk808; @@ -1000,6 +999,8 @@ static int __devinit rk808_i2c_probe(struct i2c_client *i2c, const struct i2c_de 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, diff --git a/drivers/rtc/rtc-rk808.c b/drivers/rtc/rtc-rk808.c index 91cd8db2d81b..adaec3302db5 100755 --- a/drivers/rtc/rtc-rk808.c +++ b/drivers/rtc/rtc-rk808.c @@ -630,11 +630,12 @@ static int rk808_rtc_probe(struct platform_device *pdev) } //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; diff --git a/include/linux/mfd/rk808.h b/include/linux/mfd/rk808.h index 374dc2c53e08..aa5a3b87ca96 100755 --- a/include/linux/mfd/rk808.h +++ b/include/linux/mfd/rk808.h @@ -125,6 +125,8 @@ struct rk808 { 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 { @@ -137,11 +139,11 @@ 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); -- 2.34.1