Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1266125
| From | Daniel Kurtz <djkurtz@chromium.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v2 1/2] i2c: mediatek: add i2c first write then read optimization |
| Date | 2015-11-10 01:40 +0100 |
| Message-ID | <qt58B-68l-9@gated-at.bofh.it> (permalink) |
| References | <qsNv4-2fT-17@gated-at.bofh.it> <qsNv4-2fT-21@gated-at.bofh.it> <qsVCi-7yE-9@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Mon, Nov 9, 2015 at 10:25 PM, Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
> On Mon, Nov 9, 2015 at 7:43 AM, Liguo Zhang <liguo.zhang@mediatek.com> wrote:
>> For platform with auto restart support, between every transfer,
>> i2c controller will trigger an interrupt and SW need to handle
>> it to start new transfer. When doing write-then-read transfer,
>> instead of restart mechanism, using WRRD mode to have controller
>> send both transfer in one request to reduce latency.
>
>
>> @@ -518,6 +529,16 @@ static int mtk_i2c_transfer(struct i2c_adapter *adap,
>> if (ret)
>> return ret;
>>
>> + i2c->auto_restart = i2c->dev_comp->auto_restart;
>> +
>> + /* checking if we can skip restart and optimize using WRRD mode */
>> + if (i2c->auto_restart && num == 2) {
>> + if (!(msgs[0].flags & I2C_M_RD) && (msgs[1].flags & I2C_M_RD) &&
>> + msgs[0].addr == msgs[1].addr) {
>
> Nitpick (optional):
>
> ((msgs[0].flags & msgs[1].flags) & I2C_M_RD)
> ?
IMHO, this makes the code less readable.
Leave this to the compiler's optimizer.
-Dan
>
>> + i2c->auto_restart = 0;
>> + }
>> + }
>
> --
> With Best Regards,
> Andy Shevchenko
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v2 0/2] Mediatek I2C Fixup Liguo Zhang <liguo.zhang@mediatek.com> - 2015-11-09 06:50 +0100
[PATCH v2 1/2] i2c: mediatek: add i2c first write then read optimization Liguo Zhang <liguo.zhang@mediatek.com> - 2015-11-09 06:50 +0100
Re: [PATCH v2 1/2] i2c: mediatek: add i2c first write then read optimization Andy Shevchenko <andy.shevchenko@gmail.com> - 2015-11-09 15:30 +0100
Re: [PATCH v2 1/2] i2c: mediatek: add i2c first write then read optimization Daniel Kurtz <djkurtz@chromium.org> - 2015-11-10 01:40 +0100
Re: [PATCH v2 1/2] i2c: mediatek: add i2c first write then read optimization Yingjoe Chen <yingjoe.chen@mediatek.com> - 2015-11-10 02:00 +0100
csiph-web