Example #1
0
int mt8193_power_on(void)
{
    MT8193_DRV_FUNC();
    #if defined(CONFIG_HAS_EARLYSUSPEND)
    if(mt8193_hdmiearlysuspend==0) return 0;
    #endif	
	mt8193_hotinit = 0;
	mt_set_gpio_mode(GPIO_HDMI_POWER_CONTROL, GPIO_MODE_00);  
    mt_set_gpio_dir(GPIO_HDMI_POWER_CONTROL, GPIO_DIR_OUT);
    mt_set_gpio_out(GPIO_HDMI_POWER_CONTROL, GPIO_OUT_ONE);

	vWriteHdmiSYSMsk(HDMI_PWR_CTRL, hdmi_power_turnon, hdmi_power_turnon);
	vWriteHdmiSYSMsk(HDMI_SYS_PWR_RST_B, hdmi_pwr_sys_sw_unreset, hdmi_pwr_sys_sw_unreset);
	vWriteHdmiSYSMsk(HDMI_PWR_CTRL, hdmi_iso_dis, hdmi_iso_en);
    vWriteHdmiSYSMsk(HDMI_PWR_CTRL, hdmi_clock_on, hdmi_clock_off);
	
	vWriteHdmiSYSMsk(HDMI_SYS_CFG1C, ANLG_ON|HDMI_ON, ANLG_ON|HDMI_ON);
	
    mt8193_i2c_write(0x1500, 0x20);
    vHotPlugPinInit();
    vInitHdcpKeyGetMethod(NON_HOST_ACCESS_FROM_EEPROM);


	vWriteHdmiIntMask(0xFF);
	
    return 0;
}
int mt8193_power_on(void)
{
	struct device_node *dn;
	int bus_switch_pin;

	HDMI_DEF_LOG("[hdmi]mt8193_power_on_\n");

	if (hdmi_powerenable == 1) {
		HDMI_DEF_LOG("[hdmi]already power on, return\n");
		return 0;
	}
	hdmi_powerenable = 1;

#if defined(CONFIG_HAS_EARLYSUSPEND)
	if (mt8193_hdmiearlysuspend == 0)
		return 0;
#endif
	mt8193_hotinit = 0;
	mt8193_hotplugstate = HDMI_STATE_HOT_PLUG_OUT;
	is_hdmi_plug_out_flag = 0;
#ifdef GPIO_HDMI_POWER_CONTROL
	mt_set_gpio_mode(GPIO_HDMI_POWER_CONTROL, GPIO_MODE_00);
	mt_set_gpio_dir(GPIO_HDMI_POWER_CONTROL, GPIO_DIR_OUT);
	mt_set_gpio_out(GPIO_HDMI_POWER_CONTROL, GPIO_OUT_ONE);
	HDMI_DEF_LOG("[hdmi]hdmi_5v_on\n");
#endif

	dn = of_find_compatible_node(NULL, NULL, "mediatek,mt8193-hdmi");
	bus_switch_pin = of_get_named_gpio(dn, "hdmi_power_gpios", 0);
	gpio_direction_output(bus_switch_pin, 1);

	vWriteHdmiSYSMsk(HDMI_PWR_CTRL, hdmi_power_turnon, hdmi_power_turnon);
	vWriteHdmiSYSMsk(HDMI_SYS_PWR_RST_B, hdmi_pwr_sys_sw_unreset, hdmi_pwr_sys_sw_unreset);
	vWriteHdmiSYSMsk(HDMI_PWR_CTRL, hdmi_iso_dis, hdmi_iso_en);
	vWriteHdmiSYSMsk(HDMI_PWR_CTRL, hdmi_clock_on, hdmi_clock_off);

	vWriteHdmiSYSMsk(HDMI_SYS_CFG1C, ANLG_ON | HDMI_ON, ANLG_ON | HDMI_ON);

	mt8193_i2c_write(0x1500, 0x20);
	vHotPlugPinInit();
	vInitHdcpKeyGetMethod(NON_HOST_ACCESS_FROM_EEPROM);

	vWriteHdmiIntMask(0xFF);

	mod_timer(&r_hdmi_timer, jiffies + gHDMI_CHK_INTERVAL / (1000 / HZ));
	mod_timer(&r_cec_timer, jiffies + gCEC_CHK_INTERVAL / (1000 / HZ));

	return 0;
}