aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/leds/leds-lp55xx-common.c
diff options
context:
space:
mode:
authorMilo(Woogyom) Kim <milo.kim@ti.com>2013-02-05 18:08:49 +0900
committerBryan Wu <cooloney@gmail.com>2013-02-06 15:59:27 -0800
commit48068d5de16c23c256c085b2cd3ff03bec393900 (patch)
tree08307d1f09040ef20677b15db0a21113a3ba7842 /drivers/leds/leds-lp55xx-common.c
parentleds-lp55xx: use lp55xx common init function - platform data (diff)
downloadlinux-dev-48068d5de16c23c256c085b2cd3ff03bec393900.tar.xz
linux-dev-48068d5de16c23c256c085b2cd3ff03bec393900.zip
leds-lp55xx: use lp55xx common init function - reset
LP5521/5523 reset device functions are moved to lp55xx common driver. Value of register address and value are chip dependent. Those are configured in each driver. In init function, reset command is executed. Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com> Signed-off-by: Bryan Wu <cooloney@gmail.com>
Diffstat (limited to 'drivers/leds/leds-lp55xx-common.c')
-rw-r--r--drivers/leds/leds-lp55xx-common.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/drivers/leds/leds-lp55xx-common.c b/drivers/leds/leds-lp55xx-common.c
index 05a854c0d9b2..bbf2bbf03807 100644
--- a/drivers/leds/leds-lp55xx-common.c
+++ b/drivers/leds/leds-lp55xx-common.c
@@ -20,6 +20,16 @@
#include "leds-lp55xx-common.h"
+static void lp55xx_reset_device(struct lp55xx_chip *chip)
+{
+ struct lp55xx_device_config *cfg = chip->cfg;
+ u8 addr = cfg->reset.addr;
+ u8 val = cfg->reset.val;
+
+ /* no error checking here because no ACK from the device after reset */
+ lp55xx_write(chip, addr, val);
+}
+
int lp55xx_write(struct lp55xx_chip *chip, u8 reg, u8 val)
{
return i2c_smbus_write_byte_data(chip->cl, reg, val);
@@ -58,14 +68,16 @@ EXPORT_SYMBOL_GPL(lp55xx_update_bits);
int lp55xx_init_device(struct lp55xx_chip *chip)
{
struct lp55xx_platform_data *pdata;
+ struct lp55xx_device_config *cfg;
struct device *dev = &chip->cl->dev;
int ret = 0;
WARN_ON(!chip);
pdata = chip->pdata;
+ cfg = chip->cfg;
- if (!pdata)
+ if (!pdata || !cfg)
return -EINVAL;
if (pdata->setup_resources) {
@@ -83,6 +95,14 @@ int lp55xx_init_device(struct lp55xx_chip *chip)
usleep_range(1000, 2000); /* 500us abs min. */
}
+ lp55xx_reset_device(chip);
+
+ /*
+ * Exact value is not available. 10 - 20ms
+ * appears to be enough for reset.
+ */
+ usleep_range(10000, 20000);
+
err:
return ret;
}