lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-id: <33110366.44811353978636788.JavaMail.weblogic@epv6ml07>
Date:	Tue, 27 Nov 2012 01:10:37 +0000 (GMT)
From:	Jingoo Han <jg1.han@...sung.com>
To:	Laurent Pinchart <laurent.pinchart+renesas@...asonboard.com>
Cc:	akpm@...ux-foundation.org, linux-kernel@...r.kernel.org,
	"linux-sh@...r.kernel.org" <linux-sh@...r.kernel.org>,
	"linux-fbdev@...r.kernel.org" <linux-fbdev@...r.kernel.org>,
	Paul Mundt <lethal@...ux-sh.org>,
	Magnus Damm <magnus.damm@...il.com>,
	Richard Purdie <rpurdie@...ys.net>,
	Kuninori Morimoto <kuninori.morimoto.gx@...esas.com>,
	Jingoo Han <jg1.han@...sung.com>
Subject: Re: [PATCH 1/5] backlight: Add GPIO-based backlight driver

On Saturday, November 24, 2012 1:35 AM, Laurent Pinchart wrote
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@...asonboard.com>
> ---
>  drivers/video/backlight/Kconfig          |    7 ++
>  drivers/video/backlight/Makefile         |    1 +
>  drivers/video/backlight/gpio_backlight.c |  158 ++++++++++++++++++++++++++++++
>  include/video/gpio_backlight.h           |   21 ++++
>  4 files changed, 187 insertions(+), 0 deletions(-)
>  create mode 100644 drivers/video/backlight/gpio_backlight.c
>  create mode 100644 include/video/gpio_backlight.h

[...]

> +static int __devinit gpio_backlight_probe(struct platform_device *pdev)
> +{
> +	struct gpio_backlight_platform_data *pdata = pdev->dev.platform_data;
> +	struct backlight_properties props;
> +	struct backlight_device *bl;
> +	struct gpio_backlight *gbl;
> +	int ret;
> +
> +	gbl = devm_kzalloc(&pdev->dev, sizeof(*gbl), GFP_KERNEL);
> +	if (gbl == NULL)
> +		return -ENOMEM;
> +
> +	gbl->dev = &pdev->dev;
> +
> +	if (!pdata) {
> +		dev_err(&pdev->dev, "failed to find platform data\n");
> +		return -ENODEV;
> +	}
> +
> +	gbl->fbdev = pdata->fbdev;
> +	gbl->gpio = pdata->gpio;
> +	gbl->active = pdata->active_low ? 0 : 1;
> +
> +	ret = devm_gpio_request_one(gbl->dev, gbl->gpio, GPIOF_DIR_OUT,
> +				    pdata->name);

Please use GPIOF_INIT flags if you want to turn off GPIO backlight.
If gbl->active is inverted, GPIOF_INIT_HIGH can be used as below:

	ret = devm_gpio_request_one(gbl->dev, gbl->gpio,
				    GPIOF_DIR_OUT | (gbl->active ?
				    GPIOF_INIT_LOW : GPIOF_INIT_HIGH),
				    pdata->name);

Best regards,
Jingoo Han

> +	if (ret < 0) {
> +		dev_err(&pdev->dev, "unable to request GPIO\n");
> +		return ret;
> +	}
> +
> +	memset(&props, 0, sizeof(props));
> +	props.type = BACKLIGHT_RAW;
> +	props.max_brightness = 1;
> +	bl = backlight_device_register(dev_name(&pdev->dev), &pdev->dev, gbl,
> +				       &gpio_backlight_ops, &props);
> +	if (IS_ERR(bl)) {
> +		dev_err(&pdev->dev, "failed to register backlight\n");
> +		return PTR_ERR(bl);
> +	}
> +
> +	bl->props.brightness = pdata->def_value;
> +	backlight_update_status(bl);
> +
> +	platform_set_drvdata(pdev, bl);
> +	return 0;
> +}


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ