Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 358619
b: refs/heads/master
c: 87cc4bd
h: refs/heads/master
i:
  358617: 5785e36
  358615: e0bbe7b
v: v3
  • Loading branch information
Milo(Woogyom) Kim authored and Bryan Wu committed Feb 6, 2013
1 parent 3d78bfc commit 2487be3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 95 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: ba6fa84651ff9a609e0ceb8265e3335ab6ed656d
refs/heads/master: 87cc4bde2a97cd8acccf34f333d0980dc5c2aa8a
79 changes: 2 additions & 77 deletions trunk/drivers/leds/leds-lp5521.c
Original file line number Diff line number Diff line change
Expand Up @@ -412,36 +412,6 @@ static ssize_t lp5521_selftest(struct device *dev,
return sprintf(buf, "%s\n", ret ? "FAIL" : "OK");
}

static void lp5521_clear_program_memory(struct i2c_client *cl)
{
int i;
u8 rgb_mem[] = {
LP5521_REG_R_PROG_MEM,
LP5521_REG_G_PROG_MEM,
LP5521_REG_B_PROG_MEM,
};

for (i = 0; i < ARRAY_SIZE(rgb_mem); i++) {
lp5521_write(cl, rgb_mem[i], 0);
lp5521_write(cl, rgb_mem[i] + 1, 0);
}
}

static void lp5521_write_program_memory(struct i2c_client *cl,
u8 base, u8 *rgb, int size)
{
int i;

if (!rgb || size <= 0)
return;

for (i = 0; i < size; i++)
lp5521_write(cl, base + i, *(rgb + i));

lp5521_write(cl, base + i, 0);
lp5521_write(cl, base + i + 1, 0);
}

static inline struct lp5521_led_pattern *lp5521_get_pattern
(struct lp5521_chip *chip, u8 offset)
{
Expand All @@ -450,42 +420,6 @@ static inline struct lp5521_led_pattern *lp5521_get_pattern
return ptn;
}

static void lp5521_run_led_pattern(int mode, struct lp5521_chip *chip)
{
struct lp5521_led_pattern *ptn;
struct i2c_client *cl = chip->client;
int num_patterns = chip->pdata->num_patterns;

if (mode > num_patterns || !(chip->pdata->patterns))
return;

if (mode == PATTERN_OFF) {
lp5521_write(cl, LP5521_REG_ENABLE, LP5521_ENABLE_DEFAULT);
usleep_range(1000, 2000);
lp5521_write(cl, LP5521_REG_OP_MODE, LP5521_CMD_DIRECT);
} else {
ptn = lp5521_get_pattern(chip, mode);
if (!ptn)
return;

lp5521_write(cl, LP5521_REG_OP_MODE, LP5521_CMD_LOAD);
usleep_range(1000, 2000);

lp5521_clear_program_memory(cl);

lp5521_write_program_memory(cl, LP5521_REG_R_PROG_MEM,
ptn->r, ptn->size_r);
lp5521_write_program_memory(cl, LP5521_REG_G_PROG_MEM,
ptn->g, ptn->size_g);
lp5521_write_program_memory(cl, LP5521_REG_B_PROG_MEM,
ptn->b, ptn->size_b);

lp5521_write(cl, LP5521_REG_OP_MODE, LP5521_CMD_RUN);
usleep_range(1000, 2000);
lp5521_write(cl, LP5521_REG_ENABLE, LP5521_ENABLE_RUN_PROGRAM);
}
}

/* device attributes */
static DEVICE_ATTR(selftest, S_IRUGO, lp5521_selftest, NULL);

Expand All @@ -498,13 +432,6 @@ static const struct attribute_group lp5521_group = {
.attrs = lp5521_attributes,
};

static void lp5521_unregister_sysfs(struct i2c_client *client)
{
struct device *dev = &client->dev;

sysfs_remove_group(&dev->kobj, &lp5521_group);
}

/* Chip specific configurations */
static struct lp55xx_device_config lp5521_cfg = {
.reset = {
Expand Down Expand Up @@ -582,13 +509,11 @@ static int lp5521_probe(struct i2c_client *client,

static int lp5521_remove(struct i2c_client *client)
{
struct lp5521_chip *old_chip = i2c_get_clientdata(client);
struct lp55xx_led *led = i2c_get_clientdata(client);
struct lp55xx_chip *chip = led->chip;

lp5521_run_led_pattern(PATTERN_OFF, old_chip);
lp5521_unregister_sysfs(client);

lp5521_stop_engine(chip);
lp55xx_unregister_sysfs(chip);
lp55xx_unregister_leds(led, chip);
lp55xx_deinit_device(chip);

Expand Down
19 changes: 2 additions & 17 deletions trunk/drivers/leds/leds-lp5523.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,6 @@ static void lp5523_set_led_current(struct lp55xx_led *led, u8 led_current)
led_current);
}

static int lp5523_write(struct i2c_client *client, u8 reg, u8 value)
{
return i2c_smbus_write_byte_data(client, reg, value);
}

static int lp5523_post_init_device(struct lp55xx_chip *chip)
{
int ret;
Expand Down Expand Up @@ -471,13 +466,6 @@ static const struct attribute_group lp5523_group = {
.attrs = lp5523_attributes,
};

static void lp5523_unregister_sysfs(struct i2c_client *client)
{
struct device *dev = &client->dev;

sysfs_remove_group(&dev->kobj, &lp5523_group);
}

/* Chip specific configurations */
static struct lp55xx_device_config lp5523_cfg = {
.reset = {
Expand Down Expand Up @@ -558,11 +546,8 @@ static int lp5523_remove(struct i2c_client *client)
struct lp55xx_led *led = i2c_get_clientdata(client);
struct lp55xx_chip *chip = led->chip;

/* Disable engine mode */
lp5523_write(client, LP5523_REG_OP_MODE, LP5523_CMD_DISABLED);

lp5523_unregister_sysfs(client);

lp5523_stop_engine(chip);
lp55xx_unregister_sysfs(chip);
lp55xx_unregister_leds(led, chip);
lp55xx_deinit_device(chip);

Expand Down

0 comments on commit 2487be3

Please sign in to comment.