local.h 1000 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. */
  4. #ifndef __HDAC_LOCAL_H
  5. #define __HDAC_LOCAL_H
  6. int hdac_read_parm(struct hdac_device *codec, hda_nid_t nid, int parm);
  7. #define get_wcaps(codec, nid) \
  8. 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. #define get_pin_caps(codec, nid) \
  17. hdac_read_parm(codec, nid, AC_PAR_PIN_CAP)
  18. static inline
  19. unsigned int get_pin_cfg(struct hdac_device *codec, hda_nid_t nid)
  20. {
  21. unsigned int val;
  22. if (snd_hdac_read(codec, nid, AC_VERB_GET_CONFIG_DEFAULT, 0, &val))
  23. return -1;
  24. return val;
  25. }
  26. #define get_amp_caps(codec, nid, dir) \
  27. hdac_read_parm(codec, nid, (dir) == HDA_OUTPUT ? \
  28. AC_PAR_AMP_OUT_CAP : AC_PAR_AMP_IN_CAP)
  29. #define get_power_caps(codec, nid) \
  30. hdac_read_parm(codec, nid, AC_PAR_POWER_STATE)
  31. #endif /* __HDAC_LOCAL_H */