Linux Framebuffer Layer development
 help / color / mirror / Atom feed
* Re: [PATCH v2 4/4] backlight/lp855x: Remove CONFIG_OF ifdef in favor of Kconfig depends
From: Jingoo Han @ 2014-12-09  1:36 UTC (permalink / raw)
  To: linux-fbdev
In-Reply-To: <1418077278-14144-4-git-send-email-seanpaul@chromium.org>

On Tuesday, December 09, 2014 7:21 AM, Sean Paul wrote:
> 
> Now that we've removed all traces of pdata, remove the CONFIG_OF ifdef
> from lp855x and instead make the driver depend on OF.
> 
> Signed-off-by: Sean Paul <seanpaul@chromium.org>

Acked-by: Jingoo Han <jg1.han@samsung.com>

Best regards,
Jingoo Han

> ---
> Changes in v2:
> 	- Remove of_match_ptr() wrapper
> 
>  drivers/video/backlight/Kconfig     | 2 +-
>  drivers/video/backlight/lp855x_bl.c | 9 +--------
>  2 files changed, 2 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
> index 8d03924..113c8b3 100644
> --- a/drivers/video/backlight/Kconfig
> +++ b/drivers/video/backlight/Kconfig
> @@ -384,7 +384,7 @@ config BACKLIGHT_LM3639
> 
>  config BACKLIGHT_LP855X
>  	tristate "Backlight driver for TI LP855X"
> -	depends on BACKLIGHT_CLASS_DEVICE && I2C && PWM
> +	depends on BACKLIGHT_CLASS_DEVICE && I2C && PWM && OF
>  	help
>  	  This supports TI LP8550, LP8551, LP8552, LP8553, LP8555, LP8556 and
>  	  LP8557 backlight driver.
> diff --git a/drivers/video/backlight/lp855x_bl.c b/drivers/video/backlight/lp855x_bl.c
> index 6530d60..f0a85f5 100644
> --- a/drivers/video/backlight/lp855x_bl.c
> +++ b/drivers/video/backlight/lp855x_bl.c
> @@ -379,7 +379,6 @@ static const struct attribute_group lp855x_attr_group = {
>  	.attrs = lp855x_attributes,
>  };
> 
> -#ifdef CONFIG_OF
>  static int lp855x_parse_dt(struct lp855x *lp)
>  {
>  	struct device *dev = lp->dev;
> @@ -426,12 +425,6 @@ static int lp855x_parse_dt(struct lp855x *lp)
> 
>  	return 0;
>  }
> -#else
> -static int lp855x_parse_dt(struct lp855x *lp)
> -{
> -	return -EINVAL;
> -}
> -#endif
> 
>  static int lp855x_probe(struct i2c_client *cl, const struct i2c_device_id *id)
>  {
> @@ -532,7 +525,7 @@ MODULE_DEVICE_TABLE(i2c, lp855x_ids);
>  static struct i2c_driver lp855x_driver = {
>  	.driver = {
>  		   .name = "lp855x",
> -		   .of_match_table = of_match_ptr(lp855x_dt_ids),
> +		   .of_match_table = lp855x_dt_ids,
>  		   },
>  	.probe = lp855x_probe,
>  	.remove = lp855x_remove,
> --
> 2.1.1


^ permalink raw reply

* Re: [PATCH v2 3/4] backlight/lp855x: Merge lp855x_platform_data with lp855x
From: Jingoo Han @ 2014-12-09  1:35 UTC (permalink / raw)
  To: linux-fbdev
In-Reply-To: <1418077278-14144-3-git-send-email-seanpaul@chromium.org>

On Tuesday, December 09, 2014 7:21 AM, Sean Paul wrote:
> 
> Now that we have removed the platform_data header, merge lp855x_platform_data
> with lp855x and remove all traces of platform_data from the driver.
> 
> Signed-off-by: Sean Paul <seanpaul@chromium.org>

Acked-by: Jingoo Han <jg1.han@samsung.com>

Best regards,
Jingoo Han

> ---
> Changes in v2:
> 	- Assign NULL to lp->supply if devm_regulator_get fails
> 
>  drivers/video/backlight/lp855x_bl.c | 101 +++++++++++++++++-------------------
>  1 file changed, 47 insertions(+), 54 deletions(-)
> 
> diff --git a/drivers/video/backlight/lp855x_bl.c b/drivers/video/backlight/lp855x_bl.c
> index d19b61c..6530d60 100644
> --- a/drivers/video/backlight/lp855x_bl.c
> +++ b/drivers/video/backlight/lp855x_bl.c
> @@ -78,8 +78,16 @@ struct lp855x_rom_data {
>  };
> 
>  /**
> - * struct lp855x_platform_data
> - * @name : Backlight driver name. If it is not defined, default name is set.
> + * struct lp855x
> + * @chipname : Chip name, comes from the i2c_device_id
> + * @blname : Backlight driver name. If it is not defined, default name is set.
> + * @chip_id : The type of lp855x
> + * @mode : Whether brightness is controlled via pwm or register
> + * @cfg : Chip specific hooks & register offsets
> + * @client : The i2c client
> + * @bl : The backlight device
> + * @dev : Device pointer
> + * @pwm : The pwm device (if available)
>   * @device_control : value of DEVICE CONTROL register
>   * @initial_brightness : initial value of backlight brightness
>   * @period_ns : platform specific pwm period value. unit is nano.
> @@ -88,26 +96,23 @@ struct lp855x_rom_data {
>   * @rom_data : list of new eeprom/eprom registers
>   * @supply : regulator that supplies 3V input
>   */
> -struct lp855x_platform_data {
> -	const char *name;
> -	u8 device_control;
> -	u8 initial_brightness;
> -	unsigned int period_ns;
> -	int size_program;
> -	struct lp855x_rom_data *rom_data;
> -	struct regulator *supply;
> -};
> -
>  struct lp855x {
>  	const char *chipname;
> +	const char *blname;
>  	enum lp855x_chip_id chip_id;
>  	enum lp855x_brightness_ctrl_mode mode;
>  	struct lp855x_device_config *cfg;
>  	struct i2c_client *client;
>  	struct backlight_device *bl;
>  	struct device *dev;
> -	struct lp855x_platform_data *pdata;
>  	struct pwm_device *pwm;
> +
> +	u8 device_control;
> +	u8 initial_brightness;
> +	unsigned int period_ns;
> +	int size_program;
> +	struct lp855x_rom_data *rom_data;
> +	struct regulator *supply;
>  };
> 
>  static int lp855x_write_byte(struct lp855x *lp, u8 reg, u8 data)
> @@ -204,7 +209,6 @@ static int lp855x_configure(struct lp855x *lp)
>  {
>  	u8 val, addr;
>  	int i, ret;
> -	struct lp855x_platform_data *pd = lp->pdata;
> 
>  	switch (lp->chip_id) {
>  	case LP8550:
> @@ -230,20 +234,20 @@ static int lp855x_configure(struct lp855x *lp)
>  		}
>  	}
> 
> -	val = pd->initial_brightness;
> +	val = lp->initial_brightness;
>  	ret = lp855x_write_byte(lp, lp->cfg->reg_brightness, val);
>  	if (ret)
>  		goto err;
> 
> -	val = pd->device_control;
> +	val = lp->device_control;
>  	ret = lp855x_write_byte(lp, lp->cfg->reg_devicectrl, val);
>  	if (ret)
>  		goto err;
> 
> -	if (pd->size_program > 0) {
> -		for (i = 0; i < pd->size_program; i++) {
> -			addr = pd->rom_data[i].addr;
> -			val = pd->rom_data[i].val;
> +	if (lp->size_program > 0) {
> +		for (i = 0; i < lp->size_program; i++) {
> +			addr = lp->rom_data[i].addr;
> +			val = lp->rom_data[i].val;
>  			if (!lp855x_is_valid_rom_area(lp, addr))
>  				continue;
> 
> @@ -269,7 +273,7 @@ err:
> 
>  static void lp855x_pwm_ctrl(struct lp855x *lp, int br, int max_br)
>  {
> -	unsigned int period = lp->pdata->period_ns;
> +	unsigned int period = lp->period_ns;
>  	unsigned int duty = br * period / max_br;
>  	struct pwm_device *pwm;
> 
> @@ -320,16 +324,15 @@ static int lp855x_backlight_register(struct lp855x *lp)
>  {
>  	struct backlight_device *bl;
>  	struct backlight_properties props;
> -	struct lp855x_platform_data *pdata = lp->pdata;
> -	const char *name = pdata->name ? : DEFAULT_BL_NAME;
> +	const char *name = lp->blname ? : DEFAULT_BL_NAME;
> 
>  	props.type = BACKLIGHT_PLATFORM;
>  	props.max_brightness = MAX_BRIGHTNESS;
> 
> -	if (pdata->initial_brightness > props.max_brightness)
> -		pdata->initial_brightness = props.max_brightness;
> +	if (lp->initial_brightness > props.max_brightness)
> +		lp->initial_brightness = props.max_brightness;
> 
> -	props.brightness = pdata->initial_brightness;
> +	props.brightness = lp->initial_brightness;
> 
>  	bl = devm_backlight_device_register(lp->dev, name, lp->dev, lp,
>  				       &lp855x_bl_ops, &props);
> @@ -381,7 +384,6 @@ static int lp855x_parse_dt(struct lp855x *lp)
>  {
>  	struct device *dev = lp->dev;
>  	struct device_node *node = dev->of_node;
> -	struct lp855x_platform_data *pdata;
>  	int rom_length;
> 
>  	if (!node) {
> @@ -389,14 +391,10 @@ static int lp855x_parse_dt(struct lp855x *lp)
>  		return -EINVAL;
>  	}
> 
> -	pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
> -	if (!pdata)
> -		return -ENOMEM;
> -
> -	of_property_read_string(node, "bl-name", &pdata->name);
> -	of_property_read_u8(node, "dev-ctrl", &pdata->device_control);
> -	of_property_read_u8(node, "init-brt", &pdata->initial_brightness);
> -	of_property_read_u32(node, "pwm-period", &pdata->period_ns);
> +	of_property_read_string(node, "bl-name", &lp->blname);
> +	of_property_read_u8(node, "dev-ctrl", &lp->device_control);
> +	of_property_read_u8(node, "init-brt", &lp->initial_brightness);
> +	of_property_read_u32(node, "pwm-period", &lp->period_ns);
> 
>  	/* Fill ROM platform data if defined */
>  	rom_length = of_get_child_count(node);
> @@ -415,19 +413,17 @@ static int lp855x_parse_dt(struct lp855x *lp)
>  			i++;
>  		}
> 
> -		pdata->size_program = rom_length;
> -		pdata->rom_data = &rom[0];
> +		lp->size_program = rom_length;
> +		lp->rom_data = &rom[0];
>  	}
> 
> -	pdata->supply = devm_regulator_get(dev, "power");
> -	if (IS_ERR(pdata->supply)) {
> -		if (PTR_ERR(pdata->supply) = -EPROBE_DEFER)
> +	lp->supply = devm_regulator_get(dev, "power");
> +	if (IS_ERR(lp->supply)) {
> +		if (PTR_ERR(lp->supply) = -EPROBE_DEFER)
>  			return -EPROBE_DEFER;
> -		pdata->supply = NULL;
> +		lp->supply = NULL;
>  	}
> 
> -	lp->pdata = pdata;
> -
>  	return 0;
>  }
>  #else
> @@ -453,21 +449,18 @@ static int lp855x_probe(struct i2c_client *cl, const struct i2c_device_id *id)
>  	lp->dev = &cl->dev;
>  	lp->chipname = id->name;
>  	lp->chip_id = id->driver_data;
> -	lp->pdata = dev_get_platdata(&cl->dev);
> 
> -	if (!lp->pdata) {
> -		ret = lp855x_parse_dt(lp);
> -		if (ret < 0)
> -			return ret;
> -	}
> +	ret = lp855x_parse_dt(lp);
> +	if (ret < 0)
> +		return ret;
> 
> -	if (lp->pdata->period_ns > 0)
> +	if (lp->period_ns > 0)
>  		lp->mode = PWM_BASED;
>  	else
>  		lp->mode = REGISTER_BASED;
> 
> -	if (lp->pdata->supply) {
> -		ret = regulator_enable(lp->pdata->supply);
> +	if (lp->supply) {
> +		ret = regulator_enable(lp->supply);
>  		if (ret < 0) {
>  			dev_err(&cl->dev, "failed to enable supply: %d\n", ret);
>  			return ret;
> @@ -505,8 +498,8 @@ static int lp855x_remove(struct i2c_client *cl)
> 
>  	lp->bl->props.brightness = 0;
>  	backlight_update_status(lp->bl);
> -	if (lp->pdata->supply)
> -		regulator_disable(lp->pdata->supply);
> +	if (lp->supply)
> +		regulator_disable(lp->supply);
>  	sysfs_remove_group(&lp->dev->kobj, &lp855x_attr_group);
> 
>  	return 0;
> --
> 2.1.1


^ permalink raw reply

* Re: [PATCH v2 2/4] backlight/lp855x: Remove platform_data header
From: Jingoo Han @ 2014-12-09  1:26 UTC (permalink / raw)
  To: linux-fbdev
In-Reply-To: <1418077278-14144-2-git-send-email-seanpaul@chromium.org>

On Tuesday, December 09, 2014 7:21 AM, Sean Paul wrote:
> 
> No one uses lp855x platform data any longer, remove the header
> and move its contents into the driver.
> 
> Signed-off-by: Sean Paul <seanpaul@chromium.org>

Acked-by: Jingoo Han <jg1.han@samsung.com>

Best regards,
Jingoo Han

> ---
> Changes in v2:
> 	- Removed platform data description from Documentation
> 
>  Documentation/backlight/lp855x-driver.txt | 38 -----------------------
>  MAINTAINERS                               |  1 -
>  drivers/video/backlight/lp855x_bl.c       | 37 +++++++++++++++++++++-
>  include/linux/platform_data/lp855x.h      | 51 -------------------------------
>  4 files changed, 36 insertions(+), 91 deletions(-)
>  delete mode 100644 include/linux/platform_data/lp855x.h
> 
> diff --git a/Documentation/backlight/lp855x-driver.txt b/Documentation/backlight/lp855x-driver.txt
> index 01bce24..33b83d9 100644
> --- a/Documentation/backlight/lp855x-driver.txt
> +++ b/Documentation/backlight/lp855x-driver.txt
> @@ -26,41 +26,3 @@ Value : pwm based or register based
>  2) chip_id
>  The lp855x chip id.
>  Value : lp8550/lp8551/lp8552/lp8553/lp8555/lp8556/lp8557
> -
> -Platform data for lp855x
> -------------------------
> -
> -For supporting platform specific data, the lp855x platform data can be used.
> -
> -* name : Backlight driver name. If it is not defined, default name is set.
> -* device_control : Value of DEVICE CONTROL register.
> -* initial_brightness : Initial value of backlight brightness.
> -* period_ns : Platform specific PWM period value. unit is nano.
> -	     Only valid when brightness is pwm input mode.
> -* size_program : Total size of lp855x_rom_data.
> -* rom_data : List of new eeprom/eprom registers.
> -
> -example 1) lp8552 platform data : i2c register mode with new eeprom data
> -
> -#define EEPROM_A5_ADDR	0xA5
> -#define EEPROM_A5_VAL	0x4f	/* EN_VSYNC=0 */
> -
> -static struct lp855x_rom_data lp8552_eeprom_arr[] = {
> -	{EEPROM_A5_ADDR, EEPROM_A5_VAL},
> -};
> -
> -static struct lp855x_platform_data lp8552_pdata = {
> -	.name = "lcd-bl",
> -	.device_control = I2C_CONFIG(LP8552),
> -	.initial_brightness = INITIAL_BRT,
> -	.size_program = ARRAY_SIZE(lp8552_eeprom_arr),
> -	.rom_data = lp8552_eeprom_arr,
> -};
> -
> -example 2) lp8556 platform data : pwm input mode with default rom data
> -
> -static struct lp855x_platform_data lp8556_pdata = {
> -	.device_control = PWM_CONFIG(LP8556),
> -	.initial_brightness = INITIAL_BRT,
> -	.period_ns = 1000000,
> -};
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 3c64271..4896edb 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -9318,7 +9318,6 @@ M:	Milo Kim <milo.kim@ti.com>
>  S:	Maintained
>  F:	Documentation/backlight/lp855x-driver.txt
>  F:	drivers/video/backlight/lp855x_bl.c
> -F:	include/linux/platform_data/lp855x.h
> 
>  TI LP8727 CHARGER DRIVER
>  M:	Milo Kim <milo.kim@ti.com>
> diff --git a/drivers/video/backlight/lp855x_bl.c b/drivers/video/backlight/lp855x_bl.c
> index a26d3bb..d19b61c 100644
> --- a/drivers/video/backlight/lp855x_bl.c
> +++ b/drivers/video/backlight/lp855x_bl.c
> @@ -15,7 +15,6 @@
>  #include <linux/backlight.h>
>  #include <linux/err.h>
>  #include <linux/of.h>
> -#include <linux/platform_data/lp855x.h>
>  #include <linux/pwm.h>
>  #include <linux/regulator/consumer.h>
> 
> @@ -63,6 +62,42 @@ struct lp855x_device_config {
>  	int (*post_init_device)(struct lp855x *);
>  };
> 
> +enum lp855x_chip_id {
> +	LP8550,
> +	LP8551,
> +	LP8552,
> +	LP8553,
> +	LP8555,
> +	LP8556,
> +	LP8557,
> +};
> +
> +struct lp855x_rom_data {
> +	u8 addr;
> +	u8 val;
> +};
> +
> +/**
> + * struct lp855x_platform_data
> + * @name : Backlight driver name. If it is not defined, default name is set.
> + * @device_control : value of DEVICE CONTROL register
> + * @initial_brightness : initial value of backlight brightness
> + * @period_ns : platform specific pwm period value. unit is nano.
> +		Only valid when mode is PWM_BASED.
> + * @size_program : total size of lp855x_rom_data
> + * @rom_data : list of new eeprom/eprom registers
> + * @supply : regulator that supplies 3V input
> + */
> +struct lp855x_platform_data {
> +	const char *name;
> +	u8 device_control;
> +	u8 initial_brightness;
> +	unsigned int period_ns;
> +	int size_program;
> +	struct lp855x_rom_data *rom_data;
> +	struct regulator *supply;
> +};
> +
>  struct lp855x {
>  	const char *chipname;
>  	enum lp855x_chip_id chip_id;
> diff --git a/include/linux/platform_data/lp855x.h b/include/linux/platform_data/lp855x.h
> deleted file mode 100644
> index 9e3ac3c..0000000
> --- a/include/linux/platform_data/lp855x.h
> +++ /dev/null
> @@ -1,51 +0,0 @@
> -/*
> - * LP855x Backlight Driver
> - *
> - *			Copyright (C) 2011 Texas Instruments
> - *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License version 2 as
> - * published by the Free Software Foundation.
> - *
> - */
> -
> -#ifndef _LP855X_H
> -#define _LP855X_H
> -
> -enum lp855x_chip_id {
> -	LP8550,
> -	LP8551,
> -	LP8552,
> -	LP8553,
> -	LP8555,
> -	LP8556,
> -	LP8557,
> -};
> -
> -struct lp855x_rom_data {
> -	u8 addr;
> -	u8 val;
> -};
> -
> -/**
> - * struct lp855x_platform_data
> - * @name : Backlight driver name. If it is not defined, default name is set.
> - * @device_control : value of DEVICE CONTROL register
> - * @initial_brightness : initial value of backlight brightness
> - * @period_ns : platform specific pwm period value. unit is nano.
> -		Only valid when mode is PWM_BASED.
> - * @size_program : total size of lp855x_rom_data
> - * @rom_data : list of new eeprom/eprom registers
> - * @supply : regulator that supplies 3V input
> - */
> -struct lp855x_platform_data {
> -	const char *name;
> -	u8 device_control;
> -	u8 initial_brightness;
> -	unsigned int period_ns;
> -	int size_program;
> -	struct lp855x_rom_data *rom_data;
> -	struct regulator *supply;
> -};
> -
> -#endif
> --
> 2.1.1


^ permalink raw reply

* Re: [PATCH v2 1/4] backlight/lp855x: Remove stale code from lp855x.h
From: Jingoo Han @ 2014-12-09  1:25 UTC (permalink / raw)
  To: linux-fbdev
In-Reply-To: <1418077278-14144-1-git-send-email-seanpaul@chromium.org>

On Tuesday, December 09, 2014 7:21 AM, Sean Paul wrote:
> 
> These aren't used by anyone, remove them.
> 
> Signed-off-by: Sean Paul <seanpaul@chromium.org>

Acked-by: Jingoo Han <jg1.han@samsung.com>

Best regards,
Jingoo Han

> ---
> Changes in v2:
> 	- None
> 
>  include/linux/platform_data/lp855x.h | 100 -----------------------------------
>  1 file changed, 100 deletions(-)
> 
> diff --git a/include/linux/platform_data/lp855x.h b/include/linux/platform_data/lp855x.h
> index 9c7fd1e..9e3ac3c 100644
> --- a/include/linux/platform_data/lp855x.h
> +++ b/include/linux/platform_data/lp855x.h
> @@ -12,65 +12,6 @@
>  #ifndef _LP855X_H
>  #define _LP855X_H
> 
> -#define BL_CTL_SHFT	(0)
> -#define BRT_MODE_SHFT	(1)
> -#define BRT_MODE_MASK	(0x06)
> -
> -/* Enable backlight. Only valid when BRT_MODE\x10(I2C only) */
> -#define ENABLE_BL	(1)
> -#define DISABLE_BL	(0)
> -
> -#define I2C_CONFIG(id)	id ## _I2C_CONFIG
> -#define PWM_CONFIG(id)	id ## _PWM_CONFIG
> -
> -/* DEVICE CONTROL register - LP8550 */
> -#define LP8550_PWM_CONFIG	(LP8550_PWM_ONLY << BRT_MODE_SHFT)
> -#define LP8550_I2C_CONFIG	((ENABLE_BL << BL_CTL_SHFT) | \
> -				(LP8550_I2C_ONLY << BRT_MODE_SHFT))
> -
> -/* DEVICE CONTROL register - LP8551 */
> -#define LP8551_PWM_CONFIG	LP8550_PWM_CONFIG
> -#define LP8551_I2C_CONFIG	LP8550_I2C_CONFIG
> -
> -/* DEVICE CONTROL register - LP8552 */
> -#define LP8552_PWM_CONFIG	LP8550_PWM_CONFIG
> -#define LP8552_I2C_CONFIG	LP8550_I2C_CONFIG
> -
> -/* DEVICE CONTROL register - LP8553 */
> -#define LP8553_PWM_CONFIG	LP8550_PWM_CONFIG
> -#define LP8553_I2C_CONFIG	LP8550_I2C_CONFIG
> -
> -/* CONFIG register - LP8555 */
> -#define LP8555_PWM_STANDBY	BIT(7)
> -#define LP8555_PWM_FILTER	BIT(6)
> -#define LP8555_RELOAD_EPROM	BIT(3)	/* use it if EPROMs should be reset
> -					   when the backlight turns on */
> -#define LP8555_OFF_OPENLEDS	BIT(2)
> -#define LP8555_PWM_CONFIG	LP8555_PWM_ONLY
> -#define LP8555_I2C_CONFIG	LP8555_I2C_ONLY
> -#define LP8555_COMB1_CONFIG	LP8555_COMBINED1
> -#define LP8555_COMB2_CONFIG	LP8555_COMBINED2
> -
> -/* DEVICE CONTROL register - LP8556 */
> -#define LP8556_PWM_CONFIG	(LP8556_PWM_ONLY << BRT_MODE_SHFT)
> -#define LP8556_COMB1_CONFIG	(LP8556_COMBINED1 << BRT_MODE_SHFT)
> -#define LP8556_I2C_CONFIG	((ENABLE_BL << BL_CTL_SHFT) | \
> -				(LP8556_I2C_ONLY << BRT_MODE_SHFT))
> -#define LP8556_COMB2_CONFIG	(LP8556_COMBINED2 << BRT_MODE_SHFT)
> -#define LP8556_FAST_CONFIG	BIT(7) /* use it if EPROMs should be maintained
> -					  when exiting the low power mode */
> -
> -/* CONFIG register - LP8557 */
> -#define LP8557_PWM_STANDBY	BIT(7)
> -#define LP8557_PWM_FILTER	BIT(6)
> -#define LP8557_RELOAD_EPROM	BIT(3)	/* use it if EPROMs should be reset
> -					   when the backlight turns on */
> -#define LP8557_OFF_OPENLEDS	BIT(2)
> -#define LP8557_PWM_CONFIG	LP8557_PWM_ONLY
> -#define LP8557_I2C_CONFIG	LP8557_I2C_ONLY
> -#define LP8557_COMB1_CONFIG	LP8557_COMBINED1
> -#define LP8557_COMB2_CONFIG	LP8557_COMBINED2
> -
>  enum lp855x_chip_id {
>  	LP8550,
>  	LP8551,
> @@ -81,47 +22,6 @@ enum lp855x_chip_id {
>  	LP8557,
>  };
> 
> -enum lp8550_brighntess_source {
> -	LP8550_PWM_ONLY,
> -	LP8550_I2C_ONLY = 2,
> -};
> -
> -enum lp8551_brighntess_source {
> -	LP8551_PWM_ONLY = LP8550_PWM_ONLY,
> -	LP8551_I2C_ONLY = LP8550_I2C_ONLY,
> -};
> -
> -enum lp8552_brighntess_source {
> -	LP8552_PWM_ONLY = LP8550_PWM_ONLY,
> -	LP8552_I2C_ONLY = LP8550_I2C_ONLY,
> -};
> -
> -enum lp8553_brighntess_source {
> -	LP8553_PWM_ONLY = LP8550_PWM_ONLY,
> -	LP8553_I2C_ONLY = LP8550_I2C_ONLY,
> -};
> -
> -enum lp8555_brightness_source {
> -	LP8555_PWM_ONLY,
> -	LP8555_I2C_ONLY,
> -	LP8555_COMBINED1,	/* Brightness register with shaped PWM */
> -	LP8555_COMBINED2,	/* PWM with shaped brightness register */
> -};
> -
> -enum lp8556_brightness_source {
> -	LP8556_PWM_ONLY,
> -	LP8556_COMBINED1,	/* pwm + i2c before the shaper block */
> -	LP8556_I2C_ONLY,
> -	LP8556_COMBINED2,	/* pwm + i2c after the shaper block */
> -};
> -
> -enum lp8557_brightness_source {
> -	LP8557_PWM_ONLY,
> -	LP8557_I2C_ONLY,
> -	LP8557_COMBINED1,	/* pwm + i2c after the shaper block */
> -	LP8557_COMBINED2,	/* pwm + i2c before the shaper block */
> -};
> -
>  struct lp855x_rom_data {
>  	u8 addr;
>  	u8 val;
> --
> 2.1.1


^ permalink raw reply

* [PATCH v2 4/4] backlight/lp855x: Remove CONFIG_OF ifdef in favor of Kconfig depends
From: Sean Paul @ 2014-12-08 22:21 UTC (permalink / raw)
  To: linux-fbdev

Now that we've removed all traces of pdata, remove the CONFIG_OF ifdef
from lp855x and instead make the driver depend on OF.

Signed-off-by: Sean Paul <seanpaul@chromium.org>
---
Changes in v2:
	- Remove of_match_ptr() wrapper

 drivers/video/backlight/Kconfig     | 2 +-
 drivers/video/backlight/lp855x_bl.c | 9 +--------
 2 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index 8d03924..113c8b3 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -384,7 +384,7 @@ config BACKLIGHT_LM3639
 
 config BACKLIGHT_LP855X
 	tristate "Backlight driver for TI LP855X"
-	depends on BACKLIGHT_CLASS_DEVICE && I2C && PWM
+	depends on BACKLIGHT_CLASS_DEVICE && I2C && PWM && OF
 	help
 	  This supports TI LP8550, LP8551, LP8552, LP8553, LP8555, LP8556 and
 	  LP8557 backlight driver.
diff --git a/drivers/video/backlight/lp855x_bl.c b/drivers/video/backlight/lp855x_bl.c
index 6530d60..f0a85f5 100644
--- a/drivers/video/backlight/lp855x_bl.c
+++ b/drivers/video/backlight/lp855x_bl.c
@@ -379,7 +379,6 @@ static const struct attribute_group lp855x_attr_group = {
 	.attrs = lp855x_attributes,
 };
 
-#ifdef CONFIG_OF
 static int lp855x_parse_dt(struct lp855x *lp)
 {
 	struct device *dev = lp->dev;
@@ -426,12 +425,6 @@ static int lp855x_parse_dt(struct lp855x *lp)
 
 	return 0;
 }
-#else
-static int lp855x_parse_dt(struct lp855x *lp)
-{
-	return -EINVAL;
-}
-#endif
 
 static int lp855x_probe(struct i2c_client *cl, const struct i2c_device_id *id)
 {
@@ -532,7 +525,7 @@ MODULE_DEVICE_TABLE(i2c, lp855x_ids);
 static struct i2c_driver lp855x_driver = {
 	.driver = {
 		   .name = "lp855x",
-		   .of_match_table = of_match_ptr(lp855x_dt_ids),
+		   .of_match_table = lp855x_dt_ids,
 		   },
 	.probe = lp855x_probe,
 	.remove = lp855x_remove,
-- 
2.1.1


^ permalink raw reply related

* [PATCH v2 3/4] backlight/lp855x: Merge lp855x_platform_data with lp855x
From: Sean Paul @ 2014-12-08 22:21 UTC (permalink / raw)
  To: linux-fbdev

Now that we have removed the platform_data header, merge lp855x_platform_data
with lp855x and remove all traces of platform_data from the driver.

Signed-off-by: Sean Paul <seanpaul@chromium.org>
---
Changes in v2:
	- Assign NULL to lp->supply if devm_regulator_get fails

 drivers/video/backlight/lp855x_bl.c | 101 +++++++++++++++++-------------------
 1 file changed, 47 insertions(+), 54 deletions(-)

diff --git a/drivers/video/backlight/lp855x_bl.c b/drivers/video/backlight/lp855x_bl.c
index d19b61c..6530d60 100644
--- a/drivers/video/backlight/lp855x_bl.c
+++ b/drivers/video/backlight/lp855x_bl.c
@@ -78,8 +78,16 @@ struct lp855x_rom_data {
 };
 
 /**
- * struct lp855x_platform_data
- * @name : Backlight driver name. If it is not defined, default name is set.
+ * struct lp855x
+ * @chipname : Chip name, comes from the i2c_device_id
+ * @blname : Backlight driver name. If it is not defined, default name is set.
+ * @chip_id : The type of lp855x
+ * @mode : Whether brightness is controlled via pwm or register
+ * @cfg : Chip specific hooks & register offsets
+ * @client : The i2c client
+ * @bl : The backlight device
+ * @dev : Device pointer
+ * @pwm : The pwm device (if available)
  * @device_control : value of DEVICE CONTROL register
  * @initial_brightness : initial value of backlight brightness
  * @period_ns : platform specific pwm period value. unit is nano.
@@ -88,26 +96,23 @@ struct lp855x_rom_data {
  * @rom_data : list of new eeprom/eprom registers
  * @supply : regulator that supplies 3V input
  */
-struct lp855x_platform_data {
-	const char *name;
-	u8 device_control;
-	u8 initial_brightness;
-	unsigned int period_ns;
-	int size_program;
-	struct lp855x_rom_data *rom_data;
-	struct regulator *supply;
-};
-
 struct lp855x {
 	const char *chipname;
+	const char *blname;
 	enum lp855x_chip_id chip_id;
 	enum lp855x_brightness_ctrl_mode mode;
 	struct lp855x_device_config *cfg;
 	struct i2c_client *client;
 	struct backlight_device *bl;
 	struct device *dev;
-	struct lp855x_platform_data *pdata;
 	struct pwm_device *pwm;
+
+	u8 device_control;
+	u8 initial_brightness;
+	unsigned int period_ns;
+	int size_program;
+	struct lp855x_rom_data *rom_data;
+	struct regulator *supply;
 };
 
 static int lp855x_write_byte(struct lp855x *lp, u8 reg, u8 data)
@@ -204,7 +209,6 @@ static int lp855x_configure(struct lp855x *lp)
 {
 	u8 val, addr;
 	int i, ret;
-	struct lp855x_platform_data *pd = lp->pdata;
 
 	switch (lp->chip_id) {
 	case LP8550:
@@ -230,20 +234,20 @@ static int lp855x_configure(struct lp855x *lp)
 		}
 	}
 
-	val = pd->initial_brightness;
+	val = lp->initial_brightness;
 	ret = lp855x_write_byte(lp, lp->cfg->reg_brightness, val);
 	if (ret)
 		goto err;
 
-	val = pd->device_control;
+	val = lp->device_control;
 	ret = lp855x_write_byte(lp, lp->cfg->reg_devicectrl, val);
 	if (ret)
 		goto err;
 
-	if (pd->size_program > 0) {
-		for (i = 0; i < pd->size_program; i++) {
-			addr = pd->rom_data[i].addr;
-			val = pd->rom_data[i].val;
+	if (lp->size_program > 0) {
+		for (i = 0; i < lp->size_program; i++) {
+			addr = lp->rom_data[i].addr;
+			val = lp->rom_data[i].val;
 			if (!lp855x_is_valid_rom_area(lp, addr))
 				continue;
 
@@ -269,7 +273,7 @@ err:
 
 static void lp855x_pwm_ctrl(struct lp855x *lp, int br, int max_br)
 {
-	unsigned int period = lp->pdata->period_ns;
+	unsigned int period = lp->period_ns;
 	unsigned int duty = br * period / max_br;
 	struct pwm_device *pwm;
 
@@ -320,16 +324,15 @@ static int lp855x_backlight_register(struct lp855x *lp)
 {
 	struct backlight_device *bl;
 	struct backlight_properties props;
-	struct lp855x_platform_data *pdata = lp->pdata;
-	const char *name = pdata->name ? : DEFAULT_BL_NAME;
+	const char *name = lp->blname ? : DEFAULT_BL_NAME;
 
 	props.type = BACKLIGHT_PLATFORM;
 	props.max_brightness = MAX_BRIGHTNESS;
 
-	if (pdata->initial_brightness > props.max_brightness)
-		pdata->initial_brightness = props.max_brightness;
+	if (lp->initial_brightness > props.max_brightness)
+		lp->initial_brightness = props.max_brightness;
 
-	props.brightness = pdata->initial_brightness;
+	props.brightness = lp->initial_brightness;
 
 	bl = devm_backlight_device_register(lp->dev, name, lp->dev, lp,
 				       &lp855x_bl_ops, &props);
@@ -381,7 +384,6 @@ static int lp855x_parse_dt(struct lp855x *lp)
 {
 	struct device *dev = lp->dev;
 	struct device_node *node = dev->of_node;
-	struct lp855x_platform_data *pdata;
 	int rom_length;
 
 	if (!node) {
@@ -389,14 +391,10 @@ static int lp855x_parse_dt(struct lp855x *lp)
 		return -EINVAL;
 	}
 
-	pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
-	if (!pdata)
-		return -ENOMEM;
-
-	of_property_read_string(node, "bl-name", &pdata->name);
-	of_property_read_u8(node, "dev-ctrl", &pdata->device_control);
-	of_property_read_u8(node, "init-brt", &pdata->initial_brightness);
-	of_property_read_u32(node, "pwm-period", &pdata->period_ns);
+	of_property_read_string(node, "bl-name", &lp->blname);
+	of_property_read_u8(node, "dev-ctrl", &lp->device_control);
+	of_property_read_u8(node, "init-brt", &lp->initial_brightness);
+	of_property_read_u32(node, "pwm-period", &lp->period_ns);
 
 	/* Fill ROM platform data if defined */
 	rom_length = of_get_child_count(node);
@@ -415,19 +413,17 @@ static int lp855x_parse_dt(struct lp855x *lp)
 			i++;
 		}
 
-		pdata->size_program = rom_length;
-		pdata->rom_data = &rom[0];
+		lp->size_program = rom_length;
+		lp->rom_data = &rom[0];
 	}
 
-	pdata->supply = devm_regulator_get(dev, "power");
-	if (IS_ERR(pdata->supply)) {
-		if (PTR_ERR(pdata->supply) = -EPROBE_DEFER)
+	lp->supply = devm_regulator_get(dev, "power");
+	if (IS_ERR(lp->supply)) {
+		if (PTR_ERR(lp->supply) = -EPROBE_DEFER)
 			return -EPROBE_DEFER;
-		pdata->supply = NULL;
+		lp->supply = NULL;
 	}
 
-	lp->pdata = pdata;
-
 	return 0;
 }
 #else
@@ -453,21 +449,18 @@ static int lp855x_probe(struct i2c_client *cl, const struct i2c_device_id *id)
 	lp->dev = &cl->dev;
 	lp->chipname = id->name;
 	lp->chip_id = id->driver_data;
-	lp->pdata = dev_get_platdata(&cl->dev);
 
-	if (!lp->pdata) {
-		ret = lp855x_parse_dt(lp);
-		if (ret < 0)
-			return ret;
-	}
+	ret = lp855x_parse_dt(lp);
+	if (ret < 0)
+		return ret;
 
-	if (lp->pdata->period_ns > 0)
+	if (lp->period_ns > 0)
 		lp->mode = PWM_BASED;
 	else
 		lp->mode = REGISTER_BASED;
 
-	if (lp->pdata->supply) {
-		ret = regulator_enable(lp->pdata->supply);
+	if (lp->supply) {
+		ret = regulator_enable(lp->supply);
 		if (ret < 0) {
 			dev_err(&cl->dev, "failed to enable supply: %d\n", ret);
 			return ret;
@@ -505,8 +498,8 @@ static int lp855x_remove(struct i2c_client *cl)
 
 	lp->bl->props.brightness = 0;
 	backlight_update_status(lp->bl);
-	if (lp->pdata->supply)
-		regulator_disable(lp->pdata->supply);
+	if (lp->supply)
+		regulator_disable(lp->supply);
 	sysfs_remove_group(&lp->dev->kobj, &lp855x_attr_group);
 
 	return 0;
-- 
2.1.1


^ permalink raw reply related

* [PATCH v2 2/4] backlight/lp855x: Remove platform_data header
From: Sean Paul @ 2014-12-08 22:21 UTC (permalink / raw)
  To: linux-fbdev

No one uses lp855x platform data any longer, remove the header
and move its contents into the driver.

Signed-off-by: Sean Paul <seanpaul@chromium.org>
---
Changes in v2:
	- Removed platform data description from Documentation

 Documentation/backlight/lp855x-driver.txt | 38 -----------------------
 MAINTAINERS                               |  1 -
 drivers/video/backlight/lp855x_bl.c       | 37 +++++++++++++++++++++-
 include/linux/platform_data/lp855x.h      | 51 -------------------------------
 4 files changed, 36 insertions(+), 91 deletions(-)
 delete mode 100644 include/linux/platform_data/lp855x.h

diff --git a/Documentation/backlight/lp855x-driver.txt b/Documentation/backlight/lp855x-driver.txt
index 01bce24..33b83d9 100644
--- a/Documentation/backlight/lp855x-driver.txt
+++ b/Documentation/backlight/lp855x-driver.txt
@@ -26,41 +26,3 @@ Value : pwm based or register based
 2) chip_id
 The lp855x chip id.
 Value : lp8550/lp8551/lp8552/lp8553/lp8555/lp8556/lp8557
-
-Platform data for lp855x
-------------------------
-
-For supporting platform specific data, the lp855x platform data can be used.
-
-* name : Backlight driver name. If it is not defined, default name is set.
-* device_control : Value of DEVICE CONTROL register.
-* initial_brightness : Initial value of backlight brightness.
-* period_ns : Platform specific PWM period value. unit is nano.
-	     Only valid when brightness is pwm input mode.
-* size_program : Total size of lp855x_rom_data.
-* rom_data : List of new eeprom/eprom registers.
-
-example 1) lp8552 platform data : i2c register mode with new eeprom data
-
-#define EEPROM_A5_ADDR	0xA5
-#define EEPROM_A5_VAL	0x4f	/* EN_VSYNC=0 */
-
-static struct lp855x_rom_data lp8552_eeprom_arr[] = {
-	{EEPROM_A5_ADDR, EEPROM_A5_VAL},
-};
-
-static struct lp855x_platform_data lp8552_pdata = {
-	.name = "lcd-bl",
-	.device_control = I2C_CONFIG(LP8552),
-	.initial_brightness = INITIAL_BRT,
-	.size_program = ARRAY_SIZE(lp8552_eeprom_arr),
-	.rom_data = lp8552_eeprom_arr,
-};
-
-example 2) lp8556 platform data : pwm input mode with default rom data
-
-static struct lp855x_platform_data lp8556_pdata = {
-	.device_control = PWM_CONFIG(LP8556),
-	.initial_brightness = INITIAL_BRT,
-	.period_ns = 1000000,
-};
diff --git a/MAINTAINERS b/MAINTAINERS
index 3c64271..4896edb 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -9318,7 +9318,6 @@ M:	Milo Kim <milo.kim@ti.com>
 S:	Maintained
 F:	Documentation/backlight/lp855x-driver.txt
 F:	drivers/video/backlight/lp855x_bl.c
-F:	include/linux/platform_data/lp855x.h
 
 TI LP8727 CHARGER DRIVER
 M:	Milo Kim <milo.kim@ti.com>
diff --git a/drivers/video/backlight/lp855x_bl.c b/drivers/video/backlight/lp855x_bl.c
index a26d3bb..d19b61c 100644
--- a/drivers/video/backlight/lp855x_bl.c
+++ b/drivers/video/backlight/lp855x_bl.c
@@ -15,7 +15,6 @@
 #include <linux/backlight.h>
 #include <linux/err.h>
 #include <linux/of.h>
-#include <linux/platform_data/lp855x.h>
 #include <linux/pwm.h>
 #include <linux/regulator/consumer.h>
 
@@ -63,6 +62,42 @@ struct lp855x_device_config {
 	int (*post_init_device)(struct lp855x *);
 };
 
+enum lp855x_chip_id {
+	LP8550,
+	LP8551,
+	LP8552,
+	LP8553,
+	LP8555,
+	LP8556,
+	LP8557,
+};
+
+struct lp855x_rom_data {
+	u8 addr;
+	u8 val;
+};
+
+/**
+ * struct lp855x_platform_data
+ * @name : Backlight driver name. If it is not defined, default name is set.
+ * @device_control : value of DEVICE CONTROL register
+ * @initial_brightness : initial value of backlight brightness
+ * @period_ns : platform specific pwm period value. unit is nano.
+		Only valid when mode is PWM_BASED.
+ * @size_program : total size of lp855x_rom_data
+ * @rom_data : list of new eeprom/eprom registers
+ * @supply : regulator that supplies 3V input
+ */
+struct lp855x_platform_data {
+	const char *name;
+	u8 device_control;
+	u8 initial_brightness;
+	unsigned int period_ns;
+	int size_program;
+	struct lp855x_rom_data *rom_data;
+	struct regulator *supply;
+};
+
 struct lp855x {
 	const char *chipname;
 	enum lp855x_chip_id chip_id;
diff --git a/include/linux/platform_data/lp855x.h b/include/linux/platform_data/lp855x.h
deleted file mode 100644
index 9e3ac3c..0000000
--- a/include/linux/platform_data/lp855x.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * LP855x Backlight Driver
- *
- *			Copyright (C) 2011 Texas Instruments
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- */
-
-#ifndef _LP855X_H
-#define _LP855X_H
-
-enum lp855x_chip_id {
-	LP8550,
-	LP8551,
-	LP8552,
-	LP8553,
-	LP8555,
-	LP8556,
-	LP8557,
-};
-
-struct lp855x_rom_data {
-	u8 addr;
-	u8 val;
-};
-
-/**
- * struct lp855x_platform_data
- * @name : Backlight driver name. If it is not defined, default name is set.
- * @device_control : value of DEVICE CONTROL register
- * @initial_brightness : initial value of backlight brightness
- * @period_ns : platform specific pwm period value. unit is nano.
-		Only valid when mode is PWM_BASED.
- * @size_program : total size of lp855x_rom_data
- * @rom_data : list of new eeprom/eprom registers
- * @supply : regulator that supplies 3V input
- */
-struct lp855x_platform_data {
-	const char *name;
-	u8 device_control;
-	u8 initial_brightness;
-	unsigned int period_ns;
-	int size_program;
-	struct lp855x_rom_data *rom_data;
-	struct regulator *supply;
-};
-
-#endif
-- 
2.1.1


^ permalink raw reply related

* [PATCH v2 1/4] backlight/lp855x: Remove stale code from lp855x.h
From: Sean Paul @ 2014-12-08 22:21 UTC (permalink / raw)
  To: linux-fbdev

These aren't used by anyone, remove them.

Signed-off-by: Sean Paul <seanpaul@chromium.org>
---
Changes in v2:
	- None

 include/linux/platform_data/lp855x.h | 100 -----------------------------------
 1 file changed, 100 deletions(-)

diff --git a/include/linux/platform_data/lp855x.h b/include/linux/platform_data/lp855x.h
index 9c7fd1e..9e3ac3c 100644
--- a/include/linux/platform_data/lp855x.h
+++ b/include/linux/platform_data/lp855x.h
@@ -12,65 +12,6 @@
 #ifndef _LP855X_H
 #define _LP855X_H
 
-#define BL_CTL_SHFT	(0)
-#define BRT_MODE_SHFT	(1)
-#define BRT_MODE_MASK	(0x06)
-
-/* Enable backlight. Only valid when BRT_MODE\x10(I2C only) */
-#define ENABLE_BL	(1)
-#define DISABLE_BL	(0)
-
-#define I2C_CONFIG(id)	id ## _I2C_CONFIG
-#define PWM_CONFIG(id)	id ## _PWM_CONFIG
-
-/* DEVICE CONTROL register - LP8550 */
-#define LP8550_PWM_CONFIG	(LP8550_PWM_ONLY << BRT_MODE_SHFT)
-#define LP8550_I2C_CONFIG	((ENABLE_BL << BL_CTL_SHFT) | \
-				(LP8550_I2C_ONLY << BRT_MODE_SHFT))
-
-/* DEVICE CONTROL register - LP8551 */
-#define LP8551_PWM_CONFIG	LP8550_PWM_CONFIG
-#define LP8551_I2C_CONFIG	LP8550_I2C_CONFIG
-
-/* DEVICE CONTROL register - LP8552 */
-#define LP8552_PWM_CONFIG	LP8550_PWM_CONFIG
-#define LP8552_I2C_CONFIG	LP8550_I2C_CONFIG
-
-/* DEVICE CONTROL register - LP8553 */
-#define LP8553_PWM_CONFIG	LP8550_PWM_CONFIG
-#define LP8553_I2C_CONFIG	LP8550_I2C_CONFIG
-
-/* CONFIG register - LP8555 */
-#define LP8555_PWM_STANDBY	BIT(7)
-#define LP8555_PWM_FILTER	BIT(6)
-#define LP8555_RELOAD_EPROM	BIT(3)	/* use it if EPROMs should be reset
-					   when the backlight turns on */
-#define LP8555_OFF_OPENLEDS	BIT(2)
-#define LP8555_PWM_CONFIG	LP8555_PWM_ONLY
-#define LP8555_I2C_CONFIG	LP8555_I2C_ONLY
-#define LP8555_COMB1_CONFIG	LP8555_COMBINED1
-#define LP8555_COMB2_CONFIG	LP8555_COMBINED2
-
-/* DEVICE CONTROL register - LP8556 */
-#define LP8556_PWM_CONFIG	(LP8556_PWM_ONLY << BRT_MODE_SHFT)
-#define LP8556_COMB1_CONFIG	(LP8556_COMBINED1 << BRT_MODE_SHFT)
-#define LP8556_I2C_CONFIG	((ENABLE_BL << BL_CTL_SHFT) | \
-				(LP8556_I2C_ONLY << BRT_MODE_SHFT))
-#define LP8556_COMB2_CONFIG	(LP8556_COMBINED2 << BRT_MODE_SHFT)
-#define LP8556_FAST_CONFIG	BIT(7) /* use it if EPROMs should be maintained
-					  when exiting the low power mode */
-
-/* CONFIG register - LP8557 */
-#define LP8557_PWM_STANDBY	BIT(7)
-#define LP8557_PWM_FILTER	BIT(6)
-#define LP8557_RELOAD_EPROM	BIT(3)	/* use it if EPROMs should be reset
-					   when the backlight turns on */
-#define LP8557_OFF_OPENLEDS	BIT(2)
-#define LP8557_PWM_CONFIG	LP8557_PWM_ONLY
-#define LP8557_I2C_CONFIG	LP8557_I2C_ONLY
-#define LP8557_COMB1_CONFIG	LP8557_COMBINED1
-#define LP8557_COMB2_CONFIG	LP8557_COMBINED2
-
 enum lp855x_chip_id {
 	LP8550,
 	LP8551,
@@ -81,47 +22,6 @@ enum lp855x_chip_id {
 	LP8557,
 };
 
-enum lp8550_brighntess_source {
-	LP8550_PWM_ONLY,
-	LP8550_I2C_ONLY = 2,
-};
-
-enum lp8551_brighntess_source {
-	LP8551_PWM_ONLY = LP8550_PWM_ONLY,
-	LP8551_I2C_ONLY = LP8550_I2C_ONLY,
-};
-
-enum lp8552_brighntess_source {
-	LP8552_PWM_ONLY = LP8550_PWM_ONLY,
-	LP8552_I2C_ONLY = LP8550_I2C_ONLY,
-};
-
-enum lp8553_brighntess_source {
-	LP8553_PWM_ONLY = LP8550_PWM_ONLY,
-	LP8553_I2C_ONLY = LP8550_I2C_ONLY,
-};
-
-enum lp8555_brightness_source {
-	LP8555_PWM_ONLY,
-	LP8555_I2C_ONLY,
-	LP8555_COMBINED1,	/* Brightness register with shaped PWM */
-	LP8555_COMBINED2,	/* PWM with shaped brightness register */
-};
-
-enum lp8556_brightness_source {
-	LP8556_PWM_ONLY,
-	LP8556_COMBINED1,	/* pwm + i2c before the shaper block */
-	LP8556_I2C_ONLY,
-	LP8556_COMBINED2,	/* pwm + i2c after the shaper block */
-};
-
-enum lp8557_brightness_source {
-	LP8557_PWM_ONLY,
-	LP8557_I2C_ONLY,
-	LP8557_COMBINED1,	/* pwm + i2c after the shaper block */
-	LP8557_COMBINED2,	/* pwm + i2c before the shaper block */
-};
-
 struct lp855x_rom_data {
 	u8 addr;
 	u8 val;
-- 
2.1.1


^ permalink raw reply related

* Re: [PATCH 3/4] backlight/lp855x: Merge lp855x_platform_data with lp855x
From: Jingoo Han @ 2014-12-08 12:03 UTC (permalink / raw)
  To: linux-fbdev
In-Reply-To: <1417805069-20441-3-git-send-email-seanpaul@chromium.org>

On Monday, December 08, 2014 9:01 PM, Jingoo Han wrote:
> 
> On Saturday, December 06, 2014 3:44 AM, Sean Paul wrote:
> >
> > Now that we have removed the platform_data header, merge lp855x_platform_data
> > with lp855x and remove all traces of platform_data from the driver.
> >
> > Signed-off-by: Sean Paul <seanpaul@chromium.org>
> > ---
> >  drivers/video/backlight/lp855x_bl.c | 100 +++++++++++++++++-------------------
> >  1 file changed, 46 insertions(+), 54 deletions(-)
> >
> > diff --git a/drivers/video/backlight/lp855x_bl.c b/drivers/video/backlight/lp855x_bl.c
> > index d19b61c..8b81d8e 100644
> > --- a/drivers/video/backlight/lp855x_bl.c
> > +++ b/drivers/video/backlight/lp855x_bl.c
> > @@ -78,8 +78,16 @@ struct lp855x_rom_data {
> >  };
> >
> >  /**
> > - * struct lp855x_platform_data
> > - * @name : Backlight driver name. If it is not defined, default name is set.
> > + * struct lp855x
> > + * @chipname : Chip name, comes from the i2c_device_id
> > + * @blname : Backlight driver name. If it is not defined, default name is set.
> > + * @chip_id : The type of lp855x
> > + * @mode : Whether brightness is controlled via pwm or register
> > + * @cfg : Chip specific hooks & register offsets
> > + * @client : The i2c client
> > + * @bl : The backlight device
> > + * @dev : Device pointer
> > + * @pwm : The pwm device (if available)
> >   * @device_control : value of DEVICE CONTROL register
> >   * @initial_brightness : initial value of backlight brightness
> >   * @period_ns : platform specific pwm period value. unit is nano.
> > @@ -88,26 +96,23 @@ struct lp855x_rom_data {
> >   * @rom_data : list of new eeprom/eprom registers
> >   * @supply : regulator that supplies 3V input
> >   */
> > -struct lp855x_platform_data {
> > -	const char *name;
> > -	u8 device_control;
> > -	u8 initial_brightness;
> > -	unsigned int period_ns;
> > -	int size_program;
> > -	struct lp855x_rom_data *rom_data;
> > -	struct regulator *supply;
> > -};
> > -
> >  struct lp855x {
> >  	const char *chipname;
> > +	const char *blname;
> >  	enum lp855x_chip_id chip_id;
> >  	enum lp855x_brightness_ctrl_mode mode;
> >  	struct lp855x_device_config *cfg;
> >  	struct i2c_client *client;
> >  	struct backlight_device *bl;
> >  	struct device *dev;
> > -	struct lp855x_platform_data *pdata;
> >  	struct pwm_device *pwm;
> > +
> > +	u8 device_control;
> > +	u8 initial_brightness;
> > +	unsigned int period_ns;
> > +	int size_program;
> > +	struct lp855x_rom_data *rom_data;
> > +	struct regulator *supply;
> >  };
> 
> Now, 'struct lp855x_platform_data' is removed.
> But, there is still remaining in 'Documentation/backlight/lp855x-driver.txt'.
> Would you clean this lp855x-driver.txt file?
> 
> >
> >  static int lp855x_write_byte(struct lp855x *lp, u8 reg, u8 data)
> > @@ -204,7 +209,6 @@ static int lp855x_configure(struct lp855x *lp)
> >  {
> >  	u8 val, addr;
> >  	int i, ret;
> > -	struct lp855x_platform_data *pd = lp->pdata;
> >
> >  	switch (lp->chip_id) {
> >  	case LP8550:
> > @@ -230,20 +234,20 @@ static int lp855x_configure(struct lp855x *lp)
> >  		}
> >  	}
> >
> > -	val = pd->initial_brightness;
> > +	val = lp->initial_brightness;
> >  	ret = lp855x_write_byte(lp, lp->cfg->reg_brightness, val);
> >  	if (ret)
> >  		goto err;
> >
> > -	val = pd->device_control;
> > +	val = lp->device_control;
> >  	ret = lp855x_write_byte(lp, lp->cfg->reg_devicectrl, val);
> >  	if (ret)
> >  		goto err;
> >
> > -	if (pd->size_program > 0) {
> > -		for (i = 0; i < pd->size_program; i++) {
> > -			addr = pd->rom_data[i].addr;
> > -			val = pd->rom_data[i].val;
> > +	if (lp->size_program > 0) {
> > +		for (i = 0; i < lp->size_program; i++) {
> > +			addr = lp->rom_data[i].addr;
> > +			val = lp->rom_data[i].val;
> >  			if (!lp855x_is_valid_rom_area(lp, addr))
> >  				continue;
> >
> > @@ -269,7 +273,7 @@ err:
> >
> >  static void lp855x_pwm_ctrl(struct lp855x *lp, int br, int max_br)
> >  {
> > -	unsigned int period = lp->pdata->period_ns;
> > +	unsigned int period = lp->period_ns;
> >  	unsigned int duty = br * period / max_br;
> >  	struct pwm_device *pwm;
> >
> > @@ -320,16 +324,15 @@ static int lp855x_backlight_register(struct lp855x *lp)
> >  {
> >  	struct backlight_device *bl;
> >  	struct backlight_properties props;
> > -	struct lp855x_platform_data *pdata = lp->pdata;
> > -	const char *name = pdata->name ? : DEFAULT_BL_NAME;
> > +	const char *name = lp->blname ? : DEFAULT_BL_NAME;
> >
> >  	props.type = BACKLIGHT_PLATFORM;
> >  	props.max_brightness = MAX_BRIGHTNESS;
> >
> > -	if (pdata->initial_brightness > props.max_brightness)
> > -		pdata->initial_brightness = props.max_brightness;
> > +	if (lp->initial_brightness > props.max_brightness)
> > +		lp->initial_brightness = props.max_brightness;
> >
> > -	props.brightness = pdata->initial_brightness;
> > +	props.brightness = lp->initial_brightness;
> >
> >  	bl = devm_backlight_device_register(lp->dev, name, lp->dev, lp,
> >  				       &lp855x_bl_ops, &props);
> > @@ -381,7 +384,6 @@ static int lp855x_parse_dt(struct lp855x *lp)
> >  {
> >  	struct device *dev = lp->dev;
> >  	struct device_node *node = dev->of_node;
> > -	struct lp855x_platform_data *pdata;
> >  	int rom_length;
> >
> >  	if (!node) {
> > @@ -389,14 +391,10 @@ static int lp855x_parse_dt(struct lp855x *lp)
> >  		return -EINVAL;
> >  	}
> >
> > -	pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
> > -	if (!pdata)
> > -		return -ENOMEM;
> > -
> > -	of_property_read_string(node, "bl-name", &pdata->name);
> > -	of_property_read_u8(node, "dev-ctrl", &pdata->device_control);
> > -	of_property_read_u8(node, "init-brt", &pdata->initial_brightness);
> > -	of_property_read_u32(node, "pwm-period", &pdata->period_ns);
> > +	of_property_read_string(node, "bl-name", &lp->blname);
> > +	of_property_read_u8(node, "dev-ctrl", &lp->device_control);
> > +	of_property_read_u8(node, "init-brt", &lp->initial_brightness);
> > +	of_property_read_u32(node, "pwm-period", &lp->period_ns);
> >
> >  	/* Fill ROM platform data if defined */
> >  	rom_length = of_get_child_count(node);
> > @@ -415,19 +413,16 @@ static int lp855x_parse_dt(struct lp855x *lp)
> >  			i++;
> >  		}
> >
> > -		pdata->size_program = rom_length;
> > -		pdata->rom_data = &rom[0];
> > +		lp->size_program = rom_length;
> > +		lp->rom_data = &rom[0];
> >  	}
> >
> > -	pdata->supply = devm_regulator_get(dev, "power");
> > -	if (IS_ERR(pdata->supply)) {
> > -		if (PTR_ERR(pdata->supply) = -EPROBE_DEFER)
> > +	lp->supply = devm_regulator_get(dev, "power");
> > +	if (IS_ERR(lp->supply)) {
> > +		if (PTR_ERR(lp->supply) = -EPROBE_DEFER)
> >  			return -EPROBE_DEFER;
> > -		pdata->supply = NULL;
> 
> Is 'lp->supply' not optional?
> If 'lp->supply' is optional, please add the following.
> 
> +		lp->supply = NULL;
> 
> >  	}
> >
> > -	lp->pdata = pdata;
> > -
> >  	return 0;
> >  }
> >  #else
> > @@ -453,21 +448,18 @@ static int lp855x_probe(struct i2c_client *cl, const struct i2c_device_id *id)
> >  	lp->dev = &cl->dev;
> >  	lp->chipname = id->name;
> >  	lp->chip_id = id->driver_data;
> > -	lp->pdata = dev_get_platdata(&cl->dev);
> >
> > -	if (!lp->pdata) {
> > -		ret = lp855x_parse_dt(lp);
> > -		if (ret < 0)
> > -			return ret;
> > -	}
> > +	ret = lp855x_parse_dt(lp);
> > +	if (ret < 0)
> > +		return ret;
> >
> > -	if (lp->pdata->period_ns > 0)
> > +	if (lp->period_ns > 0)
> >  		lp->mode = PWM_BASED;
> >  	else
> >  		lp->mode = REGISTER_BASED;
> >
> > -	if (lp->pdata->supply) {
> > -		ret = regulator_enable(lp->pdata->supply);
> > +	if (lp->supply) {
> > +		ret = regulator_enable(lp->supply);
> >  		if (ret < 0) {
> >  			dev_err(&cl->dev, "failed to enable supply: %d\n", ret);
> >  			return ret;
> > @@ -505,8 +497,8 @@ static int lp855x_remove(struct i2c_client *cl)
> >
> >  	lp->bl->props.brightness = 0;
> >  	backlight_update_status(lp->bl);
> > -	if (lp->pdata->supply)
> > -		regulator_disable(lp->pdata->supply);
> > +	if (lp->supply)
> > +		regulator_disable(lp->supply);
> 
> If 'lp->supply' is optional, this "if (lp->supply)" might
> be unnecessary.

Sorry for my typo.
Please refer to the following.

If 'lp->supply' is _NOT_ optional, this "if (lp->supply)" might
be unnecessary.


> 
> Best regards,
> Jingoo Han
> 
> >  	sysfs_remove_group(&lp->dev->kobj, &lp855x_attr_group);
> >
> >  	return 0;
> > --
> > 2.2.0.rc0.207.ga3a616c


^ permalink raw reply

* Re: [PATCH 3/4] backlight/lp855x: Merge lp855x_platform_data with lp855x
From: Jingoo Han @ 2014-12-08 11:59 UTC (permalink / raw)
  To: linux-fbdev
In-Reply-To: <1417805069-20441-3-git-send-email-seanpaul@chromium.org>

On Saturday, December 06, 2014 3:44 AM, Sean Paul wrote:
> 
> Now that we have removed the platform_data header, merge lp855x_platform_data
> with lp855x and remove all traces of platform_data from the driver.
> 
> Signed-off-by: Sean Paul <seanpaul@chromium.org>
> ---
>  drivers/video/backlight/lp855x_bl.c | 100 +++++++++++++++++-------------------
>  1 file changed, 46 insertions(+), 54 deletions(-)
> 
> diff --git a/drivers/video/backlight/lp855x_bl.c b/drivers/video/backlight/lp855x_bl.c
> index d19b61c..8b81d8e 100644
> --- a/drivers/video/backlight/lp855x_bl.c
> +++ b/drivers/video/backlight/lp855x_bl.c
> @@ -78,8 +78,16 @@ struct lp855x_rom_data {
>  };
> 
>  /**
> - * struct lp855x_platform_data
> - * @name : Backlight driver name. If it is not defined, default name is set.
> + * struct lp855x
> + * @chipname : Chip name, comes from the i2c_device_id
> + * @blname : Backlight driver name. If it is not defined, default name is set.
> + * @chip_id : The type of lp855x
> + * @mode : Whether brightness is controlled via pwm or register
> + * @cfg : Chip specific hooks & register offsets
> + * @client : The i2c client
> + * @bl : The backlight device
> + * @dev : Device pointer
> + * @pwm : The pwm device (if available)
>   * @device_control : value of DEVICE CONTROL register
>   * @initial_brightness : initial value of backlight brightness
>   * @period_ns : platform specific pwm period value. unit is nano.
> @@ -88,26 +96,23 @@ struct lp855x_rom_data {
>   * @rom_data : list of new eeprom/eprom registers
>   * @supply : regulator that supplies 3V input
>   */
> -struct lp855x_platform_data {
> -	const char *name;
> -	u8 device_control;
> -	u8 initial_brightness;
> -	unsigned int period_ns;
> -	int size_program;
> -	struct lp855x_rom_data *rom_data;
> -	struct regulator *supply;
> -};
> -
>  struct lp855x {
>  	const char *chipname;
> +	const char *blname;
>  	enum lp855x_chip_id chip_id;
>  	enum lp855x_brightness_ctrl_mode mode;
>  	struct lp855x_device_config *cfg;
>  	struct i2c_client *client;
>  	struct backlight_device *bl;
>  	struct device *dev;
> -	struct lp855x_platform_data *pdata;
>  	struct pwm_device *pwm;
> +
> +	u8 device_control;
> +	u8 initial_brightness;
> +	unsigned int period_ns;
> +	int size_program;
> +	struct lp855x_rom_data *rom_data;
> +	struct regulator *supply;
>  };

Now, 'struct lp855x_platform_data' is removed.
But, there is still remaining in 'Documentation/backlight/lp855x-driver.txt'.
Would you clean this lp855x-driver.txt file?

> 
>  static int lp855x_write_byte(struct lp855x *lp, u8 reg, u8 data)
> @@ -204,7 +209,6 @@ static int lp855x_configure(struct lp855x *lp)
>  {
>  	u8 val, addr;
>  	int i, ret;
> -	struct lp855x_platform_data *pd = lp->pdata;
> 
>  	switch (lp->chip_id) {
>  	case LP8550:
> @@ -230,20 +234,20 @@ static int lp855x_configure(struct lp855x *lp)
>  		}
>  	}
> 
> -	val = pd->initial_brightness;
> +	val = lp->initial_brightness;
>  	ret = lp855x_write_byte(lp, lp->cfg->reg_brightness, val);
>  	if (ret)
>  		goto err;
> 
> -	val = pd->device_control;
> +	val = lp->device_control;
>  	ret = lp855x_write_byte(lp, lp->cfg->reg_devicectrl, val);
>  	if (ret)
>  		goto err;
> 
> -	if (pd->size_program > 0) {
> -		for (i = 0; i < pd->size_program; i++) {
> -			addr = pd->rom_data[i].addr;
> -			val = pd->rom_data[i].val;
> +	if (lp->size_program > 0) {
> +		for (i = 0; i < lp->size_program; i++) {
> +			addr = lp->rom_data[i].addr;
> +			val = lp->rom_data[i].val;
>  			if (!lp855x_is_valid_rom_area(lp, addr))
>  				continue;
> 
> @@ -269,7 +273,7 @@ err:
> 
>  static void lp855x_pwm_ctrl(struct lp855x *lp, int br, int max_br)
>  {
> -	unsigned int period = lp->pdata->period_ns;
> +	unsigned int period = lp->period_ns;
>  	unsigned int duty = br * period / max_br;
>  	struct pwm_device *pwm;
> 
> @@ -320,16 +324,15 @@ static int lp855x_backlight_register(struct lp855x *lp)
>  {
>  	struct backlight_device *bl;
>  	struct backlight_properties props;
> -	struct lp855x_platform_data *pdata = lp->pdata;
> -	const char *name = pdata->name ? : DEFAULT_BL_NAME;
> +	const char *name = lp->blname ? : DEFAULT_BL_NAME;
> 
>  	props.type = BACKLIGHT_PLATFORM;
>  	props.max_brightness = MAX_BRIGHTNESS;
> 
> -	if (pdata->initial_brightness > props.max_brightness)
> -		pdata->initial_brightness = props.max_brightness;
> +	if (lp->initial_brightness > props.max_brightness)
> +		lp->initial_brightness = props.max_brightness;
> 
> -	props.brightness = pdata->initial_brightness;
> +	props.brightness = lp->initial_brightness;
> 
>  	bl = devm_backlight_device_register(lp->dev, name, lp->dev, lp,
>  				       &lp855x_bl_ops, &props);
> @@ -381,7 +384,6 @@ static int lp855x_parse_dt(struct lp855x *lp)
>  {
>  	struct device *dev = lp->dev;
>  	struct device_node *node = dev->of_node;
> -	struct lp855x_platform_data *pdata;
>  	int rom_length;
> 
>  	if (!node) {
> @@ -389,14 +391,10 @@ static int lp855x_parse_dt(struct lp855x *lp)
>  		return -EINVAL;
>  	}
> 
> -	pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
> -	if (!pdata)
> -		return -ENOMEM;
> -
> -	of_property_read_string(node, "bl-name", &pdata->name);
> -	of_property_read_u8(node, "dev-ctrl", &pdata->device_control);
> -	of_property_read_u8(node, "init-brt", &pdata->initial_brightness);
> -	of_property_read_u32(node, "pwm-period", &pdata->period_ns);
> +	of_property_read_string(node, "bl-name", &lp->blname);
> +	of_property_read_u8(node, "dev-ctrl", &lp->device_control);
> +	of_property_read_u8(node, "init-brt", &lp->initial_brightness);
> +	of_property_read_u32(node, "pwm-period", &lp->period_ns);
> 
>  	/* Fill ROM platform data if defined */
>  	rom_length = of_get_child_count(node);
> @@ -415,19 +413,16 @@ static int lp855x_parse_dt(struct lp855x *lp)
>  			i++;
>  		}
> 
> -		pdata->size_program = rom_length;
> -		pdata->rom_data = &rom[0];
> +		lp->size_program = rom_length;
> +		lp->rom_data = &rom[0];
>  	}
> 
> -	pdata->supply = devm_regulator_get(dev, "power");
> -	if (IS_ERR(pdata->supply)) {
> -		if (PTR_ERR(pdata->supply) = -EPROBE_DEFER)
> +	lp->supply = devm_regulator_get(dev, "power");
> +	if (IS_ERR(lp->supply)) {
> +		if (PTR_ERR(lp->supply) = -EPROBE_DEFER)
>  			return -EPROBE_DEFER;
> -		pdata->supply = NULL;

Is 'lp->supply' not optional?
If 'lp->supply' is optional, please add the following.

+		lp->supply = NULL;

>  	}
> 
> -	lp->pdata = pdata;
> -
>  	return 0;
>  }
>  #else
> @@ -453,21 +448,18 @@ static int lp855x_probe(struct i2c_client *cl, const struct i2c_device_id *id)
>  	lp->dev = &cl->dev;
>  	lp->chipname = id->name;
>  	lp->chip_id = id->driver_data;
> -	lp->pdata = dev_get_platdata(&cl->dev);
> 
> -	if (!lp->pdata) {
> -		ret = lp855x_parse_dt(lp);
> -		if (ret < 0)
> -			return ret;
> -	}
> +	ret = lp855x_parse_dt(lp);
> +	if (ret < 0)
> +		return ret;
> 
> -	if (lp->pdata->period_ns > 0)
> +	if (lp->period_ns > 0)
>  		lp->mode = PWM_BASED;
>  	else
>  		lp->mode = REGISTER_BASED;
> 
> -	if (lp->pdata->supply) {
> -		ret = regulator_enable(lp->pdata->supply);
> +	if (lp->supply) {
> +		ret = regulator_enable(lp->supply);
>  		if (ret < 0) {
>  			dev_err(&cl->dev, "failed to enable supply: %d\n", ret);
>  			return ret;
> @@ -505,8 +497,8 @@ static int lp855x_remove(struct i2c_client *cl)
> 
>  	lp->bl->props.brightness = 0;
>  	backlight_update_status(lp->bl);
> -	if (lp->pdata->supply)
> -		regulator_disable(lp->pdata->supply);
> +	if (lp->supply)
> +		regulator_disable(lp->supply);

If 'lp->supply' is optional, this "if (lp->supply)" might
be unnecessary.

Best regards,
Jingoo Han

>  	sysfs_remove_group(&lp->dev->kobj, &lp855x_attr_group);
> 
>  	return 0;
> --
> 2.2.0.rc0.207.ga3a616c


^ permalink raw reply

* Re: [PATCH 2/4] backlight/lp855x: Remove platform_data header
From: Jingoo Han @ 2014-12-08 11:41 UTC (permalink / raw)
  To: linux-fbdev
In-Reply-To: <1417805069-20441-2-git-send-email-seanpaul@chromium.org>

On Saturday, December 06, 2014 3:44 AM, Sean Paul wrote:
> 
> No one uses lp855x platform data any longer, remove the header
> and move its contents into the driver.
> 
> Signed-off-by: Sean Paul <seanpaul@chromium.org>

Acked-by: Jingoo Han <jg1.han@samsung.com>

Best regards,
Jingoo Han

> ---
>  MAINTAINERS                          |  1 -
>  drivers/video/backlight/lp855x_bl.c  | 37 +++++++++++++++++++++++++-
>  include/linux/platform_data/lp855x.h | 51 ------------------------------------
>  3 files changed, 36 insertions(+), 53 deletions(-)
>  delete mode 100644 include/linux/platform_data/lp855x.h
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 3c64271..4896edb 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -9318,7 +9318,6 @@ M:	Milo Kim <milo.kim@ti.com>
>  S:	Maintained
>  F:	Documentation/backlight/lp855x-driver.txt
>  F:	drivers/video/backlight/lp855x_bl.c
> -F:	include/linux/platform_data/lp855x.h
> 
>  TI LP8727 CHARGER DRIVER
>  M:	Milo Kim <milo.kim@ti.com>
> diff --git a/drivers/video/backlight/lp855x_bl.c b/drivers/video/backlight/lp855x_bl.c
> index a26d3bb..d19b61c 100644
> --- a/drivers/video/backlight/lp855x_bl.c
> +++ b/drivers/video/backlight/lp855x_bl.c
> @@ -15,7 +15,6 @@
>  #include <linux/backlight.h>
>  #include <linux/err.h>
>  #include <linux/of.h>
> -#include <linux/platform_data/lp855x.h>
>  #include <linux/pwm.h>
>  #include <linux/regulator/consumer.h>
> 
> @@ -63,6 +62,42 @@ struct lp855x_device_config {
>  	int (*post_init_device)(struct lp855x *);
>  };
> 
> +enum lp855x_chip_id {
> +	LP8550,
> +	LP8551,
> +	LP8552,
> +	LP8553,
> +	LP8555,
> +	LP8556,
> +	LP8557,
> +};
> +
> +struct lp855x_rom_data {
> +	u8 addr;
> +	u8 val;
> +};
> +
> +/**
> + * struct lp855x_platform_data
> + * @name : Backlight driver name. If it is not defined, default name is set.
> + * @device_control : value of DEVICE CONTROL register
> + * @initial_brightness : initial value of backlight brightness
> + * @period_ns : platform specific pwm period value. unit is nano.
> +		Only valid when mode is PWM_BASED.
> + * @size_program : total size of lp855x_rom_data
> + * @rom_data : list of new eeprom/eprom registers
> + * @supply : regulator that supplies 3V input
> + */
> +struct lp855x_platform_data {
> +	const char *name;
> +	u8 device_control;
> +	u8 initial_brightness;
> +	unsigned int period_ns;
> +	int size_program;
> +	struct lp855x_rom_data *rom_data;
> +	struct regulator *supply;
> +};
> +
>  struct lp855x {
>  	const char *chipname;
>  	enum lp855x_chip_id chip_id;
> diff --git a/include/linux/platform_data/lp855x.h b/include/linux/platform_data/lp855x.h
> deleted file mode 100644
> index 9e3ac3c..0000000
> --- a/include/linux/platform_data/lp855x.h
> +++ /dev/null
> @@ -1,51 +0,0 @@
> -/*
> - * LP855x Backlight Driver
> - *
> - *			Copyright (C) 2011 Texas Instruments
> - *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License version 2 as
> - * published by the Free Software Foundation.
> - *
> - */
> -
> -#ifndef _LP855X_H
> -#define _LP855X_H
> -
> -enum lp855x_chip_id {
> -	LP8550,
> -	LP8551,
> -	LP8552,
> -	LP8553,
> -	LP8555,
> -	LP8556,
> -	LP8557,
> -};
> -
> -struct lp855x_rom_data {
> -	u8 addr;
> -	u8 val;
> -};
> -
> -/**
> - * struct lp855x_platform_data
> - * @name : Backlight driver name. If it is not defined, default name is set.
> - * @device_control : value of DEVICE CONTROL register
> - * @initial_brightness : initial value of backlight brightness
> - * @period_ns : platform specific pwm period value. unit is nano.
> -		Only valid when mode is PWM_BASED.
> - * @size_program : total size of lp855x_rom_data
> - * @rom_data : list of new eeprom/eprom registers
> - * @supply : regulator that supplies 3V input
> - */
> -struct lp855x_platform_data {
> -	const char *name;
> -	u8 device_control;
> -	u8 initial_brightness;
> -	unsigned int period_ns;
> -	int size_program;
> -	struct lp855x_rom_data *rom_data;
> -	struct regulator *supply;
> -};
> -
> -#endif
> --
> 2.2.0.rc0.207.ga3a616c


^ permalink raw reply

* Re: [PATCH 1/4] backlight/lp855x: Remove stale code from lp855x.h
From: Jingoo Han @ 2014-12-08 11:40 UTC (permalink / raw)
  To: linux-fbdev
In-Reply-To: <1417805069-20441-1-git-send-email-seanpaul@chromium.org>

On Saturday, December 06, 2014 3:44 AM, Sean Paul wrote:
> 
> These aren't used by anyone, remove them.
> 
> Signed-off-by: Sean Paul <seanpaul@chromium.org>

Acked-by: Jingoo Han <jg1.han@samsung.com>

Best regards,
Jingoo Han

> ---
>  include/linux/platform_data/lp855x.h | 100 -----------------------------------
>  1 file changed, 100 deletions(-)
> 
> diff --git a/include/linux/platform_data/lp855x.h b/include/linux/platform_data/lp855x.h
> index 9c7fd1e..9e3ac3c 100644
> --- a/include/linux/platform_data/lp855x.h
> +++ b/include/linux/platform_data/lp855x.h
> @@ -12,65 +12,6 @@
>  #ifndef _LP855X_H
>  #define _LP855X_H
> 
> -#define BL_CTL_SHFT	(0)
> -#define BRT_MODE_SHFT	(1)
> -#define BRT_MODE_MASK	(0x06)
> -
> -/* Enable backlight. Only valid when BRT_MODE\x10(I2C only) */
> -#define ENABLE_BL	(1)
> -#define DISABLE_BL	(0)
> -
> -#define I2C_CONFIG(id)	id ## _I2C_CONFIG
> -#define PWM_CONFIG(id)	id ## _PWM_CONFIG
> -
> -/* DEVICE CONTROL register - LP8550 */
> -#define LP8550_PWM_CONFIG	(LP8550_PWM_ONLY << BRT_MODE_SHFT)
> -#define LP8550_I2C_CONFIG	((ENABLE_BL << BL_CTL_SHFT) | \
> -				(LP8550_I2C_ONLY << BRT_MODE_SHFT))
> -
> -/* DEVICE CONTROL register - LP8551 */
> -#define LP8551_PWM_CONFIG	LP8550_PWM_CONFIG
> -#define LP8551_I2C_CONFIG	LP8550_I2C_CONFIG
> -
> -/* DEVICE CONTROL register - LP8552 */
> -#define LP8552_PWM_CONFIG	LP8550_PWM_CONFIG
> -#define LP8552_I2C_CONFIG	LP8550_I2C_CONFIG
> -
> -/* DEVICE CONTROL register - LP8553 */
> -#define LP8553_PWM_CONFIG	LP8550_PWM_CONFIG
> -#define LP8553_I2C_CONFIG	LP8550_I2C_CONFIG
> -
> -/* CONFIG register - LP8555 */
> -#define LP8555_PWM_STANDBY	BIT(7)
> -#define LP8555_PWM_FILTER	BIT(6)
> -#define LP8555_RELOAD_EPROM	BIT(3)	/* use it if EPROMs should be reset
> -					   when the backlight turns on */
> -#define LP8555_OFF_OPENLEDS	BIT(2)
> -#define LP8555_PWM_CONFIG	LP8555_PWM_ONLY
> -#define LP8555_I2C_CONFIG	LP8555_I2C_ONLY
> -#define LP8555_COMB1_CONFIG	LP8555_COMBINED1
> -#define LP8555_COMB2_CONFIG	LP8555_COMBINED2
> -
> -/* DEVICE CONTROL register - LP8556 */
> -#define LP8556_PWM_CONFIG	(LP8556_PWM_ONLY << BRT_MODE_SHFT)
> -#define LP8556_COMB1_CONFIG	(LP8556_COMBINED1 << BRT_MODE_SHFT)
> -#define LP8556_I2C_CONFIG	((ENABLE_BL << BL_CTL_SHFT) | \
> -				(LP8556_I2C_ONLY << BRT_MODE_SHFT))
> -#define LP8556_COMB2_CONFIG	(LP8556_COMBINED2 << BRT_MODE_SHFT)
> -#define LP8556_FAST_CONFIG	BIT(7) /* use it if EPROMs should be maintained
> -					  when exiting the low power mode */
> -
> -/* CONFIG register - LP8557 */
> -#define LP8557_PWM_STANDBY	BIT(7)
> -#define LP8557_PWM_FILTER	BIT(6)
> -#define LP8557_RELOAD_EPROM	BIT(3)	/* use it if EPROMs should be reset
> -					   when the backlight turns on */
> -#define LP8557_OFF_OPENLEDS	BIT(2)
> -#define LP8557_PWM_CONFIG	LP8557_PWM_ONLY
> -#define LP8557_I2C_CONFIG	LP8557_I2C_ONLY
> -#define LP8557_COMB1_CONFIG	LP8557_COMBINED1
> -#define LP8557_COMB2_CONFIG	LP8557_COMBINED2
> -
>  enum lp855x_chip_id {
>  	LP8550,
>  	LP8551,
> @@ -81,47 +22,6 @@ enum lp855x_chip_id {
>  	LP8557,
>  };
> 
> -enum lp8550_brighntess_source {
> -	LP8550_PWM_ONLY,
> -	LP8550_I2C_ONLY = 2,
> -};
> -
> -enum lp8551_brighntess_source {
> -	LP8551_PWM_ONLY = LP8550_PWM_ONLY,
> -	LP8551_I2C_ONLY = LP8550_I2C_ONLY,
> -};
> -
> -enum lp8552_brighntess_source {
> -	LP8552_PWM_ONLY = LP8550_PWM_ONLY,
> -	LP8552_I2C_ONLY = LP8550_I2C_ONLY,
> -};
> -
> -enum lp8553_brighntess_source {
> -	LP8553_PWM_ONLY = LP8550_PWM_ONLY,
> -	LP8553_I2C_ONLY = LP8550_I2C_ONLY,
> -};
> -
> -enum lp8555_brightness_source {
> -	LP8555_PWM_ONLY,
> -	LP8555_I2C_ONLY,
> -	LP8555_COMBINED1,	/* Brightness register with shaped PWM */
> -	LP8555_COMBINED2,	/* PWM with shaped brightness register */
> -};
> -
> -enum lp8556_brightness_source {
> -	LP8556_PWM_ONLY,
> -	LP8556_COMBINED1,	/* pwm + i2c before the shaper block */
> -	LP8556_I2C_ONLY,
> -	LP8556_COMBINED2,	/* pwm + i2c after the shaper block */
> -};
> -
> -enum lp8557_brightness_source {
> -	LP8557_PWM_ONLY,
> -	LP8557_I2C_ONLY,
> -	LP8557_COMBINED1,	/* pwm + i2c after the shaper block */
> -	LP8557_COMBINED2,	/* pwm + i2c before the shaper block */
> -};
> -
>  struct lp855x_rom_data {
>  	u8 addr;
>  	u8 val;
> --
> 2.2.0.rc0.207.ga3a616c


^ permalink raw reply

* Re: [PATCH] video / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM
From: Jingoo Han @ 2014-12-08 11:06 UTC (permalink / raw)
  To: 'Tomi Valkeinen', 'Rafael J. Wysocki'
  Cc: 'Jean-Christophe Plagniol-Villard', linux-fbdev,
	'Linux Kernel Mailing List', 'Linux PM list',
	'Jingoo Han'
In-Reply-To: <548584CC.7010603@ti.com>

On Monday, December 08, 2014 8:00 PM, Tomi Valkeinen wrote
> 
> On 06/12/14 04:36, Rafael J. Wysocki wrote:
> > From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> >
> > After commit b2b49ccbdd54 (PM: Kconfig: Set PM_RUNTIME if PM_SLEEP is
> > selected) PM_RUNTIME is always set if PM is set, so #ifdef blocks
> > depending on CONFIG_PM_RUNTIME may now be changed to depend on
> > CONFIG_PM.
> >
> > The alternative of CONFIG_PM_SLEEP and CONFIG_PM_RUNTIME may be
> > replaced with CONFIG_PM too.
> >
> > Make these changes in 2 files under drivers/video/.
> >
> > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> > ---
> >
> > Note: This depends on commit b2b49ccbdd54 (PM: Kconfig: Set PM_RUNTIME if
> > PM_SLEEP is selected) which is only in linux-next at the moment (via the
> > linux-pm tree).
> >
> > Please let me know if it is OK to take this one into linux-pm.
> 
> Does not seem to conflict with fbdev changes, so:
> 
> Acked-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

For drivers/video/fbdev/s3c-fb.c,

Acked-by: Jingoo Han <jg1.han@samsung.com>

Best regards,
Jingoo Han

> 
>  Tomi
> 



^ permalink raw reply

* Re: [PATCH] video / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM
From: Tomi Valkeinen @ 2014-12-08 11:00 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Jingoo Han, Jean-Christophe Plagniol-Villard, linux-fbdev,
	Linux Kernel Mailing List, Linux PM list
In-Reply-To: <19160360.7uJRUqlDQg@vostro.rjw.lan>

[-- Attachment #1: Type: text/plain, Size: 929 bytes --]

On 06/12/14 04:36, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> After commit b2b49ccbdd54 (PM: Kconfig: Set PM_RUNTIME if PM_SLEEP is
> selected) PM_RUNTIME is always set if PM is set, so #ifdef blocks
> depending on CONFIG_PM_RUNTIME may now be changed to depend on
> CONFIG_PM.
> 
> The alternative of CONFIG_PM_SLEEP and CONFIG_PM_RUNTIME may be
> replaced with CONFIG_PM too.
> 
> Make these changes in 2 files under drivers/video/.
> 
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
> 
> Note: This depends on commit b2b49ccbdd54 (PM: Kconfig: Set PM_RUNTIME if
> PM_SLEEP is selected) which is only in linux-next at the moment (via the
> linux-pm tree).
> 
> Please let me know if it is OK to take this one into linux-pm.

Does not seem to conflict with fbdev changes, so:

Acked-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

 Tomi



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply

* Re: [PATCH 4/4] backlight/lp855x: Remove CONFIG_OF ifdef in favor of Kconfig depends
From: Jingoo Han @ 2014-12-08  2:17 UTC (permalink / raw)
  To: linux-fbdev
In-Reply-To: <1417805069-20441-4-git-send-email-seanpaul@chromium.org>

On Saturday, December 06, 2014 3:44 AM, Sean Paul wrote:
> 
> Now that we've removed all traces of pdata, remove the CONFIG_OF ifdef
> from lp855x and instead make the driver depend on OF.
> 
> Signed-off-by: Sean Paul <seanpaul@chromium.org>
> ---
>  drivers/video/backlight/Kconfig     | 2 +-
>  drivers/video/backlight/lp855x_bl.c | 7 -------
>  2 files changed, 1 insertion(+), 8 deletions(-)
> 
> diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
> index 8d03924..113c8b3 100644
> --- a/drivers/video/backlight/Kconfig
> +++ b/drivers/video/backlight/Kconfig
> @@ -384,7 +384,7 @@ config BACKLIGHT_LM3639
> 
>  config BACKLIGHT_LP855X
>  	tristate "Backlight driver for TI LP855X"
> -	depends on BACKLIGHT_CLASS_DEVICE && I2C && PWM
> +	depends on BACKLIGHT_CLASS_DEVICE && I2C && PWM && OF
>  	help
>  	  This supports TI LP8550, LP8551, LP8552, LP8553, LP8555, LP8556 and
>  	  LP8557 backlight driver.
> diff --git a/drivers/video/backlight/lp855x_bl.c b/drivers/video/backlight/lp855x_bl.c
> index 8b81d8e..3d3b8cf 100644
> --- a/drivers/video/backlight/lp855x_bl.c
> +++ b/drivers/video/backlight/lp855x_bl.c
> @@ -379,7 +379,6 @@ static const struct attribute_group lp855x_attr_group = {
>  	.attrs = lp855x_attributes,
>  };
> 
> -#ifdef CONFIG_OF
>  static int lp855x_parse_dt(struct lp855x *lp)
>  {
>  	struct device *dev = lp->dev;
> @@ -425,12 +424,6 @@ static int lp855x_parse_dt(struct lp855x *lp)
> 
>  	return 0;
>  }
> -#else
> -static int lp855x_parse_dt(struct lp855x *lp)
> -{
> -	return -EINVAL;
> -}
> -#endif
> 
>  static int lp855x_probe(struct i2c_client *cl, const struct i2c_device_id *id)
>  {

One more thin, in this case, of_match_ptr() is redundant;
thus, of_match_ptr() can be also removed as follows.

--- a/drivers/video/backlight/lp855x_bl.c
+++ b/drivers/video/backlight/lp855x_bl.c
@@ -487,7 +487,7 @@ MODULE_DEVICE_TABLE(i2c, lp855x_ids);
 static struct i2c_driver lp855x_driver = {
	.driver = {
		.name = "lp855x",
-		 .of_match_table = of_match_ptr(lp855x_dt_ids),
+		.of_match_table = lp855x_dt_ids,
		},
	.probe = lp855x_probe,
	.remove = lp855x_remove,

Best regards,
Jingoo Han

> --
> 2.2.0.rc0.207.ga3a616c


^ permalink raw reply

* Re: [PATCH] video: ocfb: Fix data type warning
From: Stefan Kristiansson @ 2014-12-07  6:08 UTC (permalink / raw)
  To: Qiang Chen
  Cc: Jean-Christophe Plagniol-Villard, Tomi Valkeinen, Jingoo Han,
	Daniel Vetter, Laurent Pinchart, linux-fbdev, linux-kernel,
	Qiang Chen
In-Reply-To: <1417767510-31462-1-git-send-email-qiang2.chen@sonymobile.com>

On Fri, Dec 05, 2014 at 04:18:30PM +0800, Qiang Chen wrote:
> When allocate framebuffer memory using dma_alloc_coherent(),
> we'd better use dma_addr_t instead of phys_addr_t. Because the
> address we got in fact is DMA or bus address for the platform.
> 
> This patch also fixes below build warning:
> drivers/video/fbdev/ocfb.c:335:2:
> 	warning: passing argument 3 of ‘dma_alloc_attrs’
> 	from incompatible pointer type [enabled by default]
> 
> Signed-off-by: Qiang Chen <qiang2.chen@sonymobile.com>

Acked-by: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>

^ permalink raw reply

* [PATCH] video / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM
From: Rafael J. Wysocki @ 2014-12-06  2:36 UTC (permalink / raw)
  To: Jingoo Han, Jean-Christophe Plagniol-Villard, Tomi Valkeinen
  Cc: linux-fbdev, Linux Kernel Mailing List, Linux PM list

From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

After commit b2b49ccbdd54 (PM: Kconfig: Set PM_RUNTIME if PM_SLEEP is
selected) PM_RUNTIME is always set if PM is set, so #ifdef blocks
depending on CONFIG_PM_RUNTIME may now be changed to depend on
CONFIG_PM.

The alternative of CONFIG_PM_SLEEP and CONFIG_PM_RUNTIME may be
replaced with CONFIG_PM too.

Make these changes in 2 files under drivers/video/.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---

Note: This depends on commit b2b49ccbdd54 (PM: Kconfig: Set PM_RUNTIME if
PM_SLEEP is selected) which is only in linux-next at the moment (via the
linux-pm tree).

Please let me know if it is OK to take this one into linux-pm.

---
 drivers/video/fbdev/s3c-fb.c          |    2 +-
 drivers/video/fbdev/sh_mobile_meram.c |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

Index: linux-pm/drivers/video/fbdev/sh_mobile_meram.c
=================================--- linux-pm.orig/drivers/video/fbdev/sh_mobile_meram.c
+++ linux-pm/drivers/video/fbdev/sh_mobile_meram.c
@@ -569,7 +569,7 @@ EXPORT_SYMBOL_GPL(sh_mobile_meram_cache_
  * Power management
  */
 
-#if defined(CONFIG_PM_SLEEP) || defined(CONFIG_PM_RUNTIME)
+#ifdef CONFIG_PM
 static int sh_mobile_meram_suspend(struct device *dev)
 {
 	struct platform_device *pdev = to_platform_device(dev);
@@ -612,7 +612,7 @@ static int sh_mobile_meram_resume(struct
 		meram_write_reg(priv->base, common_regs[i], priv->regs[i]);
 	return 0;
 }
-#endif /* CONFIG_PM_SLEEP || CONFIG_PM_RUNTIME */
+#endif /* CONFIG_PM */
 
 static UNIVERSAL_DEV_PM_OPS(sh_mobile_meram_dev_pm_ops,
 			    sh_mobile_meram_suspend,
Index: linux-pm/drivers/video/fbdev/s3c-fb.c
=================================--- linux-pm.orig/drivers/video/fbdev/s3c-fb.c
+++ linux-pm/drivers/video/fbdev/s3c-fb.c
@@ -1630,7 +1630,7 @@ static int s3c_fb_resume(struct device *
 }
 #endif
 
-#ifdef CONFIG_PM_RUNTIME
+#ifdef CONFIG_PM
 static int s3c_fb_runtime_suspend(struct device *dev)
 {
 	struct s3c_fb *sfb = dev_get_drvdata(dev);


^ permalink raw reply

* RE: [PATCH 3/3] video: fbdev: Validate mode timing against monspec
From: David Ung @ 2014-12-05 20:07 UTC (permalink / raw)
  To: linux-fbdev
In-Reply-To: <1417643369-20603-3-git-send-email-davidu@nvidia.com>

 
> On 03/12/14 23:49, David Ung wrote:
> > fbmon may generate mode timings that are out of spec of the monitor.
> > eg DELL U2410 has a max clock 170mhz but advertises a resolutions of
> > 1920x1200@60 in its Standard Timings, fbmon creates a mode using the
> > GTF timing calculation which gave it a 193mhz clock.
> 
> The above is not exactly true with the previous patches, as fbmon doesn't
> calculate it with GTF, but looks it up from the DMT table.

Aiye.  that was the original problem before the existence of the DMT table.
I can adjust the commit message to add comments below.


> I have to say it's quite odd that the monitor advertises a mode it cannot
> display...

It does support 1920x1200, but with reduced timings (like most modern panels)
What it really want is DMT 0x44 which is reduced timing version of 1920x1200
(0x44, 0x0000, 0x572821, &vesa_modes[34])

But there is no STD 2byte code for this, so it uses 0xd100 in the edid,
which gave it 193mhz


> > This patch checks to see if the mode can be supported by the monitor
> > by comparing against monspecs.dclkmax.
> 
> I don't know about this patch... It looks a bit messy, and only handles a too
> high clock in the get_std_timing. We could as well get bad timing from
> get_est_timing() or somewhere else.
> 
> And I don't know if get_std_timing() should even do such filtering in the
> first place. I'd say it's supposed to return the mode from the EDID block.
> Whether the monitor or the device actually supports the mode is a separate
> thing.

I agree that the EDID block should be correct.  But as I explained above, it's
not always correct and the dclkmax is there to combat one of these situations.
Yes, it will not solve all cases but it's a start.  Hopefully these wrong edid
cases don't occur that often.


> Also, generally speaking, while I have no objection in fixing bugs in fbdev,
> I'd wish everyone just moved to DRM if at all possible. So if this starts
> turning into a bigger change, with possibilities for regressions, we have to
> consider if the fix is important enough.

Right.  Though not everyone can simply switch to DRM.
I hope this patch will not have much impact on any existing code.  As you already
mention it should only be restricted to high clocks.

David

-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information.  Any unauthorized review, use, disclosure or distribution
is prohibited.  If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------

^ permalink raw reply

* RE: [PATCH 2/3] video: fbdev: Check Standard Timing against DMT
From: David Ung @ 2014-12-05 19:47 UTC (permalink / raw)
  To: linux-fbdev
In-Reply-To: <1417643369-20603-2-git-send-email-davidu@nvidia.com>

DQo+IE9uIDAzLzEyLzE0IDIzOjQ5LCBEYXZpZCBVbmcgd3JvdGU6DQo+ID4gQWRkIHRoZSBWRVNB
IERpc3BsYXkgTW9uaXRvciBUaW1pbmcgKERNVCkgdGFibGUuDQo+ID4gRHVyaW5nIHBhcnNpbmcg
b2YgU3RhbmRhcmQgVGltaW5ncywgaXQgY29tcGFyZSB0aGUgMiBieXRlIFNURCBjb2RlDQo+ID4g
d2l0aCBETVQgdG8gc2VlIHdoYXQgdGhlIFZFU0EgbW9kZSBzaG91bGQgYmUuICBJZiB0aGVyZSBp
cyBubyBlbnRyeSBpbg0KPiA+IHRoZSB2ZXNhX21vZGVzIHRhYmxlIG9yIG5vIG1hdGNoIGZvdW5k
LCBpdCBmYWxsc2JhY2sgdG8gdGhlIEdURg0KPiA+IHRpbWluZ3MuDQo+ID4NCj4gPiBTaWduZWQt
b2ZmLWJ5OiBEYXZpZCBVbmcgPGRhdmlkdUBudmlkaWEuY29tPg0KPiA+IC0tLQ0KPiA+ICBkcml2
ZXJzL3ZpZGVvL2ZiZGV2L2NvcmUvZmJtb24uYyAgfCAyMCArKysrKystLS0tDQo+ID4gZHJpdmVy
cy92aWRlby9mYmRldi9jb3JlL21vZGVkYi5jIHwgODQNCj4gKysrKysrKysrKysrKysrKysrKysr
KysrKysrKysrKysrKysrKysrDQo+ID4gIGluY2x1ZGUvbGludXgvZmIuaCAgICAgICAgICAgICAg
ICB8IDEwICsrKysrDQo+ID4gIDMgZmlsZXMgY2hhbmdlZCwgMTA3IGluc2VydGlvbnMoKyksIDcg
ZGVsZXRpb25zKC0pDQo+ID4NCj4gPiBkaWZmIC0tZ2l0IGEvZHJpdmVycy92aWRlby9mYmRldi9j
b3JlL2ZibW9uLmMNCj4gPiBiL2RyaXZlcnMvdmlkZW8vZmJkZXYvY29yZS9mYm1vbi5jDQo+ID4g
aW5kZXggNWIwZTMxMy4uYWExMTEwYSAxMDA2NDQNCj4gPiAtLS0gYS9kcml2ZXJzL3ZpZGVvL2Zi
ZGV2L2NvcmUvZmJtb24uYw0KPiA+ICsrKyBiL2RyaXZlcnMvdmlkZW8vZmJkZXYvY29yZS9mYm1v
bi5jDQo+ID4gQEAgLTUyNiwxNiArNTI2LDIyIEBAIHN0YXRpYyBpbnQgZ2V0X3N0ZF90aW1pbmco
dW5zaWduZWQgY2hhciAqYmxvY2ssDQo+IHN0cnVjdCBmYl92aWRlb21vZGUgKm1vZGUsDQo+ID4g
IAlyZWZyZXNoID0gKGJsb2NrWzFdICYgMHgzZikgKyA2MDsNCj4gPg0KPiA+ICAJRFBSSU5USygi
ICAgICAgJWR4JWRAJWRIelxuIiwgeHJlcywgeXJlcywgcmVmcmVzaCk7DQo+ID4gLQlmb3IgKGkg
PSAwOyBpIDwgVkVTQV9NT0RFREJfU0laRTsgaSsrKSB7DQo+ID4gLQkJaWYgKHZlc2FfbW9kZXNb
aV0ueHJlcyA9PSB4cmVzICYmDQo+ID4gLQkJICAgIHZlc2FfbW9kZXNbaV0ueXJlcyA9PSB5cmVz
ICYmDQo+ID4gLQkJICAgIHZlc2FfbW9kZXNbaV0ucmVmcmVzaCA9PSByZWZyZXNoKSB7DQo+ID4g
LQkJCSptb2RlID0gdmVzYV9tb2Rlc1tpXTsNCj4gPiArCWZvciAoaSA9IDA7IGkgPCBETVRfU0la
RTsgaSsrKSB7DQo+ID4gKwkJdTMyIHN0ZF8yYnl0ZV9jb2RlID0gYmxvY2tbMF0gPDwgOCB8IGJs
b2NrWzFdOw0KPiA+ICsNCj4gPiArCQlpZiAoc3RkXzJieXRlX2NvZGUgPT0gZG10X21vZGVzW2ld
LnN0ZF8yYnl0ZV9jb2RlKSB7DQo+ID4gKwkJCWlmICghZG10X21vZGVzW2ldLm1vZGUpDQo+ID4g
KwkJCQlicmVhazsNCj4gPiArCQkJKm1vZGUgPSAqZG10X21vZGVzW2ldLm1vZGU7DQo+ID4gIAkJ
CW1vZGUtPmZsYWcgfD0gRkJfTU9ERV9JU19TVEFOREFSRDsNCj4gPiAtCQkJcmV0dXJuIDE7DQo+
ID4gKwkJCURQUklOVEsoIiAgICAgICAgRE1UIGlkPSVkXG4iLA0KPiBkbXRfbW9kZXNbaV0uZG10
X2lkKTsNCj4gPiArCQkJYnJlYWs7DQo+ID4gIAkJfQ0KPiA+ICAJfQ0KPiA+IC0JY2FsY19tb2Rl
X3RpbWluZ3MoeHJlcywgeXJlcywgcmVmcmVzaCwgbW9kZSk7DQo+ID4gKw0KPiA+ICsJaWYgKGkg
PT0gRE1UX1NJWkUgfHwgIWRtdF9tb2Rlc1tpXS5tb2RlKQ0KPiA+ICsJCWNhbGNfbW9kZV90aW1p
bmdzKHhyZXMsIHlyZXMsIHJlZnJlc2gsIG1vZGUpOw0KPiA+ICsNCj4gPiAgCXJldHVybiAxOw0K
PiA+ICB9DQo+IA0KPiBJIHRoaW5rIHRoaXMgY291bGQgYmUgbWFkZSBhIGJpdCBjbGVhbmVyLg0K
PiANCj4gVGhlIHhyZXMveXJlcy9yZWZyZXNoIGNhbGN1bGF0aW9uIGluIGdldF9zdGRfdGltaW5n
IGRvZXNuJ3QgbWF0dGVyIGZvciB0aGUNCj4gRE1UIGNvZGUgYWJvdmUuIFNvIGluIGdldF9zdGRf
dGltaW5nKCkgeW91IGNvdWxkIGZpcnN0IGRvIHRoZSBzZWFyY2ggZm9yIHRoZQ0KPiBETVQgbW9k
ZSwgYW5kIGlmIGZvdW5kLCByZXR1cm4gZnJvbSB0aGUgZnVuY3Rpb24uIEFmdGVyIHRoYXQgdGhl
IGNvZGUNCj4gd291bGQgZG8gdGhlIEdURiBjYWxjdWxhdGlvbi4NCj4gDQoNClllcywgSSd2ZSBk
ZWxldGVkIHRoZSB4cmVzL3lyZXMvcmVmcmVzaCBjYWxjdWxhdGlvbi4NClRoZSByZWFzb24gZm9y
IHRoZSBicmVhayBpbnN0ZWFkIG9mIGEgcmV0dXJuIGlzIGJlY2F1c2Ugb2YgcGF0Y2ggMy8zLCB3
aGljaA0Kd2lsbCB0aGVuIHZhbGlkYXRlcyB0aGUgbW9kZSBhZ2FpbnN0IG1vbnNwZWMuDQpEYXZp
ZA0KDQoNCg0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t
LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0NClRoaXMgZW1haWwgbWVzc2FnZSBp
cyBmb3IgdGhlIHNvbGUgdXNlIG9mIHRoZSBpbnRlbmRlZCByZWNpcGllbnQocykgYW5kIG1heSBj
b250YWluDQpjb25maWRlbnRpYWwgaW5mb3JtYXRpb24uICBBbnkgdW5hdXRob3JpemVkIHJldmll
dywgdXNlLCBkaXNjbG9zdXJlIG9yIGRpc3RyaWJ1dGlvbg0KaXMgcHJvaGliaXRlZC4gIElmIHlv
dSBhcmUgbm90IHRoZSBpbnRlbmRlZCByZWNpcGllbnQsIHBsZWFzZSBjb250YWN0IHRoZSBzZW5k
ZXIgYnkNCnJlcGx5IGVtYWlsIGFuZCBkZXN0cm95IGFsbCBjb3BpZXMgb2YgdGhlIG9yaWdpbmFs
IG1lc3NhZ2UuDQotLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t
LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0K

^ permalink raw reply

* [PATCH 4/4] backlight/lp855x: Remove CONFIG_OF ifdef in favor of Kconfig depends
From: Sean Paul @ 2014-12-05 18:44 UTC (permalink / raw)
  To: linux-fbdev

Now that we've removed all traces of pdata, remove the CONFIG_OF ifdef
from lp855x and instead make the driver depend on OF.

Signed-off-by: Sean Paul <seanpaul@chromium.org>
---
 drivers/video/backlight/Kconfig     | 2 +-
 drivers/video/backlight/lp855x_bl.c | 7 -------
 2 files changed, 1 insertion(+), 8 deletions(-)

diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index 8d03924..113c8b3 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -384,7 +384,7 @@ config BACKLIGHT_LM3639
 
 config BACKLIGHT_LP855X
 	tristate "Backlight driver for TI LP855X"
-	depends on BACKLIGHT_CLASS_DEVICE && I2C && PWM
+	depends on BACKLIGHT_CLASS_DEVICE && I2C && PWM && OF
 	help
 	  This supports TI LP8550, LP8551, LP8552, LP8553, LP8555, LP8556 and
 	  LP8557 backlight driver.
diff --git a/drivers/video/backlight/lp855x_bl.c b/drivers/video/backlight/lp855x_bl.c
index 8b81d8e..3d3b8cf 100644
--- a/drivers/video/backlight/lp855x_bl.c
+++ b/drivers/video/backlight/lp855x_bl.c
@@ -379,7 +379,6 @@ static const struct attribute_group lp855x_attr_group = {
 	.attrs = lp855x_attributes,
 };
 
-#ifdef CONFIG_OF
 static int lp855x_parse_dt(struct lp855x *lp)
 {
 	struct device *dev = lp->dev;
@@ -425,12 +424,6 @@ static int lp855x_parse_dt(struct lp855x *lp)
 
 	return 0;
 }
-#else
-static int lp855x_parse_dt(struct lp855x *lp)
-{
-	return -EINVAL;
-}
-#endif
 
 static int lp855x_probe(struct i2c_client *cl, const struct i2c_device_id *id)
 {
-- 
2.2.0.rc0.207.ga3a616c


^ permalink raw reply related

* [PATCH 3/4] backlight/lp855x: Merge lp855x_platform_data with lp855x
From: Sean Paul @ 2014-12-05 18:44 UTC (permalink / raw)
  To: linux-fbdev

Now that we have removed the platform_data header, merge lp855x_platform_data
with lp855x and remove all traces of platform_data from the driver.

Signed-off-by: Sean Paul <seanpaul@chromium.org>
---
 drivers/video/backlight/lp855x_bl.c | 100 +++++++++++++++++-------------------
 1 file changed, 46 insertions(+), 54 deletions(-)

diff --git a/drivers/video/backlight/lp855x_bl.c b/drivers/video/backlight/lp855x_bl.c
index d19b61c..8b81d8e 100644
--- a/drivers/video/backlight/lp855x_bl.c
+++ b/drivers/video/backlight/lp855x_bl.c
@@ -78,8 +78,16 @@ struct lp855x_rom_data {
 };
 
 /**
- * struct lp855x_platform_data
- * @name : Backlight driver name. If it is not defined, default name is set.
+ * struct lp855x
+ * @chipname : Chip name, comes from the i2c_device_id
+ * @blname : Backlight driver name. If it is not defined, default name is set.
+ * @chip_id : The type of lp855x
+ * @mode : Whether brightness is controlled via pwm or register
+ * @cfg : Chip specific hooks & register offsets
+ * @client : The i2c client
+ * @bl : The backlight device
+ * @dev : Device pointer
+ * @pwm : The pwm device (if available)
  * @device_control : value of DEVICE CONTROL register
  * @initial_brightness : initial value of backlight brightness
  * @period_ns : platform specific pwm period value. unit is nano.
@@ -88,26 +96,23 @@ struct lp855x_rom_data {
  * @rom_data : list of new eeprom/eprom registers
  * @supply : regulator that supplies 3V input
  */
-struct lp855x_platform_data {
-	const char *name;
-	u8 device_control;
-	u8 initial_brightness;
-	unsigned int period_ns;
-	int size_program;
-	struct lp855x_rom_data *rom_data;
-	struct regulator *supply;
-};
-
 struct lp855x {
 	const char *chipname;
+	const char *blname;
 	enum lp855x_chip_id chip_id;
 	enum lp855x_brightness_ctrl_mode mode;
 	struct lp855x_device_config *cfg;
 	struct i2c_client *client;
 	struct backlight_device *bl;
 	struct device *dev;
-	struct lp855x_platform_data *pdata;
 	struct pwm_device *pwm;
+
+	u8 device_control;
+	u8 initial_brightness;
+	unsigned int period_ns;
+	int size_program;
+	struct lp855x_rom_data *rom_data;
+	struct regulator *supply;
 };
 
 static int lp855x_write_byte(struct lp855x *lp, u8 reg, u8 data)
@@ -204,7 +209,6 @@ static int lp855x_configure(struct lp855x *lp)
 {
 	u8 val, addr;
 	int i, ret;
-	struct lp855x_platform_data *pd = lp->pdata;
 
 	switch (lp->chip_id) {
 	case LP8550:
@@ -230,20 +234,20 @@ static int lp855x_configure(struct lp855x *lp)
 		}
 	}
 
-	val = pd->initial_brightness;
+	val = lp->initial_brightness;
 	ret = lp855x_write_byte(lp, lp->cfg->reg_brightness, val);
 	if (ret)
 		goto err;
 
-	val = pd->device_control;
+	val = lp->device_control;
 	ret = lp855x_write_byte(lp, lp->cfg->reg_devicectrl, val);
 	if (ret)
 		goto err;
 
-	if (pd->size_program > 0) {
-		for (i = 0; i < pd->size_program; i++) {
-			addr = pd->rom_data[i].addr;
-			val = pd->rom_data[i].val;
+	if (lp->size_program > 0) {
+		for (i = 0; i < lp->size_program; i++) {
+			addr = lp->rom_data[i].addr;
+			val = lp->rom_data[i].val;
 			if (!lp855x_is_valid_rom_area(lp, addr))
 				continue;
 
@@ -269,7 +273,7 @@ err:
 
 static void lp855x_pwm_ctrl(struct lp855x *lp, int br, int max_br)
 {
-	unsigned int period = lp->pdata->period_ns;
+	unsigned int period = lp->period_ns;
 	unsigned int duty = br * period / max_br;
 	struct pwm_device *pwm;
 
@@ -320,16 +324,15 @@ static int lp855x_backlight_register(struct lp855x *lp)
 {
 	struct backlight_device *bl;
 	struct backlight_properties props;
-	struct lp855x_platform_data *pdata = lp->pdata;
-	const char *name = pdata->name ? : DEFAULT_BL_NAME;
+	const char *name = lp->blname ? : DEFAULT_BL_NAME;
 
 	props.type = BACKLIGHT_PLATFORM;
 	props.max_brightness = MAX_BRIGHTNESS;
 
-	if (pdata->initial_brightness > props.max_brightness)
-		pdata->initial_brightness = props.max_brightness;
+	if (lp->initial_brightness > props.max_brightness)
+		lp->initial_brightness = props.max_brightness;
 
-	props.brightness = pdata->initial_brightness;
+	props.brightness = lp->initial_brightness;
 
 	bl = devm_backlight_device_register(lp->dev, name, lp->dev, lp,
 				       &lp855x_bl_ops, &props);
@@ -381,7 +384,6 @@ static int lp855x_parse_dt(struct lp855x *lp)
 {
 	struct device *dev = lp->dev;
 	struct device_node *node = dev->of_node;
-	struct lp855x_platform_data *pdata;
 	int rom_length;
 
 	if (!node) {
@@ -389,14 +391,10 @@ static int lp855x_parse_dt(struct lp855x *lp)
 		return -EINVAL;
 	}
 
-	pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
-	if (!pdata)
-		return -ENOMEM;
-
-	of_property_read_string(node, "bl-name", &pdata->name);
-	of_property_read_u8(node, "dev-ctrl", &pdata->device_control);
-	of_property_read_u8(node, "init-brt", &pdata->initial_brightness);
-	of_property_read_u32(node, "pwm-period", &pdata->period_ns);
+	of_property_read_string(node, "bl-name", &lp->blname);
+	of_property_read_u8(node, "dev-ctrl", &lp->device_control);
+	of_property_read_u8(node, "init-brt", &lp->initial_brightness);
+	of_property_read_u32(node, "pwm-period", &lp->period_ns);
 
 	/* Fill ROM platform data if defined */
 	rom_length = of_get_child_count(node);
@@ -415,19 +413,16 @@ static int lp855x_parse_dt(struct lp855x *lp)
 			i++;
 		}
 
-		pdata->size_program = rom_length;
-		pdata->rom_data = &rom[0];
+		lp->size_program = rom_length;
+		lp->rom_data = &rom[0];
 	}
 
-	pdata->supply = devm_regulator_get(dev, "power");
-	if (IS_ERR(pdata->supply)) {
-		if (PTR_ERR(pdata->supply) = -EPROBE_DEFER)
+	lp->supply = devm_regulator_get(dev, "power");
+	if (IS_ERR(lp->supply)) {
+		if (PTR_ERR(lp->supply) = -EPROBE_DEFER)
 			return -EPROBE_DEFER;
-		pdata->supply = NULL;
 	}
 
-	lp->pdata = pdata;
-
 	return 0;
 }
 #else
@@ -453,21 +448,18 @@ static int lp855x_probe(struct i2c_client *cl, const struct i2c_device_id *id)
 	lp->dev = &cl->dev;
 	lp->chipname = id->name;
 	lp->chip_id = id->driver_data;
-	lp->pdata = dev_get_platdata(&cl->dev);
 
-	if (!lp->pdata) {
-		ret = lp855x_parse_dt(lp);
-		if (ret < 0)
-			return ret;
-	}
+	ret = lp855x_parse_dt(lp);
+	if (ret < 0)
+		return ret;
 
-	if (lp->pdata->period_ns > 0)
+	if (lp->period_ns > 0)
 		lp->mode = PWM_BASED;
 	else
 		lp->mode = REGISTER_BASED;
 
-	if (lp->pdata->supply) {
-		ret = regulator_enable(lp->pdata->supply);
+	if (lp->supply) {
+		ret = regulator_enable(lp->supply);
 		if (ret < 0) {
 			dev_err(&cl->dev, "failed to enable supply: %d\n", ret);
 			return ret;
@@ -505,8 +497,8 @@ static int lp855x_remove(struct i2c_client *cl)
 
 	lp->bl->props.brightness = 0;
 	backlight_update_status(lp->bl);
-	if (lp->pdata->supply)
-		regulator_disable(lp->pdata->supply);
+	if (lp->supply)
+		regulator_disable(lp->supply);
 	sysfs_remove_group(&lp->dev->kobj, &lp855x_attr_group);
 
 	return 0;
-- 
2.2.0.rc0.207.ga3a616c


^ permalink raw reply related

* [PATCH 2/4] backlight/lp855x: Remove platform_data header
From: Sean Paul @ 2014-12-05 18:44 UTC (permalink / raw)
  To: linux-fbdev

No one uses lp855x platform data any longer, remove the header
and move its contents into the driver.

Signed-off-by: Sean Paul <seanpaul@chromium.org>
---
 MAINTAINERS                          |  1 -
 drivers/video/backlight/lp855x_bl.c  | 37 +++++++++++++++++++++++++-
 include/linux/platform_data/lp855x.h | 51 ------------------------------------
 3 files changed, 36 insertions(+), 53 deletions(-)
 delete mode 100644 include/linux/platform_data/lp855x.h

diff --git a/MAINTAINERS b/MAINTAINERS
index 3c64271..4896edb 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -9318,7 +9318,6 @@ M:	Milo Kim <milo.kim@ti.com>
 S:	Maintained
 F:	Documentation/backlight/lp855x-driver.txt
 F:	drivers/video/backlight/lp855x_bl.c
-F:	include/linux/platform_data/lp855x.h
 
 TI LP8727 CHARGER DRIVER
 M:	Milo Kim <milo.kim@ti.com>
diff --git a/drivers/video/backlight/lp855x_bl.c b/drivers/video/backlight/lp855x_bl.c
index a26d3bb..d19b61c 100644
--- a/drivers/video/backlight/lp855x_bl.c
+++ b/drivers/video/backlight/lp855x_bl.c
@@ -15,7 +15,6 @@
 #include <linux/backlight.h>
 #include <linux/err.h>
 #include <linux/of.h>
-#include <linux/platform_data/lp855x.h>
 #include <linux/pwm.h>
 #include <linux/regulator/consumer.h>
 
@@ -63,6 +62,42 @@ struct lp855x_device_config {
 	int (*post_init_device)(struct lp855x *);
 };
 
+enum lp855x_chip_id {
+	LP8550,
+	LP8551,
+	LP8552,
+	LP8553,
+	LP8555,
+	LP8556,
+	LP8557,
+};
+
+struct lp855x_rom_data {
+	u8 addr;
+	u8 val;
+};
+
+/**
+ * struct lp855x_platform_data
+ * @name : Backlight driver name. If it is not defined, default name is set.
+ * @device_control : value of DEVICE CONTROL register
+ * @initial_brightness : initial value of backlight brightness
+ * @period_ns : platform specific pwm period value. unit is nano.
+		Only valid when mode is PWM_BASED.
+ * @size_program : total size of lp855x_rom_data
+ * @rom_data : list of new eeprom/eprom registers
+ * @supply : regulator that supplies 3V input
+ */
+struct lp855x_platform_data {
+	const char *name;
+	u8 device_control;
+	u8 initial_brightness;
+	unsigned int period_ns;
+	int size_program;
+	struct lp855x_rom_data *rom_data;
+	struct regulator *supply;
+};
+
 struct lp855x {
 	const char *chipname;
 	enum lp855x_chip_id chip_id;
diff --git a/include/linux/platform_data/lp855x.h b/include/linux/platform_data/lp855x.h
deleted file mode 100644
index 9e3ac3c..0000000
--- a/include/linux/platform_data/lp855x.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * LP855x Backlight Driver
- *
- *			Copyright (C) 2011 Texas Instruments
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- */
-
-#ifndef _LP855X_H
-#define _LP855X_H
-
-enum lp855x_chip_id {
-	LP8550,
-	LP8551,
-	LP8552,
-	LP8553,
-	LP8555,
-	LP8556,
-	LP8557,
-};
-
-struct lp855x_rom_data {
-	u8 addr;
-	u8 val;
-};
-
-/**
- * struct lp855x_platform_data
- * @name : Backlight driver name. If it is not defined, default name is set.
- * @device_control : value of DEVICE CONTROL register
- * @initial_brightness : initial value of backlight brightness
- * @period_ns : platform specific pwm period value. unit is nano.
-		Only valid when mode is PWM_BASED.
- * @size_program : total size of lp855x_rom_data
- * @rom_data : list of new eeprom/eprom registers
- * @supply : regulator that supplies 3V input
- */
-struct lp855x_platform_data {
-	const char *name;
-	u8 device_control;
-	u8 initial_brightness;
-	unsigned int period_ns;
-	int size_program;
-	struct lp855x_rom_data *rom_data;
-	struct regulator *supply;
-};
-
-#endif
-- 
2.2.0.rc0.207.ga3a616c


^ permalink raw reply related

* [PATCH 1/4] backlight/lp855x: Remove stale code from lp855x.h
From: Sean Paul @ 2014-12-05 18:44 UTC (permalink / raw)
  To: linux-fbdev

These aren't used by anyone, remove them.

Signed-off-by: Sean Paul <seanpaul@chromium.org>
---
 include/linux/platform_data/lp855x.h | 100 -----------------------------------
 1 file changed, 100 deletions(-)

diff --git a/include/linux/platform_data/lp855x.h b/include/linux/platform_data/lp855x.h
index 9c7fd1e..9e3ac3c 100644
--- a/include/linux/platform_data/lp855x.h
+++ b/include/linux/platform_data/lp855x.h
@@ -12,65 +12,6 @@
 #ifndef _LP855X_H
 #define _LP855X_H
 
-#define BL_CTL_SHFT	(0)
-#define BRT_MODE_SHFT	(1)
-#define BRT_MODE_MASK	(0x06)
-
-/* Enable backlight. Only valid when BRT_MODE\x10(I2C only) */
-#define ENABLE_BL	(1)
-#define DISABLE_BL	(0)
-
-#define I2C_CONFIG(id)	id ## _I2C_CONFIG
-#define PWM_CONFIG(id)	id ## _PWM_CONFIG
-
-/* DEVICE CONTROL register - LP8550 */
-#define LP8550_PWM_CONFIG	(LP8550_PWM_ONLY << BRT_MODE_SHFT)
-#define LP8550_I2C_CONFIG	((ENABLE_BL << BL_CTL_SHFT) | \
-				(LP8550_I2C_ONLY << BRT_MODE_SHFT))
-
-/* DEVICE CONTROL register - LP8551 */
-#define LP8551_PWM_CONFIG	LP8550_PWM_CONFIG
-#define LP8551_I2C_CONFIG	LP8550_I2C_CONFIG
-
-/* DEVICE CONTROL register - LP8552 */
-#define LP8552_PWM_CONFIG	LP8550_PWM_CONFIG
-#define LP8552_I2C_CONFIG	LP8550_I2C_CONFIG
-
-/* DEVICE CONTROL register - LP8553 */
-#define LP8553_PWM_CONFIG	LP8550_PWM_CONFIG
-#define LP8553_I2C_CONFIG	LP8550_I2C_CONFIG
-
-/* CONFIG register - LP8555 */
-#define LP8555_PWM_STANDBY	BIT(7)
-#define LP8555_PWM_FILTER	BIT(6)
-#define LP8555_RELOAD_EPROM	BIT(3)	/* use it if EPROMs should be reset
-					   when the backlight turns on */
-#define LP8555_OFF_OPENLEDS	BIT(2)
-#define LP8555_PWM_CONFIG	LP8555_PWM_ONLY
-#define LP8555_I2C_CONFIG	LP8555_I2C_ONLY
-#define LP8555_COMB1_CONFIG	LP8555_COMBINED1
-#define LP8555_COMB2_CONFIG	LP8555_COMBINED2
-
-/* DEVICE CONTROL register - LP8556 */
-#define LP8556_PWM_CONFIG	(LP8556_PWM_ONLY << BRT_MODE_SHFT)
-#define LP8556_COMB1_CONFIG	(LP8556_COMBINED1 << BRT_MODE_SHFT)
-#define LP8556_I2C_CONFIG	((ENABLE_BL << BL_CTL_SHFT) | \
-				(LP8556_I2C_ONLY << BRT_MODE_SHFT))
-#define LP8556_COMB2_CONFIG	(LP8556_COMBINED2 << BRT_MODE_SHFT)
-#define LP8556_FAST_CONFIG	BIT(7) /* use it if EPROMs should be maintained
-					  when exiting the low power mode */
-
-/* CONFIG register - LP8557 */
-#define LP8557_PWM_STANDBY	BIT(7)
-#define LP8557_PWM_FILTER	BIT(6)
-#define LP8557_RELOAD_EPROM	BIT(3)	/* use it if EPROMs should be reset
-					   when the backlight turns on */
-#define LP8557_OFF_OPENLEDS	BIT(2)
-#define LP8557_PWM_CONFIG	LP8557_PWM_ONLY
-#define LP8557_I2C_CONFIG	LP8557_I2C_ONLY
-#define LP8557_COMB1_CONFIG	LP8557_COMBINED1
-#define LP8557_COMB2_CONFIG	LP8557_COMBINED2
-
 enum lp855x_chip_id {
 	LP8550,
 	LP8551,
@@ -81,47 +22,6 @@ enum lp855x_chip_id {
 	LP8557,
 };
 
-enum lp8550_brighntess_source {
-	LP8550_PWM_ONLY,
-	LP8550_I2C_ONLY = 2,
-};
-
-enum lp8551_brighntess_source {
-	LP8551_PWM_ONLY = LP8550_PWM_ONLY,
-	LP8551_I2C_ONLY = LP8550_I2C_ONLY,
-};
-
-enum lp8552_brighntess_source {
-	LP8552_PWM_ONLY = LP8550_PWM_ONLY,
-	LP8552_I2C_ONLY = LP8550_I2C_ONLY,
-};
-
-enum lp8553_brighntess_source {
-	LP8553_PWM_ONLY = LP8550_PWM_ONLY,
-	LP8553_I2C_ONLY = LP8550_I2C_ONLY,
-};
-
-enum lp8555_brightness_source {
-	LP8555_PWM_ONLY,
-	LP8555_I2C_ONLY,
-	LP8555_COMBINED1,	/* Brightness register with shaped PWM */
-	LP8555_COMBINED2,	/* PWM with shaped brightness register */
-};
-
-enum lp8556_brightness_source {
-	LP8556_PWM_ONLY,
-	LP8556_COMBINED1,	/* pwm + i2c before the shaper block */
-	LP8556_I2C_ONLY,
-	LP8556_COMBINED2,	/* pwm + i2c after the shaper block */
-};
-
-enum lp8557_brightness_source {
-	LP8557_PWM_ONLY,
-	LP8557_I2C_ONLY,
-	LP8557_COMBINED1,	/* pwm + i2c after the shaper block */
-	LP8557_COMBINED2,	/* pwm + i2c before the shaper block */
-};
-
 struct lp855x_rom_data {
 	u8 addr;
 	u8 val;
-- 
2.2.0.rc0.207.ga3a616c


^ permalink raw reply related

* Re: [PATCH 3/3] video: fbdev: Validate mode timing against monspec
From: Tomi Valkeinen @ 2014-12-05 12:22 UTC (permalink / raw)
  To: linux-fbdev
In-Reply-To: <1417643369-20603-3-git-send-email-davidu@nvidia.com>

[-- Attachment #1: Type: text/plain, Size: 1366 bytes --]

On 03/12/14 23:49, David Ung wrote:
> fbmon may generate mode timings that are out of spec of the monitor.
> eg DELL U2410 has a max clock 170mhz but advertises a resolutions of
> 1920x1200@60 in its Standard Timings, fbmon creates a mode using the
> GTF timing calculation which gave it a 193mhz clock.

The above is not exactly true with the previous patches, as fbmon
doesn't calculate it with GTF, but looks it up from the DMT table.

I have to say it's quite odd that the monitor advertises a mode it
cannot display...

> This patch checks to see if the mode can be supported by the monitor
> by comparing against monspecs.dclkmax.

I don't know about this patch... It looks a bit messy, and only handles
a too high clock in the get_std_timing. We could as well get bad timing
from get_est_timing() or somewhere else.

And I don't know if get_std_timing() should even do such filtering in
the first place. I'd say it's supposed to return the mode from the EDID
block. Whether the monitor or the device actually supports the mode is a
separate thing.

Also, generally speaking, while I have no objection in fixing bugs in
fbdev, I'd wish everyone just moved to DRM if at all possible. So if
this starts turning into a bigger change, with possibilities for
regressions, we have to consider if the fix is important enough.

 Tomi



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply

* Re: [PATCH 2/3] video: fbdev: Check Standard Timing against DMT
From: Tomi Valkeinen @ 2014-12-05 12:02 UTC (permalink / raw)
  To: linux-fbdev
In-Reply-To: <1417643369-20603-2-git-send-email-davidu@nvidia.com>

[-- Attachment #1: Type: text/plain, Size: 2100 bytes --]

On 03/12/14 23:49, David Ung wrote:
> Add the VESA Display Monitor Timing (DMT) table.
> During parsing of Standard Timings, it compare the 2 byte STD code
> with DMT to see what the VESA mode should be.  If there is no entry
> in the vesa_modes table or no match found, it fallsback to the
> GTF timings.
> 
> Signed-off-by: David Ung <davidu@nvidia.com>
> ---
>  drivers/video/fbdev/core/fbmon.c  | 20 ++++++----
>  drivers/video/fbdev/core/modedb.c | 84 +++++++++++++++++++++++++++++++++++++++
>  include/linux/fb.h                | 10 +++++
>  3 files changed, 107 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/video/fbdev/core/fbmon.c b/drivers/video/fbdev/core/fbmon.c
> index 5b0e313..aa1110a 100644
> --- a/drivers/video/fbdev/core/fbmon.c
> +++ b/drivers/video/fbdev/core/fbmon.c
> @@ -526,16 +526,22 @@ static int get_std_timing(unsigned char *block, struct fb_videomode *mode,
>  	refresh = (block[1] & 0x3f) + 60;
>  
>  	DPRINTK("      %dx%d@%dHz\n", xres, yres, refresh);
> -	for (i = 0; i < VESA_MODEDB_SIZE; i++) {
> -		if (vesa_modes[i].xres == xres &&
> -		    vesa_modes[i].yres == yres &&
> -		    vesa_modes[i].refresh == refresh) {
> -			*mode = vesa_modes[i];
> +	for (i = 0; i < DMT_SIZE; i++) {
> +		u32 std_2byte_code = block[0] << 8 | block[1];
> +
> +		if (std_2byte_code == dmt_modes[i].std_2byte_code) {
> +			if (!dmt_modes[i].mode)
> +				break;
> +			*mode = *dmt_modes[i].mode;
>  			mode->flag |= FB_MODE_IS_STANDARD;
> -			return 1;
> +			DPRINTK("        DMT id=%d\n", dmt_modes[i].dmt_id);
> +			break;
>  		}
>  	}
> -	calc_mode_timings(xres, yres, refresh, mode);
> +
> +	if (i == DMT_SIZE || !dmt_modes[i].mode)
> +		calc_mode_timings(xres, yres, refresh, mode);
> +
>  	return 1;
>  }

I think this could be made a bit cleaner.

The xres/yres/refresh calculation in get_std_timing doesn't matter for
the DMT code above. So in get_std_timing() you could first do the search
for the DMT mode, and if found, return from the function. After that the
code would do the GTF calculation.

 Tomi



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox