display: add getter/setter function for white balance 92/284292/1 accepted/tizen/7.0/unified/20221117.014348
authorYunhee Seo <yuni.seo@samsung.com>
Thu, 10 Nov 2022 08:12:45 +0000 (17:12 +0900)
committeryunhee seo <yuni.seo@samsung.com>
Tue, 15 Nov 2022 04:53:12 +0000 (04:53 +0000)
Add a dbus/plugin getter and setter function of display white balance which controls RGB gain and offset.

White balancing is adjusting standard point of white color, this because the light source is different for each device.
gain value is a value to be multiplied for RGB value calculation.
offset value is a value to be added for RGB value calculation.

white balancing getter/setter dbus methods
1. Set white balance
    path: /Org/Tizen/System/DeviceD/Display
    interface: org.tizen.system.deviced.display
    member: SetWhiteBalance
    parameter: "(ii)", white balance enum type to be set, value to be set
    return: "(i)", 0 on success, negative on error.

2. Get white balance
    path: /Org/Tizen/System/DeviceD/Display
    interface: org.tizen.system.deviced.display
    member: GetWhiteBalance
    parameter: "(i)", white balance enum type to be get
    return: "(i)", value for that white balance type, negative on error.

plugin implementation is referring to this enum type
enum hal_display_white_balance {
HAL_DISPLAY_WHITE_BALANCE_R_GAIN,
HAL_DISPLAY_WHITE_BALANCE_G_GAIN,
HAL_DISPLAY_WHITE_BALANCE_B_GAIN,
HAL_DISPLAY_WHITE_BALANCE_R_OFFSET,
HAL_DISPLAY_WHITE_BALANCE_G_OFFSET,
HAL_DISPLAY_WHITE_BALANCE_B_OFFSET,
};

Change-Id: I972bdb468806b442b221634a166645764c7c2ec9
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
(cherry picked from commit 0b807395978a911334d6204ba383d5ea5a244f5d)

plugins/iot-headed/display/core.c
plugins/iot-headed/display/device-interface.c
plugins/mobile/display/core.c
plugins/mobile/display/device-interface.c
plugins/tv/display/core.c
plugins/tv/display/device-interface.c
plugins/wearable/display/core.c
plugins/wearable/display/device-interface.c
src/display/device-interface.h
src/display/display-dbus.c

index b6edf04..6bd21d0 100644 (file)
@@ -92,6 +92,7 @@ extern void init_save_userlock(void);
 
 static struct display_plugin *disp_plgn;
 static struct _backlight_ops *backlight_ops;
+static struct _display_white_balance_ops *display_white_balance_ops;
 static struct battery_plugin *battery_plgn;
 static int (*fp_get_charging_status) (int *val);
 static void (*power_saving_func) (int onoff);
@@ -2350,6 +2351,10 @@ static void __CONSTRUCTOR__ initialize(void)
        if (!backlight_ops)
                _E("Failed to get backlight operator variable.");
 
+       display_white_balance_ops = get_var_display_white_balance_ops();
+       if (!display_white_balance_ops)
+               _E("Failed to get display white balance operator variable.");
+
        battery_plgn = get_var_battery_plugin();
        if (!battery_plgn)
                _E("Failed to get battery plugin variable.");
index bef99b0..f07018d 100644 (file)
 #define LCD_PHASED_DELAY               10000   /* microsecond */
 #define DUMP_MODE_WAITING_TIME         600000  /* milisecond */
 
+#define MAX_WHITE_BALANCE_GAIN                 2047
+#define MAX_WHITE_BALANCE_OFFSET               2047
+#define DEFAULT_WHITE_BALANCE_GAIN             1024
+#define DEFAULT_WHITE_BALANCE_OFFSET           0
+
 #define DISPLAY_HAL_LIB_PATH "/usr/lib/libdisplay-hal.so"
 
 #define GESTURE_STR                    "gesture"
@@ -69,6 +74,7 @@
 #define FREEZER_VITAL_WAKEUP_CGROUP "/sys/fs/cgroup/freezer/vital_wakeup/freezer.state"
 
 static struct _backlight_ops backlight_ops;
+static struct _display_white_balance_ops display_white_balance_ops;
 static bool custom_status;
 static int custom_brightness;
 static int force_brightness;
@@ -83,6 +89,11 @@ inline struct _backlight_ops *get_var_backlight_ops(void)
        return &backlight_ops;
 }
 
+inline struct _display_white_balance_ops *get_var_display_white_balance_ops(void)
+{
+       return &display_white_balance_ops;
+}
+
 bool display_dev_ready(void)
 {
        return display_dev_available;
@@ -739,6 +750,77 @@ static void release_blink(void)
        release_timer = g_timeout_add(DUMP_MODE_WAITING_TIME, release_blink_cb, NULL);
 }
 
+static int set_white_balance(enum hal_display_white_balance white_balance_type, int value)
+{
+       int ret = 0;
+
+       if (!display_dev_available) {
+               _E("There is no display device.");
+               return -ENOENT;
+       }
+
+       switch (white_balance_type) {
+       case HAL_DISPLAY_WHITE_BALANCE_R_GAIN:
+       case HAL_DISPLAY_WHITE_BALANCE_G_GAIN:
+       case HAL_DISPLAY_WHITE_BALANCE_B_GAIN:
+               if (value > MAX_WHITE_BALANCE_GAIN)
+                       value = DEFAULT_WHITE_BALANCE_GAIN;
+               break;
+       case HAL_DISPLAY_WHITE_BALANCE_R_OFFSET:
+       case HAL_DISPLAY_WHITE_BALANCE_G_OFFSET:
+       case HAL_DISPLAY_WHITE_BALANCE_B_OFFSET:
+               if (value > MAX_WHITE_BALANCE_OFFSET)
+                       value = DEFAULT_WHITE_BALANCE_OFFSET;
+               break;
+       default:
+               _E("Unknown white balance type");
+               return -EINVAL;
+       }
+
+       ret = hal_device_display_set_white_balance(white_balance_type, value);
+       if (ret < 0) {
+               if (ret == -ENODEV)
+                       _E("Set white balance is not supported.");
+               else
+                       _E("Failed to set white balance value.");
+       }
+
+       return ret;
+}
+
+static int get_white_balance(enum hal_display_white_balance white_balance_type, int* value)
+{
+       int ret = 0;
+
+       if (!display_dev_available) {
+               _E("There is no display device.");
+               return -ENOENT;
+       }
+
+       switch (white_balance_type) {
+       case HAL_DISPLAY_WHITE_BALANCE_R_GAIN:
+       case HAL_DISPLAY_WHITE_BALANCE_G_GAIN:
+       case HAL_DISPLAY_WHITE_BALANCE_B_GAIN:
+       case HAL_DISPLAY_WHITE_BALANCE_R_OFFSET:
+       case HAL_DISPLAY_WHITE_BALANCE_G_OFFSET:
+       case HAL_DISPLAY_WHITE_BALANCE_B_OFFSET:
+               break;
+       default:
+               _E("Unknown white balance type");
+               return -EINVAL;
+       }
+
+       ret = hal_device_display_get_white_balance(white_balance_type, value);
+       if (ret < 0) {
+               if (ret == -ENODEV)
+                       _E("Get white balance is not supported.");
+               else
+                       _E("Failed to get white balance value.");
+       }
+
+       return ret;
+}
+
 static void restore_brightness_func(void)
 {
        backlight_ops.set_brightness = set_brightness;
@@ -777,6 +859,11 @@ static struct _backlight_ops backlight_ops = {
        .release_blink = release_blink,
 };
 
+static struct _display_white_balance_ops display_white_balance_ops = {
+       .set_white_balance = set_white_balance,
+       .get_white_balance = get_white_balance,
+};
+
 int display_service_load(void)
 {
        int r;
index 2e2d569..ddb7e58 100644 (file)
@@ -93,6 +93,7 @@ extern void init_save_userlock(void);
 
 static struct display_plugin *disp_plgn;
 static struct _backlight_ops *backlight_ops;
+static struct _display_white_balance_ops *display_white_balance_ops;
 static struct battery_plugin *battery_plgn;
 static int (*fp_get_charging_status) (int *val);
 
@@ -2361,6 +2362,10 @@ static void __CONSTRUCTOR__ initialize(void)
        if (!backlight_ops)
                _E("Failed to get backlight operator variable.");
 
+       display_white_balance_ops = get_var_display_white_balance_ops();
+       if (!display_white_balance_ops)
+               _E("Failed to get display white balance operator variable.");
+
        battery_plgn = get_var_battery_plugin();
        if (!battery_plgn)
                _E("Failed to get battery plugin variable.");
index 28d4f1c..1c3c8dd 100644 (file)
 #define LCD_PHASED_DELAY               10000   /* microsecond */
 #define DUMP_MODE_WAITING_TIME         600000  /* milisecond */
 
+#define MAX_WHITE_BALANCE_GAIN                 2047
+#define MAX_WHITE_BALANCE_OFFSET               2047
+#define DEFAULT_WHITE_BALANCE_GAIN             1024
+#define DEFAULT_WHITE_BALANCE_OFFSET           0
+
 #define DISPLAY_HAL_LIB_PATH "/usr/lib/libdisplay-hal.so"
 
 #define GESTURE_STR                    "gesture"
@@ -68,6 +73,7 @@
 #define UNKNOWN_STR                    "unknown"
 
 static struct _backlight_ops backlight_ops;
+static struct _display_white_balance_ops display_white_balance_ops;
 static bool custom_status;
 static int custom_brightness;
 static int force_brightness;
@@ -82,6 +88,11 @@ inline struct _backlight_ops *get_var_backlight_ops(void)
        return &backlight_ops;
 }
 
+inline struct _display_white_balance_ops *get_var_display_white_balance_ops(void)
+{
+       return &display_white_balance_ops;
+}
+
 bool display_dev_ready(void)
 {
        return display_dev_available;
@@ -738,6 +749,77 @@ static void release_blink(void)
        release_timer = g_timeout_add(DUMP_MODE_WAITING_TIME, release_blink_cb, NULL);
 }
 
+static int set_white_balance(enum hal_display_white_balance white_balance_type, int value)
+{
+       int ret = 0;
+
+       if (!display_dev_available) {
+               _E("There is no display device.");
+               return -ENOENT;
+       }
+
+       switch (white_balance_type) {
+       case HAL_DISPLAY_WHITE_BALANCE_R_GAIN:
+       case HAL_DISPLAY_WHITE_BALANCE_G_GAIN:
+       case HAL_DISPLAY_WHITE_BALANCE_B_GAIN:
+               if (value > MAX_WHITE_BALANCE_GAIN)
+                       value = DEFAULT_WHITE_BALANCE_GAIN;
+               break;
+       case HAL_DISPLAY_WHITE_BALANCE_R_OFFSET:
+       case HAL_DISPLAY_WHITE_BALANCE_G_OFFSET:
+       case HAL_DISPLAY_WHITE_BALANCE_B_OFFSET:
+               if (value > MAX_WHITE_BALANCE_OFFSET)
+                       value = DEFAULT_WHITE_BALANCE_OFFSET;
+               break;
+       default:
+               _E("Unknown white balance type");
+               return -EINVAL;
+       }
+
+       ret = hal_device_display_set_white_balance(white_balance_type, value);
+       if (ret < 0) {
+               if (ret == -ENODEV)
+                       _E("Set white balance is not supported.");
+               else
+                       _E("Failed to set white balance value.");
+       }
+
+       return ret;
+}
+
+static int get_white_balance(enum hal_display_white_balance white_balance_type, int* value)
+{
+       int ret = 0;
+
+       if (!display_dev_available) {
+               _E("There is no display device.");
+               return -ENOENT;
+       }
+
+       switch (white_balance_type) {
+       case HAL_DISPLAY_WHITE_BALANCE_R_GAIN:
+       case HAL_DISPLAY_WHITE_BALANCE_G_GAIN:
+       case HAL_DISPLAY_WHITE_BALANCE_B_GAIN:
+       case HAL_DISPLAY_WHITE_BALANCE_R_OFFSET:
+       case HAL_DISPLAY_WHITE_BALANCE_G_OFFSET:
+       case HAL_DISPLAY_WHITE_BALANCE_B_OFFSET:
+               break;
+       default:
+               _E("Unknown white balance type");
+               return -EINVAL;
+       }
+
+       ret = hal_device_display_get_white_balance(white_balance_type, value);
+       if (ret < 0) {
+               if (ret == -ENODEV)
+                       _E("Get white balance is not supported.");
+               else
+                       _E("Failed to get white balance value.");
+       }
+
+       return ret;
+}
+
 static void restore_brightness_func(void)
 {
        backlight_ops.set_brightness = set_brightness;
@@ -776,6 +858,11 @@ static struct _backlight_ops backlight_ops = {
        .release_blink = release_blink,
 };
 
+static struct _display_white_balance_ops display_white_balance_ops = {
+       .set_white_balance = set_white_balance,
+       .get_white_balance = get_white_balance,
+};
+
 int display_service_load(void)
 {
        int r;
index d8ba642..3dc8fc8 100644 (file)
@@ -91,6 +91,7 @@ extern void init_save_userlock(void);
 
 static struct display_plugin *disp_plgn;
 static struct _backlight_ops *backlight_ops;
+static struct _display_white_balance_ops *display_white_balance_ops;
 static struct battery_plugin *battery_plgn;
 static int (*fp_get_charging_status) (int *val);
 
@@ -2347,6 +2348,10 @@ static void __CONSTRUCTOR__ initialize(void)
        if (!backlight_ops)
                _E("Failed to get backlight operator variable.");
 
+       display_white_balance_ops = get_var_display_white_balance_ops();
+       if (!display_white_balance_ops)
+               _E("Failed to get display white balance operator variable.");
+
        battery_plgn = get_var_battery_plugin();
        if (!battery_plgn)
                _E("Failed to get battery plugin variable.");
index d377ac8..a5500ca 100644 (file)
 #define LCD_PHASED_DELAY               10000   /* microsecond */
 #define DUMP_MODE_WAITING_TIME         600000  /* milisecond */
 
+#define MAX_WHITE_BALANCE_GAIN                 2047
+#define MAX_WHITE_BALANCE_OFFSET               2047
+#define DEFAULT_WHITE_BALANCE_GAIN             1024
+#define DEFAULT_WHITE_BALANCE_OFFSET           0
+
 #define DISPLAY_HAL_LIB_PATH "/usr/lib/libdisplay-hal.so"
 
 #define GESTURE_STR                    "gesture"
@@ -69,6 +74,7 @@
 #define FREEZER_VITAL_WAKEUP_CGROUP "/sys/fs/cgroup/freezer/vital_wakeup/freezer.state"
 
 static struct _backlight_ops backlight_ops;
+static struct _display_white_balance_ops display_white_balance_ops;
 static bool custom_status;
 static int custom_brightness;
 static int force_brightness;
@@ -83,6 +89,11 @@ inline struct _backlight_ops *get_var_backlight_ops(void)
        return &backlight_ops;
 }
 
+inline struct _display_white_balance_ops *get_var_display_white_balance_ops(void)
+{
+       return &display_white_balance_ops;
+}
+
 bool display_dev_ready(void)
 {
        return display_dev_available;
@@ -739,6 +750,77 @@ static void release_blink(void)
        release_timer = g_timeout_add(DUMP_MODE_WAITING_TIME, release_blink_cb, NULL);
 }
 
+static int set_white_balance(enum hal_display_white_balance white_balance_type, int value)
+{
+       int ret = 0;
+
+       if (!display_dev_available) {
+               _E("There is no display device.");
+               return -ENOENT;
+       }
+
+       switch (white_balance_type) {
+       case HAL_DISPLAY_WHITE_BALANCE_R_GAIN:
+       case HAL_DISPLAY_WHITE_BALANCE_G_GAIN:
+       case HAL_DISPLAY_WHITE_BALANCE_B_GAIN:
+               if (value > MAX_WHITE_BALANCE_GAIN)
+                       value = DEFAULT_WHITE_BALANCE_GAIN;
+               break;
+       case HAL_DISPLAY_WHITE_BALANCE_R_OFFSET:
+       case HAL_DISPLAY_WHITE_BALANCE_G_OFFSET:
+       case HAL_DISPLAY_WHITE_BALANCE_B_OFFSET:
+               if (value > MAX_WHITE_BALANCE_OFFSET)
+                       value = DEFAULT_WHITE_BALANCE_OFFSET;
+               break;
+       default:
+               _E("Unknown white balance type");
+               return -EINVAL;
+       }
+
+       ret = hal_device_display_set_white_balance(white_balance_type, value);
+       if (ret < 0) {
+               if (ret == -ENODEV)
+                       _E("Set white balance is not supported.");
+               else
+                       _E("Failed to set white balance value.");
+       }
+
+       return ret;
+}
+
+static int get_white_balance(enum hal_display_white_balance white_balance_type, int* value)
+{
+       int ret = 0;
+
+       if (!display_dev_available) {
+               _E("There is no display device.");
+               return -ENOENT;
+       }
+
+       switch (white_balance_type) {
+       case HAL_DISPLAY_WHITE_BALANCE_R_GAIN:
+       case HAL_DISPLAY_WHITE_BALANCE_G_GAIN:
+       case HAL_DISPLAY_WHITE_BALANCE_B_GAIN:
+       case HAL_DISPLAY_WHITE_BALANCE_R_OFFSET:
+       case HAL_DISPLAY_WHITE_BALANCE_G_OFFSET:
+       case HAL_DISPLAY_WHITE_BALANCE_B_OFFSET:
+               break;
+       default:
+               _E("Unknown white balance type");
+               return -EINVAL;
+       }
+
+       ret = hal_device_display_get_white_balance(white_balance_type, value);
+       if (ret < 0) {
+               if (ret == -ENODEV)
+                       _E("Get white balance is not supported.");
+               else
+                       _E("Failed to get white balance value.");
+       }
+
+       return ret;
+}
+
 static void restore_brightness_func(void)
 {
        backlight_ops.set_brightness = set_brightness;
@@ -777,6 +859,11 @@ static struct _backlight_ops backlight_ops = {
        .release_blink = release_blink,
 };
 
+static struct _display_white_balance_ops display_white_balance_ops = {
+       .set_white_balance = set_white_balance,
+       .get_white_balance = get_white_balance,
+};
+
 int display_service_load(void)
 {
        int r;
index 1506958..56275ad 100644 (file)
@@ -99,6 +99,7 @@ extern void init_save_userlock(void);
 
 static struct display_plugin *disp_plgn;
 static struct _backlight_ops *backlight_ops;
+static struct _display_white_balance_ops *display_white_balance_ops;
 static struct battery_plugin *battery_plgn;
 static int (*fp_get_charging_status) (int *val);
 
@@ -2683,6 +2684,10 @@ static void __CONSTRUCTOR__ initialize(void)
        if (!backlight_ops)
                _E("Failed to get backlight operator variable.");
 
+       display_white_balance_ops = get_var_display_white_balance_ops();
+       if (!display_white_balance_ops)
+               _E("Failed to get display white balance operator variable.");
+
        battery_plgn = get_var_battery_plugin();
        if (!battery_plgn)
                 _E("Failed to get battery plugin variable.");
index 8ff62de..cb77833 100644 (file)
 #define LCD_PHASED_DELAY               10000   /* microsecond */
 #define DUMP_MODE_WAITING_TIME         600000  /* milisecond */
 
+#define MAX_WHITE_BALANCE_GAIN                 2047
+#define MAX_WHITE_BALANCE_OFFSET               2047
+#define DEFAULT_WHITE_BALANCE_GAIN             1024
+#define DEFAULT_WHITE_BALANCE_OFFSET           0
+
 #define DISPLAY_HAL_LIB_PATH "/usr/lib/libdisplay-hal.so"
 
 #define GESTURE_STR                    "gesture"
@@ -74,6 +79,7 @@
 
 
 static struct _backlight_ops backlight_ops;
+static struct _display_white_balance_ops display_white_balance_ops;
 static struct battery_plugin *battery_plgn;
 static bool custom_status;
 static int custom_brightness;
@@ -95,6 +101,11 @@ inline struct _backlight_ops *get_var_backlight_ops(void)
        return &backlight_ops;
 }
 
+inline struct _display_white_balance_ops *get_var_display_white_balance_ops(void)
+{
+       return &display_white_balance_ops;
+}
+
 bool display_dev_ready(void)
 {
        return display_dev_available;
@@ -811,6 +822,77 @@ static void restore_brightness_func(void)
        backlight_ops.transit_brt = change_brightness;
 }
 
+static int set_white_balance(enum hal_display_white_balance white_balance_type, int value)
+{
+       int ret = 0;
+
+       if (!display_dev_available) {
+               _E("There is no display device.");
+               return -ENOENT;
+       }
+
+       switch (white_balance_type) {
+       case HAL_DISPLAY_WHITE_BALANCE_R_GAIN:
+       case HAL_DISPLAY_WHITE_BALANCE_G_GAIN:
+       case HAL_DISPLAY_WHITE_BALANCE_B_GAIN:
+               if (value > MAX_WHITE_BALANCE_GAIN)
+                       value = DEFAULT_WHITE_BALANCE_GAIN;
+               break;
+       case HAL_DISPLAY_WHITE_BALANCE_R_OFFSET:
+       case HAL_DISPLAY_WHITE_BALANCE_G_OFFSET:
+       case HAL_DISPLAY_WHITE_BALANCE_B_OFFSET:
+               if (value > MAX_WHITE_BALANCE_OFFSET)
+                       value = DEFAULT_WHITE_BALANCE_OFFSET;
+               break;
+       default:
+               _E("Unknown white balance type");
+               return -EINVAL;
+       }
+
+       ret = hal_device_display_set_white_balance(white_balance_type, value);
+       if (ret < 0) {
+               if (ret == -ENODEV)
+                       _E("Set white balance is not supported.");
+               else
+                       _E("Failed to set white balance value.");
+       }
+
+       return ret;
+}
+
+static int get_white_balance(enum hal_display_white_balance white_balance_type, int* value)
+{
+       int ret = 0;
+
+       if (!display_dev_available) {
+               _E("There is no display device.");
+               return -ENOENT;
+       }
+
+       switch (white_balance_type) {
+       case HAL_DISPLAY_WHITE_BALANCE_R_GAIN:
+       case HAL_DISPLAY_WHITE_BALANCE_G_GAIN:
+       case HAL_DISPLAY_WHITE_BALANCE_B_GAIN:
+       case HAL_DISPLAY_WHITE_BALANCE_R_OFFSET:
+       case HAL_DISPLAY_WHITE_BALANCE_G_OFFSET:
+       case HAL_DISPLAY_WHITE_BALANCE_B_OFFSET:
+               break;
+       default:
+               _E("Unknown white balance type");
+               return -EINVAL;
+       }
+
+       ret = hal_device_display_get_white_balance(white_balance_type, value);
+       if (ret < 0) {
+               if (ret == -ENODEV)
+                       _E("Get white balance is not supported.");
+               else
+                       _E("Failed to get white balance value.");
+       }
+
+       return ret;
+}
+
 static struct _backlight_ops backlight_ops = {
        .off = backlight_off,
        .dim = backlight_dim,
@@ -844,6 +926,11 @@ static struct _backlight_ops backlight_ops = {
        .get_brightness_raw = get_brightness, /* always fetch brightness from node even LBM mode */
 };
 
+static struct _display_white_balance_ops display_white_balance_ops = {
+       .set_white_balance = set_white_balance,
+       .get_white_balance = get_white_balance,
+};
+
 int display_service_load(void)
 {
        int r;
index 759ff50..56b41e4 100644 (file)
@@ -94,6 +94,13 @@ struct _backlight_ops {
 
 struct _backlight_ops *get_var_backlight_ops(void);
 
+struct _display_white_balance_ops {
+       int (*set_white_balance)(enum hal_display_white_balance white_balance_type, int value);
+       int (*get_white_balance)(enum hal_display_white_balance white_balance_type, int* out_val);
+};
+
+struct _display_white_balance_ops *get_var_display_white_balance_ops(void);
+
 enum dpms_state {
        DPMS_ON,       /* In use */
        DPMS_STANDBY,  /* Blanked, low power */
index 9b73ba9..197260a 100644 (file)
@@ -71,6 +71,7 @@
 
 static struct display_plugin *disp_plgn;
 static struct _backlight_ops *backlight_ops;
+static struct _display_white_balance_ops *display_white_balance_ops;
 static struct display_config *display_conf;
 
 static GVariant *dbus_start(GDBusConnection *conn,
@@ -1198,6 +1199,52 @@ static GVariant *dbus_getbrightnessinfo(GDBusConnection *conn,
        return g_variant_new("(ii)", default_brightness, current_brightness);
 }
 
+static GVariant *dbus_setwhitebalance(GDBusConnection *conn,
+       const gchar *sender, const gchar *path, const gchar *iface, const gchar *name,
+       GVariant *param, GDBusMethodInvocation *invocation, gpointer user_data)
+{
+       int white_balance_type, value;
+       int ret = 0, ret_val;
+       pid_t pid;
+
+       g_variant_get(param, "(ii)", &white_balance_type, &value);
+
+       ret_val = display_white_balance_ops->set_white_balance(white_balance_type, value);
+       if (ret_val < 0) {
+               _E("Failed to set white balance");
+               ret = -EPERM;
+       }
+
+       pid = gdbus_connection_get_sender_pid(conn, sender);
+       _I("Set white balance pid=%d white balance type=%d value=%d", pid, white_balance_type, value);
+
+       return g_variant_new("(i)", ret);
+}
+
+static GVariant *dbus_getwhitebalance(GDBusConnection *conn,
+       const gchar *sender, const gchar *path, const gchar *iface, const gchar *name,
+       GVariant *param, GDBusMethodInvocation *invocation, gpointer user_data)
+{
+       int white_balance_type;
+       int ret = 0, ret_val;
+       pid_t pid;
+
+       g_variant_get(param, "(i)", &white_balance_type);
+
+       ret = display_white_balance_ops->get_white_balance(white_balance_type, &ret_val);
+       if (ret < 0) {
+               _E("Failed to get white balance");
+               ret = -EPERM;
+       }
+       else
+               ret = ret_val;
+
+       pid = gdbus_connection_get_sender_pid(conn, sender);
+       _I("Get white balance pid=%d white balance type=%d", pid, white_balance_type);
+
+       return g_variant_new("(i)", ret);
+}
+
 static const dbus_method_s dbus_methods[] = {
        { "start",           NULL,  NULL, dbus_start },
        { "stop",            NULL,  NULL, dbus_stop },
@@ -1235,6 +1282,8 @@ static const dbus_method_s dbus_methods[] = {
        { "LockTimeoutInput",  "si", "i", dbus_locktimeout_input },
        { "DimStayControl",        "i",  "i", dbus_dimstay_control },
        { "GetBrightnessInfo", NULL, "ii", dbus_getbrightnessinfo},
+       { "SetWhiteBalance", "ii", "i", dbus_setwhitebalance},
+       { "GetWhiteBalance", "i", "i", dbus_getwhitebalance},
        /* Add methods here */
 };
 
@@ -1363,6 +1412,10 @@ static void __CONSTRUCTOR__ initialize(void)
        if (!backlight_ops)
                _E("Failed to get backlight operator variable.");
 
+       display_white_balance_ops = get_var_display_white_balance_ops();
+       if (!display_white_balance_ops)
+               _E("Failed to get display white balance operator variable.");
+
        display_conf = get_var_display_config();
        if (!display_conf)
                _E("Failed to get display configuration variable.");