static ssize_t cpufreq_ceiling_store(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, size_t n) { int val, ret = -EINVAL; if (sscanf(buf, "%d", &val) > 0) { if (val == 11 && !is_perf_lock_active(&user_cpu_ceiling_lock)) { perf_lock(&user_cpu_ceiling_lock); ret = n; } else if (val == 10 && is_perf_lock_active(&user_cpu_ceiling_lock)) { perf_unlock(&user_cpu_ceiling_lock); ret = n; } else { switch (val){ ceiling_level_wrapper(0, 1, PERF_LOCK_LOWEST); ceiling_level_wrapper(2, 3, PERF_LOCK_LOW); ceiling_level_wrapper(4, 5, PERF_LOCK_MEDIUM); ceiling_level_wrapper(6, 7, PERF_LOCK_HIGH); ceiling_level_wrapper(8, 9, PERF_LOCK_HIGHEST); default: break; } ret = n; } } return ret; }
static int mipi_himax_lcd_off(struct platform_device *pdev) { struct msm_fb_data_type *mfd; mfd = platform_get_drvdata(pdev); PR_DISP_DEBUG("%s\n", __func__); if (!mfd) return -ENODEV; if (mfd->key != MFD_KEY) return -EINVAL; mutex_lock(&cmdlock); #if defined CONFIG_FB_MSM_SELF_REFRESH #ifdef CONFIG_PERFLOCK if (!is_perf_lock_active(&himax_perf_lock)) perf_lock(&himax_perf_lock); #endif #endif mipi_dsi_cmds_tx(&himax_tx_buf, himax_display_off_cmd1, ARRAY_SIZE(himax_display_off_cmd1)); mipi_dsi_cmds_tx(&himax_tx_buf, himax_display_off_cmd2, ARRAY_SIZE(himax_display_off_cmd2)); #if defined CONFIG_FB_MSM_SELF_REFRESH #ifdef CONFIG_PERFLOCK if (is_perf_lock_active(&himax_perf_lock)) perf_unlock(&himax_perf_lock); #endif #endif mutex_unlock(&cmdlock); return 0; }
static inline void user_cpufreq_ceiling_lock(int level, int val) { if (val == 1 && !is_perf_lock_active(&user_ceiling_lock[level])) perf_lock(&user_ceiling_lock[level]); if (val == 0 && is_perf_lock_active(&user_ceiling_lock[level])) perf_unlock(&user_ceiling_lock[level]); }
static ssize_t perflock_store(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, size_t n) { int val; if (sscanf(buf, "%d", &val) > 0) { if (val == 1 && !is_perf_lock_active(&user_perf_lock)) perf_lock(&user_perf_lock); if (val == 0 && is_perf_lock_active(&user_perf_lock)) perf_unlock(&user_perf_lock); return n; } return -EINVAL; }
static ssize_t cpufreq_ceiling_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { int i, ceiling_enable = 0; for (i = 0; i < PERF_LOCK_INVALID; i++) if(is_perf_lock_active(&user_ceiling_lock[i]) != 0) ceiling_enable |= (1 << i); if (is_perf_lock_active(&user_cpu_ceiling_lock) != 0) ceiling_enable |= (1 << PERF_LOCK_INVALID); return sprintf(buf, "%d\n", ceiling_enable); }
static inline void user_cpufreq_ceiling_lock(int level, int val) { mutex_lock(&user_lock_mutex); if (val == 1) { if (!is_perf_lock_active(&user_limit_lock[level])) limit_lock(&user_limit_lock[level]); user_limit_lock_num[level]++; } if (val == 0) { if(user_limit_lock_num[level] > 0) user_limit_lock_num[level]--; if (user_limit_lock_num[level] == 0 && is_perf_lock_active(&user_limit_lock[level])) limit_unlock(&user_limit_lock[level]); } mutex_unlock(&user_lock_mutex); }
static void himax_self_refresh_switch(int on) { int vsync_timeout; mutex_lock(&cmdlock); wake_lock(&himax_idle_wake_lock); #ifdef CONFIG_PERFLOCK if (!is_perf_lock_active(&himax_perf_lock)) perf_lock(&himax_perf_lock); #endif if (on) { mipi_set_tx_power_mode(0); mipi_dsi_cmds_tx(&himax_tx_buf, video_to_cmd, ARRAY_SIZE(video_to_cmd)); mipi_set_tx_power_mode(1); disable_video_mode_clk(); } else { mipi_set_tx_power_mode(0); enable_irq(vsync_irq); mipi_dsi_cmds_tx(&himax_tx_buf, cmd_to_video, ARRAY_SIZE(cmd_to_video)); wait_vsync = 1; udelay(300); vsync_timeout = wait_event_timeout(himax_vsync_wait, himax_vsync_gpio || gpio_get_value(28), HZ/2); if (vsync_timeout == 0) PR_DISP_DEBUG("Lost vsync!\n"); disable_irq(vsync_irq); wait_vsync = 0; himax_vsync_gpio = 0; udelay(300); mipi_dsi_cmds_tx(&himax_tx_buf, vsync_hsync_cmds, ARRAY_SIZE(vsync_hsync_cmds)); enable_video_mode_clk(); if (vsync_timeout == 0) mipi_himax_panel_recover(); } #ifdef CONFIG_PERFLOCK if (is_perf_lock_active(&himax_perf_lock)) perf_unlock(&himax_perf_lock); #endif wake_unlock(&himax_idle_wake_lock); PR_DISP_DEBUG("[SR] %d\n", on); mutex_unlock(&cmdlock); }
static inline void user_perflock(int level, int val) { mutex_lock(&user_lock_mutex); if (val == 1) { if (!is_perf_locked()) pm_qos_update_request(&user_perf_lock_qos, SHSYS_PM_QOS_USER_PERFLOCK_LATENCY); if (!is_perf_lock_active(&user_perf_lock[level])) perf_lock(&user_perf_lock[level]); user_perf_lock_num[level]++; } if (val == 0) { if(user_perf_lock_num[level] > 0) user_perf_lock_num[level]--; if (user_perf_lock_num[level] == 0 && is_perf_lock_active(&user_perf_lock[level])) perf_unlock(&user_perf_lock[level]); if (!is_perf_locked()) pm_qos_update_request(&user_perf_lock_qos, PM_QOS_DEFAULT_VALUE); } mutex_unlock(&user_lock_mutex); }
static ssize_t perflock_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { int i, perflock_enable = 0; for (i = 0; i < PERF_LOCK_INVALID; i++) if(is_perf_lock_active(&user_perf_lock[i]) != 0) perflock_enable |= (1 << i); return sprintf(buf, "%d\n", perflock_enable); }
static void mipi_himax_cmi_display_on(struct msm_fb_data_type *mfd) { PR_DISP_DEBUG("%s+\n", __func__); mutex_lock(&cmdlock); #if defined CONFIG_FB_MSM_SELF_REFRESH #ifdef CONFIG_PERFLOCK if (!is_perf_lock_active(&himax_perf_lock)) perf_lock(&himax_perf_lock); #endif #endif mipi_dsi_cmds_tx(&himax_tx_buf, himax_CMI_display_on_cmds, ARRAY_SIZE(himax_CMI_display_on_cmds)); #if defined CONFIG_FB_MSM_SELF_REFRESH #ifdef CONFIG_PERFLOCK if (is_perf_lock_active(&himax_perf_lock)) perf_unlock(&himax_perf_lock); #endif #endif mutex_unlock(&cmdlock); }
static ssize_t perflock_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { /* bit[0] = lowest, bit[1] = low, bit[2] = medium, bit[3] = high, bit[4]=highest */ int i, perf_enable = 0; for (i = 0; i < PERF_LOCK_INVALID; i++) if(is_perf_lock_active(&user_perf_lock[i]) != 0) perf_enable |= (1 << i); return sprintf(buf, "%d\n", perf_enable); }
static void usbnet_unlock_perf(void) { pr_info("[USBNET] %s\n", __func__); #ifdef CONFIG_PERFLOCK if (is_perf_lock_active(&usbnet_perf_lock)) perf_unlock(&usbnet_perf_lock); #endif pm_qos_update_request(&usbnet_req_freq, (s32)PM_QOS_CPU_FREQ_MIN_DEFAULT_VALUE); pm_qos_update_request(&usbnet_req_cpus, (s32)PM_QOS_MIN_ONLINE_CPUS_DEFAULT_VALUE); is_usbnet_perf_locked = 0; }
static ssize_t cpufreq_ceiling_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { /* bit[0] = low, bit[1] = medium, bit[2] = high */ int i, ceiling_enable = 0; for (i = 0; i < CEILING_LEVEL_INVALID; i++) if(is_perf_lock_active(&user_cpufreq_ceiling[i]) != 0) ceiling_enable |= (1 << i); return sprintf(buf, "%d\n", ceiling_enable); }
static ssize_t limitlock_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { /* bit[0] = low, bit[1] = medium, bit[2] = high */ int i, ceiling_enable = 0; for (i = 0; i < PERF_LOCK_INVALID; i++) if(is_perf_lock_active(&user_limit_lock[i]) != 0) ceiling_enable |= (1 << i); return sprintf(buf, "%d\n", ceiling_enable); }
/* ----------------------------------------------------------------------------- // Common Routine Implementation // ----------------------------------------------------------------------------- */ static int mipi_himax_lcd_on(struct platform_device *pdev) { struct msm_fb_data_type *mfd; struct mipi_panel_info *mipi; static int turn_on_logo = 1; mfd = platform_get_drvdata(pdev); if (!mfd) return -ENODEV; if (mfd->key != MFD_KEY) return -EINVAL; mipi = &mfd->panel_info.mipi; mutex_lock(&cmdlock); #if defined CONFIG_FB_MSM_SELF_REFRESH #ifdef CONFIG_PERFLOCK if (!is_perf_lock_active(&himax_perf_lock)) perf_lock(&himax_perf_lock); #endif #endif if (mipi->mode == DSI_VIDEO_MODE) { PR_DISP_DEBUG("DSI_VIDEO_MODE.%s", __func__); if (panel_type == PANEL_ID_VIG_CHIMEI_HX) { PR_DISP_DEBUG("Panel type = PANEL_ID_VIG_CHIMEI_HX\n"); mipi_dsi_cmds_tx(&himax_tx_buf, himax_CMI_video_on_cmds, ARRAY_SIZE(himax_CMI_video_on_cmds)); } else if (panel_type == PANEL_ID_VIG_CHIMEI_HX_C25) { PR_DISP_DEBUG("Panel type = PANEL_ID_VIG_CHIMEI_HX_C25\n"); mipi_dsi_cmds_tx(&himax_tx_buf, himax_CMI_video_on_c25_cmds, ARRAY_SIZE(himax_CMI_video_on_c25_cmds)); } else if (panel_type == PANEL_ID_VIG_CHIMEI_HX_C3) { PR_DISP_DEBUG("Panel type = PANEL_ID_VIG_CHIMEI_HX_C3\n"); mipi_dsi_cmds_tx(&himax_tx_buf, himax_CMI_video_on_c3_cmds, ARRAY_SIZE(himax_CMI_video_on_c3_cmds)); } else if (panel_type == PANEL_ID_VIG_SHARP_HX_C3) { PR_DISP_DEBUG("Panel type = PANEL_ID_VIG_SHARP_HX_C3\n"); mipi_dsi_cmds_tx(&himax_tx_buf, himax_video_on_c3_cmds, ARRAY_SIZE(himax_video_on_c3_cmds)); } else if (panel_type == PANEL_ID_VIG_SHARP_HX_C25) { PR_DISP_DEBUG("Panel type = PANEL_ID_VIG_SHARP_HX_C25\n"); mipi_dsi_cmds_tx(&himax_tx_buf, himax_video_on_c2_cmds, ARRAY_SIZE(himax_video_on_c2_cmds)); } else if (panel_type == PANEL_ID_VIG_SHARP_HX_C2) { PR_DISP_DEBUG("Panel type = PANEL_ID_VIG_SHARP_HX_C2\n"); mipi_dsi_cmds_tx(&himax_tx_buf, himax_video_on_c2_cmds, ARRAY_SIZE(himax_video_on_c2_cmds)); } else { PR_DISP_DEBUG("Panel type = PANEL_ID_VIG_SHARP_HX\n"); mipi_dsi_cmds_tx(&himax_tx_buf, himax_video_on_cmds, ARRAY_SIZE(himax_video_on_cmds)); } if (turn_on_logo && board_mfg_mode() == 0) { mipi_dsi_cmds_tx(&himax_tx_buf, himax_show_logo_cmds, ARRAY_SIZE(himax_show_logo_cmds)); turn_on_logo = 0; } } else { PR_DISP_DEBUG("DSI_CMD_MODE.%s", __func__); if (panel_type == PANEL_ID_VIG_CHIMEI_HX) { mipi_dsi_cmds_tx(&himax_tx_buf, himax_CMI_cmd_on_cmds, ARRAY_SIZE(himax_CMI_cmd_on_cmds)); } else { mipi_dsi_cmds_tx(&himax_tx_buf, himax_cmd_on_cmds, ARRAY_SIZE(himax_cmd_on_cmds)); } mipi_dsi_cmd_bta_sw_trigger(); mipi_himax_manufacture_id(); } #if defined CONFIG_FB_MSM_SELF_REFRESH #ifdef CONFIG_PERFLOCK if (is_perf_lock_active(&himax_perf_lock)) perf_unlock(&himax_perf_lock); #endif #endif mutex_unlock(&cmdlock); return 0; }
static ssize_t perflock_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { return sprintf(buf, "%d\n", (is_perf_lock_active(&user_perf_lock) != 0)); }