diff options
author | masonwang <masonwang@google.com> | 2021-08-13 20:05:50 +0800 |
---|---|---|
committer | masonwang <masonwang@google.com> | 2021-08-13 21:49:09 +0800 |
commit | f8f1a1e50d53a7e2ef4ccc0ec1c2dd5c0871245e (patch) | |
tree | cf621255a96a54b828391213a3eca1c1a2f1ce21 | |
parent | 8679f5c537224dfeee6917d4fda681fa1bc705cc (diff) | |
download | himax_touch-f8f1a1e50d53a7e2ef4ccc0ec1c2dd5c0871245e.tar.gz |
touch/himax: defer to probe if no designated panel connected.
Bug: 196539771
Test: Touch driver defers to probe if no distinguished panel
connected.
Change-Id: Ic3d86c43ec205edd088b0d3986b4050b19d8b67d
-rw-r--r-- | himax_platform.c | 36 | ||||
-rw-r--r-- | himax_platform.h | 2 |
2 files changed, 38 insertions, 0 deletions
diff --git a/himax_platform.c b/himax_platform.c index 14ed92e..b767c49 100644 --- a/himax_platform.c +++ b/himax_platform.c @@ -145,6 +145,37 @@ int himax_ts_check_dt(struct device_node *np) } #endif +static int himax_check_panel_map(struct device_node *np, + struct himax_platform_data *pdata) +{ + int ret = 0; + int index; + struct of_phandle_args panelmap; + struct drm_panel *panel = NULL; + + if (of_property_read_bool(np, "himax,panel_map")) { + for (index = 0 ;; index++) { + ret = of_parse_phandle_with_fixed_args(np, + "himax,panel_map", + 1, + index, + &panelmap); + if (ret) { + E("%s: Can't find display panel!\n", __func__); + return -EPROBE_DEFER; + } + panel = of_drm_find_panel(panelmap.np); + of_node_put(panelmap.np); + if (!IS_ERR_OR_NULL(panel)) { + pdata->panel = panel; + pdata->initial_panel_index = panelmap.args[0]; + break; + } + } + } + return 0; +} + int himax_parse_dt(struct himax_ts_data *ts, struct himax_platform_data *pdata) { int coords_size = 0; @@ -161,6 +192,11 @@ int himax_parse_dt(struct himax_ts_data *ts, struct himax_platform_data *pdata) #endif #endif + /* Check if panel(s) exist or not. */ + ret = himax_check_panel_map(dt, pdata); + if (ret) + return ret; + prop = of_find_property(dt, "himax,panel-coords", NULL); if (prop) { coords_size = prop->length / sizeof(u32); diff --git a/himax_platform.h b/himax_platform.h index fa3b452..dde413f 100644 --- a/himax_platform.h +++ b/himax_platform.h @@ -101,6 +101,8 @@ struct himax_platform_data { int hx_config_size; struct pinctrl *pinctrl; + struct drm_panel *panel; + u32 initial_panel_index; #if defined(CONFIG_HMX_DB) bool i2c_pull_up; bool digital_pwr_regulator; |