Himax 10.36寸 incell触摸调试
触摸是带笔的,数据比较大,用的是spi接口。
一、添加驱动:
drivers/input/touchscreen/hxchipset
二、dts配置
&spi4 { status = "okay"; pinctrl-0 = <&spi4m1_cs0 &spi4m1_cs1 &spi4m1_pins>; himax_touch@0 { compatible = "himax,hxcommon"; reg = <0>; spi-max-frequency = <10000000>; status = "okay"; pinctrl-names = "default"; pinctrl-0 = <&touch_int>; himax,irq-gpio = <&gpio1 RK_PB5 IRQ_TYPE_LEVEL_LOW>; himax,rst-gpio = <&gpio1 RK_PB4 GPIO_ACTIVE_HIGH>; himax,panel-coords = <0 1200 0 2000>; himax,display-coords = <0 1200 0 2000>; report_type = <1>; }; };
三、添加固件
diff --git a/device.mk b/device.mk old mode 100644 new mode 100755 index b454e36..db1b079 --- a/device.mk +++ b/device.mk @@ -44,6 +44,8 @@ PRODUCT_COPY_FILES += \ PRODUCT_COPY_FILES += \ $(LOCAL_PATH)/init.rk3588.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/hw/init.rk3588.rc \ + $(LOCAL_PATH)/rk3588s_s/Himax_firmware.bin:$(TARGET_COPY_OUT_VENDOR)/etc/firmware/Himax_firmware.bin \ $(LOCAL_PATH)/wake_lock_filter.xml:system/etc/wake_lock_filter.xml \
厂家提供正确驱动,驱动正常加载,提供的固件正常加载(/vendor/etc/firmware/Himax_firmware.bin),如果时序正确,那这时候一般都有触点了.
如果有触点,但方向反了或者镜像,那一般是固件没给对,需要提供正确对应的固件。
四、调试过程遇到的一些问题点
1.触摸不稳定,偶尔休眠唤醒或者开机没有触摸,那一般都是时序没有调好,
VCCD, VSP, VSN, LCM_RST, TP_RST这几个信号的时序要控制好:
VSP, VSN时序添加显示驱动中
diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c old mode 100644 new mode 100755 index 4e298108a62e..c4e5b96d61f7 --- a/drivers/gpu/drm/panel/panel-simple.c +++ b/drivers/gpu/drm/panel/panel-simple.c @@ -143,6 +143,9 @@ struct panel_simple { struct gpio_desc *reset_gpio; struct gpio_desc *hpd_gpio; + struct gpio_desc *enn_gpio; + struct gpio_desc *enp_gpio; + struct drm_display_mode override_mode; struct drm_dsc_picture_parameter_set *pps; @@ -465,6 +468,9 @@ static int panel_simple_unprepare(struct drm_panel *panel) gpiod_direction_output(p->reset_gpio, 1); gpiod_direction_output(p->enable_gpio, 0); + gpiod_direction_output(p->enn_gpio, 0); + gpiod_direction_output(p->enp_gpio, 0); + panel_simple_regulator_disable(p); if (p->desc->delay.unprepare) @@ -518,6 +524,9 @@ static int panel_simple_prepare(struct drm_panel *panel) gpiod_direction_output(p->enable_gpio, 1); + gpiod_direction_output(p->enn_gpio, 1); + gpiod_direction_output(p->enp_gpio, 1); + delay = p->desc->delay.prepare; if (p->no_hpd) delay += p->desc->delay.hpd_absent_delay; @@ -810,6 +819,27 @@ static int panel_simple_probe(struct device *dev, const struct pane l_desc *desc) return err; } + panel->enn_gpio = devm_gpiod_get_optional(dev, "enn", GPIOD_ASIS); + if (IS_ERR(panel->enn_gpio)) { + err = PTR_ERR(panel->enn_gpio); + if (err != -EPROBE_DEFER) + dev_err(dev, "failed to get enn GPIO: %d\n", err); + return err; + } + + panel->enp_gpio = devm_gpiod_get_optional(dev, "enp", GPIOD_ASIS); + if (IS_ERR(panel->enp_gpio)) { + err = PTR_ERR(panel->enp_gpio); + if (err != -EPROBE_DEFER) + dev_err(dev, "failed to get enp GPIO: %d\n", err); + return err; + } + + gpiod_direction_output(panel->enn_gpio, 1); + gpiod_direction_output(panel->enp_gpio, 1); + + msleep(10); + panel->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_ASIS); if (IS_ERR(panel->reset_gpio)) { err = PTR_ERR(panel->reset_gpio);
1.每次开机触摸不行,休眠唤醒后才有触摸。
需要在u-boot里面添加VSP, VSN信号的控制:
diff --git a/drivers/video/drm/rockchip_panel.c b/drivers/video/drm/rockchip_panel.c old mode 100644 new mode 100755 index de7e5e25c2..80eba26247 --- a/drivers/video/drm/rockchip_panel.c +++ b/drivers/video/drm/rockchip_panel.c @@ -67,6 +67,9 @@ struct rockchip_panel_priv { struct gpio_desc enable_gpio; struct gpio_desc reset_gpio; + struct gpio_desc enn_gpio; + struct gpio_desc enp_gpio; + int cmd_type; struct gpio_desc spi_sdi_gpio; struct gpio_desc spi_scl_gpio; @@ -285,6 +288,16 @@ static void panel_simple_prepare(struct rockchip_panel *panel) if (plat->delay.prepare) mdelay(plat->delay.prepare); + //wmc add + if (dm_gpio_is_valid(&priv->enn_gpio)) + dm_gpio_set_value(&priv->enn_gpio, 1); + + if (dm_gpio_is_valid(&priv->enp_gpio)) + dm_gpio_set_value(&priv->enp_gpio, 1); + +++ b/drivers/video/drm/rockchip_panel.c @@ -67,6 +67,9 @@ struct rockchip_panel_priv { struct gpio_desc enable_gpio; struct gpio_desc reset_gpio; + struct gpio_desc enn_gpio; + struct gpio_desc enp_gpio; + int cmd_type; struct gpio_desc spi_sdi_gpio; struct gpio_desc spi_scl_gpio; @@ -285,6 +288,16 @@ static void panel_simple_prepare(struct rockchip_panel *panel) if (plat->delay.prepare) mdelay(plat->delay.prepare); + //wmc add + if (dm_gpio_is_valid(&priv->enn_gpio)) + dm_gpio_set_value(&priv->enn_gpio, 1); + + if (dm_gpio_is_valid(&priv->enp_gpio)) + dm_gpio_set_value(&priv->enp_gpio, 1); + + mdelay(10); + ///////////// + if (dm_gpio_is_valid(&priv->reset_gpio)) dm_gpio_set_value(&priv->reset_gpio, 1); @@ -339,6 +352,14 @@ static void panel_simple_unprepare(struct rockchip_panel *panel) if (dm_gpio_is_valid(&priv->reset_gpio)) dm_gpio_set_value(&priv->reset_gpio, 1); + //wmc add + if (dm_gpio_is_valid(&priv->enn_gpio)) + dm_gpio_set_value(&priv->enn_gpio, 0); + + if (dm_gpio_is_valid(&priv->enp_gpio)) + dm_gpio_set_value(&priv->enp_gpio, 0); + ///////////// + if (dm_gpio_is_valid(&priv->enable_gpio)) dm_gpio_set_value(&priv->enable_gpio, 0); @@ -470,6 +491,20 @@ static int rockchip_panel_probe(struct udevice *dev) printf("%s: Cannot get reset GPIO: %d\n", __func__, ret); return ret; } + + ret = gpio_request_by_name(dev, "enn-gpios", 0, + &priv->enn_gpio, GPIOD_IS_OUT); + if (ret && ret != -ENOENT) { + printf("%s: Cannot get enn GPIO: %d\n", __func__, ret); + return ret; + } + + ret = gpio_request_by_name(dev, "enp-gpios", 0, + &priv->enp_gpio, GPIOD_IS_OUT); + if (ret && ret != -ENOENT) { + printf("%s: Cannot get enp GPIO: %d\n", __func__, ret); + return ret; + } ret = uclass_get_device_by_phandle(UCLASS_PANEL_BACKLIGHT, dev, "backlight", &priv->backlight);