summaryrefslogtreecommitdiff
path: root/sound/pci/hda/patch_cs8409.h
diff options
context:
space:
mode:
authorLucas Tanure <tanureal@opensource.cirrus.com>2021-08-11 21:56:40 +0300
committerTakashi Iwai <tiwai@suse.de>2021-08-12 14:41:48 +0300
commit647d50a0c30402d2156ca201a74d77d58c7ef5ff (patch)
tree5cae1d43034d42f9cb89358b32eb50f7fbdbbdd0 /sound/pci/hda/patch_cs8409.h
parentb2a887748e518b1c355e244ff847293a1bf39c64 (diff)
downloadlinux-647d50a0c30402d2156ca201a74d77d58c7ef5ff.tar.xz
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>
Diffstat (limited to 'sound/pci/hda/patch_cs8409.h')
-rw-r--r--sound/pci/hda/patch_cs8409.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/sound/pci/hda/patch_cs8409.h b/sound/pci/hda/patch_cs8409.h
index bf0e8a4cc4cc..542582c213d2 100644
--- a/sound/pci/hda/patch_cs8409.h
+++ b/sound/pci/hda/patch_cs8409.h
@@ -11,6 +11,7 @@
#include <linux/pci.h>
#include <sound/tlv.h>
+#include <linux/workqueue.h>
#include <sound/hda_codec.h>
#include "hda_local.h"
#include "hda_auto_parser.h"
@@ -267,6 +268,7 @@ struct cs8409_cir_param {
struct cs8409_spec {
struct hda_gen_spec gen;
+ struct hda_codec *codec;
unsigned int gpio_mask;
unsigned int gpio_dir;
@@ -278,6 +280,8 @@ struct cs8409_spec {
s8 vol[CS42L42_VOLUMES];
struct mutex cs8409_i2c_mux;
+ unsigned int i2c_clck_enabled;
+ struct delayed_work i2c_clk_work;
/* verb exec op override */
int (*exec_verb)(struct hdac_device *dev, unsigned int cmd, unsigned int flags,