em3288 linux_4.19 lvds+tp调试

c 复制代码
一、显示配置
c 复制代码
\rk3288_linux4.19\kernel\arch\arm\boot\dts\rk3288-evb-act8846.dts

panel {
	compatible ="simple-panel";
	backlight = <&backlight>;
	bus-format = <MEDIA_BUS_FMT_RGB666_1X18>;
	enable-gpios = <&gpio1 24 GPIO_ACTIVE_HIGH>;
	enable-delay-ms = <1>;
	power-supply = <&vcc_lcd>;
	rockchip,data-mapping = "vesa"; //rgb  close
	rockchip,data-width = <24>;
 	rockchip,output = "lvds";

  	display-timings {
		native-mode = <&timing0>;
     timing0: timing0 {
				clock-frequency = <78000000>;
				hactive = <1280>;
				vactive = <800>;
				hback-porch = <100>;
				hfront-porch = <18>;
				vback-porch = <8>;
				vfront-porch = <6>;
				hsync-len = <10>;
				vsync-len = <2>;
				hsync-active = <0>;
				vsync-active = <0>;
				de-active = <0>;
				pixelclk-active = <0>;
		    };
    };
		port {
			panel_in_lvds: endpoint {
				remote-endpoint = <&lvds_out_panel>;
			};
		};
	};	
.............................
&route_lvds {
	status = "okay";
};

&lvds {
	status = "okay";

	ports {
		port@1 {
			reg = <1>;

			lvds_out_panel: endpoint {
				remote-endpoint = <&panel_in_lvds>;
			};
		};
	};
};

&lvds_in_vopl {
	status = "okay";
};

&lvds_in_vopb {
	status = "disabled";
};

&backlight {
//	enable-gpios = <&gpio7 RK_PA2 GPIO_ACTIVE_HIGH>;
	pinctrl-names = "default";
//	pinctrl-0 = <&bl_en>;
	pwms = <&pwm1 0 1000000 PWM_POLARITY_INVERTED>;
};

&pwm1 {
	status = "okay";
};
c 复制代码
二、gt928 配置
c 复制代码
\rk3288_linux4.19\kernel\arch\arm\boot\dts\rk3288-evb-act8846.dts

&i2c4 {
	status = "okay";
	ts@02 {
		compatible = "goodix,gt9xx";
		reg = <0x5d>;
		touch-gpio = <&gpio8 RK_PB1 IRQ_TYPE_LEVEL_LOW>;
		reset-gpio = <&gpio7 RK_PA6 GPIO_ACTIVE_LOW>;
		max-x = <1280>;
		max-y = <800>;
	};
};
c 复制代码
\rk3288_linux4.19\kernel\drivers\input\touchscreen\gt9xx\gt9xx.c

static void gtp_touch_down(struct goodix_ts_data* ts,s32 id,s32 x,s32 y,s32 w)
{
	if (gtp_change_x2y)
		GTP_SWAP(x, y);
+        x = ts->abs_x_max - x; 
	if (!bgt911 && !bgt970) {
		if (gtp_x_reverse)
			x = ts->abs_x_max - x;

		if (gtp_y_reverse)
			y = ts->abs_y_max - y;
	}
	
..........................
static int goodix_ts_probe(struct i2c_client *client, const struct i2c_device_id *id)
{
    s32 ret = -1;
    struct goodix_ts_data *ts;
    u16 version_info;
    
    struct device_node *np = client->dev.of_node;
+ //   enum of_gpio_flags rst_flags, pwr_flags;
+ 	enum of_gpio_flags rst_flags;
    u32 val;
	printk("%s() start\n", __func__);

    
    GTP_DEBUG_FUNC();
    
    //do NOT remove these logs
    GTP_INFO("GTP Driver Version: %s", GTP_DRIVER_VERSION);
    GTP_INFO("GTP I2C Address: 0x%02x", client->addr);

    i2c_connect_client = client;
    
    if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) 
    {
        GTP_ERROR("I2C check functionality failed.");
        return -ENODEV;
    }
    ts = kzalloc(sizeof(*ts), GFP_KERNEL);
    if (ts == NULL)
    {
        GTP_ERROR("Alloc GFP_KERNEL memory failed.");
        return -ENOMEM;
    }
    
    memset(ts, 0, sizeof(*ts));
    
    if (!np) {
    	dev_err(&client->dev, "no device tree\n");
    	return -EINVAL;
    }
+    
+/*    if (of_property_read_u32(np, "tp-size", &val)) {
    	dev_err(&client->dev, "no max-x defined\n");
    	return -EINVAL;
+    } */
+
	if (val == 89) {
		m89or101 = TRUE;
		gtp_change_x2y = TRUE;
		gtp_x_reverse = FALSE;
		gtp_y_reverse = TRUE;
	} else if (val == 101) {
		m89or101 = FALSE;
		gtp_change_x2y = TRUE;
		gtp_x_reverse = TRUE;
		gtp_y_reverse = FALSE;
	} else if (val == 911) {
		m89or101 = FALSE;
		bgt911 = TRUE;
		gtp_change_x2y = TRUE;
		gtp_x_reverse = FALSE;
		gtp_y_reverse = TRUE;
	} else if (val == 9110) {
		m89or101 = FALSE;
		bgt9110 = TRUE;
		gtp_change_x2y = TRUE;
		gtp_x_reverse = TRUE;
		gtp_y_reverse = FALSE;
	} else if (val == 9111) {
		m89or101 = FALSE;
		bgt9111 = TRUE;
		gtp_change_x2y = TRUE;
		gtp_x_reverse = FALSE;
		gtp_y_reverse = FALSE;
	} else if (val == 970) {
		m89or101 = FALSE;
		bgt911 = FALSE;
		bgt970 = TRUE;
		gtp_change_x2y = FALSE;
		gtp_x_reverse = FALSE;
		gtp_y_reverse = TRUE;
	} else if (val == 910) {
		m89or101 = FALSE;
		bgt911 = FALSE;
		bgt970 = FALSE;
		bgt910 = TRUE;
		gtp_change_x2y = TRUE;
		gtp_x_reverse = FALSE;
		gtp_y_reverse = TRUE;
	}

	ts->tp_regulator = devm_regulator_get(&client->dev, "tp");
	if (IS_ERR(ts->tp_regulator)) {
		dev_err(&client->dev, "failed to get regulator, %ld\n",
			PTR_ERR(ts->tp_regulator));
		return PTR_ERR(ts->tp_regulator);
	}

	ret = regulator_enable(ts->tp_regulator);
	if (ret < 0)
		GTP_ERROR("failed to enable tp regulator\n");
	msleep(20);

    ts->irq_pin = of_get_named_gpio_flags(np, "touch-gpio", 0, (enum of_gpio_flags *)(&ts->irq_flags));
    ts->rst_pin = of_get_named_gpio_flags(np, "reset-gpio", 0, &rst_flags);
 +   //ts->pwr_pin = of_get_named_gpio_flags(np, "power-gpio", 0, &pwr_flags);
    //ts->tp_select_pin = of_get_named_gpio_flags(np, "tp-select-gpio", 0, &tp_select_flags);
    if (of_property_read_u32(np, "max-x", &val)) {
    	dev_err(&client->dev, "no max-x defined\n");
    	return -EINVAL;
    }
    //ts->abs_x_max = val;
    if (of_property_read_u32(np, "max-y", &val)) {
    	dev_err(&client->dev, "no max-y defined\n");
    	return -EINVAL;
    }
    //ts->abs_y_max = val;
    if (of_property_read_u32(np, "configfile-num", &val)) {
	    ts->cfg_file_num = 0;
    } else {
	    ts->cfg_file_num = val;
    }
    ts->pendown =PEN_RELEASE;
    ts->client = client;
    
    
    INIT_WORK(&ts->work, goodix_ts_work_func);
    ts->client = client;
    spin_lock_init(&ts->irq_lock);          // 2.6.39 later
    // ts->irq_lock = SPIN_LOCK_UNLOCKED;   // 2.6.39 & before
#if GTP_ESD_PROTECT
    ts->clk_tick_cnt = 2 * HZ;      // HZ: clock ticks in 1 second generated by system
    GTP_DEBUG("Clock ticks for an esd cycle: %d", ts->clk_tick_cnt);  
    spin_lock_init(&ts->esd_lock);
    // ts->esd_lock = SPIN_LOCK_UNLOCKED;
#endif


相关推荐
chlk12318 小时前
Linux文件权限完全图解:读懂 ls -l 和 chmod 755 背后的秘密
linux·操作系统
舒一笑18 小时前
Ubuntu系统安装CodeX出现问题
linux·后端
改一下配置文件19 小时前
Ubuntu24.04安装NVIDIA驱动完整指南(含Secure Boot解决方案)
linux
碳基沙盒19 小时前
OpenClaw 多 Agent 配置实战指南
运维
深紫色的三北六号1 天前
Linux 服务器磁盘扩容与目录迁移:rsync + bind mount 实现服务无感迁移(无需修改配置)
linux·扩容·服务迁移
SudosuBash1 天前
[CS:APP 3e] 关于对 第 12 章 读/写者的一点思考和题解 (作业 12.19,12.20,12.21)
linux·并发·操作系统(os)
哈基咪怎么可能是AI2 天前
为什么我就想要「线性历史 + Signed Commits」GitHub 却把我当猴耍 🤬🎙️
linux·github
十日十行2 天前
Linux和window共享文件夹
linux
Sinclair3 天前
简单几步,安卓手机秒变服务器,安装 CMS 程序
android·服务器
木心月转码ing3 天前
WSL+Cpp开发环境配置
linux