void apq8064_keypad_gpio_init()
{
	int i = 0;
	int num = 0;
	struct pm8xxx_gpio_init *gpio_array;
	uint32_t pmic_type;

	pmic_type = board_pmic_type();

	if (pmic_type == PMIC_IS_PM8917)
	{
		num = ARRAY_SIZE(pm8917_keypad_gpios_apq);
		gpio_array = pm8917_keypad_gpios_apq;
	}
	else
	{
		num = ARRAY_SIZE(pm8921_keypad_gpios_apq);
		gpio_array = pm8921_keypad_gpios_apq;
	}

	for(i = 0; i < num; i++)
	{
		pm8921_gpio_config(gpio_array[i].gpio,
							&(gpio_array[i].config));
	}
}
Exemple #2
0
void pmic8921_gpio_set(uint32_t gpio, uint32_t level)
{
	struct pm8xxx_gpio_init pm8921_gpio[] = {
		PM8XXX_GPIO_OUTPUT(PM_GPIO(gpio), level),
	};

	pm8921_gpio_config(pm8921_gpio[0].gpio,
		&(pm8921_gpio[0].config));

	return;
}
Exemple #3
0
void apq8064_display_gpio_init()
{
		int i = 0;
		int num = 0;

		num = ARRAY_SIZE(pm8921_display_gpios_apq);

		for (i = 0; i < num; i++) {
			pm8921_gpio_config(pm8921_display_gpios_apq[i].gpio,
				&(pm8921_display_gpios_apq[i].config));
		}
}
Exemple #4
0
void msm8930_keypad_gpio_init()
{
		int i = 0;
		int num = 0;

		num = ARRAY_SIZE(pm8038_keypad_gpios);

		for(i=0; i < num; i++)
		{
			pm8921_gpio_config(pm8038_keypad_gpios[i].gpio,
								&(pm8038_keypad_gpios[i].config));
		}
}
Exemple #5
0
static void msm8960_backlight_on(void)
{
	struct pm8921_gpio backlight_pwm = {
		.direction = PM_GPIO_DIR_OUT,
		.output_buffer = 0,
		.output_value = 0,
		.pull = PM_GPIO_PULL_NO,
		.vin_sel = 2,
		.out_strength = PM_GPIO_STRENGTH_HIGH,
		.function = PM_GPIO_FUNC_1,
		.inv_int_pol = 0,
	};

	int rc = pm8921_gpio_config(PM_GPIO(24), &backlight_pwm);
	if (rc)
		dprintf(CRITICAL, "FAIL pm8921_gpio_config(): rc=%d.\n", rc);
}

#define PM8921_GPIO_BL_LED_EN_MITWOA           22
#define PM8921_GPIO_BL_LED_EN_MITWO           13
#define LM3530_I2C_ADDR                 (0x38)

void panel_backlight_on_mitwoa(unsigned int on)
{
	int ret = 0;
	static struct qup_i2c_dev *lm3530_dev = NULL;

	if (on) {
		lm3530_dev = qup_i2c_init(GSBI_ID_10, 100000, 24000000);

		pmic8921_gpio_set(PM8921_GPIO_BL_LED_EN_MITWOA, 1);

		ret += i2c_write(lm3530_dev, LM3530_I2C_ADDR, 0x10, 0x17);
		ret += i2c_write(lm3530_dev, LM3530_I2C_ADDR, 0x20, 0x00);
		ret += i2c_write(lm3530_dev, LM3530_I2C_ADDR, 0x30, 0x00);
		ret += i2c_write(lm3530_dev, LM3530_I2C_ADDR, 0xA0, 0x1F);
	} else {
		ret += i2c_write(lm3530_dev, LM3530_I2C_ADDR, 0x10, 0x00);
		pmic8921_gpio_set(PM8921_GPIO_BL_LED_EN_MITWOA, 0);
		lm3530_dev = NULL;
	}
	if (ret) {
		dprintf(CRITICAL, "panel_backlight_on: ret %d\n", ret);
	}
}
Exemple #6
0
/* Configure gpio 26 through lpg2 */
void keypad_led_drv_on_pwm(void)
{
	struct pm8921_gpio keypad_pwm = {
		.direction = PM_GPIO_DIR_OUT,
		.output_buffer = 0,
		.output_value = 0,
		.pull = PM_GPIO_PULL_NO,
		.vin_sel = 2,
		.out_strength = PM_GPIO_STRENGTH_HIGH,
		.function = PM_GPIO_FUNC_2,
		.inv_int_pol = 0,
	};

	int rc = pm8921_gpio_config(PM_GPIO(26), &keypad_pwm);
	if (rc)
	{
	dprintf(CRITICAL, "FAIL pm8921_gpio_config(): rc=%d.\n", rc);
	}
}
void msm8930_keypad_gpio_init()
{
	int i = 0;
	int num = 0;
	struct pm8xxx_gpio_init *gpio_array;

	if (platform_pmic_type(PMIC_IS_PM8917))
	{
		num = ARRAY_SIZE(pm8917_keypad_gpios);
		gpio_array = pm8917_keypad_gpios;
	}
	else
	{
		num = ARRAY_SIZE(pm8038_keypad_gpios);
		gpio_array = pm8038_keypad_gpios;
	}

	for(i=0; i < num; i++)
	{
		pm8921_gpio_config(gpio_array[i].gpio,
							&(gpio_array[i].config));
	}
}
static void msm8960_backlight_on(void)
{
	struct pm8921_gpio backlight_pwm = {
		.direction = PM_GPIO_DIR_OUT,
		.output_buffer = 0,
		.output_value = 0,
		.pull = PM_GPIO_PULL_NO,
		.vin_sel = 2,
		.out_strength = PM_GPIO_STRENGTH_HIGH,
		.function = PM_GPIO_FUNC_1,
		.inv_int_pol = 0,
	};

	int rc = pm8921_gpio_config(PM_GPIO(24), &backlight_pwm);
	if (rc)
		dprintf(CRITICAL, "FAIL pm8921_gpio_config(): rc=%d.\n", rc);
}

/* Pull DISP_RST_N high to get panel out of reset */
static void msm8960_mipi_panel_reset(void)
{
	struct pm8921_gpio gpio43_param = {
		.direction = PM_GPIO_DIR_OUT,
		.output_buffer = 0,
		.output_value = 1,
		.pull = PM_GPIO_PULL_UP_30,
		.vin_sel = 2,
		.out_strength = PM_GPIO_STRENGTH_HIGH,
		.function = PM_GPIO_FUNC_PAIRED,
		.inv_int_pol = 0,
		.disable_pin = 0,
	};
	pm8921_gpio_config(PM_GPIO(43), &gpio43_param);
}

static int msm8960_mipi_panel_clock(int enable)
{
	if (enable) {
		mdp_clock_init();
		mmss_clock_init();
	} else if(!target_cont_splash_screen()) {
			mmss_clock_disable();
	}

	return 0;
}

static int msm8960_mipi_panel_power(int enable)
{
	if (enable) {
		msm8960_backlight_on();

		/* Turn on LDO8 for lcd1 mipi vdd */
		pm8921_ldo_set_voltage(LDO_8, LDO_VOLTAGE_3_0V);

		/* Turn on LDO23 for lcd1 mipi vddio */
		pm8921_ldo_set_voltage(LDO_23, LDO_VOLTAGE_1_8V);

		/* Turn on LDO2 for vdda_mipi_dsi */
		pm8921_ldo_set_voltage(LDO_2, LDO_VOLTAGE_1_2V);

		msm8960_mipi_panel_reset();
	}

	return 0;
}

void display_init(void)
{
	dprintf(CRITICAL, "display_init\n");

	switch (board_target_id()) {
	case LINUX_MACHTYPE_8064_CDP:
		lvds_chimei_wxga_init(&(panel.panel_info));
		panel.clk_func = apq8064_lvds_clock;
		panel.power_func = apq8064_lvds_panel_power;
		panel.fb.base = 0x80B00000;
		panel.fb.width =  panel.panel_info.xres;
		panel.fb.height =  panel.panel_info.yres;
		panel.fb.stride =  panel.panel_info.xres;
		panel.fb.bpp =  panel.panel_info.bpp;
		panel.fb.format = FB_FORMAT_RGB888;
		panel.mdp_rev = MDP_REV_44;
		break;
	case LINUX_MACHTYPE_8064_MTP:
		mipi_toshiba_video_wsvga_init(&(panel.panel_info));
		panel.clk_func = fusion3_mtp_clock;
		panel.power_func = fusion3_mtp_panel_power;
		panel.fb.base = 0x89000000;
		panel.fb.width =  panel.panel_info.xres;
		panel.fb.height =  panel.panel_info.yres;
		panel.fb.stride =  panel.panel_info.xres;
		panel.fb.bpp =  panel.panel_info.bpp;
		panel.fb.format = FB_FORMAT_RGB888;
		panel.mdp_rev = MDP_REV_44;
		break;
	case LINUX_MACHTYPE_8960_CDP:
	case LINUX_MACHTYPE_8960_MTP:
	case LINUX_MACHTYPE_8960_FLUID:
	case LINUX_MACHTYPE_8960_LIQUID:
		mipi_toshiba_video_wsvga_init(&(panel.panel_info));
		panel.clk_func = msm8960_mipi_panel_clock;
		panel.power_func = msm8960_mipi_panel_power;
		panel.fb.base = 0x89000000;
		panel.fb.width =  panel.panel_info.xres;
		panel.fb.height =  panel.panel_info.yres;
		panel.fb.stride =  panel.panel_info.xres;
		panel.fb.bpp =  panel.panel_info.bpp;
		panel.fb.format = FB_FORMAT_RGB888;
		panel.mdp_rev = MDP_REV_42;
		break;
	default:
		return;
	};

	if (msm_display_init(&panel)) {
		dprintf(CRITICAL, "Display init failed!\n");
		return;
	}

	display_image_on_screen();
	display_enable = 1;
}

void display_shutdown(void)
{
	if (display_enable)
		msm_display_off();
}
static void msm8960_backlight_on(void)
{
	struct pm8921_gpio backlight_pwm = {
		.direction = PM_GPIO_DIR_OUT,
		.output_buffer = 0,
		.output_value = 0,
		.pull = PM_GPIO_PULL_NO,
		.vin_sel = 2,
		.out_strength = PM_GPIO_STRENGTH_HIGH,
		.function = PM_GPIO_FUNC_1,
		.inv_int_pol = 0,
	};

	int rc = pm8921_gpio_config(PM_GPIO(24), &backlight_pwm);
	if (rc)
		dprintf(CRITICAL, "FAIL pm8921_gpio_config(): rc=%d.\n", rc);
}

/* Pull DISP_RST_N high to get panel out of reset */
static void msm8960_mipi_panel_reset(void)
{
	struct pm8921_gpio gpio43_param = {
		.direction = PM_GPIO_DIR_OUT,
		.output_buffer = 0,
		.output_value = 1,
		.pull = PM_GPIO_PULL_UP_30,
		.vin_sel = 2,
		.out_strength = PM_GPIO_STRENGTH_HIGH,
		.function = PM_GPIO_FUNC_PAIRED,
		.inv_int_pol = 0,
		.disable_pin = 0,
	};
	pm8921_gpio_config(PM_GPIO(43), &gpio43_param);
}

static int msm8960_mipi_panel_clock(int enable)
{
	if (enable) {
		mdp_clock_init();
		mmss_clock_init();
	} else if(!target_cont_splash_screen()) {
			mmss_clock_disable();
	}

	return 0;
}

static int msm8960_liquid_mipi_panel_clock(int enable)
{
	if (enable) {
		mdp_clock_init();
		liquid_mmss_clock_init(); /* 240 MHZ MIPI-DSI clk */
	} else if(!target_cont_splash_screen()) {
			mmss_clock_disable();
	}

	return 0;
}

static int msm8960_mipi_panel_power(int enable)
{
	if (enable) {
		msm8960_backlight_on();

		/* Turn on LDO8 for lcd1 mipi vdd */
		pm8921_ldo_set_voltage(LDO_8, LDO_VOLTAGE_3_0V);

		/* Turn on LDO23 for lcd1 mipi vddio */
		pm8921_ldo_set_voltage(LDO_23, LDO_VOLTAGE_1_8V);

		/* Turn on LDO2 for vdda_mipi_dsi */
		pm8921_ldo_set_voltage(LDO_2, LDO_VOLTAGE_1_2V);

		msm8960_mipi_panel_reset();
	}

	return 0;
}

#define	PM_GPIO_VIN_VPH			0 /* 3v ~ 4.4v */
#define	PM_GPIO_VIN_BB			1 /* ~3.3v */
#define	PM_GPIO_VIN_S4			2 /* 1.8v */
#define	PM_GPIO_VIN_L15			3

static int msm8960_liquid_mipi_panel_power(int enable)
{
	if (enable) {
		static int gpio17, gpio21, gpio43 ;
		int rc;

		struct pm8921_gpio gpio_config = {
			.direction = PM_GPIO_DIR_OUT,
			.output_buffer = 0,
			.output_value = 1,
			.pull = PM_GPIO_PULL_NO,
			.vin_sel = PM_GPIO_VIN_S4,
			.out_strength = PM_GPIO_STRENGTH_HIGH,
			.function = PM_GPIO_FUNC_NORMAL,
			.inv_int_pol = 0,
			.disable_pin = 0,
		};

		/* Note: PWM is controlled by PM-GPIO#24 */
		gpio17 = PM_GPIO(17); /* ext_3p3v */
		gpio21 = PM_GPIO(21); /* disp power enable_n , vin=VPH-PWR */
		gpio43 = PM_GPIO(43); /* Displays Enable (rst_n) */

		gpio_config.output_value = 1;
		rc = pm8921_gpio_config(gpio17, &gpio_config);
		mdelay(100);
		gpio_config.output_value = 0;
		/* disp disable (resx=0) */
		rc = pm8921_gpio_config(gpio43, &gpio_config);
		mdelay(100);
		gpio_config.output_value = 0;
		gpio_config.vin_sel = PM_GPIO_VIN_VPH; /* VPH_PWR */
		/* disp power enable_n */
		rc = pm8921_gpio_config(gpio21, &gpio_config);
		mdelay(100);
		gpio_config.output_value = 1;
		gpio_config.vin_sel = PM_GPIO_VIN_S4;
		/* disp enable */
		rc = pm8921_gpio_config(gpio43, &gpio_config);
		mdelay(100);

		pm8921_low_voltage_switch_enable(lvs_4); /* S4 1.8 V */

		/* Turn on LDO2 for vdda_mipi_dsi */
		pm8921_ldo_set_voltage(LDO_2, LDO_VOLTAGE_1_2V);

		msm8960_backlight_on();
	}

	return 0;
}

void display_init(void)
{
	int target_id = board_target_id();

	dprintf(INFO, "display_init(),target_id=%d.\n", target_id);

	switch (target_id) {
	case LINUX_MACHTYPE_8960_LIQUID:
		mipi_chimei_video_wxga_init(&(panel.panel_info));
		/*
		 * mipi_chimei_wxga panel not supported yet in LK.
		 * However, MIPI clocks and power should be set in LK.
		 */
		panel.clk_func = msm8960_liquid_mipi_panel_clock;
		panel.power_func = msm8960_liquid_mipi_panel_power;
		panel.fb.base = MIPI_FB_ADDR;
		panel.fb.width =  panel.panel_info.xres;
		panel.fb.height =  panel.panel_info.yres;
		panel.fb.stride =  panel.panel_info.xres;
		panel.fb.bpp =  panel.panel_info.bpp;
		panel.fb.format = FB_FORMAT_RGB888;
		panel.mdp_rev = MDP_REV_44;
		break;
	case LINUX_MACHTYPE_8064_CDP:
		lvds_chimei_wxga_init(&(panel.panel_info));
		panel.clk_func = apq8064_lvds_clock;
		panel.power_func = apq8064_lvds_panel_power;
		panel.fb.base = 0x80B00000;
		panel.fb.width =  panel.panel_info.xres;
		panel.fb.height =  panel.panel_info.yres;
		panel.fb.stride =  panel.panel_info.xres;
		panel.fb.bpp =  panel.panel_info.bpp;
		panel.fb.format = FB_FORMAT_RGB888;
		panel.mdp_rev = MDP_REV_44;
		break;
	case LINUX_MACHTYPE_8064_MTP:
		mipi_toshiba_video_wsvga_init(&(panel.panel_info));
		panel.clk_func = fusion3_mtp_clock;
		panel.power_func = fusion3_mtp_panel_power;
		panel.fb.base = 0x89000000;
		panel.fb.width =  panel.panel_info.xres;
		panel.fb.height =  panel.panel_info.yres;
		panel.fb.stride =  panel.panel_info.xres;
		panel.fb.bpp =  panel.panel_info.bpp;
		panel.fb.format = FB_FORMAT_RGB888;
		panel.mdp_rev = MDP_REV_44;
		break;
	case LINUX_MACHTYPE_8960_CDP:
	case LINUX_MACHTYPE_8960_MTP:
	case LINUX_MACHTYPE_8960_FLUID:
		mipi_toshiba_video_wsvga_init(&(panel.panel_info));
		panel.clk_func = msm8960_mipi_panel_clock;
		panel.power_func = msm8960_mipi_panel_power;
		panel.fb.base = 0x89000000;
		panel.fb.width =  panel.panel_info.xres;
		panel.fb.height =  panel.panel_info.yres;
		panel.fb.stride =  panel.panel_info.xres;
		panel.fb.bpp =  panel.panel_info.bpp;
		panel.fb.format = FB_FORMAT_RGB888;
		panel.mdp_rev = MDP_REV_42;
		break;
	default:
		return;
	};

	if (msm_display_init(&panel)) {
		dprintf(CRITICAL, "Display init failed!\n");
		return;
	}

	display_image_on_screen();
	display_enable = 1;
}

void display_shutdown(void)
{
	if (display_enable)
		msm_display_off();
}