hc
2023-12-11 1f93a7dfd1f8d5ff7a5c53246c7534fe2332d6f4
kernel/drivers/headset_observe/rk_headset.c
....@@ -155,6 +155,7 @@
155155 int level2 = 0;
156156 struct rk_headset_pdata *pdata = headset_info->pdata;
157157 static unsigned int old_status = 0;
158
+ int ret;
158159
159160 printk("---headsetobserve_work---\n");
160161 mutex_lock(&headset_info->mutex_lock[HEADSET]);
....@@ -182,6 +183,10 @@
182183 headset_info->headset_status ? "in" : "out");
183184 if (headset_info->headset_status == HEADSET_IN) {
184185 headset_info->cur_headset_status = BIT_HEADSET_NO_MIC;
186
+ ret = gpio_direction_output(pdata->spk_ctl_gpio,0);
187
+ if (ret < 0) {
188
+ printk("spk_ctl_gpio set direction fail\n");
189
+ }
185190 if (pdata->headset_insert_type == HEADSET_IN_HIGH)
186191 irq_set_irq_type(headset_info->irq[HEADSET],
187192 IRQF_TRIGGER_FALLING);
....@@ -196,6 +201,10 @@
196201 goto out;
197202 }
198203 } else if (headset_info->headset_status == HEADSET_OUT) {
204
+ ret = gpio_direction_output(pdata->spk_ctl_gpio,1);
205
+ if (ret < 0) {
206
+ printk("spk_ctl_gpio set direction fail\n");
207
+ }
199208 headset_info->hook_status = HOOK_UP;
200209 if (headset_info->isHook_irq == enable) {
201210 DBG("disable headset_hook irq\n");