hc
2024-03-22 619f0f87159c5dbd2755b1b0a0eb35784be84e7a
kernel/drivers/headset_observe/rk_headset_irq_hook_adc.c
....@@ -111,6 +111,7 @@
111111 struct rk_headset_pdata *pdata = headset_info->pdata;
112112 static unsigned int old_status = 0;
113113 int i, level = 0;
114
+ int ret;
114115
115116 disable_irq_nosync(headset_info->irq[HEADSET]);
116117 if (headset_info->heatset_irq_working == BUSY ||
....@@ -161,11 +162,15 @@
161162 goto out;
162163 }
163164
164
- pr_info("(headset in is %s)headset status is %s\n",
165
+ pr_info("(myttest headset in is %s)headset status is %s\n",
165166 pdata->headset_insert_type ? "high level" : "low level",
166167 headset_info->headset_status ? "in" : "out");
167168
168169 if (headset_info->headset_status == HEADSET_IN) {
170
+ ret = gpio_direction_output(pdata->spk_ctl_gpio,1);
171
+ if (ret < 0) {
172
+ printk("spk_ctl_gpio set direction fail\n");
173
+ }
169174 if (pdata->chan != 0) {
170175 /* detect Hook key */
171176 schedule_delayed_work(
....@@ -186,6 +191,10 @@
186191 irq_set_irq_type(headset_info->irq[HEADSET],
187192 IRQF_TRIGGER_RISING);
188193 } else if (headset_info->headset_status == HEADSET_OUT) {
194
+ ret = gpio_direction_output(pdata->spk_ctl_gpio,0);
195
+ if (ret < 0) {
196
+ printk("spk_ctl_gpio set direction fail\n");
197
+ }
189198 headset_info->cur_headset_status = HEADSET_OUT;
190199 cancel_delayed_work(&headset_info->hook_work);
191200 if (headset_info->isMic) {