2009-10-19 12:10:17

by Amit Kucheria

[permalink] [raw]
Subject: [PATCH 0/5] mfd: twl4030: Various twl4030-power fixes

Add support of remapping of power states and supply optimised power scripts
for the rx51 board. There are also some cleanups to made the code easier to
read.

Boot-tested on rx51 using linux-omap + Kevin's PM branch. We continue to hit
OFF states.

The scripts can be used as a reference for other OMAP3-based boards, but I'm
not sending patches since I don't have any HW.

Regards,
Amit

Amit Kucheria (5):
mfd: twl4030-power: Rename DEVGROUP to DEV_GRP
mfd: twl4030-power: Add comments for the register and bit layout
mfd: twl4030-power: Move power-related data closer together in the
header file
mfd: twl4030-power: Add support for remapping power states
mfd: twl4030-power: Optimised power scripts for the rx51

arch/arm/mach-omap2/board-rx51-peripherals.c | 118 +++++++++++++------
drivers/mfd/twl4030-power.c | 64 +++++++++--
include/linux/i2c/twl4030.h | 157 +++++++++++++-------------
3 files changed, 217 insertions(+), 122 deletions(-)


2009-10-19 12:10:51

by Amit Kucheria

[permalink] [raw]
Subject: [PATCH 1/5] mfd: twl4030-power: Rename DEVGROUP to DEV_GRP

Stick to the names used in the reference manual

Signed-off-by: Amit Kucheria <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
drivers/mfd/twl4030-power.c | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/mfd/twl4030-power.c b/drivers/mfd/twl4030-power.c
index d423e0c..82e3bcb 100644
--- a/drivers/mfd/twl4030-power.c
+++ b/drivers/mfd/twl4030-power.c
@@ -69,12 +69,12 @@ static u8 twl4030_start_script_address = 0x2b;

/* resource configuration registers */

-#define DEVGROUP_OFFSET 0
+#define DEV_GRP_OFFSET 0
#define TYPE_OFFSET 1

-/* Bit positions */
-#define DEVGROUP_SHIFT 5
-#define DEVGROUP_MASK (7 << DEVGROUP_SHIFT)
+/* Bit positions in the registers */
+#define DEV_GRP_SHIFT 5
+#define DEV_GRP_MASK (7 << DEV_GRP_SHIFT)
#define TYPE_SHIFT 0
#define TYPE_MASK (7 << TYPE_SHIFT)
#define TYPE2_SHIFT 3
@@ -328,7 +328,7 @@ static int __init twl4030_configure_resource(struct twl4030_resconfig *rconfig)

/* Set resource group */
err = twl4030_i2c_read_u8(TWL4030_MODULE_PM_RECEIVER, &grp,
- rconfig_addr + DEVGROUP_OFFSET);
+ rconfig_addr + DEV_GRP_OFFSET);
if (err) {
pr_err("TWL4030 Resource %d group could not be read\n",
rconfig->resource);
@@ -336,10 +336,10 @@ static int __init twl4030_configure_resource(struct twl4030_resconfig *rconfig)
}

if (rconfig->devgroup >= 0) {
- grp &= ~DEVGROUP_MASK;
- grp |= rconfig->devgroup << DEVGROUP_SHIFT;
+ grp &= ~DEV_GRP_MASK;
+ grp |= rconfig->devgroup << DEV_GRP_SHIFT;
err = twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER,
- grp, rconfig_addr + DEVGROUP_OFFSET);
+ grp, rconfig_addr + DEV_GRP_OFFSET);
if (err < 0) {
pr_err("TWL4030 failed to program devgroup\n");
return err;
--
1.6.3.3

2009-10-19 12:10:52

by Amit Kucheria

[permalink] [raw]
Subject: [PATCH 2/5] mfd: twl4030-power: Add comments for the register and bit layout

Describe how the resource registers are laid out and the various bit-fields in
them.

Signed-off-by: Amit Kucheria <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
drivers/mfd/twl4030-power.c | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/mfd/twl4030-power.c b/drivers/mfd/twl4030-power.c
index 82e3bcb..2c38ac1 100644
--- a/drivers/mfd/twl4030-power.c
+++ b/drivers/mfd/twl4030-power.c
@@ -67,14 +67,22 @@ static u8 twl4030_start_script_address = 0x2b;
#define R_KEY_1 0xC0
#define R_KEY_2 0x0C

-/* resource configuration registers */
-
+/* resource configuration registers
+ <RESOURCE>_DEV_GRP at address 'n+0'
+ <RESOURCE>_TYPE at address 'n+1'
+ <RESOURCE>_REMAP at address 'n+2'
+ <RESOURCE>_DEDICATED at address 'n+3'
+*/
#define DEV_GRP_OFFSET 0
#define TYPE_OFFSET 1

/* Bit positions in the registers */
+
+/* <RESOURCE>_DEV_GRP */
#define DEV_GRP_SHIFT 5
#define DEV_GRP_MASK (7 << DEV_GRP_SHIFT)
+
+/* <RESOURCE>_TYPE */
#define TYPE_SHIFT 0
#define TYPE_MASK (7 << TYPE_SHIFT)
#define TYPE2_SHIFT 3
--
1.6.3.3

2009-10-19 12:11:23

by Amit Kucheria

[permalink] [raw]
Subject: [PATCH 3/5] mfd: twl4030-power: Move power-related data closer together in the header file

Bring together all the TWL power-related data in the header file

Signed-off-by: Amit Kucheria <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
include/linux/i2c/twl4030.h | 154 ++++++++++++++++++++++---------------------
1 files changed, 78 insertions(+), 76 deletions(-)

diff --git a/include/linux/i2c/twl4030.h b/include/linux/i2c/twl4030.h
index 508824e..4bc2836 100644
--- a/include/linux/i2c/twl4030.h
+++ b/include/linux/i2c/twl4030.h
@@ -221,13 +221,89 @@ int twl4030_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes);

/*----------------------------------------------------------------------*/

+struct twl4030_bci_platform_data {
+ int *battery_tmp_tbl;
+ unsigned int tblsize;
+};
+
+/* TWL4030_GPIO_MAX (18) GPIOs, with interrupts */
+struct twl4030_gpio_platform_data {
+ int gpio_base;
+ unsigned irq_base, irq_end;
+
+ /* package the two LED signals as output-only GPIOs? */
+ bool use_leds;
+
+ /* gpio-n should control VMMC(n+1) if BIT(n) in mmc_cd is set */
+ u8 mmc_cd;
+
+ /* if BIT(N) is set, or VMMC(n+1) is linked, debounce GPIO-N */
+ u32 debounce;
+
+ /* For gpio-N, bit (1 << N) in "pullups" is set if that pullup
+ * should be enabled. Else, if that bit is set in "pulldowns",
+ * that pulldown is enabled. Don't waste power by letting any
+ * digital inputs float...
+ */
+ u32 pullups;
+ u32 pulldowns;
+
+ int (*setup)(struct device *dev,
+ unsigned gpio, unsigned ngpio);
+ int (*teardown)(struct device *dev,
+ unsigned gpio, unsigned ngpio);
+};
+
+struct twl4030_madc_platform_data {
+ int irq_line;
+};
+
+/* Boards have uniqe mappings of {row, col} --> keycode.
+ * Column and row are 8 bits each, but range only from 0..7.
+ * a PERSISTENT_KEY is "always on" and never reported.
+ */
+#define PERSISTENT_KEY(r, c) KEY((r), (c), KEY_RESERVED)
+
+struct twl4030_keypad_data {
+ const struct matrix_keymap_data *keymap_data;
+ unsigned rows;
+ unsigned cols;
+ bool rep;
+};
+
+enum twl4030_usb_mode {
+ T2_USB_MODE_ULPI = 1,
+ T2_USB_MODE_CEA2011_3PIN = 2,
+};
+
+struct twl4030_usb_data {
+ enum twl4030_usb_mode usb_mode;
+};
+
+struct twl4030_ins {
+ u16 pmb_message;
+ u8 delay;
+};
+
+struct twl4030_script {
+ struct twl4030_ins *script;
+ unsigned size;
+ u8 flags;
+#define TWL4030_WRST_SCRIPT (1<<0)
+#define TWL4030_WAKEUP12_SCRIPT (1<<1)
+#define TWL4030_WAKEUP3_SCRIPT (1<<2)
+#define TWL4030_SLEEP_SCRIPT (1<<3)
+};
+
+/*----------------------------------------------------------------------*/
+
/* Power bus message definitions */

/* The TWL4030/5030 splits its power-management resources (the various
* regulators, clock and reset lines) into 3 processor groups - P1, P2 and
* P3. These groups can then be configured to transition between sleep, wait-on
- * and active states by sending messages to the power bus. See Section 5.4.2
- * Power Resources of TWL4030 TRM
+ * (OFF) and active states by sending messages to the power bus. See Section
+ * 5.4.2 Power Resources of TWL4030 TRM
*/

/* Processor groups */
@@ -312,80 +388,6 @@ int twl4030_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes);

/*----------------------------------------------------------------------*/

-struct twl4030_bci_platform_data {
- int *battery_tmp_tbl;
- unsigned int tblsize;
-};
-
-/* TWL4030_GPIO_MAX (18) GPIOs, with interrupts */
-struct twl4030_gpio_platform_data {
- int gpio_base;
- unsigned irq_base, irq_end;
-
- /* package the two LED signals as output-only GPIOs? */
- bool use_leds;
-
- /* gpio-n should control VMMC(n+1) if BIT(n) in mmc_cd is set */
- u8 mmc_cd;
-
- /* if BIT(N) is set, or VMMC(n+1) is linked, debounce GPIO-N */
- u32 debounce;
-
- /* For gpio-N, bit (1 << N) in "pullups" is set if that pullup
- * should be enabled. Else, if that bit is set in "pulldowns",
- * that pulldown is enabled. Don't waste power by letting any
- * digital inputs float...
- */
- u32 pullups;
- u32 pulldowns;
-
- int (*setup)(struct device *dev,
- unsigned gpio, unsigned ngpio);
- int (*teardown)(struct device *dev,
- unsigned gpio, unsigned ngpio);
-};
-
-struct twl4030_madc_platform_data {
- int irq_line;
-};
-
-/* Boards have uniqe mappings of {row, col} --> keycode.
- * Column and row are 8 bits each, but range only from 0..7.
- * a PERSISTENT_KEY is "always on" and never reported.
- */
-#define PERSISTENT_KEY(r, c) KEY((r), (c), KEY_RESERVED)
-
-struct twl4030_keypad_data {
- const struct matrix_keymap_data *keymap_data;
- unsigned rows;
- unsigned cols;
- bool rep;
-};
-
-enum twl4030_usb_mode {
- T2_USB_MODE_ULPI = 1,
- T2_USB_MODE_CEA2011_3PIN = 2,
-};
-
-struct twl4030_usb_data {
- enum twl4030_usb_mode usb_mode;
-};
-
-struct twl4030_ins {
- u16 pmb_message;
- u8 delay;
-};
-
-struct twl4030_script {
- struct twl4030_ins *script;
- unsigned size;
- u8 flags;
-#define TWL4030_WRST_SCRIPT (1<<0)
-#define TWL4030_WAKEUP12_SCRIPT (1<<1)
-#define TWL4030_WAKEUP3_SCRIPT (1<<2)
-#define TWL4030_SLEEP_SCRIPT (1<<3)
-};
-
struct twl4030_resconfig {
u8 resource;
u8 devgroup; /* Processor group that Power resource belongs to */
--
1.6.3.3

2009-10-19 12:11:07

by Amit Kucheria

[permalink] [raw]
Subject: [PATCH 4/5] mfd: twl4030-power: Add support for remapping power states

The <RESOURCE>_REMAP register allows configuration of the <RESOURCE> in case
of a sleep or off transition.

Allow this property of resources to be configured (through twl4030_resconfig)
and add code to parse these values to program the registers accordingly.

Signed-off-by: Amit Kucheria <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
drivers/mfd/twl4030-power.c | 36 ++++++++++++++++++++++++++++++++++++
include/linux/i2c/twl4030.h | 3 +++
2 files changed, 39 insertions(+), 0 deletions(-)

diff --git a/drivers/mfd/twl4030-power.c b/drivers/mfd/twl4030-power.c
index 2c38ac1..3e41e0c 100644
--- a/drivers/mfd/twl4030-power.c
+++ b/drivers/mfd/twl4030-power.c
@@ -75,6 +75,8 @@ static u8 twl4030_start_script_address = 0x2b;
*/
#define DEV_GRP_OFFSET 0
#define TYPE_OFFSET 1
+#define REMAP_OFFSET 2
+#define DEDICATED_OFFSET 3

/* Bit positions in the registers */

@@ -88,6 +90,12 @@ static u8 twl4030_start_script_address = 0x2b;
#define TYPE2_SHIFT 3
#define TYPE2_MASK (3 << TYPE2_SHIFT)

+/* <RESOURCE>_REMAP */
+#define SLEEP_STATE_SHIFT 0
+#define SLEEP_STATE_MASK (0xf << SLEEP_STATE_SHIFT)
+#define OFF_STATE_SHIFT 4
+#define OFF_STATE_MASK (0xf << OFF_STATE_SHIFT)
+
static u8 res_config_addrs[] = {
[RES_VAUX1] = 0x17,
[RES_VAUX2] = 0x1b,
@@ -325,6 +333,7 @@ static int __init twl4030_configure_resource(struct twl4030_resconfig *rconfig)
int err;
u8 type;
u8 grp;
+ u8 remap;

if (rconfig->resource > TOTAL_RESOURCES) {
pr_err("TWL4030 Resource %d does not exist\n",
@@ -380,6 +389,33 @@ static int __init twl4030_configure_resource(struct twl4030_resconfig *rconfig)
return err;
}

+ /* Set remap states */
+ err = twl4030_i2c_read_u8(TWL4030_MODULE_PM_RECEIVER, &remap,
+ rconfig_addr + REMAP_OFFSET);
+ if (err < 0) {
+ pr_err("TWL4030 Resource %d remap could not be read\n",
+ rconfig->resource);
+ return err;
+ }
+
+ if (rconfig->remap_off >= 0) {
+ remap &= ~OFF_STATE_MASK;
+ remap |= rconfig->remap_off << OFF_STATE_SHIFT;
+ }
+
+ if (rconfig->remap_sleep >= 0) {
+ remap &= ~SLEEP_STATE_MASK;
+ remap |= rconfig->remap_off << SLEEP_STATE_SHIFT;
+ }
+
+ err = twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER,
+ remap,
+ rconfig_addr + REMAP_OFFSET);
+ if (err < 0) {
+ pr_err("TWL4030 failed to program remap\n");
+ return err;
+ }
+
return 0;
}

diff --git a/include/linux/i2c/twl4030.h b/include/linux/i2c/twl4030.h
index 4bc2836..ef21575 100644
--- a/include/linux/i2c/twl4030.h
+++ b/include/linux/i2c/twl4030.h
@@ -326,6 +326,7 @@ struct twl4030_script {

#define RES_TYPE_ALL 0x7

+/* Resource states */
#define RES_STATE_WRST 0xF
#define RES_STATE_ACTIVE 0xE
#define RES_STATE_SLEEP 0x8
@@ -393,6 +394,8 @@ struct twl4030_resconfig {
u8 devgroup; /* Processor group that Power resource belongs to */
u8 type; /* Power resource addressed, 6 / broadcast message */
u8 type2; /* Power resource addressed, 3 / broadcast message */
+ u8 remap_off; /* off state remapping */
+ u8 remap_sleep; /* sleep state remapping */
};

struct twl4030_power_data {
--
1.6.3.3

2009-10-19 12:11:54

by Amit Kucheria

[permalink] [raw]
Subject: [PATCH 5/5] mfd: twl4030-power: Optimised power scripts for the rx51

The power scripts optimisation was mainly done by:
Tero Kristo <[email protected]> and
Arnaud Mandy <[email protected]>

I'm only refactoring and testing it against the mainline kernel.

Signed-off-by: Amit Kucheria <[email protected]>
Cc: Samuel Ortiz <[email protected]>
Cc: Tero Kristo <[email protected]>
Cc: [email protected]
---
arch/arm/mach-omap2/board-rx51-peripherals.c | 118 ++++++++++++++++++--------
1 files changed, 82 insertions(+), 36 deletions(-)

diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c
index c1af532..d933050 100644
--- a/arch/arm/mach-omap2/board-rx51-peripherals.c
+++ b/arch/arm/mach-omap2/board-rx51-peripherals.c
@@ -292,15 +292,9 @@ static struct twl4030_usb_data rx51_usb_data = {

static struct twl4030_ins sleep_on_seq[] __initdata = {
/*
- * Turn off VDD1 and VDD2.
+ * Turn off everything
*/
- {MSG_SINGULAR(DEV_GRP_P1, 0xf, RES_STATE_OFF), 4},
- {MSG_SINGULAR(DEV_GRP_P1, 0x10, RES_STATE_OFF), 2},
-/*
- * And also turn off the OMAP3 PLLs and the sysclk output.
- */
- {MSG_SINGULAR(DEV_GRP_P1, 0x7, RES_STATE_OFF), 3},
- {MSG_SINGULAR(DEV_GRP_P1, 0x17, RES_STATE_OFF), 3},
+ {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, 1, 0, RES_STATE_SLEEP), 2},
};

static struct twl4030_script sleep_on_script __initdata = {
@@ -311,14 +305,9 @@ static struct twl4030_script sleep_on_script __initdata = {

static struct twl4030_ins wakeup_seq[] __initdata = {
/*
- * Reenable the OMAP3 PLLs.
- * Wakeup VDD1 and VDD2.
- * Reenable sysclk output.
+ * Reenable everything
*/
- {MSG_SINGULAR(DEV_GRP_P1, 0x7, RES_STATE_ACTIVE), 0x30},
- {MSG_SINGULAR(DEV_GRP_P1, 0xf, RES_STATE_ACTIVE), 0x30},
- {MSG_SINGULAR(DEV_GRP_P1, 0x10, RES_STATE_ACTIVE), 0x37},
- {MSG_SINGULAR(DEV_GRP_P1, 0x19, RES_STATE_ACTIVE), 3},
+ {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, 1, 0, RES_STATE_ACTIVE), 2},
};

static struct twl4030_script wakeup_script __initdata = {
@@ -329,10 +318,9 @@ static struct twl4030_script wakeup_script __initdata = {

static struct twl4030_ins wakeup_p3_seq[] __initdata = {
/*
- * Wakeup VDD1 (dummy to be able to insert a delay)
- * Enable CLKEN
+ * Reenable everything
*/
- {MSG_SINGULAR(DEV_GRP_P1, 0x17, RES_STATE_ACTIVE), 3},
+ {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, 1, 0, RES_STATE_ACTIVE), 2},
};

static struct twl4030_script wakeup_p3_script __initdata = {
@@ -353,12 +341,11 @@ static struct twl4030_ins wrst_seq[] __initdata = {
{MSG_SINGULAR(DEV_GRP_NULL, RES_RESET, RES_STATE_OFF), 2},
{MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, 0, 1, RES_STATE_ACTIVE),
0x13},
- {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_PP, 0, 2, RES_STATE_WRST), 0x13},
{MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_PP, 0, 3, RES_STATE_OFF), 0x13},
{MSG_SINGULAR(DEV_GRP_NULL, RES_VDD1, RES_STATE_WRST), 0x13},
{MSG_SINGULAR(DEV_GRP_NULL, RES_VDD2, RES_STATE_WRST), 0x13},
{MSG_SINGULAR(DEV_GRP_NULL, RES_VPLL1, RES_STATE_WRST), 0x35},
- {MSG_SINGULAR(DEV_GRP_P1, RES_HFCLKOUT, RES_STATE_ACTIVE), 2},
+ {MSG_SINGULAR(DEV_GRP_P3, RES_HFCLKOUT, RES_STATE_ACTIVE), 2},
{MSG_SINGULAR(DEV_GRP_NULL, RES_RESET, RES_STATE_ACTIVE), 2},
};

@@ -380,22 +367,81 @@ static struct twl4030_script *twl4030_scripts[] __initdata = {
};

static struct twl4030_resconfig twl4030_rconfig[] __initdata = {
- { .resource = RES_VINTANA1, .devgroup = -1, .type = -1, .type2 = 1 },
- { .resource = RES_VINTANA2, .devgroup = -1, .type = -1, .type2 = 1 },
- { .resource = RES_VINTDIG, .devgroup = -1, .type = -1, .type2 = 1 },
- { .resource = RES_VMMC1, .devgroup = -1, .type = -1, .type2 = 3},
- { .resource = RES_VMMC2, .devgroup = DEV_GRP_NULL, .type = -1,
- .type2 = 3},
- { .resource = RES_VAUX1, .devgroup = -1, .type = -1, .type2 = 3},
- { .resource = RES_VAUX2, .devgroup = -1, .type = -1, .type2 = 3},
- { .resource = RES_VAUX3, .devgroup = -1, .type = -1, .type2 = 3},
- { .resource = RES_VAUX4, .devgroup = -1, .type = -1, .type2 = 3},
- { .resource = RES_VPLL2, .devgroup = -1, .type = -1, .type2 = 3},
- { .resource = RES_VDAC, .devgroup = -1, .type = -1, .type2 = 3},
- { .resource = RES_VSIM, .devgroup = DEV_GRP_NULL, .type = -1,
- .type2 = 3},
- { .resource = RES_CLKEN, .devgroup = DEV_GRP_P3, .type = -1,
- .type2 = 1 },
+ { .resource = RES_VDD1, .devgroup = -1,
+ .type = 1, .type2 = -1, .remap_off = RES_STATE_OFF,
+ .remap_sleep = RES_STATE_OFF
+ },
+ { .resource = RES_VDD2, .devgroup = -1,
+ .type = 1, .type2 = -1, .remap_off = RES_STATE_OFF,
+ .remap_sleep = RES_STATE_OFF
+ },
+ { .resource = RES_VPLL1, .devgroup = -1,
+ .type = 1, .type2 = -1, .remap_off = RES_STATE_OFF,
+ .remap_sleep = RES_STATE_OFF
+ },
+ { .resource = RES_VPLL2, .devgroup = -1,
+ .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
+ },
+ { .resource = RES_VAUX1, .devgroup = -1,
+ .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
+ },
+ { .resource = RES_VAUX2, .devgroup = -1,
+ .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
+ },
+ { .resource = RES_VAUX3, .devgroup = -1,
+ .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
+ },
+ { .resource = RES_VAUX4, .devgroup = -1,
+ .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
+ },
+ { .resource = RES_VMMC1, .devgroup = -1,
+ .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
+ },
+ { .resource = RES_VMMC2, .devgroup = -1,
+ .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
+ },
+ { .resource = RES_VDAC, .devgroup = -1,
+ .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
+ },
+ { .resource = RES_VSIM, .devgroup = -1,
+ .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
+ },
+ { .resource = RES_VINTANA1, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
+ .type = -1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
+ },
+ { .resource = RES_VINTANA2, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
+ .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
+ },
+ { .resource = RES_VINTDIG, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
+ .type = -1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
+ },
+ { .resource = RES_VIO, .devgroup = DEV_GRP_P3,
+ .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
+ },
+ { .resource = RES_CLKEN, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
+ .type = 1, .type2 = -1 , .remap_off = -1, .remap_sleep = -1
+ },
+ { .resource = RES_REGEN, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
+ .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
+ },
+ { .resource = RES_NRES_PWRON, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
+ .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
+ },
+ { .resource = RES_SYSEN, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
+ .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
+ },
+ { .resource = RES_HFCLKOUT, .devgroup = DEV_GRP_P3,
+ .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
+ },
+ { .resource = RES_32KCLKOUT, .devgroup = -1,
+ .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
+ },
+ { .resource = RES_RESET, .devgroup = -1,
+ .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
+ },
+ { .resource = RES_Main_Ref, .devgroup = -1,
+ .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
+ },
{ 0, 0},
};

--
1.6.3.3

2009-10-19 19:11:26

by Samuel Ortiz

[permalink] [raw]
Subject: Re: [PATCH 3/5] mfd: twl4030-power: Move power-related data closer together in the header file

Hi Amit,

On Mon, Oct 19, 2009 at 03:10:52PM +0300, Amit Kucheria wrote:
> Bring together all the TWL power-related data in the header file
I dont really see the point of doing this, as you're not really gathering
scattered structures but rather moving a group of definitions up in the header
file.
If you dont mind I'll drop this one, unless Jean wants to take it.

Cheers,
Samuel.

> Signed-off-by: Amit Kucheria <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> ---
> include/linux/i2c/twl4030.h | 154 ++++++++++++++++++++++---------------------
> 1 files changed, 78 insertions(+), 76 deletions(-)
>
> diff --git a/include/linux/i2c/twl4030.h b/include/linux/i2c/twl4030.h
> index 508824e..4bc2836 100644
> --- a/include/linux/i2c/twl4030.h
> +++ b/include/linux/i2c/twl4030.h
> @@ -221,13 +221,89 @@ int twl4030_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes);
>
> /*----------------------------------------------------------------------*/
>
> +struct twl4030_bci_platform_data {
> + int *battery_tmp_tbl;
> + unsigned int tblsize;
> +};
> +
> +/* TWL4030_GPIO_MAX (18) GPIOs, with interrupts */
> +struct twl4030_gpio_platform_data {
> + int gpio_base;
> + unsigned irq_base, irq_end;
> +
> + /* package the two LED signals as output-only GPIOs? */
> + bool use_leds;
> +
> + /* gpio-n should control VMMC(n+1) if BIT(n) in mmc_cd is set */
> + u8 mmc_cd;
> +
> + /* if BIT(N) is set, or VMMC(n+1) is linked, debounce GPIO-N */
> + u32 debounce;
> +
> + /* For gpio-N, bit (1 << N) in "pullups" is set if that pullup
> + * should be enabled. Else, if that bit is set in "pulldowns",
> + * that pulldown is enabled. Don't waste power by letting any
> + * digital inputs float...
> + */
> + u32 pullups;
> + u32 pulldowns;
> +
> + int (*setup)(struct device *dev,
> + unsigned gpio, unsigned ngpio);
> + int (*teardown)(struct device *dev,
> + unsigned gpio, unsigned ngpio);
> +};
> +
> +struct twl4030_madc_platform_data {
> + int irq_line;
> +};
> +
> +/* Boards have uniqe mappings of {row, col} --> keycode.
> + * Column and row are 8 bits each, but range only from 0..7.
> + * a PERSISTENT_KEY is "always on" and never reported.
> + */
> +#define PERSISTENT_KEY(r, c) KEY((r), (c), KEY_RESERVED)
> +
> +struct twl4030_keypad_data {
> + const struct matrix_keymap_data *keymap_data;
> + unsigned rows;
> + unsigned cols;
> + bool rep;
> +};
> +
> +enum twl4030_usb_mode {
> + T2_USB_MODE_ULPI = 1,
> + T2_USB_MODE_CEA2011_3PIN = 2,
> +};
> +
> +struct twl4030_usb_data {
> + enum twl4030_usb_mode usb_mode;
> +};
> +
> +struct twl4030_ins {
> + u16 pmb_message;
> + u8 delay;
> +};
> +
> +struct twl4030_script {
> + struct twl4030_ins *script;
> + unsigned size;
> + u8 flags;
> +#define TWL4030_WRST_SCRIPT (1<<0)
> +#define TWL4030_WAKEUP12_SCRIPT (1<<1)
> +#define TWL4030_WAKEUP3_SCRIPT (1<<2)
> +#define TWL4030_SLEEP_SCRIPT (1<<3)
> +};
> +
> +/*----------------------------------------------------------------------*/
> +
> /* Power bus message definitions */
>
> /* The TWL4030/5030 splits its power-management resources (the various
> * regulators, clock and reset lines) into 3 processor groups - P1, P2 and
> * P3. These groups can then be configured to transition between sleep, wait-on
> - * and active states by sending messages to the power bus. See Section 5.4.2
> - * Power Resources of TWL4030 TRM
> + * (OFF) and active states by sending messages to the power bus. See Section
> + * 5.4.2 Power Resources of TWL4030 TRM
> */
>
> /* Processor groups */
> @@ -312,80 +388,6 @@ int twl4030_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes);
>
> /*----------------------------------------------------------------------*/
>
> -struct twl4030_bci_platform_data {
> - int *battery_tmp_tbl;
> - unsigned int tblsize;
> -};
> -
> -/* TWL4030_GPIO_MAX (18) GPIOs, with interrupts */
> -struct twl4030_gpio_platform_data {
> - int gpio_base;
> - unsigned irq_base, irq_end;
> -
> - /* package the two LED signals as output-only GPIOs? */
> - bool use_leds;
> -
> - /* gpio-n should control VMMC(n+1) if BIT(n) in mmc_cd is set */
> - u8 mmc_cd;
> -
> - /* if BIT(N) is set, or VMMC(n+1) is linked, debounce GPIO-N */
> - u32 debounce;
> -
> - /* For gpio-N, bit (1 << N) in "pullups" is set if that pullup
> - * should be enabled. Else, if that bit is set in "pulldowns",
> - * that pulldown is enabled. Don't waste power by letting any
> - * digital inputs float...
> - */
> - u32 pullups;
> - u32 pulldowns;
> -
> - int (*setup)(struct device *dev,
> - unsigned gpio, unsigned ngpio);
> - int (*teardown)(struct device *dev,
> - unsigned gpio, unsigned ngpio);
> -};
> -
> -struct twl4030_madc_platform_data {
> - int irq_line;
> -};
> -
> -/* Boards have uniqe mappings of {row, col} --> keycode.
> - * Column and row are 8 bits each, but range only from 0..7.
> - * a PERSISTENT_KEY is "always on" and never reported.
> - */
> -#define PERSISTENT_KEY(r, c) KEY((r), (c), KEY_RESERVED)
> -
> -struct twl4030_keypad_data {
> - const struct matrix_keymap_data *keymap_data;
> - unsigned rows;
> - unsigned cols;
> - bool rep;
> -};
> -
> -enum twl4030_usb_mode {
> - T2_USB_MODE_ULPI = 1,
> - T2_USB_MODE_CEA2011_3PIN = 2,
> -};
> -
> -struct twl4030_usb_data {
> - enum twl4030_usb_mode usb_mode;
> -};
> -
> -struct twl4030_ins {
> - u16 pmb_message;
> - u8 delay;
> -};
> -
> -struct twl4030_script {
> - struct twl4030_ins *script;
> - unsigned size;
> - u8 flags;
> -#define TWL4030_WRST_SCRIPT (1<<0)
> -#define TWL4030_WAKEUP12_SCRIPT (1<<1)
> -#define TWL4030_WAKEUP3_SCRIPT (1<<2)
> -#define TWL4030_SLEEP_SCRIPT (1<<3)
> -};
> -
> struct twl4030_resconfig {
> u8 resource;
> u8 devgroup; /* Processor group that Power resource belongs to */
> --
> 1.6.3.3
>

--
Intel Open Source Technology Centre
http://oss.intel.com/

2009-10-19 19:14:46

by Samuel Ortiz

[permalink] [raw]
Subject: Re: [PATCH 5/5] mfd: twl4030-power: Optimised power scripts for the rx51

Hi Amit,

On Mon, Oct 19, 2009 at 03:11:08PM +0300, Amit Kucheria wrote:
> The power scripts optimisation was mainly done by:
> Tero Kristo <[email protected]> and
> Arnaud Mandy <[email protected]>
>
> I'm only refactoring and testing it against the mainline kernel.
Fine with me but if you want me to carry this patch, I'd like to get an ACK
from Tony or one of the 2 above mentioned Nokia developers.

Cheers,
Samuel.


> Signed-off-by: Amit Kucheria <[email protected]>
> Cc: Samuel Ortiz <[email protected]>
> Cc: Tero Kristo <[email protected]>
> Cc: [email protected]
> ---
> arch/arm/mach-omap2/board-rx51-peripherals.c | 118 ++++++++++++++++++--------
> 1 files changed, 82 insertions(+), 36 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c
> index c1af532..d933050 100644
> --- a/arch/arm/mach-omap2/board-rx51-peripherals.c
> +++ b/arch/arm/mach-omap2/board-rx51-peripherals.c
> @@ -292,15 +292,9 @@ static struct twl4030_usb_data rx51_usb_data = {
>
> static struct twl4030_ins sleep_on_seq[] __initdata = {
> /*
> - * Turn off VDD1 and VDD2.
> + * Turn off everything
> */
> - {MSG_SINGULAR(DEV_GRP_P1, 0xf, RES_STATE_OFF), 4},
> - {MSG_SINGULAR(DEV_GRP_P1, 0x10, RES_STATE_OFF), 2},
> -/*
> - * And also turn off the OMAP3 PLLs and the sysclk output.
> - */
> - {MSG_SINGULAR(DEV_GRP_P1, 0x7, RES_STATE_OFF), 3},
> - {MSG_SINGULAR(DEV_GRP_P1, 0x17, RES_STATE_OFF), 3},
> + {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, 1, 0, RES_STATE_SLEEP), 2},
> };
>
> static struct twl4030_script sleep_on_script __initdata = {
> @@ -311,14 +305,9 @@ static struct twl4030_script sleep_on_script __initdata = {
>
> static struct twl4030_ins wakeup_seq[] __initdata = {
> /*
> - * Reenable the OMAP3 PLLs.
> - * Wakeup VDD1 and VDD2.
> - * Reenable sysclk output.
> + * Reenable everything
> */
> - {MSG_SINGULAR(DEV_GRP_P1, 0x7, RES_STATE_ACTIVE), 0x30},
> - {MSG_SINGULAR(DEV_GRP_P1, 0xf, RES_STATE_ACTIVE), 0x30},
> - {MSG_SINGULAR(DEV_GRP_P1, 0x10, RES_STATE_ACTIVE), 0x37},
> - {MSG_SINGULAR(DEV_GRP_P1, 0x19, RES_STATE_ACTIVE), 3},
> + {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, 1, 0, RES_STATE_ACTIVE), 2},
> };
>
> static struct twl4030_script wakeup_script __initdata = {
> @@ -329,10 +318,9 @@ static struct twl4030_script wakeup_script __initdata = {
>
> static struct twl4030_ins wakeup_p3_seq[] __initdata = {
> /*
> - * Wakeup VDD1 (dummy to be able to insert a delay)
> - * Enable CLKEN
> + * Reenable everything
> */
> - {MSG_SINGULAR(DEV_GRP_P1, 0x17, RES_STATE_ACTIVE), 3},
> + {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, 1, 0, RES_STATE_ACTIVE), 2},
> };
>
> static struct twl4030_script wakeup_p3_script __initdata = {
> @@ -353,12 +341,11 @@ static struct twl4030_ins wrst_seq[] __initdata = {
> {MSG_SINGULAR(DEV_GRP_NULL, RES_RESET, RES_STATE_OFF), 2},
> {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, 0, 1, RES_STATE_ACTIVE),
> 0x13},
> - {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_PP, 0, 2, RES_STATE_WRST), 0x13},
> {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_PP, 0, 3, RES_STATE_OFF), 0x13},
> {MSG_SINGULAR(DEV_GRP_NULL, RES_VDD1, RES_STATE_WRST), 0x13},
> {MSG_SINGULAR(DEV_GRP_NULL, RES_VDD2, RES_STATE_WRST), 0x13},
> {MSG_SINGULAR(DEV_GRP_NULL, RES_VPLL1, RES_STATE_WRST), 0x35},
> - {MSG_SINGULAR(DEV_GRP_P1, RES_HFCLKOUT, RES_STATE_ACTIVE), 2},
> + {MSG_SINGULAR(DEV_GRP_P3, RES_HFCLKOUT, RES_STATE_ACTIVE), 2},
> {MSG_SINGULAR(DEV_GRP_NULL, RES_RESET, RES_STATE_ACTIVE), 2},
> };
>
> @@ -380,22 +367,81 @@ static struct twl4030_script *twl4030_scripts[] __initdata = {
> };
>
> static struct twl4030_resconfig twl4030_rconfig[] __initdata = {
> - { .resource = RES_VINTANA1, .devgroup = -1, .type = -1, .type2 = 1 },
> - { .resource = RES_VINTANA2, .devgroup = -1, .type = -1, .type2 = 1 },
> - { .resource = RES_VINTDIG, .devgroup = -1, .type = -1, .type2 = 1 },
> - { .resource = RES_VMMC1, .devgroup = -1, .type = -1, .type2 = 3},
> - { .resource = RES_VMMC2, .devgroup = DEV_GRP_NULL, .type = -1,
> - .type2 = 3},
> - { .resource = RES_VAUX1, .devgroup = -1, .type = -1, .type2 = 3},
> - { .resource = RES_VAUX2, .devgroup = -1, .type = -1, .type2 = 3},
> - { .resource = RES_VAUX3, .devgroup = -1, .type = -1, .type2 = 3},
> - { .resource = RES_VAUX4, .devgroup = -1, .type = -1, .type2 = 3},
> - { .resource = RES_VPLL2, .devgroup = -1, .type = -1, .type2 = 3},
> - { .resource = RES_VDAC, .devgroup = -1, .type = -1, .type2 = 3},
> - { .resource = RES_VSIM, .devgroup = DEV_GRP_NULL, .type = -1,
> - .type2 = 3},
> - { .resource = RES_CLKEN, .devgroup = DEV_GRP_P3, .type = -1,
> - .type2 = 1 },
> + { .resource = RES_VDD1, .devgroup = -1,
> + .type = 1, .type2 = -1, .remap_off = RES_STATE_OFF,
> + .remap_sleep = RES_STATE_OFF
> + },
> + { .resource = RES_VDD2, .devgroup = -1,
> + .type = 1, .type2 = -1, .remap_off = RES_STATE_OFF,
> + .remap_sleep = RES_STATE_OFF
> + },
> + { .resource = RES_VPLL1, .devgroup = -1,
> + .type = 1, .type2 = -1, .remap_off = RES_STATE_OFF,
> + .remap_sleep = RES_STATE_OFF
> + },
> + { .resource = RES_VPLL2, .devgroup = -1,
> + .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
> + },
> + { .resource = RES_VAUX1, .devgroup = -1,
> + .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
> + },
> + { .resource = RES_VAUX2, .devgroup = -1,
> + .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
> + },
> + { .resource = RES_VAUX3, .devgroup = -1,
> + .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
> + },
> + { .resource = RES_VAUX4, .devgroup = -1,
> + .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
> + },
> + { .resource = RES_VMMC1, .devgroup = -1,
> + .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
> + },
> + { .resource = RES_VMMC2, .devgroup = -1,
> + .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
> + },
> + { .resource = RES_VDAC, .devgroup = -1,
> + .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
> + },
> + { .resource = RES_VSIM, .devgroup = -1,
> + .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
> + },
> + { .resource = RES_VINTANA1, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
> + .type = -1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
> + },
> + { .resource = RES_VINTANA2, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
> + .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
> + },
> + { .resource = RES_VINTDIG, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
> + .type = -1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
> + },
> + { .resource = RES_VIO, .devgroup = DEV_GRP_P3,
> + .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
> + },
> + { .resource = RES_CLKEN, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
> + .type = 1, .type2 = -1 , .remap_off = -1, .remap_sleep = -1
> + },
> + { .resource = RES_REGEN, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
> + .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
> + },
> + { .resource = RES_NRES_PWRON, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
> + .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
> + },
> + { .resource = RES_SYSEN, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
> + .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
> + },
> + { .resource = RES_HFCLKOUT, .devgroup = DEV_GRP_P3,
> + .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
> + },
> + { .resource = RES_32KCLKOUT, .devgroup = -1,
> + .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
> + },
> + { .resource = RES_RESET, .devgroup = -1,
> + .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
> + },
> + { .resource = RES_Main_Ref, .devgroup = -1,
> + .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
> + },
> { 0, 0},
> };
>
> --
> 1.6.3.3
>

--
Intel Open Source Technology Centre
http://oss.intel.com/

2009-10-19 19:25:44

by Samuel Ortiz

[permalink] [raw]
Subject: Re: [PATCH 1/5] mfd: twl4030-power: Rename DEVGROUP to DEV_GRP

Hi Amit,

I've applied patches 1,2 and 3 to my for-next branch.
I dont think patch 4 is really useful, and I'll wait for an ACK from Tony or
Nokia before pushing patch 5.

Thanks for your work.

Cheers,
Samuel.

On Mon, Oct 19, 2009 at 03:10:44PM +0300, Amit Kucheria wrote:
> Stick to the names used in the reference manual
>
> Signed-off-by: Amit Kucheria <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> ---
> drivers/mfd/twl4030-power.c | 16 ++++++++--------
> 1 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/mfd/twl4030-power.c b/drivers/mfd/twl4030-power.c
> index d423e0c..82e3bcb 100644
> --- a/drivers/mfd/twl4030-power.c
> +++ b/drivers/mfd/twl4030-power.c
> @@ -69,12 +69,12 @@ static u8 twl4030_start_script_address = 0x2b;
>
> /* resource configuration registers */
>
> -#define DEVGROUP_OFFSET 0
> +#define DEV_GRP_OFFSET 0
> #define TYPE_OFFSET 1
>
> -/* Bit positions */
> -#define DEVGROUP_SHIFT 5
> -#define DEVGROUP_MASK (7 << DEVGROUP_SHIFT)
> +/* Bit positions in the registers */
> +#define DEV_GRP_SHIFT 5
> +#define DEV_GRP_MASK (7 << DEV_GRP_SHIFT)
> #define TYPE_SHIFT 0
> #define TYPE_MASK (7 << TYPE_SHIFT)
> #define TYPE2_SHIFT 3
> @@ -328,7 +328,7 @@ static int __init twl4030_configure_resource(struct twl4030_resconfig *rconfig)
>
> /* Set resource group */
> err = twl4030_i2c_read_u8(TWL4030_MODULE_PM_RECEIVER, &grp,
> - rconfig_addr + DEVGROUP_OFFSET);
> + rconfig_addr + DEV_GRP_OFFSET);
> if (err) {
> pr_err("TWL4030 Resource %d group could not be read\n",
> rconfig->resource);
> @@ -336,10 +336,10 @@ static int __init twl4030_configure_resource(struct twl4030_resconfig *rconfig)
> }
>
> if (rconfig->devgroup >= 0) {
> - grp &= ~DEVGROUP_MASK;
> - grp |= rconfig->devgroup << DEVGROUP_SHIFT;
> + grp &= ~DEV_GRP_MASK;
> + grp |= rconfig->devgroup << DEV_GRP_SHIFT;
> err = twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER,
> - grp, rconfig_addr + DEVGROUP_OFFSET);
> + grp, rconfig_addr + DEV_GRP_OFFSET);
> if (err < 0) {
> pr_err("TWL4030 failed to program devgroup\n");
> return err;
> --
> 1.6.3.3
>

--
Intel Open Source Technology Centre
http://oss.intel.com/

2009-10-19 19:33:48

by Jean Delvare

[permalink] [raw]
Subject: Re: [PATCH 3/5] mfd: twl4030-power: Move power-related data closer together in the header file

On Mon, 19 Oct 2009 21:12:33 +0200, Samuel Ortiz wrote:
> Hi Amit,
>
> On Mon, Oct 19, 2009 at 03:10:52PM +0300, Amit Kucheria wrote:
> > Bring together all the TWL power-related data in the header file
> I dont really see the point of doing this, as you're not really gathering
> scattered structures but rather moving a group of definitions up in the header
> file.
> If you dont mind I'll drop this one, unless Jean wants to take it.

No, I don't care about this at all ;)

--
Jean Delvare

2009-10-19 23:22:40

by Tony Lindgren

[permalink] [raw]
Subject: Re: [PATCH 5/5] mfd: twl4030-power: Optimised power scripts for the rx51

* Samuel Ortiz <[email protected]> [091019 12:15]:
> Hi Amit,
>
> On Mon, Oct 19, 2009 at 03:11:08PM +0300, Amit Kucheria wrote:
> > The power scripts optimisation was mainly done by:
> > Tero Kristo <[email protected]> and
> > Arnaud Mandy <[email protected]>
> >
> > I'm only refactoring and testing it against the mainline kernel.
> Fine with me but if you want me to carry this patch, I'd like to get an ACK
> from Tony or one of the 2 above mentioned Nokia developers.

Acked-by: Tony Lindgren <[email protected]>

> Cheers,
> Samuel.
>
>
> > Signed-off-by: Amit Kucheria <[email protected]>
> > Cc: Samuel Ortiz <[email protected]>
> > Cc: Tero Kristo <[email protected]>
> > Cc: [email protected]
> > ---
> > arch/arm/mach-omap2/board-rx51-peripherals.c | 118 ++++++++++++++++++--------
> > 1 files changed, 82 insertions(+), 36 deletions(-)
> >
> > diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c
> > index c1af532..d933050 100644
> > --- a/arch/arm/mach-omap2/board-rx51-peripherals.c
> > +++ b/arch/arm/mach-omap2/board-rx51-peripherals.c
> > @@ -292,15 +292,9 @@ static struct twl4030_usb_data rx51_usb_data = {
> >
> > static struct twl4030_ins sleep_on_seq[] __initdata = {
> > /*
> > - * Turn off VDD1 and VDD2.
> > + * Turn off everything
> > */
> > - {MSG_SINGULAR(DEV_GRP_P1, 0xf, RES_STATE_OFF), 4},
> > - {MSG_SINGULAR(DEV_GRP_P1, 0x10, RES_STATE_OFF), 2},
> > -/*
> > - * And also turn off the OMAP3 PLLs and the sysclk output.
> > - */
> > - {MSG_SINGULAR(DEV_GRP_P1, 0x7, RES_STATE_OFF), 3},
> > - {MSG_SINGULAR(DEV_GRP_P1, 0x17, RES_STATE_OFF), 3},
> > + {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, 1, 0, RES_STATE_SLEEP), 2},
> > };
> >
> > static struct twl4030_script sleep_on_script __initdata = {
> > @@ -311,14 +305,9 @@ static struct twl4030_script sleep_on_script __initdata = {
> >
> > static struct twl4030_ins wakeup_seq[] __initdata = {
> > /*
> > - * Reenable the OMAP3 PLLs.
> > - * Wakeup VDD1 and VDD2.
> > - * Reenable sysclk output.
> > + * Reenable everything
> > */
> > - {MSG_SINGULAR(DEV_GRP_P1, 0x7, RES_STATE_ACTIVE), 0x30},
> > - {MSG_SINGULAR(DEV_GRP_P1, 0xf, RES_STATE_ACTIVE), 0x30},
> > - {MSG_SINGULAR(DEV_GRP_P1, 0x10, RES_STATE_ACTIVE), 0x37},
> > - {MSG_SINGULAR(DEV_GRP_P1, 0x19, RES_STATE_ACTIVE), 3},
> > + {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, 1, 0, RES_STATE_ACTIVE), 2},
> > };
> >
> > static struct twl4030_script wakeup_script __initdata = {
> > @@ -329,10 +318,9 @@ static struct twl4030_script wakeup_script __initdata = {
> >
> > static struct twl4030_ins wakeup_p3_seq[] __initdata = {
> > /*
> > - * Wakeup VDD1 (dummy to be able to insert a delay)
> > - * Enable CLKEN
> > + * Reenable everything
> > */
> > - {MSG_SINGULAR(DEV_GRP_P1, 0x17, RES_STATE_ACTIVE), 3},
> > + {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, 1, 0, RES_STATE_ACTIVE), 2},
> > };
> >
> > static struct twl4030_script wakeup_p3_script __initdata = {
> > @@ -353,12 +341,11 @@ static struct twl4030_ins wrst_seq[] __initdata = {
> > {MSG_SINGULAR(DEV_GRP_NULL, RES_RESET, RES_STATE_OFF), 2},
> > {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, 0, 1, RES_STATE_ACTIVE),
> > 0x13},
> > - {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_PP, 0, 2, RES_STATE_WRST), 0x13},
> > {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_PP, 0, 3, RES_STATE_OFF), 0x13},
> > {MSG_SINGULAR(DEV_GRP_NULL, RES_VDD1, RES_STATE_WRST), 0x13},
> > {MSG_SINGULAR(DEV_GRP_NULL, RES_VDD2, RES_STATE_WRST), 0x13},
> > {MSG_SINGULAR(DEV_GRP_NULL, RES_VPLL1, RES_STATE_WRST), 0x35},
> > - {MSG_SINGULAR(DEV_GRP_P1, RES_HFCLKOUT, RES_STATE_ACTIVE), 2},
> > + {MSG_SINGULAR(DEV_GRP_P3, RES_HFCLKOUT, RES_STATE_ACTIVE), 2},
> > {MSG_SINGULAR(DEV_GRP_NULL, RES_RESET, RES_STATE_ACTIVE), 2},
> > };
> >
> > @@ -380,22 +367,81 @@ static struct twl4030_script *twl4030_scripts[] __initdata = {
> > };
> >
> > static struct twl4030_resconfig twl4030_rconfig[] __initdata = {
> > - { .resource = RES_VINTANA1, .devgroup = -1, .type = -1, .type2 = 1 },
> > - { .resource = RES_VINTANA2, .devgroup = -1, .type = -1, .type2 = 1 },
> > - { .resource = RES_VINTDIG, .devgroup = -1, .type = -1, .type2 = 1 },
> > - { .resource = RES_VMMC1, .devgroup = -1, .type = -1, .type2 = 3},
> > - { .resource = RES_VMMC2, .devgroup = DEV_GRP_NULL, .type = -1,
> > - .type2 = 3},
> > - { .resource = RES_VAUX1, .devgroup = -1, .type = -1, .type2 = 3},
> > - { .resource = RES_VAUX2, .devgroup = -1, .type = -1, .type2 = 3},
> > - { .resource = RES_VAUX3, .devgroup = -1, .type = -1, .type2 = 3},
> > - { .resource = RES_VAUX4, .devgroup = -1, .type = -1, .type2 = 3},
> > - { .resource = RES_VPLL2, .devgroup = -1, .type = -1, .type2 = 3},
> > - { .resource = RES_VDAC, .devgroup = -1, .type = -1, .type2 = 3},
> > - { .resource = RES_VSIM, .devgroup = DEV_GRP_NULL, .type = -1,
> > - .type2 = 3},
> > - { .resource = RES_CLKEN, .devgroup = DEV_GRP_P3, .type = -1,
> > - .type2 = 1 },
> > + { .resource = RES_VDD1, .devgroup = -1,
> > + .type = 1, .type2 = -1, .remap_off = RES_STATE_OFF,
> > + .remap_sleep = RES_STATE_OFF
> > + },
> > + { .resource = RES_VDD2, .devgroup = -1,
> > + .type = 1, .type2 = -1, .remap_off = RES_STATE_OFF,
> > + .remap_sleep = RES_STATE_OFF
> > + },
> > + { .resource = RES_VPLL1, .devgroup = -1,
> > + .type = 1, .type2 = -1, .remap_off = RES_STATE_OFF,
> > + .remap_sleep = RES_STATE_OFF
> > + },
> > + { .resource = RES_VPLL2, .devgroup = -1,
> > + .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
> > + },
> > + { .resource = RES_VAUX1, .devgroup = -1,
> > + .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
> > + },
> > + { .resource = RES_VAUX2, .devgroup = -1,
> > + .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
> > + },
> > + { .resource = RES_VAUX3, .devgroup = -1,
> > + .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
> > + },
> > + { .resource = RES_VAUX4, .devgroup = -1,
> > + .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
> > + },
> > + { .resource = RES_VMMC1, .devgroup = -1,
> > + .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
> > + },
> > + { .resource = RES_VMMC2, .devgroup = -1,
> > + .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
> > + },
> > + { .resource = RES_VDAC, .devgroup = -1,
> > + .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
> > + },
> > + { .resource = RES_VSIM, .devgroup = -1,
> > + .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
> > + },
> > + { .resource = RES_VINTANA1, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
> > + .type = -1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
> > + },
> > + { .resource = RES_VINTANA2, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
> > + .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
> > + },
> > + { .resource = RES_VINTDIG, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
> > + .type = -1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
> > + },
> > + { .resource = RES_VIO, .devgroup = DEV_GRP_P3,
> > + .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
> > + },
> > + { .resource = RES_CLKEN, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
> > + .type = 1, .type2 = -1 , .remap_off = -1, .remap_sleep = -1
> > + },
> > + { .resource = RES_REGEN, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
> > + .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
> > + },
> > + { .resource = RES_NRES_PWRON, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
> > + .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
> > + },
> > + { .resource = RES_SYSEN, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
> > + .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
> > + },
> > + { .resource = RES_HFCLKOUT, .devgroup = DEV_GRP_P3,
> > + .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
> > + },
> > + { .resource = RES_32KCLKOUT, .devgroup = -1,
> > + .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
> > + },
> > + { .resource = RES_RESET, .devgroup = -1,
> > + .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
> > + },
> > + { .resource = RES_Main_Ref, .devgroup = -1,
> > + .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
> > + },
> > { 0, 0},
> > };
> >
> > --
> > 1.6.3.3
> >
>
> --
> Intel Open Source Technology Centre
> http://oss.intel.com/
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/

2009-10-20 06:07:50

by Amit Kucheria

[permalink] [raw]
Subject: Re: [PATCH 1/5] mfd: twl4030-power: Rename DEVGROUP to DEV_GRP

On 09 Oct 19, Samuel Ortiz wrote:
> Hi Amit,
>
> I've applied patches 1,2 and 3 to my for-next branch.
> I dont think patch 4 is really useful, and I'll wait for an ACK from Tony or
> Nokia before pushing patch 5.
>
> Thanks for your work.
>
> Cheers,
> Samuel.

Samuel,

I hope you meant you're taking patches 1, 2, 4 and 5.

3 is the one just moving stuff around and may be discarded.

Thanks.

Regards,
Amit

> On Mon, Oct 19, 2009 at 03:10:44PM +0300, Amit Kucheria wrote:
> > Stick to the names used in the reference manual
> >
> > Signed-off-by: Amit Kucheria <[email protected]>
> > Cc: [email protected]
> > Cc: [email protected]
> > ---
> > drivers/mfd/twl4030-power.c | 16 ++++++++--------
> > 1 files changed, 8 insertions(+), 8 deletions(-)
> >
> > diff --git a/drivers/mfd/twl4030-power.c b/drivers/mfd/twl4030-power.c
> > index d423e0c..82e3bcb 100644
> > --- a/drivers/mfd/twl4030-power.c
> > +++ b/drivers/mfd/twl4030-power.c
> > @@ -69,12 +69,12 @@ static u8 twl4030_start_script_address = 0x2b;
> >
> > /* resource configuration registers */
> >
> > -#define DEVGROUP_OFFSET 0
> > +#define DEV_GRP_OFFSET 0
> > #define TYPE_OFFSET 1
> >
> > -/* Bit positions */
> > -#define DEVGROUP_SHIFT 5
> > -#define DEVGROUP_MASK (7 << DEVGROUP_SHIFT)
> > +/* Bit positions in the registers */
> > +#define DEV_GRP_SHIFT 5
> > +#define DEV_GRP_MASK (7 << DEV_GRP_SHIFT)
> > #define TYPE_SHIFT 0
> > #define TYPE_MASK (7 << TYPE_SHIFT)
> > #define TYPE2_SHIFT 3
> > @@ -328,7 +328,7 @@ static int __init twl4030_configure_resource(struct twl4030_resconfig *rconfig)
> >
> > /* Set resource group */
> > err = twl4030_i2c_read_u8(TWL4030_MODULE_PM_RECEIVER, &grp,
> > - rconfig_addr + DEVGROUP_OFFSET);
> > + rconfig_addr + DEV_GRP_OFFSET);
> > if (err) {
> > pr_err("TWL4030 Resource %d group could not be read\n",
> > rconfig->resource);
> > @@ -336,10 +336,10 @@ static int __init twl4030_configure_resource(struct twl4030_resconfig *rconfig)
> > }
> >
> > if (rconfig->devgroup >= 0) {
> > - grp &= ~DEVGROUP_MASK;
> > - grp |= rconfig->devgroup << DEVGROUP_SHIFT;
> > + grp &= ~DEV_GRP_MASK;
> > + grp |= rconfig->devgroup << DEV_GRP_SHIFT;
> > err = twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER,
> > - grp, rconfig_addr + DEVGROUP_OFFSET);
> > + grp, rconfig_addr + DEV_GRP_OFFSET);
> > if (err < 0) {
> > pr_err("TWL4030 failed to program devgroup\n");
> > return err;
> > --
> > 1.6.3.3
> >
>
> --
> Intel Open Source Technology Centre
> http://oss.intel.com/

--
------------------------------------------------------------
Amit Kucheria, Finland
------------------------------------------------------------

2009-10-20 09:19:38

by Samuel Ortiz

[permalink] [raw]
Subject: Re: [PATCH 5/5] mfd: twl4030-power: Optimised power scripts for the rx51

On Mon, Oct 19, 2009 at 04:22:39PM -0700, Tony Lindgren wrote:
> * Samuel Ortiz <[email protected]> [091019 12:15]:
> > Hi Amit,
> >
> > On Mon, Oct 19, 2009 at 03:11:08PM +0300, Amit Kucheria wrote:
> > > The power scripts optimisation was mainly done by:
> > > Tero Kristo <[email protected]> and
> > > Arnaud Mandy <[email protected]>
> > >
> > > I'm only refactoring and testing it against the mainline kernel.
> > Fine with me but if you want me to carry this patch, I'd like to get an ACK
> > from Tony or one of the 2 above mentioned Nokia developers.
>
> Acked-by: Tony Lindgren <[email protected]>
Thanks Amit, Tony. Patch applied.

Cheers,
Samuel.

> > Cheers,
> > Samuel.
> >
> >
> > > Signed-off-by: Amit Kucheria <[email protected]>
> > > Cc: Samuel Ortiz <[email protected]>
> > > Cc: Tero Kristo <[email protected]>
> > > Cc: [email protected]
> > > ---
> > > arch/arm/mach-omap2/board-rx51-peripherals.c | 118 ++++++++++++++++++--------
> > > 1 files changed, 82 insertions(+), 36 deletions(-)
> > >
> > > diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c
> > > index c1af532..d933050 100644
> > > --- a/arch/arm/mach-omap2/board-rx51-peripherals.c
> > > +++ b/arch/arm/mach-omap2/board-rx51-peripherals.c
> > > @@ -292,15 +292,9 @@ static struct twl4030_usb_data rx51_usb_data = {
> > >
> > > static struct twl4030_ins sleep_on_seq[] __initdata = {
> > > /*
> > > - * Turn off VDD1 and VDD2.
> > > + * Turn off everything
> > > */
> > > - {MSG_SINGULAR(DEV_GRP_P1, 0xf, RES_STATE_OFF), 4},
> > > - {MSG_SINGULAR(DEV_GRP_P1, 0x10, RES_STATE_OFF), 2},
> > > -/*
> > > - * And also turn off the OMAP3 PLLs and the sysclk output.
> > > - */
> > > - {MSG_SINGULAR(DEV_GRP_P1, 0x7, RES_STATE_OFF), 3},
> > > - {MSG_SINGULAR(DEV_GRP_P1, 0x17, RES_STATE_OFF), 3},
> > > + {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, 1, 0, RES_STATE_SLEEP), 2},
> > > };
> > >
> > > static struct twl4030_script sleep_on_script __initdata = {
> > > @@ -311,14 +305,9 @@ static struct twl4030_script sleep_on_script __initdata = {
> > >
> > > static struct twl4030_ins wakeup_seq[] __initdata = {
> > > /*
> > > - * Reenable the OMAP3 PLLs.
> > > - * Wakeup VDD1 and VDD2.
> > > - * Reenable sysclk output.
> > > + * Reenable everything
> > > */
> > > - {MSG_SINGULAR(DEV_GRP_P1, 0x7, RES_STATE_ACTIVE), 0x30},
> > > - {MSG_SINGULAR(DEV_GRP_P1, 0xf, RES_STATE_ACTIVE), 0x30},
> > > - {MSG_SINGULAR(DEV_GRP_P1, 0x10, RES_STATE_ACTIVE), 0x37},
> > > - {MSG_SINGULAR(DEV_GRP_P1, 0x19, RES_STATE_ACTIVE), 3},
> > > + {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, 1, 0, RES_STATE_ACTIVE), 2},
> > > };
> > >
> > > static struct twl4030_script wakeup_script __initdata = {
> > > @@ -329,10 +318,9 @@ static struct twl4030_script wakeup_script __initdata = {
> > >
> > > static struct twl4030_ins wakeup_p3_seq[] __initdata = {
> > > /*
> > > - * Wakeup VDD1 (dummy to be able to insert a delay)
> > > - * Enable CLKEN
> > > + * Reenable everything
> > > */
> > > - {MSG_SINGULAR(DEV_GRP_P1, 0x17, RES_STATE_ACTIVE), 3},
> > > + {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, 1, 0, RES_STATE_ACTIVE), 2},
> > > };
> > >
> > > static struct twl4030_script wakeup_p3_script __initdata = {
> > > @@ -353,12 +341,11 @@ static struct twl4030_ins wrst_seq[] __initdata = {
> > > {MSG_SINGULAR(DEV_GRP_NULL, RES_RESET, RES_STATE_OFF), 2},
> > > {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, 0, 1, RES_STATE_ACTIVE),
> > > 0x13},
> > > - {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_PP, 0, 2, RES_STATE_WRST), 0x13},
> > > {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_PP, 0, 3, RES_STATE_OFF), 0x13},
> > > {MSG_SINGULAR(DEV_GRP_NULL, RES_VDD1, RES_STATE_WRST), 0x13},
> > > {MSG_SINGULAR(DEV_GRP_NULL, RES_VDD2, RES_STATE_WRST), 0x13},
> > > {MSG_SINGULAR(DEV_GRP_NULL, RES_VPLL1, RES_STATE_WRST), 0x35},
> > > - {MSG_SINGULAR(DEV_GRP_P1, RES_HFCLKOUT, RES_STATE_ACTIVE), 2},
> > > + {MSG_SINGULAR(DEV_GRP_P3, RES_HFCLKOUT, RES_STATE_ACTIVE), 2},
> > > {MSG_SINGULAR(DEV_GRP_NULL, RES_RESET, RES_STATE_ACTIVE), 2},
> > > };
> > >
> > > @@ -380,22 +367,81 @@ static struct twl4030_script *twl4030_scripts[] __initdata = {
> > > };
> > >
> > > static struct twl4030_resconfig twl4030_rconfig[] __initdata = {
> > > - { .resource = RES_VINTANA1, .devgroup = -1, .type = -1, .type2 = 1 },
> > > - { .resource = RES_VINTANA2, .devgroup = -1, .type = -1, .type2 = 1 },
> > > - { .resource = RES_VINTDIG, .devgroup = -1, .type = -1, .type2 = 1 },
> > > - { .resource = RES_VMMC1, .devgroup = -1, .type = -1, .type2 = 3},
> > > - { .resource = RES_VMMC2, .devgroup = DEV_GRP_NULL, .type = -1,
> > > - .type2 = 3},
> > > - { .resource = RES_VAUX1, .devgroup = -1, .type = -1, .type2 = 3},
> > > - { .resource = RES_VAUX2, .devgroup = -1, .type = -1, .type2 = 3},
> > > - { .resource = RES_VAUX3, .devgroup = -1, .type = -1, .type2 = 3},
> > > - { .resource = RES_VAUX4, .devgroup = -1, .type = -1, .type2 = 3},
> > > - { .resource = RES_VPLL2, .devgroup = -1, .type = -1, .type2 = 3},
> > > - { .resource = RES_VDAC, .devgroup = -1, .type = -1, .type2 = 3},
> > > - { .resource = RES_VSIM, .devgroup = DEV_GRP_NULL, .type = -1,
> > > - .type2 = 3},
> > > - { .resource = RES_CLKEN, .devgroup = DEV_GRP_P3, .type = -1,
> > > - .type2 = 1 },
> > > + { .resource = RES_VDD1, .devgroup = -1,
> > > + .type = 1, .type2 = -1, .remap_off = RES_STATE_OFF,
> > > + .remap_sleep = RES_STATE_OFF
> > > + },
> > > + { .resource = RES_VDD2, .devgroup = -1,
> > > + .type = 1, .type2 = -1, .remap_off = RES_STATE_OFF,
> > > + .remap_sleep = RES_STATE_OFF
> > > + },
> > > + { .resource = RES_VPLL1, .devgroup = -1,
> > > + .type = 1, .type2 = -1, .remap_off = RES_STATE_OFF,
> > > + .remap_sleep = RES_STATE_OFF
> > > + },
> > > + { .resource = RES_VPLL2, .devgroup = -1,
> > > + .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
> > > + },
> > > + { .resource = RES_VAUX1, .devgroup = -1,
> > > + .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
> > > + },
> > > + { .resource = RES_VAUX2, .devgroup = -1,
> > > + .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
> > > + },
> > > + { .resource = RES_VAUX3, .devgroup = -1,
> > > + .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
> > > + },
> > > + { .resource = RES_VAUX4, .devgroup = -1,
> > > + .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
> > > + },
> > > + { .resource = RES_VMMC1, .devgroup = -1,
> > > + .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
> > > + },
> > > + { .resource = RES_VMMC2, .devgroup = -1,
> > > + .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
> > > + },
> > > + { .resource = RES_VDAC, .devgroup = -1,
> > > + .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
> > > + },
> > > + { .resource = RES_VSIM, .devgroup = -1,
> > > + .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
> > > + },
> > > + { .resource = RES_VINTANA1, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
> > > + .type = -1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
> > > + },
> > > + { .resource = RES_VINTANA2, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
> > > + .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
> > > + },
> > > + { .resource = RES_VINTDIG, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
> > > + .type = -1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
> > > + },
> > > + { .resource = RES_VIO, .devgroup = DEV_GRP_P3,
> > > + .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
> > > + },
> > > + { .resource = RES_CLKEN, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
> > > + .type = 1, .type2 = -1 , .remap_off = -1, .remap_sleep = -1
> > > + },
> > > + { .resource = RES_REGEN, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
> > > + .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
> > > + },
> > > + { .resource = RES_NRES_PWRON, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
> > > + .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
> > > + },
> > > + { .resource = RES_SYSEN, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
> > > + .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
> > > + },
> > > + { .resource = RES_HFCLKOUT, .devgroup = DEV_GRP_P3,
> > > + .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
> > > + },
> > > + { .resource = RES_32KCLKOUT, .devgroup = -1,
> > > + .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
> > > + },
> > > + { .resource = RES_RESET, .devgroup = -1,
> > > + .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
> > > + },
> > > + { .resource = RES_Main_Ref, .devgroup = -1,
> > > + .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
> > > + },
> > > { 0, 0},
> > > };
> > >
> > > --
> > > 1.6.3.3
> > >
> >
> > --
> > Intel Open Source Technology Centre
> > http://oss.intel.com/
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> > the body of a message to [email protected]
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
> > Please read the FAQ at http://www.tux.org/lkml/

--
Intel Open Source Technology Centre
http://oss.intel.com/

2009-10-20 09:20:32

by Samuel Ortiz

[permalink] [raw]
Subject: Re: [PATCH 1/5] mfd: twl4030-power: Rename DEVGROUP to DEV_GRP

Hi Amit,

On Tue, Oct 20, 2009 at 09:07:13AM +0300, Amit Kucheria wrote:
> On 09 Oct 19, Samuel Ortiz wrote:
> > Hi Amit,
> >
> > I've applied patches 1,2 and 3 to my for-next branch.
> > I dont think patch 4 is really useful, and I'll wait for an ACK from Tony or
> > Nokia before pushing patch 5.
> >
> > Thanks for your work.
> >
> > Cheers,
> > Samuel.
>
> Samuel,
>
> I hope you meant you're taking patches 1, 2, 4 and 5.
Yes, sorry about it. So, patches 1,2,4 and 5 applied.

Cheers,
Samuel.


> 3 is the one just moving stuff around and may be discarded.
>
> Thanks.
>
> Regards,
> Amit
>
> > On Mon, Oct 19, 2009 at 03:10:44PM +0300, Amit Kucheria wrote:
> > > Stick to the names used in the reference manual
> > >
> > > Signed-off-by: Amit Kucheria <[email protected]>
> > > Cc: [email protected]
> > > Cc: [email protected]
> > > ---
> > > drivers/mfd/twl4030-power.c | 16 ++++++++--------
> > > 1 files changed, 8 insertions(+), 8 deletions(-)
> > >
> > > diff --git a/drivers/mfd/twl4030-power.c b/drivers/mfd/twl4030-power.c
> > > index d423e0c..82e3bcb 100644
> > > --- a/drivers/mfd/twl4030-power.c
> > > +++ b/drivers/mfd/twl4030-power.c
> > > @@ -69,12 +69,12 @@ static u8 twl4030_start_script_address = 0x2b;
> > >
> > > /* resource configuration registers */
> > >
> > > -#define DEVGROUP_OFFSET 0
> > > +#define DEV_GRP_OFFSET 0
> > > #define TYPE_OFFSET 1
> > >
> > > -/* Bit positions */
> > > -#define DEVGROUP_SHIFT 5
> > > -#define DEVGROUP_MASK (7 << DEVGROUP_SHIFT)
> > > +/* Bit positions in the registers */
> > > +#define DEV_GRP_SHIFT 5
> > > +#define DEV_GRP_MASK (7 << DEV_GRP_SHIFT)
> > > #define TYPE_SHIFT 0
> > > #define TYPE_MASK (7 << TYPE_SHIFT)
> > > #define TYPE2_SHIFT 3
> > > @@ -328,7 +328,7 @@ static int __init twl4030_configure_resource(struct twl4030_resconfig *rconfig)
> > >
> > > /* Set resource group */
> > > err = twl4030_i2c_read_u8(TWL4030_MODULE_PM_RECEIVER, &grp,
> > > - rconfig_addr + DEVGROUP_OFFSET);
> > > + rconfig_addr + DEV_GRP_OFFSET);
> > > if (err) {
> > > pr_err("TWL4030 Resource %d group could not be read\n",
> > > rconfig->resource);
> > > @@ -336,10 +336,10 @@ static int __init twl4030_configure_resource(struct twl4030_resconfig *rconfig)
> > > }
> > >
> > > if (rconfig->devgroup >= 0) {
> > > - grp &= ~DEVGROUP_MASK;
> > > - grp |= rconfig->devgroup << DEVGROUP_SHIFT;
> > > + grp &= ~DEV_GRP_MASK;
> > > + grp |= rconfig->devgroup << DEV_GRP_SHIFT;
> > > err = twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER,
> > > - grp, rconfig_addr + DEVGROUP_OFFSET);
> > > + grp, rconfig_addr + DEV_GRP_OFFSET);
> > > if (err < 0) {
> > > pr_err("TWL4030 failed to program devgroup\n");
> > > return err;
> > > --
> > > 1.6.3.3
> > >
> >
> > --
> > Intel Open Source Technology Centre
> > http://oss.intel.com/
>
> --
> ------------------------------------------------------------
> Amit Kucheria, Finland
> ------------------------------------------------------------

--
Intel Open Source Technology Centre
http://oss.intel.com/