^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * HD-audio regmap helpers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) #ifndef __SOUND_HDA_REGMAP_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #define __SOUND_HDA_REGMAP_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include <linux/regmap.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <sound/core.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <sound/hdaudio.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #define AC_AMP_FAKE_MUTE 0x10 /* fake mute bit set to amp verbs */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) int snd_hdac_regmap_init(struct hdac_device *codec);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) void snd_hdac_regmap_exit(struct hdac_device *codec);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) int snd_hdac_regmap_add_vendor_verb(struct hdac_device *codec,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) unsigned int verb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) int snd_hdac_regmap_read_raw(struct hdac_device *codec, unsigned int reg,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) unsigned int *val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) int snd_hdac_regmap_read_raw_uncached(struct hdac_device *codec,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) unsigned int reg, unsigned int *val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) int snd_hdac_regmap_write_raw(struct hdac_device *codec, unsigned int reg,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) unsigned int val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) int snd_hdac_regmap_update_raw(struct hdac_device *codec, unsigned int reg,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) unsigned int mask, unsigned int val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) int snd_hdac_regmap_update_raw_once(struct hdac_device *codec, unsigned int reg,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) unsigned int mask, unsigned int val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) void snd_hdac_regmap_sync(struct hdac_device *codec);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) * snd_hdac_regmap_encode_verb - encode the verb to a pseudo register
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) * @nid: widget NID
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) * @verb: codec verb
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) * Returns an encoded pseudo register.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) #define snd_hdac_regmap_encode_verb(nid, verb) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) (((verb) << 8) | 0x80000 | ((unsigned int)(nid) << 20))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) * snd_hdac_regmap_encode_amp - encode the AMP verb to a pseudo register
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) * @nid: widget NID
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) * @ch: channel (left = 0, right = 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) * @dir: direction (#HDA_INPUT, #HDA_OUTPUT)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) * @idx: input index value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) * Returns an encoded pseudo register.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) #define snd_hdac_regmap_encode_amp(nid, ch, dir, idx) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) (snd_hdac_regmap_encode_verb(nid, AC_VERB_GET_AMP_GAIN_MUTE) | \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) ((ch) ? AC_AMP_GET_RIGHT : AC_AMP_GET_LEFT) | \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) ((dir) == HDA_OUTPUT ? AC_AMP_GET_OUTPUT : AC_AMP_GET_INPUT) | \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) (idx))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) * snd_hdac_regmap_encode_amp_stereo - encode a pseudo register for stereo AMPs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) * @nid: widget NID
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) * @dir: direction (#HDA_INPUT, #HDA_OUTPUT)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) * @idx: input index value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) * Returns an encoded pseudo register.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) #define snd_hdac_regmap_encode_amp_stereo(nid, dir, idx) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) (snd_hdac_regmap_encode_verb(nid, AC_VERB_GET_AMP_GAIN_MUTE) | \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) AC_AMP_SET_LEFT | AC_AMP_SET_RIGHT | /* both bits set! */ \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) ((dir) == HDA_OUTPUT ? AC_AMP_GET_OUTPUT : AC_AMP_GET_INPUT) | \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) (idx))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) * snd_hdac_regmap_write - Write a verb with caching
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) * @nid: codec NID
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) * @reg: verb to write
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) * @val: value to write
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) * For writing an amp value, use snd_hdac_regmap_update_amp().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) static inline int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) snd_hdac_regmap_write(struct hdac_device *codec, hda_nid_t nid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) unsigned int verb, unsigned int val)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) unsigned int cmd = snd_hdac_regmap_encode_verb(nid, verb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) return snd_hdac_regmap_write_raw(codec, cmd, val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) * snd_hda_regmap_update - Update a verb value with caching
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) * @nid: codec NID
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) * @verb: verb to update
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) * @mask: bit mask to update
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) * @val: value to update
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) * For updating an amp value, use snd_hdac_regmap_update_amp().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) static inline int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) snd_hdac_regmap_update(struct hdac_device *codec, hda_nid_t nid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) unsigned int verb, unsigned int mask,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) unsigned int val)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) unsigned int cmd = snd_hdac_regmap_encode_verb(nid, verb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) return snd_hdac_regmap_update_raw(codec, cmd, mask, val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) * snd_hda_regmap_read - Read a verb with caching
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) * @nid: codec NID
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) * @verb: verb to read
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) * @val: pointer to store the value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) * For reading an amp value, use snd_hda_regmap_get_amp().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) static inline int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) snd_hdac_regmap_read(struct hdac_device *codec, hda_nid_t nid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) unsigned int verb, unsigned int *val)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) unsigned int cmd = snd_hdac_regmap_encode_verb(nid, verb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) return snd_hdac_regmap_read_raw(codec, cmd, val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) * snd_hdac_regmap_get_amp - Read AMP value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) * @codec: HD-audio codec
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) * @nid: NID to read the AMP value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) * @ch: channel (left=0 or right=1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) * @direction: #HDA_INPUT or #HDA_OUTPUT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) * @index: the index value (only for input direction)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) * @val: the pointer to store the value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) * Read AMP value. The volume is between 0 to 0x7f, 0x80 = mute bit.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) * Returns the value or a negative error.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) static inline int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) snd_hdac_regmap_get_amp(struct hdac_device *codec, hda_nid_t nid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) int ch, int dir, int idx)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) unsigned int cmd = snd_hdac_regmap_encode_amp(nid, ch, dir, idx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) int err, val;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) err = snd_hdac_regmap_read_raw(codec, cmd, &val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) return err < 0 ? err : val;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) * snd_hdac_regmap_update_amp - update the AMP value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) * @codec: HD-audio codec
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) * @nid: NID to read the AMP value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) * @ch: channel (left=0 or right=1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) * @direction: #HDA_INPUT or #HDA_OUTPUT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) * @idx: the index value (only for input direction)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) * @mask: bit mask to set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) * @val: the bits value to set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) * Update the AMP value with a bit mask.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) * Returns 0 if the value is unchanged, 1 if changed, or a negative error.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) static inline int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) snd_hdac_regmap_update_amp(struct hdac_device *codec, hda_nid_t nid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) int ch, int dir, int idx, int mask, int val)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) unsigned int cmd = snd_hdac_regmap_encode_amp(nid, ch, dir, idx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) return snd_hdac_regmap_update_raw(codec, cmd, mask, val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) * snd_hdac_regmap_get_amp_stereo - Read stereo AMP values
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) * @codec: HD-audio codec
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) * @nid: NID to read the AMP value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) * @ch: channel (left=0 or right=1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) * @direction: #HDA_INPUT or #HDA_OUTPUT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) * @index: the index value (only for input direction)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) * @val: the pointer to store the value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) * Read stereo AMP values. The lower byte is left, the upper byte is right.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) * Returns the value or a negative error.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) static inline int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) snd_hdac_regmap_get_amp_stereo(struct hdac_device *codec, hda_nid_t nid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) int dir, int idx)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) unsigned int cmd = snd_hdac_regmap_encode_amp_stereo(nid, dir, idx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) int err, val;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) err = snd_hdac_regmap_read_raw(codec, cmd, &val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) return err < 0 ? err : val;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) * snd_hdac_regmap_update_amp_stereo - update the stereo AMP value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) * @codec: HD-audio codec
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) * @nid: NID to read the AMP value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) * @direction: #HDA_INPUT or #HDA_OUTPUT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) * @idx: the index value (only for input direction)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) * @mask: bit mask to set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) * @val: the bits value to set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) * Update the stereo AMP value with a bit mask.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) * The lower byte is left, the upper byte is right.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) * Returns 0 if the value is unchanged, 1 if changed, or a negative error.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) static inline int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) snd_hdac_regmap_update_amp_stereo(struct hdac_device *codec, hda_nid_t nid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) int dir, int idx, int mask, int val)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) unsigned int cmd = snd_hdac_regmap_encode_amp_stereo(nid, dir, idx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) return snd_hdac_regmap_update_raw(codec, cmd, mask, val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) * snd_hdac_regmap_sync_node - sync the widget node attributes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) * @codec: HD-audio codec
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) * @nid: NID to sync
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) static inline void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) snd_hdac_regmap_sync_node(struct hdac_device *codec, hda_nid_t nid)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) regcache_mark_dirty(codec->regmap);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) regcache_sync_region(codec->regmap, nid << 20, ((nid + 1) << 20) - 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) #endif /* __SOUND_HDA_REGMAP_H */