Skip to contentSkip to conversation

ASoC: cs53l30: Add codec driver support for Cirrus CS53L30

PATCH Superseded Nicolin Chen 3 participants 5 messages May 23, 2016 – May 25, 2016

Subsystems (4)

v6 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

PATCH v6 1/1 ASoC: cs53l30: Add codec driver support for Cirrus CS53L30

CS53L30 is a Quad-Channel ADC from Cirrus Logic with an I2S/TDM DAI. So this patch adds support for CS53L30 that supports 24-bit recording feature.

---
Changelog:
v5->v6
* Added clock controls
* Reconstructed bitfield macros and improved coding style
* Fixed some misuses of regmap_update_bits()
* Added TLV volume controls to replace enums for preamplifier
* Added micbias level in DT instead of exposing to user-space
* Simplified SDOUTx controls by removing cs53l30_asp_sdout_event() (Still be able to use set_tristate() instead)
* Removed useless header files and sort the rest alphabetically
* Registered runtime pm functions to the driver
* Added regulator controls (VA and VP)
* Added writeable register function for regmap
* Merged two ASP dais
* Added TDM support
* Added a simple introduction in commit log

 .../devicetree/bindings/sound/cs53l30.txt          |   38 +
 sound/soc/codecs/Kconfig                           |    6 +
 sound/soc/codecs/Makefile                          |    2 +
 sound/soc/codecs/cs53l30.c                         | 1097 ++++++++++++++++++++
 sound/soc/codecs/cs53l30.h                         |  458 ++++++++
 5 files changed, 1601 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/cs53l30.txt
 create mode 100644 sound/soc/codecs/cs53l30.c
 create mode 100644 sound/soc/codecs/cs53l30.h
Documentation/devicetree/bindings/sound/cs53l30.txt new file +38 -0
new file mode 100644
index 0000000..ace7ffe
@@ -0,0 +1,38 @@
+CS53L30 audio CODEC
+
+Required properties:
+
+  - compatible : "cirrus,cs53l30"
+
+  - reg : the I2C address of the device
+
+  - VA-supply, VP-supply : power supplies for the device,
+    as covered in Documentation/devicetree/bindings/regulator/regulator.txt.
+
+Optional properties:
+
+  - reset-gpios : a GPIO spec for the reset pin.
+
+  - micbias-lvl : Set the output voltage level on the MICBIAS Pin.
+		  0 = Hi-Z
+		  1 = 1.80 V
+		  2 = 2.75 V
+
+  - use-sdout2 : This is a boolean property. If present, it indicates
+		 the hardware design connects both SDOUT1 and SDOUT2
+		 pins to output data. Otherwise, it indicates that
+		 only SDOUT1 is connected for data output.
+		 * CS53l30 supports 4-channel data output in the same
+		 * frame using two different ways:
+		 * 1) Normal I2S mode on two data pins -- each SDOUT
+		 *    carries 2-channel data in the same time.
+		 * 2) TDM mode on one signle data pin -- SDOUT1 carries
+		 *    4-channel data per frame.
+
+Example:
+
+codec: cs53l30@48 {
+        compatible = "cirrus,cs53l30";
+        reg = <0x48>;
+        reset-gpios = <&gpio 54 0>;
+};
sound/soc/codecs/Kconfig +6 -0
index b3afae9..970ca04 100644
@@ -56,6 +56,7 @@ config SND_SOC_ALL_CODECS
 	select SND_SOC_CS42XX8_I2C if I2C
 	select SND_SOC_CS4349 if I2C
 	select SND_SOC_CS47L24 if MFD_CS47L24
+	select SND_SOC_CS53L30 if I2C
 	select SND_SOC_CX20442 if TTY
 	select SND_SOC_DA7210 if SND_SOC_I2C_AND_SPI
 	select SND_SOC_DA7213 if I2C
@@ -444,6 +445,11 @@ config SND_SOC_CS4349
 config SND_SOC_CS47L24
 	tristate
 
+# Cirrus Logic Quad-Channel ADC
+config SND_SOC_CS53L30
+	tristate "Cirrus Logic CS53L30 CODEC"
+	depends on I2C
+
 config SND_SOC_CX20442
 	tristate
 	depends on TTY
sound/soc/codecs/Makefile +2 -0
index b7b9941..f38428c 100644
@@ -48,6 +48,7 @@ snd-soc-cs42xx8-objs := cs42xx8.o
 snd-soc-cs42xx8-i2c-objs := cs42xx8-i2c.o
 snd-soc-cs4349-objs := cs4349.o
 snd-soc-cs47l24-objs := cs47l24.o
+snd-soc-cs53l30-objs := cs53l30.o
 snd-soc-cx20442-objs := cx20442.o
 snd-soc-da7210-objs := da7210.o
 snd-soc-da7213-objs := da7213.o
@@ -259,6 +260,7 @@ obj-$(CONFIG_SND_SOC_CS42XX8)	+= snd-soc-cs42xx8.o
 obj-$(CONFIG_SND_SOC_CS42XX8_I2C) += snd-soc-cs42xx8-i2c.o
 obj-$(CONFIG_SND_SOC_CS4349)	+= snd-soc-cs4349.o
 obj-$(CONFIG_SND_SOC_CS47L24)	+= snd-soc-cs47l24.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
 obj-$(CONFIG_SND_SOC_DA7213)	+= snd-soc-da7213.o
sound/soc/codecs/cs53l30.c new file +1097 -0

1,097 lines not on this page · raw message

sound/soc/codecs/cs53l30.h new file +458 -0

458 lines not on this page · raw message

Signature · 1 line
2.1.4
maintainer
#1 lore raw
Quoted 48 lines · Nicolin Chen

CS53L30 is a Quad-Channel ADC from Cirrus Logic with an I2S/TDM DAI. So this patch adds support for CS53L30 that supports 24-bit recording feature.

---
Changelog:
v5->v6
* Added clock controls
* Reconstructed bitfield macros and improved coding style
* Fixed some misuses of regmap_update_bits()
* Added TLV volume controls to replace enums for preamplifier
* Added micbias level in DT instead of exposing to user-space
* Simplified SDOUTx controls by removing cs53l30_asp_sdout_event() (Still be able to use set_tristate() instead)
* Removed useless header files and sort the rest alphabetically
* Registered runtime pm functions to the driver
* Added regulator controls (VA and VP)
* Added writeable register function for regmap
* Merged two ASP dais
* Added TDM support
* Added a simple introduction in commit log

 .../devicetree/bindings/sound/cs53l30.txt          |   38 +
 sound/soc/codecs/Kconfig                           |    6 +
 sound/soc/codecs/Makefile                          |    2 +
 sound/soc/codecs/cs53l30.c                         | 1097 ++++++++++++++++++++
 sound/soc/codecs/cs53l30.h                         |  458 ++++++++
 5 files changed, 1601 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/cs53l30.txt
 create mode 100644 sound/soc/codecs/cs53l30.c
 create mode 100644 sound/soc/codecs/cs53l30.h
Documentation/devicetree/bindings/sound/cs53l30.txt new file +9 -0
new file mode 100644
index 0000000..ace7ffe
@@ -0,0 +1,38 @@
+CS53L30 audio CODEC
+
+Required properties:
+
+  - compatible : "cirrus,cs53l30"
+
+  - reg : the I2C address of the device
+
+  - VA-supply, VP-supply : power supplies for the device,

Documentation/devicetree/bindings/sound/cs53l30.txt line 19

Quoted 10 lines
Documentation/devicetree/bindings/sound/cs53l30.txt new file +10 -0
+    as covered in Documentation/devicetree/bindings/regulator/regulator.txt.
+
+Optional properties:
+
+  - reset-gpios : a GPIO spec for the reset pin.
+
+  - micbias-lvl : Set the output voltage level on the MICBIAS Pin.
+		  0 = Hi-Z
+		  1 = 1.80 V
+		  2 = 2.75 V

Needs a vendor prefix.

Documentation/devicetree/bindings/sound/cs53l30.txt line 21

Quoted 2 lines
Documentation/devicetree/bindings/sound/cs53l30.txt new file +2 -0
+
+  - use-sdout2 : This is a boolean property. If present, it indicates

Needs a vendor prefix.

Quoted 17 lines
Documentation/devicetree/bindings/sound/cs53l30.txt new file +17 -0
+		 the hardware design connects both SDOUT1 and SDOUT2
+		 pins to output data. Otherwise, it indicates that
+		 only SDOUT1 is connected for data output.
+		 * CS53l30 supports 4-channel data output in the same
+		 * frame using two different ways:
+		 * 1) Normal I2S mode on two data pins -- each SDOUT
+		 *    carries 2-channel data in the same time.
+		 * 2) TDM mode on one signle data pin -- SDOUT1 carries
+		 *    4-channel data per frame.
+
+Example:
+
+codec: cs53l30@48 {
+        compatible = "cirrus,cs53l30";
+        reg = <0x48>;
+        reset-gpios = <&gpio 54 0>;
+};
maintainer
#2 lore raw
In reply to Nicolin Chen
Quoted 39 lines · Nicolin Chen

CS53L30 is a Quad-Channel ADC from Cirrus Logic with an I2S/TDM DAI. So this patch adds support for CS53L30 that supports 24-bit recording feature.

---
Changelog:
v5->v6
* Added clock controls
* Reconstructed bitfield macros and improved coding style
* Fixed some misuses of regmap_update_bits()
* Added TLV volume controls to replace enums for preamplifier
* Added micbias level in DT instead of exposing to user-space
* Simplified SDOUTx controls by removing cs53l30_asp_sdout_event() (Still be able to use set_tristate() instead)
* Removed useless header files and sort the rest alphabetically
* Registered runtime pm functions to the driver
* Added regulator controls (VA and VP)
* Added writeable register function for regmap
* Merged two ASP dais
* Added TDM support
* Added a simple introduction in commit log

 .../devicetree/bindings/sound/cs53l30.txt          |   38 +
 sound/soc/codecs/Kconfig                           |    6 +
 sound/soc/codecs/Makefile                          |    2 +
 sound/soc/codecs/cs53l30.c                         | 1097 ++++++++++++++++++++
 sound/soc/codecs/cs53l30.h                         |  458 ++++++++
 5 files changed, 1601 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/cs53l30.txt
 create mode 100644 sound/soc/codecs/cs53l30.c
 create mode 100644 sound/soc/codecs/cs53l30.h
Documentation/devicetree/bindings/sound/cs53l30.txt new file +0 -0
new file mode 100644
index 0000000..ace7ffe

Documentation/devicetree/bindings/sound/cs53l30.txt line 10

Quoted 10 lines
Documentation/devicetree/bindings/sound/cs53l30.txt new file +10 -0
@@ -0,0 +1,38 @@
+CS53L30 audio CODEC
+
+Required properties:
+
+  - compatible : "cirrus,cs53l30"
+
+  - reg : the I2C address of the device
+
+  - VA-supply, VP-supply : power supplies for the device,
+    as covered in Documentation/devicetree/bindings/regulator/regulator.txt.

Also, these are missing from the example yet are required. I'd argue they should be optional as you could have designs with no regulator control.

Quoted 28 lines
Documentation/devicetree/bindings/sound/cs53l30.txt new file +28 -0
+
+Optional properties:
+
+  - reset-gpios : a GPIO spec for the reset pin.
+
+  - micbias-lvl : Set the output voltage level on the MICBIAS Pin.
+		  0 = Hi-Z
+		  1 = 1.80 V
+		  2 = 2.75 V
+
+  - use-sdout2 : This is a boolean property. If present, it indicates
+		 the hardware design connects both SDOUT1 and SDOUT2
+		 pins to output data. Otherwise, it indicates that
+		 only SDOUT1 is connected for data output.
+		 * CS53l30 supports 4-channel data output in the same
+		 * frame using two different ways:
+		 * 1) Normal I2S mode on two data pins -- each SDOUT
+		 *    carries 2-channel data in the same time.
+		 * 2) TDM mode on one signle data pin -- SDOUT1 carries
+		 *    4-channel data per frame.
+
+Example:
+
+codec: cs53l30@48 {
+        compatible = "cirrus,cs53l30";
+        reg = <0x48>;
+        reset-gpios = <&gpio 54 0>;
+};
#3 lore raw
Quoted 12 lines · Rob Herring
Quoted 12 lines
Documentation/devicetree/bindings/sound/cs53l30.txt new file +6 -0
new file mode 100644
index 0000000..ace7ffe
@@ -0,0 +1,38 @@
+CS53L30 audio CODEC
+
+Required properties:
+
+  - compatible : "cirrus,cs53l30"
+
Quoted 8 lines

Documentation/devicetree/bindings/sound/cs53l30.txt line 10

Quoted 4 lines
Documentation/devicetree/bindings/sound/cs53l30.txt new file +4 -0
+  - reg : the I2C address of the device
+
+  - VA-supply, VP-supply : power supplies for the device,
+    as covered in Documentation/devicetree/bindings/regulator/regulator.txt.

Also, these are missing from the example yet are required. I'd argue they should be optional as you could have designs with no regulator control.

Will refine both in next ver. Thanks

maintainer
#4 lore raw
In reply to Rob Herring
Quoted 8 lines · Rob Herring

Documentation/devicetree/bindings/sound/cs53l30.txt line 10

Quoted 2 lines · Nicolin Chen
Documentation/devicetree/bindings/sound/cs53l30.txt new file +2 -0
+  - VA-supply, VP-supply : power supplies for the device,
+    as covered in Documentation/devicetree/bindings/regulator/regulator.txt.

Also, these are missing from the example yet are required. I'd argue they should be optional as you could have designs with no regulator control.

The general rule is that regulators should only be omitted if they are physically absent, we can describe simple fixed supplies with no control so we should do so (though in practice Linux is much more forgiving and will provide one if the supply is just plain missing from the DT). This is a simpler rule for people to follow than making them officially optional and is more robust in the face of things like implementation changes that allow supplies to become controlable or drivers that suddenly form a desire to look at their supply voltages, as well as allowing other OSs to have simpler implementations if it's followed.