From 76fe1d903a8ce23908c2f33887d96672ca9debdd Mon Sep 17 00:00:00 2001 From: yzq Date: Sat, 16 Jul 2011 08:40:20 -0700 Subject: [PATCH] fix hdmi bug : wake up , the hdmi screen probabilistic flash of white --- arch/arm/mach-rk29/board-rk29-ddr3sdk.c | 2 +- drivers/hid/hid-core.c | 25 ++-- drivers/input/touchscreen/eeti_egalax_i2c.c | 16 ++- drivers/video/hdmi/Kconfig | 21 ++-- drivers/video/hdmi/hdmi-new/chips/anx7150.c | 86 +++++++------- drivers/video/hdmi/hdmi-new/chips/anx7150.h | 1 + .../video/hdmi/hdmi-new/chips/anx7150_hw.c | 14 ++- .../video/hdmi/hdmi-new/chips/anx7150_hw.h | 2 +- drivers/video/hdmi/hdmi-new/hdmi-backlight.c | 2 +- drivers/video/hdmi/hdmi-new/hdmi-codec.c | 6 +- drivers/video/hdmi/hdmi-new/hdmi-core.c | 41 ++++++- drivers/video/hdmi/hdmi-new/hdmi-sysfs.c | 110 +++++++++++------- drivers/video/hdmi/hdmi-old/chips/anx7150.c | 10 +- drivers/video/hdmi/hdmi-old/chips/anx7150.h | 1 + .../video/hdmi/hdmi-old/chips/anx7150_hw.c | 29 ++++- drivers/video/hdmi/hdmi-old/hdmi-core.c | 4 + drivers/video/rk29_fb.c | 99 ++++++++++------ include/linux/hdmi-new.h | 43 +++++-- 18 files changed, 340 insertions(+), 172 deletions(-) diff --git a/arch/arm/mach-rk29/board-rk29-ddr3sdk.c b/arch/arm/mach-rk29/board-rk29-ddr3sdk.c index 4fb9faf0dbd3..22f03a8b786f 100755 --- a/arch/arm/mach-rk29/board-rk29-ddr3sdk.c +++ b/arch/arm/mach-rk29/board-rk29-ddr3sdk.c @@ -104,7 +104,7 @@ #endif #define MEM_FB_SIZE (3*SZ_2M) #ifdef CONFIG_FB_WORK_IPP -#define MEM_FBIPP_SIZE SZ_8M //1920 x 1080 x 2 x 2 //RGB565 = x2;RGB888 = x4 +#define MEM_FBIPP_SIZE SZ_16M //1920 x 1080 x 2 x 2 //RGB565 = x2;RGB888 = x4 #else #define MEM_FBIPP_SIZE 0 #endif diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index f3f14159a739..f86f96443df9 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c @@ -32,7 +32,7 @@ #include #include #include - +#include #include "hid-ids.h" /* @@ -44,6 +44,7 @@ #define DRIVER_DESC "HID core driver" #define DRIVER_LICENSE "GPL" +static unsigned int is_left_down = 0; int hid_debug = 0; module_param_named(debug, hid_debug, int, 0600); MODULE_PARM_DESC(debug, "toggle HID debugging messages"); @@ -1120,6 +1121,13 @@ int hid_input_report(struct hid_device *hid, int type, u8 *data, int size, int i kfree(buf); nomem: + if(is_left_down == 0 && data[0] == 1){ + is_left_down = 1; + data[1] = 0; + data[2] = 0; + } + if(data[0] == 0) + is_left_down = 0; if (hdrv && hdrv->raw_event && hid_match_report(hid, report)) { ret = hdrv->raw_event(hid, report, data, size); if (ret != 0) @@ -1127,7 +1135,7 @@ nomem: } hid_report_raw_event(hid, type, data, size, interrupt); - +//hdmi_set_scale(HDMI_MOUSE_EVENT, data, size); //mod by kfx return 0; } EXPORT_SYMBOL_GPL(hid_input_report); @@ -1287,12 +1295,6 @@ static const struct hid_device_id hid_blacklist[] = { { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI) }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ISO) }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_JIS) }, - { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI) }, - { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ISO) }, - { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_JIS) }, - { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI) }, - { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO) }, - { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS) }, { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI) }, { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO) }, { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS) }, @@ -1303,7 +1305,6 @@ static const struct hid_device_id hid_blacklist[] = { { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_TACTICAL_PAD) }, { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_1) }, { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_2) }, - { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_3) }, { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_MOUSE) }, { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, 0x0006) }, { HID_USB_DEVICE(USB_VENDOR_ID_EZKEY, USB_DEVICE_ID_BTC_8193) }, @@ -1711,12 +1712,6 @@ static const struct hid_device_id hid_mouse_ignore_list[] = { { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI) }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ISO) }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_JIS) }, - { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI) }, - { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ISO) }, - { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_JIS) }, - { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI) }, - { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO) }, - { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS) }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) }, { } diff --git a/drivers/input/touchscreen/eeti_egalax_i2c.c b/drivers/input/touchscreen/eeti_egalax_i2c.c index 026c18bfe5df..19b3b6439591 100755 --- a/drivers/input/touchscreen/eeti_egalax_i2c.c +++ b/drivers/input/touchscreen/eeti_egalax_i2c.c @@ -40,7 +40,7 @@ #include #include #include - +#include //#define DEBUG #ifdef CONFIG_EETI_EGALAX_DEBUG #define TS_DEBUG(fmt,args...) printk( KERN_DEBUG "[egalax_i2c]: " fmt, ## args) @@ -338,6 +338,7 @@ static void ProcessReport(unsigned char *buf, int buflen) { int i; short X=0, Y=0, ContactID=0, Status=0; + int x, y, scale; if(buflen!=MAX_I2C_LEN || buf[0]!=0x04) // check buffer len & header return; @@ -362,9 +363,20 @@ static void ProcessReport(unsigned char *buf, int buflen) input_report_abs(input_dev, ABS_MT_TRACKING_ID, i); input_report_abs(input_dev, ABS_MT_TOUCH_MAJOR, PointBuf[i].Status); input_report_abs(input_dev, ABS_MT_WIDTH_MAJOR, 0); +#if 1 //mod by kfx + scale = hdmi_get_scale(); + x = PointBuf[i].X * 100 / scale; + x -= CONFIG_EETI_EGALAX_MAX_X * (100-scale)/200; + x = (x<0)?0:x; + y = PointBuf[i].Y * 100 / scale; + y -= CONFIG_EETI_EGALAX_MAX_Y * (100-scale)/200; + y = (y<0)?0:y; + input_report_abs(input_dev, ABS_MT_POSITION_X, x); + input_report_abs(input_dev, ABS_MT_POSITION_Y, y); +#else input_report_abs(input_dev, ABS_MT_POSITION_X, PointBuf[i].X); input_report_abs(input_dev, ABS_MT_POSITION_Y, PointBuf[i].Y); - +#endif input_mt_sync(input_dev); if(PointBuf[i].Status == 0) diff --git a/drivers/video/hdmi/Kconfig b/drivers/video/hdmi/Kconfig index b62e7dacf3c0..f26959e52318 100644 --- a/drivers/video/hdmi/Kconfig +++ b/drivers/video/hdmi/Kconfig @@ -8,14 +8,14 @@ config HDMI if HDMI -config HDMI_OLD - default y - bool "old hdmi support" - help - nothing -if HDMI_OLD -source "drivers/video/hdmi/hdmi-old/Kconfig" -endif +#config HDMI_OLD +# default y +# bool "old hdmi support" +# help +# nothing +#if HDMI_OLD +#source "drivers/video/hdmi/hdmi-old/Kconfig" +#endif config HDMI_NEW bool "new hdmi support" @@ -24,7 +24,10 @@ config HDMI_NEW if HDMI_NEW source "drivers/video/hdmi/hdmi-new/Kconfig" endif - +config HDMI_DUAL_DISP + bool "hdmi support dual display" + help + nothing config HDMI_DEBUG bool "hdmi debug" diff --git a/drivers/video/hdmi/hdmi-new/chips/anx7150.c b/drivers/video/hdmi/hdmi-new/chips/anx7150.c index 779cef9f5479..f970b1262f68 100755 --- a/drivers/video/hdmi/hdmi-new/chips/anx7150.c +++ b/drivers/video/hdmi/hdmi-new/chips/anx7150.c @@ -12,7 +12,6 @@ #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; @@ -34,13 +33,22 @@ int anx7150_i2c_write_p1_reg(struct i2c_client *client, char reg, char *val) return i2c_master_reg8_send(client, reg, val, 1, ANX7150_SCL_RATE) > 0? 0: -EINVAL; } -static int anx7150_param_chg(struct anx7150_pdata *anx) +static int anx7150_hdmi_precent(struct hdmi *hdmi) { - int resolution_real; + struct anx7150_pdata *anx = hdmi_priv(hdmi); - hdmi_set_spk(anx->hdmi->display_on); - hdmi_set_backlight(!anx->hdmi->display_on); - hdmi_switch_fb(anx->hdmi, anx->hdmi->display_on); + return gpio_get_value(anx->client->irq)?0:1; +} +static int anx7150_param_chg(struct anx7150_pdata *anx) +{ + int resolution_real, enable; + + if(anx->hdmi->mode == DISP_ON_LCD) + anx->hdmi->scale = 100; + enable = ((anx->hdmi->mode!= DISP_ON_LCD) && anx->hdmi->display_on && anx7150_hdmi_precent(anx->hdmi))?1:0; + hdmi_set_spk(!enable); //if(hdmi mode) turn off spk + hdmi_set_backlight(!enable); //if(hdmi mode) trun off backlight + hdmi_switch_fb(anx->hdmi, enable); resolution_real = ANX7150_Get_Optimal_resolution(anx->hdmi->resolution); HDMI_Set_Video_Format(resolution_real); HDMI_Set_Audio_Fs(anx->hdmi->audio_fs); @@ -61,23 +69,24 @@ static int anx7150_insert(struct hdmi *hdmi) int tmo = 10; struct anx7150_pdata *anx = hdmi_priv(hdmi); - anx7150_plug(anx->client); - if(ANX7150_Parse_EDID(anx->client,&anx->dev) < 0) - { - dev_info(&anx->client->dev, "parse EDID error\n"); - anx7150_unplug(anx->client); - return -1; - } + if(anx->edid_read_ok == 0) { + anx7150_plug(anx->client); + if(ANX7150_Parse_EDID(anx->client,&anx->dev) < 0) + { + dev_info(&anx->client->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); - return -1; + while(--tmo && ANX7150_GET_SENSE_STATE(anx->client) != 1) + mdelay(10); + if(tmo <= 0) + { + anx7150_unplug(anx->client); + return -1; + } + anx->edid_read_ok = 1; } - if(!hdmi->display_on) - return 0; anx7150_param_chg(anx); return 0; } @@ -86,9 +95,11 @@ static int anx7150_remove(struct hdmi *hdmi) struct anx7150_pdata *anx = hdmi_priv(hdmi); anx7150_unplug(anx->client); - hdmi_set_spk(HDMI_DISABLE); - hdmi_set_backlight(HDMI_ENABLE); + anx->edid_read_ok = 0; + hdmi->scale = 100; + hdmi_set_spk(HDMI_ENABLE); hdmi_switch_fb(hdmi, HDMI_DISABLE); + hdmi_set_backlight(HDMI_ENABLE); return 0; } @@ -97,26 +108,23 @@ static int anx7150_shutdown(struct hdmi *hdmi) struct anx7150_pdata *anx = hdmi_priv(hdmi); anx7150_unplug(anx->client); + anx->edid_read_ok = 0; + hdmi->scale = 100; return 0; } static int anx7150_display_on(struct hdmi* hdmi) { - struct anx7150_pdata *anx = hdmi_priv(hdmi); - hdmi->display_on = HDMI_ENABLE; hdmi_dbg(hdmi->dev, "hdmi display on\n"); - anx7150_param_chg(anx); + anx7150_insert(hdmi); return 0; } static int anx7150_display_off(struct hdmi* hdmi) { - struct anx7150_pdata *anx = hdmi_priv(hdmi); - hdmi->display_on = HDMI_DISABLE; - anx->dev.hdmi_enable = HDMI_DISABLE; hdmi_dbg(hdmi->dev, "hdmi display off\n"); - anx7150_param_chg(anx); + anx7150_remove(hdmi); return 0; } static int anx7150_set_param(struct hdmi *hdmi) @@ -127,12 +135,6 @@ static int anx7150_set_param(struct hdmi *hdmi) return 0; } -static int anx7150_hdmi_precent(struct hdmi *hdmi) -{ - struct anx7150_pdata *anx = hdmi_priv(hdmi); - - return gpio_get_value(anx->client->irq)?0:1; -} static struct hdmi_ops anx7150_ops = { .display_on = anx7150_display_on, .display_off = anx7150_display_off, @@ -151,10 +153,12 @@ static void anx7150_detect_work(struct work_struct *work) free_irq(anx->irq, anx); ret = request_irq(anx->irq, anx7150_detect_irq, anx7150_hdmi_precent(anx->hdmi)? IRQF_TRIGGER_RISING : IRQF_TRIGGER_FALLING,NULL,anx); - dev_info(&anx->client->dev, "det = %d,hpd_status = %d\n", + dev_dbg(&anx->client->dev, "det = %d,hpd_status = %d\n", gpio_get_value(anx->client->irq), anx7150_get_hpd(anx->client)); + if(gpio_get_value(anx->client->irq) == anx7150_get_hpd(anx->client)) + return; anx->is_changed = 1; - if(!anx->is_early_suspend) + if(!anx->is_early_suspend && anx->hdmi->display_on == HDMI_ENABLE) hdmi_changed(anx->hdmi, 0); } @@ -216,8 +220,11 @@ static int anx7150_i2c_probe(struct i2c_client *client,const struct i2c_device_i 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 = HDMI_DEFAULT_MODE; anx = hdmi_priv(hdmi); + anx->edid_read_ok = 0; anx->hdmi = hdmi; i2c_set_clientdata(client, anx); anx->client = client; @@ -253,8 +260,9 @@ static int anx7150_i2c_probe(struct i2c_client *client,const struct i2c_device_i #endif anx->is_early_suspend = 0; anx->is_changed = 1; + anx7150_initial(anx->client); - hdmi_changed(hdmi, 200); + //hdmi_changed(hdmi, 200); dev_info(&client->dev, "anx7150 i2c probe ok\n"); return 0; err_free_irq: diff --git a/drivers/video/hdmi/hdmi-new/chips/anx7150.h b/drivers/video/hdmi/hdmi-new/chips/anx7150.h index 77b07d90f779..dc3343396929 100755 --- a/drivers/video/hdmi/hdmi-new/chips/anx7150.h +++ b/drivers/video/hdmi/hdmi-new/chips/anx7150.h @@ -81,6 +81,7 @@ struct anx7150_pdata { int init; int is_early_suspend; int is_changed; + int edid_read_ok; struct delayed_work work; struct hdmi *hdmi; struct i2c_client *client; diff --git a/drivers/video/hdmi/hdmi-new/chips/anx7150_hw.c b/drivers/video/hdmi/hdmi-new/chips/anx7150_hw.c index 537be6412a46..ece170dc8e49 100755 --- a/drivers/video/hdmi/hdmi-new/chips/anx7150_hw.c +++ b/drivers/video/hdmi/hdmi-new/chips/anx7150_hw.c @@ -494,6 +494,14 @@ int anx7150_rst_ddcchannel(struct i2c_client *client) return rc; } +int anx7150_initial(struct i2c_client *client) +{ + ANX7150_Variable_Initial(); //simon + ANX7150_HW_Interface_Variable_Initial(); //simon + + anx7150_hardware_initial(client); //simon + return 0; +} int anx7150_unplug(struct i2c_client *client) { int rc = 0; @@ -1298,7 +1306,7 @@ static int ANX7150_Read_EDID(struct i2c_client *client) u8 edid_segment,segmentpointer,k; rc = anx7150_rst_ddcchannel(client); - mdelay(1); + mdelay(5); edid_segment = ANX7150_edid_length / 256; if (edid_segment==0) //update @@ -1310,11 +1318,11 @@ static int ANX7150_Read_EDID(struct i2c_client *client) for (k = 0; k <= segmentpointer; k ++) { rc =anx7150_initddc_read(client, 0xa0, k, 0x00, 0x80, 0x00); - mdelay(1); + mdelay(10); rc = ANX7150_DDC_Mass_Read(client, 128, k); //mdelay(10); rc = anx7150_initddc_read(client, 0xa0, k, 0x80, 0x80, 0x00); - mdelay(1); + mdelay(10); rc = ANX7150_DDC_Mass_Read(client, 128, k + 1); //mdelay(10); } diff --git a/drivers/video/hdmi/hdmi-new/chips/anx7150_hw.h b/drivers/video/hdmi/hdmi-new/chips/anx7150_hw.h index baf289e389f3..4c2b97e6cd1f 100755 --- a/drivers/video/hdmi/hdmi-new/chips/anx7150_hw.h +++ b/drivers/video/hdmi/hdmi-new/chips/anx7150_hw.h @@ -1263,6 +1263,6 @@ void HDMI_Set_Audio_Fs( u8 audio_fs); int ANX7150_PLAYBACK_Process(void); int ANX7150_Blue_Screen(struct anx7150_pdata *anx); int anx7150_set_avmute(struct i2c_client *client); - +int anx7150_initial(struct i2c_client *client); #endif diff --git a/drivers/video/hdmi/hdmi-new/hdmi-backlight.c b/drivers/video/hdmi/hdmi-new/hdmi-backlight.c index 8ea28730055b..f308f414bbf2 100755 --- a/drivers/video/hdmi/hdmi-new/hdmi-backlight.c +++ b/drivers/video/hdmi/hdmi-new/hdmi-backlight.c @@ -4,4 +4,4 @@ extern void rk29_backlight_set(bool on); void hdmi_set_backlight(int on) { rk29_backlight_set(on); -} \ No newline at end of file +} diff --git a/drivers/video/hdmi/hdmi-new/hdmi-codec.c b/drivers/video/hdmi/hdmi-new/hdmi-codec.c index c516890c1e2b..c6c1c783c04a 100755 --- a/drivers/video/hdmi/hdmi-new/hdmi-codec.c +++ b/drivers/video/hdmi/hdmi-new/hdmi-codec.c @@ -1,11 +1,7 @@ #include extern void codec_set_spk(bool on); -int hdmi_codec_set_audio_fs(unsigned char audio_fs) -{ - return 0; -} void hdmi_set_spk(int on) { - codec_set_spk(!on); + codec_set_spk(on); } diff --git a/drivers/video/hdmi/hdmi-new/hdmi-core.c b/drivers/video/hdmi/hdmi-new/hdmi-core.c index 992d42b2ba25..c4e978e84891 100755 --- a/drivers/video/hdmi/hdmi-new/hdmi-core.c +++ b/drivers/video/hdmi/hdmi-new/hdmi-core.c @@ -4,6 +4,8 @@ #include #include +#include + struct class *hdmi_class; struct hdmi_id_ref_info { @@ -24,7 +26,7 @@ static inline void hdmi_remove_attrs(struct hdmi *hdmi) {} #endif /* CONFIG_SYSFS */ - +extern struct input_dev *gsensor_input_dev; void hdmi_changed(struct hdmi *hdmi, int msec) { schedule_delayed_work(&hdmi->changed_work, msecs_to_jiffies(msec)); @@ -55,7 +57,7 @@ static void hdmi_changed_work(struct work_struct *work) else ret = hdmi->ops->remove(hdmi); if(ret < 0) - dev_dbg(hdmi->dev, "hdmi changed error\n"); + dev_warn(hdmi->dev, "hdmi changed error\n"); kobject_uevent(&hdmi->dev->kobj, KOBJ_CHANGE); } @@ -113,6 +115,7 @@ dev_create_failed: kfree(hdmi); return NULL; success: + hdmi->scale = 100; return hdmi; } void hdmi_unregister(struct hdmi *hdmi) @@ -147,6 +150,40 @@ int hdmi_is_insert(void) else return 0; } +int hdmi_get_scale(void) +{ + struct hdmi* hdmi = get_hdmi_struct(0); + if(!hdmi) + return 100; + else if(!hdmi->display_on || !hdmi->ops->hdmi_precent(hdmi)) + return 100; + else + return hdmi->scale; +} + +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->display_on || !hdmi->ops->hdmi_precent(hdmi)) + 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->scalescale; + return 0; +} + static int __init hdmi_class_init(void) { int i; diff --git a/drivers/video/hdmi/hdmi-new/hdmi-sysfs.c b/drivers/video/hdmi/hdmi-new/hdmi-sysfs.c index dc86fe0e41fb..2597ff3e8708 100755 --- a/drivers/video/hdmi/hdmi-new/hdmi-sysfs.c +++ b/drivers/video/hdmi/hdmi-new/hdmi-sysfs.c @@ -12,23 +12,29 @@ static ssize_t hdmi_show_state_attrs(struct device *dev, return sprintf(buf, "display_on=%d\n" "plug=%d\n" "auto_switch=%d\n" + "dual_disp=%d\n" + "mode=%d\n" "hdcp_on=%d\n" "audio_fs=%d\n" + "scale=%d\n" "resolution=%d\n" "--------------------------\n" "resolution support:\n" - "HDMI_1280x720p_50Hz 0\n" - "HDMI_1280x720p_60Hz 1\n" - "HDMI_720x576p_50Hz_4x3 2\n" - "HDMI_720x576p_50Hz_16x9 3\n" - "HDMI_720x480p_60Hz_4x3 4\n" - "HDMI_720x480p_60Hz_16x9 5\n" - "HDMI_1920x1080p_50Hz 6\n" - "HDMI_1920x1080p_60Hz 7\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->auto_switch, hdmi->hdcp_on, - hdmi->audio_fs, hdmi->resolution); + hdmi->auto_switch,hdmi->dual_disp, + hdmi->mode, + hdmi->hdcp_on, + hdmi->audio_fs, (hdmi->ops->hdmi_precent(hdmi) && hdmi->display_on)?hdmi->scale:100, + hdmi->resolution); } static ssize_t hdmi_restore_state_attrs(struct device *dev, struct device_attribute *attr, @@ -38,17 +44,32 @@ static ssize_t hdmi_restore_state_attrs(struct device *dev, struct hdmi *hdmi = dev_get_drvdata(dev); char *p; const char *q; - int auto_switch = -1, hdcp_on = -1, audio_fs = -1, resolution = -1; + int set_param = 0, tmp = 0; + + hdmi_dbg(hdmi->dev, "func:%s-->buf = \n%s\n", __func__, buf); + if(hdmi->display_on == HDMI_DISABLE) + { + dev_err(dev, "hdmi is off\n"); + ret = -EINVAL; + goto exit; + } + q = buf; do { - if((p = strstr(q, "auto_switch=")) != NULL) + if((p = strstr(q, "mode=")) != NULL) { - q = p + 12; - if((sscanf(q, "%d", &auto_switch) == 1) && - (auto_switch == 0 || auto_switch == 1)) - hdmi->auto_switch = auto_switch; + q = p + 5; + + 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"); @@ -56,38 +77,57 @@ static ssize_t hdmi_restore_state_attrs(struct device *dev, goto exit; } } + else if((p = strstr(q, "hdcp_on=")) != NULL) { q = p + 8; - if((sscanf(q, "%d", &hdcp_on) == 1) && - (hdcp_on == 0 || hdcp_on == 1)) - hdmi->hdcp_on = hdcp_on; +#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, "audio_fs=")) != NULL) + + + else if((p = strstr(q, "scale=")) != NULL) { - q = p + 9; - if((sscanf(q, "%d", &audio_fs) == 1) && - (audio_fs >= 0)) - hdmi->audio_fs = audio_fs; + q = p + 6; +#if 1 + if((sscanf(q, "%d", &tmp) == 1) && (tmp >=MIN_SCALE && tmp <= 100)) + { + hdmi->scale = tmp; + hdmi->scale = (hdmi->ops->hdmi_precent(hdmi) && hdmi->display_on)?hdmi->scale:100; + } else { dev_err(dev, "failed to set hdmi configuration\n"); ret = -EINVAL; goto exit; } +#endif } else if((p = strstr(q, "resolution=")) != NULL) { q = p + 11; - if((sscanf(q, "%d", &resolution) == 1) && - (resolution >= 0)) - hdmi->resolution = resolution; + if((sscanf(q, "%d", &tmp) == 1) && (tmp >= 0)) + { + if(hdmi->resolution != tmp) + { + set_param |= 1; + hdmi->resolution = tmp; + } + } else { dev_err(dev, "failed to set hdmi configuration\n"); @@ -99,22 +139,8 @@ static ssize_t hdmi_restore_state_attrs(struct device *dev, break; }while(*q != 0); - if(auto_switch == -1 && - hdcp_on == -1 && - audio_fs == -1 && - resolution == -1) - { - dev_err(dev, "failed to set hdmi configuration\n"); - ret = -EINVAL; - goto exit; - } - if(hdmi->ops->set_param) + if(hdmi->ops->set_param && set_param != 0) ret = hdmi->ops->set_param(hdmi); - else - { - dev_err(dev, "hdmi device is not exist\n"); - return ret = 0; - } exit: if(ret < 0) dev_err(dev, "hdmi_restore_state_attrs err\n"); diff --git a/drivers/video/hdmi/hdmi-old/chips/anx7150.c b/drivers/video/hdmi/hdmi-old/chips/anx7150.c index 4e8212e00329..9ef5a8f9a7ed 100755 --- a/drivers/video/hdmi/hdmi-old/chips/anx7150.c +++ b/drivers/video/hdmi/hdmi-old/chips/anx7150.c @@ -8,7 +8,7 @@ #include #include -#include "anx7150.h" +#include "linux/anx7150.h" #include "anx7150_hw.h" int anx7150_i2c_read_p0_reg(struct i2c_client *client, char reg, char *val) @@ -99,7 +99,13 @@ static irqreturn_t anx7150_detect_irq(int irq, void *dev_id) return IRQ_HANDLED; } - +#if 1//eboda zlj add for test 110518 +struct anx7150_dev_s *anx7150_dev; +int anx7150_get_output_status(void) +{ + return anx7150_dev->rk29_output_status; +} +#endif void anx7150_task(struct anx7150_pdata *anx) { int state; diff --git a/drivers/video/hdmi/hdmi-old/chips/anx7150.h b/drivers/video/hdmi/hdmi-old/chips/anx7150.h index 1122861d799e..38fe18940f8d 100755 --- a/drivers/video/hdmi/hdmi-old/chips/anx7150.h +++ b/drivers/video/hdmi/hdmi-old/chips/anx7150.h @@ -90,4 +90,5 @@ 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); +int anx7150_get_output_status(void);//eboda zlj add for test 110518 #endif diff --git a/drivers/video/hdmi/hdmi-old/chips/anx7150_hw.c b/drivers/video/hdmi/hdmi-old/chips/anx7150_hw.c index a40bd02d9090..0ff799a04e0d 100755 --- a/drivers/video/hdmi/hdmi-old/chips/anx7150_hw.c +++ b/drivers/video/hdmi/hdmi-old/chips/anx7150_hw.c @@ -1,9 +1,11 @@ #include #include #include - - -#include "anx7150.h" +#if 1 // eboda twp +#include +#include +#endif +#include "linux/anx7150.h" #include "anx7150_hw.h" //#ifdef ITU656 struct ANX7150_video_timingtype ANX7150_video_timingtype_table = @@ -292,7 +294,7 @@ static void ANX7150_Variable_Initial(void) //********************end of video config********* //********************for edid parse*********** - ANX7150_edid_result.is_HDMI = 0; + ANX7150_edid_result.is_HDMI = 1;// 0->1,eboda zlj add for test 110413 ANX7150_edid_result.ycbcr422_supported = 0; ANX7150_edid_result.ycbcr444_supported = 0; ANX7150_edid_result.supported_720p_60Hz = 0; @@ -520,7 +522,12 @@ int anx7150_unplug(struct i2c_client *client) ANX7150_parse_edid_done = 0; // ANX7150_system_config_done = 0; ANX7150_srm_checked = 0; - + #if 1 //eboda twp + // gpio_direction_output(RK29_PIN6_PD1, 0); + //gpio_set_value(RK29_PIN6_PD1, 1); + rk29_mux_api_set(GPIO1B5_PWM0_NAME, GPIO1L_PWM0); + //printk("turn on LCD\n"); + #endif return rc; } int anx7150_plug(struct i2c_client *client) @@ -1678,7 +1685,7 @@ static void ANX7150_Parse_VendorSTD(void) } else { - ANX7150_edid_result.is_HDMI = 0; + ANX7150_edid_result.is_HDMI = 1;// 0->1,eboda zlj add for test 110413 //ANX7150_i2c_read_p0_reg(ANX7150_SYS_CTRL1_REG, &c); //ANX7150_i2c_write_p0_reg(ANX7150_SYS_CTRL1_REG, c & (~ANX7150_SYS_CTRL1_HDMI)); } @@ -2818,6 +2825,16 @@ int ANX7150_Config_Video(struct i2c_client *client) c |= (0x02); rc = anx7150_i2c_write_p0_reg(client, ANX7150_SYS_CTRL1_REG, &c); hdmi_dbg(&client->dev,"ANX7150 is set to HDMI mode\n"); + #if 1 //eboda twp + //gpio_direction_output(RK29_PIN6_PD1, GPIO1L_GPIO1B5); + //gpio_set_value(RK29_PIN6_PD1, 0); + rk29_mux_api_set(GPIO1B5_PWM0_NAME, 0); + if (gpio_request(RK29_PIN1_PB5, NULL)) { + printk("func %s, line %d: request gpio fail\n", __FUNCTION__, __LINE__); + } + gpio_direction_output(RK29_PIN1_PB5, 0); + //printk("turn off LCD\n"); + #endif } rc = anx7150_i2c_read_p0_reg(client, ANX7150_SYS_CTRL1_REG, &c); TX_is_HDMI = c & 0x02; diff --git a/drivers/video/hdmi/hdmi-old/hdmi-core.c b/drivers/video/hdmi/hdmi-old/hdmi-core.c index 6b03ab29562e..cca51dd31834 100755 --- a/drivers/video/hdmi/hdmi-old/hdmi-core.c +++ b/drivers/video/hdmi/hdmi-old/hdmi-core.c @@ -115,6 +115,10 @@ struct hdmi *get_hdmi_struct(int nr) else return ref_info[nr].hdmi; } +int hdmi_get_scale(void) +{ + return 100; +} static int __init hdmi_class_init(void) { int i; diff --git a/drivers/video/rk29_fb.c b/drivers/video/rk29_fb.c index 7ea52aab56c9..26ad7b93ccf8 100755 --- a/drivers/video/rk29_fb.c +++ b/drivers/video/rk29_fb.c @@ -48,7 +48,7 @@ #ifdef CONFIG_HDMI #include -#include +#include #endif #include @@ -937,6 +937,21 @@ int rk29_set_cursor(struct fb_info *info, struct fb_cursor *cursor) } #endif +static void hdmi_set_fbscale(struct fb_info *info) +{ + struct rk29fb_inf *inf = dev_get_drvdata(info->device); + struct rk29fb_screen *screen = inf->cur_screen; + struct win0_par *par = info->par; + int scale; + + scale = hdmi_get_scale(); + if(scale == 100) + return; + par->xpos += screen->x_res * (100-scale) / 200; + par->ypos += screen->y_res * (100-scale) / 200; + par->xsize = par->xsize *scale /100; + par->ysize = par->ysize *scale /100; +} static int win0_blank(int blank_mode, struct fb_info *info) { struct rk29fb_inf *inf = dev_get_drvdata(info->device); @@ -967,21 +982,24 @@ static int win0_set_par(struct fb_info *info) struct fb_var_screeninfo *var = &info->var; struct fb_fix_screeninfo *fix = &info->fix; struct win0_par *par = info->par; - - u32 xact = var->xres; /* visible resolution */ - u32 yact = var->yres; - u32 xvir = var->xres_virtual; /* virtual resolution */ - u32 yvir = var->yres_virtual; + u32 xact, yact, xvir, yvir, xpos, ypos, ScaleYrgbX,ScaleYrgbY, ScaleCbrX, ScaleCbrY, y_addr,uv_addr; + hdmi_set_fbscale(info); + xact = var->xres; /* visible resolution */ + yact = var->yres; + xvir = var->xres_virtual; /* virtual resolution */ + yvir = var->yres_virtual; //u32 xact_st = var->xoffset; /* offset from virtual to visible */ //u32 yact_st = var->yoffset; /* resolution */ - u32 xpos = par->xpos; - u32 ypos = par->ypos; + xpos = par->xpos; + ypos = par->ypos; - u32 ScaleYrgbX=0x1000,ScaleYrgbY=0x1000; - u32 ScaleCbrX=0x1000, ScaleCbrY=0x1000; + ScaleYrgbX=0x1000; + ScaleYrgbY=0x1000; + ScaleCbrX=0x1000; + ScaleCbrY=0x1000; - u32 y_addr = 0; //user alloc buf addr y - u32 uv_addr = 0; + y_addr = 0; //user alloc buf addr y + uv_addr = 0; fbprintk(">>>>>> %s : %s\n", __FILE__, __FUNCTION__); @@ -1132,28 +1150,31 @@ static int win1_set_par(struct fb_info *info) struct rk29fb_screen *screen = inf->cur_screen; struct win0_par *par = info->par; struct fb_var_screeninfo *var = &info->var; - + u32 addr; + u16 xres_virtual,xpos,ypos; + u8 trspval,trspmode; + hdmi_set_fbscale(info); //u32 offset=0, addr=0, map_size=0, smem_len=0; - u32 addr=0; - u16 xres_virtual = 0; //virtual screen size + addr=0; + xres_virtual = 0; //virtual screen size //u16 xpos_virtual = var->xoffset; //visiable offset in virtual screen //u16 ypos_virtual = var->yoffset; - u16 xpos = par->xpos; //visiable offset in panel - u16 ypos = par->ypos; + xpos = par->xpos; //visiable offset in panel + ypos = par->ypos; - u8 trspmode = TRSP_CLOSE; - u8 trspval = 0; + trspmode = TRSP_CLOSE; + trspval = 0; //fbprintk(">>>>>> %s : %s\n", __FILE__, __FUNCTION__); #ifdef CONFIG_FB_SCALING_OSD if(((screen->x_res != var->xres) || (screen->y_res != var->yres)) - && !((screen->x_res>1280) && (var->bits_per_pixel == 32))) + && !((screen->x_res>1920) && (var->bits_per_pixel == 32))) { - addr = fix->mmio_start + par->y_offset; - xres_virtual = screen->x_res; //virtual screen size + addr = fix->mmio_start + par->y_offset* hdmi_get_scale()/100; + xres_virtual = screen->x_res* hdmi_get_scale()/100; //virtual screen size } else #endif @@ -1208,9 +1229,9 @@ static int win1_pan( struct fb_info *info ) struct rk29fb_screen *screen = inf->cur_screen; struct fb_var_screeninfo *var = &info->var; if(((screen->x_res != var->xres) || (screen->y_res != var->yres)) - && !((screen->x_res>1280) && (var->bits_per_pixel == 32))) + && !((screen->x_res>1920) && (var->bits_per_pixel == 32))) { - addr = fix1->mmio_start + par->y_offset; + addr = fix1->mmio_start + par->y_offset* hdmi_get_scale()/100; } else #endif @@ -1372,7 +1393,7 @@ static int fb0_set_par(struct fb_info *info) { #ifdef CONFIG_FB_SCALING_OSD if(((screen->x_res != var->xres) || (screen->y_res != var->yres)) - && !((screen->x_res>1280) && (var->bits_per_pixel == 32))) + && !((screen->x_res>1920) && (var->bits_per_pixel == 32))) { par->xpos = 0; par->ypos = 0; @@ -1384,9 +1405,9 @@ static int fb0_set_par(struct fb_info *info) ipp_req.src0.w = var->xres; ipp_req.src0.h = var->yres; - ipp_req.dst0.YrgbMst = fix->mmio_start + dstoffset; - ipp_req.dst0.w = screen->x_res; - ipp_req.dst0.h = screen->y_res; + ipp_req.dst0.YrgbMst = fix->mmio_start + dstoffset* hdmi_get_scale()/100; + ipp_req.dst0.w = screen->x_res* hdmi_get_scale()/100; + ipp_req.dst0.h = screen->y_res* hdmi_get_scale()/100; ipp_req.src_vir_w = ipp_req.src0.w; ipp_req.dst_vir_w = ipp_req.dst0.w; @@ -1432,7 +1453,7 @@ static int fb0_pan_display(struct fb_var_screeninfo *var, struct fb_info *info) #ifdef CONFIG_FB_SCALING_OSD struct fb_fix_screeninfo *fix = &info->fix; struct rk29_ipp_req ipp_req; - u32 dstoffset = 0 + u32 dstoffset = 0; #endif //fbprintk(">>>>>> %s : %s \n", __FILE__, __FUNCTION__); @@ -1470,7 +1491,7 @@ static int fb0_pan_display(struct fb_var_screeninfo *var, struct fb_info *info) { #ifdef CONFIG_FB_SCALING_OSD if(((screen->x_res != var->xres) || (screen->y_res != var->yres)) - && !((screen->x_res>1280) && (var->bits_per_pixel == 32))) + && !((screen->x_res>1920) && (var->bits_per_pixel == 32))) { par->y_offset = dstoffset; @@ -1478,9 +1499,9 @@ static int fb0_pan_display(struct fb_var_screeninfo *var, struct fb_info *info) ipp_req.src0.w = var->xres; ipp_req.src0.h = var->yres; - ipp_req.dst0.YrgbMst = fix->mmio_start + dstoffset; - ipp_req.dst0.w = screen->x_res; - ipp_req.dst0.h = screen->y_res; + ipp_req.dst0.YrgbMst = fix->mmio_start + dstoffset* hdmi_get_scale()/100; + ipp_req.dst0.w = screen->x_res* hdmi_get_scale()/100; + ipp_req.dst0.h = screen->y_res* hdmi_get_scale()/100; ipp_req.src_vir_w = ipp_req.src0.w; ipp_req.dst_vir_w = ipp_req.dst0.w; @@ -1618,7 +1639,7 @@ static int fb1_check_var(struct fb_var_screeninfo *var, struct fb_info *info) u16 xlcd = screen->x_res; //size of panel u16 ylcd = screen->y_res; u16 yres = 0; -#ifdef CONFIG_HDMI +#if 0 struct hdmi *hdmi = get_hdmi_struct(0); #endif @@ -1729,7 +1750,7 @@ static int fb1_check_var(struct fb_var_screeninfo *var, struct fb_info *info) { return -EINVAL; // multiple of scale down or scale up can't exceed 8 } -#ifdef CONFIG_HDMI +#if 0 if(inf->video_mode == 1) { if(hdmi_resolution_changed(hdmi,var->xres,var->yres, 1) == 1) { @@ -2195,6 +2216,14 @@ static struct fb_ops fb0_ops = { //.fb_cursor = rk29_set_cursor, }; +int fb_get_video_mode(void) +{ + struct rk29fb_inf *inf; + if(!g_pdev) + return 0; + inf = platform_get_drvdata(g_pdev); + return inf->video_mode; +} /* enable: 1, switch to tv or hdmi; 0, switch to lcd */ diff --git a/include/linux/hdmi-new.h b/include/linux/hdmi-new.h index 561e25ca8da2..5ca995b29f4e 100755 --- a/include/linux/hdmi-new.h +++ b/include/linux/hdmi-new.h @@ -31,15 +31,35 @@ typedef int BOOL; #define FALSE 0 #define HDMI_DISABLE 0 #define HDMI_ENABLE 1 + +#define MIN_SCALE 80 +/* mouse event */ +#define MOUSE_NONE 0x00 +#define MOUSE_LEFT_PRESS 0x01 +#define MOUSE_RIGHT_PRESS 0x02 +#define MOUSE_MIDDLE_PRESS 0x04 +#define HDMI_MOUSE_EVENT MOUSE_NONE +/* mode */ +#define DISP_ON_LCD 0 +#define DISP_ON_HDMI 1 +#define DISP_ON_LCD_AND_HDMI 2 +/* dual display */ +#ifdef CONFIG_HDMI_DUAL_DISP +#define DUAL_DISP_CAP HDMI_ENABLE +#define HDMI_DEFAULT_MODE DISP_ON_LCD_AND_HDMI +#else +#define DUAL_DISP_CAP HDMI_DISABLE +#define HDMI_DEFAULT_MODE DISP_ON_HDMI +#endif /* resolution */ -#define HDMI_1280x720p_50Hz 0 -#define HDMI_1280x720p_60Hz 1 -#define HDMI_720x576p_50Hz_4x3 2 -#define HDMI_720x576p_50Hz_16x9 3 -#define HDMI_720x480p_60Hz_4x3 4 -#define HDMI_720x480p_60Hz_16x9 5 -#define HDMI_1920x1080p_50Hz 6 -#define HDMI_1920x1080p_60Hz 7 +#define HDMI_1920x1080p_50Hz 0 +#define HDMI_1920x1080p_60Hz 1 +#define HDMI_1280x720p_50Hz 2 +#define HDMI_1280x720p_60Hz 3 +#define HDMI_720x576p_50Hz_4x3 4 +#define HDMI_720x576p_50Hz_16x9 5 +#define HDMI_720x480p_60Hz_4x3 6 +#define HDMI_720x480p_60Hz_16x9 7 /* HDMI default resolution */ #define HDMI_DEFAULT_RESOLUTION HDMI_1280x720p_50Hz @@ -72,7 +92,10 @@ struct hdmi { BOOL param_conf; u8 resolution; + u8 scale; u8 audio_fs; + int mode; + int dual_disp; int hdmi_stay_awake; @@ -102,5 +125,7 @@ extern struct hdmi *get_hdmi_struct(int nr); extern int hdmi_get_default_resolution(void *screen); extern void hdmi_set_spk(int on); extern void hdmi_set_backlight(int on); - +extern int hdmi_get_scale(void); +extern int hdmi_set_scale(int event, char *data, int len); +extern int fb_get_video_mode(void); #endif -- 2.34.1