Commit afccd96e authored by Angus Ainslie (Purism)'s avatar Angus Ainslie (Purism)
Browse files

librem5: add led support


Signed-off-by: default avatarAngus Ainslie (Purism) <angus@akkea.ca>
parent ec497ffb
......@@ -33,13 +33,21 @@
};
};
pwmleds {
compatible = "pwm-leds";
gpio-leds {
compatible = "gpio-leds";
pinctrl-0 = <&pinctrl_led>;
ledpwm2 {
label = "PWM2";
pwms = <&pwm2 0 50000>;
max-brightness = <255>;
ledr {
label = "LED_R";
gpios = <&gpio5 3 0>;
};
ledg {
label = "LED_G";
gpios = <&gpio5 2 0>;
};
ledb {
label = "LED_B";
gpios = <&gpio1 13 0>;
};
};
};
......@@ -100,12 +108,20 @@
>;
};
pinctrl_led: ledgrp {
fsl,pins = <
MX8MQ_IOMUXC_SPDIF_TX_GPIO5_IO3 0x16 /* LED_R */
MX8MQ_IOMUXC_SAI3_MCLK_GPIO5_IO2 0x16 /* LED_G */
MX8MQ_IOMUXC_GPIO1_IO13_GPIO1_IO13 0x16 /* LED_B */
>;
};
pinctrl_pwm1: pwm1grp {
fsl,pins = <
MX8MQ_IOMUXC_SPDIF_EXT_CLK_PWM1_OUT 0x83 /* MOTO */
>;
};
#if 0
pinctrl_pwm2: pwm2grp {
fsl,pins = <
MX8MQ_IOMUXC_GPIO1_IO13_PWM2_OUT 0x16 /* LED_B */
......@@ -123,7 +139,7 @@
MX8MQ_IOMUXC_SAI3_MCLK_PWM4_OUT 0x16 /* LED_G */
>;
};
#endif
pinctrl_uart1: uart1grp {
fsl,pins = <
MX8MQ_IOMUXC_UART1_RXD_UART1_DCE_RX 0x79
......@@ -285,7 +301,7 @@
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_ecspi1>;
status = "okay";
flash0: winbond@0 {
reg = <0>;
#address-cells = <1>;
......@@ -293,13 +309,28 @@
compatible = "spi-flash";
spi-max-frequency = <29000000>;
};
};
};
/*
&pwm2 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_pwm2>;
status = "okay";
};
&pwm3 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_pwm3>;
status = "okay";
};
&pwm4 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_pwm4>;
status = "okay";
};
*/
&uart1 { /* console */
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_uart1>;
......
......@@ -307,6 +307,7 @@ out:
#define HUB_EN IMX_GPIO_NR(1, 14)
#define CHG_EN IMX_GPIO_NR(3, 2)
#define CHG_OTG_OUT_EN IMX_GPIO_NR(3, 4)
#define LED_G IMX_GPIO_NR(5, 2)
static iomux_v3_cfg_t const configure_pads[] = {
IMX8MQ_PAD_GPIO1_IO03__GPIO1_IO3 | MUX_PAD_CTRL(PAD_CTL_DSE6),
......@@ -318,6 +319,7 @@ static iomux_v3_cfg_t const configure_pads[] = {
IMX8MQ_PAD_GPIO1_IO14__GPIO1_IO14 | MUX_PAD_CTRL(PAD_CTL_DSE6),
IMX8MQ_PAD_NAND_CE1_B__GPIO3_IO2 | MUX_PAD_CTRL(PAD_CTL_DSE6),
IMX8MQ_PAD_NAND_CE3_B__GPIO3_IO4 | MUX_PAD_CTRL(PAD_CTL_DSE6),
IMX8MQ_PAD_SAI3_MCLK__GPIO5_IO2 | MUX_PAD_CTRL(PAD_CTL_DSE6),
};
void spl_board_init(void)
......@@ -412,6 +414,7 @@ void board_init_f(ulong dummy)
}
imx_iomux_v3_setup_multiple_pads(configure_pads, ARRAY_SIZE(configure_pads));
gpio_direction_output(LED_G, 1);
gpio_direction_input(VOL_UP);
gpio_direction_input(VOL_DOWN);
gpio_direction_output(TYPEC_MUX_EN, 1);
......
......@@ -87,3 +87,21 @@ CONFIG_IMX8M_DRAM=y
CONFIG_IMX8M_LPDDR4=y
CONFIG_ENV_IS_IN_MMC=y
CONFIG_LED=y
CONFIG_LED_BLINK=y
CONFIG_LED_GPIO=y
CONFIG_LED_STATUS=y
CONFIG_LED_FREQ=2
CONFIG_LED_STATUS_GPIO=y
CONFIG_LED_STATUS0=y
CONFIG_LED_STATUS_BIT=0
CONFIG_LED_STATUS_STATE=1
#CONFIG_LED_STATUS_RED_ENABLE=y
#CONFIG_LED_STATUS_RED=0
#CONFIG_LED_STATUS_BLUE_ENABLE=y
#CONFIG_LED_STATUS_BLUE=1
#CONFIG_LED_STATUS_GREEN_ENABLE=y
#CONFIG_LED_STATUS_GREEN=2
#CONFIG_LED_STATUS_CMD=y
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment