~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/sound/soc/codecs/mt6359-accdet.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 */
  2 /*
  3  * Copyright (C) 2021 MediaTek Inc.
  4  * Author: Argus Lin <argus.lin@mediatek.com>
  5  */
  6 
  7 #ifndef _ACCDET_H_
  8 #define _ACCDET_H_
  9 
 10 #include <linux/ctype.h>
 11 #include <linux/string.h>
 12 
 13 #define ACCDET_DEVNAME "accdet"
 14 
 15 #define HEADSET_MODE_1          (1)
 16 #define HEADSET_MODE_2          (2)
 17 #define HEADSET_MODE_6          (6)
 18 
 19 #define MT6359_ACCDET_NUM_BUTTONS 4
 20 #define MT6359_ACCDET_JACK_MASK (SND_JACK_HEADPHONE | \
 21                                 SND_JACK_HEADSET | \
 22                                 SND_JACK_BTN_0 | \
 23                                 SND_JACK_BTN_1 | \
 24                                 SND_JACK_BTN_2 | \
 25                                 SND_JACK_BTN_3)
 26 #define MT6359_ACCDET_BTN_MASK (SND_JACK_BTN_0 | \
 27                                 SND_JACK_BTN_1 | \
 28                                 SND_JACK_BTN_2 | \
 29                                 SND_JACK_BTN_3)
 30 
 31 enum eint_moisture_status {
 32         M_PLUG_IN =             0,
 33         M_WATER_IN =            1,
 34         M_HP_PLUG_IN =          2,
 35         M_PLUG_OUT =            3,
 36         M_NO_ACT =              4,
 37         M_UNKNOWN =             5,
 38 };
 39 
 40 enum {
 41         accdet_state000 = 0,
 42         accdet_state001,
 43         accdet_state010,
 44         accdet_state011,
 45         accdet_auxadc,
 46         eint_state000,
 47         eint_state001,
 48         eint_state010,
 49         eint_state011,
 50         eint_inverter_state000,
 51 };
 52 
 53 struct three_key_threshold {
 54         unsigned int mid;
 55         unsigned int up;
 56         unsigned int down;
 57 };
 58 
 59 struct four_key_threshold {
 60         unsigned int mid;
 61         unsigned int voice;
 62         unsigned int up;
 63         unsigned int down;
 64 };
 65 
 66 struct pwm_deb_settings {
 67         unsigned int pwm_width;
 68         unsigned int pwm_thresh;
 69         unsigned int fall_delay;
 70         unsigned int rise_delay;
 71         unsigned int debounce0;
 72         unsigned int debounce1;
 73         unsigned int debounce3;
 74         unsigned int debounce4;
 75         unsigned int eint_pwm_width;
 76         unsigned int eint_pwm_thresh;
 77         unsigned int eint_debounce0;
 78         unsigned int eint_debounce1;
 79         unsigned int eint_debounce2;
 80         unsigned int eint_debounce3;
 81         unsigned int eint_inverter_debounce;
 82 
 83 };
 84 
 85 struct dts_data {
 86         unsigned int mic_vol;
 87         unsigned int mic_mode;
 88         unsigned int plugout_deb;
 89         unsigned int eint_pol;
 90         struct pwm_deb_settings *pwm_deb;
 91         struct three_key_threshold three_key;
 92         struct four_key_threshold four_key;
 93         unsigned int moisture_detect_enable;
 94         unsigned int eint_detect_mode;
 95         unsigned int eint_use_ext_res;
 96         unsigned int eint_comp_vth;
 97         unsigned int moisture_detect_mode;
 98         unsigned int moisture_comp_vth;
 99         unsigned int moisture_comp_vref2;
100         unsigned int moisture_use_ext_res;
101 };
102 
103 struct mt6359_accdet {
104         struct snd_soc_jack *jack;
105         struct device *dev;
106         struct regmap *regmap;
107         struct dts_data *data;
108         unsigned int caps;
109         int accdet_irq;
110         int accdet_eint0;
111         int accdet_eint1;
112         struct mutex res_lock; /* lock protection */
113         bool jack_plugged;
114         unsigned int jack_type;
115         unsigned int btn_type;
116         unsigned int accdet_status;
117         unsigned int pre_accdet_status;
118         unsigned int cali_voltage;
119         unsigned int jd_sts;
120         struct work_struct accdet_work;
121         struct workqueue_struct *accdet_workqueue;
122         struct work_struct jd_work;
123         struct workqueue_struct *jd_workqueue;
124 };
125 
126 int mt6359_accdet_enable_jack_detect(struct snd_soc_component *component,
127                                      struct snd_soc_jack *jack);
128 #endif
129 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php