From: <hap...@us...> - 2007-09-17 20:13:36
|
Revision: 1331 http://hackndev.svn.sourceforge.net/hackndev/?rev=1331&view=rev Author: happy-slapin Date: 2007-09-17 13:13:33 -0700 (Mon, 17 Sep 2007) Log Message: ----------- cleanup: remove unimportant changes to hh.org-derived files Modified Paths: -------------- linux4palm/linux/branches/cleanup-branch-never-commit/arch/arm/tools/mach-types Added Paths: ----------- linux4palm/linux/branches/cleanup-branch-never-commit/drivers/mfd/htc-bbkeys.c linux4palm/linux/branches/cleanup-branch-never-commit/usr/.gitignore Removed Paths: ------------- linux4palm/linux/branches/cleanup-branch-never-commit/drivers/leds/leds-magician.c Modified: linux4palm/linux/branches/cleanup-branch-never-commit/arch/arm/tools/mach-types =================================================================== --- linux4palm/linux/branches/cleanup-branch-never-commit/arch/arm/tools/mach-types 2007-09-17 19:54:28 UTC (rev 1330) +++ linux4palm/linux/branches/cleanup-branch-never-commit/arch/arm/tools/mach-types 2007-09-17 20:13:33 UTC (rev 1331) @@ -12,7 +12,7 @@ # # http://www.arm.linux.org.uk/developer/machines/?action=new # -# Last update: Wed Aug 29 03:11:21 2007 +# Last update: Mon Mar 19 13:59:12 2007 # # machine_is_xxx CONFIG_xxxx MACH_TYPE_xxx number # @@ -217,7 +217,8 @@ ceiva ARCH_CEIVA CEIVA 200 fret SA1100_FRET FRET 201 emailphone SA1100_EMAILPHONE EMAILPHONE 202 -h3900 ARCH_H3900 H3900 203 +#h3900 ARCH_H3900 H3900 203 +h3900 MACH_H3900 H3900 203 pxa1 ARCH_PXA1 PXA1 204 koan369 SA1100_KOAN369 KOAN369 205 cogent ARCH_COGENT COGENT 206 @@ -266,7 +267,7 @@ wismo SA1100_WISMO WISMO 249 ezlinx ARCH_EZLINX EZLINX 250 at91rm9200 ARCH_AT91RM9200 AT91RM9200 251 -adtech_orion ARCH_ADTECH_ORION ADTECH_ORION 252 +orion ARCH_ORION ORION 252 neptune ARCH_NEPTUNE NEPTUNE 253 hackkit SA1100_HACKKIT HACKKIT 254 pxa_wins30 ARCH_PXA_WINS30 PXA_WINS30 255 @@ -353,7 +354,7 @@ icarus SA1100_ICARUS ICARUS 336 h1900 ARCH_H1900 H1900 337 gemini SA1100_GEMINI GEMINI 338 -axim ARCH_AXIM AXIM 339 +aximx5 ARCH_AXIMX5 AXIMX5 339 audiotron ARCH_AUDIOTRON AUDIOTRON 340 h2200 ARCH_H2200 H2200 341 loox600 ARCH_LOOX600 LOOX600 342 @@ -1148,7 +1149,7 @@ rema MACH_REMA REMA 1135 bps1000 MACH_BPS1000 BPS1000 1136 hw90350 MACH_HW90350 HW90350 1137 -omap_3430sdp MACH_OMAP_3430SDP OMAP_3430SDP 1138 +omap_sdp3430 MACH_OMAP_SDP3430 OMAP_SDP3430 1138 bluetouch MACH_BLUETOUCH BLUETOUCH 1139 vstms MACH_VSTMS VSTMS 1140 xsbase270 MACH_XSBASE270 XSBASE270 1141 @@ -1299,7 +1300,7 @@ h4300 MACH_H4300 H4300 1291 goramo_mlr MACH_GORAMO_MLR GORAMO_MLR 1292 mxc30020evb MACH_MXC30020EVB MXC30020EVB 1293 -adsbitsyg5 MACH_ADSBITSIMX ADSBITSIMX 1294 +adsbitsimx MACH_ADSBITSIMX ADSBITSIMX 1294 adsportalplus MACH_ADSPORTALPLUS ADSPORTALPLUS 1295 mmsp2plus MACH_MMSP2PLUS MMSP2PLUS 1296 em_x270 MACH_EM_X270 EM_X270 1297 @@ -1473,3 +1474,10 @@ add_wsc2 MACH_ADD_WSC2 ADD_WSC2 1465 add_medinet MACH_ADD_MEDINET ADD_MEDINET 1466 bboard MACH_BBOARD BBOARD 1467 +cambria MACH_CAMBRIA CAMBRIA 1468 +mt7xxx MACH_MT7XXX MT7XXX 1469 +matrix512 MACH_MATRIX512 MATRIX512 1470 +matrix522 MACH_MATRIX522 MATRIX522 1471 +ipac5010 MACH_IPAC5010 IPAC5010 1472 +sakura MACH_SAKURA SAKURA 1473 +grocx MACH_GROCX GROCX 1474 Deleted: linux4palm/linux/branches/cleanup-branch-never-commit/drivers/leds/leds-magician.c =================================================================== --- linux4palm/linux/branches/cleanup-branch-never-commit/drivers/leds/leds-magician.c 2007-09-17 19:54:28 UTC (rev 1330) +++ linux4palm/linux/branches/cleanup-branch-never-commit/drivers/leds/leds-magician.c 2007-09-17 20:13:33 UTC (rev 1331) @@ -1,116 +0,0 @@ -/* - * HTC Magician GPIO LED driver - * - * Copyright (c) 2006 Philipp Zabel <phi...@gm...> - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file COPYING in the main directory of this archive for - * more details. - */ - -#include <linux/kernel.h> -#include <linux/init.h> -#include <linux/platform_device.h> -#include <linux/leds.h> - -#include <asm/io.h> -#include <asm/gpio.h> - -#include <asm/arch/magician.h> - -static void magician_led_keys_set(struct led_classdev *led_cdev, - enum led_brightness value) -{ - gpio_set_value(GPIO103_MAGICIAN_LED_KP, value); -} - -static void magician_led_vibra_set(struct led_classdev *led_cdev, - enum led_brightness value) -{ - gpio_set_value(GPIO22_MAGICIAN_VIBRA_EN, value); -} - -static struct led_classdev magician_keys_led = { - .name = "magician:keys", - .default_trigger = "backlight", - .brightness_set = magician_led_keys_set, -}; - -static struct led_classdev magician_vibra_led = { - .name = "magician:vibra", - .default_trigger = "none", - .brightness_set = magician_led_vibra_set, -}; - -#ifdef CONFIG_PM -static int magician_led_suspend(struct platform_device *dev, pm_message_t state) -{ - led_classdev_suspend(&magician_keys_led); - led_classdev_suspend(&magician_vibra_led); - - return 0; -} - -static int magician_led_resume(struct platform_device *dev) -{ - int i; - - led_classdev_resume(&magician_keys_led); - led_classdev_resume(&magician_vibra_led); - - return 0; -} -#else -#define magician_led_suspend NULL -#define magician_led_resume NULL -#endif - -static int magician_led_probe(struct platform_device *pdev) -{ - int ret; - - ret = led_classdev_register(&pdev->dev, &magician_keys_led); - if (ret < 0) - return ret; - - ret = led_classdev_register(&pdev->dev, &magician_vibra_led); - if (ret < 0) - led_classdev_unregister(&magician_keys_led); - - return ret; -} - -static int magician_led_remove(struct platform_device *pdev) -{ - led_classdev_unregister(&magician_vibra_led); - led_classdev_unregister(&magician_keys_led); - - return 0; -} - -static struct platform_driver magician_led_driver = { - .probe = magician_led_probe, - .remove = magician_led_remove, - .suspend = magician_led_suspend, - .resume = magician_led_resume, - .driver = { - .name = "magician-led", - }, -}; - -static int __init magician_led_init (void) -{ - return platform_driver_register(&magician_led_driver); -} - -static void __exit magician_led_exit (void) -{ - platform_driver_unregister(&magician_led_driver); -} - -module_init (magician_led_init); -module_exit (magician_led_exit); - -MODULE_AUTHOR("Philipp Zabel <phi...@gm...>"); -MODULE_DESCRIPTION("HTC Magician LED driver"); -MODULE_LICENSE("GPL"); Added: linux4palm/linux/branches/cleanup-branch-never-commit/drivers/mfd/htc-bbkeys.c =================================================================== --- linux4palm/linux/branches/cleanup-branch-never-commit/drivers/mfd/htc-bbkeys.c (rev 0) +++ linux4palm/linux/branches/cleanup-branch-never-commit/drivers/mfd/htc-bbkeys.c 2007-09-17 20:13:33 UTC (rev 1331) @@ -0,0 +1,429 @@ +/* + * Support for the "mysterious" micro-controller that does "bit + * banging" on a pair of gpio pins. This is known to be present on + * HTC Apache and HTC Hermes phones. This controller controls the lcd + * power, the front keypad, and front LEDs. + * + * (c) Copyright 2007 Kevin O'Connor <ke...@ko...> + * + * This file may be distributed under the terms of the GNU GPL license. + */ + +#include <linux/kernel.h> +#include <linux/platform_device.h> /* struct platform_device */ +#include <linux/interrupt.h> /* irqreturn_t */ +#include <linux/input.h> /* input_report_key */ +#include <linux/spinlock.h> /* spinlock_t */ + +#include <asm/gpio.h> /* gpio_set_value */ +#include <linux/mfd/htc-bbkeys.h> + +/* Some HTC phones have a device attached to gpio pins that appears to + * follow the i2c system with some minor deviations. It uses a 4bit + * register number instead of a 7 bit device-id address. */ + +#define dprintf1(fmt, args...) printk(KERN_DEBUG fmt "\n" , ##args) +#define dprintf(fmt, args...) + +struct bbkeys_info { + spinlock_t lock; + int sda_gpio, scl_gpio; + int irq; + struct input_dev *input; + u8 outcache[8]; +}; + + +/**************************************************************** + * Chip register access + ****************************************************************/ + +/* Wrappers around gpio functions */ +static inline int get_sda(struct bbkeys_info *bb) +{ + return gpio_get_value(bb->sda_gpio); +} +static inline void set_sda(struct bbkeys_info *bb, int value) +{ + gpio_set_value(bb->sda_gpio, value); +} +static inline void set_scl(struct bbkeys_info *bb, int value) +{ + gpio_set_value(bb->scl_gpio, value); +} +static inline void set_sda_input(struct bbkeys_info *bb) +{ + gpio_direction_input(bb->sda_gpio); +} +static inline void set_sda_output(struct bbkeys_info *bb) +{ + gpio_direction_output(bb->sda_gpio); +} + +/* Read 'count' bits from SDA pin. The caller must ensure the SDA pin + * is set to input mode before calling. The SCL pin must be low. */ +static inline u32 read_bits(struct bbkeys_info *bb, int count) +{ + u32 data = 0; + int i = count; + + for (; i>0; i--) { + data <<= 1; + + set_scl(bb, 1); + + if (get_sda(bb)) + data |= 1; + dprintf(2, "Read bit of %d", data & 1); + + set_scl(bb, 0); + } + dprintf(1, "Read %d bits: 0x%08x", count, data); + return data; +} + +/* Write 'count' bits to SDA pin. The caller must ensure the SDA pin + * is set to output mode before calling. The SCL pin must be low. */ +static inline void write_bits(struct bbkeys_info *bb, u32 data, int count) +{ + u32 bit = 1<<(count-1); + dprintf(1, "Writing %d bits: 0x%08x", count, data); + + for (; count>0; count--) { + set_sda(bb, data & bit); + dprintf(2, "Write bit of %d", !!(data & bit)); + + set_scl(bb, 1); + set_scl(bb, 0); + + data <<= 1; + } +} + +/* Init the gpio lines and send a stop followed by a start. */ +static inline void stopstart(struct bbkeys_info *bb) +{ + dprintf(1, "Stop Start"); + + /* Init lines */ + set_sda_output(bb); + set_scl(bb, 0); + set_sda(bb, 0); + + /* Send stop */ + set_scl(bb, 1); + set_sda(bb, 1); + + /* Send start */ + set_sda(bb, 0); + set_scl(bb, 0); +} + +/* Read a register from the bit-banging interface. */ +static u32 __bbkeys_read(struct bbkeys_info *bb, u32 reg) +{ + u32 val; + stopstart(bb); + + /* Set read indicator as low order bit. */ + val = reg << 1; + val |= 1; + + /* Send register */ + write_bits(bb, val, 5); + + /* Get ack. */ + set_sda_input(bb); + val = read_bits(bb, 1); + if (! val) + goto fail; + + /* Read register value. */ + val = read_bits(bb, 9); + if (!(val & 1)) + goto fail; + val >>= 1; + + return val; +fail: + printk(KERN_WARNING "BBKEYS - Missing ack\n"); + return 0; +} + +static u32 bbkeys_read(struct bbkeys_info *bb, u32 reg) +{ + u32 ret; + unsigned long flag; + spin_lock_irqsave(&bb->lock, flag); + ret = __bbkeys_read(bb, reg); + spin_unlock_irqrestore(&bb->lock, flag); + return ret; +} + +/* Write a register on the bit-banging interface. */ +static void __bbkeys_write(struct bbkeys_info *bb, u32 reg, u32 data) +{ + stopstart(bb); + + /* Set write indicator as low order bit. */ + reg <<= 1; + + /* Send register */ + write_bits(bb, reg, 5); + + /* Get ack. */ + set_sda_input(bb); + reg = read_bits(bb, 1); + if (! reg) + goto fail; + set_sda_output(bb); + + /* write register value. */ + write_bits(bb, data, 8); + set_sda_input(bb); + reg = read_bits(bb, 1); + if (!reg) + goto fail; + return; +fail: + printk(KERN_WARNING "BBKEYS - Missing ack\n"); +} + +static void bbkeys_write(struct bbkeys_info *bb, u32 reg, u32 data) +{ + unsigned long flag; + spin_lock_irqsave(&bb->lock, flag); + __bbkeys_write(bb, reg, data); + spin_unlock_irqrestore(&bb->lock, flag); +} + + +/**************************************************************** + * Keypad + ****************************************************************/ + +static irqreturn_t bbkeys_isr(int irq, void *dev_id) +{ + int i; + struct platform_device *pdev = dev_id; + struct htc_bbkeys_platform_data *pdata = pdev->dev.platform_data; + struct bbkeys_info *bb = platform_get_drvdata(pdev); + u32 regs; + + /* Ack the interrupt. */ + bbkeys_write(bb, pdata->ackreg, 0); + + /* Read the key status registers */ + regs = ~(bbkeys_read(bb, pdata->key1reg) + | (bbkeys_read(bb, pdata->key2reg) << 8)); + + /* Register the state of the keys */ + for (i = 0; i < BBKEYS_MAXKEY; i++) { + int key = pdata->buttons[i]; + int state = !!(regs & (1<<i)); + if (key < 0) + continue; + input_report_key(bb->input, key, state); + input_sync(bb->input); + } + + return IRQ_HANDLED; +} + +/* Delayed input driver data. */ +static int InputReady; +static struct platform_device *Early_pdev; + +static int key_setup(struct platform_device *pdev) +{ + struct bbkeys_info *bb = platform_get_drvdata(pdev); + struct htc_bbkeys_platform_data *pdata = pdev->dev.platform_data; + struct input_dev *input; + struct resource *res; + int i, ret; + + if (! InputReady) { + printk("Delaying registration of bbkeys input driver\n"); + Early_pdev = pdev; + return 0; + } + + /* Find keyboard irq */ + res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); + if (!res) + return -EINVAL; + bb->irq = res->start; + + input = input_allocate_device(); + if (!input) + return -ENOMEM; + + set_bit(EV_KEY, input->evbit); + + input->name = pdev->name; + bb->input = input; + + for (i = 0; i < BBKEYS_MAXKEY; i++) { + int code = pdata->buttons[i]; + if (code >= 0) + set_bit(code, input->keybit); + } + + ret = input_register_device(input); + if (ret < 0) { + printk(KERN_ERR "Unable to register bbkeys input device\n"); + goto fail; + } + + ret = request_irq(bb->irq, bbkeys_isr + , IRQF_DISABLED | IRQF_TRIGGER_RISING + | IRQF_SAMPLE_RANDOM + , pdev->name, pdev); + if (ret) + goto fail; + + /* Clear any queued up key events. */ + bbkeys_write(bb, pdata->ackreg, 0); + + return 0; + +fail: + input_free_device(input); + return ret; +} + + +/**************************************************************** + * GPIOs + ****************************************************************/ + +static inline int u8pos(unsigned gpio) { + return (gpio & GPIO_BASE_MASK) / 8; +} +static inline int u8bit(unsigned gpio) { + return 1<<(gpio & (8-1)); +} + +/* Check an input pin to see if it is active. */ +static int bbkeys_get(struct device *dev, unsigned gpio) +{ + struct bbkeys_info *bb = dev_get_drvdata(dev); + u32 readval = bbkeys_read(bb, u8pos(gpio)); + return !!(readval & u8bit(gpio)); +} + +/* Set the direction of an output pin. */ +static void bbkeys_set(struct device *dev, unsigned gpio, int val) +{ + struct bbkeys_info *bb = dev_get_drvdata(dev); + int pos = u8pos(gpio); + unsigned long flag; + + spin_lock_irqsave(&bb->lock, flag); + if (val) + bb->outcache[pos] |= u8bit(gpio); + else + bb->outcache[pos] &= ~u8bit(gpio); + __bbkeys_write(bb, pos, bb->outcache[pos]); + spin_unlock_irqrestore(&bb->lock, flag); +} + +/* Dummy handler - this device doesn't support irqs. */ +static int bbkeys_to_irq(struct device *dev, unsigned gpio_no) +{ + return -ENODEV; +} + + +/**************************************************************** + * Setup + ****************************************************************/ + +static int bbkeys_probe(struct platform_device *pdev) +{ + struct htc_bbkeys_platform_data *pdata = pdev->dev.platform_data; + struct bbkeys_info *bb; + int ret; + struct gpio_ops ops; + + /* Initialize bb data structure. */ + bb = kzalloc(sizeof(*bb), GFP_KERNEL); + if (!bb) + return -ENOMEM; + + spin_lock_init(&bb->lock); + + bb->sda_gpio = pdata->sda_gpio; + bb->scl_gpio = pdata->scl_gpio; + + platform_set_drvdata(pdev, bb); + + /* Setup input handling */ + ret = key_setup(pdev); + if (ret) + goto fail; + + ops.get_value = bbkeys_get; + ops.set_value = bbkeys_set; + ops.to_irq = bbkeys_to_irq; + gpiodev_register(pdata->gpio_base, &pdev->dev, &ops); + + return 0; +fail: + printk(KERN_NOTICE "BBKEYS failed to setup\n"); + kfree(bb); + return ret; +} + +static int bbkeys_remove(struct platform_device *pdev) +{ + struct bbkeys_info *bb = platform_get_drvdata(pdev); + free_irq(bb->irq, pdev); + input_unregister_device(bb->input); + kfree(bb); + return 0; +} + +static struct platform_driver bbkeys_driver = { + .driver = { + .name = "htc-bbkeys", + }, + .probe = bbkeys_probe, + .remove = bbkeys_remove, +}; + +static int __init bbkeys_init(void) +{ + return platform_driver_register(&bbkeys_driver); +} + +static void __exit bbkeys_exit(void) +{ + platform_driver_unregister(&bbkeys_driver); +} + +/* Ugh. The input subsystem comes up later in the boot process, but + * several devices need the bbkeys gpio driver earlier. So, if this + * driver comes up early, we delay input registration until later in + * the boot. */ +static int __init bbkeys_late_init(void) +{ + InputReady = 1; + if (Early_pdev) { + printk("Registering delayed bbkeys input driver\n"); + key_setup(Early_pdev); + } + Early_pdev = NULL; + return 0; +} + +module_init(bbkeys_late_init) +#ifdef MODULE +module_init(bbkeys_init); +#else /* start early for dependencies */ +subsys_initcall(bbkeys_init); +#endif +module_exit(bbkeys_exit) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Kevin O'Connor <ke...@ko...>"); Added: linux4palm/linux/branches/cleanup-branch-never-commit/usr/.gitignore =================================================================== --- linux4palm/linux/branches/cleanup-branch-never-commit/usr/.gitignore (rev 0) +++ linux4palm/linux/branches/cleanup-branch-never-commit/usr/.gitignore 2007-09-17 20:13:33 UTC (rev 1331) @@ -0,0 +1,7 @@ +# +# Generated files +# +gen_init_cpio +initramfs_data.cpio +initramfs_data.cpio.gz +initramfs_list This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |