r3875 - branches/src/target/kernel/2.6.24.x/patches
werner at sita.openmoko.org
werner at sita.openmoko.org
Thu Jan 17 23:40:34 CET 2008
Author: werner
Date: 2008-01-17 23:40:29 +0100 (Thu, 17 Jan 2008)
New Revision: 3875
Added:
branches/src/target/kernel/2.6.24.x/patches/gta02-bt-fixes.patch
branches/src/target/kernel/2.6.24.x/patches/pcf506xx.patch
Modified:
branches/src/target/kernel/2.6.24.x/patches/series
Log:
Increase BT voltage from 2.5V to 3.2V on GTA02, enable/disable the regulator
to control BT power, and assorted build fixes.
series: added pcf506xx.patch and gta02-bt-fixes.patch
pcf506xx.patch:
- include/linux/pcf50606.h (struct pmu_voltage_rail, enum pmu_event, pmu_cb):
moved to pcf506xx.h
- include/linux/pcf50633.h (struct pmu_voltage_rail, enum pmu_event, pmu_cb):
moved to pcf506xx.h
gta02-bt-fixes.patch:
- arch/arm/mach-s3c2440/mach-gta02.c (gta02_pcf_pdata): raised maximum voltage
of LDO4 from 2.5V to 3.3V
- arch/arm/plat-s3c24xx/neo1973_pm_bt.c (bt_read, bt_write, gta01_bt_probe):
allow compilation with one of GTA01 and GTA02 or both enabled
- arch/arm/plat-s3c24xx/neo1973_pm_bt.c (bt_write): when enabling BT on the
GTA02, raise the LDO4 voltage to 3.2V and enable the regulator
- arch/arm/plat-s3c24xx/neo1973_pm_bt.c (gta01_bt_probe): don't set
GTA01_GPIO_BT_EN om the GTA02
- drivers/i2c/chips/pcf50633.c (ena_regulator_registers): regulator to enable
register mapping
- drivers/i2c/chips/pcf50633.c, include/linux/pcf50633.h
(pcf50633_ena_voltage): enable/disable a voltage regulator
Added: branches/src/target/kernel/2.6.24.x/patches/gta02-bt-fixes.patch
===================================================================
--- branches/src/target/kernel/2.6.24.x/patches/gta02-bt-fixes.patch 2008-01-17 18:08:02 UTC (rev 3874)
+++ branches/src/target/kernel/2.6.24.x/patches/gta02-bt-fixes.patch 2008-01-17 22:40:29 UTC (rev 3875)
@@ -0,0 +1,260 @@
+Modify GTA02 power manager for bluetooth.
+
+From: Willie <willie_chen at openmoko.com>
+
+1. Default power value isn't correct. Now we set pcf50633 LDO4 to 3.2 voltage.
+
+2. Separate GTA01 and GTA02 source code.
+
+3. Add pcf50633 API for enable register.
+---
+
+ arch/arm/mach-s3c2440/mach-gta02.c | 4 +-
+ arch/arm/plat-s3c24xx/neo1973_pm_bt.c | 42 +++++++++++++++++++++--
+ drivers/i2c/chips/pcf50633.c | 59 +++++++++++++++++++++++++++++++++
+ include/linux/pcf50633.h | 11 ++++++
+ 4 files changed, 109 insertions(+), 7 deletions(-)
+
+
+Index: linux-2.6.24-rc7/arch/arm/mach-s3c2440/mach-gta02.c
+===================================================================
+--- linux-2.6.24-rc7.orig/arch/arm/mach-s3c2440/mach-gta02.c
++++ linux-2.6.24-rc7/arch/arm/mach-s3c2440/mach-gta02.c
+@@ -209,10 +209,10 @@
+ },
+ },
+ [PCF50633_REGULATOR_LDO4] = {
+- .name = "gl_2v5",
++ .name = "bt_3v2",
+ .voltage = {
+ .init = 2500,
+- .max = 2500,
++ .max = 3300,
+ },
+ },
+ [PCF50633_REGULATOR_LDO5] = {
+Index: linux-2.6.24-rc7/arch/arm/plat-s3c24xx/neo1973_pm_bt.c
+===================================================================
+--- linux-2.6.24-rc7.orig/arch/arm/plat-s3c24xx/neo1973_pm_bt.c
++++ linux-2.6.24-rc7/arch/arm/plat-s3c24xx/neo1973_pm_bt.c
+@@ -16,12 +16,19 @@
+ #include <linux/kernel.h>
+ #include <linux/platform_device.h>
+
+-#include <linux/pcf50606.h>
+-
+ #include <asm/hardware.h>
+ #include <asm/mach-types.h>
++
++#ifdef CONFIG_MACH_NEO1973_GTA01
+ #include <asm/arch/gta01.h>
++#include <linux/pcf50606.h>
++#endif
++
++#ifdef CONFIG_MACH_NEO1973_GTA02
+ #include <asm/arch/gta02.h>
++#include <linux/pcf50633.h>
++#endif
++
+
+ #define DRVMSG "FIC Neo1973 Bluetooth Power Management"
+
+@@ -30,6 +37,8 @@
+ {
+ if (!strcmp(attr->attr.name, "power_on")) {
+ switch (machine_arch_type) {
++
++#ifdef CONFIG_MACH_NEO1973_GTA01
+ case MACH_TYPE_NEO1973_GTA01:
+ if (pcf50606_onoff_get(pcf50606_global,
+ PCF50606_REGULATOR_D1REG) &&
+@@ -37,21 +46,33 @@
+ PCF50606_REGULATOR_D1REG) == 3100)
+ goto out_1;
+ break;
++#endif /* CONFIG_MACH_NEO1973_GTA01 */
++
++#ifdef CONFIG_MACH_NEO1973_GTA02
+ case MACH_TYPE_NEO1973_GTA02:
+ if (s3c2410_gpio_getpin(GTA02_GPIO_BT_EN))
+ goto out_1;
+ break;
++#endif /* CONFIG_MACH_NEO1973_GTA02 */
++
+ }
+ } else if (!strcmp(attr->attr.name, "reset")) {
+ switch (machine_arch_type) {
++
++#ifdef CONFIG_MACH_NEO1973_GTA01
+ case MACH_TYPE_NEO1973_GTA01:
+ if (s3c2410_gpio_getpin(GTA01_GPIO_BT_EN) == 0)
+ goto out_1;
+ break;
++#endif /* CONFIG_MACH_NEO1973_GTA01 */
++
++#ifdef CONFIG_MACH_NEO1973_GTA02
+ case MACH_TYPE_NEO1973_GTA02:
+ if (s3c2410_gpio_getpin(GTA02_GPIO_BT_EN) == 0)
+ goto out_1;
+ break;
++#endif /* CONFIG_MACH_NEO1973_GTA02 */
++
+ }
+ }
+
+@@ -64,9 +85,12 @@
+ const char *buf, size_t count)
+ {
+ unsigned long on = simple_strtoul(buf, NULL, 10);
++ unsigned int vol;
+
+ if (!strcmp(attr->attr.name, "power_on")) {
+ switch (machine_arch_type) {
++
++#ifdef CONFIG_MACH_NEO1973_GTA01
+ case MACH_TYPE_NEO1973_GTA01:
+ /* if we are powering up, assert reset, then power,
+ * then release reset */
+@@ -80,22 +104,39 @@
+ PCF50606_REGULATOR_D1REG, on);
+ s3c2410_gpio_setpin(GTA01_GPIO_BT_EN, on);
+ break;
++#endif /* CONFIG_MACH_NEO1973_GTA01 */
++
++#ifdef CONFIG_MACH_NEO1973_GTA02
+ case MACH_TYPE_NEO1973_GTA02:
++ s3c2410_gpio_setpin(GTA02_GPIO_BT_EN, on ? 0 : 1);
+ if (on)
+- s3c2410_gpio_setpin(GTA02_GPIO_BT_EN, 0);
+- else
+- s3c2410_gpio_setpin(GTA02_GPIO_BT_EN, 1);
++ pcf50633_voltage_set(pcf50633_global,
++ PCF50633_REGULATOR_LDO4, 3200);
++ pcf50633_ena_voltage(pcf50633_global,
++ PCF50633_REGULATOR_LDO4, on);
++ vol = pcf50633_voltage_get(pcf50633_global,
++ PCF50633_REGULATOR_LDO4);
++ dev_info(dev, "GTA02 Set PCF50633 LDO4 = %d\n", vol);
+ break;
++#endif /* CONFIG_MACH_NEO1973_GTA02 */
++
+ }
+ } else if (!strcmp(attr->attr.name, "reset")) {
+ /* reset is low-active, so we need to invert */
+ switch (machine_arch_type) {
++
++#ifdef CONFIG_MACH_NEO1973_GTA01
+ case MACH_TYPE_NEO1973_GTA01:
+ s3c2410_gpio_setpin(GTA01_GPIO_BT_EN, on ? 0 : 1);
+ break;
++#endif /* CONFIG_MACH_NEO1973_GTA01 */
++
++#ifdef CONFIG_MACH_NEO1973_GTA02
+ case MACH_TYPE_NEO1973_GTA02:
+ s3c2410_gpio_setpin(GTA02_GPIO_BT_EN, on ? 0 : 1);
+ break;
++#endif /* CONFIG_MACH_NEO1973_GTA02 */
++
+ }
+ }
+
+@@ -143,18 +184,25 @@
+ dev_info(&pdev->dev, DRVMSG ": starting\n");
+
+ switch (machine_arch_type) {
++
++#ifdef CONFIG_MACH_NEO1973_GTA01
+ case MACH_TYPE_NEO1973_GTA01:
+ /* we make sure that the voltage is off */
+ pcf50606_onoff_set(pcf50606_global,
+ PCF50606_REGULATOR_D1REG, 0);
++ /* we pull reset to low to make sure that the chip doesn't
++ * drain power through the reset line */
++ s3c2410_gpio_setpin(GTA01_GPIO_BT_EN, 0);
+ break;
++#endif /* CONFIG_MACH_NEO1973_GTA01 */
++
++#ifdef CONFIG_MACH_NEO1973_GTA02
+ case MACH_TYPE_NEO1973_GTA02:
+ /* FIXME: implementation */
+ break;
++#endif /* CONFIG_MACH_NEO1973_GTA02 */
++
+ }
+- /* we pull reset to low to make sure that the chip doesn't
+- * drain power through the reset line */
+- s3c2410_gpio_setpin(GTA01_GPIO_BT_EN, 0);
+
+ return sysfs_create_group(&pdev->dev.kobj, >a01_bt_attr_group);
+ }
+Index: linux-2.6.24-rc7/drivers/i2c/chips/pcf50633.c
+===================================================================
+--- linux-2.6.24-rc7.orig/drivers/i2c/chips/pcf50633.c
++++ linux-2.6.24-rc7/drivers/i2c/chips/pcf50633.c
+@@ -319,6 +319,20 @@
+ [PCF50633_REGULATOR_HCLDO] = PCF50633_REG_HCLDOOUT,
+ };
+
++static const u_int8_t ena_regulator_registers[__NUM_PCF50633_REGULATORS] = {
++ [PCF50633_REGULATOR_AUTO] = PCF50633_REG_AUTOENA,
++ [PCF50633_REGULATOR_DOWN1] = PCF50633_REG_DOWN1ENA,
++ [PCF50633_REGULATOR_DOWN2] = PCF50633_REG_DOWN2ENA,
++ [PCF50633_REGULATOR_MEMLDO] = PCF50633_REG_MEMLDOENA,
++ [PCF50633_REGULATOR_LDO1] = PCF50633_REG_LDO1ENA,
++ [PCF50633_REGULATOR_LDO2] = PCF50633_REG_LDO2ENA,
++ [PCF50633_REGULATOR_LDO3] = PCF50633_REG_LDO3ENA,
++ [PCF50633_REGULATOR_LDO4] = PCF50633_REG_LDO4ENA,
++ [PCF50633_REGULATOR_LDO5] = PCF50633_REG_LDO5ENA,
++ [PCF50633_REGULATOR_LDO6] = PCF50633_REG_LDO6ENA,
++ [PCF50633_REGULATOR_HCLDO] = PCF50633_REG_HCLDOENA,
++};
++
+ int pcf50633_onoff_set(struct pcf50633_data *pcf,
+ enum pcf50633_regulator_id reg, int on)
+ {
+@@ -401,6 +415,29 @@
+ }
+ EXPORT_SYMBOL_GPL(pcf50633_voltage_set);
+
++int pcf50633_ena_voltage(struct pcf50633_data *pcf,
++ enum pcf50633_regulator_id reg,
++ u_int8_t on)
++{
++ u_int8_t regnr;
++
++ DEBUGP("pcf=%p, reg=%d", pcf, reg);
++
++ if(reg >= __NUM_PCF50633_REGULATORS)
++ return -EINVAL;
++
++ regnr = ena_regulator_registers[reg];
++ BUG_ON(regnr); /* in case we forgot one */
++
++ if (on)
++ reg_set_bit_mask(pcf, regnr, 0x01, 0x01);
++ else
++ reg_set_bit_mask(pcf, regnr, 0x01, 0x00);
++
++ return 0;
++}
++EXPORT_SYMBOL_GPL(pcf50633_ena_voltage);
++
+ unsigned int pcf50633_voltage_get(struct pcf50633_data *pcf,
+ enum pcf50633_regulator_id reg)
+ {
+Index: linux-2.6.24-rc7/include/linux/pcf50633.h
+===================================================================
+--- linux-2.6.24-rc7.orig/include/linux/pcf50633.h
++++ linux-2.6.24-rc7/include/linux/pcf50633.h
+@@ -47,6 +47,11 @@
+ pcf50633_voltage_get(struct pcf50633_data *pcf,
+ enum pcf50633_regulator_id reg);
+ extern int
++pcf50633_ena_voltage(struct pcf50633_data *pcf,
++ enum pcf50633_regulator_id reg,
++ u_int8_t on);
++
++extern int
+ pcf50633_onoff_get(struct pcf50633_data *pcf,
+ enum pcf50633_regulator_id reg);
+
Added: branches/src/target/kernel/2.6.24.x/patches/pcf506xx.patch
===================================================================
--- branches/src/target/kernel/2.6.24.x/patches/pcf506xx.patch 2008-01-17 18:08:02 UTC (rev 3874)
+++ branches/src/target/kernel/2.6.24.x/patches/pcf506xx.patch 2008-01-17 22:40:29 UTC (rev 3875)
@@ -0,0 +1,132 @@
+Moved shared PMU code from pcf50606.h and pcf50633.h (which prevented inclusion
+of both at the same time) to pcf506xx.h
+
+- include/linux/pcf50606.h (struct pmu_voltage_rail, enum pmu_event, pmu_cb):
+ moved to pcf506xx.h
+- include/linux/pcf50633.h (struct pmu_voltage_rail, enum pmu_event, pmu_cb):
+ moved to pcf506xx.h
+
+Signed off-by: Werner Almesberger <werner at openmoko.org>
+
+Index: linux-2.6.24-rc7/include/linux/pcf50606.h
+===================================================================
+--- linux-2.6.24-rc7.orig/include/linux/pcf50606.h
++++ linux-2.6.24-rc7/include/linux/pcf50606.h
+@@ -1,6 +1,9 @@
+ #ifndef _LINUX_PCF50606_H
+ #define _LINUX_PCF50606_H
+
++#include <linux/pcf506xx.h>
++
++
+ /* public in-kernel pcf50606 api */
+ enum pcf50606_regulator_id {
+ PCF50606_REGULATOR_DCD,
+@@ -48,26 +51,6 @@
+ extern void
+ pcf50606_charge_fast(struct pcf50606_data *pcf, int on);
+
+-#define PMU_VRAIL_F_SUSPEND_ON 0x00000001 /* Remains on during suspend */
+-#define PMU_VRAIL_F_UNUSED 0x00000002 /* This rail is not used */
+-struct pmu_voltage_rail {
+- char *name;
+- unsigned int flags;
+- struct {
+- unsigned int init;
+- unsigned int max;
+- } voltage;
+-};
+-
+-enum pmu_event {
+- PMU_EVT_NONE,
+- PMU_EVT_INSERT,
+- PMU_EVT_REMOVE,
+- __NUM_PMU_EVTS
+-};
+-
+-typedef int pmu_cb(struct device *dev, unsigned int feature,
+- enum pmu_event event);
+
+ #define PCF50606_FEAT_EXTON 0x00000001 /* not yet supported */
+ #define PCF50606_FEAT_MBC 0x00000002
+Index: linux-2.6.24-rc7/include/linux/pcf50633.h
+===================================================================
+--- linux-2.6.24-rc7.orig/include/linux/pcf50633.h
++++ linux-2.6.24-rc7/include/linux/pcf50633.h
+@@ -1,6 +1,9 @@
+ #ifndef _LINUX_PCF50633_H
+ #define _LINUX_PCF50633_H
+
++#include <linux/pcf506xx.h>
++
++
+ /* public in-kernel pcf50633 api */
+ enum pcf50633_regulator_id {
+ PCF50633_REGULATOR_AUTO,
+@@ -57,30 +60,6 @@
+ extern void
+ pcf50633_charge_enable(struct pcf50633_data *pcf, int on);
+
+-/* FIXME: sharded with pcf50606 */
+-#define PMU_VRAIL_F_SUSPEND_ON 0x00000001 /* Remains on during suspend */
+-#define PMU_VRAIL_F_UNUSED 0x00000002 /* This rail is not used */
+-struct pmu_voltage_rail {
+- char *name;
+- unsigned int flags;
+- struct {
+- unsigned int init;
+- unsigned int max;
+- } voltage;
+-};
+-
+-enum pmu_event {
+- PMU_EVT_NONE,
+- PMU_EVT_INSERT,
+- PMU_EVT_REMOVE,
+- PMU_EVT_USB_INSERT,
+- PMU_EVT_USB_REMOVE,
+- __NUM_PMU_EVTS
+-};
+-
+-typedef int pmu_cb(struct device *dev, unsigned int feature,
+- enum pmu_event event);
+-
+ #define PCF50633_FEAT_EXTON 0x00000001 /* not yet supported */
+ #define PCF50633_FEAT_MBC 0x00000002
+ #define PCF50633_FEAT_BBC 0x00000004 /* not yet supported */
+Index: linux-2.6.24-rc7/include/linux/pcf506xx.h
+===================================================================
+--- /dev/null
++++ linux-2.6.24-rc7/include/linux/pcf506xx.h
+@@ -0,0 +1,31 @@
++#ifndef _LINUX_PCF506XX_H
++#define _LINUX_PCF506XX_H
++
++
++#define PMU_VRAIL_F_SUSPEND_ON 0x00000001 /* Remains on during suspend */
++#define PMU_VRAIL_F_UNUSED 0x00000002 /* This rail is not used */
++struct pmu_voltage_rail {
++ char *name;
++ unsigned int flags;
++ struct {
++ unsigned int init;
++ unsigned int max;
++ } voltage;
++};
++
++enum pmu_event {
++ PMU_EVT_NONE,
++ PMU_EVT_INSERT,
++ PMU_EVT_REMOVE,
++#ifdef CONFIG_SENSORS_PCF50633
++ PMU_EVT_USB_INSERT,
++ PMU_EVT_USB_REMOVE,
++#endif
++ __NUM_PMU_EVTS
++};
++
++typedef int pmu_cb(struct device *dev, unsigned int feature,
++ enum pmu_event event);
++
++
++#endif /* !_LINUX_PCF506XX_H */
Modified: branches/src/target/kernel/2.6.24.x/patches/series
===================================================================
--- branches/src/target/kernel/2.6.24.x/patches/series 2008-01-17 18:08:02 UTC (rev 3874)
+++ branches/src/target/kernel/2.6.24.x/patches/series 2008-01-17 22:40:29 UTC (rev 3875)
@@ -50,6 +50,8 @@
lis302dl.patch
gta02-leds.patch
gta02-acc.patch
+pcf506xx.patch
+gta02-bt-fixes.patch
# additional local stuff
yaffs2-20070905.patch
More information about the commitlog
mailing list