Skip to content

Commit 7031307

Browse files
myungjooBen Dooks
authored andcommitted
i2c-s3c2410: fix calculation of SDA line delay
S3C2440 style I2C controller uses PCLK to calculate the SDA line delay. The driver wrongly assumed that this delay is calculated from the frequency that the controller is operating on. This patch fixes this issue. Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Ben Dooks <ben-linux@fluff.org>
1 parent 4bba0fd commit 7031307

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/i2c/busses/i2c-s3c2410.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -662,8 +662,8 @@ static int s3c24xx_i2c_clockrate(struct s3c24xx_i2c *i2c, unsigned int *got)
662662
unsigned long sda_delay;
663663

664664
if (pdata->sda_delay) {
665-
sda_delay = (freq / 1000) * pdata->sda_delay;
666-
sda_delay /= 1000000;
665+
sda_delay = clkin * pdata->sda_delay;
666+
sda_delay = DIV_ROUND_UP(sda_delay, 1000000);
667667
sda_delay = DIV_ROUND_UP(sda_delay, 5);
668668
if (sda_delay > 3)
669669
sda_delay = 3;

0 commit comments

Comments
 (0)