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