@@ -37,9 +37,6 @@
#define ACCDET_PMIC_RSV_EINT BIT(7)
-#define ACCDET_THREE_KEY BIT(8)
-#define ACCDET_FOUR_KEY BIT(9)
-#define ACCDET_TRI_KEY_CDD BIT(10)
#define ACCDET_RSV_KEY BIT(11)
#define ACCDET_ANALOG_FASTDISCHARGE BIT(12)
@@ -322,41 +319,6 @@ static void mt6359_accdet_jack_report(struct mt6359_accdet *priv)
snd_soc_jack_report(priv->jack, report, MT6359_ACCDET_JACK_MASK);
}
-static unsigned int check_button(struct mt6359_accdet *priv, unsigned int v)
-{
- if (priv->caps & ACCDET_FOUR_KEY) {
- if (v < priv->data->four_key.down &&
- v >= priv->data->four_key.up)
- priv->btn_type = SND_JACK_BTN_1;
- if (v < priv->data->four_key.up &&
- v >= priv->data->four_key.voice)
- priv->btn_type = SND_JACK_BTN_2;
- if (v < priv->data->four_key.voice &&
- v >= priv->data->four_key.mid)
- priv->btn_type = SND_JACK_BTN_3;
- if (v < priv->data->four_key.mid)
- priv->btn_type = SND_JACK_BTN_0;
- } else {
- if (v < priv->data->three_key.down &&
- v >= priv->data->three_key.up)
- priv->btn_type = SND_JACK_BTN_1;
- if (v < priv->data->three_key.up &&
- v >= priv->data->three_key.mid)
- priv->btn_type = SND_JACK_BTN_2;
- if (v < priv->data->three_key.mid)
- priv->btn_type = SND_JACK_BTN_0;
- }
- return 0;
-}
-
-static void is_key_pressed(struct mt6359_accdet *priv, bool pressed)
-{
- priv->btn_type = priv->jack_type & ~MT6359_ACCDET_BTN_MASK;
-
- if (pressed)
- check_button(priv, priv->cali_voltage);
-}
-
static inline void check_jack_btn_type(struct mt6359_accdet *priv)
{
unsigned int val = 0;
@@ -368,15 +330,11 @@ static inline void check_jack_btn_type(struct mt6359_accdet *priv)
switch (priv->accdet_status) {
case 0:
- if (priv->jack_type == SND_JACK_HEADSET)
- is_key_pressed(priv, true);
- else
+ if (priv->jack_type != SND_JACK_HEADSET)
priv->jack_type = SND_JACK_HEADPHONE;
break;
case 1:
- if (priv->jack_type == SND_JACK_HEADSET) {
- is_key_pressed(priv, false);
- } else {
+ if (priv->jack_type != SND_JACK_HEADSET) {
priv->jack_type = SND_JACK_HEADSET;
accdet_set_debounce(priv, eint_state011, 0x1);
}
@@ -606,48 +564,6 @@ static int mt6359_accdet_parse_dt(struct mt6359_accdet *priv)
if (ret)
priv->data->eint_comp_vth = 0x0;
- ret = of_property_read_u32(node, "mediatek,key-mode", &tmp);
- if (ret)
- tmp = 0;
- if (tmp == 0) {
- int three_key[4];
-
- priv->caps |= ACCDET_THREE_KEY;
- ret = of_property_read_u32_array(node,
- "mediatek,three-key-thr",
- three_key,
- ARRAY_SIZE(three_key));
- if (!ret)
- memcpy(&priv->data->three_key, three_key + 1,
- sizeof(struct three_key_threshold));
- } else if (tmp == 1) {
- int four_key[5];
-
- priv->caps |= ACCDET_FOUR_KEY;
- ret = of_property_read_u32_array(node,
- "mediatek,four-key-thr",
- four_key,
- ARRAY_SIZE(four_key));
- if (!ret) {
- memcpy(&priv->data->four_key, four_key + 1,
- sizeof(struct four_key_threshold));
- } else {
- dev_warn(priv->dev,
- "accdet no 4-key-thrsh dts, use efuse\n");
- }
- } else if (tmp == 2) {
- int three_key[4];
-
- priv->caps |= ACCDET_TRI_KEY_CDD;
- ret = of_property_read_u32_array(node,
- "mediatek,tri-key-cdd-thr",
- three_key,
- ARRAY_SIZE(three_key));
- if (!ret)
- memcpy(&priv->data->three_key, three_key + 1,
- sizeof(struct three_key_threshold));
- }
-
of_node_put(node);
dev_warn(priv->dev, "accdet caps=%x\n", priv->caps);
@@ -50,19 +50,6 @@ enum {
eint_inverter_state000,
};
-struct three_key_threshold {
- unsigned int mid;
- unsigned int up;
- unsigned int down;
-};
-
-struct four_key_threshold {
- unsigned int mid;
- unsigned int voice;
- unsigned int up;
- unsigned int down;
-};
-
struct pwm_deb_settings {
unsigned int pwm_width;
unsigned int pwm_thresh;
@@ -88,8 +75,6 @@ struct dts_data {
unsigned int plugout_deb;
unsigned int eint_pol;
struct pwm_deb_settings *pwm_deb;
- struct three_key_threshold three_key;
- struct four_key_threshold four_key;
unsigned int moisture_detect_enable;
unsigned int eint_detect_mode;
unsigned int eint_use_ext_res;
The button detection functionality depends on a calibration voltage value which is currently not updated anywhere in the driver code, and hence it doesn't actually do anything. Remove this unused code. Signed-off-by: NĂcolas F. R. A. Prado <nfraprado@collabora.com> --- sound/soc/codecs/mt6359-accdet.c | 88 +--------------------------------------- sound/soc/codecs/mt6359-accdet.h | 15 ------- 2 files changed, 2 insertions(+), 101 deletions(-)