I'm trying to interface a GPIO controller in a kernel driver and I'm not sure if I'm doing everything right.
This is my device tree code:
gpio_screen1:gpio1@20 {
compatible = "nxp,pca9535";
gpio-controller;
#gpio-cells = <2>;
reg = <0x20>;
// pinctrl-names = "default";
// pinctrl-0 = <&pinctrl_pca9505>;
};
screen: screen@0x02000 {
compatible = "myscreen,myscreen";
#address-cells = <1>;
#size-cells = <0>;
reg = < 0x04000 0xF00 >;
interrupts = <1 2>;
reset-gpios = <&gpio_screen1 15 0>;
sleep-gpios = <&gpio_screen1 14 0>;
clk_sel1-gpios = <&gpio_screen1 10 0>;
lane_sel-gpios = <&gpio_screen1 9 0>;
};
And this is my driver code that registers the GPIO
gpio = of_get_named_gpio(pdev->dev.of_node, "reset-gpios", 0);
if (!gpio_is_valid(gpio)) {
dev_err(&pdev->dev, "failed to parse reset gpio\n");
return gpio;
}
dev->reset = gpio;
Is this initialization correct?
I've been looking at the Documentation for this GPIO controller but it's not very helpful.