OSDN Git Service

ALSA: hda/cs8409: Dont disable I2C clock between consecutive accesses
authorLucas Tanure <tanureal@opensource.cirrus.com>
Wed, 11 Aug 2021 18:56:40 +0000 (19:56 +0100)
committerTakashi Iwai <tiwai@suse.de>
Thu, 12 Aug 2021 11:41:48 +0000 (13:41 +0200)
commit647d50a0c30402d2156ca201a74d77d58c7ef5ff
tree5cae1d43034d42f9cb89358b32eb50f7fbdbbdd0
parentb2a887748e518b1c355e244ff847293a1bf39c64
ALSA: hda/cs8409: Dont disable I2C clock between consecutive accesses

Only disable I2C clock 25 ms after not being used.

The current implementation enables and disables the I2C clock for each
I2C transaction. Each enable/disable call requires two verb transactions.
This means each I2C transaction requires a total of four verb transactions
to enable and disable the clock.
However, if there are multiple consecutive I2C transactions, it is not
necessary to enable and disable the clock each time, instead it is more
efficient to enable the clock for the first transaction, and disable it
after the final transaction, which would improve performance.
This is achieved by using a timeout which disables the clock if no request
to enable the clock has occurred for 25 ms.

Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com>
Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20210811185654.6837-14-vitalyr@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/hda/patch_cs8409.c
sound/pci/hda/patch_cs8409.h