|
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.
|