hc
2023-10-16 def2367077573b56f9fc4f824e5c0377a3a4175a
kernel/drivers/headset_observe/rk_headset.c
....@@ -153,6 +153,7 @@
153153 {
154154 int level = 0;
155155 int level2 = 0;
156
+ int ret;
156157 struct rk_headset_pdata *pdata = headset_info->pdata;
157158 static unsigned int old_status = 0;
158159
....@@ -182,6 +183,11 @@
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
+ }
190
+
185191 if (pdata->headset_insert_type == HEADSET_IN_HIGH)
186192 irq_set_irq_type(headset_info->irq[HEADSET],
187193 IRQF_TRIGGER_FALLING);
....@@ -196,6 +202,10 @@
196202 goto out;
197203 }
198204 } else if (headset_info->headset_status == HEADSET_OUT) {
205
+ ret = gpio_direction_output(pdata->spk_ctl_gpio,1);
206
+ if (ret < 0) {
207
+ printk("spk_ctl_gpio set direction fail\n");
208
+ }
199209 headset_info->hook_status = HOOK_UP;
200210 if (headset_info->isHook_irq == enable) {
201211 DBG("disable headset_hook irq\n");