Re: [Zaurus-devel] latest angstrom image + linux-2.6.38.4 report

2011-05-21 Thread Stanislav Brabec
Pavel Machek wrote:

 Umm, can you raise the issue on linux-input? New kernel should not
 break old tslib...

They probably know, why they increased EV_VERSION. If we are sure that
that change does not break tslib, we should patch tslib to accept both
versions.

-- 


Stanislav Brabec
http://www.penguin.cz/~utx/zaurus


___
Zaurus-devel mailing list
Zaurus-devel@lists.linuxtogo.org
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/zaurus-devel


[Zaurus-devel] spitz pm: adjust messages

2011-05-21 Thread Pavel Machek
Charger error is something that should be reported to the syslog; do
it. If temperature reading fails, we do not want to charge the
battery, anyway.

Signed-off-by: Pavel Machek pa...@ucw.cz

diff --git a/arch/arm/mach-pxa/sharpsl_pm.c b/arch/arm/mach-pxa/sharpsl_pm.c
index 785880f..513588c 100644
--- a/arch/arm/mach-pxa/sharpsl_pm.c
+++ b/arch/arm/mach-pxa/sharpsl_pm.c
@@ -317,6 +302,8 @@ static void sharpsl_charge_off(void)
 
 static void sharpsl_charge_error(void)
 {
+   dev_warn(sharpsl_pm.dev, Charger Error\n);
+
sharpsl_pm_led(SHARPSL_LED_ERROR);
sharpsl_pm.machinfo-charge(0);
sharpsl_pm.charge_mode = CHRG_ERROR;
@@ -513,8 +500,10 @@ static int sharpsl_check_battery_temp(void)
val = get_select_val(buff);
 
dev_dbg(sharpsl_pm.dev, Temperature: %d\n, val);
-   if (val  sharpsl_pm.machinfo-charge_on_temp) {
-   printk(KERN_WARNING Not charging: temperature out of 
limits.\n);
+   /* FIXME: this should catch battery read errors, but we should
+  probably avoid charging in 0C temperatures, too. */
+   if ((val  0) || (val  sharpsl_pm.machinfo-charge_on_temp)) {
+   dev_warn(sharpsl_pm.dev, Not charging: temperature %d out of 
limits.\n, val);
return -1;
}
 
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

___
Zaurus-devel mailing list
Zaurus-devel@lists.linuxtogo.org
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/zaurus-devel


[Zaurus-devel] spitz pm: add power monitoring driver

2011-05-21 Thread Pavel Machek

This adds battery/charge monitoring driver for spitz. 

This is still not 100% done; spitz.c parts need small cleanups to fit
with the rest of code, and limit interface needs to be done.

Question is... who merges this when its done? Would it be ok to go
through PXA tree?

Signed-off-by: Pavel Machek pa...@ucw.cz

diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c
index 01c5769..5bf7f0e 100644
--- a/arch/arm/mach-pxa/spitz.c
+++ b/arch/arm/mach-pxa/spitz.c
@@ -921,6 +921,15 @@ static inline void spitz_i2c_init(void) {}
 #endif
 
 /**
+ * Battery
+ 
**/
+
+static struct platform_device spitz_battery_device = {
+   .name   = spitz-battery,
+   .id = -1,
+};
+
+/**
  * Machine init
  
**/
 static void spitz_poweroff(void)
@@ -968,6 +977,7 @@ static void __init spitz_init(void)
spitz_nor_init();
spitz_nand_init();
spitz_i2c_init();
+   platform_device_register(spitz_battery_device);
 }
 
 static void __init spitz_fixup(struct machine_desc *desc,
diff --git a/drivers/power/Kconfig b/drivers/power/Kconfig
index 52a462f..df54d70 100644
--- a/drivers/power/Kconfig
+++ b/drivers/power/Kconfig
@@ -102,6 +102,12 @@ config BATTERY_COLLIE
  Say Y to enable support for the battery on the Sharp Zaurus
  SL-5500 (collie) models.
 
+config BATTERY_SPITZ
+   tristate Sharp SL-3000C (spitz) battery
+   help
+ Say Y to enable support for the battery on the Sharp Zaurus
+ SL-3000C (spitz) models.
+
 config BATTERY_WM97XX
bool WM97xx generic battery driver
depends on TOUCHSCREEN_WM97XX=y
diff --git a/drivers/power/Makefile b/drivers/power/Makefile
index 8385bfa..7a82c1e 100644
--- a/drivers/power/Makefile
+++ b/drivers/power/Makefile
@@ -20,6 +20,7 @@ obj-$(CONFIG_BATTERY_PMU) += pmu_battery.o
 obj-$(CONFIG_BATTERY_OLPC) += olpc_battery.o
 obj-$(CONFIG_BATTERY_TOSA) += tosa_battery.o
 obj-$(CONFIG_BATTERY_COLLIE)   += collie_battery.o
+obj-$(CONFIG_BATTERY_SPITZ)+= spitz_battery.o
 obj-$(CONFIG_BATTERY_WM97XX)   += wm97xx_battery.o
 obj-$(CONFIG_BATTERY_BQ20Z75)  += bq20z75.o
 obj-$(CONFIG_BATTERY_BQ27x00)  += bq27x00_battery.o
diff --git a/drivers/power/spitz_battery.c b/drivers/power/spitz_battery.c
new file mode 100644
index 000..a612ff8
--- /dev/null
+++ b/drivers/power/spitz_battery.c
@@ -0,0 +1,318 @@
+/*
+ * Battery and Power Management code for the Sharp SL-3000c
+ *
+ * Copyright (c) 2009 Pavel Machek pa...@ucw.cz
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ */
+#include linux/platform_device.h
+#include linux/kernel.h
+#include linux/module.h
+#include linux/power_supply.h
+#include linux/delay.h
+#include linux/spinlock.h
+#include linux/interrupt.h
+#include linux/gpio.h
+
+#include asm/mach-types.h
+#include mach/spitz.h
+#include mach/sharpsl_pm.h
+
+extern struct sharpsl_pm_status sharpsl_pm;
+
+struct spitz_bat {
+   struct power_supply psy;
+
+   bool (*is_present)(struct spitz_bat *bat);
+};
+
+static struct spitz_bat spitz_bat_main, spitz_ac;
+
+extern int sharpsl_pm_pxa_read_max(int channel);
+
+
+static int spitz_bat_get_property(struct power_supply *psy,
+   enum power_supply_property psp,
+   union power_supply_propval *val)
+{
+   int ret = 0;
+   struct spitz_bat *bat = container_of(psy, struct spitz_bat, psy);
+
+   val-intval = 0;
+
+   switch (psp) {
+   case POWER_SUPPLY_PROP_HEALTH:
+   /* POWER_SUPPLY_HEALTH_OVERHEAT , POWER_SUPPLY_HEALTH_COLD,
+  POWER_SUPPLY_HEALTH_OVERVOLTAGE, 
POWER_SUPPLY_HEALTH_UNSPEC_FAILURE, POWER_SUPPLY_HEALTH_GOOD
+*/
+   return 0;
+   case POWER_SUPPLY_PROP_CHARGE_TYPE:
+   val-intval = POWER_SUPPLY_CHARGE_TYPE_NONE;
+   if (gpio_get_value(SPITZ_GPIO_CHRG_ON) == 0) {
+   if (gpio_get_value(SPITZ_GPIO_JK_B) == 1)
+   val-intval = POWER_SUPPLY_CHARGE_TYPE_FAST;
+   else
+   val-intval = POWER_SUPPLY_CHARGE_TYPE_TRICKLE;
+   }
+   return 0;
+   case POWER_SUPPLY_PROP_STATUS:
+ {
+   int status = 0;
+
+   if (gpio_get_value(SPITZ_GPIO_CHRG_ON) == 0)
+   printk(Chrg bit on. );
+   if (gpio_get_value(SPITZ_GPIO_JK_B) == 0)
+   printk(Slow charge bit on. );
+
+   val-intval = POWER_SUPPLY_STATUS_UNKNOWN;
+
+

Re: [Zaurus-devel] Disable CF during suspend

2011-05-21 Thread Pavel Machek
Hi!

  Disable SPITZ_SCP_CF_POWER during suspend. Otherwise it eats battery,
  fast. Thanks to Stanislav Brabec.
 
 If you can verify that your card turns off on suspend, then you have my:
 Acked-by: Stanislav Brabec u...@penguin.cz

Yes, I checked the LEDs to make sure it is off. It is.

 But I would line to see more aggressive power control, something like
 spitz_card_pwr_ctrl() in old kernels - if there is no CF and no
 (external) CF card inserted, then SPITZ_SCP_CF_POWER card be turned off.
 If they are memory cards, they can be turned off even while idle.

Yes, that would be nice; but this is already good first step.
Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

___
Zaurus-devel mailing list
Zaurus-devel@lists.linuxtogo.org
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/zaurus-devel


Re: [Zaurus-devel] Zaurus GPIO buttons with matrix keypad drivers

2011-05-21 Thread Pavel Machek
Hi!

 following comments from a Stanislav patch
 
 Spitz switched to generic matrix-gpio keyboard driver in 2.6.32-rc0,
 but that means that support for power button and lid switches was
 lost. This restores it, using button-gpio code.
 
 in the 2.6.38 source I only find in spitz.c:
 
 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
 static struct gpio_keys_button spitz_gpio_keys[]
 
 and in tosa.c : static struct gpio_keys_button tosa_gpio_keys[]
 
 
 What about the rest of Zaurus?

Well, it probably needs similar patches It should not be hard to
copy from spitz.

Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

___
Zaurus-devel mailing list
Zaurus-devel@lists.linuxtogo.org
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/zaurus-devel