I created a GPIO based fixed regulator in my device tree, and an I2C device that uses it, but the regulator initializes after the I2C device in the boot sequence, so the device fails to initialize:
Regulator:
#define GPIO_1V8_PWR_EN_1V8 TEGRA194_MAIN_GPIO(P, 5)
fixed-regulators {
p0661_1v8_switch: p0661_1v8_sensors: regulator@105 {
compatible = "regulator-fixed";
reg = <105>;
regulator-name = "+1V8_SW";
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
gpio = <&tegra_main_gpio GPIO_1V8_PWR_EN_1V8 0>;
enable-active-high;
vin-supply = <&p0661_1v8_ldo>;
};
};
The I2C device:
i2c0_3v3: i2c@c240000 { // Linux i2c-1 - lm75 driver
status = "okay";
tmp112_0x48: tmp112@48 {
compatible = "ti,tmp112";
reg = <0x48>;
vs-supply = <&p0661_1v8_sensors>;
status = "okay";
};
};
Both the regulator and device show up in the device tree. However the regulator is initialized in the boot sequence AFTER the device (checks for regulator at 7.285940, supply initializes at 7.331517, final failure at 7.374369:
[ 7.285940] lm75 1-0048: Failed to get regulator vs
[ 7.311001] tegra-i2c 31e0000.i2c: Adding to iommu group 2
[ 7.327782] cpufreq: cpufreq_online: CPU0: Running at unlisted initial frequency: 1905000 KHz, changing to: 1907200 KHz
[ 7.328789] tegra194-cpufreq ccplex: probed with BWMGR
[ 7.330399] sdhci-tegra 3460000.sdhci: BWMGR client registration for eMC Successful
[ 7.331517] +1V8_SW: supplied by +1V8_LDO
[ 7.331528] sdhci-tegra 3440000.sdhci: Got CD GPIO
[ 7.331940] sdhci-tegra 3440000.sdhci: BWMGR client registration for eMC Successful
[ 7.332483] irq: IRQ267: trimming hierarchy from :pmc@c360000
[ 7.339572] usb-conn-gpio 3520000.xusb_padctl:ports:usb2-0:connector: repeated role: 0
[ 7.341637] tegra194-isp5 13e10000.host1x:isp@14800000: initialized
[ 7.353550] driver not enabled, cannot register any devices
[ 7.359845] mmc0: CQHCI version 5.10
[ 7.364897] tegra194-vi5 15c10000.vi: initialized
[ 7.367601] driver not enabled, cannot register any devices
[ 7.374369] lm75: probe of 1-0048 failed with error -121
Is there a standard way to specify in the device-tree that the fixed-regulators should initialize earlier? Alternatively is there a way to cause the I2C device to delay initializing until after the regulator is available?