summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlokilee73 <changjoo.lee@samsung.com>2019-04-05 16:24:59 +0900
committerlokilee73 <changjoo.lee@samsung.com>2019-04-09 14:16:52 +0900
commit8ad98e376e22d5bebc249e9e519fee6b0aa6f9dd (patch)
treed785f29238263a09278bc46d746f5a11bd481edd
parent06da4c2f5f73e99e18aa5d98ed006ad6d3bcec4e (diff)
downloaddevice-tw3-8ad98e376e22d5bebc249e9e519fee6b0aa6f9dd.tar.gz
device-tw3-8ad98e376e22d5bebc249e9e519fee6b0aa6f9dd.tar.bz2
device-tw3-8ad98e376e22d5bebc249e9e519fee6b0aa6f9dd.zip
Add display HAL for image effect
Change-Id: I79f9d661a031614e4f3f81a7034991f37513b442 Signed-off-by: lokilee73 <changjoo.lee@samsung.com>
-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;