Re: [PATCH 06/16] regulator: madera-ldo1: LDO1 driver for Cirrus Logic Madera codecs
On Tue, Apr 11, 2017 at 02:20:31PM -0500, Rob Herring wrote: > On Mon, Apr 10, 2017 at 1:11 PM, Mark Brownwrote: > > In what way? Other than the -gpios stuff (which would just be a trivial > > thing if we wanted to change it)? > That's mainly it. I don't see that as meaningful or a good reason to duplicate the driver or the binding, it'd be better to just add the new property and deprecate the old. > It's not clear which node wlf,ldoena goes in either. > In the parent? ldo1? Parent since it's looked up in device context, this is also something that it seems better to fix in one binding rather than duplicate. signature.asc Description: PGP signature
Re: [PATCH 06/16] regulator: madera-ldo1: LDO1 driver for Cirrus Logic Madera codecs
On Tue, Apr 11, 2017 at 02:20:31PM -0500, Rob Herring wrote: > On Mon, Apr 10, 2017 at 1:11 PM, Mark Brown wrote: > > In what way? Other than the -gpios stuff (which would just be a trivial > > thing if we wanted to change it)? > That's mainly it. I don't see that as meaningful or a good reason to duplicate the driver or the binding, it'd be better to just add the new property and deprecate the old. > It's not clear which node wlf,ldoena goes in either. > In the parent? ldo1? Parent since it's looked up in device context, this is also something that it seems better to fix in one binding rather than duplicate. signature.asc Description: PGP signature
Re: [PATCH 06/16] regulator: madera-ldo1: LDO1 driver for Cirrus Logic Madera codecs
On Mon, Apr 10, 2017 at 1:11 PM, Mark Brownwrote: > On Mon, Apr 10, 2017 at 12:49:17PM -0500, Rob Herring wrote: > >> Same question as Mark. Should this share bindings with arizona? The >> arizona one looks a bit strange, so not sure we'd want to just copy it. > > In what way? Other than the -gpios stuff (which would just be a trivial > thing if we wanted to change it)? That's mainly it. It's not clear which node wlf,ldoena goes in either. In the parent? ldo1? Rob
Re: [PATCH 06/16] regulator: madera-ldo1: LDO1 driver for Cirrus Logic Madera codecs
On Mon, Apr 10, 2017 at 1:11 PM, Mark Brown wrote: > On Mon, Apr 10, 2017 at 12:49:17PM -0500, Rob Herring wrote: > >> Same question as Mark. Should this share bindings with arizona? The >> arizona one looks a bit strange, so not sure we'd want to just copy it. > > In what way? Other than the -gpios stuff (which would just be a trivial > thing if we wanted to change it)? That's mainly it. It's not clear which node wlf,ldoena goes in either. In the parent? ldo1? Rob
Re: [PATCH 06/16] regulator: madera-ldo1: LDO1 driver for Cirrus Logic Madera codecs
On Mon, Apr 10, 2017 at 12:49:17PM -0500, Rob Herring wrote: > Same question as Mark. Should this share bindings with arizona? The > arizona one looks a bit strange, so not sure we'd want to just copy it. In what way? Other than the -gpios stuff (which would just be a trivial thing if we wanted to change it)? signature.asc Description: PGP signature
Re: [PATCH 06/16] regulator: madera-ldo1: LDO1 driver for Cirrus Logic Madera codecs
On Mon, Apr 10, 2017 at 12:49:17PM -0500, Rob Herring wrote: > Same question as Mark. Should this share bindings with arizona? The > arizona one looks a bit strange, so not sure we'd want to just copy it. In what way? Other than the -gpios stuff (which would just be a trivial thing if we wanted to change it)? signature.asc Description: PGP signature
Re: [PATCH 06/16] regulator: madera-ldo1: LDO1 driver for Cirrus Logic Madera codecs
On Wed, Apr 05, 2017 at 11:07:54AM +0100, Richard Fitzgerald wrote: > This patch adds a driver for the internal LDO1 regulator on > some Cirrus Logic Madera class codecs. > > Signed-off-by: Richard Fitzgerald> Signed-off-by: Charles Keepax > --- > .../devicetree/bindings/regulator/madera-ldo1.txt | 29 +++ cirrus-madera-ldo1.txt Or perhaps a subdirectory. We should have done the same for arizona bindings. Same question as Mark. Should this share bindings with arizona? The arizona one looks a bit strange, so not sure we'd want to just copy it. > MAINTAINERS| 3 + > drivers/regulator/Kconfig | 8 + > drivers/regulator/Makefile | 1 + > drivers/regulator/madera-ldo1.c| 198 > + > include/linux/regulator/madera-ldo1.h | 24 +++ > 6 files changed, 263 insertions(+) > create mode 100644 > Documentation/devicetree/bindings/regulator/madera-ldo1.txt > create mode 100644 drivers/regulator/madera-ldo1.c > create mode 100644 include/linux/regulator/madera-ldo1.h > > diff --git a/Documentation/devicetree/bindings/regulator/madera-ldo1.txt > b/Documentation/devicetree/bindings/regulator/madera-ldo1.txt > new file mode 100644 > index 000..688f21d > --- /dev/null > +++ b/Documentation/devicetree/bindings/regulator/madera-ldo1.txt > @@ -0,0 +1,29 @@ > +Cirrus Logic Madera class audio codecs LDO1 regulator driver > + > +Only required if you are using the codec internal LDO1 regulator. > +This is a subnode of the parent mfd node. > + > +See also the core bindings for the parent MFD driver: > +See Documentation/devicetree/bindings/mfd/madera.txt > + > +Required properties: > + - compatible : must be "cirrus,madera-ldo1" > + - LDOVDD-supply : Power supply for the LDO1 regulator. > + > + - enable-gpio : GPIO to use to enable/disable the regulator. enable-gpios And define whether active high or low. > +As defined in bindings/gpio.txt. > + > +Optional subnodes: > + Standard regulator bindings as described in > bindings/regulator/regulator.txt > + > +Example: > + > +codec: cs47l85@0 { > + compatible = "cirrus,cs47l85"; > + > + ldo1 { > + compatible = "cirrus,madera-ldo1"; > + LDOVDD-supply = <_vdd1>; > + enable-gpio = < 0>; > + }; > +};
Re: [PATCH 06/16] regulator: madera-ldo1: LDO1 driver for Cirrus Logic Madera codecs
On Wed, Apr 05, 2017 at 11:07:54AM +0100, Richard Fitzgerald wrote: > This patch adds a driver for the internal LDO1 regulator on > some Cirrus Logic Madera class codecs. > > Signed-off-by: Richard Fitzgerald > Signed-off-by: Charles Keepax > --- > .../devicetree/bindings/regulator/madera-ldo1.txt | 29 +++ cirrus-madera-ldo1.txt Or perhaps a subdirectory. We should have done the same for arizona bindings. Same question as Mark. Should this share bindings with arizona? The arizona one looks a bit strange, so not sure we'd want to just copy it. > MAINTAINERS| 3 + > drivers/regulator/Kconfig | 8 + > drivers/regulator/Makefile | 1 + > drivers/regulator/madera-ldo1.c| 198 > + > include/linux/regulator/madera-ldo1.h | 24 +++ > 6 files changed, 263 insertions(+) > create mode 100644 > Documentation/devicetree/bindings/regulator/madera-ldo1.txt > create mode 100644 drivers/regulator/madera-ldo1.c > create mode 100644 include/linux/regulator/madera-ldo1.h > > diff --git a/Documentation/devicetree/bindings/regulator/madera-ldo1.txt > b/Documentation/devicetree/bindings/regulator/madera-ldo1.txt > new file mode 100644 > index 000..688f21d > --- /dev/null > +++ b/Documentation/devicetree/bindings/regulator/madera-ldo1.txt > @@ -0,0 +1,29 @@ > +Cirrus Logic Madera class audio codecs LDO1 regulator driver > + > +Only required if you are using the codec internal LDO1 regulator. > +This is a subnode of the parent mfd node. > + > +See also the core bindings for the parent MFD driver: > +See Documentation/devicetree/bindings/mfd/madera.txt > + > +Required properties: > + - compatible : must be "cirrus,madera-ldo1" > + - LDOVDD-supply : Power supply for the LDO1 regulator. > + > + - enable-gpio : GPIO to use to enable/disable the regulator. enable-gpios And define whether active high or low. > +As defined in bindings/gpio.txt. > + > +Optional subnodes: > + Standard regulator bindings as described in > bindings/regulator/regulator.txt > + > +Example: > + > +codec: cs47l85@0 { > + compatible = "cirrus,cs47l85"; > + > + ldo1 { > + compatible = "cirrus,madera-ldo1"; > + LDOVDD-supply = <_vdd1>; > + enable-gpio = < 0>; > + }; > +};
Re: [PATCH 06/16] regulator: madera-ldo1: LDO1 driver for Cirrus Logic Madera codecs
On Wed, Apr 05, 2017 at 11:07:54AM +0100, Richard Fitzgerald wrote: > This patch adds a driver for the internal LDO1 regulator on > some Cirrus Logic Madera class codecs. There appear to be only data differences to the existing arizona driver, is it possible to share the code? signature.asc Description: PGP signature
Re: [PATCH 06/16] regulator: madera-ldo1: LDO1 driver for Cirrus Logic Madera codecs
On Wed, Apr 05, 2017 at 11:07:54AM +0100, Richard Fitzgerald wrote: > This patch adds a driver for the internal LDO1 regulator on > some Cirrus Logic Madera class codecs. There appear to be only data differences to the existing arizona driver, is it possible to share the code? signature.asc Description: PGP signature
[PATCH 06/16] regulator: madera-ldo1: LDO1 driver for Cirrus Logic Madera codecs
This patch adds a driver for the internal LDO1 regulator on some Cirrus Logic Madera class codecs. Signed-off-by: Richard FitzgeraldSigned-off-by: Charles Keepax --- .../devicetree/bindings/regulator/madera-ldo1.txt | 29 +++ MAINTAINERS| 3 + drivers/regulator/Kconfig | 8 + drivers/regulator/Makefile | 1 + drivers/regulator/madera-ldo1.c| 198 + include/linux/regulator/madera-ldo1.h | 24 +++ 6 files changed, 263 insertions(+) create mode 100644 Documentation/devicetree/bindings/regulator/madera-ldo1.txt create mode 100644 drivers/regulator/madera-ldo1.c create mode 100644 include/linux/regulator/madera-ldo1.h diff --git a/Documentation/devicetree/bindings/regulator/madera-ldo1.txt b/Documentation/devicetree/bindings/regulator/madera-ldo1.txt new file mode 100644 index 000..688f21d --- /dev/null +++ b/Documentation/devicetree/bindings/regulator/madera-ldo1.txt @@ -0,0 +1,29 @@ +Cirrus Logic Madera class audio codecs LDO1 regulator driver + +Only required if you are using the codec internal LDO1 regulator. +This is a subnode of the parent mfd node. + +See also the core bindings for the parent MFD driver: +See Documentation/devicetree/bindings/mfd/madera.txt + +Required properties: + - compatible : must be "cirrus,madera-ldo1" + - LDOVDD-supply : Power supply for the LDO1 regulator. + + - enable-gpio: GPIO to use to enable/disable the regulator. +As defined in bindings/gpio.txt. + +Optional subnodes: + Standard regulator bindings as described in bindings/regulator/regulator.txt + +Example: + +codec: cs47l85@0 { + compatible = "cirrus,cs47l85"; + + ldo1 { + compatible = "cirrus,madera-ldo1"; + LDOVDD-supply = <_vdd1>; + enable-gpio = < 0>; + }; +}; diff --git a/MAINTAINERS b/MAINTAINERS index d28e53f..1207c9c 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3267,9 +3267,12 @@ T: git https://github.com/CirrusLogic/linux-drivers.git W: https://github.com/CirrusLogic/linux-drivers/wiki S: Supported F: Documentation/devicetree/bindings/mfd/madera.txt +F: Documentation/devicetree/bindings/regulator/madera* F: include/linux/mfd/madera/* +F: include/linux/regulator/madera* F: drivers/mfd/madera* F: drivers/mfd/cs47l* +F: drivers/regulator/madera* CLEANCACHE API M: Konrad Rzeszutek Wilk diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig index be06eb2..c96d9a6 100644 --- a/drivers/regulator/Kconfig +++ b/drivers/regulator/Kconfig @@ -368,6 +368,14 @@ config REGULATOR_LTC3676 This enables support for the LTC3676 8-output regulators controlled via I2C. +config REGULATOR_MADERA_LDO1 + tristate "Cirrus Logic Madera codecs LDO1 regulator" + depends on MFD_MADERA + help + If you want to use the internal LDO1 regulator on CS47L85 and WM1840 + to supply DCVDD you must include this driver. If you are using an + external DCVDD regulator you do not need this driver. + config REGULATOR_MAX14577 tristate "Maxim 14577/77836 regulator" depends on MFD_MAX14577 diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile index ef7725e..2db3592 100644 --- a/drivers/regulator/Makefile +++ b/drivers/regulator/Makefile @@ -49,6 +49,7 @@ obj-$(CONFIG_REGULATOR_LP8788) += lp8788-ldo.o obj-$(CONFIG_REGULATOR_LP8755) += lp8755.o obj-$(CONFIG_REGULATOR_LTC3589) += ltc3589.o obj-$(CONFIG_REGULATOR_LTC3676) += ltc3676.o +obj-$(CONFIG_REGULATOR_MADERA_LDO1) += madera-ldo1.o obj-$(CONFIG_REGULATOR_MAX14577) += max14577-regulator.o obj-$(CONFIG_REGULATOR_MAX1586) += max1586.o obj-$(CONFIG_REGULATOR_MAX77620) += max77620-regulator.o diff --git a/drivers/regulator/madera-ldo1.c b/drivers/regulator/madera-ldo1.c new file mode 100644 index 000..6504d6f --- /dev/null +++ b/drivers/regulator/madera-ldo1.c @@ -0,0 +1,198 @@ +/* + * madera-ldo1.c -- Driver for the LDO1 regulator on Madera codecs + * + * Copyright 2015-2017 Cirrus Logic + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include + +struct madera_ldo1 { + struct regulator_dev *regulator; + + struct regulator_consumer_supply supply; + struct regulator_init_data init_data; +}; + +static const struct regulator_ops madera_ldo1_ops = { + .list_voltage = regulator_list_voltage_linear, + .map_voltage = regulator_map_voltage_linear, + .get_voltage_sel =
[PATCH 06/16] regulator: madera-ldo1: LDO1 driver for Cirrus Logic Madera codecs
This patch adds a driver for the internal LDO1 regulator on some Cirrus Logic Madera class codecs. Signed-off-by: Richard Fitzgerald Signed-off-by: Charles Keepax --- .../devicetree/bindings/regulator/madera-ldo1.txt | 29 +++ MAINTAINERS| 3 + drivers/regulator/Kconfig | 8 + drivers/regulator/Makefile | 1 + drivers/regulator/madera-ldo1.c| 198 + include/linux/regulator/madera-ldo1.h | 24 +++ 6 files changed, 263 insertions(+) create mode 100644 Documentation/devicetree/bindings/regulator/madera-ldo1.txt create mode 100644 drivers/regulator/madera-ldo1.c create mode 100644 include/linux/regulator/madera-ldo1.h diff --git a/Documentation/devicetree/bindings/regulator/madera-ldo1.txt b/Documentation/devicetree/bindings/regulator/madera-ldo1.txt new file mode 100644 index 000..688f21d --- /dev/null +++ b/Documentation/devicetree/bindings/regulator/madera-ldo1.txt @@ -0,0 +1,29 @@ +Cirrus Logic Madera class audio codecs LDO1 regulator driver + +Only required if you are using the codec internal LDO1 regulator. +This is a subnode of the parent mfd node. + +See also the core bindings for the parent MFD driver: +See Documentation/devicetree/bindings/mfd/madera.txt + +Required properties: + - compatible : must be "cirrus,madera-ldo1" + - LDOVDD-supply : Power supply for the LDO1 regulator. + + - enable-gpio: GPIO to use to enable/disable the regulator. +As defined in bindings/gpio.txt. + +Optional subnodes: + Standard regulator bindings as described in bindings/regulator/regulator.txt + +Example: + +codec: cs47l85@0 { + compatible = "cirrus,cs47l85"; + + ldo1 { + compatible = "cirrus,madera-ldo1"; + LDOVDD-supply = <_vdd1>; + enable-gpio = < 0>; + }; +}; diff --git a/MAINTAINERS b/MAINTAINERS index d28e53f..1207c9c 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3267,9 +3267,12 @@ T: git https://github.com/CirrusLogic/linux-drivers.git W: https://github.com/CirrusLogic/linux-drivers/wiki S: Supported F: Documentation/devicetree/bindings/mfd/madera.txt +F: Documentation/devicetree/bindings/regulator/madera* F: include/linux/mfd/madera/* +F: include/linux/regulator/madera* F: drivers/mfd/madera* F: drivers/mfd/cs47l* +F: drivers/regulator/madera* CLEANCACHE API M: Konrad Rzeszutek Wilk diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig index be06eb2..c96d9a6 100644 --- a/drivers/regulator/Kconfig +++ b/drivers/regulator/Kconfig @@ -368,6 +368,14 @@ config REGULATOR_LTC3676 This enables support for the LTC3676 8-output regulators controlled via I2C. +config REGULATOR_MADERA_LDO1 + tristate "Cirrus Logic Madera codecs LDO1 regulator" + depends on MFD_MADERA + help + If you want to use the internal LDO1 regulator on CS47L85 and WM1840 + to supply DCVDD you must include this driver. If you are using an + external DCVDD regulator you do not need this driver. + config REGULATOR_MAX14577 tristate "Maxim 14577/77836 regulator" depends on MFD_MAX14577 diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile index ef7725e..2db3592 100644 --- a/drivers/regulator/Makefile +++ b/drivers/regulator/Makefile @@ -49,6 +49,7 @@ obj-$(CONFIG_REGULATOR_LP8788) += lp8788-ldo.o obj-$(CONFIG_REGULATOR_LP8755) += lp8755.o obj-$(CONFIG_REGULATOR_LTC3589) += ltc3589.o obj-$(CONFIG_REGULATOR_LTC3676) += ltc3676.o +obj-$(CONFIG_REGULATOR_MADERA_LDO1) += madera-ldo1.o obj-$(CONFIG_REGULATOR_MAX14577) += max14577-regulator.o obj-$(CONFIG_REGULATOR_MAX1586) += max1586.o obj-$(CONFIG_REGULATOR_MAX77620) += max77620-regulator.o diff --git a/drivers/regulator/madera-ldo1.c b/drivers/regulator/madera-ldo1.c new file mode 100644 index 000..6504d6f --- /dev/null +++ b/drivers/regulator/madera-ldo1.c @@ -0,0 +1,198 @@ +/* + * madera-ldo1.c -- Driver for the LDO1 regulator on Madera codecs + * + * Copyright 2015-2017 Cirrus Logic + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include + +struct madera_ldo1 { + struct regulator_dev *regulator; + + struct regulator_consumer_supply supply; + struct regulator_init_data init_data; +}; + +static const struct regulator_ops madera_ldo1_ops = { + .list_voltage = regulator_list_voltage_linear, + .map_voltage = regulator_map_voltage_linear, + .get_voltage_sel = regulator_get_voltage_sel_regmap, + .set_voltage_sel = regulator_set_voltage_sel_regmap, +}; + +static