FAN: coudln't get the regulator

I am getting this error in kernel log:

kernel: [ 6.918097] FAN: coudln’t get the regulator

As a result pwm_fan is not probing and /sys/kernel/debug/tegra_fan/target_pwm is missing.

What could make “vdd-fan” regulator to disappear?

L4T 24.1, kernel cmdline:

panic=10 fbcon=map:0 console=tty0 console=ttyS0,115200n8 tegraid=21.1.2.0.0 ddr_die=2048M@2048M ddr_die=2048M@4096M section=256M memtype=0 vpr_resize usb_port_owner_info=0 lane_owner_info=0 emc_max_dvfs=0 video=tegrafb no_console_suspend=1 debug_uartport=lsport,0 earlyprintk=uart8250-32bit,0x70006000 maxcpus=4 usbcore.old_scheme_first=1 lp0_vec=0x1000@0xff2bf000 nvdumper_reserved=0xff23f000 core_edp_mv=1125 core_edp_ma=4000 gpt root=/dev/mmcblk1p1 rw rootwait noplymouth text

Hi DmitriK,

let us check fan regulator issue step by step.
The error message “FAN: coudln’t get the regulator” should come from
drivers/thermal/pwm_fan.c:842 like the lines below and because something wrong at line 840,
you just return from line 844 and does not run the remaining lines of pwm_fan_probe to cause /sys/kernel/debug/tegra_fan/target_pwm is missing.

840 fan_data->fan_reg = regulator_get(fan_data->dev, “vdd-fan”);
841 if (IS_ERR_OR_NULL(fan_data->fan_reg)) {
842 pr_err(“FAN: coudln’t get the regulator\n”);
843 devm_kfree(&pdev->dev, (void *)fan_data);
844 return -ENODEV;
845 }

So can you please check your device tree. The following is mine and can be an example.

pwm-fan {
    status = "okay";
    compatible = "pwm-fan";
    shared_data = <0x000000d1>;
    active_pwm = <0x00000000 0x000000ff 0x000000ff 0x00002a9a 0x74666573 0x000029f5 0x00002aa9 0x00002ab1 0x00002ac0 0x00002ac6>;
    [b]vdd-fan-supply[/b] = <0x000000d2>;
};
  1. check if your device tree has a node whose name is pwm-fan.
  2. check the node if status is okay and compatible is pwm-fan.
  3. check the node if the property vdd-fan-supply is correct.

dts looks ok and identical to official dts in this regard. pwm-fan probe function cannot find “vdd_fan” regulator. I am using own custom carrier board that provides 5V to fan.
Could it be that power tree initialization went bad because module is used in non-devkit carrier?
Does devkit really use this regulator to power the fan?

vdd_fan: regulator@13 {
compatible = “regulator-fixed-sync”;
reg = <13>;
regulator-name = “vdd-fan”;
regulator-min-microvolt = <5000000>;
regulator-max-microvolt = <5000000>;
gpio = <&gpio ((4 * 8) + 4) 0>;
regulator-enable-ramp-delay = <284>;
regulator-disable-ramp-delay = <6200>;
};

vdd_fan: regulator@13 {
gpio = <&tca9539_74 4 0>;
};

regulators I have:

cat /sys/class/regulator/regulator.*/name

regulator-dummy
vdd-cam-hv
vdd-rtc
avdd-ts-hv
vdd-ts
vdd-gen-pll-edp
vdd-hdmi-dp
vdd-3v3
max77620-gpio7
lcd-bl-en
en-vdd-sd
vdd-ac-bat
vdd-sys-boost
aux-3v3
snsr_pm
vdd-disp-3v0
usb-vbus1
usb-vbus3
rtl-5v0
en-usb-vbus2
en-vdd-vcm-2v8
vdd_gpu
vdd-cpu-fixed
vdd_cpu
vdd_core
vddio-ddr
vdd-pre-reg
vdd-1v8
avdd-sys
vdd-pex
vddio-sdmmc1

Could it be that power tree initialization went bad because module is used in non-devkit carrier?
Does your design use tca9539 to control the fan?

Does devkit really use this regulator to power the fan?
Yes, device driver pwm-fan use vdd-fan to power the fan via calling regulater_xxx() and like your check,
I don’t see vdd-fan in cat /sys/class/regulator/regulator.*/name. This is weird.

So could you help to

  1. check if the values of vdd-fan-supply are same as expected by sudo hexdump /proc/device-tree/pwm-fan/vdd-fan-supply
  2. check what is the error return value of regulator_get(fan_data->dev, “vdd-fan”) by printk …

Hi Ted,

I’ve been helping Dmitri with the tegra hardware. I’ve been looking at your schematics for this circuit.

I’ll go ahead an attach a screen shot of your schematics for reference.

As far as I can tell, the fan is powered of of 5V0_IO_SYS. This is powered on and off via carrier_power_on which is asserted at boot. I don’t see any other IO controlling this rail from the X1 SOM itself. Am I missing something?

Otherwise, you do have 3 other fan related signals:

FAN_PWM - 1.8 VDC PWM signal coming off the tegra itself.

PS_VDD_FAN_DISABLE- This is coming off the tca9539 on your carrier board. Asserting this high is effectively voiding the PWM signal coming out of the X1 SOM. This isn’t a power supply per se, but it might be what your VDD-FAN device driver is trying to assert?

FAN_TACH - This is the one output from the Fan itself. I believe its the feedback your SOM is likely using to do speed control on the fan itself.

Can you clarify what the call to regulator_xxx() is actually doing? What, if anything is it controlling?

Thanks for your help Ted!

~
Doug

Ted,

Answering your questions:

  1. check if the values of vdd-fan-supply are same as expected by sudo hexdump /proc/device-tree/pwm-fan/vdd-fan-supply

root@jane:/var/log# hexdump /proc/device-tree/pwm-fan/vdd-fan-supply
0000000 0000 bc00
0000004

  1. check what is the error return value of regulator_get(fan_data->dev, “vdd-fan”) by printk …

[ 7.647183] FAN: coudln’t get the regulator vdd-fan ERR: -517

from:

fan_data->fan_reg = regulator_get(fan_data->dev, “vdd-fan”);
if (IS_ERR_OR_NULL(fan_data->fan_reg)) {
pr_err(“FAN: coudln’t get the regulator %s ERR: %d\n”, “vdd-fan”, (int)PTR_ERR(fan_data->fan_reg));
devm_kfree(&pdev->dev, (void *)fan_data);
return -ENODEV;
}

PS_VDD_FAN_DISABLE- This is coming off the tca9539 on your carrier board.
Asserting this high is effectively voiding the PWM signal coming out of the X1 SOM.
This isn’t a power supply per se, but it might be what your VDD-FAN device driver is trying to assert?

Yes, vdd-fan is binding to the pin PS_VDD_FAN_DISABLE as a regulator via device tree like in #4.
and the device tree looks okay to me. But according to the error return value -517, it’s more like
something wrong on tca9539.

#define EPROBE_DEFER 517 /* Driver requests probe retry */

and I re-checked the list in #5. does not see those regulators which are binding to tca9539 like en_vdd_ts_1v8 or en_vdd_ts_hv_3v3.
so maybe all the regulators related to tca9539 also do not work properly.

Could you help to check tca9539 as following.

ubuntu@tegra-ubuntu:/sys/devices/platform/7000c400.i2c/i2c-1/1-0074$ ls
driver gpio modalias name power subsystem uevent
ubuntu@tegra-ubuntu:/sys/devices/platform/7000c400.i2c/i2c-1/1-0074$ cat name
tca9539
ubuntu@tegra-ubuntu:/sys/devices/platform/7000c400.i2c/i2c-1/1-0074$ cd gpio/gpiochip1008/
ubuntu@tegra-ubuntu:/sys/devices/platform/7000c400.i2c/i2c-1/1-0074/gpio/gpiochip1008$ ls
base device label ngpio power subsystem uevent
ubuntu@tegra-ubuntu:/sys/devices/platform/7000c400.i2c/i2c-1/1-0074/gpio/gpiochip1008$ cat label
tca9539
ubuntu@tegra-ubuntu:/sys/devices/platform/7000c400.i2c/i2c-1/1-0074/gpio/gpiochip1008$ cat ngpio
16

Yes, vdd-fan is binding to the pin PS_VDD_FAN_DISABLE as a regulator via device tree like in #4.

tca9539 & PS_VDD_FAN_DISABLE were removed from our HW design. I am going to replace vdd_fan by dummy regulator.

Yes, vdd-fan is binding to the pin PS_VDD_FAN_DISABLE as a regulator via device tree like in #4.
tca9539 & PS_VDD_FAN_DISABLE were removed from our HW design. Need to replace vdd_fan by dummy regulator.

OK. You can just remove the following code snippet from your device tree

210 vdd_fan: regulator@13 {
211 gpio = <&tca9539_74 4 0>;
212 };

to binding vdd-fan with PS_VDD_FAN_DISABLE as a tegra’s gpio not tca9539’s gpio.
then you should be able to see vdd-fan from the list in #5. and don’t forget to modify
the property gpio accroding to your HW design.

166 vdd_fan: regulator@13 {
167 compatible = “regulator-fixed-sync”;
168 reg = <13>;
169 regulator-name = “vdd-fan”;
170 regulator-min-microvolt = <5000000>;
171 regulator-max-microvolt = <5000000>;
172 gpio = <&gpio TEGRA_GPIO(E, 4) 0>;
173 regulator-enable-ramp-delay = <284>;
174 regulator-disable-ramp-delay = <6200>;
175 };

Our HW folks just dropped FAN_DISABLE feature completely from design - there is no gpio to bind for this.

I added dummy regulator to resolve this issue:

— a/arch/arm64/boot/dts/tegra210-jetson-tx1-p2597-2180-a01-devkit.dts
+++ b/arch/arm64/boot/dts/tegra210-jetson-tx1-p2597-2180-a01-devkit.dts
@@ -129,4 +129,20 @@
};
};

  •   pwm-fan {
    
  •           vdd-fan-supply = <&vdd_fan_dummy>;
    
  •   };
    
  •   regulators {
    
  •           compatible = "simple-bus";
    
  •           vdd_fan_dummy: regulator-dummy {
    
  •                   compatible = "regulator-fixed";
    
  •                   regulator-min-microvolt = <5000000>;
    
  •                   regulator-max-microvolt = <5000000>;
    
  •                   regulator-name = "vdd-fan";
    
  •                   regulator-enable-ramp-delay = <284>;
    
  •                   regulator-disable-ramp-delay = <6200>;
    
  •           };
    
  •   };
    

};