byte MHD_Bridge_detect(void)
{
    byte temp = 0;
    byte BridgeOn = 0;
    DisableInterrupts();
    msleep(180);
    if(!gpio_get_value(GPIO_ACCESSORY_INT)&& MHD_HW_IsOn())
    {
        temp = ReadIndexedRegister(INDEXED_PAGE_0, 0x09);
        if ((temp & RSEN) == 0x00)
        {
            BridgeOn = FALSE;
            //ReadModifyWriteTPI(0x79, SI_BIT_5 | SI_BIT_4, SI_BIT_4); //force HPD to 0
            ReadModifyWriteIndexedRegister(INDEXED_PAGE_0, 0x79, SI_BIT_5 | SI_BIT_4, SI_BIT_4);
        }
        else
        {
            BridgeOn = TRUE;
            //ReadModifyWriteTPI(0x79, BIT_5 | BIT_4, 0); //back to current state
        }
        printk("[MHD] Bridge detect %x :: HPD %d\n",BridgeOn,gpio_get_value(GPIO_HDMI_HPD));
        //ReadModifyWriteTPI(0x79, SI_BIT_5 | SI_BIT_4, 0); //back to current state
        ReadModifyWriteIndexedRegister(INDEXED_PAGE_0, 0x79, SI_BIT_5 | SI_BIT_4, 0);
    }
    MHD_INT_clear();
    EnableInterrupts();
    printk("[MHD]MHD_Bridge_detect -- \n");
    return BridgeOn;
}
byte MHD_Bridge_detect(void)
{
	byte temp = 0;
	byte BridgeOn = 0;
	/* disable interrupts */
	ReadModifyWriteTPI(TPI_INTERRUPT_ENABLE_REG,
			RECEIVER_SENSE_EVENT_MASK, 0x00);
	msleep(180);
	if(!gpio_get_value(TEGRA_GPIO_PI5)&& MHD_HW_IsOn()) //TEGRA_GPIO_PI5: GPIO_ACCESSORY_INT
	{
		temp = ReadIndexedRegister(INDEXED_PAGE_0, 0x09);
		if ((temp & RSEN) == 0x00) {
   			BridgeOn = FALSE;
			//ReadModifyWriteTPI(0x79, SI_BIT_5 | SI_BIT_4, SI_BIT_4); //force HPD to 0
			ReadModifyWriteIndexedRegister(INDEXED_PAGE_0, 0x79, SI_BIT_5 | SI_BIT_4, SI_BIT_4);
		} else {	
  			BridgeOn = TRUE;
			//ReadModifyWriteTPI(0x79, BIT_5 | BIT_4, 0); //back to current state
		}	
		printk("[HDMI] Bridge detect %x :: HPD %d\n",BridgeOn,gpio_get_value(TEGRA_GPIO_PN7)); //TEGRA_GPIO_PN7: GPIO_HDMI_HPD
		//ReadModifyWriteTPI(0x79, SI_BIT_5 | SI_BIT_4, 0); //back to current state
		ReadModifyWriteIndexedRegister(INDEXED_PAGE_0, 0x79, SI_BIT_5 | SI_BIT_4, 0);
	}	
	MHD_INT_clear();

	/* enable interrupts */
	WriteIndexedRegister(INDEXED_PAGE_0, 0x78, 0x01);

	printk("[HDMI]MHD_Bridge_detect -- \n");
	return BridgeOn; 
}
static ssize_t MHD_check_read(struct device *dev,
                              struct device_attribute *attr, char *buf)
{
    int count;
    int res;
    /*TVout_LDO_ctrl(true);*/
    if (!MHD_HW_IsOn()) {
        sii9234_tpi_init();
        res = MHD_Read_deviceID();
        MHD_HW_Off();
    } else {
        sii9234_tpi_init();
        res = MHD_Read_deviceID();
    }

    count = sprintf(buf, "%d\n", res);
    /*TVout_LDO_ctrl(false);*/
    return count;
}
Esempio n. 4
0
static ssize_t MHD_check_read(struct device *dev, struct device_attribute *attr, char *buf)
{
	int count;
	int res;
	#if 0

	s3c_gpio_setpull(GPIO_MHL_SEL, S3C_GPIO_PULL_UP);	//MHL_SEL

	gpio_set_value(GPIO_MHL_SEL, 1);
	

	//TVout_LDO_ctrl(true);
	
	if(!MHD_HW_IsOn())
	{
		sii9234_tpi_init();
		res = MHD_Read_deviceID();
		MHD_HW_Off();		
	}
	else
	{
		sii9234_tpi_init();
		res = MHD_Read_deviceID();
	}

	I2C_WriteByte(0x72, 0xA5, 0xE1);
	res = 0;
	res = I2C_ReadByte(0x72, 0xA5);

	printk("A5 res %x",res);

	res = 0;
	res = I2C_ReadByte(0x72, 0x1B);

	printk("Device ID res %x",res);

	res = 0;
	res = I2C_ReadByte(0x72, 0x1C);

	printk("Device Rev ID res %x",res);

	res = 0;
	res = I2C_ReadByte(0x72, 0x1D);

	printk("Device Reserved ID res %x",res);

	printk("\n####HDMI_EN1 %x MHL_RST %x GPIO_MHL_SEL %x\n",gpio_get_value(GPIO_HDMI_EN1),gpio_get_value(GPIO_MHL_RST),gpio_get_value(GPIO_MHL_SEL));

	res = I2C_ReadByte(0x7A, 0x3D);

	res = I2C_ReadByte(0x7A, 0xFF);
		
	s3c_gpio_setpull(GPIO_MHL_SEL, S3C_GPIO_PULL_NONE);	//MHL_SEL

	gpio_set_value(GPIO_MHL_SEL, 0);

#endif
	count = sprintf(buf,"%d\n", res );
	//TVout_LDO_ctrl(false);
	return count;
}