From 6b11fb291cb3fc40a232f53347d6d10e5ba47b6c Mon Sep 17 00:00:00 2001 From: hjc Date: Fri, 29 Aug 2014 16:54:27 +0800 Subject: [PATCH] rk3036 hdmi: add debug interface --- drivers/video/rockchip/display-sys.c | 16 +++++++++++++++ .../hdmi/chips/rk3036/rk3036_hdmi_hw.c | 20 +++++++++++++++++++ drivers/video/rockchip/hdmi/rk_hdmi.h | 7 +++++++ drivers/video/rockchip/hdmi/rk_hdmi_sysfs.c | 13 ++++++++++++ include/linux/display-sys.h | 1 + 5 files changed, 57 insertions(+) mode change 100644 => 100755 drivers/video/rockchip/display-sys.c diff --git a/drivers/video/rockchip/display-sys.c b/drivers/video/rockchip/display-sys.c old mode 100644 new mode 100755 index 0fbb96fe910e..373cba98ac05 --- a/drivers/video/rockchip/display-sys.c +++ b/drivers/video/rockchip/display-sys.c @@ -189,6 +189,21 @@ static ssize_t display_store_scale(struct device *dev, return -EINVAL; } +static ssize_t display_store_debug(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + int cmd; + struct rk_display_device *dsp = dev_get_drvdata(dev); + + if(dsp->ops && dsp->ops->setdebug) { + sscanf(buf, "%d", &cmd); + dsp->ops->setdebug(dsp, cmd); + return count; + } + return -EINVAL; +} + static struct device_attribute display_attrs[] = { __ATTR(name, S_IRUGO, display_show_name, NULL), __ATTR(type, S_IRUGO, display_show_type, NULL), @@ -197,6 +212,7 @@ static struct device_attribute display_attrs[] = { __ATTR(modes, S_IRUGO, display_show_modes, NULL), __ATTR(mode, 0664, display_show_mode, display_store_mode), __ATTR(scale, 0664, display_show_scale, display_store_scale), + __ATTR(debug, 0664, NULL, display_store_debug), __ATTR_NULL }; diff --git a/drivers/video/rockchip/hdmi/chips/rk3036/rk3036_hdmi_hw.c b/drivers/video/rockchip/hdmi/chips/rk3036/rk3036_hdmi_hw.c index f81296cd5da2..ca6c99ee31fc 100755 --- a/drivers/video/rockchip/hdmi/chips/rk3036/rk3036_hdmi_hw.c +++ b/drivers/video/rockchip/hdmi/chips/rk3036/rk3036_hdmi_hw.c @@ -579,6 +579,25 @@ static void rk3036_hdmi_reset(struct hdmi *hdmi_drv) rk3036_hdmi_set_pwr_mode(hdmi_drv, LOWER_PWR); } +static int rk3036_hdmi_debug(struct hdmi *hdmi_drv,int cmd) +{ + switch(cmd) { + case 0: + printk("%s[%d]:cmd=%d\n",__func__,__LINE__,cmd); + break; + case 1: + printk("%s[%d]:cmd=%d\n",__func__,__LINE__,cmd); + break; + default: + printk("%s[%d]:cmd=%d\n",__func__,__LINE__,cmd); + break; + } + return 0; +} + +static struct rk_hdmi_drv_ops hdmi_drv_ops = { + .hdmi_debug = rk3036_hdmi_debug, +}; int rk3036_hdmi_initial(struct hdmi *hdmi_drv) { @@ -592,6 +611,7 @@ int rk3036_hdmi_initial(struct hdmi *hdmi_drv) hdmi_drv->detect_hotplug = rk3036_hdmi_detect_hotplug; hdmi_drv->read_edid = rk3036_hdmi_read_edid; hdmi_drv->insert = rk3036_hdmi_insert; + hdmi_drv->ops = &hdmi_drv_ops; rk3036_hdmi_reset_pclk(); rk3036_hdmi_reset(hdmi_drv); diff --git a/drivers/video/rockchip/hdmi/rk_hdmi.h b/drivers/video/rockchip/hdmi/rk_hdmi.h index 8a42d9da3719..b8c15be41892 100755 --- a/drivers/video/rockchip/hdmi/rk_hdmi.h +++ b/drivers/video/rockchip/hdmi/rk_hdmi.h @@ -313,6 +313,12 @@ struct rk_hdmi_drvdata { u8 soc_type; u32 reversed; }; +struct hdmi; + +struct rk_hdmi_drv_ops { + int (*hdmi_debug) (struct hdmi *hdmi, int cmd); +}; + struct hdmi { struct device *dev; @@ -381,6 +387,7 @@ struct hdmi { void (*cec_irq)(void); void (*cec_set_device_pa)(int); int (*cec_enumerate)(void); + struct rk_hdmi_drv_ops *ops; }; #define hdmi_err(dev, format, arg...) \ diff --git a/drivers/video/rockchip/hdmi/rk_hdmi_sysfs.c b/drivers/video/rockchip/hdmi/rk_hdmi_sysfs.c index 09855e5e4ba2..767490d900dc 100755 --- a/drivers/video/rockchip/hdmi/rk_hdmi_sysfs.c +++ b/drivers/video/rockchip/hdmi/rk_hdmi_sysfs.c @@ -141,6 +141,18 @@ static int hdmi_get_scale(struct rk_display_device *device, int direction) else return -1; } +static int hdmi_set_debug(struct rk_display_device *device, int cmd) +{ + struct hdmi *hdmi = device->priv_data; + + if (!hdmi) + return -1; + if (hdmi->ops && hdmi->ops->hdmi_debug) + hdmi->ops->hdmi_debug(hdmi,cmd); + + return 0; +} + struct rk_display_ops hdmi_display_ops = { .setenable = hdmi_set_enable, @@ -151,6 +163,7 @@ struct rk_display_ops hdmi_display_ops = { .getmode = hdmi_get_mode, .setscale = hdmi_set_scale, .getscale = hdmi_get_scale, + .setdebug = hdmi_set_debug, }; #if 1 diff --git a/include/linux/display-sys.h b/include/linux/display-sys.h index 579af11cc345..8edee472a5e5 100755 --- a/include/linux/display-sys.h +++ b/include/linux/display-sys.h @@ -37,6 +37,7 @@ struct rk_display_ops { int (*getmode)(struct rk_display_device *, struct fb_videomode *mode); int (*setscale)(struct rk_display_device *, int, int); int (*getscale)(struct rk_display_device *, int); + int (*setdebug)(struct rk_display_device *, int); }; struct rk_display_device { -- 2.34.1