Re: [PATCH 1/8] usb: typec: fusb302: Make fusb302_set_cc_polarity also set pull ups / downs

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

 



On Fri, Feb 22, 2019 at 03:11:58PM +0100, Hans de Goede wrote:
> The 2 callers of fusb302_set_cc_polarity both call fusb302_set_cc_pull
> directly before calling fusb302_set_cc_polarity, this is not ideal for
> 2 reasons:
> 
> 1) fusb302_set_cc_pull uses the cached polarity when applying pull-ups,
> which maybe changed immediately afterwards, to fix this set_cc_polarity
> already does the pull-up setting.
> 
> 2) Both touch the SWITCHES0 register in a r-w-modify cycle, this leads to
> read reg, write reg, read reg, write reg. If we fold the setting of
> the pull-downs into fusb302_set_cc_polarity then not only can we avoid
> doing the reads / writes twice, at this point we set all bits, so we
> can skip the read, turning 4 (slowish) i2c-transfers into 1.
> 
> Doing this also avoids the need to cache the pull_up state in
> struct fusb302_chip.
> 
> Signed-off-by: Hans de Goede <hdegoede@xxxxxxxxxx>
> ---
>  drivers/usb/typec/tcpm/fusb302.c | 48 +++++++++++---------------------
>  1 file changed, 16 insertions(+), 32 deletions(-)

It would be nice to get some people to review/ack this series before I
take it (hint...)

thanks,

greg k-h



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux