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