* [PATCH 00/12] dmaengine: remove users of device_control
From: Vinod Koul @ 2014-10-11 15:51 UTC (permalink / raw)
To: dmaengine
Cc: Vinod Koul, Viresh Kumar, Tejun Heo, Linus Walleij, Dan Williams,
Guennadi Liakhovetski, Mauro Carvalho Chehab, David Woodhouse,
Brian Norris, Nicolas Ferre, Mark Brown, Greg Kroah-Hartman,
Jiri Slaby, Felipe Balbi, Jean-Christophe Plagniol-Villard,
Tomi Valkeinen, Liam Girdwood, Jaroslav Kysela, Takashi Iwai,
Jingoo Han, Bartlomiej Zolnierkiewicz, Laurent Pinchart
The recent discussion [1] on the API have resulted in moving away from
device_control ioctl method to proper channel APIs.
There are still few users on the device_control which should use the wrappers
existing rather than access device_control.
This will aid us in deprecating and removing device_control, possibly after
the merge window.
These can be merged thru respective subsystem tree or dmaengine tree. Either
way please just let me know.
Feng's kbuild has tested these as well [2]
[1]: http://www.spinics.net/lists/dmaengine/msg02212.html
[2]: http://git.infradead.org/users/vkoul/slave-dma.git/shortlog/refs/heads/topic/dma_control_cleanup
Vinod Koul (12):
pata_arasan_cf: use dmaengine_terminate_all() API
dmaengine: coh901318: use dmaengine_terminate_all() API
[media] V4L2: mx3_camer: use dmaengine_pause() API
mtd: fsmc_nand: use dmaengine_terminate_all() API
mtd: sh_flctl: use dmaengine_terminate_all() API
net: ks8842: use dmaengine_terminate_all() API
spi/atmel: use dmaengine_terminate_all() API
spi/spi-dw-mid.c: use dmaengine_slave_config() API
serial: sh-sci: use dmaengine_terminate_all() API
usb: musb: ux500_dma: use dmaengine_xxx() APIs
ASoC: txx9: use dmaengine_terminate_all() API
video: mx3fb: use dmaengine_terminate_all() API
drivers/ata/pata_arasan_cf.c | 5 ++---
drivers/dma/coh901318.c | 2 +-
drivers/media/platform/soc_camera/mx3_camera.c | 6 ++----
drivers/mtd/nand/fsmc_nand.c | 2 +-
drivers/mtd/nand/sh_flctl.c | 2 +-
drivers/net/ethernet/micrel/ks8842.c | 6 ++----
drivers/spi/spi-atmel.c | 6 ++----
drivers/spi/spi-dw-mid.c | 6 ++----
drivers/tty/serial/sh-sci.c | 2 +-
drivers/usb/musb/ux500_dma.c | 7 ++-----
drivers/video/fbdev/mx3fb.c | 3 +--
sound/soc/txx9/txx9aclc.c | 7 +++----
12 files changed, 20 insertions(+), 34 deletions(-)
^ permalink raw reply
* Re: [PATCH 2/2] backlight: pwm: clean up pwm requested using legacy API
From: Greg KH @ 2014-10-11 14:21 UTC (permalink / raw)
To: Vladimir Zapolskiy
Cc: linux-fbdev, linux-pwm, Thierry Reding, Jingoo Han, Bryan Wu,
Lee Jones, stable
In-Reply-To: <1413035186-11771-3-git-send-email-vladimir_zapolskiy@mentor.com>
On Sat, Oct 11, 2014 at 04:46:26PM +0300, Vladimir Zapolskiy wrote:
> If PWM device is requested by means of legacy API pwm_request(), its
> resources are not freed on module unbind, which may cause an oops on
> access, e.g. by reading /sys/kernel/debug/pwm.
>
> Reported-by: Dmitry Eremin-Solenikov <dmitry_eremin@mentor.com>
> Signed-off-by: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
> ---
> drivers/video/backlight/pwm_bl.c | 4 ++++
> 1 file changed, 4 insertions(+)
<formletter>
This is not the correct way to submit patches for inclusion in the
stable kernel tree. Please read Documentation/stable_kernel_rules.txt
for how to do this properly.
</formletter>
^ permalink raw reply
* Re: [PATCH 1/2] backlight: pwm: don't call legacy pwm request for device defined in dt
From: Greg KH @ 2014-10-11 14:21 UTC (permalink / raw)
To: Vladimir Zapolskiy
Cc: linux-fbdev, linux-pwm, Thierry Reding, Jingoo Han, Bryan Wu,
Lee Jones, stable
In-Reply-To: <1413035186-11771-2-git-send-email-vladimir_zapolskiy@mentor.com>
On Sat, Oct 11, 2014 at 04:46:25PM +0300, Vladimir Zapolskiy wrote:
> Platform PWM backlight data provided by board's device tree should be
> complete enough to successfully request a pwm device using pwm_get() API.
>
> Based on initial implementation done by Dmitry Eremin-Solenikov.
>
> Reported-by: Dmitry Eremin-Solenikov <dmitry_eremin@mentor.com>
> Signed-off-by: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
> Cc: Thierry Reding <thierry.reding@gmail.com>
> Cc: Jingoo Han <jg1.han@samsung.com>
> Cc: Bryan Wu <cooloney@gmail.com>
> Cc: Lee Jones <lee.jones@linaro.org>
> ---
> drivers/video/backlight/pwm_bl.c | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
<formletter>
This is not the correct way to submit patches for inclusion in the
stable kernel tree. Please read Documentation/stable_kernel_rules.txt
for how to do this properly.
</formletter>
^ permalink raw reply
* [PATCH 2/2] backlight: pwm: clean up pwm requested using legacy API
From: Vladimir Zapolskiy @ 2014-10-11 13:46 UTC (permalink / raw)
To: linux-fbdev, linux-pwm
Cc: Thierry Reding, Jingoo Han, Bryan Wu, Lee Jones, stable
In-Reply-To: <1413035186-11771-1-git-send-email-vladimir_zapolskiy@mentor.com>
If PWM device is requested by means of legacy API pwm_request(), its
resources are not freed on module unbind, which may cause an oops on
access, e.g. by reading /sys/kernel/debug/pwm.
Reported-by: Dmitry Eremin-Solenikov <dmitry_eremin@mentor.com>
Signed-off-by: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
---
drivers/video/backlight/pwm_bl.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
index dd7aaf7..40770dd 100644
--- a/drivers/video/backlight/pwm_bl.c
+++ b/drivers/video/backlight/pwm_bl.c
@@ -34,6 +34,7 @@ struct pwm_bl_data {
struct regulator *power_supply;
struct gpio_desc *enable_gpio;
unsigned int scale;
+ bool legacy;
int (*notify)(struct device *,
int brightness);
void (*notify_after)(struct device *,
@@ -274,6 +275,7 @@ static int pwm_backlight_probe(struct platform_device *pdev)
pb->pwm = devm_pwm_get(&pdev->dev, NULL);
if (IS_ERR(pb->pwm) && !pdev->dev.of_node) {
dev_err(&pdev->dev, "unable to request PWM, trying legacy API\n");
+ pb->legacy = true;
pb->pwm = pwm_request(data->pwm_id, "pwm-backlight");
}
@@ -339,6 +341,8 @@ static int pwm_backlight_remove(struct platform_device *pdev)
if (pb->exit)
pb->exit(&pdev->dev);
+ if (pb->legacy)
+ pwm_free(pb->pwm);
return 0;
}
--
1.7.10.4
^ permalink raw reply related
* [PATCH 1/2] backlight: pwm: don't call legacy pwm request for device defined in dt
From: Vladimir Zapolskiy @ 2014-10-11 13:46 UTC (permalink / raw)
To: linux-fbdev, linux-pwm
Cc: Thierry Reding, Jingoo Han, Bryan Wu, Lee Jones, stable
In-Reply-To: <1413035186-11771-1-git-send-email-vladimir_zapolskiy@mentor.com>
Platform PWM backlight data provided by board's device tree should be
complete enough to successfully request a pwm device using pwm_get() API.
Based on initial implementation done by Dmitry Eremin-Solenikov.
Reported-by: Dmitry Eremin-Solenikov <dmitry_eremin@mentor.com>
Signed-off-by: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Jingoo Han <jg1.han@samsung.com>
Cc: Bryan Wu <cooloney@gmail.com>
Cc: Lee Jones <lee.jones@linaro.org>
---
drivers/video/backlight/pwm_bl.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
index cb5ae4c..dd7aaf7 100644
--- a/drivers/video/backlight/pwm_bl.c
+++ b/drivers/video/backlight/pwm_bl.c
@@ -272,15 +272,15 @@ static int pwm_backlight_probe(struct platform_device *pdev)
}
pb->pwm = devm_pwm_get(&pdev->dev, NULL);
- if (IS_ERR(pb->pwm)) {
+ if (IS_ERR(pb->pwm) && !pdev->dev.of_node) {
dev_err(&pdev->dev, "unable to request PWM, trying legacy API\n");
-
pb->pwm = pwm_request(data->pwm_id, "pwm-backlight");
- if (IS_ERR(pb->pwm)) {
- dev_err(&pdev->dev, "unable to request legacy PWM\n");
- ret = PTR_ERR(pb->pwm);
- goto err_alloc;
- }
+ }
+
+ if (IS_ERR(pb->pwm)) {
+ dev_err(&pdev->dev, "unable to request PWM\n");
+ ret = PTR_ERR(pb->pwm);
+ goto err_alloc;
}
dev_dbg(&pdev->dev, "got pwm for backlight\n");
--
1.7.10.4
^ permalink raw reply related
* [PATCH 0/2] backlight: pwm: fix oops on accessing removed legacy pwm device
From: Vladimir Zapolskiy @ 2014-10-11 13:46 UTC (permalink / raw)
To: linux-fbdev, linux-pwm
Cc: Thierry Reding, Jingoo Han, Bryan Wu, Lee Jones, stable
The changeset fixes an oops, if pwm device was allocated by calling
legacy API and not deregistered appropriately on removal:
% dmesg | grep -i pwm
pwm-backlight backlight.19: unable to request PWM, trying legacy API
% rmmod pwm_bl
% cat /sys/kernel/debug/pwm
Unable to handle kernel paging request at virtual address 7f0c18cc
pgd = ace18000
[7f0c18cc] *pgd<5eb811, *pte\0000000, *ppte\0000000
Internal error: Oops: 7 [#1] PREEMPT SMP ARM
......
Vladimir Zapolskiy (2):
backlight: pwm: don't call legacy pwm request for device defined in dt
backlight: pwm: clean up pwm requested using legacy API
drivers/video/backlight/pwm_bl.c | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
--
1.7.10.4
^ permalink raw reply
* [PATCH] fbcon: Fix option parsing control flow in fb_console_setup
From: Maarten ter Huurne @ 2014-10-09 9:48 UTC (permalink / raw)
To: Tomi Valkeinen, Jean-Christophe Plagniol-Villard
Cc: linux-fbdev, linux-kernel, Paul Cercueil, Maarten ter Huurne
Since strsep is used to tokenize the options string, after each option
match the code should use "continue" to get the next token from strsep.
This patch applies this pattern consistently.
Previously, for "scrollback:" and "map:" the parse code would return
(unconditionally: strsep ensures *options != ','), causing any
following option to be ignored, while for "vc:" the parse code would
go on to parse further options within the same token, which could lead
to invalid input being accepted.
Signed-off-by: Maarten ter Huurne <maarten@treewalker.org>
Acked-by: Paul Cercueil <paul@crapouillou.net>
---
drivers/video/console/fbcon.c | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c
index 57b1d44..eb976ee 100644
--- a/drivers/video/console/fbcon.c
+++ b/drivers/video/console/fbcon.c
@@ -448,8 +448,10 @@ static int __init fb_console_setup(char *this_opt)
return 1;
while ((options = strsep(&this_opt, ",")) != NULL) {
- if (!strncmp(options, "font:", 5))
+ if (!strncmp(options, "font:", 5)) {
strlcpy(fontname, options + 5, sizeof(fontname));
+ continue;
+ }
if (!strncmp(options, "scrollback:", 11)) {
options += 11;
@@ -457,13 +459,9 @@ static int __init fb_console_setup(char *this_opt)
fbcon_softback_size = simple_strtoul(options, &options, 0);
if (*options = 'k' || *options = 'K') {
fbcon_softback_size *= 1024;
- options++;
}
- if (*options != ',')
- return 1;
- options++;
- } else
- return 1;
+ }
+ continue;
}
if (!strncmp(options, "map:", 4)) {
@@ -478,8 +476,7 @@ static int __init fb_console_setup(char *this_opt)
fbcon_map_override();
}
-
- return 1;
+ continue;
}
if (!strncmp(options, "vc:", 3)) {
@@ -491,7 +488,8 @@ static int __init fb_console_setup(char *this_opt)
if (*options++ = '-')
last_fb_vc = simple_strtoul(options, &options, 10) - 1;
fbcon_is_default = 0;
- }
+ continue;
+ }
if (!strncmp(options, "rotate:", 7)) {
options += 7;
@@ -499,6 +497,7 @@ static int __init fb_console_setup(char *this_opt)
initial_rotation = simple_strtoul(options, &options, 0);
if (initial_rotation > 3)
initial_rotation = 0;
+ continue;
}
}
return 1;
--
1.8.4.5
^ permalink raw reply related
* Re: [PATCH] fonts: Add 6x10 font
From: Tomi Valkeinen @ 2014-10-09 9:02 UTC (permalink / raw)
To: Maarten ter Huurne
Cc: Jean-Christophe Plagniol-Villard, Geert Uytterhoeven,
Apelete Seketeli, linux-fbdev, linux-kernel
In-Reply-To: <2514574.0C4va8fPM6@hyperion>
[-- Attachment #1: Type: text/plain, Size: 1778 bytes --]
On 08/10/14 10:25, Maarten ter Huurne wrote:
> On Tuesday 30 September 2014 12:41:46 Tomi Valkeinen wrote:
>> Hi,
>>
>> On 09/09/14 14:46, Maarten ter Huurne wrote:
>>> This font is suitable for framebuffer consoles on devices with a
>>> 320x240 screen, to get a reasonable number of characters (53x24) that
>>> are still at a readable size.
>>>
>>> The font is derived from the existing 6x11 font, but gets 3 extra
>>> lines without sacrificing readability. Also I redesigned a some glyhps
>>> so they are more distinct and better fill the available space.
>>>
>>> Signed-off-by: Maarten ter Huurne <maarten@treewalker.org>
>>> ---
>>>
>>> include/linux/font.h | 4 +-
>>> lib/fonts/Kconfig | 9 +
>>> lib/fonts/Makefile | 1 +
>>> lib/fonts/font_6x10.c | 3086
>>> +++++++++++++++++++++++++++++++++++++++++++++++++ lib/fonts/fonts.c
>>> | 4 +
>>> 5 files changed, 3103 insertions(+), 1 deletion(-)
>>> create mode 100644 lib/fonts/font_6x10.c
>>
>> I think the patch is fine, but there hasn't been any comments or acks
>> for this. I'm a bit reluctant to add this much data to the kernel if
>> there are no users (except you) for this.
>
> Are you counting end users, developers or projects? We've got at least
> several thousand end users in OpenDingux for Dingoo A320 and GCW Zero
> combined. I could ask a few fellow developers for signed-off-by lines, if
> that helps. But it's all from the same project.
>
> I think the font fills a space that is currently unoccupied: the 4x6 font is
> space efficient but barely readable, the 8x8 font gets only 40 columns on
> 320x240 and the 6x11 font doesn't use the vertical space efficiently.
Ok, sounds good enough for me. Queueing for 3.18.
Tomi
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply
* Re: [PATCH] pwm-backlight: Turn off pwm backlight in probe
From: Thierry Reding @ 2014-10-08 12:13 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <001601cfe2dc$6e964ca0$4bc2e5e0$%han@samsung.com>
[-- Attachment #1: Type: text/plain, Size: 2980 bytes --]
On Wed, Oct 08, 2014 at 06:44:19PM +0900, Jingoo Han wrote:
> On Tuesday, October 07, 2014 5:36 PM, Thierry Reding wrote:
> > On Mon, Oct 06, 2014 at 09:22:44PM +0200, Markus Pargmann wrote:
> > > The backlight will be enabled by the panel again if it is used. So we
> > > can save the default brightness and disable the pwm backlight when
> > > probing.
> > >
> > > Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
> > > ---
> > > drivers/video/backlight/pwm_bl.c | 4 +++-
> > > 1 file changed, 3 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
> > > index 336b83be7e2d..b4f433a6f106 100644
> > > --- a/drivers/video/backlight/pwm_bl.c
> > > +++ b/drivers/video/backlight/pwm_bl.c
> > > @@ -317,9 +317,11 @@ static int pwm_backlight_probe(struct platform_device *pdev)
> > > data->dft_brightness = data->max_brightness;
> > > }
> > >
> > > - bl->props.brightness = data->dft_brightness;
> > > + bl->props.brightness = 0;
> > > backlight_update_status(bl);
> > >
> > > + bl->props.brightness = data->dft_brightness;
> > > +
> > > platform_set_drvdata(pdev, bl);
> > > return 0;
> > >
> >
> > It would be nice if it was that easy. But we can't do this, because it
> > will regress for users of this driver that don't use a panel or DRM. If
> > the PWM backlight driver is used for example in conjunction with a plain
> > fbdev driver it isn't necessarily hooked up with anything and won't be
> > enabled automatically. That's really bad if fbdev is the only output you
> > have since you'd have to blindly type the commands to enable the
> > backlight. Furthermore disabling backlight isn't always what you want to
> > do. For example if the bootloader already turned it on and you hand over
> > from bootloader to kernel in a seamless way, then you absolutely want to
> > keep backlight on all the time.
> >
> > See also[0] for a different proposal to solve the same problem. Back at
> > the time that received only a very few replies, but it would be nice if
> > Lee and Bryan could look at it again and see if we can come up with some
> > way to deal with this situation.
>
> (+cc Ajay Kumar)
>
> As I said earlier, I agree with this proposal.
I'm not sure which proposal exactly. I originally proposed adding a
backlight-boot-off property, but that received some pushback from DT
people because it isn't strictly hardware information but configuration
data.
Perhaps a better solution would be to default to not touching the
backlight status on probe at all. But we can't do that for non-DT
because of backwards-compatibility. For DT it seems like all users have
some form of DRM/KMS driver too, so I'd expect them to turn it off when
appropriate.
Should we just go and make that change (no changing backlight state for
DT) and see if anybody complains? If so, I'll gladly prepare a patch to
do just that.
Thierry
[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply
* Re: [PATCH] pwm-backlight: Turn off pwm backlight in probe
From: Markus Pargmann @ 2014-10-08 9:55 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <CAEC9eQNhFE9=0ycbOyf6BzKTyvdGh9EGSCJqDiF7oTtvDWgTTw@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 3105 bytes --]
On Tue, Oct 07, 2014 at 02:47:53PM +0530, Ajay kumar wrote:
> On Tue, Oct 7, 2014 at 2:37 PM, Markus Pargmann <mpa@pengutronix.de> wrote:
> > Hi,
> >
> > On Tue, Oct 07, 2014 at 10:35:49AM +0200, Thierry Reding wrote:
> >> On Mon, Oct 06, 2014 at 09:22:44PM +0200, Markus Pargmann wrote:
> >> > The backlight will be enabled by the panel again if it is used. So we
> >> > can save the default brightness and disable the pwm backlight when
> >> > probing.
> >> >
> >> > Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
> >> > ---
> >> > drivers/video/backlight/pwm_bl.c | 4 +++-
> >> > 1 file changed, 3 insertions(+), 1 deletion(-)
> >> >
> >> > diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
> >> > index 336b83be7e2d..b4f433a6f106 100644
> >> > --- a/drivers/video/backlight/pwm_bl.c
> >> > +++ b/drivers/video/backlight/pwm_bl.c
> >> > @@ -317,9 +317,11 @@ static int pwm_backlight_probe(struct platform_device *pdev)
> >> > data->dft_brightness = data->max_brightness;
> >> > }
> >> >
> >> > - bl->props.brightness = data->dft_brightness;
> >> > + bl->props.brightness = 0;
> >> > backlight_update_status(bl);
> >> >
> >> > + bl->props.brightness = data->dft_brightness;
> >> > +
> >> > platform_set_drvdata(pdev, bl);
> >> > return 0;
> >> >
> >>
> >> It would be nice if it was that easy. But we can't do this, because it
> >> will regress for users of this driver that don't use a panel or DRM. If
> >> the PWM backlight driver is used for example in conjunction with a plain
> >> fbdev driver it isn't necessarily hooked up with anything and won't be
> >> enabled automatically. That's really bad if fbdev is the only output you
> >> have since you'd have to blindly type the commands to enable the
> >> backlight. Furthermore disabling backlight isn't always what you want to
> >> do. For example if the bootloader already turned it on and you hand over
> >> from bootloader to kernel in a seamless way, then you absolutely want to
> >> keep backlight on all the time.
> >>
> >> See also[0] for a different proposal to solve the same problem. Back at
> >> the time that received only a very few replies, but it would be nice if
> >> Lee and Bryan could look at it again and see if we can come up with some
> >> way to deal with this situation.
> >
> > Yes your proposal looks a lot better to handle the different use cases.
> > The DT-binding is not a hardware description but I don't see any better
> > way of passing that information. So it would be good to get your
> > solution mainline.
> +1
> And, I have already tested Thierry's proposal on Exynos5800 peach_pi.
I also tested Thierry's patch on i.MX6s now and it works fine.
Regards,
Markus
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply
* Re: [PATCH] pwm-backlight: Turn off pwm backlight in probe
From: Jingoo Han @ 2014-10-08 9:44 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <20141007083548.GD24254@ulmo>
On Tuesday, October 07, 2014 5:36 PM, Thierry Reding wrote:
> On Mon, Oct 06, 2014 at 09:22:44PM +0200, Markus Pargmann wrote:
> > The backlight will be enabled by the panel again if it is used. So we
> > can save the default brightness and disable the pwm backlight when
> > probing.
> >
> > Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
> > ---
> > drivers/video/backlight/pwm_bl.c | 4 +++-
> > 1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
> > index 336b83be7e2d..b4f433a6f106 100644
> > --- a/drivers/video/backlight/pwm_bl.c
> > +++ b/drivers/video/backlight/pwm_bl.c
> > @@ -317,9 +317,11 @@ static int pwm_backlight_probe(struct platform_device *pdev)
> > data->dft_brightness = data->max_brightness;
> > }
> >
> > - bl->props.brightness = data->dft_brightness;
> > + bl->props.brightness = 0;
> > backlight_update_status(bl);
> >
> > + bl->props.brightness = data->dft_brightness;
> > +
> > platform_set_drvdata(pdev, bl);
> > return 0;
> >
>
> It would be nice if it was that easy. But we can't do this, because it
> will regress for users of this driver that don't use a panel or DRM. If
> the PWM backlight driver is used for example in conjunction with a plain
> fbdev driver it isn't necessarily hooked up with anything and won't be
> enabled automatically. That's really bad if fbdev is the only output you
> have since you'd have to blindly type the commands to enable the
> backlight. Furthermore disabling backlight isn't always what you want to
> do. For example if the bootloader already turned it on and you hand over
> from bootloader to kernel in a seamless way, then you absolutely want to
> keep backlight on all the time.
>
> See also[0] for a different proposal to solve the same problem. Back at
> the time that received only a very few replies, but it would be nice if
> Lee and Bryan could look at it again and see if we can come up with some
> way to deal with this situation.
(+cc Ajay Kumar)
As I said earlier, I agree with this proposal.
>
> Thierry
>
> [0]: https://lkml.org/lkml/2014/7/31/259
^ permalink raw reply
* Re: [RESUBMIT PATCH v3 2/8] backlight: Add support Skyworks SKY81452 backlight driver
From: Gyungoh Yoo @ 2014-10-08 8:55 UTC (permalink / raw)
To: Jingoo Han
Cc: 'Bryan Wu', 'Lee Jones',
'Jean-Christophe Plagniol-Villard',
'Tomi Valkeinen', 'Grant Likely',
'Rob Herring', linux-kernel, linux-fbdev, devicetree,
'Gyungoh Yoo '
In-Reply-To: <008e01cfe293$bcd6fe30$3684fa90$%han@samsung.com>
On Wed, Oct 08, 2014 at 10:03:57AM +0900, Jingoo Han wrote:
> On Tuesday, October 07, 2014 2:01 PM, Gyungoh Yoo wrote:
> >
>
> If possible, please add more detailed commit message for this patch.
>
> > Signed-off-by: Gyungoh Yoo <jack.yoo@skyworksinc.com>
> > ---
> > drivers/video/backlight/Kconfig | 10 +
> > drivers/video/backlight/Makefile | 1 +
> > drivers/video/backlight/sky81452-backlight.c | 347 +++++++++++++++++++++++++++
> > 3 files changed, 358 insertions(+)
> > create mode 100644 drivers/video/backlight/sky81452-backlight.c
> >
> > diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
> > index 8d03924..2586fdd 100644
> > --- a/drivers/video/backlight/Kconfig
> > +++ b/drivers/video/backlight/Kconfig
> > @@ -409,6 +409,16 @@ config BACKLIGHT_PANDORA
> > If you have a Pandora console, say Y to enable the
> > backlight driver.
> >
> > +config BACKLIGHT_SKY81452
> > + tristate "Backlight driver for SKY81452"
> > + depends on BACKLIGHT_CLASS_DEVICE && MFD_SKY81452
> > + help
> > + If you have a Skyworks SKY81452, say Y to enable the
> > + backlight driver.
> > +
> > + To compile this driver as a module, choose M here: the module will
> > + be called sky81452-backlight
> > +
> > config BACKLIGHT_TPS65217
> > tristate "TPS65217 Backlight"
> > depends on BACKLIGHT_CLASS_DEVICE && MFD_TPS65217
> > diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile
> > index fcd50b73..d67073f 100644
> > --- a/drivers/video/backlight/Makefile
> > +++ b/drivers/video/backlight/Makefile
> > @@ -50,6 +50,7 @@ obj-$(CONFIG_BACKLIGHT_PANDORA) += pandora_bl.o
> > obj-$(CONFIG_BACKLIGHT_PCF50633) += pcf50633-backlight.o
> > obj-$(CONFIG_BACKLIGHT_PWM) += pwm_bl.o
> > obj-$(CONFIG_BACKLIGHT_SAHARA) += kb3886_bl.o
> > +obj-$(CONFIG_BACKLIGHT_SKY81452) += sky81452-backlight.o
> > obj-$(CONFIG_BACKLIGHT_TOSA) += tosa_bl.o
> > obj-$(CONFIG_BACKLIGHT_TPS65217) += tps65217_bl.o
> > obj-$(CONFIG_BACKLIGHT_WM831X) += wm831x_bl.o
> > diff --git a/drivers/video/backlight/sky81452-backlight.c b/drivers/video/backlight/sky81452-
> > backlight.c
> > new file mode 100644
> > index 0000000..101399d
> > --- /dev/null
> > +++ b/drivers/video/backlight/sky81452-backlight.c
> > @@ -0,0 +1,347 @@
> > +/*
> > + * sky81452-backlight.c SKY81452 backlight driver
> > + *
> > + * Copyright 2014 Skyworks Solutions Inc.
> > + * Author : Gyungoh Yoo <jack.yoo@skyworksinc.com>
> > + *
> > + * This program is free software; you can redistribute it and/or modify it
> > + * under the terms of the GNU General Public License as published by the
> > + * Free Software Foundation; either version 2, or (at your option) any
> > + * later version.
> > + *
> > + * This program is distributed in the hope that it will be useful, but
> > + * WITHOUT ANY WARRANTY; without even the implied warranty of
> > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> > + * General Public License for more details.
> > + *
> > + * You should have received a copy of the GNU General Public License along
> > + * with this program; if not, see <http://www.gnu.org/licenses/>.
> > + */
> > +
> > +#include <linux/kernel.h>
> > +#include <linux/module.h>
> > +#include <linux/init.h>
> > +#include <linux/platform_device.h>
> > +#include <linux/slab.h>
> > +#include <linux/of.h>
> > +#include <linux/err.h>
> > +#include <linux/gpio.h>
> > +#include <linux/of_gpio.h>
> > +#include <linux/regmap.h>
> > +#include <linux/backlight.h>
> > +#include <linux/sky81452-backlight.h>
>
> Please, re-order these headers alphabetically.
> It enhances the readability.
I see.
>
> > +
> > +/* registers */
> > +#define SKY81452_REG0 0x00
> > +#define SKY81452_REG1 0x01
> > +#define SKY81452_REG2 0x02
> > +#define SKY81452_REG4 0x04
> > +#define SKY81452_REG5 0x05
> > +
> > +/* bit mask */
> > +#define SKY81452_CS 0xFF
> > +#define SKY81452_EN 0x3F
> > +#define SKY81452_IGPW 0x20
> > +#define SKY81452_PWMMD 0x10
> > +#define SKY81452_PHASE 0x08
> > +#define SKY81452_ILIM 0x04
> > +#define SKY81452_VSHRT 0x03
> > +#define SKY81452_OCP 0x80
> > +#define SKY81452_OTMP 0x40
> > +#define SKY81452_SHRT 0x3F
> > +#define SKY81452_OPN 0x3F
> > +
> > +#define SKY81452_DEFAULT_NAME "lcd-backlight"
> > +#define SKY81452_MAX_BRIGHTNESS (SKY81452_CS + 1)
> > +
> > +#define CTZ(b) __builtin_ctz(b)
> > +
> > +static int sky81452_bl_update_status(struct backlight_device *bd)
> > +{
> > + const struct sky81452_bl_platform_data *pdata > > + dev_get_platdata(bd->dev.parent);
> > + const unsigned int brightness = (unsigned int)bd->props.brightness;
> > + struct regmap *regmap = bl_get_data(bd);
> > + int ret;
> > +
> > + if (brightness > 0) {
> > + ret = regmap_write(regmap, SKY81452_REG0, brightness - 1);
> > + if (IS_ERR_VALUE(ret))
> > + return ret;
> > +
> > + return regmap_update_bits(regmap, SKY81452_REG1, SKY81452_EN,
> > + pdata->enable << CTZ(SKY81452_EN));
> > + }
> > +
> > + return regmap_update_bits(regmap, SKY81452_REG1, SKY81452_EN, 0);
> > +}
> > +
> > +static int sky81452_bl_get_brightness(struct backlight_device *bd)
> > +{
> > + return bd->props.brightness;
> > +}
> > +
> > +static const struct backlight_ops sky81452_bl_ops = {
> > + .update_status = sky81452_bl_update_status,
> > + .get_brightness = sky81452_bl_get_brightness,
> > +};
> > +
> > +static ssize_t sky81452_bl_store_enable(struct device *dev,
> > + struct device_attribute *attr, const char *buf, size_t count)
> > +{
> > + struct regmap *regmap = bl_get_data(to_backlight_device(dev));
> > + unsigned long value;
> > + int ret;
> > +
> > + ret = kstrtoul(buf, 16, &value);
> > + if (IS_ERR_VALUE(ret))
> > + return ret;
> > +
> > + ret = regmap_update_bits(regmap, SKY81452_REG1, SKY81452_EN,
> > + value << CTZ(SKY81452_EN));
> > + if (IS_ERR_VALUE(ret))
> > + return ret;
> > +
> > + return count;
> > +}
> > +
> > +static ssize_t sky81452_bl_show_open_short(struct device *dev,
> > + struct device_attribute *attr, char *buf)
> > +{
> > + struct regmap *regmap = bl_get_data(to_backlight_device(dev));
> > + unsigned int reg, value = 0;
> > + char tmp[3];
> > + int i, ret;
> > +
> > + reg = !strcmp(attr->attr.name, "open") ? SKY81452_REG5 : SKY81452_REG4;
> > + ret = regmap_read(regmap, reg, &value);
> > + if (IS_ERR_VALUE(ret))
> > + return ret;
> > +
> > + if (value & SKY81452_SHRT) {
> > + *buf = 0;
> > + for (i = 0; i < 6; i++) {
> > + if (value & 0x01) {
> > + sprintf(tmp, "%d ", i + 1);
> > + strcat(buf, tmp);
> > + }
> > + value >>= 1;
> > + }
> > + strcat(buf, "\n");
> > + } else
> > + strcpy(buf, "none\n");
>
> Please add braces to 'else' statement.
>
> If only one branch of a conditional statement is a single
> statement. Braces are needed.
>
> if () {
> ... (multi lines)
> } else {
> ...
> }
I see.
>
>
> > +
> > + return strlen(buf);
> > +}
> > +
> > +static ssize_t sky81452_bl_show_fault(struct device *dev,
> > + struct device_attribute *attr, char *buf)
> > +{
> > + struct regmap *regmap = bl_get_data(to_backlight_device(dev));
> > + unsigned int value = 0;
> > + int ret;
> > +
> > + ret = regmap_read(regmap, SKY81452_REG4, &value);
> > + if (IS_ERR_VALUE(ret))
> > + return ret;
> > +
> > + *buf = 0;
> > +
> > + if (value & SKY81452_OCP)
> > + strcat(buf, "over-current ");
> > +
> > + if (value & SKY81452_OTMP)
> > + strcat(buf, "over-temperature");
> > +
> > + strcat(buf, "\n");
> > + return strlen(buf);
> > +}
> > +
> > +static DEVICE_ATTR(enable, S_IWGRP | S_IWUSR, NULL, sky81452_bl_store_enable);
> > +static DEVICE_ATTR(open, S_IRUGO, sky81452_bl_show_open_short, NULL);
> > +static DEVICE_ATTR(short, S_IRUGO, sky81452_bl_show_open_short, NULL);
> > +static DEVICE_ATTR(fault, S_IRUGO, sky81452_bl_show_fault, NULL);
> > +
> > +static struct attribute *sky81452_bl_attribute[] = {
> > + &dev_attr_enable.attr,
> > + &dev_attr_open.attr,
> > + &dev_attr_short.attr,
> > + &dev_attr_fault.attr,
> > + NULL
> > +};
> > +
> > +static const struct attribute_group sky81452_bl_attr_group = {
> > + .attrs = sky81452_bl_attribute,
> > +};
> > +
> > +#ifdef CONFIG_OF
> > +static struct sky81452_bl_platform_data *sky81452_bl_parse_dt(
> > + struct device *dev)
> > +{
> > + struct device_node *np = of_node_get(dev->of_node);
> > + struct sky81452_bl_platform_data *pdata;
> > + int ret;
> > +
> > + if (!np) {
> > + dev_err(dev, "backlight node not found");
> > + return ERR_PTR(-ENODATA);
> > + }
> > +
> > + pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
> > + if (!pdata) {
> > + of_node_put(np);
> > + return ERR_PTR(-ENOMEM);
> > + }
> > +
> > + of_property_read_string(np, "name", &pdata->name);
> > + pdata->ignore_pwm = of_property_read_bool(np, "ignore-pwm");
> > + pdata->dpwm_mode = of_property_read_bool(np, "dpwm-mode");
> > + pdata->phase_shift = of_property_read_bool(np, "phase-shift");
> > +
> > + pdata->gpio_enable = of_get_named_gpio(np, "gpio-enable", 0);
> > + if (IS_ERR_VALUE(pdata->gpio_enable))
> > + pdata->gpio_enable = -1;
> > +
> > + ret = of_property_read_u32(np, "enable", &pdata->enable);
> > + if (IS_ERR_VALUE(ret))
> > + pdata->enable = SKY81452_EN >> CTZ(SKY81452_EN);
> > +
> > + ret = of_property_read_u32(np, "short-detection-threshold",
> > + &pdata->short_detection_threshold);
> > + if (IS_ERR_VALUE(ret))
> > + pdata->short_detection_threshold = 7;
> > +
> > + ret = of_property_read_u32(np, "boost-current-limit",
> > + &pdata->boost_current_limit);
> > + if (IS_ERR_VALUE(ret))
> > + pdata->boost_current_limit = 2750;
> > +
> > + of_node_put(np);
> > + return pdata;
> > +}
> > +#else
> > +static struct sky81452_bl_platform_data *sky81452_bl_parse_dt(
> > + struct device *dev)
> > +{
> > + return ERR_PTR(-EINVAL);
> > +}
> > +#endif
> > +
> > +static int sky81452_bl_init_device(struct regmap *regmap,
> > + struct sky81452_bl_platform_data *pdata)
> > +{
> > + unsigned int value;
> > +
> > + value = pdata->ignore_pwm ? SKY81452_IGPW : 0;
> > + value |= pdata->dpwm_mode ? SKY81452_PWMMD : 0;
> > + value |= pdata->phase_shift ? 0 : SKY81452_PHASE;
> > +
> > + if (pdata->boost_current_limit = 2300)
> > + value |= SKY81452_ILIM;
> > + else if (pdata->boost_current_limit != 2720)
> > + return -EINVAL;
> > +
> > + if (pdata->short_detection_threshold < 4 ||
> > + pdata->short_detection_threshold > 7)
> > + return -EINVAL;
> > + value |= (7 - pdata->short_detection_threshold) << CTZ(SKY81452_VSHRT);
> > +
> > + return regmap_write(regmap, SKY81452_REG2, value);
> > +}
> > +
> > +static int sky81452_bl_probe(struct platform_device *pdev)
> > +{
> > + struct device *dev = &pdev->dev;
> > + struct regmap *regmap = dev_get_drvdata(dev->parent);
> > + struct sky81452_bl_platform_data *pdata = dev_get_platdata(dev);
> > + struct backlight_device *bd;
> > + struct backlight_properties props;
> > + const char *name;
> > + int ret;
> > +
> > + if (!pdata) {
> > + pdata = sky81452_bl_parse_dt(dev);
> > + if (IS_ERR(pdata))
> > + return PTR_ERR(pdata);
> > + }
> > +
> > + if (pdata->gpio_enable >= 0) {
> > + ret = devm_gpio_request_one(dev, pdata->gpio_enable,
> > + GPIOF_OUT_INIT_HIGH, "sky81452-en");
> > + if (IS_ERR_VALUE(ret)) {
> > + dev_err(dev, "failed to request GPIO. err=%d", ret);
> > + return ret;
> > + }
> > + }
> > +
> > + ret = sky81452_bl_init_device(regmap, pdata);
> > + if (IS_ERR_VALUE(ret)) {
> > + dev_err(dev, "failed to initialize. err=%d", ret);
> > + return ret;
> > + }
> > +
> > + memset(&props, 0, sizeof(props));
> > + props.max_brightness = SKY81452_MAX_BRIGHTNESS,
> > + name = pdata->name ? pdata->name : SKY81452_DEFAULT_NAME;
> > + bd = devm_backlight_device_register(dev, name, dev, regmap,
> > + &sky81452_bl_ops, &props);
> > + if (IS_ERR(bd)) {
> > + dev_err(dev, "failed to register. err=%ld", PTR_ERR(bd));
> > + return PTR_ERR(bd);
> > + }
> > +
> > + platform_set_drvdata(pdev, bd);
> > +
> > + ret = sysfs_create_group(&bd->dev.kobj, &sky81452_bl_attr_group);
> > + if (IS_ERR_VALUE(ret)) {
> > + dev_err(dev, "failed to create attribute. err=%d", ret);
> > + goto err;
> > + }
> > +
> > + return ret;
> > +err:
> > + backlight_device_unregister(bd);
>
> This backlight_device_unregister() is NOT necessary.
> This is because backlight_device_unregister will be called
> automatically, when devm_backlight_device_register() is used
> and error returns.
I see.
>
> > + return ret;
> > +}
> > +
> > +static int sky81452_bl_remove(struct platform_device *pdev)
> > +{
> > + const struct sky81452_bl_platform_data *pdata > > + dev_get_platdata(&pdev->dev);
> > + struct backlight_device *bd = platform_get_drvdata(pdev);
> > +
> > + sysfs_remove_group(&bd->dev.kobj, &sky81452_bl_attr_group);
> > +
> > + bd->props.power = FB_BLANK_UNBLANK;
> > + bd->props.brightness = 0;
> > + backlight_update_status(bd);
> > +
> > + if (pdata->gpio_enable >= 0)
> > + gpio_set_value_cansleep(pdata->gpio_enable, 0);
> > +
> > + return 0;
> > +}
> > +
> > +#ifdef CONFIG_OF
> > +static const struct of_device_id sky81452_bl_of_match[] = {
> > + { .compatible = "skyworks,sky81452-backlight", },
> > + { }
> > +};
> > +MODULE_DEVICE_TABLE(of, sky81452_bl_of_match);
> > +#endif
> > +
> > +static struct platform_driver sky81452_bl_driver = {
> > + .driver = {
> > + .name = "sky81452-backlight",
> > + .of_match_table = of_match_ptr(sky81452_bl_of_match),
> > + },
> > + .probe = sky81452_bl_probe,
> > + .remove = sky81452_bl_remove,
> > +};
> > +
> > +module_platform_driver(sky81452_bl_driver);
> > +
> > +MODULE_DESCRIPTION("Skyworks SKY81452 backlight driver");
> > +MODULE_AUTHOR("Gyungoh Yoo <jack.yoo@skyworksinc.com>");
> > +MODULE_LICENSE("GPL");
>
> How about using 'GPL v2'?
I will change it.
Thanks you so much for your review.
>
> > +MODULE_VERSION("1.2");
> > --
> > 1.9.1
>
^ permalink raw reply
* Re: [PATCH] fonts: Add 6x10 font
From: Maarten ter Huurne @ 2014-10-08 7:25 UTC (permalink / raw)
To: Tomi Valkeinen
Cc: Jean-Christophe Plagniol-Villard, Geert Uytterhoeven,
Apelete Seketeli, linux-fbdev, linux-kernel
In-Reply-To: <542A7ADA.4010500@ti.com>
On Tuesday 30 September 2014 12:41:46 Tomi Valkeinen wrote:
> Hi,
>
> On 09/09/14 14:46, Maarten ter Huurne wrote:
> > This font is suitable for framebuffer consoles on devices with a
> > 320x240 screen, to get a reasonable number of characters (53x24) that
> > are still at a readable size.
> >
> > The font is derived from the existing 6x11 font, but gets 3 extra
> > lines without sacrificing readability. Also I redesigned a some glyhps
> > so they are more distinct and better fill the available space.
> >
> > Signed-off-by: Maarten ter Huurne <maarten@treewalker.org>
> > ---
> >
> > include/linux/font.h | 4 +-
> > lib/fonts/Kconfig | 9 +
> > lib/fonts/Makefile | 1 +
> > lib/fonts/font_6x10.c | 3086
> > +++++++++++++++++++++++++++++++++++++++++++++++++ lib/fonts/fonts.c
> > | 4 +
> > 5 files changed, 3103 insertions(+), 1 deletion(-)
> > create mode 100644 lib/fonts/font_6x10.c
>
> I think the patch is fine, but there hasn't been any comments or acks
> for this. I'm a bit reluctant to add this much data to the kernel if
> there are no users (except you) for this.
Are you counting end users, developers or projects? We've got at least
several thousand end users in OpenDingux for Dingoo A320 and GCW Zero
combined. I could ask a few fellow developers for signed-off-by lines, if
that helps. But it's all from the same project.
I think the font fills a space that is currently unoccupied: the 4x6 font is
space efficient but barely readable, the 8x8 font gets only 40 columns on
320x240 and the 6x11 font doesn't use the vertical space efficiently.
Bye,
Maarten
^ permalink raw reply
* Re: [RESUBMIT PATCH v3 2/8] backlight: Add support Skyworks SKY81452 backlight driver
From: Jingoo Han @ 2014-10-08 1:03 UTC (permalink / raw)
To: 'Gyungoh Yoo'
Cc: 'Bryan Wu', 'Lee Jones',
'Jean-Christophe Plagniol-Villard',
'Tomi Valkeinen', 'Grant Likely',
'Rob Herring', linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-fbdev-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA, 'Gyungoh Yoo ',
'Jingoo Han'
In-Reply-To: <1412658075-7929-1-git-send-email-jack.yoo-tjhQNA90jdKqndwCJWfcng@public.gmane.org>
On Tuesday, October 07, 2014 2:01 PM, Gyungoh Yoo wrote:
>
If possible, please add more detailed commit message for this patch.
> Signed-off-by: Gyungoh Yoo <jack.yoo@skyworksinc.com>
> ---
> drivers/video/backlight/Kconfig | 10 +
> drivers/video/backlight/Makefile | 1 +
> drivers/video/backlight/sky81452-backlight.c | 347 +++++++++++++++++++++++++++
> 3 files changed, 358 insertions(+)
> create mode 100644 drivers/video/backlight/sky81452-backlight.c
>
> diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
> index 8d03924..2586fdd 100644
> --- a/drivers/video/backlight/Kconfig
> +++ b/drivers/video/backlight/Kconfig
> @@ -409,6 +409,16 @@ config BACKLIGHT_PANDORA
> If you have a Pandora console, say Y to enable the
> backlight driver.
>
> +config BACKLIGHT_SKY81452
> + tristate "Backlight driver for SKY81452"
> + depends on BACKLIGHT_CLASS_DEVICE && MFD_SKY81452
> + help
> + If you have a Skyworks SKY81452, say Y to enable the
> + backlight driver.
> +
> + To compile this driver as a module, choose M here: the module will
> + be called sky81452-backlight
> +
> config BACKLIGHT_TPS65217
> tristate "TPS65217 Backlight"
> depends on BACKLIGHT_CLASS_DEVICE && MFD_TPS65217
> diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile
> index fcd50b73..d67073f 100644
> --- a/drivers/video/backlight/Makefile
> +++ b/drivers/video/backlight/Makefile
> @@ -50,6 +50,7 @@ obj-$(CONFIG_BACKLIGHT_PANDORA) += pandora_bl.o
> obj-$(CONFIG_BACKLIGHT_PCF50633) += pcf50633-backlight.o
> obj-$(CONFIG_BACKLIGHT_PWM) += pwm_bl.o
> obj-$(CONFIG_BACKLIGHT_SAHARA) += kb3886_bl.o
> +obj-$(CONFIG_BACKLIGHT_SKY81452) += sky81452-backlight.o
> obj-$(CONFIG_BACKLIGHT_TOSA) += tosa_bl.o
> obj-$(CONFIG_BACKLIGHT_TPS65217) += tps65217_bl.o
> obj-$(CONFIG_BACKLIGHT_WM831X) += wm831x_bl.o
> diff --git a/drivers/video/backlight/sky81452-backlight.c b/drivers/video/backlight/sky81452-
> backlight.c
> new file mode 100644
> index 0000000..101399d
> --- /dev/null
> +++ b/drivers/video/backlight/sky81452-backlight.c
> @@ -0,0 +1,347 @@
> +/*
> + * sky81452-backlight.c SKY81452 backlight driver
> + *
> + * Copyright 2014 Skyworks Solutions Inc.
> + * Author : Gyungoh Yoo <jack.yoo@skyworksinc.com>
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU General Public License as published by the
> + * Free Software Foundation; either version 2, or (at your option) any
> + * later version.
> + *
> + * This program is distributed in the hope that it will be useful, but
> + * WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + * General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License along
> + * with this program; if not, see <http://www.gnu.org/licenses/>.
> + */
> +
> +#include <linux/kernel.h>
> +#include <linux/module.h>
> +#include <linux/init.h>
> +#include <linux/platform_device.h>
> +#include <linux/slab.h>
> +#include <linux/of.h>
> +#include <linux/err.h>
> +#include <linux/gpio.h>
> +#include <linux/of_gpio.h>
> +#include <linux/regmap.h>
> +#include <linux/backlight.h>
> +#include <linux/sky81452-backlight.h>
Please, re-order these headers alphabetically.
It enhances the readability.
> +
> +/* registers */
> +#define SKY81452_REG0 0x00
> +#define SKY81452_REG1 0x01
> +#define SKY81452_REG2 0x02
> +#define SKY81452_REG4 0x04
> +#define SKY81452_REG5 0x05
> +
> +/* bit mask */
> +#define SKY81452_CS 0xFF
> +#define SKY81452_EN 0x3F
> +#define SKY81452_IGPW 0x20
> +#define SKY81452_PWMMD 0x10
> +#define SKY81452_PHASE 0x08
> +#define SKY81452_ILIM 0x04
> +#define SKY81452_VSHRT 0x03
> +#define SKY81452_OCP 0x80
> +#define SKY81452_OTMP 0x40
> +#define SKY81452_SHRT 0x3F
> +#define SKY81452_OPN 0x3F
> +
> +#define SKY81452_DEFAULT_NAME "lcd-backlight"
> +#define SKY81452_MAX_BRIGHTNESS (SKY81452_CS + 1)
> +
> +#define CTZ(b) __builtin_ctz(b)
> +
> +static int sky81452_bl_update_status(struct backlight_device *bd)
> +{
> + const struct sky81452_bl_platform_data *pdata > + dev_get_platdata(bd->dev.parent);
> + const unsigned int brightness = (unsigned int)bd->props.brightness;
> + struct regmap *regmap = bl_get_data(bd);
> + int ret;
> +
> + if (brightness > 0) {
> + ret = regmap_write(regmap, SKY81452_REG0, brightness - 1);
> + if (IS_ERR_VALUE(ret))
> + return ret;
> +
> + return regmap_update_bits(regmap, SKY81452_REG1, SKY81452_EN,
> + pdata->enable << CTZ(SKY81452_EN));
> + }
> +
> + return regmap_update_bits(regmap, SKY81452_REG1, SKY81452_EN, 0);
> +}
> +
> +static int sky81452_bl_get_brightness(struct backlight_device *bd)
> +{
> + return bd->props.brightness;
> +}
> +
> +static const struct backlight_ops sky81452_bl_ops = {
> + .update_status = sky81452_bl_update_status,
> + .get_brightness = sky81452_bl_get_brightness,
> +};
> +
> +static ssize_t sky81452_bl_store_enable(struct device *dev,
> + struct device_attribute *attr, const char *buf, size_t count)
> +{
> + struct regmap *regmap = bl_get_data(to_backlight_device(dev));
> + unsigned long value;
> + int ret;
> +
> + ret = kstrtoul(buf, 16, &value);
> + if (IS_ERR_VALUE(ret))
> + return ret;
> +
> + ret = regmap_update_bits(regmap, SKY81452_REG1, SKY81452_EN,
> + value << CTZ(SKY81452_EN));
> + if (IS_ERR_VALUE(ret))
> + return ret;
> +
> + return count;
> +}
> +
> +static ssize_t sky81452_bl_show_open_short(struct device *dev,
> + struct device_attribute *attr, char *buf)
> +{
> + struct regmap *regmap = bl_get_data(to_backlight_device(dev));
> + unsigned int reg, value = 0;
> + char tmp[3];
> + int i, ret;
> +
> + reg = !strcmp(attr->attr.name, "open") ? SKY81452_REG5 : SKY81452_REG4;
> + ret = regmap_read(regmap, reg, &value);
> + if (IS_ERR_VALUE(ret))
> + return ret;
> +
> + if (value & SKY81452_SHRT) {
> + *buf = 0;
> + for (i = 0; i < 6; i++) {
> + if (value & 0x01) {
> + sprintf(tmp, "%d ", i + 1);
> + strcat(buf, tmp);
> + }
> + value >>= 1;
> + }
> + strcat(buf, "\n");
> + } else
> + strcpy(buf, "none\n");
Please add braces to 'else' statement.
If only one branch of a conditional statement is a single
statement. Braces are needed.
if () {
... (multi lines)
} else {
...
}
> +
> + return strlen(buf);
> +}
> +
> +static ssize_t sky81452_bl_show_fault(struct device *dev,
> + struct device_attribute *attr, char *buf)
> +{
> + struct regmap *regmap = bl_get_data(to_backlight_device(dev));
> + unsigned int value = 0;
> + int ret;
> +
> + ret = regmap_read(regmap, SKY81452_REG4, &value);
> + if (IS_ERR_VALUE(ret))
> + return ret;
> +
> + *buf = 0;
> +
> + if (value & SKY81452_OCP)
> + strcat(buf, "over-current ");
> +
> + if (value & SKY81452_OTMP)
> + strcat(buf, "over-temperature");
> +
> + strcat(buf, "\n");
> + return strlen(buf);
> +}
> +
> +static DEVICE_ATTR(enable, S_IWGRP | S_IWUSR, NULL, sky81452_bl_store_enable);
> +static DEVICE_ATTR(open, S_IRUGO, sky81452_bl_show_open_short, NULL);
> +static DEVICE_ATTR(short, S_IRUGO, sky81452_bl_show_open_short, NULL);
> +static DEVICE_ATTR(fault, S_IRUGO, sky81452_bl_show_fault, NULL);
> +
> +static struct attribute *sky81452_bl_attribute[] = {
> + &dev_attr_enable.attr,
> + &dev_attr_open.attr,
> + &dev_attr_short.attr,
> + &dev_attr_fault.attr,
> + NULL
> +};
> +
> +static const struct attribute_group sky81452_bl_attr_group = {
> + .attrs = sky81452_bl_attribute,
> +};
> +
> +#ifdef CONFIG_OF
> +static struct sky81452_bl_platform_data *sky81452_bl_parse_dt(
> + struct device *dev)
> +{
> + struct device_node *np = of_node_get(dev->of_node);
> + struct sky81452_bl_platform_data *pdata;
> + int ret;
> +
> + if (!np) {
> + dev_err(dev, "backlight node not found");
> + return ERR_PTR(-ENODATA);
> + }
> +
> + pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
> + if (!pdata) {
> + of_node_put(np);
> + return ERR_PTR(-ENOMEM);
> + }
> +
> + of_property_read_string(np, "name", &pdata->name);
> + pdata->ignore_pwm = of_property_read_bool(np, "ignore-pwm");
> + pdata->dpwm_mode = of_property_read_bool(np, "dpwm-mode");
> + pdata->phase_shift = of_property_read_bool(np, "phase-shift");
> +
> + pdata->gpio_enable = of_get_named_gpio(np, "gpio-enable", 0);
> + if (IS_ERR_VALUE(pdata->gpio_enable))
> + pdata->gpio_enable = -1;
> +
> + ret = of_property_read_u32(np, "enable", &pdata->enable);
> + if (IS_ERR_VALUE(ret))
> + pdata->enable = SKY81452_EN >> CTZ(SKY81452_EN);
> +
> + ret = of_property_read_u32(np, "short-detection-threshold",
> + &pdata->short_detection_threshold);
> + if (IS_ERR_VALUE(ret))
> + pdata->short_detection_threshold = 7;
> +
> + ret = of_property_read_u32(np, "boost-current-limit",
> + &pdata->boost_current_limit);
> + if (IS_ERR_VALUE(ret))
> + pdata->boost_current_limit = 2750;
> +
> + of_node_put(np);
> + return pdata;
> +}
> +#else
> +static struct sky81452_bl_platform_data *sky81452_bl_parse_dt(
> + struct device *dev)
> +{
> + return ERR_PTR(-EINVAL);
> +}
> +#endif
> +
> +static int sky81452_bl_init_device(struct regmap *regmap,
> + struct sky81452_bl_platform_data *pdata)
> +{
> + unsigned int value;
> +
> + value = pdata->ignore_pwm ? SKY81452_IGPW : 0;
> + value |= pdata->dpwm_mode ? SKY81452_PWMMD : 0;
> + value |= pdata->phase_shift ? 0 : SKY81452_PHASE;
> +
> + if (pdata->boost_current_limit = 2300)
> + value |= SKY81452_ILIM;
> + else if (pdata->boost_current_limit != 2720)
> + return -EINVAL;
> +
> + if (pdata->short_detection_threshold < 4 ||
> + pdata->short_detection_threshold > 7)
> + return -EINVAL;
> + value |= (7 - pdata->short_detection_threshold) << CTZ(SKY81452_VSHRT);
> +
> + return regmap_write(regmap, SKY81452_REG2, value);
> +}
> +
> +static int sky81452_bl_probe(struct platform_device *pdev)
> +{
> + struct device *dev = &pdev->dev;
> + struct regmap *regmap = dev_get_drvdata(dev->parent);
> + struct sky81452_bl_platform_data *pdata = dev_get_platdata(dev);
> + struct backlight_device *bd;
> + struct backlight_properties props;
> + const char *name;
> + int ret;
> +
> + if (!pdata) {
> + pdata = sky81452_bl_parse_dt(dev);
> + if (IS_ERR(pdata))
> + return PTR_ERR(pdata);
> + }
> +
> + if (pdata->gpio_enable >= 0) {
> + ret = devm_gpio_request_one(dev, pdata->gpio_enable,
> + GPIOF_OUT_INIT_HIGH, "sky81452-en");
> + if (IS_ERR_VALUE(ret)) {
> + dev_err(dev, "failed to request GPIO. err=%d", ret);
> + return ret;
> + }
> + }
> +
> + ret = sky81452_bl_init_device(regmap, pdata);
> + if (IS_ERR_VALUE(ret)) {
> + dev_err(dev, "failed to initialize. err=%d", ret);
> + return ret;
> + }
> +
> + memset(&props, 0, sizeof(props));
> + props.max_brightness = SKY81452_MAX_BRIGHTNESS,
> + name = pdata->name ? pdata->name : SKY81452_DEFAULT_NAME;
> + bd = devm_backlight_device_register(dev, name, dev, regmap,
> + &sky81452_bl_ops, &props);
> + if (IS_ERR(bd)) {
> + dev_err(dev, "failed to register. err=%ld", PTR_ERR(bd));
> + return PTR_ERR(bd);
> + }
> +
> + platform_set_drvdata(pdev, bd);
> +
> + ret = sysfs_create_group(&bd->dev.kobj, &sky81452_bl_attr_group);
> + if (IS_ERR_VALUE(ret)) {
> + dev_err(dev, "failed to create attribute. err=%d", ret);
> + goto err;
> + }
> +
> + return ret;
> +err:
> + backlight_device_unregister(bd);
This backlight_device_unregister() is NOT necessary.
This is because backlight_device_unregister will be called
automatically, when devm_backlight_device_register() is used
and error returns.
> + return ret;
> +}
> +
> +static int sky81452_bl_remove(struct platform_device *pdev)
> +{
> + const struct sky81452_bl_platform_data *pdata > + dev_get_platdata(&pdev->dev);
> + struct backlight_device *bd = platform_get_drvdata(pdev);
> +
> + sysfs_remove_group(&bd->dev.kobj, &sky81452_bl_attr_group);
> +
> + bd->props.power = FB_BLANK_UNBLANK;
> + bd->props.brightness = 0;
> + backlight_update_status(bd);
> +
> + if (pdata->gpio_enable >= 0)
> + gpio_set_value_cansleep(pdata->gpio_enable, 0);
> +
> + return 0;
> +}
> +
> +#ifdef CONFIG_OF
> +static const struct of_device_id sky81452_bl_of_match[] = {
> + { .compatible = "skyworks,sky81452-backlight", },
> + { }
> +};
> +MODULE_DEVICE_TABLE(of, sky81452_bl_of_match);
> +#endif
> +
> +static struct platform_driver sky81452_bl_driver = {
> + .driver = {
> + .name = "sky81452-backlight",
> + .of_match_table = of_match_ptr(sky81452_bl_of_match),
> + },
> + .probe = sky81452_bl_probe,
> + .remove = sky81452_bl_remove,
> +};
> +
> +module_platform_driver(sky81452_bl_driver);
> +
> +MODULE_DESCRIPTION("Skyworks SKY81452 backlight driver");
> +MODULE_AUTHOR("Gyungoh Yoo <jack.yoo@skyworksinc.com>");
> +MODULE_LICENSE("GPL");
How about using 'GPL v2'?
> +MODULE_VERSION("1.2");
> --
> 1.9.1
^ permalink raw reply
* Re: [PATCH] pwm-backlight: Turn off pwm backlight in probe
From: Ajay kumar @ 2014-10-07 9:29 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <20141007090718.GC5042@pengutronix.de>
On Tue, Oct 7, 2014 at 2:37 PM, Markus Pargmann <mpa@pengutronix.de> wrote:
> Hi,
>
> On Tue, Oct 07, 2014 at 10:35:49AM +0200, Thierry Reding wrote:
>> On Mon, Oct 06, 2014 at 09:22:44PM +0200, Markus Pargmann wrote:
>> > The backlight will be enabled by the panel again if it is used. So we
>> > can save the default brightness and disable the pwm backlight when
>> > probing.
>> >
>> > Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
>> > ---
>> > drivers/video/backlight/pwm_bl.c | 4 +++-
>> > 1 file changed, 3 insertions(+), 1 deletion(-)
>> >
>> > diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
>> > index 336b83be7e2d..b4f433a6f106 100644
>> > --- a/drivers/video/backlight/pwm_bl.c
>> > +++ b/drivers/video/backlight/pwm_bl.c
>> > @@ -317,9 +317,11 @@ static int pwm_backlight_probe(struct platform_device *pdev)
>> > data->dft_brightness = data->max_brightness;
>> > }
>> >
>> > - bl->props.brightness = data->dft_brightness;
>> > + bl->props.brightness = 0;
>> > backlight_update_status(bl);
>> >
>> > + bl->props.brightness = data->dft_brightness;
>> > +
>> > platform_set_drvdata(pdev, bl);
>> > return 0;
>> >
>>
>> It would be nice if it was that easy. But we can't do this, because it
>> will regress for users of this driver that don't use a panel or DRM. If
>> the PWM backlight driver is used for example in conjunction with a plain
>> fbdev driver it isn't necessarily hooked up with anything and won't be
>> enabled automatically. That's really bad if fbdev is the only output you
>> have since you'd have to blindly type the commands to enable the
>> backlight. Furthermore disabling backlight isn't always what you want to
>> do. For example if the bootloader already turned it on and you hand over
>> from bootloader to kernel in a seamless way, then you absolutely want to
>> keep backlight on all the time.
>>
>> See also[0] for a different proposal to solve the same problem. Back at
>> the time that received only a very few replies, but it would be nice if
>> Lee and Bryan could look at it again and see if we can come up with some
>> way to deal with this situation.
>
> Yes your proposal looks a lot better to handle the different use cases.
> The DT-binding is not a hardware description but I don't see any better
> way of passing that information. So it would be good to get your
> solution mainline.
+1
And, I have already tested Thierry's proposal on Exynos5800 peach_pi.
Ajay
^ permalink raw reply
* Re: [PATCH] pwm-backlight: Turn off pwm backlight in probe
From: Markus Pargmann @ 2014-10-07 9:07 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <20141007083548.GD24254@ulmo>
[-- Attachment #1: Type: text/plain, Size: 2653 bytes --]
Hi,
On Tue, Oct 07, 2014 at 10:35:49AM +0200, Thierry Reding wrote:
> On Mon, Oct 06, 2014 at 09:22:44PM +0200, Markus Pargmann wrote:
> > The backlight will be enabled by the panel again if it is used. So we
> > can save the default brightness and disable the pwm backlight when
> > probing.
> >
> > Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
> > ---
> > drivers/video/backlight/pwm_bl.c | 4 +++-
> > 1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
> > index 336b83be7e2d..b4f433a6f106 100644
> > --- a/drivers/video/backlight/pwm_bl.c
> > +++ b/drivers/video/backlight/pwm_bl.c
> > @@ -317,9 +317,11 @@ static int pwm_backlight_probe(struct platform_device *pdev)
> > data->dft_brightness = data->max_brightness;
> > }
> >
> > - bl->props.brightness = data->dft_brightness;
> > + bl->props.brightness = 0;
> > backlight_update_status(bl);
> >
> > + bl->props.brightness = data->dft_brightness;
> > +
> > platform_set_drvdata(pdev, bl);
> > return 0;
> >
>
> It would be nice if it was that easy. But we can't do this, because it
> will regress for users of this driver that don't use a panel or DRM. If
> the PWM backlight driver is used for example in conjunction with a plain
> fbdev driver it isn't necessarily hooked up with anything and won't be
> enabled automatically. That's really bad if fbdev is the only output you
> have since you'd have to blindly type the commands to enable the
> backlight. Furthermore disabling backlight isn't always what you want to
> do. For example if the bootloader already turned it on and you hand over
> from bootloader to kernel in a seamless way, then you absolutely want to
> keep backlight on all the time.
>
> See also[0] for a different proposal to solve the same problem. Back at
> the time that received only a very few replies, but it would be nice if
> Lee and Bryan could look at it again and see if we can come up with some
> way to deal with this situation.
Yes your proposal looks a lot better to handle the different use cases.
The DT-binding is not a hardware description but I don't see any better
way of passing that information. So it would be good to get your
solution mainline.
Best regards,
Markus
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply
* Re: [PATCH] pwm-backlight: Turn off pwm backlight in probe
From: Lee Jones @ 2014-10-07 9:06 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <20141007083548.GD24254@ulmo>
On Tue, 07 Oct 2014, Thierry Reding wrote:
> On Mon, Oct 06, 2014 at 09:22:44PM +0200, Markus Pargmann wrote:
> > The backlight will be enabled by the panel again if it is used. So we
> > can save the default brightness and disable the pwm backlight when
> > probing.
> >
> > Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
> > ---
> > drivers/video/backlight/pwm_bl.c | 4 +++-
> > 1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
> > index 336b83be7e2d..b4f433a6f106 100644
> > --- a/drivers/video/backlight/pwm_bl.c
> > +++ b/drivers/video/backlight/pwm_bl.c
> > @@ -317,9 +317,11 @@ static int pwm_backlight_probe(struct platform_device *pdev)
> > data->dft_brightness = data->max_brightness;
> > }
> >
> > - bl->props.brightness = data->dft_brightness;
> > + bl->props.brightness = 0;
> > backlight_update_status(bl);
> >
> > + bl->props.brightness = data->dft_brightness;
> > +
> > platform_set_drvdata(pdev, bl);
> > return 0;
> >
>
> It would be nice if it was that easy. But we can't do this, because it
> will regress for users of this driver that don't use a panel or DRM. If
> the PWM backlight driver is used for example in conjunction with a plain
> fbdev driver it isn't necessarily hooked up with anything and won't be
> enabled automatically. That's really bad if fbdev is the only output you
> have since you'd have to blindly type the commands to enable the
> backlight. Furthermore disabling backlight isn't always what you want to
> do. For example if the bootloader already turned it on and you hand over
> from bootloader to kernel in a seamless way, then you absolutely want to
> keep backlight on all the time.
>
> See also[0] for a different proposal to solve the same problem. Back at
> the time that received only a very few replies, but it would be nice if
> Lee and Bryan could look at it again and see if we can come up with some
> way to deal with this situation.
I don't have any experience with this stuff. Jingoo and Bryan are the
_real_ reviewers for Backlight. I just maintain the patches. That
and I'm already swamped with MFD.
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
^ permalink raw reply
* Re: [PATCH] pwm-backlight: Turn off pwm backlight in probe
From: Thierry Reding @ 2014-10-07 8:35 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1412623364-14583-1-git-send-email-mpa@pengutronix.de>
[-- Attachment #1: Type: text/plain, Size: 1978 bytes --]
On Mon, Oct 06, 2014 at 09:22:44PM +0200, Markus Pargmann wrote:
> The backlight will be enabled by the panel again if it is used. So we
> can save the default brightness and disable the pwm backlight when
> probing.
>
> Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
> ---
> drivers/video/backlight/pwm_bl.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
> index 336b83be7e2d..b4f433a6f106 100644
> --- a/drivers/video/backlight/pwm_bl.c
> +++ b/drivers/video/backlight/pwm_bl.c
> @@ -317,9 +317,11 @@ static int pwm_backlight_probe(struct platform_device *pdev)
> data->dft_brightness = data->max_brightness;
> }
>
> - bl->props.brightness = data->dft_brightness;
> + bl->props.brightness = 0;
> backlight_update_status(bl);
>
> + bl->props.brightness = data->dft_brightness;
> +
> platform_set_drvdata(pdev, bl);
> return 0;
>
It would be nice if it was that easy. But we can't do this, because it
will regress for users of this driver that don't use a panel or DRM. If
the PWM backlight driver is used for example in conjunction with a plain
fbdev driver it isn't necessarily hooked up with anything and won't be
enabled automatically. That's really bad if fbdev is the only output you
have since you'd have to blindly type the commands to enable the
backlight. Furthermore disabling backlight isn't always what you want to
do. For example if the bootloader already turned it on and you hand over
from bootloader to kernel in a seamless way, then you absolutely want to
keep backlight on all the time.
See also[0] for a different proposal to solve the same problem. Back at
the time that received only a very few replies, but it would be nice if
Lee and Bryan could look at it again and see if we can come up with some
way to deal with this situation.
Thierry
[0]: https://lkml.org/lkml/2014/7/31/259
[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply
* [RESUBMIT PATCH v3 2/8] backlight: Add support Skyworks SKY81452 backlight driver
From: Gyungoh Yoo @ 2014-10-07 5:01 UTC (permalink / raw)
To: jg1.han-Sze3O3UU22JBDgjK7y7TUQ, cooloney-Re5JQEeQqe8AvxtiuMwx3w,
lee.jones-QSEj5FYQhm4dnm+yROfE0A
Cc: plagnioj-sclMFOaUSTBWk0Htik3J/w, tomi.valkeinen-l0cyMroinI0,
grant.likely-QSEj5FYQhm4dnm+yROfE0A,
robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-fbdev-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA,
jack.yoo-tjhQNA90jdKqndwCJWfcng
In-Reply-To: <1412657745-7812-1-git-send-email-jack.yoo-tjhQNA90jdKqndwCJWfcng@public.gmane.org>
Signed-off-by: Gyungoh Yoo <jack.yoo@skyworksinc.com>
---
drivers/video/backlight/Kconfig | 10 +
drivers/video/backlight/Makefile | 1 +
drivers/video/backlight/sky81452-backlight.c | 347 +++++++++++++++++++++++++++
3 files changed, 358 insertions(+)
create mode 100644 drivers/video/backlight/sky81452-backlight.c
diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index 8d03924..2586fdd 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -409,6 +409,16 @@ config BACKLIGHT_PANDORA
If you have a Pandora console, say Y to enable the
backlight driver.
+config BACKLIGHT_SKY81452
+ tristate "Backlight driver for SKY81452"
+ depends on BACKLIGHT_CLASS_DEVICE && MFD_SKY81452
+ help
+ If you have a Skyworks SKY81452, say Y to enable the
+ backlight driver.
+
+ To compile this driver as a module, choose M here: the module will
+ be called sky81452-backlight
+
config BACKLIGHT_TPS65217
tristate "TPS65217 Backlight"
depends on BACKLIGHT_CLASS_DEVICE && MFD_TPS65217
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile
index fcd50b73..d67073f 100644
--- a/drivers/video/backlight/Makefile
+++ b/drivers/video/backlight/Makefile
@@ -50,6 +50,7 @@ obj-$(CONFIG_BACKLIGHT_PANDORA) += pandora_bl.o
obj-$(CONFIG_BACKLIGHT_PCF50633) += pcf50633-backlight.o
obj-$(CONFIG_BACKLIGHT_PWM) += pwm_bl.o
obj-$(CONFIG_BACKLIGHT_SAHARA) += kb3886_bl.o
+obj-$(CONFIG_BACKLIGHT_SKY81452) += sky81452-backlight.o
obj-$(CONFIG_BACKLIGHT_TOSA) += tosa_bl.o
obj-$(CONFIG_BACKLIGHT_TPS65217) += tps65217_bl.o
obj-$(CONFIG_BACKLIGHT_WM831X) += wm831x_bl.o
diff --git a/drivers/video/backlight/sky81452-backlight.c b/drivers/video/backlight/sky81452-backlight.c
new file mode 100644
index 0000000..101399d
--- /dev/null
+++ b/drivers/video/backlight/sky81452-backlight.c
@@ -0,0 +1,347 @@
+/*
+ * sky81452-backlight.c SKY81452 backlight driver
+ *
+ * Copyright 2014 Skyworks Solutions Inc.
+ * Author : Gyungoh Yoo <jack.yoo@skyworksinc.com>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2, or (at your option) any
+ * later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/platform_device.h>
+#include <linux/slab.h>
+#include <linux/of.h>
+#include <linux/err.h>
+#include <linux/gpio.h>
+#include <linux/of_gpio.h>
+#include <linux/regmap.h>
+#include <linux/backlight.h>
+#include <linux/sky81452-backlight.h>
+
+/* registers */
+#define SKY81452_REG0 0x00
+#define SKY81452_REG1 0x01
+#define SKY81452_REG2 0x02
+#define SKY81452_REG4 0x04
+#define SKY81452_REG5 0x05
+
+/* bit mask */
+#define SKY81452_CS 0xFF
+#define SKY81452_EN 0x3F
+#define SKY81452_IGPW 0x20
+#define SKY81452_PWMMD 0x10
+#define SKY81452_PHASE 0x08
+#define SKY81452_ILIM 0x04
+#define SKY81452_VSHRT 0x03
+#define SKY81452_OCP 0x80
+#define SKY81452_OTMP 0x40
+#define SKY81452_SHRT 0x3F
+#define SKY81452_OPN 0x3F
+
+#define SKY81452_DEFAULT_NAME "lcd-backlight"
+#define SKY81452_MAX_BRIGHTNESS (SKY81452_CS + 1)
+
+#define CTZ(b) __builtin_ctz(b)
+
+static int sky81452_bl_update_status(struct backlight_device *bd)
+{
+ const struct sky81452_bl_platform_data *pdata + dev_get_platdata(bd->dev.parent);
+ const unsigned int brightness = (unsigned int)bd->props.brightness;
+ struct regmap *regmap = bl_get_data(bd);
+ int ret;
+
+ if (brightness > 0) {
+ ret = regmap_write(regmap, SKY81452_REG0, brightness - 1);
+ if (IS_ERR_VALUE(ret))
+ return ret;
+
+ return regmap_update_bits(regmap, SKY81452_REG1, SKY81452_EN,
+ pdata->enable << CTZ(SKY81452_EN));
+ }
+
+ return regmap_update_bits(regmap, SKY81452_REG1, SKY81452_EN, 0);
+}
+
+static int sky81452_bl_get_brightness(struct backlight_device *bd)
+{
+ return bd->props.brightness;
+}
+
+static const struct backlight_ops sky81452_bl_ops = {
+ .update_status = sky81452_bl_update_status,
+ .get_brightness = sky81452_bl_get_brightness,
+};
+
+static ssize_t sky81452_bl_store_enable(struct device *dev,
+ struct device_attribute *attr, const char *buf, size_t count)
+{
+ struct regmap *regmap = bl_get_data(to_backlight_device(dev));
+ unsigned long value;
+ int ret;
+
+ ret = kstrtoul(buf, 16, &value);
+ if (IS_ERR_VALUE(ret))
+ return ret;
+
+ ret = regmap_update_bits(regmap, SKY81452_REG1, SKY81452_EN,
+ value << CTZ(SKY81452_EN));
+ if (IS_ERR_VALUE(ret))
+ return ret;
+
+ return count;
+}
+
+static ssize_t sky81452_bl_show_open_short(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct regmap *regmap = bl_get_data(to_backlight_device(dev));
+ unsigned int reg, value = 0;
+ char tmp[3];
+ int i, ret;
+
+ reg = !strcmp(attr->attr.name, "open") ? SKY81452_REG5 : SKY81452_REG4;
+ ret = regmap_read(regmap, reg, &value);
+ if (IS_ERR_VALUE(ret))
+ return ret;
+
+ if (value & SKY81452_SHRT) {
+ *buf = 0;
+ for (i = 0; i < 6; i++) {
+ if (value & 0x01) {
+ sprintf(tmp, "%d ", i + 1);
+ strcat(buf, tmp);
+ }
+ value >>= 1;
+ }
+ strcat(buf, "\n");
+ } else
+ strcpy(buf, "none\n");
+
+ return strlen(buf);
+}
+
+static ssize_t sky81452_bl_show_fault(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct regmap *regmap = bl_get_data(to_backlight_device(dev));
+ unsigned int value = 0;
+ int ret;
+
+ ret = regmap_read(regmap, SKY81452_REG4, &value);
+ if (IS_ERR_VALUE(ret))
+ return ret;
+
+ *buf = 0;
+
+ if (value & SKY81452_OCP)
+ strcat(buf, "over-current ");
+
+ if (value & SKY81452_OTMP)
+ strcat(buf, "over-temperature");
+
+ strcat(buf, "\n");
+ return strlen(buf);
+}
+
+static DEVICE_ATTR(enable, S_IWGRP | S_IWUSR, NULL, sky81452_bl_store_enable);
+static DEVICE_ATTR(open, S_IRUGO, sky81452_bl_show_open_short, NULL);
+static DEVICE_ATTR(short, S_IRUGO, sky81452_bl_show_open_short, NULL);
+static DEVICE_ATTR(fault, S_IRUGO, sky81452_bl_show_fault, NULL);
+
+static struct attribute *sky81452_bl_attribute[] = {
+ &dev_attr_enable.attr,
+ &dev_attr_open.attr,
+ &dev_attr_short.attr,
+ &dev_attr_fault.attr,
+ NULL
+};
+
+static const struct attribute_group sky81452_bl_attr_group = {
+ .attrs = sky81452_bl_attribute,
+};
+
+#ifdef CONFIG_OF
+static struct sky81452_bl_platform_data *sky81452_bl_parse_dt(
+ struct device *dev)
+{
+ struct device_node *np = of_node_get(dev->of_node);
+ struct sky81452_bl_platform_data *pdata;
+ int ret;
+
+ if (!np) {
+ dev_err(dev, "backlight node not found");
+ return ERR_PTR(-ENODATA);
+ }
+
+ pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
+ if (!pdata) {
+ of_node_put(np);
+ return ERR_PTR(-ENOMEM);
+ }
+
+ of_property_read_string(np, "name", &pdata->name);
+ pdata->ignore_pwm = of_property_read_bool(np, "ignore-pwm");
+ pdata->dpwm_mode = of_property_read_bool(np, "dpwm-mode");
+ pdata->phase_shift = of_property_read_bool(np, "phase-shift");
+
+ pdata->gpio_enable = of_get_named_gpio(np, "gpio-enable", 0);
+ if (IS_ERR_VALUE(pdata->gpio_enable))
+ pdata->gpio_enable = -1;
+
+ ret = of_property_read_u32(np, "enable", &pdata->enable);
+ if (IS_ERR_VALUE(ret))
+ pdata->enable = SKY81452_EN >> CTZ(SKY81452_EN);
+
+ ret = of_property_read_u32(np, "short-detection-threshold",
+ &pdata->short_detection_threshold);
+ if (IS_ERR_VALUE(ret))
+ pdata->short_detection_threshold = 7;
+
+ ret = of_property_read_u32(np, "boost-current-limit",
+ &pdata->boost_current_limit);
+ if (IS_ERR_VALUE(ret))
+ pdata->boost_current_limit = 2750;
+
+ of_node_put(np);
+ return pdata;
+}
+#else
+static struct sky81452_bl_platform_data *sky81452_bl_parse_dt(
+ struct device *dev)
+{
+ return ERR_PTR(-EINVAL);
+}
+#endif
+
+static int sky81452_bl_init_device(struct regmap *regmap,
+ struct sky81452_bl_platform_data *pdata)
+{
+ unsigned int value;
+
+ value = pdata->ignore_pwm ? SKY81452_IGPW : 0;
+ value |= pdata->dpwm_mode ? SKY81452_PWMMD : 0;
+ value |= pdata->phase_shift ? 0 : SKY81452_PHASE;
+
+ if (pdata->boost_current_limit = 2300)
+ value |= SKY81452_ILIM;
+ else if (pdata->boost_current_limit != 2720)
+ return -EINVAL;
+
+ if (pdata->short_detection_threshold < 4 ||
+ pdata->short_detection_threshold > 7)
+ return -EINVAL;
+ value |= (7 - pdata->short_detection_threshold) << CTZ(SKY81452_VSHRT);
+
+ return regmap_write(regmap, SKY81452_REG2, value);
+}
+
+static int sky81452_bl_probe(struct platform_device *pdev)
+{
+ struct device *dev = &pdev->dev;
+ struct regmap *regmap = dev_get_drvdata(dev->parent);
+ struct sky81452_bl_platform_data *pdata = dev_get_platdata(dev);
+ struct backlight_device *bd;
+ struct backlight_properties props;
+ const char *name;
+ int ret;
+
+ if (!pdata) {
+ pdata = sky81452_bl_parse_dt(dev);
+ if (IS_ERR(pdata))
+ return PTR_ERR(pdata);
+ }
+
+ if (pdata->gpio_enable >= 0) {
+ ret = devm_gpio_request_one(dev, pdata->gpio_enable,
+ GPIOF_OUT_INIT_HIGH, "sky81452-en");
+ if (IS_ERR_VALUE(ret)) {
+ dev_err(dev, "failed to request GPIO. err=%d", ret);
+ return ret;
+ }
+ }
+
+ ret = sky81452_bl_init_device(regmap, pdata);
+ if (IS_ERR_VALUE(ret)) {
+ dev_err(dev, "failed to initialize. err=%d", ret);
+ return ret;
+ }
+
+ memset(&props, 0, sizeof(props));
+ props.max_brightness = SKY81452_MAX_BRIGHTNESS,
+ name = pdata->name ? pdata->name : SKY81452_DEFAULT_NAME;
+ bd = devm_backlight_device_register(dev, name, dev, regmap,
+ &sky81452_bl_ops, &props);
+ if (IS_ERR(bd)) {
+ dev_err(dev, "failed to register. err=%ld", PTR_ERR(bd));
+ return PTR_ERR(bd);
+ }
+
+ platform_set_drvdata(pdev, bd);
+
+ ret = sysfs_create_group(&bd->dev.kobj, &sky81452_bl_attr_group);
+ if (IS_ERR_VALUE(ret)) {
+ dev_err(dev, "failed to create attribute. err=%d", ret);
+ goto err;
+ }
+
+ return ret;
+err:
+ backlight_device_unregister(bd);
+ return ret;
+}
+
+static int sky81452_bl_remove(struct platform_device *pdev)
+{
+ const struct sky81452_bl_platform_data *pdata + dev_get_platdata(&pdev->dev);
+ struct backlight_device *bd = platform_get_drvdata(pdev);
+
+ sysfs_remove_group(&bd->dev.kobj, &sky81452_bl_attr_group);
+
+ bd->props.power = FB_BLANK_UNBLANK;
+ bd->props.brightness = 0;
+ backlight_update_status(bd);
+
+ if (pdata->gpio_enable >= 0)
+ gpio_set_value_cansleep(pdata->gpio_enable, 0);
+
+ return 0;
+}
+
+#ifdef CONFIG_OF
+static const struct of_device_id sky81452_bl_of_match[] = {
+ { .compatible = "skyworks,sky81452-backlight", },
+ { }
+};
+MODULE_DEVICE_TABLE(of, sky81452_bl_of_match);
+#endif
+
+static struct platform_driver sky81452_bl_driver = {
+ .driver = {
+ .name = "sky81452-backlight",
+ .of_match_table = of_match_ptr(sky81452_bl_of_match),
+ },
+ .probe = sky81452_bl_probe,
+ .remove = sky81452_bl_remove,
+};
+
+module_platform_driver(sky81452_bl_driver);
+
+MODULE_DESCRIPTION("Skyworks SKY81452 backlight driver");
+MODULE_AUTHOR("Gyungoh Yoo <jack.yoo@skyworksinc.com>");
+MODULE_LICENSE("GPL");
+MODULE_VERSION("1.2");
--
1.9.1
^ permalink raw reply related
* [PATCH] pwm-backlight: Turn off pwm backlight in probe
From: Markus Pargmann @ 2014-10-06 19:22 UTC (permalink / raw)
To: linux-arm-kernel
The backlight will be enabled by the panel again if it is used. So we
can save the default brightness and disable the pwm backlight when
probing.
Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
---
drivers/video/backlight/pwm_bl.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
index 336b83be7e2d..b4f433a6f106 100644
--- a/drivers/video/backlight/pwm_bl.c
+++ b/drivers/video/backlight/pwm_bl.c
@@ -317,9 +317,11 @@ static int pwm_backlight_probe(struct platform_device *pdev)
data->dft_brightness = data->max_brightness;
}
- bl->props.brightness = data->dft_brightness;
+ bl->props.brightness = 0;
backlight_update_status(bl);
+ bl->props.brightness = data->dft_brightness;
+
platform_set_drvdata(pdev, bl);
return 0;
--
2.1.0
^ permalink raw reply related
* [RFC 10/10] Documentation: devicetree: bindings: video: Xylon logiCVC IP binding
From: Davor Joja @ 2014-10-06 13:33 UTC (permalink / raw)
To: linux-fbdev
Xylon logiCVC IP core binding description.
Signed-off-by: Davor Joja <davorjoja@logicbricks.com>
---
.../devicetree/bindings/video/xylon-logicvc.txt | 207 +++++++++++++++++++++
1 file changed, 207 insertions(+)
create mode 100644 Documentation/devicetree/bindings/video/xylon-logicvc.txt
diff --git a/Documentation/devicetree/bindings/video/xylon-logicvc.txt b/Documentation/devicetree/bindings/video/xylon-logicvc.txt
new file mode 100644
index 0000000..12f24c5
--- /dev/null
+++ b/Documentation/devicetree/bindings/video/xylon-logicvc.txt
@@ -0,0 +1,207 @@
+Binding for Xylon logiCVC configurable video controller IP core
+
+Required properties:
+ - compatible: "xylon,logicvc-4.00.a", "xylon,logicvc-4.01.a"
+ - reg: MMIO base address and size of the logiCVC IP core address space
+ - interrupts-parent: the phandle for interrupt controller
+ - interrupts: the interrupt number
+ - pixel-stride: layer width in pixels
+ Common for all available logiCVC standard layers.
+
+ - layer_N: layer has its own configuration described with below properties,
+ where N is layer ID in range 0 - 4
+ - bits-per-pixel: layer bits per pixel configuration (8, 16, 32)
+ Layer is configured to be used with specified pixel width in bits.
+ Pixels written to layer video memory must match in size to configured
+ "bits-per-pixel" value.
+ Note: Allowed "transparency" for values of "bits-per-pixel":
+
+ =======================+ bits-per-pixel transparency
+ =======================+ 8 clut16
+ 8 clut32
+ 8 layer
+ 16 layer
+ 32 layer, pixel
+ =======================+
+ - type: layer type (rgb, yuv, alpha)
+ Layer is configured to be used with specified color space.
+ Pixels written to layer video memory must match specified color format.
+ Type is set to "alpha" if layer contains only pixel alpha values
+ used by layer above. Permitted layer IDs for configuring layer alpha
+ are 1 and 3.
+ - transparency: layer transparency (clut16, clut32, layer, pixel)
+ logiCVC layer can be configured to have transparency control on
+ CLUT, layer or pixel level.
+ "CLUT" mode enables controlling of layer transparency by changing
+ alpha value in logiCVC CLUT registers.
+ "Layer" mode enables controlling of layer transparency by changing
+ alpha value in single logiCVC register.
+ "Pixel" mode enables controlling of pixel transparency by changing
+ dedicated alpha bits of specific pixel in video memory.
+ Note: "transparency" property is not used if "type" property is set
+ to "alpha".
+
+Optional properties:
+ - background-layer-bits-per-pixel: background layer bits per pixel (8, 16, 32)
+ If omitted, last available layer is logiCVC standard layer, which has its
+ own video memory of specific size, color format and specified
+ bits per pixel.
+ If 8, 16 or 32, last available layer is logiCVC background layer,
+ with only specified bits per pixel value.
+ - background-layer-type: background layer type (rgb, yuv)
+ Must be used only when "background-layer-bits-per-pixel" exist.
+ If set to "rgb", in case of 32 bits per pixel, background color register
+ must be written with XRGB8888 value. In case of 16 bits per pixel,
+ background color register must be written with RGB565 value.
+ If set to "yuv", background color register must be written with XYUV8888
+ value.
+ - hsync-active-low: horizontal synchronization pulse is active low "L"
+ If omitted, generated horizontal synchronization pulse polarity is logic
+ high "H".
+ - vsync-active-low: vertical synchronization pulse is active low "L"
+ If omitted, generated vertical synchronization pulse polarity is logic
+ high "H".
+ - pixel-data-invert: output pixel data polarity is inverted
+ If omitted, logiCVC outputs pixel data at default interface polarity.
+ - pixel-data-output-trigger-high: output pixel data triggers on rising edge
+ If omitted, logiCVC outputs pixel data on falling edge of pixel clock.
+ - readable-regs: all logiCVC registers are available for reading
+ If omitted, only Interrupt Status, Power Control and IP Version registers
+ are available for reading.
+ - size-position: logiCVC functionality for controlling on screen layer size
+ and position available
+ If omitted, functionality not available.
+ - component-swap: swap the order of colour components inside the pixel
+ - data-enable-active-low: data enable signal is active low "L"
+ If omitted, generated data enable polarity is logic high "H".
+ - display-interface-itu656: modifies RGB to YUV conversion coefficients
+ - address: layer video memory address for layer_N where
+ N is layer ID in range 0 - 4.
+ logiCVC can be configured to have layer video memory address hardcoded
+ as layer register reset value. This video memory is not part of the system
+ memory. Still it is accessible by CPU and HW devices.
+ If omitted, layer video memory address is set dynamically by
+ device driver.Layer video memory address can be changed dynamically
+ despite the hardcoded address.
+ Note: Additionally, address range parameter can be set. It defines range
+ of video memory in bytes starting from provided address. It is mandatory
+ for physically last layer in memory. If range parameter is omitted for
+ physically last layer, range will be by default set to 2048 lines.
+ If omitted for any other layer then physically last layer,
+ range will be calculated according to address of next physical layer.
+ - buffer-offset: buffer address offset represented in number of lines
+ Used only for HW buffer switching.
+ If omitted, buffer offset variable is by default set to "0".
+ - power-delay: delay in ms after enabling display power supply
+ If omitted, delay is by default set to "0".
+ - signal-delay: delay in ms after enabling display control and data signals
+ in parallel and LVDS interface
+ If omitted, delay is by default set to "0".
+ - display-timings: custom display video mode timing parameters
+ If omitted, driver will use its default video mode timings.
+ native-mode optional parameter determines which video mode timings from
+ the list are used. If native-mode parameter is omitted, first available
+ video mode timings are used.
+
+Example:
+
+ logicvc_0: logicvc@40000000 {
+ compatible = "xylon,logicvc-4.00.a";
+ reg = <0x40030000 0x6000>;
+ interrupt-parent = <&ps7_scugic_0>;
+ interrupts = <0 59 4>;
+ background-layer-bits-per-pixel = <32>;
+ background-layer-type = "rgb";
+ display-interface-itu656;
+ hsync-active-low;
+ vsync-active-low;
+ data-enable-active-low;
+ pixel-data-invert;
+ pixel-data-output-trigger-high;
+ readable-regs;
+ size-position;
+ pixel-stride = <2048>;
+ power-delay = <100>;
+ signal-delay = <50>;
+ layer_0 {
+ address = <0x30000000>
+ buffer-offset = <512>;
+ bits-per-pixel = <16>;
+ type = "yuv";
+ transparency = "layer";
+ component-swap;
+ };
+ layer_1 {
+ address = <0x30600000>;
+ bits-per-pixel = <32>;
+ type = "rgb";
+ transparency = "pixel";
+ };
+ layer_2 {
+ address = <0x31F50000>;
+ bits-per-pixel = <8>;
+ type = "rgb";
+ transparency = "clut32";
+ };
+ layer_3 {
+ address = <0x3216C000 0xCA8000>;
+ bits-per-pixel = <16>;
+ type = "rgb";
+ transparency = "layer";
+ };
+
+ display-timings {
+ native-mode = <&wsxga>;
+ hd720p: 1280x720 {
+ clock-frequency = <74250000>;
+ hactive = <1280>;
+ vactive = <720>;
+ hfront-porch = <110>;
+ hback-porch = <220>;
+ hsync-len = <40>;
+ vfront-porch = <5>;
+ vback-porch = <20>;
+ vsync-len = <5>;
+ hsync-active = <0>;
+ vsync-active = <0>;
+ de-active = <1>;
+ pixelclk-active = <1>;
+ };
+ wsxga: 1680x1050 {
+ clock-frequency = <119000000>;
+ hactive = <1680>;
+ vactive = <1050>;
+ hfront-porch = <48>;
+ hback-porch = <80>;
+ hsync-len = <32>;
+ vfront-porch = <3>;
+ vback-porch = <21>;
+ vsync-len = <6>;
+ };
+ hd1080p: 1920x1080 {
+ clock-frequency = <148500000>;
+ hactive = <1920>;
+ vactive = <1080>;
+ hfront-porch = <88>;
+ hback-porch = <148>;
+ hsync-len = <44>;
+ vfront-porch = <4>;
+ vback-porch = <36>;
+ vsync-len = <5>;
+ };
+ TM050RBH01: 800x480 {
+ clock-frequency = <30000000>;
+ hactive = <800>;
+ vactive = <480>;
+ hfront-porch = <40>;
+ hback-porch = <40>;
+ hsync-len = <48>;
+ vfront-porch = <13>;
+ vback-porch = <29>;
+ vsync-len = <3>;
+ };
+ };
+ };
--
1.9.1
^ permalink raw reply related
* [RFC 09/10] Documentation: devicetree: bindings: video: Xylon driver binding
From: Davor Joja @ 2014-10-06 13:32 UTC (permalink / raw)
To: linux-fbdev
Xylon framebuffer driver binding description.
Signed-off-by: Davor Joja <davorjoja@logicbricks.com>
---
.../devicetree/bindings/video/xylon-fb.txt | 54 ++++++++++++++++++++++
1 file changed, 54 insertions(+)
create mode 100644 Documentation/devicetree/bindings/video/xylon-fb.txt
diff --git a/Documentation/devicetree/bindings/video/xylon-fb.txt b/Documentation/devicetree/bindings/video/xylon-fb.txt
new file mode 100644
index 0000000..b1c8149
--- /dev/null
+++ b/Documentation/devicetree/bindings/video/xylon-fb.txt
@@ -0,0 +1,54 @@
+Binding for Xylon FB driver
+
+Xylon FB driver supports Xylon configurable video controller
+logiCVC FPGA IP core device.
+
+Required properties:
+ - compatible: value must be "xylon,fb-3.00.a"
+ - clocks: the phandle for the pixel clock generator
+ - device: the phandle for logiCVC video controller device
+ - encoder: the phandle for the video encoder
+
+Optional properties:
+ - console-layer: layer ID for FB console (0 - 4)
+ If omitted, FB console started on default layer ID 0.
+ Note: FB console can be started only on layer configured with one
+ of parameters combination below:
+ ===================
+ bits-per-pixel type transparency
+ ===================
+ 8 yuv clut32
+ 8 rgb clut16
+ 8 rgb clut32
+ 8 rgb layer
+ 16 rgb layer
+ 32 rgb layer
+ 32 rgb pixel
+ ===================
+
+ - edid-video-mode: video mode set to preferred EDID resolution
+ If omitted, configured according to "video-mode" property.
+ - edid-print: prints EDID description in system log
+ Must be used only with "edid-video-mode".
+ If omitted, functionality is not available.
+ - vsync-irq: generate interrupt on vertical synchronization pulse
+ - video-mode: preferred video mode resolution
+ If omitted, configures logiCVC to default video resolution "1024x768".
+ - M: Coordinated Video Timings (CVT)
+ - R: reduced video timings for digital displays
+ - i: calculate for an interlaced mode
+ - m: add margins to calculation calculation
+ (1.8% of xres rounded down to 8 pixels and 1.8% of yres).
+Example:
+
+ xylon_fb {
+ compatible = "xylon,fb-3.00.a";
+ clocks = <&si570>;
+ device = <&logicvc_0>;
+ encoder = <&adv7511>;
+ console-layer = <0>;
+ edid-video-mode;
+ edid-print;
+ vsync-irq;
+ video-mode = "1920x1080MR";
+ };
\ No newline at end of file
--
1.9.1
^ permalink raw reply related
* [RFC 08/10] video: fbdev: Xylon framebuffer driver to fbdev Kconfig and Makefile
From: Davor Joja @ 2014-10-06 13:32 UTC (permalink / raw)
To: linux-fbdev
Adding Xylon framebuffer driver to video/fbdev Kconfig and Makefile.
Signed-off-by: Davor Joja <davorjoja@logicbricks.com>
---
drivers/video/fbdev/Kconfig | 1 +
drivers/video/fbdev/Makefile | 1 +
2 files changed, 2 insertions(+)
diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig
index e911b9c..cb066f3 100644
--- a/drivers/video/fbdev/Kconfig
+++ b/drivers/video/fbdev/Kconfig
@@ -2469,6 +2469,7 @@ source "drivers/video/fbdev/omap/Kconfig"
source "drivers/video/fbdev/omap2/Kconfig"
source "drivers/video/fbdev/exynos/Kconfig"
source "drivers/video/fbdev/mmp/Kconfig"
+source "drivers/video/fbdev/xylon/Kconfig"
config FB_SH_MOBILE_MERAM
tristate "SuperH Mobile MERAM read ahead support"
diff --git a/drivers/video/fbdev/Makefile b/drivers/video/fbdev/Makefile
index 1979aff..537fcb2 100644
--- a/drivers/video/fbdev/Makefile
+++ b/drivers/video/fbdev/Makefile
@@ -132,6 +132,7 @@ obj-$(CONFIG_FB_JZ4740) += jz4740_fb.o
obj-$(CONFIG_FB_PUV3_UNIGFX) += fb-puv3.o
obj-$(CONFIG_FB_HYPERV) += hyperv_fb.o
obj-$(CONFIG_FB_OPENCORES) += ocfb.o
+obj-y += xylon/
# Platform or fallback drivers go here
obj-$(CONFIG_FB_UVESA) += uvesafb.o
--
1.9.1
^ permalink raw reply related
* [RFC 07/10] include: uapi: linux: Xylon framebuffer driver header file
From: Davor Joja @ 2014-10-06 13:32 UTC (permalink / raw)
To: linux-fbdev
Driver header file containing structures and IOCTLs for user space
apps to be able to use complete logiCVC hw functionality.
Signed-off-by: Davor Joja <davorjoja@logicbricks.com>
---
include/uapi/linux/xylonfb.h | 85 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 85 insertions(+)
create mode 100644 include/uapi/linux/xylonfb.h
diff --git a/include/uapi/linux/xylonfb.h b/include/uapi/linux/xylonfb.h
new file mode 100644
index 0000000..5db8344
--- /dev/null
+++ b/include/uapi/linux/xylonfb.h
@@ -0,0 +1,85 @@
+/*
+ * Xylon logiCVC frame buffer driver IOCTL parameters
+ *
+ * Copyright (C) 2014 Xylon d.o.o.
+ * Author: Davor Joja <davor.joja@logicbricks.com>
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef __XYLONFB_H__
+#define __XYLONFB_H__
+
+#include <linux/types.h>
+
+struct xylonfb_hw_access {
+ __u32 offset;
+ __u32 value;
+ bool set;
+};
+
+/* Used only with logiCVC 3.x */
+struct xylonfb_layer_buffer {
+ __u8 id;
+ bool set;
+};
+
+struct xylonfb_layer_color {
+ __u32 raw_rgb;
+ __u8 use_raw;
+ __u8 r;
+ __u8 g;
+ __u8 b;
+ bool set;
+};
+
+struct xylonfb_layer_geometry {
+ __u16 x;
+ __u16 y;
+ __u16 width;
+ __u16 height;
+ __u16 x_offset;
+ __u16 y_offset;
+ bool set;
+};
+
+struct xylonfb_layer_transparency {
+ __u8 alpha;
+ bool set;
+};
+
+/* Xylon FB IOCTL's */
+#define XYLONFB_IOW(num, dtype) _IOW('x', num, dtype)
+#define XYLONFB_IOR(num, dtype) _IOR('x', num, dtype)
+#define XYLONFB_IOWR(num, dtype) _IOWR('x', num, dtype)
+#define XYLONFB_IO(num) _IO('x', num)
+
+#define XYLONFB_VSYNC_CTRL XYLONFB_IOR(30, bool)
+#define XYLONFB_LAYER_IDX XYLONFB_IOR(31, unsigned int)
+#define XYLONFB_LAYER_ALPHA \
+ XYLONFB_IOR(32, struct xylonfb_layer_transparency)
+#define XYLONFB_LAYER_COLOR_TRANSP_CTRL XYLONFB_IOW(33, bool)
+#define XYLONFB_LAYER_COLOR_TRANSP \
+ XYLONFB_IOR(34, struct xylonfb_layer_color)
+#define XYLONFB_LAYER_GEOMETRY \
+ XYLONFB_IOR(35, struct xylonfb_layer_geometry)
+#define XYLONFB_LAYER_BUFFER \
+ XYLONFB_IOR(36, struct xylonfb_layer_buffer)
+#define XYLONFB_LAYER_BUFFER_OFFSET XYLONFB_IOR(37, unsigned int)
+#define XYLONFB_BACKGROUND_COLOR \
+ XYLONFB_IOR(38, struct xylonfb_layer_color)
+#define XYLONFB_LAYER_EXT_BUFF_SWITCH XYLONFB_IOW(39, bool)
+#define XYLONFB_HW_ACCESS \
+ XYLONFB_IOR(40, struct xylonfb_hw_access)
+#define XYLONFB_IP_CORE_VERSION XYLONFB_IOR(41, __u32)
+#define XYLONFB_WAIT_EDID XYLONFB_IOW(42, unsigned int)
+#define XYLONFB_GET_EDID XYLONFB_IOR(43, char)
+
+#endif /* __XYLONFB_H__ */
--
1.9.1
^ permalink raw reply related
* [RFC 06/10] video: fbdev: Xylon: Framebuffer driver kernel and make configuration
From: Davor Joja @ 2014-10-06 13:32 UTC (permalink / raw)
To: linux-fbdev
Driver kernel and build configuration.
Signed-off-by: Davor Joja <davorjoja@logicbricks.com>
---
drivers/video/fbdev/xylon/Kconfig | 40 ++++++++++++++++++++++++++++++++++++++
drivers/video/fbdev/xylon/Makefile | 3 +++
2 files changed, 43 insertions(+)
create mode 100644 drivers/video/fbdev/xylon/Kconfig
create mode 100644 drivers/video/fbdev/xylon/Makefile
diff --git a/drivers/video/fbdev/xylon/Kconfig b/drivers/video/fbdev/xylon/Kconfig
new file mode 100644
index 0000000..25ae308
--- /dev/null
+++ b/drivers/video/fbdev/xylon/Kconfig
@@ -0,0 +1,40 @@
+menuconfig FB_XYLON
+ tristate "Xylon logiCVC frame buffer support"
+ depends on FB
+ default n
+ select FB_CFB_FILLRECT
+ select FB_CFB_COPYAREA
+ select FB_CFB_IMAGEBLIT
+ select VIDEOMODE_HELPERS
+ help
+ Choose this option if you want to use the Xylon logiCVC as frame
+ buffer device. Without the support of PCI & AGP.
+
+config FB_XYLON_PIXCLK
+ bool "Xylon logiCVC pixel clock"
+ depends on FB_XYLON
+ default n
+ help
+ logiCVC pixel clock generated from:
+ - External generator not controllable by Xylon framebuffer driver
+ This is default selection.
+ - Generators controllable by Xylon framebuffer driver
+
+config FB_XYLON_PIXCLK_LOGICLK
+ bool "Xylon logiCLK pixel clock generator"
+ depends on FB_XYLON && FB_XYLON_PIXCLK
+ default n
+ select COMMON_CLK_LOGICLK
+ help
+ Support for controlling pixel clock generation from
+ Xylon logiCLK FGPA IP core.
+
+config FB_XYLON_PIXCLK_SI570
+ bool "Si570 pixel clock generator"
+ depends on FB_XYLON && FB_XYLON_PIXCLK
+ default n
+ select I2C
+ select COMMON_CLK_SI570
+ help
+ Support for controlling pixel clock generation from
+ Si570 clock generator.
diff --git a/drivers/video/fbdev/xylon/Makefile b/drivers/video/fbdev/xylon/Makefile
new file mode 100644
index 0000000..3baa96a
--- /dev/null
+++ b/drivers/video/fbdev/xylon/Makefile
@@ -0,0 +1,3 @@
+xylonfb-y := xylonfb_main.o xylonfb_core.o xylonfb_ioctl.o xylonfb_pixclk.o
+
+obj-$(CONFIG_FB_XYLON) += xylonfb.o
--
1.9.1
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox