* Re: [PATCH] ARC: add negative dependency for VGA_CONSOLE
From: Tomi Valkeinen @ 2015-08-26 11:34 UTC (permalink / raw)
To: Vineet Gupta, Geert Uytterhoeven, Yuriy Kolerov
Cc: linux-kernel@vger.kernel.org, Linux-Arch,
Linux Fbdev development list, Arnd Bergmann, Andrew Morton,
Jean-Christophe PLAGNIOL-VILLARD, Alexey Brodkin,
Anton.Kolesov@synopsys.com, Francois Bedard
In-Reply-To: <C2D7FE5348E1B147BCA15975FBA23075CFB85748@IN01WEMBXB.internal.synopsys.com>
[-- Attachment #1: Type: text/plain, Size: 1329 bytes --]
On 25/08/15 10:47, Vineet Gupta wrote:
> On Monday 17 August 2015 09:51 PM, Geert Uytterhoeven wrote:
>> On Mon, Aug 17, 2015 at 5:52 PM, Yuriy Kolerov
>> <yuriy.kolerov@synopsys.com> wrote:
>>> Architectures which support VGA console must define screen_info
>>> structurture from "uapi/linux/screen_info.h". Otherwise undefined
>>> symbol error occurs. Usually it's defined in "setup.c" for each
>>> architecture.
>>>
>>> If an architecture does not support VGA console (ARC's case)
>>> there are 2 ways: define a dummy instance of screen_info or add
>>> a negative dependency for VGA_CONSOLE in to prevent selecting
>>> this option.
>>>
>>> I've implemented the second way. However the best solution is to
>>> add HAVE_VGA_CONSOLE option for targets which support VGA
>>> console. Then turn off VGA_CONSOLE by default and add dependency
>>> to HAVE_VGA_CONSOLE. But right now it's better to just add a
>>> negative dependency for ARC and then consider how to collaborate
>>> about this issue with maintainers of other architectures.
>> +1
>>
>>> Signed-off-by: Yuriy Kolerov <yuriy.kolerov@synopsys.com>
>> Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
>
> Hi Tomi,
>
> Is anything else needed for this to be merged.
This is already in linux-next, merged by Andrew Morton.
Tomi
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply
* [PATCH -next] drivers/video/fbdev: Add dependencies on !S390
From: Guenter Roeck @ 2015-08-26 11:32 UTC (permalink / raw)
To: Jean-Christophe Plagniol-Villard
Cc: Tomi Valkeinen, linux-fbdev, linux-kernel, Guenter Roeck,
Luis R. Rodriguez, Borislav Petkov, Ingo Molnar
s390:allmodconfig fails to build with:
ERROR: "pci_iomap_wc" [drivers/video/fbdev/vt8623fb.ko] undefined!
ERROR: "pci_iomap_wc" [drivers/video/fbdev/s3fb.ko] undefined!
ERROR: "pci_iomap_wc" [drivers/video/fbdev/arkfb.ko] undefined!
Those functions are currently only available in generic PCI iomap code,
which is not used on S390.
Fixes: 81bdef04d3bc ("drivers/video/fbdev/vt8623fb: Use arch_phys_wc_add() and pci_iomap_wc()")
Fixes: 4edcd2ab1255 ("drivers/video/fbdev/s3fb: Use arch_phys_wc_add() and pci_iomap_wc()")
Fixes: c823a48ac47f ("drivers/video/fbdev/arkfb.c: Use arch_phys_wc_add() and pci_iomap_wc()")
Cc: Luis R. Rodriguez <mcgrof@suse.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
drivers/video/fbdev/Kconfig | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig
index 8b1d371b5404..6b1893e5c769 100644
--- a/drivers/video/fbdev/Kconfig
+++ b/drivers/video/fbdev/Kconfig
@@ -1442,6 +1442,7 @@ config FB_ATY_BACKLIGHT
config FB_S3
tristate "S3 Trio/Virge support"
depends on FB && PCI
+ depends on !S390
select FB_CFB_FILLRECT
select FB_CFB_COPYAREA
select FB_CFB_IMAGEBLIT
@@ -1649,6 +1650,7 @@ config FB_VOODOO1
config FB_VT8623
tristate "VIA VT8623 support"
depends on FB && PCI
+ depends on !S390
select FB_CFB_FILLRECT
select FB_CFB_COPYAREA
select FB_CFB_IMAGEBLIT
@@ -1683,6 +1685,7 @@ config FB_TRIDENT
config FB_ARK
tristate "ARK 2000PV support"
depends on FB && PCI
+ depends on !S390
select FB_CFB_FILLRECT
select FB_CFB_COPYAREA
select FB_CFB_IMAGEBLIT
--
2.1.4
^ permalink raw reply related
* Re: omapdss: Division by zero in kernel
From: Pali Rohár @ 2015-08-26 10:16 UTC (permalink / raw)
To: Tomi Valkeinen
Cc: Jean-Christophe Plagniol-Villard, Jyri Sarha, linux-omap,
linux-fbdev, linux-kernel, Pavel Machek, Sebastian Reichel,
Aaro Koskinen, Tony Lindgren, Nishanth Menon
In-Reply-To: <55D6ECB5.6010708@ti.com>
On Friday 21 August 2015 12:17:41 Tomi Valkeinen wrote:
>
>
> On 21/08/15 11:48, Pali Rohár wrote:
> > On Friday 21 August 2015 11:42:14 Tomi Valkeinen wrote:
> >>
> >>
> >> On 24/07/15 19:03, Pali Rohár wrote:
> >>> Hello,
> >>>
> >>> when on N900 (real HW or qemu) I run this command
> >>>
> >>> / # echo 0 > /sys/devices/platform/omapdss/overlay0/enabled && echo 0 > /sys/class/graphics/fb0/size
> >>>
> >>> then kernel crash with this error message
> >>>
> >>> / # [ 29.904113] Division by zero in kernel.
> >>
> >
> > Hi! Thanks for explaining.
> >
> >> The problem is that fb console uses the kernel mmapped framebuffer, but
> >> omapfb is not aware of the fb console. So the above commands free the
> >> framebuffer, as omapfb thinks no one is using it, and then fb console
> >> tries to touch the fb.
> >>
> >
> > What about refusing those calls from fb console? So fb console will not
> > know about this problem and omapfb will just ignore drawn functions?
>
> Hmm, I'm not sure I understand what you mean... omapfb is not drawing
> anything, fbcon is doing the drawing independently to the fb. And the fb
> suddenly disappears without fbcon realizing that.
>
> >> omapfb tracks mmaps from userspace, and refuses to free a fb it it's
> >> mmapped.
> >>
> >> I don't know how to fix it straight away. Maybe there's a way for omapfb
> >> to check if the fbcon uses the fb in question, and if so, refuses to
> >> release/resize the memory.
> >>
> >> Tomi
> >>
> >
> > Maemo userspace (on Nokia N900) uses above commands to initialize
> > graphic and Xserver. So it would be nice if disabling framebuffer would
> > work even if fbcon.ko is loaded (or compiled directly into zImage).
>
> Ok. And N900 has fbcon enabled? I wonder how it survives...
>
Depends on compiled kernel. Original stock Nokia kernel 2.6.28 has it
disabled, but when I recompiled it with fbcon (either static linked into
zImage or external fbcon.ko) it works and I do not see any problem.
So I think it survives...
> fbcon can be unbound from userspace with something like:
>
> echo 0 > /sys/class/vtconsole/vtcon1/bind
>
> After that I think the memory can be freed.
>
> But obviously the kernel should not crash here, no question about that.
>
> Tomi
>
Maybe just adding that test for zero to prevent division by zero?
--
Pali Rohár
pali.rohar@gmail.com
^ permalink raw reply
* Re: [PATCH 3/3] devicetree: Add led-backlight binding
From: Jacek Anaszewski @ 2015-08-26 9:56 UTC (permalink / raw)
To: Tomi Valkeinen
Cc: Jingoo Han, Lee Jones, linux-leds, linux-fbdev, Andrew Lunn,
devicetree@vger.kernel.org
In-Reply-To: <55DD82C4.50405@ti.com>
On 08/26/2015 11:11 AM, Tomi Valkeinen wrote:
>
>
> On 26/08/15 10:07, Jacek Anaszewski wrote:
>> On 08/25/2015 05:41 PM, Tomi Valkeinen wrote:
>>>
>>>
>>> On 25/08/15 16:39, Jacek Anaszewski wrote:
>>>
>>>>> +Example:
>>>>> +
>>>>> + backlight {
>>>>> + compatible = "led-backlight";
>>>>> + leds = <&backlight_led>;
>>>>> +
>>>>> + brightness-levels = <0 4 8 16 32 64 128 255>;
>>>>
>>>> brightness level is not a suitable unit for describing LED brightness
>>>> in a Device Tree, as it is not a physical unit. We have led-max-microamp
>>>> property for this, expressed in microamperes, please refer to [0] from
>>>> linux-next.
>>>
>>> Hmm, ok, but what should the driver do with microamperes? As far as I
>>> see, "enum led_brightness" (which is between 0-255) is used to set the
>>> brightness to LEDs. I don't see any function accepting microamperes.
>>
>> This is implementation detail. You can convert microamperes to
>> enum led_brightness in the driver. Please refer to the discussion [1].
>
> The led_set_brightness() takes "enum led_brightness", so I don't
> understand what this driver would do with the microampere value. It
> could, of course, do an arbitrary conversion, say, direct mapping of the
> mA value to brightness, but that would just confuse things further.
OK, I was looking at the problem from LED-centric perspective. Indeed,
backlight subsystem has no other way to pass brightness to the LED
subsystem than in the form of levels. However, the last word belongs
to DT maintainer in this matter.
Cc'ing devicetree@vger.kernel.org.
> If there was a led_set_microampere(), supported by all led devices, then
> yes, the above should be microamperes.
>
> Or are you saying that I should have the binding use microamperes, and
> just do a naive microampere -> brightness conversion in this driver, and
> hope that in the future this driver can be changes to pass the
> micrompere value directly to the underlying LED driver?
>
> And speaking of microamperes for LED drivers, what's a meaningful
> microampere conversion for LED drivers that don't deal with microamperes
> at all? For example, the LED chip we're using, TLC59108, is basically a
> PWM chip. Can we somehow calculate microamperes if we know duty cycle
> and period?
For this type of drivers we have to resort to levels in DT.
It shouldn't serve as an excuse for not describing the rest of
hardware in a better way, though.
--
Best Regards,
Jacek Anaszewski
^ permalink raw reply
* Re: [PATCH v2] pwm-backlight: Avoid backlight flicker when probed from DT
From: Philipp Zabel @ 2015-08-26 9:20 UTC (permalink / raw)
To: Thierry Reding, Jingoo Han, Lee Jones
Cc: Ajay Kumar, linux-pwm, linux-fbdev, linux-kernel, kernel
In-Reply-To: <1438276973-20920-1-git-send-email-p.zabel@pengutronix.de>
Hi Thierry, Jingoo, Lee,
Am Donnerstag, den 30.07.2015, 19:22 +0200 schrieb Philipp Zabel:
> If the driver is probed from the device tree, and there is a phandle
> property set on it, and the enable GPIO is already configured as output,
> and the backlight is currently disabled, keep it disabled.
> If all these conditions are met, assume there will be some other driver
> that can enable the backlight at the appropriate time.
do you have any comments on this?
This patch fixes premature backlight illumination issues for DT probed
devices with enable gpio or regulator without changing the behavior of
the non-DT case or DT cases where the enable gpio and regulator are kept
initially enabled or where no other device node points to the backlight
via phandle.
regards
Philipp
> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
> ---
> Changes since v1:
> - Also check if the regulator is enabled. If the power supply is disabled,
> and a phandle points to it, the backlight should stay powered down.
> ---
> drivers/video/backlight/pwm_bl.c | 23 +++++++++++++++++++++++
> 1 file changed, 23 insertions(+)
>
> diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
> index eff379b..31afd6d 100644
> --- a/drivers/video/backlight/pwm_bl.c
> +++ b/drivers/video/backlight/pwm_bl.c
> @@ -199,6 +199,8 @@ static int pwm_backlight_probe(struct platform_device *pdev)
> struct backlight_properties props;
> struct backlight_device *bl;
> struct pwm_bl_data *pb;
> + int initial_blank = FB_BLANK_UNBLANK;
> + bool phandle;
> int ret;
>
> if (!data) {
> @@ -264,12 +266,32 @@ static int pwm_backlight_probe(struct platform_device *pdev)
> pb->enable_gpio = gpio_to_desc(data->enable_gpio);
> }
>
> + phandle = of_find_property(pdev->dev.of_node, "phandle", NULL) != NULL;
> +
> + if (pb->enable_gpio) {
> + /*
> + * If the driver is probed from the device tree and there is a
> + * phandle link pointing to the backlight node, it is safe to
> + * assume that another driver will enable the backlight at the
> + * appropriate time. Therefore, if it is disabled, keep it so.
> + */
> + if (phandle &&
> + gpiod_get_direction(pb->enable_gpio) = GPIOF_DIR_OUT &&
> + gpiod_get_value(pb->enable_gpio) = 0)
> + initial_blank = FB_BLANK_POWERDOWN;
> + else
> + gpiod_direction_output(pb->enable_gpio, 1);
> + }
> +
> pb->power_supply = devm_regulator_get(&pdev->dev, "power");
> if (IS_ERR(pb->power_supply)) {
> ret = PTR_ERR(pb->power_supply);
> goto err_alloc;
> }
>
> + if (phandle && !regulator_is_enabled(pb->power_supply))
> + initial_blank = FB_BLANK_POWERDOWN;
> +
> pb->pwm = devm_pwm_get(&pdev->dev, NULL);
> if (IS_ERR(pb->pwm)) {
> ret = PTR_ERR(pb->pwm);
> @@ -321,6 +343,7 @@ static int pwm_backlight_probe(struct platform_device *pdev)
> }
>
> bl->props.brightness = data->dft_brightness;
> + bl->props.power = initial_blank;
> backlight_update_status(bl);
>
> platform_set_drvdata(pdev, bl);
^ permalink raw reply
* Re: [PATCH 3/3] devicetree: Add led-backlight binding
From: Tomi Valkeinen @ 2015-08-26 9:11 UTC (permalink / raw)
To: Jacek Anaszewski
Cc: Jingoo Han, Lee Jones, linux-leds, linux-fbdev, Andrew Lunn
In-Reply-To: <55DD65BE.4050308@samsung.com>
[-- Attachment #1: Type: text/plain, Size: 1954 bytes --]
On 26/08/15 10:07, Jacek Anaszewski wrote:
> On 08/25/2015 05:41 PM, Tomi Valkeinen wrote:
>>
>>
>> On 25/08/15 16:39, Jacek Anaszewski wrote:
>>
>>>> +Example:
>>>> +
>>>> + backlight {
>>>> + compatible = "led-backlight";
>>>> + leds = <&backlight_led>;
>>>> +
>>>> + brightness-levels = <0 4 8 16 32 64 128 255>;
>>>
>>> brightness level is not a suitable unit for describing LED brightness
>>> in a Device Tree, as it is not a physical unit. We have led-max-microamp
>>> property for this, expressed in microamperes, please refer to [0] from
>>> linux-next.
>>
>> Hmm, ok, but what should the driver do with microamperes? As far as I
>> see, "enum led_brightness" (which is between 0-255) is used to set the
>> brightness to LEDs. I don't see any function accepting microamperes.
>
> This is implementation detail. You can convert microamperes to
> enum led_brightness in the driver. Please refer to the discussion [1].
The led_set_brightness() takes "enum led_brightness", so I don't
understand what this driver would do with the microampere value. It
could, of course, do an arbitrary conversion, say, direct mapping of the
mA value to brightness, but that would just confuse things further.
If there was a led_set_microampere(), supported by all led devices, then
yes, the above should be microamperes.
Or are you saying that I should have the binding use microamperes, and
just do a naive microampere -> brightness conversion in this driver, and
hope that in the future this driver can be changes to pass the
micrompere value directly to the underlying LED driver?
And speaking of microamperes for LED drivers, what's a meaningful
microampere conversion for LED drivers that don't deal with microamperes
at all? For example, the LED chip we're using, TLC59108, is basically a
PWM chip. Can we somehow calculate microamperes if we know duty cycle
and period?
Tomi
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply
* Re: [PATCH 3/3] devicetree: Add led-backlight binding
From: Jacek Anaszewski @ 2015-08-26 7:07 UTC (permalink / raw)
To: Tomi Valkeinen
Cc: Jingoo Han, Lee Jones, linux-leds, linux-fbdev, Andrew Lunn
In-Reply-To: <55DC8C9D.4050007@ti.com>
On 08/25/2015 05:41 PM, Tomi Valkeinen wrote:
>
>
> On 25/08/15 16:39, Jacek Anaszewski wrote:
>
>>> +Example:
>>> +
>>> + backlight {
>>> + compatible = "led-backlight";
>>> + leds = <&backlight_led>;
>>> +
>>> + brightness-levels = <0 4 8 16 32 64 128 255>;
>>
>> brightness level is not a suitable unit for describing LED brightness
>> in a Device Tree, as it is not a physical unit. We have led-max-microamp
>> property for this, expressed in microamperes, please refer to [0] from
>> linux-next.
>
> Hmm, ok, but what should the driver do with microamperes? As far as I
> see, "enum led_brightness" (which is between 0-255) is used to set the
> brightness to LEDs. I don't see any function accepting microamperes.
This is implementation detail. You can convert microamperes to
enum led_brightness in the driver. Please refer to the discussion [1].
>>> + default-brightness-level = <6>;
>>
>> This also should be microamperes.
>
> This is an index to the above brightness-levels array. It's not LED
> brightness, but backlight brightness, between 0 and
> ARRAY_SIZE(brightness-levels) - 1.
You could skip "-level" postfix and have default brightness
in microamperes.
[1] http://www.spinics.net/lists/linux-leds/msg03416.html
--
Best Regards,
Jacek Anaszewski
^ permalink raw reply
* Re: [PATCH v4 10/11] dma: rename dma_*_writecombine() to dma_*_wc()
From: Ingo Molnar @ 2015-08-26 4:21 UTC (permalink / raw)
To: Andrew Morton
Cc: Luis R. Rodriguez, David Howells, Luis R. Rodriguez, bp, bhelgaas,
tomi.valkeinen, airlied, linux-fbdev, luto, vinod.koul,
dan.j.williams, toshi.kani, benh, mst, daniel.vetter, konrad.wilk,
x86, linux-kernel, linux-pci, xen-devel
In-Reply-To: <20150825162540.0591c8c8276b1ff279785e49@linux-foundation.org>
* Andrew Morton <akpm@linux-foundation.org> wrote:
> > There's a catch-22 issue here either way, for instance this rename patch has
> > been being baked for probably 2 releases already but the difficulty has been
> > trying to find the appropriate time to merge it without conflict.
> >
> > If you do it in the beginning of the merge window, you have to ask yourself in
> > what tree it will be done. Since subsystems are topic specific that means that
> > subsystem will end up having a conflict at the end of the merge window.
>
> Yes it's a special case. I think the best way of handling such things is to get
> them in to Linus either right at the end of the merge window or the day after he
> releases -rc1. This is when most people's trees are mostly empty.
Yes, that was the plan last time around as well - but the end of the merge window
is when we have the least maintainer bandwidth as well ...
Anyway, I applied most of the patches (sans the rename), so the rename patch
should be a lot simpler to execute at the right moment this time around.
Thanks,
Ingo
^ permalink raw reply
* Re: [PATCH v4 10/11] dma: rename dma_*_writecombine() to dma_*_wc()
From: Andrew Morton @ 2015-08-25 23:25 UTC (permalink / raw)
To: Luis R. Rodriguez
Cc: David Howells, Ingo Molnar, Luis R. Rodriguez, bp, bhelgaas,
tomi.valkeinen, airlied, linux-fbdev, luto, vinod.koul,
dan.j.williams, toshi.kani, benh, mst, daniel.vetter, konrad.wilk,
x86, linux-kernel, linux-pci, xen-devel
In-Reply-To: <20150825231912.GW8051@wotan.suse.de>
On Wed, 26 Aug 2015 01:19:13 +0200 "Luis R. Rodriguez" <mcgrof@suse.com> wrote:
> On Tue, Aug 25, 2015 at 01:43:58PM -0700, Andrew Morton wrote:
> > On Tue, 25 Aug 2015 17:48:37 +0200 "Luis R. Rodriguez" <mcgrof@suse.com> wrote:
> >
> > > On Tue, Aug 25, 2015 at 09:53:18AM +0200, Ingo Molnar wrote:
> > > > Which kernel is this against? It has conflicts in 3 files with Linus's latest:
> > > > v4.2-rc8.
> > >
> > > Sorry I based it on linux-next, will respin the rename patch onto tip/auto-latest
> > >
> >
> > Doing that will make the patch kinda useless, because then the patch
> > will trash more mature work which is pending in linux-next, one week
> > before the merge window opens.
> >
> > A better plan would be to base the patches on linux-next then wait for
> > 4.3-rc1.
>
> There's a catch-22 issue here either way, for instance this rename
> patch has been being baked for probably 2 releases already but the
> difficulty has been trying to find the appropriate time to merge it
> without conflict.
>
> If you do it in the beginning of the merge window, you have to ask
> yourself in what tree it will be done. Since subsystems are topic
> specific that means that subsystem will end up having a conflict
> at the end of the merge window.
Yes it's a special case. I think the best way of handling such things
is to get them in to Linus either right at the end of the merge window
or the day after he releases -rc1. This is when most people's trees
are mostly empty.
^ permalink raw reply
* Re: [PATCH v4 10/11] dma: rename dma_*_writecombine() to dma_*_wc()
From: Luis R. Rodriguez @ 2015-08-25 23:19 UTC (permalink / raw)
To: Andrew Morton, David Howells
Cc: Ingo Molnar, Luis R. Rodriguez, bp, bhelgaas, tomi.valkeinen,
airlied, linux-fbdev, luto, vinod.koul, dan.j.williams,
toshi.kani, benh, mst, daniel.vetter, konrad.wilk, x86,
linux-kernel, linux-pci, xen-devel
In-Reply-To: <20150825134358.990073a55012c60a638b3144@linux-foundation.org>
On Tue, Aug 25, 2015 at 01:43:58PM -0700, Andrew Morton wrote:
> On Tue, 25 Aug 2015 17:48:37 +0200 "Luis R. Rodriguez" <mcgrof@suse.com> wrote:
>
> > On Tue, Aug 25, 2015 at 09:53:18AM +0200, Ingo Molnar wrote:
> > > Which kernel is this against? It has conflicts in 3 files with Linus's latest:
> > > v4.2-rc8.
> >
> > Sorry I based it on linux-next, will respin the rename patch onto tip/auto-latest
> >
>
> Doing that will make the patch kinda useless, because then the patch
> will trash more mature work which is pending in linux-next, one week
> before the merge window opens.
>
> A better plan would be to base the patches on linux-next then wait for
> 4.3-rc1.
There's a catch-22 issue here either way, for instance this rename
patch has been being baked for probably 2 releases already but the
difficulty has been trying to find the appropriate time to merge it
without conflict.
If you do it in the beginning of the merge window, you have to ask
yourself in what tree it will be done. Since subsystems are topic
specific that means that subsystem will end up having a conflict
at the end of the merge window.
If you do it at the end you run into the issue you describe.
So unless I'm missing something, perhaps metrics to argue one way is better
than another, it seems today this is up up to a subsystem's maintainer's
preference?
There are more subtle issues with this though, I've identified similar problems
before and proposed one solution to it could be a linux-oven [0], in that
thread I describe other issues and why I think a linux-oven might help.
Perhaps the biggest change that comes to mind that could have caused
tons of collateral was the UAPI change David Howells did years ago,
when did that go in, at the end of early? In retrospect what would have
helped?
Anyway, both version of the patch are now available, up to you guys :)
[0] http://lkml.kernel.org/r/20150619231255.GC7487@garbanzo.do-not-panic.com
Luis
^ permalink raw reply
* Re: [PATCH v4 10/11] dma: rename dma_*_writecombine() to dma_*_wc()
From: Andrew Morton @ 2015-08-25 20:43 UTC (permalink / raw)
To: Luis R. Rodriguez
Cc: Ingo Molnar, Luis R. Rodriguez, bp, bhelgaas, tomi.valkeinen,
airlied, linux-fbdev, luto, vinod.koul, dan.j.williams,
toshi.kani, benh, mst, daniel.vetter, konrad.wilk, x86,
linux-kernel, linux-pci, xen-devel
In-Reply-To: <20150825154837.GL8051@wotan.suse.de>
On Tue, 25 Aug 2015 17:48:37 +0200 "Luis R. Rodriguez" <mcgrof@suse.com> wrote:
> On Tue, Aug 25, 2015 at 09:53:18AM +0200, Ingo Molnar wrote:
> > Which kernel is this against? It has conflicts in 3 files with Linus's latest:
> > v4.2-rc8.
>
> Sorry I based it on linux-next, will respin the rename patch onto tip/auto-latest
>
Doing that will make the patch kinda useless, because then the patch
will trash more mature work which is pending in linux-next, one week
before the merge window opens.
A better plan would be to base the patches on linux-next then wait for
4.3-rc1.
^ permalink raw reply
* Re: [PATCH 4/4] fbdev: Debug knob to register without holding console_lock
From: Rob Clark @ 2015-08-25 19:24 UTC (permalink / raw)
To: Daniel Vetter
Cc: Intel Graphics Development, Tomi Valkeinen,
Jean-Christophe Plagniol-Villard, Linux Fbdev development list,
DRI Development
In-Reply-To: <1440510314-8633-4-git-send-email-daniel.vetter@ffwll.ch>
On Tue, Aug 25, 2015 at 9:45 AM, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> When the usual fbcon legacy options are enabled we have
> ->register_framebuffer
> ->fb notifier chain calls into fbcon
> ->fbcon sets up console on new fbi
> ->fbi->set_par
> ->drm_fb_helper_set_par exercises full kms api
>
> And because of locking inversion hilarity all of register_framebuffer
> is done with the console lock held. Which means that the first time on
> driver load we exercise _all_ the kms code (all probe paths and
> modeset paths for everything connected) is under the console lock.
> That means if anything goes belly-up in that big pile of code nothing
> ever reaches logfiles (and the machine is dead).
>
> Usual tactic to debug that is to temporarily remove those console_lock
> calls to be able to capture backtraces. I'm fed up writing this patch
> and recompiling kernels. Hence this patch here to add an unsafe,
> kernel-taining option to do this at runtime.
>
> Cc: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>
> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
> Cc: linux-fbdev@vger.kernel.org
> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This one was causing me some problems, if I tried to enable
lockless_register_fb. It *looks* like it should work, so I'm not
quite sure what the deal is. But I'm 110% fan of getting something
like this working, because console_lock is pretty much the bane of kms
developer's existence..
I'll have to debug further on a system where I can see more than the
bottom three lines of the second to last backtrace..
BR,
-R
> ---
> drivers/video/fbdev/core/fbmem.c | 14 +++++++++++---
> 1 file changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c
> index 0705d8883ede..4e73b6f6b1c0 100644
> --- a/drivers/video/fbdev/core/fbmem.c
> +++ b/drivers/video/fbdev/core/fbmem.c
> @@ -1608,6 +1608,11 @@ static int do_remove_conflicting_framebuffers(struct apertures_struct *a,
> return 0;
> }
>
> +static bool lockless_register_fb;
> +module_param_named_unsafe(lockless_register_fb, lockless_register_fb, bool, 0400);
> +MODULE_PARM_DESC(lockless_register_fb,
> + "Lockless framebuffer registration for debugging [default=off]");
> +
> static int do_register_framebuffer(struct fb_info *fb_info)
> {
> int i, ret;
> @@ -1675,15 +1680,18 @@ static int do_register_framebuffer(struct fb_info *fb_info)
> registered_fb[i] = fb_info;
>
> event.info = fb_info;
> - console_lock();
> + if (!lockless_register_fb)
> + console_lock();
> if (!lock_fb_info(fb_info)) {
> - console_unlock();
> + if (!lockless_register_fb)
> + console_unlock();
> return -ENODEV;
> }
>
> fb_notifier_call_chain(FB_EVENT_FB_REGISTERED, &event);
> unlock_fb_info(fb_info);
> - console_unlock();
> + if (!lockless_register_fb)
> + console_unlock();
> return 0;
> }
>
> --
> 1.8.3.1
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply
* [PATCH v5 10/11] dma: rename dma_*_writecombine() to dma_*_wc()
From: Luis R. Rodriguez @ 2015-08-25 15:53 UTC (permalink / raw)
To: mingo
Cc: bp, bhelgaas, tomi.valkeinen, airlied, linux-fbdev, luto,
vinod.koul, dan.j.williams, toshi.kani, benh, mst, akpm,
daniel.vetter, konrad.wilk, x86, linux-kernel, linux-pci,
xen-devel, Luis R. Rodriguez
In-Reply-To: <1440443613-13696-11-git-send-email-mcgrof@do-not-panic.com>
From: "Luis R. Rodriguez" <mcgrof@suse.com>
Rename dma_*_writecombine() to dma_*_wc(), so that the naming
is coherent across the various write-combining APIs.
The following Coccinelle SmPL patch was used for this simple
transformation:
@ rename_dma_alloc_writecombine @
expression dev, size, dma_addr, gfp;
@@
-dma_alloc_writecombine(dev, size, dma_addr, gfp)
+dma_alloc_wc(dev, size, dma_addr, gfp)
@ rename_dma_free_writecombine @
expression dev, size, cpu_addr, dma_addr;
@@
-dma_free_writecombine(dev, size, cpu_addr, dma_addr)
+dma_free_wc(dev, size, cpu_addr, dma_addr)
@ rename_dma_mmap_writecombine @
expression dev, vma, cpu_addr, dma_addr, size;
@@
-dma_mmap_writecombine(dev, vma, cpu_addr, dma_addr, size)
+dma_mmap_wc(dev, vma, cpu_addr, dma_addr, size)
Generated-by: Coccinelle SmPL
Suggested-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
---
arch/arm/mach-lpc32xx/phy3250.c | 13 ++++++-------
arch/arm/mach-netx/fb.c | 14 ++++++--------
arch/arm/mach-nspire/clcd.c | 13 ++++++-------
arch/avr32/include/asm/dma-mapping.h | 20 ++++++++++----------
arch/avr32/mm/dma-coherent.c | 12 ++++++------
arch/metag/include/asm/dma-mapping.h | 4 ++--
arch/metag/kernel/dma.c | 6 +++---
drivers/dma/iop-adma.c | 8 ++++----
drivers/dma/mv_xor.c | 4 ++--
drivers/dma/qcom_bam_dma.c | 14 +++++++-------
drivers/gpu/drm/drm_gem_cma_helper.c | 13 ++++++-------
drivers/gpu/drm/omapdrm/omap_dmm_tiler.c | 13 ++++++-------
drivers/gpu/drm/omapdrm/omap_gem.c | 8 ++++----
drivers/gpu/drm/sti/sti_cursor.c | 20 ++++++++------------
drivers/gpu/drm/sti/sti_gdp.c | 3 +--
drivers/gpu/drm/sti/sti_hqvdp.c | 6 +++---
drivers/gpu/drm/tegra/gem.c | 11 +++++------
drivers/gpu/host1x/cdma.c | 8 ++++----
drivers/gpu/host1x/job.c | 10 ++++------
drivers/media/platform/coda/coda-bit.c | 10 +++++-----
drivers/video/fbdev/acornfb.c | 4 ++--
drivers/video/fbdev/amba-clcd-versatile.c | 14 ++++++--------
drivers/video/fbdev/amba-clcd.c | 4 ++--
drivers/video/fbdev/atmel_lcdfb.c | 9 +++++----
drivers/video/fbdev/ep93xx-fb.c | 8 +++-----
drivers/video/fbdev/gbefb.c | 8 ++++----
drivers/video/fbdev/imxfb.c | 12 ++++++------
drivers/video/fbdev/mx3fb.c | 9 ++++-----
drivers/video/fbdev/nuc900fb.c | 8 ++++----
drivers/video/fbdev/omap/lcdc.c | 16 ++++++++--------
drivers/video/fbdev/pxa168fb.c | 8 ++++----
drivers/video/fbdev/pxafb.c | 4 ++--
drivers/video/fbdev/s3c-fb.c | 7 +++----
drivers/video/fbdev/s3c2410fb.c | 8 ++++----
drivers/video/fbdev/sa1100fb.c | 8 ++++----
include/linux/dma-mapping.h | 16 ++++++++--------
sound/arm/pxa2xx-pcm-lib.c | 20 ++++++++------------
sound/soc/fsl/imx-pcm-fiq.c | 10 ++++------
sound/soc/nuc900/nuc900-pcm.c | 6 ++----
sound/soc/omap/omap-pcm.c | 12 ++++--------
40 files changed, 185 insertions(+), 216 deletions(-)
diff --git a/arch/arm/mach-lpc32xx/phy3250.c b/arch/arm/mach-lpc32xx/phy3250.c
index 7858d5b6f6ce..43ff56c2a7a9 100644
--- a/arch/arm/mach-lpc32xx/phy3250.c
+++ b/arch/arm/mach-lpc32xx/phy3250.c
@@ -86,8 +86,8 @@ static int lpc32xx_clcd_setup(struct clcd_fb *fb)
{
dma_addr_t dma;
- fb->fb.screen_base = dma_alloc_writecombine(&fb->dev->dev,
- PANEL_SIZE, &dma, GFP_KERNEL);
+ fb->fb.screen_base = dma_alloc_wc(&fb->dev->dev, PANEL_SIZE, &dma,
+ GFP_KERNEL);
if (!fb->fb.screen_base) {
printk(KERN_ERR "CLCD: unable to map framebuffer\n");
return -ENOMEM;
@@ -116,15 +116,14 @@ static int lpc32xx_clcd_setup(struct clcd_fb *fb)
static int lpc32xx_clcd_mmap(struct clcd_fb *fb, struct vm_area_struct *vma)
{
- return dma_mmap_writecombine(&fb->dev->dev, vma,
- fb->fb.screen_base, fb->fb.fix.smem_start,
- fb->fb.fix.smem_len);
+ return dma_mmap_wc(&fb->dev->dev, vma, fb->fb.screen_base,
+ fb->fb.fix.smem_start, fb->fb.fix.smem_len);
}
static void lpc32xx_clcd_remove(struct clcd_fb *fb)
{
- dma_free_writecombine(&fb->dev->dev, fb->fb.fix.smem_len,
- fb->fb.screen_base, fb->fb.fix.smem_start);
+ dma_free_wc(&fb->dev->dev, fb->fb.fix.smem_len, fb->fb.screen_base,
+ fb->fb.fix.smem_start);
}
/*
diff --git a/arch/arm/mach-netx/fb.c b/arch/arm/mach-netx/fb.c
index d122ee6ab991..8814ee5e98fd 100644
--- a/arch/arm/mach-netx/fb.c
+++ b/arch/arm/mach-netx/fb.c
@@ -42,8 +42,8 @@ int netx_clcd_setup(struct clcd_fb *fb)
fb->panel = netx_panel;
- fb->fb.screen_base = dma_alloc_writecombine(&fb->dev->dev, 1024*1024,
- &dma, GFP_KERNEL);
+ fb->fb.screen_base = dma_alloc_wc(&fb->dev->dev, 1024 * 1024, &dma,
+ GFP_KERNEL);
if (!fb->fb.screen_base) {
printk(KERN_ERR "CLCD: unable to map framebuffer\n");
return -ENOMEM;
@@ -57,16 +57,14 @@ int netx_clcd_setup(struct clcd_fb *fb)
int netx_clcd_mmap(struct clcd_fb *fb, struct vm_area_struct *vma)
{
- return dma_mmap_writecombine(&fb->dev->dev, vma,
- fb->fb.screen_base,
- fb->fb.fix.smem_start,
- fb->fb.fix.smem_len);
+ return dma_mmap_wc(&fb->dev->dev, vma, fb->fb.screen_base,
+ fb->fb.fix.smem_start, fb->fb.fix.smem_len);
}
void netx_clcd_remove(struct clcd_fb *fb)
{
- dma_free_writecombine(&fb->dev->dev, fb->fb.fix.smem_len,
- fb->fb.screen_base, fb->fb.fix.smem_start);
+ dma_free_wc(&fb->dev->dev, fb->fb.fix.smem_len, fb->fb.screen_base,
+ fb->fb.fix.smem_start);
}
static AMBA_AHB_DEVICE(fb, "fb", 0, 0x00104000, { NETX_IRQ_LCD }, NULL);
diff --git a/arch/arm/mach-nspire/clcd.c b/arch/arm/mach-nspire/clcd.c
index abea12617b17..ea0e5b2ca1cd 100644
--- a/arch/arm/mach-nspire/clcd.c
+++ b/arch/arm/mach-nspire/clcd.c
@@ -90,8 +90,8 @@ int nspire_clcd_setup(struct clcd_fb *fb)
panel_size = ((panel->mode.xres * panel->mode.yres) * panel->bpp) / 8;
panel_size = ALIGN(panel_size, PAGE_SIZE);
- fb->fb.screen_base = dma_alloc_writecombine(&fb->dev->dev,
- panel_size, &dma, GFP_KERNEL);
+ fb->fb.screen_base = dma_alloc_wc(&fb->dev->dev, panel_size, &dma,
+ GFP_KERNEL);
if (!fb->fb.screen_base) {
pr_err("CLCD: unable to map framebuffer\n");
@@ -107,13 +107,12 @@ int nspire_clcd_setup(struct clcd_fb *fb)
int nspire_clcd_mmap(struct clcd_fb *fb, struct vm_area_struct *vma)
{
- return dma_mmap_writecombine(&fb->dev->dev, vma,
- fb->fb.screen_base, fb->fb.fix.smem_start,
- fb->fb.fix.smem_len);
+ return dma_mmap_wc(&fb->dev->dev, vma, fb->fb.screen_base,
+ fb->fb.fix.smem_start, fb->fb.fix.smem_len);
}
void nspire_clcd_remove(struct clcd_fb *fb)
{
- dma_free_writecombine(&fb->dev->dev, fb->fb.fix.smem_len,
- fb->fb.screen_base, fb->fb.fix.smem_start);
+ dma_free_wc(&fb->dev->dev, fb->fb.fix.smem_len, fb->fb.screen_base,
+ fb->fb.fix.smem_start);
}
diff --git a/arch/avr32/include/asm/dma-mapping.h b/arch/avr32/include/asm/dma-mapping.h
index ae7ac9205d20..b43b11d1c7c0 100644
--- a/arch/avr32/include/asm/dma-mapping.h
+++ b/arch/avr32/include/asm/dma-mapping.h
@@ -71,7 +71,7 @@ extern void dma_free_coherent(struct device *dev, size_t size,
void *cpu_addr, dma_addr_t handle);
/**
- * dma_alloc_writecombine - allocate write-combining memory for DMA
+ * dma_alloc_wc - allocate write-combining memory for DMA
* @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
* @size: required memory size
* @handle: bus-specific DMA address
@@ -81,24 +81,24 @@ extern void dma_free_coherent(struct device *dev, size_t size,
* return the CPU-viewed address, and sets @handle to be the
* device-viewed address.
*/
-extern void *dma_alloc_writecombine(struct device *dev, size_t size,
- dma_addr_t *handle, gfp_t gfp);
+extern void *dma_alloc_wc(struct device *dev, size_t size,
+ dma_addr_t *handle, gfp_t gfp);
/**
- * dma_free_coherent - free memory allocated by dma_alloc_writecombine
+ * dma_free_coherent - free memory allocated by dma_alloc_wc
* @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
- * @size: size of memory originally requested in dma_alloc_writecombine
- * @cpu_addr: CPU-view address returned from dma_alloc_writecombine
- * @handle: device-view address returned from dma_alloc_writecombine
+ * @size: size of memory originally requested in dma_alloc_wc
+ * @cpu_addr: CPU-view address returned from dma_alloc_wc
+ * @handle: device-view address returned from dma_alloc_wc
*
* Free (and unmap) a DMA buffer previously allocated by
- * dma_alloc_writecombine().
+ * dma_alloc_wc().
*
* References to memory and mappings associated with cpu_addr/handle
* during and after this call executing are illegal.
*/
-extern void dma_free_writecombine(struct device *dev, size_t size,
- void *cpu_addr, dma_addr_t handle);
+extern void dma_free_wc(struct device *dev, size_t size,
+ void *cpu_addr, dma_addr_t handle);
/**
* dma_map_single - map a single buffer for streaming DMA
diff --git a/arch/avr32/mm/dma-coherent.c b/arch/avr32/mm/dma-coherent.c
index 50cdb5b10f0f..5d029d202a2a 100644
--- a/arch/avr32/mm/dma-coherent.c
+++ b/arch/avr32/mm/dma-coherent.c
@@ -121,8 +121,8 @@ void dma_free_coherent(struct device *dev, size_t size,
}
EXPORT_SYMBOL(dma_free_coherent);
-void *dma_alloc_writecombine(struct device *dev, size_t size,
- dma_addr_t *handle, gfp_t gfp)
+void *dma_alloc_wc(struct device *dev, size_t size,
+ dma_addr_t *handle, gfp_t gfp)
{
struct page *page;
dma_addr_t phys;
@@ -137,10 +137,10 @@ void *dma_alloc_writecombine(struct device *dev, size_t size,
/* Now, map the page into P3 with write-combining turned on */
return __ioremap(phys, size, _PAGE_BUFFER);
}
-EXPORT_SYMBOL(dma_alloc_writecombine);
+EXPORT_SYMBOL(dma_alloc_wc);
-void dma_free_writecombine(struct device *dev, size_t size,
- void *cpu_addr, dma_addr_t handle)
+void dma_free_wc(struct device *dev, size_t size,
+ void *cpu_addr, dma_addr_t handle)
{
struct page *page;
@@ -149,4 +149,4 @@ void dma_free_writecombine(struct device *dev, size_t size,
page = phys_to_page(handle);
__dma_free(dev, size, page, handle);
}
-EXPORT_SYMBOL(dma_free_writecombine);
+EXPORT_SYMBOL(dma_free_wc);
diff --git a/arch/metag/include/asm/dma-mapping.h b/arch/metag/include/asm/dma-mapping.h
index eb5cdec94be0..d727deae083a 100644
--- a/arch/metag/include/asm/dma-mapping.h
+++ b/arch/metag/include/asm/dma-mapping.h
@@ -23,8 +23,8 @@ void dma_sync_for_cpu(void *vaddr, size_t size, int dma_direction);
int dma_mmap_coherent(struct device *dev, struct vm_area_struct *vma,
void *cpu_addr, dma_addr_t dma_addr, size_t size);
-int dma_mmap_writecombine(struct device *dev, struct vm_area_struct *vma,
- void *cpu_addr, dma_addr_t dma_addr, size_t size);
+int dma_mmap_wc(struct device *dev, struct vm_area_struct *vma,
+ void *cpu_addr, dma_addr_t dma_addr, size_t size);
static inline dma_addr_t
dma_map_single(struct device *dev, void *ptr, size_t size,
diff --git a/arch/metag/kernel/dma.c b/arch/metag/kernel/dma.c
index c700d625067a..89138b4f717a 100644
--- a/arch/metag/kernel/dma.c
+++ b/arch/metag/kernel/dma.c
@@ -372,13 +372,13 @@ int dma_mmap_coherent(struct device *dev, struct vm_area_struct *vma,
}
EXPORT_SYMBOL(dma_mmap_coherent);
-int dma_mmap_writecombine(struct device *dev, struct vm_area_struct *vma,
- void *cpu_addr, dma_addr_t dma_addr, size_t size)
+int dma_mmap_wc(struct device *dev, struct vm_area_struct *vma,
+ void *cpu_addr, dma_addr_t dma_addr, size_t size)
{
vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
return dma_mmap(dev, vma, cpu_addr, dma_addr, size);
}
-EXPORT_SYMBOL(dma_mmap_writecombine);
+EXPORT_SYMBOL(dma_mmap_wc);
diff --git a/drivers/dma/iop-adma.c b/drivers/dma/iop-adma.c
index e4f43125e0fb..f039cfadf17b 100644
--- a/drivers/dma/iop-adma.c
+++ b/drivers/dma/iop-adma.c
@@ -1300,10 +1300,10 @@ static int iop_adma_probe(struct platform_device *pdev)
* note: writecombine gives slightly better performance, but
* requires that we explicitly flush the writes
*/
- adev->dma_desc_pool_virt = dma_alloc_writecombine(&pdev->dev,
- plat_data->pool_size,
- &adev->dma_desc_pool,
- GFP_KERNEL);
+ adev->dma_desc_pool_virt = dma_alloc_wc(&pdev->dev,
+ plat_data->pool_size,
+ &adev->dma_desc_pool,
+ GFP_KERNEL);
if (!adev->dma_desc_pool_virt) {
ret = -ENOMEM;
goto err_free_adev;
diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c
index f1325f62563e..872a385a66fe 100644
--- a/drivers/dma/mv_xor.c
+++ b/drivers/dma/mv_xor.c
@@ -1000,8 +1000,8 @@ mv_xor_channel_add(struct mv_xor_device *xordev,
* requires that we explicitly flush the writes
*/
mv_chan->dma_desc_pool_virt - dma_alloc_writecombine(&pdev->dev, MV_XOR_POOL_SIZE,
- &mv_chan->dma_desc_pool, GFP_KERNEL);
+ dma_alloc_wc(&pdev->dev, MV_XOR_POOL_SIZE, &mv_chan->dma_desc_pool,
+ GFP_KERNEL);
if (!mv_chan->dma_desc_pool_virt)
return ERR_PTR(-ENOMEM);
diff --git a/drivers/dma/qcom_bam_dma.c b/drivers/dma/qcom_bam_dma.c
index 5a250cdc8376..d34aef7a101b 100644
--- a/drivers/dma/qcom_bam_dma.c
+++ b/drivers/dma/qcom_bam_dma.c
@@ -502,8 +502,8 @@ static int bam_alloc_chan(struct dma_chan *chan)
return 0;
/* allocate FIFO descriptor space, but only if necessary */
- bchan->fifo_virt = dma_alloc_writecombine(bdev->dev, BAM_DESC_FIFO_SIZE,
- &bchan->fifo_phys, GFP_KERNEL);
+ bchan->fifo_virt = dma_alloc_wc(bdev->dev, BAM_DESC_FIFO_SIZE,
+ &bchan->fifo_phys, GFP_KERNEL);
if (!bchan->fifo_virt) {
dev_err(bdev->dev, "Failed to allocate desc fifo\n");
@@ -538,8 +538,8 @@ static void bam_free_chan(struct dma_chan *chan)
bam_reset_channel(bchan);
spin_unlock_irqrestore(&bchan->vc.lock, flags);
- dma_free_writecombine(bdev->dev, BAM_DESC_FIFO_SIZE, bchan->fifo_virt,
- bchan->fifo_phys);
+ dma_free_wc(bdev->dev, BAM_DESC_FIFO_SIZE, bchan->fifo_virt,
+ bchan->fifo_phys);
bchan->fifo_virt = NULL;
/* mask irq for pipe/channel */
@@ -1231,9 +1231,9 @@ static int bam_dma_remove(struct platform_device *pdev)
bam_dma_terminate_all(&bdev->channels[i].vc.chan);
tasklet_kill(&bdev->channels[i].vc.task);
- dma_free_writecombine(bdev->dev, BAM_DESC_FIFO_SIZE,
- bdev->channels[i].fifo_virt,
- bdev->channels[i].fifo_phys);
+ dma_free_wc(bdev->dev, BAM_DESC_FIFO_SIZE,
+ bdev->channels[i].fifo_virt,
+ bdev->channels[i].fifo_phys);
}
tasklet_kill(&bdev->task);
diff --git a/drivers/gpu/drm/drm_gem_cma_helper.c b/drivers/gpu/drm/drm_gem_cma_helper.c
index bd75f303da63..138142fcaf75 100644
--- a/drivers/gpu/drm/drm_gem_cma_helper.c
+++ b/drivers/gpu/drm/drm_gem_cma_helper.c
@@ -107,8 +107,8 @@ struct drm_gem_cma_object *drm_gem_cma_create(struct drm_device *drm,
if (IS_ERR(cma_obj))
return cma_obj;
- cma_obj->vaddr = dma_alloc_writecombine(drm->dev, size,
- &cma_obj->paddr, GFP_KERNEL | __GFP_NOWARN);
+ cma_obj->vaddr = dma_alloc_wc(drm->dev, size, &cma_obj->paddr,
+ GFP_KERNEL | __GFP_NOWARN);
if (!cma_obj->vaddr) {
dev_err(drm->dev, "failed to allocate buffer with size %zu\n",
size);
@@ -190,8 +190,8 @@ void drm_gem_cma_free_object(struct drm_gem_object *gem_obj)
cma_obj = to_drm_gem_cma_obj(gem_obj);
if (cma_obj->vaddr) {
- dma_free_writecombine(gem_obj->dev->dev, cma_obj->base.size,
- cma_obj->vaddr, cma_obj->paddr);
+ dma_free_wc(gem_obj->dev->dev, cma_obj->base.size,
+ cma_obj->vaddr, cma_obj->paddr);
} else if (gem_obj->import_attach) {
drm_prime_gem_destroy(gem_obj, cma_obj->sgt);
}
@@ -327,9 +327,8 @@ static int drm_gem_cma_mmap_obj(struct drm_gem_cma_object *cma_obj,
vma->vm_flags &= ~VM_PFNMAP;
vma->vm_pgoff = 0;
- ret = dma_mmap_writecombine(cma_obj->base.dev->dev, vma,
- cma_obj->vaddr, cma_obj->paddr,
- vma->vm_end - vma->vm_start);
+ ret = dma_mmap_wc(cma_obj->base.dev->dev, vma, cma_obj->vaddr,
+ cma_obj->paddr, vma->vm_end - vma->vm_start);
if (ret)
drm_gem_vm_close(vma);
diff --git a/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c b/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c
index 7841970de48d..43f0697ce752 100644
--- a/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c
+++ b/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c
@@ -570,10 +570,9 @@ static int omap_dmm_remove(struct platform_device *dev)
kfree(omap_dmm->engines);
if (omap_dmm->refill_va)
- dma_free_writecombine(omap_dmm->dev,
- REFILL_BUFFER_SIZE * omap_dmm->num_engines,
- omap_dmm->refill_va,
- omap_dmm->refill_pa);
+ dma_free_wc(omap_dmm->dev,
+ REFILL_BUFFER_SIZE * omap_dmm->num_engines,
+ omap_dmm->refill_va, omap_dmm->refill_pa);
if (omap_dmm->dummy_page)
__free_page(omap_dmm->dummy_page);
@@ -698,9 +697,9 @@ static int omap_dmm_probe(struct platform_device *dev)
omap_dmm->dummy_pa = page_to_phys(omap_dmm->dummy_page);
/* alloc refill memory */
- omap_dmm->refill_va = dma_alloc_writecombine(&dev->dev,
- REFILL_BUFFER_SIZE * omap_dmm->num_engines,
- &omap_dmm->refill_pa, GFP_KERNEL);
+ omap_dmm->refill_va = dma_alloc_wc(&dev->dev,
+ REFILL_BUFFER_SIZE * omap_dmm->num_engines,
+ &omap_dmm->refill_pa, GFP_KERNEL);
if (!omap_dmm->refill_va) {
dev_err(&dev->dev, "could not allocate refill memory\n");
goto fail;
diff --git a/drivers/gpu/drm/omapdrm/omap_gem.c b/drivers/gpu/drm/omapdrm/omap_gem.c
index 7ed08fdc4c42..be3635b93527 100644
--- a/drivers/gpu/drm/omapdrm/omap_gem.c
+++ b/drivers/gpu/drm/omapdrm/omap_gem.c
@@ -1295,8 +1295,8 @@ void omap_gem_free_object(struct drm_gem_object *obj)
omap_gem_detach_pages(obj);
if (!is_shmem(obj)) {
- dma_free_writecombine(dev->dev, obj->size,
- omap_obj->vaddr, omap_obj->paddr);
+ dma_free_wc(dev->dev, obj->size, omap_obj->vaddr,
+ omap_obj->paddr);
} else if (omap_obj->vaddr) {
vunmap(omap_obj->vaddr);
}
@@ -1384,8 +1384,8 @@ struct drm_gem_object *omap_gem_new(struct drm_device *dev,
/* attempt to allocate contiguous memory if we don't
* have DMM for remappign discontiguous buffers
*/
- omap_obj->vaddr = dma_alloc_writecombine(dev->dev, size,
- &omap_obj->paddr, GFP_KERNEL);
+ omap_obj->vaddr = dma_alloc_wc(dev->dev, size,
+ &omap_obj->paddr, GFP_KERNEL);
if (!omap_obj->vaddr) {
kfree(omap_obj);
diff --git a/drivers/gpu/drm/sti/sti_cursor.c b/drivers/gpu/drm/sti/sti_cursor.c
index 010eaee60bf7..75bdbf140fb0 100644
--- a/drivers/gpu/drm/sti/sti_cursor.c
+++ b/drivers/gpu/drm/sti/sti_cursor.c
@@ -124,17 +124,15 @@ static int sti_cursor_prepare_layer(struct sti_layer *layer, bool first_prepare)
cursor->height = layer->src_h;
if (cursor->pixmap.base)
- dma_free_writecombine(layer->dev,
- cursor->pixmap.size,
- cursor->pixmap.base,
- cursor->pixmap.paddr);
+ dma_free_wc(layer->dev, cursor->pixmap.size,
+ cursor->pixmap.base, cursor->pixmap.paddr);
cursor->pixmap.size = cursor->width * cursor->height;
- cursor->pixmap.base = dma_alloc_writecombine(layer->dev,
- cursor->pixmap.size,
- &cursor->pixmap.paddr,
- GFP_KERNEL | GFP_DMA);
+ cursor->pixmap.base = dma_alloc_wc(layer->dev,
+ cursor->pixmap.size,
+ &cursor->pixmap.paddr,
+ GFP_KERNEL | GFP_DMA);
if (!cursor->pixmap.base) {
DRM_ERROR("Failed to allocate memory for pixmap\n");
return -ENOMEM;
@@ -225,10 +223,8 @@ struct sti_layer *sti_cursor_create(struct device *dev)
}
/* Allocate clut buffer */
- cursor->clut = dma_alloc_writecombine(dev,
- 0x100 * sizeof(unsigned short),
- &cursor->clut_paddr,
- GFP_KERNEL | GFP_DMA);
+ cursor->clut = dma_alloc_wc(dev, 0x100 * sizeof(unsigned short),
+ &cursor->clut_paddr, GFP_KERNEL | GFP_DMA);
if (!cursor->clut) {
DRM_ERROR("Failed to allocate memory for cursor clut\n");
diff --git a/drivers/gpu/drm/sti/sti_gdp.c b/drivers/gpu/drm/sti/sti_gdp.c
index 087906fd8846..9bf293ee3bc3 100644
--- a/drivers/gpu/drm/sti/sti_gdp.c
+++ b/drivers/gpu/drm/sti/sti_gdp.c
@@ -490,8 +490,7 @@ static void sti_gdp_init(struct sti_layer *layer)
/* Allocate all the nodes within a single memory page */
size = sizeof(struct sti_gdp_node) *
GDP_NODE_PER_FIELD * GDP_NODE_NB_BANK;
- base = dma_alloc_writecombine(layer->dev,
- size, &dma_addr, GFP_KERNEL | GFP_DMA);
+ base = dma_alloc_wc(layer->dev, size, &dma_addr, GFP_KERNEL | GFP_DMA);
if (!base) {
DRM_ERROR("Failed to allocate memory for GDP node\n");
diff --git a/drivers/gpu/drm/sti/sti_hqvdp.c b/drivers/gpu/drm/sti/sti_hqvdp.c
index b0eb62de1b2e..025f48795b9c 100644
--- a/drivers/gpu/drm/sti/sti_hqvdp.c
+++ b/drivers/gpu/drm/sti/sti_hqvdp.c
@@ -788,9 +788,9 @@ static void sti_hqvd_init(struct sti_layer *layer)
/* Allocate memory for the VDP commands */
size = NB_VDP_CMD * sizeof(struct sti_hqvdp_cmd);
- hqvdp->hqvdp_cmd = dma_alloc_writecombine(hqvdp->dev, size,
- &hqvdp->hqvdp_cmd_paddr,
- GFP_KERNEL | GFP_DMA);
+ hqvdp->hqvdp_cmd = dma_alloc_wc(hqvdp->dev, size,
+ &hqvdp->hqvdp_cmd_paddr,
+ GFP_KERNEL | GFP_DMA);
if (!hqvdp->hqvdp_cmd) {
DRM_ERROR("Failed to allocate memory for VDP cmd\n");
return;
diff --git a/drivers/gpu/drm/tegra/gem.c b/drivers/gpu/drm/tegra/gem.c
index 01e16e146bfe..82777d424f23 100644
--- a/drivers/gpu/drm/tegra/gem.c
+++ b/drivers/gpu/drm/tegra/gem.c
@@ -181,8 +181,7 @@ static void tegra_bo_free(struct drm_device *drm, struct tegra_bo *bo)
sg_free_table(bo->sgt);
kfree(bo->sgt);
} else if (bo->vaddr) {
- dma_free_writecombine(drm->dev, bo->gem.size, bo->vaddr,
- bo->paddr);
+ dma_free_wc(drm->dev, bo->gem.size, bo->vaddr, bo->paddr);
}
}
@@ -239,8 +238,8 @@ static int tegra_bo_alloc(struct drm_device *drm, struct tegra_bo *bo)
} else {
size_t size = bo->gem.size;
- bo->vaddr = dma_alloc_writecombine(drm->dev, size, &bo->paddr,
- GFP_KERNEL | __GFP_NOWARN);
+ bo->vaddr = dma_alloc_wc(drm->dev, size, &bo->paddr,
+ GFP_KERNEL | __GFP_NOWARN);
if (!bo->vaddr) {
dev_err(drm->dev,
"failed to allocate buffer of size %zu\n",
@@ -483,8 +482,8 @@ int tegra_drm_mmap(struct file *file, struct vm_area_struct *vma)
vma->vm_flags &= ~VM_PFNMAP;
vma->vm_pgoff = 0;
- ret = dma_mmap_writecombine(gem->dev->dev, vma, bo->vaddr,
- bo->paddr, gem->size);
+ ret = dma_mmap_wc(gem->dev->dev, vma, bo->vaddr, bo->paddr,
+ gem->size);
if (ret) {
drm_gem_vm_close(vma);
return ret;
diff --git a/drivers/gpu/host1x/cdma.c b/drivers/gpu/host1x/cdma.c
index 5a8c8d55317a..a18db4d5347c 100644
--- a/drivers/gpu/host1x/cdma.c
+++ b/drivers/gpu/host1x/cdma.c
@@ -52,8 +52,8 @@ static void host1x_pushbuffer_destroy(struct push_buffer *pb)
struct host1x *host1x = cdma_to_host1x(cdma);
if (pb->phys != 0)
- dma_free_writecombine(host1x->dev, pb->size_bytes + 4,
- pb->mapped, pb->phys);
+ dma_free_wc(host1x->dev, pb->size_bytes + 4, pb->mapped,
+ pb->phys);
pb->mapped = NULL;
pb->phys = 0;
@@ -76,8 +76,8 @@ static int host1x_pushbuffer_init(struct push_buffer *pb)
pb->pos = 0;
/* allocate and map pushbuffer memory */
- pb->mapped = dma_alloc_writecombine(host1x->dev, pb->size_bytes + 4,
- &pb->phys, GFP_KERNEL);
+ pb->mapped = dma_alloc_wc(host1x->dev, pb->size_bytes + 4, &pb->phys,
+ GFP_KERNEL);
if (!pb->mapped)
goto fail;
diff --git a/drivers/gpu/host1x/job.c b/drivers/gpu/host1x/job.c
index 63bd63f3c7df..defa7995f213 100644
--- a/drivers/gpu/host1x/job.c
+++ b/drivers/gpu/host1x/job.c
@@ -467,9 +467,8 @@ static inline int copy_gathers(struct host1x_job *job, struct device *dev)
size += g->words * sizeof(u32);
}
- job->gather_copy_mapped = dma_alloc_writecombine(dev, size,
- &job->gather_copy,
- GFP_KERNEL);
+ job->gather_copy_mapped = dma_alloc_wc(dev, size, &job->gather_copy,
+ GFP_KERNEL);
if (!job->gather_copy_mapped) {
job->gather_copy_mapped = NULL;
return -ENOMEM;
@@ -578,9 +577,8 @@ void host1x_job_unpin(struct host1x_job *job)
job->num_unpins = 0;
if (job->gather_copy_size)
- dma_free_writecombine(job->channel->dev, job->gather_copy_size,
- job->gather_copy_mapped,
- job->gather_copy);
+ dma_free_wc(job->channel->dev, job->gather_copy_size,
+ job->gather_copy_mapped, job->gather_copy);
}
EXPORT_SYMBOL(host1x_job_unpin);
diff --git a/drivers/media/platform/coda/coda-bit.c b/drivers/media/platform/coda/coda-bit.c
index 109797bb8fbb..d1e1658a4f35 100644
--- a/drivers/media/platform/coda/coda-bit.c
+++ b/drivers/media/platform/coda/coda-bit.c
@@ -1373,9 +1373,9 @@ static int coda_alloc_bitstream_buffer(struct coda_ctx *ctx,
return 0;
ctx->bitstream.size = roundup_pow_of_two(q_data->sizeimage * 2);
- ctx->bitstream.vaddr = dma_alloc_writecombine(
- &ctx->dev->plat_dev->dev, ctx->bitstream.size,
- &ctx->bitstream.paddr, GFP_KERNEL);
+ ctx->bitstream.vaddr = dma_alloc_wc(&ctx->dev->plat_dev->dev,
+ ctx->bitstream.size,
+ &ctx->bitstream.paddr, GFP_KERNEL);
if (!ctx->bitstream.vaddr) {
v4l2_err(&ctx->dev->v4l2_dev,
"failed to allocate bitstream ringbuffer");
@@ -1392,8 +1392,8 @@ static void coda_free_bitstream_buffer(struct coda_ctx *ctx)
if (ctx->bitstream.vaddr = NULL)
return;
- dma_free_writecombine(&ctx->dev->plat_dev->dev, ctx->bitstream.size,
- ctx->bitstream.vaddr, ctx->bitstream.paddr);
+ dma_free_wc(&ctx->dev->plat_dev->dev, ctx->bitstream.size,
+ ctx->bitstream.vaddr, ctx->bitstream.paddr);
ctx->bitstream.vaddr = NULL;
kfifo_init(&ctx->bitstream_fifo, NULL, 0);
}
diff --git a/drivers/video/fbdev/acornfb.c b/drivers/video/fbdev/acornfb.c
index a305caea58ee..fb75b7e5a19a 100644
--- a/drivers/video/fbdev/acornfb.c
+++ b/drivers/video/fbdev/acornfb.c
@@ -1040,8 +1040,8 @@ static int acornfb_probe(struct platform_device *dev)
* for the framebuffer if we are not using
* VRAM.
*/
- base = dma_alloc_writecombine(current_par.dev, size, &handle,
- GFP_KERNEL);
+ base = dma_alloc_wc(current_par.dev, size, &handle,
+ GFP_KERNEL);
if (base = NULL) {
printk(KERN_ERR "acornfb: unable to allocate screen "
"memory\n");
diff --git a/drivers/video/fbdev/amba-clcd-versatile.c b/drivers/video/fbdev/amba-clcd-versatile.c
index 7a8afcd4573e..a8a22daa3f9d 100644
--- a/drivers/video/fbdev/amba-clcd-versatile.c
+++ b/drivers/video/fbdev/amba-clcd-versatile.c
@@ -154,8 +154,8 @@ int versatile_clcd_setup_dma(struct clcd_fb *fb, unsigned long framesize)
{
dma_addr_t dma;
- fb->fb.screen_base = dma_alloc_writecombine(&fb->dev->dev, framesize,
- &dma, GFP_KERNEL);
+ fb->fb.screen_base = dma_alloc_wc(&fb->dev->dev, framesize, &dma,
+ GFP_KERNEL);
if (!fb->fb.screen_base) {
pr_err("CLCD: unable to map framebuffer\n");
return -ENOMEM;
@@ -169,14 +169,12 @@ int versatile_clcd_setup_dma(struct clcd_fb *fb, unsigned long framesize)
int versatile_clcd_mmap_dma(struct clcd_fb *fb, struct vm_area_struct *vma)
{
- return dma_mmap_writecombine(&fb->dev->dev, vma,
- fb->fb.screen_base,
- fb->fb.fix.smem_start,
- fb->fb.fix.smem_len);
+ return dma_mmap_wc(&fb->dev->dev, vma, fb->fb.screen_base,
+ fb->fb.fix.smem_start, fb->fb.fix.smem_len);
}
void versatile_clcd_remove_dma(struct clcd_fb *fb)
{
- dma_free_writecombine(&fb->dev->dev, fb->fb.fix.smem_len,
- fb->fb.screen_base, fb->fb.fix.smem_start);
+ dma_free_wc(&fb->dev->dev, fb->fb.fix.smem_len, fb->fb.screen_base,
+ fb->fb.fix.smem_start);
}
diff --git a/drivers/video/fbdev/amba-clcd.c b/drivers/video/fbdev/amba-clcd.c
index 9362424c2340..fe274b5851c7 100644
--- a/drivers/video/fbdev/amba-clcd.c
+++ b/drivers/video/fbdev/amba-clcd.c
@@ -774,8 +774,8 @@ static int clcdfb_of_dma_setup(struct clcd_fb *fb)
static int clcdfb_of_dma_mmap(struct clcd_fb *fb, struct vm_area_struct *vma)
{
- return dma_mmap_writecombine(&fb->dev->dev, vma, fb->fb.screen_base,
- fb->fb.fix.smem_start, fb->fb.fix.smem_len);
+ return dma_mmap_wc(&fb->dev->dev, vma, fb->fb.screen_base,
+ fb->fb.fix.smem_start, fb->fb.fix.smem_len);
}
static void clcdfb_of_dma_remove(struct clcd_fb *fb)
diff --git a/drivers/video/fbdev/atmel_lcdfb.c b/drivers/video/fbdev/atmel_lcdfb.c
index abadc490fa1f..689fb9d99988 100644
--- a/drivers/video/fbdev/atmel_lcdfb.c
+++ b/drivers/video/fbdev/atmel_lcdfb.c
@@ -415,8 +415,8 @@ static inline void atmel_lcdfb_free_video_memory(struct atmel_lcdfb_info *sinfo)
{
struct fb_info *info = sinfo->info;
- dma_free_writecombine(info->device, info->fix.smem_len,
- info->screen_base, info->fix.smem_start);
+ dma_free_wc(info->device, info->fix.smem_len, info->screen_base,
+ info->fix.smem_start);
}
/**
@@ -436,8 +436,9 @@ static int atmel_lcdfb_alloc_video_memory(struct atmel_lcdfb_info *sinfo)
* ((var->bits_per_pixel + 7) / 8));
info->fix.smem_len = max(smem_len, sinfo->smem_len);
- info->screen_base = dma_alloc_writecombine(info->device, info->fix.smem_len,
- (dma_addr_t *)&info->fix.smem_start, GFP_KERNEL);
+ info->screen_base = dma_alloc_wc(info->device, info->fix.smem_len,
+ (dma_addr_t *)&info->fix.smem_start,
+ GFP_KERNEL);
if (!info->screen_base) {
return -ENOMEM;
diff --git a/drivers/video/fbdev/ep93xx-fb.c b/drivers/video/fbdev/ep93xx-fb.c
index 7ec251cc9c03..e876b83e4600 100644
--- a/drivers/video/fbdev/ep93xx-fb.c
+++ b/drivers/video/fbdev/ep93xx-fb.c
@@ -316,9 +316,8 @@ static int ep93xxfb_mmap(struct fb_info *info, struct vm_area_struct *vma)
unsigned int offset = vma->vm_pgoff << PAGE_SHIFT;
if (offset < info->fix.smem_len) {
- return dma_mmap_writecombine(info->dev, vma, info->screen_base,
- info->fix.smem_start,
- info->fix.smem_len);
+ return dma_mmap_wc(info->dev, vma, info->screen_base,
+ info->fix.smem_start, info->fix.smem_len);
}
return -EINVAL;
@@ -449,8 +448,7 @@ static int ep93xxfb_alloc_videomem(struct fb_info *info)
unsigned int fb_size;
fb_size = ep93xxfb_calc_fbsize(fbi->mach_info);
- virt_addr = dma_alloc_writecombine(info->dev, fb_size,
- &phys_addr, GFP_KERNEL);
+ virt_addr = dma_alloc_wc(info->dev, fb_size, &phys_addr, GFP_KERNEL);
if (!virt_addr)
return -ENOMEM;
diff --git a/drivers/video/fbdev/gbefb.c b/drivers/video/fbdev/gbefb.c
index b63d55f481fa..1a242b1338e9 100644
--- a/drivers/video/fbdev/gbefb.c
+++ b/drivers/video/fbdev/gbefb.c
@@ -1185,8 +1185,8 @@ static int gbefb_probe(struct platform_device *p_dev)
} else {
/* try to allocate memory with the classical allocator
* this has high chance to fail on low memory machines */
- gbe_mem = dma_alloc_writecombine(NULL, gbe_mem_size,
- &gbe_dma_addr, GFP_KERNEL);
+ gbe_mem = dma_alloc_wc(NULL, gbe_mem_size, &gbe_dma_addr,
+ GFP_KERNEL);
if (!gbe_mem) {
printk(KERN_ERR "gbefb: couldn't allocate framebuffer memory\n");
ret = -ENOMEM;
@@ -1238,7 +1238,7 @@ static int gbefb_probe(struct platform_device *p_dev)
out_gbe_unmap:
arch_phys_wc_del(par->wc_cookie);
if (gbe_dma_addr)
- dma_free_writecombine(NULL, gbe_mem_size, gbe_mem, gbe_mem_phys);
+ dma_free_wc(NULL, gbe_mem_size, gbe_mem, gbe_mem_phys);
out_tiles_free:
dma_free_coherent(NULL, GBE_TLB_SIZE * sizeof(uint16_t),
(void *)gbe_tiles.cpu, gbe_tiles.dma);
@@ -1259,7 +1259,7 @@ static int gbefb_remove(struct platform_device* p_dev)
gbe_turn_off();
arch_phys_wc_del(par->wc_cookie);
if (gbe_dma_addr)
- dma_free_writecombine(NULL, gbe_mem_size, gbe_mem, gbe_mem_phys);
+ dma_free_wc(NULL, gbe_mem_size, gbe_mem, gbe_mem_phys);
dma_free_coherent(NULL, GBE_TLB_SIZE * sizeof(uint16_t),
(void *)gbe_tiles.cpu, gbe_tiles.dma);
release_mem_region(GBE_BASE, sizeof(struct sgi_gbe));
diff --git a/drivers/video/fbdev/imxfb.c b/drivers/video/fbdev/imxfb.c
index cee88603efc9..465b3387c549 100644
--- a/drivers/video/fbdev/imxfb.c
+++ b/drivers/video/fbdev/imxfb.c
@@ -922,8 +922,8 @@ static int imxfb_probe(struct platform_device *pdev)
}
fbi->map_size = PAGE_ALIGN(info->fix.smem_len);
- info->screen_base = dma_alloc_writecombine(&pdev->dev, fbi->map_size,
- &fbi->map_dma, GFP_KERNEL);
+ info->screen_base = dma_alloc_wc(&pdev->dev, fbi->map_size,
+ &fbi->map_dma, GFP_KERNEL);
if (!info->screen_base) {
dev_err(&pdev->dev, "Failed to allocate video RAM: %d\n", ret);
@@ -990,8 +990,8 @@ failed_cmap:
if (pdata && pdata->exit)
pdata->exit(fbi->pdev);
failed_platform_init:
- dma_free_writecombine(&pdev->dev, fbi->map_size, info->screen_base,
- fbi->map_dma);
+ dma_free_wc(&pdev->dev, fbi->map_size, info->screen_base,
+ fbi->map_dma);
failed_map:
iounmap(fbi->regs);
failed_ioremap:
@@ -1026,8 +1026,8 @@ static int imxfb_remove(struct platform_device *pdev)
kfree(info->pseudo_palette);
framebuffer_release(info);
- dma_free_writecombine(&pdev->dev, fbi->map_size, info->screen_base,
- fbi->map_dma);
+ dma_free_wc(&pdev->dev, fbi->map_size, info->screen_base,
+ fbi->map_dma);
iounmap(fbi->regs);
release_mem_region(res->start, resource_size(res));
diff --git a/drivers/video/fbdev/mx3fb.c b/drivers/video/fbdev/mx3fb.c
index 7947634ee6b0..f91b1db262b0 100644
--- a/drivers/video/fbdev/mx3fb.c
+++ b/drivers/video/fbdev/mx3fb.c
@@ -1336,9 +1336,8 @@ static int mx3fb_map_video_memory(struct fb_info *fbi, unsigned int mem_len,
int retval = 0;
dma_addr_t addr;
- fbi->screen_base = dma_alloc_writecombine(fbi->device,
- mem_len,
- &addr, GFP_DMA | GFP_KERNEL);
+ fbi->screen_base = dma_alloc_wc(fbi->device, mem_len, &addr,
+ GFP_DMA | GFP_KERNEL);
if (!fbi->screen_base) {
dev_err(fbi->device, "Cannot allocate %u bytes framebuffer memory\n",
@@ -1378,8 +1377,8 @@ err0:
*/
static int mx3fb_unmap_video_memory(struct fb_info *fbi)
{
- dma_free_writecombine(fbi->device, fbi->fix.smem_len,
- fbi->screen_base, fbi->fix.smem_start);
+ dma_free_wc(fbi->device, fbi->fix.smem_len, fbi->screen_base,
+ fbi->fix.smem_start);
fbi->screen_base = NULL;
mutex_lock(&fbi->mm_lock);
diff --git a/drivers/video/fbdev/nuc900fb.c b/drivers/video/fbdev/nuc900fb.c
index 389fa2cbb713..6680edae4696 100644
--- a/drivers/video/fbdev/nuc900fb.c
+++ b/drivers/video/fbdev/nuc900fb.c
@@ -396,8 +396,8 @@ static int nuc900fb_map_video_memory(struct fb_info *info)
dev_dbg(fbi->dev, "nuc900fb_map_video_memory(fbi=%p) map_size %lu\n",
fbi, map_size);
- info->screen_base = dma_alloc_writecombine(fbi->dev, map_size,
- &map_dma, GFP_KERNEL);
+ info->screen_base = dma_alloc_wc(fbi->dev, map_size, &map_dma,
+ GFP_KERNEL);
if (!info->screen_base)
return -ENOMEM;
@@ -411,8 +411,8 @@ static int nuc900fb_map_video_memory(struct fb_info *info)
static inline void nuc900fb_unmap_video_memory(struct fb_info *info)
{
struct nuc900fb_info *fbi = info->par;
- dma_free_writecombine(fbi->dev, PAGE_ALIGN(info->fix.smem_len),
- info->screen_base, info->fix.smem_start);
+ dma_free_wc(fbi->dev, PAGE_ALIGN(info->fix.smem_len),
+ info->screen_base, info->fix.smem_start);
}
static irqreturn_t nuc900fb_irqhandler(int irq, void *dev_id)
diff --git a/drivers/video/fbdev/omap/lcdc.c b/drivers/video/fbdev/omap/lcdc.c
index 6efa2591eaa8..e3d9b9ea5498 100644
--- a/drivers/video/fbdev/omap/lcdc.c
+++ b/drivers/video/fbdev/omap/lcdc.c
@@ -612,8 +612,8 @@ static void lcdc_dma_handler(u16 status, void *data)
static int alloc_palette_ram(void)
{
- lcdc.palette_virt = dma_alloc_writecombine(lcdc.fbdev->dev,
- MAX_PALETTE_SIZE, &lcdc.palette_phys, GFP_KERNEL);
+ lcdc.palette_virt = dma_alloc_wc(lcdc.fbdev->dev, MAX_PALETTE_SIZE,
+ &lcdc.palette_phys, GFP_KERNEL);
if (lcdc.palette_virt = NULL) {
dev_err(lcdc.fbdev->dev, "failed to alloc palette memory\n");
return -ENOMEM;
@@ -625,8 +625,8 @@ static int alloc_palette_ram(void)
static void free_palette_ram(void)
{
- dma_free_writecombine(lcdc.fbdev->dev, MAX_PALETTE_SIZE,
- lcdc.palette_virt, lcdc.palette_phys);
+ dma_free_wc(lcdc.fbdev->dev, MAX_PALETTE_SIZE, lcdc.palette_virt,
+ lcdc.palette_phys);
}
static int alloc_fbmem(struct omapfb_mem_region *region)
@@ -642,8 +642,8 @@ static int alloc_fbmem(struct omapfb_mem_region *region)
if (region->size > frame_size)
frame_size = region->size;
lcdc.vram_size = frame_size;
- lcdc.vram_virt = dma_alloc_writecombine(lcdc.fbdev->dev,
- lcdc.vram_size, &lcdc.vram_phys, GFP_KERNEL);
+ lcdc.vram_virt = dma_alloc_wc(lcdc.fbdev->dev, lcdc.vram_size,
+ &lcdc.vram_phys, GFP_KERNEL);
if (lcdc.vram_virt = NULL) {
dev_err(lcdc.fbdev->dev, "unable to allocate FB DMA memory\n");
return -ENOMEM;
@@ -660,8 +660,8 @@ static int alloc_fbmem(struct omapfb_mem_region *region)
static void free_fbmem(void)
{
- dma_free_writecombine(lcdc.fbdev->dev, lcdc.vram_size,
- lcdc.vram_virt, lcdc.vram_phys);
+ dma_free_wc(lcdc.fbdev->dev, lcdc.vram_size, lcdc.vram_virt,
+ lcdc.vram_phys);
}
static int setup_fbmem(struct omapfb_mem_desc *req_md)
diff --git a/drivers/video/fbdev/pxa168fb.c b/drivers/video/fbdev/pxa168fb.c
index e209b039f553..04bd7237da6f 100644
--- a/drivers/video/fbdev/pxa168fb.c
+++ b/drivers/video/fbdev/pxa168fb.c
@@ -683,8 +683,8 @@ static int pxa168fb_probe(struct platform_device *pdev)
*/
info->fix.smem_len = PAGE_ALIGN(DEFAULT_FB_SIZE);
- info->screen_base = dma_alloc_writecombine(fbi->dev, info->fix.smem_len,
- &fbi->fb_start_dma, GFP_KERNEL);
+ info->screen_base = dma_alloc_wc(fbi->dev, info->fix.smem_len,
+ &fbi->fb_start_dma, GFP_KERNEL);
if (info->screen_base = NULL) {
ret = -ENOMEM;
goto failed_free_info;
@@ -809,8 +809,8 @@ static int pxa168fb_remove(struct platform_device *pdev)
irq = platform_get_irq(pdev, 0);
- dma_free_writecombine(fbi->dev, PAGE_ALIGN(info->fix.smem_len),
- info->screen_base, info->fix.smem_start);
+ dma_free_wc(fbi->dev, PAGE_ALIGN(info->fix.smem_len),
+ info->screen_base, info->fix.smem_start);
clk_disable(fbi->clk);
clk_put(fbi->clk);
diff --git a/drivers/video/fbdev/pxafb.c b/drivers/video/fbdev/pxafb.c
index 7245611ec963..6a5b9801396a 100644
--- a/drivers/video/fbdev/pxafb.c
+++ b/drivers/video/fbdev/pxafb.c
@@ -2286,8 +2286,8 @@ static int pxafb_remove(struct platform_device *dev)
free_pages_exact(fbi->video_mem, fbi->video_mem_size);
- dma_free_writecombine(&dev->dev, fbi->dma_buff_size,
- fbi->dma_buff, fbi->dma_buff_phys);
+ dma_free_wc(&dev->dev, fbi->dma_buff_size, fbi->dma_buff,
+ fbi->dma_buff_phys);
iounmap(fbi->mmio_base);
diff --git a/drivers/video/fbdev/s3c-fb.c b/drivers/video/fbdev/s3c-fb.c
index 7e3a05fc47aa..b7e3571c396f 100644
--- a/drivers/video/fbdev/s3c-fb.c
+++ b/drivers/video/fbdev/s3c-fb.c
@@ -1105,8 +1105,7 @@ static int s3c_fb_alloc_memory(struct s3c_fb *sfb, struct s3c_fb_win *win)
dev_dbg(sfb->dev, "want %u bytes for window\n", size);
- fbi->screen_base = dma_alloc_writecombine(sfb->dev, size,
- &map_dma, GFP_KERNEL);
+ fbi->screen_base = dma_alloc_wc(sfb->dev, size, &map_dma, GFP_KERNEL);
if (!fbi->screen_base)
return -ENOMEM;
@@ -1131,8 +1130,8 @@ static void s3c_fb_free_memory(struct s3c_fb *sfb, struct s3c_fb_win *win)
struct fb_info *fbi = win->fbinfo;
if (fbi->screen_base)
- dma_free_writecombine(sfb->dev, PAGE_ALIGN(fbi->fix.smem_len),
- fbi->screen_base, fbi->fix.smem_start);
+ dma_free_wc(sfb->dev, PAGE_ALIGN(fbi->fix.smem_len),
+ fbi->screen_base, fbi->fix.smem_start);
}
/**
diff --git a/drivers/video/fbdev/s3c2410fb.c b/drivers/video/fbdev/s3c2410fb.c
index d6704add1601..0dd86be36afb 100644
--- a/drivers/video/fbdev/s3c2410fb.c
+++ b/drivers/video/fbdev/s3c2410fb.c
@@ -645,8 +645,8 @@ static int s3c2410fb_map_video_memory(struct fb_info *info)
dprintk("map_video_memory(fbi=%p) map_size %u\n", fbi, map_size);
- info->screen_base = dma_alloc_writecombine(fbi->dev, map_size,
- &map_dma, GFP_KERNEL);
+ info->screen_base = dma_alloc_wc(fbi->dev, map_size, &map_dma,
+ GFP_KERNEL);
if (info->screen_base) {
/* prevent initial garbage on screen */
@@ -667,8 +667,8 @@ static inline void s3c2410fb_unmap_video_memory(struct fb_info *info)
{
struct s3c2410fb_info *fbi = info->par;
- dma_free_writecombine(fbi->dev, PAGE_ALIGN(info->fix.smem_len),
- info->screen_base, info->fix.smem_start);
+ dma_free_wc(fbi->dev, PAGE_ALIGN(info->fix.smem_len),
+ info->screen_base, info->fix.smem_start);
}
static inline void modify_gpio(void __iomem *reg,
diff --git a/drivers/video/fbdev/sa1100fb.c b/drivers/video/fbdev/sa1100fb.c
index 89dd7e02197f..66467eb190b2 100644
--- a/drivers/video/fbdev/sa1100fb.c
+++ b/drivers/video/fbdev/sa1100fb.c
@@ -567,8 +567,8 @@ static int sa1100fb_mmap(struct fb_info *info,
if (off < info->fix.smem_len) {
vma->vm_pgoff += 1; /* skip over the palette */
- return dma_mmap_writecombine(fbi->dev, vma, fbi->map_cpu,
- fbi->map_dma, fbi->map_size);
+ return dma_mmap_wc(fbi->dev, vma, fbi->map_cpu, fbi->map_dma,
+ fbi->map_size);
}
vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
@@ -1100,8 +1100,8 @@ static int sa1100fb_map_video_memory(struct sa1100fb_info *fbi)
* of the framebuffer.
*/
fbi->map_size = PAGE_ALIGN(fbi->fb.fix.smem_len + PAGE_SIZE);
- fbi->map_cpu = dma_alloc_writecombine(fbi->dev, fbi->map_size,
- &fbi->map_dma, GFP_KERNEL);
+ fbi->map_cpu = dma_alloc_wc(fbi->dev, fbi->map_size, &fbi->map_dma,
+ GFP_KERNEL);
if (fbi->map_cpu) {
fbi->fb.screen_base = fbi->map_cpu + PAGE_SIZE;
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index ac07ff090919..1f54e9bd6b34 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -271,26 +271,26 @@ struct dma_attrs;
dma_unmap_sg(dev, sgl, nents, dir)
#else
-static inline void *dma_alloc_writecombine(struct device *dev, size_t size,
- dma_addr_t *dma_addr, gfp_t gfp)
+static inline void *dma_alloc_wc(struct device *dev, size_t size,
+ dma_addr_t *dma_addr, gfp_t gfp)
{
DEFINE_DMA_ATTRS(attrs);
dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs);
return dma_alloc_attrs(dev, size, dma_addr, gfp, &attrs);
}
-static inline void dma_free_writecombine(struct device *dev, size_t size,
- void *cpu_addr, dma_addr_t dma_addr)
+static inline void dma_free_wc(struct device *dev, size_t size,
+ void *cpu_addr, dma_addr_t dma_addr)
{
DEFINE_DMA_ATTRS(attrs);
dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs);
return dma_free_attrs(dev, size, cpu_addr, dma_addr, &attrs);
}
-static inline int dma_mmap_writecombine(struct device *dev,
- struct vm_area_struct *vma,
- void *cpu_addr, dma_addr_t dma_addr,
- size_t size)
+static inline int dma_mmap_wc(struct device *dev,
+ struct vm_area_struct *vma,
+ void *cpu_addr, dma_addr_t dma_addr,
+ size_t size)
{
DEFINE_DMA_ATTRS(attrs);
dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs);
diff --git a/sound/arm/pxa2xx-pcm-lib.c b/sound/arm/pxa2xx-pcm-lib.c
index 01f8fdc42b1b..5596f7cc8e73 100644
--- a/sound/arm/pxa2xx-pcm-lib.c
+++ b/sound/arm/pxa2xx-pcm-lib.c
@@ -238,8 +238,8 @@ int __pxa2xx_pcm_open(struct snd_pcm_substream *substream)
if (!rtd)
goto out;
rtd->dma_desc_array - dma_alloc_writecombine(substream->pcm->card->dev, PAGE_SIZE,
- &rtd->dma_desc_array_phys, GFP_KERNEL);
+ dma_alloc_wc(substream->pcm->card->dev, PAGE_SIZE,
+ &rtd->dma_desc_array_phys, GFP_KERNEL);
if (!rtd->dma_desc_array)
goto err1;
@@ -259,8 +259,8 @@ int __pxa2xx_pcm_close(struct snd_pcm_substream *substream)
struct snd_pcm_runtime *runtime = substream->runtime;
struct pxa2xx_runtime_data *rtd = runtime->private_data;
- dma_free_writecombine(substream->pcm->card->dev, PAGE_SIZE,
- rtd->dma_desc_array, rtd->dma_desc_array_phys);
+ dma_free_wc(substream->pcm->card->dev, PAGE_SIZE,
+ rtd->dma_desc_array, rtd->dma_desc_array_phys);
kfree(rtd);
return 0;
}
@@ -270,10 +270,8 @@ int pxa2xx_pcm_mmap(struct snd_pcm_substream *substream,
struct vm_area_struct *vma)
{
struct snd_pcm_runtime *runtime = substream->runtime;
- return dma_mmap_writecombine(substream->pcm->card->dev, vma,
- runtime->dma_area,
- runtime->dma_addr,
- runtime->dma_bytes);
+ return dma_mmap_wc(substream->pcm->card->dev, vma, runtime->dma_area,
+ runtime->dma_addr, runtime->dma_bytes);
}
EXPORT_SYMBOL(pxa2xx_pcm_mmap);
@@ -285,8 +283,7 @@ int pxa2xx_pcm_preallocate_dma_buffer(struct snd_pcm *pcm, int stream)
buf->dev.type = SNDRV_DMA_TYPE_DEV;
buf->dev.dev = pcm->card->dev;
buf->private_data = NULL;
- buf->area = dma_alloc_writecombine(pcm->card->dev, size,
- &buf->addr, GFP_KERNEL);
+ buf->area = dma_alloc_wc(pcm->card->dev, size, &buf->addr, GFP_KERNEL);
if (!buf->area)
return -ENOMEM;
buf->bytes = size;
@@ -307,8 +304,7 @@ void pxa2xx_pcm_free_dma_buffers(struct snd_pcm *pcm)
buf = &substream->dma_buffer;
if (!buf->area)
continue;
- dma_free_writecombine(pcm->card->dev, buf->bytes,
- buf->area, buf->addr);
+ dma_free_wc(pcm->card->dev, buf->bytes, buf->area, buf->addr);
buf->area = NULL;
}
}
diff --git a/sound/soc/fsl/imx-pcm-fiq.c b/sound/soc/fsl/imx-pcm-fiq.c
index 7abf6a079574..ccdc4380d86a 100644
--- a/sound/soc/fsl/imx-pcm-fiq.c
+++ b/sound/soc/fsl/imx-pcm-fiq.c
@@ -217,8 +217,8 @@ static int snd_imx_pcm_mmap(struct snd_pcm_substream *substream,
struct snd_pcm_runtime *runtime = substream->runtime;
int ret;
- ret = dma_mmap_writecombine(substream->pcm->card->dev, vma,
- runtime->dma_area, runtime->dma_addr, runtime->dma_bytes);
+ ret = dma_mmap_wc(substream->pcm->card->dev, vma, runtime->dma_area,
+ runtime->dma_addr, runtime->dma_bytes);
pr_debug("%s: ret: %d %p 0x%08x 0x%08x\n", __func__, ret,
runtime->dma_area,
@@ -247,8 +247,7 @@ static int imx_pcm_preallocate_dma_buffer(struct snd_pcm *pcm, int stream)
buf->dev.type = SNDRV_DMA_TYPE_DEV;
buf->dev.dev = pcm->card->dev;
buf->private_data = NULL;
- buf->area = dma_alloc_writecombine(pcm->card->dev, size,
- &buf->addr, GFP_KERNEL);
+ buf->area = dma_alloc_wc(pcm->card->dev, size, &buf->addr, GFP_KERNEL);
if (!buf->area)
return -ENOMEM;
buf->bytes = size;
@@ -330,8 +329,7 @@ static void imx_pcm_free(struct snd_pcm *pcm)
if (!buf->area)
continue;
- dma_free_writecombine(pcm->card->dev, buf->bytes,
- buf->area, buf->addr);
+ dma_free_wc(pcm->card->dev, buf->bytes, buf->area, buf->addr);
buf->area = NULL;
}
}
diff --git a/sound/soc/nuc900/nuc900-pcm.c b/sound/soc/nuc900/nuc900-pcm.c
index 5ae5ca15b6d6..cd8175afa900 100644
--- a/sound/soc/nuc900/nuc900-pcm.c
+++ b/sound/soc/nuc900/nuc900-pcm.c
@@ -267,10 +267,8 @@ static int nuc900_dma_mmap(struct snd_pcm_substream *substream,
{
struct snd_pcm_runtime *runtime = substream->runtime;
- return dma_mmap_writecombine(substream->pcm->card->dev, vma,
- runtime->dma_area,
- runtime->dma_addr,
- runtime->dma_bytes);
+ return dma_mmap_wc(substream->pcm->card->dev, vma, runtime->dma_area,
+ runtime->dma_addr, runtime->dma_bytes);
}
static struct snd_pcm_ops nuc900_dma_ops = {
diff --git a/sound/soc/omap/omap-pcm.c b/sound/soc/omap/omap-pcm.c
index 6bb623a2a4df..99381a27295b 100644
--- a/sound/soc/omap/omap-pcm.c
+++ b/sound/soc/omap/omap-pcm.c
@@ -156,10 +156,8 @@ static int omap_pcm_mmap(struct snd_pcm_substream *substream,
{
struct snd_pcm_runtime *runtime = substream->runtime;
- return dma_mmap_writecombine(substream->pcm->card->dev, vma,
- runtime->dma_area,
- runtime->dma_addr,
- runtime->dma_bytes);
+ return dma_mmap_wc(substream->pcm->card->dev, vma, runtime->dma_area,
+ runtime->dma_addr, runtime->dma_bytes);
}
static struct snd_pcm_ops omap_pcm_ops = {
@@ -183,8 +181,7 @@ static int omap_pcm_preallocate_dma_buffer(struct snd_pcm *pcm,
buf->dev.type = SNDRV_DMA_TYPE_DEV;
buf->dev.dev = pcm->card->dev;
buf->private_data = NULL;
- buf->area = dma_alloc_writecombine(pcm->card->dev, size,
- &buf->addr, GFP_KERNEL);
+ buf->area = dma_alloc_wc(pcm->card->dev, size, &buf->addr, GFP_KERNEL);
if (!buf->area)
return -ENOMEM;
@@ -207,8 +204,7 @@ static void omap_pcm_free_dma_buffers(struct snd_pcm *pcm)
if (!buf->area)
continue;
- dma_free_writecombine(pcm->card->dev, buf->bytes,
- buf->area, buf->addr);
+ dma_free_wc(pcm->card->dev, buf->bytes, buf->area, buf->addr);
buf->area = NULL;
}
}
--
2.4.3
^ permalink raw reply related
* Re: [PATCH v4 10/11] dma: rename dma_*_writecombine() to dma_*_wc()
From: Luis R. Rodriguez @ 2015-08-25 15:48 UTC (permalink / raw)
To: Ingo Molnar
Cc: Luis R. Rodriguez, bp, bhelgaas, tomi.valkeinen, airlied,
linux-fbdev, luto, vinod.koul, dan.j.williams, toshi.kani, benh,
mst, akpm, daniel.vetter, konrad.wilk, x86, linux-kernel,
linux-pci, xen-devel
In-Reply-To: <20150825075318.GA2735@gmail.com>
On Tue, Aug 25, 2015 at 09:53:18AM +0200, Ingo Molnar wrote:
> Which kernel is this against? It has conflicts in 3 files with Linus's latest:
> v4.2-rc8.
Sorry I based it on linux-next, will respin the rename patch onto tip/auto-latest
Luis
^ permalink raw reply
* Re: [PATCH 3/3] devicetree: Add led-backlight binding
From: Tomi Valkeinen @ 2015-08-25 15:41 UTC (permalink / raw)
To: Jacek Anaszewski
Cc: Jingoo Han, Lee Jones, linux-leds, linux-fbdev, Andrew Lunn
In-Reply-To: <55DC700C.4030802@samsung.com>
[-- Attachment #1: Type: text/plain, Size: 953 bytes --]
On 25/08/15 16:39, Jacek Anaszewski wrote:
>> +Example:
>> +
>> + backlight {
>> + compatible = "led-backlight";
>> + leds = <&backlight_led>;
>> +
>> + brightness-levels = <0 4 8 16 32 64 128 255>;
>
> brightness level is not a suitable unit for describing LED brightness
> in a Device Tree, as it is not a physical unit. We have led-max-microamp
> property for this, expressed in microamperes, please refer to [0] from
> linux-next.
Hmm, ok, but what should the driver do with microamperes? As far as I
see, "enum led_brightness" (which is between 0-255) is used to set the
brightness to LEDs. I don't see any function accepting microamperes.
>> + default-brightness-level = <6>;
>
> This also should be microamperes.
This is an index to the above brightness-levels array. It's not LED
brightness, but backlight brightness, between 0 and
ARRAY_SIZE(brightness-levels) - 1.
Tomi
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply
* [PATCH 4/4] fbdev: Debug knob to register without holding console_lock
From: Daniel Vetter @ 2015-08-25 13:45 UTC (permalink / raw)
To: DRI Development
Cc: Daniel Vetter, Intel Graphics Development, Tomi Valkeinen,
Jean-Christophe Plagniol-Villard, linux-fbdev
In-Reply-To: <1440510314-8633-1-git-send-email-daniel.vetter@ffwll.ch>
When the usual fbcon legacy options are enabled we have
->register_framebuffer
->fb notifier chain calls into fbcon
->fbcon sets up console on new fbi
->fbi->set_par
->drm_fb_helper_set_par exercises full kms api
And because of locking inversion hilarity all of register_framebuffer
is done with the console lock held. Which means that the first time on
driver load we exercise _all_ the kms code (all probe paths and
modeset paths for everything connected) is under the console lock.
That means if anything goes belly-up in that big pile of code nothing
ever reaches logfiles (and the machine is dead).
Usual tactic to debug that is to temporarily remove those console_lock
calls to be able to capture backtraces. I'm fed up writing this patch
and recompiling kernels. Hence this patch here to add an unsafe,
kernel-taining option to do this at runtime.
Cc: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: linux-fbdev@vger.kernel.org
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
drivers/video/fbdev/core/fbmem.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c
index 0705d8883ede..4e73b6f6b1c0 100644
--- a/drivers/video/fbdev/core/fbmem.c
+++ b/drivers/video/fbdev/core/fbmem.c
@@ -1608,6 +1608,11 @@ static int do_remove_conflicting_framebuffers(struct apertures_struct *a,
return 0;
}
+static bool lockless_register_fb;
+module_param_named_unsafe(lockless_register_fb, lockless_register_fb, bool, 0400);
+MODULE_PARM_DESC(lockless_register_fb,
+ "Lockless framebuffer registration for debugging [default=off]");
+
static int do_register_framebuffer(struct fb_info *fb_info)
{
int i, ret;
@@ -1675,15 +1680,18 @@ static int do_register_framebuffer(struct fb_info *fb_info)
registered_fb[i] = fb_info;
event.info = fb_info;
- console_lock();
+ if (!lockless_register_fb)
+ console_lock();
if (!lock_fb_info(fb_info)) {
- console_unlock();
+ if (!lockless_register_fb)
+ console_unlock();
return -ENODEV;
}
fb_notifier_call_chain(FB_EVENT_FB_REGISTERED, &event);
unlock_fb_info(fb_info);
- console_unlock();
+ if (!lockless_register_fb)
+ console_unlock();
return 0;
}
--
1.8.3.1
^ permalink raw reply related
* Re: [PATCH 3/3] devicetree: Add led-backlight binding
From: Jacek Anaszewski @ 2015-08-25 13:39 UTC (permalink / raw)
To: Tomi Valkeinen
Cc: Jingoo Han, Lee Jones, linux-leds, linux-fbdev, Andrew Lunn
In-Reply-To: <1440502442-19531-4-git-send-email-tomi.valkeinen@ti.com>
Hi Tomi,
On 08/25/2015 01:34 PM, Tomi Valkeinen wrote:
> Add DT binding for led-backlight.
>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
> .../bindings/video/backlight/led-backlight.txt | 30 ++++++++++++++++++++++
> 1 file changed, 30 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/video/backlight/led-backlight.txt
>
> diff --git a/Documentation/devicetree/bindings/video/backlight/led-backlight.txt b/Documentation/devicetree/bindings/video/backlight/led-backlight.txt
> new file mode 100644
> index 000000000000..fb77051ac230
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/video/backlight/led-backlight.txt
> @@ -0,0 +1,30 @@
> +led-backlight bindings
> +
> +Required properties:
> + - compatible: "led-backlight"
> + - leds: phandle to a led OF node [0]
> + - brightness-levels: Array of distinct LED brightness levels. These
> + are in the range from 0 to 255, passed to the LED class driver.
> + - default-brightness-level: the default brightness level (index into the
> + array defined by the "brightness-levels" property)
> + - power-supply: regulator for supply voltage
> +
> +Optional properties:
> + - enable-gpios: contains a single GPIO specifier for the GPIO which enables
> + and disables the backlight (see GPIO binding[1])
> +
> +[0]: Documentation/devicetree/bindings/leds/common.txt
> +[1]: Documentation/devicetree/bindings/gpio/gpio.txt
> +
> +Example:
> +
> + backlight {
> + compatible = "led-backlight";
> + leds = <&backlight_led>;
> +
> + brightness-levels = <0 4 8 16 32 64 128 255>;
brightness level is not a suitable unit for describing LED brightness
in a Device Tree, as it is not a physical unit. We have led-max-microamp
property for this, expressed in microamperes, please refer to [0] from
linux-next.
> + default-brightness-level = <6>;
This also should be microamperes.
> + power-supply = <&vdd_bl_reg>;
> + enable-gpios = <&gpio 58 0>;
> + };
>
--
Best Regards,
Jacek Anaszewski
^ permalink raw reply
* Re: [PATCH 1/3] leds: Add of_led_get() and led_put()
From: Jacek Anaszewski @ 2015-08-25 13:25 UTC (permalink / raw)
To: Tomi Valkeinen
Cc: Jingoo Han, Lee Jones, linux-leds, linux-fbdev, Andrew Lunn
In-Reply-To: <1440502442-19531-2-git-send-email-tomi.valkeinen@ti.com>
Hi Tomi,
Thanks for the patch. Generally, I'd prefer to add files
drivers/leds/of.c and include/linux/of_leds.h and put related functions
there. Those functions' names should begin with "of_". Please provide
also no-op versions of the functions to address configurations when
CONFIG_OF isn't enabled. I have also few comments below.
On 08/25/2015 01:34 PM, Tomi Valkeinen wrote:
> This patch adds basic support for a kernel driver to get a LED device.
> This will be used by the led-backlight driver.
>
> Only OF version is implemented for now, and the behavior is similar to
> PWM's of_pwm_get() and pwm_put().
>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
> drivers/leds/led-class.c | 75 ++++++++++++++++++++++++++++++++++++++++++++++++
> include/linux/leds.h | 4 +++
> 2 files changed, 79 insertions(+)
>
> diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c
> index beabfbc6f7cd..0cb4fd7d71d6 100644
> --- a/drivers/leds/led-class.c
> +++ b/drivers/leds/led-class.c
> @@ -20,6 +20,7 @@
> #include <linux/slab.h>
> #include <linux/spinlock.h>
> #include <linux/timer.h>
> +#include <linux/of.h>
> #include "leds.h"
>
> static struct class *leds_class;
> @@ -216,6 +217,80 @@ static int led_resume(struct device *dev)
>
> static SIMPLE_DEV_PM_OPS(leds_class_dev_pm_ops, led_suspend, led_resume);
>
> +/* find OF node for the given led_cdev */
> +static struct device_node *find_led_of_node(struct led_classdev *led_cdev)
> +{
> + struct device *led_dev = led_cdev->dev;
> + struct device_node *child;
> +
> + for_each_child_of_node(led_dev->parent->of_node, child) {
> + if (of_property_match_string(child, "label", led_cdev->name) = 0)
> + return child;
> + }
> +
> + return NULL;
> +}
> +
> +static int led_match_led_node(struct device *led_dev, const void *data)
> +{
> + struct led_classdev *led_cdev = dev_get_drvdata(led_dev);
> + const struct device_node *target_node = data;
> + struct device_node *led_node;
> +
> + led_node = find_led_of_node(led_cdev);
> + if (!led_node)
> + return 0;
> +
> + of_node_put(led_node);
> +
> + return led_node = target_node ? 1 : 0;
> +}
> +
> +/**
> + * of_led_get() - request a LED device via the LED framework
> + * @np: device node to get the LED device from
> + *
> + * Returns the LED device parsed from the phandle specified in the "leds"
> + * property of a device tree node or a negative error-code on failure.
> + */
> +struct led_classdev *of_led_get(struct device_node *np)
> +{
> + struct device *led_dev;
> + struct led_classdev *led_cdev;
> + struct device_node *led_node;
> +
> + led_node = of_parse_phandle(np, "leds", 0);
> + if (!led_node)
> + return ERR_PTR(-ENODEV);
> +
> + led_dev = class_find_device(leds_class, NULL, led_node,
> + led_match_led_node);
Single of_node_put(led_node) here will do.
> + if (!led_dev) {
> + of_node_put(led_node);
> + return ERR_PTR(-EPROBE_DEFER);
> + }
> +
> + of_node_put(led_node);
> + led_cdev = dev_get_drvdata(led_dev);
> +
> + if (!try_module_get(led_cdev->dev->parent->driver->owner))
> + return ERR_PTR(-ENODEV);
> +
> + return led_cdev;
> +}
> +EXPORT_SYMBOL_GPL(of_led_get);
> +/**
> + * led_put() - release a LED device
> + * @led_cdev: LED device
> + */
> +void led_put(struct led_classdev *led_cdev)
> +{
> + module_put(led_cdev->dev->parent->driver->owner);
> +}
> +EXPORT_SYMBOL_GPL(led_put);
Please move it to include/linux/leds.h, make static inline and provide
also no-op version for the case when CONFIG_LEDS_CLASS isn't enabled.
> static int match_name(struct device *dev, const void *data)
> {
> if (!dev_name(dev))
> diff --git a/include/linux/leds.h b/include/linux/leds.h
> index b122eeafb5dc..efc9b28af564 100644
> --- a/include/linux/leds.h
> +++ b/include/linux/leds.h
> @@ -21,6 +21,7 @@
> #include <linux/workqueue.h>
>
> struct device;
> +struct device_node;
> /*
> * LED Core
> */
> @@ -113,6 +114,9 @@ extern void devm_led_classdev_unregister(struct device *parent,
> extern void led_classdev_suspend(struct led_classdev *led_cdev);
> extern void led_classdev_resume(struct led_classdev *led_cdev);
>
> +extern struct led_classdev *of_led_get(struct device_node *np);
We need also no-op version for (!CONFIG_OF || !CONFIG_LEDS_CLASS).
> +extern void led_put(struct led_classdev *led_cdev);
> +
> /**
> * led_blink_set - set blinking with software fallback
> * @led_cdev: the LED to start blinking
>
--
Best Regards,
Jacek Anaszewski
^ permalink raw reply
* Re: [PATCH 2/3] backlight: add led-backlight driver
From: Tomi Valkeinen @ 2015-08-25 13:00 UTC (permalink / raw)
To: Andrew Lunn
Cc: Jacek Anaszewski, Jingoo Han, Lee Jones, linux-leds, linux-fbdev
In-Reply-To: <20150825123952.GA18009@lunn.ch>
[-- Attachment #1: Type: text/plain, Size: 1053 bytes --]
On 25/08/15 15:39, Andrew Lunn wrote:
> On Tue, Aug 25, 2015 at 02:34:01PM +0300, Tomi Valkeinen wrote:
>> This patch adds a led-backlight driver (led_bl), which is similar to
>> pwm_bl except the driver uses a LED class driver to adjust the
>> brightness in the HW.
>
> Shouldn't this be sending an event to drivers/leds/trigger/kedtrig-backlight.c
>
> Calling led_set_brightness() from outside of drivers/leds is pretty
> much unheard of. It is normal to have a trigger to do this. So why not
> use the exiting backlight trigger?
ledtrig-backlight.c is based on fbdev, and I want the backlight to work
also with DRM. And I want the backlight device to be a proper backlight
device, i.e. something I can pass data to from the DT.
So, I could create a new trigger, say, "bldev" trigger, which would
create a backlight device. But then I could not pass any info to it via DT.
This patch was the only working solution I could figure out, but I don't
have much experience with leds, so I might be missing something.
Tomi
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply
* Re: [PATCH 1/3] leds: Add of_led_get() and led_put()
From: Tomi Valkeinen @ 2015-08-25 12:53 UTC (permalink / raw)
To: Andrew Lunn
Cc: Jacek Anaszewski, Jingoo Han, Lee Jones, linux-leds, linux-fbdev
In-Reply-To: <20150825121853.GB14871@lunn.ch>
[-- Attachment #1: Type: text/plain, Size: 1013 bytes --]
On 25/08/15 15:18, Andrew Lunn wrote:
> On Tue, Aug 25, 2015 at 02:34:00PM +0300, Tomi Valkeinen wrote:
>> This patch adds basic support for a kernel driver to get a LED device.
>> This will be used by the led-backlight driver.
>>
>> Only OF version is implemented for now, and the behavior is similar to
>> PWM's of_pwm_get() and pwm_put().
>
> Hi Tomi
>
> Is this the correct way to do it? I would of expected an xlate
> function.
I don't know. To be honest I haven't worked much with this kind of code,
and I didn't want to start writing full blown "of" support for leds. My
solution cuts the corners a bit... Probably this is more of an RFC than
a ready patch series.
I need to look what the of_xlate functions are doing in other frameworks.
> I'm also wondering if this is the right place, in the class. Don't you
> just need the core?
I'm using the "static struct class *leds_class;" to find the actual
led_classdev, and that variable is local to led-class.c.
Tomi
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply
* Re: [PATCH 2/3] backlight: add led-backlight driver
From: Andrew Lunn @ 2015-08-25 12:39 UTC (permalink / raw)
To: Tomi Valkeinen
Cc: Jacek Anaszewski, Jingoo Han, Lee Jones, linux-leds, linux-fbdev
In-Reply-To: <1440502442-19531-3-git-send-email-tomi.valkeinen@ti.com>
On Tue, Aug 25, 2015 at 02:34:01PM +0300, Tomi Valkeinen wrote:
> This patch adds a led-backlight driver (led_bl), which is similar to
> pwm_bl except the driver uses a LED class driver to adjust the
> brightness in the HW.
Shouldn't this be sending an event to drivers/leds/trigger/kedtrig-backlight.c
Calling led_set_brightness() from outside of drivers/leds is pretty
much unheard of. It is normal to have a trigger to do this. So why not
use the exiting backlight trigger?
Andrew
^ permalink raw reply
* Re: [PATCH 1/3] leds: Add of_led_get() and led_put()
From: Andrew Lunn @ 2015-08-25 12:18 UTC (permalink / raw)
To: Tomi Valkeinen
Cc: Jacek Anaszewski, Jingoo Han, Lee Jones, linux-leds, linux-fbdev
In-Reply-To: <1440502442-19531-2-git-send-email-tomi.valkeinen@ti.com>
On Tue, Aug 25, 2015 at 02:34:00PM +0300, Tomi Valkeinen wrote:
> This patch adds basic support for a kernel driver to get a LED device.
> This will be used by the led-backlight driver.
>
> Only OF version is implemented for now, and the behavior is similar to
> PWM's of_pwm_get() and pwm_put().
Hi Tomi
Is this the correct way to do it? I would of expected an xlate
function.
I'm also wondering if this is the right place, in the class. Don't you
just need the core?
Andrew
^ permalink raw reply
* [PATCH 3/3] devicetree: Add led-backlight binding
From: Tomi Valkeinen @ 2015-08-25 11:34 UTC (permalink / raw)
To: Jacek Anaszewski, Jingoo Han, Lee Jones, linux-leds, linux-fbdev
Cc: Andrew Lunn, Tomi Valkeinen
In-Reply-To: <1440502442-19531-1-git-send-email-tomi.valkeinen@ti.com>
Add DT binding for led-backlight.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
.../bindings/video/backlight/led-backlight.txt | 30 ++++++++++++++++++++++
1 file changed, 30 insertions(+)
create mode 100644 Documentation/devicetree/bindings/video/backlight/led-backlight.txt
diff --git a/Documentation/devicetree/bindings/video/backlight/led-backlight.txt b/Documentation/devicetree/bindings/video/backlight/led-backlight.txt
new file mode 100644
index 000000000000..fb77051ac230
--- /dev/null
+++ b/Documentation/devicetree/bindings/video/backlight/led-backlight.txt
@@ -0,0 +1,30 @@
+led-backlight bindings
+
+Required properties:
+ - compatible: "led-backlight"
+ - leds: phandle to a led OF node [0]
+ - brightness-levels: Array of distinct LED brightness levels. These
+ are in the range from 0 to 255, passed to the LED class driver.
+ - default-brightness-level: the default brightness level (index into the
+ array defined by the "brightness-levels" property)
+ - power-supply: regulator for supply voltage
+
+Optional properties:
+ - enable-gpios: contains a single GPIO specifier for the GPIO which enables
+ and disables the backlight (see GPIO binding[1])
+
+[0]: Documentation/devicetree/bindings/leds/common.txt
+[1]: Documentation/devicetree/bindings/gpio/gpio.txt
+
+Example:
+
+ backlight {
+ compatible = "led-backlight";
+ leds = <&backlight_led>;
+
+ brightness-levels = <0 4 8 16 32 64 128 255>;
+ default-brightness-level = <6>;
+
+ power-supply = <&vdd_bl_reg>;
+ enable-gpios = <&gpio 58 0>;
+ };
--
2.1.4
^ permalink raw reply related
* [PATCH 2/3] backlight: add led-backlight driver
From: Tomi Valkeinen @ 2015-08-25 11:34 UTC (permalink / raw)
To: Jacek Anaszewski, Jingoo Han, Lee Jones, linux-leds, linux-fbdev
Cc: Andrew Lunn, Tomi Valkeinen
In-Reply-To: <1440502442-19531-1-git-send-email-tomi.valkeinen@ti.com>
This patch adds a led-backlight driver (led_bl), which is similar to
pwm_bl except the driver uses a LED class driver to adjust the
brightness in the HW.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
drivers/video/backlight/Kconfig | 7 ++
drivers/video/backlight/Makefile | 1 +
drivers/video/backlight/led_bl.c | 226 +++++++++++++++++++++++++++++++++++++++
3 files changed, 234 insertions(+)
create mode 100644 drivers/video/backlight/led_bl.c
diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index 0505b796d743..d1336196aba2 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -453,6 +453,13 @@ config BACKLIGHT_BD6107
help
If you have a Rohm BD6107 say Y to enable the backlight driver.
+config BACKLIGHT_LED
+ tristate "Generic LED based Backlight Driver"
+ depends on LEDS_CLASS && OF
+ help
+ If you have a LCD backlight adjustable by LED class driver, say Y
+ to enable this driver.
+
endif # BACKLIGHT_CLASS_DEVICE
endif # BACKLIGHT_LCD_SUPPORT
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile
index d67073f9d421..ecd321daee21 100644
--- a/drivers/video/backlight/Makefile
+++ b/drivers/video/backlight/Makefile
@@ -54,3 +54,4 @@ 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
+obj-$(CONFIG_BACKLIGHT_LED) += led_bl.o
diff --git a/drivers/video/backlight/led_bl.c b/drivers/video/backlight/led_bl.c
new file mode 100644
index 000000000000..82cffa39a5b2
--- /dev/null
+++ b/drivers/video/backlight/led_bl.c
@@ -0,0 +1,226 @@
+/*
+ * Copyright 2015 Texas Instruments
+ *
+ * Author: Tomi Valkeinen <tomi.valkeinen@ti.com>
+ *
+ * Based on pwm_bl.c
+ *
+ * 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; version 2 of the License.
+ */
+#include <linux/backlight.h>
+#include <linux/gpio/consumer.h>
+#include <linux/leds.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/regulator/consumer.h>
+#include <linux/slab.h>
+
+struct led_bl_data {
+ struct device *dev;
+ struct backlight_device *bl_dev;
+
+ unsigned int *levels;
+ bool enabled;
+ struct regulator *power_supply;
+ struct gpio_desc *enable_gpio;
+
+ struct led_classdev *led_cdev;
+
+ unsigned int max_brightness;
+ unsigned int default_brightness;
+};
+
+static void led_bl_set_brightness(struct led_bl_data *priv, int brightness)
+{
+ int err;
+
+ if (!priv->enabled) {
+ err = regulator_enable(priv->power_supply);
+ if (err < 0)
+ dev_err(priv->dev, "failed to enable power supply\n");
+
+ if (priv->enable_gpio)
+ gpiod_set_value_cansleep(priv->enable_gpio, 1);
+ }
+
+ led_set_brightness(priv->led_cdev, priv->levels[brightness]);
+
+ priv->enabled = true;
+}
+
+static void led_bl_power_off(struct led_bl_data *priv)
+{
+ if (!priv->enabled)
+ return;
+
+ led_set_brightness(priv->led_cdev, LED_OFF);
+
+ if (priv->enable_gpio)
+ gpiod_set_value_cansleep(priv->enable_gpio, 0);
+
+ regulator_disable(priv->power_supply);
+
+ priv->enabled = false;
+}
+
+static int led_bl_update_status(struct backlight_device *bl)
+{
+ struct led_bl_data *priv = bl_get_data(bl);
+ int brightness = bl->props.brightness;
+
+ if (bl->props.power != FB_BLANK_UNBLANK ||
+ bl->props.fb_blank != FB_BLANK_UNBLANK ||
+ bl->props.state & BL_CORE_FBBLANK)
+ brightness = 0;
+
+ if (brightness > 0)
+ led_bl_set_brightness(priv, brightness);
+ else
+ led_bl_power_off(priv);
+
+ return 0;
+}
+
+static const struct backlight_ops led_bl_ops = {
+ .update_status = led_bl_update_status,
+};
+
+static int led_bl_parse_dt(struct device *dev,
+ struct led_bl_data *priv)
+{
+ struct device_node *node = dev->of_node;
+ int num_levels;
+ u32 *levels;
+ u32 value;
+ int ret;
+
+ if (!node)
+ return -ENODEV;
+
+ num_levels = of_property_count_u32_elems(node, "brightness-levels");
+ if (num_levels < 0)
+ return num_levels;
+
+ levels = devm_kzalloc(dev, sizeof(u32) * num_levels, GFP_KERNEL);
+ if (!levels)
+ return -ENOMEM;
+
+ ret = of_property_read_u32_array(node, "brightness-levels",
+ levels,
+ num_levels);
+ if (ret < 0)
+ return ret;
+
+ ret = of_property_read_u32(node, "default-brightness-level", &value);
+ if (ret < 0)
+ return ret;
+
+ if (value >= num_levels) {
+ dev_err(dev, "invalid default-brightness-level\n");
+ return -EINVAL;
+ }
+
+ priv->levels = levels;
+ priv->max_brightness = num_levels - 1;
+ priv->default_brightness = value;
+
+ priv->led_cdev = of_led_get(node);
+ if (IS_ERR(priv->led_cdev))
+ return PTR_ERR(priv->led_cdev);
+
+ return 0;
+}
+
+static int led_bl_probe(struct platform_device *pdev)
+{
+ struct backlight_properties props;
+ struct led_bl_data *priv;
+ int ret;
+
+ priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
+ if (!priv)
+ return -ENOMEM;
+
+ platform_set_drvdata(pdev, priv);
+
+ priv->dev = &pdev->dev;
+
+ ret = led_bl_parse_dt(&pdev->dev, priv);
+ if (ret < 0) {
+ dev_err(&pdev->dev, "failed to parse DT data\n");
+ return ret;
+ }
+
+ priv->enable_gpio = devm_gpiod_get_optional(&pdev->dev, "enable",
+ GPIOD_OUT_LOW);
+ if (IS_ERR(priv->enable_gpio)) {
+ ret = PTR_ERR(priv->enable_gpio);
+ goto err;
+ }
+
+ priv->power_supply = devm_regulator_get(&pdev->dev, "power");
+ if (IS_ERR(priv->power_supply)) {
+ ret = PTR_ERR(priv->power_supply);
+ goto err;
+ }
+
+ memset(&props, 0, sizeof(struct backlight_properties));
+ props.type = BACKLIGHT_RAW;
+ props.max_brightness = priv->max_brightness;
+ priv->bl_dev = backlight_device_register(dev_name(&pdev->dev),
+ &pdev->dev, priv, &led_bl_ops, &props);
+ if (IS_ERR(priv->bl_dev)) {
+ dev_err(&pdev->dev, "failed to register backlight\n");
+ ret = PTR_ERR(priv->bl_dev);
+ goto err;
+ }
+
+ priv->bl_dev->props.brightness = priv->default_brightness;
+ backlight_update_status(priv->bl_dev);
+
+ return 0;
+
+err:
+ if (priv->led_cdev)
+ led_put(priv->led_cdev);
+
+ return ret;
+}
+
+static int led_bl_remove(struct platform_device *pdev)
+{
+ struct led_bl_data *priv = platform_get_drvdata(pdev);
+ struct backlight_device *bl = priv->bl_dev;
+
+ backlight_device_unregister(bl);
+
+ led_bl_power_off(priv);
+
+ led_put(priv->led_cdev);
+
+ return 0;
+}
+
+static const struct of_device_id led_bl_of_match[] = {
+ { .compatible = "led-backlight" },
+ { }
+};
+
+MODULE_DEVICE_TABLE(of, led_bl_of_match);
+
+static struct platform_driver led_bl_driver = {
+ .driver = {
+ .name = "led-backlight",
+ .of_match_table = of_match_ptr(led_bl_of_match),
+ },
+ .probe = led_bl_probe,
+ .remove = led_bl_remove,
+};
+
+module_platform_driver(led_bl_driver);
+
+MODULE_DESCRIPTION("LED based Backlight Driver");
+MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:led-backlight");
--
2.1.4
^ permalink raw reply related
* [PATCH 1/3] leds: Add of_led_get() and led_put()
From: Tomi Valkeinen @ 2015-08-25 11:34 UTC (permalink / raw)
To: Jacek Anaszewski, Jingoo Han, Lee Jones, linux-leds, linux-fbdev
Cc: Andrew Lunn, Tomi Valkeinen
In-Reply-To: <1440502442-19531-1-git-send-email-tomi.valkeinen@ti.com>
This patch adds basic support for a kernel driver to get a LED device.
This will be used by the led-backlight driver.
Only OF version is implemented for now, and the behavior is similar to
PWM's of_pwm_get() and pwm_put().
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
drivers/leds/led-class.c | 75 ++++++++++++++++++++++++++++++++++++++++++++++++
include/linux/leds.h | 4 +++
2 files changed, 79 insertions(+)
diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c
index beabfbc6f7cd..0cb4fd7d71d6 100644
--- a/drivers/leds/led-class.c
+++ b/drivers/leds/led-class.c
@@ -20,6 +20,7 @@
#include <linux/slab.h>
#include <linux/spinlock.h>
#include <linux/timer.h>
+#include <linux/of.h>
#include "leds.h"
static struct class *leds_class;
@@ -216,6 +217,80 @@ static int led_resume(struct device *dev)
static SIMPLE_DEV_PM_OPS(leds_class_dev_pm_ops, led_suspend, led_resume);
+/* find OF node for the given led_cdev */
+static struct device_node *find_led_of_node(struct led_classdev *led_cdev)
+{
+ struct device *led_dev = led_cdev->dev;
+ struct device_node *child;
+
+ for_each_child_of_node(led_dev->parent->of_node, child) {
+ if (of_property_match_string(child, "label", led_cdev->name) = 0)
+ return child;
+ }
+
+ return NULL;
+}
+
+static int led_match_led_node(struct device *led_dev, const void *data)
+{
+ struct led_classdev *led_cdev = dev_get_drvdata(led_dev);
+ const struct device_node *target_node = data;
+ struct device_node *led_node;
+
+ led_node = find_led_of_node(led_cdev);
+ if (!led_node)
+ return 0;
+
+ of_node_put(led_node);
+
+ return led_node = target_node ? 1 : 0;
+}
+
+/**
+ * of_led_get() - request a LED device via the LED framework
+ * @np: device node to get the LED device from
+ *
+ * Returns the LED device parsed from the phandle specified in the "leds"
+ * property of a device tree node or a negative error-code on failure.
+ */
+struct led_classdev *of_led_get(struct device_node *np)
+{
+ struct device *led_dev;
+ struct led_classdev *led_cdev;
+ struct device_node *led_node;
+
+ led_node = of_parse_phandle(np, "leds", 0);
+ if (!led_node)
+ return ERR_PTR(-ENODEV);
+
+ led_dev = class_find_device(leds_class, NULL, led_node,
+ led_match_led_node);
+ if (!led_dev) {
+ of_node_put(led_node);
+ return ERR_PTR(-EPROBE_DEFER);
+ }
+
+ of_node_put(led_node);
+
+ led_cdev = dev_get_drvdata(led_dev);
+
+ if (!try_module_get(led_cdev->dev->parent->driver->owner))
+ return ERR_PTR(-ENODEV);
+
+ return led_cdev;
+}
+EXPORT_SYMBOL_GPL(of_led_get);
+
+/**
+ * led_put() - release a LED device
+ * @led_cdev: LED device
+ */
+void led_put(struct led_classdev *led_cdev)
+{
+ module_put(led_cdev->dev->parent->driver->owner);
+}
+EXPORT_SYMBOL_GPL(led_put);
+
static int match_name(struct device *dev, const void *data)
{
if (!dev_name(dev))
diff --git a/include/linux/leds.h b/include/linux/leds.h
index b122eeafb5dc..efc9b28af564 100644
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
@@ -21,6 +21,7 @@
#include <linux/workqueue.h>
struct device;
+struct device_node;
/*
* LED Core
*/
@@ -113,6 +114,9 @@ extern void devm_led_classdev_unregister(struct device *parent,
extern void led_classdev_suspend(struct led_classdev *led_cdev);
extern void led_classdev_resume(struct led_classdev *led_cdev);
+extern struct led_classdev *of_led_get(struct device_node *np);
+extern void led_put(struct led_classdev *led_cdev);
+
/**
* led_blink_set - set blinking with software fallback
* @led_cdev: the LED to start blinking
--
2.1.4
^ 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