Hi,
I got following error while attempting to use an output from the IO Expander as the reset-gpios for the camera sensor in Jetpack-6.2 :
nvidia@ORNN:~$ sudo dmesg | grep toto
[ 12.596474] toto 7-0010: probing toto v4l2 sensor at addr 0x10
[ 12.596720] toto 7-0010: supply vana not found, using dummy regulator
[ 12.603744] toto 7-0010: camera_common_regulator_get: vana
[ 12.603766] toto 7-0010: supply vdig not found, using dummy regulator
[ 12.618172] toto 7-0010: camera_common_regulator_get: vdig
[ 12.618200] toto 7-0010: supply vana not found, using dummy regulator
[ 12.618990] toto 7-0010: camera_common_regulator_get: vana
[ 12.618999] toto 7-0010: toto_power_get: unable to request reset_gpio (-16)
[ 12.619004] toto 7-0010: unable to power get
[ 12.619007] toto 7-0010: tegra camera driver registration failed
[ 12.620628] toto: probe of 7-0010 failed with error -14
The IO Expander is well registered and enumerates the IOs under its control :
nvidia@ORNN:~$ sudo cat /sys/kernel/debug/gpio
gpiochip2: GPIOs 308-315, parent: i2c/7-0027, mcp23008, can sleep:
gpio-309 ( |mcp23008_27_output_h) in hi
gpio-310 ( |mcp23008_27_output_h) in hi
gpio-311 ( |mcp23008_27_output_h) in hi
Relevant device-tree node :
i2c@c250000 {
status = "okay";
#address-cells = <1>;
#size-cells = <0>;
mcp23008_27: gpio@27 {
compatible = "microchip,mcp23008";
gpio-controller;
#gpio-cells = <2>;
reg = <0x27>;
status = "okay";
// interrupt-parent = <&gpio_aon>; // gpiochip1: registered GPIOs 316 to 347 on tegra234-gpio-aon
// interrupts = <TEGRA234_AON_GPIO(CC, 3) IRQ_TYPE_EDGE_FALLING>; // GPIO6/GPIO06/PCC.03/331
// irq-gpios = <&gpio_aon TEGRA234_AON_GPIO(CC, 3) GPIO_ACTIVE_HIGH>; // GPIO6/GPIO06/PCC.03/331
reset-gpios = <&gpio TEGRA234_MAIN_GPIO(P, 6) GPIO_ACTIVE_LOW>; // GPIO2/GPIO02/PP.06/446
interrupt-controller;
#interrupt-cells=<2>;
microchip,irq-mirror;
microchip,irq-active-high;
mcp23008_27_output_low {
status = "disabled";
};
mcp23008_27_output_high {
gpio-hog;
output-high;
gpios = <1 0 2 0 3 0>;
};
};
toto_a@10 {
status = "okay";
compatible = "sony,toto";
/* I2C device address */
reg = <0x10>;
/* V4L2 device node location */
devnode = "video0";
/* Physical dimensions of sensor */
physical_w = "1.944";
physical_h = "1.097";
sensor_model = "toto";
use_sensor_mode_id = "false";
/* Define any required hw resources needed by driver */
/* ie. clocks, io pins, power sources */
/* mclk-index indicates the index of the */
/* mclk-name with in the clock-names array */
avdd-reg = "vana";
iovdd-reg = "vif";
dvdd-reg = "vdig";
//vana-supply = <&p3509_avdd_cam_2v8>;
//vif-supply = <&p3509_vdd_1v8_cvb>;
//vana-supply = <&p3509_vdd_3v3_cvb>;
//vdig-supply = <&p3509_vdd_sys_en>;
clocks = <&bpmp TEGRA234_CLK_EXTPERIPH1>,
<&bpmp TEGRA234_CLK_EXTPERIPH1>;
clock-names = "extperiph1", "pllp_grtba";
mclk = "extperiph1";
clock-frequency = <24000000>;
reset-gpios = <&mcp23008_27 3 GPIO_ACTIVE_LOW>;
mode0 { //1920x1080_60Fps
Relevant source code :
static int toto_power_get(struct tegracam_device *tc_dev)
{
struct device *dev = tc_dev->dev;
struct camera_common_data *s_data = tc_dev->s_data;
struct camera_common_power_rail *pw = s_data->power;
struct camera_common_pdata *pdata = s_data->pdata;
struct clk *parent;
int err = 0;
if (!pdata) {
dev_err(dev, "pdata missing\n");
return -EFAULT;
}
/* Sensor MCLK (aka. INCK) */
if (pdata->mclk_name) {
pw->mclk = devm_clk_get(dev, pdata->mclk_name);
if (IS_ERR(pw->mclk)) {
dev_err(dev, "unable to get clock %s\n",
pdata->mclk_name);
return PTR_ERR(pw->mclk);
}
if (pdata->parentclk_name) {
parent = devm_clk_get(dev, pdata->parentclk_name);
if (IS_ERR(parent)) {
dev_err(dev, "unable to get parent clock %s",
pdata->parentclk_name);
} else
clk_set_parent(pw->mclk, parent);
}
}
/* analog 3.3v */
if (pdata->regulators.avdd)
err |= camera_common_regulator_get(dev,
&pw->avdd, pdata->regulators.avdd);
if (err) {
dev_err(dev, "%s: unable to get regulator(s)\n", __func__);
goto done;
}
/* dig 1.2v */
if (pdata->regulators.dvdd)
err |= camera_common_regulator_get(dev,
&pw->dvdd, pdata->regulators.dvdd);
if (err) {
dev_err(dev, "%s: unable to get regulator(s)\n", __func__);
goto done;
}
/* vdd 1.8v */
if (pdata->regulators.iovdd)
err |= camera_common_regulator_get(dev,
&pw->avdd, pdata->regulators.avdd);
if (err) {
dev_err(dev, "%s: unable to get regulator(s)\n", __func__);
goto done;
}
/* Reset or ENABLE GPIO */
pw->reset_gpio = pdata->reset_gpio;
err = gpio_request(pw->reset_gpio, "cam_reset_gpio");
if (err < 0) {
dev_err(dev, "%s: unable to request reset_gpio (%d)\n",
__func__, err);
goto done;
}
done:
pw->state = SWITCH_OFF;
return err;
}
Could you give a hint to debug this as this was working well with Jetpack-5, please ?
Thanks in advance and best regards,
Khang