summaryrefslogtreecommitdiff
path: root/drivers/video
diff options
context:
space:
mode:
authorTimo Alho <talho@nvidia.com>2013-12-31 10:50:30 +0200
committerJuha Tukkinen <jtukkinen@nvidia.com>2014-01-16 11:57:40 -0800
commitf67cd21a4509ff9dca7e7ad2ac0f90bfec82351e (patch)
treec4d0ba7c39f9498b2b0fd08e16236c8e3289da3c /drivers/video
parent97834f21cb6e2ffb0ed065cbca564c0706270b0c (diff)
EDP: remove old system EDP framework (max8831 backlight driver)
Revised system edp software framework has been put in place. This patch removes old system edp client code from max8831 backlight driver. Bug 1431977 Change-Id: I4d107f7d26759c009a28e4b6617bd8126950a022 Signed-off-by: Timo Alho <talho@nvidia.com> Reviewed-on: http://git-master/r/350985 Reviewed-by: Vineel Kumar Reddy Kovvuri <vineelkumarr@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Juha Tukkinen <jtukkinen@nvidia.com>
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/backlight/max8831_bl.c105
1 files changed, 2 insertions, 103 deletions
diff --git a/drivers/video/backlight/max8831_bl.c b/drivers/video/backlight/max8831_bl.c
index b2fe55441827..f5c280975a3c 100644
--- a/drivers/video/backlight/max8831_bl.c
+++ b/drivers/video/backlight/max8831_bl.c
@@ -29,7 +29,6 @@
#include <linux/mfd/max8831.h>
#include <linux/max8831_backlight.h>
#include <linux/regulator/consumer.h>
-#include <linux/edp.h>
#include <linux/platform_device.h>
struct max8831_backlight_data {
@@ -40,8 +39,6 @@ struct max8831_backlight_data {
int (*notify)(struct device *dev, int brightness);
bool (*is_powered)(void);
- struct edp_client *max8831_edp_client;
- int *edp_brightness_states;
};
static int max8831_backlight_set(struct backlight_device *bl, int brightness)
@@ -77,47 +74,6 @@ static int max8831_backlight_set(struct backlight_device *bl, int brightness)
return 0;
}
-static int max8831_backlight_set_with_edp(struct backlight_device *bl,
- int brightness)
-{
- struct max8831_backlight_data *data = bl_get_data(bl);
- struct device *dev = data->max8831_dev;
- unsigned int approved_state;
- int unsigned approved_brightness;
- int ret;
- unsigned int edp_state;
- unsigned int edp_brightness;
- unsigned int i;
-
- if (data->max8831_edp_client) {
- for (i = 0; i < MAX8831_EDP_NUM_STATES; i++) {
- edp_brightness = data->edp_brightness_states[i];
- if (brightness > edp_brightness) {
- /* Choose the next higher EDP state */
- if (i)
- i--;
- break;
- } else if (brightness == edp_brightness)
- break;
- }
- edp_state = i;
- ret = edp_update_client_request(data->max8831_edp_client,
- edp_state, &approved_state);
- if (ret) {
- dev_err(dev, "E state transition failed\n");
- return ret;
- }
-
- approved_brightness =
- data->edp_brightness_states[approved_state];
- if (brightness > approved_brightness)
- brightness = approved_brightness;
- }
-
- max8831_backlight_set(bl, brightness);
- return 0;
-}
-
static int max8831_backlight_update_status(struct backlight_device *bl)
{
struct max8831_backlight_data *data = bl_get_data(bl);
@@ -134,15 +90,7 @@ static int max8831_backlight_update_status(struct backlight_device *bl)
if (data->notify)
brightness = data->notify(data->max8831_dev, brightness);
- return max8831_backlight_set_with_edp(bl, brightness);
-}
-
-static void max8831_backlight_edpcb(unsigned int new_state, void *priv_data)
-{
- struct backlight_device *bl_device = (struct backlight_device *) priv_data;
- struct max8831_backlight_data *data = bl_get_data(bl_device);
- max8831_backlight_set(bl_device,
- data->edp_brightness_states[new_state]);
+ return max8831_backlight_set(bl, brightness);
}
static int max8831_backlight_get_brightness(struct backlight_device *bl)
@@ -162,9 +110,6 @@ static int max8831_bl_probe(struct platform_device *pdev)
struct backlight_device *bl;
struct backlight_properties props;
struct platform_max8831_backlight_data *pData = pdev->dev.platform_data;
- struct edp_manager *battery_manager = NULL;
- int ret;
-
data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
if (data == NULL)
@@ -175,7 +120,6 @@ static int max8831_bl_probe(struct platform_device *pdev)
data->id = pdev->id;
data->notify = pData->notify;
data->is_powered = pData->is_powered;
- data->edp_brightness_states = pData->edp_brightness;
data->regulator = regulator_get(data->max8831_dev,
"vin");
if (IS_ERR(data->regulator)) {
@@ -195,50 +139,6 @@ static int max8831_bl_probe(struct platform_device *pdev)
return PTR_ERR(bl);
}
- data->max8831_edp_client = devm_kzalloc(&pdev->dev,
- sizeof(struct edp_client), GFP_KERNEL);
- if (IS_ERR_OR_NULL(data->max8831_edp_client)) {
- dev_err(&pdev->dev, "could not allocate edp client\n");
- return PTR_ERR(data->max8831_edp_client);
- }
-
- strncpy(data->max8831_edp_client->name, "backlight", EDP_NAME_LEN - 1);
- data->max8831_edp_client->name[EDP_NAME_LEN - 1] = '\0';
- data->max8831_edp_client->states = pData->edp_states;
- data->max8831_edp_client->num_states = MAX8831_EDP_NUM_STATES;
- data->max8831_edp_client->e0_index = MAX8831_EDP_ZERO;
- data->max8831_edp_client->private_data = bl;
- data->max8831_edp_client->priority = EDP_MAX_PRIO + 2;
- data->max8831_edp_client->throttle = max8831_backlight_edpcb;
- data->max8831_edp_client->notify_promotion = max8831_backlight_edpcb;
-
- battery_manager = edp_get_manager("battery");
- if (!battery_manager) {
- dev_err(&pdev->dev, "unable to get edp manager\n");
- } else {
- ret = edp_register_client(battery_manager,
- data->max8831_edp_client);
- if (ret) {
- dev_err(&pdev->dev, "unable to register edp client\n");
- } else {
- ret = edp_update_client_request(
- data->max8831_edp_client,
- MAX8831_EDP_ZERO, NULL);
- if (ret) {
- dev_err(&pdev->dev,
- "unable to set E0 EDP state\n");
- edp_unregister_client(data->max8831_edp_client);
- } else {
- goto edp_success;
- }
- }
- }
-
- devm_kfree(&pdev->dev, data->max8831_edp_client);
- data->max8831_edp_client = NULL;
-
-edp_success:
-
bl->props.brightness = pData->dft_brightness;
platform_set_drvdata(pdev, bl);
@@ -267,11 +167,10 @@ static int max8831_bl_suspend(struct device *dev)
struct max8831_backlight_data *data = bl_get_data(bl);
int ret;
- ret = max8831_backlight_set_with_edp(bl, 0);
+ ret = max8831_backlight_set(bl, 0);
if (data->regulator)
regulator_disable(data->regulator);
return ret;
-
}
static int max8831_bl_resume(struct device *dev)