Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --optional-reset-gpio parameter #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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