A small, affordable computer with free resources to help people learn, make things, and have fun
https://forums.raspberrypi.com/
Code: Select all
/dts-v1/;
/plugin/;
/ {
compatible = "brcm,bcm2835";
i2c_frag: fragment@0 {
target = <&i2c_csi_dsi>;
__overlay__ {
#address-cells = <1>;
#size-cells = <0>;
status = "okay";
gt911: gt911@5d {
compatible = "goodix,gt911";
reg = <0x5d>;
touchscreen-x-mm = <90>;
touchscreen-y-mm = <151>;
reset-gpios = <&gpio 5 1>; // 1 means GPIO_ACTIVE_LOW
irq-gpios = <&gpio 6 0>;
interrupt-parent = <&gpio>;
interrupts = <6 2>; // 2 = IRQ_TYPE_EDGE_FALLING
touchscreen-swapped-x-y=<1>;
touchscreen-inverted-y=<1>;
};
};
};
dsi_frag: fragment@1 {
target = <&dsi1>;
__overlay__ {
#address-cells = <1>;
#size-cells = <0>;
status = "okay";
port {
dsi_out: endpoint {
remote-endpoint = <&dsi_panel_in>;
};
};
panel_disp: panel_disp@0 {
reg = <0>;
// Loads a modified version of the panel-ilitek-ili9806e driver
compatible = "densitron,dmt050wvnmcmi-1a";
// This is an unconnected dummy gpio, the display is reset by the touch controller init
reset-gpios = <&gpio 8 1>; // 1 means GPIO_ACTIVE_LOW
port {
dsi_panel_in: endpoint {
remote-endpoint = <&dsi_out>;
};
};
};
};
};
};
Code: Select all
ctx->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW);Code: Select all
ctx->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);Code: Select all
[...]
panel_disp: panel_disp@0 {
// Ensure touchscreen is probed first to perform reset
parent = < >911 >;
[...]
Code: Select all
static int ili9806e_dsi_probe(struct mipi_dsi_device *dsi)
{
struct device *dev = &dsi->dev;
struct device_node * parent = of_parse_phandle(dev->of_node, "parent", 0);
if (parent)
{
struct device *parent_dev;
parent_dev = bus_find_device_by_of_node(&i2c_bus_type, parent);
Code: Select all
static int ili9806e_dsi_probe(struct mipi_dsi_device *dsi)
{
struct device *dev = &dsi->dev;
struct device_node * parent = of_parse_phandle(dev->of_node, "parent", 0);
if (parent)
{
struct i2c_client * parent_i2c = of_find_i2c_device_by_node(parent);
if (parent_i2c)
{
void * data = dev_get_drvdata(&parent_i2c->dev);
put_device(&parent_i2c->dev);
if (!data)
{
printk(KERN_INFO "ili9806e parent i2c not ready, deferring");
return -EPROBE_DEFER;
}
}
[...]
There is a very-non-upstream driver that allows you to create virtual GPIOs and link to them in Device Tree. It's the gpio-fsm driver, where "fsm" is short for Finite State Machine. This would allow you to create a dummy GPIO and save a pin.1) Is there a way to specify a dummy gpio for the Ilitek reset-gpios? The driver requires reset-gpios to be there, but I would prefer not to waste an actual GPIO line for this.
Code: Select all
/dts-v1/;
/plugin/;
#include <dt-bindings/gpio/gpio-fsm.h>
#define DISP_RESET GF_SW(0)
#define TS_RESET GF_SW(1)
#define SHARED_RESET GF_OP(0) // GPIO7
/{
compatible = "brcm,bcm2835";
fragment@0 {
target-path = "/";
__overlay__ {
disp_reset: disp-reset {
compatible = "rpi,gpio-fsm";
debug = <0>;
gpio-controller;
#gpio-cells = <2>;
num-swgpios = <2>;
gpio-line-names = "disp_reset", "ts_reset";
output-gpios = <&gpio 7 1>; // SHARED_RESET
shutdown-timeout-ms = <2000>;
idle {
start_state;
set = <SHARED_RESET 0>;
reset_0 = <DISP_RESET 1>;
reset_1 = <TS_RESET 1>;
};
reset_0 {
set = <SHARED_RESET 1>;
unreset_0 = <DISP_RESET 0>;
};
unreset_0 {
set = <SHARED_RESET 0>;
skipreset_0a = <DISP_RESET 1>;
};
skipreset_0a {
skipreset_0b = <TS_RESET 1>;
};
skipreset_0b {
idle = <TS_RESET 0>;
};
reset_1 {
set = <SHARED_RESET 1>;
unreset_1 = <TS_RESET 0>;
};
unreset_1 {
set = <SHARED_RESET 0>;
skipreset_1a = <TS_RESET 1>;
};
skipreset_1a {
skipreset_1b = <DISP_RESET 1>;
};
skipreset_1b {
idle = <DISP_RESET 0>;
};
};
};
};
__overrides__ {
fsm_debug = <&disp_reset>,"debug:0";
};
};