All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v5 0/3] ARM: mxs: add recording support for saif
@ 2011-11-11  9:30 ` Dong Aisheng
  0 siblings, 0 replies; 22+ messages in thread
From: Dong Aisheng @ 2011-11-11  9:30 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: alsa-devel, s.hauer, broonie, w.sang, kernel, u.kleine-koenig,
	lrg, shawn.guo

Changes since v4:
 * use new added master_id and master_mode in platform_data.
 The new changes depend on another patch:
 0001-ASoC-mxs-saif-remove-function-in-platform_data.patch

Changes since v3:
 * remove unneeded locking according to Sascha.
The patches are based on imx-features branch since commit:
ca4e419c2.

Changes since v2:
 * separate clkmux code into another patch according to Uwe
 * add lock according to Wolfram
 * Other minus fixes suggested by Uwe and Wolfram.
 * remove Wolfram's fix saif clock setting patch which is in v2 series
   since Wolfram will reform the clock code and send it out himself.
   For test purpose, user still needs that patch. People can get it
   from v2 series.
   The patch is:
   [PATCH v2 3/3] arm: mxs: disable clock-gates when setting saif-clocks

The patches are based on imx-features branch since commit:
f4f01e31835f.

Changes since v1:
The main changes are move mach-specific code(clkmux in DIGCTL) from
saif driver to mach-specific layer based on Wolfram's suggestion.

Note that the last patch is a RFC patch and sent out for testing
since without that patch the saif may not work.

Dong Aisheng (3):
  ARM: mxs: add saif clkmux functions
  ARM: mx28evk: add platform data for saif
  ARM: mx28evk: set a initial clock rate for saif

 arch/arm/mach-mxs/clock-mx28.c                  |   38 +++++++++++++++++++++++
 arch/arm/mach-mxs/devices-mx28.h                |    3 +-
 arch/arm/mach-mxs/devices/platform-mxs-saif.c   |    5 ++-
 arch/arm/mach-mxs/include/mach/common.h         |    1 +
 arch/arm/mach-mxs/include/mach/devices-common.h |    4 ++-
 arch/arm/mach-mxs/include/mach/digctl.h         |   21 ++++++++++++
 arch/arm/mach-mxs/mach-mx28evk.c                |   18 +++++++++-
 7 files changed, 84 insertions(+), 6 deletions(-)
 create mode 100644 arch/arm/mach-mxs/include/mach/digctl.h

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH v5 0/3] ARM: mxs: add recording support for saif
@ 2011-11-11  9:30 ` Dong Aisheng
  0 siblings, 0 replies; 22+ messages in thread
From: Dong Aisheng @ 2011-11-11  9:30 UTC (permalink / raw)
  To: linux-arm-kernel

Changes since v4:
 * use new added master_id and master_mode in platform_data.
 The new changes depend on another patch:
 0001-ASoC-mxs-saif-remove-function-in-platform_data.patch

Changes since v3:
 * remove unneeded locking according to Sascha.
The patches are based on imx-features branch since commit:
ca4e419c2.

Changes since v2:
 * separate clkmux code into another patch according to Uwe
 * add lock according to Wolfram
 * Other minus fixes suggested by Uwe and Wolfram.
 * remove Wolfram's fix saif clock setting patch which is in v2 series
   since Wolfram will reform the clock code and send it out himself.
   For test purpose, user still needs that patch. People can get it
   from v2 series.
   The patch is:
   [PATCH v2 3/3] arm: mxs: disable clock-gates when setting saif-clocks

The patches are based on imx-features branch since commit:
f4f01e31835f.

Changes since v1:
The main changes are move mach-specific code(clkmux in DIGCTL) from
saif driver to mach-specific layer based on Wolfram's suggestion.

Note that the last patch is a RFC patch and sent out for testing
since without that patch the saif may not work.

Dong Aisheng (3):
  ARM: mxs: add saif clkmux functions
  ARM: mx28evk: add platform data for saif
  ARM: mx28evk: set a initial clock rate for saif

 arch/arm/mach-mxs/clock-mx28.c                  |   38 +++++++++++++++++++++++
 arch/arm/mach-mxs/devices-mx28.h                |    3 +-
 arch/arm/mach-mxs/devices/platform-mxs-saif.c   |    5 ++-
 arch/arm/mach-mxs/include/mach/common.h         |    1 +
 arch/arm/mach-mxs/include/mach/devices-common.h |    4 ++-
 arch/arm/mach-mxs/include/mach/digctl.h         |   21 ++++++++++++
 arch/arm/mach-mxs/mach-mx28evk.c                |   18 +++++++++-
 7 files changed, 84 insertions(+), 6 deletions(-)
 create mode 100644 arch/arm/mach-mxs/include/mach/digctl.h

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH v5 1/3] ARM: mxs: add saif clkmux functions
  2011-11-11  9:30 ` Dong Aisheng
@ 2011-11-11  9:30   ` Dong Aisheng
  -1 siblings, 0 replies; 22+ messages in thread
From: Dong Aisheng @ 2011-11-11  9:30 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: alsa-devel, s.hauer, broonie, w.sang, kernel, u.kleine-koenig,
	lrg, shawn.guo

Signed-off-by: Dong Aisheng <b29396@freescale.com>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Wolfram Sang <w.sang@pengutronix.de>
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: Liam Girdwood <lrg@ti.com>

---
changes since v4:
 * remove get_master_id function.
   Instead, we use master_mode and master_id in platform_data to tell
   saif driver the correct master id for each saifs.
changes since v3:
 * remove the unneeded locking according to Sascha
changes since v2:
 * This patch is separated from the following patch based on
   suggestions from Uwe.
   [PATCH 2/3] ARM: mx28evk: add platform data for saif
---
 arch/arm/mach-mxs/clock-mx28.c          |   29 +++++++++++++++++++++++++++++
 arch/arm/mach-mxs/include/mach/common.h |    1 +
 arch/arm/mach-mxs/include/mach/digctl.h |   21 +++++++++++++++++++++
 3 files changed, 51 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-mxs/clock-mx28.c b/arch/arm/mach-mxs/clock-mx28.c
index 7954013..c51fe85 100644
--- a/arch/arm/mach-mxs/clock-mx28.c
+++ b/arch/arm/mach-mxs/clock-mx28.c
@@ -22,6 +22,7 @@
 #include <linux/io.h>
 #include <linux/jiffies.h>
 #include <linux/clkdev.h>
+#include <linux/spinlock.h>
 
 #include <asm/clkdev.h>
 #include <asm/div64.h>
@@ -29,6 +30,7 @@
 #include <mach/mx28.h>
 #include <mach/common.h>
 #include <mach/clock.h>
+#include <mach/digctl.h>
 
 #include "regs-clkctrl-mx28.h"
 
@@ -43,6 +45,33 @@ static struct clk emi_clk;
 static struct clk saif0_clk;
 static struct clk saif1_clk;
 static struct clk clk32k_clk;
+static DEFINE_SPINLOCK(clkmux_lock);
+
+/*
+ * HW_SAIF_CLKMUX_SEL:
+ *  DIRECT(0x0): SAIF0 clock pins selected for SAIF0 input clocks, and SAIF1
+ *		clock pins selected for SAIF1 input clocks.
+ *  CROSSINPUT(0x1): SAIF1 clock inputs selected for SAIF0 input clocks, and
+ *		SAIF0 clock inputs selected for SAIF1 input clocks.
+ *  EXTMSTR0(0x2): SAIF0 clock pin selected for both SAIF0 and SAIF1 input
+ *		clocks.
+ *  EXTMSTR1(0x3): SAIF1 clock pin selected for both SAIF0 and SAIF1 input
+ *		clocks.
+ */
+int mxs_saif_clkmux_select(unsigned int clkmux)
+{
+	if (clkmux > 0x3)
+		return -EINVAL;
+
+	spin_lock(&clkmux_lock);
+	__raw_writel(BM_DIGCTL_CTRL_SAIF_CLKMUX,
+			DIGCTRL_BASE_ADDR + HW_DIGCTL_CTRL + MXS_CLR_ADDR);
+	__raw_writel(clkmux << BP_DIGCTL_CTRL_SAIF_CLKMUX,
+			DIGCTRL_BASE_ADDR + HW_DIGCTL_CTRL + MXS_SET_ADDR);
+	spin_unlock(&clkmux_lock);
+
+	return 0;
+}
 
 static int _raw_clk_enable(struct clk *clk)
 {
diff --git a/arch/arm/mach-mxs/include/mach/common.h b/arch/arm/mach-mxs/include/mach/common.h
index 635bb5d..3bbb94f 100644
--- a/arch/arm/mach-mxs/include/mach/common.h
+++ b/arch/arm/mach-mxs/include/mach/common.h
@@ -16,6 +16,7 @@ struct clk;
 extern const u32 *mxs_get_ocotp(void);
 extern int mxs_reset_block(void __iomem *);
 extern void mxs_timer_init(struct clk *, int);
+extern int mxs_saif_clkmux_select(unsigned int clkmux);
 
 extern int mx23_register_gpios(void);
 extern int mx23_clocks_init(void);
diff --git a/arch/arm/mach-mxs/include/mach/digctl.h b/arch/arm/mach-mxs/include/mach/digctl.h
new file mode 100644
index 0000000..9bd0496
--- /dev/null
+++ b/arch/arm/mach-mxs/include/mach/digctl.h
@@ -0,0 +1,21 @@
+/*
+ * Copyright 2011 Freescale Semiconductor, Inc. All Rights Reserved.
+ *
+ * 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 __MACH_DIGCTL_H__
+#define __MACH_DIGCTL_H__
+
+/* MXS DIGCTL SAIF CLKMUX */
+#define MXS_DIGCTL_SAIF_CLKMUX_DIRECT		0x0
+#define MXS_DIGCTL_SAIF_CLKMUX_CROSSINPUT	0x1
+#define MXS_DIGCTL_SAIF_CLKMUX_EXTMSTR0		0x2
+#define MXS_DIGCTL_SAIF_CLKMUX_EXTMSTR1		0x3
+
+#define HW_DIGCTL_CTRL			0x0
+#define  BP_DIGCTL_CTRL_SAIF_CLKMUX	(10)
+#define  BM_DIGCTL_CTRL_SAIF_CLKMUX	(0x3 << 10)
+#endif
-- 
1.7.0.4


_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH v5 1/3] ARM: mxs: add saif clkmux functions
@ 2011-11-11  9:30   ` Dong Aisheng
  0 siblings, 0 replies; 22+ messages in thread
From: Dong Aisheng @ 2011-11-11  9:30 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Dong Aisheng <b29396@freescale.com>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Wolfram Sang <w.sang@pengutronix.de>
Cc: Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: Liam Girdwood <lrg@ti.com>

---
changes since v4:
 * remove get_master_id function.
   Instead, we use master_mode and master_id in platform_data to tell
   saif driver the correct master id for each saifs.
changes since v3:
 * remove the unneeded locking according to Sascha
changes since v2:
 * This patch is separated from the following patch based on
   suggestions from Uwe.
   [PATCH 2/3] ARM: mx28evk: add platform data for saif
---
 arch/arm/mach-mxs/clock-mx28.c          |   29 +++++++++++++++++++++++++++++
 arch/arm/mach-mxs/include/mach/common.h |    1 +
 arch/arm/mach-mxs/include/mach/digctl.h |   21 +++++++++++++++++++++
 3 files changed, 51 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-mxs/clock-mx28.c b/arch/arm/mach-mxs/clock-mx28.c
index 7954013..c51fe85 100644
--- a/arch/arm/mach-mxs/clock-mx28.c
+++ b/arch/arm/mach-mxs/clock-mx28.c
@@ -22,6 +22,7 @@
 #include <linux/io.h>
 #include <linux/jiffies.h>
 #include <linux/clkdev.h>
+#include <linux/spinlock.h>
 
 #include <asm/clkdev.h>
 #include <asm/div64.h>
@@ -29,6 +30,7 @@
 #include <mach/mx28.h>
 #include <mach/common.h>
 #include <mach/clock.h>
+#include <mach/digctl.h>
 
 #include "regs-clkctrl-mx28.h"
 
@@ -43,6 +45,33 @@ static struct clk emi_clk;
 static struct clk saif0_clk;
 static struct clk saif1_clk;
 static struct clk clk32k_clk;
+static DEFINE_SPINLOCK(clkmux_lock);
+
+/*
+ * HW_SAIF_CLKMUX_SEL:
+ *  DIRECT(0x0): SAIF0 clock pins selected for SAIF0 input clocks, and SAIF1
+ *		clock pins selected for SAIF1 input clocks.
+ *  CROSSINPUT(0x1): SAIF1 clock inputs selected for SAIF0 input clocks, and
+ *		SAIF0 clock inputs selected for SAIF1 input clocks.
+ *  EXTMSTR0(0x2): SAIF0 clock pin selected for both SAIF0 and SAIF1 input
+ *		clocks.
+ *  EXTMSTR1(0x3): SAIF1 clock pin selected for both SAIF0 and SAIF1 input
+ *		clocks.
+ */
+int mxs_saif_clkmux_select(unsigned int clkmux)
+{
+	if (clkmux > 0x3)
+		return -EINVAL;
+
+	spin_lock(&clkmux_lock);
+	__raw_writel(BM_DIGCTL_CTRL_SAIF_CLKMUX,
+			DIGCTRL_BASE_ADDR + HW_DIGCTL_CTRL + MXS_CLR_ADDR);
+	__raw_writel(clkmux << BP_DIGCTL_CTRL_SAIF_CLKMUX,
+			DIGCTRL_BASE_ADDR + HW_DIGCTL_CTRL + MXS_SET_ADDR);
+	spin_unlock(&clkmux_lock);
+
+	return 0;
+}
 
 static int _raw_clk_enable(struct clk *clk)
 {
diff --git a/arch/arm/mach-mxs/include/mach/common.h b/arch/arm/mach-mxs/include/mach/common.h
index 635bb5d..3bbb94f 100644
--- a/arch/arm/mach-mxs/include/mach/common.h
+++ b/arch/arm/mach-mxs/include/mach/common.h
@@ -16,6 +16,7 @@ struct clk;
 extern const u32 *mxs_get_ocotp(void);
 extern int mxs_reset_block(void __iomem *);
 extern void mxs_timer_init(struct clk *, int);
+extern int mxs_saif_clkmux_select(unsigned int clkmux);
 
 extern int mx23_register_gpios(void);
 extern int mx23_clocks_init(void);
diff --git a/arch/arm/mach-mxs/include/mach/digctl.h b/arch/arm/mach-mxs/include/mach/digctl.h
new file mode 100644
index 0000000..9bd0496
--- /dev/null
+++ b/arch/arm/mach-mxs/include/mach/digctl.h
@@ -0,0 +1,21 @@
+/*
+ * Copyright 2011 Freescale Semiconductor, Inc. All Rights Reserved.
+ *
+ * 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 __MACH_DIGCTL_H__
+#define __MACH_DIGCTL_H__
+
+/* MXS DIGCTL SAIF CLKMUX */
+#define MXS_DIGCTL_SAIF_CLKMUX_DIRECT		0x0
+#define MXS_DIGCTL_SAIF_CLKMUX_CROSSINPUT	0x1
+#define MXS_DIGCTL_SAIF_CLKMUX_EXTMSTR0		0x2
+#define MXS_DIGCTL_SAIF_CLKMUX_EXTMSTR1		0x3
+
+#define HW_DIGCTL_CTRL			0x0
+#define  BP_DIGCTL_CTRL_SAIF_CLKMUX	(10)
+#define  BM_DIGCTL_CTRL_SAIF_CLKMUX	(0x3 << 10)
+#endif
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH v5 2/3] ARM: mx28evk: add platform data for saif
  2011-11-11  9:30 ` Dong Aisheng
@ 2011-11-11  9:30   ` Dong Aisheng
  -1 siblings, 0 replies; 22+ messages in thread
From: Dong Aisheng @ 2011-11-11  9:30 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: alsa-devel, s.hauer, broonie, w.sang, kernel, u.kleine-koenig,
	lrg, shawn.guo

This is for supporting saif record function.

Signed-off-by: Dong Aisheng <b29396@freescale.com>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Wolfram Sang <w.sang@pengutronix.de>
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: Liam Girdwood <lrg@ti.com>

---
Changes since v4:
 * Using the new added master_id and master_mode in platfrom_data
No changes since v3:
Changes since v2:
 * separate clkmux code into another patch
 * A few minus fixes suggested by Uwe & Wolfram.
Changes since v1:
 * move saif clkmux code into mach-specific part
---
 arch/arm/mach-mxs/devices-mx28.h                |    3 ++-
 arch/arm/mach-mxs/devices/platform-mxs-saif.c   |    5 +++--
 arch/arm/mach-mxs/include/mach/devices-common.h |    4 +++-
 arch/arm/mach-mxs/mach-mx28evk.c                |   18 ++++++++++++++++--
 4 files changed, 24 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-mxs/devices-mx28.h b/arch/arm/mach-mxs/devices-mx28.h
index c888710..4f50094 100644
--- a/arch/arm/mach-mxs/devices-mx28.h
+++ b/arch/arm/mach-mxs/devices-mx28.h
@@ -47,6 +47,7 @@ struct platform_device *__init mx28_add_mxsfb(
 		const struct mxsfb_platform_data *pdata);
 
 extern const struct mxs_saif_data mx28_saif_data[] __initconst;
-#define mx28_add_saif(id)              mxs_add_saif(&mx28_saif_data[id])
+#define mx28_add_saif(id, pdata) \
+	mxs_add_saif(&mx28_saif_data[id], pdata)
 
 struct platform_device *__init mx28_add_rtc_stmp3xxx(void);
diff --git a/arch/arm/mach-mxs/devices/platform-mxs-saif.c b/arch/arm/mach-mxs/devices/platform-mxs-saif.c
index 1ec965e..f6e3a60 100644
--- a/arch/arm/mach-mxs/devices/platform-mxs-saif.c
+++ b/arch/arm/mach-mxs/devices/platform-mxs-saif.c
@@ -32,7 +32,8 @@ const struct mxs_saif_data mx28_saif_data[] __initconst = {
 };
 #endif
 
-struct platform_device *__init mxs_add_saif(const struct mxs_saif_data *data)
+struct platform_device *__init mxs_add_saif(const struct mxs_saif_data *data,
+				const struct mxs_saif_platform_data *pdata)
 {
 	struct resource res[] = {
 		{
@@ -56,5 +57,5 @@ struct platform_device *__init mxs_add_saif(const struct mxs_saif_data *data)
 	};
 
 	return mxs_add_platform_device("mxs-saif", data->id, res,
-					ARRAY_SIZE(res), NULL, 0);
+				ARRAY_SIZE(res), pdata, sizeof(*pdata));
 }
diff --git a/arch/arm/mach-mxs/include/mach/devices-common.h b/arch/arm/mach-mxs/include/mach/devices-common.h
index a8080f4..dc369c1 100644
--- a/arch/arm/mach-mxs/include/mach/devices-common.h
+++ b/arch/arm/mach-mxs/include/mach/devices-common.h
@@ -94,6 +94,7 @@ struct platform_device *__init mxs_add_mxs_pwm(
 		resource_size_t iobase, int id);
 
 /* saif */
+#include <sound/saif.h>
 struct mxs_saif_data {
 	int id;
 	resource_size_t iobase;
@@ -103,4 +104,5 @@ struct mxs_saif_data {
 };
 
 struct platform_device *__init mxs_add_saif(
-		const struct mxs_saif_data *data);
+		const struct mxs_saif_data *data,
+		const struct mxs_saif_platform_data *pdata);
diff --git a/arch/arm/mach-mxs/mach-mx28evk.c b/arch/arm/mach-mxs/mach-mx28evk.c
index 4a3cca3..cfe7910 100644
--- a/arch/arm/mach-mxs/mach-mx28evk.c
+++ b/arch/arm/mach-mxs/mach-mx28evk.c
@@ -28,6 +28,7 @@
 
 #include <mach/common.h>
 #include <mach/iomux-mx28.h>
+#include <mach/digctl.h>
 
 #include "devices-mx28.h"
 
@@ -417,6 +418,18 @@ static void __init mx28evk_add_regulators(void)
 static void __init mx28evk_add_regulators(void) {}
 #endif
 
+static const struct mxs_saif_platform_data
+			mx28evk_mxs_saif_pdata[] __initconst = {
+	/* working on EXTMSTR0 mode (saif0 master, saif1 slave) */
+	{
+		.master_mode = 1;
+		.master_id = 0;
+	}, {
+		.master_mode = 0;
+		.master_id = 0;
+	},
+};
+
 static void __init mx28evk_init(void)
 {
 	int ret;
@@ -457,8 +470,9 @@ static void __init mx28evk_init(void)
 
 	mx28_add_mxsfb(&mx28evk_mxsfb_pdata);
 
-	mx28_add_saif(0);
-	mx28_add_saif(1);
+	mxs_saif_clkmux_select(MXS_DIGCTL_SAIF_CLKMUX_EXTMSTR0);
+	mx28_add_saif(0, &mx28evk_mxs_saif_pdata[0]);
+	mx28_add_saif(1, &mx28evk_mxs_saif_pdata[1]);
 
 	mx28_add_mxs_i2c(0);
 	i2c_register_board_info(0, mxs_i2c0_board_info,
-- 
1.7.0.4


_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH v5 2/3] ARM: mx28evk: add platform data for saif
@ 2011-11-11  9:30   ` Dong Aisheng
  0 siblings, 0 replies; 22+ messages in thread
From: Dong Aisheng @ 2011-11-11  9:30 UTC (permalink / raw)
  To: linux-arm-kernel

This is for supporting saif record function.

Signed-off-by: Dong Aisheng <b29396@freescale.com>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Wolfram Sang <w.sang@pengutronix.de>
Cc: Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: Liam Girdwood <lrg@ti.com>

---
Changes since v4:
 * Using the new added master_id and master_mode in platfrom_data
No changes since v3:
Changes since v2:
 * separate clkmux code into another patch
 * A few minus fixes suggested by Uwe & Wolfram.
Changes since v1:
 * move saif clkmux code into mach-specific part
---
 arch/arm/mach-mxs/devices-mx28.h                |    3 ++-
 arch/arm/mach-mxs/devices/platform-mxs-saif.c   |    5 +++--
 arch/arm/mach-mxs/include/mach/devices-common.h |    4 +++-
 arch/arm/mach-mxs/mach-mx28evk.c                |   18 ++++++++++++++++--
 4 files changed, 24 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-mxs/devices-mx28.h b/arch/arm/mach-mxs/devices-mx28.h
index c888710..4f50094 100644
--- a/arch/arm/mach-mxs/devices-mx28.h
+++ b/arch/arm/mach-mxs/devices-mx28.h
@@ -47,6 +47,7 @@ struct platform_device *__init mx28_add_mxsfb(
 		const struct mxsfb_platform_data *pdata);
 
 extern const struct mxs_saif_data mx28_saif_data[] __initconst;
-#define mx28_add_saif(id)              mxs_add_saif(&mx28_saif_data[id])
+#define mx28_add_saif(id, pdata) \
+	mxs_add_saif(&mx28_saif_data[id], pdata)
 
 struct platform_device *__init mx28_add_rtc_stmp3xxx(void);
diff --git a/arch/arm/mach-mxs/devices/platform-mxs-saif.c b/arch/arm/mach-mxs/devices/platform-mxs-saif.c
index 1ec965e..f6e3a60 100644
--- a/arch/arm/mach-mxs/devices/platform-mxs-saif.c
+++ b/arch/arm/mach-mxs/devices/platform-mxs-saif.c
@@ -32,7 +32,8 @@ const struct mxs_saif_data mx28_saif_data[] __initconst = {
 };
 #endif
 
-struct platform_device *__init mxs_add_saif(const struct mxs_saif_data *data)
+struct platform_device *__init mxs_add_saif(const struct mxs_saif_data *data,
+				const struct mxs_saif_platform_data *pdata)
 {
 	struct resource res[] = {
 		{
@@ -56,5 +57,5 @@ struct platform_device *__init mxs_add_saif(const struct mxs_saif_data *data)
 	};
 
 	return mxs_add_platform_device("mxs-saif", data->id, res,
-					ARRAY_SIZE(res), NULL, 0);
+				ARRAY_SIZE(res), pdata, sizeof(*pdata));
 }
diff --git a/arch/arm/mach-mxs/include/mach/devices-common.h b/arch/arm/mach-mxs/include/mach/devices-common.h
index a8080f4..dc369c1 100644
--- a/arch/arm/mach-mxs/include/mach/devices-common.h
+++ b/arch/arm/mach-mxs/include/mach/devices-common.h
@@ -94,6 +94,7 @@ struct platform_device *__init mxs_add_mxs_pwm(
 		resource_size_t iobase, int id);
 
 /* saif */
+#include <sound/saif.h>
 struct mxs_saif_data {
 	int id;
 	resource_size_t iobase;
@@ -103,4 +104,5 @@ struct mxs_saif_data {
 };
 
 struct platform_device *__init mxs_add_saif(
-		const struct mxs_saif_data *data);
+		const struct mxs_saif_data *data,
+		const struct mxs_saif_platform_data *pdata);
diff --git a/arch/arm/mach-mxs/mach-mx28evk.c b/arch/arm/mach-mxs/mach-mx28evk.c
index 4a3cca3..cfe7910 100644
--- a/arch/arm/mach-mxs/mach-mx28evk.c
+++ b/arch/arm/mach-mxs/mach-mx28evk.c
@@ -28,6 +28,7 @@
 
 #include <mach/common.h>
 #include <mach/iomux-mx28.h>
+#include <mach/digctl.h>
 
 #include "devices-mx28.h"
 
@@ -417,6 +418,18 @@ static void __init mx28evk_add_regulators(void)
 static void __init mx28evk_add_regulators(void) {}
 #endif
 
+static const struct mxs_saif_platform_data
+			mx28evk_mxs_saif_pdata[] __initconst = {
+	/* working on EXTMSTR0 mode (saif0 master, saif1 slave) */
+	{
+		.master_mode = 1;
+		.master_id = 0;
+	}, {
+		.master_mode = 0;
+		.master_id = 0;
+	},
+};
+
 static void __init mx28evk_init(void)
 {
 	int ret;
@@ -457,8 +470,9 @@ static void __init mx28evk_init(void)
 
 	mx28_add_mxsfb(&mx28evk_mxsfb_pdata);
 
-	mx28_add_saif(0);
-	mx28_add_saif(1);
+	mxs_saif_clkmux_select(MXS_DIGCTL_SAIF_CLKMUX_EXTMSTR0);
+	mx28_add_saif(0, &mx28evk_mxs_saif_pdata[0]);
+	mx28_add_saif(1, &mx28evk_mxs_saif_pdata[1]);
 
 	mx28_add_mxs_i2c(0);
 	i2c_register_board_info(0, mxs_i2c0_board_info,
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH v5 3/3] ARM: mx28evk: set a initial clock rate for saif
  2011-11-11  9:30 ` Dong Aisheng
@ 2011-11-11  9:30   ` Dong Aisheng
  -1 siblings, 0 replies; 22+ messages in thread
From: Dong Aisheng @ 2011-11-11  9:30 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: alsa-devel, s.hauer, broonie, w.sang, kernel, u.kleine-koenig,
	lrg, shawn.guo

Signed-off-by: Dong Aisheng <b29396@freescale.com>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Wolfram Sang <w.sang@pengutronix.de>
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: Liam Girdwood <lrg@ti.com>

---
Changes since v1:
 * make comments a little better.
   It's originally suggested by Uwe.
---
 arch/arm/mach-mxs/clock-mx28.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-mxs/clock-mx28.c b/arch/arm/mach-mxs/clock-mx28.c
index c51fe85..b0c248d 100644
--- a/arch/arm/mach-mxs/clock-mx28.c
+++ b/arch/arm/mach-mxs/clock-mx28.c
@@ -808,6 +808,15 @@ int __init mx28_clocks_init(void)
 	clk_set_parent(&saif0_clk, &pll0_clk);
 	clk_set_parent(&saif1_clk, &pll0_clk);
 
+	/*
+	 * Set an initial clock rate for the saif internal logic to work
+	 * properly. This is important when working in EXTMASTER mode that
+	 * uses the other saif's BITCLK&LRCLK but it still needs a basic
+	 * clock which should be fast enough for the internal logic.
+	 */
+	clk_set_rate(&saif0_clk, 24000000);
+	clk_set_rate(&saif1_clk, 24000000);
+
 	clkdev_add_table(lookups, ARRAY_SIZE(lookups));
 
 	mxs_timer_init(&clk32k_clk, MX28_INT_TIMER0);
-- 
1.7.0.4



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH v5 3/3] ARM: mx28evk: set a initial clock rate for saif
@ 2011-11-11  9:30   ` Dong Aisheng
  0 siblings, 0 replies; 22+ messages in thread
From: Dong Aisheng @ 2011-11-11  9:30 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Dong Aisheng <b29396@freescale.com>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Wolfram Sang <w.sang@pengutronix.de>
Cc: Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: Liam Girdwood <lrg@ti.com>

---
Changes since v1:
 * make comments a little better.
   It's originally suggested by Uwe.
---
 arch/arm/mach-mxs/clock-mx28.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-mxs/clock-mx28.c b/arch/arm/mach-mxs/clock-mx28.c
index c51fe85..b0c248d 100644
--- a/arch/arm/mach-mxs/clock-mx28.c
+++ b/arch/arm/mach-mxs/clock-mx28.c
@@ -808,6 +808,15 @@ int __init mx28_clocks_init(void)
 	clk_set_parent(&saif0_clk, &pll0_clk);
 	clk_set_parent(&saif1_clk, &pll0_clk);
 
+	/*
+	 * Set an initial clock rate for the saif internal logic to work
+	 * properly. This is important when working in EXTMASTER mode that
+	 * uses the other saif's BITCLK&LRCLK but it still needs a basic
+	 * clock which should be fast enough for the internal logic.
+	 */
+	clk_set_rate(&saif0_clk, 24000000);
+	clk_set_rate(&saif1_clk, 24000000);
+
 	clkdev_add_table(lookups, ARRAY_SIZE(lookups));
 
 	mxs_timer_init(&clk32k_clk, MX28_INT_TIMER0);
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* Re: [PATCH v5 0/3] ARM: mxs: add recording support for saif
  2011-11-11  9:30 ` Dong Aisheng
@ 2011-11-18  3:51   ` Dong Aisheng-B29396
  -1 siblings, 0 replies; 22+ messages in thread
From: Dong Aisheng-B29396 @ 2011-11-18  3:51 UTC (permalink / raw)
  To: linux-arm-kernel, s.hauer, Guo Shawn-R65073
  Cc: alsa-devel, broonie, w.sang, kernel, u.kleine-koenig, lrg

Hi All,

> -----Original Message-----
> From: linux-arm-kernel-bounces@lists.infradead.org [mailto:linux-arm-
> kernel-bounces@lists.infradead.org] On Behalf Of Dong Aisheng
> Sent: Friday, November 11, 2011 5:31 PM
> To: linux-arm-kernel@lists.infradead.org
> Cc: alsa-devel@alsa-project.org; s.hauer@pengutronix.de;
> broonie@opensource.wolfsonmicro.com; w.sang@pengutronix.de;
> kernel@pengutronix.de; u.kleine-koenig@pengutronix.de; lrg@ti.com; Guo
> Shawn-R65073
> Subject: [PATCH v5 0/3] ARM: mxs: add recording support for saif
>
> Changes since v4:
>  * use new added master_id and master_mode in platform_data.
>  The new changes depend on another patch:
>  0001-ASoC-mxs-saif-remove-function-in-platform_data.patch
> 
> Changes since v3:
>  * remove unneeded locking according to Sascha.
> The patches are based on imx-features branch since commit:
> ca4e419c2.
> 
> Changes since v2:
>  * separate clkmux code into another patch according to Uwe
>  * add lock according to Wolfram
>  * Other minus fixes suggested by Uwe and Wolfram.
>  * remove Wolfram's fix saif clock setting patch which is in v2 series
>    since Wolfram will reform the clock code and send it out himself.
>    For test purpose, user still needs that patch. People can get it
>    from v2 series.
>    The patch is:
>    [PATCH v2 3/3] arm: mxs: disable clock-gates when setting saif-clocks
> 
> The patches are based on imx-features branch since commit:
> f4f01e31835f.
> 
> Changes since v1:
> The main changes are move mach-specific code(clkmux in DIGCTL) from saif
> driver to mach-specific layer based on Wolfram's suggestion.
> 
> Note that the last patch is a RFC patch and sent out for testing since
> without that patch the saif may not work.
> 
> Dong Aisheng (3):
>   ARM: mxs: add saif clkmux functions
>   ARM: mx28evk: add platform data for saif
>   ARM: mx28evk: set a initial clock rate for saif
> 
>  arch/arm/mach-mxs/clock-mx28.c                  |   38
> +++++++++++++++++++++++
>  arch/arm/mach-mxs/devices-mx28.h                |    3 +-
>  arch/arm/mach-mxs/devices/platform-mxs-saif.c   |    5 ++-
>  arch/arm/mach-mxs/include/mach/common.h         |    1 +
>  arch/arm/mach-mxs/include/mach/devices-common.h |    4 ++-
>  arch/arm/mach-mxs/include/mach/digctl.h         |   21 ++++++++++++
>  arch/arm/mach-mxs/mach-mx28evk.c                |   18 +++++++++-
>  7 files changed, 84 insertions(+), 6 deletions(-)  create mode 100644
> arch/arm/mach-mxs/include/mach/digctl.h
> 
Any comment or tag for this new series?

Regards
Dong Aisheng

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH v5 0/3] ARM: mxs: add recording support for saif
@ 2011-11-18  3:51   ` Dong Aisheng-B29396
  0 siblings, 0 replies; 22+ messages in thread
From: Dong Aisheng-B29396 @ 2011-11-18  3:51 UTC (permalink / raw)
  To: linux-arm-kernel

Hi All,

> -----Original Message-----
> From: linux-arm-kernel-bounces at lists.infradead.org [mailto:linux-arm-
> kernel-bounces at lists.infradead.org] On Behalf Of Dong Aisheng
> Sent: Friday, November 11, 2011 5:31 PM
> To: linux-arm-kernel at lists.infradead.org
> Cc: alsa-devel at alsa-project.org; s.hauer at pengutronix.de;
> broonie at opensource.wolfsonmicro.com; w.sang at pengutronix.de;
> kernel at pengutronix.de; u.kleine-koenig at pengutronix.de; lrg at ti.com; Guo
> Shawn-R65073
> Subject: [PATCH v5 0/3] ARM: mxs: add recording support for saif
>
> Changes since v4:
>  * use new added master_id and master_mode in platform_data.
>  The new changes depend on another patch:
>  0001-ASoC-mxs-saif-remove-function-in-platform_data.patch
> 
> Changes since v3:
>  * remove unneeded locking according to Sascha.
> The patches are based on imx-features branch since commit:
> ca4e419c2.
> 
> Changes since v2:
>  * separate clkmux code into another patch according to Uwe
>  * add lock according to Wolfram
>  * Other minus fixes suggested by Uwe and Wolfram.
>  * remove Wolfram's fix saif clock setting patch which is in v2 series
>    since Wolfram will reform the clock code and send it out himself.
>    For test purpose, user still needs that patch. People can get it
>    from v2 series.
>    The patch is:
>    [PATCH v2 3/3] arm: mxs: disable clock-gates when setting saif-clocks
> 
> The patches are based on imx-features branch since commit:
> f4f01e31835f.
> 
> Changes since v1:
> The main changes are move mach-specific code(clkmux in DIGCTL) from saif
> driver to mach-specific layer based on Wolfram's suggestion.
> 
> Note that the last patch is a RFC patch and sent out for testing since
> without that patch the saif may not work.
> 
> Dong Aisheng (3):
>   ARM: mxs: add saif clkmux functions
>   ARM: mx28evk: add platform data for saif
>   ARM: mx28evk: set a initial clock rate for saif
> 
>  arch/arm/mach-mxs/clock-mx28.c                  |   38
> +++++++++++++++++++++++
>  arch/arm/mach-mxs/devices-mx28.h                |    3 +-
>  arch/arm/mach-mxs/devices/platform-mxs-saif.c   |    5 ++-
>  arch/arm/mach-mxs/include/mach/common.h         |    1 +
>  arch/arm/mach-mxs/include/mach/devices-common.h |    4 ++-
>  arch/arm/mach-mxs/include/mach/digctl.h         |   21 ++++++++++++
>  arch/arm/mach-mxs/mach-mx28evk.c                |   18 +++++++++-
>  7 files changed, 84 insertions(+), 6 deletions(-)  create mode 100644
> arch/arm/mach-mxs/include/mach/digctl.h
> 
Any comment or tag for this new series?

Regards
Dong Aisheng

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v5 1/3] ARM: mxs: add saif clkmux functions
  2011-11-11  9:30   ` Dong Aisheng
@ 2011-11-18  4:54     ` Marek Vasut
  -1 siblings, 0 replies; 22+ messages in thread
From: Marek Vasut @ 2011-11-18  4:54 UTC (permalink / raw)
  To: alsa-devel
  Cc: s.hauer, broonie, w.sang, shawn.guo, kernel, u.kleine-koenig,
	Dong Aisheng, lrg, linux-arm-kernel

> Signed-off-by: Dong Aisheng <b29396@freescale.com>
> Cc: Sascha Hauer <s.hauer@pengutronix.de>
> Cc: Wolfram Sang <w.sang@pengutronix.de>
> Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
> Cc: Liam Girdwood <lrg@ti.com>
> 
> ---
> changes since v4:
>  * remove get_master_id function.
>    Instead, we use master_mode and master_id in platform_data to tell
>    saif driver the correct master id for each saifs.
> changes since v3:
>  * remove the unneeded locking according to Sascha
> changes since v2:
>  * This patch is separated from the following patch based on
>    suggestions from Uwe.
>    [PATCH 2/3] ARM: mx28evk: add platform data for saif
> ---
>  arch/arm/mach-mxs/clock-mx28.c          |   29
> +++++++++++++++++++++++++++++ arch/arm/mach-mxs/include/mach/common.h |   
> 1 +
>  arch/arm/mach-mxs/include/mach/digctl.h |   21 +++++++++++++++++++++
>  3 files changed, 51 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/mach-mxs/clock-mx28.c
> b/arch/arm/mach-mxs/clock-mx28.c index 7954013..c51fe85 100644
> --- a/arch/arm/mach-mxs/clock-mx28.c
> +++ b/arch/arm/mach-mxs/clock-mx28.c
> @@ -22,6 +22,7 @@
>  #include <linux/io.h>
>  #include <linux/jiffies.h>
>  #include <linux/clkdev.h>
> +#include <linux/spinlock.h>
> 
>  #include <asm/clkdev.h>
>  #include <asm/div64.h>
> @@ -29,6 +30,7 @@
>  #include <mach/mx28.h>
>  #include <mach/common.h>
>  #include <mach/clock.h>
> +#include <mach/digctl.h>
> 
>  #include "regs-clkctrl-mx28.h"
> 
> @@ -43,6 +45,33 @@ static struct clk emi_clk;
>  static struct clk saif0_clk;
>  static struct clk saif1_clk;
>  static struct clk clk32k_clk;
> +static DEFINE_SPINLOCK(clkmux_lock);
> +
> +/*
> + * HW_SAIF_CLKMUX_SEL:
> + *  DIRECT(0x0): SAIF0 clock pins selected for SAIF0 input clocks, and
> SAIF1 + *		clock pins selected for SAIF1 input clocks.
> + *  CROSSINPUT(0x1): SAIF1 clock inputs selected for SAIF0 input clocks,
> and + *		SAIF0 clock inputs selected for SAIF1 input clocks.
> + *  EXTMSTR0(0x2): SAIF0 clock pin selected for both SAIF0 and SAIF1 input
> + *		clocks.
> + *  EXTMSTR1(0x3): SAIF1 clock pin selected for both SAIF0 and SAIF1 input
> + *		clocks.
> + */
> +int mxs_saif_clkmux_select(unsigned int clkmux)
> +{
> +	if (clkmux > 0x3)
> +		return -EINVAL;
> +
> +	spin_lock(&clkmux_lock);
> +	__raw_writel(BM_DIGCTL_CTRL_SAIF_CLKMUX,
> +			DIGCTRL_BASE_ADDR + HW_DIGCTL_CTRL + MXS_CLR_ADDR);
> +	__raw_writel(clkmux << BP_DIGCTL_CTRL_SAIF_CLKMUX,
> +			DIGCTRL_BASE_ADDR + HW_DIGCTL_CTRL + MXS_SET_ADDR);
> +	spin_unlock(&clkmux_lock);
> +
> +	return 0;
> +}
> 
>  static int _raw_clk_enable(struct clk *clk)
>  {
> diff --git a/arch/arm/mach-mxs/include/mach/common.h
> b/arch/arm/mach-mxs/include/mach/common.h index 635bb5d..3bbb94f 100644
> --- a/arch/arm/mach-mxs/include/mach/common.h
> +++ b/arch/arm/mach-mxs/include/mach/common.h
> @@ -16,6 +16,7 @@ struct clk;
>  extern const u32 *mxs_get_ocotp(void);
>  extern int mxs_reset_block(void __iomem *);
>  extern void mxs_timer_init(struct clk *, int);
> +extern int mxs_saif_clkmux_select(unsigned int clkmux);
> 
>  extern int mx23_register_gpios(void);
>  extern int mx23_clocks_init(void);
> diff --git a/arch/arm/mach-mxs/include/mach/digctl.h
> b/arch/arm/mach-mxs/include/mach/digctl.h new file mode 100644
> index 0000000..9bd0496
> --- /dev/null
> +++ b/arch/arm/mach-mxs/include/mach/digctl.h
> @@ -0,0 +1,21 @@
> +/*
> + * Copyright 2011 Freescale Semiconductor, Inc. All Rights Reserved.
> + *
> + * 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 __MACH_DIGCTL_H__
> +#define __MACH_DIGCTL_H__
> +
> +/* MXS DIGCTL SAIF CLKMUX */
> +#define MXS_DIGCTL_SAIF_CLKMUX_DIRECT		0x0
> +#define MXS_DIGCTL_SAIF_CLKMUX_CROSSINPUT	0x1
> +#define MXS_DIGCTL_SAIF_CLKMUX_EXTMSTR0		0x2
> +#define MXS_DIGCTL_SAIF_CLKMUX_EXTMSTR1		0x3
> +
> +#define HW_DIGCTL_CTRL			0x0
> +#define  BP_DIGCTL_CTRL_SAIF_CLKMUX	(10)

Do you need the parenthesis above ?

> +#define  BM_DIGCTL_CTRL_SAIF_CLKMUX	(0x3 << 10)
> +#endif

Please add my

Reviewed-by: Marek Vasut <marek.vasut@gmail.com>

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [alsa-devel] [PATCH v5 1/3] ARM: mxs: add saif clkmux functions
@ 2011-11-18  4:54     ` Marek Vasut
  0 siblings, 0 replies; 22+ messages in thread
From: Marek Vasut @ 2011-11-18  4:54 UTC (permalink / raw)
  To: linux-arm-kernel

> Signed-off-by: Dong Aisheng <b29396@freescale.com>
> Cc: Sascha Hauer <s.hauer@pengutronix.de>
> Cc: Wolfram Sang <w.sang@pengutronix.de>
> Cc: Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>
> Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
> Cc: Liam Girdwood <lrg@ti.com>
> 
> ---
> changes since v4:
>  * remove get_master_id function.
>    Instead, we use master_mode and master_id in platform_data to tell
>    saif driver the correct master id for each saifs.
> changes since v3:
>  * remove the unneeded locking according to Sascha
> changes since v2:
>  * This patch is separated from the following patch based on
>    suggestions from Uwe.
>    [PATCH 2/3] ARM: mx28evk: add platform data for saif
> ---
>  arch/arm/mach-mxs/clock-mx28.c          |   29
> +++++++++++++++++++++++++++++ arch/arm/mach-mxs/include/mach/common.h |   
> 1 +
>  arch/arm/mach-mxs/include/mach/digctl.h |   21 +++++++++++++++++++++
>  3 files changed, 51 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/mach-mxs/clock-mx28.c
> b/arch/arm/mach-mxs/clock-mx28.c index 7954013..c51fe85 100644
> --- a/arch/arm/mach-mxs/clock-mx28.c
> +++ b/arch/arm/mach-mxs/clock-mx28.c
> @@ -22,6 +22,7 @@
>  #include <linux/io.h>
>  #include <linux/jiffies.h>
>  #include <linux/clkdev.h>
> +#include <linux/spinlock.h>
> 
>  #include <asm/clkdev.h>
>  #include <asm/div64.h>
> @@ -29,6 +30,7 @@
>  #include <mach/mx28.h>
>  #include <mach/common.h>
>  #include <mach/clock.h>
> +#include <mach/digctl.h>
> 
>  #include "regs-clkctrl-mx28.h"
> 
> @@ -43,6 +45,33 @@ static struct clk emi_clk;
>  static struct clk saif0_clk;
>  static struct clk saif1_clk;
>  static struct clk clk32k_clk;
> +static DEFINE_SPINLOCK(clkmux_lock);
> +
> +/*
> + * HW_SAIF_CLKMUX_SEL:
> + *  DIRECT(0x0): SAIF0 clock pins selected for SAIF0 input clocks, and
> SAIF1 + *		clock pins selected for SAIF1 input clocks.
> + *  CROSSINPUT(0x1): SAIF1 clock inputs selected for SAIF0 input clocks,
> and + *		SAIF0 clock inputs selected for SAIF1 input clocks.
> + *  EXTMSTR0(0x2): SAIF0 clock pin selected for both SAIF0 and SAIF1 input
> + *		clocks.
> + *  EXTMSTR1(0x3): SAIF1 clock pin selected for both SAIF0 and SAIF1 input
> + *		clocks.
> + */
> +int mxs_saif_clkmux_select(unsigned int clkmux)
> +{
> +	if (clkmux > 0x3)
> +		return -EINVAL;
> +
> +	spin_lock(&clkmux_lock);
> +	__raw_writel(BM_DIGCTL_CTRL_SAIF_CLKMUX,
> +			DIGCTRL_BASE_ADDR + HW_DIGCTL_CTRL + MXS_CLR_ADDR);
> +	__raw_writel(clkmux << BP_DIGCTL_CTRL_SAIF_CLKMUX,
> +			DIGCTRL_BASE_ADDR + HW_DIGCTL_CTRL + MXS_SET_ADDR);
> +	spin_unlock(&clkmux_lock);
> +
> +	return 0;
> +}
> 
>  static int _raw_clk_enable(struct clk *clk)
>  {
> diff --git a/arch/arm/mach-mxs/include/mach/common.h
> b/arch/arm/mach-mxs/include/mach/common.h index 635bb5d..3bbb94f 100644
> --- a/arch/arm/mach-mxs/include/mach/common.h
> +++ b/arch/arm/mach-mxs/include/mach/common.h
> @@ -16,6 +16,7 @@ struct clk;
>  extern const u32 *mxs_get_ocotp(void);
>  extern int mxs_reset_block(void __iomem *);
>  extern void mxs_timer_init(struct clk *, int);
> +extern int mxs_saif_clkmux_select(unsigned int clkmux);
> 
>  extern int mx23_register_gpios(void);
>  extern int mx23_clocks_init(void);
> diff --git a/arch/arm/mach-mxs/include/mach/digctl.h
> b/arch/arm/mach-mxs/include/mach/digctl.h new file mode 100644
> index 0000000..9bd0496
> --- /dev/null
> +++ b/arch/arm/mach-mxs/include/mach/digctl.h
> @@ -0,0 +1,21 @@
> +/*
> + * Copyright 2011 Freescale Semiconductor, Inc. All Rights Reserved.
> + *
> + * 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 __MACH_DIGCTL_H__
> +#define __MACH_DIGCTL_H__
> +
> +/* MXS DIGCTL SAIF CLKMUX */
> +#define MXS_DIGCTL_SAIF_CLKMUX_DIRECT		0x0
> +#define MXS_DIGCTL_SAIF_CLKMUX_CROSSINPUT	0x1
> +#define MXS_DIGCTL_SAIF_CLKMUX_EXTMSTR0		0x2
> +#define MXS_DIGCTL_SAIF_CLKMUX_EXTMSTR1		0x3
> +
> +#define HW_DIGCTL_CTRL			0x0
> +#define  BP_DIGCTL_CTRL_SAIF_CLKMUX	(10)

Do you need the parenthesis above ?

> +#define  BM_DIGCTL_CTRL_SAIF_CLKMUX	(0x3 << 10)
> +#endif

Please add my

Reviewed-by: Marek Vasut <marek.vasut@gmail.com>

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v5 2/3] ARM: mx28evk: add platform data for saif
  2011-11-11  9:30   ` Dong Aisheng
@ 2011-11-18  4:58     ` Marek Vasut
  -1 siblings, 0 replies; 22+ messages in thread
From: Marek Vasut @ 2011-11-18  4:58 UTC (permalink / raw)
  To: alsa-devel
  Cc: s.hauer, broonie, w.sang, shawn.guo, kernel, u.kleine-koenig,
	Dong Aisheng, lrg, linux-arm-kernel

> This is for supporting saif record function.
> 
> Signed-off-by: Dong Aisheng <b29396@freescale.com>
> Cc: Sascha Hauer <s.hauer@pengutronix.de>
> Cc: Wolfram Sang <w.sang@pengutronix.de>
> Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
> Cc: Liam Girdwood <lrg@ti.com>
> 
> ---
> Changes since v4:
>  * Using the new added master_id and master_mode in platfrom_data
> No changes since v3:
> Changes since v2:
>  * separate clkmux code into another patch
>  * A few minus fixes suggested by Uwe & Wolfram.
> Changes since v1:
>  * move saif clkmux code into mach-specific part
> ---
>  arch/arm/mach-mxs/devices-mx28.h                |    3 ++-
>  arch/arm/mach-mxs/devices/platform-mxs-saif.c   |    5 +++--
>  arch/arm/mach-mxs/include/mach/devices-common.h |    4 +++-
>  arch/arm/mach-mxs/mach-mx28evk.c                |   18 ++++++++++++++++--
>  4 files changed, 24 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/arm/mach-mxs/devices-mx28.h
> b/arch/arm/mach-mxs/devices-mx28.h index c888710..4f50094 100644
> --- a/arch/arm/mach-mxs/devices-mx28.h
> +++ b/arch/arm/mach-mxs/devices-mx28.h
> @@ -47,6 +47,7 @@ struct platform_device *__init mx28_add_mxsfb(
>  		const struct mxsfb_platform_data *pdata);
> 
>  extern const struct mxs_saif_data mx28_saif_data[] __initconst;
> -#define mx28_add_saif(id)              mxs_add_saif(&mx28_saif_data[id])
> +#define mx28_add_saif(id, pdata) \
> +	mxs_add_saif(&mx28_saif_data[id], pdata)
> 
>  struct platform_device *__init mx28_add_rtc_stmp3xxx(void);
> diff --git a/arch/arm/mach-mxs/devices/platform-mxs-saif.c
> b/arch/arm/mach-mxs/devices/platform-mxs-saif.c index 1ec965e..f6e3a60
> 100644
> --- a/arch/arm/mach-mxs/devices/platform-mxs-saif.c
> +++ b/arch/arm/mach-mxs/devices/platform-mxs-saif.c
> @@ -32,7 +32,8 @@ const struct mxs_saif_data mx28_saif_data[] __initconst =
> { };
>  #endif
> 
> -struct platform_device *__init mxs_add_saif(const struct mxs_saif_data
> *data) +struct platform_device *__init mxs_add_saif(const struct
> mxs_saif_data *data, +				const struct 
mxs_saif_platform_data *pdata)
>  {
>  	struct resource res[] = {
>  		{
> @@ -56,5 +57,5 @@ struct platform_device *__init mxs_add_saif(const struct
> mxs_saif_data *data) };
> 
>  	return mxs_add_platform_device("mxs-saif", data->id, res,
> -					ARRAY_SIZE(res), NULL, 0);
> +				ARRAY_SIZE(res), pdata, sizeof(*pdata));

Wasn't there some ARRAY_AND_SIZE() macro somewhere? I checked and it's now used 
in three instances -- PXA, MMP, UX500 and maybe somewhere else -- can you move 
it to common header and use here?

>  }
> diff --git a/arch/arm/mach-mxs/include/mach/devices-common.h
> b/arch/arm/mach-mxs/include/mach/devices-common.h index a8080f4..dc369c1
> 100644
> --- a/arch/arm/mach-mxs/include/mach/devices-common.h
> +++ b/arch/arm/mach-mxs/include/mach/devices-common.h
> @@ -94,6 +94,7 @@ struct platform_device *__init mxs_add_mxs_pwm(
>  		resource_size_t iobase, int id);
> 
>  /* saif */
> +#include <sound/saif.h>

It looks weird to intermix includes and code :-(

>  struct mxs_saif_data {
>  	int id;
>  	resource_size_t iobase;
> @@ -103,4 +104,5 @@ struct mxs_saif_data {
>  };
> 
>  struct platform_device *__init mxs_add_saif(
> -		const struct mxs_saif_data *data);
> +		const struct mxs_saif_data *data,
> +		const struct mxs_saif_platform_data *pdata);
> diff --git a/arch/arm/mach-mxs/mach-mx28evk.c
> b/arch/arm/mach-mxs/mach-mx28evk.c index 4a3cca3..cfe7910 100644
> --- a/arch/arm/mach-mxs/mach-mx28evk.c
> +++ b/arch/arm/mach-mxs/mach-mx28evk.c
> @@ -28,6 +28,7 @@
> 
>  #include <mach/common.h>
>  #include <mach/iomux-mx28.h>
> +#include <mach/digctl.h>
> 
>  #include "devices-mx28.h"
> 
> @@ -417,6 +418,18 @@ static void __init mx28evk_add_regulators(void)
>  static void __init mx28evk_add_regulators(void) {}
>  #endif
> 
> +static const struct mxs_saif_platform_data
> +			mx28evk_mxs_saif_pdata[] __initconst = {
> +	/* working on EXTMSTR0 mode (saif0 master, saif1 slave) */
> +	{
> +		.master_mode = 1;
> +		.master_id = 0;
> +	}, {
> +		.master_mode = 0;
> +		.master_id = 0;
> +	},
> +};
> +
>  static void __init mx28evk_init(void)
>  {
>  	int ret;
> @@ -457,8 +470,9 @@ static void __init mx28evk_init(void)
> 
>  	mx28_add_mxsfb(&mx28evk_mxsfb_pdata);
> 
> -	mx28_add_saif(0);
> -	mx28_add_saif(1);
> +	mxs_saif_clkmux_select(MXS_DIGCTL_SAIF_CLKMUX_EXTMSTR0);
> +	mx28_add_saif(0, &mx28evk_mxs_saif_pdata[0]);
> +	mx28_add_saif(1, &mx28evk_mxs_saif_pdata[1]);
> 
>  	mx28_add_mxs_i2c(0);
>  	i2c_register_board_info(0, mxs_i2c0_board_info,

Otherwise,

Reviewed-by: Marek Vasut <marek.vasut@gmail.com>

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [alsa-devel] [PATCH v5 2/3] ARM: mx28evk: add platform data for saif
@ 2011-11-18  4:58     ` Marek Vasut
  0 siblings, 0 replies; 22+ messages in thread
From: Marek Vasut @ 2011-11-18  4:58 UTC (permalink / raw)
  To: linux-arm-kernel

> This is for supporting saif record function.
> 
> Signed-off-by: Dong Aisheng <b29396@freescale.com>
> Cc: Sascha Hauer <s.hauer@pengutronix.de>
> Cc: Wolfram Sang <w.sang@pengutronix.de>
> Cc: Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>
> Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
> Cc: Liam Girdwood <lrg@ti.com>
> 
> ---
> Changes since v4:
>  * Using the new added master_id and master_mode in platfrom_data
> No changes since v3:
> Changes since v2:
>  * separate clkmux code into another patch
>  * A few minus fixes suggested by Uwe & Wolfram.
> Changes since v1:
>  * move saif clkmux code into mach-specific part
> ---
>  arch/arm/mach-mxs/devices-mx28.h                |    3 ++-
>  arch/arm/mach-mxs/devices/platform-mxs-saif.c   |    5 +++--
>  arch/arm/mach-mxs/include/mach/devices-common.h |    4 +++-
>  arch/arm/mach-mxs/mach-mx28evk.c                |   18 ++++++++++++++++--
>  4 files changed, 24 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/arm/mach-mxs/devices-mx28.h
> b/arch/arm/mach-mxs/devices-mx28.h index c888710..4f50094 100644
> --- a/arch/arm/mach-mxs/devices-mx28.h
> +++ b/arch/arm/mach-mxs/devices-mx28.h
> @@ -47,6 +47,7 @@ struct platform_device *__init mx28_add_mxsfb(
>  		const struct mxsfb_platform_data *pdata);
> 
>  extern const struct mxs_saif_data mx28_saif_data[] __initconst;
> -#define mx28_add_saif(id)              mxs_add_saif(&mx28_saif_data[id])
> +#define mx28_add_saif(id, pdata) \
> +	mxs_add_saif(&mx28_saif_data[id], pdata)
> 
>  struct platform_device *__init mx28_add_rtc_stmp3xxx(void);
> diff --git a/arch/arm/mach-mxs/devices/platform-mxs-saif.c
> b/arch/arm/mach-mxs/devices/platform-mxs-saif.c index 1ec965e..f6e3a60
> 100644
> --- a/arch/arm/mach-mxs/devices/platform-mxs-saif.c
> +++ b/arch/arm/mach-mxs/devices/platform-mxs-saif.c
> @@ -32,7 +32,8 @@ const struct mxs_saif_data mx28_saif_data[] __initconst =
> { };
>  #endif
> 
> -struct platform_device *__init mxs_add_saif(const struct mxs_saif_data
> *data) +struct platform_device *__init mxs_add_saif(const struct
> mxs_saif_data *data, +				const struct 
mxs_saif_platform_data *pdata)
>  {
>  	struct resource res[] = {
>  		{
> @@ -56,5 +57,5 @@ struct platform_device *__init mxs_add_saif(const struct
> mxs_saif_data *data) };
> 
>  	return mxs_add_platform_device("mxs-saif", data->id, res,
> -					ARRAY_SIZE(res), NULL, 0);
> +				ARRAY_SIZE(res), pdata, sizeof(*pdata));

Wasn't there some ARRAY_AND_SIZE() macro somewhere? I checked and it's now used 
in three instances -- PXA, MMP, UX500 and maybe somewhere else -- can you move 
it to common header and use here?

>  }
> diff --git a/arch/arm/mach-mxs/include/mach/devices-common.h
> b/arch/arm/mach-mxs/include/mach/devices-common.h index a8080f4..dc369c1
> 100644
> --- a/arch/arm/mach-mxs/include/mach/devices-common.h
> +++ b/arch/arm/mach-mxs/include/mach/devices-common.h
> @@ -94,6 +94,7 @@ struct platform_device *__init mxs_add_mxs_pwm(
>  		resource_size_t iobase, int id);
> 
>  /* saif */
> +#include <sound/saif.h>

It looks weird to intermix includes and code :-(

>  struct mxs_saif_data {
>  	int id;
>  	resource_size_t iobase;
> @@ -103,4 +104,5 @@ struct mxs_saif_data {
>  };
> 
>  struct platform_device *__init mxs_add_saif(
> -		const struct mxs_saif_data *data);
> +		const struct mxs_saif_data *data,
> +		const struct mxs_saif_platform_data *pdata);
> diff --git a/arch/arm/mach-mxs/mach-mx28evk.c
> b/arch/arm/mach-mxs/mach-mx28evk.c index 4a3cca3..cfe7910 100644
> --- a/arch/arm/mach-mxs/mach-mx28evk.c
> +++ b/arch/arm/mach-mxs/mach-mx28evk.c
> @@ -28,6 +28,7 @@
> 
>  #include <mach/common.h>
>  #include <mach/iomux-mx28.h>
> +#include <mach/digctl.h>
> 
>  #include "devices-mx28.h"
> 
> @@ -417,6 +418,18 @@ static void __init mx28evk_add_regulators(void)
>  static void __init mx28evk_add_regulators(void) {}
>  #endif
> 
> +static const struct mxs_saif_platform_data
> +			mx28evk_mxs_saif_pdata[] __initconst = {
> +	/* working on EXTMSTR0 mode (saif0 master, saif1 slave) */
> +	{
> +		.master_mode = 1;
> +		.master_id = 0;
> +	}, {
> +		.master_mode = 0;
> +		.master_id = 0;
> +	},
> +};
> +
>  static void __init mx28evk_init(void)
>  {
>  	int ret;
> @@ -457,8 +470,9 @@ static void __init mx28evk_init(void)
> 
>  	mx28_add_mxsfb(&mx28evk_mxsfb_pdata);
> 
> -	mx28_add_saif(0);
> -	mx28_add_saif(1);
> +	mxs_saif_clkmux_select(MXS_DIGCTL_SAIF_CLKMUX_EXTMSTR0);
> +	mx28_add_saif(0, &mx28evk_mxs_saif_pdata[0]);
> +	mx28_add_saif(1, &mx28evk_mxs_saif_pdata[1]);
> 
>  	mx28_add_mxs_i2c(0);
>  	i2c_register_board_info(0, mxs_i2c0_board_info,

Otherwise,

Reviewed-by: Marek Vasut <marek.vasut@gmail.com>

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v5 1/3] ARM: mxs: add saif clkmux functions
  2011-11-18  4:54     ` [alsa-devel] " Marek Vasut
@ 2011-11-18  6:28       ` Dong Aisheng-B29396
  -1 siblings, 0 replies; 22+ messages in thread
From: Dong Aisheng-B29396 @ 2011-11-18  6:28 UTC (permalink / raw)
  To: Marek Vasut, alsa-devel
  Cc: s.hauer, broonie, w.sang, Guo Shawn-R65073, kernel,
	u.kleine-koenig, lrg, linux-arm-kernel

> -----Original Message-----
> From: Marek Vasut [mailto:marek.vasut@gmail.com]
> Sent: Friday, November 18, 2011 12:55 PM
> To: alsa-devel@alsa-project.org
> Cc: Dong Aisheng-B29396; linux-arm-kernel@lists.infradead.org;
> s.hauer@pengutronix.de; broonie@opensource.wolfsonmicro.com;
> w.sang@pengutronix.de; kernel@pengutronix.de; u.kleine-
> koenig@pengutronix.de; lrg@ti.com; Guo Shawn-R65073
> Subject: Re: [alsa-devel] [PATCH v5 1/3] ARM: mxs: add saif clkmux
> functions
> 
> > Signed-off-by: Dong Aisheng <b29396@freescale.com>
> > Cc: Sascha Hauer <s.hauer@pengutronix.de>
> > Cc: Wolfram Sang <w.sang@pengutronix.de>
> > Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> > Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
> > Cc: Liam Girdwood <lrg@ti.com>
> >
> > ---
> > changes since v4:
> >  * remove get_master_id function.
> >    Instead, we use master_mode and master_id in platform_data to tell
> >    saif driver the correct master id for each saifs.
> > changes since v3:
> >  * remove the unneeded locking according to Sascha changes since v2:
> >  * This patch is separated from the following patch based on
> >    suggestions from Uwe.
> >    [PATCH 2/3] ARM: mx28evk: add platform data for saif
> > ---
> >  arch/arm/mach-mxs/clock-mx28.c          |   29
> > +++++++++++++++++++++++++++++ arch/arm/mach-mxs/include/mach/common.h |
> > 1 +
> >  arch/arm/mach-mxs/include/mach/digctl.h |   21 +++++++++++++++++++++
> >  3 files changed, 51 insertions(+), 0 deletions(-)
> >
> > diff --git a/arch/arm/mach-mxs/clock-mx28.c
> > b/arch/arm/mach-mxs/clock-mx28.c index 7954013..c51fe85 100644
> > --- a/arch/arm/mach-mxs/clock-mx28.c
> > +++ b/arch/arm/mach-mxs/clock-mx28.c
> > @@ -22,6 +22,7 @@
> >  #include <linux/io.h>
> >  #include <linux/jiffies.h>
> >  #include <linux/clkdev.h>
> > +#include <linux/spinlock.h>
> >
> >  #include <asm/clkdev.h>
> >  #include <asm/div64.h>
> > @@ -29,6 +30,7 @@
> >  #include <mach/mx28.h>
> >  #include <mach/common.h>
> >  #include <mach/clock.h>
> > +#include <mach/digctl.h>
> >
> >  #include "regs-clkctrl-mx28.h"
> >
> > @@ -43,6 +45,33 @@ static struct clk emi_clk;  static struct clk
> > saif0_clk;  static struct clk saif1_clk;  static struct clk
> > clk32k_clk;
> > +static DEFINE_SPINLOCK(clkmux_lock);
> > +
> > +/*
> > + * HW_SAIF_CLKMUX_SEL:
> > + *  DIRECT(0x0): SAIF0 clock pins selected for SAIF0 input clocks,
> > +and
> > SAIF1 + *		clock pins selected for SAIF1 input clocks.
> > + *  CROSSINPUT(0x1): SAIF1 clock inputs selected for SAIF0 input
> > + clocks,
> > and + *		SAIF0 clock inputs selected for SAIF1 input clocks.
> > + *  EXTMSTR0(0x2): SAIF0 clock pin selected for both SAIF0 and SAIF1
> input
> > + *		clocks.
> > + *  EXTMSTR1(0x3): SAIF1 clock pin selected for both SAIF0 and SAIF1
> input
> > + *		clocks.
> > + */
> > +int mxs_saif_clkmux_select(unsigned int clkmux) {
> > +	if (clkmux > 0x3)
> > +		return -EINVAL;
> > +
> > +	spin_lock(&clkmux_lock);
> > +	__raw_writel(BM_DIGCTL_CTRL_SAIF_CLKMUX,
> > +			DIGCTRL_BASE_ADDR + HW_DIGCTL_CTRL + MXS_CLR_ADDR);
> > +	__raw_writel(clkmux << BP_DIGCTL_CTRL_SAIF_CLKMUX,
> > +			DIGCTRL_BASE_ADDR + HW_DIGCTL_CTRL + MXS_SET_ADDR);
> > +	spin_unlock(&clkmux_lock);
> > +
> > +	return 0;
> > +}
> >
> >  static int _raw_clk_enable(struct clk *clk)  { diff --git
> > a/arch/arm/mach-mxs/include/mach/common.h
> > b/arch/arm/mach-mxs/include/mach/common.h index 635bb5d..3bbb94f
> > 100644
> > --- a/arch/arm/mach-mxs/include/mach/common.h
> > +++ b/arch/arm/mach-mxs/include/mach/common.h
> > @@ -16,6 +16,7 @@ struct clk;
> >  extern const u32 *mxs_get_ocotp(void);  extern int
> > mxs_reset_block(void __iomem *);  extern void mxs_timer_init(struct
> > clk *, int);
> > +extern int mxs_saif_clkmux_select(unsigned int clkmux);
> >
> >  extern int mx23_register_gpios(void);  extern int
> > mx23_clocks_init(void); diff --git
> > a/arch/arm/mach-mxs/include/mach/digctl.h
> > b/arch/arm/mach-mxs/include/mach/digctl.h new file mode 100644 index
> > 0000000..9bd0496
> > --- /dev/null
> > +++ b/arch/arm/mach-mxs/include/mach/digctl.h
> > @@ -0,0 +1,21 @@
> > +/*
> > + * Copyright 2011 Freescale Semiconductor, Inc. All Rights Reserved.
> > + *
> > + * 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 __MACH_DIGCTL_H__
> > +#define __MACH_DIGCTL_H__
> > +
> > +/* MXS DIGCTL SAIF CLKMUX */
> > +#define MXS_DIGCTL_SAIF_CLKMUX_DIRECT		0x0
> > +#define MXS_DIGCTL_SAIF_CLKMUX_CROSSINPUT	0x1
> > +#define MXS_DIGCTL_SAIF_CLKMUX_EXTMSTR0		0x2
> > +#define MXS_DIGCTL_SAIF_CLKMUX_EXTMSTR1		0x3
> > +
> > +#define HW_DIGCTL_CTRL			0x0
> > +#define  BP_DIGCTL_CTRL_SAIF_CLKMUX	(10)
> 
> Do you need the parenthesis above ?
> 
I'm not sure about his.
HW_DIGCTL_CTRL is the register offset.
Do we have to do this?

> > +#define  BM_DIGCTL_CTRL_SAIF_CLKMUX	(0x3 << 10)
> > +#endif
> 
> Please add my
> 
> Reviewed-by: Marek Vasut <marek.vasut@gmail.com>

Thanks for the review.

Regards
Dong Aisheng

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [alsa-devel] [PATCH v5 1/3] ARM: mxs: add saif clkmux functions
@ 2011-11-18  6:28       ` Dong Aisheng-B29396
  0 siblings, 0 replies; 22+ messages in thread
From: Dong Aisheng-B29396 @ 2011-11-18  6:28 UTC (permalink / raw)
  To: linux-arm-kernel

> -----Original Message-----
> From: Marek Vasut [mailto:marek.vasut at gmail.com]
> Sent: Friday, November 18, 2011 12:55 PM
> To: alsa-devel at alsa-project.org
> Cc: Dong Aisheng-B29396; linux-arm-kernel at lists.infradead.org;
> s.hauer at pengutronix.de; broonie at opensource.wolfsonmicro.com;
> w.sang at pengutronix.de; kernel at pengutronix.de; u.kleine-
> koenig at pengutronix.de; lrg at ti.com; Guo Shawn-R65073
> Subject: Re: [alsa-devel] [PATCH v5 1/3] ARM: mxs: add saif clkmux
> functions
> 
> > Signed-off-by: Dong Aisheng <b29396@freescale.com>
> > Cc: Sascha Hauer <s.hauer@pengutronix.de>
> > Cc: Wolfram Sang <w.sang@pengutronix.de>
> > Cc: Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>
> > Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
> > Cc: Liam Girdwood <lrg@ti.com>
> >
> > ---
> > changes since v4:
> >  * remove get_master_id function.
> >    Instead, we use master_mode and master_id in platform_data to tell
> >    saif driver the correct master id for each saifs.
> > changes since v3:
> >  * remove the unneeded locking according to Sascha changes since v2:
> >  * This patch is separated from the following patch based on
> >    suggestions from Uwe.
> >    [PATCH 2/3] ARM: mx28evk: add platform data for saif
> > ---
> >  arch/arm/mach-mxs/clock-mx28.c          |   29
> > +++++++++++++++++++++++++++++ arch/arm/mach-mxs/include/mach/common.h |
> > 1 +
> >  arch/arm/mach-mxs/include/mach/digctl.h |   21 +++++++++++++++++++++
> >  3 files changed, 51 insertions(+), 0 deletions(-)
> >
> > diff --git a/arch/arm/mach-mxs/clock-mx28.c
> > b/arch/arm/mach-mxs/clock-mx28.c index 7954013..c51fe85 100644
> > --- a/arch/arm/mach-mxs/clock-mx28.c
> > +++ b/arch/arm/mach-mxs/clock-mx28.c
> > @@ -22,6 +22,7 @@
> >  #include <linux/io.h>
> >  #include <linux/jiffies.h>
> >  #include <linux/clkdev.h>
> > +#include <linux/spinlock.h>
> >
> >  #include <asm/clkdev.h>
> >  #include <asm/div64.h>
> > @@ -29,6 +30,7 @@
> >  #include <mach/mx28.h>
> >  #include <mach/common.h>
> >  #include <mach/clock.h>
> > +#include <mach/digctl.h>
> >
> >  #include "regs-clkctrl-mx28.h"
> >
> > @@ -43,6 +45,33 @@ static struct clk emi_clk;  static struct clk
> > saif0_clk;  static struct clk saif1_clk;  static struct clk
> > clk32k_clk;
> > +static DEFINE_SPINLOCK(clkmux_lock);
> > +
> > +/*
> > + * HW_SAIF_CLKMUX_SEL:
> > + *  DIRECT(0x0): SAIF0 clock pins selected for SAIF0 input clocks,
> > +and
> > SAIF1 + *		clock pins selected for SAIF1 input clocks.
> > + *  CROSSINPUT(0x1): SAIF1 clock inputs selected for SAIF0 input
> > + clocks,
> > and + *		SAIF0 clock inputs selected for SAIF1 input clocks.
> > + *  EXTMSTR0(0x2): SAIF0 clock pin selected for both SAIF0 and SAIF1
> input
> > + *		clocks.
> > + *  EXTMSTR1(0x3): SAIF1 clock pin selected for both SAIF0 and SAIF1
> input
> > + *		clocks.
> > + */
> > +int mxs_saif_clkmux_select(unsigned int clkmux) {
> > +	if (clkmux > 0x3)
> > +		return -EINVAL;
> > +
> > +	spin_lock(&clkmux_lock);
> > +	__raw_writel(BM_DIGCTL_CTRL_SAIF_CLKMUX,
> > +			DIGCTRL_BASE_ADDR + HW_DIGCTL_CTRL + MXS_CLR_ADDR);
> > +	__raw_writel(clkmux << BP_DIGCTL_CTRL_SAIF_CLKMUX,
> > +			DIGCTRL_BASE_ADDR + HW_DIGCTL_CTRL + MXS_SET_ADDR);
> > +	spin_unlock(&clkmux_lock);
> > +
> > +	return 0;
> > +}
> >
> >  static int _raw_clk_enable(struct clk *clk)  { diff --git
> > a/arch/arm/mach-mxs/include/mach/common.h
> > b/arch/arm/mach-mxs/include/mach/common.h index 635bb5d..3bbb94f
> > 100644
> > --- a/arch/arm/mach-mxs/include/mach/common.h
> > +++ b/arch/arm/mach-mxs/include/mach/common.h
> > @@ -16,6 +16,7 @@ struct clk;
> >  extern const u32 *mxs_get_ocotp(void);  extern int
> > mxs_reset_block(void __iomem *);  extern void mxs_timer_init(struct
> > clk *, int);
> > +extern int mxs_saif_clkmux_select(unsigned int clkmux);
> >
> >  extern int mx23_register_gpios(void);  extern int
> > mx23_clocks_init(void); diff --git
> > a/arch/arm/mach-mxs/include/mach/digctl.h
> > b/arch/arm/mach-mxs/include/mach/digctl.h new file mode 100644 index
> > 0000000..9bd0496
> > --- /dev/null
> > +++ b/arch/arm/mach-mxs/include/mach/digctl.h
> > @@ -0,0 +1,21 @@
> > +/*
> > + * Copyright 2011 Freescale Semiconductor, Inc. All Rights Reserved.
> > + *
> > + * 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 __MACH_DIGCTL_H__
> > +#define __MACH_DIGCTL_H__
> > +
> > +/* MXS DIGCTL SAIF CLKMUX */
> > +#define MXS_DIGCTL_SAIF_CLKMUX_DIRECT		0x0
> > +#define MXS_DIGCTL_SAIF_CLKMUX_CROSSINPUT	0x1
> > +#define MXS_DIGCTL_SAIF_CLKMUX_EXTMSTR0		0x2
> > +#define MXS_DIGCTL_SAIF_CLKMUX_EXTMSTR1		0x3
> > +
> > +#define HW_DIGCTL_CTRL			0x0
> > +#define  BP_DIGCTL_CTRL_SAIF_CLKMUX	(10)
> 
> Do you need the parenthesis above ?
> 
I'm not sure about his.
HW_DIGCTL_CTRL is the register offset.
Do we have to do this?

> > +#define  BM_DIGCTL_CTRL_SAIF_CLKMUX	(0x3 << 10)
> > +#endif
> 
> Please add my
> 
> Reviewed-by: Marek Vasut <marek.vasut@gmail.com>

Thanks for the review.

Regards
Dong Aisheng

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v5 2/3] ARM: mx28evk: add platform data for saif
  2011-11-18  4:58     ` [alsa-devel] " Marek Vasut
@ 2011-11-18  6:40       ` Dong Aisheng-B29396
  -1 siblings, 0 replies; 22+ messages in thread
From: Dong Aisheng-B29396 @ 2011-11-18  6:40 UTC (permalink / raw)
  To: Marek Vasut, alsa-devel
  Cc: s.hauer, broonie, w.sang, Guo Shawn-R65073, kernel,
	u.kleine-koenig, lrg, linux-arm-kernel

> -----Original Message-----
> From: Marek Vasut [mailto:marek.vasut@gmail.com]
> Sent: Friday, November 18, 2011 12:58 PM
> To: alsa-devel@alsa-project.org
> Cc: Dong Aisheng-B29396; linux-arm-kernel@lists.infradead.org;
> s.hauer@pengutronix.de; broonie@opensource.wolfsonmicro.com;
> w.sang@pengutronix.de; kernel@pengutronix.de; u.kleine-
> koenig@pengutronix.de; lrg@ti.com; Guo Shawn-R65073
> Subject: Re: [alsa-devel] [PATCH v5 2/3] ARM: mx28evk: add platform data
> for saif
> 
> > This is for supporting saif record function.
> >
> > Signed-off-by: Dong Aisheng <b29396@freescale.com>
> > Cc: Sascha Hauer <s.hauer@pengutronix.de>
> > Cc: Wolfram Sang <w.sang@pengutronix.de>
> > Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> > Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
> > Cc: Liam Girdwood <lrg@ti.com>
> >
> > ---
> > Changes since v4:
> >  * Using the new added master_id and master_mode in platfrom_data No
> > changes since v3:
> > Changes since v2:
> >  * separate clkmux code into another patch
> >  * A few minus fixes suggested by Uwe & Wolfram.
> > Changes since v1:
> >  * move saif clkmux code into mach-specific part
> > ---
> >  arch/arm/mach-mxs/devices-mx28.h                |    3 ++-
> >  arch/arm/mach-mxs/devices/platform-mxs-saif.c   |    5 +++--
> >  arch/arm/mach-mxs/include/mach/devices-common.h |    4 +++-
> >  arch/arm/mach-mxs/mach-mx28evk.c                |   18
> ++++++++++++++++--
> >  4 files changed, 24 insertions(+), 6 deletions(-)
> >
> > diff --git a/arch/arm/mach-mxs/devices-mx28.h
> > b/arch/arm/mach-mxs/devices-mx28.h index c888710..4f50094 100644
> > --- a/arch/arm/mach-mxs/devices-mx28.h
> > +++ b/arch/arm/mach-mxs/devices-mx28.h
> > @@ -47,6 +47,7 @@ struct platform_device *__init mx28_add_mxsfb(
> >  		const struct mxsfb_platform_data *pdata);
> >
> >  extern const struct mxs_saif_data mx28_saif_data[] __initconst;
> > -#define mx28_add_saif(id)
> mxs_add_saif(&mx28_saif_data[id])
> > +#define mx28_add_saif(id, pdata) \
> > +	mxs_add_saif(&mx28_saif_data[id], pdata)
> >
> >  struct platform_device *__init mx28_add_rtc_stmp3xxx(void); diff
> > --git a/arch/arm/mach-mxs/devices/platform-mxs-saif.c
> > b/arch/arm/mach-mxs/devices/platform-mxs-saif.c index 1ec965e..f6e3a60
> > 100644
> > --- a/arch/arm/mach-mxs/devices/platform-mxs-saif.c
> > +++ b/arch/arm/mach-mxs/devices/platform-mxs-saif.c
> > @@ -32,7 +32,8 @@ const struct mxs_saif_data mx28_saif_data[]
> > __initconst = { };  #endif
> >
> > -struct platform_device *__init mxs_add_saif(const struct
> > mxs_saif_data
> > *data) +struct platform_device *__init mxs_add_saif(const struct
> > mxs_saif_data *data, +				const struct
> mxs_saif_platform_data *pdata)
> >  {
> >  	struct resource res[] = {
> >  		{
> > @@ -56,5 +57,5 @@ struct platform_device *__init mxs_add_saif(const
> > struct mxs_saif_data *data) };
> >
> >  	return mxs_add_platform_device("mxs-saif", data->id, res,
> > -					ARRAY_SIZE(res), NULL, 0);
> > +				ARRAY_SIZE(res), pdata, sizeof(*pdata));
> 
> Wasn't there some ARRAY_AND_SIZE() macro somewhere? I checked and it's
> now used in three instances -- PXA, MMP, UX500 and maybe somewhere else -
> - can you move it to common header and use here?
> 
Yes, could it be another patch since many place may need to update?
BTW, I also wonder why each platform defines this same micro respectively.
I mean that couldn't it be in the common code kernel.h as ARRAY_SIZE?
Anyway, that's another question and not much to do with this patch series.

> >  }
> > diff --git a/arch/arm/mach-mxs/include/mach/devices-common.h
> > b/arch/arm/mach-mxs/include/mach/devices-common.h index
> > a8080f4..dc369c1
> > 100644
> > --- a/arch/arm/mach-mxs/include/mach/devices-common.h
> > +++ b/arch/arm/mach-mxs/include/mach/devices-common.h
> > @@ -94,6 +94,7 @@ struct platform_device *__init mxs_add_mxs_pwm(
> >  		resource_size_t iobase, int id);
> >
> >  /* saif */
> > +#include <sound/saif.h>
> 
> It looks weird to intermix includes and code :-(
> 
I just follow the convention this file is using.

> >  struct mxs_saif_data {
> >  	int id;
> >  	resource_size_t iobase;
> > @@ -103,4 +104,5 @@ struct mxs_saif_data {  };
> >
> >  struct platform_device *__init mxs_add_saif(
> > -		const struct mxs_saif_data *data);
> > +		const struct mxs_saif_data *data,
> > +		const struct mxs_saif_platform_data *pdata);
> > diff --git a/arch/arm/mach-mxs/mach-mx28evk.c
> > b/arch/arm/mach-mxs/mach-mx28evk.c index 4a3cca3..cfe7910 100644
> > --- a/arch/arm/mach-mxs/mach-mx28evk.c
> > +++ b/arch/arm/mach-mxs/mach-mx28evk.c
> > @@ -28,6 +28,7 @@
> >
> >  #include <mach/common.h>
> >  #include <mach/iomux-mx28.h>
> > +#include <mach/digctl.h>
> >
> >  #include "devices-mx28.h"
> >
> > @@ -417,6 +418,18 @@ static void __init mx28evk_add_regulators(void)
> > static void __init mx28evk_add_regulators(void) {}  #endif
> >
> > +static const struct mxs_saif_platform_data
> > +			mx28evk_mxs_saif_pdata[] __initconst = {
> > +	/* working on EXTMSTR0 mode (saif0 master, saif1 slave) */
> > +	{
> > +		.master_mode = 1;
> > +		.master_id = 0;
> > +	}, {
> > +		.master_mode = 0;
> > +		.master_id = 0;
> > +	},
> > +};
> > +
> >  static void __init mx28evk_init(void)  {
> >  	int ret;
> > @@ -457,8 +470,9 @@ static void __init mx28evk_init(void)
> >
> >  	mx28_add_mxsfb(&mx28evk_mxsfb_pdata);
> >
> > -	mx28_add_saif(0);
> > -	mx28_add_saif(1);
> > +	mxs_saif_clkmux_select(MXS_DIGCTL_SAIF_CLKMUX_EXTMSTR0);
> > +	mx28_add_saif(0, &mx28evk_mxs_saif_pdata[0]);
> > +	mx28_add_saif(1, &mx28evk_mxs_saif_pdata[1]);
> >
> >  	mx28_add_mxs_i2c(0);
> >  	i2c_register_board_info(0, mxs_i2c0_board_info,
> 
> Otherwise,
> 
> Reviewed-by: Marek Vasut <marek.vasut@gmail.com>
Thanks for the review.

Regards
Dong Aisheng

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [alsa-devel] [PATCH v5 2/3] ARM: mx28evk: add platform data for saif
@ 2011-11-18  6:40       ` Dong Aisheng-B29396
  0 siblings, 0 replies; 22+ messages in thread
From: Dong Aisheng-B29396 @ 2011-11-18  6:40 UTC (permalink / raw)
  To: linux-arm-kernel

> -----Original Message-----
> From: Marek Vasut [mailto:marek.vasut at gmail.com]
> Sent: Friday, November 18, 2011 12:58 PM
> To: alsa-devel at alsa-project.org
> Cc: Dong Aisheng-B29396; linux-arm-kernel at lists.infradead.org;
> s.hauer at pengutronix.de; broonie at opensource.wolfsonmicro.com;
> w.sang at pengutronix.de; kernel at pengutronix.de; u.kleine-
> koenig at pengutronix.de; lrg at ti.com; Guo Shawn-R65073
> Subject: Re: [alsa-devel] [PATCH v5 2/3] ARM: mx28evk: add platform data
> for saif
> 
> > This is for supporting saif record function.
> >
> > Signed-off-by: Dong Aisheng <b29396@freescale.com>
> > Cc: Sascha Hauer <s.hauer@pengutronix.de>
> > Cc: Wolfram Sang <w.sang@pengutronix.de>
> > Cc: Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>
> > Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
> > Cc: Liam Girdwood <lrg@ti.com>
> >
> > ---
> > Changes since v4:
> >  * Using the new added master_id and master_mode in platfrom_data No
> > changes since v3:
> > Changes since v2:
> >  * separate clkmux code into another patch
> >  * A few minus fixes suggested by Uwe & Wolfram.
> > Changes since v1:
> >  * move saif clkmux code into mach-specific part
> > ---
> >  arch/arm/mach-mxs/devices-mx28.h                |    3 ++-
> >  arch/arm/mach-mxs/devices/platform-mxs-saif.c   |    5 +++--
> >  arch/arm/mach-mxs/include/mach/devices-common.h |    4 +++-
> >  arch/arm/mach-mxs/mach-mx28evk.c                |   18
> ++++++++++++++++--
> >  4 files changed, 24 insertions(+), 6 deletions(-)
> >
> > diff --git a/arch/arm/mach-mxs/devices-mx28.h
> > b/arch/arm/mach-mxs/devices-mx28.h index c888710..4f50094 100644
> > --- a/arch/arm/mach-mxs/devices-mx28.h
> > +++ b/arch/arm/mach-mxs/devices-mx28.h
> > @@ -47,6 +47,7 @@ struct platform_device *__init mx28_add_mxsfb(
> >  		const struct mxsfb_platform_data *pdata);
> >
> >  extern const struct mxs_saif_data mx28_saif_data[] __initconst;
> > -#define mx28_add_saif(id)
> mxs_add_saif(&mx28_saif_data[id])
> > +#define mx28_add_saif(id, pdata) \
> > +	mxs_add_saif(&mx28_saif_data[id], pdata)
> >
> >  struct platform_device *__init mx28_add_rtc_stmp3xxx(void); diff
> > --git a/arch/arm/mach-mxs/devices/platform-mxs-saif.c
> > b/arch/arm/mach-mxs/devices/platform-mxs-saif.c index 1ec965e..f6e3a60
> > 100644
> > --- a/arch/arm/mach-mxs/devices/platform-mxs-saif.c
> > +++ b/arch/arm/mach-mxs/devices/platform-mxs-saif.c
> > @@ -32,7 +32,8 @@ const struct mxs_saif_data mx28_saif_data[]
> > __initconst = { };  #endif
> >
> > -struct platform_device *__init mxs_add_saif(const struct
> > mxs_saif_data
> > *data) +struct platform_device *__init mxs_add_saif(const struct
> > mxs_saif_data *data, +				const struct
> mxs_saif_platform_data *pdata)
> >  {
> >  	struct resource res[] = {
> >  		{
> > @@ -56,5 +57,5 @@ struct platform_device *__init mxs_add_saif(const
> > struct mxs_saif_data *data) };
> >
> >  	return mxs_add_platform_device("mxs-saif", data->id, res,
> > -					ARRAY_SIZE(res), NULL, 0);
> > +				ARRAY_SIZE(res), pdata, sizeof(*pdata));
> 
> Wasn't there some ARRAY_AND_SIZE() macro somewhere? I checked and it's
> now used in three instances -- PXA, MMP, UX500 and maybe somewhere else -
> - can you move it to common header and use here?
> 
Yes, could it be another patch since many place may need to update?
BTW, I also wonder why each platform defines this same micro respectively.
I mean that couldn't it be in the common code kernel.h as ARRAY_SIZE?
Anyway, that's another question and not much to do with this patch series.

> >  }
> > diff --git a/arch/arm/mach-mxs/include/mach/devices-common.h
> > b/arch/arm/mach-mxs/include/mach/devices-common.h index
> > a8080f4..dc369c1
> > 100644
> > --- a/arch/arm/mach-mxs/include/mach/devices-common.h
> > +++ b/arch/arm/mach-mxs/include/mach/devices-common.h
> > @@ -94,6 +94,7 @@ struct platform_device *__init mxs_add_mxs_pwm(
> >  		resource_size_t iobase, int id);
> >
> >  /* saif */
> > +#include <sound/saif.h>
> 
> It looks weird to intermix includes and code :-(
> 
I just follow the convention this file is using.

> >  struct mxs_saif_data {
> >  	int id;
> >  	resource_size_t iobase;
> > @@ -103,4 +104,5 @@ struct mxs_saif_data {  };
> >
> >  struct platform_device *__init mxs_add_saif(
> > -		const struct mxs_saif_data *data);
> > +		const struct mxs_saif_data *data,
> > +		const struct mxs_saif_platform_data *pdata);
> > diff --git a/arch/arm/mach-mxs/mach-mx28evk.c
> > b/arch/arm/mach-mxs/mach-mx28evk.c index 4a3cca3..cfe7910 100644
> > --- a/arch/arm/mach-mxs/mach-mx28evk.c
> > +++ b/arch/arm/mach-mxs/mach-mx28evk.c
> > @@ -28,6 +28,7 @@
> >
> >  #include <mach/common.h>
> >  #include <mach/iomux-mx28.h>
> > +#include <mach/digctl.h>
> >
> >  #include "devices-mx28.h"
> >
> > @@ -417,6 +418,18 @@ static void __init mx28evk_add_regulators(void)
> > static void __init mx28evk_add_regulators(void) {}  #endif
> >
> > +static const struct mxs_saif_platform_data
> > +			mx28evk_mxs_saif_pdata[] __initconst = {
> > +	/* working on EXTMSTR0 mode (saif0 master, saif1 slave) */
> > +	{
> > +		.master_mode = 1;
> > +		.master_id = 0;
> > +	}, {
> > +		.master_mode = 0;
> > +		.master_id = 0;
> > +	},
> > +};
> > +
> >  static void __init mx28evk_init(void)  {
> >  	int ret;
> > @@ -457,8 +470,9 @@ static void __init mx28evk_init(void)
> >
> >  	mx28_add_mxsfb(&mx28evk_mxsfb_pdata);
> >
> > -	mx28_add_saif(0);
> > -	mx28_add_saif(1);
> > +	mxs_saif_clkmux_select(MXS_DIGCTL_SAIF_CLKMUX_EXTMSTR0);
> > +	mx28_add_saif(0, &mx28evk_mxs_saif_pdata[0]);
> > +	mx28_add_saif(1, &mx28evk_mxs_saif_pdata[1]);
> >
> >  	mx28_add_mxs_i2c(0);
> >  	i2c_register_board_info(0, mxs_i2c0_board_info,
> 
> Otherwise,
> 
> Reviewed-by: Marek Vasut <marek.vasut@gmail.com>
Thanks for the review.

Regards
Dong Aisheng

^ permalink raw reply	[flat|nested] 22+ messages in thread

* RE: [alsa-devel] [PATCH v5 1/3] ARM: mxs: add saif clkmux functions
  2011-11-18  6:28       ` [alsa-devel] " Dong Aisheng-B29396
@ 2011-11-18  8:29         ` Lothar Waßmann
  -1 siblings, 0 replies; 22+ messages in thread
From: Lothar Waßmann @ 2011-11-18  8:29 UTC (permalink / raw)
  To: Dong Aisheng-B29396
  Cc: alsa-devel, s.hauer, broonie, w.sang, Guo Shawn-R65073,
	Marek Vasut, kernel, u.kleine-koenig, lrg, linux-arm-kernel

Hi,

Dong Aisheng-B29396 writes:
[...]
> > > +#define HW_DIGCTL_CTRL			0x0
> > > +#define  BP_DIGCTL_CTRL_SAIF_CLKMUX	(10)
> > 
> > Do you need the parenthesis above ?
> > 
> I'm not sure about his.
> HW_DIGCTL_CTRL is the register offset.
> Do we have to do this?
> 
You need parens around macro parameters that are used in an expression
inside the macro. But you never ever need to enclose a bare number in
parens!


Lothar Waßmann
-- 
___________________________________________________________

Ka-Ro electronics GmbH | Pascalstraße 22 | D - 52076 Aachen
Phone: +49 2408 1402-0 | Fax: +49 2408 1402-10
Geschäftsführer: Matthias Kaussen
Handelsregistereintrag: Amtsgericht Aachen, HRB 4996

www.karo-electronics.de | info@karo-electronics.de
___________________________________________________________

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [alsa-devel] [PATCH v5 1/3] ARM: mxs: add saif clkmux functions
@ 2011-11-18  8:29         ` Lothar Waßmann
  0 siblings, 0 replies; 22+ messages in thread
From: Lothar Waßmann @ 2011-11-18  8:29 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

Dong Aisheng-B29396 writes:
[...]
> > > +#define HW_DIGCTL_CTRL			0x0
> > > +#define  BP_DIGCTL_CTRL_SAIF_CLKMUX	(10)
> > 
> > Do you need the parenthesis above ?
> > 
> I'm not sure about his.
> HW_DIGCTL_CTRL is the register offset.
> Do we have to do this?
> 
You need parens around macro parameters that are used in an expression
inside the macro. But you never ever need to enclose a bare number in
parens!


Lothar Wa?mann
-- 
___________________________________________________________

Ka-Ro electronics GmbH | Pascalstra?e 22 | D - 52076 Aachen
Phone: +49 2408 1402-0 | Fax: +49 2408 1402-10
Gesch?ftsf?hrer: Matthias Kaussen
Handelsregistereintrag: Amtsgericht Aachen, HRB 4996

www.karo-electronics.de | info at karo-electronics.de
___________________________________________________________

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v5 1/3] ARM: mxs: add saif clkmux functions
  2011-11-18  8:29         ` Lothar Waßmann
@ 2011-11-18  8:57           ` Dong Aisheng-B29396
  -1 siblings, 0 replies; 22+ messages in thread
From: Dong Aisheng-B29396 @ 2011-11-18  8:57 UTC (permalink / raw)
  To: Lothar Waßmann
  Cc: alsa-devel, s.hauer, broonie, w.sang, Guo Shawn-R65073,
	Marek Vasut, kernel, u.kleine-koenig, lrg, linux-arm-kernel

> -----Original Message-----
> From: Lothar Waßmann [mailto:LW@KARO-electronics.de]
> Sent: Friday, November 18, 2011 4:30 PM
> To: Dong Aisheng-B29396
> Cc: Marek Vasut; alsa-devel@alsa-project.org; s.hauer@pengutronix.de;
> broonie@opensource.wolfsonmicro.com; w.sang@pengutronix.de; Guo Shawn-
> R65073; kernel@pengutronix.de; u.kleine-koenig@pengutronix.de; lrg@ti.com;
> linux-arm-kernel@lists.infradead.org
> Subject: RE: [alsa-devel] [PATCH v5 1/3] ARM: mxs: add saif clkmux
> functions
> 
> Hi,
> 
> Dong Aisheng-B29396 writes:
> [...]
> > > > +#define HW_DIGCTL_CTRL			0x0
> > > > +#define  BP_DIGCTL_CTRL_SAIF_CLKMUX	(10)
> > >
> > > Do you need the parenthesis above ?
> > >
> > I'm not sure about his.
> > HW_DIGCTL_CTRL is the register offset.
> > Do we have to do this?
> >
> You need parens around macro parameters that are used in an expression
> inside the macro. But you never ever need to enclose a bare number in
> parens!
> 
Yep!
I will remove it.
Saving two bytes in code size! :-)

Regards
Dong Aisheng

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [alsa-devel] [PATCH v5 1/3] ARM: mxs: add saif clkmux functions
@ 2011-11-18  8:57           ` Dong Aisheng-B29396
  0 siblings, 0 replies; 22+ messages in thread
From: Dong Aisheng-B29396 @ 2011-11-18  8:57 UTC (permalink / raw)
  To: linux-arm-kernel

> -----Original Message-----
> From: Lothar Wa?mann [mailto:LW at KARO-electronics.de]
> Sent: Friday, November 18, 2011 4:30 PM
> To: Dong Aisheng-B29396
> Cc: Marek Vasut; alsa-devel at alsa-project.org; s.hauer at pengutronix.de;
> broonie at opensource.wolfsonmicro.com; w.sang at pengutronix.de; Guo Shawn-
> R65073; kernel at pengutronix.de; u.kleine-koenig at pengutronix.de; lrg at ti.com;
> linux-arm-kernel at lists.infradead.org
> Subject: RE: [alsa-devel] [PATCH v5 1/3] ARM: mxs: add saif clkmux
> functions
> 
> Hi,
> 
> Dong Aisheng-B29396 writes:
> [...]
> > > > +#define HW_DIGCTL_CTRL			0x0
> > > > +#define  BP_DIGCTL_CTRL_SAIF_CLKMUX	(10)
> > >
> > > Do you need the parenthesis above ?
> > >
> > I'm not sure about his.
> > HW_DIGCTL_CTRL is the register offset.
> > Do we have to do this?
> >
> You need parens around macro parameters that are used in an expression
> inside the macro. But you never ever need to enclose a bare number in
> parens!
> 
Yep!
I will remove it.
Saving two bytes in code size! :-)

Regards
Dong Aisheng

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2011-11-18  8:58 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-11  9:30 [PATCH v5 0/3] ARM: mxs: add recording support for saif Dong Aisheng
2011-11-11  9:30 ` Dong Aisheng
2011-11-11  9:30 ` [PATCH v5 1/3] ARM: mxs: add saif clkmux functions Dong Aisheng
2011-11-11  9:30   ` Dong Aisheng
2011-11-18  4:54   ` Marek Vasut
2011-11-18  4:54     ` [alsa-devel] " Marek Vasut
2011-11-18  6:28     ` Dong Aisheng-B29396
2011-11-18  6:28       ` [alsa-devel] " Dong Aisheng-B29396
2011-11-18  8:29       ` Lothar Waßmann
2011-11-18  8:29         ` Lothar Waßmann
2011-11-18  8:57         ` Dong Aisheng-B29396
2011-11-18  8:57           ` [alsa-devel] " Dong Aisheng-B29396
2011-11-11  9:30 ` [PATCH v5 2/3] ARM: mx28evk: add platform data for saif Dong Aisheng
2011-11-11  9:30   ` Dong Aisheng
2011-11-18  4:58   ` Marek Vasut
2011-11-18  4:58     ` [alsa-devel] " Marek Vasut
2011-11-18  6:40     ` Dong Aisheng-B29396
2011-11-18  6:40       ` [alsa-devel] " Dong Aisheng-B29396
2011-11-11  9:30 ` [PATCH v5 3/3] ARM: mx28evk: set a initial clock rate " Dong Aisheng
2011-11-11  9:30   ` Dong Aisheng
2011-11-18  3:51 ` [PATCH v5 0/3] ARM: mxs: add recording support " Dong Aisheng-B29396
2011-11-18  3:51   ` Dong Aisheng-B29396

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.