All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tomi Valkeinen <tomi.valkeinen@ti.com>
To: linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] video: imxfb: Use regulator API with LCD class for powering
Date: Mon, 10 Feb 2014 12:05:37 +0000	[thread overview]
Message-ID: <52F8C091.50704@ti.com> (raw)
In-Reply-To: <1387624080-15312-1-git-send-email-shc_work@mail.ru>

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

On 21/12/13 13:08, Alexander Shiyan wrote:
> This patch replaces custom lcd_power() callback with
> regulator API over LCD class.
> 
> Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
> ---
>  .../devicetree/bindings/video/fsl,imx-fb.txt       |  1 +
>  arch/arm/mach-imx/mach-mx27ads.c                   | 55 +++++++++++++++--
>  drivers/video/imxfb.c                              | 71 +++++++++++++++++++---
>  include/linux/platform_data/video-imxfb.h          |  1 -
>  4 files changed, 114 insertions(+), 14 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/video/fsl,imx-fb.txt b/Documentation/devicetree/bindings/video/fsl,imx-fb.txt
> index 46da08d..e6b1ee9 100644
> --- a/Documentation/devicetree/bindings/video/fsl,imx-fb.txt
> +++ b/Documentation/devicetree/bindings/video/fsl,imx-fb.txt
> @@ -15,6 +15,7 @@ Required nodes:
>  	- fsl,pcr: LCDC PCR value
>  
>  Optional properties:
> +- lcd-supply: Regulator for LCD supply voltage.
>  - fsl,dmacr: DMA Control Register value. This is optional. By default, the
>  	register is not modified as recommended by the datasheet.
>  - fsl,lscr1: LCDC Sharp Configuration Register value.
> diff --git a/arch/arm/mach-imx/mach-mx27ads.c b/arch/arm/mach-imx/mach-mx27ads.c
> index 9821b824..a7a4a9c 100644
> --- a/arch/arm/mach-imx/mach-mx27ads.c
> +++ b/arch/arm/mach-imx/mach-mx27ads.c
> @@ -21,6 +21,10 @@
>  #include <linux/mtd/physmap.h>
>  #include <linux/i2c.h>
>  #include <linux/irq.h>
> +
> +#include <linux/regulator/fixed.h>
> +#include <linux/regulator/machine.h>
> +
>  #include <asm/mach-types.h>
>  #include <asm/mach/arch.h>
>  #include <asm/mach/time.h>
> @@ -195,14 +199,58 @@ static const struct imxi2c_platform_data mx27ads_i2c1_data __initconst = {
>  static struct i2c_board_info mx27ads_i2c_devices[] = {
>  };
>  
> -void lcd_power(int on)
> +static void vgpio_set(struct gpio_chip *chip, unsigned offset, int value)
>  {
> -	if (on)
> +	if (value)
>  		__raw_writew(PBC_BCTRL1_LCDON, PBC_BCTRL1_SET_REG);
>  	else
>  		__raw_writew(PBC_BCTRL1_LCDON, PBC_BCTRL1_CLEAR_REG);
>  }
>  
> +static int vgpio_dir_out(struct gpio_chip *chip, unsigned offset, int value)
> +{
> +	return 0;
> +}
> +
> +#define MX27ADS_LCD_GPIO	(6 * 32)
> +
> +static struct regulator_consumer_supply mx27ads_lcd_regulator_consumer =
> +	REGULATOR_SUPPLY("lcd", "imx-fb.0");
> +
> +static struct regulator_init_data mx27ads_lcd_regulator_init_data = {
> +	.constraints	= {
> +		.valid_ops_mask	= REGULATOR_CHANGE_STATUS,
> +},
> +	.consumer_supplies	= &mx27ads_lcd_regulator_consumer,
> +	.num_consumer_supplies	= 1,
> +};
> +
> +static struct fixed_voltage_config mx27ads_lcd_regulator_pdata = {
> +	.supply_name	= "LCD",
> +	.microvolts	= 3300000,
> +	.gpio		= MX27ADS_LCD_GPIO,
> +	.init_data	= &mx27ads_lcd_regulator_init_data,
> +};
> +
> +static void __init mx27ads_regulator_init(void)
> +{
> +	struct gpio_chip *vchip;
> +
> +	vchip = kzalloc(sizeof(*vchip), GFP_KERNEL);
> +	vchip->owner		= THIS_MODULE;
> +	vchip->label		= "LCD";
> +	vchip->base		= MX27ADS_LCD_GPIO;
> +	vchip->ngpio		= 1;
> +	vchip->direction_output	= vgpio_dir_out;
> +	vchip->set		= vgpio_set;
> +	gpiochip_add(vchip);
> +
> +	platform_device_register_data(&platform_bus, "reg-fixed-voltage",
> +				      PLATFORM_DEVID_AUTO,
> +				      &mx27ads_lcd_regulator_pdata,
> +				      sizeof(mx27ads_lcd_regulator_pdata));
> +}
> +

Hmm, isn't all this something that should be in the board's .dts?

 Tomi



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

WARNING: multiple messages have this Message-ID (diff)
From: tomi.valkeinen@ti.com (Tomi Valkeinen)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] video: imxfb: Use regulator API with LCD class for powering
Date: Mon, 10 Feb 2014 14:05:37 +0200	[thread overview]
Message-ID: <52F8C091.50704@ti.com> (raw)
In-Reply-To: <1387624080-15312-1-git-send-email-shc_work@mail.ru>

On 21/12/13 13:08, Alexander Shiyan wrote:
> This patch replaces custom lcd_power() callback with
> regulator API over LCD class.
> 
> Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
> ---
>  .../devicetree/bindings/video/fsl,imx-fb.txt       |  1 +
>  arch/arm/mach-imx/mach-mx27ads.c                   | 55 +++++++++++++++--
>  drivers/video/imxfb.c                              | 71 +++++++++++++++++++---
>  include/linux/platform_data/video-imxfb.h          |  1 -
>  4 files changed, 114 insertions(+), 14 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/video/fsl,imx-fb.txt b/Documentation/devicetree/bindings/video/fsl,imx-fb.txt
> index 46da08d..e6b1ee9 100644
> --- a/Documentation/devicetree/bindings/video/fsl,imx-fb.txt
> +++ b/Documentation/devicetree/bindings/video/fsl,imx-fb.txt
> @@ -15,6 +15,7 @@ Required nodes:
>  	- fsl,pcr: LCDC PCR value
>  
>  Optional properties:
> +- lcd-supply: Regulator for LCD supply voltage.
>  - fsl,dmacr: DMA Control Register value. This is optional. By default, the
>  	register is not modified as recommended by the datasheet.
>  - fsl,lscr1: LCDC Sharp Configuration Register value.
> diff --git a/arch/arm/mach-imx/mach-mx27ads.c b/arch/arm/mach-imx/mach-mx27ads.c
> index 9821b824..a7a4a9c 100644
> --- a/arch/arm/mach-imx/mach-mx27ads.c
> +++ b/arch/arm/mach-imx/mach-mx27ads.c
> @@ -21,6 +21,10 @@
>  #include <linux/mtd/physmap.h>
>  #include <linux/i2c.h>
>  #include <linux/irq.h>
> +
> +#include <linux/regulator/fixed.h>
> +#include <linux/regulator/machine.h>
> +
>  #include <asm/mach-types.h>
>  #include <asm/mach/arch.h>
>  #include <asm/mach/time.h>
> @@ -195,14 +199,58 @@ static const struct imxi2c_platform_data mx27ads_i2c1_data __initconst = {
>  static struct i2c_board_info mx27ads_i2c_devices[] = {
>  };
>  
> -void lcd_power(int on)
> +static void vgpio_set(struct gpio_chip *chip, unsigned offset, int value)
>  {
> -	if (on)
> +	if (value)
>  		__raw_writew(PBC_BCTRL1_LCDON, PBC_BCTRL1_SET_REG);
>  	else
>  		__raw_writew(PBC_BCTRL1_LCDON, PBC_BCTRL1_CLEAR_REG);
>  }
>  
> +static int vgpio_dir_out(struct gpio_chip *chip, unsigned offset, int value)
> +{
> +	return 0;
> +}
> +
> +#define MX27ADS_LCD_GPIO	(6 * 32)
> +
> +static struct regulator_consumer_supply mx27ads_lcd_regulator_consumer =
> +	REGULATOR_SUPPLY("lcd", "imx-fb.0");
> +
> +static struct regulator_init_data mx27ads_lcd_regulator_init_data = {
> +	.constraints	= {
> +		.valid_ops_mask	= REGULATOR_CHANGE_STATUS,
> +},
> +	.consumer_supplies	= &mx27ads_lcd_regulator_consumer,
> +	.num_consumer_supplies	= 1,
> +};
> +
> +static struct fixed_voltage_config mx27ads_lcd_regulator_pdata = {
> +	.supply_name	= "LCD",
> +	.microvolts	= 3300000,
> +	.gpio		= MX27ADS_LCD_GPIO,
> +	.init_data	= &mx27ads_lcd_regulator_init_data,
> +};
> +
> +static void __init mx27ads_regulator_init(void)
> +{
> +	struct gpio_chip *vchip;
> +
> +	vchip = kzalloc(sizeof(*vchip), GFP_KERNEL);
> +	vchip->owner		= THIS_MODULE;
> +	vchip->label		= "LCD";
> +	vchip->base		= MX27ADS_LCD_GPIO;
> +	vchip->ngpio		= 1;
> +	vchip->direction_output	= vgpio_dir_out;
> +	vchip->set		= vgpio_set;
> +	gpiochip_add(vchip);
> +
> +	platform_device_register_data(&platform_bus, "reg-fixed-voltage",
> +				      PLATFORM_DEVID_AUTO,
> +				      &mx27ads_lcd_regulator_pdata,
> +				      sizeof(mx27ads_lcd_regulator_pdata));
> +}
> +

Hmm, isn't all this something that should be in the board's .dts?

 Tomi


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 901 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140210/7e251ede/attachment.sig>

  parent reply	other threads:[~2014-02-10 12:05 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-21 11:08 [PATCH] video: imxfb: Use regulator API with LCD class for powering Alexander Shiyan
2013-12-21 11:08 ` Alexander Shiyan
2013-12-23  8:21 ` Shawn Guo
2013-12-23  8:21   ` Shawn Guo
2013-12-23  8:24   ` [PATCH] video: imxfb: Use regulator API w =?UTF-8?B?aXRoIExDRCBjbGFzc Alexander Shiyan
2013-12-23  8:24     ` [PATCH] video: imxfb: Use regulator API with LCD class for powering Alexander Shiyan
2013-12-23  8:28     ` Shawn Guo
2013-12-23  8:28       ` Shawn Guo
2014-01-08 13:32       ` Tomi Valkeinen
2014-01-08 13:32         ` Tomi Valkeinen
2014-01-08 14:45         ` Shawn Guo
2014-01-08 14:45           ` Shawn Guo
2014-02-10 12:05 ` Tomi Valkeinen [this message]
2014-02-10 12:05   ` Tomi Valkeinen
2014-02-10 12:16   ` [PATCH] video: imxfb: Use regulator API w =?UTF-8?B?aXRoIExDRCBjbGFzc Alexander Shiyan
2014-02-10 12:16     ` [PATCH] video: imxfb: Use regulator API with LCD class for powering Alexander Shiyan
2014-02-10 12:21     ` Tomi Valkeinen
2014-02-10 12:21       ` Tomi Valkeinen
2014-02-11  2:43       ` Shawn Guo
2014-02-11  2:43         ` Shawn Guo
2014-02-11 13:11         ` Tomi Valkeinen
2014-02-11 13:11           ` Tomi Valkeinen
2014-02-11 16:21           ` [PATCH] video: imxfb: Use regulator API w =?UTF-8?B?aXRoIExDRCBjbGFzc Alexander Shiyan
2014-02-11 16:21             ` [PATCH] video: imxfb: Use regulator API with LCD class for powering Alexander Shiyan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52F8C091.50704@ti.com \
    --to=tomi.valkeinen@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.