local.h 830 B

1234567891011121314151617181920212223242526272829303132333435
  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. void hda_widget_sysfs_exit(struct hdac_device *codec);
  26. #endif /* __HDAC_LOCAL_H */