Re: Beagleboard -XM and 32GB microSD card oddities

2011-06-30 Thread Gregoire Gentil
Is your card labeled SDHC or SDXC? Can you give the specs of your card?
Have you tried on Pandaboard? 

Grégoire

On Thu, 2011-06-30 at 10:50 +0100, Sid Boyce wrote:
 I'm not really looking for a solution, just supplying some information 
 in case anyone is contemplating a 16GB card.
 
 Using Ubuntu 11.04 ARM or x86_64, I cannot create an ext4 partition that 
 will mount. Doing fsck.ext4 appears to fix the filesystem, but rerunning 
 fsck.ext4 a second time gives the same errors.
 
 Only BTRFS works.
 
 A BTRFS partition can be created without a problem. I then use rsync to 
 copy across all the data from the 16GB (ext4) partition and it mounts 
 without errors. After the rsync I create the excluded directories proc, 
 sys, tmp, media.
 
 I get a kernel oops (2.6.39-x1) on boot up of the 32GB card.
 I'm still trying to figure why I'm getting the oops that I don't have on 
 the original 16GB card.
 Regards
 Sid.


--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Super Fast Linux Boot on BeagleBoard: 300 ms from boot loader to shell

2011-04-13 Thread Gregoire Gentil
First, if the kernel is pretty empty, what's the point of booting in
300ms? What's the business case?

Secondly, there is no source on this page, no detailed paper about what
are the optimizations in x-load and kernel.

Bottom-line, I thought that the linux-omap mailing list was ad-free...

Grégoire


On Wed, 2011-04-13 at 17:42 +0300, Constantine Shulyupin wrote:
 Hi,
 
 Make Linux Software presents the fastest ever embedded Linux boot for
 720 MHz ARM and NAND flash memory. Linux boot time is 300 milliseconds
 from boot loader to shell. The first goal of the project is to achieve
 a minimal boot time of a minimal but functional Linux system on common
 hardware. The second goal is to provide a platform for developing more
 functional systems with shortest possible boot time.
 
 Video of boot process: http://www.youtube.com/watch?v=747XLVbTgA4
 
 Boot log with timestamps:
 
 0.000 0.000: TI X-Loader 1.4.4ss Mar 26 2011 01:45:43
 0.000 0.000: Optimised by www.MakeLinux.com
 0.000 0.000: Loading
 0.237 0.237: Running
 0.237 0.000: CFG_LOADADDR=80008000
 0.249 0.012: *(int*)CFG_LOADADDR=e321f0d3
 0.276 0.027: Linux version 2.6.32 (co...@makelinux.com)
 0.276 0.000: Starting application
 0.296 0.020: BusyBox v1.16.2 hush - the humble shell
 
 To learn more, please visit http://www.makelinux.com/emb/fastboot/omap
 


--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: How to completely switch off LCD backlight

2011-02-06 Thread Gregoire Gentil
If you are not using it, put .reset_gpio = 96 in your board file for the
DSS2 structure. Then echo 1/0  .../fb0/blank will do the trick to turn
on/off your screen,

Grégoire

On Sun, 2011-02-06 at 21:53 +0400, Elvis Dowson wrote:
 Hi Grant,
 Thanks for the reply. 
 
 On Feb 6, 2011, at 9:30 PM, Grant Erickson wrote:
  
  The following script should be instructive:
  
 device=/sys/devices/platform/pwm-backlight.0/backlight/pwm-backlight.0
 
 For me, this is located in /sys/class/backlight/beagleboard
 
 and bl_power is located in /sys/class/backlight/beagleboard
 
 power=${device}/bl_power
 brightness=${device}/brightness
 max=${device}/max_brightness
  
  
 disable_backlight () {
 echo 1  ${power}
 }
  
 enable_backlight () {
 echo 0  ${power}
 }
 
 I did try
 
 echo 1  bl_power
 
 but there was no effect. GPIO 96 from the OMAP3503 is physically connected to 
 LCD LED backlight enable, which I think is what would be used to turn the 
 backlight on/off. 
 
 Where can I specify the mapping of GPIO 96 to the bl_power file, so that the 
 LCD backlight can be switched off?
 
 Elvis
 
 
 
 --
 To unsubscribe from this list: send the line unsubscribe linux-omap in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html


--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/8] AI TB: Always Innovating OMAP3-based Touch Book

2009-11-19 Thread Gregoire Gentil

This series adds support for Always Innovating OMAP3-based Touch Book.

I also attach the patches as it seems that the last time, the indentation
was screwed up by the mailer.

Gregoire Gentil (8):
  defconfig file of Always Innovating OMAP3-based Touch Book
  Board file of Always Innovating OMAP3-based Touch Book
  Freescale MMA7455 accelerometer driver
  Driver for Always Innovating OMAP3-based Touch Book keyboard
  HID file for Always Innovating OMAP3-based Touch Book keyboard
  Audio driver of Always Innovating OMAP3-based Touch Book
  Video driver of Always Innovating OMAP3-based Touch Book
  Additional files for Always Innovating OMAP3-based Touch Book

 arch/arm/configs/omap3_touchbook_defconfig | 2441 
 arch/arm/mach-omap2/Kconfig|5 +
 arch/arm/mach-omap2/Makefile   |2 +
 arch/arm/mach-omap2/board-omap3touchbook.c |  683 
 drivers/hid/Kconfig|7 +
 drivers/hid/Makefile   |1 +
 drivers/hid/hid-alwaysinnovating.c |  262 +++
 drivers/hid/hid-core.c |1 +
 drivers/hid/hid-ids.h  |3 +
 drivers/input/misc/Kconfig |9 +
 drivers/input/misc/Makefile|2 +-
 drivers/input/misc/mma7455l.c  |  626 +++
 drivers/video/omap/lcd_omap3touchbook.c|  130 ++
 include/linux/mma7455l.h   |   11 +
 sound/soc/omap/Kconfig |8 +
 sound/soc/omap/Makefile|2 +
 sound/soc/omap/omap3touchbook.c|  211 +++
 17 files changed, 4403 insertions(+), 1 deletions(-)
 create mode 100644 arch/arm/configs/omap3_touchbook_defconfig
 create mode 100644 arch/arm/mach-omap2/board-omap3touchbook.c
 create mode 100644 drivers/hid/hid-alwaysinnovating.c
 create mode 100644 drivers/input/misc/mma7455l.c
 create mode 100644 drivers/video/omap/lcd_omap3touchbook.c
 create mode 100644 include/linux/mma7455l.h
 create mode 100644 sound/soc/omap/omap3touchbook.c

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/8] Board file of Always Innovating OMAP3-based Touch Book

2009-11-19 Thread Gregoire Gentil

Signed-off-by: Gregoire Gentil grego...@gentil.com
---
 arch/arm/mach-omap2/board-omap3touchbook.c |  683 
 1 files changed, 683 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-omap2/board-omap3touchbook.c

diff --git a/arch/arm/mach-omap2/board-omap3touchbook.c 
b/arch/arm/mach-omap2/board-omap3touchbook.c
new file mode 100644
index 000..ad3ef6e
--- /dev/null
+++ b/arch/arm/mach-omap2/board-omap3touchbook.c
@@ -0,0 +1,683 @@
+/*
+ * linux/arch/arm/mach-omap2/board-omap3touchbook.c
+ *
+ * Copyright (C) 2009 Always Innovating
+ *
+ * Modified from mach-omap2/board-omap3beagleboard.c
+ *
+ * Initial code: Grégoire Gentil, Tim Yamin
+ *
+ * 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/kernel.h
+#include linux/init.h
+#include linux/platform_device.h
+#include linux/delay.h
+#include linux/err.h
+#include linux/clk.h
+#include linux/io.h
+#include linux/leds.h
+#include linux/gpio.h
+#include linux/input.h
+#include linux/gpio_keys.h
+
+#include linux/mtd/mtd.h
+#include linux/mtd/partitions.h
+#include linux/mtd/nand.h
+
+#include plat/mcspi.h
+#include linux/spi/spi.h
+
+#include linux/spi/ads7846.h
+#include linux/mma7455l.h
+
+#include plat/dmtimer.h
+#include linux/backlight.h
+
+#include linux/regulator/machine.h
+#include linux/i2c/twl4030.h
+
+#include mach/hardware.h
+#include asm/mach-types.h
+#include asm/mach/arch.h
+#include asm/mach/map.h
+#include asm/mach/flash.h
+
+#include plat/board.h
+#include plat/common.h
+#include plat/gpmc.h
+#include plat/nand.h
+#include plat/mux.h
+#include plat/usb.h
+#include plat/timer-gp.h
+
+#include mmc-twl4030.h
+
+#include asm/setup.h
+
+#define GPMC_CS0_BASE  0x60
+#define GPMC_CS_SIZE   0x30
+
+#define NAND_BLOCK_SIZESZ_128K
+
+#define OMAP3_AC_GPIO  136
+#define OMAP3_TS_GPIO  162
+#define TB_BL_PWM_TIMER9
+#define TB_KILL_POWER_GPIO 168
+
+unsigned long touchbook_revision;
+
+static struct mtd_partition omap3touchbook_nand_partitions[] = {
+   /* All the partition sizes are listed in terms of NAND block size */
+   {
+   .name   = X-Loader,
+   .offset = 0,
+   .size   = 4 * NAND_BLOCK_SIZE,
+   .mask_flags = MTD_WRITEABLE,/* force read-only */
+   },
+   {
+   .name   = U-Boot,
+   .offset = MTDPART_OFS_APPEND,   /* Offset = 0x8 */
+   .size   = 15 * NAND_BLOCK_SIZE,
+   .mask_flags = MTD_WRITEABLE,/* force read-only */
+   },
+   {
+   .name   = U-Boot Env,
+   .offset = MTDPART_OFS_APPEND,   /* Offset = 0x26 */
+   .size   = 1 * NAND_BLOCK_SIZE,
+   },
+   {
+   .name   = Kernel,
+   .offset = MTDPART_OFS_APPEND,   /* Offset = 0x28 */
+   .size   = 32 * NAND_BLOCK_SIZE,
+   },
+   {
+   .name   = File System,
+   .offset = MTDPART_OFS_APPEND,   /* Offset = 0x68 */
+   .size   = MTDPART_SIZ_FULL,
+   },
+};
+
+static struct omap_nand_platform_data omap3touchbook_nand_data = {
+   .options= NAND_BUSWIDTH_16,
+   .parts  = omap3touchbook_nand_partitions,
+   .nr_parts   = ARRAY_SIZE(omap3touchbook_nand_partitions),
+   .dma_channel= -1,   /* disable DMA in OMAP NAND driver */
+   .nand_setup = NULL,
+   .dev_ready  = NULL,
+};
+
+static struct resource omap3touchbook_nand_resource = {
+   .flags  = IORESOURCE_MEM,
+};
+
+static struct platform_device omap3touchbook_nand_device = {
+   .name   = omap2-nand,
+   .id = -1,
+   .dev= {
+   .platform_data  = omap3touchbook_nand_data,
+   },
+   .num_resources  = 1,
+   .resource   = omap3touchbook_nand_resource,
+};
+
+#include sdram-micron-mt46h32m32lf-6.h
+
+static struct twl4030_hsmmc_info mmc[] = {
+   {
+   .mmc= 1,
+   .wires  = 8,
+   .gpio_wp= 29,
+   },
+   {}  /* Terminator */
+};
+
+static struct platform_device omap3_touchbook_lcd_device = {
+   .name   = omap3touchbook_lcd,
+   .id = -1,
+};
+
+static struct omap_lcd_config omap3_touchbook_lcd_config __initdata = {
+   .ctrl_name  = internal,
+};
+
+static struct regulator_consumer_supply touchbook_vmmc1_supply = {
+   .supply = vmmc,
+};
+
+static struct regulator_consumer_supply touchbook_vsim_supply = {
+   .supply = vmmc_aux,
+};
+
+static struct gpio_led gpio_leds[];
+
+static int

[PATCH 3/8] Freescale MMA7455 accelerometer driver

2009-11-19 Thread Gregoire Gentil

Signed-off-by: Gregoire Gentil grego...@gentil.com
---
 drivers/input/misc/Kconfig|9 +
 drivers/input/misc/Makefile   |2 +-
 drivers/input/misc/mma7455l.c |  626 +
 include/linux/mma7455l.h  |   11 +
 4 files changed, 647 insertions(+), 1 deletions(-)
 create mode 100644 drivers/input/misc/mma7455l.c
 create mode 100644 include/linux/mma7455l.h

diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index a9bb254..454bac7 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -317,4 +317,13 @@ config INPUT_PCAP
  To compile this driver as a module, choose M here: the
  module will be called pcap_keys.
 
+config INPUT_MMA7455L
+   tristate Freescale MMA7455L 3-axis accelerometer
+   depends on SPI_MASTER
+   help
+ SPI driver for the Freescale MMA7455L 3-axis accelerometer.
+
+ The userspace interface is a 3-axis (X/Y/Z) relative movement
+ Linux input device, reporting REL_[XYZ] events.
+
 endif
diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile
index a8b8485..3db6347 100644
--- a/drivers/input/misc/Makefile
+++ b/drivers/input/misc/Makefile
@@ -30,4 +30,4 @@ obj-$(CONFIG_INPUT_WINBOND_CIR)   += winbond-cir.o
 obj-$(CONFIG_INPUT_WISTRON_BTNS)   += wistron_btns.o
 obj-$(CONFIG_INPUT_WM831X_ON)  += wm831x-on.o
 obj-$(CONFIG_INPUT_YEALINK)+= yealink.o
-
+obj-$(CONFIG_INPUT_MMA7455L)   += mma7455l.o
diff --git a/drivers/input/misc/mma7455l.c b/drivers/input/misc/mma7455l.c
new file mode 100644
index 000..d415bb0
--- /dev/null
+++ b/drivers/input/misc/mma7455l.c
@@ -0,0 +1,626 @@
+/* Linux kernel driver for the Freescale MMA7455L 3-axis accelerometer
+ *
+ * Copyright (C) 2009 by Always Innovating, Inc.
+ * Author: Gregoire Gentil grego...@gentil.com
+ * Author: Tim Yamin pl...@roo.me.uk
+ * All rights reserved.
+ *
+ * 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 330, Boston,
+ * MA 02111-1307 USA
+ *
+ */
+
+/*
+ * What this driver doesn't yet support:
+ *
+ * - I2C
+ * - INT2 handling
+ * - Pulse detection (and the sysctls to control it)
+ * - 10-bit measurement
+ */
+
+#include linux/kernel.h
+#include linux/types.h
+#include linux/module.h
+#include linux/device.h
+#include linux/platform_device.h
+#include linux/delay.h
+#include linux/input.h
+#include linux/irq.h
+#include linux/interrupt.h
+#include linux/sysfs.h
+#include linux/gpio.h
+
+#include linux/mma7455l.h
+#include linux/spi/spi.h
+
+#define MMA7455L_WHOAMI_MAGIC  0x55
+
+enum mma7455l_reg {
+   MMA7455L_REG_XOUTL  = 0x00,
+   MMA7455L_REG_XOUTH  = 0x01,
+   MMA7455L_REG_YOUTL  = 0x02,
+   MMA7455L_REG_YOUTH  = 0x03,
+   MMA7455L_REG_ZOUTL  = 0x04,
+   MMA7455L_REG_ZOUTH  = 0x05,
+   MMA7455L_REG_XOUT8  = 0x06,
+   MMA7455L_REG_YOUT8  = 0x07,
+   MMA7455L_REG_ZOUT8  = 0x08,
+   MMA7455L_REG_STATUS = 0x09,
+   MMA7455L_REG_DETSRC = 0x0a,
+   MMA7455L_REG_TOUT   = 0x0b,
+   MMA7455L_REG_RESERVED1  = 0x0c,
+   MMA7455L_REG_I2CAD  = 0x0d,
+   MMA7455L_REG_USRINF = 0x0e,
+   MMA7455L_REG_WHOAMI = 0x0f,
+   MMA7455L_REG_XOFFL  = 0x10,
+   MMA7455L_REG_XOFFH  = 0x11,
+   MMA7455L_REG_YOFFL  = 0x12,
+   MMA7455L_REG_YOFFH  = 0x13,
+   MMA7455L_REG_ZOFFL  = 0x14,
+   MMA7455L_REG_ZOFFH  = 0x15,
+   MMA7455L_REG_MCTL   = 0x16,
+   MMA7455L_REG_INTRST = 0x17,
+   MMA7455L_REG_CTL1   = 0x18,
+   MMA7455L_REG_CTL2   = 0x19,
+   MMA7455L_REG_LDTH   = 0x1a,
+   MMA7455L_REG_PDTH   = 0x1b,
+   MMA7455L_REG_PW = 0x1c,
+   MMA7455L_REG_LT = 0x1d,
+   MMA7455L_REG_TW = 0x1e,
+   MMA7455L_REG_RESERVED2  = 0x1f,
+};
+
+enum mma7455l_reg_status {
+   MMA7455L_STATUS_XDA = 0x08,
+   MMA7455L_STATUS_YDA = 0x10,
+   MMA7455L_STATUS_ZDA = 0x20,
+};
+
+enum

[PATCH 4/8] Driver for Always Innovating OMAP3-based Touch Book keyboard

2009-11-19 Thread Gregoire Gentil

Signed-off-by: Gregoire Gentil grego...@gentil.com
---
 drivers/hid/Kconfig|7 +++
 drivers/hid/Makefile   |1 +
 drivers/hid/hid-core.c |1 +
 drivers/hid/hid-ids.h  |3 +++
 4 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index 24d90ea..b56ddc5 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -62,6 +62,13 @@ config HID_A4TECH
---help---
Support for A4 tech X5 and WOP-35 / Trust 450L mice.
 
+config HID_ALWAYSINNOVATING
+   tristate Always Innovating if EMBEDDED
+   depends on USB_HID
+   default !EMBEDDED
+   ---help---
+   Support for Always Innovating Touch Book.
+
 config HID_APPLE
tristate Apple if EMBEDDED
depends on (USB_HID || BT_HIDP)
diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile
index 0de2dff..b6a2860 100644
--- a/drivers/hid/Makefile
+++ b/drivers/hid/Makefile
@@ -20,6 +20,7 @@ ifdef CONFIG_LOGIRUMBLEPAD2_FF
 endif
 
 obj-$(CONFIG_HID_A4TECH)   += hid-a4tech.o
+obj-$(CONFIG_HID_ALWAYSINNOVATING) += hid-alwaysinnovating.o
 obj-$(CONFIG_HID_APPLE)+= hid-apple.o
 obj-$(CONFIG_HID_BELKIN)   += hid-belkin.o
 obj-$(CONFIG_HID_CHERRY)   += hid-cherry.o
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 7d05c4b..2bb62c3 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1252,6 +1252,7 @@ EXPORT_SYMBOL_GPL(hid_disconnect);
 static const struct hid_device_id hid_blacklist[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU) },
{ HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_X5_005D) },
+   { HID_USB_DEVICE(USB_VENDOR_ID_ALWAYSINNOVATING, 
USB_DEVICE_ID_ALWAYSINNOVATING_TOUCH_BOOK) },
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, 
USB_DEVICE_ID_APPLE_ATV_IRCONTROL) },
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL4) },
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MIGHTYMOUSE) 
},
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index adbef5d..ebf53f7 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -54,6 +54,9 @@
 #define USB_VENDOR_ID_ALPS 0x0433
 #define USB_DEVICE_ID_IBM_GAMEPAD  0x1101
 
+#define USB_VENDOR_ID_ALWAYSINNOVATING 0xa110
+#define USB_DEVICE_ID_ALWAYSINNOVATING_TOUCH_BOOK  0x0002
+
 #define USB_VENDOR_ID_APPLE0x05ac
 #define USB_DEVICE_ID_APPLE_MIGHTYMOUSE0x0304
 #define USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI  0x020e
-- 
1.6.0.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/8] HID file for Always Innovating OMAP3-based Touch Book keyboard

2009-11-19 Thread Gregoire Gentil

Signed-off-by: Gregoire Gentil grego...@gentil.com
---
 drivers/hid/hid-alwaysinnovating.c |  262 
 1 files changed, 262 insertions(+), 0 deletions(-)
 create mode 100644 drivers/hid/hid-alwaysinnovating.c

diff --git a/drivers/hid/hid-alwaysinnovating.c 
b/drivers/hid/hid-alwaysinnovating.c
new file mode 100644
index 000..a7bb0fd
--- /dev/null
+++ b/drivers/hid/hid-alwaysinnovating.c
@@ -0,0 +1,262 @@
+/*
+ *  USB HID quirks support for the Always Innovating Touch Book
+ *  Code borrowed from hid-apple.c
+ *
+ *  Copyright (c) 2009 Gregoire Gentil grego...@gentil.com
+ *  Copyright (c) 2009 Tim Yamin pl...@roo.me.uk
+ */
+
+/*
+ * 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.
+ */
+
+#include linux/device.h
+#include linux/hid.h
+#include linux/module.h
+#include linux/usb.h
+
+#include hid-ids.h
+
+struct touchbook_sc {
+   unsigned long quirks;
+   unsigned int  fn_on;
+   DECLARE_BITMAP(pressed_fn, KEY_CNT);
+};
+
+struct touchbook_key_translation {
+   u16 from;
+   u16 to;
+   u8 flags;
+};
+
+static struct touchbook_key_translation touchbook_fn_keys[] = {
+   { KEY_F6,   KEY_BRIGHTNESSDOWN },
+   { KEY_F7,   KEY_BRIGHTNESSUP },
+
+   { KEY_F8,   KEY_MUTE },
+   { KEY_F9,   KEY_VOLUMEDOWN },
+   { KEY_F10,  KEY_VOLUMEUP },
+
+   { KEY_UP,   KEY_PAGEUP },
+   { KEY_DOWN, KEY_PAGEDOWN },
+   { }
+};
+
+extern unsigned long touchbook_revision;
+unsigned long swap_key;
+
+static struct touchbook_key_translation *touchbook_find_translation(
+   struct touchbook_key_translation *table, u16 from)
+{
+   struct touchbook_key_translation *trans;
+
+   /* Look for the translation */
+   for (trans = table; trans-from; trans++)
+   if (trans-from == from)
+   return trans;
+
+   return NULL;
+}
+
+static int touchbook_event(struct hid_device *hid, struct hid_field *field,
+   struct hid_usage *usage, __s32 value)
+{
+   int do_translate;
+
+   struct input_dev *input = field-hidinput-input;
+   struct touchbook_sc *asc = hid_get_drvdata(hid);
+   struct touchbook_key_translation *trans;
+
+   if (swap_key  usage-code == KEY_RIGHTSHIFT) {
+   input_event(input, usage-type, KEY_END, value);
+   return 1;
+   }
+
+   if (swap_key  usage-code == KEY_END) {
+   input_event(input, usage-type, KEY_RIGHTSHIFT, value);
+   return 1;
+   }
+
+   if (usage-code == KEY_POWER) {
+   asc-fn_on = !!value;
+   input_event(input, usage-type, usage-code, value);
+   return 1;
+   }
+
+   trans = touchbook_find_translation(touchbook_fn_keys, usage-code);
+   if (trans) {
+   if (test_bit(usage-code, asc-pressed_fn))
+   do_translate = 1;
+   else
+   do_translate = asc-fn_on;
+
+   if (do_translate) {
+   if (value)
+   set_bit(usage-code, asc-pressed_fn);
+   else
+   clear_bit(usage-code, asc-pressed_fn);
+
+   input_event(input, usage-type, trans-to,
+   value);
+
+   return 1;
+   }
+   }
+
+   return 0;
+}
+
+static int touchbook_input_mapping(struct hid_device *hdev,
+   struct hid_input *hi,
+   struct hid_field *field, struct hid_usage *usage,
+   unsigned long **bit, int *max)
+{
+   struct touchbook_key_translation *trans;
+
+   /* Enable all other keys */
+   for (trans = touchbook_fn_keys; trans-from; trans++)
+   set_bit(trans-to, hi-input-keybit);
+
+   return 0;
+}
+
+static ssize_t show_swap_key(struct device *dev,
+   struct device_attribute *attr, char *buf)
+{
+   return snprintf(buf, PAGE_SIZE, %lu\n, swap_key);
+}
+
+static ssize_t store_swap_key(struct device *dev,
+   struct device_attribute *attr,
+   const char *buf, size_t count)
+{
+strict_strtoul(buf, 10, swap_key);
+
+   if (swap_key != 0  swap_key != 1) {
+   swap_key = 0;
+   return -EINVAL;
+   }
+
+   return count;
+}
+
+static struct device_attribute touchbook_hid_attrs[] = {
+   __ATTR(swap_key, S_IRUGO | S_IWUGO, show_swap_key, store_swap_key),
+};
+
+int touchbook_create_sysfs(struct hid_device *hdev)
+{
+   int i;
+   int r;
+
+   for (i = 0; i  ARRAY_SIZE(touchbook_hid_attrs); i++) {
+   r = device_create_file(hdev-dev,
+   touchbook_hid_attrs[i

[PATCH 6/8] Audio driver of Always Innovating OMAP3-based Touch Book

2009-11-19 Thread Gregoire Gentil

Signed-off-by: Gregoire Gentil grego...@gentil.com
---
 sound/soc/omap/Kconfig  |8 ++
 sound/soc/omap/Makefile |2 +
 sound/soc/omap/omap3touchbook.c |  211 +++
 3 files changed, 221 insertions(+), 0 deletions(-)
 create mode 100644 sound/soc/omap/omap3touchbook.c

diff --git a/sound/soc/omap/Kconfig b/sound/soc/omap/Kconfig
index 653a362..c590252 100644
--- a/sound/soc/omap/Kconfig
+++ b/sound/soc/omap/Kconfig
@@ -83,6 +83,14 @@ config SND_OMAP_SOC_OMAP3_PANDORA
help
  Say Y if you want to add support for SoC audio on the OMAP3 Pandora.
 
+config SND_OMAP_SOC_OMAP3_TOUCHBOOK
+   tristate SoC Audio support for OMAP3 Touch Book
+   depends on TWL4030_CORE  SND_OMAP_SOC  MACH_OMAP3_TOUCHBOOK
+   select SND_OMAP_SOC_MCBSP
+   select SND_SOC_TWL4030
+   help
+ Say Y if you want to add support for SoC audio on the OMAP3 Touch 
Book.
+
 config SND_OMAP_SOC_OMAP3_BEAGLE
tristate SoC Audio support for OMAP3 Beagle
depends on TWL4030_CORE  SND_OMAP_SOC  MACH_OMAP3_BEAGLE
diff --git a/sound/soc/omap/Makefile b/sound/soc/omap/Makefile
index 02d6947..f360b82 100644
--- a/sound/soc/omap/Makefile
+++ b/sound/soc/omap/Makefile
@@ -15,6 +15,7 @@ snd-soc-omap3evm-objs := omap3evm.o
 snd-soc-sdp3430-objs := sdp3430.o
 snd-soc-omap3pandora-objs := omap3pandora.o
 snd-soc-omap3beagle-objs := omap3beagle.o
+snd-soc-omap3touchbook-objs := omap3touchbook.o
 snd-soc-zoom2-objs := zoom2.o
 
 obj-$(CONFIG_SND_OMAP_SOC_N810) += snd-soc-n810.o
@@ -26,4 +27,5 @@ obj-$(CONFIG_MACH_OMAP3EVM) += snd-soc-omap3evm.o
 obj-$(CONFIG_SND_OMAP_SOC_SDP3430) += snd-soc-sdp3430.o
 obj-$(CONFIG_SND_OMAP_SOC_OMAP3_PANDORA) += snd-soc-omap3pandora.o
 obj-$(CONFIG_SND_OMAP_SOC_OMAP3_BEAGLE) += snd-soc-omap3beagle.o
+obj-$(CONFIG_SND_OMAP_SOC_OMAP3_TOUCHBOOK) += snd-soc-omap3touchbook.o
 obj-$(CONFIG_SND_OMAP_SOC_ZOOM2) += snd-soc-zoom2.o
diff --git a/sound/soc/omap/omap3touchbook.c b/sound/soc/omap/omap3touchbook.c
new file mode 100644
index 000..584f07d
--- /dev/null
+++ b/sound/soc/omap/omap3touchbook.c
@@ -0,0 +1,211 @@
+/*
+ * omap3touchbook.c  --  SoC audio for OMAP3 Touch Book
+ *
+ * Author: Gregoire Gentil grego...@gentil.com
+ *
+ * Derived from sound/soc/omap/omap3beagle.c
+ *
+ * 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.
+ *
+ * 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., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#include linux/clk.h
+#include linux/irq.h
+#include linux/interrupt.h
+#include linux/platform_device.h
+
+#include sound/core.h
+#include sound/pcm.h
+#include sound/soc.h
+#include sound/soc-dapm.h
+
+#include asm/mach-types.h
+#include mach/hardware.h
+#include mach/gpio.h
+#include plat/mcbsp.h
+
+#include omap-mcbsp.h
+#include omap-pcm.h
+#include ../codecs/twl4030.h
+
+#define TB_HEADPHONE_GPIO 56
+#define TB_HEADPHONE_IRQ  OMAP_GPIO_IRQ(TB_HEADPHONE_GPIO)
+
+static int omap3touchbook_hw_params(struct snd_pcm_substream *substream,
+   struct snd_pcm_hw_params *params)
+{
+   struct snd_soc_pcm_runtime *rtd = substream-private_data;
+   struct snd_soc_dai *codec_dai = rtd-dai-codec_dai;
+   struct snd_soc_dai *cpu_dai = rtd-dai-cpu_dai;
+   unsigned int fmt;
+   int ret;
+
+   switch (params_channels(params)) {
+   case 2: /* Stereo I2S mode */
+   fmt =   SND_SOC_DAIFMT_I2S |
+   SND_SOC_DAIFMT_NB_NF |
+   SND_SOC_DAIFMT_CBM_CFM;
+   break;
+   case 4: /* Four channel TDM mode */
+   fmt =   SND_SOC_DAIFMT_DSP_A |
+   SND_SOC_DAIFMT_IB_NF |
+   SND_SOC_DAIFMT_CBM_CFM;
+   break;
+   default:
+   return -EINVAL;
+   }
+
+   /* Set codec DAI configuration */
+   ret = snd_soc_dai_set_fmt(codec_dai, fmt);
+   if (ret  0) {
+   printk(KERN_ERR can't set codec DAI configuration\n);
+   return ret;
+   }
+
+   /* Set cpu DAI configuration */
+   ret = snd_soc_dai_set_fmt(cpu_dai, fmt);
+   if (ret  0) {
+   printk(KERN_ERR can't set cpu DAI configuration\n);
+   return ret;
+   }
+
+   /* Set the codec system clock for DAC and ADC */
+   ret = snd_soc_dai_set_sysclk(codec_dai, 0, 2600,
+SND_SOC_CLOCK_IN);
+   if (ret  0) {
+   printk(KERN_ERR can't set codec

[PATCH 8/8] Additional file for Always Innovating OMAP3-based Touch Book

2009-11-19 Thread Gregoire Gentil

Signed-off-by: Gregoire Gentil grego...@gentil.com
---
 arch/arm/mach-omap2/Kconfig  |5 +
 arch/arm/mach-omap2/Makefile |2 ++
 2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index 034d990..6d32d1b 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -73,6 +73,11 @@ config MACH_OMAP3_PANDORA
bool OMAP3 Pandora
depends on ARCH_OMAP3  ARCH_OMAP34XX
 
+config MACH_OMAP3_TOUCHBOOK
+   bool OMAP3 Touch Book
+   depends on ARCH_OMAP3  ARCH_OMAP34XX
+   select BACKLIGHT_CLASS_DEVICE
+
 config MACH_OMAP_3430SDP
bool OMAP 3430 SDP board
depends on ARCH_OMAP3  ARCH_OMAP34XX
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 59b0ccc..b6b5c7f 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -90,6 +90,8 @@ obj-$(CONFIG_MACH_CM_T35) += board-cm-t35.o \
   mmc-twl4030.o
 obj-$(CONFIG_MACH_IGEP0020)+= board-igep0020.o \
   mmc-twl4030.o
+obj-$(CONFIG_MACH_OMAP3_TOUCHBOOK) += board-omap3touchbook.o \
+  mmc-twl4030.o
 
 obj-$(CONFIG_MACH_OMAP_4430SDP)+= board-4430sdp.o
 
-- 
1.6.0.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 7/8] Video driver of Always Innovating OMAP3-based Touch Book

2009-11-19 Thread Gregoire Gentil

Signed-off-by: Gregoire Gentil grego...@gentil.com
---
 drivers/video/omap/lcd_omap3touchbook.c |  130 +++
 1 files changed, 130 insertions(+), 0 deletions(-)
 create mode 100644 drivers/video/omap/lcd_omap3touchbook.c

diff --git a/drivers/video/omap/lcd_omap3touchbook.c 
b/drivers/video/omap/lcd_omap3touchbook.c
new file mode 100644
index 000..5b58703
--- /dev/null
+++ b/drivers/video/omap/lcd_omap3touchbook.c
@@ -0,0 +1,130 @@
+/*
+ * LCD panel support for the Touch Book
+ *
+ * Author: Gregoire Gentil grego...@gentil.com
+ *
+ * Derived from drivers/video/omap/lcd-omap3beagle.c
+ *
+ * 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 330, Boston, MA  02111-1307, USA.
+ */
+
+#include linux/module.h
+#include linux/platform_device.h
+#include linux/gpio.h
+#include linux/i2c/twl4030.h
+
+#include plat/mux.h
+#include plat/omapfb.h
+#include asm/mach-types.h
+
+#define LCD_PANEL_ENABLE_GPIO   176
+
+static int omap3beagle_panel_init(struct lcd_panel *panel,
+   struct omapfb_device *fbdev)
+{
+   gpio_request(LCD_PANEL_ENABLE_GPIO, LCD enable);
+   return 0;
+}
+
+static void omap3beagle_panel_cleanup(struct lcd_panel *panel)
+{
+   gpio_free(LCD_PANEL_ENABLE_GPIO);
+}
+
+static int omap3beagle_panel_enable(struct lcd_panel *panel)
+{
+   gpio_set_value(LCD_PANEL_ENABLE_GPIO, 1);
+   return 0;
+}
+
+static void omap3beagle_panel_disable(struct lcd_panel *panel)
+{
+   gpio_set_value(LCD_PANEL_ENABLE_GPIO, 0);
+}
+
+static unsigned long omap3beagle_panel_get_caps(struct lcd_panel *panel)
+{
+   return 0;
+}
+
+struct lcd_panel omap3beagle_panel = {
+   .name   = omap3beagle,
+   .config = OMAP_LCDC_PANEL_TFT,
+
+   .bpp= 16,
+   .data_lines = 24,
+   .x_res  = 1024,
+   .y_res  = 600,
+   .hsw= 3,
+   .hfp= 3,
+   .hbp= 39,
+   .vsw= 1,
+   .vfp= 2,
+   .vbp= 7,
+
+   .pixel_clock= 64000,
+
+   .init   = omap3touchbook_panel_init,
+   .cleanup= omap3touchbook_panel_cleanup,
+   .enable = omap3touchbook_panel_enable,
+   .disable= omap3touchbook_panel_disable,
+   .get_caps   = omap3touchbook_panel_get_caps,
+};
+
+static int omap3touchbook_panel_probe(struct platform_device *pdev)
+{
+   omapfb_register_panel(omap3beagle_panel);
+   return 0;
+}
+
+static int omap3touchbook_panel_remove(struct platform_device *pdev)
+{
+   return 0;
+}
+
+static int omap3touchbook_panel_suspend(struct platform_device *pdev,
+  pm_message_t mesg)
+{
+   return 0;
+}
+
+static int omap3touchbook_panel_resume(struct platform_device *pdev)
+{
+   return 0;
+}
+
+struct platform_driver omap3touchbook_panel_driver = {
+   .probe  = omap3touchbook_panel_probe,
+   .remove = omap3touchbook_panel_remove,
+   .suspend= omap3touchbook_panel_suspend,
+   .resume = omap3touchbook_panel_resume,
+   .driver = {
+   .name   = omap3touchbook_lcd,
+   .owner  = THIS_MODULE,
+   },
+};
+
+static int __init omap3touchbook_panel_drv_init(void)
+{
+   return platform_driver_register(omap3beagle_panel_driver);
+}
+
+static void __exit omap3touchbook_panel_drv_exit(void)
+{
+   platform_driver_unregister(omap3touchbook_panel_driver);
+}
+
+module_init(omap3touchbook_panel_drv_init);
+module_exit(omap3touchbook_panel_drv_exit);
-- 
1.6.0.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/8] AI TB: Board file of Always Innovating OMAP3-based Touch Book

2009-11-18 Thread Gregoire Gentil
Signed-off-by: Gregoire Gentil grego...@gentil.com
---
arch/arm/mach-omap2/board-omap3touchbook.c |  683

1 files changed, 683 insertions(+), 0 deletions(-)
create mode 100644 arch/arm/mach-omap2/board-omap3touchbook.c

diff --git a/arch/arm/mach-omap2/board-omap3touchbook.c
b/arch/arm/mach-omap2/board-omap3touchbook.c
new file mode 100644
index 000..ad3ef6e
--- /dev/null
+++ b/arch/arm/mach-omap2/board-omap3touchbook.c
@@ -0,0 +1,683 @@
+/*
+ * linux/arch/arm/mach-omap2/board-omap3touchbook.c
+ *
+ * Copyright (C) 2009 Always Innovating
+ *
+ * Modified from mach-omap2/board-omap3beagleboard.c
+ *
+ * Initial code: Grégoire Gentil, Tim Yamin
+ *
+ * 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/kernel.h
+#include linux/init.h
+#include linux/platform_device.h
+#include linux/delay.h
+#include linux/err.h
+#include linux/clk.h
+#include linux/io.h
+#include linux/leds.h
+#include linux/gpio.h
+#include linux/input.h
+#include linux/gpio_keys.h
+
+#include linux/mtd/mtd.h
+#include linux/mtd/partitions.h
+#include linux/mtd/nand.h
+
+#include plat/mcspi.h
+#include linux/spi/spi.h
+
+#include linux/spi/ads7846.h
+#include linux/mma7455l.h
+
+#include plat/dmtimer.h
+#include linux/backlight.h
+
+#include linux/regulator/machine.h
+#include linux/i2c/twl4030.h
+
+#include mach/hardware.h
+#include asm/mach-types.h
+#include asm/mach/arch.h
+#include asm/mach/map.h
+#include asm/mach/flash.h
+
+#include plat/board.h
+#include plat/common.h
+#include plat/gpmc.h
+#include plat/nand.h
+#include plat/mux.h
+#include plat/usb.h
+#include plat/timer-gp.h
+
+#include mmc-twl4030.h
+
+#include asm/setup.h
+
+#define GPMC_CS0_BASE  0x60
+#define GPMC_CS_SIZE   0x30
+
+#define NAND_BLOCK_SIZE SZ_128K
+
+#define OMAP3_AC_GPIO 136
+#define OMAP3_TS_GPIO 162
+#define TB_BL_PWM_TIMER 9
+#define TB_KILL_POWER_GPIO 168
+
+unsigned long touchbook_revision;
+
+static struct mtd_partition omap3touchbook_nand_partitions[] = {
+ /* All the partition sizes are listed in terms of NAND block size */
+ {
+ .name = X-Loader,
+ .offset = 0,
+ .size = 4 * NAND_BLOCK_SIZE,
+ .mask_flags = MTD_WRITEABLE, /* force read-only */
+ },
+ {
+ .name = U-Boot,
+ .offset = MTDPART_OFS_APPEND, /* Offset = 0x8 */
+ .size = 15 * NAND_BLOCK_SIZE,
+ .mask_flags = MTD_WRITEABLE, /* force read-only */
+ },
+ {
+ .name = U-Boot Env,
+ .offset = MTDPART_OFS_APPEND, /* Offset = 0x26 */
+ .size = 1 * NAND_BLOCK_SIZE,
+ },
+ {
+ .name = Kernel,
+ .offset = MTDPART_OFS_APPEND, /* Offset = 0x28 */
+ .size = 32 * NAND_BLOCK_SIZE,
+ },
+ {
+ .name = File System,
+ .offset = MTDPART_OFS_APPEND, /* Offset = 0x68 */
+ .size = MTDPART_SIZ_FULL,
+ },
+};
+
+static struct omap_nand_platform_data omap3touchbook_nand_data = {
+ .options = NAND_BUSWIDTH_16,
+ .parts = omap3touchbook_nand_partitions,
+ .nr_parts = ARRAY_SIZE(omap3touchbook_nand_partitions),
+ .dma_channel = -1, /* disable DMA in OMAP NAND driver */
+ .nand_setup = NULL,
+ .dev_ready = NULL,
+};
+
+static struct resource omap3touchbook_nand_resource = {
+ .flags = IORESOURCE_MEM,
+};
+
+static struct platform_device omap3touchbook_nand_device = {
+ .name = omap2-nand,
+ .id = -1,
+ .dev = {
+ .platform_data = omap3touchbook_nand_data,
+ },
+ .num_resources = 1,
+ .resource = omap3touchbook_nand_resource,
+};
+
+#include sdram-micron-mt46h32m32lf-6.h
+
+static struct twl4030_hsmmc_info mmc[] = {
+ {
+ .mmc = 1,
+ .wires = 8,
+ .gpio_wp = 29,
+ },
+ {} /* Terminator */
+};
+
+static struct platform_device omap3_touchbook_lcd_device = {
+ .name = omap3touchbook_lcd,
+ .id = -1,
+};
+
+static struct omap_lcd_config omap3_touchbook_lcd_config __initdata = {
+ .ctrl_name = internal,
+};
+
+static struct regulator_consumer_supply touchbook_vmmc1_supply = {
+ .supply = vmmc,
+};
+
+static struct regulator_consumer_supply touchbook_vsim_supply = {
+ .supply = vmmc_aux,
+};
+
+static struct gpio_led gpio_leds[];
+
+static int touchbook_twl_gpio_setup(struct device *dev,
+ unsigned gpio, unsigned ngpio)
+{
+ if (system_rev = 0x20  system_rev = 0x34301000) {
+ omap_cfg_reg(AG9_34XX_GPIO23);
+ mmc[0].gpio_wp = 23;
+ } else {
+ omap_cfg_reg(AH8_34XX_GPIO29);
+ }
+ /* gpio + 0 is mmc0_cd (input/IRQ) */
+ mmc[0].gpio_cd = gpio + 0;
+ twl4030_mmc_init(mmc);
+
+ /* link regulators to MMC adapters */
+ touchbook_vmmc1_supply.dev = mmc[0].dev;
+ touchbook_vsim_supply.dev = mmc[0].dev;
+
+ /* REVISIT: need ehci-omap hooks for external VBUS
+ * power switch and overcurrent detect
+ */
+
+ gpio_request(gpio + 1, EHCI_nOC);
+ gpio_direction_input(gpio + 1);
+
+ /* TWL4030_GPIO_MAX + 0 == ledA, EHCI nEN_USB_PWR (out, active low) */
+ gpio_request(gpio + TWL4030_GPIO_MAX, nEN_USB_PWR);
+ gpio_direction_output(gpio + TWL4030_GPIO_MAX, 0);
+
+ /* TWL4030_GPIO_MAX + 1 == ledB, PMU_STAT (out, active low LED) */
+ gpio_leds[2

[PATCH 7/8] AI TB: Video driver of Always Innovating OMAP3-based Touch Book

2009-11-18 Thread Gregoire Gentil
Signed-off-by: Gregoire Gentil grego...@gentil.com
---
drivers/video/omap/lcd_omap3touchbook.c |  130
+++
1 files changed, 130 insertions(+), 0 deletions(-)
create mode 100644 drivers/video/omap/lcd_omap3touchbook.c

diff --git a/drivers/video/omap/lcd_omap3touchbook.c
b/drivers/video/omap/lcd_omap3touchbook.c
new file mode 100644
index 000..5b58703
--- /dev/null
+++ b/drivers/video/omap/lcd_omap3touchbook.c
@@ -0,0 +1,130 @@
+/*
+ * LCD panel support for the Touch Book
+ *
+ * Author: Gregoire Gentil grego...@gentil.com
+ *
+ * Derived from drivers/video/omap/lcd-omap3beagle.c
+ *
+ * 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 330, Boston, MA  02111-1307, USA.
+ */
+
+#include linux/module.h
+#include linux/platform_device.h
+#include linux/gpio.h
+#include linux/i2c/twl4030.h
+
+#include plat/mux.h
+#include plat/omapfb.h
+#include asm/mach-types.h
+
+#define LCD_PANEL_ENABLE_GPIO   176
+
+static int omap3beagle_panel_init(struct lcd_panel *panel,
+ struct omapfb_device *fbdev)
+{
+ gpio_request(LCD_PANEL_ENABLE_GPIO, LCD enable);
+ return 0;
+}
+
+static void omap3beagle_panel_cleanup(struct lcd_panel *panel)
+{
+ gpio_free(LCD_PANEL_ENABLE_GPIO);
+}
+
+static int omap3beagle_panel_enable(struct lcd_panel *panel)
+{
+ gpio_set_value(LCD_PANEL_ENABLE_GPIO, 1);
+ return 0;
+}
+
+static void omap3beagle_panel_disable(struct lcd_panel *panel)
+{
+ gpio_set_value(LCD_PANEL_ENABLE_GPIO, 0);
+}
+
+static unsigned long omap3beagle_panel_get_caps(struct lcd_panel
*panel)
+{
+ return 0;
+}
+
+struct lcd_panel omap3beagle_panel = {
+ .name = omap3beagle,
+ .config = OMAP_LCDC_PANEL_TFT,
+
+ .bpp = 16,
+ .data_lines = 24,
+ .x_res = 1024,
+ .y_res = 600,
+ .hsw = 3,
+ .hfp = 3,
+ .hbp = 39,
+ .vsw = 1,
+ .vfp = 2,
+ .vbp = 7,
+
+ .pixel_clock = 64000,
+
+ .init = omap3touchbook_panel_init,
+ .cleanup = omap3touchbook_panel_cleanup,
+ .enable = omap3touchbook_panel_enable,
+ .disable = omap3touchbook_panel_disable,
+ .get_caps = omap3touchbook_panel_get_caps,
+};
+
+static int omap3touchbook_panel_probe(struct platform_device *pdev)
+{
+ omapfb_register_panel(omap3beagle_panel);
+ return 0;
+}
+
+static int omap3touchbook_panel_remove(struct platform_device *pdev)
+{
+ return 0;
+}
+
+static int omap3touchbook_panel_suspend(struct platform_device *pdev,
+pm_message_t mesg)
+{
+ return 0;
+}
+
+static int omap3touchbook_panel_resume(struct platform_device *pdev)
+{
+ return 0;
+}
+
+struct platform_driver omap3touchbook_panel_driver = {
+ .probe = omap3touchbook_panel_probe,
+ .remove = omap3touchbook_panel_remove,
+ .suspend = omap3touchbook_panel_suspend,
+ .resume = omap3touchbook_panel_resume,
+ .driver = {
+ .name = omap3touchbook_lcd,
+ .owner = THIS_MODULE,
+ },
+};
+
+static int __init omap3touchbook_panel_drv_init(void)
+{
+ return platform_driver_register(omap3beagle_panel_driver);
+}
+
+static void __exit omap3touchbook_panel_drv_exit(void)
+{
+ platform_driver_unregister(omap3touchbook_panel_driver);
+}
+
+module_init(omap3touchbook_panel_drv_init);
+module_exit(omap3touchbook_panel_drv_exit);
-- 
1.6.0.4


From f5576d74460c00bf82707fc9a2d4db12227b55e0 Mon Sep 17 00:00:00 2001
From: Gregoire Gentil grego...@gentil.com
Date: Wed, 18 Nov 2009 18:34:14 -0800
Subject: [PATCH] Video driver of Always Innovating OMAP3-based Touch Book


Signed-off-by: Gregoire Gentil grego...@gentil.com
---
 drivers/video/omap/lcd_omap3touchbook.c |  130 +++
 1 files changed, 130 insertions(+), 0 deletions(-)
 create mode 100644 drivers/video/omap/lcd_omap3touchbook.c

diff --git a/drivers/video/omap/lcd_omap3touchbook.c b/drivers/video/omap/lcd_omap3touchbook.c
new file mode 100644
index 000..5b58703
--- /dev/null
+++ b/drivers/video/omap/lcd_omap3touchbook.c
@@ -0,0 +1,130 @@
+/*
+ * LCD panel support for the Touch Book
+ *
+ * Author: Gregoire Gentil grego...@gentil.com
+ *
+ * Derived from drivers/video/omap/lcd-omap3beagle.c
+ *
+ * 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

[PATCH 0/5] AI TB: Always Innovating OMAP3-based Touch Book

2009-11-15 Thread Gregoire Gentil
This series adds support for the Always Innovating OMAP3-based Touch
Book,

Grégoire Gentil




Gregoire Gentil (5):
  Defconfig file of the Always Innovating OMAP3-based Touch Book.
  Board file of the Always Innovating OMAP3-based Touch Book.
  Driver for the Freescale MMA7455L accelerometer
  Driver for the Always Innovating Touch Book keyboard.
  Additional modifications for the Always Innovating OMAP3-based

arch/arm/configs/omap3_touchbook_defconfig | 2441

arch/arm/mach-omap2/Kconfig|5 +
arch/arm/mach-omap2/Makefile   |2 +
arch/arm/mach-omap2/board-omap3touchbook.c |  683 
drivers/hid/Kconfig|7 +
drivers/hid/Makefile   |1 +
drivers/hid/hid-alwaysinnovating.c |  262 +++
drivers/hid/hid-core.c |1 +
drivers/hid/hid-ids.h  |3 +
drivers/input/misc/Kconfig |9 +
drivers/input/misc/Makefile|2 +-
drivers/input/misc/mma7455l.c  |  625 +++
drivers/video/omap/lcd_omap3touchbook.c|  130 ++
include/linux/mma7455l.h   |   11 +
sound/soc/omap/Kconfig |8 +
sound/soc/omap/Makefile|2 +
sound/soc/omap/omap3touchbook.c|  211 +++
17 files changed, 4402 insertions(+), 1 deletions(-)
create mode 100644 arch/arm/configs/omap3_touchbook_defconfig
create mode 100644 arch/arm/mach-omap2/board-omap3touchbook.c
create mode 100644 drivers/hid/hid-alwaysinnovating.c
create mode 100644 drivers/input/misc/mma7455l.c
create mode 100644 drivers/video/omap/lcd_omap3touchbook.c
create mode 100644 include/linux/mma7455l.h
create mode 100644 sound/soc/omap/omap3touchbook.c



--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/5] AI TB: Board file of the Always Innovating OMAP3-based Touch Book.

2009-11-15 Thread Gregoire Gentil
Board file of the Always Innovating OMAP3-based Touch Book.




Signed-off-by: Gregoire Gentil grego...@gentil.com
---
arch/arm/mach-omap2/board-omap3touchbook.c |  683

1 files changed, 683 insertions(+), 0 deletions(-)
create mode 100644 arch/arm/mach-omap2/board-omap3touchbook.c

diff --git a/arch/arm/mach-omap2/board-omap3touchbook.c
b/arch/arm/mach-omap2/board-omap3touchbook.c
new file mode 100644
index 000..ad3ef6e
--- /dev/null
+++ b/arch/arm/mach-omap2/board-omap3touchbook.c
@@ -0,0 +1,683 @@
+/*
+ * linux/arch/arm/mach-omap2/board-omap3touchbook.c
+ *
+ * Copyright (C) 2009 Always Innovating
+ *
+ * Modified from mach-omap2/board-omap3beagleboard.c
+ *
+ * Initial code: Grégoire Gentil, Tim Yamin
+ *
+ * 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/kernel.h
+#include linux/init.h
+#include linux/platform_device.h
+#include linux/delay.h
+#include linux/err.h
+#include linux/clk.h
+#include linux/io.h
+#include linux/leds.h
+#include linux/gpio.h
+#include linux/input.h
+#include linux/gpio_keys.h
+
+#include linux/mtd/mtd.h
+#include linux/mtd/partitions.h
+#include linux/mtd/nand.h
+
+#include plat/mcspi.h
+#include linux/spi/spi.h
+
+#include linux/spi/ads7846.h
+#include linux/mma7455l.h
+
+#include plat/dmtimer.h
+#include linux/backlight.h
+
+#include linux/regulator/machine.h
+#include linux/i2c/twl4030.h
+
+#include mach/hardware.h
+#include asm/mach-types.h
+#include asm/mach/arch.h
+#include asm/mach/map.h
+#include asm/mach/flash.h
+
+#include plat/board.h
+#include plat/common.h
+#include plat/gpmc.h
+#include plat/nand.h
+#include plat/mux.h
+#include plat/usb.h
+#include plat/timer-gp.h
+
+#include mmc-twl4030.h
+
+#include asm/setup.h
+
+#define GPMC_CS0_BASE  0x60
+#define GPMC_CS_SIZE   0x30
+
+#define NAND_BLOCK_SIZE SZ_128K
+
+#define OMAP3_AC_GPIO 136
+#define OMAP3_TS_GPIO 162
+#define TB_BL_PWM_TIMER 9
+#define TB_KILL_POWER_GPIO 168
+
+unsigned long touchbook_revision;
+
+static struct mtd_partition omap3touchbook_nand_partitions[] = {
+ /* All the partition sizes are listed in terms of NAND block size */
+ {
+ .name = X-Loader,
+ .offset = 0,
+ .size = 4 * NAND_BLOCK_SIZE,
+ .mask_flags = MTD_WRITEABLE, /* force read-only */
+ },
+ {
+ .name = U-Boot,
+ .offset = MTDPART_OFS_APPEND, /* Offset = 0x8 */
+ .size = 15 * NAND_BLOCK_SIZE,
+ .mask_flags = MTD_WRITEABLE, /* force read-only */
+ },
+ {
+ .name = U-Boot Env,
+ .offset = MTDPART_OFS_APPEND, /* Offset = 0x26 */
+ .size = 1 * NAND_BLOCK_SIZE,
+ },
+ {
+ .name = Kernel,
+ .offset = MTDPART_OFS_APPEND, /* Offset = 0x28 */
+ .size = 32 * NAND_BLOCK_SIZE,
+ },
+ {
+ .name = File System,
+ .offset = MTDPART_OFS_APPEND, /* Offset = 0x68 */
+ .size = MTDPART_SIZ_FULL,
+ },
+};
+
+static struct omap_nand_platform_data omap3touchbook_nand_data = {
+ .options = NAND_BUSWIDTH_16,
+ .parts = omap3touchbook_nand_partitions,
+ .nr_parts = ARRAY_SIZE(omap3touchbook_nand_partitions),
+ .dma_channel = -1, /* disable DMA in OMAP NAND driver */
+ .nand_setup = NULL,
+ .dev_ready = NULL,
+};
+
+static struct resource omap3touchbook_nand_resource = {
+ .flags = IORESOURCE_MEM,
+};
+
+static struct platform_device omap3touchbook_nand_device = {
+ .name = omap2-nand,
+ .id = -1,
+ .dev = {
+ .platform_data = omap3touchbook_nand_data,
+ },
+ .num_resources = 1,
+ .resource = omap3touchbook_nand_resource,
+};
+
+#include sdram-micron-mt46h32m32lf-6.h
+
+static struct twl4030_hsmmc_info mmc[] = {
+ {
+ .mmc = 1,
+ .wires = 8,
+ .gpio_wp = 29,
+ },
+ {} /* Terminator */
+};
+
+static struct platform_device omap3_touchbook_lcd_device = {
+ .name = omap3touchbook_lcd,
+ .id = -1,
+};
+
+static struct omap_lcd_config omap3_touchbook_lcd_config __initdata = {
+ .ctrl_name = internal,
+};
+
+static struct regulator_consumer_supply touchbook_vmmc1_supply = {
+ .supply = vmmc,
+};
+
+static struct regulator_consumer_supply touchbook_vsim_supply = {
+ .supply = vmmc_aux,
+};
+
+static struct gpio_led gpio_leds[];
+
+static int touchbook_twl_gpio_setup(struct device *dev,
+ unsigned gpio, unsigned ngpio)
+{
+ if (system_rev = 0x20  system_rev = 0x34301000) {
+ omap_cfg_reg(AG9_34XX_GPIO23);
+ mmc[0].gpio_wp = 23;
+ } else {
+ omap_cfg_reg(AH8_34XX_GPIO29);
+ }
+ /* gpio + 0 is mmc0_cd (input/IRQ) */
+ mmc[0].gpio_cd = gpio + 0;
+ twl4030_mmc_init(mmc);
+
+ /* link regulators to MMC adapters */
+ touchbook_vmmc1_supply.dev = mmc[0].dev;
+ touchbook_vsim_supply.dev = mmc[0].dev;
+
+ /* REVISIT: need ehci-omap hooks for external VBUS
+ * power switch and overcurrent detect
+ */
+
+ gpio_request(gpio + 1, EHCI_nOC);
+ gpio_direction_input(gpio + 1);
+
+ /* TWL4030_GPIO_MAX + 0 == ledA, EHCI nEN_USB_PWR (out, active low) */
+ gpio_request(gpio + TWL4030_GPIO_MAX, nEN_USB_PWR);
+ gpio_direction_output(gpio + TWL4030_GPIO_MAX, 0);
+
+ /* TWL4030_GPIO_MAX

[PATCH 3/5] AI TB: Driver for the Freescale MMA7455L accelerometer

2009-11-15 Thread Gregoire Gentil
Driver for the Freescale MMA7455L accelerometer




Signed-off-by: Gregoire Gentil grego...@gentil.com
---
drivers/input/misc/Kconfig|9 +
drivers/input/misc/Makefile   |2 +-
drivers/input/misc/mma7455l.c |  625
+
include/linux/mma7455l.h  |   11 +
4 files changed, 646 insertions(+), 1 deletions(-)
create mode 100644 drivers/input/misc/mma7455l.c
create mode 100644 include/linux/mma7455l.h

diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index a9bb254..454bac7 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -317,4 +317,13 @@ config INPUT_PCAP
  To compile this driver as a module, choose M here: the
  module will be called pcap_keys.

+config INPUT_MMA7455L
+ tristate Freescale MMA7455L 3-axis accelerometer
+ depends on SPI_MASTER
+ help
+   SPI driver for the Freescale MMA7455L 3-axis accelerometer.
+
+   The userspace interface is a 3-axis (X/Y/Z) relative movement
+   Linux input device, reporting REL_[XYZ] events.
+
endif
diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile
index a8b8485..3db6347 100644
--- a/drivers/input/misc/Makefile
+++ b/drivers/input/misc/Makefile
@@ -30,4 +30,4 @@ obj-$(CONFIG_INPUT_WINBOND_CIR) += winbond-cir.o
obj-$(CONFIG_INPUT_WISTRON_BTNS) += wistron_btns.o
obj-$(CONFIG_INPUT_WM831X_ON) += wm831x-on.o
obj-$(CONFIG_INPUT_YEALINK) += yealink.o
-
+obj-$(CONFIG_INPUT_MMA7455L) += mma7455l.o
diff --git a/drivers/input/misc/mma7455l.c
b/drivers/input/misc/mma7455l.c
new file mode 100644
index 000..771d4b7
--- /dev/null
+++ b/drivers/input/misc/mma7455l.c
@@ -0,0 +1,625 @@
+/* Linux kernel driver for the Freescale MMA7455L 3-axis accelerometer
+ *
+ * Copyright (C) 2009 by Always Innovating, Inc.
+ * Author: Gregoire Gentil grego...@gentil.com
+ * Author: Tim Yamin pl...@roo.me.uk
+ * All rights reserved.
+ *
+ * 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 330, Boston,
+ * MA 02111-1307 USA
+ *
+ */
+
+/*
+ * What this driver doesn't yet support:
+ *
+ * - I2C
+ * - INT2 handling
+ * - Pulse detection (and the sysctls to control it)
+ * - 10-bit measurement
+ */
+
+#include linux/kernel.h
+#include linux/types.h
+#include linux/module.h
+#include linux/device.h
+#include linux/platform_device.h
+#include linux/delay.h
+#include linux/input.h
+#include linux/irq.h
+#include linux/interrupt.h
+#include linux/sysfs.h
+#include linux/gpio.h
+
+#include linux/mma7455l.h
+#include linux/spi/spi.h
+
+#define MMA7455L_WHOAMI_MAGIC 0x55
+
+enum mma7455l_reg {
+ MMA7455L_REG_XOUTL = 0x00,
+ MMA7455L_REG_XOUTH = 0x01,
+ MMA7455L_REG_YOUTL = 0x02,
+ MMA7455L_REG_YOUTH = 0x03,
+ MMA7455L_REG_ZOUTL = 0x04,
+ MMA7455L_REG_ZOUTH = 0x05,
+ MMA7455L_REG_XOUT8 = 0x06,
+ MMA7455L_REG_YOUT8 = 0x07,
+ MMA7455L_REG_ZOUT8 = 0x08,
+ MMA7455L_REG_STATUS = 0x09,
+ MMA7455L_REG_DETSRC = 0x0a,
+ MMA7455L_REG_TOUT = 0x0b,
+ MMA7455L_REG_RESERVED1 = 0x0c,
+ MMA7455L_REG_I2CAD = 0x0d,
+ MMA7455L_REG_USRINF = 0x0e,
+ MMA7455L_REG_WHOAMI = 0x0f,
+ MMA7455L_REG_XOFFL = 0x10,
+ MMA7455L_REG_XOFFH = 0x11,
+ MMA7455L_REG_YOFFL = 0x12,
+ MMA7455L_REG_YOFFH = 0x13,
+ MMA7455L_REG_ZOFFL = 0x14,
+ MMA7455L_REG_ZOFFH = 0x15,
+ MMA7455L_REG_MCTL = 0x16,
+ MMA7455L_REG_INTRST = 0x17,
+ MMA7455L_REG_CTL1 = 0x18,
+ MMA7455L_REG_CTL2 = 0x19,
+ MMA7455L_REG_LDTH = 0x1a,
+ MMA7455L_REG_PDTH = 0x1b,
+ MMA7455L_REG_PW = 0x1c,
+ MMA7455L_REG_LT = 0x1d,
+ MMA7455L_REG_TW = 0x1e,
+ MMA7455L_REG_RESERVED2 = 0x1f,
+};
+
+enum mma7455l_reg_status {
+ MMA7455L_STATUS_XDA = 0x08,
+ MMA7455L_STATUS_YDA = 0x10,
+ MMA7455L_STATUS_ZDA = 0x20,
+};
+
+enum mma7455l_mode {
+ MMA7455L_MODE_STANDBY = 0,
+ MMA7455L_MODE_MEASUREMENT = 1,
+ MMA7455L_MODE_LEVELDETECTION = 0x42, /* Set DRPD to on */
+ MMA7455L_MODE_PULSEDETECTION = 0x43, /* Set DRPD to on */
+ MMA7455L_MODE_MASK = 0x43,
+};
+
+enum mma7455l_gselect {
+ MMA7455L_GSELECT_8 = 0x0,
+ MMA7455L_GSELECT_2 = 0x4,
+ MMA7455L_GSELECT_4 = 0x8,
+ MMA7455L_GSELECT_MASK = 0xC,
+};
+
+/* FIXME */
+#define MMA7455L_F_FS 0x0020 /* ADC full scale */
+
+struct mma7455l_info {
+ struct spi_device *spi_dev;
+ struct input_dev *input_dev;
+ struct mutex lock;
+ struct delayed_work work;
+
+ u8 mode;
+ u8 gSelect;
+
+ u8 flags;
+ u8 working;
+};
+
+/* lowlevel register access functions */
+
+#define WRITE_BIT (1  7)
+#define ADDR_SHIFT 1
+
+static

[PATCH 4/5] AI TB: Driver for the Always Innovating Touch Book keyboard.

2009-11-15 Thread Gregoire Gentil
Driver for the Always Innovating Touch Book keyboard.




Signed-off-by: Gregoire Gentil grego...@gentil.com
---
drivers/hid/Kconfig|7 +
drivers/hid/Makefile   |1 +
drivers/hid/hid-alwaysinnovating.c |  262

drivers/hid/hid-core.c |1 +
drivers/hid/hid-ids.h  |3 +
5 files changed, 274 insertions(+), 0 deletions(-)
create mode 100644 drivers/hid/hid-alwaysinnovating.c

diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index 24d90ea..b56ddc5 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -62,6 +62,13 @@ config HID_A4TECH
---help---
Support for A4 tech X5 and WOP-35 / Trust 450L mice.

+config HID_ALWAYSINNOVATING
+ tristate Always Innovating if EMBEDDED
+ depends on USB_HID
+ default !EMBEDDED
+ ---help---
+ Support for Always Innovating Touch Book.
+
config HID_APPLE
tristate Apple if EMBEDDED
depends on (USB_HID || BT_HIDP)
diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile
index 0de2dff..b6a2860 100644
--- a/drivers/hid/Makefile
+++ b/drivers/hid/Makefile
@@ -20,6 +20,7 @@ ifdef CONFIG_LOGIRUMBLEPAD2_FF
endif

obj-$(CONFIG_HID_A4TECH) += hid-a4tech.o
+obj-$(CONFIG_HID_ALWAYSINNOVATING) += hid-alwaysinnovating.o
obj-$(CONFIG_HID_APPLE) += hid-apple.o
obj-$(CONFIG_HID_BELKIN) += hid-belkin.o
obj-$(CONFIG_HID_CHERRY) += hid-cherry.o
diff --git a/drivers/hid/hid-alwaysinnovating.c
b/drivers/hid/hid-alwaysinnovating.c
new file mode 100644
index 000..a7bb0fd
--- /dev/null
+++ b/drivers/hid/hid-alwaysinnovating.c
@@ -0,0 +1,262 @@
+/*
+ *  USB HID quirks support for the Always Innovating Touch Book
+ *  Code borrowed from hid-apple.c
+ *
+ *  Copyright (c) 2009 Gregoire Gentil grego...@gentil.com
+ *  Copyright (c) 2009 Tim Yamin pl...@roo.me.uk
+ */
+
+/*
+ * 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.
+ */
+
+#include linux/device.h
+#include linux/hid.h
+#include linux/module.h
+#include linux/usb.h
+
+#include hid-ids.h
+
+struct touchbook_sc {
+ unsigned long quirks;
+ unsigned int  fn_on;
+ DECLARE_BITMAP(pressed_fn, KEY_CNT);
+};
+
+struct touchbook_key_translation {
+ u16 from;
+ u16 to;
+ u8 flags;
+};
+
+static struct touchbook_key_translation touchbook_fn_keys[] = {
+ { KEY_F6, KEY_BRIGHTNESSDOWN },
+ { KEY_F7, KEY_BRIGHTNESSUP },
+
+ { KEY_F8, KEY_MUTE },
+ { KEY_F9, KEY_VOLUMEDOWN },
+ { KEY_F10, KEY_VOLUMEUP },
+
+ { KEY_UP, KEY_PAGEUP },
+ { KEY_DOWN, KEY_PAGEDOWN },
+ { }
+};
+
+extern unsigned long touchbook_revision;
+unsigned long swap_key;
+
+static struct touchbook_key_translation *touchbook_find_translation(
+ struct touchbook_key_translation *table, u16 from)
+{
+ struct touchbook_key_translation *trans;
+
+ /* Look for the translation */
+ for (trans = table; trans-from; trans++)
+ if (trans-from == from)
+ return trans;
+
+ return NULL;
+}
+
+static int touchbook_event(struct hid_device *hid, struct hid_field
*field,
+ struct hid_usage *usage, __s32 value)
+{
+ int do_translate;
+
+ struct input_dev *input = field-hidinput-input;
+ struct touchbook_sc *asc = hid_get_drvdata(hid);
+ struct touchbook_key_translation *trans;
+
+ if (swap_key  usage-code == KEY_RIGHTSHIFT) {
+ input_event(input, usage-type, KEY_END, value);
+ return 1;
+ }
+
+ if (swap_key  usage-code == KEY_END) {
+ input_event(input, usage-type, KEY_RIGHTSHIFT, value);
+ return 1;
+ }
+
+ if (usage-code == KEY_POWER) {
+ asc-fn_on = !!value;
+ input_event(input, usage-type, usage-code, value);
+ return 1;
+ }
+
+ trans = touchbook_find_translation(touchbook_fn_keys, usage-code);
+ if (trans) {
+ if (test_bit(usage-code, asc-pressed_fn))
+ do_translate = 1;
+ else
+ do_translate = asc-fn_on;
+
+ if (do_translate) {
+ if (value)
+ set_bit(usage-code, asc-pressed_fn);
+ else
+ clear_bit(usage-code, asc-pressed_fn);
+
+ input_event(input, usage-type, trans-to,
+ value);
+
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
+static int touchbook_input_mapping(struct hid_device *hdev,
+ struct hid_input *hi,
+ struct hid_field *field, struct hid_usage *usage,
+ unsigned long **bit, int *max)
+{
+ struct touchbook_key_translation *trans;
+
+ /* Enable all other keys */
+ for (trans = touchbook_fn_keys; trans-from; trans++)
+ set_bit(trans-to, hi-input-keybit);
+
+ return 0;
+}
+
+static ssize_t show_swap_key(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ return snprintf(buf, PAGE_SIZE, %lu\n, swap_key);
+}
+
+static ssize_t store_swap_key(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ strict_strtoul(buf, 10, swap_key);
+
+ if (swap_key != 0  swap_key != 1) {
+ swap_key = 0;
+ return -EINVAL;
+ }
+
+ return count;
+}
+
+static struct device_attribute touchbook_hid_attrs[] = {
+ __ATTR(swap_key, S_IRUGO | S_IWUGO, show_swap_key, store_swap_key

[PATCH 5/5] AI TB: Additional modifications for the Always Innovating OMAP3-based Touch Book, including video and sound.

2009-11-15 Thread Gregoire Gentil
Additional modifications for the Always Innovating OMAP3-based Touch
Book, including video and sound.




Signed-off-by: Gregoire Gentil grego...@gentil.com
---
arch/arm/mach-omap2/Kconfig |5 +
arch/arm/mach-omap2/Makefile|2 +
drivers/video/omap/lcd_omap3touchbook.c |  130 +++
sound/soc/omap/Kconfig  |8 ++
sound/soc/omap/Makefile |2 +
sound/soc/omap/omap3touchbook.c |  211
+++
6 files changed, 358 insertions(+), 0 deletions(-)
create mode 100644 drivers/video/omap/lcd_omap3touchbook.c
create mode 100644 sound/soc/omap/omap3touchbook.c

diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index b25af76..f271383 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -73,6 +73,11 @@ config MACH_OMAP3_PANDORA
bool OMAP3 Pandora
depends on ARCH_OMAP3  ARCH_OMAP34XX

+config MACH_OMAP3_TOUCHBOOK
+ bool OMAP3 Touch Book
+ depends on ARCH_OMAP3  ARCH_OMAP34XX
+ select BACKLIGHT_CLASS_DEVICE
+
config MACH_OMAP_3430SDP
bool OMAP 3430 SDP board
depends on ARCH_OMAP3  ARCH_OMAP34XX
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 59b0ccc..b6b5c7f 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -90,6 +90,8 @@ obj-$(CONFIG_MACH_CM_T35) += board-cm-t35.o \
   mmc-twl4030.o
obj-$(CONFIG_MACH_IGEP0020) += board-igep0020.o \
   mmc-twl4030.o
+obj-$(CONFIG_MACH_OMAP3_TOUCHBOOK) += board-omap3touchbook.o \
+mmc-twl4030.o

obj-$(CONFIG_MACH_OMAP_4430SDP) += board-4430sdp.o

diff --git a/drivers/video/omap/lcd_omap3touchbook.c
b/drivers/video/omap/lcd_omap3touchbook.c
new file mode 100644
index 000..5b58703
--- /dev/null
+++ b/drivers/video/omap/lcd_omap3touchbook.c
@@ -0,0 +1,130 @@
+/*
+ * LCD panel support for the Touch Book
+ *
+ * Author: Gregoire Gentil grego...@gentil.com
+ *
+ * Derived from drivers/video/omap/lcd-omap3beagle.c
+ *
+ * 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 330, Boston, MA  02111-1307, USA.
+ */
+
+#include linux/module.h
+#include linux/platform_device.h
+#include linux/gpio.h
+#include linux/i2c/twl4030.h
+
+#include plat/mux.h
+#include plat/omapfb.h
+#include asm/mach-types.h
+
+#define LCD_PANEL_ENABLE_GPIO   176
+
+static int omap3beagle_panel_init(struct lcd_panel *panel,
+ struct omapfb_device *fbdev)
+{
+ gpio_request(LCD_PANEL_ENABLE_GPIO, LCD enable);
+ return 0;
+}
+
+static void omap3beagle_panel_cleanup(struct lcd_panel *panel)
+{
+ gpio_free(LCD_PANEL_ENABLE_GPIO);
+}
+
+static int omap3beagle_panel_enable(struct lcd_panel *panel)
+{
+ gpio_set_value(LCD_PANEL_ENABLE_GPIO, 1);
+ return 0;
+}
+
+static void omap3beagle_panel_disable(struct lcd_panel *panel)
+{
+ gpio_set_value(LCD_PANEL_ENABLE_GPIO, 0);
+}
+
+static unsigned long omap3beagle_panel_get_caps(struct lcd_panel
*panel)
+{
+ return 0;
+}
+
+struct lcd_panel omap3beagle_panel = {
+ .name = omap3beagle,
+ .config = OMAP_LCDC_PANEL_TFT,
+
+ .bpp = 16,
+ .data_lines = 24,
+ .x_res = 1024,
+ .y_res = 600,
+ .hsw = 3,
+ .hfp = 3,
+ .hbp = 39,
+ .vsw = 1,
+ .vfp = 2,
+ .vbp = 7,
+
+ .pixel_clock = 64000,
+
+ .init = omap3touchbook_panel_init,
+ .cleanup = omap3touchbook_panel_cleanup,
+ .enable = omap3touchbook_panel_enable,
+ .disable = omap3touchbook_panel_disable,
+ .get_caps = omap3touchbook_panel_get_caps,
+};
+
+static int omap3touchbook_panel_probe(struct platform_device *pdev)
+{
+ omapfb_register_panel(omap3beagle_panel);
+ return 0;
+}
+
+static int omap3touchbook_panel_remove(struct platform_device *pdev)
+{
+ return 0;
+}
+
+static int omap3touchbook_panel_suspend(struct platform_device *pdev,
+pm_message_t mesg)
+{
+ return 0;
+}
+
+static int omap3touchbook_panel_resume(struct platform_device *pdev)
+{
+ return 0;
+}
+
+struct platform_driver omap3touchbook_panel_driver = {
+ .probe = omap3touchbook_panel_probe,
+ .remove = omap3touchbook_panel_remove,
+ .suspend = omap3touchbook_panel_suspend,
+ .resume = omap3touchbook_panel_resume,
+ .driver = {
+ .name = omap3touchbook_lcd,
+ .owner = THIS_MODULE,
+ },
+};
+
+static int __init omap3touchbook_panel_drv_init(void)
+{
+ return platform_driver_register(omap3beagle_panel_driver);
+}
+
+static void __exit omap3touchbook_panel_drv_exit(void)
+{
+ platform_driver_unregister

Re: [PATCH 00/19] OMAP: DSS2: Intro

2009-11-15 Thread Gregoire Gentil
On Wed, 2009-10-07 at 11:57 +0300, Felipe Contreras wrote:
 On Wed, Sep 30, 2009 at 12:21 PM, Tomi Valkeinen
 tomi.valkei...@nokia.com wrote:
  Hi,
 
  Andrew, do you have time to check out the DSS2 driver? Or suggestions
  how should I proceed.
 
  I rebased DSS2 on top of today's linux-tree, and there were no
  conflicts, so the posted patches should apply. But the rebased tree is
  also available in master branch at
  git://gitorious.org/linux-omap-dss2/linux.git
 
 It's also worth noting that DSS2 is used basically on all linux-omap
 trees already, I've seen it working at least on N900 and beagleboard
 and it makes no sense to try to get some video output without it.
 
 P.S. I had to patch the beagleboard support from Tomi's
 'master-before-squash'... it would be nice to get it upstream already
I second Felipe on this one. DSS2 is a very stable and an ideal video
driver for OMAP3. Hopefully, it will make upstream soon,

Grégoire



--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: New project announcement: gst-dsp, with beagleboard demo image

2009-10-13 Thread Gregoire Gentil
It definitely seems to be a very nice effort that will be very useful to
many projects. I will integrate on the Touch Book. Thanks,

Grégoire

On Tue, 2009-10-13 at 00:31 +0300, Felipe Contreras wrote:
 Hi,
 
 This is the first public release of gst-dsp; a native GStreamer plug-in to
 access Texas Instruments' DSP algorithms for OMAP3 platforms.
 
 The code came originally from a series of TI projects: tiopenmax[1], and
 libbridge[2]. gst-dsp replaces these two layers and talks directly to the DSP
 bridge driver.
 
 The main advantages are code simplification (5k vs 50k), and better 
 performance
 (at least 4 times less CPU usage). However, not all of the codecs have been
 implemented, only MPEG-4 and H.263 video encoders and decoders, the JPEG
 encoder, and H.264 is partially supported.
 
 Currently it's used in the Nokia N900.
 
 In order to make it easier for people to try it out, I created a demo image 
 for
 the beagleboard with all the required components: GStreamer, gst-dsp, DSP
 public binaries, and a kernel with DSS2 and DSP bridge driver.
 
 The linux kernel (DSS2 + dspbridge) is at the v2.6.32-felipec1 tag in:
 http://gitorious.org/~felipec/linux-omap/felipec
 
 The DSP algorithms are public, and come from tiopenmax:
 https://gforge.ti.com/gf/download/frsrelease/170/1399/tiopenmax-0.3.5.tar.gz
 
 Here's the demo rootfs with the kernel image and instructions:
 http://people.freedesktop.org/~felipec/beagle-2.6.32-rc3/
 
 And here's the video showing it on action for both playback and recording:
 http://www.youtube.com/watch?v=SN-Nw_yDQUs
 
 The main repository is hosted on github:
 http://github.com/felipec/gst-dsp
 
 And there's also one specific for maemo:
 http://maemo.gitorious.org/maemo-multimedia/gst-dsp
 
 This code wouldn't have been possible without all the contributions and
 specially thanks to TI for making their code open source.
 
 Here's the shortlog for 0.6.0:
 
 Andriy Shevchenko (1):
   base: fix a crash on send codec data
 
 Felipe Contreras (180):
   Initial commit
   Register dsp node
   Add README
   Fix and update copyrights
   Add ALLOCATE_HEAP and ALLOCATE_SN to dsp_bridge
   Add handy dsp_send_message
   dummy: use dsp_send_message
   Rename gstdsp.* to plugin.*
   Makefile: cleanup
   dummy: trivial clanups
   Add log utility
   Use log utility
   dmm_buffer: size_t improvements
   dmm_buffer: always unmap when freeing
   dmm_buffer: use getpagesize()
   dmm_buffer: alignment improvements
   dmm_buffer: add user_data field
   Add MPEG-4 video decoder
   README: update
   mp4vdec: trivial cleanup
   mp4vdec: send signal to output_loop
   mp4vdec: flush output buffers too
   mp4vdec: reset output port
   mp4vdec: extra check for null buffer
   mp4vdec: use atomic operations for status
   mp4vdec: use more atomic operations for status
   mp4vdec: send stop signal before
   mp4vdec: re-use comm buffers
   dmm_buffer: reorganize a bit
   dmm_buffer: add dmm_buffer_reserve
   dmm_buffer: allow to re-reserve memory
   dmm_buffer: allow re-mapping
   mp4vdec: trivial cleanup
   dmm_buffer: unmap before unreserving
   mp4vdec: re-use mappings for output buffers
   mp4vdec: convert flush condition to semaphore
   Remove cond.h
   Rename mp4vdec to vdec
   vdec: trivial cleanup
   vdec: trivial reorganization
   vdec: prepare for multiple algos
   vdec: move create_node to dsp_start
   vdec: start dsp node after getting the caps
   vdec: initial support for H.264
   vdec: add Juha to authors list
   README: update
   vdec: cleanup
   vdec: make dsp_thread static
   vdec: reorganize a bit
   New base class
   Add new video encoder
   base: handle more commands
   base: reorganize got_message a bit
   venc: improve jpeg args
   venc: send jpeg dynamic params
   base: cleanup setup_output_buffers
   base: remove unused buffer_count
   base: reorganize a bit
   base: add use_pad_alloc option
   base: free mapped buffers on dsp_stop()
   base: be more verbose on get_slot()
   README: update
   Makefile: check for missing symbols
   New utility gstdsp_register()
   base: detect dsp errors
   base: properly handle dsp errors
   base: post error in the bus
   base: extra check for status in outout_loop()
   base: free events array
   base: reinitialize state on NULL-READY
   base: use circular buffer for timestamps
   base: increase ts_array
   base: increase mapping cache
   dummy: reorganize map_buffer
   dummy: input buffers don't need alignment
   dummy: cleanup
   dummy: don't map buffers
   venc: increase framesize limit for jpeg
   base: add gstdsp_post_error()
   venc: allocate a buffer when framesize is unaligned
   base: decrease wait for events timeout
 

Re: USB charging over TPS65950 BCI

2009-09-14 Thread Gregoire Gentil
I don't know. I haven't seen yet a battery driver that works correctly
with the TPS65950 and I have ping multiple times various people at TI.
Perhaps Gandhar will have an idea. I think that it would be valuable for
the community that somebody at TI provides some patches to report
correctly everything around the battery,

Grégoire


On Fri, 2009-09-11 at 19:31 +0530, pramod gurav wrote: 
 hi gregoire,
 i did not mention about charge current. the sysfs entry charge_current
 always returns 360.
 
 
 -- 
 Best Regards
 Pramod
 
 
 On Fri, Sep 11, 2009 at 7:21 PM, pramod gurav pramodfo...@gmail.com wrote:
  Hello gregoire,
 
  Really sorry I could not reply to your mail as I was busy with some other 
  work.
  I applied your above patch tested. The sysfs entries return correct
  values for status, charger device(online), voltage_now. But the
  current across the battery is reported wrong. I compared the values
  returned by current_now sysfs entry with multimeter values across the
  battery. The values were varying whenever I remove AC and plug it
  back. But what I could see was the current_now value was approximately
  double the actual current across the battery.
  Without your patch the twl4030_bci gives wrong values for current_now,
  voltage_now, capacity etc.
  But your patch fixes this issue.
 
  But the USB charging did not work. Is USB charging functional with
  TWL4030 on any of the OMAP boards?
 
 
  Don't mind for the late reply. Thanks for your help.
 
  --
  Thanks and Best Regards
  Pramod
 
  On Wed, Aug 5, 2009 at 9:48 PM, Gregoire Gentil grego...@gentil.com wrote:
  Hello,
 
  Any feed-back on the patch I sent? Have you tried it? Have you fixed
  your problem?
 
  Grégoire
 
 
  On Fri, 2009-07-31 at 23:41 -0700, Gregoire Gentil wrote:
  On Fri, 2009-07-31 at 19:19 +0530, pramod gurav wrote:
   Hi All,
   I was trying to get the USB battery charging working over TPS65950 BCI
   on the OMAP3430 custom board. I am working with linux-omap-2.6
   v2.6.28-omap1 tag. I enabled the TWL4030 MADC and TWL4030 BCI drivers.
   I passed interrupt details to these drivers from platform_device
   structure from my board file. I could get the AC charging working. The
   AC and USB detection worked. However the USB charging is not
   happening.
   I read through the TPS TRM and took the dumps of the registers from
   BCI and some from TWL USB module and BOOT_BCI whenever I plug in the
   USB charger between host and the board. The register settings seem to
   be fine. But the battery is not charging. I am using BQ27000 chip for
   battery monitoring and I can see the battery voltage is decreasing.
  
   Following are the register dumps of TWL with and without USB plugged in:
  
   These are the register contents when USB charger is plugged in:
   BCIMDEN = 0x11
   REG_BOOT_BCI= 0x37
   REG_POWER_CTRL  = 0x20
   REG_BCIMFSTS4   = 0xf4
   REG_BCIMFSTS1   = 0x13
   REG_BCIIREF1= 0x68
   REG_BCIIREF2= 0x3
   REG_BCIMFEN4= 0x6f
   REG_BCIMFSTS2   = 0x0
   REG_BCIMSTATEC  = 0x12
   REG_STS_HW_CONDITIONS= 0x90
  
  
   These are the register contents when USB charger is plugged out:
   BCIMDEN = 0x0
   REG_BOOT_BCI= 0x35
   REG_POWER_CTRL  = 0x20
   REG_BCIMFSTS4   = 0xf0
   REG_BCIMFSTS1   = 0xaa
   REG_BCIIREF1= 0x68
   REG_BCIIREF2= 0x3
   REG_BCIMFEN4= 0x68
   REG_BCIMFSTS2   = 0x0
   REG_BCIMSTATEC  =0x0
   REG_STS_HW_CONDITIONS= 0x10
  
   Is there anything more I need to support to get BCI USB charging
   working? Need I follow any USB Communication protocol between Host and
   the board.
   I have pasted the kernel boot logs for reference at the end.
   Can any one please guide me to some pointers?
  
   --
   Best Regards
   Pramod
  I'm experiencing some problems with TWL4030 DC charging and I'm
  interested by this kind of problem. Basically, the values reported by
  our patch is different from the current going to the battery. We wrote
  the attached enhanced patch so as to edit at run-time the charging mode
  and various values including charge_current. It's against 2.6.29 but I
  think that it should work again 2.6.28. Unfortunately, starting 2.6.30,
  Tony has removed all the BCI battery code and has asked for updated code
  against mainline but I've not seen anything so far.
 
  Pramod, can you try the attached patch (perhaps, it will help you) and
  can you tell if you see the exact current going to the battery reported
  by the driver?
 
  Grégoire
 
 
 
 
 
  --- a/drivers/power/twl4030_bci_battery.c 2009-07-22 
  18:27:16.0
  -0700
  +++ b/drivers/power/twl4030_bci_battery.c 2009-07-22 
  18:30:22.0
  -0700
  @@ -15,6 +15,9 @@
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
 
  +/* Boot with automatic charge */
  +#define CHARGE_MODE 1
  +
   #include linux/init.h
   #include linux/module.h
   #include linux/device.h
  @@ -50,6 +53,7 @@
   /* Boot BCI flag bits */
   #define BCIAUTOWEN

Re: [beagleboard] Re: USB EHCI problems

2009-08-15 Thread Gregoire Gentil
On the Touch Book (which has the same transceiver as Beagleboard), we
experience a similar problem with high speed USB. I'm playing with those
various options and patches but it's not working so far. I'm then very
interested to get any help on this problem too. More documentation about
Smart Reflex would help,

Grégoire


On Sat, 2009-08-15 at 23:04 +0300, Siarhei Siamashka wrote:
 On Saturday 15 August 2009, Frantisek Dufka wrote:
  Gerald Coley wrote:
   You need to enable Smart Reflex on VDD2 in the Kernel. I can't seem to
   get anyone around here to help me formalize exactly how to do this in
   the Kernel. So if you can figure it out, I would go ahead and do it. If
   you could please then post it to the community, that would be great.
  
   Gerald
 
  http://www.webos-internals.org/wiki/Patch_webOS_CPU_Frequency_or_Voltage_Sc
 aling#Enable_SmartReflex
 
  the file is there but after running
  echo -n 1  /sys/power/sr_vdd2_autocomp
  there is still zero in the file and in kernel log I see
  OPP3 doesn't support SmartReflex
  SR2: VDD autocomp not activated
 
  Maybe different kernel would do.
 
 Would it make sense to ask for help in the linux-omap mailing list?
 I guess Gerald has a reply from TI or a new errata list or something else
 which says that enabling Smart Reflex on VDD2 can workaround EHCI problem.
 
 Now somebody knowledgeable about kernel internals, OMAP3, Smart Reflex
 and power management code in general could probably provide some hints
 or even a patch to enable this bugfix in the kernel. Maybe the fix is even
 sitting in somebody's branch already and we just don't know. Or maybe a
 solution for EHCI problem has been explained in the list, but just was
 lost in the pile of other messages in linux-omap (it has quite a heavy
 traffic).
 
 It may make sense to look at the 'pm' branch:
 http://elinux.org/OMAP_Power_Management
 
 But this wiki page has comment:
 Enables SmartReflex autocompensation on VDD2 (Note: This feature can only be 
 tested on a ES3.1 silicon):
 # echo 1  /sys/power/sr_vdd2_autocomp
 
 And AFAIK beagleboard revision C has ES3.0 silicon. So no luck here. Or can
 something still be done?
 
 The whole beagleboard EHCI story starts here:
 http://groups.google.com/group/beagleboard/browse_thread/thread/5b8385f0bb1f63da/d46625fe49783a8a
 

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: USB charging over TPS65950 BCI

2009-08-01 Thread Gregoire Gentil
On Fri, 2009-07-31 at 19:19 +0530, pramod gurav wrote:
 Hi All,
 I was trying to get the USB battery charging working over TPS65950 BCI
 on the OMAP3430 custom board. I am working with linux-omap-2.6
 v2.6.28-omap1 tag. I enabled the TWL4030 MADC and TWL4030 BCI drivers.
 I passed interrupt details to these drivers from platform_device
 structure from my board file. I could get the AC charging working. The
 AC and USB detection worked. However the USB charging is not
 happening.
 I read through the TPS TRM and took the dumps of the registers from
 BCI and some from TWL USB module and BOOT_BCI whenever I plug in the
 USB charger between host and the board. The register settings seem to
 be fine. But the battery is not charging. I am using BQ27000 chip for
 battery monitoring and I can see the battery voltage is decreasing.
 
 Following are the register dumps of TWL with and without USB plugged in:
 
 These are the register contents when USB charger is plugged in:
 BCIMDEN = 0x11
 REG_BOOT_BCI= 0x37
 REG_POWER_CTRL  = 0x20
 REG_BCIMFSTS4   = 0xf4
 REG_BCIMFSTS1   = 0x13
 REG_BCIIREF1= 0x68
 REG_BCIIREF2= 0x3
 REG_BCIMFEN4= 0x6f
 REG_BCIMFSTS2   = 0x0
 REG_BCIMSTATEC  = 0x12
 REG_STS_HW_CONDITIONS= 0x90
 
 
 These are the register contents when USB charger is plugged out:
 BCIMDEN = 0x0
 REG_BOOT_BCI= 0x35
 REG_POWER_CTRL  = 0x20
 REG_BCIMFSTS4   = 0xf0
 REG_BCIMFSTS1   = 0xaa
 REG_BCIIREF1= 0x68
 REG_BCIIREF2= 0x3
 REG_BCIMFEN4= 0x68
 REG_BCIMFSTS2   = 0x0
 REG_BCIMSTATEC  =0x0
 REG_STS_HW_CONDITIONS= 0x10
 
 Is there anything more I need to support to get BCI USB charging
 working? Need I follow any USB Communication protocol between Host and
 the board.
 I have pasted the kernel boot logs for reference at the end.
 Can any one please guide me to some pointers?
 
 -- 
 Best Regards
 Pramod
I'm experiencing some problems with TWL4030 DC charging and I'm
interested by this kind of problem. Basically, the values reported by
our patch is different from the current going to the battery. We wrote
the attached enhanced patch so as to edit at run-time the charging mode
and various values including charge_current. It's against 2.6.29 but I
think that it should work again 2.6.28. Unfortunately, starting 2.6.30,
Tony has removed all the BCI battery code and has asked for updated code
against mainline but I've not seen anything so far.

Pramod, can you try the attached patch (perhaps, it will help you) and
can you tell if you see the exact current going to the battery reported
by the driver?

Grégoire





--- a/drivers/power/twl4030_bci_battery.c   2009-07-22 18:27:16.0
-0700
+++ b/drivers/power/twl4030_bci_battery.c   2009-07-22 18:30:22.0
-0700
@@ -15,6 +15,9 @@
  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  */
 
+/* Boot with automatic charge */
+#define CHARGE_MODE 1
+
 #include linux/init.h
 #include linux/module.h
 #include linux/device.h
@@ -50,6 +53,7 @@
 /* Boot BCI flag bits */
 #define BCIAUTOWEN 0x020
 #define CONFIG_DONE0x010
+#define CVENAC 0x004
 #define BCIAUTOUSB 0x002
 #define BCIAUTOAC  0x001
 #define BCIMSTAT_MASK  0x03F
@@ -81,6 +85,11 @@
 #define REG_BB_CFG 0x012
 #define BBCHEN 0x010
 
+/* GPBR */
+#define REG_GPBR1  0x0c
+#define MADC_HFCLK_EN  0x80
+#define DEFAULT_MADC_CLK_EN0x10
+
 /* Power supply charge interrupt */
 #define REG_PWR_ISR1   0x00
 #define REG_PWR_IMR1   0x01
@@ -125,6 +134,18 @@
 /* BCIEDR3 */
 #defineVBATLVL_EDRRISIN0x02
 
+/* BCIIREF1 */
+#define REG_BCIIREF1   0x027
+#define REG_BCIIREF2   0x028
+
+/* BCIMFTH1 */
+#define REG_BCIMFTH1   0x016
+
+/* Key */
+#define KEY_IIREF  0xE7
+#define KEY_FTH1   0xD2
+#define REG_BCIMFKEY   0x011
+
 /* Step size and prescaler ratio */
 #define TEMP_STEP_SIZE 147
 #define TEMP_PSR_R 100
@@ -142,9 +163,6 @@
 #define ENABLE 1
 #define DISABLE1
 
-/* Ptr to thermistor table */
-int *therm_tbl;
-
 struct twl4030_bci_device_info {
struct device   *dev;
 
@@ -160,6 +178,8 @@
struct power_supply bk_bat;
struct delayed_work twl4030_bci_monitor_work;
struct delayed_work twl4030_bk_bci_monitor_work;
+
+   struct twl4030_bci_platform_data *pdata;
 };
 
 static int usb_charger_flag;
@@ -425,15 +445,21 @@
 /*
  * Enable/Disable AC Charge funtionality.
  */
-static int twl4030charger_ac_en(int enable)
+static int twl4030charger_ac_en(int enable, int automatic)
 {
int ret;
 
if (enable) {
/* forcing the field BCIAUTOAC (BOOT_BCI[0) to 1 */
-   ret = clear_n_set(TWL4030_MODULE_PM_MASTER, 0,
-   (CONFIG_DONE | BCIAUTOWEN | BCIAUTOAC),
-   REG_BOOT_BCI);
+ 

Re: tidspbridge git repository

2009-04-26 Thread Gregoire Gentil
On Fri, 2009-03-27 at 09:50 -0700, Tony Lindgren wrote:
 * Ameya Palande ameya.pala...@nokia.com [090327 06:06]:
  Hi Tony,
  
  ext Tony Lindgren wrote:
   * ameya.pala...@nokia.com ameya.pala...@nokia.com [090323 00:42]:
   Hi Tony,
  
   I have collected latest patches for tidspbridge at:
   git://gitorious.org/tidspbridge/mainline.git 
  
   Branch is: tidspbridge
  
   It is based on your pm branch.
   Can you pull it to your tidspbridge branch?
   
   What dependencies are there to the PM branch?
   
   To me it sounds like you should rebase your tidspbridge branch
   against the mainline kernel as the drivers should be arch
   independent.
   
   If something is missing from the mainline kernel to rebase and
   compile tidspbridge against the mainline, we need to fix those
   issues.
   
   Regards,
   
   Tony
  
  I have rebased tidspbridge patches on top of current pm branch.
  Currently bridge depends on some pm features which are not yet in
  mainline.
 
 Can you please describe what those dependencies are? We should fix
 those so we don't have dependencies.
  
  But at least now it can be compiled for your latest pm branch which
  I guess is in turn based on 2.6.29
  
  Here is the git URL:
  git://gitorious.org/tidspbridge/mainline.git
  
  Branch is: tidspbridge-2.6.29-pm
 
 The thing is that in order to do the development in parallel, we want
 to base all the branches against the mainline kernel. Otherwise we'll
 have unnecessary dependencies between the branches.
 
 Tony
 --
 To unsubscribe from this list: send the line unsubscribe linux-omap in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
I agree with Tony. It would be great to avoid any dependency against a
specific branch. We managed to compile tidspbridge against 2.6.29 MASTER
(not PM branch) and it seems to work with the attached patch. It has
been tested on Beagleaboard,

Grégoire



From 0b791888bcaa083983d6a04746c3a93b4e2c30b5 Mon Sep 17 00:00:00 2001
From: Tim Yamin pl...@roo.me.uk
Date: Sun, 26 Apr 2009 19:10:54 -0700
Subject: [PATCH] Make a few small changes so dspbridge compiles clean
against a non-pm tree.

Signed-off-by: Tim Yamin pl...@roo.me.uk
---
 arch/arm/mach-omap2/dspbridge.c |8 +---
 drivers/dsp/bridge/rmgr/drv_interface.c |2 ++
 drivers/dsp/bridge/rmgr/proc.c  |1 -
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-omap2/dspbridge.c
b/arch/arm/mach-omap2/dspbridge.c
index 43283c9..221e8ff 100644
--- a/arch/arm/mach-omap2/dspbridge.c
+++ b/arch/arm/mach-omap2/dspbridge.c
@@ -12,19 +12,21 @@
  */
 
 #include linux/platform_device.h
-
-#include mach/omap-pm.h
-
 #include dspbridge/host_os.h
 
 static struct platform_device *dspbridge_pdev;
 
+#ifdef CONFIG_BRIDGE_DVFS
+#include mach/omap-pm.h
 static struct dspbridge_platform_data dspbridge_pdata __initdata = {
.dsp_set_min_opp = omap_pm_dsp_set_min_opp,
.dsp_get_opp = omap_pm_dsp_get_opp,
.cpu_set_freq= omap_pm_cpu_set_freq,
.cpu_get_freq= omap_pm_cpu_get_freq,
 };
+#else
+static struct dspbridge_platform_data dspbridge_pdata;
+#endif
 
 static int __init dspbridge_init(void)
 {
diff --git a/drivers/dsp/bridge/rmgr/drv_interface.c
b/drivers/dsp/bridge/rmgr/drv_interface.c
index 9466409..4aa7de6 100755
--- a/drivers/dsp/bridge/rmgr/drv_interface.c
+++ b/drivers/dsp/bridge/rmgr/drv_interface.c
@@ -100,8 +100,10 @@
 #include dspbridge/dbreg.h
 #endif
 
+#ifdef CONFIG_BRIDGE_DVFS
 #include mach/omap-pm.h
 #include mach-omap2/omap3-opp.h
+#endif
 
 #define BRIDGE_NAME C6410
 /*  --- Globals */
diff --git a/drivers/dsp/bridge/rmgr/proc.c
b/drivers/dsp/bridge/rmgr/proc.c
index 59073dd..332e01a 100644
--- a/drivers/dsp/bridge/rmgr/proc.c
+++ b/drivers/dsp/bridge/rmgr/proc.c
@@ -145,7 +145,6 @@
 /*  --- This */
 #include dspbridge/proc.h
 #include dspbridge/pwr.h
-#include mach-omap2/omap3-opp.h
 
 #ifndef RES_CLEANUP_DISABLE
 #include dspbridge/resourcecleanup.h
-- 
1.5.6.3




0001-Make-a-few-small-changes-so-dspbridge-compiles-clean.patch
Description: application/mbox


YUV rotation support for DSS2 - 2.6.29 [WAS Re: Hello Tomi Valkeinen, I have some questions about dss2 driver.]

2009-04-06 Thread Gregoire Gentil
Tomi,

Tim has patched your latest DSS2 2.6.29 git (master branch) to add
support for YUV rotation. It has been successfully tested on the coming
Touch Book, as well as the Beagleboard Rev B6 with the exception of the
bug mentioned below. You may want to review this patch and perhaps
integrate once we have fixed the problem below.

A couple of questions and comments:

1. dss.c has no way of knowing whether VRFB is being used or not --
this is a problem because you need to decide whether to call
calc_rotation_offset_vrfb(...) or calc_rotation_offset(...). Any
suggestions on how the rotation mode should be passed between dss.c and
omapfb-main.c?

2. If I try to rotate both plane 0 and plane 1 to either 90 degrees or
270 (doesn't matter which is which), as soon as you try to play a video
you get VID1_FIFO_UNDERFLOW error messages, so it seems that the
hardware seems to be struggling a little when you have two sets of
90/270 degree rotations. If one of the planes is 0/180 and the other
is 90/270, then everything is fine. Would changing the FIFO settings
somehow improve this or do you have any ideas about what else might make
it work better?


Thanks in advance,

Grégoire Gentil

diff --git a/arch/arm/plat-omap/vrfb.c b/arch/arm/plat-omap/vrfb.c
index 7e0f8fc..77aa9a7 100644
--- a/arch/arm/plat-omap/vrfb.c
+++ b/arch/arm/plat-omap/vrfb.c
@@ -61,8 +61,10 @@ void omap_vrfb_setup(struct vrfb *vrfb, unsigned long paddr,
 			width, height, bytespp);
 
 	if (bytespp == 4)
+	{
 		pixel_size_exp = 2;
-	else if (bytespp == 2)
+		width = 1;
+	} else if (bytespp == 2)
 		pixel_size_exp = 1;
 	else
 		BUG();
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index 2480a03..1f022ce 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -1089,7 +1089,8 @@ static void _dispc_set_scaling(enum omap_plane plane,
 }
 
 static void _dispc_set_rotation_attrs(enum omap_plane plane, u8 rotation,
-		bool mirroring, enum omap_color_mode color_mode)
+		bool mirroring, enum omap_color_mode color_mode, u16 width,
+		u16 height)
 {
 	if (color_mode == OMAP_DSS_COLOR_YUV2 ||
 			color_mode == OMAP_DSS_COLOR_UYVY) {
@@ -1107,7 +1108,7 @@ static void _dispc_set_rotation_attrs(enum omap_plane plane, u8 rotation,
 			case 0: vidrot = 0; break;
 			case 1: vidrot = 1; break;
 			case 2: vidrot = 2; break;
-			case 3: vidrot = 1; break;
+			case 3: vidrot = 3; break;
 			}
 		}
 
@@ -1121,6 +1122,13 @@ static void _dispc_set_rotation_attrs(enum omap_plane plane, u8 rotation,
 		REG_FLD_MOD(dispc_reg_att[plane], 0, 13, 12);
 		REG_FLD_MOD(dispc_reg_att[plane], 0, 18, 18);
 	}
+
+	/* Turn on DMA optimization. For this to work, both height
+	   and width need to be even... */
+	if(width % 2 == 0  height % 2 == 0  (rotation == 1 || rotation == 3))
+		REG_FLD_MOD(dispc_reg_att[plane], 1, 20, 20);
+	else
+		REG_FLD_MOD(dispc_reg_att[plane], 0, 20, 20);
 }
 
 static s32 pixinc(int pixels, u8 ps)
@@ -1283,6 +1291,76 @@ static void calc_rotation_offset(u8 rotation, bool mirror,
 	}
 }
 
+static void calc_rotation_offset_vrfb(u8 rotation, bool mirror,
+		u16 screen_width,
+		u16 width, u16 height,
+		enum omap_color_mode color_mode, bool fieldmode,
+		unsigned *offset0, unsigned *offset1,
+		s32 *row_inc, s32 *pix_inc)
+{
+	u8 ps;
+	u16 fbw, fbh;
+
+	DSSDBG(calc_rot(%d): scrw %d, %dx%d, cm %d\n, rotation, screen_width,
+			width, height, color_mode);
+
+	/* width  height are overlay sizes, convert to fb sizes */
+	if (rotation == 0 || rotation == 2) {
+		fbw = width;
+		fbh = height;
+	} else {
+		fbw = height;
+		fbh = width;
+	}
+
+	switch (color_mode) {
+	case OMAP_DSS_COLOR_RGB16:
+	case OMAP_DSS_COLOR_ARGB16:
+		ps = 2;
+		break;
+
+	case OMAP_DSS_COLOR_RGB24P:
+		ps = 3;
+		break;
+
+	case OMAP_DSS_COLOR_RGB24U:
+	case OMAP_DSS_COLOR_ARGB32:
+	case OMAP_DSS_COLOR_RGBA32:
+	case OMAP_DSS_COLOR_RGBX32:
+		ps = 4;
+		break;
+
+	case OMAP_DSS_COLOR_YUV2:
+	case OMAP_DSS_COLOR_UYVY:
+		ps = 4;
+		fbw = 1;
+		break;
+	default:
+		BUG();
+		return;
+	}
+
+	*pix_inc = 1;
+	switch(rotation + mirror * 4) {
+		case 0:
+		case 1:
+		case 2:
+		case 3:
+			*offset0 = *offset1 = 0;
+			break;
+		default:
+			BUG();
+	}
+
+if(!mirror) {
+		if(rotation == 0 || rotation == 2)
+			*row_inc = 1 + (screen_width - fbw) * ps;
+		else
+			*row_inc = 1 + (screen_width - fbh) * ps;
+	} else
+		BUG();
+}
+
 static int _dispc_setup_plane(enum omap_plane plane,
 		enum omap_channel channel_out,
 		u32 paddr, u16 screen_width,
@@ -1361,7 +1439,7 @@ static int _dispc_setup_plane(enum omap_plane plane,
 	if (ilace  height = out_height)
 		fieldmode = 1;
 
-	calc_rotation_offset(rotation, mirror,
+	calc_rotation_offset_vrfb(rotation, mirror,
 			screen_width, width, height, color_mode,
 			fieldmode,
 			offset0, offset1, row_inc, pix_inc);
@@ -1393,18 +1471,25 @@ static int _dispc_setup_plane(enum omap_plane plane,
 			out_width, out_height);
 
 	_dispc_set_plane_pos(plane, pos_x, pos_y);
-
 	

Re: McSPI3 on the BeagleBoard

2009-02-20 Thread Gregoire Gentil
Philip,

I found the patch. Thanks. SPI3 is working for me too but I think that
there are a couple of errors:

- first, in the patch you posted on the beagleboard mailing list, you
don't setup CS0 and CS1 pins in u-boot. I think that you should do it.

- secondly, you have added more mux configuration in the kernel for SPI3
that should not be SPI3 but those new ones are wrong as they are
competing with some USB pins. It's the same error as David pointed you
for MMC2. Nevertheless, it's still working. Why? Because I have now a
strong feeling that mux configuration is not working in the kernel (at
least for the beagleboard). Here are a few facts that would confirm this
statement:

- MUX setup for USB ehci has never worked in the kernel. It's why the
beagleaboard rev-C ehci patch has been transfered to u-boot.

- the difference between your patch before and after it was working, is
really the u-boot configuration. You haven't really changed anything in
the kernel (especially in the spi driver) and as mentioned above, you
have even introduced some competing muxes that should have created more
trouble if the kernel mux config were working correctly.

- I had two other areas where I configured the pins in kernel and it was
not working. Only when I eventually did it in u-boot, it started to
work.

I don't know what's wrong with the pin configuration in the kernel,

Grégoire
 

On Thu, 2009-02-19 at 09:14 -0500, Philip Balister wrote:
 Gregoire Gentil wrote:
  Philip,
  
  Can you please post here or on the Beagleboard mailing list the u-boot
  patch? This muxpin is very tricky and I have experienced many problems
  when set up in the kernel while it seems to work better from u-boot -
  don't know why,
 
 I posted it to the Beagle group. Let me know if you are having trouble 
 finding it.
 
 If we come up with a better config for the expansion port, we'll clean 
 it up and submit here. My gut feeling is having SPI interfaces on the 
 expansion connector will be more useful then the MMC interface.
 
 Philip
 

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html