Re: [PATCH v9 3/9] mfd: madera: Add common support for Cirrus Logic Madera codecs

2018-04-16 Thread Richard Fitzgerald

On 28/03/18 10:00, Lee Jones wrote:

On Tue, 13 Mar 2018, Richard Fitzgerald wrote:


This adds the generic core support for Cirrus Logic "Madera" class codecs.
These are complex audio codec SoCs with a variety of digital and analogue
I/O, onboard audio processing and DSPs, and other features.

These codecs are all based off a common set of hardware IP so can be
supported by a core of common code (with a few minor device-to-device
variations).

Signed-off-by: Charles Keepax 
Signed-off-by: Nikesh Oswal 
Signed-off-by: Richard Fitzgerald 
---
There have been various smallish changes since Lee acked this patch so I have
decided to err on the side of caution and remove the Ack in case Lee might have
some comments about the current state of the code.

Cumulative changes since Lee acked it:
- changed to use gpiod for all reset code - affects 
madera_[enable|disable]_hard_reset,
   madera_get_reset_gpio, madera_dev_init
- use of_device_get_match_data in the spi and i2c probes
- use __maybe_unused on the pm runtime functions instead of a #ifdef
- don't put comma after {} list terminators
- commented why we don't use the devm version of mfd_add_devices
- don't use regulator_get_exclusive, it fails in the legitimate case of having 
the same
   regulator supply multiple chip supplies
- the core driver can now be built as a module
- minor Kconfig change to make the SPI/I2C submodules depend on the core module
 as this gives a more user-friendly menuconfig
- changed the irqchip and codec pdata to be a pointer to remove the build 
dependency
 so we can submit this patch without the irqchip and codec driver patches
- SPDX license headers
---
  MAINTAINERS  |   3 +
  drivers/mfd/Kconfig  |  29 ++
  drivers/mfd/Makefile |   5 +
  drivers/mfd/madera-core.c| 600 +++
  drivers/mfd/madera-i2c.c | 139 +
  drivers/mfd/madera-spi.c | 138 +
  drivers/mfd/madera.h |  44 +++
  include/linux/mfd/madera/core.h  | 187 
  include/linux/mfd/madera/pdata.h |  63 
  9 files changed, 1208 insertions(+)
  create mode 100644 drivers/mfd/madera-core.c
  create mode 100644 drivers/mfd/madera-i2c.c
  create mode 100644 drivers/mfd/madera-spi.c
  create mode 100644 drivers/mfd/madera.h
  create mode 100644 include/linux/mfd/madera/core.h
  create mode 100644 include/linux/mfd/madera/pdata.h

diff --git a/MAINTAINERS b/MAINTAINERS
index 40d78683a53f..f7ea1a47496c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3498,7 +3498,10 @@ L:   patc...@opensource.cirrus.com
  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:include/linux/mfd/madera/*
+F: drivers/mfd/madera*
+F: drivers/mfd/cs47l*
  
  CLEANCACHE API

  M:Konrad Rzeszutek Wilk 
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index b860eb5aa194..f5ca392f8bc2 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -232,6 +232,35 @@ config MFD_CROS_EC_CHARDEV
If you have a supported Chromebook, choose Y or M here.
The module will be called cros_ec_dev.
  
+config MFD_MADERA

+   tristate "Cirrus Logic Madera codecs"
+   select MFD_CORE
+   select REGMAP
+   select REGMAP_IRQ
+   select MADERA_IRQ
+   select PINCTRL
+   select PINCTRL_MADERA
+   help
+ Support for the Cirrus Logic Madera platform audio codecs
+
+config MFD_MADERA_I2C
+   tristate "Cirrus Logic Madera codecs with I2C"
+   depends on MFD_MADERA
+   depends on I2C
+   select REGMAP_I2C
+   help
+ Support for the Cirrus Logic Madera platform audio SoC
+ core functionality controlled via I2C.
+
+config MFD_MADERA_SPI
+   tristate "Cirrus Logic Madera codecs with SPI"
+   depends on MFD_MADERA
+   depends on SPI_MASTER
+   select REGMAP_SPI
+   help
+ Support for the Cirrus Logic Madera platform audio SoC
+ core functionality controlled via SPI.
+
  config MFD_ASIC3
bool "Compaq ASIC3"
depends on GPIOLIB && ARM
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index e9fd20dba18d..db9ee6d24d91 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -72,6 +72,11 @@ wm8994-objs  := wm8994-core.o wm8994-irq.o 
wm8994-regmap.o
  obj-$(CONFIG_MFD_WM8994)  += wm8994.o
  obj-$(CONFIG_MFD_WM97xx)  += wm97xx-core.o
  
+madera-objs			:= madera-core.o

+obj-$(CONFIG_MFD_MADERA)   += madera.o
+obj-$(CONFIG_MFD_MADERA_I2C)   += madera-i2c.o
+obj-$(CONFIG_MFD_MADERA_SPI)   += madera-spi.o
+
  obj-$(CONFIG_TPS6105X)+= tps6105x.o
  obj-$(CONFIG_TPS65010)+= tps65010.o
  obj-$(CONFIG_TPS6507X)  

Re: [PATCH v9 3/9] mfd: madera: Add common support for Cirrus Logic Madera codecs

2018-04-16 Thread Richard Fitzgerald

On 28/03/18 10:00, Lee Jones wrote:

On Tue, 13 Mar 2018, Richard Fitzgerald wrote:


This adds the generic core support for Cirrus Logic "Madera" class codecs.
These are complex audio codec SoCs with a variety of digital and analogue
I/O, onboard audio processing and DSPs, and other features.

These codecs are all based off a common set of hardware IP so can be
supported by a core of common code (with a few minor device-to-device
variations).

Signed-off-by: Charles Keepax 
Signed-off-by: Nikesh Oswal 
Signed-off-by: Richard Fitzgerald 
---
There have been various smallish changes since Lee acked this patch so I have
decided to err on the side of caution and remove the Ack in case Lee might have
some comments about the current state of the code.

Cumulative changes since Lee acked it:
- changed to use gpiod for all reset code - affects 
madera_[enable|disable]_hard_reset,
   madera_get_reset_gpio, madera_dev_init
- use of_device_get_match_data in the spi and i2c probes
- use __maybe_unused on the pm runtime functions instead of a #ifdef
- don't put comma after {} list terminators
- commented why we don't use the devm version of mfd_add_devices
- don't use regulator_get_exclusive, it fails in the legitimate case of having 
the same
   regulator supply multiple chip supplies
- the core driver can now be built as a module
- minor Kconfig change to make the SPI/I2C submodules depend on the core module
 as this gives a more user-friendly menuconfig
- changed the irqchip and codec pdata to be a pointer to remove the build 
dependency
 so we can submit this patch without the irqchip and codec driver patches
- SPDX license headers
---
  MAINTAINERS  |   3 +
  drivers/mfd/Kconfig  |  29 ++
  drivers/mfd/Makefile |   5 +
  drivers/mfd/madera-core.c| 600 +++
  drivers/mfd/madera-i2c.c | 139 +
  drivers/mfd/madera-spi.c | 138 +
  drivers/mfd/madera.h |  44 +++
  include/linux/mfd/madera/core.h  | 187 
  include/linux/mfd/madera/pdata.h |  63 
  9 files changed, 1208 insertions(+)
  create mode 100644 drivers/mfd/madera-core.c
  create mode 100644 drivers/mfd/madera-i2c.c
  create mode 100644 drivers/mfd/madera-spi.c
  create mode 100644 drivers/mfd/madera.h
  create mode 100644 include/linux/mfd/madera/core.h
  create mode 100644 include/linux/mfd/madera/pdata.h

diff --git a/MAINTAINERS b/MAINTAINERS
index 40d78683a53f..f7ea1a47496c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3498,7 +3498,10 @@ L:   patc...@opensource.cirrus.com
  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:include/linux/mfd/madera/*
+F: drivers/mfd/madera*
+F: drivers/mfd/cs47l*
  
  CLEANCACHE API

  M:Konrad Rzeszutek Wilk 
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index b860eb5aa194..f5ca392f8bc2 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -232,6 +232,35 @@ config MFD_CROS_EC_CHARDEV
If you have a supported Chromebook, choose Y or M here.
The module will be called cros_ec_dev.
  
+config MFD_MADERA

+   tristate "Cirrus Logic Madera codecs"
+   select MFD_CORE
+   select REGMAP
+   select REGMAP_IRQ
+   select MADERA_IRQ
+   select PINCTRL
+   select PINCTRL_MADERA
+   help
+ Support for the Cirrus Logic Madera platform audio codecs
+
+config MFD_MADERA_I2C
+   tristate "Cirrus Logic Madera codecs with I2C"
+   depends on MFD_MADERA
+   depends on I2C
+   select REGMAP_I2C
+   help
+ Support for the Cirrus Logic Madera platform audio SoC
+ core functionality controlled via I2C.
+
+config MFD_MADERA_SPI
+   tristate "Cirrus Logic Madera codecs with SPI"
+   depends on MFD_MADERA
+   depends on SPI_MASTER
+   select REGMAP_SPI
+   help
+ Support for the Cirrus Logic Madera platform audio SoC
+ core functionality controlled via SPI.
+
  config MFD_ASIC3
bool "Compaq ASIC3"
depends on GPIOLIB && ARM
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index e9fd20dba18d..db9ee6d24d91 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -72,6 +72,11 @@ wm8994-objs  := wm8994-core.o wm8994-irq.o 
wm8994-regmap.o
  obj-$(CONFIG_MFD_WM8994)  += wm8994.o
  obj-$(CONFIG_MFD_WM97xx)  += wm97xx-core.o
  
+madera-objs			:= madera-core.o

+obj-$(CONFIG_MFD_MADERA)   += madera.o
+obj-$(CONFIG_MFD_MADERA_I2C)   += madera-i2c.o
+obj-$(CONFIG_MFD_MADERA_SPI)   += madera-spi.o
+
  obj-$(CONFIG_TPS6105X)+= tps6105x.o
  obj-$(CONFIG_TPS65010)+= tps65010.o
  obj-$(CONFIG_TPS6507X)+= tps6507x.o
diff --git a/drivers/mfd/madera-core.c b/drivers/mfd/madera-core.c
new file 

Re: [PATCH v9 3/9] mfd: madera: Add common support for Cirrus Logic Madera codecs

2018-03-28 Thread Lee Jones
On Tue, 13 Mar 2018, Richard Fitzgerald wrote:

> This adds the generic core support for Cirrus Logic "Madera" class codecs.
> These are complex audio codec SoCs with a variety of digital and analogue
> I/O, onboard audio processing and DSPs, and other features.
> 
> These codecs are all based off a common set of hardware IP so can be
> supported by a core of common code (with a few minor device-to-device
> variations).
> 
> Signed-off-by: Charles Keepax 
> Signed-off-by: Nikesh Oswal 
> Signed-off-by: Richard Fitzgerald 
> ---
> There have been various smallish changes since Lee acked this patch so I have
> decided to err on the side of caution and remove the Ack in case Lee might 
> have
> some comments about the current state of the code.
> 
> Cumulative changes since Lee acked it:
> - changed to use gpiod for all reset code - affects 
> madera_[enable|disable]_hard_reset,
>   madera_get_reset_gpio, madera_dev_init
> - use of_device_get_match_data in the spi and i2c probes
> - use __maybe_unused on the pm runtime functions instead of a #ifdef
> - don't put comma after {} list terminators
> - commented why we don't use the devm version of mfd_add_devices
> - don't use regulator_get_exclusive, it fails in the legitimate case of 
> having the same
>   regulator supply multiple chip supplies
> - the core driver can now be built as a module
> - minor Kconfig change to make the SPI/I2C submodules depend on the core 
> module
> as this gives a more user-friendly menuconfig
> - changed the irqchip and codec pdata to be a pointer to remove the build 
> dependency
> so we can submit this patch without the irqchip and codec driver patches
> - SPDX license headers
> ---
>  MAINTAINERS  |   3 +
>  drivers/mfd/Kconfig  |  29 ++
>  drivers/mfd/Makefile |   5 +
>  drivers/mfd/madera-core.c| 600 
> +++
>  drivers/mfd/madera-i2c.c | 139 +
>  drivers/mfd/madera-spi.c | 138 +
>  drivers/mfd/madera.h |  44 +++
>  include/linux/mfd/madera/core.h  | 187 
>  include/linux/mfd/madera/pdata.h |  63 
>  9 files changed, 1208 insertions(+)
>  create mode 100644 drivers/mfd/madera-core.c
>  create mode 100644 drivers/mfd/madera-i2c.c
>  create mode 100644 drivers/mfd/madera-spi.c
>  create mode 100644 drivers/mfd/madera.h
>  create mode 100644 include/linux/mfd/madera/core.h
>  create mode 100644 include/linux/mfd/madera/pdata.h
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 40d78683a53f..f7ea1a47496c 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -3498,7 +3498,10 @@ L: patc...@opensource.cirrus.com
>  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:   include/linux/mfd/madera/*
> +F:   drivers/mfd/madera*
> +F:   drivers/mfd/cs47l*
>  
>  CLEANCACHE API
>  M:   Konrad Rzeszutek Wilk 
> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> index b860eb5aa194..f5ca392f8bc2 100644
> --- a/drivers/mfd/Kconfig
> +++ b/drivers/mfd/Kconfig
> @@ -232,6 +232,35 @@ config MFD_CROS_EC_CHARDEV
>If you have a supported Chromebook, choose Y or M here.
>The module will be called cros_ec_dev.
>  
> +config MFD_MADERA
> + tristate "Cirrus Logic Madera codecs"
> + select MFD_CORE
> + select REGMAP
> + select REGMAP_IRQ
> + select MADERA_IRQ
> + select PINCTRL
> + select PINCTRL_MADERA
> + help
> +   Support for the Cirrus Logic Madera platform audio codecs
> +
> +config MFD_MADERA_I2C
> + tristate "Cirrus Logic Madera codecs with I2C"
> + depends on MFD_MADERA
> + depends on I2C
> + select REGMAP_I2C
> + help
> +   Support for the Cirrus Logic Madera platform audio SoC
> +   core functionality controlled via I2C.
> +
> +config MFD_MADERA_SPI
> + tristate "Cirrus Logic Madera codecs with SPI"
> + depends on MFD_MADERA
> + depends on SPI_MASTER
> + select REGMAP_SPI
> + help
> +   Support for the Cirrus Logic Madera platform audio SoC
> +   core functionality controlled via SPI.
> +
>  config MFD_ASIC3
>   bool "Compaq ASIC3"
>   depends on GPIOLIB && ARM
> diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
> index e9fd20dba18d..db9ee6d24d91 100644
> --- a/drivers/mfd/Makefile
> +++ b/drivers/mfd/Makefile
> @@ -72,6 +72,11 @@ wm8994-objs:= wm8994-core.o 
> wm8994-irq.o wm8994-regmap.o
>  obj-$(CONFIG_MFD_WM8994) += wm8994.o
>  obj-$(CONFIG_MFD_WM97xx) += wm97xx-core.o
>  
> +madera-objs  := madera-core.o
> +obj-$(CONFIG_MFD_MADERA) += madera.o
> +obj-$(CONFIG_MFD_MADERA_I2C) += madera-i2c.o
> +obj-$(CONFIG_MFD_MADERA_SPI) += madera-spi.o
> +
>  

Re: [PATCH v9 3/9] mfd: madera: Add common support for Cirrus Logic Madera codecs

2018-03-28 Thread Lee Jones
On Tue, 13 Mar 2018, Richard Fitzgerald wrote:

> This adds the generic core support for Cirrus Logic "Madera" class codecs.
> These are complex audio codec SoCs with a variety of digital and analogue
> I/O, onboard audio processing and DSPs, and other features.
> 
> These codecs are all based off a common set of hardware IP so can be
> supported by a core of common code (with a few minor device-to-device
> variations).
> 
> Signed-off-by: Charles Keepax 
> Signed-off-by: Nikesh Oswal 
> Signed-off-by: Richard Fitzgerald 
> ---
> There have been various smallish changes since Lee acked this patch so I have
> decided to err on the side of caution and remove the Ack in case Lee might 
> have
> some comments about the current state of the code.
> 
> Cumulative changes since Lee acked it:
> - changed to use gpiod for all reset code - affects 
> madera_[enable|disable]_hard_reset,
>   madera_get_reset_gpio, madera_dev_init
> - use of_device_get_match_data in the spi and i2c probes
> - use __maybe_unused on the pm runtime functions instead of a #ifdef
> - don't put comma after {} list terminators
> - commented why we don't use the devm version of mfd_add_devices
> - don't use regulator_get_exclusive, it fails in the legitimate case of 
> having the same
>   regulator supply multiple chip supplies
> - the core driver can now be built as a module
> - minor Kconfig change to make the SPI/I2C submodules depend on the core 
> module
> as this gives a more user-friendly menuconfig
> - changed the irqchip and codec pdata to be a pointer to remove the build 
> dependency
> so we can submit this patch without the irqchip and codec driver patches
> - SPDX license headers
> ---
>  MAINTAINERS  |   3 +
>  drivers/mfd/Kconfig  |  29 ++
>  drivers/mfd/Makefile |   5 +
>  drivers/mfd/madera-core.c| 600 
> +++
>  drivers/mfd/madera-i2c.c | 139 +
>  drivers/mfd/madera-spi.c | 138 +
>  drivers/mfd/madera.h |  44 +++
>  include/linux/mfd/madera/core.h  | 187 
>  include/linux/mfd/madera/pdata.h |  63 
>  9 files changed, 1208 insertions(+)
>  create mode 100644 drivers/mfd/madera-core.c
>  create mode 100644 drivers/mfd/madera-i2c.c
>  create mode 100644 drivers/mfd/madera-spi.c
>  create mode 100644 drivers/mfd/madera.h
>  create mode 100644 include/linux/mfd/madera/core.h
>  create mode 100644 include/linux/mfd/madera/pdata.h
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 40d78683a53f..f7ea1a47496c 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -3498,7 +3498,10 @@ L: patc...@opensource.cirrus.com
>  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:   include/linux/mfd/madera/*
> +F:   drivers/mfd/madera*
> +F:   drivers/mfd/cs47l*
>  
>  CLEANCACHE API
>  M:   Konrad Rzeszutek Wilk 
> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> index b860eb5aa194..f5ca392f8bc2 100644
> --- a/drivers/mfd/Kconfig
> +++ b/drivers/mfd/Kconfig
> @@ -232,6 +232,35 @@ config MFD_CROS_EC_CHARDEV
>If you have a supported Chromebook, choose Y or M here.
>The module will be called cros_ec_dev.
>  
> +config MFD_MADERA
> + tristate "Cirrus Logic Madera codecs"
> + select MFD_CORE
> + select REGMAP
> + select REGMAP_IRQ
> + select MADERA_IRQ
> + select PINCTRL
> + select PINCTRL_MADERA
> + help
> +   Support for the Cirrus Logic Madera platform audio codecs
> +
> +config MFD_MADERA_I2C
> + tristate "Cirrus Logic Madera codecs with I2C"
> + depends on MFD_MADERA
> + depends on I2C
> + select REGMAP_I2C
> + help
> +   Support for the Cirrus Logic Madera platform audio SoC
> +   core functionality controlled via I2C.
> +
> +config MFD_MADERA_SPI
> + tristate "Cirrus Logic Madera codecs with SPI"
> + depends on MFD_MADERA
> + depends on SPI_MASTER
> + select REGMAP_SPI
> + help
> +   Support for the Cirrus Logic Madera platform audio SoC
> +   core functionality controlled via SPI.
> +
>  config MFD_ASIC3
>   bool "Compaq ASIC3"
>   depends on GPIOLIB && ARM
> diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
> index e9fd20dba18d..db9ee6d24d91 100644
> --- a/drivers/mfd/Makefile
> +++ b/drivers/mfd/Makefile
> @@ -72,6 +72,11 @@ wm8994-objs:= wm8994-core.o 
> wm8994-irq.o wm8994-regmap.o
>  obj-$(CONFIG_MFD_WM8994) += wm8994.o
>  obj-$(CONFIG_MFD_WM97xx) += wm97xx-core.o
>  
> +madera-objs  := madera-core.o
> +obj-$(CONFIG_MFD_MADERA) += madera.o
> +obj-$(CONFIG_MFD_MADERA_I2C) += madera-i2c.o
> +obj-$(CONFIG_MFD_MADERA_SPI) += madera-spi.o
> +
>  obj-$(CONFIG_TPS6105X)   += tps6105x.o
>  obj-$(CONFIG_TPS65010)   += tps65010.o
>