i2c-s3c2410: fix check for being in suspend.
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
Hi Ben,
Moving to the i2c list...
Quoted 23 lines · Ben Dooks
As noted by Julia Lawall <[email protected]>, we can never trigger the check for being in suspend due to the result
of !readl(i2c->regs +S3C2410_IICCON) &S3C2410_IICCON_IRQENalways being 0.Add suspend/resume hooks to stop i2c transactions happening until the driver has been resumed.
Signed-off-by Ben Dooks <[email protected]>Index:
linux.git/drivers/i2c/busses/i2c-s3c2410.c
===================================================================drivers/i2c/busses/i2c-s3c2410.c +1
-0@@ -56,6 +56,7 @@ enum s3c24xx_i2c_state {struct s3c24xx_i2c {spinlock_t lock;wait_queue_head_t wait; +unsigned int suspended:1 ;struct i2c_msg *msg;unsigned int msg_num;
drivers/i2c/busses/i2c-s3c2410.c static int s3c24xx_i2c_doxfer(struct s3c · line 514
Quoted 8 lines
drivers/i2c/busses/i2c-s3c2410.c +1
-1@@ -507,7 +508,7 @@ static int s3c24xx_i2c_doxfer(struct s3cunsigned long timeout;int ret; -if (!readl (i2c->regs +S3C2410_IICCON ) &S3C2410_IICCON_IRQEN ) +if (i2c->suspended)return -EIO ; ret =s3c24xx_i2c_set_master (i2c);
This hunk will not apply, ad Julia's fix is already upstream. You'll have to update your patch a bit.
Quoted 39 lines
drivers/i2c/busses/i2c-s3c2410.c +12
-2@@ -986,17 +987,26 @@ static int s3c24xx_i2c_remove(struct pla }#ifdef CONFIG_PM +static int s3c24xx_i2c_suspend_late (struct platform_device *dev, +pm_message_t msg) +{ +struct s3c24xx_i2c *i2c =platform_get_drvdata (dev); + i2c->suspended =1 ; +return 0 ; +} +static int s3c24xx_i2c_resume (struct platform_device *dev) {struct s3c24xx_i2c *i2c =platform_get_drvdata (dev); -if (i2c !=NULL ) -s3c24xx_i2c_init (i2c); + i2c->suspended =0 ; +s3c24xx_i2c_init (i2c);return 0 ; }#else +#define s3c24xx_i2c_suspend_late NULL#define s3c24xx_i2c_resume NULL#endif @@ -1005,6 +1015,7 @@ static int s3c24xx_i2c_resume(struct plastatic struct platform_driver s3c2410_i2c_driver = { .probe = s3c24xx_i2c_probe, .remove = s3c24xx_i2c_remove, + .suspend_late = s3c24xx_i2c_suspend_late, .resume = s3c24xx_i2c_resume, .driver = { .owner =THIS_MODULE ,
drivers/i2c/busses/i2c-s3c2410.c static struct platform_driver s3c2410_i2 · line 1032
Quoted 7 lines
drivers/i2c/busses/i2c-s3c2410.c +1
-0@@ -1015,6 +1026,7 @@ static struct platform_driver s3c2410_i2static struct platform_driver s3c2440_i2c_driver = { .probe = s3c24xx_i2c_probe, .remove = s3c24xx_i2c_remove, + .suspend_late = s3c24xx_i2c_suspend_late, .resume = s3c24xx_i2c_resume, .driver = { .owner =THIS_MODULE ,
Will you take care of pushing this upstream, or should I?
Thanks,
Signature · 1 line
Jean Delvare