Skip to contentSkip to conversation

ARM: shmobile: kzm9g: add REGULATOR settings to kzm9g_defconfig

PATCH In review Tetsuyuki Kobayashi 6 participants 29 messages Jul 3, 2012 – Jul 4, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: shmobile: kzm9g: add REGULATOR settings to kzm9g_defconfig

Add REGULATOR settings to kernel config file of kzm9g.

---
Hello,

I found Guennadi's
"ARM: mach-shmobile: add fixed voltage regulators to kzm9g" requires REGULATOR setting in kernel config. Without this, it causes these errors at boot time.

smsc911x: Driver version 2008-10-21
smsc911x smsc911x.0: Failed to get supply 'vdd33a': -517 smsc911x smsc911x.0: (unregistered net_device): couldn't get regulators -517 platform smsc911x.0: Driver smsc911x requests probe deferral

After applying this patch,
make kzm9g_defconfig
make menuconfig (as you like)
make uImage

smsc911x ethernet device works well as before.

 arch/arm/configs/kzm9g_defconfig |    3 +++
 1 file changed, 3 insertions(+)
arch/arm/configs/kzm9g_defconfig +3 -0
index 7b2eecd..d2df401 100644
@@ -82,6 +82,9 @@ CONFIG_I2C_CHARDEV=y
 CONFIG_I2C_SH_MOBILE=y
 CONFIG_GPIO_PCF857X=y
 # CONFIG_HWMON is not set
+CONFIG_REGULATOR=y
+CONFIG_REGULATOR_DUMMY=y
+CONFIG_REGULATOR_FIXED_VOLTAGE=y
 CONFIG_FB=y
 CONFIG_FB_SH_MOBILE_LCDC=y
 CONFIG_FRAMEBUFFER_CONSOLE=y

-- 1.7.9.5

#1 lore raw
Quoted 1 line · Tetsuyuki Kobayashi

+CONFIG_REGULATOR_DUMMY=y

No, this should only ever be enabled as a crutch to get things working. It should not be enabled by default.

#2 lore raw
In reply to Tetsuyuki Kobayashi

Hello

Quoted 10 lines · Tetsuyuki Kobayashi

Add REGULATOR settings to kernel config file of kzm9g.

---
Hello,

I found Guennadi's
"ARM: mach-shmobile: add fixed voltage regulators to kzm9g" requires REGULATOR setting in kernel config. Without this, it causes these errors at boot time.

Thanks for the patch. However, I think, this error will only appear if you enable REGULATOR in the kernel, but both REGULATOR_FIXED_VOLTAGE and REGULATOR_DUMMY are disabled. To fix this fixing the defconfig is good, but not sufficient, I think. How about adding something like

select REGULATOR_FIXED_VOLTAGE if REGULATOR

to either the CPU or the arch section in respective Kconfig? I would actually propose to add these to both arm/mach-shmobile and sh. Any objections?

Thanks
Guennadi

Quoted 23 lines

smsc911x: Driver version 2008-10-21
smsc911x smsc911x.0: Failed to get supply 'vdd33a': -517 smsc911x smsc911x.0: (unregistered net_device): couldn't get regulators -517 platform smsc911x.0: Driver smsc911x requests probe deferral

After applying this patch,
make kzm9g_defconfig
make menuconfig (as you like)
make uImage

smsc911x ethernet device works well as before.

 arch/arm/configs/kzm9g_defconfig |    3 +++
 1 file changed, 3 insertions(+)
arch/arm/configs/kzm9g_defconfig +0 -0
index 7b2eecd..d2df401 100644

arch/arm/configs/kzm9g_defconfig CONFIG_I2C_CHARDEV=y

Quoted 10 lines
arch/arm/configs/kzm9g_defconfig +3 -1
@@ -82,6 +82,9 @@ CONFIG_I2C_CHARDEV=y
 CONFIG_I2C_SH_MOBILE=y
 CONFIG_GPIO_PCF857X=y
 # CONFIG_HWMON is not set
+CONFIG_REGULATOR=y
+CONFIG_REGULATOR_DUMMY=y
+CONFIG_REGULATOR_FIXED_VOLTAGE=y
 CONFIG_FB=y
 CONFIG_FB_SH_MOBILE_LCDC=y
 CONFIG_FRAMEBUFFER_CONSOLE=y
-- 1.7.9.5 

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

#3 lore raw
In reply to Tetsuyuki Kobayashi

Hello, Guennadi

Quoted 10 lines · Guennadi Liakhovetski

Hello

Quoted 6 lines · Tetsuyuki Kobayashi

Add REGULATOR settings to kernel config file of kzm9g.

---
Hello,

Quoted 8 lines
Quoted 4 lines

I found Guennadi's
"ARM: mach-shmobile: add fixed voltage regulators to kzm9g" requires REGULATOR setting in kernel config. Without this, it causes these errors at boot time.

Thanks for the patch. However, I think, this error will only appear if you enable REGULATOR in the kernel, but both REGULATOR_FIXED_VOLTAGE and REGULATOR_DUMMY are disabled. To fix this fixing the defconfig is good,

Oh yes, you are right. I made bad combination as you said. if CONFIG_REGULATOR is not set, it goes well as before.

Quoted 8 lines

but not sufficient, I think. How about adding something like

select REGULATOR_FIXED_VOLTAGE if REGULATOR

to either the CPU or the arch section in respective Kconfig? I would actually propose to add these to both arm/mach-shmobile and sh. Any objections?

Thank you.
I withdraw my config patch and wait for your proposal to Kconfig.

#4 lore raw
In reply to Tetsuyuki Kobayashi

Hello Mark, Thanks for responding.

Quoted 7 lines · Mark Brown
Quoted 1 line · Tetsuyuki Kobayashi

+CONFIG_REGULATOR_DUMMY=y

No, this should only ever be enabled as a crutch to get things working. It should not be enabled by default.

Thank you.
As Guennadi's follow-up, I found this patch is mistake.

#5 lore raw
In reply to Tetsuyuki Kobayashi
Quoted 29 lines · Tetsuyuki Kobayashi

Hello, Guennadi

Quoted 10 lines · Guennadi Liakhovetski

Hello

Quoted 6 lines · Tetsuyuki Kobayashi

Add REGULATOR settings to kernel config file of kzm9g.

---
Hello,

Quoted 8 lines
Quoted 4 lines

I found Guennadi's
"ARM: mach-shmobile: add fixed voltage regulators to kzm9g" requires REGULATOR setting in kernel config. Without this, it causes these errors at boot time.

Thanks for the patch. However, I think, this error will only appear if you enable REGULATOR in the kernel, but both REGULATOR_FIXED_VOLTAGE and REGULATOR_DUMMY are disabled. To fix this fixing the defconfig is good,

Oh yes, you are right. I made bad combination as you said. if CONFIG_REGULATOR is not set, it goes well as before.

Quoted 4 lines

but not sufficient, I think. How about adding something like

select REGULATOR_FIXED_VOLTAGE if REGULATOR

Quoted 7 lines
Quoted 4 lines

to either the CPU or the arch section in respective Kconfig? I would actually propose to add these to both arm/mach-shmobile and sh. Any objections?

Thank you.
I withdraw my config patch and wait for your proposal to Kconfig.

Well, I'm not sure what approach would be the preferred by the maintainers, how about the diff below. If it is acceptable, I'll split it into 2 patches and submit properly.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

arch/arm/Kconfig +1 -0
index 84449dd..295ce8e 100644
@@ -720,6 +720,7 @@ config ARCH_SHMOBILE
 	select MULTI_IRQ_HANDLER
 	select PM_GENERIC_DOMAINS if PM
 	select NEED_MACH_MEMORY_H
+	select REGULATOR_FIXED_VOLTAGE if REGULATOR
 	help
 	  Support for Renesas's SH-Mobile and R-Mobile ARM platforms.
 
arch/sh/Kconfig +1 -0
index 31d9db7..dd8f7a7 100644
@@ -34,6 +34,7 @@ config SUPERH
 	select GENERIC_CMOS_UPDATE if SH_SH03 || SH_DREAMCAST
 	select GENERIC_STRNCPY_FROM_USER
 	select GENERIC_STRNLEN_USER
+	select REGULATOR_FIXED_VOLTAGE if REGULATOR
 	help
 	  The SuperH is a RISC processor targeted for use in embedded systems
 	  and consumer electronics; it was also used in the Sega Dreamcast
#6 lore raw
In reply to Tetsuyuki Kobayashi
Quoted 3 lines · Guennadi Liakhovetski

Well, I'm not sure what approach would be the preferred by the maintainers, how about the diff below. If it is acceptable, I'll split it into 2 patches and submit properly.

This doesn't seem right. If this is useful we should just remove the configuration for the fixed voltage regulator entirely as there's nothing platform specific about this, and we probably ought to be going through all the boards using "real" regulators adding selects for their drivers too.

#7 lore raw
In reply to Tetsuyuki Kobayashi
Quoted 11 lines · Mark Brown
Quoted 3 lines · Guennadi Liakhovetski

Well, I'm not sure what approach would be the preferred by the maintainers, how about the diff below. If it is acceptable, I'll split it into 2 patches and submit properly.

This doesn't seem right. If this is useful we should just remove the configuration for the fixed voltage regulator entirely as there's nothing platform specific about this, and we probably ought to be going through all the boards using "real" regulators adding selects for their drivers too.

Hm, why? Let's take smsc911x. The driver needs "some" regulators for its two power pins. On different systems different regulators are used for those supplies. It just happens to be the case, that many sh and arm/mach-shmobile platform use the fixed voltage regulator for smsc911x (and other devices). In principle every such board should enable the fixed regulator individually. But, since there are several of them, I just proposed a shortcut. Otherwise, if on some other board a different regulator is used to supply power to devices, enabling the fixed voltage regulator will not help in any way. To actually make that system work it'll need to enable the respective regulator.

So, I think, the absolutely correct fix would be to add that "select" statement to each affected board individually. But maybe enabling it for sh and shmobile in general will be accepted as a reasonable alternative.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

#8 lore raw
In reply to Tetsuyuki Kobayashi
Quoted 8 lines · Guennadi Liakhovetski
Quoted 5 lines · Mark Brown

This doesn't seem right. If this is useful we should just remove the configuration for the fixed voltage regulator entirely as there's nothing platform specific about this, and we probably ought to be going through all the boards using "real" regulators adding selects for their drivers too.

Quoted 4 lines

Hm, why? Let's take smsc911x. The driver needs "some" regulators for its two power pins. On different systems different regulators are used for those supplies. It just happens to be the case, that many sh and arm/mach-shmobile platform use the fixed voltage regulator for smsc911x

What I'm saying is that that statement is equally true if you replace "sh and arm/mach-shmobile platform" with "systems".

#9 lore raw
In reply to Tetsuyuki Kobayashi
Quoted 9 lines · Mark Brown
Quoted 7 lines · Guennadi Liakhovetski
Quoted 5 lines · Mark Brown

This doesn't seem right. If this is useful we should just remove the configuration for the fixed voltage regulator entirely as there's nothing platform specific about this, and we probably ought to be going through all the boards using "real" regulators adding selects for their drivers too.

Quoted 7 lines
Quoted 4 lines

Hm, why? Let's take smsc911x. The driver needs "some" regulators for its two power pins. On different systems different regulators are used for those supplies. It just happens to be the case, that many sh and arm/mach-shmobile platform use the fixed voltage regulator for smsc911x

What I'm saying is that that statement is equally true if you replace "sh and arm/mach-shmobile platform" with "systems".

So, you think, each board should select all required regulators individually?

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

#10 lore raw
In reply to Tetsuyuki Kobayashi
Quoted 15 lines · Guennadi Liakhovetski
Quoted 13 lines · Mark Brown
Quoted 12 lines · Guennadi Liakhovetski
Quoted 5 lines · Mark Brown

This doesn't seem right. If this is useful we should just remove the configuration for the fixed voltage regulator entirely as there's nothing platform specific about this, and we probably ought to be going through all the boards using "real" regulators adding selects for their drivers too.

Hm, why? Let's take smsc911x. The driver needs "some" regulators for its two power pins. On different systems different regulators are used for those supplies. It just happens to be the case, that many sh and arm/mach-shmobile platform use the fixed voltage regulator for smsc911x

Quoted 5 lines
Quoted 2 lines

What I'm saying is that that statement is equally true if you replace "sh and arm/mach-shmobile platform" with "systems".

So, you think, each board should select all required regulators individually?

That's not what I wrote above (at least not for the fixed voltage regulator). But in general I'm not sure we're requiring that .configs that people can generate do more than build.

#11 lore raw
In reply to Tetsuyuki Kobayashi
Quoted 16 lines · Mark Brown
Quoted 14 lines · Guennadi Liakhovetski
Quoted 13 lines · Mark Brown
Quoted 12 lines · Guennadi Liakhovetski
Quoted 5 lines · Mark Brown

This doesn't seem right. If this is useful we should just remove the configuration for the fixed voltage regulator entirely as there's nothing platform specific about this, and we probably ought to be going through all the boards using "real" regulators adding selects for their drivers too.

Hm, why? Let's take smsc911x. The driver needs "some" regulators for its two power pins. On different systems different regulators are used for those supplies. It just happens to be the case, that many sh and arm/mach-shmobile platform use the fixed voltage regulator for smsc911x

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

What I'm saying is that that statement is equally true if you replace "sh and arm/mach-shmobile platform" with "systems".

So, you think, each board should select all required regulators individually?

That's not what I wrote above (at least not for the fixed voltage regulator).

No, sorry, that was my interpretation, because I didn't think that we wanted to treat the fixed regulator any differently than others.

Quoted 2 lines

But in general I'm not sure we're requiring that .configs that people can generate do more than build.

Well, you could have a kernel configuration with REGULATOR=y for some reason with fixed regulator disabled. It would work with earlier kernels. Now it would begin to fail... Do we want to allow that?

Well, I suspect, other boards must have had the same exact problem, as they added regulator support. It seems some boards to that, but not all...

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

#12 lore raw
In reply to Tetsuyuki Kobayashi
Quoted 8 lines · Guennadi Liakhovetski
Quoted 2 lines · Mark Brown

But in general I'm not sure we're requiring that .configs that people can generate do more than build.

Well, you could have a kernel configuration with REGULATOR=y for some reason with fixed regulator disabled. It would work with earlier kernels. Now it would begin to fail... Do we want to allow that?

Well, it does happen from time to time; for example when moving from forcing some GPIOs on to making them software managed. It's only going to affect boards which were previously using regulators but not the fixed one, I'm not sure if that is common for these systems...

Quoted 2 lines

Well, I suspect, other boards must have had the same exact problem, as they added regulator support. It seems some boards to that, but not all...

Handling this really needs some kind of "set on upgrade" thing but I'm not sure that's worth the trouble, especially since it's not that common.

#13 lore raw
In reply to Tetsuyuki Kobayashi

Paul, Magnus, Rafael

What do you think about this? Shall we force the fixed regulator globally on for sh and sh-mobile, shall we only force it on for affected boards, or shall we leave it to the user to shoot themselves in the foot? In general we're not trying to force all Kconfig options on, that a board needs. There are enough ways to have a non-working configuration. E.g., you can leave off the sh I2C driver. Arguably, having to enable the fixed voltage regulator is less obvious, than needing a correct I2C bus driver.

I think I would go with

select REGULATOR_FIXED_VOLTAGE if REGULATOR

- ideally on a per-board basis, or arch-wide. Mark doesn't favour at least the latter of these options, IIUC. So, maybe adding entries to defconfigs would indeed sufice for now (but no dummy regulator!)

Thanks
Guennadi

Quoted 15 lines · Mark Brown
Quoted 8 lines · Guennadi Liakhovetski
Quoted 2 lines · Mark Brown

But in general I'm not sure we're requiring that .configs that people can generate do more than build.

Well, you could have a kernel configuration with REGULATOR=y for some reason with fixed regulator disabled. It would work with earlier kernels. Now it would begin to fail... Do we want to allow that?

Well, it does happen from time to time; for example when moving from forcing some GPIOs on to making them software managed. It's only going to affect boards which were previously using regulators but not the fixed one, I'm not sure if that is common for these systems...

Quoted 6 lines
Quoted 2 lines

Well, I suspect, other boards must have had the same exact problem, as they added regulator support. It seems some boards to that, but not all...

Handling this really needs some kind of "set on upgrade" thing but I'm not sure that's worth the trouble, especially since it's not that common.

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

#14 lore raw
In reply to Tetsuyuki Kobayashi
Quoted 9 lines · Rafael J. Wysocki

Well, if arch-wide, then perhaps we don't need REGULATOR_FIXED_VOLTAGE at all and we can just make things depending on it depend on REGULATOR directly?

The meaning of what you're proposing above is pretty much "REGULATOR_FIXED_VOLTAGE should be set whenever REGULATOR is" and I guess REGULATOR_FIXED_VOLTAGE depends on REGULATOR, so they appear to be equivalent.

How much code does really depend on REGULATOR_FIXED_VOLTAGE which is not build when REGULATOR is set?

No, that won't help - the problem is that we want a specific regulator driver to be built in order to ensure that the services it provides are available.

#15 lore raw
In reply to Tetsuyuki Kobayashi
Quoted 10 lines · Guennadi Liakhovetski

Paul, Magnus, Rafael

What do you think about this? Shall we force the fixed regulator globally on for sh and sh-mobile, shall we only force it on for affected boards, or shall we leave it to the user to shoot themselves in the foot? In general we're not trying to force all Kconfig options on, that a board needs. There are enough ways to have a non-working configuration. E.g., you can leave off the sh I2C driver. Arguably, having to enable the fixed voltage regulator is less obvious, than needing a correct I2C bus driver.

Quoted 7 lines

I think I would go with

select REGULATOR_FIXED_VOLTAGE if REGULATOR

- ideally on a per-board basis, or arch-wide. Mark doesn't favour at least the latter of these options, IIUC. So, maybe adding entries to defconfigs would indeed sufice for now (but no dummy regulator!)

Well, if arch-wide, then perhaps we don't need REGULATOR_FIXED_VOLTAGE at all and we can just make things depending on it depend on REGULATOR directly?

The meaning of what you're proposing above is pretty much "REGULATOR_FIXED_VOLTAGE should be set whenever REGULATOR is" and I guess REGULATOR_FIXED_VOLTAGE depends on REGULATOR, so they appear to be equivalent.

How much code does really depend on REGULATOR_FIXED_VOLTAGE which is not build when REGULATOR is set?

Thanks,
Rafael

#16 lore raw
In reply to Tetsuyuki Kobayashi
Quoted 9 lines · Mark Brown
Quoted 6 lines · Rafael J. Wysocki

Well, if arch-wide, then perhaps we don't need REGULATOR_FIXED_VOLTAGE at all and we can just make things depending on it depend on REGULATOR directly?

The meaning of what you're proposing above is pretty much "REGULATOR_FIXED_VOLTAGE should be set whenever REGULATOR is" and I guess REGULATOR_FIXED_VOLTAGE depends on REGULATOR, so they appear to be equivalent.

Quoted 6 lines
Quoted 2 lines

How much code does really depend on REGULATOR_FIXED_VOLTAGE which is not build when REGULATOR is set?

No, that won't help - the problem is that we want a specific regulator driver to be built in order to ensure that the services it provides are available.

Right, so what's wrong with having a "select REGULATOR_FIXED_VOLTAGE" on boards that make use of them? That seems to be the most straightforward way to me.

Also, I know too little about the regulator subsystem, but to me it is somewhat special that REGULATOR=n behaves differently than REGULATOR=y and REGULATOR_DRIVER=n.

Thanks,

/ magnus

#17 lore raw
In reply to Tetsuyuki Kobayashi
Quoted 14 lines · Magnus Damm
Quoted 12 lines · Mark Brown
Quoted 9 lines · Rafael J. Wysocki

Well, if arch-wide, then perhaps we don't need REGULATOR_FIXED_VOLTAGE at all and we can just make things depending on it depend on REGULATOR directly?

The meaning of what you're proposing above is pretty much "REGULATOR_FIXED_VOLTAGE should be set whenever REGULATOR is" and I guess REGULATOR_FIXED_VOLTAGE depends on REGULATOR, so they appear to be equivalent.

How much code does really depend on REGULATOR_FIXED_VOLTAGE which is not build when REGULATOR is set?

Quoted 8 lines
Quoted 3 lines

No, that won't help - the problem is that we want a specific regulator driver to be built in order to ensure that the services it provides are available.

Right, so what's wrong with having a "select REGULATOR_FIXED_VOLTAGE" on boards that make use of them? That seems to be the most straightforward way to me.

Yes, agreed. This is not very different from the gpiolib have/want case, either, and going that on a board-specific level worked out fine.

#18 lore raw
In reply to Tetsuyuki Kobayashi
Quoted 3 lines · Magnus Damm

Right, so what's wrong with having a "select REGULATOR_FIXED_VOLTAGE" on boards that make use of them? That seems to be the most straightforward way to me.

I tend to agree; as I've said several times now the only sensible options I see are:

- Add the selects per board.
- Just enable the fixed voltage driver whenever the regulator core is enabled.

Anything else seems silly.

Quoted 3 lines

Also, I know too little about the regulator subsystem, but to me it is somewhat special that REGULATOR=n behaves differently than REGULATOR=y and REGULATOR_DRIVER=n.

What's happening is that the regulator API stubs itself out when it's not in use in order to avoid having lots of ifdefs every time anyone tries to use the API in generic code or drivers that get used on multiple platforms. This is the same behaviour as gpiolib, it's a similar sort of utility API.

If the power on defaults for the system weren't suitable for whatever is being done you'd still have an issue even with the stubs but a lot of the time the main effect of the API is to allow drivers to do additional power optimisations.

#19 lore raw
In reply to Tetsuyuki Kobayashi
Quoted 13 lines · Rafael J. Wysocki
Quoted 12 lines · Guennadi Liakhovetski

Paul, Magnus, Rafael

What do you think about this? Shall we force the fixed regulator globally on for sh and sh-mobile, shall we only force it on for affected boards, or shall we leave it to the user to shoot themselves in the foot? In general we're not trying to force all Kconfig options on, that a board needs. There are enough ways to have a non-working configuration. E.g., you can leave off the sh I2C driver. Arguably, having to enable the fixed voltage regulator is less obvious, than needing a correct I2C bus driver.

I think I would go with

Quoted 8 lines
Quoted 5 lines

select REGULATOR_FIXED_VOLTAGE if REGULATOR

- ideally on a per-board basis, or arch-wide. Mark doesn't favour at least the latter of these options, IIUC. So, maybe adding entries to defconfigs would indeed sufice for now (but no dummy regulator!)

Well, if arch-wide, then perhaps we don't need REGULATOR_FIXED_VOLTAGE at all and we can just make things depending on it depend on REGULATOR directly?

No, we cannot. That's exactly the problem: if REGULATOR is selected and REGULATOR_FIXED_VOLTAGE is not, then the regulator driver subsystem is enabled, instead of stubs real regulator functions will be used, and drivers, using regulators to control power supply to their devices, will fail obtaining such a regulator, if the respective driver (fixed in our cases) is not built or loaded. So, we need either - no regulator support in the kernel at all - then stubs are used and in case of our always-on fixed voltage power supplies everything just works, or the fixed regulator driver must be available to satisfy client drivers, e.g., smsc911x, sh_mmcif, sh_mobile_sdhi.

Quoted 2 lines

The meaning of what you're proposing above is pretty much "REGULATOR_FIXED_VOLTAGE should be set whenever REGULATOR is"

Exactly.

Quoted 2 lines

and I guess
REGULATOR_FIXED_VOLTAGE depends on REGULATOR, so they appear to be equivalent.

No, they are not.

Quoted 2 lines

How much code does really depend on REGULATOR_FIXED_VOLTAGE which is not build when REGULATOR is set?

Sorry, not sure what you mean "how much code." So far I've got 3 drivers on my radar - see above. As for platforms - about 10 platforms on each of sh and arm/mach-shmobile.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

#20 lore raw
In reply to Tetsuyuki Kobayashi
Quoted 19 lines · Paul Mundt
Quoted 18 lines · Magnus Damm
Quoted 15 lines · Mark Brown
Quoted 9 lines · Rafael J. Wysocki

Well, if arch-wide, then perhaps we don't need REGULATOR_FIXED_VOLTAGE at all and we can just make things depending on it depend on REGULATOR directly?

The meaning of what you're proposing above is pretty much "REGULATOR_FIXED_VOLTAGE should be set whenever REGULATOR is" and I guess REGULATOR_FIXED_VOLTAGE depends on REGULATOR, so they appear to be equivalent.

How much code does really depend on REGULATOR_FIXED_VOLTAGE which is not build when REGULATOR is set?

No, that won't help - the problem is that we want a specific regulator driver to be built in order to ensure that the services it provides are available.

Quoted 6 lines
Quoted 4 lines

Right, so what's wrong with having a "select REGULATOR_FIXED_VOLTAGE" on boards that make use of them? That seems to be the most straightforward way to me.

Yes, agreed. This is not very different from the gpiolib have/want case, either, and going that on a board-specific level worked out fine.

Ok, I'll make 2 patches then - for arch/sh/boards/Kconfig and arch/arm/mach-shmobile/Kconfig, adding the proposed "select ... if ..." line for each affected board.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

#21 lore raw
In reply to Tetsuyuki Kobayashi
Quoted 9 lines · Mark Brown
Quoted 6 lines · Rafael J. Wysocki

Well, if arch-wide, then perhaps we don't need REGULATOR_FIXED_VOLTAGE at all and we can just make things depending on it depend on REGULATOR directly?

The meaning of what you're proposing above is pretty much "REGULATOR_FIXED_VOLTAGE should be set whenever REGULATOR is" and I guess REGULATOR_FIXED_VOLTAGE depends on REGULATOR, so they appear to be equivalent.

Quoted 6 lines
Quoted 2 lines

How much code does really depend on REGULATOR_FIXED_VOLTAGE which is not build when REGULATOR is set?

No, that won't help - the problem is that we want a specific regulator driver to be built in order to ensure that the services it provides are available.

OK, so if each board requires a specific regulator driver to be used, then I think we should just select it from arch/arm/mach-shmobile/Kconfig for that particular board.

Thanks,
Rafael

#22 lore raw
In reply to Tetsuyuki Kobayashi
Quoted 6 lines · Mark Brown
Quoted 3 lines · Magnus Damm

Right, so what's wrong with having a "select REGULATOR_FIXED_VOLTAGE" on boards that make use of them? That seems to be the most straightforward way to me.

Quoted 8 lines

I tend to agree; as I've said several times now the only sensible options I see are:

- Add the selects per board.
- Just enable the fixed voltage driver whenever the regulator core is enabled.

Anything else seems silly.

Yeah.

Quoted 9 lines
Quoted 3 lines

Also, I know too little about the regulator subsystem, but to me it is somewhat special that REGULATOR=n behaves differently than REGULATOR=y and REGULATOR_DRIVER=n.

What's happening is that the regulator API stubs itself out when it's not in use in order to avoid having lots of ifdefs every time anyone tries to use the API in generic code or drivers that get used on multiple platforms. This is the same behaviour as gpiolib, it's a similar sort of utility API.

I very much prefer that way over the way I think I2C (at least used to) require #ifdef magic.

Quoted 4 lines

If the power on defaults for the system weren't suitable for whatever is being done you'd still have an issue even with the stubs but a lot of the time the main effect of the API is to allow drivers to do additional power optimisations.

I may misunderstand the situation, but I believe the issue here is that the REGULATOR=n case works fine on the boards with smsc911x, but it stops "working" whenever REGULATOR=y is turned on and REGULATOR_DRIVER_FOOBAR=n. People probably enable regulators because they want to use the PMIC (that most likely isn't hooked up to the SMSC chip), but they get surprised to see the following SMSC error message:

smsc911x: Driver version 2008-10-21
smsc911x smsc911x.0: Failed to get supply 'vdd33a': -517 smsc911x smsc911x.0: (unregistered net_device): couldn't get regulators -517 platform smsc911x.0: Driver smsc911x requests probe deferral

Cheers,

/ magnus

#23 lore raw
In reply to Tetsuyuki Kobayashi
Quoted 25 lines · Guennadi Liakhovetski
Quoted 23 lines · Paul Mundt
Quoted 22 lines · Magnus Damm
Quoted 9 lines · Mark Brown
Quoted 6 lines · Rafael J. Wysocki

Well, if arch-wide, then perhaps we don't need REGULATOR_FIXED_VOLTAGE at all and we can just make things depending on it depend on REGULATOR directly?

The meaning of what you're proposing above is pretty much "REGULATOR_FIXED_VOLTAGE should be set whenever REGULATOR is" and I guess REGULATOR_FIXED_VOLTAGE depends on REGULATOR, so they appear to be equivalent.

Quoted 6 lines
Quoted 2 lines

How much code does really depend on REGULATOR_FIXED_VOLTAGE which is not build when REGULATOR is set?

No, that won't help - the problem is that we want a specific regulator driver to be built in order to ensure that the services it provides are available.

Right, so what's wrong with having a "select REGULATOR_FIXED_VOLTAGE" on boards that make use of them? That seems to be the most straightforward way to me.

Quoted 6 lines
Quoted 2 lines

Yes, agreed. This is not very different from the gpiolib have/want case, either, and going that on a board-specific level worked out fine.

Ok, I'll make 2 patches then - for arch/sh/boards/Kconfig and arch/arm/mach-shmobile/Kconfig, adding the proposed "select ... if ..." line for each affected board.

Thanks. Is the "if ..." part the preferred way? It seems very verbose to me.

Cheers,

/ magnus

#24 lore raw
In reply to Tetsuyuki Kobayashi
Quoted 19 lines · Mark Brown
Quoted 3 lines · Magnus Damm

Right, so what's wrong with having a "select REGULATOR_FIXED_VOLTAGE" on boards that make use of them? That seems to be the most straightforward way to me.

I tend to agree; as I've said several times now the only sensible options I see are:

- Add the selects per board.
- Just enable the fixed voltage driver whenever the regulator core is enabled.

Anything else seems silly.

Quoted 3 lines

Also, I know too little about the regulator subsystem, but to me it is somewhat special that REGULATOR=n behaves differently than REGULATOR=y and REGULATOR_DRIVER=n.

Quoted 5 lines

What's happening is that the regulator API stubs itself out when it's not in use in order to avoid having lots of ifdefs every time anyone tries to use the API in generic code or drivers that get used on multiple platforms. This is the same behaviour as gpiolib, it's a similar sort of utility API.

Right, but there's a difference: the gpio_request() stub in include/linux/gpio.h returns -ENOSYS, gpio_is_valid() returns false, etc., whereas regulator_get() returns NULL (not an error code), regulator_enable() returns 0 (a success...) etc. Yes, I understand, it's a design decision and it has its own reasons, but I was a bit surprised when I first saw that :)

Quoted 4 lines

If the power on defaults for the system weren't suitable for whatever is being done you'd still have an issue even with the stubs but a lot of the time the main effect of the API is to allow drivers to do additional power optimisations.

Yeah... Which is exactly what produces the difference between REGULATOR=n and (REGULATOR=y && REGULATOR_DRIVER=n). But yes, it probably isn't worth changing any more, we just have to keep this in mind.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

#25 lore raw
In reply to Tetsuyuki Kobayashi
Quoted 27 lines · Magnus Damm
Quoted 25 lines · Guennadi Liakhovetski
Quoted 23 lines · Paul Mundt
Quoted 22 lines · Magnus Damm
Quoted 9 lines · Mark Brown
Quoted 6 lines · Rafael J. Wysocki

Well, if arch-wide, then perhaps we don't need REGULATOR_FIXED_VOLTAGE at all and we can just make things depending on it depend on REGULATOR directly?

The meaning of what you're proposing above is pretty much "REGULATOR_FIXED_VOLTAGE should be set whenever REGULATOR is" and I guess REGULATOR_FIXED_VOLTAGE depends on REGULATOR, so they appear to be equivalent.

Quoted 6 lines
Quoted 2 lines

How much code does really depend on REGULATOR_FIXED_VOLTAGE which is not build when REGULATOR is set?

No, that won't help - the problem is that we want a specific regulator driver to be built in order to ensure that the services it provides are available.

Right, so what's wrong with having a "select REGULATOR_FIXED_VOLTAGE" on boards that make use of them? That seems to be the most straightforward way to me.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

Yes, agreed. This is not very different from the gpiolib have/want case, either, and going that on a board-specific level worked out fine.

Ok, I'll make 2 patches then - for arch/sh/boards/Kconfig and arch/arm/mach-shmobile/Kconfig, adding the proposed "select ... if ..." line for each affected board.

Thanks. Is the "if ..." part the preferred way? It seems very verbose to me.

I tried without the "if," i.e. just

select REGULATOR_FIXED_VOLTAGE

If REGULATOR is not enabled in the .config, this produces a peculiar configuration of

REGULATOR=n
REGULATOR_FIXED_VOLTAGE=y

Which doesn't seem very meaningful to me. We could "select" both - that's another possibility. My proposal with the "if" gives more flexibility in kernel configuration - you can build a kernel without regulator support that way, for whatever reason you might want to do that.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

#26 lore raw
In reply to Tetsuyuki Kobayashi
Quoted 45 lines · Guennadi Liakhovetski
Quoted 27 lines · Magnus Damm
Quoted 25 lines · Guennadi Liakhovetski
Quoted 23 lines · Paul Mundt
Quoted 22 lines · Magnus Damm
Quoted 9 lines · Mark Brown
Quoted 6 lines · Rafael J. Wysocki

Well, if arch-wide, then perhaps we don't need REGULATOR_FIXED_VOLTAGE at all and we can just make things depending on it depend on REGULATOR directly?

The meaning of what you're proposing above is pretty much "REGULATOR_FIXED_VOLTAGE should be set whenever REGULATOR is" and I guess REGULATOR_FIXED_VOLTAGE depends on REGULATOR, so they appear to be equivalent.

Quoted 6 lines
Quoted 2 lines

How much code does really depend on REGULATOR_FIXED_VOLTAGE which is not build when REGULATOR is set?

No, that won't help - the problem is that we want a specific regulator driver to be built in order to ensure that the services it provides are available.

Right, so what's wrong with having a "select REGULATOR_FIXED_VOLTAGE" on boards that make use of them? That seems to be the most straightforward way to me.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

Yes, agreed. This is not very different from the gpiolib have/want case, either, and going that on a board-specific level worked out fine.

Ok, I'll make 2 patches then - for arch/sh/boards/Kconfig and arch/arm/mach-shmobile/Kconfig, adding the proposed "select ... if ..." line for each affected board.

Thanks. Is the "if ..." part the preferred way? It seems very verbose to me.

I tried without the "if," i.e. just

select REGULATOR_FIXED_VOLTAGE

If REGULATOR is not enabled in the .config, this produces a peculiar configuration of

Quoted 7 lines

REGULATOR=n
REGULATOR_FIXED_VOLTAGE=y

Which doesn't seem very meaningful to me. We could "select" both - that's another possibility. My proposal with the "if" gives more flexibility in kernel configuration - you can build a kernel without regulator support that way, for whatever reason you might want to do that.

Yes, I think the "if" option is more flexible.

Thanks,
Rafael

#27 lore raw
In reply to Tetsuyuki Kobayashi
Quoted 49 lines · Rafael J. Wysocki
Quoted 48 lines · Guennadi Liakhovetski
Quoted 27 lines · Magnus Damm
Quoted 25 lines · Guennadi Liakhovetski
Quoted 23 lines · Paul Mundt
Quoted 22 lines · Magnus Damm
Quoted 9 lines · Mark Brown
Quoted 6 lines · Rafael J. Wysocki

Well, if arch-wide, then perhaps we don't need REGULATOR_FIXED_VOLTAGE at all and we can just make things depending on it depend on REGULATOR directly?

The meaning of what you're proposing above is pretty much "REGULATOR_FIXED_VOLTAGE should be set whenever REGULATOR is" and I guess REGULATOR_FIXED_VOLTAGE depends on REGULATOR, so they appear to be equivalent.

Quoted 6 lines
Quoted 2 lines

How much code does really depend on REGULATOR_FIXED_VOLTAGE which is not build when REGULATOR is set?

No, that won't help - the problem is that we want a specific regulator driver to be built in order to ensure that the services it provides are available.

Right, so what's wrong with having a "select REGULATOR_FIXED_VOLTAGE" on boards that make use of them? That seems to be the most straightforward way to me.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

Yes, agreed. This is not very different from the gpiolib have/want case, either, and going that on a board-specific level worked out fine.

Ok, I'll make 2 patches then - for arch/sh/boards/Kconfig and arch/arm/mach-shmobile/Kconfig, adding the proposed "select ... if ..." line for each affected board.

Thanks. Is the "if ..." part the preferred way? It seems very verbose to me.

I tried without the "if," i.e. just

select REGULATOR_FIXED_VOLTAGE

If REGULATOR is not enabled in the .config, this produces a peculiar configuration of

REGULATOR=n
REGULATOR_FIXED_VOLTAGE=y

Quoted 6 lines
Quoted 4 lines

Which doesn't seem very meaningful to me. We could "select" both - that's another possibility. My proposal with the "if" gives more flexibility in kernel configuration - you can build a kernel without regulator support that way, for whatever reason you might want to do that.

Yes, I think the "if" option is more flexible.

Agreed. Thanks.

/ magnus

#28 lore raw
In reply to Tetsuyuki Kobayashi
Quoted 7 lines · Magnus Damm

On Wed, Jul 4, 2012 at 7:48 PM, Mark Brown

Quoted 4 lines

If the power on defaults for the system weren't suitable for whatever is being done you'd still have an issue even with the stubs but a lot of the time the main effect of the API is to allow drivers to do additional power optimisations.

Quoted 7 lines

I may misunderstand the situation, but I believe the issue here is that the REGULATOR=n case works fine on the boards with smsc911x, but it stops "working" whenever REGULATOR=y is turned on and REGULATOR_DRIVER_FOOBAR=n. People probably enable regulators because they want to use the PMIC (that most likely isn't hooked up to the SMSC chip), but they get surprised to see the following SMSC error message:

Yes, of course, but then there's not really much else we can do here except for ignore errors which isn't awesome.