From: <hap...@us...> - 2007-09-17 14:11:51
|
Revision: 1325 http://hackndev.svn.sourceforge.net/hackndev/?rev=1325&view=rev Author: happy-slapin Date: 2007-09-17 07:11:49 -0700 (Mon, 17 Sep 2007) Log Message: ----------- cleanup: drivers/misc: update from hh.org Modified Paths: -------------- linux4palm/linux/branches/cleanup-branch-never-commit/drivers/input/keyboard/Kconfig linux4palm/linux/branches/cleanup-branch-never-commit/drivers/misc/fsi_drv.c linux4palm/linux/branches/cleanup-branch-never-commit/drivers/misc/samcop_fsi.c linux4palm/linux/branches/cleanup-branch-never-commit/drivers/misc/samcop_fsi.h linux4palm/linux/branches/cleanup-branch-never-commit/drivers/pcmcia/pxa2xx_base.c linux4palm/linux/branches/cleanup-branch-never-commit/drivers/video/backlight/Makefile Modified: linux4palm/linux/branches/cleanup-branch-never-commit/drivers/input/keyboard/Kconfig =================================================================== --- linux4palm/linux/branches/cleanup-branch-never-commit/drivers/input/keyboard/Kconfig 2007-09-17 13:32:07 UTC (rev 1324) +++ linux4palm/linux/branches/cleanup-branch-never-commit/drivers/input/keyboard/Kconfig 2007-09-17 14:11:49 UTC (rev 1325) @@ -200,6 +200,12 @@ This is more generic version of gpio_keys driver, supporting GPIOs across different chips. +config GPIODEV_KEYS2 + tristate "Buttons on GPIOs, version 2" + help + GPIO keyboard driver supportting multiple GPIOs per button, + as well as button priorities. + config GPIODEV_DIAGONAL tristate "Diagonal joypad on GPIO" help Modified: linux4palm/linux/branches/cleanup-branch-never-commit/drivers/misc/fsi_drv.c =================================================================== --- linux4palm/linux/branches/cleanup-branch-never-commit/drivers/misc/fsi_drv.c 2007-09-17 13:32:07 UTC (rev 1324) +++ linux4palm/linux/branches/cleanup-branch-never-commit/drivers/misc/fsi_drv.c 2007-09-17 14:11:49 UTC (rev 1325) @@ -26,24 +26,26 @@ #include <asm/arch/irqs.h> #include <asm/arch/fsi.h> +#include <asm/arch/pxa-regs.h> +#include <asm/arch/h5400-gpio.h> #include "samcop_fsi.h" -atomic_t fsi_in_use; -DECLARE_WAIT_QUEUE_HEAD(fsi_rqueue); -struct timer_list fsi_temp_timer; +static atomic_t fsi_in_use; +static DECLARE_WAIT_QUEUE_HEAD(fsi_rqueue); +static struct timer_list fsi_temp_timer; -unsigned int fsi_prescale = 19; -unsigned int fsi_dmi = 1124; -unsigned int fsi_treshold_on = 20; -unsigned int fsi_treshold_off = 4; -unsigned int fsi_buffer_size = FSI_FRAME_SIZE * (sizeof(unsigned long)) * 3; +static unsigned int fsi_prescale = 19; +static unsigned int fsi_dmi = 1124; +static unsigned int fsi_treshold_on = 20; +static unsigned int fsi_treshold_off = 4; +static unsigned int fsi_buffer_size = FSI_FRAME_SIZE * (sizeof(unsigned long)) * 3; volatile unsigned char fsi_lfrm = 0; static struct samcop_fsi *fsi_ = NULL; -void fsi_set_mode(unsigned int cmd) +static void fsi_set_mode(unsigned int cmd) { static unsigned int current_mode = 0; static unsigned long control_register = 0; @@ -107,14 +109,14 @@ } } -void fsi_timer_temp_callback(unsigned long input) +static void fsi_timer_temp_callback(unsigned long input) { printk(KERN_DEBUG "%s: stopping temperature increase (status=%d)\n", __FUNCTION__, samcop_fsi_get_control(fsi_) & FSI_CONTROL_TEMP); fsi_set_mode(FSI_CMD_STOP_TEMP); } -inline int fsi_analyze_column(struct fsi_read_state *read_state, unsigned int data) +static inline int fsi_analyze_column(struct fsi_read_state *read_state, unsigned int data) { if ((data & 0xEFEF) == 0xE0E0) { /* sync column */ read_state->frame_number++; @@ -158,7 +160,7 @@ return 0; } -void fsi_run_tasklet(unsigned long state_ptr) +static void fsi_run_tasklet(unsigned long state_ptr) { unsigned int i; unsigned long data; @@ -202,14 +204,14 @@ DECLARE_TASKLET_DISABLED(fsi_tasklet,fsi_run_tasklet,0); -int fsi_irq_handler(int irq, void *dev_id, struct pt_regs *regs) +static irqreturn_t fsi_irq_handler(int irq, void *dev_id) { unsigned int fifo_status; fifo_status = samcop_fsi_get_status(fsi_); - if (fifo_status & 1) { + if (fifo_status & 1) { /* FIFO trigger */ fsi_set_mode(FSI_CMD_STOP_ACQ_INT); tasklet_schedule(&fsi_tasklet); } @@ -226,10 +228,10 @@ fsi_lfrm = 1; tasklet_schedule(&fsi_tasklet); } - return 0; + return IRQ_HANDLED; } -int fsi_copy_to_user(struct fsi_read_state *read_state, char *buf) +static int fsi_copy_to_user(struct fsi_read_state *read_state, char *buf) { unsigned int avail_words; @@ -240,7 +242,14 @@ else avail_words = read_state->write_pos - read_state->read_pos; - if (copy_to_user(buf+read_state->word_count*4,read_state->buffer+read_state->read_pos,avail_words*4)) + /* 'buf' is 'char*', but word_count denotes count in array of 'unsigned + * long'. To get proper destination address, we need to multiple it by + * sizeof(unsigned long). + */ + + if (copy_to_user(buf+read_state->word_count*sizeof(unsigned long), + read_state->buffer+read_state->read_pos, + avail_words*sizeof(unsigned long))) return -EFAULT; read_state->word_count += avail_words; @@ -284,10 +293,13 @@ filp->private_data = read_state; -#if 0 +#if 1 /* GPIO61 turns out to be serial power, not fingerchip power. Any other guesses? */ - SET_GPIO(POWER_FP_N, 0); /* power on */ + /* it _IS_ this GPIO. No idea what else it powers, but without it, ATMEL + * chip returns zeroes. */ + //SET_GPIO(POWER_FP_N, 0); /* power on */ + SET_H5400_GPIO(POWER_RS232_N_OR_FS, 0); #endif /* init hardware */ samcop_fsi_up(fsi_); @@ -295,18 +307,19 @@ return 0; } -int fsi_release(struct inode *inode, struct file *filp) +static int fsi_release(struct inode *inode, struct file *filp) { /* put scanner to sleep before we exit */ samcop_fsi_down(fsi_); kfree(filp->private_data); atomic_inc(&fsi_in_use); + SET_H5400_GPIO(POWER_RS232_N_OR_FS, 1); return 0; } -ssize_t fsi_read(struct file *filp, char *buf, size_t count, loff_t *offp) +static ssize_t fsi_read(struct file *filp, char *buf, size_t count, loff_t *offp) { int errval = 0; struct fsi_read_state *read_state; @@ -321,6 +334,7 @@ /* allocate buffer and initialize state */ read_state->buffer_size = fsi_buffer_size; read_state->buffer = kmalloc(read_state->buffer_size,GFP_KERNEL); + read_state->buffer_size = fsi_buffer_size/sizeof(unsigned long); if (read_state->buffer == NULL) return -ENOMEM; @@ -347,6 +361,7 @@ /* gather data */ while (read_state->word_count < read_state->word_dest) { + //printk (KERN_INFO "word_count: %d, word_dest: %d\n", read_state->word_count, read_state->word_dest); interruptible_sleep_on(&fsi_rqueue); if (signal_pending(current)) { errval = -ERESTARTSYS; @@ -380,7 +395,7 @@ return count; } -int fsi_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) +static int fsi_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) { struct fsi_read_state *read_state; @@ -474,15 +489,20 @@ return 0; } -void +int fsi_detach(void) { + if (atomic_dec_and_test(&fsi_in_use)) { + atomic_inc(&fsi_in_use); + /* someone is using FSI at the moment, we can't quit */ + return -EBUSY; + } fsi_set_mode(FSI_CMD_STOP_TEMP); del_timer(&fsi_temp_timer); - samcop_fsi_down(fsi_); /* Stop h/w */ free_irq(fsi_->irq, NULL); fsi_ = NULL; misc_deregister(&fsi_miscdev); + return 0; } MODULE_AUTHOR("J\xB0rgen Andreas Michaelsen <jor...@if...>"); Modified: linux4palm/linux/branches/cleanup-branch-never-commit/drivers/misc/samcop_fsi.c =================================================================== --- linux4palm/linux/branches/cleanup-branch-never-commit/drivers/misc/samcop_fsi.c 2007-09-17 13:32:07 UTC (rev 1324) +++ linux4palm/linux/branches/cleanup-branch-never-commit/drivers/misc/samcop_fsi.c 2007-09-17 14:11:49 UTC (rev 1325) @@ -9,6 +9,7 @@ * */ + #include <linux/module.h> #include <linux/init.h> #include <linux/kernel.h> @@ -18,24 +19,24 @@ #include <linux/clk.h> #include <asm/hardware.h> #include <asm/io.h> -#include <asm/arch/ipaq.h> #include <asm/hardware/ipaq-samcop.h> -#include <asm/hardware/samcop_base.h> +#include <linux/mfd/samcop_base.h> #include <asm/hardware/samcop-fsi.h> #include "samcop_fsi.h" static inline void -samcop_fsi_write_register (struct samcop_fsi *fsi, u32 reg, u16 val) +samcop_fsi_write_register (struct samcop_fsi *fsi, u32 reg, u32 val) { - __raw_writew (val, reg + fsi->map); + fsi->fsi_data->write_reg (fsi->me, reg, val); } -static inline u16 +static inline u32 samcop_fsi_read_register (struct samcop_fsi *fsi, u32 reg) { - return __raw_readw (reg + fsi->map); + return fsi->fsi_data->read_reg (fsi->me, reg); } + /* * Helper functions that provide samcop access to the fcd and fsi parts of the * fingerprint scanner @@ -44,6 +45,7 @@ void samcop_fsi_set_control (struct samcop_fsi *fsi, u32 val) { + val &= 0xff; samcop_fsi_write_register (fsi, _SAMCOP_FSI_Control, val); } @@ -100,7 +102,7 @@ /* tell scanner to sleep */ u32 control_register = 0; control_register = samcop_fsi_get_control(fsi); - control_register |= ~SAMCOP_FSI_CONTROL_TEMP_PWR_ON; + control_register &= ~SAMCOP_FSI_CONTROL_TEMP_PWR_ON; // |= was here originally samcop_fsi_set_control(fsi, control_register); /* disable PCLK */ @@ -110,40 +112,69 @@ void samcop_fsi_set_status (struct samcop_fsi *fsi, u32 val) { - samcop_fsi_write_register (fsi, SAMCOP_FSI_STA, val); + samcop_fsi_write_register (fsi, _SAMCOP_FSI_STA, val); } u32 samcop_fsi_get_status (struct samcop_fsi *fsi) { - return samcop_fsi_read_register (fsi, SAMCOP_FSI_STA); + return samcop_fsi_read_register (fsi, _SAMCOP_FSI_STA); } u32 samcop_fsi_read_data (struct samcop_fsi *fsi) { - return samcop_fsi_read_register (fsi, SAMCOP_FSI_DAT); + return samcop_fsi_read_register (fsi, _SAMCOP_FSI_DAT); } static int -samcop_fsi_probe (struct device *dev) +samcop_fsi_probe (struct platform_device *pdev) { int result = 0; struct samcop_fsi *fsi; - struct platform_device *sdev = to_platform_device (dev); fsi = kmalloc (sizeof (*fsi), GFP_KERNEL); if (!fsi) return -ENOMEM; memset (fsi, 0, sizeof (*fsi)); - fsi->parent = dev->parent; - dev->driver_data = fsi; + fsi->parent = pdev->dev.parent; + platform_set_drvdata(pdev, fsi); - fsi->map = (void *)sdev->resource[1].start; - fsi->irq = sdev->resource[2].start; + /* Is this really correct? Some other drivers use this approach, but + * this was already once ioremapped by samcop_base, so we could possibly + * use that mapping and not create new one (approach similar to + * samcop_sdi). + */ - fsi->clk = clk_get(dev, "fsi"); + fsi->map = ioremap(pdev->resource[0].start, + pdev->resource[0].end - pdev->resource[0].start + 1); + fsi->irq = pdev->resource[1].start; + pr_debug("FSI at 0x%p, IRQ %d\n", fsi->map, fsi->irq); + + fsi->clk = clk_get(&pdev->dev, "fsi"); + if (!fsi->clk) { + printk(KERN_ERR "samcop_fsi: Could not get fsi clock"); + iounmap(fsi->map); + kfree(fsi); + result = -EBUSY; + }; + + fsi->fsi_data = pdev->dev.platform_data; + fsi->me = &pdev->dev; +/* + fsi->set_control = samcop_fsi_set_control; + fsi->get_control = samcop_fsi_get_control; + fsi->set_status = samcop_fsi_set_status; + fsi->get_status = samcop_fsi_get_status; + fsi->read_data = samcop_fsi_read_data; + fsi->up = samcop_fsi_up; + fsi->down = samcop_fsi_down; + fsi->set_fifo_control = samcop_fsi_set_fifo_control; + fsi->set_prescaler = samcop_fsi_set_prescaler; + fsi->set_dmc = samcop_fsi_set_dmc; +*/ + if (IS_ERR(fsi->clk)) { printk(KERN_ERR "failed to get fsi clock\n"); kfree (fsi); @@ -154,33 +185,40 @@ printk("couldn't attach fsi driver: error %d\n", result); kfree (fsi); } + return result; } static int -samcop_fsi_remove (struct device *dev) +samcop_fsi_remove (struct platform_device *dev) { - struct samcop_fsi *fsi = dev->driver_data; - fsi_detach(); + struct samcop_fsi *fsi = platform_get_drvdata(dev); + int result = 0; + result = fsi_detach(); + if (result != 0) + return result; + iounmap(fsi->map); kfree (fsi); - return 0; + return result; } static int -samcop_fsi_suspend (struct device *dev, pm_message_t state) +samcop_fsi_suspend (struct platform_device *dev, pm_message_t state) { return 0; } static int -samcop_fsi_resume (struct device *dev) +samcop_fsi_resume (struct platform_device *dev) { return 0; } -struct device_driver samcop_fsi_device_driver = { - .name = "samcop fsi", +struct platform_driver samcop_fsi_device_driver = { + .driver = { + .name = "samcop fsi", + }, .probe = samcop_fsi_probe, .remove = samcop_fsi_remove, .suspend = samcop_fsi_suspend, @@ -189,12 +227,12 @@ static int samcop_fsi_init (void) { - return driver_register (&samcop_fsi_device_driver); + return platform_driver_register (&samcop_fsi_device_driver); } static void samcop_fsi_cleanup (void) { - driver_unregister (&samcop_fsi_device_driver); + platform_driver_unregister (&samcop_fsi_device_driver); } module_init(samcop_fsi_init); Modified: linux4palm/linux/branches/cleanup-branch-never-commit/drivers/misc/samcop_fsi.h =================================================================== --- linux4palm/linux/branches/cleanup-branch-never-commit/drivers/misc/samcop_fsi.h 2007-09-17 13:32:07 UTC (rev 1324) +++ linux4palm/linux/branches/cleanup-branch-never-commit/drivers/misc/samcop_fsi.h 2007-09-17 14:11:49 UTC (rev 1325) @@ -10,14 +10,26 @@ #ifndef _SAMCOP_FSI_H_ #define _SAMCOP_FSI_H_ + +struct samcop_fsi_data { + u32 (*read_reg)(struct device *dev, u32 reg); + void (*write_reg)(struct device *dev, u32 reg, u32 val); +}; + + struct samcop_fsi { struct device *parent; // parent struct for access to // samcop registers + struct device *me; void *map; // fsi register map int irq; // data ready irq struct clk *clk; // samcop fsi clk + + struct samcop_fsi_data *fsi_data; }; + + extern void samcop_fsi_set_control (struct samcop_fsi *fsi, u32 val); extern u32 samcop_fsi_get_control (struct samcop_fsi *fsi); extern void samcop_fsi_set_status (struct samcop_fsi *fsi, u32 val); @@ -29,7 +41,8 @@ extern void samcop_fsi_set_prescaler (struct samcop_fsi *fsi, u32 val); extern void samcop_fsi_set_dmc (struct samcop_fsi *fsi, u32 val); + extern int fsi_attach (struct samcop_fsi *fsi); -extern void fsi_detach (void); +extern int fsi_detach (void); #endif /* _SAMCOP_FSI_H_ */ Modified: linux4palm/linux/branches/cleanup-branch-never-commit/drivers/pcmcia/pxa2xx_base.c =================================================================== --- linux4palm/linux/branches/cleanup-branch-never-commit/drivers/pcmcia/pxa2xx_base.c 2007-09-17 13:32:07 UTC (rev 1324) +++ linux4palm/linux/branches/cleanup-branch-never-commit/drivers/pcmcia/pxa2xx_base.c 2007-09-17 14:11:49 UTC (rev 1325) @@ -59,7 +59,12 @@ u_int mem_clk_10khz) { u_int code = pcmcia_cycle_ns * mem_clk_10khz; +// FIXME: There shouldn't be such #ifdef, added 20070803, resolve max in 6months +#ifdef CONFIG_ARCH_H5400 + return (code / 300000) + ((code % 300000) ? 1 : 0) + 1; +#else return (code / 300000) + ((code % 300000) ? 1 : 0) - 1; +#endif } static inline u_int pxa2xx_mcxx_setup(u_int pcmcia_cycle_ns, Modified: linux4palm/linux/branches/cleanup-branch-never-commit/drivers/video/backlight/Makefile =================================================================== --- linux4palm/linux/branches/cleanup-branch-never-commit/drivers/video/backlight/Makefile 2007-09-17 13:32:07 UTC (rev 1324) +++ linux4palm/linux/branches/cleanup-branch-never-commit/drivers/video/backlight/Makefile 2007-09-17 14:11:49 UTC (rev 1325) @@ -1,13 +1,13 @@ # Backlight & LCD drivers -obj-$(CONFIG_LCD_CLASS_DEVICE) += lcd.o -obj-$(CONFIG_BACKLIGHT_CLASS_DEVICE) += backlight.o -obj-$(CONFIG_BACKLIGHT_CORGI) += corgi_bl.o -obj-$(CONFIG_BACKLIGHT_HP680) += hp680_bl.o -obj-$(CONFIG_BACKLIGHT_LOCOMO) += locomolcd.o -obj-$(CONFIG_BACKLIGHT_PROGEAR) += progear_bl.o -obj-$(CONFIG_BACKLIGHT_HX2750) += hx2750_bl.o -obj-$(CONFIG_BACKLIGHT_H2200) += h2200_bl.o -obj-$(CONFIG_LCD_H2200) += h2200_lcd.o -obj-$(CONFIG_BACKLIGHT_S3C2410) += s3c2410_lcd.o +obj-$(CONFIG_LCD_CLASS_DEVICE) += lcd.o +obj-$(CONFIG_BACKLIGHT_CLASS_DEVICE) += backlight.o +obj-$(CONFIG_BACKLIGHT_CORGI) += corgi_bl.o +obj-$(CONFIG_BACKLIGHT_HP680) += hp680_bl.o +obj-$(CONFIG_BACKLIGHT_LOCOMO) += locomolcd.o +obj-$(CONFIG_BACKLIGHT_PROGEAR) += progear_bl.o +obj-$(CONFIG_BACKLIGHT_HX2750) += hx2750_bl.o +obj-$(CONFIG_BACKLIGHT_H2200) += h2200_bl.o +obj-$(CONFIG_LCD_H2200) += h2200_lcd.o +obj-$(CONFIG_BACKLIGHT_S3C2410) += s3c2410_lcd.o This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hap...@us...> - 2007-09-17 19:42:02
|
Revision: 1329 http://hackndev.svn.sourceforge.net/hackndev/?rev=1329&view=rev Author: happy-slapin Date: 2007-09-17 12:41:58 -0700 (Mon, 17 Sep 2007) Log Message: ----------- cleanup: getting from hh.org Modified Paths: -------------- linux4palm/linux/branches/cleanup-branch-never-commit/drivers/char/Kconfig linux4palm/linux/branches/cleanup-branch-never-commit/drivers/char/sa1100-rtc.c linux4palm/linux/branches/cleanup-branch-never-commit/drivers/mfd/htc-egpio.c linux4palm/linux/branches/cleanup-branch-never-commit/drivers/mfd/pasic3_base.c linux4palm/linux/branches/cleanup-branch-never-commit/drivers/mfd/samcop_base.c Modified: linux4palm/linux/branches/cleanup-branch-never-commit/drivers/char/Kconfig =================================================================== --- linux4palm/linux/branches/cleanup-branch-never-commit/drivers/char/Kconfig 2007-09-17 15:37:25 UTC (rev 1328) +++ linux4palm/linux/branches/cleanup-branch-never-commit/drivers/char/Kconfig 2007-09-17 19:41:58 UTC (rev 1329) @@ -810,23 +810,19 @@ via the file /proc/rtc and its behaviour is set by various ioctls on /dev/rtc. -# -# This is a weird duplicate copy of the driver, please update your config to use -# RTC_DRV_SA1100 instead! -# -#config SA1100_RTC -# tristate "SA11x0/PXA2xx RTC support" -# depends on ARCH_SA1100 || ARCH_PXA -# help -# If you say Y here and create a character special file /dev/rtc with -# major number 10 and minor number 135 using mknod ("man mknod"), you -# will get access to the real time clock built into your SA11x0 or -# PXA2xx CPU. It reports status information via the file /proc/rtc -# and its behaviour is set by various ioctls on /dev/rtc. -# -# To compile this driver as a module, choose M here: the -# module will be called sa1100-rtc. +config SA1100_RTC + tristate "SA11x0/PXA2xx RTC support" + depends on ARCH_SA1100 || ARCH_PXA + help + If you say Y here and create a character special file /dev/rtc with + major number 10 and minor number 135 using mknod ("man mknod"), you + will get access to the real time clock built into your SA11x0 or + PXA2xx CPU. It reports status information via the file /proc/rtc + and its behaviour is set by various ioctls on /dev/rtc. + To compile this driver as a module, choose M here: the + module will be called sa1100-rtc. + config GEN_RTC tristate "Generic /dev/rtc emulation" depends on RTC!=y && !IA64 && !ARM && !M32R && !SPARC && !FRV Modified: linux4palm/linux/branches/cleanup-branch-never-commit/drivers/char/sa1100-rtc.c =================================================================== --- linux4palm/linux/branches/cleanup-branch-never-commit/drivers/char/sa1100-rtc.c 2007-09-17 15:37:25 UTC (rev 1328) +++ linux4palm/linux/branches/cleanup-branch-never-commit/drivers/char/sa1100-rtc.c 2007-09-17 19:41:58 UTC (rev 1329) @@ -1,16 +1,4 @@ /* - * - * NOTE: The file you're looking for is in drivers/rtc, please don't use this one - * it'll be removed eventually. - * - * - * - * - */ -#error This is a weird duplicate copy of the driver, please update your config to use \ -RTC_DRV_SA1100 instead! - -/* * linux/drivers/char/sa1100-rtc.c * * Real Time Clock interface for Linux on StrongARM SA1x00 Modified: linux4palm/linux/branches/cleanup-branch-never-commit/drivers/mfd/htc-egpio.c =================================================================== --- linux4palm/linux/branches/cleanup-branch-never-commit/drivers/mfd/htc-egpio.c 2007-09-17 15:37:25 UTC (rev 1328) +++ linux4palm/linux/branches/cleanup-branch-never-commit/drivers/mfd/htc-egpio.c 2007-09-17 19:41:58 UTC (rev 1329) @@ -11,6 +11,7 @@ #include <linux/errno.h> /* ENODEV */ #include <linux/interrupt.h> /* enable_irq_wake */ #include <linux/spinlock.h> /* spinlock_t */ +#include <linux/platform_device.h> /* platform_device */ #include <linux/module.h> #include <linux/gpiodev2.h> #include <linux/mfd/htc-egpio.h> @@ -138,12 +139,9 @@ for (i=0; i<pdata->nr_pins; i++) { struct htc_egpio_pinInfo *pi = &pdata->pins[i]; if (pi->type == HTC_EGPIO_TYPE_INPUT - && pi->pin_nr == (gpio_no & GPIO_BASE_MASK) + && pi->gpio == gpio_no && pi->input_irq >= 0) - return pi->input_irq + ei->irqStart; - if (pi->type == HTC_EGPIO_TYPE_IRQ - && pi->pin_nr == (gpio_no & GPIO_BASE_MASK)) - return pi->pin_nr + ei->irqStart; + return (pi->input_irq & 0xf) + ei->irqStart; } return -ENODEV; } @@ -181,10 +179,10 @@ static void setup_pin(struct egpio_info *ei, struct htc_egpio_pinInfo *pi) { - struct htc_egpio_pinInfo dummy; + int pin = pi->gpio & GPIO_BASE_MASK; - if (pi->pin_nr < 0 || pi->pin_nr > 16*MAX_EGPIO_REGS) { - printk(KERN_ERR "EGPIO invalid pin %d\n", pi->pin_nr); + if (pi->gpio < 0 || pin > 16*MAX_EGPIO_REGS) { + printk(KERN_ERR "EGPIO invalid pin %d\n", pi->gpio); return; } @@ -192,24 +190,19 @@ case HTC_EGPIO_TYPE_INPUT: if (pi->input_irq < 0) break; - dummy.pin_nr = pi->input_irq; - pi = &dummy; - /* NO BREAK */ - case HTC_EGPIO_TYPE_IRQ: - if (ei->ackRegister != u16pos(pi->pin_nr)) { + pin = pi->input_irq & GPIO_BASE_MASK; + if (ei->ackRegister != u16pos(pin)) { printk(KERN_ERR "EGPIO irq conflict %d vs %d\n" - , ei->ackRegister, u16pos(pi->pin_nr)); + , ei->ackRegister, u16pos(pin)); return; } break; - case HTC_EGPIO_TYPE_OUTPUT: { - int pin = pi->pin_nr; + case HTC_EGPIO_TYPE_OUTPUT: if (ei->maxRegs < u16pos(pin)) ei->maxRegs = u16pos(pin); if (pi->output_initial) ei->cached_values[u16pos(pin)] |= u16bit(pin); break; - } default: printk(KERN_ERR "EGPIO unknown type %d\n", pi->type); } @@ -221,6 +214,7 @@ struct resource *res; struct egpio_info *ei; int irq, i, ret; + struct gpio_ops ops; /* Initialize ei data structure. */ ei = kzalloc(sizeof(*ei), GFP_KERNEL); @@ -247,18 +241,12 @@ , res->start, ei->addrBase); ei->bus_shift = pdata->bus_shift; - pdata->ops.get = egpio_get; - pdata->ops.set = egpio_set; - pdata->ops.to_irq = egpio_to_irq; platform_set_drvdata(pdev, ei); - { - struct gpio_ops ops; ops.get_value = egpio_get; ops.set_value = egpio_set; ops.to_irq = egpio_to_irq; gpiodev_register(pdata->gpio_base, &pdev->dev, &ops); - } /* Go through list of pins. */ ei->irqStart = pdata->irq_base; Modified: linux4palm/linux/branches/cleanup-branch-never-commit/drivers/mfd/pasic3_base.c =================================================================== --- linux4palm/linux/branches/cleanup-branch-never-commit/drivers/mfd/pasic3_base.c 2007-09-17 15:37:25 UTC (rev 1328) +++ linux4palm/linux/branches/cleanup-branch-never-commit/drivers/mfd/pasic3_base.c 2007-09-17 19:41:58 UTC (rev 1329) @@ -94,13 +94,10 @@ struct device *dev = ds1wm_dev->dev.parent; int c; - /* FIXME: use this to detect magician/pasic3 for now */ - if (ds1wm_clk.rate == 4000000) { - c = pasic3_read_register(dev, 0x28); - pasic3_write_register(dev, 0x28, c & 0x7f); + c = pasic3_read_register(dev, 0x28); + pasic3_write_register(dev, 0x28, c & 0x7f); - pr_debug ("pasic3: DS1WM OWM_EN low (active) %02x\n", c & 0x7f); - } + pr_debug ("pasic3: DS1WM OWM_EN low (active) %02x\n", c & 0x7f); } static void ds1wm_disable(struct platform_device *ds1wm_dev) @@ -108,13 +105,10 @@ struct device *dev = ds1wm_dev->dev.parent; int c; - /* FIXME: use this to detect magician/pasic3 for now */ - if (ds1wm_clk.rate == 4000000) { - c = pasic3_read_register(dev, 0x28); - pasic3_write_register(dev, 0x28, c | 0x80); + c = pasic3_read_register(dev, 0x28); + pasic3_write_register(dev, 0x28, c | 0x80); - pr_debug ("pasic3: DS1WM OWM_EN high (inactive) %02x\n", c | 0x80); - } + pr_debug ("pasic3: DS1WM OWM_EN high (inactive) %02x\n", c | 0x80); } static struct ds1wm_platform_data __devinit ds1wm_platform_data = { Modified: linux4palm/linux/branches/cleanup-branch-never-commit/drivers/mfd/samcop_base.c =================================================================== --- linux4palm/linux/branches/cleanup-branch-never-commit/drivers/mfd/samcop_base.c 2007-09-17 15:37:25 UTC (rev 1328) +++ linux4palm/linux/branches/cleanup-branch-never-commit/drivers/mfd/samcop_base.c 2007-09-17 19:41:58 UTC (rev 1329) @@ -54,9 +54,11 @@ #include <asm/hardware/ipaq-samcop.h> #include <linux/mfd/samcop_base.h> #include <asm/hardware/samcop-sdi.h> +#include <asm/hardware/samcop-fsi.h> #include <asm/hardware/samcop-dma.h> #include <asm/arch/pxa-dmabounce.h> #include "../mmc/samcop_sdi.h" +#include "../misc/samcop_fsi.h" #include <asm/arch/irq.h> #include <asm/arch/clock.h> @@ -581,7 +583,31 @@ set_irq_chained_handler(samcop->irq_nr, samcop_irq_demux); } + /************************************************************* + * SAMCOP FS interface hooks and initialization + *************************************************************/ + +static u32 samcop_fsi_read_register(struct device *dev, u32 reg) +{ + struct samcop_data *samcop = dev->parent->driver_data; + + return samcop_read_register(samcop, _SAMCOP_FSI_Base + reg); +} + +static void samcop_fsi_write_register(struct device *dev, u32 reg, u32 val) +{ + struct samcop_data *samcop = dev->parent->driver_data; + + samcop_write_register(samcop, _SAMCOP_FSI_Base + reg, val); +} + +static struct samcop_fsi_data samcop_fsi_data = { + .read_reg = samcop_fsi_read_register, + .write_reg = samcop_fsi_write_register, +}; + +/************************************************************* * SAMCOP SD interface hooks and initialization *************************************************************/ int samcop_dma_needs_bounce(struct device *dev, dma_addr_t addr, size_t size) @@ -1125,6 +1151,7 @@ .start = _SAMCOP_FSI_Base, .end = _SAMCOP_FSI_Base + 0x1f, .irq = _IRQ_SAMCOP_FCD, + .platform_data = &samcop_fsi_data, }, { .id = { -1 }, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |