static int check_dt(struct device_node *np)
{
int i = 0;
int count = 0;
struct device_node *node = NULL;
struct drm_panel *panel = NULL;
int itrycount = 0;
NVT_LOG("chenwenmin \n");
count = of_count_phandle_with_args(np, "panel", NULL);
NVT_LOG("chenwenmin panel count=%d\n", count);
if (count <= 0) {
NVT_LOG("chenwenmin panel count=%d\n", count);
return -ENODEV;
}
for (i = 0; i < count; i++) {
node = of_parse_phandle(np, "panel", i);
NVT_LOG("chenwenmin node=%p \n", node);
panel = of_drm_find_panel(node);
of_node_put(node);
NVT_LOG("chenwenmin IS_ERR(panel)=%d \n", IS_ERR(panel));
NVT_LOG("chenwenmin panel=%p \n", panel);
if (!IS_ERR(panel)) {
NVT_LOG("chenwenmin find drm_panel successfully\n");
active_panel = panel;
return 0;
}
itrycount++;
if (itrycount < 20) {
NVT_LOG("chenwenmin itrycount=%d \n", itrycount);
i = -1;
msleep(500);
continue;
}
}
NVT_LOG("chenwenmin no find drm_panel");
return -ENODEV;
}
log
[ 9.470570] [NVT-ts] nvt_ts_probe 1474: chenwenmin
[ 9.470576] [NVT-ts] check_dt 2144: chenwenmin
[ 9.470586] [NVT-ts] check_dt 2147: chenwenmin panel count=1
[ 9.470595] [NVT-ts] check_dt 2155: chenwenmin node=ffffffc0ff855ae8
[ 9.470601] 154 of_drm_find_panel chenwenmin
[ 9.470624] 171 of_drm_find_panel chenwenmin
[ 9.470629] [NVT-ts] check_dt 2158: chenwenmin IS_ERR(panel)=1
[ 9.470634] [NVT-ts] check_dt 2159: chenwenmin panel=fffffffffffffdfb
[ 9.470640] [NVT-ts] check_dt 2167: chenwenmin itrycount=1
[ 9.978318] [NVT-ts] check_dt 2155: chenwenmin node=ffffffc0ff855ae8
执行 panel = of_drm_find_panel(node);返回panel为错误值,由于现在
&qupv3_se2_spi {
status = "okay";
focaltech@0 {
compatible = "focaltech,fts";
reg = <0>;
spi-max-frequency = <6000000>;
interrupt-parent = <&tlmm>;
interrupts = <93 0x2>;
focaltech,reset-gpio = <&tlmm 103 0x01>;
focaltech,irq-gpio = <&tlmm 93 0x02>;
focaltech,max-touch-number = <10>;
focaltech,display-coords = <0 0 1080 2340>;
pinctrl-names = "pmx_ts_active","pmx_ts_suspend","pmx_ts_release";
pinctrl-0 = <&ts_int_active &ts_reset_active>;
pinctrl-1 = <&ts_int_suspend &ts_reset_suspend>;
pinctrl-2 = <&ts_release>;
};
/* Novatek device tree node */
novatek@1 {
compatible = "novatek,NVT-ts-spi";
panel = <&dsi_td4330_truly_v2_video>;
reg = <1>; //Same as CS ID
status = "ok";
spi-max-frequency = <9600000>; //4800000,9600000,15000000,19200000
novatek,reset-gpio = <&tlmm 103 0x00>;
novatek,irq-gpio = <&tlmm 93 0x2001>;
};内容的 panel = <&dsi_td4330_truly_v2_video>;还未生效
需要把module_init(nvt_driver_init);换为late_initcall(nvt_driver_init);
后续待分析