示例#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 void ImmVibeSPI_Control(struct work_struct *work)
{
	if(vib_state) {
		ImmVibeSPI_ForceOut_AmpEnable(0);
		vibrator_pwm_set(1,127);
	}
	else {
		ImmVibeSPI_ForceOut_AmpDisable(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  {
示例#5
0
static int vibrator_init(void)
{
    int rc;

    snddev_reg_l1 = NULL;

    /* GPIO setting for Motor EN*/
    rc = gpio_request(GPIO_LIN_MOTOR_EN, "lin_motor_en");
    if (rc) {
        pr_err("%s: GPIO_LIN_MOTOR_EN %d request failed\n",
            __func__, GPIO_LIN_MOTOR_EN);
        return 0;
    }

//    gpio_direction_output(GPIO_LIN_MOTOR_EN, 0);

//    gpio_free(GPIO_LIN_MOTOR_EN);

    printk("[LGE:vibrator] GPIO_LIN_MOTOR_EN gpio value :%d  \n", gpio_get_value(GPIO_LIN_MOTOR_EN));

	vibrator_ic_enable_set(0);
	vibrator_pwm_set(0,0);
//	vibrator_power_set(0);

#if 0
    /* GPIO setting for Motor PWM */
    rc = gpio_request(GPIO_LIN_MOTOR_PWM, "lin_motor_pwn");
    if (rc) {
            pr_err("%s: GPIO_LIN_MOTOR_PWM %d request failed\n",
                __func__, GPIO_LIN_MOTOR_PWM);
            return 0;
    }

    gpio_direction_output(GPIO_LIN_MOTOR_PWM, 1);
    gpio_free(GPIO_LIN_MOTOR_PWM);
    printk("[LGE:vibrator] GPIO_LIN_MOTOR_PWM  \n");
#endif

    return 0;
}