@@ -56,6 +56,7 @@ enum s3c24xx_i2c_state {
5656struct s3c24xx_i2c {
5757 spinlock_t lock ;
5858 wait_queue_head_t wait ;
59+ unsigned int suspended :1 ;
5960
6061 struct i2c_msg * msg ;
6162 unsigned int msg_num ;
@@ -507,7 +508,7 @@ static int s3c24xx_i2c_doxfer(struct s3c24xx_i2c *i2c, struct i2c_msg *msgs, int
507508 unsigned long timeout ;
508509 int ret ;
509510
510- if (!( readl ( i2c -> regs + S3C2410_IICCON ) & S3C2410_IICCON_IRQEN ) )
511+ if (i2c -> suspended )
511512 return - EIO ;
512513
513514 ret = s3c24xx_i2c_set_master (i2c );
@@ -986,17 +987,26 @@ static int s3c24xx_i2c_remove(struct platform_device *pdev)
986987}
987988
988989#ifdef CONFIG_PM
990+ static int s3c24xx_i2c_suspend_late (struct platform_device * dev ,
991+ pm_message_t msg )
992+ {
993+ struct s3c24xx_i2c * i2c = platform_get_drvdata (dev );
994+ i2c -> suspended = 1 ;
995+ return 0 ;
996+ }
997+
989998static int s3c24xx_i2c_resume (struct platform_device * dev )
990999{
9911000 struct s3c24xx_i2c * i2c = platform_get_drvdata (dev );
9921001
993- if ( i2c != NULL )
994- s3c24xx_i2c_init (i2c );
1002+ i2c -> suspended = 0 ;
1003+ s3c24xx_i2c_init (i2c );
9951004
9961005 return 0 ;
9971006}
9981007
9991008#else
1009+ #define s3c24xx_i2c_suspend_late NULL
10001010#define s3c24xx_i2c_resume NULL
10011011#endif
10021012
@@ -1005,6 +1015,7 @@ static int s3c24xx_i2c_resume(struct platform_device *dev)
10051015static struct platform_driver s3c2410_i2c_driver = {
10061016 .probe = s3c24xx_i2c_probe ,
10071017 .remove = s3c24xx_i2c_remove ,
1018+ .suspend_late = s3c24xx_i2c_suspend_late ,
10081019 .resume = s3c24xx_i2c_resume ,
10091020 .driver = {
10101021 .owner = THIS_MODULE ,
@@ -1015,6 +1026,7 @@ static struct platform_driver s3c2410_i2c_driver = {
10151026static struct platform_driver s3c2440_i2c_driver = {
10161027 .probe = s3c24xx_i2c_probe ,
10171028 .remove = s3c24xx_i2c_remove ,
1029+ .suspend_late = s3c24xx_i2c_suspend_late ,
10181030 .resume = s3c24xx_i2c_resume ,
10191031 .driver = {
10201032 .owner = THIS_MODULE ,
0 commit comments