hdmi: delete older version driver which is no longer used.

This commit is contained in:
Zheng Yang
2014-08-22 14:16:27 +08:00
parent c99cf18c14
commit fc130c98c7
16 changed files with 0 additions and 8994 deletions

View File

@@ -1,28 +0,0 @@
#
# Display drivers configuration
#
menu "HDMI"
config HDMI
bool "HDMI support"
select FB_WORK_IPP
select FB_SCALING_OSD
if HDMI
source "drivers/video/hdmi/chips/Kconfig"
config HDMI_SAVE_DATA
bool "enable hdmi save data"
help
Enable hdmi save data in rtc register
config HDMI_DUAL_DISP
bool "dual display support"
depends on RK610_HDMI
help
Support output lcd and hdmi at the same time.
#config HDMI_DEBUG
# bool "hdmi debug"
endif
endmenu

View File

@@ -1,2 +0,0 @@
obj-$(CONFIG_HDMI) += hdmi-core.o hdmi-sysfs.o hdmi-fb.o hdmi-backlight.o
obj-$(CONFIG_HDMI) += chips/

View File

@@ -1,12 +0,0 @@
choice
prompt "HDMI chips select"
config ANX7150
bool "anx7150"
config ANX9030
bool "anx9030"
config RK610_HDMI
bool "RK610(Jetta) hdmi support"
depends on MFD_RK610
help
Support Jetta(RK610) to hdmi.
endchoice

View File

@@ -1,2 +0,0 @@
obj-$(CONFIG_ANX7150) += anx7150/anx7150.o anx7150/anx7150_hw.o
obj-$(CONFIG_RK610_HDMI) += rk610/rk610_hdmi.o rk610/rk610_hdmi_hw.o

View File

@@ -1,283 +0,0 @@
#include <linux/kernel.h>
#include <linux/delay.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/hdmi.h>
#include <linux/i2c.h>
#include <linux/interrupt.h>
#include <mach/gpio.h>
#include <mach/iomux.h>
#include <mach/board.h>
#include "anx7150.h"
#include "anx7150_hw.h"
int anx7150_i2c_read_p0_reg(struct i2c_client *client, char reg, char *val)
{
client->addr = ANX7150_I2C_ADDR0;
return i2c_master_reg8_recv(client, reg, val, 1, ANX7150_SCL_RATE) > 0? 0: -EINVAL;
}
int anx7150_i2c_write_p0_reg(struct i2c_client *client, char reg, char *val)
{
client->addr = ANX7150_I2C_ADDR0;
return i2c_master_reg8_send(client, reg, val, 1, ANX7150_SCL_RATE) > 0? 0: -EINVAL;
}
int anx7150_i2c_read_p1_reg(struct i2c_client *client, char reg, char *val)
{
client->addr = ANX7150_I2C_ADDR1;
return i2c_master_reg8_recv(client, reg, val, 1, ANX7150_SCL_RATE) > 0? 0: -EINVAL;
}
int anx7150_i2c_write_p1_reg(struct i2c_client *client, char reg, char *val)
{
client->addr = ANX7150_I2C_ADDR1;
return i2c_master_reg8_send(client, reg, val, 1, ANX7150_SCL_RATE) > 0? 0: -EINVAL;
}
static int anx7150_precent(struct hdmi *hdmi)
{
struct anx7150_pdata *anx = hdmi_priv(hdmi);
return gpio_get_value(anx->client->irq)?0:1;
}
static int anx7150_param_chg(struct anx7150_pdata *anx)
{
int resolution_real;
resolution_real = ANX7150_Get_Optimal_resolution(anx->hdmi->resolution);
anx->hdmi->resolution = resolution_real;
hdmi_switch_fb(anx->hdmi, HDMI_ENABLE);
HDMI_Set_Video_Format(resolution_real);
HDMI_Set_Audio_Fs(anx->hdmi->audio_fs);
ANX7150_API_HDCP_ONorOFF(anx->hdmi->hdcp_on);
ANX7150_API_System_Config();
ANX7150_Config_Video(anx->client);
ANX7150_Config_Audio(anx->client);
ANX7150_Config_Packet(anx->client);
ANX7150_HDCP_Process(anx->client, anx->hdmi->display_on);
ANX7150_PLAYBACK_Process();
return 0;
}
static int anx7150_insert(struct hdmi *hdmi)
{
int tmo = 10;
struct anx7150_pdata *anx = hdmi_priv(hdmi);
if(anx->init == 1)
return -1;
anx7150_plug(anx->client);
hdmi_dbg(&anx->client->dev, "parse edid\n");
if(ANX7150_Parse_EDID(anx->client,&anx->dev) < 0)
{
dev_info(hdmi->dev, "parse EDID error\n");
anx7150_unplug(anx->client);
return -1;
}
while(--tmo && ANX7150_GET_SENSE_STATE(anx->client) != 1)
mdelay(10);
if(tmo <= 0)
{
anx7150_unplug(anx->client);
dev_dbg(hdmi->dev, "get sense_state error\n");
return -1;
}
hdmi_set_backlight(HDMI_DISABLE);
hdmi->scale = hdmi->scale_set;
anx7150_param_chg(anx);
return 0;
}
static int anx7150_remove(struct hdmi *hdmi)
{
struct anx7150_pdata *anx = hdmi_priv(hdmi);
if(anx->init == 1)
return -1;
anx7150_unplug(anx->client);
hdmi->scale = 100;
hdmi_switch_fb(hdmi, HDMI_DISABLE);
hdmi_set_backlight(HDMI_ENABLE);
return 0;
}
static int anx7150_set_param(struct hdmi *hdmi)
{
struct anx7150_pdata *anx = hdmi_priv(hdmi);
if(anx->init == 1)
return 0;
anx7150_param_chg(anx);
return 0;
}
static int anx7150_init(struct hdmi *hdmi)
{
struct anx7150_pdata *anx = hdmi_priv(hdmi);
#ifdef CONFIG_HDMI_SAVE_DATA
int hdmi_data = hdmi_get_data();
if(hdmi_data<0){
hdmi_set_data((hdmi->resolution&0x7)|((hdmi->scale&0x1f)<<3));
}
else{
hdmi->resolution = hdmi_data&0x7;
hdmi->scale_set= ((hdmi_data>>3)&0x1f) + MIN_SCALE;
hdmi->scale = hdmi->scale_set;
}
#endif
anx->init = 0;
hdmi_changed(hdmi,1);
return 0;
}
static void anx7150_init_work_func(struct work_struct *work)
{
struct anx7150_pdata *anx = container_of(work, struct anx7150_pdata, work.work);
if(anx!=NULL)
anx7150_init(anx->hdmi);
else
printk("anx7150_init_work_func err\n");
}
static struct hdmi_ops anx7150_ops = {
.set_param = anx7150_set_param,
.hdmi_precent = anx7150_precent,
.insert = anx7150_insert,
.remove = anx7150_remove,
.init = anx7150_init,
};
#ifdef CONFIG_HAS_EARLYSUSPEND
static void anx7150_early_suspend(struct early_suspend *h)
{
struct anx7150_pdata *anx = container_of(h,
struct anx7150_pdata,
early_suspend);
dev_info(&anx->client->dev, "anx7150 enter early suspend\n");
hdmi_suspend(anx->hdmi);
return;
}
static void anx7150_early_resume(struct early_suspend *h)
{
struct anx7150_pdata *anx = container_of(h,
struct anx7150_pdata,
early_suspend);
dev_info(&anx->client->dev, "anx7150 exit early suspend\n");
hdmi_resume(anx->hdmi);
return;
}
#endif
static int anx7150_i2c_probe(struct i2c_client *client,const struct i2c_device_id *id)
{
int ret = 0;
struct hdmi *hdmi = NULL;
struct anx7150_pdata *anx = NULL;
struct hdmi_platform_data *pdata = client->dev.platform_data;
if(pdata && pdata->io_init)
pdata->io_init();
hdmi = hdmi_register(sizeof(struct anx7150_pdata), &client->dev);
if (!hdmi)
{
dev_err(&client->dev, "fail to register hdmi\n");
return -ENOMEM;
}
hdmi->ops = &anx7150_ops;
hdmi->display_on = HDMI_DEFAULT_MODE;
hdmi->hdcp_on = HDMI_DISABLE;
hdmi->audio_fs = HDMI_I2S_DEFAULT_Fs;
hdmi->resolution = HDMI_DEFAULT_RESOLUTION;
hdmi->dual_disp = DUAL_DISP_CAP;
hdmi->mode = DISP_ON_LCD;
hdmi->scale = 100;
hdmi->scale_set = 100;
anx = hdmi_priv(hdmi);
anx->init = 1;
anx->hdmi = hdmi;
i2c_set_clientdata(client, anx);
anx->client = client;
if((ret = gpio_request(client->irq, "hdmi gpio")) < 0)
{
dev_err(&client->dev, "fail to request gpio %d\n", client->irq);
goto err_hdmi_unregister;
}
//gpio_pull_updown(client->irq,0);
gpio_direction_input(client->irq);
if(anx7150_detect_device(anx) < 0)
{
dev_err(&client->dev, "anx7150 is not exist\n");
ret = -EIO;
goto err_gpio_free;
}
#ifdef CONFIG_HAS_EARLYSUSPEND
anx->early_suspend.suspend = anx7150_early_suspend;
anx->early_suspend.resume = anx7150_early_resume;
anx->early_suspend.level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN - 1;
register_early_suspend(&anx->early_suspend);
#endif
anx7150_unplug(anx->client);
INIT_DELAYED_WORK(&anx->work,anx7150_init_work_func);
schedule_delayed_work(&anx->work, msecs_to_jiffies(2000));
dev_info(&client->dev, "anx7150 i2c probe ok\n");
return 0;
err_gpio_free:
gpio_free(client->irq);
err_hdmi_unregister:
hdmi_unregister(hdmi);
anx = NULL;
return ret;
}
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->hdmi;
gpio_free(client->irq);
hdmi_unregister(hdmi);
anx = NULL;
return 0;
}
static const struct i2c_device_id anx7150_id[] = {
{ "anx7150", 0 },
{ }
};
static struct i2c_driver anx7150_i2c_driver = {
.driver = {
.name = "anx7150",
.owner = THIS_MODULE,
},
.probe = &anx7150_i2c_probe,
.remove = &anx7150_i2c_remove,
.id_table = anx7150_id,
};
static int __init anx7150_module_init(void)
{
return i2c_add_driver(&anx7150_i2c_driver);
}
static void __exit anx7150_module_exit(void)
{
i2c_del_driver(&anx7150_i2c_driver);
}
module_init(anx7150_module_init);
//fs_initcall(anx7150_module_init);
module_exit(anx7150_module_exit);

View File

@@ -1,99 +0,0 @@
#ifndef _ANX7150_H
#define _ANX7150_H
#include <linux/hdmi.h>
#include <linux/earlysuspend.h>
#define ANX7150_I2C_ADDR0 0X39
#define ANX7150_I2C_ADDR1 0X3d
#define ANX7150_SCL_RATE 100 * 1000
/* HDMI auto switch */
#define HDMI_AUTO_SWITCH HDMI_ENABLE
/* HDMI reciver status */
#define HDMI_RECIVER_INACTIVE 0
#define HDMI_RECIVER_ACTIVE 1
/* ANX7150 reciver HPD Status */
#define HDMI_RECIVER_UNPLUG 0
#define HDMI_RECIVER_PLUG 1
#define LCD 0
#define HDMI 1
#define RK29_OUTPUT_STATUS_LCD LCD
#define RK29_OUTPUT_STATUS_HDMI HDMI
/* HDMI HDCP ENABLE */
#define ANX7150_HDCP_EN HDMI_DISABLE
/* ANX7150 state machine */
enum{
HDMI_INITIAL = 1,
WAIT_HOTPLUG,
READ_PARSE_EDID,
WAIT_RX_SENSE,
WAIT_HDMI_ENABLE,
SYSTEM_CONFIG,
CONFIG_VIDEO,
CONFIG_AUDIO,
CONFIG_PACKETS,
HDCP_AUTHENTICATION,
PLAY_BACK,
RESET_LINK,
UNKNOWN,
};
struct anx7150_dev_s{
struct i2c_driver *i2c_driver;
struct fasync_struct *async_queue;
struct workqueue_struct *workqueue;
struct delayed_work delay_work;
struct miscdevice *mdev;
void (*notifier_callback)(struct anx7150_dev_s *);
int anx7150_detect;
int resolution_set;
int resolution_real;
int i2s_Fs;
int hdmi_enable;
int hdmi_auto_switch;
int reciver_status;
int HPD_change_cnt;
int HPD_status;
int rk29_output_status;
int hdcp_enable;
int parameter_config;
int rate;
int fb_switch_state;
struct hdmi *hdmi;
};
struct anx7150_pdata {
int irq;
int gpio;
int init;
int is_early_suspend;
int is_changed;
struct delayed_work work;
struct hdmi *hdmi;
struct i2c_client *client;
struct anx7150_dev_s dev;
#ifdef CONFIG_HAS_EARLYSUSPEND
struct early_suspend early_suspend;
#endif
};
int anx7150_i2c_read_p0_reg(struct i2c_client *client, char reg, char *val);
int anx7150_i2c_write_p0_reg(struct i2c_client *client, char reg, char *val);
int anx7150_i2c_read_p1_reg(struct i2c_client *client, char reg, char *val);
int anx7150_i2c_write_p1_reg(struct i2c_client *client, char reg, char *val);
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,310 +0,0 @@
#include <linux/kernel.h>
#include <linux/delay.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/hdmi.h>
#include <linux/i2c.h>
#include <linux/interrupt.h>
#include <mach/gpio.h>
#include <mach/iomux.h>
#include <mach/board.h>
#include <linux/irq.h>
#include <linux/mfd/rk610_core.h>
#include "rk610_hdmi.h"
#include "rk610_hdmi_hw.h"
struct i2c_client *rk610_g_hdmi_client=NULL;
static bool hpd=0;
static void rk610_handler(struct work_struct *work)
{
struct i2c_client *client = rk610_g_hdmi_client;
if(client==NULL){
printk(">>> %s client==NULL\n",__func__);
}
Rk610_hdmi_event_work(client,&hpd);
}
static DECLARE_DELAYED_WORK(rk610_irq_work, rk610_handler);
static int rk610_hdmi_precent(struct hdmi *hdmi)
{
//struct rk610_hdmi_inf *rk610_hdmi = hdmi_priv(hdmi);
schedule_delayed_work(&rk610_irq_work, msecs_to_jiffies(30));
return hpd;
}
static int rk610_hdmi_param_chg(struct rk610_hdmi_inf *rk610_hdmi)
{
int resolution_real;
RK610_DBG(&rk610_hdmi->client->dev,"%s \n",__FUNCTION__);
resolution_real = Rk610_Get_Optimal_resolution(rk610_hdmi->hdmi->resolution);
rk610_hdmi->hdmi->resolution = resolution_real;
hdmi_switch_fb(rk610_hdmi->hdmi, rk610_hdmi->hdmi->display_on);
Rk610_hdmi_Set_Video(rk610_hdmi->hdmi->resolution);
Rk610_hdmi_Set_Audio(rk610_hdmi->hdmi->audio_fs);
Rk610_hdmi_Config_Done(rk610_hdmi->client);
return 0;
}
static int rk610_hdmi_set_param(struct hdmi *hdmi)
{
struct rk610_hdmi_inf *rk610_hdmi = hdmi_priv(hdmi);
RK610_DBG(&rk610_hdmi->client->dev,"%s \n",__FUNCTION__);
if(rk610_hdmi->init == 1)
return 0;
rk610_hdmi_param_chg(rk610_hdmi);
return 0;
}
static int rk610_hdmi_insert(struct hdmi *hdmi)
{
struct rk610_hdmi_inf *rk610_hdmi = hdmi_priv(hdmi);
RK610_DBG(&rk610_hdmi->client->dev,"%s \n",__FUNCTION__);
if(rk610_hdmi->init == 1)
return -1;
Rk610_hdmi_plug(rk610_hdmi->client);
rk610_hdmi_param_chg(rk610_hdmi);
printk("rk610_hdmi_insert hdmi->display_on=%d\n",hdmi->display_on);
hdmi->scale = hdmi->scale_set;
return 0;
}
static int rk610_hdmi_remove(struct hdmi *hdmi)
{
struct rk610_hdmi_inf *rk610_hdmi = hdmi_priv(hdmi);
RK610_DBG(&rk610_hdmi->client->dev,"%s \n",__FUNCTION__);
if(rk610_hdmi->init == 1)
return -1;
hdmi_switch_fb(hdmi, HDMI_DISABLE);
Rk610_hdmi_unplug(rk610_hdmi->client);
printk("rk610_hdmi_remove hdmi->display_on=%d\n",hdmi->display_on);
return 0;
}
#ifdef CONFIG_HAS_EARLYSUSPEND
static void rk610_hdmi_early_suspend(struct early_suspend *h)
{
struct rk610_hdmi_inf *rk610_hdmi = container_of(h,
struct rk610_hdmi_inf,
early_suspend);
printk( "rk610_hdmi enter early suspend\n");
hdmi_suspend(rk610_hdmi->hdmi);
Rk610_hdmi_suspend(rk610_hdmi->client);
return;
}
static void rk610_hdmi_early_resume(struct early_suspend *h)
{
struct rk610_hdmi_inf *rk610_hdmi = container_of(h,
struct rk610_hdmi_inf,
early_suspend);
printk("rk610_hdmi exit early suspend\n");
hdmi_resume(rk610_hdmi->hdmi);
Rk610_hdmi_resume(rk610_hdmi->client);
return;
}
#endif
static int rk610_hdmi_init(struct hdmi *hdmi)
{
struct rk610_hdmi_inf *rk610_hdmi = hdmi_priv(hdmi);
#ifdef CONFIG_HDMI_SAVE_DATA
int hdmi_data = hdmi_get_data();
if(hdmi_data<0){
hdmi_set_data((hdmi->resolution&0x7)|((hdmi->scale&0x1f)<<3));
}
else{
hdmi->resolution = hdmi_data&0x7;
hdmi->scale_set= ((hdmi_data>>3)&0x1f) + MIN_SCALE;
hdmi->scale = hdmi->scale_set;
}
#endif
RK610_DBG(&rk610_hdmi->client->dev,"%s \n",__FUNCTION__);
rk610_hdmi->init =0;
Rk610_hdmi_init(rk610_hdmi->client);
hdmi_changed(hdmi,1);
Rk610_hdmi_Set_Video(hdmi->resolution);
Rk610_hdmi_Set_Audio(hdmi->audio_fs);
Rk610_hdmi_Config_Done(rk610_hdmi->client);
return 0;
}
static struct hdmi_ops rk610_hdmi_ops = {
.set_param = rk610_hdmi_set_param,
.hdmi_precent = rk610_hdmi_precent,
.insert = rk610_hdmi_insert,
.remove = rk610_hdmi_remove,
.init = rk610_hdmi_init,
};
#ifdef RK610_DEBUG
static int rk610_read_p0_reg(struct i2c_client *client, char reg, char *val)
{
return i2c_master_reg8_recv(client, reg, val, 1, 100*1000) > 0? 0: -EINVAL;
}
static int rk610_write_p0_reg(struct i2c_client *client, char reg, char *val)
{
return i2c_master_reg8_send(client, reg, val, 1, 100*1000) > 0? 0: -EINVAL;
}
static ssize_t rk610_show_reg_attrs(struct device *dev,
struct device_attribute *attr,
char *buf)
{
int i,size=0;
char val;
struct i2c_client *client=rk610_g_hdmi_client;
for(i=0;i<256;i++)
{
rk610_read_p0_reg(client, i, &val);
if(i%16==0)
size += sprintf(buf+size,"\n>>>rk610_hdmi %x:",i);
size += sprintf(buf+size," %2x",val);
}
return size;
}
static ssize_t rk610_store_reg_attrs(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t size)
{
struct i2c_client *client=NULL;
static char val=0,reg=0;
client = rk610_g_hdmi_client;
RK610_DBG(&client->dev,"/**********rk610 reg config******/");
sscanf(buf, "%x%x", &val,&reg);
RK610_DBG(&client->dev,"reg=%x val=%x\n",reg,val);
rk610_write_p0_reg(client, reg, &val);
RK610_DBG(&client->dev,"val=%x\n",val);
return size;
}
static struct device_attribute rk610_attrs[] = {
__ATTR(reg_ctl, 0777,rk610_show_reg_attrs,rk610_store_reg_attrs),
};
#endif
#if 0
static irqreturn_t rk610_hdmi_interrupt(int irq, void *dev_id)
{
struct hdmi *hdmi = (struct hdmi *)dev_id;
unsigned long lock_flags = 0;
printk("The rk610_hdmi interrupt handeler is working..\n");
return IRQ_HANDLED;
}
#endif
static int rk610_hdmi_i2c_probe(struct i2c_client *client,const struct i2c_device_id *id)
{
int ret = 0;
struct hdmi *hdmi = NULL;
struct rk610_hdmi_inf *rk610_hdmi = NULL;
struct hdmi_platform_data *pdata = client->dev.platform_data;
rk610_g_hdmi_client = client;
if(pdata && pdata->io_init)
{
printk("rk610_hdmi_i2c_probe io_init \n");
pdata->io_init();
}
hdmi = hdmi_register(sizeof(struct rk610_hdmi_inf), &client->dev);
if (!hdmi)
{
dev_err(&client->dev, "fail to register hdmi\n");
return -ENOMEM;
}
if(HDMI_SOURCE_DEFAULT == HDMI_SOURCE_LCDC0)
hdmi->lcdc = rk_get_lcdc_drv("lcdc0");
else
hdmi->lcdc = rk_get_lcdc_drv("lcdc1");
if(hdmi->lcdc == NULL)
{
dev_err(hdmi->dev, "can not connect to video source lcdc\n");
ret = -ENXIO;
}
hdmi->ops = &rk610_hdmi_ops;
hdmi->display_on = HDMI_DEFAULT_MODE;
hdmi->hdcp_on = HDMI_DISABLE;
hdmi->audio_fs = HDMI_I2S_DEFAULT_Fs;
hdmi->resolution = HDMI_DEFAULT_RESOLUTION;
hdmi->dual_disp = DUAL_DISP_CAP;
hdmi->mode = DISP_ON_LCD;
hdmi->scale = 100;
hdmi->scale_set = 100;
rk610_hdmi = hdmi_priv(hdmi);
rk610_hdmi->init = 1;
rk610_hdmi->hdmi = hdmi;
i2c_set_clientdata(client, rk610_hdmi);
rk610_hdmi->client = client;
if((gpio_request(client->irq, "hdmi gpio")) < 0)
{
dev_err(&client->dev, "fail to request gpio %d\n", client->irq);
goto err_gpio_free;
}
rk610_hdmi->irq = gpio_to_irq(client->irq);
rk610_hdmi->gpio = client->irq;
gpio_direction_input(client->irq);
#if 0
if((ret = request_irq(rk610_hdmi->irq, rk610_hdmi_interrupt, IRQ_TYPE_EDGE_RISING,client->name, hdmi))<0){
RK610_ERR(&client->dev, "fail to request gpio %d\n", client->irq);
goto err_gpio_free;
}
#endif
#ifdef CONFIG_HAS_EARLYSUSPEND
rk610_hdmi->early_suspend.suspend = rk610_hdmi_early_suspend;
rk610_hdmi->early_suspend.resume = rk610_hdmi_early_resume;
rk610_hdmi->early_suspend.level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN - 1;
register_early_suspend(&rk610_hdmi->early_suspend);
#endif
#ifdef RK610_DEBUG
device_create_file(&(client->dev), &rk610_attrs[0]);
#endif
rk610_hdmi_init(rk610_hdmi->hdmi);
dev_info(&client->dev, "rk610_hdmi i2c probe ok\n");
return 0;
err_gpio_free:
gpio_free(client->irq);
err_hdmi_unregister:
hdmi_unregister(hdmi);
rk610_hdmi = NULL;
return ret;
}
static int __devexit rk610_hdmi_i2c_remove(struct i2c_client *client)
{
struct rk610_hdmi_inf *rk610_hdmi = (struct rk610_hdmi_inf *)i2c_get_clientdata(client);
struct hdmi *hdmi = rk610_hdmi->hdmi;
gpio_free(client->irq);
hdmi_unregister(hdmi);
rk610_hdmi = NULL;
return 0;
}
static const struct i2c_device_id rk610_hdmi_id[] = {
{ "rk610_hdmi", 0 },
{ }
};
static struct i2c_driver rk610_hdmi_i2c_driver = {
.driver = {
.name = "rk610_hdmi",
},
.probe = &rk610_hdmi_i2c_probe,
.remove = &rk610_hdmi_i2c_remove,
.id_table = rk610_hdmi_id,
};
static int __init rk610_hdmi_module_init(void)
{
return i2c_add_driver(&rk610_hdmi_i2c_driver);
}
static void __exit rk610_hdmi_module_exit(void)
{
i2c_del_driver(&rk610_hdmi_i2c_driver);
}
device_initcall_sync(rk610_hdmi_module_init);
module_exit(rk610_hdmi_module_exit);

View File

@@ -1,36 +0,0 @@
#ifndef _RK610_H
#define _RK610_H
#include <linux/hdmi.h>
#include <linux/earlysuspend.h>
/************RK610 device addr***********/
#define RK610_CTRL_ADDR 0x40
#define RK610_TVE_ADDR 0x42
#define RK610_HDMI_ADDR 0x46
#define RK610_CODEC_ADDR 0xc0 // 0x11xxxxxx
/****************HDMI STRUCT********************************/
struct rk610_hdmi_inf{
int irq;
int gpio;
int init;
struct i2c_client *client;
struct hdmi *hdmi;
#ifdef CONFIG_HAS_EARLYSUSPEND
struct early_suspend early_suspend;
#endif
};
/******************TVE STRUCT **************/
/*************RK610 STRUCT**********************************/
//struct rk610_pdata {
// struct rk610_hdmi_inf hdmi;
// struct rk610_lcd_info lcd;
//};
/*****************END ***********************************/
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -1,258 +0,0 @@
#ifndef _RK610_HDMI_HW_H
#define _RK610_HDMI_HW_H
#include <linux/earlysuspend.h>
#define MAX_V_DESCRIPTORS 20
#define MAX_A_DESCRIPTORS 10
#define MAX_SPEAKER_CONFIGURATIONS 4
#define AUDIO_DESCR_SIZE 3
#define EDID_BLOCK_SIZE 128
#define NUM_OF_EXTEN_ADDR 0x7e
#define EDID_HDR_NO_OF_FF 0x06
// Data Block Tag Codes
//====================================================
#define AUDIO_D_BLOCK 0x01
#define VIDEO_D_BLOCK 0x02
#define VENDOR_SPEC_D_BLOCK 0x03
#define SPKR_ALLOC_D_BLOCK 0x04
#define USE_EXTENDED_TAG 0x07
// Extended Data Block Tag Codes
//====================================================
#define COLORIMETRY_D_BLOCK 0x05
#define HDMI_SIGNATURE_LEN 0x03
#define CEC_PHYS_ADDR_LEN 0x02
#define EDID_EXTENSION_TAG 0x02
#define EDID_REV_THREE 0x03
#define EDID_DATA_START 0x04
#define EDID_BLOCK_0 0x00
#define EDID_BLOCK_2_3 0x01
#define VIDEO_CAPABILITY_D_BLOCK 0x00
//#define DEV_SUPPORT_CEC
#if 1
#define MSBIT 0x80
#define LSBIT 0x01
#define TWO_LSBITS 0x03
#define THREE_LSBITS 0x07
#define FOUR_LSBITS 0x0F
#define FIVE_LSBITS 0x1F
#define SEVEN_LSBITS 0x7F
#define TWO_MSBITS 0xC0
#define EIGHT_BITS 0xFF
#define BYTE_SIZE 0x08
#define BITS_1_0 0x03
#define BITS_2_1 0x06
#define BITS_2_1_0 0x07
#define BITS_3_2 0x0C
#define BITS_4_3_2 0x1C
#define BITS_5_4 0x30
#define BITS_5_4_3 0x38
#define BITS_6_5 0x60
#define BITS_6_5_4 0x70
#define BITS_7_6 0xC0
#define TPI_INTERNAL_PAGE_REG 0xBC
#define TPI_INDEXED_OFFSET_REG 0xBD
#define TPI_INDEXED_VALUE_REG 0xBE
#define EDID_TAG_ADDR 0x00
#define EDID_REV_ADDR 0x01
#define EDID_TAG_IDX 0x02
#define LONG_DESCR_PTR_IDX 0x02
#define MISC_SUPPORT_IDX 0x03
#define ESTABLISHED_TIMING_INDEX 35 // Offset of Established Timing in EDID block
#define NUM_OF_STANDARD_TIMINGS 8
#define STANDARD_TIMING_OFFSET 38
#define LONG_DESCR_LEN 18
#define NUM_OF_DETAILED_DESCRIPTORS 4
#define DETAILED_TIMING_OFFSET 0x36
#endif
enum{
EDID_BLOCK0=0,
EDID_BLOCK1,
EDID_BLOCK2,
EDID_BLOCK3,
};
#define RK610_SYS_FREG_CLK 11289600
#define RK610_SCL_RATE (100*1000)
#define RK610_DDC_CONFIG (RK610_SYS_FREG_CLK>>2)/RK610_SCL_RATE
#define FALSE 0
#define TRUE 1
//EVENT
#define RK610_HPD_EVENT 1<<7
#define RK610_HPD_PLUG 1<<7
#define RK610_EDID_EVENT 1<<2
//output mode 0x52
#define DISPLAY_DVI 0
#define DISPLAY_HDMI 1
#define DISPLAY_MODE (1<<1)
//0x00
#define RK610_INT_POL 1
#define RK610_SYS_PWR_ON 0
#define RK610_SYS_PWR_OFF 1
#define RK610_PHY_CLK 0
#define RK610_SYS_CLK 1
#define RK610_MCLK_FS 0x01 //256fs
//0x01
// INPUT_VIDEO_FORMAT
#define RGB_YUV444 0x00
#define DDR_RGB444_YUV444 0x05
#define DDR_YUV422 0x06
//0x02
//video output format
#define RGB444 0x00
#define YUV444 0x01
#define YUV422 0x02
//DATA WIDTH
#define DATA_12BIT 0X00
#define DATA_10BIT 0X01
#define DATA_8BIT 0X03
//0X04
//1:after 0:not After 1st sof for external DE sample
#define DE_AFTER_SOF 0
#define DE_NOAFTER_SOF 1
#define CSC_ENABLE 0
#define CSC_DISABLE 1
//0X05
#define CLEAR_AVMUTE(x) (x)<<7
#define SET_AVMUTE(x) (x)<<6
#define AUDIO_MUTE(x) (x)<<1
#define VIDEO_BLACK(x) (x)<<0 //1:black 0:normal
//0x08
#define VSYNC_POL(x) (x)<<3 //0:Negative 1:Positive
#define HSYNC_POL(x) (x)<<2 //0:Negative 1:Positive
#define INTER_PROGRESSIVE(x) (x)<<1 //0: progressive 1:interlace
#define VIDEO_SET_ENABLE(x) (x)<<0 //0:disable 1: enable
/* 0xe1 */
//Main-driver strength :0000~1111: the strength from low to high
#define M_DRIVER_STR(x) (((x)&0xf)<<4)
//Pre-driver strength :00~11: the strength from low to high
#define P_DRIVER_STR(x) (((x)&3)<<2)
//TX driver enable 1: enable 0: disable
#define TX_DRIVER_EN(x) (((x)&1)<<1)
/* 0xe2 */
//Pre-emphasis strength 00~11: the strength from 0 to high
#define P_EMPHASIS_STR(x) (((x)&3)<<4)
//Power down TMDS driver 1: power down. 0: not
#define PWR_DOWN_TMDS(x) (((x)&1)<<0)
/* 0xe3 */
//PLL out enable. Just for test. need set to 1<><31>b0
#define PLL_OUT_EN(x) (((x)&1)<<7)
/* 0xe4 */
// Band-Gap power down 11: power down 00: not
#define BAND_PWR(x) (((x)&3)<<0)
/* 0xe5 */
//PLL disable 1: disable 0: enable
#define PLL_PWR(x) (((x)&1)<<4)
// PLL reset 1: reset 0: not
#define PLL_RST(x) (((x)&1)<<3)
//PHY TMDS channels reset 1: reset 0: not
#define TMDS_RST(x) (((x)&1)<<2)
/* 0xe7 */
// PLL LDO power down 1: power down 0: not
#define PLL_LDO_PWR(x) (((x)&1)<<2)
/**********CONFIG CHANGE ************/
#define VIDEO_CHANGE 1<<0
#define AUDIO_CHANGE 1<<1
#define byte u8
#define HDMI_VIC_1080p_50Hz 0x1f
#define HDMI_VIC_1080p_60Hz 0x10
#define HDMI_VIC_720p_50Hz 0x13
#define HDMI_VIC_720p_60Hz 0x04
#define HDMI_VIC_576p_50Hz 0x11
#define HDMI_VIC_480p_60Hz 0x02
struct edid_result{
bool supported_720p_50Hz;
bool supported_720p_60Hz;
bool supported_576p_50Hz;
bool supported_720x480p_60Hz;
bool supported_1080p_50Hz;
bool supported_1080p_60Hz;
};
typedef struct edid_info
{ // for storing EDID parsed data
byte edidDataValid;
byte VideoDescriptor[MAX_V_DESCRIPTORS]; // maximum number of video descriptors
byte AudioDescriptor[MAX_A_DESCRIPTORS][3]; // maximum number of audio descriptors
byte SpkrAlloc[MAX_SPEAKER_CONFIGURATIONS]; // maximum number of speaker configurations
byte UnderScan; // "1" if DTV monitor underscans IT video formats by default
byte BasicAudio; // Sink supports Basic Audio
byte YCbCr_4_4_4; // Sink supports YCbCr 4:4:4
byte YCbCr_4_2_2; // Sink supports YCbCr 4:2:2
byte HDMI_Sink; // "1" if HDMI signature found
byte CEC_A_B; // CEC Physical address. See HDMI 1.3 Table 8-6
byte CEC_C_D;
byte ColorimetrySupportFlags; // IEC 61966-2-4 colorimetry support: 1 - xvYCC601; 2 - xvYCC709
byte MetadataProfile;
byte _3D_Supported;
} EDID_INF;
enum EDID_ErrorCodes
{
EDID_OK,
EDID_INCORRECT_HEADER,
EDID_CHECKSUM_ERROR,
EDID_NO_861_EXTENSIONS,
EDID_SHORT_DESCRIPTORS_OK,
EDID_LONG_DESCRIPTORS_OK,
EDID_EXT_TAG_ERROR,
EDID_REV_ADDR_ERROR,
EDID_V_DESCR_OVERFLOW,
EDID_UNKNOWN_TAG_CODE,
EDID_NO_DETAILED_DESCRIPTORS,
EDID_DDC_BUS_REQ_FAILURE,
EDID_DDC_BUS_RELEASE_FAILURE
};
enum PWR_MODE{
NORMAL,
LOWER_PWR,
};
struct rk610_hdmi_hw_inf{
struct i2c_client *client;
EDID_INF *edid_inf;
u8 video_format;
u8 audio_fs;
u8 config_param;
bool suspend_flag;
bool hpd;
bool analog_sync;
};
#ifdef CONFIG_HAS_EARLYSUSPEND
extern int Rk610_hdmi_suspend(struct i2c_client *client);
extern int Rk610_hdmi_resume(struct i2c_client *client);
#endif
extern void Rk610_hdmi_plug(struct i2c_client *client);
extern void Rk610_hdmi_unplug(struct i2c_client *client);
extern int Rk610_hdmi_Set_Video(u8 video_format);
extern int Rk610_hdmi_Set_Audio(u8 audio_fs);
extern int Rk610_hdmi_Config_Done(struct i2c_client *client);
extern int Rk610_Get_Optimal_resolution(int resolution_set);
extern void Rk610_hdmi_event_work(struct i2c_client *client, bool *hpd);
extern int Rk610_hdmi_init(struct i2c_client *client);
#endif

View File

@@ -1,23 +0,0 @@
#include <linux/hdmi.h>
#ifdef CONFIG_BACKLIGHT_RK29_BL
/* drivers/video/backlight/rk29_backlight.c */
extern void rk29_backlight_set(bool on);
#else
void rk29_backlight_set(bool on)
{
/* please add backlight switching-related code here or on your backlight driver
parameter: on=1 ==> open spk
on=0 ==> close spk
*/
}
#endif
#ifdef CONFIG_FB_RK29 && CONFIG_HDMI_DUAL_DISP
extern void rk29_lcd_set(bool on);
#else
void rk29_lcd_set(bool on){}
#endif
void hdmi_set_backlight(int on)
{
rk29_backlight_set(on);
rk29_lcd_set(on);
}

View File

@@ -1,254 +0,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 = hdmi->display_on;
kobject_uevent(&hdmi->dev->kobj, KOBJ_CHANGE);
}
else
hdmi_dbg(hdmi->dev, "insert error\n");
hdmi_set_backlight(hdmi->display_on==DISP_ON_HDMI?HDMI_DISABLE: HDMI_ENABLE);
}
else if(precent &&(hdmi->mode != hdmi->display_on)&& hdmi->display_on){
hdmi->mode = hdmi->display_on;
hdmi_set_backlight(hdmi->display_on==DISP_ON_HDMI?HDMI_DISABLE: HDMI_ENABLE);
}
else if((!precent || !hdmi->display_on) && hdmi->mode != DISP_ON_LCD){
if(hdmi->ops->remove(hdmi) == 0){
hdmi->mode = DISP_ON_LCD;
hdmi_set_backlight(HDMI_ENABLE);
kobject_uevent(&hdmi->dev->kobj, KOBJ_CHANGE);
}
else
hdmi_dbg(hdmi->dev, "remove error\n");
}
mutex_unlock(&hdmi->lock);
return;
}
void hdmi_changed(struct hdmi *hdmi, int msec)
{
schedule_delayed_work(&hdmi->work, msecs_to_jiffies(msec));
return;
}
void hdmi_suspend(struct hdmi *hdmi)
{
del_timer(&hdmi->timer);
flush_delayed_work(&hdmi->work);
if(hdmi->mode != DISP_ON_LCD){
hdmi->ops->remove(hdmi);
hdmi->mode = DISP_ON_LCD;
}
return;
}
void hdmi_resume(struct hdmi *hdmi)
{
mod_timer(&hdmi->timer, jiffies + msecs_to_jiffies(10));
return;
}
static void hdmi_changed_work(struct work_struct *work)
{
struct hdmi *hdmi = container_of(work, struct hdmi,
work.work);
__hdmi_changed(hdmi);
return;
}
void *hdmi_priv(struct hdmi *hdmi)
{
return (void *)hdmi->priv;
}
static void hdmi_detect_timer(unsigned long data)
{
struct hdmi *hdmi = (struct hdmi*)data;
int precent = hdmi->ops->hdmi_precent(hdmi);
if((precent && hdmi->mode == DISP_ON_LCD) ||
(!precent && hdmi->mode != DISP_ON_LCD))
hdmi_changed(hdmi, 100);
mod_timer(&hdmi->timer, jiffies + msecs_to_jiffies(200));
}
struct hdmi *hdmi_register(int extra, struct device *parent)
{
int rc = 0, i;
char name[8];
struct hdmi *hdmi = kzalloc(sizeof(struct hdmi)+ extra, GFP_KERNEL);
if(!hdmi)
return NULL;
for(i = 0; i < HDMI_MAX_ID; i++)
{
if(ref_info[i].ref == 0)
{
ref_info[i].ref = 1;
hdmi->id = i;
break;
}
}
if(i == HDMI_MAX_ID)
{
kfree(hdmi);
return NULL;
}
sprintf(name, "hdmi-%d", hdmi->id);
hdmi->dev = device_create(hdmi_class, parent, 0,
"%s", name);
if (IS_ERR(hdmi->dev)) {
rc = PTR_ERR(hdmi->dev);
goto dev_create_failed;
}
dev_set_drvdata(hdmi->dev, hdmi);
ref_info[i].hdmi = hdmi;
INIT_DELAYED_WORK(&hdmi->work, hdmi_changed_work);
rc = hdmi_create_attrs(hdmi);
if (rc)
goto create_attrs_failed;
goto success;
create_attrs_failed:
device_unregister(hdmi->dev);
dev_create_failed:
hdmi_remove_attrs(hdmi);
kfree(hdmi);
return NULL;
success:
mutex_init(&hdmi->lock);
setup_timer(&hdmi->timer, hdmi_detect_timer,(unsigned long)hdmi);
mod_timer(&hdmi->timer, jiffies + msecs_to_jiffies(200));
return hdmi;
}
void hdmi_unregister(struct hdmi *hdmi)
{
int id;
if(!hdmi)
return;
id = hdmi->id;
del_timer(&hdmi->timer);
flush_scheduled_work();
hdmi_remove_attrs(hdmi);
device_unregister(hdmi->dev);
kfree(hdmi);
hdmi = NULL;
ref_info[id].ref = 0;
ref_info[id].hdmi = NULL;
}
struct hdmi *get_hdmi_struct(int nr)
{
if(ref_info[nr].ref == 0)
return NULL;
else
return ref_info[nr].hdmi;
}
int hdmi_is_insert(void)
{
struct hdmi *hdmi = get_hdmi_struct(0);
if(hdmi && hdmi->ops && hdmi->ops->hdmi_precent)
return hdmi->ops->hdmi_precent(hdmi);
else
return 0;
}
int hdmi_get_scale(void)
{
struct hdmi* hdmi = get_hdmi_struct(0);
if(!hdmi)
return 100;
else if(hdmi->mode != DISP_ON_LCD)
return hdmi->scale;
else
return 100;
}
int hdmi_set_scale(int event, char *data, int len)
{
int result;
struct hdmi* hdmi = get_hdmi_struct(0);
if(!hdmi)
return -1;
if(len != 4)
return -1;
if(fb_get_video_mode() || hdmi->mode == DISP_ON_LCD)
return -1;
result = data[0] | data[1]<<1 | data[2]<<2;
if(event != MOUSE_NONE && (result & event) != event)
return -1;
hdmi->scale += data[3];
hdmi->scale = (hdmi->scale>100)?100:hdmi->scale;
hdmi->scale = (hdmi->scale<MIN_SCALE)?MIN_SCALE:hdmi->scale;
return 0;
}
static int __init hdmi_class_init(void)
{
int i;
hdmi_class = class_create(THIS_MODULE, "hdmi");
if (IS_ERR(hdmi_class))
return PTR_ERR(hdmi_class);
for(i = 0; i < HDMI_MAX_ID; i++) {
ref_info[i].id = i;
ref_info[i].ref = 0;
ref_info[i].hdmi = NULL;
}
return 0;
}
static void __exit hdmi_class_exit(void)
{
class_destroy(hdmi_class);
}
EXPORT_SYMBOL(hdmi_changed);
EXPORT_SYMBOL(hdmi_register);
EXPORT_SYMBOL(hdmi_unregister);
EXPORT_SYMBOL(get_hdmi_struct);
subsys_initcall(hdmi_class_init);
module_exit(hdmi_class_exit);

View File

@@ -1,349 +0,0 @@
#include <linux/console.h>
#include <linux/fb.h>
#include <linux/completion.h>
#include <linux/rk_screen.h>
#include <linux/hdmi.h>
#include "../rk29_fb.h"
/* Base */
#define LCD_ACLK 500000000// 312000000
#define OUT_TYPE SCREEN_HDMI
#define OUT_FACE OUT_P888
#define DCLK_POL 1
#define SWAP_RB 0
/* 720p@50Hz Timing */
#define OUT_CLK0 74250000
#define H_PW0 40
#define H_BP0 220
#define H_VD0 1280
#define H_FP0 440
#define V_PW0 5
#define V_BP0 20
#define V_VD0 720
#define V_FP0 5
/* 720p@60Hz Timing */
#define OUT_CLK1 74250000
#define H_PW1 40
#define H_BP1 220
#define H_VD1 1280
#define H_FP1 110
#define V_PW1 5
#define V_BP1 20
#define V_VD1 720
#define V_FP1 5
/* 576p@50Hz Timing */
#define OUT_CLK2 27000000
#define H_PW2 64
#define H_BP2 68
#define H_VD2 720
#define H_FP2 12
#define V_PW2 5
#define V_BP2 39
#define V_VD2 576
#define V_FP2 5
/* 720x480p@60Hz Timing */
#define OUT_CLK3 27000000
#define H_PW3 62
#define H_BP3 60
#define H_VD3 720
#define H_FP3 16
#define V_PW3 6
#define V_BP3 30
#define V_VD3 480
#define V_FP3 9
/* 1080p@50Hz Timing */
#define OUT_CLK5 148500000
#define H_PW4 44
#define H_BP4 148
#define H_VD4 1920
#define H_FP4 528
#define V_PW4 5
#define V_BP4 36
#define V_VD4 1080
#define V_FP4 4
/* 1080p@60Hz Timing */
#define OUT_CLK4 148500000
#define H_PW5 44
#define H_BP5 148
#define H_VD5 1920
#define H_FP5 88
#define V_PW5 5
#define V_BP5 36
#define V_VD5 1080
#define V_FP5 4
extern int FB_Switch_Screen( struct rk29fb_screen *screen, u32 enable );
static int anx7150_init(void)
{
return 0;
}
static int anx7150_standby(u8 enable)
{
return 0;
}
struct rk29fb_screen hdmi_info[] = {
{
.hdmi_resolution = HDMI_1280x720p_50Hz,
.type = OUT_TYPE,
.face = OUT_FACE,
.x_res = H_VD0,
.y_res = V_VD0,
.pixclock = OUT_CLK0,
.lcdc_aclk = LCD_ACLK,
.left_margin = H_BP0,
.right_margin = H_FP0,
.hsync_len = H_PW0,
.upper_margin = V_BP0,
.lower_margin = V_FP0,
.vsync_len = V_PW0,
.pin_hsync = 1,
.pin_vsync = 1,
.pin_den = 0,
.pin_dclk = DCLK_POL,
.swap_rb = SWAP_RB,
.swap_rg = 0,
.swap_gb = 0,
.swap_delta = 0,
.swap_dumy = 0,
.init = anx7150_init,
.standby = anx7150_standby,
}, //HDMI_1280x720p_50Hz
{
.hdmi_resolution = HDMI_1280x720p_60Hz,
.type = OUT_TYPE,
.face = OUT_FACE,
.x_res = H_VD1,
.y_res = V_VD1,
.pixclock = OUT_CLK1,
.lcdc_aclk = LCD_ACLK,
.left_margin = H_BP1,
.right_margin = H_FP1,
.hsync_len = H_PW1,
.upper_margin = V_BP1,
.lower_margin = V_FP1,
.vsync_len = V_PW1,
.pin_hsync = 1,
.pin_vsync = 1,
.pin_den = 0,
.pin_dclk = DCLK_POL,
.swap_rb = SWAP_RB,
.swap_rg = 0,
.swap_gb = 0,
.swap_delta = 0,
.swap_dumy = 0,
.init = anx7150_init,
.standby = anx7150_standby,
}, //HDMI_1280x720p_60Hz
{
.hdmi_resolution = HDMI_720x576p_50Hz_4x3,
.type = OUT_TYPE,
.face = OUT_FACE,
.x_res = H_VD2,
.y_res = V_VD2,
.pixclock = OUT_CLK2,
.lcdc_aclk = LCD_ACLK,
.left_margin = H_BP2,
.right_margin = H_FP2,
.hsync_len = H_PW2,
.upper_margin = V_BP2,
.lower_margin = V_FP2,
.vsync_len = V_PW2,
.pin_hsync = 0,
.pin_vsync = 0,
.pin_den = 0,
.pin_dclk = DCLK_POL,
.swap_rb = SWAP_RB,
.swap_rg = 0,
.swap_gb = 0,
.swap_delta = 0,
.swap_dumy = 0,
.init = anx7150_init,
.standby = anx7150_standby,
}, //HDMI_720x576p_50Hz_4x3
{
.hdmi_resolution = HDMI_720x576p_50Hz_16x9,
.type = OUT_TYPE,
.face = OUT_FACE,
.x_res = H_VD2,
.y_res = V_VD2,
.pixclock = OUT_CLK2,
.lcdc_aclk = LCD_ACLK,
.left_margin = H_BP2,
.right_margin = H_FP2,
.hsync_len = H_PW2,
.upper_margin = V_BP2,
.lower_margin = V_FP2,
.vsync_len = V_PW2,
.pin_hsync = 0,
.pin_vsync = 0,
.pin_den = 0,
.pin_dclk = DCLK_POL,
.swap_rb = SWAP_RB,
.swap_rg = 0,
.swap_gb = 0,
.swap_delta = 0,
.swap_dumy = 0,
.init = anx7150_init,
.standby = anx7150_standby,
}, //HDMI_720x576p_50Hz_16x9
{
.hdmi_resolution = HDMI_720x480p_60Hz_4x3,
.type = OUT_TYPE,
.face = OUT_FACE,
.x_res = H_VD3,
.y_res = V_VD3,
.pixclock = OUT_CLK3,
.lcdc_aclk = LCD_ACLK,
.left_margin = H_BP3,
.right_margin = H_FP3,
.hsync_len = H_PW3,
.upper_margin = V_BP3,
.lower_margin = V_FP3,
.vsync_len = V_PW3,
.pin_hsync = 0,
.pin_vsync = 0,
.pin_den = 0,
.pin_dclk = DCLK_POL,
.swap_rb = SWAP_RB,
.swap_rg = 0,
.swap_gb = 0,
.swap_delta = 0,
.swap_dumy = 0,
.init = anx7150_init,
.standby = anx7150_standby,
}, //HDMI_720x480p_60Hz_4x3
{
.hdmi_resolution = HDMI_720x480p_60Hz_16x9,
.type = OUT_TYPE,
.face = OUT_FACE,
.x_res = H_VD3,
.y_res = V_VD3,
.pixclock = OUT_CLK3,
.lcdc_aclk = LCD_ACLK,
.left_margin = H_BP3,
.right_margin = H_FP3,
.hsync_len = H_PW3,
.upper_margin = V_BP3,
.lower_margin = V_FP3,
.vsync_len = V_PW3,
.pin_hsync = 0,
.pin_vsync = 0,
.pin_den = 0,
.pin_dclk = DCLK_POL,
.swap_rb = SWAP_RB,
.swap_rg = 0,
.swap_gb = 0,
.swap_delta = 0,
.swap_dumy = 0,
.init = anx7150_init,
.standby = anx7150_standby,
}, //HDMI_720x480p_60Hz_16x9
{
.hdmi_resolution = HDMI_1920x1080p_50Hz,
.type = OUT_TYPE,
.face = OUT_FACE,
.x_res = H_VD4,
.y_res = V_VD4,
.pixclock = OUT_CLK4,
.lcdc_aclk = LCD_ACLK,
.left_margin = H_BP4,
.right_margin = H_FP4,
.hsync_len = H_PW4,
.upper_margin = V_BP4,
.lower_margin = V_FP4,
.vsync_len = V_PW4,
.pin_hsync = 1,
.pin_vsync = 1,
.pin_den = 0,
.pin_dclk = DCLK_POL,
.swap_rb = SWAP_RB,
.swap_rg = 0,
.swap_gb = 0,
.swap_delta = 0,
.swap_dumy = 0,
.init = anx7150_init,
.standby = anx7150_standby,
}, //HDMI_1920x1080p_50Hz
{
.hdmi_resolution = HDMI_1920x1080p_60Hz,
.type = OUT_TYPE,
.face = OUT_FACE,
.x_res = H_VD5,
.y_res = V_VD5,
.pixclock = OUT_CLK5,
.lcdc_aclk = LCD_ACLK,
.left_margin = H_BP5,
.right_margin = H_FP5,
.hsync_len = H_PW5,
.upper_margin = V_BP5,
.lower_margin = V_FP5,
.vsync_len = V_PW5,
.pin_hsync = 1,
.pin_vsync = 1,
.pin_den = 0,
.pin_dclk = DCLK_POL,
.swap_rb = SWAP_RB,
.swap_rg = 0,
.swap_gb = 0,
.swap_delta = 0,
.swap_dumy = 0,
.init = anx7150_init,
.standby = anx7150_standby,
}, //HDMI_1920x1080p_60Hz
};
int hdmi_switch_fb(struct hdmi *hdmi, int type)
{
int rc = 0;
switch(hdmi->resolution)
{
case HDMI_1280x720p_50Hz:
rc = FB_Switch_Screen(&hdmi_info[0], type);
break;
case HDMI_1280x720p_60Hz:
rc = FB_Switch_Screen(&hdmi_info[1], type);
break;
case HDMI_720x576p_50Hz_4x3:
rc = FB_Switch_Screen(&hdmi_info[2], type);
break;
case HDMI_720x576p_50Hz_16x9:
rc = FB_Switch_Screen(&hdmi_info[3], type);
break;
case HDMI_720x480p_60Hz_4x3:
rc = FB_Switch_Screen(&hdmi_info[4], type);
break;
case HDMI_720x480p_60Hz_16x9:
rc = FB_Switch_Screen(&hdmi_info[5], type);
break;
case HDMI_1920x1080p_50Hz:
rc = FB_Switch_Screen(&hdmi_info[6], type);
break;
case HDMI_1920x1080p_60Hz:
rc = FB_Switch_Screen(&hdmi_info[7], type);
break;
default:
rc = FB_Switch_Screen(&hdmi_info[0], type);
break;
}
if(hdmi->wait == 1) {
complete(&hdmi->complete);
hdmi->wait = 0;
}
return rc;
}

View File

@@ -1,284 +0,0 @@
#include <linux/ctype.h>
#include <linux/hdmi.h>
#include <linux/string.h>
int debug_en = 0;
#ifndef CONFIG_HDMI_SAVE_DATA
int hdmi_get_data(void)
{
return 0;
}
int hdmi_set_data(int data)
{
return 0;
}
#endif
static ssize_t hdmi_show_state_attrs(struct device *dev,
struct device_attribute *attr,
char *buf)
{
struct hdmi *hdmi = dev_get_drvdata(dev);
return sprintf(buf, "display_on=%d\n"
"plug=%d\n"
"dual_disp=%d\n"
"video_mode=%d\n"
"mode=%d\n"
"hdcp_on=%d\n"
"audio_fs=%d\n"
"scale=%d\n"
"scale_set=%d\n"
"resolution=%d\n"
"--------------------------\n"
"resolution support:\n"
"HDMI_1920x1080p_50Hz 0\n"
"HDMI_1920x1080p_60Hz 1\n"
"HDMI_1280x720p_50Hz 2\n"
"HDMI_1280x720p_60Hz 3\n"
"HDMI_720x576p_50Hz_4x3 4\n"
"HDMI_720x576p_50Hz_16x9 5\n"
"HDMI_720x480p_60Hz_4x3 6\n"
"HDMI_720x480p_60Hz_16x9 7\n"
"--------------------------\n",
hdmi->display_on,hdmi->ops->hdmi_precent(hdmi),
hdmi->dual_disp,fb_get_video_mode(), hdmi->mode, hdmi->hdcp_on,
hdmi->audio_fs, (hdmi->ops->hdmi_precent(hdmi) && hdmi->display_on)?hdmi->scale:100,
hdmi->scale_set,
hdmi->resolution);
}
static ssize_t hdmi_restore_state_attrs(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t size)
{
int ret = 0;
struct hdmi *hdmi = dev_get_drvdata(dev);
char *p;
const char *q;
int set_param = 0, tmp = 0;
#ifdef CONFIG_HDMI_SAVE_DATA
int hdmi_data=0;
#endif
if(hdmi->mode == DISP_ON_LCD)
{
dev_err(dev, "display on lcd, do not set parameter!\n");
ret = -EINVAL;
goto exit;
}
q = buf;
do
{
if((p = strstr(q, "mode=")) != NULL)
{
q = p + 5;
#if 0
if((sscanf(q, "%d", &tmp) == 1) && (tmp >= 0 && tmp <= 3))
{
if(tmp != hdmi->mode)
{
set_param |= 1;
hdmi->mode = tmp;
}
}
else
{
dev_err(dev, "failed to set hdmi configuration\n");
ret = -EINVAL;
goto exit;
}
#endif
}
else if((p = strstr(q, "hdcp_on=")) != NULL)
{
q = p + 8;
#if 0
if((sscanf(q, "%d", &tmp) == 1) && (tmp == 0 || tmp ==1))
{
if(tmp != hdmi->hdcp_on)
{
set_param |= 1;
hdmi->hdcp_on = tmp;
}
}
else
{
dev_err(dev, "failed to set hdmi configuration\n");
ret = -EINVAL;
goto exit;
}
#endif
}
else if((p = strstr(q, "scale_set=")) != NULL)
{
q = p + 10;
if((sscanf(q, "%d", &tmp) == 1) && (tmp >=MIN_SCALE && tmp <= 100))
{
hdmi->scale_set = tmp;
hdmi_dbg(dev, "set scale = %d\n", tmp);
hdmi->scale = tmp;
#ifdef CONFIG_HDMI_SAVE_DATA
hdmi_data = hdmi_get_data();
if(hdmi_data<0)
hdmi->ops->init(hdmi);
hdmi_data = (((hdmi->scale-MIN_SCALE)&0x1f)<<3) | (hdmi_data & 0x7);
hdmi_set_data(hdmi_data);
#endif
}
else
{
dev_err(dev, "failed to set hdmi configuration\n");
ret = -EINVAL;
goto exit;
}
}
else if((p = strstr(q, "resolution=")) != NULL)
{
q = p + 11;
if((sscanf(q, "%d", &tmp) == 1) && (tmp >= 0))
{
if(hdmi->resolution != tmp)
{
set_param |= 1;
hdmi_dbg(dev, "set resolution = %d\n", tmp);
hdmi->resolution = tmp;
#ifdef CONFIG_HDMI_SAVE_DATA
hdmi_data = hdmi_get_data();
if(hdmi_data<0)
hdmi->ops->init(hdmi);
hdmi_data = (hdmi->resolution&0x7) | (hdmi_data & 0xf8);
hdmi_set_data(hdmi_data);
#endif
}
}
else
{
dev_err(dev, "failed to set hdmi configuration\n");
ret = -EINVAL;
goto exit;
}
}
else
break;
}while(*q != 0);
if(hdmi->ops->set_param && set_param != 0)
{
mutex_lock(&hdmi->lock);
ret = hdmi->ops->set_param(hdmi);
mutex_unlock(&hdmi->lock);
}
exit:
if(ret < 0)
dev_err(dev, "hdmi_restore_state_attrs err\n");
return size;
}
static ssize_t hdmi_show_switch_attrs(struct device *dev,
struct device_attribute *attr,
char *buf)
{
struct hdmi *hdmi = dev_get_drvdata(dev);
return sprintf(buf, "%d\n", hdmi->display_on);
}
static ssize_t hdmi_restore_switch_attrs(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t size)
{
int display_on = 0;
struct hdmi *hdmi = dev_get_drvdata(dev);
sscanf(buf, "%d", &display_on);
hdmi_dbg(dev, "hdmi %s\n", (display_on)?"enable":"disable");
if(display_on ^ hdmi->display_on)
{
hdmi->display_on = display_on;
hdmi_changed(hdmi, 1);
}
return size;
}
static ssize_t hdmi_show_debug_attrs(struct device *dev,
struct device_attribute *attr,
char *buf)
{
return sprintf(buf, "%d\n", debug_en);
}
static ssize_t hdmi_restore_debug_attrs(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t size)
{
int tmp;
sscanf(buf, "%d", &tmp);
if(tmp != 0 && tmp != 1)
dev_err(dev, "hdmi_restore_debug_attrs err\n");
else
debug_en = tmp;
return size;
}
#if 0
static ssize_t hdmi_restore_init_attrs(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t size)
{
int enable = HDMI_DISABLE, scale = 100, resolution = HDMI_DEFAULT_RESOLUTION;
struct hdmi *hdmi = dev_get_drvdata(dev);
sscanf(buf, "%d %d %d\n", &enable, &scale, &resolution);
hdmi_dbg(dev, "hdmi init, set param: enable = %d, scale = %d, resolution = %d\n",
enable, scale, resolution);
hdmi->display_on = enable;
hdmi->resolution = resolution;
hdmi->scale_set = scale;
if(hdmi->ops->hdmi_precent(hdmi) && hdmi->display_on)
hdmi->scale = scale;
if(hdmi->ops->init)
hdmi->ops->init(hdmi);
return size;
}
#endif
static struct device_attribute hdmi_attrs[] = {
__ATTR(state, 0774, hdmi_show_state_attrs, hdmi_restore_state_attrs),
__ATTR(enable, 0774, hdmi_show_switch_attrs, hdmi_restore_switch_attrs),
__ATTR(debug, 0774, hdmi_show_debug_attrs, hdmi_restore_debug_attrs),
//__ATTR(init, 0777, NULL, hdmi_restore_init_attrs),
};
int hdmi_create_attrs(struct hdmi *hdmi)
{
int rc = 0;
int i;
for (i = 0; i < ARRAY_SIZE(hdmi_attrs); i++) {
rc = device_create_file(hdmi->dev, &hdmi_attrs[i]);
if (rc)
goto create_failed;
}
goto succeed;
create_failed:
while (i--)
device_remove_file(hdmi->dev, &hdmi_attrs[i]);
succeed:
return rc;
}
void hdmi_remove_attrs(struct hdmi *hdmi)
{
int i;
for (i = 0; i < ARRAY_SIZE(hdmi_attrs); i++)
device_remove_file(hdmi->dev, &hdmi_attrs[i]);
}