Add support for Cirrus Logic CS47L35/L85/L90/L91 codecs
Subsystems (11)
v7 cover Add support for Cirrus Logic CS47L35/L85/L90/L91 codecs
IMPORTANT: These patches have to be submitted as an atomic block because of build interdependencies so you'll need to agree who is going to take them all through a branch.
The Cirrus Logic CS47L35, CS47L85, CS47L90/91 codecs are complex audio SoC devices. In addition to the core audio capability they have onboard GPIO, regulators, DSPs and interrupt controller and a large register map space accessed over SPI or I2C. This family of codecs is based around common IP blocks and they are managed by a set of common drivers referred to as "Madera".
Patches still waiting for review/ack:
#7-8 regulator
#9 irqchip
#14-17 ASoC
Richard Fitzgerald (17):
mfd: madera: Add register definitions for Cirrus Logic Madera codecs
mfd: madera: Add DT bindings for Cirrus Logic Madera codecs
mfd: madera: Add common support for Cirrus Logic Madera codecs
mfd: madera: Register map tables for Cirrus Logic CS47L35
mfd: madera: Register map tables for Cirrus Logic CS47L85
mfd: madera: Register map tables for Cirrus Logic CS47L90/91
regulator: arizona-micsupp: Add support for Cirrus Logic Madera codecs
regulator: arizona-ldo1: Add support for Cirrus Logic Madera codecs
irqchip: Add driver for Cirrus Logic Madera codecs
pinctrl: madera: Add DT bindings for Cirrus Logic Madera codecs
pinctrl: madera: Add driver for Cirrus Logic Madera codecs
gpio: madera: Support Cirrus Logic Madera class codecs
ASoC: madera: Add DT bindings for Cirrus Logic Madera codecs
ASoC: madera: Add common support for Cirrus Logic Madera codecs
ASoC: cs47l35: Add codec driver for Cirrus Logic CS47L35
ASoC: cs47l85: Add codec driver for Cirrus Logic CS47L85
ASoC: cs47l90: Add codec driver for Cirrus Logic CS47L90
Documentation/devicetree/bindings/mfd/madera.txt | 102 + .../bindings/pinctrl/cirrus,madera-pinctrl.txt | 99 + .../bindings/regulator/arizona-regulator.txt | 3 +- Documentation/devicetree/bindings/sound/madera.txt | 67 + MAINTAINERS | 23 + drivers/gpio/Kconfig | 6 + drivers/gpio/Makefile | 1 + drivers/gpio/gpio-madera.c | 196 + drivers/irqchip/Kconfig | 3 + drivers/irqchip/Makefile | 1 + drivers/irqchip/irq-madera.c | 301 ++ drivers/mfd/Kconfig | 48 + drivers/mfd/Makefile | 13 + drivers/mfd/cs47l35-tables.c | 1610 +++++++ drivers/mfd/cs47l85-tables.c | 3010 +++++++++++++ drivers/mfd/cs47l90-tables.c | 2675 ++++++++++++ drivers/mfd/madera-core.c | 599 +++ drivers/mfd/madera-i2c.c | 140 + drivers/mfd/madera-spi.c | 139 + drivers/mfd/madera.h | 44 + drivers/pinctrl/Kconfig | 1 + drivers/pinctrl/Makefile | 1 + drivers/pinctrl/cirrus/Kconfig | 15 + drivers/pinctrl/cirrus/Makefile | 11 + drivers/pinctrl/cirrus/pinctrl-cs47l35.c | 46 + drivers/pinctrl/cirrus/pinctrl-cs47l85.c | 60 + drivers/pinctrl/cirrus/pinctrl-cs47l90.c | 58 + drivers/pinctrl/cirrus/pinctrl-madera.c | 1074 +++++ drivers/pinctrl/cirrus/pinctrl-madera.h | 40 + drivers/regulator/Kconfig | 15 +- drivers/regulator/arizona-ldo1.c | 82 +- drivers/regulator/arizona-micsupp.c | 71 +- include/dt-bindings/sound/madera.h | 27 + include/linux/irqchip/irq-madera-pdata.h | 23 + include/linux/irqchip/irq-madera.h | 98 + include/linux/mfd/madera/core.h | 196 + include/linux/mfd/madera/pdata.h | 61 + include/linux/mfd/madera/registers.h | 3916 +++++++++++++++++ include/sound/madera-pdata.h | 61 + sound/soc/codecs/Kconfig | 23 + sound/soc/codecs/Makefile | 8 + sound/soc/codecs/cs47l35.c | 1671 ++++++++ sound/soc/codecs/cs47l85.c | 2677 ++++++++++++ sound/soc/codecs/cs47l90.c | 2651 ++++++++++++ sound/soc/codecs/madera.c | 4439 ++++++++++++++++++++ sound/soc/codecs/madera.h | 470 +++ 46 files changed, 26865 insertions(+), 10 deletions(-) create mode 100644 Documentation/devicetree/bindings/mfd/madera.txt create mode 100644 Documentation/devicetree/bindings/pinctrl/cirrus,madera-pinctrl.txt create mode 100644 Documentation/devicetree/bindings/sound/madera.txt create mode 100644 drivers/gpio/gpio-madera.c create mode 100644 drivers/irqchip/irq-madera.c create mode 100644 drivers/mfd/cs47l35-tables.c create mode 100644 drivers/mfd/cs47l85-tables.c create mode 100644 drivers/mfd/cs47l90-tables.c 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 drivers/pinctrl/cirrus/Kconfig create mode 100644 drivers/pinctrl/cirrus/Makefile create mode 100644 drivers/pinctrl/cirrus/pinctrl-cs47l35.c create mode 100644 drivers/pinctrl/cirrus/pinctrl-cs47l85.c create mode 100644 drivers/pinctrl/cirrus/pinctrl-cs47l90.c create mode 100644 drivers/pinctrl/cirrus/pinctrl-madera.c create mode 100644 drivers/pinctrl/cirrus/pinctrl-madera.h create mode 100644 include/dt-bindings/sound/madera.h create mode 100644 include/linux/irqchip/irq-madera-pdata.h create mode 100644 include/linux/irqchip/irq-madera.h create mode 100644 include/linux/mfd/madera/core.h create mode 100644 include/linux/mfd/madera/pdata.h create mode 100644 include/linux/mfd/madera/registers.h create mode 100644 include/sound/madera-pdata.h create mode 100644 sound/soc/codecs/cs47l35.c create mode 100644 sound/soc/codecs/cs47l85.c create mode 100644 sound/soc/codecs/cs47l90.c create mode 100644 sound/soc/codecs/madera.c create mode 100644 sound/soc/codecs/madera.h
Signature · 1 line
2.11.0
PATCH v7 1/17 mfd: madera: Add register definitions for Cirrus Logic Madera codecs
This patch adds a header file of register definitions for Cirrus Logic "Madera" class codecs. These codecs are all based off a common set of hardware IP so have a common register map (with a few minor device-to-device variations).
The registers.h file is tool-generated directly from the hardware design but has been manually stripped down to reduce size (full register map is >44000 lines). All names are kept the same as datasheet names so that they can be cross-referenced between source and datasheet without confusion.
The register map layout is kept fully-defined rather than factored into macros and/or block-indexing code. The major reasons for this are:
- #1 is that it makes the source highly greppable, which is important. "What does the driver do with register bits XYZ" or "Where does it use register bits XYZ" are commonly types of questions. These can be quickly answered by a grep. Squashing definitions into generator macros or block- indexing code is a way of defeating grep.
- most of the register definitions are used in tables, so a constant value is required. Using generator macros make the table definition clunky and obscure.
- the code is clearer when it's there in the source exactly what register and field it is using
- it is easier to diff the register map of a new (unsupported) codec against what is already supported and merge in differences
- it makes the register map available in source for maintenance/debugging instead of having to refer back to the datasheet for a register map
--- MAINTAINERS | 10 + include/linux/mfd/madera/registers.h | 3916 ++++++++++++++++++++++++++++++++++ 2 files changed, 3926 insertions(+) create mode 100644 include/linux/mfd/madera/registers.h
MAINTAINERS +10 -0
@@ -3487,6 +3487,16 @@ M: Dave Goodell <[email protected]> S: Supported F: drivers/infiniband/hw/usnic/ +CIRRUS LOGIC MADERA CODEC DRIVERS +M: Charles Keepax <[email protected]> +M: Richard Fitzgerald <[email protected]> +L: [email protected] (moderated for non-subscribers) +L: [email protected] +T: git https://github.com/CirrusLogic/linux-drivers.git +W: https://github.com/CirrusLogic/linux-drivers/wiki +S: Supported +F: include/linux/mfd/madera/* + CLEANCACHE API M: Konrad Rzeszutek Wilk <[email protected]> L: [email protected]
include/linux/mfd/madera/registers.h new file +3916 -0
2,984 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.11.0
Part of the diff is not shown here. View the raw message.
PATCH v7 2/17 mfd: madera: Add DT bindings for Cirrus Logic Madera codecs
In reply to Richard FitzgeraldSpecification of the bindings for the parent MFD driver component of the Cirrus Logic Madera codec drivers.
Note that although the interrupt controller and GPIO are child drivers their required bindings are trivial, mandatory, and exist within the parent MFD node so are documented here.
--- Documentation/devicetree/bindings/mfd/madera.txt | 102 +++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/madera.txt
Documentation/devicetree/bindings/mfd/madera.txt new file +102 -0
@@ -0,0 +1,102 @@ +Cirrus Logic Madera class audio codecs Multi-Functional Device + +These devices are audio SoCs with extensive digital capabilities and a range +of analogue I/O. + +See also the child driver bindings in: +bindings/pinctrl/cirrus,madera-pinctrl.txt +bindings/regulator/arizona-regulator.txt +bindings/sound/madera.txt + +Required properties: + + - compatible : One of the following chip-specific strings: + "cirrus,cs47l35" + "cirrus,cs47l85" + "cirrus,cs47l90" + "cirrus,cs47l91" + "cirrus,wm1840" + + - reg : I2C slave address when connected using I2C, chip select number when + using SPI. + + - DCVDD-supply : Power supply for the device as defined in + bindings/regulator/regulator.txt + Mandatory on CS47L35, CS47L90, CS47L91 + Optional on CS47L85, WM1840 + + - AVDD-supply, DBVDD1-supply, DBVDD2-supply, CPVDD1-supply, CPVDD2-supply : + Power supplies for the device + + - DBVDD3-supply, DBVDD4-supply : Power supplies for the device + (CS47L85, CS47L90, CS47L91, WM1840) + + - SPKVDDL-supply, SPKVDDR-supply : Power supplies for the device + (CS47L85, WM1840) + + - SPKVDD-supply : Power supply for the device + (CS47L35) + + - interrupt-controller : Indicates that this device is an interrupt controller + + - #interrupt-cells: the number of cells to describe an IRQ, must be 2. + The first cell is the IRQ number. + The second cell is the flags, encoded as the trigger masks from + bindings/interrupt-controller/interrupts.txt + + - gpio-controller : Indicates this device is a GPIO controller. + + - #gpio-cells : Must be 2. The first cell is the pin number. The second cell + is reserved for future use and must be zero + + - interrupt-parent : The parent interrupt controller. + + - interrupts : The interrupt line the /IRQ signal for the device is + connected to. + +Optional properties: + + - MICVDD-supply : Power supply, only need to be specified if + powered externally + + - reset-gpios : One entry specifying the GPIO controlling /RESET. + As defined in bindings/gpio.txt. + Although optional, it is strongly recommended to use a hardware reset + + - MICBIASx : Initial data for the MICBIAS regulators, as covered in + Documentation/devicetree/bindings/regulator/regulator.txt. + One for each MICBIAS generator (MICBIAS1, MICBIAS2, ...) + (all codecs) + + One for each output pin (MICBIAS1A, MIBCIAS1B, MICBIAS2A, ...) + (all except CS47L85, WM1840) + + The following following additional property is supported for the generator + nodes: + - cirrus,ext-cap : Set to 1 if the MICBIAS has external decoupling + capacitors attached. + +Optional child nodes: + micvdd : Node containing initialization data for the micvdd regulator + See bindings/regulator/arizona-regulator.txt + + ldo1 : Node containing initialization data for the LDO1 regulator + See bindings/regulator/arizona-regulator.txt + (cs47l85, wm1840) + +Example: + +cs47l85@0 { + compatible = "cirrus,cs47l85"; + reg = <0>; + + reset-gpios = <&gpio 0>; + + interrupt-controller; + #interrupt-cells = <2>; + interrupts = <&host_irq1>; + interrupt-parent = <&gic>; + + gpio-controller; + #gpio-cells = <2>; +};
Signature · 1 line
2.11.0
PATCH v7 3/17 mfd: madera: Add common support for Cirrus Logic Madera codecs
In reply to Richard FitzgeraldThis 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).
--- MAINTAINERS | 3 + drivers/mfd/Kconfig | 27 ++ drivers/mfd/Makefile | 4 + drivers/mfd/madera-core.c | 599 +++++++++++++++++++++++++++++++++++++++ drivers/mfd/madera-i2c.c | 140 +++++++++ drivers/mfd/madera-spi.c | 139 +++++++++ drivers/mfd/madera.h | 44 +++ include/linux/mfd/madera/core.h | 196 +++++++++++++ include/linux/mfd/madera/pdata.h | 61 ++++ 9 files changed, 1213 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
MAINTAINERS +3 -0
@@ -3495,7 +3495,10 @@ L: [email protected] 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 <[email protected]>
drivers/mfd/Kconfig +27 -0
@@ -232,6 +232,33 @@ 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 + bool + select MFD_CORE + select REGMAP + select REGMAP_IRQ + select MADERA_IRQ + +config MFD_MADERA_I2C + bool "Cirrus Logic Madera codecs with I2C" + select MFD_MADERA + select REGMAP_I2C + select PINCTRL + depends on I2C + help + Support for the Cirrus Logic Madera platform audio SoC + core functionality controlled via I2C. + +config MFD_MADERA_SPI + bool "Cirrus Logic Madera codecs with SPI" + select MFD_MADERA + select REGMAP_SPI + select PINCTRL + depends on SPI_MASTER + 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
drivers/mfd/Makefile +4 -0
@@ -73,6 +73,10 @@ wm8994-objs := wm8994-core.o wm8994-irq.o wm8994-regmap.o obj-$(CONFIG_MFD_WM8994) += wm8994.o obj-$(CONFIG_MFD_WM97xx) += wm97xx-core.o +obj-$(CONFIG_MFD_MADERA) += madera-core.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
drivers/mfd/madera-core.c new file +599 -0
599 lines not on this page · raw message
drivers/mfd/madera-i2c.c new file +140 -0
140 lines not on this page · raw message
drivers/mfd/madera-spi.c new file +139 -0
139 lines not on this page · raw message
drivers/mfd/madera.h new file +44 -0
44 lines not on this page · raw message
include/linux/mfd/madera/core.h new file +196 -0
196 lines not on this page · raw message
include/linux/mfd/madera/pdata.h new file +61 -0
61 lines not on this page · raw message
Signature · 1 line
2.11.0
PATCH v7 4/17 mfd: madera: Register map tables for Cirrus Logic CS47L35
In reply to Richard FitzgeraldRegmap configuration tables for Cirrus Logic CS47L35 codecs.
--- drivers/mfd/Kconfig | 7 + drivers/mfd/Makefile | 3 + drivers/mfd/cs47l35-tables.c | 1610 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 1620 insertions(+) create mode 100644 drivers/mfd/cs47l35-tables.c
drivers/mfd/Kconfig +7 -0
@@ -259,6 +259,13 @@ config MFD_MADERA_SPI Support for the Cirrus Logic Madera platform audio SoC core functionality controlled via SPI. +config MFD_CS47L35 + bool "Cirrus Logic CS47L35" + select PINCTRL_CS47L35 + depends on MFD_MADERA + help + Support for Cirrus Logic CS47L35 Smart Codec + config MFD_ASIC3 bool "Compaq ASIC3" depends on GPIOLIB && ARM
drivers/mfd/Makefile +3 -0
@@ -74,6 +74,9 @@ obj-$(CONFIG_MFD_WM8994) += wm8994.o obj-$(CONFIG_MFD_WM97xx) += wm97xx-core.o obj-$(CONFIG_MFD_MADERA) += madera-core.o +ifeq ($(CONFIG_MFD_CS47L35),y) +obj-$(CONFIG_MFD_MADERA) += cs47l35-tables.o +endif obj-$(CONFIG_MFD_MADERA_I2C) += madera-i2c.o obj-$(CONFIG_MFD_MADERA_SPI) += madera-spi.o
drivers/mfd/cs47l35-tables.c new file +1610 -0
1,610 lines not on this page · raw message
Signature · 1 line
2.11.0
PATCH v7 5/17 mfd: madera: Register map tables for Cirrus Logic CS47L85
In reply to Richard FitzgeraldRegmap configuration tables for Cirrus Logic CS47L85 codecs.
--- drivers/mfd/Kconfig | 7 + drivers/mfd/Makefile | 3 + drivers/mfd/cs47l85-tables.c | 3010 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 3020 insertions(+) create mode 100644 drivers/mfd/cs47l85-tables.c
drivers/mfd/Kconfig +7 -0
@@ -266,6 +266,13 @@ config MFD_CS47L35 help Support for Cirrus Logic CS47L35 Smart Codec +config MFD_CS47L85 + bool "Cirrus Logic CS47L85" + select PINCTRL_CS47L85 + depends on MFD_MADERA + help + Support for Cirrus Logic CS47L85 Smart Codec + config MFD_ASIC3 bool "Compaq ASIC3" depends on GPIOLIB && ARM
drivers/mfd/Makefile +3 -0
@@ -77,6 +77,9 @@ obj-$(CONFIG_MFD_MADERA) += madera-core.o ifeq ($(CONFIG_MFD_CS47L35),y) obj-$(CONFIG_MFD_MADERA) += cs47l35-tables.o endif +ifeq ($(CONFIG_MFD_CS47L85),y) +obj-$(CONFIG_MFD_MADERA) += cs47l85-tables.o +endif obj-$(CONFIG_MFD_MADERA_I2C) += madera-i2c.o obj-$(CONFIG_MFD_MADERA_SPI) += madera-spi.o
drivers/mfd/cs47l85-tables.c new file +3010 -0
2,978 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.11.0
Part of the diff is not shown here. View the raw message.
PATCH v7 6/17 mfd: madera: Register map tables for Cirrus Logic CS47L90/91
In reply to Richard FitzgeraldRegmap configuration tables for Cirrus Logic CS47L90 and CS47L91 codecs.
--- drivers/mfd/Kconfig | 7 + drivers/mfd/Makefile | 3 + drivers/mfd/cs47l90-tables.c | 2675 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 2685 insertions(+) create mode 100644 drivers/mfd/cs47l90-tables.c
drivers/mfd/Kconfig +7 -0
@@ -273,6 +273,13 @@ config MFD_CS47L85 help Support for Cirrus Logic CS47L85 Smart Codec +config MFD_CS47L90 + bool "Cirrus Logic CS47L90/91" + select PINCTRL_CS47L90 + depends on MFD_MADERA + help + Support for Cirrus Logic CS47L90 and CS47L91 Smart Codecs + config MFD_ASIC3 bool "Compaq ASIC3" depends on GPIOLIB && ARM
drivers/mfd/Makefile +3 -0
@@ -80,6 +80,9 @@ endif ifeq ($(CONFIG_MFD_CS47L85),y) obj-$(CONFIG_MFD_MADERA) += cs47l85-tables.o endif +ifeq ($(CONFIG_MFD_CS47L90),y) +obj-$(CONFIG_MFD_MADERA) += cs47l90-tables.o +endif obj-$(CONFIG_MFD_MADERA_I2C) += madera-i2c.o obj-$(CONFIG_MFD_MADERA_SPI) += madera-spi.o
drivers/mfd/cs47l90-tables.c new file +2675 -0
2,675 lines not on this page · raw message
Signature · 1 line
2.11.0
PATCH v7 7/17 regulator: arizona-micsupp: Add support for Cirrus Logic Madera codecs
In reply to Richard FitzgeraldThis adds a new driver identity "madera-micsupp" and probe function so that this driver can be used to control the micsupp regulator on Cirrus Logic Madera codecs.
--- .../bindings/regulator/arizona-regulator.txt | 3 +- drivers/regulator/Kconfig | 7 ++- drivers/regulator/arizona-micsupp.c | 71 +++++++++++++++++++++- 3 files changed, 76 insertions(+), 5 deletions(-)
Documentation/devicetree/bindings/regulator/arizona-regulator.txt +2 -1
@@ -5,7 +5,8 @@ of analogue I/O. This document lists regulator specific bindings, see the primary binding document: - ../mfd/arizona.txt + For Wolfson Arizona codecs: ../mfd/arizona.txt + For Cirrus Logic Madera codecs: ../mfd/madera.txt Optional properties: - wlf,ldoena : GPIO specifier for the GPIO controlling LDOENA
drivers/regulator/Kconfig +4 -3
@@ -134,11 +134,12 @@ config REGULATOR_ARIZONA_LDO1 devices. config REGULATOR_ARIZONA_MICSUPP - tristate "Wolfson Arizona class devices MICSUPP" - depends on MFD_ARIZONA + tristate "Cirrus Madera and Wolfson Arizona class devices MICSUPP" + depends on MFD_ARIZONA || MFD_MADERA depends on SND_SOC help - Support for the MICSUPP regulators found on Wolfson Arizona class + Support for the MICSUPP regulators found on Cirrus Logic Madera codecs + and Wolfson Arizona codecs devices. config REGULATOR_AS3711
drivers/regulator/arizona-micsupp.c +70 -1
98 lines not on this page · raw message
Signature · 1 line
2.11.0
PATCH v7 8/17 regulator: arizona-ldo1: Add support for Cirrus Logic Madera codecs
In reply to Richard FitzgeraldThis adds a new driver identity "madera-ldo1" and probe function so that this driver can be used to control the LDO1 regulator on some Cirrus Logic Madera codecs.
--- drivers/regulator/Kconfig | 8 ++-- drivers/regulator/arizona-ldo1.c | 82 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 85 insertions(+), 5 deletions(-)
drivers/regulator/Kconfig +4 -4
@@ -126,12 +126,12 @@ config REGULATOR_AB8500 signal AB8500 PMIC config REGULATOR_ARIZONA_LDO1 - tristate "Wolfson Arizona class devices LDO1" - depends on MFD_ARIZONA + tristate "Cirrus Madera and Wolfson Arizona class devices LDO1" + depends on MFD_ARIZONA || MFD_MADERA depends on SND_SOC help - Support for the LDO1 regulators found on Wolfson Arizona class - devices. + Support for the LDO1 regulators found on Cirrus Logic Madera codecs + and Wolfson Arizona codecs. config REGULATOR_ARIZONA_MICSUPP tristate "Cirrus Madera and Wolfson Arizona class devices MICSUPP"
drivers/regulator/arizona-ldo1.c +81 -1
109 lines not on this page · raw message
Signature · 1 line
2.11.0
PATCH v7 9/17 irqchip: Add driver for Cirrus Logic Madera codecs
In reply to Richard FitzgeraldThe Cirrus Logic Madera codecs (Cirrus Logic CS47L35/85/90/91 and WM1840) are highly complex devices containing up to 7 programmable DSPs and many other internal sources of interrupts plus a number of GPIOs that can be used as interrupt inputs. The large number (>150) of internal interrupt sources are managed by an on-board interrupt controller.
This driver provides the handling for the interrupt controller. As the codec is accessed via regmap, we can make use of the generic IRQ functionality from regmap to do most of the work. Only around half of the possible interrupt source are currently of interest from the driver so only this subset is defined. Others can be added in future if needed.
The KConfig options are not user-configurable because this driver is mandatory so is automatically included when the parent MFD driver is selected.
--- MAINTAINERS | 2 + drivers/irqchip/Kconfig | 3 + drivers/irqchip/Makefile | 1 + drivers/irqchip/irq-madera.c | 301 +++++++++++++++++++++++++++++++ include/linux/irqchip/irq-madera-pdata.h | 23 +++ include/linux/irqchip/irq-madera.h | 98 ++++++++++ 6 files changed, 428 insertions(+) create mode 100644 drivers/irqchip/irq-madera.c create mode 100644 include/linux/irqchip/irq-madera-pdata.h create mode 100644 include/linux/irqchip/irq-madera.h
MAINTAINERS +2 -0
@@ -3496,7 +3496,9 @@ 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/irqchip/irq-madera* F: include/linux/mfd/madera/* +F: drivers/irqchip/irq-madera* F: drivers/mfd/madera* F: drivers/mfd/cs47l*
drivers/irqchip/Kconfig +3 -0
@@ -144,6 +144,9 @@ config IMGPDC_IRQ select GENERIC_IRQ_CHIP select IRQ_DOMAIN +config MADERA_IRQ + bool + config IRQ_MIPS_CPU bool select GENERIC_IRQ_CHIP
drivers/irqchip/Makefile +1 -0
@@ -17,6 +17,7 @@ obj-$(CONFIG_ARCH_S3C24XX) += irq-s3c24xx.o obj-$(CONFIG_DW_APB_ICTL) += irq-dw-apb-ictl.o obj-$(CONFIG_METAG) += irq-metag-ext.o obj-$(CONFIG_METAG_PERFCOUNTER_IRQS) += irq-metag.o +obj-$(CONFIG_MADERA_IRQ) += irq-madera.o obj-$(CONFIG_CLPS711X_IRQCHIP) += irq-clps711x.o obj-$(CONFIG_OMPIC) += irq-ompic.o obj-$(CONFIG_OR1K_PIC) += irq-or1k-pic.o
drivers/irqchip/irq-madera.c new file +301 -0
301 lines not on this page · raw message
include/linux/irqchip/irq-madera-pdata.h new file +23 -0
@@ -0,0 +1,23 @@ +/* +* Platform data for Cirrus Logic Madera codecs irqchip driver +* +* Copyright 2016-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. +*/ + +#ifndef IRQCHIP_MADERA_PDATA_H +#define IRQCHIP_MADERA_PDATA_H + +/** +* struct madera_irqchip_pdata - Configuration for Madera devices IRQ driver +* +* @irq_flags: Mode for primary IRQ (defaults to active low) +*/ +struct madera_irqchip_pdata { +unsigned int irq_flags; +}; + +#endif
include/linux/irqchip/irq-madera.h new file +98 -0
98 lines not on this page · raw message
Signature · 1 line
2.11.0
PATCH v7 10/17 pinctrl: madera: Add DT bindings for Cirrus Logic Madera codecs
In reply to Richard FitzgeraldThis is the binding description of the pinctrl driver for Cirru Logic Madera codecs. The binding uses the generic pinctrl binding so the main purpose here is to describe the device-specific names for groups and functions.
--- .../bindings/pinctrl/cirrus,madera-pinctrl.txt | 99 ++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 Documentation/devicetree/bindings/pinctrl/cirrus,madera-pinctrl.txt
Documentation/devicetree/bindings/pinctrl/cirrus,madera-pinctrl.txt new file +99 -0
@@ -0,0 +1,99 @@ +Cirrus Logic Madera class audio codecs pinctrl driver + +The Cirrus Logic Madera codecs provide a number of GPIO functions for +interfacing to external hardware and to provide logic outputs to other devices. +Certain groups of GPIO pins also have an alternate function, normally as an +audio interface. + +The set of available GPIOs, functions and alternate function groups differs +between codecs so refer to the datasheet for the codec for further information +on what is supported on that device. + +The properties for this driver exist within the parent MFD driver node. + +See also + the core bindings for the parent MFD driver: + Documentation/devicetree/bindings/mfd/madera.txt + + the generic pinmix bindings: + Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt + +Required properties of parent mfd node: + - pinctrl-names : must be "default" + - pinctrl-0 : a phandle to the node containing the subnodes containing default + configurations + +Required subnodes: + One subnode is required to contain the default settings. It contains an + arbitrary number of configuration subnodes, one for each group or pin + configuration you want to apply as a default. + +Required properties of configuration subnodes: + - groups : name of one pin group to configure. One of: + aif1, aif2, aif3, aif4, mif1, mif2, mif3, pdmspk1, pdmspk2, + dmic4, dmic5, dmic6, + gpio1, gpio2, ..., gpio40 + The gpioN groups select the single pin of this name for configuration + +Optional properties of configuration subnodes: + Any configuration option not explicitly listed in the dts will be left at + chip default setting. + + - function : name of function to assign to this group. One of: + aif1, aif2, aif3, aif4, mif1, mif2, mif3, pdmspk1, pdmspk2, + dmic3, dmic4, dmic5, dmic6, + io, dsp-gpio, irq1, irq2, + fll1-clk, fll1-lock, fll2-clk, fll2-lock, fll3-clk, fll3-lock, + fllao-clk, fllao-lock, + opclk, opclk-async, pwm1, pwm2, spdif, + asrc1-in1-lock, asrc1-in2-lock, asrc2-in1-lock, asrc2-in2-lock, + spkl-short-circuit, spkr-short-circuit, spk-shutdown, + spk-overheat-shutdown, spk-overheat-warn, + timer1-sts, timer2-sts, timer3-sts, timer4-sts, timer5-sts, timer6-sts, + timer7-sts, timer8-sts, + log1-fifo-ne, log2-fifo-ne, log3-fifo-ne, log4-fifo-ne, log5-fifo-ne, + log6-fifo-ne, log7-fifo-ne, log8-fifo-ne, + + - bias-disable : disable pull-up and pull-down + - bias-bus-hold : enable buskeeper + - bias-pull-up : output is pulled-up + - bias-pull-down : output is pulled-down + - drive-push-pull : CMOS output + - drive-open-drain : open-drain output + - drive-strength : drive strength in mA. Valid values are 4 or 8 + - input-schmitt-enable : enable schmitt-trigger mode + - input-schmitt-disable : disable schmitt-trigger mode + - input-debounce : A value of 0 disables debounce, a value !=0 enables + debounce + - output-low : set the pin to output mode with low level + - output-high : set the pin to output mode with high level + +Example: + +cs47l85@0 { + compatible = "cirrus,cs47l85"; + + pinctrl-names = "default"; + pinctrl-0 = <&cs47l85_defaults>; + + cs47l85_defaults: cs47l85-gpio-defaults { + aif1 { + groups = "aif1"; + function = "aif1"; + bias-bus-hold; + }; + + aif2 { + groups = "aif2"; + function = "aif2"; + bias-bus-hold; + }; + + opclk { + groups = "gpio1"; + function = "opclk"; + bias-pull-up; + drive-strength = <8>; + }; + }; +};
Signature · 1 line
2.11.0
PATCH v7 11/17 pinctrl: madera: Add driver for Cirrus Logic Madera codecs
In reply to Richard FitzgeraldThese codecs have a variable number of I/O lines each of which is individually selectable to a wide range of possible functions.
The functionality is slightly different from the traditional muxed GPIO since most of the functions can be mapped to any pin (and even the same function to multiple pins). Most pins have a dedicated "alternate" function that is only available on that pin. The alternate functions are usually a group of signals, though it is not always necessary to enable the full group, depending on the alternate function and how it is to be used. The mapping between alternate functions and GPIO pins varies between codecs depending on the number of alternate functions and available pins.
Note on the Kconfig options:
The formula "default y if..." is used for PINCTRL_MADERA so that its select options will be processed, allowing us to group selects for pinctrl into the pinctrl Kconfig where they logically belong instead of accumulating under the parent MFD Kconfig.
--- MAINTAINERS | 2 + drivers/pinctrl/Kconfig | 1 + drivers/pinctrl/Makefile | 1 + drivers/pinctrl/cirrus/Kconfig | 15 + drivers/pinctrl/cirrus/Makefile | 11 + drivers/pinctrl/cirrus/pinctrl-cs47l35.c | 46 ++ drivers/pinctrl/cirrus/pinctrl-cs47l85.c | 60 ++ drivers/pinctrl/cirrus/pinctrl-cs47l90.c | 58 ++ drivers/pinctrl/cirrus/pinctrl-madera.c | 1074 ++++++++++++++++++++++++++++++ drivers/pinctrl/cirrus/pinctrl-madera.h | 40 ++ 10 files changed, 1308 insertions(+) create mode 100644 drivers/pinctrl/cirrus/Kconfig create mode 100644 drivers/pinctrl/cirrus/Makefile create mode 100644 drivers/pinctrl/cirrus/pinctrl-cs47l35.c create mode 100644 drivers/pinctrl/cirrus/pinctrl-cs47l85.c create mode 100644 drivers/pinctrl/cirrus/pinctrl-cs47l90.c create mode 100644 drivers/pinctrl/cirrus/pinctrl-madera.c create mode 100644 drivers/pinctrl/cirrus/pinctrl-madera.h
MAINTAINERS +2 -0
@@ -3496,11 +3496,13 @@ 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/pinctrl/cirrus,madera-pinctrl.txt F: include/linux/irqchip/irq-madera* F: include/linux/mfd/madera/* F: drivers/irqchip/irq-madera* F: drivers/mfd/madera* F: drivers/mfd/cs47l* +F: drivers/pinctrl/cirrus/* CLEANCACHE API M: Konrad Rzeszutek Wilk <[email protected]>
drivers/pinctrl/Kconfig +1 -0
@@ -379,6 +379,7 @@ source "drivers/pinctrl/vt8500/Kconfig" source "drivers/pinctrl/mediatek/Kconfig" source "drivers/pinctrl/zte/Kconfig" source "drivers/pinctrl/meson/Kconfig" +source "drivers/pinctrl/cirrus/Kconfig" config PINCTRL_XWAY bool
drivers/pinctrl/Makefile +1 -0
@@ -67,3 +67,4 @@ obj-$(CONFIG_PINCTRL_UNIPHIER) += uniphier/ obj-$(CONFIG_ARCH_VT8500) += vt8500/ obj-y += mediatek/ obj-$(CONFIG_PINCTRL_ZX) += zte/ +obj-y += cirrus/
drivers/pinctrl/cirrus/Kconfig new file +15 -0
@@ -0,0 +1,15 @@ +config PINCTRL_MADERA + bool + select PINMUX + select GENERIC_PINCONF + default y if MFD_MADERA=y + +config PINCTRL_CS47L35 + bool + +config PINCTRL_CS47L85 + bool + +config PINCTRL_CS47L90 + bool +
drivers/pinctrl/cirrus/Makefile new file +11 -0
@@ -0,0 +1,11 @@ +# Cirrus Logic pinctrl drivers +obj-$(CONFIG_PINCTRL_MADERA) += pinctrl-madera.o +ifeq ($(CONFIG_PINCTRL_CS47L35),y) +obj-$(CONFIG_PINCTRL_MADERA) += pinctrl-cs47l35.o +endif +ifeq ($(CONFIG_PINCTRL_CS47L85),y) +obj-$(CONFIG_PINCTRL_MADERA) += pinctrl-cs47l85.o +endif +ifeq ($(CONFIG_PINCTRL_CS47L90),y) +obj-$(CONFIG_PINCTRL_MADERA) += pinctrl-cs47l90.o +endif
drivers/pinctrl/cirrus/pinctrl-cs47l35.c new file +46 -0
46 lines not on this page · raw message
drivers/pinctrl/cirrus/pinctrl-cs47l85.c new file +60 -0
60 lines not on this page · raw message
drivers/pinctrl/cirrus/pinctrl-cs47l90.c new file +58 -0
58 lines not on this page · raw message
drivers/pinctrl/cirrus/pinctrl-madera.c new file +1074 -0
1,074 lines not on this page · raw message
drivers/pinctrl/cirrus/pinctrl-madera.h new file +40 -0
@@ -0,0 +1,40 @@ +/* +* Pinctrl for Cirrus Logic Madera codecs +* +* Copyright 2016-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. +*/ + +#ifndef PINCTRL_MADERA_H +#define PINCTRL_MADERA_H + +struct madera_pin_groups { +const char *name; +const unsigned int *pins; +unsigned int n_pins; +}; + +struct madera_pin_chip { +unsigned int n_pins; + +const struct madera_pin_groups *pin_groups; +unsigned int n_pin_groups; +}; + +struct madera_pin_private { +struct madera *madera; + +const struct madera_pin_chip *chip;/* chip-specific groups */ + +struct device *dev; +struct pinctrl_dev *pctl; +}; + +extern const struct madera_pin_chip cs47l35_pin_chip; +extern const struct madera_pin_chip cs47l85_pin_chip; +extern const struct madera_pin_chip cs47l90_pin_chip; + +#endif
Signature · 1 line
2.11.0
PATCH v7 12/17 gpio: madera: Support Cirrus Logic Madera class codecs
In reply to Richard FitzgeraldThis adds support for the GPIOs on Cirrus Logic Madera class codecs. Any pins not used for special functions (see the pinctrl driver) can be used as general single-bit input or output lines. The number of available GPIOs varies between codecs.
--- MAINTAINERS | 1 + drivers/gpio/Kconfig | 6 ++ drivers/gpio/Makefile | 1 + drivers/gpio/gpio-madera.c | 196 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 204 insertions(+) create mode 100644 drivers/gpio/gpio-madera.c
MAINTAINERS +1 -0
@@ -3499,6 +3499,7 @@ F: Documentation/devicetree/bindings/mfd/madera.txt F: Documentation/devicetree/bindings/pinctrl/cirrus,madera-pinctrl.txt F: include/linux/irqchip/irq-madera* F: include/linux/mfd/madera/* +F: drivers/gpio/gpio-madera* F: drivers/irqchip/irq-madera* F: drivers/mfd/madera* F: drivers/mfd/cs47l*
drivers/gpio/Kconfig +6 -0
@@ -1003,6 +1003,12 @@ config GPIO_LP87565 This driver can also be built as a module. If so, the module will be called gpio-lp87565. +config GPIO_MADERA + bool "Cirrus Logic Madera class codecs" + depends on PINCTRL_MADERA + help + Support for GPIOs on Cirrus Logic Madera class codecs. + config GPIO_MAX77620 tristate "GPIO support for PMIC MAX77620 and MAX20024" depends on MFD_MAX77620
drivers/gpio/Makefile +1 -0
@@ -69,6 +69,7 @@ obj-$(CONFIG_ARCH_LPC32XX) += gpio-lpc32xx.o obj-$(CONFIG_GPIO_LP873X) += gpio-lp873x.o obj-$(CONFIG_GPIO_LP87565) += gpio-lp87565.o obj-$(CONFIG_GPIO_LYNXPOINT) += gpio-lynxpoint.o +obj-$(CONFIG_GPIO_MADERA) += gpio-madera.o obj-$(CONFIG_GPIO_MAX3191X) += gpio-max3191x.o obj-$(CONFIG_GPIO_MAX730X) += gpio-max730x.o obj-$(CONFIG_GPIO_MAX7300) += gpio-max7300.o
drivers/gpio/gpio-madera.c new file +196 -0
196 lines not on this page · raw message
Signature · 1 line
2.11.0
Re: [PATCH v7 12/17] gpio: madera: Support Cirrus Logic Madera class codecs
drivers/gpio/Kconfig config GPIO_LP87565 · line 1007
Quoted 7 lines · Richard Fitzgerald
This adds support for the GPIOs on Cirrus Logic Madera class codecs. Any pins not used for special functions (see the pinctrl driver) can be used as general single-bit input or output lines. The number of available GPIOs varies between codecs.
drivers/gpio/Kconfig +2
-0+config GPIO_MADERA + bool "Cirrus Logic Madera class codecs"
Not module?
Quoted 4 lines
+/*
+ * GPIO support for Cirrus Logic Madera codecs
+ *
+ * Copyright 2015-2017 Cirrus Logic
SPDX ?
drivers/gpio/gpio-madera.c line 14
Quoted 11 lines
+ *
+ * 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.
+ */drivers/gpio/gpio-madera.c new file +5
-0+ +#include <linux/device.h> +#include <linux/gpio.h> +#include <linux/kernel.h> +#include <linux/module.h>
?!?! Same to the MODULE_*() macros and Co.
drivers/gpio/gpio-madera.c line 35
Quoted 7 lines
drivers/gpio/gpio-madera.c new file +5
-0+static int madera_gpio_get_direction (struct gpio_chip *chip, +unsigned int offset) +{ + ret =regmap_read (madera->regmap, +MADERA_GPIO1_CTRL_2 + (2 * offset), &val);
Redundant parens here and everywhere. * has higher priority and noone I'm pretty sure can think other way.
drivers/gpio/gpio-madera.c line 39
Quoted 4 lines
drivers/gpio/gpio-madera.c new file +4
-0+if (ret <0 ) +return ret; + +return (val &MADERA_GP1_DIR_MASK ) >>MADERA_GP1_DIR_SHIFT ;
!! missed ?
Quoted 4 lines
drivers/gpio/gpio-madera.c new file +3
-0+} +static int madera_gpio_direction_out (struct gpio_chip *chip, +unsigned int offset,int value)
drivers/gpio/gpio-madera.c line 78
Quoted 10 lines
drivers/gpio/gpio-madera.c new file +10
-0+{ +struct madera_gpio *madera_gpio =gpiochip_get_data (chip); +struct madera *madera = madera_gpio->madera; +unsigned int regval; +int ret; + +if (value) + regval =MADERA_GP1_LVL ; +else + regval =0 ;
Perhaps
regval = value ? ... : 0;
?
drivers/gpio/gpio-madera.c line 78
Quoted 4 lines
drivers/gpio/gpio-madera.c new file +4
-0+if (value) + regval =MADERA_GP1_LVL ; +else + regval =0 ;
Ditto.
Quoted 4 lines
drivers/gpio/gpio-madera.c new file +4
-0+static int madera_gpio_probe (struct platform_device *pdev) +{ +struct madera *madera =dev_get_drvdata (pdev->dev.parent); +struct madera_pdata *pdata =dev_get_platdata (madera->dev);
drivers/gpio/gpio-madera.c line 143
Quoted 10 lines
drivers/gpio/gpio-madera.c new file +8
-0+struct madera_gpio *madera_gpio; +int ret; + madera_gpio->madera = madera; + madera_gpio->gpio_chip = template_chip; + madera_gpio->gpio_chip.parent = &pdev->dev; + +if (IS_ENABLED (CONFIG_OF_GPIO )) + madera_gpio->gpio_chip.of_node = madera->dev->of_node;
Isn't it done in GPIO core?
drivers/gpio/gpio-madera.c line 163
Quoted 2 lines
drivers/gpio/gpio-madera.c new file +2
-0+if (pdata && pdata->gpio_base) + madera_gpio->gpio_chip.base = pdata->gpio_base;
platform data in modern driver? Hmm...
Quoted 8 lines
drivers/gpio/gpio-madera.c new file +6
-0+else + madera_gpio->gpio_chip.base =-1 ; + + ret =devm_gpiochip_add_data (&pdev->dev, &madera_gpio->gpio_chip, + madera_gpio); +if (ret <0 ) {
drivers/gpio/gpio-madera.c line 179
Quoted 10 lines
drivers/gpio/gpio-madera.c new file +10
-0+dev_err (&pdev->dev,"Could not register gpiochip, %d\n" , ret); +return ret; + } + + ret =gpiochip_add_pin_range (&madera_gpio->gpio_chip,"madera-pinctrl" , +0 ,0 , madera_gpio->gpio_chip.ngpio); +if (ret) { +dev_warn (&pdev->dev,"Failed to add pin range (%d)\n" , ret); +return ret; + }
Consider if your messages above indeed make value. Hint: device core prints a warning if ->probe() fails.
drivers/gpio/gpio-madera.c line 185
Quoted 2 lines
drivers/gpio/gpio-madera.c new file +2
-0+static struct platform_driver madera_gpio_driver = { + .driver.name ="madera-gpio" ,
Please, do in more portable way, i.e.
.driver = {
.name = "...",
},
Quoted 1 line
+ .driver.owner =
THIS_MODULE,
Is this still needed? I suppose below macro does it for ya.
drivers/gpio/gpio-madera.c line 196
Quoted 11 lines
drivers/gpio/gpio-madera.c new file +10
-0+ .probe = madera_gpio_probe, +}; + +module_platform_driver (madera_gpio_driver); + +MODULE_DESCRIPTION ("GPIO interface for Madera codecs" ); +MODULE_AUTHOR ("Nariman Poushin <[email protected]>" ); +MODULE_AUTHOR ("Richard Fitzgerald <[email protected]>" ); +MODULE_LICENSE ("GPL v2" ); +MODULE_ALIAS ("platform:madera-gpio" );
See above
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH v7 12/17] gpio: madera: Support Cirrus Logic Madera class codecs
In reply to Richard FitzgeraldQuoted 9 lines · Richard Fitzgerald
This adds support for the GPIOs on Cirrus Logic Madera class codecs. Any pins not used for special functions (see the pinctrl driver) can be used as general single-bit input or output lines. The number of available GPIOs varies between codecs.
Signed-off-by Nariman Poushin <[email protected]>Signed-off-by Richard Fitzgerald <[email protected]>Signed-off-by Charles Keepax <[email protected]>Acked-by Linus Walleij <[email protected]>
I see Andy found more problems so fix those too..
drivers/gpio/gpio-madera.c line 12
Quoted 2 lines
drivers/gpio/gpio-madera.c new file +2
-0+#include <linux/device.h> +#include <linux/gpio.h>
Only
#include <linux/gpio/driver.h>
drivers/gpio/gpio-madera.c line 14
Quoted 2 lines
drivers/gpio/gpio-madera.c new file +2
-0+#include <linux/kernel.h> +#include <linux/module.h>
Not for bool drivers, right, as Andy pointed out.
Quoted 1 line
+static struct
gpio_chiptemplate_chip= {
Why is this named "template"?
There is nothing template about it, it is what you use.
If you keep it like this, name it madera_chip or something.
drivers/gpio/gpio-madera.c line 122
Quoted 10 lines
drivers/gpio/gpio-madera.c new file +10
-0+ .label = "madera", + .owner = THIS_MODULE, + .request = gpiochip_generic_request, + .free = gpiochip_generic_free, + .get_direction = madera_gpio_get_direction, + .direction_input = madera_gpio_direction_in, + .get = madera_gpio_get, + .direction_output = madera_gpio_direction_out, + .set = madera_gpio_set, + .set_config = gpiochip_generic_config,
Pretty cool! Have you tested this with e.g. open drain or debounce?
drivers/gpio/gpio-madera.c line 175
Quoted 2 lines
drivers/gpio/gpio-madera.c new file +2
-0+ ret =gpiochip_add_pin_range (&madera_gpio->gpio_chip,"madera-pinctrl" , +0 ,0 , madera_gpio->gpio_chip.ngpio);
Are you using device tree for this?
In that case add the range in the device tree instead.
The gpiolib will pick that up for you by default and you don't even need this code. See
git grep 'gpio-ranges' arch/arm/boot/dts
If you're also using this with platform data or ACPI or whatever, then this is fine.
Yours,
Linus Walleij
PATCH v7 13/17 ASoC: madera: Add DT bindings for Cirrus Logic Madera codecs
In reply to Richard FitzgeraldThe Cirrus Logic Madera codecs are a family of related codecs with extensive digital and analogue I/O, digital mixing and routing, signal processing and programmable DSPs.
--- Documentation/devicetree/bindings/sound/madera.txt | 67 ++++++++++++++++++++++ MAINTAINERS | 1 + include/dt-bindings/sound/madera.h | 27 +++++++++ 3 files changed, 95 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/madera.txt create mode 100644 include/dt-bindings/sound/madera.h
Documentation/devicetree/bindings/sound/madera.txt new file +67 -0
@@ -0,0 +1,67 @@ +Cirrus Logic Madera class audio codecs + +This describes audio configuration bindings for these codecs. + +See also the core bindings for the parent MFD driver: +See Documentation/devicetree/bindings/mfd/madera.txt + +and defines for values used in these bindings: +include/dt-bindings/sound/madera.h + +These properties are all contained in the parent MFD node. + +Optional properties: + - cirrus,dmic-ref : Indicates how the MICBIAS pins have been externally + connected to DMICs on each input, one cell per input. + <IN1 IN2 IN3 ...> + A value of 0 indicates MICVDD and is the default, other values depend on the + codec: + For CS47L35 one of the CS47L35_DMIC_REF_xxx values + For all other codecs one of the MADERA_DMIC_REF_xxx values + Also see the datasheet for a description of the INn_DMIC_SUP field. + + - cirrus,inmode : A list of input mode settings for each input. A maximum of + 16 cells, with four cells per input in the order INnAL, INnAR INnBL INnBR. + For non-muxed inputs the first two cells for that input set the mode for + the left and right channel and the second two cells must be 0. + For muxed inputs the first two cells for that input set the mode of the + left and right A inputs and the second two cells set the mode of the left + and right B inputs. + Valid mode values are one of the MADERA_INMODE_xxx. If the array is shorter + than the number of inputs the unspecified inputs default to + MADERA_INMODE_DIFF. + + - cirrus,out-mono : Mono bit for each output, must contain six cells if + specified. A non-zero value indicates the corresponding output is mono. + + - cirrus,max-channels-clocked : Maximum number of channels that I2S clocks + will be generated for. Useful when clock master for systems where the I2S + bus has multiple data lines. + One cell for each AIF, use a value of zero for AIFs that should be handled + normally. + + - cirrus,pdm-fmt : PDM speaker data format, must contain 2 cells + (OUT5 and OUT6). See the PDM_SPKn_FMT field in the datasheet for a + description of this value. + The second cell is ignored for codecs that do not have OUT6. + + - cirrus,pdm-mute : PDM mute format, must contain 2 cells + (OUT5 and OUT6). See the PDM_SPKn_CTRL_1 register in the datasheet for a + description of this value. + The second cell is ignored for codecs that do not have OUT6. + +Example: + +cs47l35@0 { + compatible = "cirrus,cs47l35"; + + cirrus,dmic-ref = <0 0 CS47L35_DMIC_REF_MICBIAS1B 0>; + cirrus,inmode = < + MADERA_INMODE_DMIC MADERA_INMODE_DMIC /* IN1A digital */ + MADERA_INMODE_SE MADERA_INMODE_SE /* IN1B single-ended */ + MADERA_INMODE_DIFF MADERA_INMODE_DIFF /* IN2 differential */ + 0 0 /* not used on this codec */ + >; + cirrus,out-mono = <0 0 0 0 0 0>; + cirrus,max-channels-clocked = <2 0 0>; +};
MAINTAINERS +1 -0
@@ -3497,6 +3497,7 @@ W: https://github.com/CirrusLogic/linux-drivers/wiki S: Supported F: Documentation/devicetree/bindings/mfd/madera.txt F: Documentation/devicetree/bindings/pinctrl/cirrus,madera-pinctrl.txt +F: include/dt-bindings/sound/madera* F: include/linux/irqchip/irq-madera* F: include/linux/mfd/madera/* F: drivers/gpio/gpio-madera*
include/dt-bindings/sound/madera.h new file +27 -0
@@ -0,0 +1,27 @@ +/* +* Device Tree defines for Madera codecs +* +* Copyright 2016-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. +*/ + +#ifndef DT_BINDINGS_SOUND_MADERA_H +#define DT_BINDINGS_SOUND_MADERA_H + +#define MADERA_INMODE_DIFF 0 +#define MADERA_INMODE_SE 1 +#define MADERA_INMODE_DMIC 2 + +#define MADERA_DMIC_REF_MICVDD 0 +#define MADERA_DMIC_REF_MICBIAS1 1 +#define MADERA_DMIC_REF_MICBIAS2 2 +#define MADERA_DMIC_REF_MICBIAS3 3 + +#define CS47L35_DMIC_REF_MICBIAS1B 1 +#define CS47L35_DMIC_REF_MICBIAS2A 2 +#define CS47L35_DMIC_REF_MICBIAS2B 3 + +#endif
Signature · 1 line
2.11.0
PATCH v7 14/17 ASoC: madera: Add common support for Cirrus Logic Madera codecs
In reply to Richard FitzgeraldThe Cirrus Logic Madera codecs are a family of related codecs with extensive digital and analogue I/O, digital mixing and routing, signal processing and programmable DSPs.
This patch adds common support code shared by all Madera codecs.
--- MAINTAINERS | 4 + include/sound/madera-pdata.h | 61 + sound/soc/codecs/Kconfig | 5 + sound/soc/codecs/Makefile | 2 + sound/soc/codecs/madera.c | 4439 ++++++++++++++++++++++++++++++++++++++++++ sound/soc/codecs/madera.h | 470 +++++ 6 files changed, 4981 insertions(+) create mode 100644 include/sound/madera-pdata.h create mode 100644 sound/soc/codecs/madera.c create mode 100644 sound/soc/codecs/madera.h
MAINTAINERS +4 -0
@@ -3497,14 +3497,18 @@ W: https://github.com/CirrusLogic/linux-drivers/wiki S: Supported F: Documentation/devicetree/bindings/mfd/madera.txt F: Documentation/devicetree/bindings/pinctrl/cirrus,madera-pinctrl.txt +F: Documentation/devicetree/bindings/sound/madera.txt F: include/dt-bindings/sound/madera* F: include/linux/irqchip/irq-madera* F: include/linux/mfd/madera/* +F: include/sound/madera* F: drivers/gpio/gpio-madera* F: drivers/irqchip/irq-madera* F: drivers/mfd/madera* F: drivers/mfd/cs47l* F: drivers/pinctrl/cirrus/* +F: sound/soc/codecs/cs47l* +F: sound/soc/codecs/madera* CLEANCACHE API M: Konrad Rzeszutek Wilk <[email protected]>
include/sound/madera-pdata.h new file +61 -0
61 lines not on this page · raw message
sound/soc/codecs/Kconfig +5 -0
@@ -256,10 +256,12 @@ config SND_SOC_WM_HUBS config SND_SOC_WM_ADSP tristate select SND_SOC_COMPRESS + default y if SND_SOC_MADERA=y default y if SND_SOC_CS47L24=y default y if SND_SOC_WM5102=y default y if SND_SOC_WM5110=y default y if SND_SOC_WM2200=y + default m if SND_SOC_MADERA=m default m if SND_SOC_CS47L24=m default m if SND_SOC_WM5102=m default m if SND_SOC_WM5110=m
@@ -595,6 +597,9 @@ config SND_SOC_ISABELLE config SND_SOC_LM49453 tristate +config SND_SOC_MADERA + tristate + config SND_SOC_MAX98088 tristate
sound/soc/codecs/Makefile +2 -0
@@ -80,6 +80,7 @@ snd-soc-jz4740-codec-objs := jz4740.o snd-soc-l3-objs := l3.o snd-soc-lm4857-objs := lm4857.o snd-soc-lm49453-objs := lm49453.o +snd-soc-madera-objs := madera.o snd-soc-max9768-objs := max9768.o snd-soc-max98088-objs := max98088.o snd-soc-max98090-objs := max98090.o
@@ -325,6 +326,7 @@ obj-$(CONFIG_SND_SOC_JZ4740_CODEC) += snd-soc-jz4740-codec.o obj-$(CONFIG_SND_SOC_L3) += snd-soc-l3.o obj-$(CONFIG_SND_SOC_LM4857) += snd-soc-lm4857.o obj-$(CONFIG_SND_SOC_LM49453) += snd-soc-lm49453.o +obj-$(CONFIG_SND_SOC_MADERA) += snd-soc-madera.o obj-$(CONFIG_SND_SOC_MAX9768) += snd-soc-max9768.o obj-$(CONFIG_SND_SOC_MAX98088) += snd-soc-max98088.o obj-$(CONFIG_SND_SOC_MAX98090) += snd-soc-max98090.o
sound/soc/codecs/madera.c new file +4439 -0
2,886 lines not on this page · raw message
sound/soc/codecs/madera.h new file +470 -0
470 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.11.0
Part of the diff is not shown here. View the raw message.
PATCH v7 15/17 ASoC: cs47l35: Add codec driver for Cirrus Logic CS47L35
In reply to Richard FitzgeraldAdds the codec driver for the CS47L35 SmartCodec. This is a multi-functional codec based on the Cirrus Logic Madera platform.
--- sound/soc/codecs/Kconfig | 6 + sound/soc/codecs/Makefile | 2 + sound/soc/codecs/cs47l35.c | 1671 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 1679 insertions(+) create mode 100644 sound/soc/codecs/cs47l35.c
sound/soc/codecs/Kconfig +6 -0
@@ -63,6 +63,7 @@ config SND_SOC_ALL_CODECS select SND_SOC_CS43130 if I2C select SND_SOC_CS4349 if I2C select SND_SOC_CS47L24 if MFD_CS47L24 + select SND_SOC_CS47L35 if MFD_CS47L35 select SND_SOC_CS53L30 if I2C select SND_SOC_CX20442 if TTY select SND_SOC_DA7210 if SND_SOC_I2C_AND_SPI
@@ -508,6 +509,9 @@ config SND_SOC_CS4349 config SND_SOC_CS47L24 tristate +config SND_SOC_CS47L35 + tristate + # Cirrus Logic Quad-Channel ADC config SND_SOC_CS53L30 tristate "Cirrus Logic CS53L30 CODEC"
@@ -599,6 +603,8 @@ config SND_SOC_LM49453 config SND_SOC_MADERA tristate + default y if SND_SOC_CS47L35=y + default m if SND_SOC_CS47L35=m config SND_SOC_MAX98088 tristate
sound/soc/codecs/Makefile +2 -0
@@ -57,6 +57,7 @@ snd-soc-cs42xx8-i2c-objs := cs42xx8-i2c.o snd-soc-cs43130-objs := cs43130.o snd-soc-cs4349-objs := cs4349.o snd-soc-cs47l24-objs := cs47l24.o +snd-soc-cs47l35-objs := cs47l35.o snd-soc-cs53l30-objs := cs53l30.o snd-soc-cx20442-objs := cx20442.o snd-soc-da7210-objs := da7210.o
@@ -303,6 +304,7 @@ obj-$(CONFIG_SND_SOC_CS42XX8_I2C) += snd-soc-cs42xx8-i2c.o obj-$(CONFIG_SND_SOC_CS43130) += snd-soc-cs43130.o obj-$(CONFIG_SND_SOC_CS4349) += snd-soc-cs4349.o obj-$(CONFIG_SND_SOC_CS47L24) += snd-soc-cs47l24.o +obj-$(CONFIG_SND_SOC_CS47L35) += snd-soc-cs47l35.o obj-$(CONFIG_SND_SOC_CS53L30) += snd-soc-cs53l30.o obj-$(CONFIG_SND_SOC_CX20442) += snd-soc-cx20442.o obj-$(CONFIG_SND_SOC_DA7210) += snd-soc-da7210.o
sound/soc/codecs/cs47l35.c new file +1671 -0
1,671 lines not on this page · raw message
Signature · 1 line
2.11.0
PATCH v7 16/17 ASoC: cs47l85: Add codec driver for Cirrus Logic CS47L85
In reply to Richard FitzgeraldAdds the codec driver for the CS47L85 SmartCodec. This is a multi-functional codec based on the Cirrus Logic Madera platform.
--- sound/soc/codecs/Kconfig | 6 + sound/soc/codecs/Makefile | 2 + sound/soc/codecs/cs47l85.c | 2677 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 2685 insertions(+) create mode 100644 sound/soc/codecs/cs47l85.c
sound/soc/codecs/Kconfig +6 -0
@@ -64,6 +64,7 @@ config SND_SOC_ALL_CODECS select SND_SOC_CS4349 if I2C select SND_SOC_CS47L24 if MFD_CS47L24 select SND_SOC_CS47L35 if MFD_CS47L35 + select SND_SOC_CS47L85 if MFD_CS47L85 select SND_SOC_CS53L30 if I2C select SND_SOC_CX20442 if TTY select SND_SOC_DA7210 if SND_SOC_I2C_AND_SPI
@@ -512,6 +513,9 @@ config SND_SOC_CS47L24 config SND_SOC_CS47L35 tristate +config SND_SOC_CS47L85 + tristate + # Cirrus Logic Quad-Channel ADC config SND_SOC_CS53L30 tristate "Cirrus Logic CS53L30 CODEC"
@@ -604,7 +608,9 @@ config SND_SOC_LM49453 config SND_SOC_MADERA tristate default y if SND_SOC_CS47L35=y + default y if SND_SOC_CS47L85=y default m if SND_SOC_CS47L35=m + default m if SND_SOC_CS47L85=m config SND_SOC_MAX98088 tristate
sound/soc/codecs/Makefile +2 -0
@@ -58,6 +58,7 @@ snd-soc-cs43130-objs := cs43130.o snd-soc-cs4349-objs := cs4349.o snd-soc-cs47l24-objs := cs47l24.o snd-soc-cs47l35-objs := cs47l35.o +snd-soc-cs47l85-objs := cs47l85.o snd-soc-cs53l30-objs := cs53l30.o snd-soc-cx20442-objs := cx20442.o snd-soc-da7210-objs := da7210.o
@@ -305,6 +306,7 @@ obj-$(CONFIG_SND_SOC_CS43130) += snd-soc-cs43130.o obj-$(CONFIG_SND_SOC_CS4349) += snd-soc-cs4349.o obj-$(CONFIG_SND_SOC_CS47L24) += snd-soc-cs47l24.o obj-$(CONFIG_SND_SOC_CS47L35) += snd-soc-cs47l35.o +obj-$(CONFIG_SND_SOC_CS47L85) += snd-soc-cs47l85.o obj-$(CONFIG_SND_SOC_CS53L30) += snd-soc-cs53l30.o obj-$(CONFIG_SND_SOC_CX20442) += snd-soc-cx20442.o obj-$(CONFIG_SND_SOC_DA7210) += snd-soc-da7210.o
sound/soc/codecs/cs47l85.c new file +2677 -0
2,677 lines not on this page · raw message
Signature · 1 line
2.11.0
PATCH v7 17/17 ASoC: cs47l90: Add codec driver for Cirrus Logic CS47L90
In reply to Richard FitzgeraldAdds the codec driver for the CS47L90 SmartCodec. This is a multi-functional codec based on the Cirrus Logic Madera platform.
--- sound/soc/codecs/Kconfig | 6 + sound/soc/codecs/Makefile | 2 + sound/soc/codecs/cs47l90.c | 2651 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 2659 insertions(+) create mode 100644 sound/soc/codecs/cs47l90.c
sound/soc/codecs/Kconfig +6 -0
@@ -65,6 +65,7 @@ config SND_SOC_ALL_CODECS select SND_SOC_CS47L24 if MFD_CS47L24 select SND_SOC_CS47L35 if MFD_CS47L35 select SND_SOC_CS47L85 if MFD_CS47L85 + select SND_SOC_CS47L90 if MFD_CS47L90 select SND_SOC_CS53L30 if I2C select SND_SOC_CX20442 if TTY select SND_SOC_DA7210 if SND_SOC_I2C_AND_SPI
@@ -516,6 +517,9 @@ config SND_SOC_CS47L35 config SND_SOC_CS47L85 tristate +config SND_SOC_CS47L90 + tristate + # Cirrus Logic Quad-Channel ADC config SND_SOC_CS53L30 tristate "Cirrus Logic CS53L30 CODEC"
@@ -609,8 +613,10 @@ config SND_SOC_MADERA tristate default y if SND_SOC_CS47L35=y default y if SND_SOC_CS47L85=y + default y if SND_SOC_CS47L90=y default m if SND_SOC_CS47L35=m default m if SND_SOC_CS47L85=m + default m if SND_SOC_CS47L90=m config SND_SOC_MAX98088 tristate
sound/soc/codecs/Makefile +2 -0
@@ -59,6 +59,7 @@ snd-soc-cs4349-objs := cs4349.o snd-soc-cs47l24-objs := cs47l24.o snd-soc-cs47l35-objs := cs47l35.o snd-soc-cs47l85-objs := cs47l85.o +snd-soc-cs47l90-objs := cs47l90.o snd-soc-cs53l30-objs := cs53l30.o snd-soc-cx20442-objs := cx20442.o snd-soc-da7210-objs := da7210.o
@@ -307,6 +308,7 @@ obj-$(CONFIG_SND_SOC_CS4349) += snd-soc-cs4349.o obj-$(CONFIG_SND_SOC_CS47L24) += snd-soc-cs47l24.o obj-$(CONFIG_SND_SOC_CS47L35) += snd-soc-cs47l35.o obj-$(CONFIG_SND_SOC_CS47L85) += snd-soc-cs47l85.o +obj-$(CONFIG_SND_SOC_CS47L90) += snd-soc-cs47l90.o obj-$(CONFIG_SND_SOC_CS53L30) += snd-soc-cs53l30.o obj-$(CONFIG_SND_SOC_CX20442) += snd-soc-cx20442.o obj-$(CONFIG_SND_SOC_DA7210) += snd-soc-da7210.o
sound/soc/codecs/cs47l90.c new file +2651 -0
2,651 lines not on this page · raw message
Signature · 1 line
2.11.0