static void tvenc_detect_work_func(struct work_struct *work) { int value; struct tvenc_info *tvenc= container_of(work, struct tvenc_info, detect_delay_work); value = gpio_get_value(82); printk("%s, TV-detection GPIO=%d\n", __func__, value); #ifdef CONFIG_HTC_HEADSET_MGR switch_send_event(BIT_TV_OUT | BIT_TV_OUT_AUDIO, !!value); #endif }
static void OnDownstreamRxPoweredUp(struct hdmi_info *hdmi) { HDMI_DBG("%s\n", __func__); dsRxPoweredUp = true; HotPlugService(hdmi); #ifdef CONFIG_HTC_HEADSET_MGR /* send cable in event */ switch_send_event(BIT_HDMI_CABLE, 1); HDMI_DBG("Cable inserted.\n"); #endif pvid_mode = vid_mode; hdmi_active9022_dup(hdmi->client); }
static ssize_t debug_flag_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { unsigned long state = 0; HS_DBG(); if (strncmp(buf, "enable", count - 1) == 0) { if (hi->debug_flag & DEBUG_FLAG_ADC) { HS_LOG("Debug work is already running"); return count; } if (!debug_wq) { debug_wq = create_workqueue("debug"); if (!debug_wq) { HS_LOG("Failed to create debug workqueue"); return count; } } HS_LOG("Enable headset debug"); mutex_lock(&hi->mutex_lock); hi->debug_flag |= DEBUG_FLAG_ADC; mutex_unlock(&hi->mutex_lock); queue_work(debug_wq, &debug_work); } else if (strncmp(buf, "disable", count - 1) == 0) { if (!(hi->debug_flag & DEBUG_FLAG_ADC)) { HS_LOG("Debug work has been stopped"); return count; } HS_LOG("Disable headset debug"); mutex_lock(&hi->mutex_lock); hi->debug_flag &= ~DEBUG_FLAG_ADC; mutex_unlock(&hi->mutex_lock); if (debug_wq) { flush_workqueue(debug_wq); destroy_workqueue(debug_wq); debug_wq = NULL; } } else if (strncmp(buf, "debug_log_enable", count - 1) == 0) { HS_LOG("Enable headset debug log"); hi->debug_flag |= DEBUG_FLAG_LOG; } else if (strncmp(buf, "debug_log_disable", count - 1) == 0) { HS_LOG("Disable headset debug log"); hi->debug_flag &= ~DEBUG_FLAG_LOG; } else if (strncmp(buf, "no_headset", count - 1) == 0) { HS_LOG("Headset simulation: no_headset"); state = BIT_HEADSET | BIT_HEADSET_NO_MIC | BIT_35MM_HEADSET | BIT_TV_OUT | BIT_USB_AUDIO_OUT; switch_send_event(state, 0); } else if (strncmp(buf, "35mm_mic", count - 1) == 0) { HS_LOG("Headset simulation: 35mm_mic"); state = BIT_HEADSET | BIT_35MM_HEADSET; switch_send_event(state, 1); } else if (strncmp(buf, "35mm_no_mic", count - 1) == 0) { HS_LOG("Headset simulation: 35mm_no_mic"); state = BIT_HEADSET_NO_MIC | BIT_35MM_HEADSET; switch_send_event(state, 1); } else if (strncmp(buf, "35mm_tv_out", count - 1) == 0) { HS_LOG("Headset simulation: 35mm_tv_out"); state = BIT_TV_OUT | BIT_35MM_HEADSET; switch_send_event(state, 1); } else if (strncmp(buf, "usb_audio", count - 1) == 0) { HS_LOG("Headset simulation: usb_audio"); state = BIT_USB_AUDIO_OUT; switch_send_event(state, 1); } else { HS_LOG("Invalid parameter"); return count; } return count; }
static ssize_t headset_simulate_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { unsigned long state = 0; HS_DBG(); state = MASK_35MM_HEADSET | MASK_USB_HEADSET; switch_send_event(state, 0); if (strncmp(buf, "headset_unplug", count - 1) == 0) { HS_LOG("Headset simulation: headset_unplug"); set_35mm_hw_state(0); hi->hs_35mm_type = HEADSET_UNPLUG; return count; } set_35mm_hw_state(1); state = BIT_35MM_HEADSET; if (strncmp(buf, "headset_no_mic", count - 1) == 0) { HS_LOG("Headset simulation: headset_no_mic"); hi->hs_35mm_type = HEADSET_NO_MIC; state |= BIT_HEADSET_NO_MIC; } else if (strncmp(buf, "headset_mic", count - 1) == 0) { HS_LOG("Headset simulation: headset_mic"); hi->hs_35mm_type = HEADSET_MIC; state |= BIT_HEADSET; } else if (strncmp(buf, "headset_metrico", count - 1) == 0) { HS_LOG("Headset simulation: headset_metrico"); hi->hs_35mm_type = HEADSET_METRICO; state |= BIT_HEADSET; } else if (strncmp(buf, "headset_unknown_mic", count - 1) == 0) { HS_LOG("Headset simulation: headset_unknown_mic"); hi->hs_35mm_type = HEADSET_UNKNOWN_MIC; state |= BIT_HEADSET_NO_MIC; } else if (strncmp(buf, "headset_tv_out", count - 1) == 0) { HS_LOG("Headset simulation: headset_tv_out"); hi->hs_35mm_type = HEADSET_TV_OUT; state |= BIT_TV_OUT; #if defined(CONFIG_FB_MSM_TVOUT) && defined(CONFIG_ARCH_MSM8X60) tvout_enable_detection(1); #endif } else if (strncmp(buf, "headset_indicator", count - 1) == 0) { HS_LOG("Headset simulation: headset_indicator"); hi->hs_35mm_type = HEADSET_INDICATOR; } else if (strncmp(buf, "headset_beats", count - 1) == 0) { HS_LOG("Headset simulation: headset_beats"); hi->hs_35mm_type = HEADSET_BEATS; state |= BIT_HEADSET; } else if (strncmp(buf, "headset_beats_solo", count - 1) == 0) { HS_LOG("Headset simulation: headset_beats_solo"); hi->hs_35mm_type = HEADSET_BEATS_SOLO; state |= BIT_HEADSET; } else { HS_LOG("Invalid parameter"); return count; } switch_send_event(state, 1); return count; }