linux-openmoko-2.6.34: enable 3D engine and update jitterless patch
authorMartin Jansa <Martin.Jansa@gmail.com>
Sun, 31 Oct 2010 13:13:35 +0000 (14:13 +0100)
committerMartin Jansa <Martin.Jansa@gmail.com>
Sun, 31 Oct 2010 14:16:24 +0000 (15:16 +0100)
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
recipes/linux/linux-openmoko-2.6.34/0001-Enable-3D-engine.patch [new file with mode: 0644]
recipes/linux/linux-openmoko-2.6.34/0001-s3c2410_ts-jitter-less-version-for-glamo.patch
recipes/linux/linux-openmoko-2.6.34/om-gta02/defconfig
recipes/linux/linux-openmoko-2.6.34_git.bb

diff --git a/recipes/linux/linux-openmoko-2.6.34/0001-Enable-3D-engine.patch b/recipes/linux/linux-openmoko-2.6.34/0001-Enable-3D-engine.patch
new file mode 100644 (file)
index 0000000..4313e80
--- /dev/null
@@ -0,0 +1,101 @@
+From 8199fde74f278d013d50e293d1cbcf284db27a61 Mon Sep 17 00:00:00 2001
+From: Thomas White <taw@bitwiz.org.uk>
+Date: Sun, 6 Jun 2010 21:36:01 +0200
+Subject: [PATCH] Enable 3D engine
+
+Turns out, this makes Mesa work a lot better.
+
+Signed-off-by: Thomas White <taw@bitwiz.org.uk>
+Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
+---
+ drivers/gpu/drm/glamo/glamo-cmdq.c |    6 +++++-
+ drivers/mfd/glamo-core.c           |   25 +++++++++++++++++++++++++
+ 2 files changed, 30 insertions(+), 1 deletions(-)
+
+diff --git a/drivers/gpu/drm/glamo/glamo-cmdq.c b/drivers/gpu/drm/glamo/glamo-cmdq.c
+index c425e46..05d3c20 100644
+--- a/drivers/gpu/drm/glamo/glamo-cmdq.c
++++ b/drivers/gpu/drm/glamo/glamo-cmdq.c
+@@ -462,10 +462,14 @@ int glamo_cmdq_init(struct glamodrm_handle *gdrm)
+       init_MUTEX(&gdrm->add_to_ring);
+-      /* Enable 2D and 3D */
++      /* Enable 2D */
+       glamo_engine_enable(gdrm->glamo_core, GLAMO_ENGINE_2D);
+       glamo_engine_reset(gdrm->glamo_core, GLAMO_ENGINE_2D);
++      /* Enable 3D */
++      glamo_engine_enable(gdrm->glamo_core, GLAMO_ENGINE_3D);
++      glamo_engine_reset(gdrm->glamo_core, GLAMO_ENGINE_3D);
++
+       /* Start by zeroing the command queue memory */
+       for ( i=0; i<GLAMO_CMDQ_SIZE; i+=2 ) {
+               iowrite16(0x0000, gdrm->cmdq_base+i);
+diff --git a/drivers/mfd/glamo-core.c b/drivers/mfd/glamo-core.c
+index e558adc..51101f5 100644
+--- a/drivers/mfd/glamo-core.c
++++ b/drivers/mfd/glamo-core.c
+@@ -522,6 +522,23 @@ static const struct glamo_engine_reg_set glamo_2d_regs[] = {
+       }
+ };
++static const struct glamo_engine_reg_set glamo_3d_regs[] = {
++      { GLAMO_REG_CLOCK_3D,
++      GLAMO_CLOCK_3D_EN_M8CLK |
++      GLAMO_CLOCK_3D_DG_M8CLK,
++
++      GLAMO_CLOCK_3D_EN_ECLK |
++      GLAMO_CLOCK_3D_DG_ECLK,
++
++      GLAMO_CLOCK_3D_EN_RCLK |
++      GLAMO_CLOCK_3D_DG_RCLK
++      },
++      { GLAMO_REG_CLOCK_GEN5_1,
++      0,
++      GLAMO_CLOCK_GEN51_EN_DIV_GCLK,
++      }
++};
++
+ static const struct glamo_engine_reg_set glamo_cmdq_regs[] = {
+       { GLAMO_REG_CLOCK_2D,
+       GLAMO_CLOCK_2D_EN_M6CLK,
+@@ -543,6 +560,8 @@ static const struct glamo_engine_desc glamo_engines[] = {
+                                       glamo_mmc_regs),
+       [GLAMO_ENGINE_2D] = GLAMO_ENGINE("2D", GLAMO_HOSTBUS2_MMIO_EN_2D,
+                                       glamo_2d_regs),
++      [GLAMO_ENGINE_3D] = GLAMO_ENGINE("3D", GLAMO_HOSTBUS2_MMIO_EN_3D,
++                                      glamo_3d_regs),
+       [GLAMO_ENGINE_CMDQ] = GLAMO_ENGINE("CMDQ", GLAMO_HOSTBUS2_MMIO_EN_CQ,
+                                       glamo_cmdq_regs),
+ };
+@@ -566,6 +585,7 @@ int __glamo_engine_enable(struct glamo_core *glamo, enum glamo_engine engine)
+       case GLAMO_ENGINE_LCD:
+       case GLAMO_ENGINE_MMC:
+       case GLAMO_ENGINE_2D:
++      case GLAMO_ENGINE_3D:
+       case GLAMO_ENGINE_CMDQ:
+               break;
+       default:
+@@ -612,6 +632,7 @@ int __glamo_engine_disable(struct glamo_core *glamo, enum glamo_engine engine)
+       case GLAMO_ENGINE_MMC:
+       case GLAMO_ENGINE_2D:
+       case GLAMO_ENGINE_CMDQ:
++      case GLAMO_ENGINE_3D:
+               break;
+       default:
+               return -EINVAL;
+@@ -704,6 +725,10 @@ static const struct glamo_script reset_regs[] = {
+       [GLAMO_ENGINE_2D] = {
+               GLAMO_REG_CLOCK_2D, GLAMO_CLOCK_2D_RESET
+       },
++      [GLAMO_ENGINE_3D] = {
++              GLAMO_REG_CLOCK_3D, GLAMO_CLOCK_3D_BACK_RESET |
++                                  GLAMO_CLOCK_3D_FRONT_RESET
++      },
+       [GLAMO_ENGINE_JPEG] = {
+               GLAMO_REG_CLOCK_JPEG, GLAMO_CLOCK_JPEG_RESET
+       },
+-- 
+1.7.3.2
+
index 501fbbb..fa93b8b 100644 (file)
@@ -1,21 +1,64 @@
-From ca0ced6d80c32dd7eed1c3ea2e539a38692a4fd7 Mon Sep 17 00:00:00 2001
+From 3233bb1968fe4960358e75186cbe0114993716a2 Mon Sep 17 00:00:00 2001
 From: Gennady Kupava <gb@bsdmn.com>
 Date: Wed, 20 Oct 2010 20:26:40 +0200
-Subject: [PATCH] s3c2410_ts: jitter less version for glamo
+Subject: [PATCH] s3c2410_ts: jitter less touchscreen for glamo, version 3
 
+Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
 ---
- arch/arm/mach-s3c2440/mach-gta02.c     |    4 +-
- drivers/input/touchscreen/s3c2410_ts.c |   28 +++++++++++++++++++-
- drivers/mfd/glamo-core.c               |   44 +++++++++++++++++++++++++++++++-
- include/linux/mfd/glamo-core.h         |    4 +++
- 4 files changed, 75 insertions(+), 5 deletions(-)
+ arch/arm/mach-s3c2410/include/mach/ts.h |    4 ++
+ arch/arm/mach-s3c2440/mach-gta02.c      |   23 ++++++++++-
+ drivers/input/touchscreen/s3c2410_ts.c  |   35 ++++++++++++++++-
+ drivers/mfd/glamo-core.c                |   63 ++++++++++++++++++++++++++++++-
+ include/linux/mfd/glamo-core.h          |    5 ++
+ 5 files changed, 124 insertions(+), 6 deletions(-)
 
+diff --git a/arch/arm/mach-s3c2410/include/mach/ts.h b/arch/arm/mach-s3c2410/include/mach/ts.h
+index dc36170..3112a2c 100644
+--- a/arch/arm/mach-s3c2410/include/mach/ts.h
++++ b/arch/arm/mach-s3c2410/include/mach/ts.h
+@@ -14,6 +14,10 @@ struct s3c2410_ts_mach_info {
+        int             delay;
+        int             presc;
+        int             oversampling_shift;
++#ifdef CONFIG_MACH_NEO1973_GTA02
++       void          (*before_adc_hook)(void);
++       void          (*after_adc_hook)(void);
++#endif
+ };
+ extern void s3c24xx_ts_set_platdata(struct s3c2410_ts_mach_info *);
 diff --git a/arch/arm/mach-s3c2440/mach-gta02.c b/arch/arm/mach-s3c2440/mach-gta02.c
-index 702b80a..a0d7334 100644
+index 702b80a..3093ca9 100644
 --- a/arch/arm/mach-s3c2440/mach-gta02.c
 +++ b/arch/arm/mach-s3c2440/mach-gta02.c
-@@ -945,9 +945,9 @@ static struct s3c2410_hcd_info gta02_usb_info __initdata = {
+@@ -111,6 +111,7 @@
+ #include <linux/jbt6k74.h>
+ #include <linux/glamofb.h>
+ #include <linux/mfd/glamo.h>
++#include <linux/mfd/glamo-core.h>
+ #define S3C2410_GPIONO(bank,offset) ((bank) + (offset))
+@@ -943,11 +944,29 @@ static struct s3c2410_hcd_info gta02_usb_info __initdata = {
+       },
+ };
  
++static int glamo_slowed = 0;
++
++static void gta02_ts_hook_before_adc () {
++      if (!glamo_slowed) {
++              glamo_slowed = 1;
++              glamo_pixclock_slow(dev_get_drvdata (&gta02_glamo_dev.dev));
++      }
++};
++
++static void gta02_ts_hook_after_adc () {
++      if (glamo_slowed) {
++              glamo_slowed = 0;
++              glamo_pixclock_fast(dev_get_drvdata (&gta02_glamo_dev.dev));
++      }
++};
++
  /* Touchscreen */
  static struct s3c2410_ts_mach_info gta02_ts_info = {
 -       .delay = 10000,
@@ -23,56 +66,54 @@ index 702b80a..a0d7334 100644
         .presc = 0xff, /* slow as we can go */
 -         .oversampling_shift = 2,
 +       .oversampling_shift = 0,
++       .before_adc_hook = gta02_ts_hook_before_adc,
++       .after_adc_hook = gta02_ts_hook_after_adc,
  };
  
  /* Buttons */
 diff --git a/drivers/input/touchscreen/s3c2410_ts.c b/drivers/input/touchscreen/s3c2410_ts.c
-index ed5b437..1ebe220 100644
+index ed5b437..c4d82c9 100644
 --- a/drivers/input/touchscreen/s3c2410_ts.c
 +++ b/drivers/input/touchscreen/s3c2410_ts.c
-@@ -41,6 +41,10 @@
- #include <mach/regs-gpio.h>
- #include <mach/ts.h>
+@@ -84,6 +84,10 @@ struct s3c2410ts {
+       int count;
+       int shift;
+       int expectedintr; /* kind of interrupt we are waiting for */
 +#ifdef CONFIG_MACH_NEO1973_GTA02
-+#include <linux/mfd/glamo-core.h>
++      void          (*before_adc_hook)(void);
++      void          (*after_adc_hook)(void);
 +#endif
-+
- #define TSC_SLEEP  (S3C2410_ADCTSC_PULL_UP_DISABLE | S3C2410_ADCTSC_XY_PST(0))
+ };
  
- #define INT_DOWN      (0)
-@@ -92,6 +96,22 @@ static struct s3c2410ts ts;
+ static struct s3c2410ts ts;
+@@ -92,6 +96,7 @@ static struct s3c2410ts ts;
  #define WAITFORINT_DOWN (1)
  #define WAITFORINT_NOTHING (2)
  
-+
-+static inline void before_adc_hook(void) 
-+{
-+#ifdef CONFIG_MACH_NEO1973_GTA02
-+  glamo_pixclock_slow();
-+#endif
-+}
-+
-+static inline void after_adc_hook(void) 
-+{
-+#ifdef CONFIG_MACH_NEO1973_GTA02
-+  glamo_pixclock_fast();
-+#endif
-+}
-+
 +
  /**
   * s3c2410_ts_connect - configure gpio for s3c2410 systems
   *
-@@ -152,6 +172,7 @@ static void touch_timer_fire(unsigned long data)
+@@ -152,6 +157,9 @@ static void touch_timer_fire(unsigned long data)
                        ts.count = 0;
                }
  
-+              before_adc_hook();
++#ifdef CONFIG_MACH_NEO1973_GTA02
++              ts.before_adc_hook();
++#endif
                s3c_adc_start(ts.client, 0, 1 << ts.shift);
        } else {
                ts.xp = 0;
-@@ -201,7 +222,7 @@ static irqreturn_t stylus_irq(int irq, void *dev_id)
+@@ -159,7 +167,7 @@ static void touch_timer_fire(unsigned long data)
+               ts.count = 0;
+               input_report_key(ts.input, BTN_TOUCH, 0);
+-        input_report_abs(ts.input, ABS_PRESSURE, 0);
++              input_report_abs(ts.input, ABS_PRESSURE, 0);
+               input_sync(ts.input);
+               
+               ts.expectedintr = WAITFORINT_DOWN;
+@@ -201,7 +209,7 @@ static irqreturn_t stylus_irq(int irq, void *dev_id)
        ts.expectedintr = WAITFORINT_NOTHING;
  
        if (down)
@@ -81,17 +122,19 @@ index ed5b437..1ebe220 100644
        else
                dev_info(ts.dev, "%s: count=%d\n", __func__, ts.count);
  
-@@ -228,6 +249,9 @@ static void s3c24xx_ts_conversion(struct s3c_adc_client *client,
+@@ -228,6 +236,11 @@ static void s3c24xx_ts_conversion(struct s3c_adc_client *client,
  
        ts.count++;
  
++#ifdef CONFIG_MACH_NEO1973_GTA02
 +      if (!*left) 
-+              after_adc_hook();
++              ts.after_adc_hook();
++#endif
 +
        /* From tests, it seems that it is unlikely to get a pen-up
         * event during the conversion process which means we can
         * ignore any pen-up events with less than the requisite
-@@ -251,7 +275,7 @@ static void s3c24xx_ts_select(struct s3c_adc_client *client, unsigned select)
+@@ -251,7 +264,7 @@ static void s3c24xx_ts_select(struct s3c_adc_client *client, unsigned select)
                writel(S3C2410_ADCTSC_PULL_UP_DISABLE | AUTOPST,
                       ts.io + S3C2410_ADCTSC);
        } else {
@@ -100,8 +143,45 @@ index ed5b437..1ebe220 100644
                ts.expectedintr = WAITFORINT_UP;
                writel(WAIT4INT | INT_UP, ts.io + S3C2410_ADCTSC);
        }
+@@ -333,6 +346,8 @@ static int __devinit s3c2410ts_probe(struct platform_device *pdev)
+       ts.expectedintr = WAITFORINT_DOWN;
+       writel(WAIT4INT | INT_DOWN, ts.io + S3C2410_ADCTSC);
++
++
+       input_dev = input_allocate_device();
+       if (!input_dev) {
+               dev_err(dev, "Unable to allocate the input device !!\n");
+@@ -355,6 +370,11 @@ static int __devinit s3c2410ts_probe(struct platform_device *pdev)
+       ts.shift = info->oversampling_shift;
++#ifdef CONFIG_MACH_NEO1973_GTA02
++      ts.before_adc_hook = info->before_adc_hook;
++      ts.after_adc_hook = info->after_adc_hook;
++#endif
++
+       ret = request_irq(ts.irq_tc, stylus_irq, IRQF_DISABLED,
+                         "s3c2410_ts_pen", ts.input);
+       if (ret) {
+@@ -412,6 +432,15 @@ static int s3c2410ts_suspend(struct device *dev)
+       ts.expectedintr = WAITFORINT_NOTHING;
+       writel(TSC_SLEEP, ts.io + S3C2410_ADCTSC);
+       disable_irq(ts.irq_tc);
++
++      del_timer_sync(&touch_timer); 
++      /* TODO - need to fix races better, as timer can fire 
++         between TSC_SLEEP and del_timer_sync() and shedule next adc */
++
++#ifdef CONFIG_MACH_NEO1973_GTA02
++      ts.after_adc_hook();
++#endif
++
+       clk_disable(ts.clock);
+       return 0;
 diff --git a/drivers/mfd/glamo-core.c b/drivers/mfd/glamo-core.c
-index 3d57d2b..e558adc 100644
+index fb0c92d..716f236 100644
 --- a/drivers/mfd/glamo-core.c
 +++ b/drivers/mfd/glamo-core.c
 @@ -104,6 +104,8 @@ static const struct reg_range reg_range[] = {
@@ -113,11 +193,31 @@ index 3d57d2b..e558adc 100644
  static inline void __reg_write(struct glamo_core *glamo,
                                uint16_t reg, uint16_t val)
  {
-@@ -169,6 +171,44 @@ static inline void __reg_set_bit(struct glamo_core *glamo,
+@@ -160,6 +162,19 @@ static void reg_set_bit_mask(struct glamo_core *glamo,
+       spin_unlock(&glamo->lock);
+ }
++
++
++static void reg_checkandset_bit_mask(struct glamo_core *glamo,
++                              uint16_t reg, uint16_t mask,
++                              uint16_t val, uint16_t check)
++{
++      spin_lock(&glamo->lock);
++      if (__reg_read(glamo, reg) & mask == check)
++          __reg_set_bit_mask(glamo, reg, mask, val);
++      spin_unlock(&glamo->lock);
++}
++
++
+ static inline void __reg_set_bit(struct glamo_core *glamo,
+                                uint16_t reg, uint16_t bit)
+ {
+@@ -169,6 +184,49 @@ static inline void __reg_set_bit(struct glamo_core *glamo,
        __reg_write(glamo, reg, tmp);
  }
  
-+void glamo_pixclock_slow () {
++void glamo_pixclock_slow (struct glamo_core *glamo) {
 +      
 +      int x,lastx=0;
 +      int timeout=1000000;
@@ -129,7 +229,7 @@ index 3d57d2b..e558adc 100644
 +      //int phase=0; //wait for value changing, then for non-changing
 +
 +      for (fa=0;fa<timeout;fa++) {
-+              x = __reg_read(default_glamo, 0x1100 + GLAMO_REG_LCD_STATUS1) & 0x3ff;
++              x = glamo_reg_read(glamo, 0x1100 + GLAMO_REG_LCD_STATUS1) & 0x3ff;
 +
 +
 +              if (x == lastx) {
@@ -145,20 +245,25 @@ index 3d57d2b..e558adc 100644
 +              printk (KERN_WARNING "Error waiting\n");
 +      }
 +
-+      //then, make glamo slower
-+      reg_set_bit_mask (default_glamo, 0x36, 0xFF, 0xFF);
-+}
++      /* then, make glamo slower */
++      /* it's not a problems if in rare case we do not slow down glamo properly
++         as all we'll get in that case is singe jittered value */
++      
++      default_glamo->slowed_divider = glamo_reg_read (glamo, 0x36) & 0xFF;
++      reg_set_bit_mask (glamo, 0x36, 0xFF, 0xFF);
 +
-+void glamo_pixclock_fast () {
-+      reg_set_bit_mask (default_glamo, 0x36, 0xFF, 0x02);
 +}
 +
-+
++void glamo_pixclock_fast (struct glamo_core *glamo) {
++      reg_checkandset_bit_mask (glamo, 0x36, 0xFF, glamo->slowed_divider, 0xFF);
++}
++EXPORT_SYMBOL_GPL(glamo_pixclock_fast);
++EXPORT_SYMBOL_GPL(glamo_pixclock_slow);
 +
  static inline void __reg_clear_bit(struct glamo_core *glamo,
                                        uint16_t reg, uint16_t bit)
  {
-@@ -938,6 +978,8 @@ static int __devinit glamo_probe(struct platform_device *pdev)
+@@ -963,6 +1021,8 @@ static int __devinit glamo_probe(struct platform_device *pdev)
        for (n = 0; n < __NUM_GLAMO_ENGINES; n++)
                glamo->engine_state[n] = GLAMO_ENGINE_DISABLED;
  
@@ -167,7 +272,15 @@ index 3d57d2b..e558adc 100644
        spin_lock_init(&glamo->lock);
  
        glamo->pdev = pdev;
-@@ -980,7 +1022,7 @@ static int __devinit glamo_probe(struct platform_device *pdev)
+@@ -970,6 +1030,7 @@ static int __devinit glamo_probe(struct platform_device *pdev)
+       glamo->irq = platform_get_irq(pdev, 0);
+       glamo->irq_base = irq_base = platform_get_irq(pdev, 1);
+       glamo->pdata = pdev->dev.platform_data;
++      glamo->slowed_divider = 0xFF;
+       if (glamo->irq < 0) {
+               ret = glamo->irq;
+@@ -1005,7 +1066,7 @@ static int __devinit glamo_probe(struct platform_device *pdev)
                goto err_free;
        }
  
@@ -177,10 +290,16 @@ index 3d57d2b..e558adc 100644
                dev_err(&pdev->dev, "Failed to ioremap() memory region\n");
                goto err_release_mem_region;
 diff --git a/include/linux/mfd/glamo-core.h b/include/linux/mfd/glamo-core.h
-index 66cd7a5..d5c11be 100644
+index 66cd7a5..6fe29a8 100644
 --- a/include/linux/mfd/glamo-core.h
 +++ b/include/linux/mfd/glamo-core.h
-@@ -54,6 +54,8 @@ struct glamo_core {
+@@ -49,11 +49,14 @@ struct glamo_core {
+       enum glamo_engine_state engine_state[__NUM_GLAMO_ENGINES];
+       spinlock_t lock;
+       uint16_t saved_irq_mask;
++      int slowed_divider;
+ #ifdef CONFIG_DEBUG_FS
+       struct dentry *debugfs_dir;
  #endif
  };
  
@@ -189,13 +308,13 @@ index 66cd7a5..d5c11be 100644
  struct glamo_script {
        uint16_t reg;
        uint16_t val;
-@@ -67,4 +69,6 @@ int glamo_engine_disable(struct glamo_core *glamo, enum glamo_engine engine);
+@@ -67,4 +70,6 @@ int glamo_engine_disable(struct glamo_core *glamo, enum glamo_engine engine);
  void glamo_engine_reset(struct glamo_core *glamo, enum glamo_engine engine);
  int glamo_engine_reclock(struct glamo_core *glamo,
                         enum glamo_engine engine, int ps);
-+void glamo_pixclock_slow ();
-+void glamo_pixclock_fast ();
++void glamo_pixclock_slow (struct glamo_core *glamo);
++void glamo_pixclock_fast (struct glamo_core *glamo);
  #endif /* __GLAMO_CORE_H */
 -- 
-1.7.3.1
+1.7.3.2
 
index d2e9880..6299a7f 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.34.2
-# Wed Aug  4 11:02:10 2010
+# Linux kernel version: 2.6.34.7
+# Fri Oct 29 12:29:23 2010
 #
 CONFIG_ARM=y
 CONFIG_HAVE_PWM=y
index 4ca4ba8..7c6cb49 100644 (file)
@@ -4,7 +4,7 @@ require linux-openmoko.inc
 KERNEL_RELEASE="2.6.34.7"
 
 SRCREV = "e4182f3551f1b8e8f8bd07a2d68e49a0ec4cd04a"
-OEV = "oe8"
+OEV = "oe9"
 PV = "${KERNEL_RELEASE}-${OEV}+gitr${SRCPV}"
 
 SRC_URI = "\
@@ -26,6 +26,7 @@ SRC_URI = "\
   file://0008-Use-unlocked_ioctl-rather-than-ioctl.patch \
   file://0001-glamo-display-Enable-FIFO-stage-for-the-LCD-engine-s.patch \
   file://0009-glamo-display-fix-WSOD-for-242-timming.patch \
+  file://0001-Enable-3D-engine.patch \
 # patches from Radek Polak used in qtmoko
   file://0001-accels.patch.patch \
   file://0002-usbhost.patch.patch \