Skip to content

Commit

Permalink
Add --optional-reset-gpio parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
jenneron committed Aug 14, 2021
1 parent 3e9ac4f commit c32af8c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
8 changes: 7 additions & 1 deletion driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,8 +378,14 @@ def generate_probe(p: Panel, options: Options) -> str:
if name == "reset":
init = "GPIOD_OUT_HIGH"

if name == "reset" and options.optional_reset:
s += f'''
ctx->{name}_gpio = devm_gpiod_get_optional(dev, "{name}", {init});'''
else:
s += f'''
ctx->{name}_gpio = devm_gpiod_get(dev, "{name}", {init});'''

s += f'''
ctx->{name}_gpio = devm_gpiod_get(dev, "{name}", {init});
if (IS_ERR(ctx->{name}_gpio))
return dev_err_probe(dev, PTR_ERR(ctx->{name}_gpio),
"Failed to get {name}-gpios\\n");
Expand Down
1 change: 1 addition & 0 deletions generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class Options:
dcs_get_brightness: bool
ignore_wait: int
dumb_dcs: bool
optional_reset: bool

# Added by panel driver generator
compatible: str
Expand Down
3 changes: 3 additions & 0 deletions lmdpdg.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ def generate(p: Panel, options: generator.Options) -> None:
enter/exit_sleep_mode and set_display_on/off (which should be supported by
any panel ideally).
""")
parser.add_argument('--optional-reset-gpio', dest='optional_reset', action='store_true',help="""
Use dev_gpiod_get_optional for reset GPIO.
""")
args = parser.parse_args(namespace=generator.Options())

for f in args.dtb:
Expand Down

0 comments on commit c32af8c

Please sign in to comment.