Commit 08bf73a6 authored by Linus Walleij's avatar Linus Walleij Committed by Lee Jones

backlight: sky81452: Privatize platform data

The only way the platform data for the SKY81452 ever gets populated
is through the device tree.

The MFD device is bothered with this for no reason at all. Just
allocate the platform data in the driver and be happy.

Cc: Gyungoh Yoo <jack.yoo@skyworksinc.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Reviewed-by: default avatarDaniel Thompson <daniel.thompson@linaro.org>
Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
parent e1915eec
...@@ -47,8 +47,6 @@ static int sky81452_probe(struct i2c_client *client, ...@@ -47,8 +47,6 @@ static int sky81452_probe(struct i2c_client *client,
memset(cells, 0, sizeof(cells)); memset(cells, 0, sizeof(cells));
cells[0].name = "sky81452-backlight"; cells[0].name = "sky81452-backlight";
cells[0].of_compatible = "skyworks,sky81452-backlight"; cells[0].of_compatible = "skyworks,sky81452-backlight";
cells[0].platform_data = pdata->bl_pdata;
cells[0].pdata_size = sizeof(*pdata->bl_pdata);
cells[1].name = "sky81452-regulator"; cells[1].name = "sky81452-regulator";
cells[1].platform_data = pdata->regulator_init_data; cells[1].platform_data = pdata->regulator_init_data;
cells[1].pdata_size = sizeof(*pdata->regulator_init_data); cells[1].pdata_size = sizeof(*pdata->regulator_init_data);
......
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
#include <linux/of.h> #include <linux/of.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/regmap.h> #include <linux/regmap.h>
#include <linux/platform_data/sky81452-backlight.h>
#include <linux/slab.h> #include <linux/slab.h>
/* registers */ /* registers */
...@@ -41,6 +40,29 @@ ...@@ -41,6 +40,29 @@
#define SKY81452_DEFAULT_NAME "lcd-backlight" #define SKY81452_DEFAULT_NAME "lcd-backlight"
#define SKY81452_MAX_BRIGHTNESS (SKY81452_CS + 1) #define SKY81452_MAX_BRIGHTNESS (SKY81452_CS + 1)
/**
* struct sky81452_platform_data
* @name: backlight driver name.
If it is not defined, default name is lcd-backlight.
* @gpios_enable:GPIO descriptor which control EN pin
* @enable: Enable mask for current sink channel 1, 2, 3, 4, 5 and 6.
* @ignore_pwm: true if DPWMI should be ignored.
* @dpwm_mode: true is DPWM dimming mode, otherwise Analog dimming mode.
* @phase_shift:true is phase shift mode.
* @short_detecion_threshold: It should be one of 4, 5, 6 and 7V.
* @boost_current_limit: It should be one of 2300, 2750mA.
*/
struct sky81452_bl_platform_data {
const char *name;
struct gpio_desc *gpiod_enable;
unsigned int enable;
bool ignore_pwm;
bool dpwm_mode;
bool phase_shift;
unsigned int short_detection_threshold;
unsigned int boost_current_limit;
};
#define CTZ(b) __builtin_ctz(b) #define CTZ(b) __builtin_ctz(b)
static int sky81452_bl_update_status(struct backlight_device *bd) static int sky81452_bl_update_status(struct backlight_device *bd)
...@@ -251,17 +273,15 @@ static int sky81452_bl_probe(struct platform_device *pdev) ...@@ -251,17 +273,15 @@ static int sky81452_bl_probe(struct platform_device *pdev)
{ {
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct regmap *regmap = dev_get_drvdata(dev->parent); struct regmap *regmap = dev_get_drvdata(dev->parent);
struct sky81452_bl_platform_data *pdata = dev_get_platdata(dev); struct sky81452_bl_platform_data *pdata;
struct backlight_device *bd; struct backlight_device *bd;
struct backlight_properties props; struct backlight_properties props;
const char *name; const char *name;
int ret; int ret;
if (!pdata) {
pdata = sky81452_bl_parse_dt(dev); pdata = sky81452_bl_parse_dt(dev);
if (IS_ERR(pdata)) if (IS_ERR(pdata))
return PTR_ERR(pdata); return PTR_ERR(pdata);
}
ret = sky81452_bl_init_device(regmap, pdata); ret = sky81452_bl_init_device(regmap, pdata);
if (ret < 0) { if (ret < 0) {
......
...@@ -9,11 +9,9 @@ ...@@ -9,11 +9,9 @@
#ifndef _SKY81452_H #ifndef _SKY81452_H
#define _SKY81452_H #define _SKY81452_H
#include <linux/platform_data/sky81452-backlight.h>
#include <linux/regulator/machine.h> #include <linux/regulator/machine.h>
struct sky81452_platform_data { struct sky81452_platform_data {
struct sky81452_bl_platform_data *bl_pdata;
struct regulator_init_data *regulator_init_data; struct regulator_init_data *regulator_init_data;
}; };
......
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* sky81452.h SKY81452 backlight driver
*
* Copyright 2014 Skyworks Solutions Inc.
* Author : Gyungoh Yoo <jack.yoo@skyworksinc.com>
*/
#ifndef _SKY81452_BACKLIGHT_H
#define _SKY81452_BACKLIGHT_H
#include <linux/gpio/consumer.h>
/**
* struct sky81452_platform_data
* @name: backlight driver name.
If it is not defined, default name is lcd-backlight.
* @gpios_enable:GPIO descriptor which control EN pin
* @enable: Enable mask for current sink channel 1, 2, 3, 4, 5 and 6.
* @ignore_pwm: true if DPWMI should be ignored.
* @dpwm_mode: true is DPWM dimming mode, otherwise Analog dimming mode.
* @phase_shift:true is phase shift mode.
* @short_detecion_threshold: It should be one of 4, 5, 6 and 7V.
* @boost_current_limit: It should be one of 2300, 2750mA.
*/
struct sky81452_bl_platform_data {
const char *name;
struct gpio_desc *gpiod_enable;
unsigned int enable;
bool ignore_pwm;
bool dpwm_mode;
bool phase_shift;
unsigned int short_detection_threshold;
unsigned int boost_current_limit;
};
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment