da903x: Where should usb charge pump support go?
Dear All,
The new da903x driver is proving to be a good replacement for the out of kernel driver I've been using previously.
Unfortunately there is still quite a lot of functionality to to add.
The key one for me is control of the USB charge pump. So the question is, does this fit within the regulator framework (i.e. should I add it to the regulator driver) or should this be a seperate driver (and if so where?)
Personally I'm not convinced it fits cleanly within the regulator framework given it is probably only ever going to get called from one driver and has somewhat odd properties!
Thanks,
Jonathan Cameron
Quoted 7 lines · ext Jonathan Cameron
Dear All,
The new da903x driver is proving to be a good replacement for the out of kernel driver I've been using previously.
Unfortunately there is still quite a lot of functionality to to add.
Quoted 7 lines
The key one for me is control of the USB charge pump. So the question is, does this fit within the regulator framework (i.e. should I add it to the regulator driver) or should this be a seperate driver (and if so where?)
Personally I'm not convinced it fits cleanly within the regulator framework given it is probably only ever going to get called from one driver and has somewhat odd properties!
I was thinking the same and even mailed Liam and Mark about it. The design I was thinking was the charger chip would be done in regulator framework and the battery chip (or current gauge) would be using power supply fw and regulator consumer device.
The constraints would be basically the current and/or voltage range your charger chip supports.
I still didn't have much time to hack on it, but seemed to be pretty reasonable.
If someone has better idea, I'd trully like to hear that.
Signature · 1 line
balbi
Quoted 7 lines · Jonathan Cameron
The key one for me is control of the USB charge pump. So the question is, does this fit within the regulator framework (i.e. should I add it to the regulator driver) or should this be a seperate driver (and if so where?)
Personally I'm not convinced it fits cleanly within the regulator framework given it is probably only ever going to get called from one driver and has somewhat odd properties!
What exactly does the USB charge pump control do here? Is it purely controlling the power supplied to USB (I'm assuming that this is the PXA USB controller and that the DA903x is so closely tied to it nobody would use it with another CPU)? I'm guessing it's a bit more than that and there's also control over the current that can be drawn from USB by the system as well as that supplied.
Quoted 21 lines · Felipe Balbi
Quoted 7 lines · ext Jonathan Cameron
Dear All,
The new da903x driver is proving to be a good replacement for the out of kernel driver I've been using previously.
Unfortunately there is still quite a lot of functionality to to add.
Quoted 7 lines
The key one for me is control of the USB charge pump. So the question is, does this fit within the regulator framework (i.e. should I add it to the regulator driver) or should this be a seperate driver (and if so where?)
Personally I'm not convinced it fits cleanly within the regulator framework given it is probably only ever going to get called from one driver and has somewhat odd properties!
I was thinking the same and even mailed Liam and Mark about it. The design I was thinking was the charger chip would be done in regulator framework and the battery chip (or current gauge) would be using power supply fw and regulator consumer device.
Quoted 8 lines
The constraints would be basically the current and/or voltage range your charger chip supports.
I still didn't have much time to hack on it, but seemed to be pretty reasonable.
If someone has better idea, I'd trully like to hear that.
Fwiw, we have done something similar with the wm8350 charger and exposed it through the kernel power supply framework. The charger is connected directly to the wm8350 line input and not controllable through any regulator hence it was not made a regulator consumer.
Jonathan, since this charge pump has an 'odd' interface and one user it may just be easier to initially add outwith the framework. It should probably live in drivers/mfd with the da903x core.
Fwiw, we should look at supporting charge pumps in the regulator framework as we already support voltage and current sink regulators.
Liam
Quoted 5 lines · Liam Girdwood
Quoted 4 lines · Felipe Balbi
Quoted 3 lines · ext Jonathan Cameron
Dear All,
The new da903x driver is proving to be a good replacement for the out
of kernel
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
driver I've been using previously.
Unfortunately there is still quite a lot of functionality to to add.
The key one for me is control of the USB charge pump. So the question
is, does
Quoted 1 line
Quoted 1 line
Quoted 1 line
this fit within the regulator framework (i.e. should I add it to the
regulator
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
driver) or should this be a seperate driver (and if so where?)
Personally I'm not convinced it fits cleanly within the regulator
framework
Quoted 1 line
Quoted 1 line
Quoted 1 line
given it is probably only ever going to get called from one driver
and has
Quoted 15 lines
Quoted 6 lines
Quoted 1 line
somewhat odd properties!
I was thinking the same and even mailed Liam and Mark about it. The design I was thinking was the charger chip would be done in regulator framework and the battery chip (or current gauge) would be using power supply fw and regulator consumer device.
Quoted 8 lines
The constraints would be basically the current and/or voltage range your charger chip supports.
I still didn't have much time to hack on it, but seemed to be pretty reasonable.
If someone has better idea, I'd trully like to hear that.
Quoted 8 lines
Fwiw, we have done something similar with the wm8350 charger and exposed it through the kernel power supply framework. The charger is connected directly to the wm8350 line input and not controllable through any regulator hence it was not made a regulator consumer.
Jonathan, since this charge pump has an 'odd' interface and one user it may just be easier to initially add outwith the framework. It should probably live in
drivers/mfdwith the da903x core.
That sounds a sensible option for now.
Quoted 2 lines
Fwiw, we should look at supporting charge pumps in the regulator framework as we already support voltage and current sink regulators.
Seems like a good idea in the long run.
Anyhow, as a quick summary of what the da9030 (don't have the da9034 datasheet to hand) has that isn't currently supported (mainly with a view to keeping things consistent)
The DC-DC Bucks.
This is probably just a simple matter of testing the obvious additions to the code? (are there any known problems with this?)
USB charge pump.
Two modes, either 100mA at 5V or 10mA source for SR pulse generation (from what I understand this is part of the detection of usb devices) There are also 4 detectors vor various voltage and device attachment functions.
Sim charge pump.
Slightly unusual and if not in 5V mode routes through ldo6 and ldo17 with controllable voltage guarantees (either 1.8V or 2.9V). Probably needs to be tied into the control of these ldo's within the regulator driver.
Battery Charger.
This one is complex. Supports 40 to 1400mA and 4 to 4.35V supply with lots of monitoring. Has several different operating modes and needs a non trivial driver. This one will be 'interesting' to write (have a sand bucket ready and cross your fingers)
ADC
Used partly for internal monitoring functionality, partly for auxiliary inputs. The question on this is whether to implement it as a hwmon driver (somewhat unusual form, but sort of fits) or whether some of this is needed for feedback to the battery charger code etc.
Anyhow, the only one of critical importance to me is the usb charge pump, so I'll work on that for now. I'd be interested in testing battery charger code but have too many other drivers to write at the mo to be able to code that up.
Thanks
Jonathan
Quoted 6 lines · Jonathan Cameron
ADC
Used partly for internal monitoring functionality, partly for auxiliary inputs. The question on this is whether to implement it as a hwmon driver (somewhat unusual form, but sort of fits) or whether some of this is needed for feedback to the battery charger code etc.
For WM8350 this is implemented as a device-specific function in the driver core which is then used by other drivers to export the information to relevant subsystems.
There was some work on a generic ADC framework that might be a better fit for the auxiliary inputs but I'm not sure where that's going ATM or if it's really appropriate.
Quoted 9 lines · Mark Brown
Quoted 6 lines · Jonathan Cameron
ADC
Used partly for internal monitoring functionality, partly for auxiliary inputs. The question on this is whether to implement it as a hwmon driver (somewhat unusual form, but sort of fits) or whether some of this is needed for feedback to the battery charger code etc.
Quoted 3 lines
For WM8350 this is implemented as a device-specific function in the driver core which is then used by other drivers to export the information to relevant subsystems.
Seems a sensible option. Can always put a hwmon driver on top of that if people want the nice userspace interfaces etc.
Quoted 3 lines
There was some work on a generic ADC framework that might be a better fit for the auxiliary inputs but I'm not sure where that's going ATM or if it's really appropriate.
That's probably me anyway (industrialio), it's stalled whilst I switch my test platform to this driver and isn't really suitable for this (unless someone wants to abuse the auxiliary adc inputs for general purpose stuff).
It's focus (principally) is on fast capture from sensors by triggering events (periodic timers / gpio / non periodic triggering schedules - haven't done that one yet) rather than internal monitoring. Other such as input / hwmon may be built on top of the underlying core, but that's not done yet.
As a quick and dirty progress report, the device handling side of things is in place and working well. Current work is on generalizing the triggering framework and working out how to handle the connectivity issues cleanly. I did promise to post a release at the end of last week but have dropped back a chunk as some 'minor' changes proved rather complex to do.
Jonathan
Quoted 8 lines · Jonathan Cameron
Quoted 3 lines · Mark Brown
For WM8350 this is implemented as a device-specific function in the driver core which is then used by other drivers to export the information to relevant subsystems.
Seems a sensible option. Can always put a hwmon driver on top of that if people want the nice userspace interfaces etc.
If it's anything like WM8350 you'll end up with multiple things sitting on top of it.
Quoted 2 lines
That's probably me anyway (industrialio), it's stalled whilst I switch my test platform to this driver and isn't really suitable for this
Ah, yes - so it is.
Quoted 2 lines
(unless someone wants to abuse the auxiliary adc inputs for general purpose stuff).
My experience suggests that at least some designs will want to do that but if you go with the internal-only support with multiple clients they can always write a driver on top of that if/when they need it.
Quoted 5 lines · Jonathan Cameron
Battery Charger.
This one is complex. Supports 40 to 1400mA and 4 to 4.35V supply with lots of monitoring. Has several different operating modes and needs a non trivial driver. This one will be 'interesting' to write (have a sand bucket ready and cross your fingers)
I have the battery charger driver for EM-X270, but for now it's tightly coupled to the platform code.
I'll try to make it generic but it'll take some time...
Signature · 2 lines
Sincerely Yours, Mike.