Skip to content

Commit

Permalink
dtsi: add pinctrl
Browse files Browse the repository at this point in the history
  • Loading branch information
wonderfulShrineMaidenOfParadise committed Oct 10, 2023
1 parent 0478be9 commit cae5a3f
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions dtsi.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,43 @@ def generate_gpios(options: Options):
for name, flags in options.gpios.items():
flags = "GPIO_ACTIVE_LOW" if flags & GpioFlag.ACTIVE_LOW else "GPIO_ACTIVE_HIGH"
s += f"\t\t{name}-gpios = <&tlmm XY {flags}>;\n"

if 'backlight' in options.gpios:
s += '''
pinctrl-0 = <&lcd_bl_en_default>;
pinctrl-names = "default";
'''
return s


def generate_tlmm(options: Options):
s = "&tlmm {"
if 'backlight' in options.gpios:
s += '''
lcd_bl_en_default: lcd-bl-en-default-state {
pins = "gpioXY";
function = "gpio";
drive-strength = <2>;
bias-disable;
};
'''

s += '''
mdss_default: mdss-default-state {
pins = "gpioXY";
function = "gpio";
drive-strength = <8>;
bias-disable;
};
mdss_sleep: mdss-sleep-state {
pins = "gpioXY";
function = "gpio";
drive-strength = <2>;
bias-pull-down;
};
};
'''
return s


Expand All @@ -35,6 +72,10 @@ def generate_panel_dtsi(p: Panel, options: Options) -> None:
''')
f.write(f'''\
&mdss_dsi0 {{
pinctrl-0 = <&mdss_default>;
pinctrl-1 = <&mdss_sleep>;
pinctrl-names = "default", "sleep";
panel@0 {{
compatible = "{options.compatible}";
reg = <0>;
Expand Down Expand Up @@ -69,3 +110,5 @@ def generate_panel_dtsi(p: Panel, options: Options) -> None:
phy-type = <PHY_TYPE_CPHY>;
};
''')

f.write(generate_tlmm(options))

0 comments on commit cae5a3f

Please sign in to comment.