Gpio04 and adv7482 reset

We have same problem, here, in Xavier NX. We used GPIO04 to connected to adv7482 reset pin. We released this gpio in “tegra194-p3668-common.dtsi” and can change value in userspace, but We cant to change the value of this gpio in driver. How We can change this gpio04 in driver?
JP4.6.2.

regards
royayeazadi

hello royayeazadi,

are you using a customize board?
this pin is by default as Baseboard Power LED Control.
for example,

                suspend_gpio: suspend-led-gpio {
                        gpios = <TEGRA194_AON_GPIO(CC, 1) GPIO_ACTIVE_HIGH>;

Thanks for your reply;
Yes we are using customize board.

hello royayeazadi,

in the device tree sources, you should have a scope of adv7482, please define this pin within the same scope.
then, you should be able to use the APIs to parse this pin from kernel driver side.
for example, of_get_named_gpio()

Thanks for your reply;
In kernel driver:

gpio = of_get_named_gpio(np, "reset-gpios", 0);
	if (gpio < 0) {
		if (gpio == -EPROBE_DEFER)
			ret = ERR_PTR(-EPROBE_DEFER);
		dev_err(dev, "reset-gpios not found\n");
		goto error;
	}

In dts:

#define CAM0_RST_L	TEGRA194_AON_GPIO(CC, 1)//GPIO04 ~ gpio265
/ {
	i2c@3180000 {
		#address-cells = <1>;
		#size-cells = <0>;
		adv7482_ef@70 {
			reset-gpios = <&tegra_aon_gpio CAM0_RST_L GPIO_ACTIVE_HIGH>;
		};
	};
	
	gpio@c2f0000 {
		aon-camera-control-output-low {
			gpio-hog;
			output-low;
			gpios = <CAM0_RST_L 0 >;
			label = "cam0-rst";
			status = "okay";
		};
	};
}

but We cant to change the value of this gpio.

hello royayeazadi,

is there kernel failure reported when you’re parsing this gpio pin?

How I can to find “failure report”?

hello royayeazadi,

$ dmesg it’ll dump kernel logs.
you may setup a terminal to leave it running with $ dmesg --follow. and please enable your adv7482 driver which should fetch GPIO while init.
please check whether there shows error logs.

no error logs for gpio in kernel.

hello royayeazadi,

so, the reset-gpios should be available for the driver side.
please dig into your driver implementation to debug the issue.

this file is my driver.
adv7482.c (11.8 KB)
adv7482_tables.h (14.2 KB)

hello royayeazadi,

had you check this GPIO number is parse correctly? is it gpio265?
i.e. board_priv_pdata->reset_gpio = (unsigned int)gpio;

hello JerryChang,
thanks for your reply,

This line is print 265.
pr_alert(“%s___pw->reset_gpio=%d \n”, func, pw->reset_gpio);

hello royayeazadi,

okay, this GPIO pin should be valid. you may also using API for examination btw.
i.e. static inline bool gpio_is_valid(int number)

are you certain this due to reset pin did not toggle from driver side?
had you confirm the GPIO direction configure is correct? for example, you may calling gpio_direction_output() to configure the pin.

yes, i am certain. we see that with oscilloscope.

where this is call?

hello royayeazadi,

it is used for pin direction configuration. you may see-also reference driver as see-also.

thanks for reply,
I will test and report.

I use `gpio_direction_output(), but not change the value of gpio in oscilloscope.

hello royayeazadi,

let me confirm your issue again.
you meant you could see GPIO state change if you used sysfs to toggle the pin but you cannot controlling the same in driver code?