+ dev_drv->ops->set_dsp_lut(dev_drv, dsp_lut);
+
+ return count;
+}
+
+static ssize_t show_dsp_cabc(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct fb_info *fbi = dev_get_drvdata(dev);
+ struct rk_lcdc_driver *dev_drv =
+ (struct rk_lcdc_driver *)fbi->par;
+
+ return snprintf(buf, PAGE_SIZE, "cabc mode=%d\n",
+ dev_drv->cabc_mode);
+ return 0;
+}
+
+static ssize_t set_dsp_cabc(struct device *dev, struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ struct fb_info *fbi = dev_get_drvdata(dev);
+ struct rk_lcdc_driver *dev_drv =
+ (struct rk_lcdc_driver *)fbi->par;
+ int ret, mode = 0;
+
+ ret = kstrtoint(buf, 0, &mode);
+ if (ret)
+ return ret;
+
+ ret = dev_drv->ops->set_dsp_cabc(dev_drv, mode);
+ if (ret < 0)
+ return ret;
+
+ return count;
+}
+
+static ssize_t show_dsp_bcsh(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct fb_info *fbi = dev_get_drvdata(dev);
+ struct rk_lcdc_driver *dev_drv =
+ (struct rk_lcdc_driver *)fbi->par;
+ int brightness, contrast, sat_con, sin_hue, cos_hue;
+
+ if (dev_drv->ops->get_dsp_bcsh_bcs) {
+ brightness = dev_drv->ops->get_dsp_bcsh_bcs(dev_drv,
+ BRIGHTNESS);
+ contrast = dev_drv->ops->get_dsp_bcsh_bcs(dev_drv, CONTRAST);
+ sat_con = dev_drv->ops->get_dsp_bcsh_bcs(dev_drv, SAT_CON);
+ }
+ if (dev_drv->ops->get_dsp_bcsh_hue) {
+ sin_hue = dev_drv->ops->get_dsp_bcsh_hue(dev_drv, H_SIN);
+ cos_hue = dev_drv->ops->get_dsp_bcsh_hue(dev_drv, H_COS);
+ }
+ return snprintf(buf, PAGE_SIZE,
+ "brightness:%4d,contrast:%4d,sat_con:%4d,"
+ "sin_hue:%4d,cos_hue:%4d\n",
+ brightness, contrast, sat_con, sin_hue, cos_hue);
+}
+
+static ssize_t set_dsp_bcsh(struct device *dev, struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ struct fb_info *fbi = dev_get_drvdata(dev);
+ struct rk_lcdc_driver *dev_drv =
+ (struct rk_lcdc_driver *)fbi->par;
+ int brightness, contrast, sat_con, ret, sin_hue, cos_hue;
+
+ if (!strncmp(buf, "open", 4)) {
+ if (dev_drv->ops->open_bcsh)
+ ret = dev_drv->ops->open_bcsh(dev_drv, 1);
+ else
+ ret = -1;
+ } else if (!strncmp(buf, "close", 5)) {
+ if (dev_drv->ops->open_bcsh)
+ ret = dev_drv->ops->open_bcsh(dev_drv, 0);
+ else
+ ret = -1;
+ } else if (!strncmp(buf, "brightness", 10)) {
+ sscanf(buf, "brightness %d", &brightness);
+ if (unlikely(brightness > 255)) {
+ dev_err(fbi->dev,
+ "brightness should be [0:255],now=%d\n\n",
+ brightness);
+ brightness = 255;
+ }
+ if (dev_drv->ops->set_dsp_bcsh_bcs)
+ ret = dev_drv->ops->set_dsp_bcsh_bcs(dev_drv,
+ BRIGHTNESS,
+ brightness);
+ else
+ ret = -1;
+ } else if (!strncmp(buf, "contrast", 8)) {
+ sscanf(buf, "contrast %d", &contrast);
+ if (unlikely(contrast > 510)) {
+ dev_err(fbi->dev,
+ "contrast should be [0:510],now=%d\n",
+ contrast);
+ contrast = 510;
+ }
+ if (dev_drv->ops->set_dsp_bcsh_bcs)
+ ret = dev_drv->ops->set_dsp_bcsh_bcs(dev_drv,
+ CONTRAST,
+ contrast);
+ else
+ ret = -1;
+ } else if (!strncmp(buf, "sat_con", 7)) {
+ sscanf(buf, "sat_con %d", &sat_con);
+ if (unlikely(sat_con > 1015)) {
+ dev_err(fbi->dev,
+ "sat_con should be [0:1015],now=%d\n",
+ sat_con);
+ sat_con = 1015;
+ }
+ if (dev_drv->ops->set_dsp_bcsh_bcs)
+ ret = dev_drv->ops->set_dsp_bcsh_bcs(dev_drv,
+ SAT_CON,
+ sat_con);
+ else
+ ret = -1;
+ } else if (!strncmp(buf, "hue", 3)) {
+ sscanf(buf, "hue %d %d", &sin_hue, &cos_hue);
+ if (unlikely(sin_hue > 511 || cos_hue > 511)) {
+ dev_err(fbi->dev, "sin_hue=%d,cos_hue=%d\n",
+ sin_hue, cos_hue);
+ }
+ if (dev_drv->ops->set_dsp_bcsh_hue)
+ ret = dev_drv->ops->set_dsp_bcsh_hue(dev_drv,
+ sin_hue,
+ cos_hue);
+ else
+ ret = -1;
+ } else {
+ printk("format error\n");
+ }
+
+ if (ret < 0)
+ return ret;
+
+ return count;
+}
+
+static ssize_t show_scale(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct fb_info *fbi = dev_get_drvdata(dev);
+ struct rk_lcdc_driver *dev_drv =
+ (struct rk_lcdc_driver *)fbi->par;
+ struct rk_screen *screen = dev_drv->cur_screen;
+
+ return snprintf(buf, PAGE_SIZE,
+ "xscale=%d yscale=%d\nleft=%d top=%d right=%d bottom=%d\n",
+ (screen->overscan.left + screen->overscan.right)/2,
+ (screen->overscan.top + screen->overscan.bottom)/2,
+ screen->overscan.left, screen->overscan.top,
+ screen->overscan.right, screen->overscan.bottom);
+}
+
+static ssize_t set_scale(struct device *dev, struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ struct fb_info *fbi = dev_get_drvdata(dev);
+ struct rk_lcdc_driver *dev_drv =
+ (struct rk_lcdc_driver *)fbi->par;
+ struct rk_screen *screen = dev_drv->cur_screen;
+ u32 left, top, right, bottom;
+
+ if (!strncmp(buf, "overscan", 8)) {
+ sscanf(buf,
+ "overscan %d,%d,%d,%d", &left, &top, &right, &bottom);
+ if (left > 0 && left <= 100)
+ screen->overscan.left = left;
+ if (top > 0 && top <= 100)
+ screen->overscan.top = top;
+ if (right > 0 && right <= 100)
+ screen->overscan.right = right;
+ if (bottom > 0 && bottom <= 100)
+ screen->overscan.bottom = bottom;
+ } else if (!strncmp(buf, "left", 4)) {
+ sscanf(buf, "left=%d", &left);
+ if (left > 0 && left <= 100)
+ screen->overscan.left = left;
+ } else if (!strncmp(buf, "top", 3)) {
+ sscanf(buf, "top=%d", &top);
+ if (top > 0 && top <= 100)
+ screen->overscan.top = top;
+ } else if (!strncmp(buf, "right", 5)) {
+ sscanf(buf, "right=%d", &right);
+ if (right > 0 && right <= 100)
+ screen->overscan.right = right;
+ } else if (!strncmp(buf, "bottom", 6)) {
+ sscanf(buf, "bottom=%d", &bottom);
+ if (bottom > 0 && bottom <= 100)
+ screen->overscan.bottom = bottom;
+ } else if (!strncmp(buf, "xscale", 6)) {
+ sscanf(buf, "xscale=%d", &left);
+ if (left > 0 && left <= 100) {
+ screen->overscan.left = left;
+ screen->overscan.right = left;
+ }
+ } else if (!strncmp(buf, "yscale", 6)) {
+ sscanf(buf, "yscale=%d", &left);
+ if (left > 0 && left <= 100) {
+ screen->overscan.top = left;
+ screen->overscan.bottom = left;
+ }
+ } else {
+ sscanf(buf, "%d", &left);
+ if (left > 0 && left <= 100) {
+ screen->overscan.left = left;
+ screen->overscan.right = left;
+ screen->overscan.top = left;
+ screen->overscan.bottom = left;
+ }
+ }
+
+ if (dev_drv->ops->set_overscan)
+ dev_drv->ops->set_overscan(dev_drv, &screen->overscan);