hda_auto_parser.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /*
  2. * BIOS auto-parser helper functions for HD-audio
  3. *
  4. * Copyright (c) 2012 Takashi Iwai <tiwai@suse.de>
  5. *
  6. * This driver is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. */
  11. #ifndef __SOUND_HDA_AUTO_PARSER_H
  12. #define __SOUND_HDA_AUTO_PARSER_H
  13. /*
  14. * Helper for automatic pin configuration
  15. */
  16. enum {
  17. AUTO_PIN_MIC,
  18. AUTO_PIN_LINE_IN,
  19. AUTO_PIN_CD,
  20. AUTO_PIN_AUX,
  21. AUTO_PIN_LAST
  22. };
  23. enum {
  24. AUTO_PIN_LINE_OUT,
  25. AUTO_PIN_SPEAKER_OUT,
  26. AUTO_PIN_HP_OUT
  27. };
  28. #define AUTO_CFG_MAX_OUTS HDA_MAX_OUTS
  29. #define AUTO_CFG_MAX_INS 8
  30. struct auto_pin_cfg_item {
  31. hda_nid_t pin;
  32. int type;
  33. };
  34. struct auto_pin_cfg;
  35. const char *hda_get_autocfg_input_label(struct hda_codec *codec,
  36. const struct auto_pin_cfg *cfg,
  37. int input);
  38. int snd_hda_get_pin_label(struct hda_codec *codec, hda_nid_t nid,
  39. const struct auto_pin_cfg *cfg,
  40. char *label, int maxlen, int *indexp);
  41. enum {
  42. INPUT_PIN_ATTR_UNUSED, /* pin not connected */
  43. INPUT_PIN_ATTR_INT, /* internal mic/line-in */
  44. INPUT_PIN_ATTR_DOCK, /* docking mic/line-in */
  45. INPUT_PIN_ATTR_NORMAL, /* mic/line-in jack */
  46. INPUT_PIN_ATTR_REAR, /* mic/line-in jack in rear */
  47. INPUT_PIN_ATTR_FRONT, /* mic/line-in jack in front */
  48. INPUT_PIN_ATTR_LAST = INPUT_PIN_ATTR_FRONT,
  49. };
  50. int snd_hda_get_input_pin_attr(unsigned int def_conf);
  51. struct auto_pin_cfg {
  52. int line_outs;
  53. /* sorted in the order of Front/Surr/CLFE/Side */
  54. hda_nid_t line_out_pins[AUTO_CFG_MAX_OUTS];
  55. int speaker_outs;
  56. hda_nid_t speaker_pins[AUTO_CFG_MAX_OUTS];
  57. int hp_outs;
  58. int line_out_type; /* AUTO_PIN_XXX_OUT */
  59. hda_nid_t hp_pins[AUTO_CFG_MAX_OUTS];
  60. int num_inputs;
  61. struct auto_pin_cfg_item inputs[AUTO_CFG_MAX_INS];
  62. int dig_outs;
  63. hda_nid_t dig_out_pins[2];
  64. hda_nid_t dig_in_pin;
  65. hda_nid_t mono_out_pin;
  66. int dig_out_type[2]; /* HDA_PCM_TYPE_XXX */
  67. int dig_in_type; /* HDA_PCM_TYPE_XXX */
  68. };
  69. /* bit-flags for snd_hda_parse_pin_def_config() behavior */
  70. #define HDA_PINCFG_NO_HP_FIXUP (1 << 0) /* no HP-split */
  71. #define HDA_PINCFG_NO_LO_FIXUP (1 << 1) /* don't take other outs as LO */
  72. int snd_hda_parse_pin_defcfg(struct hda_codec *codec,
  73. struct auto_pin_cfg *cfg,
  74. const hda_nid_t *ignore_nids,
  75. unsigned int cond_flags);
  76. /* older function */
  77. #define snd_hda_parse_pin_def_config(codec, cfg, ignore) \
  78. snd_hda_parse_pin_defcfg(codec, cfg, ignore, 0)
  79. #endif /* __SOUND_HDA_AUTO_PARSER_H */