git://git.onelab.eu
/
linux-2.6.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git]
/
drivers
/
i2c
/
chips
/
tps65010.c
diff --git
a/drivers/i2c/chips/tps65010.c
b/drivers/i2c/chips/tps65010.c
index
179b1e0
..
4ee56de
100644
(file)
--- a/
drivers/i2c/chips/tps65010.c
+++ b/
drivers/i2c/chips/tps65010.c
@@
-19,7
+19,6
@@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
@@
-44,13
+43,12
@@
/*-------------------------------------------------------------------------*/
#define DRIVER_VERSION "2 May 2005"
/*-------------------------------------------------------------------------*/
#define DRIVER_VERSION "2 May 2005"
-#define DRIVER_NAME (tps65010_driver.name)
+#define DRIVER_NAME (tps65010_driver.
driver.
name)
MODULE_DESCRIPTION("TPS6501x Power Management Driver");
MODULE_LICENSE("GPL");
static unsigned short normal_i2c[] = { 0x48, /* 0x49, */ I2C_CLIENT_END };
MODULE_DESCRIPTION("TPS6501x Power Management Driver");
MODULE_LICENSE("GPL");
static unsigned short normal_i2c[] = { 0x48, /* 0x49, */ I2C_CLIENT_END };
-static unsigned short normal_i2c_range[] = { I2C_CLIENT_END };
I2C_CLIENT_INSMOD;
I2C_CLIENT_INSMOD;
@@
-84,7
+82,7
@@
struct tps65010 {
struct i2c_client client;
struct mutex lock;
int irq;
struct i2c_client client;
struct mutex lock;
int irq;
- struct
work_struct
work;
+ struct
delayed_work
work;
struct dentry *file;
unsigned charging:1;
unsigned por:1;
struct dentry *file;
unsigned charging:1;
unsigned por:1;
@@
-101,7
+99,7
@@
struct tps65010 {
/* not currently tracking GPIO state */
};
/* not currently tracking GPIO state */
};
-#define POWER_POLL_DELAY msecs_to_jiffies(
8
00)
+#define POWER_POLL_DELAY msecs_to_jiffies(
50
00)
/*-------------------------------------------------------------------------*/
/*-------------------------------------------------------------------------*/
@@
-307,7
+305,7
@@
static int dbg_show(struct seq_file *s, void *_)
static int dbg_tps_open(struct inode *inode, struct file *file)
{
static int dbg_tps_open(struct inode *inode, struct file *file)
{
- return single_open(file, dbg_show, inode->
u.generic_ip
);
+ return single_open(file, dbg_show, inode->
i_private
);
}
static struct file_operations debug_fops = {
}
static struct file_operations debug_fops = {
@@
-330,7
+328,7
@@
static void tps65010_interrupt(struct tps65010 *tps)
{
u8 tmp = 0, mask, poll;
{
u8 tmp = 0, mask, poll;
- /* IRQs won't trigger
irqs
for certain events, but we can get
+ /* IRQs won't trigger for certain events, but we can get
* others by polling (normally, with external power applied).
*/
poll = 0;
* others by polling (normally, with external power applied).
*/
poll = 0;
@@
-413,10
+411,11
@@
static void tps65010_interrupt(struct tps65010 *tps)
}
/* handle IRQs and polling using keventd for now */
}
/* handle IRQs and polling using keventd for now */
-static void tps65010_work(
void *_tps
)
+static void tps65010_work(
struct work_struct *work
)
{
{
- struct tps65010 *tps
= _tps
;
+ struct tps65010 *tps;
+ tps = container_of(work, struct tps65010, work.work);
mutex_lock(&tps->lock);
tps65010_interrupt(tps);
mutex_lock(&tps->lock);
tps65010_interrupt(tps);
@@
-448,13
+447,13
@@
static void tps65010_work(void *_tps)
mutex_unlock(&tps->lock);
}
mutex_unlock(&tps->lock);
}
-static irqreturn_t tps65010_irq(int irq, void *_tps
, struct pt_regs *regs
)
+static irqreturn_t tps65010_irq(int irq, void *_tps)
{
struct tps65010 *tps = _tps;
disable_irq_nosync(irq);
set_bit(FLAG_IRQ_ENABLE, &tps->flags);
{
struct tps65010 *tps = _tps;
disable_irq_nosync(irq);
set_bit(FLAG_IRQ_ENABLE, &tps->flags);
- (void) schedule_work(&tps->work);
+ (void) schedule_work(&tps->work
.work
);
return IRQ_HANDLED;
}
return IRQ_HANDLED;
}
@@
-467,13
+466,15
@@
static int __exit tps65010_detach_client(struct i2c_client *client)
struct tps65010 *tps;
tps = container_of(client, struct tps65010, client);
struct tps65010 *tps;
tps = container_of(client, struct tps65010, client);
+ free_irq(tps->irq, tps);
#ifdef CONFIG_ARM
if (machine_is_omap_h2())
omap_free_gpio(58);
if (machine_is_omap_osk())
omap_free_gpio(OMAP_MPUIO(1));
#endif
#ifdef CONFIG_ARM
if (machine_is_omap_h2())
omap_free_gpio(58);
if (machine_is_omap_osk())
omap_free_gpio(OMAP_MPUIO(1));
#endif
- free_irq(tps->irq, tps);
+ cancel_delayed_work(&tps->work);
+ flush_scheduled_work();
debugfs_remove(tps->file);
if (i2c_detach_client(client) == 0)
kfree(tps);
debugfs_remove(tps->file);
if (i2c_detach_client(client) == 0)
kfree(tps);
@@
-507,7
+508,7
@@
tps65010_probe(struct i2c_adapter *bus, int address, int kind)
return 0;
mutex_init(&tps->lock);
return 0;
mutex_init(&tps->lock);
- INIT_
WORK(&tps->work, tps65010_work, tps
);
+ INIT_
DELAYED_WORK(&tps->work, tps65010_work
);
tps->irq = -1;
tps->client.addr = address;
tps->client.adapter = bus;
tps->irq = -1;
tps->client.addr = address;
tps->client.adapter = bus;
@@
-521,15
+522,18
@@
tps65010_probe(struct i2c_adapter *bus, int address, int kind)
goto fail1;
}
goto fail1;
}
+ /* the IRQ is active low, but many gpio lines can't support that
+ * so this driver can use falling-edge triggers instead.
+ */
+ irqflags = IRQF_SAMPLE_RANDOM;
#ifdef CONFIG_ARM
#ifdef CONFIG_ARM
- irqflags = SA_SAMPLE_RANDOM | SA_TRIGGER_LOW;
if (machine_is_omap_h2()) {
tps->model = TPS65010;
omap_cfg_reg(W4_GPIO58);
tps->irq = OMAP_GPIO_IRQ(58);
omap_request_gpio(58);
omap_set_gpio_direction(58, 1);
if (machine_is_omap_h2()) {
tps->model = TPS65010;
omap_cfg_reg(W4_GPIO58);
tps->irq = OMAP_GPIO_IRQ(58);
omap_request_gpio(58);
omap_set_gpio_direction(58, 1);
- irqflags |=
SA
_TRIGGER_FALLING;
+ irqflags |=
IRQF
_TRIGGER_FALLING;
}
if (machine_is_omap_osk()) {
tps->model = TPS65010;
}
if (machine_is_omap_osk()) {
tps->model = TPS65010;
@@
-537,15
+541,13
@@
tps65010_probe(struct i2c_adapter *bus, int address, int kind)
tps->irq = OMAP_GPIO_IRQ(OMAP_MPUIO(1));
omap_request_gpio(OMAP_MPUIO(1));
omap_set_gpio_direction(OMAP_MPUIO(1), 1);
tps->irq = OMAP_GPIO_IRQ(OMAP_MPUIO(1));
omap_request_gpio(OMAP_MPUIO(1));
omap_set_gpio_direction(OMAP_MPUIO(1), 1);
- irqflags |=
SA
_TRIGGER_FALLING;
+ irqflags |=
IRQF
_TRIGGER_FALLING;
}
if (machine_is_omap_h3()) {
tps->model = TPS65013;
// FIXME set up this board's IRQ ...
}
}
if (machine_is_omap_h3()) {
tps->model = TPS65013;
// FIXME set up this board's IRQ ...
}
-#else
- irqflags = SA_SAMPLE_RANDOM;
#endif
if (tps->irq > 0) {
#endif
if (tps->irq > 0) {
@@
-621,7
+623,7
@@
tps65010_probe(struct i2c_adapter *bus, int address, int kind)
(void) i2c_smbus_write_byte_data(&tps->client, TPS_MASK3, 0x0f
| i2c_smbus_read_byte_data(&tps->client, TPS_MASK3));
(void) i2c_smbus_write_byte_data(&tps->client, TPS_MASK3, 0x0f
| i2c_smbus_read_byte_data(&tps->client, TPS_MASK3));
- tps65010_work(
tps
);
+ tps65010_work(
&tps->work.work
);
tps->file = debugfs_create_file(DRIVER_NAME, S_IRUGO, NULL,
tps, DEBUG_FOPS);
tps->file = debugfs_create_file(DRIVER_NAME, S_IRUGO, NULL,
tps, DEBUG_FOPS);
@@
-673,7
+675,7
@@
int tps65010_set_vbus_draw(unsigned mA)
&& test_and_set_bit(
FLAG_VBUS_CHANGED, &the_tps->flags)) {
/* gadget drivers call this in_irq() */
&& test_and_set_bit(
FLAG_VBUS_CHANGED, &the_tps->flags)) {
/* gadget drivers call this in_irq() */
- (void) schedule_work(&the_tps->work);
+ (void) schedule_work(&the_tps->work
.work
);
}
local_irq_restore(flags);
}
local_irq_restore(flags);