Camera'a reset-gpios not found via IO expander

Dear All,

Could someone give me an example of configuring an IO Expander ( TCA6408, TCA8539, …) as output to be used in a sensor node’s reset-gpios property, please ?

For example :
Define outputs :

  i2c@3180000 {
    tca6408_21: tca6408@21 {
      compatible = "ti,tca6408";
      gpio-controller;
      #gpio-cells = <2>;
      reg = <0x21>;
      vcc-supply = <&en_vdd_cam>;

      // TODO : Configure inputs & outputs  
    };
   };

Use outputs as value of reset-gpios property :

  i2c@3180000 {
        imx219_z@10 {
          ...
          reset-gpios = <&tca6408_21 0 GPIO_ACTIVE_HIGH>;
          ...
        };
        imx219_y@10 {
          ...
          reset-gpios = <&tca6408_21 1 GPIO_ACTIVE_HIGH>;
          ...
        };
  };

I’ve got following error be only doing as above :
imx219 10-001f: reset-gpios not found

Thanks in advance,
K.

hello khang.l4es,

so, you’re going to enable TCA6408 multiplexer,
had you already configure those GPIO definition? you should see reference driver to have implementation.
for example,

        i2c@3180000 {
                tca6408_21: tca6408@21 {
                        compatible = "ti,tca6408";
                        gpio-controller;
                        #gpio-cells = <2>;
                        reg = <0x21>;
                        vcc-supply = <&p2822_vdd_1v8_cvb>;
                        tca6408_21_outlow {
                                gpio-hog;
                                gpios = <0 0 1 0 ...>;
                                output-low;
                                label = "tca6408_21_outlow_0",
                                        "tca6408_21_outlow_1",
                                        ...

                        tca6408_21_outhigh {
                                status = "disabled";
                        };
                        tca6408_21_input {
                                status = "disabled";
                        };

...
                        i2c@2 {
                                ov5693_c@36 {
                                        pwdn-gpios = <&tca6408_21 0 GPIO_ACTIVE_HIGH>;
                                        reset-gpios = <&tca6408_21 1 GPIO_ACTIVE_HIGH>;
                                        ...

to add-on,
<0 0>, the 1st 0 is GPIO definition, the 2nd 0 is the default state.
this example, define two GPIOs, both of them configure low by default.

HI @JerryChang ,
Thanks for your reply. It is clear for me about defining gpio inputs as well as outputs low and high. I’m specially interested in reset-gpios definition which is not recognized. I would like to know why

 i2c@2 {
 }

is there and should it be inside

tca6408_21: tca6408@21 {

};

Also, in case if the camera sensor is plugged into different i2c bus, what would happen, please ?

Many thanks,
K.

i2c@2 this may not necessary for your use-case, it’s recap from the reference drivers,
it’s a six camera module to share the i2c bus (0x36) with pca9548. it muxes i2c address by using i2c@0 to i2c@5.
for example, $L4T_Sources/r32.6.1/Linux_for_Tegra/source/public/hardware/nvidia/platform/t19x/galen/kernel-dts/common/tegra194-p2822-0000-camera-e3333-a00.dtsi

please replace that with the actual sensor i2c address if you’re having camera modules define without mux.
thanks

Hi @JerryChang ,

Thanks again for your reply. I would like to make a little bit clearer the case without i2c mux. For example, if my sensor is hooked to a different i2c bus saying i2c@3160000, How should I replace the above i2c@2 node ? Could i2c@3160000 be inside tca6408@21 and same level of tca6408_21_outlow, tca6408_21_outhigh, tca6408_21_input, etc?

        i2c@3180000 {
                tca6408_21: tca6408@21 { // Begin of tca6408_21
                        compatible = "ti,tca6408";
                        gpio-controller;
                        #gpio-cells = <2>;
                        reg = <0x21>;
                        vcc-supply = <&p2822_vdd_1v8_cvb>;
                        tca6408_21_outlow {
                                gpio-hog;
                                gpios = <0 0 1 0 ...>;
                                output-low;
                                label = "tca6408_21_outlow_0",
                                        "tca6408_21_outlow_1",
                                        ...

                        tca6408_21_outhigh {
                                status = "disabled";
                        };
                        tca6408_21_input {
                                status = "disabled";
                        };

                        i2c@3160000 {
                                ov5693_c@36 {
                                        pwdn-gpios = <&tca6408_21 0 GPIO_ACTIVE_HIGH>;
                                        reset-gpios = <&tca6408_21 1 GPIO_ACTIVE_HIGH>;
                                        ...
                                };
                        };  // End of i2c@3160000 

                 };  // End of tca6408_21: tca6408@21

        }; // End of   i2c@3180000

Or should i2c@3160000 be same level as i2c@3180000, please ?

And should we list out the gpios’ indexes (0 and 1 for example) :

                                gpios = <0 0 1 0 ...>;

that later will be used in

                                        pwdn-gpios = <&tca6408_21 0 GPIO_ACTIVE_HIGH>;
                                        reset-gpios = <&tca6408_21 1 GPIO_ACTIVE_HIGH>;

Thanks,
Khang

hello khang.l4es,

you should define i2c@3160000 to be same level as i2c@3180000,
here’s hierarchy in the above reference driver,

        i2c@3180000 {
                tca6408@21 {...}
                tca9548@77 {
                        i2c@0 {...}
                        i2c@1 {...}
                        i2c@2 {...}
                        ...

yes.

Hi @JerryChang ,

The provided example , $L4T_Sources/r32.6.1/Linux_for_Tegra/source/public/hardware/nvidia/platform/t19x/galen/kernel-dts/common/tegra194-p2822-0000-camera-e3333-a00.dtsi is quite clear. I just have some small doubts :

  1. Should we list out all of the GPIOs’ indexes or just one(s) we use? For example, if the reset-gpios is for my sensor is on output #7, then which one below is correct :
 gpios = <0 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0>;

or

 gpios = <7 0>;
  1. The reset-gpios of my sensor is active-low i.e a low level (0V) on that gpio will cause the reset. Therefore, do I need to define inversely :
                       tca6408_21_outlow {
                               status = "disabled";
                       };

                       tca6408_21_outhigh {
                               gpio-hog;
                               gpios = <7 0>; // Or  gpios = <0 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0>;
                               output-high;
                               label = "tca6408_21_outhigh_7;
                       };
                       tca6408_21_input {
                               status = "disabled";
                       };

and

                                        reset-gpios = <&tca6408_21 7 GPIO_ACTIVE_LOW>;

Thanks alot,
Khang

hi khang.l4es,

  1. you don’t need to list all of the GPIOs’ indexes, please just specify the ones you would like to use.
  2. it looks the correct init gpio state settings.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.