コード例 #1
0
int adreno_idler(struct devfreq_dev_status stats, struct devfreq *devfreq,
		 unsigned long *freq)
{
	if (!adreno_idler_active)
		return 0;

	if (stats.busy_time < idleworkload) {
		/* busy_time >= idleworkload should be considered as a non-idle workload. */
		if (!idle_lasttime)
			idle_lasttime = get_time_inms();
		if (*freq == devfreq->profile->freq_table[devfreq->profile->max_state - 1]) {
			/* frequency is already at its lowest.
			   No need to calculate things, so bail out. */
			return 1;
		}
		if (idle_lasttime + idlewaitms <= get_time_inms() &&
		    stats.busy_time * 100 < stats.total_time * downdifferenctial) {
			/* We are idle for idlewaitms! Ramp down the frequency now. */
			*freq = devfreq->profile->freq_table[devfreq->profile->max_state - 1];
			return 1;
		}
	} else {
		/* This is the case where msm-adreno-tz don't use the lowest frequency.
		   Mimic this behavior by bumping up the frequency. */
		idle_lasttime = 0;
		*freq = devfreq->profile->freq_table[devfreq->profile->max_state - 2];
		/* Do not return 1 here and allow rest of the algorithm to
		   figure out the appropriate frequency for current workload.
		   It can even set it back to lowest frequency. */
	}
	return 0;
}
コード例 #2
0
static void gpio_keys_report_event(struct gpio_button_data *bdata)
{
	static int64_t homekey_lasttime = 0;
	static int homekey_count = 0;
	
	struct gpio_keys_button *button = bdata->button;
	struct input_dev *input = bdata->input;
	unsigned int type = button->type ?: EV_KEY;
	int state = (gpio_get_value_cansleep(button->gpio) ? 1 : 0)
		^ button->active_low;

	//mdnie negative effect toggle by gm
	if((button->code == HOME_KEY_VAL) && mdnie_shortcut_enabled)
	{
		if(state) {
			if (  get_time_inms() - homekey_lasttime < homekey_trg_ms) {
				homekey_count++;
				printk(KERN_INFO "repeated home_key action %d.\n", homekey_count);
			}
			else
			{
				homekey_count = 0;
			}
		}
		else {
			if(homekey_count>=homekey_trg_cnt - 1)
			{
				mdnie_toggle_negative();
				homekey_count = 0;
			}
			homekey_lasttime = get_time_inms();
		}
	}

	if (type == EV_ABS) {
		if (state)
			input_event(input, type, button->code, button->value);
	} else {
		if (bdata->wakeup && !state) {
			input_event(input, type, button->code, !state);
			if (button->code == KEY_POWER)
				printk(KERN_DEBUG"[keys] f PWR %d\n", !state);
		}

		bdata->key_state = !!state;
		bdata->wakeup = false;

		input_event(input, type, button->code, !!state);
		if (button->code == KEY_POWER)
			printk(KERN_DEBUG"[keys]PWR %d\n", !!state);
		if(!!state) gpu_boost_on_touch();
	}

	input_sync(input);
}
コード例 #3
0
static void gpio_keys_gpio_report_event(struct gpio_button_data *bdata)
{
	static int64_t homekey_lasttime = 0;
	static int homekey_count = 0;
	const struct gpio_keys_button *button = bdata->button;
	struct input_dev *input = bdata->input;
	unsigned int type = button->type ?: EV_KEY;
	int state = (gpio_get_value_cansleep(button->gpio) ? 1 : 0) ^ button->active_low;

	printk(KERN_INFO "%s: %s key is %s\n",
		__func__, button->desc, state ? "pressed" : "released");

	if (type == EV_ABS) {
		if (state)
			input_event(input, type, button->code, button->value);
	} else {
		input_event(input, type, button->code, !!state);
	}
	input_sync(input);

	if (!power_suspended) {
		//mdnie negative effect toggle by gm
		if (button->code == 172) {
			if (state) {
				gpio_sync_worker(false);
				if (get_time_inms() - homekey_lasttime < 300) {
					homekey_count++;
					printk(KERN_INFO "repeated home_key action %d.\n", homekey_count);
				} else {
					homekey_count = 0;
				}
			} else {
				if (homekey_count == 3) {
					mdnie_toggle_negative();
					homekey_count = 0;
				}
				homekey_lasttime = get_time_inms();
			}
		}
	}
}
コード例 #4
0
static void gpio_keys_report_event(struct gpio_button_data *bdata)
{
	static int64_t homekey_lasttime = 0;
	static int homekey_count = 0;

	struct gpio_keys_button *button = bdata->button;
	struct input_dev *input = bdata->input;
	unsigned int type = button->type ?: EV_KEY;
	int state = (gpio_get_value_cansleep(button->gpio) ? 1 : 0)
		^ button->active_low;
#ifdef CONFIG_MACH_GC1
	struct gpio_keys_drvdata *ddata = input_get_drvdata(input);
	struct gpio_button_data *tmp_bdata;
	static bool overlapped;
	static unsigned int hotkey;
	unsigned int index_hotkey = 0;
	bool zoomkey = false;

#ifdef CONFIG_FAST_BOOT

	/*Fake pwr off control*/
	if (fake_shut_down || fake_pressed) {
		if (button->code == KEY_POWER) {
			if (!!state) {
				printk(KERN_DEBUG"[Keys] start fake check\n");
				fake_pressed = true;
				if (!wake_lock_active(&fake_lock))
					wake_lock(&fake_lock);
				mod_timer(&fake_timer,
					jiffies + msecs_to_jiffies(500));
			} else {
				printk(KERN_DEBUG"[Keys] end fake checkPwr 0\n");
				fake_pressed = false;
				if (wake_lock_active(&fake_lock))
					wake_unlock(&fake_lock);
			}
		}
		bdata->wakeup = false;
		return ;
	}
#endif
	if (system_rev < 6 && system_rev >= 2) {
		if (overlapped) {
			if (hotkey == button->code && !state) {
				bdata->key_state = !!state;
				bdata->wakeup = false;
				overlapped = false;
#ifdef CONFIG_SAMSUNG_PRODUCT_SHIP
				printk(KERN_DEBUG"[KEYS] Ignored\n");
#else
				printk(KERN_DEBUG"[KEYS] Ignore %d %d\n",
						hotkey, state);
#endif
				return;
			}
		}

		gpio_keys_check_zoom_exception(button->code, &zoomkey,
				&hotkey, &index_hotkey);
	} else if (system_rev >= 6) {
		/*exclusive check for zoom dial*/
		unsigned int zoom_type = 0;
		unsigned int current_zoom_state = 0;
		bool pass_cur_event = false;

		if (is_zoom_key(button->code, &zoom_type)) {
			current_zoom_state = check_zoom_state(ddata);

			if (zoom_type == ZOOM_IN
				&& current_zoom_state == ZOOM_OUT)
					pass_cur_event = true;
			else if (zoom_type == ZOOM_OUT
				&& current_zoom_state == ZOOM_IN)
					pass_cur_event = true;

			if (pass_cur_event) {
#if !defined(CONFIG_SAMSUNG_PRODUCT_SHIP)
				printk(KERN_DEBUG "[keys] Pass zoom"
					"current %d, code %d\n",
					current_zoom_state, button->code);
#endif
				return ;
			}
		}
	}
#endif

	/* mdnie negative effect toggle by gm */
	if ((button->code == HOME_KEY_VAL || button->code == KEY_HOME || button->code == KEY_HOMEPAGE) &&
				mdnie_shortcut_enabled) {
		if (state) {
			if (get_time_inms() - homekey_lasttime < homekey_trg_ms) {
				homekey_count++;
				printk(KERN_INFO "repeated home_key action %d.\n", homekey_count);
			} else {
				homekey_count = 0;
			}
		} else {
			if (homekey_count>=homekey_trg_cnt - 1) {
				mdnie_toggle_negative();
				homekey_count = 0;
			}
			homekey_lasttime = get_time_inms();
		}
	}

	if (type == EV_ABS) {
		if (state) {
			input_event(input, type, button->code, button->value);
			input_sync(input);
		}
	} else {
		if (bdata->wakeup && !state) {
			input_event(input, type, button->code, !state);
			input_sync(input);
			if (button->code == KEY_POWER)
				printk(KERN_DEBUG"[keys] f PWR %d\n", !state);
		}

		bdata->key_state = !!state;
		bdata->wakeup = false;

#ifdef CONFIG_MACH_GC1
		if (system_rev < 6 && system_rev >= 2
				&& zoomkey && state) {
			tmp_bdata = &ddata->data[index_hotkey];

			if (tmp_bdata->key_state) {
#ifdef CONFIG_SAMSUNG_PRODUCT_SHIP
				printk(KERN_DEBUG"[KEYS] overlapped\n");
#else
				printk(KERN_DEBUG"[KEYS] overlapped. Forced release c %d h %d\n",
					tmp_bdata->button->code, hotkey);
#endif
				input_event(input, type, hotkey, 0);
				input_sync(input);

				overlapped = true;
			}
		}

		if (system_rev >= 6) {
			/* forced release*/
			if (button->code == KEY_CAMERA_ZOOMIN && !state) {
				tmp_bdata = &ddata->data[5];
				if (tmp_bdata->key_state) {
					input_event(input, type, 0x221,
						!!state);
					input_sync(input);
					printk(KERN_DEBUG"[KEYS] forced 0x221 key release\n");
				}
			}

			if (button->code == KEY_CAMERA_ZOOMOUT && !state) {
				tmp_bdata = &ddata->data[6];
				if (tmp_bdata->key_state) {
					input_event(input, type, 0x222,
						!!state);
					input_sync(input);
					printk(KERN_DEBUG"[KEYS] forced 0x222 key release\n");
				}
			}

			/*forced press*/
			if (button->code == 0x221 && state) {
				tmp_bdata = &ddata->data[3];
				if (!tmp_bdata->key_state) {
					input_event(input, type,
						KEY_CAMERA_ZOOMIN, !!state);
					input_sync(input);
					printk(KERN_DEBUG"[KEYS] forced 0x215 key press\n");
				}
			}

			if (button->code == 0x222 && state) {
				tmp_bdata = &ddata->data[4];
				if (!tmp_bdata->key_state) {
					input_event(input, type,
						KEY_CAMERA_ZOOMOUT, !!state);
					input_sync(input);
					printk(KERN_DEBUG"[KEYS] forced 0x216 key press\n");
				}
			}
		}

#endif
		input_event(input, type, button->code, !!state);
		input_sync(input);

		if (button->code == KEY_POWER)
			printk(KERN_DEBUG"[keys]PWR %d\n", !!state);
	}
}
コード例 #5
0
ファイル: gpio_keys.c プロジェクト: gadido30/bigfatwifi
static void gpio_keys_report_event(struct gpio_button_data *bdata)
{
	static int64_t homekey_lasttime = 0;
	static int homekey_count = 0;
	struct gpio_keys_button *button = bdata->button;
	struct input_dev *input = bdata->input;
	unsigned int type = button->type ?: EV_KEY;
	int state = (gpio_get_value_cansleep(button->gpio) ? 1 : 0)
		^ button->active_low;
	//mdnie negative effect toggle by gm
	if(button->code == HOME_KEY_VAL)
	{
		if(state) {
			if (  get_time_inms() - homekey_lasttime < 300) {
				homekey_count++;
				printk(KERN_INFO "repeated home_key action %d.\n", homekey_count);
			}
			else
			{
				homekey_count = 0;
			}
		}
		else {
			if(homekey_count==3)
			{
				mdnie_toggle_negative();
				homekey_count = 0;
			}
			homekey_lasttime = get_time_inms();
		}
	}
#ifdef CONFIG_MACH_GC1
	struct gpio_keys_drvdata *ddata = input_get_drvdata(input);
	struct gpio_button_data *tmp_bdata;
	static bool overlapped;
	static unsigned int hotkey;
	unsigned int index_hotkey = 0;
	bool zoomkey = false;

#ifdef CONFIG_FAST_BOOT
	/*Fake pwr off control*/
	if (fake_shut_down) {
		if (button->code == KEY_POWER) {
			if (!!state) {
				printk(KERN_DEBUG"[Keys] start fake check\n");
				fake_pressed = true;
				mod_timer(&fake_timer,
					jiffies + msecs_to_jiffies(1000));
			} else {
				printk(KERN_DEBUG"[Keys] end fake checkPwr 0\n");
				fake_pressed = false;
			}
		}
		return ;
	}
#endif
	if (system_rev < 6 && system_rev >= 2) {
		if (overlapped) {
			if (hotkey == button->code && !state) {
				bdata->key_state = !!state;
				bdata->wakeup = false;
				overlapped = false;
#ifdef CONFIG_SAMSUNG_PRODUCT_SHIP
				printk(KERN_DEBUG"[KEYS] Ignored\n");
#else
				printk(KERN_DEBUG"[KEYS] Ignore %d %d\n",
						hotkey, state);
#endif
				return;
			}
		}

		gpio_keys_check_zoom_exception(button->code, &zoomkey,
				&hotkey, &index_hotkey);
	}
#endif

	if (type == EV_ABS) {
		if (state) {
			input_event(input, type, button->code, button->value);
			input_sync(input);
			}
	} else {
		if (bdata->wakeup && !state) {
			input_event(input, type, button->code, !state);
			input_sync(input);
			if (button->code == KEY_POWER)
				printk(KERN_DEBUG"[keys] f PWR %d\n", !state);
		}

		bdata->key_state = !!state;
		bdata->wakeup = false;


#ifdef CONFIG_MACH_GC1
		if (system_rev < 6 && system_rev >= 2
				&& zoomkey && state) {
			tmp_bdata = &ddata->data[index_hotkey];

			if (tmp_bdata->key_state) {
#ifdef CONFIG_SAMSUNG_PRODUCT_SHIP
				printk(KERN_DEBUG"[KEYS] overlapped\n");
#else
				printk(KERN_DEBUG"[KEYS] overlapped. Forced release c %d h %d\n",
					tmp_bdata->button->code, hotkey);
#endif
				input_event(input, type, hotkey, 0);
				input_sync(input);

				overlapped = true;
			}
		}
#endif
#ifdef CONFIG_SENSORS_HALL
	      if(!flip_cover_open && button->code == KEY_POWER){
	        printk(KERN_DEBUG" cover closed...ignoring PWR button");
	      }else{ 
#endif
		input_event(input, type, button->code, !!state);
		input_sync(input);
#ifdef CONFIG_SENSORS_HALL
	      }
#endif
		if (button->code == KEY_POWER)
			printk(KERN_DEBUG"[keys]PWR %d\n", !!state);
	}
}