Re: [PATCH 1/3] mfd: twl6040: Select i2c fast mode as default with regmap patch

From: Nishanth Menon
Date: Thu Feb 27 2014 - 10:01:04 EST


On 02/27/2014 08:33 AM, Peter Ujfalusi wrote:
> On 02/27/2014 04:24 PM, Nishanth Menon wrote:
>>
>> we should ideally have been using highspeed for i2c bus.
>>
>> is'nt it better if i2c_check_functionality (and adding required flags
>> for func) be used to check the adapter speed and decide this in the
>> driver instead of hardcoding the bus speed within TWL6040 -
>> considering that 6040 can infact do max high speed as well?
>
> Yeah, I was thinking of something similar. Just did not found the API to get
> the speed the i2c bus has been configured to.
> I'll check this.

The other option might be to blindly configure 6040 to max speed ->
but then you do have an issue with that single register write
operation to configure the speed?

TWL6040 is by default at 100KHz, bus_speed is configured (via dts or
otherwise) is 400KHz/3.4MHz, the register write for configuring 6040
to max speed will occur at 400KHz/3.4MHz, which implies 6040 register
write operation might not actually take place (as 6040 still expects
to talk 100KHz till the mentioned register write takes place).

Ideally, the behavior you need is as follows:
talk at 100KHz for the first register write(of configuring speed),
followed by 400KHz/3.4 MHz for the subsequent operations on the bus
(assuming 400KHz/3.4 is the least common denominator speed on the bus).

I am not sure if the i2c framework has ability to do that.


--
Regards,
Nishanth Menon
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/