Send commitlog mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://lists.openmoko.org/mailman/listinfo/commitlog
or, via email, send a message with subject or body 'help' to
[EMAIL PROTECTED]
You can reach the person managing the list at
[EMAIL PROTECTED]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of commitlog digest..."
Today's Topics:
1. r1570 - trunk/src/target/kernel/patches
([EMAIL PROTECTED])
2. r1571 - trunk/src/target/kernel/patches
([EMAIL PROTECTED])
3. r1572 - trunk/oe/packages/uboot ([EMAIL PROTECTED])
4. r1573 - trunk/oe/packages/tasks ([EMAIL PROTECTED])
5. r1574 - trunk/src/host/dfu-util/src ([EMAIL PROTECTED])
6. r1575 - trunk/oe/conf ([EMAIL PROTECTED])
7. r1576 - trunk/oe/packages/upstart ([EMAIL PROTECTED])
8. r1577 - trunk/src/target/kernel/patches
([EMAIL PROTECTED])
--- Begin Message ---
Author: laforge
Date: 2007-03-30 21:02:12 +0200 (Fri, 30 Mar 2007)
New Revision: 1570
Modified:
trunk/src/target/kernel/patches/gta01-jbt6k74.patch
Log:
* use sysfs_{create,remove}_group
* clean up some unrelated Kconfig change that should never have been here
Modified: trunk/src/target/kernel/patches/gta01-jbt6k74.patch
===================================================================
--- trunk/src/target/kernel/patches/gta01-jbt6k74.patch 2007-03-30 13:42:40 UTC
(rev 1569)
+++ trunk/src/target/kernel/patches/gta01-jbt6k74.patch 2007-03-30 19:02:12 UTC
(rev 1570)
@@ -1,10 +1,10 @@
This driver adds support for LCM initialization of the JBT6K74 LCM
as found on the FIC GTA01 hardware
-Index: linux-2.6.20/drivers/spi/Kconfig
+Index: linux-2.6.20.4/drivers/spi/Kconfig
===================================================================
---- linux-2.6.20.orig/drivers/spi/Kconfig 2007-02-17 14:19:37.000000000
+0100
-+++ linux-2.6.20/drivers/spi/Kconfig 2007-02-17 14:20:46.000000000 +0100
+--- linux-2.6.20.4.orig/drivers/spi/Kconfig 2007-03-30 20:45:38.000000000
+0200
++++ linux-2.6.20.4/drivers/spi/Kconfig 2007-03-30 20:45:59.000000000 +0200
@@ -129,5 +129,9 @@
# (slave support would go here)
@@ -15,21 +15,21 @@
+
endmenu # "SPI support"
-Index: linux-2.6.20/drivers/spi/Makefile
+Index: linux-2.6.20.4/drivers/spi/Makefile
===================================================================
---- linux-2.6.20.orig/drivers/spi/Makefile 2007-02-17 14:19:37.000000000
+0100
-+++ linux-2.6.20/drivers/spi/Makefile 2007-02-17 14:20:46.000000000 +0100
+--- linux-2.6.20.4.orig/drivers/spi/Makefile 2007-03-30 20:45:38.000000000
+0200
++++ linux-2.6.20.4/drivers/spi/Makefile 2007-03-30 20:45:59.000000000
+0200
@@ -26,4 +26,5 @@
# ... add above this line ...
# SPI slave drivers (protocol for that link)
+obj-$(CONFIG_SPI_SLAVE_JBT6K74) += jbt6k74.o
# ... add above this line ...
-Index: linux-2.6.20/drivers/spi/jbt6k74.c
+Index: linux-2.6.20.4/drivers/spi/jbt6k74.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6.20/drivers/spi/jbt6k74.c 2007-02-17 14:20:46.000000000 +0100
-@@ -0,0 +1,532 @@
++++ linux-2.6.20.4/drivers/spi/jbt6k74.c 2007-03-30 20:58:36.000000000
+0200
+@@ -0,0 +1,539 @@
+/* Linux kernel driver for the tpo JBT6K74-AS LCM ASIC
+ *
+ * Copyright (C) 2006-2007 by OpenMoko, Inc.
@@ -419,8 +419,6 @@
+static ssize_t gamma_read(struct device *dev, struct device_attribute *attr,
+ char *buf)
+{
-+ int reg = reg_by_string(attr->attr.name);
-+
+ return strlcpy(buf, "N/A\n", PAGE_SIZE);
+}
+
@@ -441,6 +439,19 @@
+static DEVICE_ATTR(gamma_inclination, 0644, gamma_read, gamma_write);
+static DEVICE_ATTR(gamma_blue_offset, 0644, gamma_read, gamma_write);
+
++static struct attribute *jbt_sysfs_entries[] = {
++ &dev_attr_state.attr,
++ &dev_attr_gamma_fine1.attr,
++ &dev_attr_gamma_fine2.attr,
++ &dev_attr_gamma_inclination.attr,
++ &dev_attr_gamma_blue_offset.attr,
++};
++
++static struct attribute_group jbt_attr_group = {
++ .name = NULL,
++ .attrs = jbt_sysfs_entries,
++};
++
+/* linux device model infrastructure */
+
+static int __devinit jbt_probe(struct spi_device *spi)
@@ -472,16 +483,17 @@
+ }
+
+ rc = jbt6k74_enter_state(jbt, JBT_STATE_NORMAL);
-+ if (rc < 0) {
++ if (rc < 0)
+ printk(KERN_WARNING "jbt6k74: cannot enter NORMAL state\n");
-+ }
++
+ jbt6k74_display_onoff(jbt, 1);
+
-+ device_create_file(&spi->dev, &dev_attr_state);
-+ device_create_file(&spi->dev, &dev_attr_gamma_fine1);
-+ device_create_file(&spi->dev, &dev_attr_gamma_fine2);
-+ device_create_file(&spi->dev, &dev_attr_gamma_inclination);
-+ device_create_file(&spi->dev, &dev_attr_gamma_blue_offset);
++ rc = sysfs_create_group(&spi->dev.kobj, &jbt_attr_group);
++ if (rc) {
++ dev_set_drvdata(&spi->dev, NULL);
++ kfree(jbt);
++ return rc;
++ }
+
+ return 0;
+}
@@ -492,12 +504,7 @@
+
+ DEBUGP("entering\n");
+
-+ device_remove_file(&spi->dev, &dev_attr_state);
-+ device_remove_file(&spi->dev, &dev_attr_gamma_fine1);
-+ device_remove_file(&spi->dev, &dev_attr_gamma_fine2);
-+ device_remove_file(&spi->dev, &dev_attr_gamma_inclination);
-+ device_remove_file(&spi->dev, &dev_attr_gamma_blue_offset);
-+
++ sysfs_remove_group(&spi->dev.kobj, &jbt_attr_group);
+ kfree(jbt);
+
+ return 0;
@@ -562,15 +569,15 @@
+
+module_init(jbt_init);
+module_exit(jbt_exit);
-Index: linux-2.6.20/arch/arm/mach-s3c2410/Kconfig
+Index: linux-2.6.20.4/arch/arm/mach-s3c2410/Kconfig
===================================================================
---- linux-2.6.20.orig/arch/arm/mach-s3c2410/Kconfig 2007-02-17
14:20:52.000000000 +0100
-+++ linux-2.6.20/arch/arm/mach-s3c2410/Kconfig 2007-02-17 14:21:13.000000000
+0100
-@@ -89,6 +89,7 @@
- config MACH_GTA01
- bool "FIC Neo1973 GSM Phone"
+--- linux-2.6.20.4.orig/arch/arm/mach-s3c2410/Kconfig 2007-03-30
20:45:38.000000000 +0200
++++ linux-2.6.20.4/arch/arm/mach-s3c2410/Kconfig 2007-03-30
20:58:53.000000000 +0200
+@@ -83,6 +83,7 @@
+ config MACH_QT2410
+ bool "QT2410"
select CPU_S3C2410
+ select SPI_SLAVE_JBT6K74
help
- Say Y here if you are using the FIC Neo1973 GSM Phone
+ Say Y here if you are using the Armzone QT2410
--- End Message ---
--- Begin Message ---
Author: laforge
Date: 2007-03-30 21:11:54 +0200 (Fri, 30 Mar 2007)
New Revision: 1571
Modified:
trunk/src/target/kernel/patches/gta01-jbt6k74.patch
Log:
* add missing NULL terminating entry to sysfs group
Modified: trunk/src/target/kernel/patches/gta01-jbt6k74.patch
===================================================================
--- trunk/src/target/kernel/patches/gta01-jbt6k74.patch 2007-03-30 19:02:12 UTC
(rev 1570)
+++ trunk/src/target/kernel/patches/gta01-jbt6k74.patch 2007-03-30 19:11:54 UTC
(rev 1571)
@@ -28,8 +28,8 @@
Index: linux-2.6.20.4/drivers/spi/jbt6k74.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6.20.4/drivers/spi/jbt6k74.c 2007-03-30 20:58:36.000000000
+0200
-@@ -0,0 +1,539 @@
++++ linux-2.6.20.4/drivers/spi/jbt6k74.c 2007-03-30 21:05:58.000000000
+0200
+@@ -0,0 +1,540 @@
+/* Linux kernel driver for the tpo JBT6K74-AS LCM ASIC
+ *
+ * Copyright (C) 2006-2007 by OpenMoko, Inc.
@@ -445,6 +445,7 @@
+ &dev_attr_gamma_fine2.attr,
+ &dev_attr_gamma_inclination.attr,
+ &dev_attr_gamma_blue_offset.attr,
++ NULL,
+};
+
+static struct attribute_group jbt_attr_group = {
@@ -572,7 +573,7 @@
Index: linux-2.6.20.4/arch/arm/mach-s3c2410/Kconfig
===================================================================
--- linux-2.6.20.4.orig/arch/arm/mach-s3c2410/Kconfig 2007-03-30
20:45:38.000000000 +0200
-+++ linux-2.6.20.4/arch/arm/mach-s3c2410/Kconfig 2007-03-30
20:58:53.000000000 +0200
++++ linux-2.6.20.4/arch/arm/mach-s3c2410/Kconfig 2007-03-30
21:05:37.000000000 +0200
@@ -83,6 +83,7 @@
config MACH_QT2410
bool "QT2410"
--- End Message ---
--- Begin Message ---
Author: mickey
Date: 2007-03-30 21:19:51 +0200 (Fri, 30 Mar 2007)
New Revision: 1572
Modified:
trunk/oe/packages/uboot/uboot-gta01_svn.bb
Log:
* make sure we only try to install lowlevel_foo.bin if it is actually present
Modified: trunk/oe/packages/uboot/uboot-gta01_svn.bb
===================================================================
--- trunk/oe/packages/uboot/uboot-gta01_svn.bb 2007-03-30 19:11:54 UTC (rev
1571)
+++ trunk/oe/packages/uboot/uboot-gta01_svn.bb 2007-03-30 19:19:51 UTC (rev
1572)
@@ -10,7 +10,9 @@
S = "${WORKDIR}/git"
SRC_URI = "git://www.denx.de/git/u-boot.git/;protocol=git \
-
svn://svn.openmoko.org/trunk/src/target/u-boot;module=patches;proto=http"
+
svn://svn.openmoko.org/trunk/src/target/u-boot;module=patches;proto=http \
+ file://uboot-20070311-tools_makefile_ln_sf.patch;patch=1 \
+ "
EXTRA_OEMAKE = "CROSS_COMPILE=${TARGET_PREFIX}"
TARGET_LDFLAGS = ""
@@ -29,7 +31,9 @@
oe_runmake clean
oe_runmake all
mv u-boot.bin u-boot_${mach}.bin
- mv board/neo1973/lowlevel_foo.bin lowlevel_foo_${mach}.bin
+ if [ -f board/neo1973/lowlevel_foo.bin ]; then
+ mv board/neo1973/lowlevel_foo.bin
lowlevel_foo_${mach}.bin
+ fi
done
}
@@ -39,8 +43,10 @@
do
install ${S}/u-boot_${mach}.bin \
${DEPLOY_DIR_IMAGE}/u-boot-${mach}-${PR}.bin
- install ${S}/lowlevel_foo_${mach}.bin \
- ${DEPLOY_DIR_IMAGE}/lowlevel_foo-${mach}-${PR}.bin
+ if [ -f ${S}/lowlevel_foo_${mach}.bin ]; then
+ install ${S}/lowlevel_foo_${mach}.bin \
+ ${DEPLOY_DIR_IMAGE}/lowlevel_foo-${mach}-${PR}.bin
+ fi
done
install -m 0755 tools/mkimage ${STAGING_BINDIR_NATIVE}/uboot-mkimage
}
--- End Message ---
--- Begin Message ---
Author: mickey
Date: 2007-03-30 21:20:23 +0200 (Fri, 30 Mar 2007)
New Revision: 1573
Modified:
trunk/oe/packages/tasks/task-openmoko.bb
Log:
oe/tasks: add rssreader and messages to task-openmoko
Modified: trunk/oe/packages/tasks/task-openmoko.bb
===================================================================
--- trunk/oe/packages/tasks/task-openmoko.bb 2007-03-30 19:19:51 UTC (rev
1572)
+++ trunk/oe/packages/tasks/task-openmoko.bb 2007-03-30 19:20:23 UTC (rev
1573)
@@ -4,7 +4,7 @@
PACKAGE_ARCH = "all"
LICENSE = "MIT"
PROVIDES = "task-openmoko-everything"
-PR = "r31"
+PR = "r32"
PACKAGES = "\
task-openmoko-linux \
@@ -127,6 +127,8 @@
openmoko-contacts \
openmoko-dates \
openmoko-today \
+ openmoko-messages \
+ openmoko-rssreader \
"
#
--- End Message ---
--- Begin Message ---
Author: laforge
Date: 2007-03-30 21:21:03 +0200 (Fri, 30 Mar 2007)
New Revision: 1574
Modified:
trunk/src/host/dfu-util/src/main.c
Log:
* print which configuration is set
* fix typo (Closes: #335)
Modified: trunk/src/host/dfu-util/src/main.c
===================================================================
--- trunk/src/host/dfu-util/src/main.c 2007-03-30 19:20:23 UTC (rev 1573)
+++ trunk/src/host/dfu-util/src/main.c 2007-03-30 19:21:03 UTC (rev 1574)
@@ -575,7 +575,7 @@
}
#if 0
- printf("Setting Configuration...\n");
+ printf("Setting Configuration %u...\n", dif->configuration);
if (usb_set_configuration(dif->dev_handle, dif->configuration) < 0) {
fprintf(stderr, "Cannot set configuration: %s\n",
usb_strerror());
exit(1);
@@ -680,7 +680,7 @@
if (dfu_detach(dif->dev_handle, dif->interface, 1000) < 0) {
fprintf(stderr, "can't detach: %s\n", usb_strerror());
}
- printf("Resetting USB to swithc back to runtime mode\n");
+ printf("Resetting USB to switch back to runtime mode\n");
ret = usb_reset(dif->dev_handle);
if (ret < 0 && ret != -ENODEV) {
fprintf(stderr, "error resetting after download: %s\n",
--- End Message ---
--- Begin Message ---
Author: mickey
Date: 2007-03-30 21:23:01 +0200 (Fri, 30 Mar 2007)
New Revision: 1575
Modified:
trunk/oe/conf/site.conf
Log:
remove openalchemy, those are local changes.
Modified: trunk/oe/conf/site.conf
===================================================================
--- trunk/oe/conf/site.conf 2007-03-30 19:21:03 UTC (rev 1574)
+++ trunk/oe/conf/site.conf 2007-03-30 19:23:01 UTC (rev 1575)
@@ -10,9 +10,7 @@
BBFILE_COLLECTIONS = "upstream openalchemy local"
BBFILE_PATTERN_upstream = "^${OMDIR}/openembedded/"
BBFILE_PATTERN_local = "^${OMDIR}/oe/"
-BBFILE_PATTERN_openalchemy = "^${OMDIR}/oa/"
BBFILE_PRIORITY_upstream = "5"
-BBFILE_PRIORITY_openalchemy = "9"
BBFILE_PRIORITY_local = "10"
BBINCLUDELOGS = "yes"
--- End Message ---
--- Begin Message ---
Author: mickey
Date: 2007-03-30 21:23:34 +0200 (Fri, 30 Mar 2007)
New Revision: 1576
Modified:
trunk/oe/packages/upstart/upstart_0.3.5.bb
Log:
add some update-alternatives related hunks
Modified: trunk/oe/packages/upstart/upstart_0.3.5.bb
===================================================================
--- trunk/oe/packages/upstart/upstart_0.3.5.bb 2007-03-30 19:23:01 UTC (rev
1575)
+++ trunk/oe/packages/upstart/upstart_0.3.5.bb 2007-03-30 19:23:34 UTC (rev
1576)
@@ -2,18 +2,50 @@
HOMEPAGE = "http://upstart.ubuntu.com/"
SECTION = "base"
LICENSE = "GPL"
-PR = "r1"
+PR = "r2"
FILESDIR = "[EMAIL PROTECTED](bb.data.getVar('FILE',d,1))}/files"
SRC_URI = "http://upstart.ubuntu.com/download/upstart-0.3.5.tar.bz2 \
file://upstart-0.3.5-pwrokfail.patch;patch=1 \
"
-inherit autotools
+inherit autotools update-alternatives
-EXTRA_OECONF = "--enable-compat=sysv"
+ALTERNATIVE_NAME = "init"
+ALTERNATIVE_LINK = "${base_sbindir}/init"
+ALTERNATIVE_PATH = "${base_sbindir}/init.upstart"
+ALTERNATIVE_PRIORITY = 60
+EXTRA_OECONF = "--enable-compat=sysv --sbindir=${base_sbindir}
--libdir=${base_libdir}"
+#EXTRA_OECONF = "--enable-compat=sysv"
+
do_configure() {
gnu-configize
oe_runconf
}
+
+do_install() {
+ oe_runmake 'DESTDIR=${D}' install
+ mv ${D}${base_sbindir}/init ${D}${base_sbindir}/init.${PN}
+ # initctl
+ mv ${D}${base_sbindir}/reboot ${D}${base_sbindir}/reboot.${PN}
+ # runlevel
+ mv ${D}${base_sbindir}/shutdown ${D}${base_sbindir}/shutdown.${PN}
+ # telinit
+ mv ${D}${base_sbindir}/halt ${D}${base_sbindir}/halt.${PN}
+ # poweroff
+ # logd
+}
+
+pkg_postinst_${PN} () {
+ update-alternatives --install ${base_sbindir}/halt halt halt.${PN} 200
+ update-alternatives --install ${base_sbindir}/reboot reboot
reboot.${PN} 200
+ update-alternatives --install ${base_sbindir}/shutdown shutdown
shutdown.${PN} 200
+}
+
+pkg_prerm_${PN} () {
+ update-alternatives --remove halt halt.${PN}
+ update-alternatives --remove reboot reboot.${PN}
+ update-alternatives --remove shutdown shutdown.${PN}
+}
+
--- End Message ---
--- Begin Message ---
Author: laforge
Date: 2007-03-30 21:27:11 +0200 (Fri, 30 Mar 2007)
New Revision: 1577
Modified:
trunk/src/target/kernel/patches/gta01-pcf50606.patch
Log:
* introduce platform_data usage for pcf50606 driver
* this makes it less GTA01 specific and rather a more generic pcf50606 driver
Modified: trunk/src/target/kernel/patches/gta01-pcf50606.patch
===================================================================
--- trunk/src/target/kernel/patches/gta01-pcf50606.patch 2007-03-30
19:23:34 UTC (rev 1576)
+++ trunk/src/target/kernel/patches/gta01-pcf50606.patch 2007-03-30
19:27:11 UTC (rev 1577)
@@ -3,8 +3,8 @@
Index: linux-2.6.20.4/drivers/i2c/chips/pcf50606.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6.20.4/drivers/i2c/chips/pcf50606.c 2007-03-27
16:24:25.000000000 +0200
-@@ -0,0 +1,1633 @@
++++ linux-2.6.20.4/drivers/i2c/chips/pcf50606.c 2007-03-30
20:52:22.000000000 +0200
+@@ -0,0 +1,1710 @@
+/* Philips PCF50606 Power Management Unit (PMU) driver
+ *
+ * (C) 2006 by OpenMoko, Inc.
@@ -64,10 +64,6 @@
+#define DEBUGPC(x, args ...)
+#endif
+
-+/* Five seconds of power key press required to shut down */
-+
-+#define PCF50606_ONKEY_SECONDS_REQUIRED 5
-+
+/***********************************************************************
+ * Static data / structures
+ ***********************************************************************/
@@ -94,6 +90,7 @@
+
+struct pcf50606_data {
+ struct i2c_client client;
++ struct pcf50606_platform_data *pdata;
+ struct mutex lock;
+ unsigned int flags;
+ unsigned int working;
@@ -122,6 +119,8 @@
+struct pcf50606_data *pcf50606_global;
+EXPORT_SYMBOL(pcf50606_global);
+
++static struct platform_device *pcf50606_pdev;
++
+/* This is a mitsubishi TN11-3H103J T,B NTC Thermistor -10..79 centigrade */
+static const u_int16_t ntc_table_tn11_3h103j[] = {
+ /* -10 */
@@ -601,7 +600,7 @@
+ pcf->onkey_seconds, reg_read(pcf,
PCF50606_REG_OOCC1));
+ pcf->onkey_seconds++;
+ if (pcf->onkey_seconds >=
-+ PCF50606_ONKEY_SECONDS_REQUIRED) {
++ pcf->pdata->onkey_seconds_required) {
+ /* Ask init to do 'ctrlaltdel' */
+ DEBUGPC("SIGINT(init) ");
+ kill_proc(1, SIGINT, 1);
@@ -611,7 +610,9 @@
+ }
+ if (int1 & PCF50606_INT1_ALARM) {
+ DEBUGPC("ALARM ");
-+ rtc_update_irq(&pcf->rtc->class_dev, 1, RTC_AF | RTC_IRQF);
++ if (pcf->pdata->used_features & PCF50606_FEAT_RTC)
++ rtc_update_irq(&pcf->rtc->class_dev, 1,
++ RTC_AF | RTC_IRQF);
+ }
+
+ if (int2 & PCF50606_INT2_CHGINS) {
@@ -850,6 +851,9 @@
+/* Enable/disable fast charging (500mA in the GTA01) */
+void pcf50606_charge_fast(struct pcf50606_data *pcf, int on)
+{
++ if (!(pcf->pdata->used_features & PCF50606_FEAT_MBC))
++ return;
++
+ if (on) {
+ /* We can allow PCF to automatically charge
+ * using Ifast */
@@ -871,16 +875,14 @@
+}
+EXPORT_SYMBOL(pcf50606_charge_fast);
+
-+#define PCF50606_R_FIXBATT 10000 /* 10 kOhms */
-+#define PCF50606_R_FIXBATT_PAR 10000 /* 10 kOhms */
+#define ONE 1000000
-+static inline u_int16_t adc_to_rntc(u_int16_t adc)
++static inline u_int16_t adc_to_rntc(struct pcf50606_data *pcf, u_int16_t adc)
+{
-+ u_int32_t r_batt = (adc * PCF50606_R_FIXBATT) / (1023 - adc);
++ u_int32_t r_batt = (adc * pcf->pdata->r_fix_batt) / (1023 - adc);
+ u_int16_t r_ntc;
+
+ /* The battery NTC has a parallell 10kOhms resistor */
-+ r_ntc = ONE / ((ONE/r_batt) - (ONE/PCF50606_R_FIXBATT_PAR));
++ r_ntc = ONE / ((ONE/r_batt) - (ONE/pcf->pdata->r_fix_batt_par));
+
+ return r_ntc;
+}
@@ -905,16 +907,16 @@
+
+ adc = adc_read(pcf, PCF50606_ADCMUX_BATTEMP, NULL);
+
-+ return sprintf(buf, "%d\n", rntc_to_temp(adc_to_rntc(adc)));
++ return sprintf(buf, "%d\n", rntc_to_temp(adc_to_rntc(pcf, adc)));
+}
+static DEVICE_ATTR(battemp, S_IRUGO | S_IWUSR, show_battemp, NULL);
+
-+#define MULT_R_SENSE_1024 225 /* 0.22 Ohms * 1024 */
-+static inline u_int16_t adc_to_chg_milliamps(u_int16_t adc_adcin1,
++static inline u_int16_t adc_to_chg_milliamps(struct pcf50606_data *pcf,
++ u_int16_t adc_adcin1,
+ u_int16_t adc_batvolt)
+{
+ u_int32_t res = ((adc_adcin1 - adc_batvolt) * 6000);
-+ return res / MULT_R_SENSE_1024;
++ return res / (pcf->pdata->r_sense_milli * 1024 / 1000);
+}
+
+static ssize_t show_chgcur(struct device *dev, struct device_attribute *attr,
@@ -927,7 +929,7 @@
+
+ adc_batvolt = adc_read(pcf, PCF50606_ADCMUX_BATVOLT_ADCIN1,
+ &adc_adcin1);
-+ ma = adc_to_chg_milliamps(adc_adcin1, adc_batvolt);
++ ma = adc_to_chg_milliamps(pcf, adc_adcin1, adc_batvolt);
+
+ return sprintf(buf, "%u\n", ma);
+}
@@ -1357,12 +1359,7 @@
+};
+#endif
+
-+static struct attribute *pcf_sysfs_entries[] = {
-+ &dev_attr_battvolt.attr,
-+ &dev_attr_battemp.attr,
-+ &dev_attr_chgcur.attr,
-+ &dev_attr_chgstate.attr,
-+ &dev_attr_chgmode.attr,
++static struct attribute *pcf_sysfs_entries[15] = {
+ &dev_attr_voltage_dcd.attr,
+ &dev_attr_voltage_dcde.attr,
+ &dev_attr_voltage_dcud.attr,
@@ -1379,15 +1376,49 @@
+ .attrs = pcf_sysfs_entries,
+};
+
++static void populate_sysfs_group(struct pcf50606_data *pcf)
++{
++ int i = 0;
++ struct attribute *attr;
++
++ for (attr = pcf_sysfs_entries[0]; attr; attr++)
++ i++;
++
++ if (pcf->pdata->used_features & PCF50606_FEAT_MBC) {
++ pcf_sysfs_entries[i++] = &dev_attr_chgstate.attr;
++ pcf_sysfs_entries[i++] = &dev_attr_chgmode.attr;
++ }
++
++ if (pcf->pdata->used_features & PCF50606_FEAT_CHGCUR)
++ pcf_sysfs_entries[i++] = &dev_attr_chgcur.attr;
++
++ if (pcf->pdata->used_features & PCF50606_FEAT_BATVOLT)
++ pcf_sysfs_entries[i++] = &dev_attr_battvolt.attr;
++
++ if (pcf->pdata->used_features & PCF50606_FEAT_BATTEMP)
++ pcf_sysfs_entries[i++] = &dev_attr_battemp.attr;
++}
++
+static int pcf50606_detect(struct i2c_adapter *adapter, int address, int kind)
+{
+ struct i2c_client *new_client;
-+ struct pcf50606_platform_data *pdata;
+ struct pcf50606_data *data;
+ int err = 0;
++ int irq;
+
+ DEBUGP("entering\n");
++ if (!pcf50606_pdev) {
++ printk(KERN_ERR
++ "pcf50606: this driver needs a platform_device!\n");
++ return -EIO;
++ }
+
++ irq = platform_get_irq(pcf50606_pdev, 0);
++ if (irq < 0) {
++ dev_err(&pcf50606_pdev->dev, "no irq in platform resources!\n");
++ return -EIO;
++ }
++
+ /* At the moment, we only support one PCF50606 in a system */
+ if (pcf50606_global) {
+ printk(KERN_ERR
@@ -1402,6 +1433,8 @@
+ INIT_WORK(&data->work, pcf50606_work);
+ data->working = 0;
+ data->onkey_seconds = -1;
++ data->pdata = pcf50606_pdev->dev.platform_data;
++
+ new_client = &data->client;
+ i2c_set_clientdata(new_client, data);
+ new_client->addr = address;
@@ -1420,6 +1453,8 @@
+
+ pcf50606_global = data;
+
++ populate_sysfs_group(data);
++
+ err = sysfs_create_group(&new_client->dev.kobj, &pcf_attr_group);
+ if (err) {
+ dev_err(&new_client->dev, "error creating sysfs group\n");
@@ -1436,29 +1471,33 @@
+ reg_write(data, PCF50606_REG_INT2M, 0x00);
+ reg_write(data, PCF50606_REG_INT3M, PCF50606_INT3_TSCPRES);
+
-+ /* FIXME: make this IRQ a resource */
-+ set_irq_type(GTA01_IRQ_PCF50606, IRQT_FALLING);
-+ err = request_irq(GTA01_IRQ_PCF50606, pcf50606_irq, SA_INTERRUPT,
++ err = request_irq(irq, pcf50606_irq, SA_INTERRUPT,
+ "pcf50606", data);
+ if (err < 0)
+ goto exit_sysfs;
+
-+ if (enable_irq_wake(GTA01_IRQ_PCF50606) < 0)
++ set_irq_type(irq, IRQT_FALLING);
++
++ if (enable_irq_wake(irq) < 0)
+ printk(KERN_ERR "PCF50606: IRQ %u cannot be enabled as wake-up"
-+ "source in this hardware revision!");
++ "source in this hardware revision!", irq);
+
-+ data->rtc = rtc_device_register("pcf50606", &new_client->dev,
-+ &pcf50606_rtc_ops, THIS_MODULE);
-+ if (IS_ERR(data->rtc)) {
-+ err = PTR_ERR(data->rtc);
-+ goto exit_irq;
++ if (data->pdata->used_features & PCF50606_FEAT_RTC) {
++ data->rtc = rtc_device_register("pcf50606", &new_client->dev,
++ &pcf50606_rtc_ops, THIS_MODULE);
++ if (IS_ERR(data->rtc)) {
++ err = PTR_ERR(data->rtc);
++ goto exit_irq;
++ }
+ }
+
-+ err = misc_register(&pcf50606_wdt_miscdev);
-+ if (err) {
-+ printk(KERN_ERR "cannot register miscdev on minor=%d (%d)\n",
-+ WATCHDOG_MINOR, err);
-+ goto exit_rtc;
++ if (data->pdata->used_features & PCF50606_FEAT_WDT) {
++ err = misc_register(&pcf50606_wdt_miscdev);
++ if (err) {
++ printk(KERN_ERR "cannot register miscdev on \n"
++ "minor=%d (%d)\n", WATCHDOG_MINOR, err);
++ goto exit_rtc;
++ }
+ }
+
+ data->input_dev = input_allocate_device();
@@ -1491,9 +1530,11 @@
+
+ return 0;
+exit_misc:
-+ misc_deregister(&pcf50606_wdt_miscdev);
++ if (data->pdata->used_features & PCF50606_FEAT_WDT)
++ misc_deregister(&pcf50606_wdt_miscdev);
+exit_rtc:
-+ rtc_device_unregister(pcf50606_global->rtc);
++ if (data->pdata->used_features & PCF50606_FEAT_RTC)
++ rtc_device_unregister(pcf50606_global->rtc);
+exit_irq:
+ free_irq(GTA01_IRQ_PCF50606, pcf50606_global);
+exit_sysfs:
@@ -1520,9 +1561,14 @@
+
+ apm_get_power_status = NULL;
+ input_unregister_device(pcf->input_dev);
-+ misc_deregister(&pcf50606_wdt_miscdev);
++
++ if (pcf->pdata->used_features & PCF50606_FEAT_WDT)
++ misc_deregister(&pcf50606_wdt_miscdev);
++
+ free_irq(GTA01_IRQ_PCF50606, pcf);
-+ rtc_device_unregister(pcf->rtc);
++
++ if (pcf->pdata->used_features & PCF50606_FEAT_RTC)
++ rtc_device_unregister(pcf->rtc);
+ pm_power_off = NULL;
+
+ sysfs_remove_group(&client->dev.kobj, &pcf_attr_group);
@@ -1621,18 +1667,49 @@
+ .detach_client = &pcf50606_detach_client,
+};
+
++/* platform driver, since i2c devices don't have platform_data */
++static int __init pcf50606_plat_probe(struct platform_device *pdev)
++{
++ struct pcf50606_platform_data *pdata = pdev->dev.platform_data;
++
++ if (!pdata)
++ return -ENODEV;
++
++ pcf50606_pdev = pdev;
++
++ return 0;
++}
++
++static int pcf50606_plat_remove(struct platform_device *pdev)
++{
++ return 0;
++}
++
++static struct platform_driver pcf50606_plat_driver = {
++ .probe = pcf50606_plat_probe,
++ .remove = pcf50606_plat_remove,
++ .driver = {
++ .owner = THIS_MODULE,
++ .name = "pcf50606",
++ },
++};
++
+static int __init pcf50606_init(void)
+{
-+ DEBUGP("entering, calling i2c_add_driver\n");
-+ return i2c_add_driver(&pcf50606_driver);
++ int rc;
++
++ if (!(rc = platform_driver_register(&pcf50606_plat_driver)))
++ rc = i2c_add_driver(&pcf50606_driver);
++
++ return rc;
+}
+
-+static void __exit pcf50606_exit(void)
++static void pcf50606_exit(void)
+{
+ i2c_del_driver(&pcf50606_driver);
++ platform_driver_unregister(&pcf50606_plat_driver);
+}
+
-+
+MODULE_AUTHOR("Harald Welte <[EMAIL PROTECTED]>");
+MODULE_LICENSE("GPL");
+
@@ -1951,8 +2028,8 @@
Index: linux-2.6.20.4/include/linux/pcf50606.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6.20.4/include/linux/pcf50606.h 2007-03-26 19:01:17.000000000
+0200
-@@ -0,0 +1,56 @@
++++ linux-2.6.20.4/include/linux/pcf50606.h 2007-03-30 20:51:20.000000000
+0200
+@@ -0,0 +1,86 @@
+#ifndef _LINUX_PCF50606_H
+#define _LINUX_PCF50606_H
+
@@ -1999,10 +2076,40 @@
+extern void
+pcf50606_charge_fast(struct pcf50606_data *pcf, int on);
+
++struct pmu_voltage_rail {
++ char *name;
++ struct {
++ unsigned int init;
++ unsigned int max;
++ } voltage;
++};
++
++#define PCF50606_FEAT_EXTON 0x00000001 /* not yet supported */
++#define PCF50606_FEAT_MBC 0x00000002
++#define PCF50606_FEAT_BBC 0x00000004 /* not yet supported */
++#define PCF50606_FEAT_TSC 0x00000008 /* not yet supported */
++#define PCF50606_FEAT_WDT 0x00000010
++#define PCF50606_FEAT_ACD 0x00000020
++#define PCF50606_FEAT_RTC 0x00000040
++#define PCF50606_FEAT_PWM 0x00000080
++#define PCF50606_FEAT_CHGCUR 0x00000100
++#define PCF50606_FEAT_BATVOLT 0x00000200
++#define PCF50606_FEAT_BATTEMP 0x00000400
++
+struct pcf50606_platform_data {
-+ unsigned int irq;
-+ unsigned int initial_voltage[__NUM_PCF50606_REGULATORS];
++ /* general */
++ unsigned int used_features;
++ unsigned int onkey_seconds_required;
+
++ /* voltage regulator related */
++ struct pmu_voltage_rail rails[__NUM_PCF50606_REGULATORS];
++ unsigned int used_regulators;
++
++ /* charger related */
++ unsigned int r_fix_batt;
++ unsigned int r_fix_batt_par;
++ unsigned int r_sense_milli;
++
+ struct {
+ u_int8_t mbcc3; /* charger voltage / current */
+ } charger;
--- End Message ---
_______________________________________________
commitlog mailing list
[email protected]
http://lists.openmoko.org/mailman/listinfo/commitlog