static int headset_resume(struct platform_device *pdev) { //20101117, [email protected], gpio wakeup from LP1 [START] if(core_lock_on && headset_vdd_address){ NvOdmServicesPmuSetVoltage(headset_h_pmu, headset_vdd_address, NVODM_VOLTAGE_OFF, NULL); } suspend_status = 0; //20101117, [email protected], gpio wakeup from LP1 [END] //[email protected] 20110726 detecting headset when resuming [START] star_Mic_bias(1); headset_det_work(&headset_sw_data->work); //[email protected] 20110726 detecting headset when resuming [END] if(core_lock_on){ lprintk(D_AUDIO, KERN_ERR "##(Headset_det.c)## headset_resume()!! wakeup form LP1 headset detect\n"); input_report_key(headset_sw_data->ip_dev_wake, KEY_VOLUMEDOWN, 1); input_sync(headset_sw_data->ip_dev_wake); input_report_key(headset_sw_data->ip_dev_wake, KEY_VOLUMEDOWN, 0); input_sync(headset_sw_data->ip_dev_wake); //P990_IFX_GB_PORTING_LGSI_START #if !defined (STAR_OPERATOR_FIDO) cancel_delayed_work_sync(&headset_sw_data->delayed_work); //20111017 [email protected] Problem that no wake up when disconn headset in calling #endif //P990_IFX_GB_PORTING_LGSI_END schedule_delayed_work(&headset_sw_data->delayed_work, msecs_to_jiffies(300)); } return 0; }
ssize_t headset_detect_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { if (headset_off) return count; headset_det_work(&headset_sw_data->work); return count; }
static int headset_resume(struct platform_device *pdev) { //20101117, , gpio wakeup from LP1 [START] if(core_lock_on && headset_vdd_address){ NvOdmServicesPmuSetVoltage(headset_h_pmu, headset_vdd_address, NVODM_VOLTAGE_OFF, NULL); } suspend_status = 0; //20101117, , gpio wakeup from LP1 [END] // 20110726 detecting headset when resuming [START] star_Mic_bias(1); headset_det_work(&headset_sw_data->work); // 20110726 detecting headset when resuming [END] if(core_lock_on){ lprintk(D_AUDIO, KERN_ERR "##(Headset_det.c)## headset_resume()!! wakeup form LP1 headset detect\n"); input_report_key(headset_sw_data->ip_dev_wake, KEY_VOLUMEDOWN, 1); input_sync(headset_sw_data->ip_dev_wake); input_report_key(headset_sw_data->ip_dev_wake, KEY_VOLUMEDOWN, 0); input_sync(headset_sw_data->ip_dev_wake); schedule_delayed_work(&headset_sw_data->delayed_work, msecs_to_jiffies(300)); } return 0; }
static int headsetdet_resume(struct platform_device *pdev) { //For_Resume_Speed printk("[LUCKYJUN77] headsetdet_resume\n"); #if defined(CONFIG_HUB_AMP_WM9093) unsigned int cur_device = get_wm9093_mode(); #if 0 /* no need to send hook when wake up */ if(headset_type == HUB_HEADSET && cur_device == 6 && gpio_get_value(headset_sw_data->hook_gpio) == 0) { input_report_key(headset_sw_data->ip_dev, KEY_HOOK, 1); input_report_key(headset_sw_data->ip_dev, KEY_HOOK, 0); input_sync(headset_sw_data->ip_dev); } #endif if(cur_device == 4 || cur_device == 5 || cur_device == 6) //call case headset_det_work(&headset_sw_data->work); #endif return 0; }
static int headsetdet_probe(struct platform_device *pdev) { struct gpio_switch_platform_data *pdata = pdev->dev.platform_data; struct headset_switch_data *switch_data; int ret = 0; struct input_dev *ip_dev; if (!pdata) return -EBUSY; switch_data = kzalloc(sizeof(struct headset_switch_data), GFP_KERNEL); if (!switch_data) return -ENOMEM; switch_data->sdev.name = pdata->name; switch_data->gpio = pdata->gpio; switch_data->name_on = pdata->name_on; switch_data->name_off = pdata->name_off; switch_data->state_on = pdata->state_on; switch_data->state_off = pdata->state_off; switch_data->sdev.print_state = switch_gpio_print_state; switch_data->hook_gpio = 163; #if defined(CONFIG_MACH_LGE_HUB_REV_A) // 20100814 , dmb ant detect [START_LGE] //nothing #else switch_data->dmb_ant_gpio = 164; switch_data->dmb_ant_detected = 0; #endif // 20100814 , dmb ant detect [END_LGE] ret = switch_dev_register(&switch_data->sdev); if (ret < 0) goto err_switch_dev_register; omap_mux_init_gpio(switch_data->gpio, OMAP_PIN_INPUT_PULLDOWN | OMAP_PIN_OFF_WAKEUPENABLE); //20101004 , ear sense wakable setting #if 1 //20101109 , hook key wakable setting omap_mux_init_gpio(switch_data->hook_gpio, OMAP_PIN_INPUT_PULLUP | OMAP_PIN_OFF_WAKEUPENABLE); #endif ret = gpio_request(switch_data->gpio, pdev->name); ret = gpio_request(switch_data->hook_gpio, pdev->name); #if defined(CONFIG_MACH_LGE_HUB_REV_A) // 20100814 , dmb ant detect [START_LGE] //nothing #else ret = gpio_request(switch_data->dmb_ant_gpio, pdev->name); #endif // 20100814 , dmb ant detect [END_LGE] if (ret < 0) goto err_request_gpio; ret = gpio_direction_input(switch_data->gpio); ret = gpio_direction_input(switch_data->hook_gpio); #if defined(CONFIG_MACH_LGE_HUB_REV_A) || defined(CONFIG_MACH_LGE_HUB_REV_B)// 20100814 , dmb ant detect [START_LGE] //nothing #else ret = gpio_direction_input(switch_data->dmb_ant_gpio); #endif // 20100814 , dmb ant detect [END_LGE] if (ret < 0) goto err_set_gpio_input; ip_dev = input_allocate_device(); switch_data->ip_dev = ip_dev; switch_data->ip_dev->name = "Hookkey"; //20100830, , define the input dev name set_bit(EV_SYN, switch_data->ip_dev->evbit); set_bit(EV_KEY, switch_data->ip_dev->evbit); set_bit(KEY_HOOK, switch_data->ip_dev->keybit); //for short pressed hook key ret = input_register_device(switch_data->ip_dev); INIT_WORK(&switch_data->work, headset_det_work); INIT_DELAYED_WORK(&switch_data->delayed_work, type_det_work); INIT_DELAYED_WORK(&switch_data->hook_delayed_work, hook_det_work); switch_data->irq = gpio_to_irq(switch_data->gpio); switch_data->hook_irq = gpio_to_irq(switch_data->hook_gpio); // 20100814 , dmb ant detect [START_LGE] #if defined(CONFIG_MACH_LGE_HUB_REV_A) //nothing #else switch_data->dmb_ant_irq = gpio_to_irq(switch_data->dmb_ant_gpio); // 20100814 , dmb ant gpio [START_LGE] #endif // 20100814 , dmb ant detect [END_LGE] if (switch_data->irq < 0) { ret = switch_data->irq; goto err_detect_irq_num_failed; } #if 1 //20101004 , ear sense wakable setting /* Make the interrupt on wake up OMAP which is in suspend mode */ ret = enable_irq_wake(switch_data->irq); if(ret < 0){ printk(KERN_INFO "[LUCKYJUN77] EAR SENSE 170 wake up source setting failed!\n"); disable_irq_wake(switch_data->irq); return -ENOSYS; } #endif #if 1 //20101109 , hook key wakable setting /* Make the interrupt on wake up OMAP which is in suspend mode */ ret = enable_irq_wake(switch_data->hook_irq); if(ret < 0){ printk(KERN_INFO "[LUCKYJUN77] Hook key 163 wake up source setting failed!\n"); disable_irq_wake(switch_data->hook_irq); return -ENOSYS; } #endif ret = request_irq(switch_data->irq, headset_int_handler, IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, pdev->name, switch_data); if (ret < 0) goto err_request_irq; ret = request_irq(switch_data->hook_irq, headset_hook_int_handler, IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, "headset_hook", switch_data); if (ret < 0) goto err_request_irq; // 20100825 , mic bias LDO control test [START_LGE] #if 1 omap_mux_init_gpio(MIC_BIAS_LDO, OMAP_PIN_OUTPUT); ret = gpio_request(MIC_BIAS_LDO, pdev->name); if(ret < 0) { printk("can't get hub Mic bias LDO enable GPIO\n"); goto err_request_gpio; } #endif // 20100825 , mic bias LDO control test [END_LGE] // 20100814 , dmb ant detect [START_LGE] #if defined(CONFIG_MACH_LGE_HUB_REV_A) //nothing #else ret = request_irq(switch_data->dmb_ant_irq, dmb_ant_int_handler, IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, "dmb_ant", switch_data); #endif // 20100814 , dmb ant detect [END_LGE] /* Perform initial detection */ headset_sw_data = switch_data; headset_sw_data->is_suspend = 0; //resume headset_det_work(&switch_data->work); // 20100603 , headset suspend/resume [START_LGE] #ifdef CONFIG_HAS_EARLYSUSPEND switch_data->early_suspend.level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN + 2; switch_data->early_suspend.suspend = headsetdet_early_suspend; switch_data->early_suspend.resume = headsetdet_late_resume; register_early_suspend(&switch_data->early_suspend); #endif // 20100603 , headset suspend/resume [END_LGE] return 0; err_request_irq: err_detect_irq_num_failed: err_set_gpio_input: gpio_free(switch_data->gpio); err_request_gpio: switch_dev_unregister(&switch_data->sdev); err_switch_dev_register: kfree(switch_data); return ret; }
static int headsetdet_probe(struct platform_device *pdev) { struct gpio_switch_platform_data *pdata = pdev->dev.platform_data; struct headset_switch_data *switch_data; int ret = 0; struct input_dev *ip_dev; if (!pdata) return -EBUSY; switch_data = kzalloc(sizeof(struct headset_switch_data), GFP_KERNEL); if (!switch_data) return -ENOMEM; // 20110425 [email protected] detect headset during sleep [START] /* wake lock for headset detection */ wake_lock_init(&headset_wlock.wake_lock, WAKE_LOCK_SUSPEND, "headset_det"); set_wakelock(0); // 20110425 [email protected] detect headset during sleep [END] switch_data->sdev.name = pdata->name; switch_data->gpio = pdata->gpio; switch_data->name_on = pdata->name_on; switch_data->name_off = pdata->name_off; switch_data->state_on = pdata->state_on; switch_data->state_off = pdata->state_off; switch_data->sdev.print_state = switch_gpio_print_state; switch_data->hook_gpio = HOOK_ADC_GPIO; #if defined(CONFIG_PRODUCT_LGE_KU5900)||defined(CONFIG_PRODUCT_LGE_P970) || defined(CONFIG_PRODUCT_LGE_LU6800) // 20100814 [email protected], dmb ant detect [START_LGE] //nothing #elif defined(CONFIG_PRODUCT_LGE_HUB) // [email protected] : Mach_Hub use external ant for dmb switch_data->dmb_ant_gpio = 164; switch_data->dmb_ant_detected = 0; #endif // 20100814 [email protected], dmb ant detect [END_LGE] ret = switch_dev_register(&switch_data->sdev); if (ret < 0) goto err_switch_dev_register; omap_mux_init_gpio(switch_data->gpio, OMAP_PIN_INPUT_PULLDOWN | OMAP_PIN_OFF_WAKEUPENABLE); //20101004 [email protected], ear sense wakable setting #if 1 //20101109 [email protected], hook key wakable setting omap_mux_init_gpio(switch_data->hook_gpio, OMAP_PIN_INPUT_PULLUP | OMAP_PIN_OFF_WAKEUPENABLE); #endif ret = gpio_request(switch_data->gpio, pdev->name); ret = gpio_request(switch_data->hook_gpio, pdev->name); #if defined(CONFIG_PRODUCT_LGE_KU5900)||defined(CONFIG_PRODUCT_LGE_P970) || defined(CONFIG_PRODUCT_LGE_LU6800) // 20100814 [email protected], dmb ant detect [START_LGE] //nothing #else ret = gpio_request(switch_data->dmb_ant_gpio, pdev->name); #endif // 20100814 [email protected], dmb ant detect [END_LGE] if (ret < 0) goto err_request_gpio; ret = gpio_direction_input(switch_data->gpio); ret = gpio_direction_input(switch_data->hook_gpio); #if defined(CONFIG_PRODUCT_LGE_KU5900)||defined(CONFIG_PRODUCT_LGE_P970) || defined(CONFIG_PRODUCT_LGE_HUB)// 20100814 [email protected], dmb ant detect [START_LGE] //nothing #else //--[[ LGE_UBIQUIX_MODIFIED_START : [email protected] [2011.08.11] - GPIO direction input error fixed. ret = gpio_request(switch_data->dmb_ant_gpio, pdev->name); if (ret < 0) goto err_request_gpio; //--]] LGE_UBIQUIX_MODIFIED_END : [email protected] [2011.08.11]- GPIO direction input error fixed. ret = gpio_direction_input(switch_data->dmb_ant_gpio); #endif // 20100814 [email protected], dmb ant detect [END_LGE] if (ret < 0) goto err_set_gpio_input; ip_dev = input_allocate_device(); switch_data->ip_dev = ip_dev; switch_data->ip_dev->name = "Hookkey"; //20100830, [email protected], define the input dev name set_bit(EV_SYN, switch_data->ip_dev->evbit); set_bit(EV_KEY, switch_data->ip_dev->evbit); set_bit(KEY_HOOK, switch_data->ip_dev->keybit); //for short pressed hook key ret = input_register_device(switch_data->ip_dev); INIT_WORK(&switch_data->work, headset_det_work); INIT_DELAYED_WORK(&switch_data->delayed_work, type_det_work); INIT_DELAYED_WORK(&switch_data->hook_delayed_work, hook_det_work); switch_data->irq = gpio_to_irq(switch_data->gpio); switch_data->hook_irq = gpio_to_irq(switch_data->hook_gpio); // 20100814 [email protected], dmb ant detect [START_LGE] #if defined(CONFIG_PRODUCT_LGE_KU5900) ||defined(CONFIG_PRODUCT_LGE_P970) //nothing #else switch_data->dmb_ant_irq = gpio_to_irq(switch_data->dmb_ant_gpio); // 20100814 [email protected], dmb ant gpio [START_LGE] #endif // 20100814 [email protected], dmb ant detect [END_LGE] if (switch_data->irq < 0) { ret = switch_data->irq; goto err_detect_irq_num_failed; } #if 1 //20101004 [email protected], ear sense wakable setting /* Make the interrupt on wake up OMAP which is in suspend mode */ ret = enable_irq_wake(switch_data->irq); if(ret < 0){ DBG(KERN_INFO "[LUCKYJUN77] EAR SENSE 170 wake up source setting failed!\n"); disable_irq_wake(switch_data->irq); return -ENOSYS; } #endif #if 1 //20101109 [email protected], hook key wakable setting /* Make the interrupt on wake up OMAP which is in suspend mode */ ret = enable_irq_wake(switch_data->hook_irq); if(ret < 0){ DBG(KERN_INFO "[LUCKYJUN77] Hook key 163 wake up source setting failed!\n"); disable_irq_wake(switch_data->hook_irq); return -ENOSYS; } #endif ret = request_irq(switch_data->irq, headset_int_handler, IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, pdev->name, switch_data); if (ret < 0) goto err_request_irq; ret = request_irq(switch_data->hook_irq, headset_hook_int_handler, IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, "headset_hook", switch_data); if (ret < 0) goto err_request_irq; // 20100825 [email protected], mic bias LDO control test [START_LGE] #if 1 omap_mux_init_gpio(MIC_BIAS_LDO, OMAP_PIN_OUTPUT); ret = gpio_request(MIC_BIAS_LDO, pdev->name); if(ret < 0) { DBG("can't get hub Mic bias LDO enable GPIO\n"); goto err_request_gpio; } #endif // 20100825 [email protected], mic bias LDO control test [END_LGE] // 20100814 [email protected], dmb ant detect [START_LGE] #if defined(CONFIG_PRODUCT_LGE_KU5900) || defined(CONFIG_PRODUCT_LGE_LU6800)||defined(CONFIG_PRODUCT_LGE_P970) //nothing #else ret = request_irq(switch_data->dmb_ant_irq, dmb_ant_int_handler, IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, "dmb_ant", switch_data); #endif // 20100814 [email protected], dmb ant detect [END_LGE] /* Perform initial detection */ headset_sw_data = switch_data; headset_sw_data->is_suspend = 0; //resume headset_det_work(&switch_data->work); // 20100603 [email protected], headset suspend/resume [START_LGE] #ifdef CONFIG_HAS_EARLYSUSPEND switch_data->early_suspend.level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN + 2; switch_data->early_suspend.suspend = headsetdet_early_suspend; switch_data->early_suspend.resume = headsetdet_late_resume; register_early_suspend(&switch_data->early_suspend); #endif // 20100603 [email protected], headset suspend/resume [END_LGE] return 0; err_request_irq: err_detect_irq_num_failed: err_set_gpio_input: gpio_free(switch_data->gpio); err_request_gpio: switch_dev_unregister(&switch_data->sdev); err_switch_dev_register: kfree(switch_data); return ret; }