From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: Liam Girdwood <lrg@kernel.org>
Cc: Samuel Ortiz <sameo@openedhand.com>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 08/13] mfd: Core support for the WM8350 AudioPlus PMIC
Date: Thu, 9 Oct 2008 13:53:16 +0100 [thread overview]
Message-ID: <20081009125316.GA18321@rakim.wolfsonmicro.main> (raw)
In-Reply-To: <1223553948.6814.291.camel@dell-desktop.example.com>
On Thu, Oct 09, 2008 at 01:05:48PM +0100, Liam Girdwood wrote:
> On Mon, 2008-10-06 at 13:38 +0100, Mark Brown wrote:
> > +config MFD_WM8350_CONFIG_MODE_0
> > + bool "Support WM8350 in configuration mode 0"
> I would make the WM8350 mode configuration selectable by the target
> machines Kconfig rather than let the user choose. Wrong choices would
> probably mean broken hardware.
Machines can still select config modes - this just allows people to
enable additional modes. That said, on reflection I can't actually see
much use for that so I'll just hide the options from the user menus
(patch below).
> > + case 3:
> > + reg_map = wm8350_mode3_defaults;
> > + break;
> > +#endif
> Shouldn't this be #elif for each mode ?
> Ditto for the default register values.
This is a deliberate decision in order to allow people to build kernel
images supporting multiple boards - the driver will check the mode with
the hardware and error out at probe time if support for the mode isn't
compiled in. If the register maps were smaller I'd just compile them
all in.
> I would also #error if no mode
> was selected just to make it's correctly set by machine/board authors.
Yeah, that'd be nice but if the driver does that then it'll be harder
for people like subsystem maintainers to do build tests with WM8350
drivers and they won't get picked up by things like allmodconfig checks.
The patch below adds a build time warning for this case - the runtime
checks will mean that the driver should be safe since it won't run on
unknown hardware.
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 9556547..1597c23 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -82,48 +82,20 @@ config MFD_WM8350
tristate
config MFD_WM8350_CONFIG_MODE_0
- bool "Support WM8350 in configuration mode 0"
+ bool
depends on MFD_WM8350
- default y
- help
- The WM8350 offers four configuration modes with different
- initial register states. This option enables support for the
- WM8350 in mode 0.
-
- If unsure say Y
config MFD_WM8350_CONFIG_MODE_1
- bool "Support WM8350 in configuration mode 1"
+ bool
depends on MFD_WM8350
- default y
- help
- The WM8350 offers four configuration modes with different
- initial register states. This option enables support for the
- WM8350 in mode 1.
-
- If unsure say Y
config MFD_WM8350_CONFIG_MODE_2
- bool "Support WM8350 in configuration mode 2"
+ bool
depends on MFD_WM8350
- default y
- help
- The WM8350 offers four configuration modes with different
- initial register states. This option enables support for the
- WM8350 in mode 2.
-
- If unsure say Y
config MFD_WM8350_CONFIG_MODE_3
- bool "Support WM8350 in configuration mode 3"
+ bool
depends on MFD_WM8350
- default y
- help
- The WM8350 offers four configuration modes with different
- initial register states. This option enables support for the
- WM8350 in mode 3.
-
- If unsure say Y
config MFD_WM8350_I2C
tristate "Support Wolfson Microelectronics WM8350 with I2C"
diff --git a/drivers/mfd/wm8350-regmap.c b/drivers/mfd/wm8350-regmap.c
index b062cc1..7cb2f4d 100644
--- a/drivers/mfd/wm8350-regmap.c
+++ b/drivers/mfd/wm8350-regmap.c
@@ -15,6 +15,10 @@
#include <linux/mfd/wm8350/core.h>
#ifdef CONFIG_MFD_WM8350_CONFIG_MODE_0
+
+#undef WM8350_HAVE_CONFIG_MODE
+#define WM8350_HAVE_CONFIG_MODE
+
const u16 wm8350_mode0_defaults[] = {
0x17FF, /* R0 - Reset/ID */
0x1000, /* R1 - ID */
@@ -276,6 +280,10 @@ const u16 wm8350_mode0_defaults[] = {
#endif
#ifdef CONFIG_MFD_WM8350_CONFIG_MODE_1
+
+#undef WM8350_HAVE_CONFIG_MODE
+#define WM8350_HAVE_CONFIG_MODE
+
const u16 wm8350_mode1_defaults[] = {
0x17FF, /* R0 - Reset/ID */
0x1000, /* R1 - ID */
@@ -537,6 +545,10 @@ const u16 wm8350_mode1_defaults[] = {
#endif
#ifdef CONFIG_MFD_WM8350_CONFIG_MODE_2
+
+#undef WM8350_HAVE_CONFIG_MODE
+#define WM8350_HAVE_CONFIG_MODE
+
const u16 wm8350_mode2_defaults[] = {
0x17FF, /* R0 - Reset/ID */
0x1000, /* R1 - ID */
@@ -798,6 +810,10 @@ const u16 wm8350_mode2_defaults[] = {
#endif
#ifdef CONFIG_MFD_WM8350_CONFIG_MODE_3
+
+#undef WM8350_HAVE_CONFIG_MODE
+#define WM8350_HAVE_CONFIG_MODE
+
const u16 wm8350_mode3_defaults[] = {
0x17FF, /* R0 - Reset/ID */
0x1000, /* R1 - ID */
@@ -1058,6 +1074,14 @@ const u16 wm8350_mode3_defaults[] = {
};
#endif
+/* The register defaults for the config mode used must be compiled in but
+ * due to the impact on kernel size it is possible to disable
+ */
+#ifndef WM8350_HAVE_CONFIG_MODE
+#warning No WM8350 config modes supported - select at least one of the
+#warning MFD_WM8350_CONFIG_MODE_n options from the board driver.
+#endif
+
/*
* Access masks.
*/
next prev parent reply other threads:[~2008-10-09 12:53 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-06 12:32 [PATCH 0/13] WM8350 support Mark Brown
2008-10-06 12:37 ` [PATCH 01/13] mfd: Add WM8350 audio register definitions Mark Brown
2008-10-06 12:37 ` [PATCH 02/13] mfd: Add WM8350 GPIO " Mark Brown
2008-10-06 12:37 ` [PATCH 03/13] mfd: Add WM8350 PMIC " Mark Brown
2008-10-06 12:37 ` [PATCH 04/13] mfd: Add WM8350 PMU " Mark Brown
2008-10-06 12:38 ` [PATCH 05/13] mfd: Add WM8350 comparator " Mark Brown
2008-10-06 12:38 ` [PATCH 06/13] mfd: Add WM8350 RTC " Mark Brown
2008-10-06 12:38 ` [PATCH 07/13] mfd: Add WM8350 watchdog " Mark Brown
2008-10-06 12:38 ` [PATCH 08/13] mfd: Core support for the WM8350 AudioPlus PMIC Mark Brown
2008-10-06 12:38 ` [PATCH 09/13] mfd: Add I2C control support for WM8350 Mark Brown
2008-10-06 12:38 ` [PATCH 10/13] mfd: Add GPIO pin configuration " Mark Brown
2008-10-06 12:38 ` [PATCH 11/13] mfd: Add initialisation callback " Mark Brown
2008-10-06 12:38 ` [PATCH 12/13] mfd: Add WM8350 interrupt support Mark Brown
2008-10-06 12:38 ` [PATCH 13/13] regulator: Add WM8350 regulator support Mark Brown
2008-10-09 12:05 ` [PATCH 08/13] mfd: Core support for the WM8350 AudioPlus PMIC Liam Girdwood
2008-10-09 12:53 ` Mark Brown [this message]
2008-10-10 14:24 ` [PATCH 0/13] WM8350 support Liam Girdwood
2008-10-10 14:31 ` Samuel Ortiz
2008-10-10 14:38 ` Mark Brown
2008-10-10 14:45 ` Liam Girdwood
2008-10-10 14:58 ` [PATCH 01/14] mfd: Add WM8350 audio register definitions Mark Brown
2008-10-10 14:58 ` [PATCH 02/14] mfd: Add WM8350 GPIO " Mark Brown
2008-10-10 14:58 ` [PATCH 03/14] mfd: Add WM8350 PMIC " Mark Brown
2008-10-10 14:58 ` [PATCH 04/14] mfd: Add WM8350 PMU " Mark Brown
2008-10-10 14:58 ` [PATCH 05/14] mfd: Add WM8350 comparator " Mark Brown
2008-10-10 14:58 ` [PATCH 06/14] mfd: Add WM8350 RTC " Mark Brown
2008-10-10 14:58 ` [PATCH 07/14] mfd: Add WM8350 watchdog " Mark Brown
2008-10-10 14:58 ` [PATCH 08/14] mfd: Core support for the WM8350 AudioPlus PMIC Mark Brown
2008-10-10 14:58 ` [PATCH 09/14] mfd: Add I2C control support for WM8350 Mark Brown
2008-10-10 14:58 ` [PATCH 10/14] mfd: Add GPIO pin configuration " Mark Brown
2008-10-10 14:58 ` [PATCH 11/14] mfd: Add initialisation callback " Mark Brown
2008-10-10 14:58 ` [PATCH 12/14] mfd: Add WM8350 interrupt support Mark Brown
2008-10-10 14:58 ` [PATCH 13/14] regulator: Add WM8350 regulator support Mark Brown
2008-10-10 14:58 ` [PATCH 14/14] mfd: Add WM8350 subdevice registration helper Mark Brown
2008-10-11 14:18 ` Samuel Ortiz
2008-10-11 15:38 ` Mark Brown
2008-10-11 14:09 ` [PATCH 10/14] mfd: Add GPIO pin configuration support for WM8350 Samuel Ortiz
2008-10-11 14:46 ` Mark Brown
2008-10-11 14:23 ` [PATCH 0/13] WM8350 support Samuel Ortiz
2008-10-10 14:48 ` Samuel Ortiz
2008-10-10 14:38 ` Liam Girdwood
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20081009125316.GA18321@rakim.wolfsonmicro.main \
--to=broonie@opensource.wolfsonmicro.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lrg@kernel.org \
--cc=sameo@openedhand.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox