高通gpio配置输出
设备树文件
1 icn6211@2c { 2 compatible = "qcom,icn6211_mipi_rgb"; 3 reg = <0x2c>; 4 icn6211,switch-gpio = <&msm_gpio 61 0x00>; 5 icn6211,lcdreset-gpio = <&msm_gpio 25 0x00>; 6 };
c文件
1 #include2 #include 3 #include 4 5 #define GPIO_HIGH 1 6 #define GPIO_LOW 0 7 8 static int icn6211_probe(struct i2c_client *client, const struct i2c_device_id *id) 9 { 10 int icn6211_reset_gpio = 0; 11 struct device_node *np = client->dev.of_node; 12 13 icn6211_reset_gpio = of_get_named_gpio(np, "icn6211,lcdreset-gpio", 0); 14 if (!gpio_is_valid(icn6211_reset_gpio)) 15 { 16 pr_err("%s: fail @gpio_is_valid, custom_output1_gpio=%d\n", __func__, icn6211_reset_gpio); 17 } 18 else 19 { 20 if (gpio_request(icn6211_reset_gpio, "icn6211,lcdreset-gpio") != 0) 21 { 22 gpio_free(icn6211_reset_gpio); 23 pr_err("%s: fail @gpio_request, custom_output1_gpio=%d\n", __func__, icn6211_reset_gpio); 24 } 25 else 26 { 27 gpio_direction_output(icn6211_reset_gpio, GPIO_LOW); 28 } 29 } 30 }