From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jagan Teki Date: Thu, 4 May 2017 20:41:29 +0530 Subject: [U-Boot] [PATCH v5 20/33] ARM: i.MX6: sabresd: Add dm_gpio_* for backlight In-Reply-To: <1493910702-6751-1-git-send-email-jagan@openedev.com> References: <1493910702-6751-1-git-send-email-jagan@openedev.com> Message-ID: <1493910702-6751-21-git-send-email-jagan@openedev.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de From: Jagan Teki 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 Cc: Fabio Estevam Cc: Michael Trimarchi Signed-off-by: Jagan Teki --- 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 3f73b9b..1df81b9 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