mbox series

[RESEND,0/3] Add support for STM32 vrefbuf regulator

Message ID 1503925133-30722-1-git-send-email-fabrice.gasnier@st.com
Headers show
Series Add support for STM32 vrefbuf regulator | expand

Message

Fabrice Gasnier Aug. 28, 2017, 12:58 p.m. UTC
Some STM32 devices embed a voltage reference buffer which can be used as
voltage reference for ADCs, DACs and also as voltage reference
for external components through the dedicated VREF+ pin.

This patchset adds vrefbuf regulator driver, device tree bindings and
vrefbuf device tree node for STM32H7 SoC.

Fabrice Gasnier (3):
  dt-bindings: regulator: Add STM32 Voltage Reference Buffer
  regulator: Add support for stm32-vrefbuf
  ARM: dts: stm32: add vrefbuf to stm32h743

 .../bindings/regulator/st,stm32-vrefbuf.txt        |  20 ++
 arch/arm/boot/dts/stm32h743.dtsi                   |   9 +
 drivers/regulator/Kconfig                          |  12 ++
 drivers/regulator/Makefile                         |   1 +
 drivers/regulator/stm32-vrefbuf.c                  | 215 +++++++++++++++++++++
 5 files changed, 257 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/regulator/st,stm32-vrefbuf.txt
 create mode 100644 drivers/regulator/stm32-vrefbuf.c

Comments

Mark Brown Aug. 29, 2017, 6:57 p.m. UTC | #1
On Mon, Aug 28, 2017 at 02:58:52PM +0200, Fabrice Gasnier wrote:

> +	ret = clk_prepare_enable(priv->clk);
> +	if (ret) {
> +		dev_err(&pdev->dev, "clk prepare failed\n");

If you're printing an error include the error code, it'll help users
figure out what went wrong.

> +	dev_info(&pdev->dev, "STM32 VREFBUF initialized\n");

This is just noise, remove it.

> +static int __init stm32_vrefbuf_init(void)
> +{
> +	return platform_driver_register(&stm32_vrefbuf_driver);
> +}
> +subsys_initcall(stm32_vrefbuf_init);

Why is this at subsys_initcall()?
Fabrice Gasnier Aug. 30, 2017, 9:11 a.m. UTC | #2
On 08/29/2017 08:57 PM, Mark Brown wrote:
> On Mon, Aug 28, 2017 at 02:58:52PM +0200, Fabrice Gasnier wrote:
> 
>> +	ret = clk_prepare_enable(priv->clk);
>> +	if (ret) {
>> +		dev_err(&pdev->dev, "clk prepare failed\n");
> 
> If you're printing an error include the error code, it'll help users
> figure out what went wrong.
Hi Mark,

Thanks for reviewing,
I'll add it in v2.
> 
>> +	dev_info(&pdev->dev, "STM32 VREFBUF initialized\n");
> 
> This is just noise, remove it.

I'll remove it in v2.
> 
>> +static int __init stm32_vrefbuf_init(void)
>> +{
>> +	return platform_driver_register(&stm32_vrefbuf_driver);
>> +}
>> +subsys_initcall(stm32_vrefbuf_init);
> 
> Why is this at subsys_initcall()?
> 
Several consumers depend on it when it's being used, among which: STM32
internal ADC and DAC, but also external components. Purpose is to ensure
it's ready before these drivers gets probed, instead of being deferred.
Is it ok to keep it ?

Please let me know,
Best Regards,
Fabrice
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Mark Brown Aug. 30, 2017, 3:02 p.m. UTC | #3
On Wed, Aug 30, 2017 at 11:11:24AM +0200, Fabrice Gasnier wrote:
> On 08/29/2017 08:57 PM, Mark Brown wrote:
> > On Mon, Aug 28, 2017 at 02:58:52PM +0200, Fabrice Gasnier wrote:

> >> +static int __init stm32_vrefbuf_init(void)
> >> +{
> >> +	return platform_driver_register(&stm32_vrefbuf_driver);
> >> +}
> >> +subsys_initcall(stm32_vrefbuf_init);

> > Why is this at subsys_initcall()?

> Several consumers depend on it when it's being used, among which: STM32
> internal ADC and DAC, but also external components. Purpose is to ensure
> it's ready before these drivers gets probed, instead of being deferred.
> Is it ok to keep it ?

No, that's not OK - just let deferred probe handle it.  The same thing
applies to all regulator usage.
Fabrice Gasnier Aug. 30, 2017, 3:23 p.m. UTC | #4
On 08/30/2017 05:02 PM, Mark Brown wrote:
> On Wed, Aug 30, 2017 at 11:11:24AM +0200, Fabrice Gasnier wrote:
>> On 08/29/2017 08:57 PM, Mark Brown wrote:
>>> On Mon, Aug 28, 2017 at 02:58:52PM +0200, Fabrice Gasnier wrote:
> 
>>>> +static int __init stm32_vrefbuf_init(void)
>>>> +{
>>>> +	return platform_driver_register(&stm32_vrefbuf_driver);
>>>> +}
>>>> +subsys_initcall(stm32_vrefbuf_init);
> 
>>> Why is this at subsys_initcall()?
> 
>> Several consumers depend on it when it's being used, among which: STM32
>> internal ADC and DAC, but also external components. Purpose is to ensure
>> it's ready before these drivers gets probed, instead of being deferred.
>> Is it ok to keep it ?
> 
> No, that's not OK - just let deferred probe handle it.  The same thing
> applies to all regulator usage.
> 
Hi Mark,
Ok, I'll update this in v2 as well.

Thanks,
Fabrice
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html