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. r3700 - branches/src/target/kernel/2.6.24.x/patches
      ([EMAIL PROTECTED])
   2. r3701 - in
      trunk/src/target/OM-2007.2/applications/openmoko-today2: .        src
      ([EMAIL PROTECTED])
   3. r3702 - in trunk/src/host: . xoo ([EMAIL PROTECTED])
   4. r3703 - trunk/src/target/OM-2007.2/artwork/icons
      ([EMAIL PROTECTED])
   5. r3704 -
      trunk/src/target/OM-2007.2/misc/openmoko-today2-folders
      ([EMAIL PROTECTED])
   6. r3705 - in
      trunk/src/target/OM-2007.2/applications/openmoko-messages2: . src
      ([EMAIL PROTECTED])
   7. r3706 - branches/src/target/kernel/2.6.24.x/patches
      ([EMAIL PROTECTED])
--- Begin Message ---
Author: laforge
Date: 2007-12-20 13:29:25 +0100 (Thu, 20 Dec 2007)
New Revision: 3700

Modified:
   branches/src/target/kernel/2.6.24.x/patches/s3c_mci.patch
Log:
s3c_mci:
* re-add missing 'include/asm-arm/arch-s3c2410/mci.h' file to this patch
* make sure the s3c_mci driver gets the correct platform device name on 
s3c2412/2440/2442


Modified: branches/src/target/kernel/2.6.24.x/patches/s3c_mci.patch
===================================================================
--- branches/src/target/kernel/2.6.24.x/patches/s3c_mci.patch   2007-12-20 
10:52:36 UTC (rev 3699)
+++ branches/src/target/kernel/2.6.24.x/patches/s3c_mci.patch   2007-12-20 
12:29:25 UTC (rev 3700)
@@ -1604,3 +1604,69 @@
  obj-$(CONFIG_MMC_SPI)         += mmc_spi.o
 -
 +obj-$(CONFIG_MMC_S3C)         += s3cmci.o
+Index: linux-2.6/include/asm-arm/arch-s3c2410/mci.h
+===================================================================
+--- /dev/null
++++ linux-2.6/include/asm-arm/arch-s3c2410/mci.h
+@@ -0,0 +1,13 @@
++#ifndef _ARCH_MCI_H
++#define _ARCH_MCI_H
++
++struct s3c24xx_mci_pdata {
++      unsigned int    gpio_detect;
++      unsigned int    gpio_wprotect;
++      unsigned long   ocr_avail;
++      unsigned int    do_dma;
++      void            (*set_power)(unsigned char power_mode,
++                                   unsigned short vdd);
++};
++
++#endif /* _ARCH_NCI_H */
+Index: linux-2.6/arch/arm/mach-s3c2412/s3c2412.c
+===================================================================
+--- linux-2.6.orig/arch/arm/mach-s3c2412/s3c2412.c
++++ linux-2.6/arch/arm/mach-s3c2412/s3c2412.c
+@@ -214,5 +214,8 @@
+ {
+       printk("S3C2412: Initialising architecture\n");
+ 
++      /* make sure SD/MMC driver can distinguish 2412 from 2410 */
++      s3c_device_sdi.name = "s3c2412-sdi";
++
+       return sysdev_register(&s3c2412_sysdev);
+ }
+Index: linux-2.6/arch/arm/mach-s3c2440/s3c2440.c
+===================================================================
+--- linux-2.6.orig/arch/arm/mach-s3c2440/s3c2440.c
++++ linux-2.6/arch/arm/mach-s3c2440/s3c2440.c
+@@ -46,6 +46,9 @@
+       s3c_device_wdt.resource[1].start = IRQ_S3C2440_WDT;
+       s3c_device_wdt.resource[1].end   = IRQ_S3C2440_WDT;
+ 
++      /* make sure SD/MMC driver can distinguish 2440 from 2410 */
++      s3c_device_sdi.name = "s3c2440-sdi";
++
+       /* register our system device for everything else */
+ 
+       return sysdev_register(&s3c2440_sysdev);
+Index: linux-2.6/arch/arm/mach-s3c2442/s3c2442.c
+===================================================================
+--- linux-2.6.orig/arch/arm/mach-s3c2442/s3c2442.c
++++ linux-2.6/arch/arm/mach-s3c2442/s3c2442.c
+@@ -21,6 +21,7 @@
+ 
+ #include <asm/plat-s3c24xx/s3c2442.h>
+ #include <asm/plat-s3c24xx/cpu.h>
++#include <asm/plat-s3c24xx/devs.h>
+ 
+ static struct sys_device s3c2442_sysdev = {
+       .cls            = &s3c2442_sysclass,
+@@ -30,5 +31,8 @@
+ {
+       printk("S3C2442: Initialising architecture\n");
+ 
++      /* make sure SD/MMC driver can distinguish 2440 from 2410 */
++      s3c_device_sdi.name = "s3c2440-sdi";
++
+       return sysdev_register(&s3c2442_sysdev);
+ }




--- End Message ---
--- Begin Message ---
Author: chris
Date: 2007-12-20 13:33:07 +0100 (Thu, 20 Dec 2007)
New Revision: 3701

Modified:
   trunk/src/target/OM-2007.2/applications/openmoko-today2/ChangeLog
   
trunk/src/target/OM-2007.2/applications/openmoko-today2/src/today-pim-journal.c
Log:
        * src/today-pim-journal.c: (today_pim_journal_entry_changed),
        (note_added_cb), (note_modified_cb), (note_removed_cb),
        (note_store_opened_cb), (event_store_opened_cb),
        (today_pim_journal_box_new):
        Use libjana to display unread SMS message count


Modified: trunk/src/target/OM-2007.2/applications/openmoko-today2/ChangeLog
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-today2/ChangeLog   
2007-12-20 12:29:25 UTC (rev 3700)
+++ trunk/src/target/OM-2007.2/applications/openmoko-today2/ChangeLog   
2007-12-20 12:33:07 UTC (rev 3701)
@@ -1,3 +1,11 @@
+2007-12-20  Chris Lord  <[EMAIL PROTECTED]>
+
+       * src/today-pim-journal.c: (today_pim_journal_entry_changed),
+       (note_added_cb), (note_modified_cb), (note_removed_cb),
+       (note_store_opened_cb), (event_store_opened_cb),
+       (today_pim_journal_box_new):
+        Use libjana to display unread SMS message count
+
 2007-12-19  Chris Lord  <[EMAIL PROTECTED]>
 
        * src/today-pim-journal.c: (today_pim_journal_box_new):

Modified: 
trunk/src/target/OM-2007.2/applications/openmoko-today2/src/today-pim-journal.c
===================================================================
--- 
trunk/src/target/OM-2007.2/applications/openmoko-today2/src/today-pim-journal.c 
    2007-12-20 12:29:25 UTC (rev 3700)
+++ 
trunk/src/target/OM-2007.2/applications/openmoko-today2/src/today-pim-journal.c 
    2007-12-20 12:33:07 UTC (rev 3701)
@@ -1,4 +1,5 @@
 
+#include <string.h>
 #include <glib/gi18n.h>
 #include <moko-stock.h>
 #include <libtaku/launcher-util.h>
@@ -101,11 +102,6 @@
        MessageDirection dir;
        
        switch (moko_journal_entry_get_entry_type (entry)) {
-           case SMS_JOURNAL_ENTRY :
-           case EMAIL_JOURNAL_ENTRY :
-               data->n_unread_messages += added;
-               today_pim_journal_update_messages (data);
-               break;
            case VOICE_JOURNAL_ENTRY :
                moko_journal_entry_get_direction (entry, &dir);
                if (dir == DIRECTION_IN) {
@@ -184,9 +180,104 @@
        return FALSE;
 }
 
+/* Following three functions taken from phonekit/moko-sms.c */
+static GList *unread_uids;
+
 static void
-store_opened_cb (JanaStore *store, TodayData *data)
+note_added_cb (JanaStoreView *store_view, GList *components, TodayData *data)
 {
+  gboolean update = FALSE;
+  
+  for (; components; components = components->next) {
+    JanaComponent *comp = JANA_COMPONENT (components->data);
+    
+    if (!comp) continue;
+    
+    if ((!jana_utils_component_has_category (comp, "Read")) &&
+       (!(jana_utils_component_has_category (comp, "Sending") ||
+        jana_utils_component_has_category (comp, "Sent")))) {
+      gchar *uid = jana_component_get_uid (comp);
+      unread_uids = g_list_prepend (unread_uids, uid);
+      update = TRUE;
+    }
+  }
+  
+  data->n_unread_messages = g_list_length (unread_uids);
+  if (update) today_pim_journal_update_messages (data);
+}
+
+static void
+note_modified_cb (JanaStoreView *store_view, GList *components, TodayData 
*data)
+{
+  gboolean update = FALSE;
+  
+  for (; components; components = components->next) {
+    gchar *uid;
+    GList *found;
+    JanaComponent *comp = JANA_COMPONENT (components->data);
+    
+    if (!comp) continue;
+    
+    uid = jana_component_get_uid (comp);
+    if ((found = g_list_find_custom (
+         unread_uids, uid, (GCompareFunc)strcmp))) {
+      g_free (uid);
+      if (jana_utils_component_has_category (comp, "Read")) {
+        g_free (found->data);
+        unread_uids = g_list_delete_link (unread_uids, found);
+        update = TRUE;
+      }
+    } else if ((!jana_utils_component_has_category (comp, "Read")) &&
+       (!(jana_utils_component_has_category (comp, "Sending") ||
+        jana_utils_component_has_category (comp, "Sent")))) {
+      unread_uids = g_list_prepend (unread_uids, uid);
+      update = TRUE;
+    } else {
+      g_free (uid);
+    }
+  }
+  
+  data->n_unread_messages = g_list_length (unread_uids);
+  if (update) today_pim_journal_update_messages (data);
+}
+
+static void
+note_removed_cb (JanaStoreView *store_view, GList *uids, TodayData *data)
+{
+  gboolean update = FALSE;
+  
+  for (; uids; uids = uids->next) {
+    GList *found = g_list_find_custom (unread_uids, uids->data,
+                                       (GCompareFunc)strcmp);
+    if (found) {
+      g_free (found->data);
+      unread_uids = g_list_delete_link (unread_uids, found);
+      update = TRUE;
+    }
+  }
+  
+  data->n_unread_messages = g_list_length (unread_uids);
+  if (update) today_pim_journal_update_messages (data);
+}
+
+static void
+note_store_opened_cb (JanaStore *store, TodayData *data)
+{
+       JanaStoreView *view;
+       
+       view = jana_store_get_view (store);
+       g_signal_connect (view, "added",
+               G_CALLBACK (note_added_cb), data);
+       g_signal_connect (view, "modified",
+               G_CALLBACK (note_modified_cb), data);
+       g_signal_connect (view, "removed",
+               G_CALLBACK (note_removed_cb), data);
+       jana_store_view_start (view);
+}
+
+static void
+event_store_opened_cb (JanaStore *store, TodayData *data)
+{
        JanaTime *start, *end;
        
        start = jana_ecal_utils_time_now (data->location);
@@ -320,11 +411,8 @@
                data->tasks_box, FALSE, TRUE, 0);
        gtk_widget_show_all (vbox);
        
-       /* Open up journal and connect to signals to find out about missed
-        * calls and new messages.
-        */
+       /* Open up journal and connect to signals for missed calls */
        data->n_missed_calls = 0;
-       data->n_unread_messages = 0;
        data->dates_view = NULL;
        data->dates_model = NULL;
        journal = moko_journal_open_default ();
@@ -341,9 +429,16 @@
        /* Open up calendar store */
        store = jana_ecal_store_new (JANA_COMPONENT_EVENT);
        g_signal_connect (store, "opened",
-               G_CALLBACK (store_opened_cb), data);
+               G_CALLBACK (event_store_opened_cb), data);
        jana_store_open (store);
        
+       /* Open up notes store */
+       data->n_unread_messages = 0;
+       store = jana_ecal_store_new (JANA_COMPONENT_NOTE);
+       g_signal_connect (store, "opened",
+               G_CALLBACK (note_store_opened_cb), data);
+       jana_store_open (store);
+       
        /* Create tasks store */
        data->tasks_store = GTK_TREE_MODEL (today_tasks_store_new ());
        g_signal_connect_swapped (data->tasks_store, "row-inserted",




--- End Message ---
--- Begin Message ---
Author: mickey
Date: 2007-12-20 13:51:37 +0100 (Thu, 20 Dec 2007)
New Revision: 3702

Added:
   trunk/src/host/xoo/
   trunk/src/host/xoo/neo1973.jpg
   trunk/src/host/xoo/neo1973.xml
Log:
add xoo device configuration


Added: trunk/src/host/xoo/neo1973.jpg
===================================================================
(Binary files differ)


Property changes on: trunk/src/host/xoo/neo1973.jpg
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/src/host/xoo/neo1973.xml
===================================================================
--- trunk/src/host/xoo/neo1973.xml      2007-12-20 12:33:07 UTC (rev 3701)
+++ trunk/src/host/xoo/neo1973.xml      2007-12-20 12:51:37 UTC (rev 3702)
@@ -0,0 +1,18 @@
+<neo1973>
+<device width='695' height='1297' 
+        display_width='480' display_height='640' 
+        display_x='75' display_y='300' 
+        img='neo1973.jpg' />
+
+<!--
+<button x='94' y='111' width='53' height='35' key='Up'/> 
+<button x='94' y='199' width='53' height='35' key='Down'/> 
+<button x='62' y='146' width='35' height='53' key='Left'/> 
+<button x='147' y='146' width='35' height='53' key='Right'/> 
+<button x='93' y='146' width='54' height='54' key='Return'/> 
+<button x='62' y='276' width='110' height='45' key='Escape'/> 
+<button x='62' y='333' width='110' height='45' key='F4'/> 
+<button x='62' y='390' width='110' height='45' key='F5'/> 
+-->
+
+</neo1973>




--- End Message ---
--- Begin Message ---
Author: mickey
Date: 2007-12-20 14:32:12 +0100 (Thu, 20 Dec 2007)
New Revision: 3703

Added:
   trunk/src/target/OM-2007.2/artwork/icons/autogen.sh
Log:
artwork/icons: add autogen.sh


Added: trunk/src/target/OM-2007.2/artwork/icons/autogen.sh
===================================================================
--- trunk/src/target/OM-2007.2/artwork/icons/autogen.sh 2007-12-20 12:51:37 UTC 
(rev 3702)
+++ trunk/src/target/OM-2007.2/artwork/icons/autogen.sh 2007-12-20 13:32:12 UTC 
(rev 3703)
@@ -0,0 +1,6 @@
+#! /bin/sh
+autoreconf -v --install || exit 1
+libtoolize --copy --force || exit 1
+glib-gettextize --force --copy || exit 1
+intltoolize --copy --force --automake || exit 1
+./configure --enable-maintainer-mode "$@"


Property changes on: trunk/src/target/OM-2007.2/artwork/icons/autogen.sh
___________________________________________________________________
Name: svn:executable
   + *




--- End Message ---
--- Begin Message ---
Author: mickey
Date: 2007-12-20 14:32:25 +0100 (Thu, 20 Dec 2007)
New Revision: 3704

Added:
   trunk/src/target/OM-2007.2/misc/openmoko-today2-folders/autogen.sh
Log:
openmoko-today2-folders: add autogen.sh


Added: trunk/src/target/OM-2007.2/misc/openmoko-today2-folders/autogen.sh
===================================================================
--- trunk/src/target/OM-2007.2/misc/openmoko-today2-folders/autogen.sh  
2007-12-20 13:32:12 UTC (rev 3703)
+++ trunk/src/target/OM-2007.2/misc/openmoko-today2-folders/autogen.sh  
2007-12-20 13:32:25 UTC (rev 3704)
@@ -0,0 +1,6 @@
+#! /bin/sh
+autoreconf -v --install || exit 1
+libtoolize --copy --force || exit 1
+glib-gettextize --force --copy || exit 1
+intltoolize --copy --force --automake || exit 1
+./configure --enable-maintainer-mode "$@"


Property changes on: 
trunk/src/target/OM-2007.2/misc/openmoko-today2-folders/autogen.sh
___________________________________________________________________
Name: svn:executable
   + *




--- End Message ---
--- Begin Message ---
Author: chris
Date: 2007-12-20 15:24:37 +0100 (Thu, 20 Dec 2007)
New Revision: 3705

Modified:
   trunk/src/target/OM-2007.2/applications/openmoko-messages2/ChangeLog
   trunk/src/target/OM-2007.2/applications/openmoko-messages2/src/sms-notes.c
Log:
        * src/sms-notes.c: (note_changed_cb), (page_shown):
        Fix avatars not appearing when viewing messages from unknown contacts


Modified: trunk/src/target/OM-2007.2/applications/openmoko-messages2/ChangeLog
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-messages2/ChangeLog        
2007-12-20 13:32:25 UTC (rev 3704)
+++ trunk/src/target/OM-2007.2/applications/openmoko-messages2/ChangeLog        
2007-12-20 14:24:37 UTC (rev 3705)
@@ -1,3 +1,8 @@
+2007-12-20  Chris Lord  <[EMAIL PROTECTED]>
+
+       * src/sms-notes.c: (note_changed_cb), (page_shown):
+       Fix avatars not appearing when viewing messages from unknown contacts
+
 2007-12-18  Chris Lord  <[EMAIL PROTECTED]>
 
        * src/sms-contacts.c: (page_shown),

Modified: 
trunk/src/target/OM-2007.2/applications/openmoko-messages2/src/sms-notes.c
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-messages2/src/sms-notes.c  
2007-12-20 13:32:25 UTC (rev 3704)
+++ trunk/src/target/OM-2007.2/applications/openmoko-messages2/src/sms-notes.c  
2007-12-20 14:24:37 UTC (rev 3705)
@@ -72,9 +72,6 @@
                } else {
                        data->recipient_icon =
                                sms_contact_load_photo (contact);
-                       if ((!data->recipient_icon) && (data->no_photo))
-                               data->recipient_icon =
-                                       g_object_ref (data->no_photo);
                        g_object_unref (contact);
                        break;
                }
@@ -82,9 +79,13 @@
 
 note_changed_cb_end:
        /* Remove handlers */
-       if (data->recipient_number)
+       if (data->recipient_number) {
+               if ((!data->recipient_icon) && (data->no_photo))
+                       data->recipient_icon =
+                               g_object_ref (data->no_photo);
                g_signal_handlers_disconnect_by_func (
                        store_view, note_changed_cb, data);
+       }
 }
 
 static gboolean
@@ -162,7 +163,14 @@
                GList *u, *components = NULL;
                
                /* Assume the 'unknown' contact was selected */
-               data->author_icon = g_object_ref (data->no_photo);
+               if (data->no_photo) {
+                       data->author_icon = g_object_ref (data->no_photo);
+                       
+                       /* Without the author UID, we won't be able to 
+                        * identify the recipient - so set their photo here
+                        */
+                       data->recipient_icon = g_object_ref (data->no_photo);
+               }
                
                /* Manually feed the notes in - this is a bit naughty as if 
                 * they change, we won't be notified...
@@ -191,7 +199,7 @@
        }
        
        data->author_icon = sms_contact_load_photo (contact);
-       if (!data->author_icon)
+       if ((!data->author_icon) && (data->no_photo))
                data->author_icon = g_object_ref (data->no_photo);
        
        store_view = jana_store_get_view (data->notes);




--- End Message ---
--- Begin Message ---
Author: laforge
Date: 2007-12-20 15:49:59 +0100 (Thu, 20 Dec 2007)
New Revision: 3706

Modified:
   branches/src/target/kernel/2.6.24.x/patches/gta01-jbt6k74.patch
Log:
jbt6k74 cleanup as requested by SPI maintainer
* u_intX_t -> uX
* introduce mutex for tx_buf and reg_cache
* read registers from reg_cache on sysfs read
* add comment why we don't shut down the device on remove()
* fix suspend/resume for non-SUSPEND (i.e. FREEZE/PRETHAW) case
* fix resume: only switch display on if we weren't already in SLEEP/DEEP_STANDBY
* change driver initialization ordering, fail consistent/gracefully


Modified: branches/src/target/kernel/2.6.24.x/patches/gta01-jbt6k74.patch
===================================================================
--- branches/src/target/kernel/2.6.24.x/patches/gta01-jbt6k74.patch     
2007-12-20 14:24:37 UTC (rev 3705)
+++ branches/src/target/kernel/2.6.24.x/patches/gta01-jbt6k74.patch     
2007-12-20 14:49:59 UTC (rev 3706)
@@ -44,7 +44,7 @@
 ===================================================================
 --- /dev/null
 +++ linux-2.6/drivers/spi/jbt6k74.c
-@@ -0,0 +1,628 @@
+@@ -0,0 +1,673 @@
 +/* Linux kernel driver for the tpo JBT6K74-AS LCM ASIC
 + *
 + * Copyright (C) 2006-2007 by OpenMoko, Inc.
@@ -157,57 +157,68 @@
 +
 +struct jbt_info {
 +      enum jbt_state state, last_state;
-+      u_int16_t tx_buf[8];
 +      struct spi_device *spi_dev;
-+      u_int16_t reg_cache[0xEE];
++      struct mutex lock;              /* protects tx_buf and reg_cache */
++      u16 tx_buf[8];
++      u16 reg_cache[0xEE];
 +};
 +
 +#define JBT_COMMAND   0x000
 +#define JBT_DATA      0x100
 +
-+static int jbt_reg_write_nodata(struct jbt_info *jbt, u_int8_t reg)
++static int jbt_reg_write_nodata(struct jbt_info *jbt, u8 reg)
 +{
 +      int rc;
 +
++      mutex_lock(&jbt->lock);
++
 +      jbt->tx_buf[0] = JBT_COMMAND | reg;
-+
-+      rc = spi_write(jbt->spi_dev, (u_int8_t *)jbt->tx_buf,
-+                     1*sizeof(u_int16_t));
++      rc = spi_write(jbt->spi_dev, (u8 *)jbt->tx_buf,
++                     1*sizeof(u16));
 +      if (rc == 0)
 +              jbt->reg_cache[reg] = 0;
 +
++      mutex_unlock(&jbt->lock);
++
 +      return rc;
 +}
 +
 +
-+static int jbt_reg_write(struct jbt_info *jbt, u_int8_t reg, u_int8_t data)
++static int jbt_reg_write(struct jbt_info *jbt, u8 reg, u8 data)
 +{
 +      int rc;
 +
++      mutex_lock(&jbt->lock);
++
 +      jbt->tx_buf[0] = JBT_COMMAND | reg;
 +      jbt->tx_buf[1] = JBT_DATA | data;
-+
-+      rc = spi_write(jbt->spi_dev, (u_int8_t *)jbt->tx_buf,
-+                     2*sizeof(u_int16_t));
++      rc = spi_write(jbt->spi_dev, (u8 *)jbt->tx_buf,
++                     2*sizeof(u16));
 +      if (rc == 0)
 +              jbt->reg_cache[reg] = data;
++      
++      mutex_unlock(&jbt->lock);
 +
 +      return rc;
 +}
 +
-+static int jbt_reg_write16(struct jbt_info *jbt, u_int8_t reg, u_int16_t data)
++static int jbt_reg_write16(struct jbt_info *jbt, u8 reg, u16 data)
 +{
 +      int rc;
 +
++      mutex_lock(&jbt->lock);
++
 +      jbt->tx_buf[0] = JBT_COMMAND | reg;
 +      jbt->tx_buf[1] = JBT_DATA | (data >> 8);
 +      jbt->tx_buf[2] = JBT_DATA | (data & 0xff);
 +
-+      rc = spi_write(jbt->spi_dev, (u_int8_t *)jbt->tx_buf,
-+                     3*sizeof(u_int16_t));
++      rc = spi_write(jbt->spi_dev, (u8 *)jbt->tx_buf,
++                     3*sizeof(u16));
 +      if (rc == 0)
 +              jbt->reg_cache[reg] = data;
 +
++      mutex_unlock(&jbt->lock);
++
 +      return rc;
 +}
 +
@@ -269,7 +280,7 @@
 +              rc |= jbt_reg_write(jbt, JBT_REG_ASW_TIMING_2_QVGA, 0x0a);
 +      }
 +
-+      return rc;
++      return rc ? -EIO : 0;
 +}
 +
 +static int standby_to_sleep(struct jbt_info *jbt)
@@ -279,15 +290,15 @@
 +      /* three times command zero */
 +      rc = jbt_reg_write_nodata(jbt, 0x00);
 +      mdelay(1);
-+      rc = jbt_reg_write_nodata(jbt, 0x00);
++      rc |= jbt_reg_write_nodata(jbt, 0x00);
 +      mdelay(1);
-+      rc = jbt_reg_write_nodata(jbt, 0x00);
++      rc |= jbt_reg_write_nodata(jbt, 0x00);
 +      mdelay(1);
 +
 +      /* deep standby out */
 +      rc |= jbt_reg_write(jbt, JBT_REG_POWER_ON_OFF, 0x17);
 +
-+      return rc;
++      return rc ? -EIO : 0;
 +}
 +
 +static int sleep_to_normal(struct jbt_info *jbt)
@@ -311,7 +322,8 @@
 +
 +      /* initialize register set */
 +      rc |= jbt_init_regs(jbt, 0);
-+      return rc;
++
++      return rc ? -EIO : 0;
 +}
 +
 +static int sleep_to_qvga_normal(struct jbt_info *jbt)
@@ -335,7 +347,8 @@
 +
 +      /* initialize register set for qvga*/
 +      rc |= jbt_init_regs(jbt, 1);
-+      return rc;
++
++      return rc ? -EIO : 0;
 +}
 +
 +static int normal_to_sleep(struct jbt_info *jbt)
@@ -346,7 +359,7 @@
 +      rc |= jbt_reg_write16(jbt, JBT_REG_OUTPUT_CONTROL, 0x8002);
 +      rc |= jbt_reg_write_nodata(jbt, JBT_REG_SLEEP_IN);
 +
-+      return rc;
++      return rc ? -EIO : 0;
 +}
 +
 +static int sleep_to_standby(struct jbt_info *jbt)
@@ -485,17 +498,21 @@
 +                         const char *buf, size_t count)
 +{
 +      struct jbt_info *jbt = dev_get_drvdata(dev);
-+      int i;
++      int i, rc;
 +
 +      for (i = 0; i < ARRAY_SIZE(jbt_state_names); i++) {
 +              if (!strncmp(buf, jbt_state_names[i],
 +                           strlen(jbt_state_names[i]))) {
-+                      jbt6k74_enter_state(jbt, i);
++                      rc = jbt6k74_enter_state(jbt, i);
++                      if (rc)
++                              return rc;
 +                      switch (i) {
 +                      case JBT_STATE_NORMAL:
 +                      case JBT_STATE_QVGA_NORMAL:
 +                              /* Enable display again after deep-standby */
-+                              jbt6k74_display_onoff(jbt, 1);
++                              rc = jbt6k74_display_onoff(jbt, 1);
++                              if (rc)
++                                      return rc;
 +                              break;
 +                      default:
 +                              break;
@@ -524,7 +541,15 @@
 +static ssize_t gamma_read(struct device *dev, struct device_attribute *attr,
 +                        char *buf)
 +{
-+      return strlcpy(buf, "N/A\n", PAGE_SIZE);
++      struct jbt_info *jbt = dev_get_drvdata(dev);
++      int reg = reg_by_string(attr->attr.name);
++      u16 val;
++
++      mutex_lock(&jbt->lock);
++      val = jbt->reg_cache[reg];
++      mutex_unlock(&jbt->lock);
++
++      return sprintf(buf, "0x%04x\n", val);
 +}
 +
 +static ssize_t gamma_write(struct device *dev, struct device_attribute *attr,
@@ -565,17 +590,8 @@
 +      int rc;
 +      struct jbt_info *jbt;
 +
-+      jbt = kzalloc(sizeof(*jbt), GFP_KERNEL);
-+      if (!jbt)
-+              return -ENOMEM;
++      /* the controller doesn't have a MISO pin; we can't do detection */
 +
-+      jbt->spi_dev = spi;
-+      jbt->state = JBT_STATE_DEEP_STANDBY;
-+
-+      /* since we don't have MISO connected, we can't do detection */
-+
-+      dev_set_drvdata(&spi->dev, jbt);
-+
 +      spi->mode = SPI_CPOL | SPI_CPHA;
 +      spi->bits_per_word = 9;
 +
@@ -583,32 +599,58 @@
 +      if (rc < 0) {
 +              dev_err(&spi->dev,
 +                      "error during spi_setup of jbt6k74 driver\n");
-+              dev_set_drvdata(&spi->dev, NULL);
-+              kfree(jbt);
 +              return rc;
 +      }
 +
++      jbt = kzalloc(sizeof(*jbt), GFP_KERNEL);
++      if (!jbt)
++              return -ENOMEM;
++
++      jbt->spi_dev = spi;
++      jbt->state = JBT_STATE_DEEP_STANDBY;
++
++      dev_set_drvdata(&spi->dev, jbt);
++
 +      rc = jbt6k74_enter_state(jbt, JBT_STATE_NORMAL);
-+      if (rc < 0)
-+              dev_warn(&spi->dev, "cannot enter NORMAL state\n");
++      if (rc < 0) {
++              dev_err(&spi->dev, "cannot enter NORMAL state\n");
++              goto err_free_drvdata;
++      }
 +
-+      jbt6k74_display_onoff(jbt, 1);
++      rc = jbt6k74_display_onoff(jbt, 1);
++      if (rc < 0) {
++              dev_err(&spi->dev, "cannot switch display on\n");
++              goto err_standby;
++      }
 +
 +      rc = sysfs_create_group(&spi->dev.kobj, &jbt_attr_group);
-+      if (rc) {
-+              dev_set_drvdata(&spi->dev, NULL);
-+              kfree(jbt);
-+              return rc;
++      if (rc < 0) {
++              dev_err(&spi->dev, "cannot create sysfs group\n");
++              goto err_off;
 +      }
 +
 +      return 0;
++
++err_off:
++      jbt6k74_display_onoff(jbt, 0);
++err_standby:
++      jbt6k74_enter_state(jbt, JBT_STATE_DEEP_STANDBY);
++err_free_drvdata:
++      dev_set_drvdata(&spi->dev, NULL);
++      kfree(jbt);
++
++      return rc;
 +}
 +
 +static int __devexit jbt_remove(struct spi_device *spi)
 +{
 +      struct jbt_info *jbt = dev_get_drvdata(&spi->dev);
 +
++      /* We don't want to switch off the display in case the user
++       * accidentially onloads the module (whose use count normally is 0) */
++
 +      sysfs_remove_group(&spi->dev.kobj, &jbt_attr_group);
++      dev_set_drvdata(&spi->dev, NULL);
 +      kfree(jbt);
 +
 +      return 0;
@@ -619,16 +661,11 @@
 +{
 +      struct jbt_info *jbt = dev_get_drvdata(&spi->dev);
 +
-+      switch (state.event) {
-+      case PM_EVENT_SUSPEND:
-+      case 3:
-+              /* Save mode for resume */
-+              jbt->last_state = jbt->state;
-+              jbt6k74_enter_state(jbt, JBT_STATE_DEEP_STANDBY);
-+              return 0;
-+      default:
-+              return -1;
-+      }
++      /* Save mode for resume */
++      jbt->last_state = jbt->state;
++      jbt6k74_enter_state(jbt, JBT_STATE_DEEP_STANDBY);
++
++      return 0;
 +}
 +
 +static int jbt_resume(struct spi_device *spi)
@@ -636,8 +673,16 @@
 +      struct jbt_info *jbt = dev_get_drvdata(&spi->dev);
 +
 +      jbt6k74_enter_state(jbt, jbt->last_state);
-+      jbt6k74_display_onoff(jbt, 1);
 +
++      switch (jbt->last_state) {
++      case JBT_STATE_NORMAL:
++      case JBT_STATE_QVGA_NORMAL:
++              jbt6k74_display_onoff(jbt, 1);
++              break;
++      default:
++              break;
++      }
++
 +      return 0;
 +}
 +#else




--- End Message ---
_______________________________________________
commitlog mailing list
[email protected]
http://lists.openmoko.org/mailman/listinfo/commitlog

Reply via email to