local.h 961 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. */
  3. #ifndef __HDAC_LOCAL_H
  4. #define __HDAC_LOCAL_H
  5. int hdac_read_parm(struct hdac_device *codec, hda_nid_t nid, int parm);
  6. #define get_wcaps(codec, nid) \
  7. hdac_read_parm(codec, nid, AC_PAR_AUDIO_WIDGET_CAP)
  8. /* get the widget type from widget capability bits */
  9. static inline int get_wcaps_type(unsigned int wcaps)
  10. {
  11. if (!wcaps)
  12. return -1; /* invalid type */
  13. return (wcaps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
  14. }
  15. #define get_pin_caps(codec, nid) \
  16. hdac_read_parm(codec, nid, AC_PAR_PIN_CAP)
  17. static inline
  18. unsigned int get_pin_cfg(struct hdac_device *codec, hda_nid_t nid)
  19. {
  20. unsigned int val;
  21. if (snd_hdac_read(codec, nid, AC_VERB_GET_CONFIG_DEFAULT, 0, &val))
  22. return -1;
  23. return val;
  24. }
  25. #define get_amp_caps(codec, nid, dir) \
  26. hdac_read_parm(codec, nid, (dir) == HDA_OUTPUT ? \
  27. AC_PAR_AMP_OUT_CAP : AC_PAR_AMP_IN_CAP)
  28. #define get_power_caps(codec, nid) \
  29. hdac_read_parm(codec, nid, AC_PAR_POWER_STATE)
  30. #endif /* __HDAC_LOCAL_H */