summaryrefslogtreecommitdiff
path: root/drivers/video
diff options
context:
space:
mode:
authorDominik Sliwa <dominik.sliwa@toradex.com>2018-03-27 15:41:54 +0200
committerMarcel Ziswiler <marcel.ziswiler@toradex.com>2018-03-28 18:39:30 +0200
commit32d0ca371882a85f439ada0e7f2846ed4b462ab8 (patch)
tree623ee694104d11ff192087ffa3421a019eeac42a /drivers/video
parent2d9eb8a926dadffb42b2bb0e369c71ba87405ced (diff)
Revert "video: backlight: EDP client for backlight"
This reverts commit 74df06fb565b7250bc86d79727b66bb02259d54c.
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/backlight/pwm_bl.c131
1 files changed, 11 insertions, 120 deletions
diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
index e4c6d2772717..f7be6f224d69 100644
--- a/drivers/video/backlight/pwm_bl.c
+++ b/drivers/video/backlight/pwm_bl.c
@@ -1,17 +1,6 @@
/*
* linux/drivers/video/backlight/pwm_bl.c
*
- * Copyright (c) 2013, NVIDIA CORPORATION, All rights reserved.
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
* simple PWM based backlight control, board code has to setup
* 1) pin configuration so PWM waveforms can output
* 2) platform_data being correctly configured
@@ -32,7 +21,6 @@
#include <linux/pwm.h>
#include <linux/pwm_backlight.h>
#include <linux/slab.h>
-#include <linux/edp.h>
struct pwm_bl_data {
struct pwm_device *pwm;
@@ -47,13 +35,12 @@ struct pwm_bl_data {
int brightness);
int (*check_fb)(struct device *, struct fb_info *);
void (*exit)(struct device *);
- struct edp_client *pwm_bl_edp_client;
- int *edp_brightness_states;
};
-static int pwm_backlight_set(struct backlight_device *bl, int brightness)
+static int pwm_backlight_update_status(struct backlight_device *bl)
{
struct pwm_bl_data *pb = bl_get_data(bl);
+ int brightness = bl->props.brightness;
int max = bl->props.max_brightness;
if (bl->props.power != FB_BLANK_UNBLANK ||
@@ -89,47 +76,6 @@ static int pwm_backlight_set(struct backlight_device *bl, int brightness)
return 0;
}
-static int pwm_backlight_set_with_edp(struct backlight_device *bl,
- int brightness)
-{
- struct pwm_bl_data *data = bl_get_data(bl);
- unsigned int approved;
- int ret;
- unsigned int edp_state;
- unsigned int i;
- if (data->pwm_bl_edp_client) {
- for (i = 0; i < PWM_BL_EDP_NUM_STATES; i++) {
- if (brightness >= data->edp_brightness_states[i])
- break;
- }
- edp_state = i;
- ret = edp_update_client_request(data->pwm_bl_edp_client,
- edp_state, &approved);
- if (ret) {
- dev_err(data->dev, "E state transition failed\n");
- return ret;
- }
- pwm_backlight_set(bl, data->edp_brightness_states[approved]);
- } else {
- pwm_backlight_set(bl, brightness);
- }
- return 0;
-}
-
-static int pwm_backlight_update_status(struct backlight_device *bl)
-{
- int brightness = bl->props.brightness;
- return pwm_backlight_set_with_edp(bl, brightness);
-}
-
-static void pwm_backlight_edpcb(unsigned int new_state, void *priv_data)
-{
- struct backlight_device *bl_device =
- (struct backlight_device *) priv_data;
- struct pwm_bl_data *data = bl_get_data(bl_device);
- pwm_backlight_set(bl_device, data->edp_brightness_states[new_state]);
-}
-
static int pwm_backlight_get_brightness(struct backlight_device *bl)
{
return bl->props.brightness;
@@ -190,12 +136,6 @@ static int pwm_backlight_parse_dt(struct device *dev,
if (ret < 0)
return ret;
- if (value >= data->max_brightness) {
- dev_warn(dev, "invalid default brightness level: %u, using %u\n",
- value, data->max_brightness - 1);
- value = data->max_brightness - 1;
- }
-
data->dft_brightness = value;
data->max_brightness--;
}
@@ -230,7 +170,6 @@ static int pwm_backlight_probe(struct platform_device *pdev)
struct backlight_properties props;
struct backlight_device *bl;
struct pwm_bl_data *pb;
- struct edp_manager *battery_manager = NULL;
unsigned int max;
int ret;
@@ -269,7 +208,6 @@ static int pwm_backlight_probe(struct platform_device *pdev)
pb->exit = data->exit;
pb->dev = &pdev->dev;
pb->pwm_gpio = data->pwm_gpio;
- pb->edp_brightness_states = data->edp_brightness;
pb->pwm = devm_pwm_get(&pdev->dev, NULL);
if (IS_ERR(pb->pwm)) {
@@ -314,57 +252,6 @@ static int pwm_backlight_probe(struct platform_device *pdev)
goto err_alloc;
}
- if (pb->edp_brightness_states) {
- pb->pwm_bl_edp_client = devm_kzalloc(&pdev->dev,
- sizeof(struct edp_client), GFP_KERNEL);
- if (IS_ERR_OR_NULL(pb->pwm_bl_edp_client)) {
- dev_err(&pdev->dev, "could not allocate edp client\n");
- return PTR_ERR(pb->pwm_bl_edp_client);
- }
-
- strncpy(pb->pwm_bl_edp_client->name,
- "backlight", EDP_NAME_LEN - 1);
- pb->pwm_bl_edp_client->name[EDP_NAME_LEN - 1] = '\0';
- pb->pwm_bl_edp_client->states = data->edp_states;
- pb->pwm_bl_edp_client->num_states = PWM_BL_EDP_NUM_STATES;
- pb->pwm_bl_edp_client->e0_index = PWM_BL_EDP_ZERO;
- pb->pwm_bl_edp_client->private_data = bl;
- pb->pwm_bl_edp_client->priority = EDP_MAX_PRIO + 2;
- pb->pwm_bl_edp_client->throttle = pwm_backlight_edpcb;
- pb->pwm_bl_edp_client->notify_promotion = pwm_backlight_edpcb;
-
- battery_manager = edp_get_manager("battery");
- if (!battery_manager) {
- dev_err(&pdev->dev, "unable to get edp manager\n");
- goto err_edp_init;
- } else {
- ret = edp_register_client(battery_manager,
- pb->pwm_bl_edp_client);
- if (ret) {
- dev_err(&pdev->dev, "unable to register edp client\n");
- goto err_edp_init;
- } else {
- ret = edp_update_client_request(
- pb->pwm_bl_edp_client,
- PWM_BL_EDP_ZERO, NULL);
- if (ret) {
- dev_err(&pdev->dev,
- "unable to set E0 EDP state\n");
- edp_unregister_client(
- pb->pwm_bl_edp_client);
- goto err_edp_init;
- }
- goto success_edp_init;
- }
- }
-err_edp_init:
- devm_kfree(&pdev->dev, pb->pwm_bl_edp_client);
- pb->pwm_bl_edp_client = NULL;
-success_edp_init:;
- } else {
- dev_info(&pdev->dev, "edp manager not supported\n");
- }
-
if (data->dft_brightness > data->max_brightness) {
dev_warn(&pdev->dev,
"invalid default brightness level: %u, using %u\n",
@@ -404,8 +291,15 @@ static int pwm_backlight_remove(struct platform_device *pdev)
static int pwm_backlight_suspend(struct device *dev)
{
struct backlight_device *bl = dev_get_drvdata(dev);
+ struct pwm_bl_data *pb = bl_get_data(bl);
- return pwm_backlight_set_with_edp(bl, 0);
+ if (pb->notify)
+ pb->notify(pb->dev, 0);
+ pwm_config(pb->pwm, 0, pb->period);
+ pwm_disable(pb->pwm);
+ if (pb->notify_after)
+ pb->notify_after(pb->dev, 0);
+ return 0;
}
static int pwm_backlight_resume(struct device *dev)
@@ -415,19 +309,16 @@ static int pwm_backlight_resume(struct device *dev)
backlight_update_status(bl);
return 0;
}
+#endif
static SIMPLE_DEV_PM_OPS(pwm_backlight_pm_ops, pwm_backlight_suspend,
pwm_backlight_resume);
-#endif
-
static struct platform_driver pwm_backlight_driver = {
.driver = {
.name = "pwm-backlight",
.owner = THIS_MODULE,
-#ifdef CONFIG_PM_SLEEP
.pm = &pwm_backlight_pm_ops,
-#endif
.of_match_table = of_match_ptr(pwm_backlight_of_match),
},
.probe = pwm_backlight_probe,