rk3036 hdmi: add debug interface

This commit is contained in:
hjc
2014-08-29 16:54:27 +08:00
parent b3d8ca9bcc
commit 6b11fb291c
5 changed files with 57 additions and 0 deletions

16
drivers/video/rockchip/display-sys.c Normal file → Executable file
View File

@@ -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
};

View File

@@ -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);

View File

@@ -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...) \

View File

@@ -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

View File

@@ -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 {