From 7b76455518dc249c48e0691f61ac5f393d4f9568 Mon Sep 17 00:00:00 2001 From: kfx Date: Wed, 11 May 2011 17:03:31 +0800 Subject: [PATCH] update hdmi driver: backlight control --- drivers/video/backlight/rk29_backlight.c | 7 +++++++ drivers/video/hdmi/hdmi-new/Makefile | 2 +- drivers/video/hdmi/hdmi-new/chips/anx7150.c | 10 ++++++++++ drivers/video/hdmi/hdmi-new/hdmi-backlight.c | 7 +++++++ drivers/video/hdmi/hdmi-new/hdmi-core.c | 2 +- include/linux/hdmi-new.h | 2 ++ 6 files changed, 28 insertions(+), 2 deletions(-) create mode 100755 drivers/video/hdmi/hdmi-new/hdmi-backlight.c diff --git a/drivers/video/backlight/rk29_backlight.c b/drivers/video/backlight/rk29_backlight.c index c83ecf426f8f..f8057f077734 100755 --- a/drivers/video/backlight/rk29_backlight.c +++ b/drivers/video/backlight/rk29_backlight.c @@ -127,6 +127,13 @@ static void rk29_bl_suspend(struct early_suspend *h) suspend_flag = 1; } +void rk29_backlight_set(bool on) +{ + printk("%s: set %d\n", __func__, on); + return; +} +EXPORT_SYMBOL(rk29_backlight_set); + static void rk29_bl_resume(struct early_suspend *h) { struct rk29_bl_info *rk29_bl_info = bl_get_data(rk29_bl); diff --git a/drivers/video/hdmi/hdmi-new/Makefile b/drivers/video/hdmi/hdmi-new/Makefile index 350604f63894..3178a0df5bd5 100644 --- a/drivers/video/hdmi/hdmi-new/Makefile +++ b/drivers/video/hdmi/hdmi-new/Makefile @@ -1,2 +1,2 @@ -obj-y += hdmi-core.o hdmi-sysfs.o hdmi-fb.o hdmi-codec.o +obj-y += hdmi-core.o hdmi-sysfs.o hdmi-fb.o hdmi-codec.o hdmi-backlight.o obj-y += chips/ diff --git a/drivers/video/hdmi/hdmi-new/chips/anx7150.c b/drivers/video/hdmi/hdmi-new/chips/anx7150.c index f977d7f41974..a87bc0dc7560 100755 --- a/drivers/video/hdmi/hdmi-new/chips/anx7150.c +++ b/drivers/video/hdmi/hdmi-new/chips/anx7150.c @@ -39,6 +39,7 @@ static int anx7150_param_chg(struct anx7150_pdata *anx) int resolution_real; hdmi_set_spk(anx->hdmi->display_on); + hdmi_set_backlight(anx->hdmi->display_on); hdmi_switch_fb(anx->hdmi, anx->hdmi->display_on); resolution_real = ANX7150_Get_Optimal_resolution(anx->hdmi->resolution); HDMI_Set_Video_Format(resolution_real); @@ -86,11 +87,19 @@ static int anx7150_remove(struct hdmi *hdmi) anx7150_unplug(anx->client); hdmi_set_spk(HDMI_DISABLE); + hdmi_set_backlight(HDMI_DISABLE); hdmi_switch_fb(hdmi, HDMI_DISABLE); return 0; } +static int anx7150_shutdown(struct hdmi *hdmi) +{ + struct anx7150_pdata *anx = hdmi_priv(hdmi); + + anx7150_unplug(anx->client); + return 0; +} static int anx7150_display_on(struct hdmi* hdmi) { struct anx7150_pdata *anx = hdmi_priv(hdmi); @@ -131,6 +140,7 @@ static struct hdmi_ops anx7150_ops = { .hdmi_precent = anx7150_hdmi_precent, .insert = anx7150_insert, .remove = anx7150_remove, + .shutdown = anx7150_shutdown, }; static irqreturn_t anx7150_detect_irq(int irq, void *dev_id); static void anx7150_detect_work(struct work_struct *work) diff --git a/drivers/video/hdmi/hdmi-new/hdmi-backlight.c b/drivers/video/hdmi/hdmi-new/hdmi-backlight.c new file mode 100755 index 000000000000..8ea28730055b --- /dev/null +++ b/drivers/video/hdmi/hdmi-new/hdmi-backlight.c @@ -0,0 +1,7 @@ +#include + +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-core.c b/drivers/video/hdmi/hdmi-new/hdmi-core.c index f5d64984d519..b134ae422129 100755 --- a/drivers/video/hdmi/hdmi-new/hdmi-core.c +++ b/drivers/video/hdmi/hdmi-new/hdmi-core.c @@ -32,7 +32,7 @@ void hdmi_changed(struct hdmi *hdmi, int msec) int hdmi_suspend(struct hdmi *hdmi) { flush_delayed_work(&hdmi->changed_work); - return hdmi->ops->remove(hdmi); + return hdmi->ops->shutdown(hdmi); } int hdmi_resume(struct hdmi *hdmi) { diff --git a/include/linux/hdmi-new.h b/include/linux/hdmi-new.h index 9c6a534fb90b..985a6ed16fa5 100755 --- a/include/linux/hdmi-new.h +++ b/include/linux/hdmi-new.h @@ -55,6 +55,7 @@ struct hdmi_ops{ int (*insert)(struct hdmi *); int (*remove)(struct hdmi *); int (*power_off)(struct hdmi *); + int (*shutdown)(struct hdmi *); }; struct hdmi { int id; @@ -95,5 +96,6 @@ 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); #endif -- 2.34.1