Example #1
0
void FSA9480_MhlSwitchSel(bool sw) 
{
	struct i2c_client *client = local_usbsw->client;
	//struct power_supply *mhl_power_supply = power_supply_get_by_name("battery");
	//	union power_supply_propval value;
    printk("[FSA] mutex_lock\n");
	//mutex_lock(&FSA9480_MhlSwitchSel_lock);//avoid race condtion between mhl and hpd
	if(sw)
	{
               sii9234_cfg_power(1);
		if (gv_intr2&0x1) //cts: fix for 3355
		{
			mhl_vbus = true;
			mhl_power_supply=1;
			local_pdata->charger_cb(FSA9480_ATTACHED);
			gv_intr2=0;
			printk("vbus_power is detected\n");
		}

		SiI9234_init();
	}
	
	else
	{
		if (tegra_dc_hdmi_hpd())
		{
			printk("[FSA] Turn off hdmi\n");
			mhl_hpd_handler(false);
		}
                      if(mhl_power_supply==1)
			{
				mhl_power_supply=0;
				local_pdata->charger_cb(FSA9480_DETACHED);
                       	}
		mhl_vbus = false;
		sii9234_cfg_power(0);	//Turn Off power to SiI9234
	}

	/********************FSA-MHL-FSA Switching start***************************/
	DisableFSA9480Interrupts();
	{
		//gpio_set_value_cansleep(GPIO_MHL_SEL, sw);
		sii9234_switch_onoff(sw);
		
		i2c_smbus_read_byte_data(client, FSA9480_REG_INT1);
	}
	EnableFSA9480Interrupts();
	/******************FSA-MHL-FSA Switching End*******************************/
	//mutex_unlock(&FSA9480_MhlSwitchSel_lock);

    printk("[FSA] mutex_unlock\n");
}
Example #2
0
void MHL_On(bool on)
{
	printk("MHL_On(%d)\n", on);
	if (on == 1) {
	  gpio_set_value(GPIO_MHL_SEL, 1);
		sii9234_cfg_power(1);
		SiI9234_init();
	} else {
	  gpio_set_value(GPIO_MHL_RST, 0); 
		sii9234_cfg_power(0);
		gpio_set_value(GPIO_MHL_SEL, 0); 
#ifdef TIMER_ACC_ADC 
		old_adc_mhl_detected = false;
  	hrtimer_start(&sii9234_adc_timer,
		ns_to_ktime(250000000/*500ms*/), HRTIMER_MODE_REL);
#endif
	}

}
Example #3
0
static ssize_t change_switch_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t size)
{
	char *after;
	unsigned long value = simple_strtoul(buf, &after, 10);
	int i;
	printk(KERN_ERR "[MHL_SWITCH] Change the switch: %ld\n", value);

	if (value == 0) {
		for (i = 0; i <1; i++) {
			printk(KERN_ERR "[MHL] try %d\n", i+1);
			msleep(500);
		}

		gpio_set_value(GPIO_MHL_SEL, 1); 
		sii9234_cfg_power(1);
		SiI9234_init();
	} else {
	  gpio_set_value(GPIO_MHL_RST, 0);
		sii9234_cfg_power(0);
		gpio_set_value(GPIO_MHL_SEL, 0); 
	}
	return size;
}
Example #4
0
void mhl_onff_handler(struct work_struct *work) //Rajucm
{	
	// struct i2c_client *client = local_usbsw->client;
	printk("praveen: mhl on off handler\n");

	//Rajucm: phone Power on with MHL Cable,avoid crash
	while((!SII9234_i2c_status))
	{	//4Control enters into while loop only when fsa9480 detects MHL-cable @ phone bootup
		//printk(KERN_ERR"[FSA9480]## mhl cable detected during boot ## \n");
		//i2c_smbus_write_byte_data(client, 0x02, (0x01|i2c_smbus_read_byte_data(client, 0x02)));	//DisableFSA9480Interrupts
		if(!sec_get_lpm_mode())
		{
			printk(KERN_ERR "[FSA9480]## %s ## \n", SII9234_i2c_status? "Ready to start MHL":"Let's Sleep untill MHL condition comes true");
			wait_event_interruptible_timeout(fsa9480_MhlWaitEvent, SII9234_i2c_status, msecs_to_jiffies(5*1000)); //5sec:
		}

		//skip controlling the sii9234 on lpm mode
		if(sec_get_lpm_mode())
		{
			//ignore turn on mhl because of only charging mode in power off state!
			printk(KERN_DEBUG "lpm_mode booting, so there is no to turn on mhl:mhl_onoff[%d]\n",mhl_onoff);
			//only desk_dock without mhl cable!
			DisableFSA9480Interrupts();
			FSA9480_CheckAndHookAudioDock(USE_DESK_DOCK,mhl_onoff);
			return;					
		}
	}
	if(mhl_onoff)
	{
		sii9234_cfg_power(1);	//Turn On power to SiI9234
		printk("Praveen:The value of mhl_cable_status is %d\n", mhl_cable_status);
		if(mhl_cable_status == 0x08 || mhl_cable_status == 0x00 || mhl_cable_status == 0x03)
		{
			SiI9234_init();
			local_usbsw->check_watchdog=0;
			schedule_delayed_work(&local_usbsw->fsa_watchdog, msecs_to_jiffies(3000));
			DisableFSA9480Interrupts();
			gpio_set_value_cansleep(GPIO_MHL_SEL, mhl_onoff);
		}
	}
	else
	{
		sii9234_cfg_power(0);	//Turn Off power to SiI9234
		DisableFSA9480Interrupts();
		gpio_set_value_cansleep(GPIO_MHL_SEL, mhl_onoff);
		mhl_cable_status = 0x08;	//Once mhl powered off cable status cannot be 0x07;
	}

// this code only for deskdock [
	if (!mhl_onoff)
	{
		if (usedeskdock)
		{
			FSA9480_CheckAndHookAudioDock(USE_DESK_DOCK, 0);
		}
		else
		{
			FSA9480_CheckAndHookAudioDock(USB_HDMI_CABLE,0);
			EnableFSA9480Interrupts();
		}
	}
// ]	
}