public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: David Brownell <david-b@pacbell.net>
To: Felipe Balbi <felipe.balbi@nokia.com>
Cc: linux-omap@vger.kernel.org, Tony Lindgren <tony@atomide.com>
Subject: Re: [PATCH 0/9] twl4030 updates
Date: Fri, 26 Sep 2008 10:12:27 -0700	[thread overview]
Message-ID: <200809261012.28007.david-b@pacbell.net> (raw)
In-Reply-To: <1222427996-7018-1-git-send-email-felipe.balbi@nokia.com>

Let's apply the following patch 10/9 on top of this though.
And probably update the board files similarly (alpha order).

As an FYI, if you look at the "MFD core" you'll observe that
if some crap gets stripped away, the *useful* bit is a utility
making some of this create-a-child-node easier.  It's not worth
using now.  But a little bird told me that some of that crap
may be getting stripped away soon, so add_children() could
become simpler.  Wouldn't affect the function drivers (the
OTG transceiver, keypad, GPIO, RTC, etc) because we have, with
foresight, been using platform_device already.  ;)

- Dave

======= SNIP!
From: David Brownell <dbrownell@users.sourceforge.net>

Minor twl4030-core cleanups:  alphabetize the creation of the
new sub-function nodes; wrap an #if around the OMAP-only part
(to get more general build testing when this goes upstream);
remove reference to undocumented "twl3040" variant.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
---
 drivers/i2c/chips/twl4030-core.c |  115 ++++++++++++++++++-------------------
 1 file changed, 59 insertions(+), 56 deletions(-)

--- a/drivers/i2c/chips/twl4030-core.c
+++ b/drivers/i2c/chips/twl4030-core.c
@@ -45,24 +45,12 @@
 
 #define DRIVER_NAME			"twl4030"
 
-#if defined(CONFIG_RTC_DRV_TWL4030) || defined(CONFIG_RTC_DRV_TWL4030_MODULE)
-#define twl_has_rtc()	true
-#else
-#define twl_has_rtc()	false
-#endif
-
 #if defined(CONFIG_KEYBOARD_TWL4030) || defined(CONFIG_KEYBOARD_TWL4030_MODULE)
 #define twl_has_keypad()	true
 #else
 #define twl_has_keypad()	false
 #endif
 
-#if defined(CONFIG_TWL4030_USB) || defined(CONFIG_TWL4030_USB_MODULE)
-#define twl_has_usb()	true
-#else
-#define twl_has_usb()	false
-#endif
-
 #ifdef CONFIG_TWL4030_GPIO
 #define twl_has_gpio()	true
 #else
@@ -75,6 +63,18 @@
 #define twl_has_madc()	false
 #endif
 
+#if defined(CONFIG_RTC_DRV_TWL4030) || defined(CONFIG_RTC_DRV_TWL4030_MODULE)
+#define twl_has_rtc()	true
+#else
+#define twl_has_rtc()	false
+#endif
+
+#if defined(CONFIG_TWL4030_USB) || defined(CONFIG_TWL4030_USB_MODULE)
+#define twl_has_usb()	true
+#else
+#define twl_has_usb()	false
+#endif
+
 /* Primary Interrupt Handler on TWL4030 Registers */
 
 /* Register Definitions */
@@ -668,6 +668,27 @@ static int add_children(struct twl4030_p
 	struct twl4030_client	*twl = NULL;
 	int			status = 0;
 
+	if (twl_has_keypad() && pdata->keypad) {
+		pdev = platform_device_alloc("twl4030_keypad", -1);
+		if (pdev) {
+			twl = &twl4030_modules[TWL4030_SLAVENUM_NUM2];
+			pdev->dev.parent = &twl->client->dev;
+			device_init_wakeup(&pdev->dev, 1);
+			status = platform_device_add_data(pdev, pdata->keypad,
+					sizeof(*pdata->keypad));
+			if (status < 0) {
+				platform_device_put(pdev);
+				goto err;
+			}
+			status = platform_device_add(pdev);
+			if (status < 0)
+				platform_device_put(pdev);
+		} else {
+			status = -ENOMEM;
+			goto err;
+		}
+	}
+
 	if (twl_has_gpio() && pdata->gpio) {
 		twl = &twl4030_modules[TWL4030_SLAVENUM_NUM1];
 
@@ -706,6 +727,27 @@ static int add_children(struct twl4030_p
 		}
 	}
 
+	if (twl_has_madc() && pdata->madc) {
+		pdev = platform_device_alloc("twl4030_madc", -1);
+		if (pdev) {
+			twl = &twl4030_modules[TWL4030_SLAVENUM_NUM2];
+			pdev->dev.parent = &twl->client->dev;
+			device_init_wakeup(&pdev->dev, 1);
+			status = platform_device_add_data(pdev, pdata->madc,
+					sizeof(*pdata->madc));
+			if (status < 0) {
+				platform_device_put(pdev);
+				goto err;
+			}
+			status = platform_device_add(pdev);
+			if (status < 0)
+				platform_device_put(pdev);
+		} else {
+			status = -ENOMEM;
+			goto err;
+		}
+	}
+
 	if (twl_has_rtc()) {
 		pdev = platform_device_alloc("twl4030_rtc", -1);
 		if (pdev) {
@@ -736,27 +778,6 @@ static int add_children(struct twl4030_p
 		}
 	}
 
-	if (twl_has_keypad() && pdata->keypad) {
-		pdev = platform_device_alloc("twl4030_keypad", -1);
-		if (pdev) {
-			twl = &twl4030_modules[TWL4030_SLAVENUM_NUM2];
-			pdev->dev.parent = &twl->client->dev;
-			device_init_wakeup(&pdev->dev, 1);
-			status = platform_device_add_data(pdev, pdata->keypad,
-					sizeof(*pdata->keypad));
-			if (status < 0) {
-				platform_device_put(pdev);
-				goto err;
-			}
-			status = platform_device_add(pdev);
-			if (status < 0)
-				platform_device_put(pdev);
-		} else {
-			status = -ENOMEM;
-			goto err;
-		}
-	}
-
 	if (twl_has_usb() && pdata->usb) {
 		pdev = platform_device_alloc("twl4030_usb", -1);
 		if (pdev) {
@@ -778,27 +799,6 @@ static int add_children(struct twl4030_p
 		}
 	}
 
-	if (twl_has_madc() && pdata->madc) {
-		pdev = platform_device_alloc("twl4030_madc", -1);
-		if (pdev) {
-			twl = &twl4030_modules[TWL4030_SLAVENUM_NUM2];
-			pdev->dev.parent = &twl->client->dev;
-			device_init_wakeup(&pdev->dev, 1);
-			status = platform_device_add_data(pdev, pdata->madc,
-					sizeof(*pdata->madc));
-			if (status < 0) {
-				platform_device_put(pdev);
-				goto err;
-			}
-			status = platform_device_add(pdev);
-			if (status < 0)
-				platform_device_put(pdev);
-		} else {
-			status = -ENOMEM;
-			goto err;
-		}
-	}
-
 err:
 	pr_err("failed to add twl4030's children\n");
 	return status;
@@ -844,17 +844,19 @@ static int __init unprotect_pm_master(vo
 
 static int __init power_companion_init(void)
 {
+	int e = 0;
+
+#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
 	struct clk *osc;
 	u32 rate;
 	u8 ctrl = HFCLK_FREQ_26_MHZ;
-	int e = 0;
 
 	if (cpu_is_omap2430())
 		osc = clk_get(NULL, "osc_ck");
 	else
 		osc = clk_get(NULL, "osc_sys_ck");
 	if (IS_ERR(osc)) {
-		printk(KERN_WARNING "Skipping twl3040 internal clock init and "
+		printk(KERN_WARNING "Skipping twl4030 internal clock init and "
 				"using bootloader value (unknown osc rate)\n");
 		return 0;
 	}
@@ -879,6 +881,7 @@ static int __init power_companion_init(v
 	/* effect->MADC+USB ck en */
 	e |= twl4030_i2c_write_u8(TWL4030_MODULE_PM_MASTER, ctrl, R_CFG_BOOT);
 	e |= protect_pm_master();
+#endif	/* OMAP */
 
 	return e;
 }


  parent reply	other threads:[~2008-09-26 17:12 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-26 11:19 [PATCH 0/9] twl4030 updates Felipe Balbi
2008-09-26 11:19 ` [PATCH 1/9] twl4030: fix potential null pointer dereference Felipe Balbi
2008-09-26 11:19   ` [PATCH 2/9] twl4030-gpio: Remove default pullup enable/disable of GPIO Felipe Balbi
2008-09-26 11:19     ` [PATCH 3/9] i2c: clean add_children a bit Felipe Balbi
2008-09-26 11:19       ` [PATCH 4/9] i2c: move twl4030_keypad to new style registration Felipe Balbi
2008-09-26 11:19         ` [PATCH 5/9] i2c: move twl4030-usb to platform_device Felipe Balbi
2008-09-26 11:19           ` [PATCH 6/9] i2c: twl4030-usb: add 'vbus' sysfs file Felipe Balbi
2008-09-26 11:19             ` [PATCH 7/9] twl4030 gpio platform data Felipe Balbi
2008-09-26 11:19               ` [PATCH 8/9] twl4030 uses gpiolib Felipe Balbi
2008-09-26 11:19                 ` [PATCH 9/9] i2c: move twl4030-madc to new registration style Felipe Balbi
2008-09-26 17:09                   ` David Brownell
2008-09-26 17:46                     ` Felipe Balbi
2008-09-27  7:37                       ` Mikko Ylinen
2008-09-27 15:04                         ` David Brownell
2008-09-27 15:40                           ` Steve Sakoman
2008-09-27 17:17                             ` David Brownell
2008-10-01 14:20                           ` Mikko Ylinen
2008-10-01 16:13                             ` David Brownell
2008-09-26 19:50                   ` David Brownell
2008-09-26 20:01                     ` Steve Sakoman
2008-09-26 17:10                 ` [PATCH 8/9] twl4030 uses gpiolib David Brownell
2008-09-26 17:47                   ` Felipe Balbi
2008-09-26 18:57                     ` David Brownell
2008-09-28  1:01           ` [PATCH 5/9] i2c: move twl4030-usb to platform_device David Brownell
2008-09-28  3:03             ` Felipe Balbi
2008-09-26 17:12 ` David Brownell [this message]
2008-09-26 17:50   ` [PATCH 0/9] twl4030 updates Felipe Balbi
2008-09-26 18:55     ` David Brownell
2008-09-26 19:00   ` David Brownell
2008-09-26 19:10     ` Steve Sakoman
2008-09-26 19:23       ` Felipe Balbi
2008-09-26 19:45       ` David Brownell
2008-09-27 19:14 ` David Brownell
2008-09-27 21:17   ` Felipe Balbi
2008-09-27 21:45     ` David Brownell
2008-09-27 21:46       ` Felipe Balbi
2008-09-27 21:41 ` [PATCH 11/9] move twl4030-gpio to drivers/gpio David Brownell
2008-09-27 22:29   ` Felipe Balbi
2008-09-27 23:09     ` Felipe Balbi
2008-09-27 23:45       ` David Brownell
2008-09-28  3:14         ` Felipe Balbi
2008-09-28  5:16           ` David Brownell
2008-10-01 13:46             ` Felipe Contreras
2008-10-01 13:52               ` Felipe Balbi
2008-10-01 15:58               ` David Brownell
2008-10-01 16:05                 ` Jean Delvare
2008-10-01 16:32                   ` David Brownell
2008-09-27 23:29     ` David Brownell

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=200809261012.28007.david-b@pacbell.net \
    --to=david-b@pacbell.net \
    --cc=felipe.balbi@nokia.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=tony@atomide.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