1 // SPDX-License-Identifier: GPL-2.0+
3 * (C) Copyright 2016 Rockchip Electronics Co., Ltd
8 #include <dm/pinctrl.h>
9 #include <asm/arch-rockchip/periph.h>
10 #include <power/regulator.h>
14 struct udevice *pinctrl, *regulator;
18 * The PWM do not have decicated interrupt number in dts and can
19 * not get periph_id by pinctrl framework, so let's init them here.
20 * The PWM2 and PWM3 are for pwm regulater.
22 ret = uclass_get_device(UCLASS_PINCTRL, 0, &pinctrl);
24 debug("%s: Cannot find pinctrl device\n", __func__);
28 /* Enable pwm0 for panel backlight */
29 ret = pinctrl_request_noflags(pinctrl, PERIPH_ID_PWM0);
31 debug("%s PWM0 pinctrl init fail! (ret=%d)\n", __func__, ret);
35 ret = pinctrl_request_noflags(pinctrl, PERIPH_ID_PWM2);
37 debug("%s PWM2 pinctrl init fail!\n", __func__);
41 ret = pinctrl_request_noflags(pinctrl, PERIPH_ID_PWM3);
43 debug("%s PWM3 pinctrl init fail!\n", __func__);
47 ret = regulators_enable_boot_on(false);
49 debug("%s: Cannot enable boot on regulator\n", __func__);
51 ret = regulator_get_by_platname("vcc5v0_host", ®ulator);
53 debug("%s vcc5v0_host init fail! ret %d\n", __func__, ret);
57 ret = regulator_set_enable(regulator, true);
59 debug("%s vcc5v0-host-en set fail!\n", __func__);