backlight: Add TI LMU backlight common driver
Subsystems (2)
PATCH 2/10 backlight: Add TI LMU backlight common driver
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
--- 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
drivers/video/backlight/Kconfig +7 -0
@@ -384,6 +384,13 @@ config BACKLIGHT_LM3639 help This supports TI LM3639 Backlight + 1.5A Flash LED Driver +config TI_LMU_BACKLIGHT + tristate "Backlight driver for TI LMU" + depends on BACKLIGHT_LM3532 || BACKLIGHT_LM3631 || BACKLIGHT_LM3633 || BACKLIGHT_LM3695 || BACKLIGHT_LM3697 + help + TI LMU backlight driver provides common driver features. + Chip specific configuration is handled by each backlight driver. + config BACKLIGHT_LP855X tristate "Backlight driver for TI LP855X" depends on BACKLIGHT_CLASS_DEVICE && I2C
drivers/video/backlight/Makefile +1 -0
@@ -39,6 +39,7 @@ obj-$(CONFIG_BACKLIGHT_HP700) += jornada720_bl.o obj-$(CONFIG_BACKLIGHT_LM3533) += lm3533_bl.o obj-$(CONFIG_BACKLIGHT_LM3630A) += lm3630a_bl.o obj-$(CONFIG_BACKLIGHT_LM3639) += lm3639_bl.o +obj-$(CONFIG_TI_LMU_BACKLIGHT) += ti-lmu-backlight.o obj-$(CONFIG_BACKLIGHT_LOCOMO) += locomolcd.o obj-$(CONFIG_BACKLIGHT_LP855X) += lp855x_bl.o obj-$(CONFIG_BACKLIGHT_LP8788) += lp8788_bl.o
drivers/video/backlight/ti-lmu-backlight.c new file +369 -0
369 lines not on this page · raw message
drivers/video/backlight/ti-lmu-backlight.h new file +78 -0
78 lines not on this page · raw message
Signature · 1 line
1.7.9.5
Quoted 23 lines · Milo Kim
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 nodeCc Jingoo Han <[email protected]>Cc Bryan Wu <[email protected]>Cc Lee Jones <[email protected]>Signed-off-by Milo Kim <[email protected]>--- 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
[...]
Quoted 25 lines
drivers/video/backlight/ti-lmu-backlight.c new file +25
-0+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) {
drivers/video/backlight/ti-lmu-backlight.c line 166
Quoted 10 lines
drivers/video/backlight/ti-lmu-backlight.c new file +10
-0+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.
drivers/video/backlight/ti-lmu-backlight.c line 169
Quoted 3 lines
drivers/video/backlight/ti-lmu-backlight.c new file +3
-0+ +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.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html