static void sec_jack_det_work_func(struct work_struct *work) { struct sec_jack_info *hi = container_of(work, struct sec_jack_info, det_work); struct sec_jack_platform_data *pdata = hi->pdata; int time_left_ms = DET_CHECK_TIME_MS; pr_debug(MODULE_NAME "%s\n", __func__); /* threaded irq can sleep */ wake_lock_timeout(&hi->det_wake_lock, WAKE_LOCK_TIME); #ifdef CONFIG_MACH_JAGUAR if ((hi->cur_jack_type == SEC_HEADSET_4POLE) && sendkey_irq_progress) { pr_info(MODULE_NAME "%s / 120ms Delay\n", __func__); usleep_range(120000, 120000); } else { pr_info(MODULE_NAME "%s / No Delay\n", __func__); sendkey_irq_progress = false; } #endif /* debounce headset jack. don't try to determine the type of * headset until the detect state is true for a while. */ while (time_left_ms > 0) { if (!pdata->get_det_jack_state()) { /* jack not detected. */ handle_jack_not_inserted(hi); return; } usleep_range(10000, 10000); time_left_ms -= 10; } #if defined(CONFIG_SAMSUNG_JACK_GNDLDET) /* G plus L Detection */ if (!hi->pdata->get_l_jack_state()) return; #endif /* set mic bias to enable adc */ pdata->set_micbias_state(true); /* to reduce noise in earjack when attaching */ /* msleep(200); */ /* jack presence was detected the whole time, figure out which type */ determine_jack_type(hi); return; }
static ssize_t reselect_jack_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t size) { struct sec_jack_info *hi = dev_get_drvdata(dev); int value = 0; sscanf(buf, "%d", &value); pr_err("%s: User selection : 0X%x", __func__, value); if (value == 1) { recheck_jack = true; determine_jack_type(hi); } return size; }
static void sec_jack_det_work_func(struct work_struct *work) { struct sec_jack_info *hi = container_of(work, struct sec_jack_info, det_work); struct sec_jack_platform_data *pdata = hi->pdata; int time_left_ms = DET_CHECK_TIME_MS; int jack_state = 0; pr_debug(MODULE_NAME "%s\n", __func__); /* threaded irq can sleep */ wake_lock_timeout(&hi->det_wake_lock, WAKE_LOCK_TIME); /* debounce headset jack. don't try to determine the type of * headset until the detect state is true for a while. */ while (time_left_ms > 0) { jack_state = pdata->get_det_jack_state(); if (!jack_state) { pr_err("%s : err det jack state %d\n", __func__, jack_state); /* jack not detected. */ handle_jack_not_inserted(hi); return; } usleep_range(10000, 10000); time_left_ms -= 10; } /* set mic bias to enable adc */ pdata->set_micbias_state(true); /* to reduce noise in earjack when attaching */ /* msleep(200); */ /* jack presence was detected the whole time, figure out which type */ determine_jack_type(hi); return; }