summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hw/display/display.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/hw/display/display.c b/hw/display/display.c
index 0125bb3..2992a0b 100644
--- a/hw/display/display.c
+++ b/hw/display/display.c
@@ -36,6 +36,8 @@
#define TW3_LCD_PATH "/sys/class/lcd/s6e36w3x01"
#endif
+#define IMAGE_EFFECT_PATH "/sys/class/extension/mdnie/scenario"
+
static int display_get_max_brightness(int *val)
{
static int max = -1;
@@ -139,6 +141,52 @@ out:
return 0;
}
+static int display_get_image_effect(enum display_image_effect *effect)
+{
+ int r, v;
+
+ if (!effect) {
+ _E("Wrong parameter");
+ return -EINVAL;
+ }
+
+ r = sys_get_int(IMAGE_EFFECT_PATH, &v);
+ if (r < 0) {
+ _E("Failed to get image_effect (errno:%d)", r);
+ return r;
+ }
+
+ *effect = v;
+ return 0;
+}
+
+static int display_set_image_effect(enum display_image_effect effect)
+{
+ int r, value;
+
+ if (effect >= DISPLAY_IMAGE_EFFECT_MAX) {
+ _E("Wrong parameter");
+ return -EINVAL;
+ }
+
+ if (effect == DISPLAY_IMAGE_EFFECT_NEGATIVE)
+ value = 6;
+ else if (effect == DISPLAY_IMAGE_EFFECT_GREY)
+ value = 9;
+ else if (effect == DISPLAY_IMAGE_EFFECT_GREY_NEGATIVE)
+ value = 11;
+ else
+ value = 0;
+
+ r = sys_set_int(IMAGE_EFFECT_PATH, value);
+ if (r < 0) {
+ _E("Failed to get image_effect (errno:%d)", r);
+ return r;
+ }
+
+ return 0;
+}
+
static int display_open(struct hw_info *info,
const char *id, struct hw_common **common)
{
@@ -156,6 +204,8 @@ static int display_open(struct hw_info *info,
display_dev->get_brightness = display_get_brightness;
display_dev->set_brightness = display_set_brightness;
display_dev->get_state = display_get_state;
+ display_dev->get_image_effect = display_get_image_effect;
+ display_dev->set_image_effect = display_set_image_effect;
*common = (struct hw_common *)display_dev;
return 0;