Skip to content

Commit

Permalink
lk2nd: device: panel: support for replacing compatible
Browse files Browse the repository at this point in the history
Add handling for new property, replace-compatible, which,
if found, will result in not prepending the new panel
compatible string, but completely replacing it.

Signed-off-by: Alexey Minnekhanov <alexeymin@postmarketos.org>
(cherry picked from commit fc9eb1c)
  • Loading branch information
minlexx authored and stephan-gh committed Apr 16, 2023
1 parent 635c6de commit 541d9bf
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lk2nd/device/panel.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ static int lk2nd_panel_detect(const void *dtb, int node)
struct lk2nd_panel *panel = &lk2nd_dev.panel;
const char *old, *new, *ts;
int old_len, new_len, ts_len;
bool replace_mode;

/* Should have been set from parsed command line or display driver */
if (!panel->name) {
Expand All @@ -34,6 +35,8 @@ static int lk2nd_panel_detect(const void *dtb, int node)
if (!old || old_len < 0)
return old_len;

replace_mode = !!fdt_getprop(dtb, node, "replace-compatible", NULL);

node = fdt_subnode_offset(dtb, node, panel->name);
if (node < 0) {
dprintf(CRITICAL, "Unsupported panel: %s\n", panel->name);
Expand All @@ -54,6 +57,9 @@ static int lk2nd_panel_detect(const void *dtb, int node)
strlcpy((char *)panel->compatible, new, new_len);
strlcpy((char *)panel->old_compatible, old, old_len);

if (replace_mode)
panel->compatible_size = new_len;

ts = fdt_getprop(dtb, node, "touchscreen-compatible", &ts_len);
if (ts && ts_len > 0)
panel->ts_compatible = strndup(ts, ts_len);
Expand Down

0 comments on commit 541d9bf

Please sign in to comment.