This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Tool/software: Linux
Hi,
I am having TMDSEVM572X with AM572x Evaluation Module with latest linux-processor sdk.
This time i am not connecting the camera, just want to check the pin status hardwarely. My question is can i set GPIO pin manually from driver side code?(ti-processor-sdk-linux-am57xx-evm-03.03.00.04/board-support/linux-4.4.41+gitAUTOINC+f9f6f0db2d-gf9f6f0db2d/drivers/media/i2c/mt9t11x.c)? e.g. i did following in "mt9t11x_probe()" function-
gpio_read = gpiod_get_raw_value(priv->bufen_gpio);
dev_err(&client->dev, "BUFEN_PREV %d", gpio_read);
gpiod_set_raw_value_cansleep(priv->bufen_gpio, 1);
gpio_read = gpiod_get_raw_value(priv->bufen_gpio);
dev_err(&client->dev, "BUFEN_AFTER %d", gpio_read);
It is reflecting my changes in log (dmesg |grep mt9t11x), as-
[ 7.867966] mt9t11x 4-003c: BUFEN_PREV 0
[ 7.871907] mt9t11x 4-003c: BUFEN_AFTER 1
but not able to get high at hardware pin level.
Thanks.
Hi Prabhakar,
Have you set the pinmux appropriately to select the gpio ?
Yes, i did the pinmux appropriately in mux_data.h and am57xx-beagle-x15-common.dtsi files.
Which bank is the gpio from, is the bank enabled can you read the revision number of it ?
My gpio is gpio1_19 (Ball name- GPMC_AD13). Can you please suggest me how to find the corresponding bank and enable it?
Refer link [1] to test the hardware from user space to set the gpio pin as op/ip
I have gone through this, the values are updated software but not reflecting in Hardware.
Thanks.
Hi Yordan,
I added the above calls but still no result.
Please just verify my steps to toggle a perticular gpio (gpio1_19)-
1) I changed the pinmux setting in mux_data.h.
{GPMC_AD13, (M14 | PIN_OUTPUT)}, /* gpmc_ad13.BUFF_EN gpio1_19*/
2) Made a node in am57xx-beagle-x15-common.dtsi
gpio1_pins_default: gpio1_pins_default {
pinctrl-signle,pins = <
0x34 (PIN_OUTPUT | MUX_MODE14) //gpmc_ad13.gpio1_19
>;
};
and the added the above calls that you stated.
&gpio1 {
pinctrl-names = "default";
pinctrl-0 = <&gpio1_pins_default>;
status = "okay"; // To enable GPIO1
};
also in same file in &i2c5 call,
&i2c5 {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&i2c5_pins_default>;
clock-frequency = <400000>;
mt9t11x@3C {
compatible = "aptina,mt9t111";
reg = <0x3C>;
bufen-gpios = <&gpio1 19 GPIO_ACTIVE_HIGH>;
port {
cam: endpoint {
remote-endpoint = <&vin3a>;
hsync-active = <1>;
vsync-active = <1>;
pclk-sample = <0>;
input-clock-freq = <32000000>;
pixel-clock-freq = <96000000>;
};
};
};
};
In driver code, i added
//reading buffen_gpio status
gpio_read = gpiod_get_raw_value(priv->bufen_gpio);
dev_err(&client->dev, "BUFEN_PREV %d", gpio_read);
gpiod_set_raw_value_cansleep(priv->bufen_gpio, 1);
gpio_read = gpiod_get_raw_value(priv->bufen_gpio);
dev_err(&client->dev, "BUFEN_AFTER %d", gpio_read);
Any mistake in these changes? Still not working. I am not getting HIGH output.
Thanks.
Hi Yordan,
Can you test with raw writes to the corresponding GPIO_DATAOUT register?
Also have a look at omap-gpio.c driver, there is a omap_set_gpio_dataout_reg() function which is used to toggle bits (gpios) in the DATAOUT register.
I found omap_gpio_set_value() function in omap_gpio.c driver.
What is the difference of using omap_gpio_set_value() and gpiod_set_value_cansleep()/gpiod_set_raw_value_cansleep(). As gpiod_set_value_cansleep() is already being used in mt9t11x.c driver to set the GPIO value i guess. Is this not correct?
Can you please go through the mt9t11x.c driver? And let me know what is the issue there if any?
when using gpiod_set_value_cansleep() you need to lock the gpio with mutex.
I did that but no satisfying output.
Hi Yordan,
Can you test with raw writes to the corresponding GPIO_DATAOUT register?
Also have a look at omap-gpio.c driver, there is a omap_set_gpio_dataout_reg() function which is used to toggle bits (gpios) in the DATAOUT register.
I found omap_gpio_set_value() function in omap_gpio.c driver.
What is the difference of using omap_gpio_set_value() and gpiod_set_value_cansleep()/gpiod_set_raw_value_cansleep(). As gpiod_set_value_cansleep() is already being used in mt9t11x.c driver to set the GPIO value i guess. Is this not correct?
Can you please go through the mt9t11x.c driver? And let me know what is the issue there if any?
when using gpiod_set_value_cansleep() you need to lock the gpio with mutex.
I did that but no satisfying output.
Hello,
My bad i read thre trm wrongly its only gpio1[0:3] are as i/p only.
Pinmux for GPIO1_18 register 0x4a003430 should be set to 0x5000E
Pinmux for GPIO1_21 register 0x4a00343c should be set to 0x5000E
Try this from the uboot first to check if the h/w is rite:
mw is cmd to write and md is to display:
0x4ae10134 = FFEBFFFF > set pins as o/p
0x4ae10194 = 140000 > to make the pin high
0x4ae10190 = 140000 > to make the pin low
Cheers,
--Prabhakar Lad
Hi Yordan,
Can you test with raw writes to the corresponding GPIO_DATAOUT register?
I checked and confirmed the raw writes during uboot. Its working fine.
Also have a look at omap-gpio.c driver, there is a omap_set_gpio_dataout_reg() function which is used to toggle bits (gpios) in the DATAOUT register.
I want to ask that in mt9t11x.c which i am currently using, there are calls for setting gpios. So what is the difference in using omap_set_gpio_dataout_reg()?