Exemple #1
0
#include <linux/kernel.h>
#include <linux/delay.h>
#include <linux/module.h>
#include <linux/err.h>
#include <linux/slab.h>
#include <linux/hdmi.h>
#include <linux/input.h>


struct class *hdmi_class;
struct hdmi_id_ref_info {
	struct hdmi *hdmi;
	int id;
	int ref;
}ref_info[HDMI_MAX_ID];
#ifdef CONFIG_SYSFS

extern int hdmi_create_attrs(struct hdmi *hdmi);
extern void hdmi_remove_attrs(struct hdmi *hdmi);

#else

static inline int hdmi_create_attrs(struct hdmi *hdmi)
{ return 0; }
static inline void hdmi_remove_attrs(struct hdmi *hdmi) {}

#endif /* CONFIG_SYSFS */
static void __hdmi_changed(struct hdmi *hdmi)
{
	int precent;
	
	mutex_lock(&hdmi->lock);
	precent = hdmi->ops->hdmi_precent(hdmi);

	if(precent && hdmi->mode == DISP_ON_LCD && hdmi->display_on){
		if(hdmi->ops->insert(hdmi) == 0){
			hdmi->mode = DISP_ON_HDMI;
			kobject_uevent(&hdmi->dev->kobj, KOBJ_CHANGE);
		}
		else
			hdmi_dbg(hdmi->dev, "insert error\n");
	}
	else if((!precent || !hdmi->display_on) && hdmi->mode == DISP_ON_HDMI){
		if(hdmi->ops->remove(hdmi) == 0){
			hdmi->mode = DISP_ON_LCD;
			kobject_uevent(&hdmi->dev->kobj, KOBJ_CHANGE);
		}
		else
			hdmi_dbg(hdmi->dev, "remove error\n");
	}
	mutex_unlock(&hdmi->lock);
	return;
}
static void hdmi_sys_show_state(struct hdmi *hdmi)
{
	switch (hdmi->state) {
	case HDMI_SLEEP:
		hdmi_dbg(hdmi->dev, "HDMI_SLEEP\n");
		break;
	case HDMI_INITIAL:
		hdmi_dbg(hdmi->dev, "HDMI_INITIAL\n");
		break;
	case WAIT_HOTPLUG:
		hdmi_dbg(hdmi->dev, "WAIT_HOTPLUG\n");
		break;
	case READ_PARSE_EDID:
		hdmi_dbg(hdmi->dev, "READ_PARSE_EDID\n");
		break;
	case WAIT_HDMI_ENABLE:
		hdmi_dbg(hdmi->dev, "WAIT_HDMI_ENABLE\n");
		break;
	case SYSTEM_CONFIG:
		hdmi_dbg(hdmi->dev, "SYSTEM_CONFIG\n");
		break;
	case CONFIG_VIDEO:
		hdmi_dbg(hdmi->dev, "CONFIG_VIDEO\n");
		break;
	case CONFIG_AUDIO:
		hdmi_dbg(hdmi->dev, "CONFIG_AUDIO\n");
		break;
	case PLAY_BACK:
		hdmi_dbg(hdmi->dev, "PLAY_BACK\n");
		break;
	default:
		hdmi_dbg(hdmi->dev, "Unkown State %d\n", hdmi->state);
		break;
	}
}
Exemple #3
0
static void rk30_hdmi_set_pwr_mode(int mode)
{
	if(hdmi->pwr_mode == mode)
		return;
	hdmi_dbg(hdmi->dev, "[%s] mode %d\n", __FUNCTION__, mode);	
	switch(mode)
	{
		case PWR_SAVE_MODE_A:
			HDMIWrReg(SYS_CTRL, 0x10);
			break;
		case PWR_SAVE_MODE_B:
			HDMIWrReg(SYS_CTRL, 0x20);
			break;
		case PWR_SAVE_MODE_D:
			// reset PLL A&B
			HDMIWrReg(SYS_CTRL, 0x4C);
			delay100us();
			// release PLL A reset
			HDMIWrReg(SYS_CTRL, 0x48);
			delay100us();
			// release PLL B reset
			HDMIWrReg(SYS_CTRL, 0x40);
			break;
		case PWR_SAVE_MODE_E:
			HDMIWrReg(SYS_CTRL, 0x80);
			break;
	}
	hdmi->pwr_mode = mode;
	if(mode != PWR_SAVE_MODE_A)
		msleep(10);
	hdmi_dbg(hdmi->dev, "[%s] curmode %02x\n", __FUNCTION__, HDMIRdReg(SYS_CTRL));
}
Exemple #4
0
irqreturn_t hdmi_irq(int irq, void *priv)
{		
	char interrupt1 = 0;
	unsigned long flags;
	spin_lock_irqsave(&hdmi->irq_lock,flags);
	interrupt1 = HDMIRdReg(INTERRUPT_STATUS1);
	HDMIWrReg(INTERRUPT_STATUS1, interrupt1);
#if 1
		hdmi_dbg(hdmi->dev, "[%s] interrupt1 %02x  \n",\
			 __FUNCTION__, interrupt1);
#endif
	if(interrupt1 & m_INT_HOTPLUG ){
		if(hdmi->state == HDMI_SLEEP)
			hdmi->state = WAIT_HOTPLUG;
		if(hdmi->pwr_mode == LOWER_PWR)
			rk2928_hdmi_set_pwr_mode(NORMAL);
		queue_delayed_work(hdmi->workqueue, &hdmi->delay_work, msecs_to_jiffies(10));	
	}else if(interrupt1 & m_INT_EDID_READY) {
		edid_result = interrupt1;
	}else if(hdmi->state == HDMI_SLEEP) {
		hdmi_dbg(hdmi->dev, "hdmi return to sleep mode\n");
		rk2928_hdmi_set_pwr_mode(LOWER_PWR);
	}
#if 0
	if(hdmi->hdcp_irq_cb)
		hdmi->hdcp_irq_cb(interrupt2);
#endif
	spin_unlock_irqrestore(&hdmi->irq_lock,flags);
	return IRQ_HANDLED;
}
Exemple #5
0
irqreturn_t hdmi_irq(int irq, void *priv)
{		
	char interrupt1 = 0, interrupt2 = 0, interrupt3 = 0, interrupt4 = 0;
	
	if(hdmi->pwr_mode == PWR_SAVE_MODE_A)
	{
		HDMIWrReg(SYS_CTRL, 0x20);
		hdmi->pwr_mode = PWR_SAVE_MODE_B;
		
		hdmi_dbg(hdmi->dev, "hdmi irq wake up\n");
		// HDMI was inserted when system is sleeping, irq was triggered only once
		// when wake up. So we need to check hotplug status.
		if(HDMIRdReg(HPD_MENS_STA) & (m_HOTPLUG_STATUS | m_MSEN_STATUS)) {			
			queue_delayed_work(hdmi->workqueue, &hdmi->delay_work, msecs_to_jiffies(10));
		}
	}
	else
	{
		interrupt1 = HDMIRdReg(INTR_STATUS1);
		interrupt2 = HDMIRdReg(INTR_STATUS2);
		interrupt3 = HDMIRdReg(INTR_STATUS3);
		interrupt4 = HDMIRdReg(INTR_STATUS4);
		HDMIWrReg(INTR_STATUS1, interrupt1);
//		HDMIWrReg(INTR_STATUS2, interrupt2);
//		HDMIWrReg(INTR_STATUS3, interrupt3);
//		HDMIWrReg(INTR_STATUS4, interrupt4);
#if 0
		hdmi_dbg(hdmi->dev, "[%s] interrupt1 %02x interrupt2 %02x interrupt3 %02x interrupt4 %02x\n",\
			 __FUNCTION__, interrupt1, interrupt2, interrupt3, interrupt4);
#endif
		if(interrupt1 & (m_INT_HOTPLUG | m_INT_MSENS))
		{
			if(hdmi->state == HDMI_SLEEP)
				hdmi->state = WAIT_HOTPLUG;
			interrupt1 &= ~(m_INT_HOTPLUG | m_INT_MSENS);
			queue_delayed_work(hdmi->workqueue, &hdmi->delay_work, msecs_to_jiffies(10));	
		}
		else if(interrupt1 & (m_INT_EDID_READY | m_INT_EDID_ERR)) {
			spin_lock(&hdmi->irq_lock);
			edid_result = interrupt1;
			spin_unlock(&hdmi->irq_lock);
		}
//		else if(hdmi->state == HDMI_SLEEP) {
//			RK30DBG( "hdmi return to sleep mode\n");
//			HDMIWrReg(SYS_CTRL, 0x10);
//			rk30_hdmi->pwr_mode = PWR_SAVE_MODE_A;
//		}
		if(hdmi->hdcp_irq_cb)
			hdmi->hdcp_irq_cb(interrupt2);
	}
	return IRQ_HANDLED;
}
Exemple #6
0
static int hdmi_sys_detect_status(struct hdmi *hdmi, int cur_status)
{
	int rc, hpd, state = cur_status;
	
	rc = hdmi->ops->detect_hpd(hdmi, &hpd);
//	hdmi_dbg(hdmi->dev, "hpd is %d\n", hpd);
	if(!rc && (hpd != hdmi->hpd_status))
	{
		if(hpd == HDMI_RECEIVER_REMOVE)
		{
			hdmi_dbg(hdmi->dev, "HDMI_UNPLUG\n");
			hdmi_sys_unplug(hdmi);
			if(hdmi->auto_switch)
			    rk_display_device_enable_other(hdmi->ddev);
			state = HDMI_INITIAL;
			if(hdmi->wait == 1) {	
				complete(&hdmi->complete);
				hdmi->wait = 0;
			}
			hdmi_sys_send_uevent(hdmi, KOBJ_REMOVE);
		}
		else if(hdmi->hpd_status == HDMI_RECEIVER_REMOVE)
			hdmi->hpd_status = HDMI_RECEIVER_INACTIVE;
	}
	if(state > SYSTEM_CONFIG && hdmi->ops->detect_sink)
	{
		rc = hdmi->ops->detect_sink(hdmi, &hpd);
//		hdmi_dbg(hdmi->dev, "sink is %d\n", hpd);
		if(hpd == HDMI_RECEIVER_INACTIVE)
		{
			hdmi->hpd_status = hpd;	
			hdmi_dbg(hdmi->dev, "HDMI_UNLINK\n");
			if(state > WAIT_RX_SENSE)
			{	
				if(hdmi->auto_switch)
				    rk_display_device_enable_other(hdmi->ddev);
	
				if(hdmi->wait == 1) {	
					complete(&hdmi->complete);
					hdmi->wait = 0;
				}
				if(state == PLAY_BACK)
					hdmi_sys_send_uevent(hdmi, KOBJ_REMOVE);
				state = WAIT_RX_SENSE;
			}
		}		
	}
	return state;
}
Exemple #7
0
static void hdmi_show_sink_info(struct hdmi *hdmi)
{
	struct list_head *pos, *head = &hdmi->edid.modelist;
	struct fb_modelist *modelist;
	struct fb_videomode *m;
	int i;
	struct hdmi_audio *audio;

	hdmi_dbg(hdmi->dev, "******** Show Sink Info ********\n");
	hdmi_dbg(hdmi->dev, "Support video mode: \n");
	list_for_each(pos, head) {
		modelist = list_entry(pos, struct fb_modelist, list);
		m = &modelist->mode;
		hdmi_dbg(hdmi->dev, "	%s.\n", m->name);
	}
static int __devexit rk616_hdmi_remove(struct platform_device *pdev)
{
	if(hdmi) {
		mutex_lock(&hdmi->enable_mutex);
		if(!hdmi->suspend && hdmi->enable && hdmi->irq)
			disable_irq(hdmi->irq);
		mutex_unlock(&hdmi->enable_mutex);
                if (hdmi->irq) {
        		free_irq(hdmi->irq, NULL);
                }
		flush_workqueue(hdmi->workqueue);
		destroy_workqueue(hdmi->workqueue);
#ifdef CONFIG_SWITCH
		switch_dev_unregister(&(hdmi->switch_hdmi));
#endif
		hdmi_unregister_display_sysfs(hdmi);
#ifdef CONFIG_HAS_EARLYSUSPEND
		unregister_early_suspend(&hdmi->early_suspend);
#endif
		fb_destroy_modelist(&hdmi->edid.modelist);
		if(hdmi->edid.audio)
			kfree(hdmi->edid.audio);
		if(hdmi->edid.specs)
		{
			if(hdmi->edid.specs->modedb)
				kfree(hdmi->edid.specs->modedb);
			kfree(hdmi->edid.specs);
		}
		kfree(hdmi);
		hdmi = NULL;
	}
	hdmi_dbg(hdmi->dev, "rk616 hdmi removed.\n");
	return 0;
}
int hdmi_sys_init(struct hdmi *hdmi)
{
	if (uboot_vic > 0) {
		hdmi->uboot_logo = support_uboot_display();
		hdmi->hotplug = HDMI_HPD_ACTIVED;
		hdmi->state = PLAY_BACK;
		hdmi->enable = HDMI_ENABLE;
		hdmi->display = HDMI_DISABLE;
		hdmi->vic = uboot_vic;
	} else {
		hdmi->hotplug = HDMI_HPD_REMOVED;
		hdmi->state = HDMI_SLEEP;
		hdmi->enable = HDMI_ENABLE;
		hdmi->display = HDMI_DISABLE;
		hdmi->vic = HDMI_VIDEO_DEFAULT_MODE;
		hdmi->uboot_logo = 0;
	}
	hdmi_dbg(hdmi->dev, "uboot-logo=%d,uboot_vic=%d\n",hdmi->uboot_logo,uboot_vic);
	hdmi->autoconfig = HDMI_AUTO_CONFIGURE;
	hdmi->audio.channel = HDMI_AUDIO_DEFAULT_CHANNEL;
	hdmi->audio.rate = HDMI_AUDIO_DEFAULT_RATE;
	hdmi->audio.word_length = HDMI_AUDIO_DEFAULT_WORD_LENGTH;

	memset(&hdmi->edid, 0, sizeof(struct hdmi_edid));
	INIT_LIST_HEAD(&hdmi->edid.modelist);
	mutex_init(&hdmi->lock);
	return 0;
}
static void hdmi_early_suspend(struct early_suspend *h)
{
	hdmi_dbg(hdmi->dev, "hdmi enter early suspend pwr %d state %d\n", hdmi->pwr_mode, hdmi->state);

	flush_delayed_work(&hdmi->delay_work);	
	mutex_lock(&hdmi->enable_mutex);
	hdmi->suspend = 1;
	if(!hdmi->enable) {
		mutex_unlock(&hdmi->enable_mutex);
		return;
	}

        if (hdmi->irq)
        	disable_irq(hdmi->irq);

	mutex_unlock(&hdmi->enable_mutex);
	hdmi->command = HDMI_CONFIG_ENABLE;
	init_completion(&hdmi->complete);
	hdmi->wait = 1;
	queue_delayed_work(hdmi->workqueue, &hdmi->delay_work, 0);
	wait_for_completion_interruptible_timeout(&hdmi->complete,
			msecs_to_jiffies(5000));
	flush_delayed_work(&hdmi->delay_work);

	return;
}
Exemple #11
0
static int __devexit cat66121_hdmi_i2c_remove(struct i2c_client *client)
{	
	hdmi_dbg(hdmi->dev, "%s\n", __func__);
	if(hdmi) {
		mutex_lock(&hdmi->enable_mutex);
		if(!hdmi->suspend && hdmi->enable && hdmi->irq)
			disable_irq(hdmi->irq);
		mutex_unlock(&hdmi->enable_mutex);
		if(hdmi->irq)
			free_irq(hdmi->irq, NULL);
		flush_workqueue(hdmi->workqueue);
		destroy_workqueue(hdmi->workqueue);
		#ifdef CONFIG_SWITCH
		switch_dev_unregister(&(hdmi->switch_hdmi));
		#endif
		hdmi_unregister_display_sysfs(hdmi);
		#ifdef CONFIG_HAS_EARLYSUSPEND
		unregister_early_suspend(&hdmi->early_suspend);
		#endif
		fb_destroy_modelist(&hdmi->edid.modelist);
		if(hdmi->edid.audio)
			kfree(hdmi->edid.audio);
		if(hdmi->edid.specs)
		{
			if(hdmi->edid.specs->modedb)
				kfree(hdmi->edid.specs->modedb);
			kfree(hdmi->edid.specs);
		}
		kfree(hdmi);
		hdmi = NULL;
	}
    return 0;
}
Exemple #12
0
int cat66121_hdmi_sys_init(void)
{
	hdmi_dbg(hdmi->dev, "[%s]\n", __FUNCTION__);
	HDMITX_InitTxDev(&InstanceData);
	InitHDMITX();
	msleep(1);
	return HDMI_ERROR_SUCESS;
}
Exemple #13
0
int cat66121_hdmi_sys_insert(void)
{
	hdmi_dbg(hdmi->dev, "[%s]\n", __FUNCTION__);
	if(getHDMI_PowerStatus()==FALSE)
		HDMITX_PowerOn();

	HDMITX_DisableAudioOutput();
	return 0;
}
int rk610_hdmi_sys_insert(void)
{
	hdmi_dbg(hdmi->dev, "%s \n", __FUNCTION__);
	//Bring up analog module.
	HDMIWrReg(PHY_BANDGAP_PWR, v_BANDGAP_PWR_UP);	//BG power on 
	HDMIWrReg(PHY_PLL_LDO_PWR, 0x00);		//PLL power on
	msleep(1);
	HDMIWrReg(PHY_PLL_CTRL, v_PLL_DISABLE(0));	//Analog reset
	return 0;
}
Exemple #15
0
static int hdmi_sys_parse_edid(struct hdmi* hdmi)
{
	struct hdmi_edid *pedid;
	unsigned char *buff = NULL;
	int rc = HDMI_ERROR_SUCESS, extendblock = 0, i;
	
	if(hdmi == NULL)
		return HDMI_ERROR_FALSE;
	fb_destroy_modelist(&hdmi->edid.modelist);
	pedid = &(hdmi->edid);
	memset(pedid, 0, sizeof(struct hdmi_edid));
	INIT_LIST_HEAD(&pedid->modelist);
	
	buff = kmalloc(EDID_BLOCK_LENGTH, GFP_KERNEL);
	if(buff == NULL)
	{		
		hdmi_dbg(hdmi->dev, "[%s] can not allocate memory for edid buff.\n", __FUNCTION__);
		return -1;
	}
	// Read base block edid.
	memset(buff, 0 , EDID_BLOCK_LENGTH);
	rc = hdmi->ops->read_edid(hdmi, 0, buff);
	if(rc)
	{
		dev_err(hdmi->dev, "[HDMI] read edid base block error\n");
		goto out;
	}
	rc = HDMI_EDID_parse_base(buff, &extendblock, pedid);
	if(rc)
	{
		dev_err(hdmi->dev, "[HDMI] parse edid base block error\n");
		goto out;
	}
	for(i = 1; i < extendblock + 1; i++)
	{
		memset(buff, 0 , EDID_BLOCK_LENGTH);
		rc = hdmi->ops->read_edid(hdmi, i, buff);
		if(rc)
		{
			printk("[HDMI] read edid block %d error\n", i);	
			goto out;
		}
		rc = HDMI_EDID_parse_extensions(buff, pedid);
		if(rc)
		{
			dev_err(hdmi->dev, "[HDMI] parse edid block %d error\n", i);
			continue;
		}
	}
out:
	if(buff)
		kfree(buff);
	rc = ext_hdmi_ouputmode_select(hdmi, rc);
	return rc;
}
static int anx7150_display_off(struct hdmi* hdmi)
{
	struct anx7150_pdata *anx = hdmi_get_privdata(hdmi);
	
	rk29_hdmi_exit(&anx->dev);
	hdmi->display_on = HDMI_DISABLE;
	anx->dev.hdmi_enable = HDMI_DISABLE;
	anx->dev.parameter_config = 1;
	hdmi_dbg(hdmi->dev, "hdmi display off\n");
	return 0;
}
Exemple #17
0
int cat66121_hdmi_sys_remove(void)
{
	hdmi_dbg(hdmi->dev, "[%s]\n", __FUNCTION__);
#ifdef SUPPORT_HDCP
	cancel_delayed_work_sync(&hdcp_delay_work);
	HDMITX_EnableHDCP(FALSE);
#endif
	HDMITX_DisableVideoOutput();
	if(getHDMI_PowerStatus()==TRUE)
		HDMITX_PowerDown();
	return 0;
}
int rk610_hdmi_sys_remove(void)
{
	hdmi_dbg(hdmi->dev, "%s \n", __FUNCTION__);
	if(hdmi->hdcp_power_off_cb)
		hdmi->hdcp_power_off_cb();
	HDMIWrReg(PHY_DRIVER, v_MAIN_DRIVER(8)| v_PRE_DRIVER(0) | v_TX_ENABLE(0));
	HDMIWrReg(PHY_PRE_EMPHASIS, v_PRE_EMPHASIS(0) | v_TMDS_PWRDOWN(1));	//Driver power down	
	HDMIWrReg(PHY_PLL_CTRL, v_PLL_DISABLE(1) | v_PLL_RESET(1) | v_TMDS_RESET(1));
	HDMIWrReg(PHY_PLL_LDO_PWR, v_LDO_PWR_DOWN(1));
	HDMIWrReg(PHY_BANDGAP_PWR, v_BANDGAP_PWR_DOWN);
	return 0;
}
int rk3288_hdmi_detect_hotplug(struct hdmi *hdmi_drv)
{
	struct rk3288_hdmi_device *hdmi_dev = container_of(hdmi_drv, struct rk3288_hdmi_device, driver);
	u32 value = hdmi_readl(hdmi_dev, PHY_STAT0);

	hdmi_dbg(hdmi_drv->dev, "[%s] reg%x value %02x\n", __FUNCTION__, PHY_STAT0, value);

	if((value & m_PHY_HPD) || ((value & 0xf0) == 0xf0))
		return HDMI_HPD_ACTIVED;
	else
		return HDMI_HPD_REMOVED;
}
int rk30_hdmi_detect_hotplug(void)
{
	int value =	HDMIRdReg(HPD_MENS_STA);
	
	hdmi_dbg(hdmi->dev, "[%s] value %02x\n", __FUNCTION__, value);
	value &= m_HOTPLUG_STATUS | m_MSEN_STATUS;
	if(value  == (m_HOTPLUG_STATUS | m_MSEN_STATUS) )
		return HDMI_HPD_ACTIVED;
	else if(value)
		return HDMI_HPD_INSERT;
	else
		return HDMI_HPD_REMOVED;
}
Exemple #21
0
int rk2928_hdmi_detect_hotplug(void)
{
	int value =	HDMIRdReg(HDMI_STATUS);
	
	hdmi_dbg(hdmi->dev, "[%s] value %02x\n", __FUNCTION__, value);
	value &= m_HOTPLUG;
	if(value == m_HOTPLUG)
		return HDMI_HPD_ACTIVED;
	else if(value)
		return HDMI_HPD_INSERT;
	else
		return HDMI_HPD_REMOVED;
}
Exemple #22
0
void cat66121_hdmi_sys_enalbe_output(int enable)
{
	hdmi_dbg(hdmi->dev, "[%s]\n", __FUNCTION__);
	
	if(enable){
#ifdef SUPPORT_HDCP
		cancel_delayed_work_sync(&hdcp_delay_work);
		schedule_delayed_work(&hdcp_delay_work, msecs_to_jiffies(100));
#endif
		setHDMITX_AVMute(FALSE);
	}else{
		setHDMITX_AVMute(TRUE);
	}
	DumpHDMITXReg() ;
}
Exemple #23
0
static void rk2928_hdmi_set_pwr_mode(int mode)
{
	int c=0;
	hdmi_dbg(hdmi->dev,"%s \n",__FUNCTION__);
	if(hdmi->pwr_mode == mode)
		return; 
    switch(mode){
     case NORMAL:
	   	rk2928_hdmi_sys_power_down();
	    HDMIWrReg(0xe0, 0x0a);
	    HDMIWrReg(0xe1, 0x03);
	    HDMIWrReg(0xe2, 0x99);
	    HDMIWrReg(0xe3, 0x0f);
		HDMIWrReg(0xe4, 0x00);
		HDMIWrReg(0xec, 0x02);
	   	HDMIWrReg(0xce, 0x00);
		HDMIWrReg(0xce, 0x01);
		rk2928_hdmi_av_mute(1);
		rk2928_hdmi_sys_power_up();
		analog_sync = 1;
		break;
	case LOWER_PWR:
		rk2928_hdmi_av_mute(0);
	   	rk2928_hdmi_sys_power_down();
		HDMIWrReg(0xe0, 0x3a);
	    HDMIWrReg(0xe1, 0x00);
	    HDMIWrReg(0xe2, 0x00);
	    HDMIWrReg(0xe3, 0x00);
		HDMIWrReg(0xe4, 0x03);
		HDMIWrReg(0xec, 0x03);
		break;
	default:
	    hdmi_dbg(hdmi->dev,"unkown rk2928 hdmi pwr mode %d\n",mode);
    }
	hdmi->pwr_mode = mode;
}
static int __devexit anx7150_i2c_remove(struct i2c_client *client)
{
	struct anx7150_pdata *anx = (struct anx7150_pdata *)i2c_get_clientdata(client);
	struct hdmi *hdmi = anx->dev.hdmi;

	free_irq(anx->irq, NULL);
	gpio_free(client->irq);
	hdmi_unregister(hdmi);
	destroy_workqueue(anx->dev.workqueue);
	kfree(anx);
	anx = NULL;
	kfree(hdmi);
	hdmi = NULL;
		
	hdmi_dbg(hdmi->dev, "%s\n", __func__);
    return 0;
}
Exemple #25
0
static void cat66121_sys_config_avi(int VIC, int bOutputColorMode, int aspec, int Colorimetry, int pixelrep)
{
	AVI_InfoFrame *AviInfo;
	hdmi_dbg(hdmi->dev, "[%s]\n", __FUNCTION__);
	AviInfo = (AVI_InfoFrame *)CommunBuff ;

	AviInfo->pktbyte.AVI_HB[0] = AVI_INFOFRAME_TYPE|0x80 ;
	AviInfo->pktbyte.AVI_HB[1] = AVI_INFOFRAME_VER ;
	AviInfo->pktbyte.AVI_HB[2] = AVI_INFOFRAME_LEN ;

	switch(bOutputColorMode)
	{
		case F_MODE_YUV444:
			// AviInfo->info.ColorMode = 2 ;
			AviInfo->pktbyte.AVI_DB[0] = (2<<5)|(1<<4);
			break ;
		case F_MODE_YUV422:
			// AviInfo->info.ColorMode = 1 ;
			AviInfo->pktbyte.AVI_DB[0] = (1<<5)|(1<<4);
			break ;
		case F_MODE_RGB444:
		default:
			// AviInfo->info.ColorMode = 0 ;
			AviInfo->pktbyte.AVI_DB[0] = (0<<5)|(1<<4);
			break ;
	}
	AviInfo->pktbyte.AVI_DB[0] |= 0x02 ;
	AviInfo->pktbyte.AVI_DB[1] = 8 ;
	AviInfo->pktbyte.AVI_DB[1] |= (aspec != HDMI_16x9)?(1<<4):(2<<4); // 4:3 or 16:9
	AviInfo->pktbyte.AVI_DB[1] |= (Colorimetry != HDMI_ITU709)?(1<<6):(2<<6); // 4:3 or 16:9
	AviInfo->pktbyte.AVI_DB[2] = 0 ;
	AviInfo->pktbyte.AVI_DB[3] = VIC ;
	AviInfo->pktbyte.AVI_DB[4] =  pixelrep & 3 ;
	AviInfo->pktbyte.AVI_DB[5] = 0 ;
	AviInfo->pktbyte.AVI_DB[6] = 0 ;
	AviInfo->pktbyte.AVI_DB[7] = 0 ;
	AviInfo->pktbyte.AVI_DB[8] = 0 ;
	AviInfo->pktbyte.AVI_DB[9] = 0 ;
	AviInfo->pktbyte.AVI_DB[10] = 0 ;
	AviInfo->pktbyte.AVI_DB[11] = 0 ;
	AviInfo->pktbyte.AVI_DB[12] = 0 ;

	HDMITX_EnableAVIInfoFrame(TRUE, (unsigned char *)AviInfo);

}
Exemple #26
0
static int __devexit rk610_hdmi_i2c_remove(struct i2c_client *client)
{
	struct rk610_hdmi_pdata *rk610_hdmi = (struct rk610_hdmi_pdata *)i2c_get_clientdata(client);
	struct hdmi *hdmi = rk610_hdmi->hdmi;
	
	#ifdef HDMI_USE_IRG
	free_irq(rk610_hdmi->irq, NULL);
	gpio_free(client->irq);
	#endif
	hdmi_unregister(hdmi);
	kfree(rk610_hdmi);
	rk610_hdmi = NULL;
	kfree(hdmi);
	hdmi = NULL;
		
	hdmi_dbg(hdmi->dev, "%s\n", __func__);
    return 0;
}
Exemple #27
0
static int __devexit anx7150_i2c_remove(struct i2c_client *client)
{
	struct anx7150_pdata *anx = (struct anx7150_pdata *)i2c_get_clientdata(client);
	struct hdmi *hdmi = anx->dev.hdmi;

	#ifdef HDMI_USE_IRG
	free_irq(anx->irq, NULL);
	gpio_free(client->irq);
	#endif
	hdmi_unregister(hdmi);
	kfree(anx);
	anx = NULL;
	kfree(hdmi);
	hdmi = NULL;
		
	hdmi_dbg(hdmi->dev, "%s\n", __func__);
    return 0;
}
static void rk616_hdmi_shutdown(struct platform_device *pdev)
{
	if(hdmi) {
#ifdef CONFIG_HAS_EARLYSUSPEND
		unregister_early_suspend(&hdmi->early_suspend);
#endif 
                flush_delayed_work(&hdmi->delay_work);
                mutex_lock(&hdmi->enable_mutex);
                hdmi->suspend = 1;
                if(!hdmi->enable) {
                        mutex_unlock(&hdmi->enable_mutex);
                        return;
                }
                if (hdmi->irq)
                        disable_irq(hdmi->irq);
                mutex_unlock(&hdmi->enable_mutex);
        }
        hdmi_dbg(hdmi->dev,  "rk616 hdmi shut down.\n");
}
Exemple #29
0
void rk30_hdmi_control_output(int enable)
{
	hdmi_dbg(hdmi->dev, "[%s] %d\n", __FUNCTION__, enable);
	if(enable == 0) {
		HDMIWrReg(VIDEO_SETTING2, 0x03);
	}
	else {
		if(hdmi->pwr_mode == PWR_SAVE_MODE_B) {
			//  Switch to power save mode_d
			rk30_hdmi_set_pwr_mode(PWR_SAVE_MODE_D);
		}
		if(hdmi->pwr_mode == PWR_SAVE_MODE_D) {
			//  Switch to power save mode_e
			rk30_hdmi_set_pwr_mode(PWR_SAVE_MODE_E);
		}
		HDMIWrReg(VIDEO_SETTING2, 0x00);
		rk30_hdmi_audio_reset();
	}
}