Re: [PATCH] i2c: exynos5: add support for atomic transfers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Marek,

> @@ -178,6 +179,7 @@ struct exynos5_i2c {
>  	unsigned int		msg_ptr;
>  
>  	unsigned int		irq;
> +	unsigned int		polled;

Is this supposed to be called polling?

>  	void __iomem		*regs;
>  	struct clk		*clk;		/* operating clock */
> @@ -711,6 +713,24 @@ static void exynos5_i2c_message_start(struct exynos5_i2c *i2c, int stop)
>  	spin_unlock_irqrestore(&i2c->lock, flags);
>  }
>  
> +static unsigned long exynos5_i2c_polled_irqs_timeout(struct exynos5_i2c *i2c,
> +						     unsigned long timeout_ms)
> +{
> +	ktime_t start, now;
> +
> +	start = now = ktime_get();
> +	while (ktime_ms_delta(now, start) < timeout_ms &&
> +	       !((i2c->trans_done && (i2c->msg->len == i2c->msg_ptr)) ||
> +	         (i2c->state < 0))) {
> +		while (readl(i2c->regs + HSI2C_INT_ENABLE) &
> +		       readl(i2c->regs + HSI2C_INT_STATUS))
> +			exynos5_i2c_irq(i2c->irq, i2c);
> +		usleep_range(100, 200);
> +		now = ktime_get();
> +	}
> +	return ktime_ms_delta(now, start) < timeout_ms;

what are you returning here?

Andi



[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux