Re: [PATCH 5/6] Generic twl4030 power script for 3430 based boards.

2008-10-31 Thread Grazvydas Ignotas
+struct twl4030_power_data generic3430_t2scripts_data __initdata = {
+   .scripts= twl4030_scripts,
+   .size   = ARRAY_SIZE(twl4030_scripts),
+};
+

This structure is declared with __initdata, but other structures referencing it
are not:

@@ -157,6 +156,7 @@ static struct twl4030_platform_data beagle_twldata = {
/* platform_data for children goes here */
.usb= &beagle_usb_data,
.gpio   = &beagle_gpio_data,
+   .power  = &generic3430_t2scripts_data,
 };
 
This causes warning while building the kernel:

WARNING: modpost: Found 1 section mismatch(es).
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/6] Generic twl4030 power script for 3430 based boards.

2008-10-20 Thread Peter 'p2' De Schrijver
This is a generic twl4030 power script for 3430 based boards. It handles
sleep and wakeup events. In case of a sleep event it will first put the
Reset and Control (RC) resources to sleep and then put the voltage regulators
to sleep. In case of a wakeup event, the system clock will be started first,
then the voltage regulators will be woken up and finally the RC resources will
be woken up.

Signed-off-by: Peter 'p2' De Schrijver <[EMAIL PROTECTED]>
---
 arch/arm/mach-omap2/twl4030-generic-scripts.c |   78 +
 arch/arm/mach-omap2/twl4030-generic-scripts.h |8 +++
 2 files changed, 86 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-omap2/twl4030-generic-scripts.c
 create mode 100644 arch/arm/mach-omap2/twl4030-generic-scripts.h

diff --git a/arch/arm/mach-omap2/twl4030-generic-scripts.c 
b/arch/arm/mach-omap2/twl4030-generic-scripts.c
new file mode 100644
index 000..f41c9ef
--- /dev/null
+++ b/arch/arm/mach-omap2/twl4030-generic-scripts.c
@@ -0,0 +1,78 @@
+/*
+ * arch/arm/mach-omap2/twl4030-generic-scripts.c
+ *
+ * Generic power control scripts for TWL4030
+ *
+ * Copyright (C) 2008 Nokia Corporation
+ * Copyright (C) 2006 Texas Instruments, Inc
+ *
+ * Written by  Kalle Jokiniemi
+ * Peter De Schrijver <[EMAIL PROTECTED]>
+ *
+ * This file is subject to the terms and conditions of the GNU General
+ * Public License. See the file "COPYING" in the main directory of this
+ * archive for more details.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+/*
+ * This script instructs twl4030 to first put the Reset and Control (RC)
+ * resources to sleep and then all the other resources.
+ */
+
+static struct twl4030_ins sleep_on_seq[] __initdata = {
+   {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_RC, RES_TYPE_ALL, RES_TYPE2_R0,
+   RES_STATE_SLEEP), 4},
+   {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, RES_TYPE_ALL, RES_TYPE2_R0,
+   RES_STATE_SLEEP), 4},
+};
+
+static struct twl4030_script sleep_on_script __initdata = {
+   .script = sleep_on_seq,
+   .size   = ARRAY_SIZE(sleep_on_seq),
+   .flags  = TRITON_SLEEP_SCRIPT,
+};
+
+/*
+ * This script instructs twl4030 to first enable CLKEN, then wakeup the
+ * regulators and then all other resources.
+ */
+
+static struct twl4030_ins wakeup_seq[] __initdata = {
+   {MSG_SINGULAR(DEV_GRP_NULL, 0x17, RES_STATE_ACTIVE), 0x30},
+   {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_PP_PR, RES_TYPE_ALL, RES_TYPE2_R0,
+   RES_STATE_ACTIVE), 0x37},
+   {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, RES_TYPE_ALL, RES_TYPE2_R0,
+   RES_STATE_ACTIVE), 0x2},
+};
+
+static struct twl4030_script wakeup_script __initdata = {
+   .script = wakeup_seq,
+   .size   = ARRAY_SIZE(wakeup_seq),
+   .flags  = TRITON_WAKEUP12_SCRIPT | TRITON_WAKEUP3_SCRIPT,
+};
+
+static struct twl4030_script *twl4030_scripts[] __initdata = {
+   &sleep_on_script,
+   &wakeup_script,
+};
+
+struct twl4030_power_data generic3430_t2scripts_data __initdata = {
+   .scripts= twl4030_scripts,
+   .size   = ARRAY_SIZE(twl4030_scripts),
+};
+
+
diff --git a/arch/arm/mach-omap2/twl4030-generic-scripts.h 
b/arch/arm/mach-omap2/twl4030-generic-scripts.h
new file mode 100644
index 000..64d8d3f
--- /dev/null
+++ b/arch/arm/mach-omap2/twl4030-generic-scripts.h
@@ -0,0 +1,8 @@
+#ifndef __TWL4030_GENERIC_SCRIPTS_H
+#define __TWL4030_GENERIC_SCRIPTS_H
+
+#include 
+
+extern struct twl4030_power_data generic3430_t2scripts_data;
+
+#endif
-- 
1.5.6.3

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 5/6] Generic twl4030 power script for 3430 based boards.

2008-10-17 Thread Peter 'p2' De Schrijver
On Thu, Oct 16, 2008 at 04:09:47PM -0700, ext David Brownell wrote:
> On Wednesday 15 October 2008, Peter 'p2' De Schrijver wrote:
> > --- /dev/null
> > +++ b/arch/arm/mach-omap2/twl4030-generic-scripts.h
> > @@ -0,0 +1,8 @@
> > +#ifndef __TWL4030_GENERIC_SCRIPTS_H
> > +#define __TWL4030_GENERIC_SCRIPTS_H
> > +
> > +#include 
> > +
> > +extern struct twl4030_power_data generic3430_t2scripts_data;
> > +
> > +#endif
> 
> I'd still put this decl into arch/arm/mach-omap2/pm.h, which
> is already a bit of a grab-bag of PM hooks.  As you noted,
> having a header for a single declaration isn't the Best Way.

In retrospect I don't think that's such a good idea either. pm.h
contains prototypes related to OMAP2/3 powermanagement. Even though
twl4030 plays some role in powermanagement, it's more at the system
level then at the OMAP chip level. Ie. from an OMAP point of view
nothing has to be switched off. But from a system point of view, it does
save some power to switch things off. So I don't feel it belongs there.

Cheers,

Peter.

-- 
goa is a state of mind
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 5/6] Generic twl4030 power script for 3430 based boards.

2008-10-16 Thread David Brownell
On Wednesday 15 October 2008, Peter 'p2' De Schrijver wrote:
> --- /dev/null
> +++ b/arch/arm/mach-omap2/twl4030-generic-scripts.h
> @@ -0,0 +1,8 @@
> +#ifndef __TWL4030_GENERIC_SCRIPTS_H
> +#define __TWL4030_GENERIC_SCRIPTS_H
> +
> +#include 
> +
> +extern struct twl4030_power_data generic3430_t2scripts_data;
> +
> +#endif

I'd still put this decl into arch/arm/mach-omap2/pm.h, which
is already a bit of a grab-bag of PM hooks.  As you noted,
having a header for a single declaration isn't the Best Way.

- Dave

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/6] Generic twl4030 power script for 3430 based boards.

2008-10-15 Thread Peter 'p2' De Schrijver
This is a generic twl4030 power script for 3430 based boards. It handles
sleep and wakeup events. In case of a sleep event it will first put the
Reset and Control (RC) resources to sleep and then put the voltage regulators
to sleep. In case of a wakeup event, the system clock will be started first,
then the voltage regulators will be woken up and finally the RC resources will
be woken up.

Signed-off-by: Peter 'p2' De Schrijver <[EMAIL PROTECTED]>
---
 arch/arm/mach-omap2/twl4030-generic-scripts.c |   78 +
 arch/arm/mach-omap2/twl4030-generic-scripts.h |8 +++
 2 files changed, 86 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-omap2/twl4030-generic-scripts.c
 create mode 100644 arch/arm/mach-omap2/twl4030-generic-scripts.h

diff --git a/arch/arm/mach-omap2/twl4030-generic-scripts.c 
b/arch/arm/mach-omap2/twl4030-generic-scripts.c
new file mode 100644
index 000..f41c9ef
--- /dev/null
+++ b/arch/arm/mach-omap2/twl4030-generic-scripts.c
@@ -0,0 +1,78 @@
+/*
+ * arch/arm/mach-omap2/twl4030-generic-scripts.c
+ *
+ * Generic power control scripts for TWL4030
+ *
+ * Copyright (C) 2008 Nokia Corporation
+ * Copyright (C) 2006 Texas Instruments, Inc
+ *
+ * Written by  Kalle Jokiniemi
+ * Peter De Schrijver <[EMAIL PROTECTED]>
+ *
+ * This file is subject to the terms and conditions of the GNU General
+ * Public License. See the file "COPYING" in the main directory of this
+ * archive for more details.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+/*
+ * This script instructs twl4030 to first put the Reset and Control (RC)
+ * resources to sleep and then all the other resources.
+ */
+
+static struct twl4030_ins sleep_on_seq[] __initdata = {
+   {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_RC, RES_TYPE_ALL, RES_TYPE2_R0,
+   RES_STATE_SLEEP), 4},
+   {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, RES_TYPE_ALL, RES_TYPE2_R0,
+   RES_STATE_SLEEP), 4},
+};
+
+static struct twl4030_script sleep_on_script __initdata = {
+   .script = sleep_on_seq,
+   .size   = ARRAY_SIZE(sleep_on_seq),
+   .flags  = TRITON_SLEEP_SCRIPT,
+};
+
+/*
+ * This script instructs twl4030 to first enable CLKEN, then wakeup the
+ * regulators and then all other resources.
+ */
+
+static struct twl4030_ins wakeup_seq[] __initdata = {
+   {MSG_SINGULAR(DEV_GRP_NULL, 0x17, RES_STATE_ACTIVE), 0x30},
+   {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_PP_PR, RES_TYPE_ALL, RES_TYPE2_R0,
+   RES_STATE_ACTIVE), 0x37},
+   {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, RES_TYPE_ALL, RES_TYPE2_R0,
+   RES_STATE_ACTIVE), 0x2},
+};
+
+static struct twl4030_script wakeup_script __initdata = {
+   .script = wakeup_seq,
+   .size   = ARRAY_SIZE(wakeup_seq),
+   .flags  = TRITON_WAKEUP12_SCRIPT | TRITON_WAKEUP3_SCRIPT,
+};
+
+static struct twl4030_script *twl4030_scripts[] __initdata = {
+   &sleep_on_script,
+   &wakeup_script,
+};
+
+struct twl4030_power_data generic3430_t2scripts_data __initdata = {
+   .scripts= twl4030_scripts,
+   .size   = ARRAY_SIZE(twl4030_scripts),
+};
+
+
diff --git a/arch/arm/mach-omap2/twl4030-generic-scripts.h 
b/arch/arm/mach-omap2/twl4030-generic-scripts.h
new file mode 100644
index 000..64d8d3f
--- /dev/null
+++ b/arch/arm/mach-omap2/twl4030-generic-scripts.h
@@ -0,0 +1,8 @@
+#ifndef __TWL4030_GENERIC_SCRIPTS_H
+#define __TWL4030_GENERIC_SCRIPTS_H
+
+#include 
+
+extern struct twl4030_power_data generic3430_t2scripts_data;
+
+#endif
-- 
1.5.6.3

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html