Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 357616
b: refs/heads/master
c: 47ec340
h: refs/heads/master
v: v3
  • Loading branch information
Qing Xu authored and Samuel Ortiz committed Feb 13, 2013
1 parent 7ccc139 commit 69b4527
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 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: 678e8cb50647a7580b8122937e8e6e50d949267d
refs/heads/master: 47ec340cb8e232671e7c4a4689ff32c3bdf329da
31 changes: 30 additions & 1 deletion trunk/drivers/video/backlight/max8925_bl.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,29 @@ static const struct backlight_ops max8925_backlight_ops = {
.get_brightness = max8925_backlight_get_brightness,
};

#ifdef CONFIG_OF
static int max8925_backlight_dt_init(struct platform_device *pdev,
struct max8925_backlight_pdata *pdata)
{
struct device_node *nproot = pdev->dev.parent->of_node, *np;
int dual_string;

if (!nproot)
return -ENODEV;
np = of_find_node_by_name(nproot, "backlight");
if (!np) {
dev_err(&pdev->dev, "failed to find backlight node\n");
return -ENODEV;
}

of_property_read_u32(np, "maxim,max8925-dual-string", &dual_string);
pdata->dual_string = dual_string;
return 0;
}
#else
#define max8925_backlight_dt_init(x, y) (-1)
#endif

static int max8925_backlight_probe(struct platform_device *pdev)
{
struct max8925_chip *chip = dev_get_drvdata(pdev->dev.parent);
Expand Down Expand Up @@ -147,6 +170,13 @@ static int max8925_backlight_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, bl);

value = 0;
if (pdev->dev.parent->of_node && !pdata) {
pdata = devm_kzalloc(&pdev->dev,
sizeof(struct max8925_backlight_pdata),
GFP_KERNEL);
max8925_backlight_dt_init(pdev, pdata);
}

if (pdata) {
if (pdata->lxw_scl)
value |= (1 << 7);
Expand All @@ -158,7 +188,6 @@ static int max8925_backlight_probe(struct platform_device *pdev)
ret = max8925_set_bits(chip->i2c, data->reg_mode_cntl, 0xfe, value);
if (ret < 0)
goto out_brt;

backlight_update_status(bl);
return 0;
out_brt:
Expand Down

0 comments on commit 69b4527

Please sign in to comment.