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 touchscreen selection related to panel detection #217

Merged
merged 2 commits into from
Nov 21, 2022
Merged
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
3 changes: 3 additions & 0 deletions dts/msm8916/msm8939-mtp.dts
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,15 @@

qcom,mdss_dsi_nt35596_1080p_video {
compatible = "alcatel,idol3-panel-nt35596";
touchscreen-compatible = "syna,rmi4-i2c";
};
qcom,mdss_dsi_nt35596_1080p_video_v03 {
compatible = "alcatel,idol3-panel-nt35596-v03";
touchscreen-compatible = "syna,rmi4-i2c";
};
qcom,mdss_dsi_r63315_1080p_video {
compatible = "alcatel,idol3-panel-r63315";
touchscreen-compatible = "edt,edt-ft5406";
};
};
};
Expand Down
1 change: 1 addition & 0 deletions include/lk2nd.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ struct lk2nd_panel {
const char *old_compatible;
const char *compatible;
int compatible_size;
const char *ts_compatible;
};

struct lk2nd_keymap {
Expand Down
25 changes: 23 additions & 2 deletions lk2nd/lk2nd-device.c
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,8 @@ static const char *lkfdt_getprop_str(const void *fdt, int offset, const char *pr
static void lk2nd_parse_panels(const void *fdt, int offset)
{
struct lk2nd_panel *panel = &lk2nd_dev.panel;
const char *old, *new;
int old_len, new_len;
const char *old, *new, *ts;
int old_len, new_len, ts_len;

offset = fdt_subnode_offset(fdt, offset, "panel");
if (offset < 0)
Expand Down Expand Up @@ -285,6 +285,16 @@ static void lk2nd_parse_panels(const void *fdt, int offset)

strlcpy((char*) panel->compatible, new, new_len);
strlcpy((char*) panel->old_compatible, old, old_len);

ts = lkfdt_getprop_str(fdt, offset, "touchscreen-compatible", &ts_len);
if (!ts || ts_len < 1)
return;

panel->ts_compatible = malloc(ts_len);
ASSERT(panel->ts_compatible);
strlcpy((char*) panel->ts_compatible, ts, ts_len + 1);

dprintf(INFO, "Found touchscreen-compatible: %s\n", panel->ts_compatible);
}

static struct lk2nd_keymap* lk2nd_parse_keys(const void *fdt, int offset)
Expand Down Expand Up @@ -443,6 +453,17 @@ static void lk2nd_update_panel_compatible(void *fdt)
ret = fdt_setprop(fdt, offset, "compatible", panel->compatible, panel->compatible_size);
if (ret)
dprintf(CRITICAL, "Failed to update panel compatible: %d\n", ret);

/* Enable associated touchscreen if any */
stephan-gh marked this conversation as resolved.
Show resolved Hide resolved
if (panel->ts_compatible) {
offset = fdt_node_offset_by_compatible(fdt, -1, panel->ts_compatible);
if (offset < 0)
return;

ret = fdt_nop_property(fdt, offset, "status");
if (ret)
dprintf(CRITICAL, "Failed to NOP touchscreen status: %d\n", ret);
}
}

bool lk2nd_cmdline_scan(const char *cmdline, const char *arg)
Expand Down