return -EINVAL;
}
+static ssize_t display_show_scale(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct rk_display_device *dsp = dev_get_drvdata(dev);
+ int xscale, yscale;
+
+ if(dsp->ops && dsp->ops->getscale) {
+ xscale = dsp->ops->getscale(dsp, DISPLAY_SCALE_X);
+ yscale = dsp->ops->getscale(dsp, DISPLAY_SCALE_Y);
+ if(xscale && yscale)
+ return snprintf(buf, PAGE_SIZE, "xscale=%d yscale=%d\n", xscale, yscale);
+ }
+ return -EINVAL;
+}
+
+static ssize_t display_store_scale(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ struct rk_display_device *dsp = dev_get_drvdata(dev);
+ int scale = 100;
+
+ if(dsp->ops && dsp->ops->setscale) {
+ if(!strncmp(buf, "xscale", 6)) {
+ sscanf(buf, "xscale=%d", &scale);
+ dsp->ops->setscale(dsp, DISPLAY_SCALE_X, scale);
+ }
+ else if(!strncmp(buf, "yscale", 6)) {
+ sscanf(buf, "yscale=%d", &scale);
+ dsp->ops->setscale(dsp, DISPLAY_SCALE_Y, scale);
+ }
+ else {
+ sscanf(buf, "%d", &scale);
+ dsp->ops->setscale(dsp, DISPLAY_SCALE_X, scale);
+ dsp->ops->setscale(dsp, DISPLAY_SCALE_Y, scale);
+ }
+ 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),
__ATTR(connect, S_IRUGO, display_show_connect, NULL),
__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_NULL
};
return 0;
}
+static int hdmi_set_scale(struct rk_display_device *device, int direction, int value)
+{
+ struct hdmi *hdmi = device->priv_data;
+
+ if(!hdmi || value < 0 || value > 100)
+ return -1;
+
+ if(direction == DISPLAY_SCALE_X)
+ hdmi->xscale = value;
+ else if(direction == DISPLAY_SCALE_Y)
+ hdmi->yscale = value;
+ else
+ return -1;
+ rk_fb_disp_scale(hdmi->xscale, hdmi->yscale, HDMI_SOURCE_DEFAULT);
+ return 0;
+}
+
+static int hdmi_get_scale(struct rk_display_device *device, int direction)
+{
+ struct hdmi *hdmi = device->priv_data;
+
+ if(!hdmi)
+ return -1;
+
+ if(direction == DISPLAY_SCALE_X)
+ return hdmi->xscale;
+ else if(direction == DISPLAY_SCALE_Y)
+ return hdmi->yscale;
+ else
+ return -1;
+}
+
struct rk_display_ops hdmi_display_ops = {
.setenable = hdmi_set_enable,
.getenable = hdmi_get_enable,
.getmodelist = hdmi_get_modelist,
.setmode = hdmi_set_mode,
.getmode = hdmi_get_mode,
+ .setscale = hdmi_set_scale,
+ .getscale = hdmi_get_scale,
};
#if 1
DISPLAY_PRIORITY_LCD,
};
+enum {
+ DISPLAY_SCALE_X = 0,
+ DISPLAY_SCALE_Y
+};
+
/* This structure defines all the properties of a Display. */
struct rk_display_driver {
void (*suspend)(struct rk_display_device *, pm_message_t state);
int (*getmodelist)(struct rk_display_device *, struct list_head **modelist);
int (*setmode)(struct rk_display_device *, struct fb_videomode *mode);
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);
};
struct rk_display_device {