Re: [PATCH 06/13] media: i2c: ds90ub960: Add support for I2C_RX_ID
From: Andy Shevchenko
Date: Thu Oct 10 2024 - 10:00:03 EST
On Fri, Oct 04, 2024 at 05:46:37PM +0300, Tomi Valkeinen wrote:
> Normally the driver accesses both the RX and the TX port registers via a
> paging mechanism: one register is used to select the page (i.e. the
> port), which dictates the port used when accessing the port specific
> registers.
>
> The downside to this is that while debugging it's almost impossible to
> access the port specific registers from the userspace, as the driver can
> change the page at any moment.
>
> The hardware supports another access mechanism: using the I2C_RX_ID
> registers (one for each RX port), i2c addresses can be chosen which,
> when accessed, will always use the specific port's registers, skipping
> the paging mechanism.
>
> The support is only for the RX port, but it has proven very handy while
> debugging and testing. So let's add the code for this, but hide it
> behind a disabled define.
...
> + for (unsigned int i = 0; i < 4; ++i)
Why pre-increment?
> + ub960_write(priv, UB960_SR_I2C_RX_ID(i),
> + (UB960_DEBUG_I2C_RX_ID + i) << 1);
--
With Best Regards,
Andy Shevchenko