lkml.org 
[lkml]   [2014]   [Feb]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 02/10] backlight: Add TI LMU backlight common driver
On Fri, Feb 14, 2014 at 06:31:08AM +0000, Milo Kim wrote:
> TI LMU backlight driver provides common driver features.
> Chip specific configuration is handled by each backlight driver such like
> LM3532, LM3631, LM3633, LM3695 and LM3697.
>
> It supports common features as below.
> - Consistent device control flow
> - Control bank assignment from the platform data
> - Backlight subsystem control
> - PWM brightness control
> - Shared device tree node
>
> Cc: Jingoo Han <jg1.han@samsung.com>
> Cc: Bryan Wu <cooloney@gmail.com>
> Cc: Lee Jones <lee.jones@linaro.org>
> Signed-off-by: Milo Kim <milo.kim@ti.com>
> ---
> drivers/video/backlight/Kconfig | 7 +
> drivers/video/backlight/Makefile | 1 +
> drivers/video/backlight/ti-lmu-backlight.c | 369 ++++++++++++++++++++++++++++
> drivers/video/backlight/ti-lmu-backlight.h | 78 ++++++
> 4 files changed, 455 insertions(+)
> create mode 100644 drivers/video/backlight/ti-lmu-backlight.c
> create mode 100644 drivers/video/backlight/ti-lmu-backlight.h

[...]

> +static int ti_lmu_backlight_parse_dt(struct device *dev, struct ti_lmu *lmu)
> +{
> + struct ti_lmu_backlight_platform_data *pdata;
> + struct device_node *node = dev->of_node;
> + struct device_node *child;
> + int num_backlights;
> + int i = 0;
> + u8 imax_mA;
> +
> + if (!node) {
> + dev_err(dev, "No device node exists\n");
> + return -ENODEV;
> + }
> +
> + num_backlights = of_get_child_count(node);
> + if (num_backlights == 0) {
> + dev_err(dev, "No backlight strings\n");
> + return -EINVAL;
> + }
> +
> + pdata = devm_kzalloc(dev, sizeof(*pdata) * num_backlights, GFP_KERNEL);
> + if (!pdata)
> + return -ENOMEM;
> +
> + for_each_child_of_node(node, child) {
> + of_property_read_string(child, "bl-name", &pdata[i].name);
> +
> + /* Make backlight strings */
> + pdata[i].bl_string = 0;
> + if (of_find_property(child, "hvled1-used", NULL))
> + pdata[i].bl_string |= LMU_HVLED1;
> + if (of_find_property(child, "hvled2-used", NULL))
> + pdata[i].bl_string |= LMU_HVLED2;
> + if (of_find_property(child, "hvled3-used", NULL))
> + pdata[i].bl_string |= LMU_HVLED3;

Use of_property_read_bool here.

> +
> + of_property_read_u8(child, "max-current-milliamp", &imax_mA);
> + pdata[i].imax = ti_lmu_get_current_code(imax_mA);

If this is missing from a node, imax_mA will have the value from the
last iteration (or an uninitialised value).

Thanks,
Mark.


\
 
 \ /
  Last update: 2014-02-14 11:41    [W:0.167 / U:0.252 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site