Device Tree Created Regulator Enable - Write Error

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Device Tree Created Regulator Enable - Write Error

3,634 Views
PaulDeMetrotion
Senior Contributor I

I have the following regulator provided in the device tree:

reg_v5_sw: regulator@4 {

            compatible = "regulator-fixed";

            reg = <4>;

            regulator-name = "reg_v5_sw";

            regulator-min-microvolt = <5000000>;

            regulator-max-microvolt = <5000000>;

            gpio = <&gpio4 31 GPIO_ACTIVE_HIGH>;

            enable-active-high;

        };

When I boot I have the following available in /sys/class/regulator/regulator.11:

drwxr-xr-x 3 root root    0 Jan 26 23:17 .

drwxr-xr-x 3 root root    0 Jan 26 23:17 ..

lrwxrwxrwx 1 root root    0 Jan 26 23:57 device -> ../../../4.regulator

-rw-rw-rw- 1 root root 4096 Jan 26 23:57 microvolts

-rw-rw-rw- 1 root root 4096 Jan 26 23:57 name

-rw-rw-rw- 1 root root 4096 Jan 26 23:57 num_users

drwxr-xr-x 2 root root    0 Jan 26 23:38 power

-rwxrwxrwx 1 root root 4096 Jan 27 01:05 state

lrwxrwxrwx 1 root root    0 Jan 26 23:17 subsystem -> ../../../../../../class/regulator

-rw-rw-rw- 1 root root 4096 Jan 26 23:57 suspend_disk_state

-rw-rw-rw- 1 root root 4096 Jan 26 23:57 suspend_mem_state

-rw-rw-rw- 1 root root 4096 Jan 26 23:57 suspend_standby_state

-rw-rw-rw- 1 root root 4096 Jan 26 23:57 type

-rw-rw-rw- 1 root root 4096 Jan 26 23:57 uevent

The name file sows the proper regulator:

cat name

reg_v5_sw

I am attempting to enable the regulator through the following command but get the error shown.

echo "enabled" > state

-sh: echo: write error: Input/output error

Any idea why I cannot enable the regulator? Is there another driver grabbing the resource?

4 Replies

1,698 Views
alejandrolozan1
NXP Employee
NXP Employee

Hi,

I can you try to enable the below in the menuconfig?

Device Drivers --->

[*] Voltage and Current Regulator Support --->

  <*> Fixed voltage regulator support

  <*> Userspace regulator consumer support

After that

echo enabled > sys/devices/platform/reg-userspace-consumer.X/state

Please let us know how it goes.

Best Regards,

Alejandro

0 Kudos

1,697 Views
PaulDeMetrotion
Senior Contributor I

Thanks for the suggestion but still have the same error. Here are my configuration settings for the regulator device driver:

CONFIG_REGULATOR=y

CONFIG_REGULATOR_DEBUG=y

CONFIG_REGULATOR_FIXED_VOLTAGE=y

CONFIG_REGULATOR_VIRTUAL_CONSUMER=y

CONFIG_REGULATOR_USERSPACE_CONSUMER=y

# CONFIG_REGULATOR_ACT8865 is not set

# CONFIG_REGULATOR_AD5398 is not set

CONFIG_REGULATOR_ANATOP=y

# CONFIG_REGULATOR_DA9210 is not set

# CONFIG_REGULATOR_FAN53555 is not set

CONFIG_REGULATOR_GPIO=y

# CONFIG_REGULATOR_ISL6271A is not set

# CONFIG_REGULATOR_LP3971 is not set

# CONFIG_REGULATOR_LP3972 is not set

# CONFIG_REGULATOR_LP872X is not set

# CONFIG_REGULATOR_LP8755 is not set

# CONFIG_REGULATOR_MAX1586 is not set

# CONFIG_REGULATOR_MAX17135 is not set

# CONFIG_REGULATOR_MAX8649 is not set

# CONFIG_REGULATOR_MAX8660 is not set

# CONFIG_REGULATOR_MAX8952 is not set

# CONFIG_REGULATOR_MAX8973 is not set

# CONFIG_REGULATOR_MC13783 is not set

# CONFIG_REGULATOR_MC13892 is not set

CONFIG_REGULATOR_PFUZE100=y

# CONFIG_REGULATOR_TPS51632 is not set

# CONFIG_REGULATOR_TPS62360 is not set

# CONFIG_REGULATOR_TPS65023 is not set

# CONFIG_REGULATOR_TPS6507X is not set

# CONFIG_REGULATOR_TPS6524X is not set

0 Kudos

1,697 Views
alejandrolozan1
NXP Employee
NXP Employee

Hi,

After skimming through the documentation it seems that the sysfs framework for the regulator is read only.

This is something I have never tried and I have no experience with it, but after digging into it, it might be possible if you create a consumer that uses the regulator consumer driver interface to enable or disable the regulator output.

Best Regards,

Alejandro

1,697 Views
alejandrolozan1
NXP Employee
NXP Employee

Hi,

I am not sure yet, but it seems that this feature( user space access) needs to be added in the regulator driver, and it seems that it is not included. Let me keep delving into this.

Regards,

Alejandro

0 Kudos