[U-Boot] [PATCH v3 20/31] ARM: i.MX6: sabresd: Add dm_gpio_* for backlight

Jagan Teki
2017-04-05T19:20:30Z

For OF_CONTROL, gpio's need to configure through
dm_gpio_* calls instead of non-dm gpio code, So
add dm_gpio_* calls for dts supported code.

Cc: Stefano Babic <sbabic@denx.de>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Cc: Michael Trimarchi <michael@amarulasolutions.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
board/freescale/mx6sabresd/mx6sabresd.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)

diff --git a/board/freescale/mx6sabresd/mx6sabresd.c b/board/freescale/mx6sabresd/mx6sabresd.c
index 10bc7c6..1631dbc 100644
--- a/board/freescale/mx6sabresd/mx6sabresd.c
+++ b/board/freescale/mx6sabresd/mx6sabresd.c
@@ -190,7 +190,29 @@ static iomux_v3_cfg_t const bl_pads[] = {
static void enable_backlight(void)
{
imx_iomux_v3_setup_multiple_pads(bl_pads, ARRAY_SIZE(bl_pads));
+
+#ifdef CONFIG_OF_CONTROL
+ struct gpio_desc backlight;
+ int ret;
+
+ /* Set Brightness to high */
+ ret = dm_gpio_lookup_name("GPIO1_21", &backlight);
+ if (ret) {
+ printf("Cannot get GPIO1_21\n");
+ return;
+ }
+
+ ret = dm_gpio_request(&backlight, "backlight");
+ if (ret) {
+ printf("Cannot request GPIO1_21\n");
+ return;
+ }
+
+ dm_gpio_set_dir_flags(&backlight, GPIOD_IS_OUT);
+ dm_gpio_set_value(&backlight, 1);
+#else
gpio_direction_output(DISP0_PWR_EN, 1);
+#endif
}

static void enable_rgb(struct display_info_t const *dev)
--
1.9.1