[05/14] mfd: sun6i-prcm: Add sun8i analog codec as subnode
diff mbox

Message ID c74aea452bd1831f439dd67884cb2879e0849f03.1475571575.git.mylene.josserand@free-electrons.com
State New
Headers show

Commit Message

Mylene JOSSERAND Oct. 4, 2016, 9:46 a.m. UTC
The sun8i audio codec is using PRCM registers to configure all the
analog part of the audio codec. It is added as a subnode of the PRCM
with his resource (offset of 0x1c0).

Signed-off-by: Mylène Josserand <mylene.josserand@free-electrons.com>
---
 drivers/mfd/sun6i-prcm.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

Comments

Jean-Francois Moine Oct. 4, 2016, 10:52 a.m. UTC | #1
On Tue,  4 Oct 2016 11:46:18 +0200
Mylène Josserand <mylene.josserand@free-electrons.com> wrote:

> The sun8i audio codec is using PRCM registers to configure all the
> analog part of the audio codec. It is added as a subnode of the PRCM
> with his resource (offset of 0x1c0).
> 
> Signed-off-by: Mylène Josserand <mylene.josserand@free-electrons.com>
> ---
>  drivers/mfd/sun6i-prcm.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
	[snip]

I was heard that the PRCM as a MFD would disappear.
Lee Jones Oct. 26, 2016, 2:05 p.m. UTC | #2
On Tue, 04 Oct 2016, Mylène Josserand wrote:

> The sun8i audio codec is using PRCM registers to configure all the
> analog part of the audio codec. It is added as a subnode of the PRCM
> with his resource (offset of 0x1c0).
> 
> Signed-off-by: Mylène Josserand <mylene.josserand@free-electrons.com>
> ---
>  drivers/mfd/sun6i-prcm.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/drivers/mfd/sun6i-prcm.c b/drivers/mfd/sun6i-prcm.c
> index 011fcc5..e0c6bf5 100644
> --- a/drivers/mfd/sun6i-prcm.c
> +++ b/drivers/mfd/sun6i-prcm.c
> @@ -12,6 +12,8 @@
>  #include <linux/init.h>
>  #include <linux/of.h>
>  
> +#define SUN6I_AUDIO_CODEC_ANALOG	0x1c0
> +
>  struct prcm_data {
>  	int nsubdevs;
>  	const struct mfd_cell *subdevs;
> @@ -57,6 +59,14 @@ static const struct resource sun6i_a31_apb0_rstc_res[] = {
>  	},
>  };
>  
> +static const struct resource sun8i_adda_res[] = {
> +	{
> +		.start = SUN6I_AUDIO_CODEC_ANALOG,
> +		.end = 0x1c3,

This also needs defining.  No magic numbers please.

> +		.flags = IORESOURCE_MEM,
> +	},
> +};
> +
>  static const struct mfd_cell sun6i_a31_prcm_subdevs[] = {
>  	{
>  		.name = "sun6i-a31-ar100-clk",
> @@ -109,6 +119,12 @@ static const struct mfd_cell sun8i_a23_prcm_subdevs[] = {
>  		.num_resources = ARRAY_SIZE(sun6i_a31_apb0_rstc_res),
>  		.resources = sun6i_a31_apb0_rstc_res,
>  	},
> +	{
> +		.name = "sun8i-codec-analog",
> +		.of_compatible = "allwinner,sun8i-codec-analog",
> +		.num_resources = ARRAY_SIZE(sun8i_adda_res),
> +		.resources = sun8i_adda_res,
> +	},
>  };
>  
>  static const struct prcm_data sun6i_a31_prcm_data = {

Patch
diff mbox

diff --git a/drivers/mfd/sun6i-prcm.c b/drivers/mfd/sun6i-prcm.c
index 011fcc5..e0c6bf5 100644
--- a/drivers/mfd/sun6i-prcm.c
+++ b/drivers/mfd/sun6i-prcm.c
@@ -12,6 +12,8 @@ 
 #include <linux/init.h>
 #include <linux/of.h>
 
+#define SUN6I_AUDIO_CODEC_ANALOG	0x1c0
+
 struct prcm_data {
 	int nsubdevs;
 	const struct mfd_cell *subdevs;
@@ -57,6 +59,14 @@  static const struct resource sun6i_a31_apb0_rstc_res[] = {
 	},
 };
 
+static const struct resource sun8i_adda_res[] = {
+	{
+		.start = SUN6I_AUDIO_CODEC_ANALOG,
+		.end = 0x1c3,
+		.flags = IORESOURCE_MEM,
+	},
+};
+
 static const struct mfd_cell sun6i_a31_prcm_subdevs[] = {
 	{
 		.name = "sun6i-a31-ar100-clk",
@@ -109,6 +119,12 @@  static const struct mfd_cell sun8i_a23_prcm_subdevs[] = {
 		.num_resources = ARRAY_SIZE(sun6i_a31_apb0_rstc_res),
 		.resources = sun6i_a31_apb0_rstc_res,
 	},
+	{
+		.name = "sun8i-codec-analog",
+		.of_compatible = "allwinner,sun8i-codec-analog",
+		.num_resources = ARRAY_SIZE(sun8i_adda_res),
+		.resources = sun8i_adda_res,
+	},
 };
 
 static const struct prcm_data sun6i_a31_prcm_data = {