Allwinner F1C100S/F1C200S study notes (6)-add nodes to the device tree

1. Introduction

Nano's device tree is in the source code linux ‣ arch ‣ arm ‣ boot ‣ dts ‣ suniv-f1c100s-licheepi-nano.dts; the
device tree dts file describes the definition and configuration of various peripherals, and the configuration profile:

  • / { … } The package is the root node, which defines the configuration of various buses and peripherals;
  • &xxx { … }The content of the package is a reference, and its definition comes from suniv.dtsi(the general definition of suniv series equipment)
  • compatible The attribute will correspond to the compatible definition in the driver source code for identification selection;
  • Prepared portions of the device tree, refer to linux ‣ Documentation ‣ devicetree ‣ bindingsthe respective modules
  • For a detailed introduction of the device tree as a whole, please refer to Device_Tree. There is also a more detailed description in the zero document;

2. Modify the LCD configuration in the device tree

The attribute name linux/drivers/gpu/drm/panel/panel-simple.cis defined in the file.

# 修改 / { } 所包裹的根节点目录下,panel属性下的compatible

# 当前默认的 LCD配置 为480X272大小的屏幕
“qiaodian,qd43003c0-40”, “simple-panel”

# 适配800X480的屏,修改为:
“lg,lb070wv8”, “simple-panel”

3. Add the RGB LED node configuration on the backplane

Add under the root node directory wrapped by / {}:

 leds {
    
    
             compatible = "gpio-leds";
             
             blue_led {
    
    
                     label = "licheepi:blue:usr";
                     gpios = <&pio 4 4 GPIO_ACTIVE_LOW>; /* PE4 */
             };

             green_led {
    
    
                     label = "licheepi:green:usr";
                     gpios = <&pio 4 5 GPIO_ACTIVE_LOW>; /* PE5 */
                     default-state = "on";
             };

             red_led {
    
    
                     label = "licheepi:red:usr";
                     gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PE6 */
             };
     };

Fourth, add support for capacitive touch screen

The control chip of the capacitive touch screen is GT911, using the I2C interface, we need to add the definition in the device tree file.

1, modify the suniv.dtsifile

  • The attributes and configurations added here are from the search for user manuals and compatible devices
  • In socadding configure properties (no next node original i2c0node)
i2c0: i2c@1C27000 {
    
    
	compatible = "allwinner,sun6i-a31-i2c";
		reg = <0x01C27000 0x400>;
		interrupts = <7>;
		clocks = <&ccu CLK_BUS_I2C0>;
		resets = <&ccu RST_BUS_I2C0>;
		pinctrl-names = "default";
		pinctrl-0 = <&i2c0_pins>;
		status = "disabled";
		#address-cells = <1>;
		#size-cells = <0>;
};
  • In pioadding i2c pin definition node (existing)
i2c0_pins: i2c0 {
    
    
	pins = "PE11", "PE12";
	function = "i2c0";
};

2, modify the suniv-f1c100s-licheepi-nano.dtsfile

  • If the xy direction of the tested touch screen is reversed, please add or remove the touchscreen-swapped-xy attribute under the gt911 node.
/* 首先要添加的头文件: */
#include <dt-bindings/input/input.h>
#include <dt-bindings/interrupt-controller/irq.h>

/* 添加引用 */
&i2c0 {
    
    
    pinctrl-0 = <&i2c0_pins>;
    pinctrl-names = "default";
    status = "okay";

    gt911: touchscreen@14 {
    
    
        compatible = "goodix,gt911";
        reg = <0x14>;
        interrupt-parent = <&pio>;
        interrupts = <4 10 IRQ_TYPE_EDGE_FALLING>; /* (PE10) */
        pinctrl-names = "default";
        pinctrl-0 = <&ts_reset_pin>;
        irq-gpios = <&pio 4 10 GPIO_ACTIVE_HIGH>; /* (PE10) */
        reset-gpios = <&pio 4 9 GPIO_ACTIVE_HIGH>; /* RST (PE9) */
        /* touchscreen-swapped-x-y */
    };
};

&pio {
    
    
    ts_reset_pin: ts_reset_pin@0 {
    
    
        pins = "PE9";
        function = "gpio_out";
    };
};

Five, compile and generate dtb file

The generated dtb file is in the same directory as dts, and put it into the first partition of the TF card.

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- dtbs -j12

Guess you like

Origin blog.csdn.net/p1279030826/article/details/112967217