aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormerge <null@invalid>2008-12-05 09:59:34 +0000
committerAndy Green <agreen@pads.home.warmcat.com>2008-12-05 09:59:34 +0000
commit361fff778b7c4d2c78f28833415335148d86a1aa (patch)
treee616c940a691b9ff548b1aaeb747eae8a1342509
parent5adc83c203167f77dd9b975ee275e3014287d6c7 (diff)
MERGE-via-pending-tracking-hist-MERGE-via-stable-tracking-build-fix-path-to-toolchain-on-1228470136
pending-tracking-hist top was MERGE-via-stable-tracking-build-fix-path-to-toolchain-on-1228470136 / 21b67ab8e79998b0a534263282dab1dda0f11b00 ... parent commitmessage: From: merge <null@invalid> MERGE-via-stable-tracking-hist-build-fix-path-to-toolchain-on stable-tracking-hist top was build-fix-path-to-toolchain-on / ca14ba894df9b28822066c578dde48d7dbe931de ... parent commitmessage: From: Andy Green <andy@openmoko.com> build-fix-path-to-toolchain-one-at-last.patch Signed-off-by: Andy Green <andy@openmoko.com>
-rw-r--r--arch/arm/plat-s3c/pm.c2
-rw-r--r--arch/arm/plat-s3c24xx/pm.c1
-rwxr-xr-xbuild27
-rw-r--r--drivers/input/misc/Kconfig6
-rw-r--r--drivers/input/misc/Makefile1
-rw-r--r--drivers/input/misc/pcf50606-input.c123
-rw-r--r--drivers/mfd/pcf50633-adc.c23
-rw-r--r--drivers/mfd/pcf50633-core.c39
-rw-r--r--drivers/mfd/pcf50633-gpio.c9
-rw-r--r--drivers/rtc/rtc-pcf50606.c3
-rw-r--r--drivers/rtc/rtc-pcf50633.c3
-rw-r--r--include/linux/mfd/pcf50633/core.h1
-rw-r--r--include/linux/mfd/pcf50633/gpio.h10
13 files changed, 210 insertions, 38 deletions
diff --git a/arch/arm/plat-s3c/pm.c b/arch/arm/plat-s3c/pm.c
index 7f6e651fe3c..3091837d177 100644
--- a/arch/arm/plat-s3c/pm.c
+++ b/arch/arm/plat-s3c/pm.c
@@ -357,7 +357,7 @@ static int s3c_pm_begin(suspend_state_t state)
static struct platform_suspend_ops s3c_pm_ops = {
.enter = s3c_pm_enter,
.valid = suspend_valid_only_mem,
- .begin = s3c_pm_begin,
+ .begin = s3c_pm_begin,
};
/* s3c_pm_init
diff --git a/arch/arm/plat-s3c24xx/pm.c b/arch/arm/plat-s3c24xx/pm.c
index 6ed53b9b2e5..e28d9bc22ae 100644
--- a/arch/arm/plat-s3c24xx/pm.c
+++ b/arch/arm/plat-s3c24xx/pm.c
@@ -144,3 +144,4 @@ void s3c_pm_save_core(void)
s3c_pm_do_save(misc_save, ARRAY_SIZE(misc_save));
s3c_pm_do_save(core_save, ARRAY_SIZE(core_save));
}
+
diff --git a/build b/build
index a0f60e520f7..1726b2d5361 100755
--- a/build
+++ b/build
@@ -1,10 +1,20 @@
#!/bin/sh
+#
+# Kernel building helper script (C)2008 Openmoko, Inc
+# Andy Green <andy@openmoko.org>
+#
+# Licensed under GPLv3 or later
+#
# set -x
-export CROSS_COMPILE=../../cross/bin/arm-angstrom-linux-gnueabi-
+export CROSS_COMPILE=/usr/local/openmoko/arm/bin/arm-angstrom-linux-gnueabi-
make ARCH=arm silentoldconfig
+#
+# figure out what we are building
+#
+
PRODUCT=
if [ ! -z "`grep CONFIG_MACH_NEO1973_GTA01=y .config`" ] ; then
@@ -32,6 +42,11 @@ if [ -z "$PRODUCT" ] ; then
exit 1
fi
+#
+# get the branch and head hash for the version we are building to
+# allow source tracability
+#
+
VERSION=
if [ -d .git ] ; then
HEAD=`git show --pretty=oneline | head -n1 | cut -d' ' -f1 | cut -b1-16`
@@ -42,7 +57,17 @@ fi
echo $MKIMAGECMD
+#
+# actually make it
+#
+
if make -j5 ARCH=arm CONFIG_DEBUG_SECTION_MISMATCH=y EXTRAVERSION=$VERSION; then
+
+ #
+ # if the build is happy, postprocess it by strip and with U-Boot header wrapper
+ # you can get mkimage from U-Boot or Qi build
+ #
+
${CROSS_COMPILE}objcopy -O binary -R .note -R .comment -S arch/arm/boot/compressed/vmlinux linux.bin
mkimage -A arm -O linux -T kernel -C none -a $START -e $START -n "OM $PRODUCT $BRANCH""_$HEAD" -d linux.bin uImage-$PRODUCT.bin
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index cdf0bfcebc7..ab69a5bb98d 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -235,4 +235,10 @@ config INPUT_PCF50633_PMU
help
Say Y to include support for input events on NXP PCF50633.
+config INPUT_PCF50606_PMU
+ tristate "PCF50606 PMU events"
+ depends on MFD_PCF50606
+ help
+ Say Y to include support for input events on NXP PCF50606.
+
endif
diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile
index f0ef98e23af..0884b84c29a 100644
--- a/drivers/input/misc/Makefile
+++ b/drivers/input/misc/Makefile
@@ -23,3 +23,4 @@ obj-$(CONFIG_INPUT_APANEL) += apanel.o
obj-$(CONFIG_INPUT_SGI_BTNS) += sgi_btns.o
obj-$(CONFIG_INPUT_LIS302DL) += lis302dl.o
obj-$(CONFIG_INPUT_PCF50633_PMU) += pcf50633-input.o
+obj-$(CONFIG_INPUT_PCF50606_PMU) += pcf50606-input.o
diff --git a/drivers/input/misc/pcf50606-input.c b/drivers/input/misc/pcf50606-input.c
new file mode 100644
index 00000000000..0e4564c4c82
--- /dev/null
+++ b/drivers/input/misc/pcf50606-input.c
@@ -0,0 +1,123 @@
+/* Philips PCF50606 Input Driver
+ *
+ * (C) 2006-2008 by Openmoko, Inc.
+ * Author: Balaji Rao <balajirrao@openmoko.org>
+ * All rights reserved.
+ *
+ * Broken down from monstrous PCF50606 driver mainly by
+ * Harald Welte, Matt Hsu, Andy Green and Werner Almesberger
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * 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 060, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <linux/input.h>
+
+#include <linux/mfd/pcf50606/core.h>
+#include <linux/mfd/pcf50606/input.h>
+
+static void
+pcf50606_input_irq(struct pcf50606 *pcf, int irq, void *data)
+{
+ struct input_dev *input_dev = pcf->input.input_dev;
+ int onkey_released;
+
+ /* We report only one event depending on if the key status */
+ onkey_released = pcf50606_reg_read(pcf, PCF50606_REG_OOCS) &
+ PCF50606_OOCS_ONKEY;
+
+ if (irq == PCF50606_IRQ_ONKEYF && !onkey_released)
+ input_report_key(input_dev, KEY_POWER, 1);
+ else if (irq == PCF50606_IRQ_ONKEYR && onkey_released)
+ input_report_key(input_dev, KEY_POWER, 0);
+
+ input_sync(input_dev);
+}
+
+int __init pcf50606_input_probe(struct platform_device *pdev)
+{
+ struct pcf50606 *pcf;
+ struct input_dev *input_dev;
+ int ret;
+
+ pcf = platform_get_drvdata(pdev);
+
+ input_dev = input_allocate_device();
+ if (!input_dev)
+ return -ENODEV;
+
+ input_dev->name = "PCF50606 PMU events";
+ input_dev->id.bustype = BUS_I2C;
+
+ input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_PWR);
+ set_bit(KEY_POWER, input_dev->keybit);
+ set_bit(KEY_POWER2, input_dev->keybit);
+
+ ret = input_register_device(input_dev);
+ if (ret)
+ goto out;
+
+ pcf->input.input_dev = input_dev;
+
+ /* Currently we care only about ONKEY and USBINS/USBREM
+ *
+ * USBINS/USBREM are told to us by mbc driver as we can't setup
+ * two handlers for an IRQ
+ */
+ pcf->irq_handler[PCF50606_IRQ_ONKEYR].handler = pcf50606_input_irq;
+
+ pcf->irq_handler[PCF50606_IRQ_ONKEYF].handler = pcf50606_input_irq;
+
+ return 0;
+
+out:
+ input_free_device(input_dev);
+ return ret;
+}
+
+static int __devexit pcf50606_input_remove(struct platform_device *pdev)
+{
+ struct pcf50606 *pcf;
+
+ pcf = platform_get_drvdata(pdev);
+ input_unregister_device(pcf->input.input_dev);
+
+ return 0;
+}
+
+struct platform_driver pcf50606_input_driver = {
+ .driver = {
+ .name = "pcf50606-input",
+ },
+ .probe = pcf50606_input_probe,
+ .remove = __devexit_p(pcf50606_input_remove),
+};
+
+static int __init pcf50606_input_init(void)
+{
+ return platform_driver_register(&pcf50606_input_driver);
+}
+module_init(pcf50606_input_init);
+
+static void __exit pcf50606_input_exit(void)
+{
+ platform_driver_unregister(&pcf50606_input_driver);
+}
+module_exit(pcf50606_input_exit);
+
+MODULE_AUTHOR("Balaji Rao <balajirrao@openmoko.org>");
+MODULE_DESCRIPTION("PCF50606 input driver");
+MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:pcf50606-input");
diff --git a/drivers/mfd/pcf50633-adc.c b/drivers/mfd/pcf50633-adc.c
index ebd3792e778..e3d4eb1c03f 100644
--- a/drivers/mfd/pcf50633-adc.c
+++ b/drivers/mfd/pcf50633-adc.c
@@ -23,6 +23,11 @@
* MA 02111-1307 USA
*/
+/*
+ * NOTE: This driver does not yet support subtractive ADC mode, which means
+ * you can do only one measurement per read request.
+ */
+
#include <linux/mfd/pcf50633/core.h>
#include <linux/mfd/pcf50633/adc.h>
@@ -115,7 +120,7 @@ int pcf50633_adc_sync_read(struct pcf50633 *pcf, int mux, int avg)
struct pcf50633_adc_request *req;
int result;
- /* req is freed when the result is ready, in pcf50633_work*/
+ /* req is freed when the result is ready, in interrupt handler */
req = kzalloc(sizeof(*req), GFP_KERNEL);
if (!req)
return -ENOMEM;
@@ -141,7 +146,7 @@ int pcf50633_adc_async_read(struct pcf50633 *pcf, int mux, int avg,
{
struct pcf50633_adc_request *req;
- /* req is freed when the result is ready, in pcf50633_work*/
+ /* req is freed when the result is ready, in interrupt handler */
req = kmalloc(sizeof(*req), GFP_KERNEL);
if (!req)
return -ENOMEM;
@@ -159,12 +164,16 @@ EXPORT_SYMBOL_GPL(pcf50633_adc_async_read);
static int adc_result(struct pcf50633 *pcf)
{
- u16 ret = (pcf50633_reg_read(pcf, PCF50633_REG_ADCS1) << 2) |
- (pcf50633_reg_read(pcf, PCF50633_REG_ADCS3) &
- PCF50633_ADCS3_ADCDAT1L_MASK);
- dev_info(pcf->dev, "adc result = %d\n", ret);
+ u8 adcs1, adcs3;
+ u16 result;
+
+ adcs1 = pcf50633_reg_read(pcf, PCF50633_REG_ADCS1);
+ adcs3 = pcf50633_reg_read(pcf, PCF50633_REG_ADCS3);
+ result = (adcs1 << 2) | (adcs3 & PCF50633_ADCS3_ADCDAT1L_MASK);
- return ret;
+ dev_info(pcf->dev, "adc result = %d\n", result);
+
+ return result;
}
static void pcf50633_adc_irq(struct pcf50633 *pcf, int irq, void *unused)
diff --git a/drivers/mfd/pcf50633-core.c b/drivers/mfd/pcf50633-core.c
index 891f7623377..6634558ea91 100644
--- a/drivers/mfd/pcf50633-core.c
+++ b/drivers/mfd/pcf50633-core.c
@@ -28,12 +28,8 @@
#include <linux/interrupt.h>
#include <linux/workqueue.h>
#include <linux/platform_device.h>
+
#include <linux/mfd/pcf50633/core.h>
-#include <linux/mfd/pcf50633/adc.h>
-#include <linux/mfd/pcf50633/rtc.h>
-#include <linux/mfd/pcf50633/mbc.h>
-#include <linux/mfd/pcf50633/input.h>
-#include <linux/mfd/pcf50633/pmic.h>
/* Read a block of upto 32 regs */
int pcf50633_read_block(struct pcf50633 *pcf , u8 reg,
@@ -303,7 +299,7 @@ static void pcf50633_irq_worker(struct work_struct *work)
/* Some revisions of the chip don't have a 8s standby mode on
* ONKEY1S press. We try to manually do it in such cases. */
- if (pcf_int[0] & PCF50633_INT1_SECOND && pcf->onkey1s_held) {
+ if ((pcf_int[0] & PCF50633_INT1_SECOND) && pcf->onkey1s_held) {
dev_info(pcf->dev, "ONKEY1S held for %d secs\n",
pcf->onkey1s_held);
if (pcf->onkey1s_held++ == PCF50633_ONKEY1S_TIMEOUT)
@@ -320,11 +316,11 @@ static void pcf50633_irq_worker(struct work_struct *work)
PCF50633_INT1_SECOND);
/* Unmask IRQ_ONKEYR */
- pcf50633_reg_clear_bits(pcf, PCF50633_REG_INT1M,
- PCF50633_INT1_SECOND);
+ pcf50633_reg_clear_bits(pcf, PCF50633_REG_INT2M,
+ PCF50633_INT2_ONKEYR);
}
- if (pcf_int[1] & PCF50633_INT2_ONKEYR & pcf->onkey1s_held) {
+ if ((pcf_int[1] & PCF50633_INT2_ONKEYR) && pcf->onkey1s_held) {
pcf->onkey1s_held = 0;
/* Mask SECOND and ONKEYR interrupts */
@@ -351,19 +347,18 @@ static void pcf50633_irq_worker(struct work_struct *work)
pcf->resume_reason[i] = pcf_int[i] &
pcf->pdata->resumers[i];
- /* Make sure we don't pass on any input events to
+ /* Make sure we don't pass on any ONKEY events to
* userspace now */
- pcf_int[1] = 0;
+ pcf_int[1] &= ~ (PCF50633_INT2_ONKEYR | PCF50633_INT2_ONKEYF);
}
/* Unset masked interrupts */
- for (i = 0; i < 5; i++)
+ for (i = 0; i < ARRAY_SIZE(pcf_int); i++) {
pcf_int[i] &= ~pcf->mask_regs[i];
-
- for (i = 0; i < ARRAY_SIZE(pcf_int); i++)
for (j = 0; j < 8 ; j++)
if (pcf_int[i] & (1 << j))
pcf50633_irq_call_handler(pcf, (i * 8) + j);
+ }
put_device(pcf->dev);
@@ -434,7 +429,8 @@ static int pcf50633_suspend(struct device *dev, pm_message_t state)
cancel_work_sync(&pcf->irq_work);
/* Save the masks */
- ret = pcf50633_read_block(pcf, PCF50633_REG_INT1M, 5,
+ ret = pcf50633_read_block(pcf, PCF50633_REG_INT1M,
+ ARRAY_SIZE(pcf->suspend_irq_masks),
pcf->suspend_irq_masks);
if (ret < 0)
dev_err(pcf->dev, "error saving irq masks\n");
@@ -442,10 +438,10 @@ static int pcf50633_suspend(struct device *dev, pm_message_t state)
/* Set interrupt masks. So that only those sources we want to wake
* us up can
*/
- for (i = 0; i < 5; i++)
+ for (i = 0; i < ARRAY_SIZE(res); i++)
res[i] = ~pcf->pdata->resumers[i];
- pcf50633_write_block(pcf, PCF50633_REG_INT1M, 5, &res[0]);
+ pcf50633_write_block(pcf, PCF50633_REG_INT1M, ARRAY_SIZE(res), &res[0]);
pcf->is_suspended = 1;
@@ -459,13 +455,16 @@ static int pcf50633_resume(struct device *dev)
pcf = dev_get_drvdata(dev);
/* Write the saved mask registers */
- pcf50633_write_block(pcf, PCF50633_REG_INT1M, 5,
+ pcf50633_write_block(pcf, PCF50633_REG_INT1M,
+ ARRAY_SIZE(pcf->suspend_irq_masks),
pcf->suspend_irq_masks);
get_device(pcf->dev);
- /* Clear any pending interrupts and set resume reason if any */
- /* this will leave with enable_irq() */
+ /*
+ * Clear any pending interrupts and set resume reason if any.
+ * This will leave with enable_irq()
+ */
pcf50633_irq_worker(&pcf->irq_work);
return 0;
diff --git a/drivers/mfd/pcf50633-gpio.c b/drivers/mfd/pcf50633-gpio.c
index a7117fa6282..55139071d22 100644
--- a/drivers/mfd/pcf50633-gpio.c
+++ b/drivers/mfd/pcf50633-gpio.c
@@ -42,7 +42,7 @@ int pcf50633_gpio_get(struct pcf50633 *pcf, int gpio)
u8 reg, val;
reg = gpio - PCF50633_GPIO1 + PCF50633_REG_GPIO1CFG;
- val = pcf50633_reg_read(pcf, reg);
+ val = pcf50633_reg_read(pcf, reg) & 0x07;
return val;
}
@@ -55,7 +55,7 @@ void pcf50633_gpio_invert_set(struct pcf50633 *pcf, int gpio, int invert)
reg = gpio - PCF50633_GPIO1 + PCF50633_REG_GPIO1CFG;
val = !!invert << 3;
- pcf50633_reg_set_bit_mask(pcf, reg, val, val);
+ pcf50633_reg_set_bit_mask(pcf, reg, 1 << 3, val);
}
EXPORT_SYMBOL_GPL(pcf50633_gpio_invert_set);
@@ -87,13 +87,14 @@ static const u8 pcf50633_regulator_registers[PCF50633_NUM_REGULATORS] = {
void pcf50633_gpio_power_supply_set(struct pcf50633 *pcf,
int gpio, int regulator, int on)
{
- u8 reg, val;
+ u8 reg, val, mask;
/* the *ENA register is always one after the *OUT register */
reg = pcf50633_regulator_registers[regulator] + 1;
val = (!!on << (gpio - PCF50633_GPIO1));
+ mask = (1 << (gpio - PCF50633_GPIO1));
- pcf50633_reg_set_bit_mask(pcf, reg, val, val);
+ pcf50633_reg_set_bit_mask(pcf, reg, mask, val);
}
EXPORT_SYMBOL_GPL(pcf50633_gpio_power_supply_set);
diff --git a/drivers/rtc/rtc-pcf50606.c b/drivers/rtc/rtc-pcf50606.c
index 498ec77c82f..841ea28ca56 100644
--- a/drivers/rtc/rtc-pcf50606.c
+++ b/drivers/rtc/rtc-pcf50606.c
@@ -207,6 +207,9 @@ static int pcf50606_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
rtc2pcf_time(&pcf_tm, &alrm->time);
+ /* do like mktime does and ignore tm_wday */
+ pcf_tm.time[PCF50606_TI_WKDAY] = 7;
+
alarm_masked = pcf50606_irq_mask_get(pcf, PCF50606_IRQ_ALARM);
/* disable alarm interrupt */
diff --git a/drivers/rtc/rtc-pcf50633.c b/drivers/rtc/rtc-pcf50633.c
index 00b159920b4..e1576d24254 100644
--- a/drivers/rtc/rtc-pcf50633.c
+++ b/drivers/rtc/rtc-pcf50633.c
@@ -207,6 +207,9 @@ static int pcf50633_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
rtc2pcf_time(&pcf_tm, &alrm->time);
+ /* do like mktime does and ignore tm_wday */
+ pcf_tm.time[PCF50633_TI_WKDAY] = 7;
+
alarm_masked = pcf50633_irq_mask_get(pcf, PCF50633_IRQ_ALARM);
/* disable alarm interrupt */
diff --git a/include/linux/mfd/pcf50633/core.h b/include/linux/mfd/pcf50633/core.h
index 8c550895a5a..bf107d3794e 100644
--- a/include/linux/mfd/pcf50633/core.h
+++ b/include/linux/mfd/pcf50633/core.h
@@ -24,6 +24,7 @@
#include <linux/mfd/pcf50633/mbc.h>
#include <linux/mfd/pcf50633/rtc.h>
#include <linux/mfd/pcf50633/adc.h>
+#include <linux/mfd/pcf50633/gpio.h>
struct pcf50633;
diff --git a/include/linux/mfd/pcf50633/gpio.h b/include/linux/mfd/pcf50633/gpio.h
index da74df6d849..6ba3951c54d 100644
--- a/include/linux/mfd/pcf50633/gpio.h
+++ b/include/linux/mfd/pcf50633/gpio.h
@@ -38,13 +38,13 @@ enum pcf50633_reg_gpocfg {
struct pcf50633;
-extern void pcf50633_gpio_set(struct pcf50633 *pcf, int gpio, int on);
-extern int pcf50633_gpio_get(struct pcf50633 *pcf, int gpio);
+void pcf50633_gpio_set(struct pcf50633 *pcf, int gpio, int on);
+int pcf50633_gpio_get(struct pcf50633 *pcf, int gpio);
-extern void pcf50633_gpio_invert_set(struct pcf50633 *, int gpio, int invert);
-extern int pcf50633_gpio_invert_get(struct pcf50633 *pcf, int gpio);
+void pcf50633_gpio_invert_set(struct pcf50633 *, int gpio, int invert);
+int pcf50633_gpio_invert_get(struct pcf50633 *pcf, int gpio);
-extern void pcf50633_gpio_power_supply_set(struct pcf50633 *,
+void pcf50633_gpio_power_supply_set(struct pcf50633 *,
int gpio, int regulator, int on);
#endif /* __LINUX_MFD_PCF50633_GPIO_H */