Skip to contentSkip to conversation

Minor fixes and DT support

PATCH In review Andreas Irestål 4 participants 13 messages Feb 16, 2016 – Feb 24, 2016

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v2 cover Minor fixes and DT support

This set of patches fixes some minor typos and adds DT support for the adau17x1 codec drivers. I've only been able to test the 1761 part on real hardware since I don't have any adau1781 hardware at the moment.

Currently, quite a lot of options are provided through the platform_data struct, so it made sense parsing the DT and create a platform_data struct from these parameters not to break anything.

Changes since v1:
- Added vendor prefix "adi," to DT properties
- DT parsing moved to main probe function

Andreas Irestål (5):
ASoC: adau17x1: Fix incorrect BCLK ratio definitions
ASoC: adau17x1: Correct typos in file headers
ASoC: adau17x1: Add adau17x1 bindings document
ASoC: adau17x1: Add basic DT support for adau17x1
ASoC: adau17x1: Support platform data via DT

 .../devicetree/bindings/sound/adi,adau17x1.txt     |  55 +++++++++
 include/dt-bindings/sound/adau17x1.h               |  14 +++
 include/linux/platform_data/adau17x1.h             |   2 +-
 sound/soc/codecs/adau1761-i2c.c                    |  14 ++-
 sound/soc/codecs/adau1761-spi.c                    |  14 ++-
 sound/soc/codecs/adau1761.c                        | 129 ++++++++++++++++++++-
 sound/soc/codecs/adau1781-i2c.c                    |  10 ++
 sound/soc/codecs/adau1781-spi.c                    |  10 ++
 sound/soc/codecs/adau1781.c                        |  50 +++++++-
 sound/soc/codecs/adau17x1.h                        |   6 +-
 10 files changed, 296 insertions(+), 8 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/sound/adi,adau17x1.txt
 create mode 100644 include/dt-bindings/sound/adau17x1.h
Signature · 6 lines
2.1.4

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
#1 lore raw

PATCH v2 1/5 ASoC: adau17x1: Fix incorrect BCLK ratio definitions

---
 sound/soc/codecs/adau17x1.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
sound/soc/codecs/adau17x1.h +3 -3
index e13583e..5ae87a0 100644
@@ -103,9 +103,9 @@ bool adau17x1_has_dsp(struct adau *adau);
 #define ADAU17X1_CLOCK_CONTROL_CORECLK_SRC_PLL	BIT(3)
 #define ADAU17X1_CLOCK_CONTROL_SYSCLK_EN	BIT(0)
 
-#define ADAU17X1_SERIAL_PORT1_BCLK32		(0x0 << 5)
-#define ADAU17X1_SERIAL_PORT1_BCLK48		(0x1 << 5)
-#define ADAU17X1_SERIAL_PORT1_BCLK64		(0x2 << 5)
+#define ADAU17X1_SERIAL_PORT1_BCLK64		(0x0 << 5)
+#define ADAU17X1_SERIAL_PORT1_BCLK32		(0x1 << 5)
+#define ADAU17X1_SERIAL_PORT1_BCLK48		(0x2 << 5)
 #define ADAU17X1_SERIAL_PORT1_BCLK128		(0x3 << 5)
 #define ADAU17X1_SERIAL_PORT1_BCLK256		(0x4 << 5)
 #define ADAU17X1_SERIAL_PORT1_BCLK_MASK		(0x7 << 5)
Signature · 1 line
2.1.4
#2 lore raw

PATCH v2 2/5 ASoC: adau17x1: Correct typos in file headers

In reply to Andreas Irestål
---
 include/linux/platform_data/adau17x1.h | 2 +-
 sound/soc/codecs/adau1761-i2c.c        | 2 +-
 sound/soc/codecs/adau1761-spi.c        | 2 +-
 sound/soc/codecs/adau1761.c            | 2 +-
 sound/soc/codecs/adau1781.c            | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)
include/linux/platform_data/adau17x1.h +1 -1
index a81766c..9db1b90 100644
@@ -1,5 +1,5 @@
 /*
- * Driver for ADAU1761/ADAU1461/ADAU1761/ADAU1961/ADAU1781/ADAU1781 codecs
+ * Driver for ADAU1361/ADAU1461/ADAU1761/ADAU1961/ADAU1381/ADAU1781 codecs
  *
  * Copyright 2011-2014 Analog Devices Inc.
  * Author: Lars-Peter Clausen <[email protected]>
sound/soc/codecs/adau1761-i2c.c +1 -1
index 348ccb1..a1b1267 100644
@@ -1,5 +1,5 @@
 /*
- * Driver for ADAU1761/ADAU1461/ADAU1761/ADAU1961 codec
+ * Driver for ADAU1361/ADAU1461/ADAU1761/ADAU1961 codec
  *
  * Copyright 2014 Analog Devices Inc.
  *  Author: Lars-Peter Clausen <[email protected]>
sound/soc/codecs/adau1761-spi.c +1 -1
index 8bc1fbd..1883349 100644
@@ -1,5 +1,5 @@
 /*
- * Driver for ADAU1761/ADAU1461/ADAU1761/ADAU1961 codec
+ * Driver for ADAU1361/ADAU1461/ADAU1761/ADAU1961 codec
  *
  * Copyright 2014 Analog Devices Inc.
  *  Author: Lars-Peter Clausen <[email protected]>
sound/soc/codecs/adau1761.c +1 -1
index 2f12477..16fed36 100644
@@ -1,5 +1,5 @@
 /*
- * Driver for ADAU1761/ADAU1461/ADAU1761/ADAU1961 codec
+ * Driver for ADAU1361/ADAU1461/ADAU1761/ADAU1961 codec
  *
  * Copyright 2011-2013 Analog Devices Inc.
  * Author: Lars-Peter Clausen <[email protected]>
sound/soc/codecs/adau1781.c +1 -1
index fde9068..bc1bb56 100644
@@ -1,5 +1,5 @@
 /*
- * Driver for ADAU1781/ADAU1781 codec
+ * Driver for ADAU1381/ADAU1781 codec
  *
  * Copyright 2011-2013 Analog Devices Inc.
  * Author: Lars-Peter Clausen <[email protected]>
Signature · 1 line
2.1.4
#3 lore raw

PATCH v2 3/5 ASoC: adau17x1: Add adau17x1 bindings document

In reply to Andreas Irestål
---
 .../devicetree/bindings/sound/adi,adau17x1.txt     | 24 ++++++++++++++++++++++
 1 file changed, 24 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/adi,adau17x1.txt
Documentation/devicetree/bindings/sound/adi,adau17x1.txt new file +24 -0
new file mode 100644
index 0000000..8dbce0e
@@ -0,0 +1,24 @@
+Analog Devices ADAU1361/ADAU1461/ADAU1761/ADAU1961/ADAU1381/ADAU1781
+
+Required properties:
+
+ - compatible:		Should contain one of the following:
+			"adi,adau1361"
+			"adi,adau1461"
+			"adi,adau1761"
+			"adi,adau1961"
+			"adi,adau1381"
+			"adi,adau1781"
+
+ - reg:			The i2c address. Value depends on the state of ADDR0
+			and ADDR1, as wired in hardware.
+
+Examples:
+#include <dt-bindings/sound/adau17x1.h>
+
+	i2c_bus {
+		adau1361@38 {
+			compatible = "adi,adau1761";
+			reg = <0x38>;
+		};
+	};
Signature · 1 line
2.1.4
maintainer Acked-by on v2 3/5
#4 lore raw

Re: [PATCH v2 3/5] ASoC: adau17x1: Add adau17x1 bindings document

Quoted 22 lines · Andreas Irestål
---
 .../devicetree/bindings/sound/adi,adau17x1.txt     | 24 ++++++++++++++++++++++
 1 file changed, 24 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/adi,adau17x1.txt
Documentation/devicetree/bindings/sound/adi,adau17x1.txt new file +10 -0
new file mode 100644
index 0000000..8dbce0e
@@ -0,0 +1,24 @@
+Analog Devices ADAU1361/ADAU1461/ADAU1761/ADAU1961/ADAU1381/ADAU1781
+
+Required properties:
+
+ - compatible:		Should contain one of the following:
+			"adi,adau1361"
+			"adi,adau1461"
+			"adi,adau1761"
+			"adi,adau1961"
+			"adi,adau1381"

Documentation/devicetree/bindings/sound/adi,adau17x1.txt line 20

Quoted 10 lines
Documentation/devicetree/bindings/sound/adi,adau17x1.txt new file +10 -0
+			"adi,adau1781"
+
+ - reg:			The i2c address. Value depends on the state of ADDR0
+			and ADDR1, as wired in hardware.
+
+Examples:
+#include <dt-bindings/sound/adau17x1.h>
+
+	i2c_bus {
+		adau1361@38 {

codec@38

Otherwise:

Quoted 11 lines
Documentation/devicetree/bindings/sound/adi,adau17x1.txt new file +4 -0
+			compatible = "adi,adau1761";
+			reg = <0x38>;
+		};
+	};
Signature · 6 lines
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
maintainer
#5 lore raw

Applied "ASoC: adau17x1: Add adau17x1 bindings document" to the asoc tree

In reply to Andreas Irestål

The patch

ASoC: adau17x1: Add adau17x1 bindings document

has been applied to the asoc tree at

git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark

Quoted 1 line

From ef329457237d885baf3408a56db9a02df97cde87 Mon Sep 17 00:00:00 2001

From: =?UTF-8?q?Andreas=20Irest=C3=A5l?= <[email protected]>
Date: Tue, 16 Feb 2016 13:56:43 +0100
Subject: [PATCH] ASoC: adau17x1: Add adau17x1 bindings document
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../devicetree/bindings/sound/adi,adau17x1.txt     | 24 ++++++++++++++++++++++
 1 file changed, 24 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/adi,adau17x1.txt
Documentation/devicetree/bindings/sound/adi,adau17x1.txt new file +24 -0
new file mode 100644
index 000000000000..8dbce0e18dda
@@ -0,0 +1,24 @@
+Analog Devices ADAU1361/ADAU1461/ADAU1761/ADAU1961/ADAU1381/ADAU1781
+
+Required properties:
+
+ - compatible:		Should contain one of the following:
+			"adi,adau1361"
+			"adi,adau1461"
+			"adi,adau1761"
+			"adi,adau1961"
+			"adi,adau1381"
+			"adi,adau1781"
+
+ - reg:			The i2c address. Value depends on the state of ADDR0
+			and ADDR1, as wired in hardware.
+
+Examples:
+#include <dt-bindings/sound/adau17x1.h>
+
+	i2c_bus {
+		adau1361@38 {
+			compatible = "adi,adau1761";
+			reg = <0x38>;
+		};
+	};
Signature · 1 line
2.7.0
#6 lore raw

PATCH v2 4/5 ASoC: adau17x1: Add basic DT support for adau17x1

In reply to Andreas Irestål
---
 sound/soc/codecs/adau1761-i2c.c | 12 ++++++++++++
 sound/soc/codecs/adau1761-spi.c | 12 ++++++++++++
 sound/soc/codecs/adau1781-i2c.c | 10 ++++++++++
 sound/soc/codecs/adau1781-spi.c | 10 ++++++++++
 4 files changed, 44 insertions(+)
sound/soc/codecs/adau1761-i2c.c +12 -0
index a1b1267..8de010f 100644
@@ -44,9 +44,21 @@ static const struct i2c_device_id adau1761_i2c_ids[] = {
 };
 MODULE_DEVICE_TABLE(i2c, adau1761_i2c_ids);
 
+#if defined(CONFIG_OF)
+static const struct of_device_id adau1761_i2c_dt_ids[] = {
+	{ .compatible = "adi,adau1361", },
+	{ .compatible = "adi,adau1461", },
+	{ .compatible = "adi,adau1761", },
+	{ .compatible = "adi,adau1961", },
+	{ },
+};
+MODULE_DEVICE_TABLE(of, adau1761_i2c_dt_ids);
+#endif
+
 static struct i2c_driver adau1761_i2c_driver = {
 	.driver = {
 		.name = "adau1761",
+		.of_match_table = of_match_ptr(adau1761_i2c_dt_ids),
 	},
 	.probe = adau1761_i2c_probe,
 	.remove = adau1761_i2c_remove,
sound/soc/codecs/adau1761-spi.c +12 -0
index 1883349..d917124 100644
@@ -61,9 +61,21 @@ static const struct spi_device_id adau1761_spi_id[] = {
 };
 MODULE_DEVICE_TABLE(spi, adau1761_spi_id);
 
+#if defined(CONFIG_OF)
+static const struct of_device_id adau1761_spi_dt_ids[] = {
+	{ .compatible = "adi,adau1361", },
+	{ .compatible = "adi,adau1461", },
+	{ .compatible = "adi,adau1761", },
+	{ .compatible = "adi,adau1961", },
+	{ },
+};
+MODULE_DEVICE_TABLE(of, adau1761_spi_dt_ids);
+#endif
+
 static struct spi_driver adau1761_spi_driver = {
 	.driver = {
 		.name = "adau1761",
+		.of_match_table = of_match_ptr(adau1761_spi_dt_ids),
 	},
 	.probe = adau1761_spi_probe,
 	.remove = adau1761_spi_remove,
sound/soc/codecs/adau1781-i2c.c +10 -0
index 0e32bba..06cbca8 100644
@@ -42,9 +42,19 @@ static const struct i2c_device_id adau1781_i2c_ids[] = {
 };
 MODULE_DEVICE_TABLE(i2c, adau1781_i2c_ids);
 
+#if defined(CONFIG_OF)
+static const struct of_device_id adau1781_i2c_dt_ids[] = {
+	{ .compatible = "adi,adau1381", },
+	{ .compatible = "adi,adau1781", },
+	{ },
+};
+MODULE_DEVICE_TABLE(of, adau1781_i2c_dt_ids);
+#endif
+
 static struct i2c_driver adau1781_i2c_driver = {
 	.driver = {
 		.name = "adau1781",
+		.of_match_table = of_match_ptr(adau1781_i2c_dt_ids),
 	},
 	.probe = adau1781_i2c_probe,
 	.remove = adau1781_i2c_remove,
sound/soc/codecs/adau1781-spi.c +10 -0
index 33a73ff..3d965a0 100644
@@ -59,9 +59,19 @@ static const struct spi_device_id adau1781_spi_id[] = {
 };
 MODULE_DEVICE_TABLE(spi, adau1781_spi_id);
 
+#if defined(CONFIG_OF)
+static const struct of_device_id adau1781_spi_dt_ids[] = {
+	{ .compatible = "adi,adau1381", },
+	{ .compatible = "adi,adau1781", },
+	{ },
+};
+MODULE_DEVICE_TABLE(of, adau1781_spi_dt_ids);
+#endif
+
 static struct spi_driver adau1781_spi_driver = {
 	.driver = {
 		.name = "adau1781",
+		.of_match_table = of_match_ptr(adau1781_spi_dt_ids),
 	},
 	.probe = adau1781_spi_probe,
 	.remove = adau1781_spi_remove,
Signature · 1 line
2.1.4
maintainer
#7 lore raw

Applied "ASoC: adau17x1: Add basic DT support for adau17x1" to the asoc tree

The patch

ASoC: adau17x1: Add basic DT support for adau17x1

has been applied to the asoc tree at

git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark

Quoted 1 line

From aaf0f3aeeb6f9e5e874fccc8a0e56b00fea537c3 Mon Sep 17 00:00:00 2001

From: =?UTF-8?q?Andreas=20Irest=C3=A5l?= <[email protected]>
Date: Tue, 16 Feb 2016 13:56:44 +0100
Subject: [PATCH] ASoC: adau17x1: Add basic DT support for adau17x1
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 sound/soc/codecs/adau1761-i2c.c | 12 ++++++++++++
 sound/soc/codecs/adau1761-spi.c | 12 ++++++++++++
 sound/soc/codecs/adau1781-i2c.c | 10 ++++++++++
 sound/soc/codecs/adau1781-spi.c | 10 ++++++++++
 4 files changed, 44 insertions(+)
sound/soc/codecs/adau1761-i2c.c +12 -0
index a1b12671c307..8de010f758cd 100644
@@ -44,9 +44,21 @@ static const struct i2c_device_id adau1761_i2c_ids[] = {
 };
 MODULE_DEVICE_TABLE(i2c, adau1761_i2c_ids);
 
+#if defined(CONFIG_OF)
+static const struct of_device_id adau1761_i2c_dt_ids[] = {
+	{ .compatible = "adi,adau1361", },
+	{ .compatible = "adi,adau1461", },
+	{ .compatible = "adi,adau1761", },
+	{ .compatible = "adi,adau1961", },
+	{ },
+};
+MODULE_DEVICE_TABLE(of, adau1761_i2c_dt_ids);
+#endif
+
 static struct i2c_driver adau1761_i2c_driver = {
 	.driver = {
 		.name = "adau1761",
+		.of_match_table = of_match_ptr(adau1761_i2c_dt_ids),
 	},
 	.probe = adau1761_i2c_probe,
 	.remove = adau1761_i2c_remove,
sound/soc/codecs/adau1761-spi.c +12 -0
index 188334928c23..d9171245bd9f 100644
@@ -61,9 +61,21 @@ static const struct spi_device_id adau1761_spi_id[] = {
 };
 MODULE_DEVICE_TABLE(spi, adau1761_spi_id);
 
+#if defined(CONFIG_OF)
+static const struct of_device_id adau1761_spi_dt_ids[] = {
+	{ .compatible = "adi,adau1361", },
+	{ .compatible = "adi,adau1461", },
+	{ .compatible = "adi,adau1761", },
+	{ .compatible = "adi,adau1961", },
+	{ },
+};
+MODULE_DEVICE_TABLE(of, adau1761_spi_dt_ids);
+#endif
+
 static struct spi_driver adau1761_spi_driver = {
 	.driver = {
 		.name = "adau1761",
+		.of_match_table = of_match_ptr(adau1761_spi_dt_ids),
 	},
 	.probe = adau1761_spi_probe,
 	.remove = adau1761_spi_remove,
sound/soc/codecs/adau1781-i2c.c +10 -0
index 0e32bba92339..06cbca84cf02 100644
@@ -42,9 +42,19 @@ static const struct i2c_device_id adau1781_i2c_ids[] = {
 };
 MODULE_DEVICE_TABLE(i2c, adau1781_i2c_ids);
 
+#if defined(CONFIG_OF)
+static const struct of_device_id adau1781_i2c_dt_ids[] = {
+	{ .compatible = "adi,adau1381", },
+	{ .compatible = "adi,adau1781", },
+	{ },
+};
+MODULE_DEVICE_TABLE(of, adau1781_i2c_dt_ids);
+#endif
+
 static struct i2c_driver adau1781_i2c_driver = {
 	.driver = {
 		.name = "adau1781",
+		.of_match_table = of_match_ptr(adau1781_i2c_dt_ids),
 	},
 	.probe = adau1781_i2c_probe,
 	.remove = adau1781_i2c_remove,
sound/soc/codecs/adau1781-spi.c +10 -0
index 33a73ff78de4..3d965a01b99c 100644
@@ -59,9 +59,19 @@ static const struct spi_device_id adau1781_spi_id[] = {
 };
 MODULE_DEVICE_TABLE(spi, adau1781_spi_id);
 
+#if defined(CONFIG_OF)
+static const struct of_device_id adau1781_spi_dt_ids[] = {
+	{ .compatible = "adi,adau1381", },
+	{ .compatible = "adi,adau1781", },
+	{ },
+};
+MODULE_DEVICE_TABLE(of, adau1781_spi_dt_ids);
+#endif
+
 static struct spi_driver adau1781_spi_driver = {
 	.driver = {
 		.name = "adau1781",
+		.of_match_table = of_match_ptr(adau1781_spi_dt_ids),
 	},
 	.probe = adau1781_spi_probe,
 	.remove = adau1781_spi_remove,
Signature · 1 line
2.7.0
#8 lore raw

PATCH v2 5/5 ASoC: adau17x1: Support platform data via DT

In reply to Andreas Irestål

Currently, it is only possible to configure HW-specific options to the adau17x1 codecs by providing a platform data struct. With this patch, it is possible to provide the same data via DT instead.

---
 .../devicetree/bindings/sound/adi,adau17x1.txt     |  31 +++++
 include/dt-bindings/sound/adau17x1.h               |  14 +++
 sound/soc/codecs/adau1761.c                        | 127 +++++++++++++++++++++
 sound/soc/codecs/adau1781.c                        |  48 ++++++++
 4 files changed, 220 insertions(+)
 create mode 100644 include/dt-bindings/sound/adau17x1.h
Documentation/devicetree/bindings/sound/adi,adau17x1.txt +31 -0
index 8dbce0e..6050602 100644
@@ -13,6 +13,32 @@ Required properties:
  - reg:			The i2c address. Value depends on the state of ADDR0
 			and ADDR1, as wired in hardware.
 
+Optional properties:
+
+ - adi,input-differential	bool to set if the input is differential
+ - adi,digital-microphone	bool to set if there is a digital microphone
+				connected to digmic/jackdet pin.
+ - adi,micbias-vg		Microphone bias voltage
+	MICBIAS_0_90_AVDD - 0.9 * AVDD
+	MICBIAS_0_65_AVDD - 0.65 * AVDD
+
+Optional properties (ADAU1361/ADAU1461/ADAU1761/ADAU1961 only)
+
+ - adi,jack-detection	If present, configures codec to use the digmic/jackdet
+			pin for jack detection. must provide one of
+			JACKDETECT_ACTIVE_LO or JACKDETECT_ACTIVE_HI followed
+			by debounce time in ms, which must be 5, 10, 20, or 40.
+
+ - adi,lineout-mode	Set output mode of the lineout pins.
+ - adi,headphone-mode	Set output mode of the headphone pins.
+
+The output mode must be one of:
+	OUTPUT_MODE_HEADPHONE           - Headphone output
+	OUTPUT_MODE_HEADPHONE_CAPLESS   - Capless headphone output
+	OUTPUT_MODE_LINE                - Line output
+
+
+
 Examples:
 #include <dt-bindings/sound/adau17x1.h>
 
@@ -20,5 +46,10 @@ Examples:
 		adau1361@38 {
 			compatible = "adi,adau1761";
 			reg = <0x38>;
+			input-differential;
+			jack-detection = <JACKDETECT_ACTIVE_LO 40>;
+			lineout-mode = <OUTPUT_MODE_LINE>;
+			headphone-mode = <OUTPUT_MODE_HEADPHONE>;
+			micbias-vg = <MICBIAS_0_90_AVDD>;
 		};
 	};
include/dt-bindings/sound/adau17x1.h new file +14 -0
new file mode 100644
index 0000000..3152019
@@ -0,0 +1,14 @@
+#ifndef __DT_ADAU17X1_H
+#define __DT_ADAU17X1_H
+
+#define MICBIAS_0_90_AVDD		0
+#define MICBIAS_0_65_AVDD		1
+
+#define OUTPUT_MODE_HEADPHONE		0
+#define OUTPUT_MODE_HEADPHONE_CAPLESS	1
+#define OUTPUT_MODE_LINE		2
+
+#define JACKDETECT_ACTIVE_HI		0
+#define JACKDETECT_ACTIVE_LO		1
+
+#endif
sound/soc/codecs/adau1761.c +127 -0

151 lines not on this page · raw message

sound/soc/codecs/adau1781.c +48 -0

72 lines not on this page · raw message

Signature · 1 line
2.1.4
#9 lore raw

Re: [PATCH v2 5/5] ASoC: adau17x1: Support platform data via DT

Quoted 4 lines · On Tuesday 16 February 2016 13:56:45 Andreas Irestål wrote:

Currently, it is only possible to configure HW-specific options to the adau17x1 codecs by providing a platform data struct. With this patch, it is possible to provide the same data via DT instead.

Quoted 8 lines
---
 .../devicetree/bindings/sound/adi,adau17x1.txt     |  31 +++++
 include/dt-bindings/sound/adau17x1.h               |  14 +++
 sound/soc/codecs/adau1761.c                        | 127 +++++++++++++++++++++
 sound/soc/codecs/adau1781.c                        |  48 ++++++++
 4 files changed, 220 insertions(+)
 create mode 100644 include/dt-bindings/sound/adau17x1.h

It would be nicer to avoid the need for the extra header file, those tend to cause more problems than they solve.

Quoted 6 lines
Documentation/devicetree/bindings/sound/adi,adau17x1.txt +0 -0
index 8dbce0e..6050602 100644
@@ -13,6 +13,32 @@ Required properties:
  - reg:			The i2c address. Value depends on the state of ADDR0

Documentation/devicetree/bindings/sound/adi,adau17x1.txt Required properties: · line 23

Quoted 10 lines
Documentation/devicetree/bindings/sound/adi,adau17x1.txt +8 -0
 			and ADDR1, as wired in hardware.
 
+Optional properties:
+
+ - adi,input-differential	bool to set if the input is differential
+ - adi,digital-microphone	bool to set if there is a digital microphone
+				connected to digmic/jackdet pin.
+ - adi,micbias-vg		Microphone bias voltage
+	MICBIAS_0_90_AVDD - 0.9 * AVDD
+	MICBIAS_0_65_AVDD - 0.65 * AVDD

This could be an integer property, or possibly two (mutually exclusive) boolean properties.

Documentation/devicetree/bindings/sound/adi,adau17x1.txt Required properties: · line 30

Quoted 6 lines
Documentation/devicetree/bindings/sound/adi,adau17x1.txt +6 -0
+Optional properties (ADAU1361/ADAU1461/ADAU1761/ADAU1961 only)
+
+ - adi,jack-detection	If present, configures codec to use the digmic/jackdet
+			pin for jack detection. must provide one of
+			JACKDETECT_ACTIVE_LO or JACKDETECT_ACTIVE_HI followed
+			by debounce time in ms, which must be 5, 10, 20, or 40.

I would use one integer property for debounce and one bool property for polarity.

Documentation/devicetree/bindings/sound/adi,adau17x1.txt Required properties: · line 38

Quoted 4 lines
Documentation/devicetree/bindings/sound/adi,adau17x1.txt +4 -0
+The output mode must be one of:
+	OUTPUT_MODE_HEADPHONE           - Headphone output
+	OUTPUT_MODE_HEADPHONE_CAPLESS   - Capless headphone output
+	OUTPUT_MODE_LINE                - Line output

And something along the same lines here. Or just document the three modes as numbers in the binding file.

Documentation/devicetree/bindings/sound/adi,adau17x1.txt Required properties: · line 36

Quoted 3 lines
Documentation/devicetree/bindings/sound/adi,adau17x1.txt +3 -0
+#ifdef CONFIG_OF
+static void adau1781_pdata_from_of(struct device *dev,
+				   struct adau1781_platform_data *pdata)

You can remove the #ifdef here...

Documentation/devicetree/bindings/sound/adi,adau17x1.txt Required properties: · line 37

Quoted 1 line
Documentation/devicetree/bindings/sound/adi,adau17x1.txt +1 -0
+	if (!dev->platform_data && np) {

if you change this to

	if (IS_ENABLED(CONFIG_OF) && np) {

Documentation/devicetree/bindings/sound/adi,adau17x1.txt Required properties: · line 42

Quoted 5 lines
Documentation/devicetree/bindings/sound/adi,adau17x1.txt +5 -0
+		of_pdata = devm_kzalloc(dev, sizeof(*of_pdata), GFP_KERNEL);
+		if (!of_pdata)
+			return -ENOMEM;
+		adau1781_pdata_from_of(dev, of_pdata);
+		dev->platform_data = of_pdata;

and here I'd try to avoid the dynamic allocation and just add the fields to the driver private structure. You can copy the information from the platform data in the 'else' path.

Arnd
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#10 lore raw

Re: [PATCH v2 5/5] ASoC: adau17x1: Support platform data via DT

Quoted 14 lines · Arnd Bergmann
Quoted 12 lines · On Tuesday 16 February 2016 13:56:45 Andreas Irestål wrote:

Currently, it is only possible to configure HW-specific options to the adau17x1 codecs by providing a platform data struct. With this patch, it is possible to provide the same data via DT instead.

---
 .../devicetree/bindings/sound/adi,adau17x1.txt     |  31 +++++
 include/dt-bindings/sound/adau17x1.h               |  14 +++
 sound/soc/codecs/adau1761.c                        | 127 +++++++++++++++++++++
 sound/soc/codecs/adau1781.c                        |  48 ++++++++
 4 files changed, 220 insertions(+)
 create mode 100644 include/dt-bindings/sound/adau17x1.h
Quoted 9 lines

sound/soc/codecs/adau1781.c int adau1781_probe(struct device *dev, struct regmap *regmap, · line 540

Quoted 5 lines
sound/soc/codecs/adau1781.c +5 -0
+		of_pdata = devm_kzalloc(dev, sizeof(*of_pdata), GFP_KERNEL);
+		if (!of_pdata)
+			return -ENOMEM;
+		adau1781_pdata_from_of(dev, of_pdata);
+		dev->platform_data = of_pdata;

and here I'd try to avoid the dynamic allocation and just add the fields to the driver private structure. You can copy the information from the platform data in the 'else' path.

Since the driver private structure is shared between two different codecs, the platform_data struct can be of 2 different types, but I guess it should be OK to have two fields or a
union in the private struct.

I was thinking about this too but chose the approach above since providing platform_data is optional. However, I could add some default values and submit again.

Thanks a lot for the feedback.
/Andreas

Quoted 2 lines

Arnd

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

maintainer
#11 lore raw

Re: [PATCH v2 5/5] ASoC: adau17x1: Support platform data via DT

In reply to Andreas Irestål
Quoted 3 lines · Andreas Irestål

Currently, it is only possible to configure HW-specific options to the adau17x1 codecs by providing a platform data struct. With this patch, it is possible to provide the same data via DT instead.

The subject is a red flag. Platform data and DT properties are not necessarily equivalent.

This should be part of the previous patch.

Quoted 15 lines
---
 .../devicetree/bindings/sound/adi,adau17x1.txt     |  31 +++++
 include/dt-bindings/sound/adau17x1.h               |  14 +++
 sound/soc/codecs/adau1761.c                        | 127 +++++++++++++++++++++
 sound/soc/codecs/adau1781.c                        |  48 ++++++++
 4 files changed, 220 insertions(+)
 create mode 100644 include/dt-bindings/sound/adau17x1.h
Documentation/devicetree/bindings/sound/adi,adau17x1.txt +0 -0
index 8dbce0e..6050602 100644

Documentation/devicetree/bindings/sound/adi,adau17x1.txt Required properties: · line 21

Quoted 9 lines
Documentation/devicetree/bindings/sound/adi,adau17x1.txt +6 -0
@@ -13,6 +13,32 @@ Required properties:
  - reg:			The i2c address. Value depends on the state of ADDR0
 			and ADDR1, as wired in hardware.
 
+Optional properties:
+
+ - adi,input-differential	bool to set if the input is differential
+ - adi,digital-microphone	bool to set if there is a digital microphone
+				connected to digmic/jackdet pin.
+ - adi,micbias-vg		Microphone bias voltage

In what units? Add units suffix. Also, this seems like something that should be common.

Documentation/devicetree/bindings/sound/adi,adau17x1.txt Required properties: · line 23

Quoted 2 lines
Documentation/devicetree/bindings/sound/adi,adau17x1.txt +2 -0
+	MICBIAS_0_90_AVDD - 0.9 * AVDD
+	MICBIAS_0_65_AVDD - 0.65 * AVDD

What does this mean?

Documentation/devicetree/bindings/sound/adi,adau17x1.txt Required properties: · line 30

Quoted 7 lines
Documentation/devicetree/bindings/sound/adi,adau17x1.txt +7 -0
+
+Optional properties (ADAU1361/ADAU1461/ADAU1761/ADAU1961 only)
+
+ - adi,jack-detection	If present, configures codec to use the digmic/jackdet
+			pin for jack detection. must provide one of
+			JACKDETECT_ACTIVE_LO or JACKDETECT_ACTIVE_HI followed
+			by debounce time in ms, which must be 5, 10, 20, or 40.

Seems like this could be common. No existing examples to copy?

Documentation/devicetree/bindings/sound/adi,adau17x1.txt Required properties: · line 38

Quoted 8 lines
Documentation/devicetree/bindings/sound/adi,adau17x1.txt +8 -0
+
+ - adi,lineout-mode	Set output mode of the lineout pins.
+ - adi,headphone-mode	Set output mode of the headphone pins.
+
+The output mode must be one of:
+	OUTPUT_MODE_HEADPHONE           - Headphone output
+	OUTPUT_MODE_HEADPHONE_CAPLESS   - Capless headphone output
+	OUTPUT_MODE_LINE                - Line output

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

maintainer
#12 lore raw

Re: [PATCH v2 5/5] ASoC: adau17x1: Support platform data via DT

Quoted 6 lines · Rob Herring

Documentation/devicetree/bindings/sound/adi,adau17x1.txt Required properties: · line 23

Quoted 2 lines · Andreas Irestål
Documentation/devicetree/bindings/sound/adi,adau17x1.txt +2 -0
+	MICBIAS_0_90_AVDD - 0.9 * AVDD
+	MICBIAS_0_65_AVDD - 0.65 * AVDD

What does this mean?

It's specifying the microphone bias as a function of the AVDD supply voltage. This should be obvious to anyone with any knowledge of the domain, it's a fairly common way of configuring such things.

Quoted 8 lines

Documentation/devicetree/bindings/sound/adi,adau17x1.txt Required properties: · line 30

Quoted 6 lines
Documentation/devicetree/bindings/sound/adi,adau17x1.txt +5 -0
+Optional properties (ADAU1361/ADAU1461/ADAU1761/ADAU1961 only)
 
+ - adi,jack-detection	If present, configures codec to use the digmic/jackdet
+			pin for jack detection. must provide one of
+			JACKDETECT_ACTIVE_LO or JACKDETECT_ACTIVE_HI followed
+			by debounce time in ms, which must be 5, 10, 20, or 40.

Seems like this could be common. No existing examples to copy?

If it's just a GPIO with a fancy name and some offloading (sounds like it) there's an existing binding for the GPIO.