示例#1
0
void zylonite_enable_lcd_smart_pins(void)
{
	mhn_mfp_set_configs(zylonite_lcd_smart_pins, ARRAY_SIZE(zylonite_lcd_smart_pins));

	mhn_gpio_set_direction(MFP_L_DD_17, GPIO_DIR_OUT);
	mhn_gpio_set_direction(MFP_L_VSYNC, GPIO_DIR_OUT);
	mhn_gpio_set_level(MFP_L_DD_17, GPIO_LEVEL_HIGH);
	mhn_gpio_set_level(MFP_L_VSYNC, GPIO_LEVEL_LOW);
}
示例#2
0
/*
** Called to enable amp (enable output force)
*/
IMMVIBESPIAPI VibeStatus ImmVibeSPI_ForceOut_AmpEnable(VibeUInt8 nActuatorIndex)
{
#if 0
#error Please review the code between the #if and #endif

    if (!g_bAmpEnabled)
    {
        DbgOut((KERN_DEBUG "ImmVibeSPI_ForceOut_AmpEnable.\n"));

        g_bAmpEnabled = true;

#if 0
        /* 
        ** Ensure the PWM frequency is at the expected value. These 2 lines of code
        ** can be removed if no other application alters the PWM frequency.
        */
        PWM_CTRL  = 0;                  /* 13Mhz / (0 + 1) = 13MHz */
        PWM_PERIOD = PWM_DUTY_MAX;      /* 13Mhz / (PWM_DUTY_MAX + 1) = 22.4kHz */

        /* Set duty cycle to 50% */
        PWM_DUTY = (PWM_DUTY_MAX+1)>>1; /* Duty cycle range = [0, PWM_DUTY_MAX] */

        /* Enable amp */
        mhn_gpio_set_level(GPIO_EN, GPIO_LEVEL_HIGH);
        mz_ops.bstat |= HN_BATTERY_MOTOR;
#endif
    }
示例#3
0
/*
** Called to disable amp (disable output force)
*/
IMMVIBESPIAPI VibeStatus ImmVibeSPI_ForceOut_AmpDisable(VibeUInt8 nActuatorIndex)
{
#if 0
#error Please review the code between the #if and #endif

    if (g_bAmpEnabled)
    {
        DbgOut((KERN_DEBUG "ImmVibeSPI_ForceOut_AmpDisable.\n"));

        g_bAmpEnabled = false;

#if 0
        mhn_gpio_set_level(GPIO_EN, GPIO_LEVEL_LOW);
	    mz_ops.bstat &= ~HN_BATTERY_MOTOR;
#endif
    }
#endif
    if (g_bAmpEnabled)
    {
		g_bAmpEnabled = false;
		
		//pwm_config(Immvib_pwm, 0, freq_count/2);
		//pwm_disable(Immvib_pwm);
		
		//gpio_request(GPIO_VIBTONE_EN1, "GPIO_VIBTONE_EN1");
		//gpio_direction_output(GPIO_VIBTONE_EN1, GPIO_LEVEL_LOW);
		//gpio_direction_output(GPIO_VIBTONE_PWM, GPIO_LEVEL_LOW);
		//gpio_free(GPIO_VIBTONE_EN1);
		gpio_set_value(GPIO_VIBTONE_EN1, GPIO_LEVEL_LOW);
		clk_disable(android_vib_clk);
    }

    return VIBE_S_SUCCESS;
}
示例#4
0
/*
** Called to disable amp (disable output force)
*/
IMMVIBESPIAPI VibeStatus ImmVibeSPI_ForceOut_AmpDisable(VibeUInt8 nActuatorIndex)
{
#if 0
#error Please review the code between the #if and #endif

    if (g_bAmpEnabled)
    {
        DbgOut((KERN_DEBUG "ImmVibeSPI_ForceOut_AmpDisable.\n"));

        g_bAmpEnabled = false;

#if 0
        mhn_gpio_set_level(GPIO_EN, GPIO_LEVEL_LOW);
	    mz_ops.bstat &= ~HN_BATTERY_MOTOR;
#endif
    }
#endif
//unsigned long flags;

//		spin_lock_irqsave(&(vib_lock), flags);
		if (g_bAmpEnabled) {
	//		printk(KERN_DEBUG "ImmVibeSPI_ForceOut_AmpDisable.\n");
			g_bAmpEnabled = false;
			gpio_set_value(OMAP_GPIO_VIBTONE_EN, GPIO_LEVEL_LOW);
//			omap_dm_timer_stop(gptimer);	
		}
//		spin_unlock_irqrestore(&(vib_lock), flags);	
		return VIBE_S_SUCCESS;

}
示例#5
0
/*
** Called to disable amp (disable output force)
*/
IMMVIBESPIAPI VibeStatus ImmVibeSPI_ForceOut_AmpDisable(VibeUInt8 nActuatorIndex)
{
#if 0
#error Please review the code between the #if and #endif

    if (g_bAmpEnabled)
    {
        DbgOut((KERN_DEBUG "ImmVibeSPI_ForceOut_AmpDisable.\n"));

        g_bAmpEnabled = false;

#if 0
        mhn_gpio_set_level(GPIO_EN, GPIO_LEVEL_LOW);
	    mz_ops.bstat &= ~HN_BATTERY_MOTOR;
#endif
    }
#endif
    if (g_bAmpEnabled)
    {
		g_bAmpEnabled = false;				
		vib_state = 0;
		set_vibetonz(vib_state);  /*queue_work() not required as Touch Sense Player serialises(schedules) all the calls*/
    }

	return VIBE_S_SUCCESS;
}
示例#6
0
/*
** Called to disable amp (disable output force)
*/
IMMVIBESPIAPI VibeStatus ImmVibeSPI_ForceOut_AmpDisable(VibeUInt8 nActuatorIndex)
{
#if 0
#error Please review the code between the #if and #endif

    if (g_bAmpEnabled)
    {
        DbgOut((KERN_DEBUG "ImmVibeSPI_ForceOut_AmpDisable.\n"));

        g_bAmpEnabled = false;

#if 0
        mhn_gpio_set_level(GPIO_EN, GPIO_LEVEL_LOW);
	    mz_ops.bstat &= ~HN_BATTERY_MOTOR;
#endif
    }
#endif


    if (g_bAmpEnabled)
    {
		g_bAmpEnabled = false;
		
		pwm_config(Immvib_pwm, 0, freq_count/2);
		pwm_disable(Immvib_pwm);
		//gpio_request(GPIO_VIBTONE_EN1, "GPIO_VIBTONE_EN1");
		gpio_direction_output(vib_plat_data.vib_enable_gpio,0);
		gpio_direction_input(vib_plat_data.vib_enable_gpio);
		s3c_gpio_setpull(vib_plat_data.vib_enable_gpio,S3C_GPIO_PULL_DOWN);
		//gpio_free(GPIO_VIBTONE_EN1);
    }

	return VIBE_S_SUCCESS;
}
示例#7
0
void zylonite_enable_lcd_pins(void)
{
	mhn_mfp_set_configs(zylonite_lcd_pins, ARRAY_SIZE(zylonite_lcd_pins));
	if (lcd_id & 0x20) { /* OLED/VGA/QVGA panel */
		mhn_gpio_set_direction(MFP_L_DD_17, GPIO_DIR_OUT);
		mhn_gpio_set_direction(MFP_L_VSYNC, GPIO_DIR_OUT);

		if(lcd_id & 0x01) {  /* REV1.2 Lead_free panel */
			mhn_gpio_set_level(MFP_L_DD_17, GPIO_LEVEL_LOW);
#ifdef CONFIG_FB_PXA_LCD_QVGA
			/* force L_V_SYNC (MODE) HIGH */
			mhn_gpio_set_level(MFP_L_VSYNC, GPIO_LEVEL_HIGH);
#endif
#ifdef CONFIG_FB_PXA_LCD_VGA
			/* force L_V_SYNC (MODE) LOW */
			mhn_gpio_set_level(MFP_L_VSYNC, GPIO_LEVEL_LOW);
#endif
		} else { /* REV1.1 Lead panel */
			mhn_mfp_set_afds(MFP_L_BIAS, MFP_AF0, MFP_DS01X);
			mhn_gpio_set_direction(MFP_L_BIAS, GPIO_DIR_OUT);
			mhn_gpio_set_level(MFP_L_BIAS, GPIO_LEVEL_LOW);

		mhn_gpio_set_level(MFP_L_DD_17, GPIO_LEVEL_LOW);
#ifdef CONFIG_FB_PXA_LCD_QVGA
			/* force L_V_SYNC (MODE) LOW */
			mhn_gpio_set_level(MFP_L_VSYNC, GPIO_LEVEL_LOW);
#endif
#ifdef CONFIG_FB_PXA_LCD_VGA
			/* force L_V_SYNC (MODE) HIGH */
			mhn_gpio_set_level(MFP_L_VSYNC, GPIO_LEVEL_HIGH);
#endif
		}
	}
}
示例#8
0
void zylonite_enable_u2d_pins(void)
{
#if defined(CONFIG_PXA300)
	mhn_gpio_set_direction(MFP_UTMI_SWITCH, GPIO_DIR_OUT);
	mhn_gpio_set_level(MFP_UTMI_SWITCH, GPIO_LEVEL_HIGH);

	mhn_gpio_set_direction(MFP_UTMI_TEST_EN, GPIO_DIR_OUT);
	mhn_gpio_set_level(MFP_UTMI_TEST_EN, GPIO_LEVEL_LOW);
#elif defined(CONFIG_PXA310)
	mhn_gpio_set_direction(MFP_ULPI_RESET, GPIO_DIR_OUT);
	mhn_gpio_set_level(MFP_ULPI_RESET, GPIO_LEVEL_HIGH);

	mhn_mfp_set_afds(MFP_PIN_ULPI_STP, 0, 0);
	mhn_mfp_set_afds(MFP_PIN_ULPI_DIR, 0, 0);
	mhn_mfp_set_afds(MFP_PIN_ULPI_NXT, 0, 0);
#endif
	mhn_mfp_set_configs(zylonite_u2d_pins, ARRAY_SIZE(zylonite_u2d_pins));
}
示例#9
0
static void zylonite_irda_transceiver_mode(struct device *dev, int mode)
{
        unsigned long flags;
	static int irda_mfp_init = 0;

	if (!irda_mfp_init) {
		printk(KERN_INFO "zylonite_irda_transceiver_mode: init\n");
		mhn_mfp_set_afds(MFP_CIR_ON_PWM, MFP_AF0, MFP_DS03X);
		mhn_mfp_set_afds(MFP_IR_SHDN_N_GPIO, MFP_AF0, MFP_DS03X);
		mhn_gpio_set_direction(MFP_CIR_ON_PWM, GPIO_DIR_OUT);
		mhn_gpio_set_direction(MFP_IR_SHDN_N_GPIO,  GPIO_DIR_OUT);
		mhn_gpio_set_level(MFP_CIR_ON_PWM, 0);
		mhn_gpio_set_level(MFP_IR_SHDN_N_GPIO, 1);

		irda_mfp_init = 1;
	}

        local_irq_save(flags);
        if (mode & IR_SIRMODE) {
		printk(KERN_INFO "zylonite_irda_transceiver_mode: SIR\n");
		mhn_gpio_set_level(MFP_CIR_ON_PWM, 0);
		mhn_gpio_set_level(MFP_IR_SHDN_N_GPIO, 0);
        } else if (mode & IR_FIRMODE) {
		/* do not support FIR */
        }
        if (mode & IR_OFF) {
		printk(KERN_INFO "zylonite_irda_transceiver_mode: OFF\n");
		mhn_gpio_set_level(MFP_CIR_ON_PWM, 0);
		mhn_gpio_set_level(MFP_IR_SHDN_N_GPIO, 1);
        }
        local_irq_restore(flags);
}
示例#10
0
/*
** Called to disable amp (disable output force)
*/
IMMVIBESPIAPI VibeStatus ImmVibeSPI_ForceOut_AmpDisable(VibeUInt8 nActuatorIndex)
{
#if 0
#error Please review the code between the #if and #endif

    if (g_bAmpEnabled)
    {
        DbgOut((KERN_DEBUG "ImmVibeSPI_ForceOut_AmpDisable.\n"));

        g_bAmpEnabled = false;

#if 0
        mhn_gpio_set_level(GPIO_EN, GPIO_LEVEL_LOW);
	    mz_ops.bstat &= ~HN_BATTERY_MOTOR;
#endif
    }
#endif
    if (g_bAmpEnabled)
    {
		g_bAmpEnabled = false;
		
		//pwm_config(Immvib_pwm, 0, freq_count/2);
		//pwm_disable(Immvib_pwm);
		
		//gpio_request(GPIO_VIBTONE_EN1, "GPIO_VIBTONE_EN1");
		//gpio_direction_output(GPIO_VIBTONE_EN1, GPIO_LEVEL_LOW);
		//gpio_direction_output(GPIO_VIBTONE_PWM, GPIO_LEVEL_LOW);
		//gpio_free(GPIO_VIBTONE_EN1);
		gpio_set_value(GPIO_VIBTONE_EN1, GPIO_LEVEL_LOW);
		
		/* Init - fix for android_vib_clk is unbalanced error */
		if (android_vib_clk->count == 0) {
			printk("[VIBETONZ] %s: there are no android_vib_clk to disable \n",__func__);
		} else {
			clk_disable(android_vib_clk);
			clk_unprepare(android_vib_clk);
		}
		/* End - fix for android_vib_clk is unbalanced error */
    }

    return VIBE_S_SUCCESS;
}
示例#11
0
/*
** Called to disable amp (disable output force)
*/
IMMVIBESPIAPI VibeStatus ImmVibeSPI_ForceOut_AmpDisable(VibeUInt8 nActuatorIndex)
{
#if 0
#error Please review the code between the #if and #endif

    if (g_bAmpEnabled)
    {
        DbgOut((KERN_DEBUG "ImmVibeSPI_ForceOut_AmpDisable.\n"));

        g_bAmpEnabled = false;

#if 0
        mhn_gpio_set_level(GPIO_EN, GPIO_LEVEL_LOW);
        mz_ops.bstat &= ~HN_BATTERY_MOTOR;
#endif
    }
#endif
    if (g_bAmpEnabled)
    {
        g_bAmpEnabled = false;
#if defined (CONFIG_TARGET_LOCALE_EUR) || defined (CONFIG_TARGET_LOCALE_HKTW) || defined (CONFIG_TARGET_LOCALE_HKTW_FET) || defined (CONFIG_TARGET_LOCALE_VZW) || defined (CONFIG_TARGET_LOCALE_USAGSM)
        if(HWREV >= 0xf)
#elif defined (CONFIG_TARGET_LOCALE_KOR)
        if(HWREV >= 0xe)
#else
        if(HWREV >= 0xff)
#endif
        {
            pwm_config(Immvib_pwm, 0, g_PWM_duty_max/2);
            pwm_disable(Immvib_pwm);
            gpio_set_value(VIB_EN, GPIO_LEVEL_LOW);
        }
        max8998_ldo_disable_direct(MAX8998_LDO16);
    }

    return VIBE_S_SUCCESS;
}
示例#12
0
static void zylonite_backlight_power(int on)
{
	/* MFP for MFP_BACKLIGHT_PWM is supposed to be configured */
	mhn_gpio_set_direction(MFP_BACKLIGHT_PWM, GPIO_DIR_OUT);
	mhn_gpio_set_level(MFP_BACKLIGHT_PWM, on);
}
示例#13
0
int mcam_init(p_camera_context_t camera_context)
{
	int   status = 0;

#ifdef DEBUG_PARAM_CHECK

	/* parameter check */
	if (camera_context->sensor_type > CAMERA_TYPE_MAX)
		return -EINVAL;

	/* check the function dispatch table according to the sensor type */
	if (!camera_context->camera_functions)
		return -EINVAL;

	if (!camera_context->camera_functions->init ||
			!camera_context->camera_functions->deinit ||
			!camera_context->camera_functions->set_capture_format ||
			!camera_context->camera_functions->start_capture ||
			!camera_context->camera_functions->stop_capture)
		return -EINVAL;
#endif

	/* initialize some camera used parameters */
	camera_context->capture_input_width = 0;
	camera_context->capture_input_height = 0;
	camera_context->capture_output_width = 0;
	camera_context->capture_output_height = 0;
	camera_context->capture_input_format = CAMERA_IMAGE_FORMAT_MAX + 1;
	camera_context->capture_output_format = CAMERA_IMAGE_FORMAT_MAX + 1;
	camera_context->fifo0_transfer_size = 0;
	camera_context->fifo1_transfer_size = 0;
	camera_context->fifo2_transfer_size = 0;
	camera_context->fifo3_transfer_size = 0;
	camera_context->video_fifo0_transfer_size = 0;
	camera_context->video_fifo1_transfer_size = 0;
	camera_context->video_fifo2_transfer_size = 0;
	camera_context->still_fifo0_transfer_size = 0;
	camera_context->still_fifo1_transfer_size = 0;
	camera_context->still_fifo2_transfer_size = 0;
	camera_context->frame_buffer_number = 0;
	camera_context->video_capture_buffer_queue.head = NULL;
	camera_context->video_capture_buffer_queue.tail = NULL;
	camera_context->still_capture_buffer_queue.head = NULL;
	camera_context->still_capture_buffer_queue.tail = NULL;
	camera_context->psu_enable = 0;
	camera_context->cgu_enable = 0;
	camera_context->ssu_scale = CI_SSU_SCALE_DISABLE;
	camera_context->cmu_usage = CI_CMU_DISABLE;
	camera_context->dma_running = 0;

	/* MFP pins init */
	zylonite_enable_cif_pins();

	/* UTMI_SWITCH must be set to low and
	 * the UTMI_TEST_EN should be set to output (low)
	 */
	mhn_gpio_set_direction(MFP_UTMI_SWITCH,  GPIO_DIR_OUT);
	mhn_gpio_set_direction(MFP_UTMI_TEST_EN, GPIO_DIR_OUT);
	mhn_gpio_set_level(MFP_UTMI_SWITCH,  GPIO_LEVEL_LOW);
	mhn_gpio_set_level(MFP_UTMI_TEST_EN, GPIO_LEVEL_HIGH);

	/* set two gpio pin direction as output
	 * to control the power of two sensors.
	 */
	mhn_gpio_set_direction(MFP_CIF_HI_PWDN_GPI0, GPIO_DIR_OUT);
	mhn_gpio_set_direction(MFP_CIF_LO_PWDN_GPI0, GPIO_DIR_OUT);
	/* set two gpio pin output as HI to power off two sensors. */
	mhn_gpio_set_level(MFP_CIF_HI_PWDN_GPI0, GPIO_LEVEL_HIGH);
	mhn_gpio_set_level(MFP_CIF_LO_PWDN_GPI0, GPIO_LEVEL_HIGH);

	/* capture interface init */
	ci_init();

	/* sensor init */
	status = camera_context->camera_functions->init(camera_context);
	if (status) {
		goto camera_init_err;
	}

	/* set frame rate */
	mcam_set_capture_frame_rate(camera_context);

	return 0;

camera_init_err:
	mcam_deinit(camera_context);
	return -EIO;
}