1/*
2 * Copyright (c) 2023 Microchip Technology Inc.
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#include <zephyr/dt-bindings/pwm/pwm.h>
8
9/* MEC152x EVB
10 * BBLED controller 0 uses GPIO156/LED0 connected to JP31-13
11 * BBLED controller 1 uses GPIO157/LED1 connected to JP31-15
12 * BBLED controller 2 uses GPIO153/LED2 connected to JP31-17
13 *
14 * BBLED hardware divides input clock (32KHz or 48MHz) by (256 * (prescalar+1)
15 * and implements duty cycle for blink mode as an 8-bit value where 0 is off and
16 * 255 full on. BBLED PWM is 8-bit.
17 * BBLED-PWM driver get cycles API reports 32KHz/256 or 48M/256.
18 * Due to all the above we use 50 ms for DT PWM period.
19 */
20
21/* PWM_SEC(1) PWM_USEC(7812) */
22/ {
23	pwmleds {
24		compatible = "pwm-leds";
25		/* struct pwm_dt_spec: phandle channel period(ns) flags */
26		bbled_pwm0: bbled_pwm0 {
27			pwms = <&bbled0 0 PWM_MSEC(50) PWM_POLARITY_NORMAL>;
28		};
29		bbled_pwm1: bbled_pwm1 {
30			pwms = <&bbled1 0 PWM_MSEC(50) PWM_POLARITY_NORMAL>;
31		};
32		bbled_pwm2: bbled_pwm2 {
33			pwms = <&bbled2 0 PWM_MSEC(50) PWM_POLARITY_NORMAL>;
34		};
35	};
36};
37
38&pinctrl {
39	led0_gpio156_invert: led0_gpio156_invert {
40		pinmux = <MCHP_XEC_PINMUX(0156, MCHP_AF1)>;
41		microchip,output-func-invert;
42	};
43	led1_gpio157_invert: led1_gpio157_invert {
44		pinmux = <MCHP_XEC_PINMUX(0157, MCHP_AF1)>;
45		microchip,output-func-invert;
46	};
47	led2_gpio153_invert: led2_gpio153_invert {
48		pinmux = <MCHP_XEC_PINMUX(0153, MCHP_AF1)>;
49		microchip,output-func-invert;
50	};
51};
52
53&bbled0 {
54	compatible = "microchip,xec-pwmbbled";
55	clock-select = "PWM_BBLED_CLK_32K";
56	pinctrl-0 = <&led0_gpio156>;
57	pinctrl-1 = <&led0_gpio156_sleep>;
58	pinctrl-names = "default", "sleep";
59	status = "okay";
60	#pwm-cells = <3>;
61};
62
63&bbled1 {
64	compatible = "microchip,xec-pwmbbled";
65	clock-select = "PWM_BBLED_CLK_32K";
66	pinctrl-0 = <&led1_gpio157>;
67	pinctrl-1 = <&led1_gpio157_sleep>;
68	pinctrl-names = "default", "sleep";
69	status = "okay";
70	#pwm-cells = <3>;
71};
72
73&bbled2 {
74	compatible = "microchip,xec-pwmbbled";
75	clock-select = "PWM_BBLED_CLK_32K";
76	pinctrl-0 = <&led2_gpio153>;
77	pinctrl-1 = <&led2_gpio153_sleep>;
78	pinctrl-names = "default", "sleep";
79	status = "okay";
80	#pwm-cells = <3>;
81};
82