^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) * Local helper macros and functions for HD-audio core drivers
^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 __HDAC_LOCAL_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #define __HDAC_LOCAL_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #define get_wcaps(codec, nid) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) snd_hdac_read_parm(codec, nid, AC_PAR_AUDIO_WIDGET_CAP)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) /* get the widget type from widget capability bits */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) static inline int get_wcaps_type(unsigned int wcaps)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) if (!wcaps)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) return -1; /* invalid type */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) return (wcaps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) static inline unsigned int get_wcaps_channels(u32 wcaps)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) unsigned int chans;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) chans = (wcaps & AC_WCAP_CHAN_CNT_EXT) >> 13;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) chans = (chans + 1) * 2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) return chans;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) extern const struct attribute_group *hdac_dev_attr_groups[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) int hda_widget_sysfs_init(struct hdac_device *codec);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) int hda_widget_sysfs_reinit(struct hdac_device *codec, hda_nid_t start_nid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) int num_nodes);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) void hda_widget_sysfs_exit(struct hdac_device *codec);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) int snd_hdac_bus_add_device(struct hdac_bus *bus, struct hdac_device *codec);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) void snd_hdac_bus_remove_device(struct hdac_bus *bus,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) struct hdac_device *codec);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) void snd_hdac_bus_queue_event(struct hdac_bus *bus, u32 res, u32 res_ex);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) int snd_hdac_bus_exec_verb(struct hdac_bus *bus, unsigned int addr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) unsigned int cmd, unsigned int *res);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) int snd_hdac_exec_verb(struct hdac_device *codec, unsigned int cmd,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) unsigned int flags, unsigned int *res);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) #endif /* __HDAC_LOCAL_H */