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

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

 



On 30.09.2023 00:57, Andi Shyti wrote:
>> @@ -178,6 +179,7 @@ struct exynos5_i2c {
>>   	unsigned int		msg_ptr;
>>   
>>   	unsigned int		irq;
>> +	unsigned int		polled;
> Is this supposed to be called polling?

Yea, a bit better name.

>>   	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?

Values similar to wait_for_completion_timeout(); 0 means timeout and 
non-zero that the waiting condition has been reached, please check how 
it is used in exynos5_i2c_xfer_msg(). Maybe the function should be named 
a bit different, but I had no good idea so far.

Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland




[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