jack.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #ifndef __SOUND_JACK_H
  2. #define __SOUND_JACK_H
  3. /*
  4. * Jack abstraction layer
  5. *
  6. * Copyright 2008 Wolfson Microelectronics plc
  7. *
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation; either version 2 of the License, or
  12. * (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  22. *
  23. */
  24. #include <sound/core.h>
  25. struct input_dev;
  26. /**
  27. * Jack types which can be reported. These values are used as a
  28. * bitmask.
  29. */
  30. enum snd_jack_types {
  31. SND_JACK_HEADPHONE = 0x0001,
  32. SND_JACK_MICROPHONE = 0x0002,
  33. SND_JACK_HEADSET = SND_JACK_HEADPHONE | SND_JACK_MICROPHONE,
  34. SND_JACK_LINEOUT = 0x0004,
  35. };
  36. struct snd_jack {
  37. struct input_dev *input_dev;
  38. int registered;
  39. int type;
  40. const char *id;
  41. char name[100];
  42. };
  43. #ifdef CONFIG_SND_JACK
  44. int snd_jack_new(struct snd_card *card, const char *id, int type,
  45. struct snd_jack **jack);
  46. void snd_jack_set_parent(struct snd_jack *jack, struct device *parent);
  47. void snd_jack_report(struct snd_jack *jack, int status);
  48. #else
  49. static inline int snd_jack_new(struct snd_card *card, const char *id, int type,
  50. struct snd_jack **jack)
  51. {
  52. return 0;
  53. }
  54. static inline void snd_jack_set_parent(struct snd_jack *jack,
  55. struct device *parent)
  56. {
  57. }
  58. static inline void snd_jack_report(struct snd_jack *jack, int status)
  59. {
  60. }
  61. #endif
  62. #endif