Skip to contentSkip to conversation

ASoC: nau8822: new codec driver

PATCH In review David Lin 2 participants 6 messages Sep 28, 2018 – Oct 19, 2018

Subsystems (3)
lore
Share & tools
lore

David Lin

author
#0 lore raw

PATCH 1/1 ASoC: nau8822: new codec driver

Add driver for NAU88C22.

---
 .../devicetree/bindings/sound/nau8822.txt     |   16 +
 sound/soc/codecs/Kconfig                      |    5 +
 sound/soc/codecs/Makefile                     |    2 +
 sound/soc/codecs/nau8822.c                    | 1136 +++++++++++++++++
 sound/soc/codecs/nau8822.h                    |  204 +++
 5 files changed, 1363 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/nau8822.txt
 create mode 100644 sound/soc/codecs/nau8822.c
 create mode 100644 sound/soc/codecs/nau8822.h
Documentation/devicetree/bindings/sound/nau8822.txt new file +16 -0
new file mode 100644
index 000000000000..a471d162d4e5
@@ -0,0 +1,16 @@
+NAU8822 audio CODEC
+
+This device supports I2C only.
+
+Required properties:
+
+  - compatible : "nuvoton,nau8822"
+
+  - reg : the I2C address of the device.
+
+Example:
+
+codec: nau8822@1a {
+	compatible = "nuvoton,nau8822";
+	reg = <0x1a>;
+};
sound/soc/codecs/Kconfig +5 -0
index efb095dbcd71..57365dbc1581 100644
@@ -109,6 +109,7 @@ config SND_SOC_ALL_CODECS
 	select SND_SOC_MT6351 if MTK_PMIC_WRAP
 	select SND_SOC_NAU8540 if I2C
 	select SND_SOC_NAU8810 if I2C
+	select SND_SOC_NAU8822 if I2C
 	select SND_SOC_NAU8824 if I2C
 	select SND_SOC_NAU8825 if I2C
 	select SND_SOC_HDMI_CODEC
@@ -1299,6 +1300,10 @@ config SND_SOC_NAU8810
 	tristate "Nuvoton Technology Corporation NAU88C10 CODEC"
 	depends on I2C
 
+config SND_SOC_NAU8822
+	tristate "Nuvoton Technology Corporation NAU88C22 CODEC"
+	depends on I2C
+
 config SND_SOC_NAU8824
 	tristate "Nuvoton Technology Corporation NAU88L24 CODEC"
 	depends on I2C
sound/soc/codecs/Makefile +2 -0
index 7ae7c85e8219..181a7d222fd7 100644
@@ -106,6 +106,7 @@ snd-soc-msm8916-digital-objs := msm8916-wcd-digital.o
 snd-soc-mt6351-objs := mt6351.o
 snd-soc-nau8540-objs := nau8540.o
 snd-soc-nau8810-objs := nau8810.o
+snd-soc-nau8822-objs := nau8822.o
 snd-soc-nau8824-objs := nau8824.o
 snd-soc-nau8825-objs := nau8825.o
 snd-soc-hdmi-codec-objs := hdmi-codec.o
@@ -366,6 +367,7 @@ obj-$(CONFIG_SND_SOC_MSM8916_WCD_DIGITAL) +=snd-soc-msm8916-digital.o
 obj-$(CONFIG_SND_SOC_MT6351)	+= snd-soc-mt6351.o
 obj-$(CONFIG_SND_SOC_NAU8540)   += snd-soc-nau8540.o
 obj-$(CONFIG_SND_SOC_NAU8810)   += snd-soc-nau8810.o
+obj-$(CONFIG_SND_SOC_NAU8822)   += snd-soc-nau8822.o
 obj-$(CONFIG_SND_SOC_NAU8824)   += snd-soc-nau8824.o
 obj-$(CONFIG_SND_SOC_NAU8825)   += snd-soc-nau8825.o
 obj-$(CONFIG_SND_SOC_HDMI_CODEC)	+= snd-soc-hdmi-codec.o
sound/soc/codecs/nau8822.c new file +1136 -0

1,136 lines not on this page · raw message

sound/soc/codecs/nau8822.h new file +204 -0

204 lines not on this page · raw message

Signature · 1 line
2.18.0
maintainer
#1 lore raw

On Fri, Sep 28, 2018 at 11:10:04AM +0800, David Lin wrote:

This looks mostly good so I'm going to apply it, I do have a couple of comments below but they are quite small and I think they can be addressed with followup patches.

Quoted 7 lines

+++ b/sound/soc/codecs/nau8822.c

sound/soc/codecs/nau8822.c new file +5 -0
@@ -0,0 +1,1136 @@
+/*
+ * nau8822.c  --  NAU8822 ALSA Soc Audio Codec driver
+ *
+ * Copyright 2017 Nuvoton Technology Corp.
+ *

sound/soc/codecs/nau8822.c line 15

Quoted 10 lines
sound/soc/codecs/nau8822.c new file +10 -0
+ * Author: David Lin <[email protected]>
+ * Co-author: John Hsu <[email protected]>
+ * Co-author: Seven Li <[email protected]>
+ *
+ * Based on WM8974.c
+ *
+ * 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.
+ */

This should be converted to use a SPDX license header

	// SPDX-License-Identifier: GPL-2.0.

sound/soc/codecs/nau8822.c line 675

Quoted 6 lines
sound/soc/codecs/nau8822.c new file +6 -0
+static int nau8822_config_clkdiv(struct snd_soc_dai *dai, int div, int rate)
+{
+	struct snd_soc_component *component = dai->component;
+	struct nau8822 *nau8822 = snd_soc_component_get_drvdata(component);
+	struct nau8822_pll *pll = &nau8822->pll;
+	int i, sclk, imclk;

We're trying to get away from using set_clkdiv() as it makes it much harder to use generic card drivers without specific knowledge of the card. However in this case it seems like it's mainly choosing if we should use the MCLK directly or the PLL and you should be able to do everything in the set_sysclk() operation - is there a reason not to do that? If not then moving to set_sysclk() would avoid problems.

#2 lore raw
Quoted 25 lines · Mark Brown

On Fri, Sep 28, 2018 at 11:10:04AM +0800, David Lin wrote:

This looks mostly good so I'm going to apply it, I do have a couple of comments below but they are quite small and I think they can be addressed with followup patches.

Quoted 7 lines

+++ b/sound/soc/codecs/nau8822.c

sound/soc/codecs/nau8822.c new file +5 -0
@@ -0,0 +1,1136 @@
+/*
+ * nau8822.c  --  NAU8822 ALSA Soc Audio Codec driver
+ *
+ * Copyright 2017 Nuvoton Technology Corp.
+ *

sound/soc/codecs/nau8822.c line 15

Quoted 10 lines
sound/soc/codecs/nau8822.c new file +10 -0
+ * Author: David Lin <[email protected]>
+ * Co-author: John Hsu <[email protected]>
+ * Co-author: Seven Li <[email protected]>
+ *
+ * Based on WM8974.c
+ *
+ * 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.
+ */

This should be converted to use a SPDX license header

Quoted 1 line
      // SPDX-License-Identifier: GPL-2.0.

OK, I will convert it on next patch.

Quoted 4 lines
Quoted 4 lines
sound/soc/codecs/nau8822.c new file +4 -0
+static int nau8822_config_clkdiv(struct snd_soc_dai *dai, int div, int rate)
+{
+    struct snd_soc_component *component = dai->component;
+    struct nau8822 *nau8822 = snd_soc_component_get_drvdata(component);
Quoted 8 lines

sound/soc/codecs/nau8822.c line 675

Quoted 2 lines
sound/soc/codecs/nau8822.c new file +2 -0
+    struct nau8822_pll *pll = &nau8822->pll;
+    int i, sclk, imclk;

We're trying to get away from using set_clkdiv() as it makes it much harder to use generic card drivers without specific knowledge of the card. However in this case it seems like it's mainly choosing if we should use the MCLK directly or the PLL and you should be able to do everything in the set_sysclk() operation - is there a reason not to do that? If not then moving to set_sysclk() would avoid problems.

The nau8822_config_clkdiv() will be called internally by nau8822_hw_params(), not link to the function point (*set_clkdiv) from the structure "snd_soc_dai_ops".

If nau8822_config_clkdiv() need to simplify, I will remove case NAU8822_CLK_PLL. The reason is using set_pll() operation can also finish clk configure from machine driver.

===========================================================================================
The privileged confidential information contained in this email is intended for use only by the addressees as indicated by the original sender of this email. If you are not the addressee indicated in this email or are not responsible for delivery of the email to such a person, please kindly reply to the sender indicating this fact and delete all copies of it from your computer and network server immediately. Your cooperation is highly appreciated. It is advised that any unauthorized use of confidential information of Nuvoton is strictly prohibited; and any information in this email irrelevant to the official business of Nuvoton shall be deemed as neither given nor endorsed by Nuvoton.

maintainer
#3 lore raw
Quoted 10 lines · On Fri, Oct 19, 2018 at 12:56:53PM +0800, AC30 CTLin0 wrote:
Quoted 8 lines · Mark Brown

On Fri, Sep 28, 2018 at 11:10:04AM +0800, David Lin wrote:

We're trying to get away from using set_clkdiv() as it makes it much harder to use generic card drivers without specific knowledge of the card. However in this case it seems like it's mainly choosing if we should use the MCLK directly or the PLL and you should be able to do everything in the set_sysclk() operation - is there a reason not to do that? If not then moving to set_sysclk() would avoid problems.

Quoted 7 lines

The nau8822_config_clkdiv() will be called internally by nau8822_hw_params(), not link to the function point (*set_clkdiv) from the structure "snd_soc_dai_ops".

If nau8822_config_clkdiv() need to simplify, I will remove case NAU8822_CLK_PLL. The reason is using set_pll() operation can also finish clk configure from machine driver.

Ah, sorry - now that you mention it I think I did see that it wasn't referenced as an actual op when I looked at a previous version which is why I didn't mention it then. The current code is fine, don't worry about it.

maintainer
#4 lore raw

Applied "ASoC: nau8822: new codec driver" to the asoc tree

In reply to David Lin

The patch

ASoC: nau8822: new codec driver

has been applied to the asoc tree at

https://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 1e3cb6c321be2e5295dcaa94c2bf42a43a47a067 Mon Sep 17 00:00:00 2001

From: David Lin <[email protected]>
Date: Fri, 28 Sep 2018 11:10:04 +0800
Subject: [PATCH] ASoC: nau8822: new codec driver

Add driver for NAU88C22.

---
 .../devicetree/bindings/sound/nau8822.txt     |   16 +
 sound/soc/codecs/Kconfig                      |    5 +
 sound/soc/codecs/Makefile                     |    2 +
 sound/soc/codecs/nau8822.c                    | 1136 +++++++++++++++++
 sound/soc/codecs/nau8822.h                    |  204 +++
 5 files changed, 1363 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/nau8822.txt
 create mode 100644 sound/soc/codecs/nau8822.c
 create mode 100644 sound/soc/codecs/nau8822.h
Documentation/devicetree/bindings/sound/nau8822.txt new file +16 -0
new file mode 100644
index 000000000000..a471d162d4e5
@@ -0,0 +1,16 @@
+NAU8822 audio CODEC
+
+This device supports I2C only.
+
+Required properties:
+
+  - compatible : "nuvoton,nau8822"
+
+  - reg : the I2C address of the device.
+
+Example:
+
+codec: nau8822@1a {
+	compatible = "nuvoton,nau8822";
+	reg = <0x1a>;
+};
sound/soc/codecs/Kconfig +5 -0
index 774d38310875..9cc4f1848c9b 100644
@@ -110,6 +110,7 @@ config SND_SOC_ALL_CODECS
 	select SND_SOC_MT6351 if MTK_PMIC_WRAP
 	select SND_SOC_NAU8540 if I2C
 	select SND_SOC_NAU8810 if I2C
+	select SND_SOC_NAU8822 if I2C
 	select SND_SOC_NAU8824 if I2C
 	select SND_SOC_NAU8825 if I2C
 	select SND_SOC_HDMI_CODEC
@@ -1326,6 +1327,10 @@ config SND_SOC_NAU8810
 	tristate "Nuvoton Technology Corporation NAU88C10 CODEC"
 	depends on I2C
 
+config SND_SOC_NAU8822
+	tristate "Nuvoton Technology Corporation NAU88C22 CODEC"
+	depends on I2C
+
 config SND_SOC_NAU8824
 	tristate "Nuvoton Technology Corporation NAU88L24 CODEC"
 	depends on I2C
sound/soc/codecs/Makefile +2 -0
index 3d694c26192c..8ffab8c8dbfa 100644
@@ -107,6 +107,7 @@ snd-soc-msm8916-digital-objs := msm8916-wcd-digital.o
 snd-soc-mt6351-objs := mt6351.o
 snd-soc-nau8540-objs := nau8540.o
 snd-soc-nau8810-objs := nau8810.o
+snd-soc-nau8822-objs := nau8822.o
 snd-soc-nau8824-objs := nau8824.o
 snd-soc-nau8825-objs := nau8825.o
 snd-soc-hdmi-codec-objs := hdmi-codec.o
@@ -371,6 +372,7 @@ obj-$(CONFIG_SND_SOC_MSM8916_WCD_DIGITAL) +=snd-soc-msm8916-digital.o
 obj-$(CONFIG_SND_SOC_MT6351)	+= snd-soc-mt6351.o
 obj-$(CONFIG_SND_SOC_NAU8540)   += snd-soc-nau8540.o
 obj-$(CONFIG_SND_SOC_NAU8810)   += snd-soc-nau8810.o
+obj-$(CONFIG_SND_SOC_NAU8822)   += snd-soc-nau8822.o
 obj-$(CONFIG_SND_SOC_NAU8824)   += snd-soc-nau8824.o
 obj-$(CONFIG_SND_SOC_NAU8825)   += snd-soc-nau8825.o
 obj-$(CONFIG_SND_SOC_HDMI_CODEC)	+= snd-soc-hdmi-codec.o
sound/soc/codecs/nau8822.c new file +1136 -0

1,136 lines not on this page · raw message

sound/soc/codecs/nau8822.h new file +204 -0

204 lines not on this page · raw message

Signature · 1 line
2.19.0.rc2
maintainer
#5 lore raw

Applied "ASoC: nau8822: new codec driver" to the asoc tree

In reply to David Lin

The patch

ASoC: nau8822: new codec driver

has been applied to the asoc tree at

https://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 1e3cb6c321be2e5295dcaa94c2bf42a43a47a067 Mon Sep 17 00:00:00 2001

From: David Lin <[email protected]>
Date: Fri, 28 Sep 2018 11:10:04 +0800
Subject: [PATCH] ASoC: nau8822: new codec driver

Add driver for NAU88C22.

---
 .../devicetree/bindings/sound/nau8822.txt     |   16 +
 sound/soc/codecs/Kconfig                      |    5 +
 sound/soc/codecs/Makefile                     |    2 +
 sound/soc/codecs/nau8822.c                    | 1136 +++++++++++++++++
 sound/soc/codecs/nau8822.h                    |  204 +++
 5 files changed, 1363 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/nau8822.txt
 create mode 100644 sound/soc/codecs/nau8822.c
 create mode 100644 sound/soc/codecs/nau8822.h
Documentation/devicetree/bindings/sound/nau8822.txt new file +16 -0
new file mode 100644
index 000000000000..a471d162d4e5
@@ -0,0 +1,16 @@
+NAU8822 audio CODEC
+
+This device supports I2C only.
+
+Required properties:
+
+  - compatible : "nuvoton,nau8822"
+
+  - reg : the I2C address of the device.
+
+Example:
+
+codec: nau8822@1a {
+	compatible = "nuvoton,nau8822";
+	reg = <0x1a>;
+};
sound/soc/codecs/Kconfig +5 -0
index 774d38310875..9cc4f1848c9b 100644
@@ -110,6 +110,7 @@ config SND_SOC_ALL_CODECS
 	select SND_SOC_MT6351 if MTK_PMIC_WRAP
 	select SND_SOC_NAU8540 if I2C
 	select SND_SOC_NAU8810 if I2C
+	select SND_SOC_NAU8822 if I2C
 	select SND_SOC_NAU8824 if I2C
 	select SND_SOC_NAU8825 if I2C
 	select SND_SOC_HDMI_CODEC
@@ -1326,6 +1327,10 @@ config SND_SOC_NAU8810
 	tristate "Nuvoton Technology Corporation NAU88C10 CODEC"
 	depends on I2C
 
+config SND_SOC_NAU8822
+	tristate "Nuvoton Technology Corporation NAU88C22 CODEC"
+	depends on I2C
+
 config SND_SOC_NAU8824
 	tristate "Nuvoton Technology Corporation NAU88L24 CODEC"
 	depends on I2C
sound/soc/codecs/Makefile +2 -0
index 3d694c26192c..8ffab8c8dbfa 100644
@@ -107,6 +107,7 @@ snd-soc-msm8916-digital-objs := msm8916-wcd-digital.o
 snd-soc-mt6351-objs := mt6351.o
 snd-soc-nau8540-objs := nau8540.o
 snd-soc-nau8810-objs := nau8810.o
+snd-soc-nau8822-objs := nau8822.o
 snd-soc-nau8824-objs := nau8824.o
 snd-soc-nau8825-objs := nau8825.o
 snd-soc-hdmi-codec-objs := hdmi-codec.o
@@ -371,6 +372,7 @@ obj-$(CONFIG_SND_SOC_MSM8916_WCD_DIGITAL) +=snd-soc-msm8916-digital.o
 obj-$(CONFIG_SND_SOC_MT6351)	+= snd-soc-mt6351.o
 obj-$(CONFIG_SND_SOC_NAU8540)   += snd-soc-nau8540.o
 obj-$(CONFIG_SND_SOC_NAU8810)   += snd-soc-nau8810.o
+obj-$(CONFIG_SND_SOC_NAU8822)   += snd-soc-nau8822.o
 obj-$(CONFIG_SND_SOC_NAU8824)   += snd-soc-nau8824.o
 obj-$(CONFIG_SND_SOC_NAU8825)   += snd-soc-nau8825.o
 obj-$(CONFIG_SND_SOC_HDMI_CODEC)	+= snd-soc-hdmi-codec.o
sound/soc/codecs/nau8822.c new file +1136 -0

1,136 lines not on this page · raw message

sound/soc/codecs/nau8822.h new file +204 -0

204 lines not on this page · raw message

Signature · 1 line
2.19.0.rc2