Skip to contentSkip to conversation

WM8350 updates

PATCH In review Mark Brown 2 participants 9 messages Oct 13, 2008

Subsystems (2)
lore
Share & tools
lore

Mark Brown

author
#0 lore raw

The following changes since commit 1fbf1b714ea8ca685f024e91f0cfa83a40b8604f:
Mark Brown (1):
mfd: Add WM8350 subdevice registration helper

are available in the git repository at:

git://opensource.wolfsonmicro.com/linux-2.6-audioplus for-lrg

Mark Brown (2):
mfd: Add placeholders for WM8350 client devices
mfd: Fix warning in WM8350

 drivers/mfd/wm8350-core.c         |   21 ++++++++++++++++++++-
 include/linux/mfd/wm8350/audio.h  |    6 ++++++
 include/linux/mfd/wm8350/core.h   |   10 ++++++++++
 include/linux/mfd/wm8350/gpio.h   |    6 ++++++
 include/linux/mfd/wm8350/rtc.h    |    6 ++++++
 include/linux/mfd/wm8350/supply.h |    6 ++++++
 include/linux/mfd/wm8350/wdt.h    |    8 +++++++-
 7 files changed, 61 insertions(+), 2 deletions(-)
author
#1 lore raw

PATCH 1/2 mfd: Add placeholders for WM8350 client devices

In order to avoid merge problems further down the line add placeholders for several of the WM8350 client devices and register them, otherwise the patches adding the client devices will all try to update the same code.

---
 drivers/mfd/wm8350-core.c         |   20 ++++++++++++++++++++
 include/linux/mfd/wm8350/audio.h  |    6 ++++++
 include/linux/mfd/wm8350/core.h   |   10 ++++++++++
 include/linux/mfd/wm8350/gpio.h   |    6 ++++++
 include/linux/mfd/wm8350/rtc.h    |    6 ++++++
 include/linux/mfd/wm8350/supply.h |    6 ++++++
 include/linux/mfd/wm8350/wdt.h    |    8 +++++++-
 7 files changed, 61 insertions(+), 1 deletions(-)
drivers/mfd/wm8350-core.c +20 -0
index cd1f76e..8554855 100644
@@ -1234,6 +1234,15 @@ int wm8350_device_init(struct wm8350 *wm8350, int irq,
 
 	wm8350_reg_write(wm8350, WM8350_SYSTEM_INTERRUPTS_MASK, 0x0);
 
+	wm8350_client_dev_register(wm8350, "wm8350-codec",
+				   &(wm8350->codec.pdev));
+	wm8350_client_dev_register(wm8350, "wm8350-gpio",
+				   &(wm8350->gpio.pdev));
+	wm8350_client_dev_register(wm8350, "wm8350-power",
+				   &(wm8350->power.pdev));
+	wm8350_client_dev_register(wm8350, "wm8350-rtc", &(wm8350->rtc.pdev));
+	wm8350_client_dev_register(wm8350, "wm8350-wdt", &(wm8350->wdt.pdev));
+
 	return 0;
 
 err:
@@ -1250,6 +1259,17 @@ void wm8350_device_exit(struct wm8350 *wm8350)
 		if (wm8350->pmic.pdev[i] != NULL)
 			platform_device_unregister(wm8350->pmic.pdev[i]);
 
+	if (wm8350->wdt.pdev)
+		platform_device_unregister(wm8350->wdt.pdev);
+	if (wm8350->rtc.pdev)
+		platform_device_unregister(wm8350->rtc.pdev);
+	if (wm8350->power.pdev)
+		platform_device_unregister(wm8350->power.pdev);
+	if (wm8350->gpio.pdev)
+		platform_device_unregister(wm8350->gpio.pdev);
+	if (wm8350->codec.pdev)
+		platform_device_unregister(wm8350->codec.pdev);
+
 	free_irq(wm8350->chip_irq, wm8350);
 	flush_work(&wm8350->irq_work);
 	kfree(wm8350->reg_cache);
include/linux/mfd/wm8350/audio.h +6 -0
index 43342f7..217bb22 100644
@@ -13,6 +13,8 @@
 #ifndef __LINUX_MFD_WM8350_AUDIO_H_
 #define __LINUX_MFD_WM8350_AUDIO_H_
 
+#include <linux/platform_device.h>
+
 #define WM8350_CLOCK_CONTROL_1                  0x28
 #define WM8350_CLOCK_CONTROL_2                  0x29
 #define WM8350_FLL_CONTROL_1                    0x2A
@@ -589,4 +591,8 @@
 #define WM8350_IRQ_CODEC_MICSCD			41
 #define WM8350_IRQ_CODEC_MICD			42
 
+struct wm8350_codec {
+	struct platform_device *pdev;
+};
+
 #endif
include/linux/mfd/wm8350/core.h +10 -0
index 348101c..6ebf97f 100644
@@ -17,7 +17,12 @@
 #include <linux/mutex.h>
 #include <linux/workqueue.h>
 
+#include <linux/mfd/wm8350/audio.h>
+#include <linux/mfd/wm8350/gpio.h>
 #include <linux/mfd/wm8350/pmic.h>
+#include <linux/mfd/wm8350/rtc.h>
+#include <linux/mfd/wm8350/supply.h>
+#include <linux/mfd/wm8350/wdt.h>
 
 /*
  * Register values.
@@ -574,7 +579,12 @@ struct wm8350 {
 	int chip_irq;
 
 	/* Client devices */
+	struct wm8350_codec codec;
+	struct wm8350_gpio gpio;
 	struct wm8350_pmic pmic;
+	struct wm8350_power power;
+	struct wm8350_rtc rtc;
+	struct wm8350_wdt wdt;
 };
 
 /**
include/linux/mfd/wm8350/gpio.h +6 -0
index c6cd2ca..ed91e8f 100644
@@ -13,6 +13,8 @@
 #ifndef __LINUX_MFD_WM8350_GPIO_H_
 #define __LINUX_MFD_WM8350_GPIO_H_
 
+#include <linux/platform_device.h>
+
 /*
  * GPIO Registers.
  */
@@ -328,6 +330,10 @@ struct wm8350;
 int wm8350_gpio_config(struct wm8350 *wm8350, int gpio, int dir, int func,
 		       int pol, int pull, int invert, int debounce);
 
+struct wm8350_gpio {
+	struct platform_device *pdev;
+};
+
 /*
  * GPIO Interrupts
  */
include/linux/mfd/wm8350/rtc.h +6 -0
index cb337ea..dfda69e 100644
@@ -12,6 +12,8 @@
 #ifndef __LINUX_MFD_WM8350_RTC_H
 #define __LINUX_MFD_WM8350_RTC_H
 
+#include <linux/platform_device.h>
+
 /*
  * Register values.
  */
@@ -257,4 +259,8 @@
 #define WM8350_IRQ_RTC_SEC			8
 #define WM8350_IRQ_RTC_ALM			9
 
+struct wm8350_rtc {
+	struct platform_device *pdev;
+};
+
 #endif
include/linux/mfd/wm8350/supply.h +6 -0
index f1d4317..1c8f3cd 100644
@@ -13,6 +13,8 @@
 #ifndef __LINUX_MFD_WM8350_SUPPLY_H_
 #define __LINUX_MFD_WM8350_SUPPLY_H_
 
+#include <linux/platform_device.h>
+
 /*
  * Charger registers
  */
@@ -102,4 +104,8 @@
 #define WM8350_IRQ_EXT_WALL_FB			37
 #define WM8350_IRQ_EXT_BAT_FB			38
 
+struct wm8350_power {
+	struct platform_device *pdev;
+};
+
 #endif
include/linux/mfd/wm8350/wdt.h +7 -1
index 72fc9f5..f6135b5 100644
@@ -1,7 +1,7 @@
 /*
  * wdt.h  --  Watchdog Driver for Wolfson WM8350 PMIC
  *
- * Copyright 2007 Wolfson Microelectronics PLC
+ * Copyright 2007, 2008 Wolfson Microelectronics PLC
  *
  *  This program is free software; you can redistribute  it and/or modify it
  *  under  the terms of  the GNU General  Public License as published by the
@@ -12,6 +12,8 @@
 #ifndef __LINUX_MFD_WM8350_WDT_H_
 #define __LINUX_MFD_WM8350_WDT_H_
 
+#include <linux/platform_device.h>
+
 #define WM8350_WDOG_HIB_MODE                    0x0080
 #define WM8350_WDOG_DEBUG                       0x0040
 #define WM8350_WDOG_MODE_MASK                   0x0030
@@ -19,4 +21,8 @@
 
 #define WM8350_IRQ_SYS_WDOG_TO			24
 
+struct wm8350_wdt {
+	struct platform_device *pdev;
+};
+
 #endif
Signature · 1 line
1.5.6.5
author
#2 lore raw

PATCH 2/2 mfd: Fix warning in WM8350

---
 drivers/mfd/wm8350-core.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
drivers/mfd/wm8350-core.c +0 -1
index 8554855..35f4557 100644
@@ -1161,7 +1161,6 @@ int wm8350_device_init(struct wm8350 *wm8350, int irq,
 {
 	int ret = -EINVAL;
 	u16 id1, id2, mask, mode;
-	int i;
 
 	/* get WM8350 revision and config mode */
 	wm8350->read_dev(wm8350, WM8350_RESET_ID, sizeof(id1), &id1);
Signature · 1 line
1.5.6.5
Acked-by on v1 2/2
#3 lore raw

Re: [PATCH 2/2] mfd: Fix warning in WM8350

Quoted 1 line · Mark Brown
Quoted 19 lines
---
 drivers/mfd/wm8350-core.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
drivers/mfd/wm8350-core.c +0 -1
index 8554855..35f4557 100644
@@ -1161,7 +1161,6 @@ int wm8350_device_init(struct wm8350 *wm8350, int irq,
 {
 	int ret = -EINVAL;
 	u16 id1, id2, mask, mode;
-	int i;
 
 	/* get WM8350 revision and config mode */
 	wm8350->read_dev(wm8350, WM8350_RESET_ID, sizeof(id1), &id1);
Signature · 1 line
1.5.6.5
Signature · 2 lines
Intel Open Source Technology Centre
http://oss.intel.com/
#4 lore raw

Re: [PATCH 1/2] mfd: Add placeholders for WM8350 client devices

In reply to Mark Brown

Hi Mark,
Hi Mark,

a few comments:

Quoted 40 lines · Mark Brown

In order to avoid merge problems further down the line add placeholders for several of the WM8350 client devices and register them, otherwise the patches adding the client devices will all try to update the same code.

---
 drivers/mfd/wm8350-core.c         |   20 ++++++++++++++++++++
 include/linux/mfd/wm8350/audio.h  |    6 ++++++
 include/linux/mfd/wm8350/core.h   |   10 ++++++++++
 include/linux/mfd/wm8350/gpio.h   |    6 ++++++
 include/linux/mfd/wm8350/rtc.h    |    6 ++++++
 include/linux/mfd/wm8350/supply.h |    6 ++++++
 include/linux/mfd/wm8350/wdt.h    |    8 +++++++-
 7 files changed, 61 insertions(+), 1 deletions(-)
drivers/mfd/wm8350-core.c +9 -0
index cd1f76e..8554855 100644
@@ -1234,6 +1234,15 @@ int wm8350_device_init(struct wm8350 *wm8350, int irq,
 
 	wm8350_reg_write(wm8350, WM8350_SYSTEM_INTERRUPTS_MASK, 0x0);
 
+	wm8350_client_dev_register(wm8350, "wm8350-codec",
+				   &(wm8350->codec.pdev));
+	wm8350_client_dev_register(wm8350, "wm8350-gpio",
+				   &(wm8350->gpio.pdev));
+	wm8350_client_dev_register(wm8350, "wm8350-power",
+				   &(wm8350->power.pdev));
+	wm8350_client_dev_register(wm8350, "wm8350-rtc", &(wm8350->rtc.pdev));
+	wm8350_client_dev_register(wm8350, "wm8350-wdt", &(wm8350->wdt.pdev));
+
 	return 0;
 
 err:
@@ -1250,6 +1259,17 @@ void wm8350_device_exit(struct wm8350 *wm8350)
 		if (wm8350->pmic.pdev[i] != NULL)
 			platform_device_unregister(wm8350->pmic.pdev[i]);
 

drivers/mfd/wm8350-core.c void wm8350_device_exit(struct wm8350 *wm8350) · line 1271

Quoted 10 lines
drivers/mfd/wm8350-core.c +10 -0
+	if (wm8350->wdt.pdev)
+		platform_device_unregister(wm8350->wdt.pdev);
+	if (wm8350->rtc.pdev)
+		platform_device_unregister(wm8350->rtc.pdev);
+	if (wm8350->power.pdev)
+		platform_device_unregister(wm8350->power.pdev);
+	if (wm8350->gpio.pdev)
+		platform_device_unregister(wm8350->gpio.pdev);
+	if (wm8350->codec.pdev)
+		platform_device_unregister(wm8350->codec.pdev);

You don't need to check for pdev here, platform_device_unregister does that for you.

Quoted 69 lines
drivers/mfd/wm8350-core.c +0 -0
 	free_irq(wm8350->chip_irq, wm8350);
 	flush_work(&wm8350->irq_work);
 	kfree(wm8350->reg_cache);
include/linux/mfd/wm8350/audio.h +6 -0
index 43342f7..217bb22 100644
@@ -13,6 +13,8 @@
 #ifndef __LINUX_MFD_WM8350_AUDIO_H_
 #define __LINUX_MFD_WM8350_AUDIO_H_
 
+#include <linux/platform_device.h>
+
 #define WM8350_CLOCK_CONTROL_1                  0x28
 #define WM8350_CLOCK_CONTROL_2                  0x29
 #define WM8350_FLL_CONTROL_1                    0x2A
@@ -589,4 +591,8 @@
 #define WM8350_IRQ_CODEC_MICSCD			41
 #define WM8350_IRQ_CODEC_MICD			42
 
+struct wm8350_codec {
+	struct platform_device *pdev;
+};
+
 #endif
include/linux/mfd/wm8350/core.h +10 -0
index 348101c..6ebf97f 100644
@@ -17,7 +17,12 @@
 #include <linux/mutex.h>
 #include <linux/workqueue.h>
 
+#include <linux/mfd/wm8350/audio.h>
+#include <linux/mfd/wm8350/gpio.h>
 #include <linux/mfd/wm8350/pmic.h>
+#include <linux/mfd/wm8350/rtc.h>
+#include <linux/mfd/wm8350/supply.h>
+#include <linux/mfd/wm8350/wdt.h>
 
 /*
  * Register values.
@@ -574,7 +579,12 @@ struct wm8350 {
 	int chip_irq;
 
 	/* Client devices */
+	struct wm8350_codec codec;
+	struct wm8350_gpio gpio;
 	struct wm8350_pmic pmic;
+	struct wm8350_power power;
+	struct wm8350_rtc rtc;
+	struct wm8350_wdt wdt;
 };
 
 /**
include/linux/mfd/wm8350/gpio.h +2 -0
index c6cd2ca..ed91e8f 100644
@@ -13,6 +13,8 @@
 #ifndef __LINUX_MFD_WM8350_GPIO_H_
 #define __LINUX_MFD_WM8350_GPIO_H_
 
+#include <linux/platform_device.h>
+
 /*
  * GPIO Registers.
  */

include/linux/mfd/wm8350/gpio.h struct wm8350; · line 335

Quoted 6 lines
include/linux/mfd/wm8350/gpio.h +3 -0
@@ -328,6 +330,10 @@ struct wm8350;
 int wm8350_gpio_config(struct wm8350 *wm8350, int gpio, int dir, int func,
 		       int pol, int pull, int invert, int debounce);
 
+struct wm8350_gpio {
+	struct platform_device *pdev;
+};

I guess you're planning to add more stuff to those structures at some point ?

Cheers,
Samuel.

Signature · 2 lines
Intel Open Source Technology Centre
http://oss.intel.com/
author
#5 lore raw

Re: [PATCH 1/2] mfd: Add placeholders for WM8350 client devices

Quoted 4 lines · Samuel Ortiz

include/linux/mfd/wm8350/gpio.h struct wm8350; · line 335

Quoted 3 lines
include/linux/mfd/wm8350/gpio.h +3 -0
+struct wm8350_gpio {
+	struct platform_device *pdev;
+};

I guess you're planning to add more stuff to those structures at some point ?

Yes - I'll the needed stuff along with the drivers to make the reviews a bit clearer. At the minute these structures are just placeholders to avoid merge conflicts when the actual drivers are contributed.

Liam, I'll push out an updated version of this patch shortly which removes the conditionals from the remove path.

author
#6 lore raw

PATCH 1/2 mfd: Add placeholders for WM8350 client devices

In reply to Samuel Ortiz

In order to avoid merge problems further down the line add placeholders for several of the WM8350 client devices and register them, otherwise the patches adding the client devices will all try to update the same code.

Also remove redundant checks for null regulator platform devices while we're at it.

---
 drivers/mfd/wm8350-core.c         |   18 ++++++++++++++++--
 include/linux/mfd/wm8350/audio.h  |    6 ++++++
 include/linux/mfd/wm8350/core.h   |   10 ++++++++++
 include/linux/mfd/wm8350/gpio.h   |    6 ++++++
 include/linux/mfd/wm8350/rtc.h    |    6 ++++++
 include/linux/mfd/wm8350/supply.h |    6 ++++++
 include/linux/mfd/wm8350/wdt.h    |    8 +++++++-
 7 files changed, 57 insertions(+), 3 deletions(-)
drivers/mfd/wm8350-core.c +16 -2
index cd1f76e..382e38c 100644
@@ -1234,6 +1234,15 @@ int wm8350_device_init(struct wm8350 *wm8350, int irq,
 
 	wm8350_reg_write(wm8350, WM8350_SYSTEM_INTERRUPTS_MASK, 0x0);
 
+	wm8350_client_dev_register(wm8350, "wm8350-codec",
+				   &(wm8350->codec.pdev));
+	wm8350_client_dev_register(wm8350, "wm8350-gpio",
+				   &(wm8350->gpio.pdev));
+	wm8350_client_dev_register(wm8350, "wm8350-power",
+				   &(wm8350->power.pdev));
+	wm8350_client_dev_register(wm8350, "wm8350-rtc", &(wm8350->rtc.pdev));
+	wm8350_client_dev_register(wm8350, "wm8350-wdt", &(wm8350->wdt.pdev));
+
 	return 0;
 
 err:
@@ -1247,8 +1256,13 @@ void wm8350_device_exit(struct wm8350 *wm8350)
 	int i;
 
 	for (i = 0; i < ARRAY_SIZE(wm8350->pmic.pdev); i++)
-		if (wm8350->pmic.pdev[i] != NULL)
-			platform_device_unregister(wm8350->pmic.pdev[i]);
+		platform_device_unregister(wm8350->pmic.pdev[i]);
+
+	platform_device_unregister(wm8350->wdt.pdev);
+	platform_device_unregister(wm8350->rtc.pdev);
+	platform_device_unregister(wm8350->power.pdev);
+	platform_device_unregister(wm8350->gpio.pdev);
+	platform_device_unregister(wm8350->codec.pdev);
 
 	free_irq(wm8350->chip_irq, wm8350);
 	flush_work(&wm8350->irq_work);
include/linux/mfd/wm8350/audio.h +6 -0
index 43342f7..217bb22 100644
@@ -13,6 +13,8 @@
 #ifndef __LINUX_MFD_WM8350_AUDIO_H_
 #define __LINUX_MFD_WM8350_AUDIO_H_
 
+#include <linux/platform_device.h>
+
 #define WM8350_CLOCK_CONTROL_1                  0x28
 #define WM8350_CLOCK_CONTROL_2                  0x29
 #define WM8350_FLL_CONTROL_1                    0x2A
@@ -589,4 +591,8 @@
 #define WM8350_IRQ_CODEC_MICSCD			41
 #define WM8350_IRQ_CODEC_MICD			42
 
+struct wm8350_codec {
+	struct platform_device *pdev;
+};
+
 #endif
include/linux/mfd/wm8350/core.h +10 -0
index 348101c..6ebf97f 100644
@@ -17,7 +17,12 @@
 #include <linux/mutex.h>
 #include <linux/workqueue.h>
 
+#include <linux/mfd/wm8350/audio.h>
+#include <linux/mfd/wm8350/gpio.h>
 #include <linux/mfd/wm8350/pmic.h>
+#include <linux/mfd/wm8350/rtc.h>
+#include <linux/mfd/wm8350/supply.h>
+#include <linux/mfd/wm8350/wdt.h>
 
 /*
  * Register values.
@@ -574,7 +579,12 @@ struct wm8350 {
 	int chip_irq;
 
 	/* Client devices */
+	struct wm8350_codec codec;
+	struct wm8350_gpio gpio;
 	struct wm8350_pmic pmic;
+	struct wm8350_power power;
+	struct wm8350_rtc rtc;
+	struct wm8350_wdt wdt;
 };
 
 /**
include/linux/mfd/wm8350/gpio.h +6 -0
index c6cd2ca..ed91e8f 100644
@@ -13,6 +13,8 @@
 #ifndef __LINUX_MFD_WM8350_GPIO_H_
 #define __LINUX_MFD_WM8350_GPIO_H_
 
+#include <linux/platform_device.h>
+
 /*
  * GPIO Registers.
  */
@@ -328,6 +330,10 @@ struct wm8350;
 int wm8350_gpio_config(struct wm8350 *wm8350, int gpio, int dir, int func,
 		       int pol, int pull, int invert, int debounce);
 
+struct wm8350_gpio {
+	struct platform_device *pdev;
+};
+
 /*
  * GPIO Interrupts
  */
include/linux/mfd/wm8350/rtc.h +6 -0
index cb337ea..dfda69e 100644
@@ -12,6 +12,8 @@
 #ifndef __LINUX_MFD_WM8350_RTC_H
 #define __LINUX_MFD_WM8350_RTC_H
 
+#include <linux/platform_device.h>
+
 /*
  * Register values.
  */
@@ -257,4 +259,8 @@
 #define WM8350_IRQ_RTC_SEC			8
 #define WM8350_IRQ_RTC_ALM			9
 
+struct wm8350_rtc {
+	struct platform_device *pdev;
+};
+
 #endif
include/linux/mfd/wm8350/supply.h +6 -0
index f1d4317..1c8f3cd 100644
@@ -13,6 +13,8 @@
 #ifndef __LINUX_MFD_WM8350_SUPPLY_H_
 #define __LINUX_MFD_WM8350_SUPPLY_H_
 
+#include <linux/platform_device.h>
+
 /*
  * Charger registers
  */
@@ -102,4 +104,8 @@
 #define WM8350_IRQ_EXT_WALL_FB			37
 #define WM8350_IRQ_EXT_BAT_FB			38
 
+struct wm8350_power {
+	struct platform_device *pdev;
+};
+
 #endif
include/linux/mfd/wm8350/wdt.h +7 -1
index 72fc9f5..f6135b5 100644
@@ -1,7 +1,7 @@
 /*
  * wdt.h  --  Watchdog Driver for Wolfson WM8350 PMIC
  *
- * Copyright 2007 Wolfson Microelectronics PLC
+ * Copyright 2007, 2008 Wolfson Microelectronics PLC
  *
  *  This program is free software; you can redistribute  it and/or modify it
  *  under  the terms of  the GNU General  Public License as published by the
@@ -12,6 +12,8 @@
 #ifndef __LINUX_MFD_WM8350_WDT_H_
 #define __LINUX_MFD_WM8350_WDT_H_
 
+#include <linux/platform_device.h>
+
 #define WM8350_WDOG_HIB_MODE                    0x0080
 #define WM8350_WDOG_DEBUG                       0x0040
 #define WM8350_WDOG_MODE_MASK                   0x0030
@@ -19,4 +21,8 @@
 
 #define WM8350_IRQ_SYS_WDOG_TO			24
 
+struct wm8350_wdt {
+	struct platform_device *pdev;
+};
+
 #endif
Signature · 1 line
1.5.6.5
author
#7 lore raw

PATCH 2/2 mfd: Fix warning in WM8350

---
 drivers/mfd/wm8350-core.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
drivers/mfd/wm8350-core.c +0 -1
index 382e38c..25a7a5d 100644
@@ -1161,7 +1161,6 @@ int wm8350_device_init(struct wm8350 *wm8350, int irq,
 {
 	int ret = -EINVAL;
 	u16 id1, id2, mask, mode;
-	int i;
 
 	/* get WM8350 revision and config mode */
 	wm8350->read_dev(wm8350, WM8350_RESET_ID, sizeof(id1), &id1);
Signature · 1 line
1.5.6.5
Acked-by on v1 1/2
#8 lore raw

Re: [PATCH 1/2] mfd: Add placeholders for WM8350 client devices

In reply to Mark Brown
Quoted 9 lines · Mark Brown

In order to avoid merge problems further down the line add placeholders for several of the WM8350 client devices and register them, otherwise the patches adding the client devices will all try to update the same code.

Also remove redundant checks for null regulator platform devices while we're at it.

Thanks Mark.

Cheers,
Samuel.

Quoted 200 lines
---
 drivers/mfd/wm8350-core.c         |   18 ++++++++++++++++--
 include/linux/mfd/wm8350/audio.h  |    6 ++++++
 include/linux/mfd/wm8350/core.h   |   10 ++++++++++
 include/linux/mfd/wm8350/gpio.h   |    6 ++++++
 include/linux/mfd/wm8350/rtc.h    |    6 ++++++
 include/linux/mfd/wm8350/supply.h |    6 ++++++
 include/linux/mfd/wm8350/wdt.h    |    8 +++++++-
 7 files changed, 57 insertions(+), 3 deletions(-)
drivers/mfd/wm8350-core.c +16 -2
index cd1f76e..382e38c 100644
@@ -1234,6 +1234,15 @@ int wm8350_device_init(struct wm8350 *wm8350, int irq,
 
 	wm8350_reg_write(wm8350, WM8350_SYSTEM_INTERRUPTS_MASK, 0x0);
 
+	wm8350_client_dev_register(wm8350, "wm8350-codec",
+				   &(wm8350->codec.pdev));
+	wm8350_client_dev_register(wm8350, "wm8350-gpio",
+				   &(wm8350->gpio.pdev));
+	wm8350_client_dev_register(wm8350, "wm8350-power",
+				   &(wm8350->power.pdev));
+	wm8350_client_dev_register(wm8350, "wm8350-rtc", &(wm8350->rtc.pdev));
+	wm8350_client_dev_register(wm8350, "wm8350-wdt", &(wm8350->wdt.pdev));
+
 	return 0;
 
 err:
@@ -1247,8 +1256,13 @@ void wm8350_device_exit(struct wm8350 *wm8350)
 	int i;
 
 	for (i = 0; i < ARRAY_SIZE(wm8350->pmic.pdev); i++)
-		if (wm8350->pmic.pdev[i] != NULL)
-			platform_device_unregister(wm8350->pmic.pdev[i]);
+		platform_device_unregister(wm8350->pmic.pdev[i]);
+
+	platform_device_unregister(wm8350->wdt.pdev);
+	platform_device_unregister(wm8350->rtc.pdev);
+	platform_device_unregister(wm8350->power.pdev);
+	platform_device_unregister(wm8350->gpio.pdev);
+	platform_device_unregister(wm8350->codec.pdev);
 
 	free_irq(wm8350->chip_irq, wm8350);
 	flush_work(&wm8350->irq_work);
include/linux/mfd/wm8350/audio.h +6 -0
index 43342f7..217bb22 100644
@@ -13,6 +13,8 @@
 #ifndef __LINUX_MFD_WM8350_AUDIO_H_
 #define __LINUX_MFD_WM8350_AUDIO_H_
 
+#include <linux/platform_device.h>
+
 #define WM8350_CLOCK_CONTROL_1                  0x28
 #define WM8350_CLOCK_CONTROL_2                  0x29
 #define WM8350_FLL_CONTROL_1                    0x2A
@@ -589,4 +591,8 @@
 #define WM8350_IRQ_CODEC_MICSCD			41
 #define WM8350_IRQ_CODEC_MICD			42
 
+struct wm8350_codec {
+	struct platform_device *pdev;
+};
+
 #endif
include/linux/mfd/wm8350/core.h +10 -0
index 348101c..6ebf97f 100644
@@ -17,7 +17,12 @@
 #include <linux/mutex.h>
 #include <linux/workqueue.h>
 
+#include <linux/mfd/wm8350/audio.h>
+#include <linux/mfd/wm8350/gpio.h>
 #include <linux/mfd/wm8350/pmic.h>
+#include <linux/mfd/wm8350/rtc.h>
+#include <linux/mfd/wm8350/supply.h>
+#include <linux/mfd/wm8350/wdt.h>
 
 /*
  * Register values.
@@ -574,7 +579,12 @@ struct wm8350 {
 	int chip_irq;
 
 	/* Client devices */
+	struct wm8350_codec codec;
+	struct wm8350_gpio gpio;
 	struct wm8350_pmic pmic;
+	struct wm8350_power power;
+	struct wm8350_rtc rtc;
+	struct wm8350_wdt wdt;
 };
 
 /**
include/linux/mfd/wm8350/gpio.h +6 -0
index c6cd2ca..ed91e8f 100644
@@ -13,6 +13,8 @@
 #ifndef __LINUX_MFD_WM8350_GPIO_H_
 #define __LINUX_MFD_WM8350_GPIO_H_
 
+#include <linux/platform_device.h>
+
 /*
  * GPIO Registers.
  */
@@ -328,6 +330,10 @@ struct wm8350;
 int wm8350_gpio_config(struct wm8350 *wm8350, int gpio, int dir, int func,
 		       int pol, int pull, int invert, int debounce);
 
+struct wm8350_gpio {
+	struct platform_device *pdev;
+};
+
 /*
  * GPIO Interrupts
  */
include/linux/mfd/wm8350/rtc.h +6 -0
index cb337ea..dfda69e 100644
@@ -12,6 +12,8 @@
 #ifndef __LINUX_MFD_WM8350_RTC_H
 #define __LINUX_MFD_WM8350_RTC_H
 
+#include <linux/platform_device.h>
+
 /*
  * Register values.
  */
@@ -257,4 +259,8 @@
 #define WM8350_IRQ_RTC_SEC			8
 #define WM8350_IRQ_RTC_ALM			9
 
+struct wm8350_rtc {
+	struct platform_device *pdev;
+};
+
 #endif
include/linux/mfd/wm8350/supply.h +6 -0
index f1d4317..1c8f3cd 100644
@@ -13,6 +13,8 @@
 #ifndef __LINUX_MFD_WM8350_SUPPLY_H_
 #define __LINUX_MFD_WM8350_SUPPLY_H_
 
+#include <linux/platform_device.h>
+
 /*
  * Charger registers
  */
@@ -102,4 +104,8 @@
 #define WM8350_IRQ_EXT_WALL_FB			37
 #define WM8350_IRQ_EXT_BAT_FB			38
 
+struct wm8350_power {
+	struct platform_device *pdev;
+};
+
 #endif
include/linux/mfd/wm8350/wdt.h +7 -1
index 72fc9f5..f6135b5 100644
@@ -1,7 +1,7 @@
 /*
  * wdt.h  --  Watchdog Driver for Wolfson WM8350 PMIC
  *
- * Copyright 2007 Wolfson Microelectronics PLC
+ * Copyright 2007, 2008 Wolfson Microelectronics PLC
  *
  *  This program is free software; you can redistribute  it and/or modify it
  *  under  the terms of  the GNU General  Public License as published by the
@@ -12,6 +12,8 @@
 #ifndef __LINUX_MFD_WM8350_WDT_H_
 #define __LINUX_MFD_WM8350_WDT_H_
 
+#include <linux/platform_device.h>
+
 #define WM8350_WDOG_HIB_MODE                    0x0080
 #define WM8350_WDOG_DEBUG                       0x0040
 #define WM8350_WDOG_MODE_MASK                   0x0030
@@ -19,4 +21,8 @@
 
 #define WM8350_IRQ_SYS_WDOG_TO			24
 
+struct wm8350_wdt {
+	struct platform_device *pdev;
+};
+
 #endif
Signature · 1 line
1.5.6.5
Signature · 2 lines
Intel Open Source Technology Centre
http://oss.intel.com/