Dear all , My board is sabresd_6dq (kernel 3.14.52), can I setting gpio to input (Hi or Low) ? please get a little suggest. thank.
P.S I set input after, but the gpio always low, I hope set input (high).
// code
func(..){
int rc, gpio;
struct device *dev = &pdev->dev;
struct device_node *np = pdev->dev.of_node;
gpio = of_get_named_gpio(np, "test-gpio", 0);
if (gpio_is_valid(gpio)) {
rc = devm_gpio_request_one(&pdev->dev, gpio, GPIOF_OUT_INIT_HIGH, "test gpio");
if (rc) {
dev_err(&pdev->dev, "unable to get test-gpio\n");
goto error_request_gpio;
}
#define INPUT
#ifdef INPUT
mdelay(500);
//set input
gpio_direction_input(gpio);
// setting gpio input
int fault;
fault = gpio_get_value(gpio);
#endif
}
}
Hi Lin
when gpio is set as input external device should provide
necessary high/low level to it. In general one can also configure
IOMUXC_SW_PAD_CTL_PAD_X_Y register for pull-up/down to maintain necessary level,
please check Chapter 36 IOMUX Controller (IOMUXC) i.MX6DQ Reference Manual
http://cache.freescale.com/files/32bit/doc/ref_manual/IMX6DQRM.pdf
Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Dear igor
Thank. I check register after, add register to dts. result: 1. set pull down is success 2. set pull up fail (voltage is 0.2 v), can you get me a little suggest.
P.S high should is 3.3v, but it is 0.2 v, please help me. thank.
// dts file
.......................
imx6qdl-sabresd {
.........................
fsl,pins = <
...........................
MX6QDL_PAD_NANDF_CS3__GPIO6_IO16 0x80000000
/* Baro int pull up( 0.2 v)*/
MX6QDL_PAD_EIM_DA15__GPIO3_IO15 0x1b0b0
/* Baro int pull down*/
//MX6QDL_PAD_EIM_DA15__GPIO3_IO15 0x110b0
>;