Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 358599
b: refs/heads/master
c: a85908d
h: refs/heads/master
i:
  358597: dd1eaca
  358595: 4bd938c
  358591: 4d67324
v: v3
  • Loading branch information
Milo(Woogyom) Kim authored and Bryan Wu committed Feb 6, 2013
1 parent 42bb175 commit 24e6921
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 29 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 632418bf65503405df3f9a6a1616f5a95f91db85
refs/heads/master: a85908dd7799e4fa242812ce27a8f774c721d1fb
14 changes: 0 additions & 14 deletions trunk/drivers/leds/leds-lp5521.c
Original file line number Diff line number Diff line change
Expand Up @@ -719,23 +719,9 @@ static void lp5521_reset_device(struct lp5521_chip *chip)
static void lp5521_deinit_device(struct lp5521_chip *chip);
static int lp5521_init_device(struct lp5521_chip *chip)
{
struct lp5521_platform_data *pdata = chip->pdata;
struct i2c_client *client = chip->client;
int ret;

if (pdata->setup_resources) {
ret = pdata->setup_resources();
if (ret < 0)
return ret;
}

if (pdata->enable) {
pdata->enable(0);
usleep_range(1000, 2000); /* Keep enable down at least 1ms */
pdata->enable(1);
usleep_range(1000, 2000); /* 500us abs min. */
}

lp5521_reset_device(chip);

usleep_range(10000, 20000); /*
Expand Down
14 changes: 0 additions & 14 deletions trunk/drivers/leds/leds-lp5523.c
Original file line number Diff line number Diff line change
Expand Up @@ -910,23 +910,9 @@ static void lp5523_reset_device(struct lp5523_chip *chip)
static void lp5523_deinit_device(struct lp5523_chip *chip);
static int lp5523_init_device(struct lp5523_chip *chip)
{
struct lp5523_platform_data *pdata = chip->pdata;
struct i2c_client *client = chip->client;
int ret;

if (pdata->setup_resources) {
ret = pdata->setup_resources();
if (ret < 0)
return ret;
}

if (pdata->enable) {
pdata->enable(0);
usleep_range(1000, 2000); /* Keep enable down at least 1ms */
pdata->enable(1);
usleep_range(1000, 2000); /* 500us abs min. */
}

lp5523_reset_device(chip);

usleep_range(10000, 20000); /*
Expand Down
34 changes: 34 additions & 0 deletions trunk/drivers/leds/leds-lp55xx-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* Derived from leds-lp5521.c, leds-lp5523.c
*/

#include <linux/delay.h>
#include <linux/i2c.h>
#include <linux/leds.h>
#include <linux/module.h>
Expand Down Expand Up @@ -54,6 +55,39 @@ int lp55xx_update_bits(struct lp55xx_chip *chip, u8 reg, u8 mask, u8 val)
}
EXPORT_SYMBOL_GPL(lp55xx_update_bits);

int lp55xx_init_device(struct lp55xx_chip *chip)
{
struct lp55xx_platform_data *pdata;
struct device *dev = &chip->cl->dev;
int ret = 0;

WARN_ON(!chip);

pdata = chip->pdata;

if (!pdata)
return -EINVAL;

if (pdata->setup_resources) {
ret = pdata->setup_resources();
if (ret < 0) {
dev_err(dev, "setup resoure err: %d\n", ret);
goto err;
}
}

if (pdata->enable) {
pdata->enable(0);
usleep_range(1000, 2000); /* Keep enable down at least 1ms */
pdata->enable(1);
usleep_range(1000, 2000); /* 500us abs min. */
}

err:
return ret;
}
EXPORT_SYMBOL_GPL(lp55xx_init_device);

MODULE_AUTHOR("Milo Kim <milo.kim@ti.com>");
MODULE_DESCRIPTION("LP55xx Common Driver");
MODULE_LICENSE("GPL");
3 changes: 3 additions & 0 deletions trunk/drivers/leds/leds-lp55xx-common.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,7 @@ extern int lp55xx_read(struct lp55xx_chip *chip, u8 reg, u8 *val);
extern int lp55xx_update_bits(struct lp55xx_chip *chip, u8 reg,
u8 mask, u8 val);

/* common device init functions */
extern int lp55xx_init_device(struct lp55xx_chip *chip);

#endif /* _LEDS_LP55XX_COMMON_H */

0 comments on commit 24e6921

Please sign in to comment.