Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /* SPDX-License-Identifier: GPL-2.0-or-later */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) #ifndef __SOUND_JACK_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3) #define __SOUND_JACK_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  *  Jack abstraction layer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  *  Copyright 2008 Wolfson Microelectronics plc
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #include <sound/core.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #include <linux/android_kabi.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) struct input_dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17)  * enum snd_jack_types - Jack types which can be reported
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18)  * @SND_JACK_HEADPHONE: Headphone
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19)  * @SND_JACK_MICROPHONE: Microphone
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20)  * @SND_JACK_HEADSET: Headset
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21)  * @SND_JACK_LINEOUT: Line out
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22)  * @SND_JACK_MECHANICAL: Mechanical switch
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23)  * @SND_JACK_VIDEOOUT: Video out
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24)  * @SND_JACK_AVOUT: AV (Audio Video) out
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25)  * @SND_JACK_LINEIN:  Line in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26)  * @SND_JACK_BTN_0: Button 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27)  * @SND_JACK_BTN_1: Button 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28)  * @SND_JACK_BTN_2: Button 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29)  * @SND_JACK_BTN_3: Button 3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30)  * @SND_JACK_BTN_4: Button 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31)  * @SND_JACK_BTN_5: Button 5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33)  * These values are used as a bitmask.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35)  * Note that this must be kept in sync with the lookup table in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36)  * sound/core/jack.c.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) enum snd_jack_types {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 	SND_JACK_HEADPHONE	= 0x0001,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 	SND_JACK_MICROPHONE	= 0x0002,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 	SND_JACK_HEADSET	= SND_JACK_HEADPHONE | SND_JACK_MICROPHONE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 	SND_JACK_LINEOUT	= 0x0004,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 	SND_JACK_MECHANICAL	= 0x0008, /* If detected separately */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 	SND_JACK_VIDEOOUT	= 0x0010,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 	SND_JACK_AVOUT		= SND_JACK_LINEOUT | SND_JACK_VIDEOOUT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 	SND_JACK_LINEIN		= 0x0020,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 	/* Kept separate from switches to facilitate implementation */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 	SND_JACK_BTN_0		= 0x4000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	SND_JACK_BTN_1		= 0x2000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	SND_JACK_BTN_2		= 0x1000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 	SND_JACK_BTN_3		= 0x0800,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	SND_JACK_BTN_4		= 0x0400,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	SND_JACK_BTN_5		= 0x0200,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) /* Keep in sync with definitions above */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) #define SND_JACK_SWITCH_TYPES 6
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) struct snd_jack {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	struct list_head kctl_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	struct snd_card *card;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	const char *id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) #ifdef CONFIG_SND_JACK_INPUT_DEV
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	struct input_dev *input_dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	int registered;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 	int type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	char name[100];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 	unsigned int key[6];   /* Keep in sync with definitions above */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) #endif /* CONFIG_SND_JACK_INPUT_DEV */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	void *private_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	void (*private_free)(struct snd_jack *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	ANDROID_KABI_RESERVE(1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) #ifdef CONFIG_SND_JACK
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) int snd_jack_new(struct snd_card *card, const char *id, int type,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 		 struct snd_jack **jack, bool initial_kctl, bool phantom_jack);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) int snd_jack_add_new_kctl(struct snd_jack *jack, const char * name, int mask);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) #ifdef CONFIG_SND_JACK_INPUT_DEV
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) void snd_jack_set_parent(struct snd_jack *jack, struct device *parent);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) int snd_jack_set_key(struct snd_jack *jack, enum snd_jack_types type,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 		     int keytype);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) void snd_jack_report(struct snd_jack *jack, int status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) static inline int snd_jack_new(struct snd_card *card, const char *id, int type,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 			       struct snd_jack **jack, bool initial_kctl, bool phantom_jack)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) static inline int snd_jack_add_new_kctl(struct snd_jack *jack, const char * name, int mask)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) static inline void snd_jack_report(struct snd_jack *jack, int status)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) #if !defined(CONFIG_SND_JACK) || !defined(CONFIG_SND_JACK_INPUT_DEV)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) static inline void snd_jack_set_parent(struct snd_jack *jack,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 				       struct device *parent)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) static inline int snd_jack_set_key(struct snd_jack *jack,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 				   enum snd_jack_types type,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 				   int keytype)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) #endif /* !CONFIG_SND_JACK || !CONFIG_SND_JACK_INPUT_DEV */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) #endif