local.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Local helper macros and functions for HD-audio core drivers
  4. */
  5. #ifndef __HDAC_LOCAL_H
  6. #define __HDAC_LOCAL_H
  7. #define get_wcaps(codec, nid) \
  8. snd_hdac_read_parm(codec, nid, AC_PAR_AUDIO_WIDGET_CAP)
  9. /* get the widget type from widget capability bits */
  10. static inline int get_wcaps_type(unsigned int wcaps)
  11. {
  12. if (!wcaps)
  13. return -1; /* invalid type */
  14. return (wcaps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
  15. }
  16. static inline unsigned int get_wcaps_channels(u32 wcaps)
  17. {
  18. unsigned int chans;
  19. chans = (wcaps & AC_WCAP_CHAN_CNT_EXT) >> 13;
  20. chans = (chans + 1) * 2;
  21. return chans;
  22. }
  23. extern const struct attribute_group *hdac_dev_attr_groups[];
  24. int hda_widget_sysfs_init(struct hdac_device *codec);
  25. int hda_widget_sysfs_reinit(struct hdac_device *codec, hda_nid_t start_nid,
  26. int num_nodes);
  27. void hda_widget_sysfs_exit(struct hdac_device *codec);
  28. int snd_hdac_bus_add_device(struct hdac_bus *bus, struct hdac_device *codec);
  29. void snd_hdac_bus_remove_device(struct hdac_bus *bus,
  30. struct hdac_device *codec);
  31. void snd_hdac_bus_queue_event(struct hdac_bus *bus, u32 res, u32 res_ex);
  32. int snd_hdac_bus_exec_verb(struct hdac_bus *bus, unsigned int addr,
  33. unsigned int cmd, unsigned int *res);
  34. int snd_hdac_exec_verb(struct hdac_device *codec, unsigned int cmd,
  35. unsigned int flags, unsigned int *res);
  36. #endif /* __HDAC_LOCAL_H */