예제 #1
0
static ssize_t
immersion_enable_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
{
	if (sscanf(buf, "%d", &val) != 1)
		return -EINVAL;

	if(val == 1) {
		printk("immersion_enable_store() : vibrator enable\n");
		vibrator_power_set(1);
		vibratror_pwm_gpio_OnOFF(1);
		vibrator_pwm_set(1, 80, GP_CLK_N_DEFAULT);
		vibrator_ic_enable_set(1);

		DbgRecorderReset((val));
		DbgRecord((val,";------- TSPDRV_ENABLE_AMP ---------\n"));
	}
	else if (val == 0) {
		printk("immersion_enable_store() : vibrator disable\n");
		vibrator_ic_enable_set(0);
		vibrator_pwm_set(0, 0, GP_CLK_N_DEFAULT);
        vibratror_pwm_gpio_OnOFF(0);
		vibrator_power_set(0);
	}

	return count;
}
static int vibrator_init(void)
{
	int rc;

	/* GPIO function setting */
	msm_gpiomux_install(gpio3_vibrator_configs,
			ARRAY_SIZE(gpio3_vibrator_configs));

	rc = gpio_request_one(gpio_vibrator_en, GPIOF_OUT_INIT_LOW, "motor_en");
	if (rc < 0) {
		pr_err("%s: MOTOR_EN %d request failed\n",
				__func__, gpio_vibrator_en);
		return rc;
	}

	vreg_l16 = regulator_get(NULL, "vibrator");   //2.6 ~ 3V
	if (IS_ERR(vreg_l16)) {
		rc = PTR_ERR(vreg_l16);
		pr_err("%s: regulator get of vibrator failed\n",
				__func__);
		goto err_regulator_get;
	}

	vibrator_clock_init();
	vibrator_ic_enable_set(0);
	vibrator_pwm_set(0, 0, GP_CLK_N_DEFAULT);
	vibrator_power_set(0);

	return 0;

err_regulator_get:
	gpio_free(gpio_vibrator_en);
	return rc;
}
예제 #3
0
static ssize_t
immersion_enable_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
{
	if (sscanf(buf, "%d", &val) != 1)
		return -EINVAL;

	if (val == 0) {
		printk("immersion_enable_store() : vibrator disable\n");
		vibrator_ic_enable_set(0, &vib);
		vibrator_pwm_set(0, 0, GP_CLK_N_DEFAULT);
		vibrator_power_set(0, &vib);
		clk_disable_unprepare(cam_gp1_clk);
	} else if((val >> 7) <= 0) {
		printk("immersion_enable_store() : vibrator enable\n");
		clk_prepare_enable(cam_gp1_clk);
		vibrator_power_set(1, &vib);
		vibrator_pwm_set(1, val, GP_CLK_N_DEFAULT);
		vibrator_ic_enable_set(1, &vib);
		DbgRecorderReset((val));
		DbgRecord((val,";------- TSPDRV_ENABLE_AMP ---------\n"));
	} else  {