Question for gpio regulator (regulator-fixed)

hello lunarking1028,

here’s definition in device tree to indicate the regulator names and its voltage.
for example,
$L4T_Sources/r32.5/Linux_for_Tegra/source/public/hardware/nvidia/platform/t19x/galen/kernel-dts/common/tegra194-fixed-regulator-p2822-1000.dtsi

        fixed-regulators {
                p2822_avdd_cam_2v8: regulator@107 {
                        compatible = "regulator-fixed";
                        reg = <107>;
                        regulator-name = "avdd-cam-2v8";
                        regulator-min-microvolt = <2800000>;
                        regulator-max-microvolt = <2800000>;
                        gpio = <&tegra_main_gpio TEGRA194_MAIN_GPIO(N, 0) 0>;
                        enable-active-high;
                };

this is assigned in the camera sensor device tree, it’s shown as vana-supply for camera driver’s usage.
for example,
$L4T_Sources/r32.5/Linux_for_Tegra/source/public/hardware/nvidia/platform/t19x/galen/galen/kernel-dts/common/tegra194-p2822-0000-camera-e3333-a00.dtsi

                        i2c@0 {
                                reg = <0>;
                                ov5693_a@36 {
                                        vana-supply = <&p2822_avdd_cam_2v8>;

there’s camera board specific device tree, (i.e. OV5693 camera sensor drivers).
it’s compatible = "nvidia,ov5693"; variable to indicate which sensor driver it used, and the actual regulator that may used from kernel driver side.
for example,
$L4T_Sources/r32.5/Linux_for_Tegra/source/public/hardware/nvidia/platform/t19x/common/kernel-dts/t19x-common-modules/tegra194-camera-e3333-a00.dtsi

        i2c@3180000 {
                tca9548@77 {
                        i2c@0 {
                                ov5693_a@36 {
                                        compatible = "nvidia,ov5693";
                                        reg = <0x36>;
                                        devnode = "video0";
...
                                        avdd-reg = "vana";
                                        iovdd-reg = "vif";

thereafter, if you looking into sensor driver, ov5693.c
it’s compatible to indicate the device tree sources.
you’ll see parsing function to read the property from device tree, and it’ll able to have sensor operations.
for example,

static const struct of_device_id ov5693_of_match[] = {
        {
                .compatible = "nvidia,ov5693",
static struct camera_common_pdata *ov5693_parse_dt(struct tegracam_device *tc_dev)
{
...
        err = of_property_read_string(node, "avdd-reg", &board_priv_pdata->regulators.avdd);

so,
you may have your implementation in kernel drivers to use them,
if necessary, you may also extend the definition in device tree for adding regulators.
thanks

1 Like