* Re: [Bulk] [PATCH] video: fix invalid free of devm_ allocated data
From: Tony Prisk @ 2013-03-28 4:59 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1364428524-13821-1-git-send-email-epure.andrei@gmail.com>
On Thu, 2013-03-28 at 01:55 +0200, Andrei Epure wrote:
> The objects allocated by devm_* APIs are managed by devres and are freed when
> the device is detached. Hence there is no need to use kfree() explicitly.
> Patch found using coccinelle.
>
> Signed-off-by: Andrei Epure <epure.andrei@gmail.com>
> ---
> drivers/video/vt8500lcdfb.c | 3 ---
> drivers/video/wm8505fb.c | 3 ---
> 2 files changed, 6 deletions(-)
>
> diff --git a/drivers/video/vt8500lcdfb.c b/drivers/video/vt8500lcdfb.c
> index b4ccca2..ea3ee61 100644
> --- a/drivers/video/vt8500lcdfb.c
> +++ b/drivers/video/vt8500lcdfb.c
> @@ -465,7 +465,6 @@ failed_free_res:
> release_mem_region(res->start, resource_size(res));
> failed_fbi:
> platform_set_drvdata(pdev, NULL);
> - kfree(fbi);
> failed:
> return ret;
> }
> @@ -494,8 +493,6 @@ static int vt8500lcd_remove(struct platform_device *pdev)
> res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> release_mem_region(res->start, resource_size(res));
>
> - kfree(fbi);
> -
> return 0;
> }
>
> diff --git a/drivers/video/wm8505fb.c b/drivers/video/wm8505fb.c
> index 2e8298e..34a2de1 100644
> --- a/drivers/video/wm8505fb.c
> +++ b/drivers/video/wm8505fb.c
> @@ -427,7 +427,6 @@ failed_free_res:
> release_mem_region(res->start, resource_size(res));
> failed_fbi:
> platform_set_drvdata(pdev, NULL);
> - kfree(fbi);
> failed:
> return ret;
> }
> @@ -451,8 +450,6 @@ static int wm8505fb_remove(struct platform_device *pdev)
> res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> release_mem_region(res->start, resource_size(res));
>
> - kfree(fbi);
> -
> return 0;
> }
>
NACK
Already have a patch queued up for this from Julia Lawall
Regards
Tony P
^ permalink raw reply
* Re: [PATCH] video: fixed missing iounmap coccinelle errors
From: Tony Prisk @ 2013-03-28 4:59 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1364427805-11972-1-git-send-email-epure.andrei@gmail.com>
On Thu, 2013-03-28 at 01:43 +0200, Andrei Epure wrote:
> Modified or added the necessary goto statements so that the ioremapped
> regions get unmapped before return.
>
> Signed-off-by: Andrei Epure <epure.andrei@gmail.com>
> ---
> drivers/video/vt8500lcdfb.c | 7 ++++---
> drivers/video/wm8505fb.c | 7 ++++---
> 2 files changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/video/vt8500lcdfb.c b/drivers/video/vt8500lcdfb.c
> index aa2579c..b4ccca2 100644
> --- a/drivers/video/vt8500lcdfb.c
> +++ b/drivers/video/vt8500lcdfb.c
> @@ -350,7 +350,7 @@ static int vt8500lcd_probe(struct platform_device *pdev)
> if (!np) {
> pr_err("%s: No display description in Device Tree\n", __func__);
> ret = -EINVAL;
> - goto failed_free_res;
> + goto failed_free_io;
> }
>
> /*
> @@ -369,7 +369,7 @@ static int vt8500lcd_probe(struct platform_device *pdev)
> ret |= of_property_read_u32(np, "bpp", &bpp);
> if (ret) {
> pr_err("%s: Unable to read display properties\n", __func__);
> - goto failed_free_res;
> + goto failed_free_io;
> }
> of_mode.vmode = FB_VMODE_NONINTERLACED;
>
> @@ -379,7 +379,8 @@ static int vt8500lcd_probe(struct platform_device *pdev)
> GFP_KERNEL);
> if (!fb_mem_virt) {
> pr_err("%s: Failed to allocate framebuffer\n", __func__);
> - return -ENOMEM;
> + ret = -ENOMEM;
> + goto failed_free_io;
> };
>
> fbi->fb.fix.smem_start = fb_mem_phys;
> diff --git a/drivers/video/wm8505fb.c b/drivers/video/wm8505fb.c
> index 4dd0580..2e8298e 100644
> --- a/drivers/video/wm8505fb.c
> +++ b/drivers/video/wm8505fb.c
> @@ -332,7 +332,7 @@ static int wm8505fb_probe(struct platform_device *pdev)
> if (!np) {
> pr_err("%s: No display description in Device Tree\n", __func__);
> ret = -EINVAL;
> - goto failed_free_res;
> + goto failed_free_io;
> }
>
> /*
> @@ -351,7 +351,7 @@ static int wm8505fb_probe(struct platform_device *pdev)
> ret |= of_property_read_u32(np, "bpp", &bpp);
> if (ret) {
> pr_err("%s: Unable to read display properties\n", __func__);
> - goto failed_free_res;
> + goto failed_free_io;
> }
>
> of_mode.vmode = FB_VMODE_NONINTERLACED;
> @@ -369,7 +369,8 @@ static int wm8505fb_probe(struct platform_device *pdev)
> GFP_KERNEL);
> if (!fb_mem_virt) {
> pr_err("%s: Failed to allocate framebuffer\n", __func__);
> - return -ENOMEM;
> + ret = -ENOMEM;
> + goto failed_free_io;
> };
>
> fbi->fb.var.xres_virtual = of_mode.xres;
NACK
Already have a patch queued up for this from Julia Lawall
Regards
Tony P
^ permalink raw reply
* Re: [PATCH 6/6] video: fb: vt8500: Convert framebuffer drivers to standardized binding
From: Tony Prisk @ 2013-03-28 5:04 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <5152D39F.1090104@ti.com>
On Wed, 2013-03-27 at 13:10 +0200, Tomi Valkeinen wrote:
> Hi,
>
> On 2013-03-27 10:47, Tony Prisk wrote:
> > Now that a display timing binding is available, convert our almost identical
> > binding to use the standard binding.
> >
> > This patch converts the vt8500 and wm8505 framebuffer drivers and
> > associated dts/dtsi files to use the standard binding as defined in
> > bindings/video/display-timing.txt.
> >
> > There are two side-effects of making this conversion:
> >
> > 1) The fb node should now be in the board file, rather than the soc file as
> > the display-timing node is a child of the fb node.
> >
> > 2) We still require a bits per pixel property to initialize the framebuffer
> > for the different lcd panels. Rather than including this as part of the
> > display timing, it is moved into the framebuffer node.
> >
> > I have also taken the opportunity to alphabetise the includes of each
> > driver to avoid double-ups.
>
> I don't think this is correct. I don't have that much experience with
> DT, but I think you should have, for example:
>
> wm8850.dtsi:
>
> fb: fb@d8051700 {
> compatible = "wm,wm8505-fb";
> reg = <0xd8051700 0x200>;
> };
>
> wm8850-w70v2.dts:
>
> &fb {
> bits-per-pixel = <16>;
>
> display-timings {
> native-mode = <&timing0>;
> timing0: 800x480 {
> clock-frequency = <0>;
> ...
> };
> };
> };
>
> So, the core fb part should be in the SoC's file, as it's part of the
> SoC. And the stuff that tells what kind of display is attached is in the
> board dts file.
>
> Also, just a word of warning, I think the videomode series I've sent for
> review will cause some breakage with this series if the videomode series
> is accepted. Nothing difficult to fix, though, but we'll need some extra
> management to avoid compilation failures.
>
> Tomi
>
>
Thanks for the feedback and the heads-up.
I believe you are correct about the DT info - it looks right when
described the way you did, so I have changed it.
If there is no other feedback, I will post a version 2 after Easter.
Regards
Tony P
^ permalink raw reply
* [PATCH] compat/compat-drivers/linux-next: fb skip_vt_switch
From: Luis R. Rodriguez @ 2013-03-28 12:04 UTC (permalink / raw)
To: FlorianSchandinat
Cc: linux-fbdev, dri-devel, jbarnes, backports, cocci, linux-kernel,
julia.lawall, rodrigo.vivi, daniel.vetter, rafael.j.wysocki,
Luis R. Rodriguez
From: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>
I maintain the the compat-drivers project [0] which aims at backporting the
Linux kernel drivers down to older kernels, automatically [1]. Thanks to
Ozan Caglayan as a GSoC project we now backport DRM drivers.
The initial framework we had set up to help with the automatic juice was
simply quilt refresh to help with hunk offsets, later it consisted of
writing cleaner diffs, then compartamentalizing shared differences into a
compat backport module [2].
Recently I looked into Coccinelle SmPL to help push for collateral evolutions
on the Linux kernel to be written when possible with SmPL [3] given that, as
discussed with Julia, the very inverse of the grammar may allow us to backport
that collateral evolution on older kernels. I'm still experimenting with that,
but another benefit of studying INRIA's Coccinelle work is that the concept
of collateral evolutions is now formalized and as I've studied their work
I'm realizing we have different categories for collateral evolutions. From
what I've experienced through the backport work, data structure changes are
the more difficult collateral evolutions to backport. Instead of updates on
our compat module these require manual diffs... One strategy to simplify
backporting these data structure changes however was to replace the uses of
the new elements on the data structure with static inlines and requiring
the heavy changes to be implementd on a helper. That is, we actually simplfied
the backport by changing the form of the collateral evolution.
The new commit by Jesse that extended the fb_info with a skip_vt_switch
element is the simplest example of a data structure expansion. We'd backport
this by adding a static inline to compat so that new kernels muck with the
new element and for older kernels this would be a no-op. This reduces the
size of the backport and unclutters the required patch with #idefs, and
insteads leaves only a replacement of the usage of the new elements with
a static inline, this however would still be required on our end:
- info->skip_vt_switch = true;
+ fb_enable_skip_vt_switch(info);
So we'd then have to just add this static inline change for each new driver...
There may be a way to get SmPL to do this for us...
However... if the static inline makes it upstream it means 0 changes are
required for *any* driver!
I've been reluctant to request a change upstream because of these side
backport benefits but due to this case's simplcity I figured I'd shoot
this out for review now.
A more elaborate example would be the netdev_attach_ops() which is not
yet upstream. This exands to this simple inline for new kernels:
static inline void netdev_attach_ops(struct net_device *dev,
const struct net_device_ops *ops)
{
dev->netdev_ops = ops;
}
For older kernels this expands to:
void netdev_attach_ops(struct net_device *dev,
const struct net_device_ops *ops)
{
dev->open = ops->ndo_open;
dev->init = ops->ndo_init;
dev->stop = ops->ndo_stop;
dev->hard_start_xmit = ops->ndo_start_xmit;
dev->change_rx_flags = ops->ndo_change_rx_flags;
dev->set_multicast_list = ops->ndo_set_multicast_list;
dev->validate_addr = ops->ndo_validate_addr;
dev->do_ioctl = ops->ndo_do_ioctl;
dev->set_config = ops->ndo_set_config;
dev->change_mtu = ops->ndo_change_mtu;
dev->set_mac_address = ops->ndo_set_mac_address;
dev->tx_timeout = ops->ndo_tx_timeout;
if (ops->ndo_get_stats)
dev->get_stats = ops->ndo_get_stats;
dev->vlan_rx_register = ops->ndo_vlan_rx_register;
dev->vlan_rx_add_vid = ops->ndo_vlan_rx_add_vid;
dev->vlan_rx_kill_vid = ops->ndo_vlan_rx_kill_vid;
#ifdef CONFIG_NET_POLL_CONTROLLER
dev->poll_controller = ops->ndo_poll_controller;
#endif
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27))
dev->select_queue = ops->ndo_select_queue;
#endif
}
Even though we have the static inline in compat it still means
every driver must be changed to use it. For example:
--- a/drivers/net/usb/rndis_host.c
+++ b/drivers/net/usb/rndis_host.c
@@ -358,7 +358,7 @@ generic_rndis_bind(struct usbnet *dev, s
dev->rx_urb_size &= ~(dev->maxpacket - 1);
u.init->max_transfer_size = cpu_to_le32(dev->rx_urb_size);
- net->netdev_ops = &rndis_netdev_ops;
+ netdev_attach_ops(net, &rndis_netdev_ops);
retval = rndis_command(dev, u.header, CONTROL_BUFFER_SIZE);
if (unlikely(retval < 0)) {
This is just one driver. The patch that deals with this collateral
evolution is now 290 lines. I've been working with Julia to express
these type of tranformations as SmPL grammar, seeing if its possible
to use the inverse of SmPL in the long run, and so on... but in the end,
if we add a static inline upstream for small changes like these -- we'd
end up requring zero changes for the backport of these type of collateral
evolutions.
This should mean less bugs and cleaner backport code and maintenance.
Curious if video guys would care to accept this as an example simple
test case to help with the project with this respective small
collateral evolution and test case.
What follows are patches that deal with the changes on all the projects.
I'll apply the compat and compat-driver patches now as these are required,
but if my fb patch (patch #4 in this series) is accepted it'd simpify
backporting this collateral evolution for all video drivers tremendously.
[0] https://backports.wiki.kernel.org
[1] http://www.do-not-panic.com/2012/08/automatically-backporting-linux-kernel.html
[2] https://git.kernel.org/cgit/linux/kernel/git/mcgrof/compat.git/
[3] http://www.do-not-panic.com/2012/08/optimizing-backporting-collateral.html
linux-next:
Luis R. Rodriguez (1):
fb: add helpers to enable and test for the skip_vt_switch
drivers/gpu/drm/i915/intel_fb.c | 2 +-
drivers/video/fbmem.c | 2 +-
include/linux/fb.h | 10 ++++++++++
3 files changed, 12 insertions(+), 2 deletions(-)
compat:
Luis R. Rodriguez (1):
compat: backport fb_info->skip_vt_switch using a static inline
include/linux/compat-3.10.h | 41 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
compat-drivers:
Luis R. Rodriguez (2):
compat-drivers: backport fb_info->skip_vt_switch using ifdefs
compat-drivers: simplify backport fb_info->skip_vt_switch CE
.../drm/0001-fb-info-vt_switch.patch | 56 ++++++++++++++++++++
1 file changed, 56 insertions(+)
create mode 100644 patches/collateral-evolutions/drm/0001-fb-info-vt_switch.patch
--
1.7.10.4
^ permalink raw reply
* [PATCH 1/4] compat-drivers: backport fb_info->skip_vt_switch using ifdefs
From: Luis R. Rodriguez @ 2013-03-28 12:04 UTC (permalink / raw)
To: FlorianSchandinat
Cc: linux-fbdev, dri-devel, jbarnes, backports, cocci, linux-kernel,
julia.lawall, rodrigo.vivi, daniel.vetter, rafael.j.wysocki,
Luis R. Rodriguez
In-Reply-To: <1364472270-9297-1-git-send-email-mcgrof@do-not-panic.com>
From: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>
Commit 3cf2667 as of next-20130301 extended the struct fb_info
with a skip_vt_switch to allow drivers to skip the VT switch
at suspend/resume time. For older kernels we can skip this
as all this switch does is call pm_vt_switch_required() with true
or false depending on this new flag and later
pm_vt_switch_unregister() would not have been made.
This patch cannot be broken down further so I'm pegging
this as the first one with 4 digits under the DRM folder
for collateral evolutions. This reflects its as atomic as
is possible. As we'll see on the next commit, these type
of collateral evolutions can best be backported not by
keeping ifdef's as below but instead by using a wrapper
caller, to help reduce with the amount of lines of code
we need. If a static inline is added upstream for these
changes, then no code is required for backporting, at all,
we'd just implement the static inline later upstream as
a no-op.
The tradeoffs to consider for this is if we can live with
these practices upstream, we may be able to support full
subsystems only with a compat module, and no need for
patches. This also means less code and likely less bugs
on the distribution front when backporting is required.
At least IMHO this may be worthy to consider at least to
support kernels listed as supported on kernel.org. We could
just leave the ifdef hell to older unsupported kernels.
Relevant commits below, starting with the first one that
added this new collateral evolution.
commit 3cf2667b9f8b2c2fe298a427deb399e52321da6b
Author: Jesse Barnes <jbarnes@virtuousgeek.org>
Date: Mon Feb 4 13:37:21 2013 +0000
fb: add support for drivers not needing VT switch at suspend/resume time
Use the new PM routines to indicate whether we need to VT switch at suspend
and resume time. When a new driver is bound, set its flag accordingly,
and when unbound, remove it from the PM's console tracking list.
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
commit 24576d23976746cb52e7700c4cadbf4bc1bc3472
Author: Jesse Barnes <jbarnes@virtuousgeek.org>
Date: Tue Mar 26 09:25:45 2013 -0700
drm/i915: enable VT switchless resume v3
With the other bits in place, we can do this safely.
v2: disable backlight on suspend to prevent premature enablement on resume
v3: disable CRTCs on suspend to allow RTD3 (Kristen)
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: cocci@systeme.lip6.fr
Cc: backports@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: Julia Lawall <julia.lawall@lip6.fr>
Cc: Rodrigo Vivi <rodrigo.vivi@gmail.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
---
.../drm/0001-fb-info-vt_switch.patch | 73 ++++++++++++++++++++
1 file changed, 73 insertions(+)
create mode 100644 patches/collateral-evolutions/drm/0001-fb-info-vt_switch.patch
diff --git a/patches/collateral-evolutions/drm/0001-fb-info-vt_switch.patch b/patches/collateral-evolutions/drm/0001-fb-info-vt_switch.patch
new file mode 100644
index 0000000..cdced87
--- /dev/null
+++ b/patches/collateral-evolutions/drm/0001-fb-info-vt_switch.patch
@@ -0,0 +1,73 @@
+Commit 3cf2667 as of next-20130301 extended the struct fb_info
+with a skip_vt_switch to allow drivers to skip the VT switch
+at suspend/resume time. For older kernels we can skip this
+as all this switch does is call pm_vt_switch_required() with true
+or false depending on this new flag and later
+pm_vt_switch_unregister() would not have been made.
+
+This patch cannot be broken down further so I'm pegging
+this as the first one with 4 digits under the DRM folder
+for collateral evolutions. This reflects its as atomic as
+is possible. As we'll see on the next commit, these type
+of collateral evolutions can best be backported not by
+keeping ifdef's as below but instead by using a wrapper
+caller, to help reduce with the amount of lines of code
+we need. If a static inline is added upstream for these
+changes, then no code is required for backporting, at all,
+we'd just implement the static inline later upstream as
+a no-op.
+
+The tradeoffs to consider for this is if we can live with
+these practices upstream, we may be able to support full
+subsystems only with a compat module, and no need for
+patches. This also means less code and likely less bugs
+on the distribution front when backporting is required.
+At least IMHO this may be worthy to consider at least to
+support kernels listed as supported on kernel.org. We could
+just leave the ifdef hell to older unsupported kernels.
+
+Relevant commits below, starting with the first one that
+added this new collateral evolution.
+
+commit 3cf2667b9f8b2c2fe298a427deb399e52321da6b
+Author: Jesse Barnes <jbarnes@virtuousgeek.org>
+Date: Mon Feb 4 13:37:21 2013 +0000
+
+ fb: add support for drivers not needing VT switch at suspend/resume time
+
+ Use the new PM routines to indicate whether we need to VT switch at suspend
+ and resume time. When a new driver is bound, set its flag accordingly,
+ and when unbound, remove it from the PM's console tracking list.
+
+ Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
+ Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+ Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
+
+commit 24576d23976746cb52e7700c4cadbf4bc1bc3472
+Author: Jesse Barnes <jbarnes@virtuousgeek.org>
+Date: Tue Mar 26 09:25:45 2013 -0700
+
+ drm/i915: enable VT switchless resume v3
+
+ With the other bits in place, we can do this safely.
+
+ v2: disable backlight on suspend to prevent premature enablement on resume
+ v3: disable CRTCs on suspend to allow RTD3 (Kristen)
+
+ Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
+ Reviewed-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>
+ Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
+
+--- a/drivers/gpu/drm/i915/intel_fb.c
++++ b/drivers/gpu/drm/i915/intel_fb.c
+@@ -150,8 +150,10 @@ static int intelfb_create(struct drm_fb_
+ }
+ info->screen_size = size;
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0))
+ /* This driver doesn't need a VT switch to restore the mode on resume */
+ info->skip_vt_switch = true;
++#endif
+
+ drm_fb_helper_fill_fix(info, fb->pitches[0], fb->depth);
+ drm_fb_helper_fill_var(info, &ifbdev->helper, sizes->fb_width, sizes->fb_height);
--
1.7.10.4
^ permalink raw reply related
* [PATCH 2/4] compat: backport fb_info->skip_vt_switch using a static inline
From: Luis R. Rodriguez @ 2013-03-28 12:04 UTC (permalink / raw)
To: FlorianSchandinat
Cc: linux-fbdev, dri-devel, jbarnes, backports, cocci, linux-kernel,
julia.lawall, rodrigo.vivi, daniel.vetter, rafael.j.wysocki,
Luis R. Rodriguez
In-Reply-To: <1364472270-9297-1-git-send-email-mcgrof@do-not-panic.com>
From: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>
Commit 3cf2667 as of next-20130301 extended the struct fb_info
with a skip_vt_switch to allow drivers to skip the VT switch
at suspend/resume time. For older kernels we can skip this
as all this switch does is call pm_vt_switch_required() with true
or false depending on this new flag and later
pm_vt_switch_unregister() would not have been made.
compat-drivers was backporting this using #ifdef's but by
integrating a static inline we'd reduce the number of lines
to backport to just 1 line replacement. This would be something
like:
- info->skip_vt_switch = true;
+ fb_enable_skip_vt_switch(info);
For kernels >= 3.10 we'd set the attribute as we do upstream,
for older kernels this would be a no-op.
If this static inline would have been added upstream it would
have meant this collateral evolution would require just adding
a no-op static inline to backport, and no changes as the above
example hunk for every driver that requires the change.
If this static inline ends up upstream *now* it means we do *not*
require the type of hunk above for every driver that requires
the change.
All the code would be left intact !
This is a linux-next 'data structure element collateral evolution'.
Cc: cocci@systeme.lip6.fr
Cc: backports@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: Julia Lawall <julia.lawall@lip6.fr>
Cc: Rodrigo Vivi <rodrigo.vivi@gmail.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
---
include/linux/compat-3.10.h | 41 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
diff --git a/include/linux/compat-3.10.h b/include/linux/compat-3.10.h
index 69ddc11..9abfc4b 100644
--- a/include/linux/compat-3.10.h
+++ b/include/linux/compat-3.10.h
@@ -7,6 +7,7 @@
#include <linux/scatterlist.h>
#include <linux/mm.h>
+#include <linux/fb.h>
#define sg_page_iter_page LINUX_BACKPORT(sg_page_iter_page)
/**
@@ -29,6 +30,46 @@ static inline dma_addr_t sg_page_iter_dma_address(struct sg_page_iter *piter)
return sg_dma_address(piter->sg) + (piter->sg_pgoffset << PAGE_SHIFT);
}
+/*
+ * This is a linux-next data structure element collateral evolution,
+ * we use a wrapper to avoid #ifdef hell to backport it. This allows
+ * us to use a simple fb_info_skip_vt_switch() replacement for when
+ * the new data structure element is used. If coccinelle SmPL grammar
+ * could be used to express the transformation for us on compat-drivers
+ * it means we'd need to express it only once. If the structure element
+ * collateral evolution were to be used *at development* time and we'd
+ * have a way to express the inverse through SmPL we'd be able to
+ * backport this collateral evolution automatically for any new driver
+ * that used it. We'd use coccinelle to look for it and do the
+ * transformations for us based on the original commit (maybe SmPL
+ * would be listed on the commit log.
+ *
+ * We may need the LINUX_BACKPORT() call that adds the backport_
+ * prefix for older kernels than 3.10 if distros decide to
+ * add this same static inline themselves (although unlikely).
+ */
+#define fb_enable_skip_vt_switch LINUX_BACKPORT(fb_enable_skip_vt_switch)
+static inline void fb_enable_skip_vt_switch(struct fb_info *info)
+{
+}
+
+#else /* kernel is >= 3.10 */
+/*
+ * We'd delete this upstream ever got this, we use our
+ * backport_ prefix with LINUX_BACKPORT() so that if this
+ * does get upstream we would not have to add another ifdef
+ * here for the kernels in between v3.10.. up to the point
+ * the routine would have gotten added, we'd just delete this
+ * #else condition completely. If we didn't have this and
+ * say 3.12 added the static inline upstream, we'd have a
+ * clash on the backport for 3.12 as the routine would
+ * already be defined *but* we'd need it for 3.11.
+ */
+#define fb_enable_skip_vt_switch LINUX_BACKPORT(fb_enable_skip_vt_switch)
+static inline void fb_enable_skip_vt_switch(struct fb_info *info)
+{
+ info->skip_vt_switch = true;
+}
#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)) */
#endif /* LINUX_3_10_COMPAT_H */
--
1.7.10.4
^ permalink raw reply related
* [PATCH 3/4] compat-drivers: simplify backport fb_info->skip_vt_switch CE
From: Luis R. Rodriguez @ 2013-03-28 12:04 UTC (permalink / raw)
To: FlorianSchandinat
Cc: linux-fbdev, dri-devel, jbarnes, backports, cocci, linux-kernel,
julia.lawall, rodrigo.vivi, daniel.vetter, rafael.j.wysocki,
Luis R. Rodriguez
In-Reply-To: <1364472270-9297-1-git-send-email-mcgrof@do-not-panic.com>
From: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>
The collateral evolution (CE) on the fb_info data structure
that added the skip_vt_switch element can be simplified
further by replacing the #ifdef hell with a static inline.
Furthermore, if the static inline is added upstream it'd mean
we can get rid of all these static inline replacements for
this data structure element CE.
Cc: cocci@systeme.lip6.fr
Cc: backports@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: Julia Lawall <julia.lawall@lip6.fr>
Cc: Rodrigo Vivi <rodrigo.vivi@gmail.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
---
.../drm/0001-fb-info-vt_switch.patch | 25 ++++----------------
1 file changed, 4 insertions(+), 21 deletions(-)
diff --git a/patches/collateral-evolutions/drm/0001-fb-info-vt_switch.patch b/patches/collateral-evolutions/drm/0001-fb-info-vt_switch.patch
index cdced87..39b13d1 100644
--- a/patches/collateral-evolutions/drm/0001-fb-info-vt_switch.patch
+++ b/patches/collateral-evolutions/drm/0001-fb-info-vt_switch.patch
@@ -8,23 +8,7 @@ pm_vt_switch_unregister() would not have been made.
This patch cannot be broken down further so I'm pegging
this as the first one with 4 digits under the DRM folder
for collateral evolutions. This reflects its as atomic as
-is possible. As we'll see on the next commit, these type
-of collateral evolutions can best be backported not by
-keeping ifdef's as below but instead by using a wrapper
-caller, to help reduce with the amount of lines of code
-we need. If a static inline is added upstream for these
-changes, then no code is required for backporting, at all,
-we'd just implement the static inline later upstream as
-a no-op.
-
-The tradeoffs to consider for this is if we can live with
-these practices upstream, we may be able to support full
-subsystems only with a compat module, and no need for
-patches. This also means less code and likely less bugs
-on the distribution front when backporting is required.
-At least IMHO this may be worthy to consider at least to
-support kernels listed as supported on kernel.org. We could
-just leave the ifdef hell to older unsupported kernels.
+is possible.
Relevant commits below, starting with the first one that
added this new collateral evolution.
@@ -60,14 +44,13 @@ Date: Tue Mar 26 09:25:45 2013 -0700
--- a/drivers/gpu/drm/i915/intel_fb.c
+++ b/drivers/gpu/drm/i915/intel_fb.c
-@@ -150,8 +150,10 @@ static int intelfb_create(struct drm_fb_
+@@ -150,8 +150,8 @@ static int intelfb_create(struct drm_fb_
}
info->screen_size = size;
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0))
/* This driver doesn't need a VT switch to restore the mode on resume */
- info->skip_vt_switch = true;
-+#endif
+- info->skip_vt_switch = true;
++ fb_enable_skip_vt_switch(info);
drm_fb_helper_fill_fix(info, fb->pitches[0], fb->depth);
drm_fb_helper_fill_var(info, &ifbdev->helper, sizes->fb_width, sizes->fb_height);
--
1.7.10.4
^ permalink raw reply related
* [PATCH 4/4] fb: add helpers to enable and test for the skip_vt_switch
From: Luis R. Rodriguez @ 2013-03-28 12:04 UTC (permalink / raw)
To: FlorianSchandinat
Cc: linux-fbdev, dri-devel, jbarnes, backports, cocci, linux-kernel,
julia.lawall, rodrigo.vivi, daniel.vetter, rafael.j.wysocki,
Luis R. Rodriguez
In-Reply-To: <1364472270-9297-1-git-send-email-mcgrof@do-not-panic.com>
From: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>
This adds helpers to enable and test for the skip_vt_switch.
This gets us two things:
1) It allows us to require less collateral evolutions
should we need changes on the fb_info data structure
later (perhaps a bitmap flag).
2) Allows this feature to be backported with 0 delta
required on the upstream drivers, we'd just require
the static inline to do a no-op.
1) may be worth while considering, 2) is a new consideration
I'm trying to get others to evaluate to help with automatically
backporting the Linux kernel. This is the first time I am
aware someone argues for it.
Cc: cocci@systeme.lip6.fr
Cc: backports@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: Julia Lawall <julia.lawall@lip6.fr>
Cc: Rodrigo Vivi <rodrigo.vivi@gmail.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
---
drivers/gpu/drm/i915/intel_fb.c | 2 +-
drivers/video/fbmem.c | 2 +-
include/linux/fb.h | 10 ++++++++++
3 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/i915/intel_fb.c b/drivers/gpu/drm/i915/intel_fb.c
index 8d81c929..c0f306c 100644
--- a/drivers/gpu/drm/i915/intel_fb.c
+++ b/drivers/gpu/drm/i915/intel_fb.c
@@ -151,7 +151,7 @@ static int intelfb_create(struct drm_fb_helper *helper,
info->screen_size = size;
/* This driver doesn't need a VT switch to restore the mode on resume */
- info->skip_vt_switch = true;
+ fb_enable_skip_vt_switch(info);
drm_fb_helper_fill_fix(info, fb->pitches[0], fb->depth);
drm_fb_helper_fill_var(info, &ifbdev->helper, sizes->fb_width, sizes->fb_height);
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c
index ccd44b0..daffadc 100644
--- a/drivers/video/fbmem.c
+++ b/drivers/video/fbmem.c
@@ -1645,7 +1645,7 @@ static int do_register_framebuffer(struct fb_info *fb_info)
if (!fb_info->modelist.prev || !fb_info->modelist.next)
INIT_LIST_HEAD(&fb_info->modelist);
- if (fb_info->skip_vt_switch)
+ if (fb_skip_vt_switch_isset(fb_info))
pm_vt_switch_required(fb_info->dev, false);
else
pm_vt_switch_required(fb_info->dev, true);
diff --git a/include/linux/fb.h b/include/linux/fb.h
index d49c60f..d534966 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -505,6 +505,16 @@ struct fb_info {
bool skip_vt_switch; /* no VT switch on suspend/resume required */
};
+static inline void fb_enable_skip_vt_switch(struct fb_info *info)
+{
+ info->skip_vt_switch = true;
+}
+
+static inline bool fb_skip_vt_switch_isset(struct fb_info *info)
+{
+ return info->skip_vt_switch;
+}
+
static inline struct apertures_struct *alloc_apertures(unsigned int max_num) {
struct apertures_struct *a = kzalloc(sizeof(struct apertures_struct)
+ max_num * sizeof(struct aperture), GFP_KERNEL);
--
1.7.10.4
^ permalink raw reply related
* [GIT PULL] fbdev fixes for 3.9
From: Tomi Valkeinen @ 2013-03-28 12:26 UTC (permalink / raw)
To: Linus Torvalds
Cc: Florian Tobias Schandinat, linux-fbdev, linux-omap, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1421 bytes --]
Hi Linus,
Since Florian is still away/inactive, I volunteered to collect fbdev fixes for
3.9 and changes for 3.10. I didn't receive any other fbdev fixes than OMAP yet,
but I didn't want to delay this further as there's a compilation fix for OMAP1.
So there could be still some fbdev fixes on the way a bit later.
Tomi
The following changes since commit a937536b868b8369b98967929045f1df54234323:
Linux 3.9-rc3 (2013-03-17 15:59:32 -0700)
are available in the git repository at:
git://gitorious.org/linux-omap-dss2/linux.git tags/fbdev-fixes-3.9-rc4
for you to fetch changes up to ff588d83bf12fe05521a64e85dd4e2b848c0b20d:
omapdss: features: fix supported outputs for OMAP4 (2013-03-22 10:14:32 +0200)
----------------------------------------------------------------
* Fix OMAP1 compilation
* OMAP display fixes
----------------------------------------------------------------
Aaro Koskinen (1):
omapfb: fix broken build on OMAP1
Archit Taneja (1):
omapdss: features: fix supported outputs for OMAP4
Grazvydas Ignotas (1):
OMAPDSS: tpo-td043 panel: fix data passing between SPI/DSS parts
drivers/video/omap/omapfb_main.c | 2 ++
drivers/video/omap2/displays/panel-tpo-td043mtea1.c | 13 +++++++++++--
drivers/video/omap2/dss/dss_features.c | 6 ++----
3 files changed, 15 insertions(+), 6 deletions(-)
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 899 bytes --]
^ permalink raw reply
* Re: [PATCH] compat/compat-drivers/linux-next: fb skip_vt_switch
From: Jesse Barnes @ 2013-03-28 15:39 UTC (permalink / raw)
To: Luis R. Rodriguez
Cc: linux-fbdev, backports, FlorianSchandinat, daniel.vetter,
rafael.j.wysocki, linux-kernel, dri-devel, rodrigo.vivi, cocci
In-Reply-To: <1364472270-9297-1-git-send-email-mcgrof@do-not-panic.com>
On Thu, 28 Mar 2013 05:04:26 -0700
"Luis R. Rodriguez" <mcgrof@do-not-panic.com> wrote:
> The new commit by Jesse that extended the fb_info with a skip_vt_switch
> element is the simplest example of a data structure expansion. We'd backport
> this by adding a static inline to compat so that new kernels muck with the
> new element and for older kernels this would be a no-op. This reduces the
> size of the backport and unclutters the required patch with #idefs, and
> insteads leaves only a replacement of the usage of the new elements with
> a static inline, this however would still be required on our end:
>
> - info->skip_vt_switch = true;
> + fb_enable_skip_vt_switch(info);
>
> So we'd then have to just add this static inline change for each new driver...
> There may be a way to get SmPL to do this for us...
Yeah I'm not attached to the direct structure reference; a couple of
inlines are just as easy to read. So no argument from me.
Thanks,
--
Jesse Barnes, Intel Open Source Technology Center
^ permalink raw reply
* Re: [PATCH] compat/compat-drivers/linux-next: fb skip_vt_switch
From: Julia Lawall @ 2013-03-28 16:19 UTC (permalink / raw)
To: Jesse Barnes
Cc: Luis R. Rodriguez, FlorianSchandinat, linux-fbdev, dri-devel,
backports, cocci, linux-kernel, julia.lawall, rodrigo.vivi,
daniel.vetter, rafael.j.wysocki
In-Reply-To: <20130328083943.01e61b4b@jbarnes-desktop>
On Thu, 28 Mar 2013, Jesse Barnes wrote:
> On Thu, 28 Mar 2013 05:04:26 -0700
> "Luis R. Rodriguez" <mcgrof@do-not-panic.com> wrote:
>
> > The new commit by Jesse that extended the fb_info with a skip_vt_switch
> > element is the simplest example of a data structure expansion. We'd backport
> > this by adding a static inline to compat so that new kernels muck with the
> > new element and for older kernels this would be a no-op. This reduces the
> > size of the backport and unclutters the required patch with #idefs, and
> > insteads leaves only a replacement of the usage of the new elements with
> > a static inline, this however would still be required on our end:
> >
> > - info->skip_vt_switch = true;
> > + fb_enable_skip_vt_switch(info);
> >
> > So we'd then have to just add this static inline change for each new driver...
> > There may be a way to get SmPL to do this for us...
@@
type of info *info;
@@
- info->skip_vt_switch = true;
+ fb_enable_skip_vt_switch(info);
for whatever the type of info is.
Then I guess there would be a similar rule for the false case?
julia
>
> Yeah I'm not attached to the direct structure reference; a couple of
> inlines are just as easy to read. So no argument from me.
>
> Thanks,
> --
> Jesse Barnes, Intel Open Source Technology Center
>
^ permalink raw reply
* Re: [PATCH] compat/compat-drivers/linux-next: fb skip_vt_switch
From: Luis R. Rodriguez @ 2013-03-28 18:05 UTC (permalink / raw)
To: Julia Lawall
Cc: Jesse Barnes, FlorianSchandinat, linux-fbdev, dri-devel,
backports@vger.kernel.org, cocci, linux-kernel@vger.kernel.org,
rodrigo.vivi, Daniel Vetter, rafael.j.wysocki
In-Reply-To: <alpine.DEB.2.02.1303281718490.1928@hadrien>
On Thu, Mar 28, 2013 at 9:19 AM, Julia Lawall <julia.lawall@lip6.fr> wrote:
> On Thu, 28 Mar 2013, Jesse Barnes wrote:
>> > - info->skip_vt_switch = true;
>> > + fb_enable_skip_vt_switch(info);
>> >
>> > So we'd then have to just add this static inline change for each new driver...
>> > There may be a way to get SmPL to do this for us...
>
> @@
> type of info *info;
> @@
>
> - info->skip_vt_switch = true;
> + fb_enable_skip_vt_switch(info);
>
> for whatever the type of info is.
Thanks Julia! I'll be sure to try to add this to compat-drivers if the
upstream fb patch is not accepted. If it is accepted we would not need
this at all!
> Then I guess there would be a similar rule for the false case?
Nope, see that's the proactive strategy taken by the static inline and
hence the patch. compat would have a static inline for both cases, and
for the false case it'd be a no-op. If accepted upstream though then
we would not need any changes for this collateral evolution. However
*spotting* these collateral evolutions and giving you SmPL for them as
a proactive strategy might be good given that if these type of patches
are indeed welcomed upstream we'd then be able to address these as
secondary steps. If they are not accepted then indeed we'd use them to
backport that collateral evolution through both compat (adds the
static inlines) and compat-drivers (the SmPL).
Luis
^ permalink raw reply
* Re: [PATCH] compat/compat-drivers/linux-next: fb skip_vt_switch
From: Julia Lawall @ 2013-03-28 18:10 UTC (permalink / raw)
To: Luis R. Rodriguez
Cc: Julia Lawall, Jesse Barnes, FlorianSchandinat, linux-fbdev,
dri-devel, backports@vger.kernel.org, cocci,
linux-kernel@vger.kernel.org, rodrigo.vivi, Daniel Vetter,
rafael.j.wysocki
In-Reply-To: <CAB=NE6WbNwPqEPYsASAPaECe4qbAWdd4=eJ402ib+CzZbT69=g@mail.gmail.com>
On Thu, 28 Mar 2013, Luis R. Rodriguez wrote:
> On Thu, Mar 28, 2013 at 9:19 AM, Julia Lawall <julia.lawall@lip6.fr> wrote:
> > On Thu, 28 Mar 2013, Jesse Barnes wrote:
> >> > - info->skip_vt_switch = true;
> >> > + fb_enable_skip_vt_switch(info);
> >> >
> >> > So we'd then have to just add this static inline change for each new driver...
> >> > There may be a way to get SmPL to do this for us...
> >
> > @@
> > type of info *info;
> > @@
> >
> > - info->skip_vt_switch = true;
> > + fb_enable_skip_vt_switch(info);
> >
> > for whatever the type of info is.
>
> Thanks Julia! I'll be sure to try to add this to compat-drivers if the
> upstream fb patch is not accepted. If it is accepted we would not need
> this at all!
>
> > Then I guess there would be a similar rule for the false case?
>
> Nope, see that's the proactive strategy taken by the static inline and
> hence the patch. compat would have a static inline for both cases, and
> for the false case it'd be a no-op. If accepted upstream though then
> we would not need any changes for this collateral evolution. However
> *spotting* these collateral evolutions and giving you SmPL for them as
> a proactive strategy might be good given that if these type of patches
> are indeed welcomed upstream we'd then be able to address these as
> secondary steps. If they are not accepted then indeed we'd use them to
> backport that collateral evolution through both compat (adds the
> static inlines) and compat-drivers (the SmPL).
Probably I am missing something, since I haven't looked at the code in
detail, bu wouldn't it be nicer to have a function call for the false
case, if there is a function call for the true case? In looking at the
code, one could wonder why things are not done in a parallel way.
julia
^ permalink raw reply
* Re: [PATCH] compat/compat-drivers/linux-next: fb skip_vt_switch
From: Luis R. Rodriguez @ 2013-03-28 18:25 UTC (permalink / raw)
To: Julia Lawall
Cc: Jesse Barnes, florianschandinat, linux-fbdev, dri-devel,
backports@vger.kernel.org, cocci, linux-kernel@vger.kernel.org,
rodrigo.vivi, Daniel Vetter, rafael.j.wysocki
In-Reply-To: <alpine.DEB.2.02.1303281909570.1928@hadrien>
On Thu, Mar 28, 2013 at 11:10 AM, Julia Lawall <julia.lawall@lip6.fr> wrote:
> On Thu, 28 Mar 2013, Luis R. Rodriguez wrote:
>>
>> Thanks Julia! I'll be sure to try to add this to compat-drivers if the
>> upstream fb patch is not accepted. If it is accepted we would not need
>> this at all!
>>
>> > Then I guess there would be a similar rule for the false case?
>>
>> Nope, see that's the proactive strategy taken by the static inline and
>> hence the patch. compat would have a static inline for both cases, and
>> for the false case it'd be a no-op. If accepted upstream though then
>> we would not need any changes for this collateral evolution. However
>> *spotting* these collateral evolutions and giving you SmPL for them as
>> a proactive strategy might be good given that if these type of patches
>> are indeed welcomed upstream we'd then be able to address these as
>> secondary steps. If they are not accepted then indeed we'd use them to
>> backport that collateral evolution through both compat (adds the
>> static inlines) and compat-drivers (the SmPL).
>
> Probably I am missing something, since I haven't looked at the code in
> detail, bu wouldn't it be nicer to have a function call for the false
> case, if there is a function call for the true case?
Yes, and indeed we have that, its the same function call, in the
negative case its a no-op, in the newer kernels it wraps to modifying
the element as in the original code.
> In looking at the
> code, one could wonder why things are not done in a parallel way.
Not sure I get this.
Luis
^ permalink raw reply
* [PATCH 1/1] video: fbomn: fix type VESA_DMT_VSYNC_HIGH
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-03-28 21:03 UTC (permalink / raw)
To: linux-arm-kernel
it's VESA_DMT_VSYNC_HIGH not VESA_DMT_HSYNC_HIGH
to check to enable the FB_SYNC_VERT_HIGH_ACT
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-fbdev@vger.kernel.org
---
drivers/video/fbmon.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/video/fbmon.c b/drivers/video/fbmon.c
index 94ad0f7..7f67099 100644
--- a/drivers/video/fbmon.c
+++ b/drivers/video/fbmon.c
@@ -1400,7 +1400,7 @@ int fb_videomode_from_videomode(const struct videomode *vm,
fbmode->vmode = 0;
if (vm->dmt_flags & VESA_DMT_HSYNC_HIGH)
fbmode->sync |= FB_SYNC_HOR_HIGH_ACT;
- if (vm->dmt_flags & VESA_DMT_HSYNC_HIGH)
+ if (vm->dmt_flags & VESA_DMT_VSYNC_HIGH)
fbmode->sync |= FB_SYNC_VERT_HIGH_ACT;
if (vm->data_flags & DISPLAY_FLAGS_INTERLACED)
fbmode->vmode |= FB_VMODE_INTERLACED;
--
1.7.10.4
^ permalink raw reply related
* Re: [PATCH] compat/compat-drivers/linux-next: fb skip_vt_switch
From: Julia Lawall @ 2013-03-28 22:29 UTC (permalink / raw)
To: Luis R. Rodriguez
Cc: Julia Lawall, Jesse Barnes, florianschandinat, linux-fbdev,
dri-devel, backports@vger.kernel.org, cocci,
linux-kernel@vger.kernel.org, rodrigo.vivi, Daniel Vetter,
rafael.j.wysocki
In-Reply-To: <CAB=NE6VPRu8DvneVdwd=pXF0ngi5OifNTpZtX3pLi50i116_OA@mail.gmail.com>
On Thu, 28 Mar 2013, Luis R. Rodriguez wrote:
> On Thu, Mar 28, 2013 at 11:10 AM, Julia Lawall <julia.lawall@lip6.fr> wrote:
> > On Thu, 28 Mar 2013, Luis R. Rodriguez wrote:
> >>
> >> Thanks Julia! I'll be sure to try to add this to compat-drivers if the
> >> upstream fb patch is not accepted. If it is accepted we would not need
> >> this at all!
> >>
> >> > Then I guess there would be a similar rule for the false case?
> >>
> >> Nope, see that's the proactive strategy taken by the static inline and
> >> hence the patch. compat would have a static inline for both cases, and
> >> for the false case it'd be a no-op. If accepted upstream though then
> >> we would not need any changes for this collateral evolution. However
> >> *spotting* these collateral evolutions and giving you SmPL for them as
> >> a proactive strategy might be good given that if these type of patches
> >> are indeed welcomed upstream we'd then be able to address these as
> >> secondary steps. If they are not accepted then indeed we'd use them to
> >> backport that collateral evolution through both compat (adds the
> >> static inlines) and compat-drivers (the SmPL).
> >
> > Probably I am missing something, since I haven't looked at the code in
> > detail, bu wouldn't it be nicer to have a function call for the false
> > case, if there is a function call for the true case?
>
> Yes, and indeed we have that, its the same function call, in the
> negative case its a no-op, in the newer kernels it wraps to modifying
> the element as in the original code.
>
> > In looking at the
> > code, one could wonder why things are not done in a parallel way.
>
> Not sure I get this.
I looked in today's linux-next, and there seems to be only one
initialization of this field, to true, and one test of this field. So
perhaps the case for setting the field to false just isn't needed.
julia
^ permalink raw reply
* Re: [PATCH] compat/compat-drivers/linux-next: fb skip_vt_switch
From: Luis R. Rodriguez @ 2013-03-28 23:25 UTC (permalink / raw)
To: Julia Lawall
Cc: Jesse Barnes, florianschandinat, linux-fbdev, dri-devel,
backports@vger.kernel.org, cocci, linux-kernel@vger.kernel.org,
rodrigo.vivi, Daniel Vetter, rafael.j.wysocki
In-Reply-To: <alpine.DEB.2.02.1303282328200.2022@localhost6.localdomain6>
On Thu, Mar 28, 2013 at 3:29 PM, Julia Lawall <julia.lawall@lip6.fr> wrote:
> On Thu, 28 Mar 2013, Luis R. Rodriguez wrote:
>
>> On Thu, Mar 28, 2013 at 11:10 AM, Julia Lawall <julia.lawall@lip6.fr> wrote:
>> > On Thu, 28 Mar 2013, Luis R. Rodriguez wrote:
>> >>
>> >> Thanks Julia! I'll be sure to try to add this to compat-drivers if the
>> >> upstream fb patch is not accepted. If it is accepted we would not need
>> >> this at all!
>> >>
>> >> > Then I guess there would be a similar rule for the false case?
>> >>
>> >> Nope, see that's the proactive strategy taken by the static inline and
>> >> hence the patch. compat would have a static inline for both cases, and
>> >> for the false case it'd be a no-op. If accepted upstream though then
>> >> we would not need any changes for this collateral evolution. However
>> >> *spotting* these collateral evolutions and giving you SmPL for them as
>> >> a proactive strategy might be good given that if these type of patches
>> >> are indeed welcomed upstream we'd then be able to address these as
>> >> secondary steps. If they are not accepted then indeed we'd use them to
>> >> backport that collateral evolution through both compat (adds the
>> >> static inlines) and compat-drivers (the SmPL).
>> >
>> > Probably I am missing something, since I haven't looked at the code in
>> > detail, bu wouldn't it be nicer to have a function call for the false
>> > case, if there is a function call for the true case?
>>
>> Yes, and indeed we have that, its the same function call, in the
>> negative case its a no-op, in the newer kernels it wraps to modifying
>> the element as in the original code.
>>
>> > In looking at the
>> > code, one could wonder why things are not done in a parallel way.
>>
>> Not sure I get this.
>
> I looked in today's linux-next, and there seems to be only one
> initialization of this field, to true, and one test of this field. So
> perhaps the case for setting the field to false just isn't needed.
Oh sorry now I get what you mean! I thought about this -- and yes I
decided to not add a bool false setting for the structure field given
that the assumption is this would not be something dynamic, and data
structure would be kzalloc()'d so by default they are 0.
Luis
^ permalink raw reply
* Re: [PATCH 1/1] video: fbomn: fix type VESA_DMT_VSYNC_HIGH
From: Jingoo Han @ 2013-03-29 1:29 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1364504606-2087-1-git-send-email-plagnioj@jcrosoft.com>
On Friday, March 29, 2013 6:03 AM, Jean-Christophe PLAGNIOL-VILLARD wrote:
>
> it's VESA_DMT_VSYNC_HIGH not VESA_DMT_HSYNC_HIGH
> to check to enable the FB_SYNC_VERT_HIGH_ACT
>
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: linux-fbdev@vger.kernel.org
CC'ed Steffen Trumtrar.
The same patch was already submitted as below:
(https://patchwork.kernel.org/patch/2183811/)
I will resend this patch, soon.
Best regards,
Jingoo Han
> ---
> drivers/video/fbmon.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/video/fbmon.c b/drivers/video/fbmon.c
> index 94ad0f7..7f67099 100644
> --- a/drivers/video/fbmon.c
> +++ b/drivers/video/fbmon.c
> @@ -1400,7 +1400,7 @@ int fb_videomode_from_videomode(const struct videomode *vm,
> fbmode->vmode = 0;
> if (vm->dmt_flags & VESA_DMT_HSYNC_HIGH)
> fbmode->sync |= FB_SYNC_HOR_HIGH_ACT;
> - if (vm->dmt_flags & VESA_DMT_HSYNC_HIGH)
> + if (vm->dmt_flags & VESA_DMT_VSYNC_HIGH)
> fbmode->sync |= FB_SYNC_VERT_HIGH_ACT;
> if (vm->data_flags & DISPLAY_FLAGS_INTERLACED)
> fbmode->vmode |= FB_VMODE_INTERLACED;
> --
> 1.7.10.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* [PATCH RESEND] fbmon: use VESA_DMT_VSYNC_HIGH to fix typo
From: Jingoo Han @ 2013-03-29 1:40 UTC (permalink / raw)
To: akpm
Cc: linux-kernel, linux-fbdev, tomi.valkeinen, FlorianSchandinat,
s.trumtrar, plagnioj, jg1.han
VkVTQV9ETVRfVlNZTkNfSElHSCBzaG91bGQgYmUgdXNlZCBpbnN0ZWFkIG9mIFZFU0FfRE1UX0hT
WU5DX0hJR0gsDQpiZWNhdXNlIEZCX1NZTkNfVkVSVF9ISUdIX0FDVCBpcyByZWxhdGVkIHRvIHZz
eW5jLCBub3QgdG8gaHN5bmMuDQoNClNpZ25lZC1vZmYtYnk6IEppbmdvbyBIYW4gPGpnMS5oYW5A
c2Ftc3VuZy5jb20+DQpDYzogU3RlZmZlbiBUcnVtdHJhciA8cy50cnVtdHJhckBwZW5ndXRyb25p
eC5kZT4NCkNjOiBUb21pIFZhbGtlaW5lbiA8dG9taS52YWxrZWluZW5AdGkuY29tPg0KLS0tDQog
ZHJpdmVycy92aWRlby9mYm1vbi5jIHwgICAgMiArLQ0KIDEgZmlsZXMgY2hhbmdlZCwgMSBpbnNl
cnRpb25zKCspLCAxIGRlbGV0aW9ucygtKQ0KDQpkaWZmIC0tZ2l0IGEvZHJpdmVycy92aWRlby9m
Ym1vbi5jIGIvZHJpdmVycy92aWRlby9mYm1vbi5jDQppbmRleCA5NGFkMGY3Li43ZjY3MDk5IDEw
MDY0NA0KLS0tIGEvZHJpdmVycy92aWRlby9mYm1vbi5jDQorKysgYi9kcml2ZXJzL3ZpZGVvL2Zi
bW9uLmMNCkBAIC0xNDAwLDcgKzE0MDAsNyBAQCBpbnQgZmJfdmlkZW9tb2RlX2Zyb21fdmlkZW9t
b2RlKGNvbnN0IHN0cnVjdCB2aWRlb21vZGUgKnZtLA0KIAlmYm1vZGUtPnZtb2RlID0gMDsNCiAJ
aWYgKHZtLT5kbXRfZmxhZ3MgJiBWRVNBX0RNVF9IU1lOQ19ISUdIKQ0KIAkJZmJtb2RlLT5zeW5j
IHw9IEZCX1NZTkNfSE9SX0hJR0hfQUNUOw0KLQlpZiAodm0tPmRtdF9mbGFncyAmIFZFU0FfRE1U
X0hTWU5DX0hJR0gpDQorCWlmICh2bS0+ZG10X2ZsYWdzICYgVkVTQV9ETVRfVlNZTkNfSElHSCkN
CiAJCWZibW9kZS0+c3luYyB8PSBGQl9TWU5DX1ZFUlRfSElHSF9BQ1Q7DQogCWlmICh2bS0+ZGF0
YV9mbGFncyAmIERJU1BMQVlfRkxBR1NfSU5URVJMQUNFRCkNCiAJCWZibW9kZS0+dm1vZGUgfD0g
RkJfVk1PREVfSU5URVJMQUNFRDsNCi0tIA0KMS43LjIuNQ0K
^ permalink raw reply
* Re: [PATCH] compat/compat-drivers/linux-next: fb skip_vt_switch
From: Julia Lawall @ 2013-03-29 6:21 UTC (permalink / raw)
To: Luis R. Rodriguez
Cc: Julia Lawall, Jesse Barnes, florianschandinat, linux-fbdev,
dri-devel, backports@vger.kernel.org, cocci,
linux-kernel@vger.kernel.org, rodrigo.vivi, Daniel Vetter,
rafael.j.wysocki
In-Reply-To: <CAB=NE6WX5Dv9p2jrNwe9GxfH=EUm596uvSspsLQ5-Uuonc6Fqg@mail.gmail.com>
> > I looked in today's linux-next, and there seems to be only one
> > initialization of this field, to true, and one test of this field. So
> > perhaps the case for setting the field to false just isn't needed.
>
> Oh sorry now I get what you mean! I thought about this -- and yes I
> decided to not add a bool false setting for the structure field given
> that the assumption is this would not be something dynamic, and data
> structure would be kzalloc()'d so by default they are 0.
What do you do about the test, though?
julia
^ permalink raw reply
* Re: [PATCH] compat/compat-drivers/linux-next: fb skip_vt_switch
From: Luis R. Rodriguez @ 2013-03-29 7:29 UTC (permalink / raw)
To: Julia Lawall
Cc: Jesse Barnes, florianschandinat, linux-fbdev, dri-devel,
backports@vger.kernel.org, cocci, linux-kernel@vger.kernel.org,
rodrigo.vivi, Daniel Vetter, rafael.j.wysocki
In-Reply-To: <alpine.DEB.2.02.1303290720350.2023@localhost6.localdomain6>
On Thu, Mar 28, 2013 at 11:21 PM, Julia Lawall <julia.lawall@lip6.fr> wrote:
>> > I looked in today's linux-next, and there seems to be only one
>> > initialization of this field, to true, and one test of this field. So
>> > perhaps the case for setting the field to false just isn't needed.
>>
>> Oh sorry now I get what you mean! I thought about this -- and yes I
>> decided to not add a bool false setting for the structure field given
>> that the assumption is this would not be something dynamic, and data
>> structure would be kzalloc()'d so by default they are 0.
>
> What do you do about the test, though?
Return the value.
Luis
^ permalink raw reply
* Re: [PATCH RESEND] fbmon: use VESA_DMT_VSYNC_HIGH to fix typo
From: Steffen Trumtrar @ 2013-03-29 8:41 UTC (permalink / raw)
To: Jingoo Han
Cc: akpm, linux-kernel, linux-fbdev, tomi.valkeinen,
FlorianSchandinat, plagnioj
In-Reply-To: <8984685.165951364521249756.JavaMail.weblogic@epml18>
On Fri, Mar 29, 2013 at 01:40:52AM +0000, Jingoo Han wrote:
> VESA_DMT_VSYNC_HIGH should be used instead of VESA_DMT_HSYNC_HIGH,
> because FB_SYNC_VERT_HIGH_ACT is related to vsync, not to hsync.
>
> Signed-off-by: Jingoo Han <jg1.han@samsung.com>
> Cc: Steffen Trumtrar <s.trumtrar@pengutronix.de>
> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
> drivers/video/fbmon.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/video/fbmon.c b/drivers/video/fbmon.c
> index 94ad0f7..7f67099 100644
> --- a/drivers/video/fbmon.c
> +++ b/drivers/video/fbmon.c
> @@ -1400,7 +1400,7 @@ int fb_videomode_from_videomode(const struct videomode *vm,
> fbmode->vmode = 0;
> if (vm->dmt_flags & VESA_DMT_HSYNC_HIGH)
> fbmode->sync |= FB_SYNC_HOR_HIGH_ACT;
> - if (vm->dmt_flags & VESA_DMT_HSYNC_HIGH)
> + if (vm->dmt_flags & VESA_DMT_VSYNC_HIGH)
> fbmode->sync |= FB_SYNC_VERT_HIGH_ACT;
> if (vm->data_flags & DISPLAY_FLAGS_INTERLACED)
> fbmode->vmode |= FB_VMODE_INTERLACED;
> --
> 1.7.2.5
Hi,
I already implied this on the original mail, but to be clear:
Acked-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Thanks,
Steffen
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply
* Re: [PATCH 1/1] video: fbomn: fix type VESA_DMT_VSYNC_HIGH
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-03-29 18:31 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <002801ce2c1c$e93564a0$bba02de0$%han@samsung.com>
On 10:29 Fri 29 Mar , Jingoo Han wrote:
> On Friday, March 29, 2013 6:03 AM, Jean-Christophe PLAGNIOL-VILLARD wrote:
> >
> > it's VESA_DMT_VSYNC_HIGH not VESA_DMT_HSYNC_HIGH
> > to check to enable the FB_SYNC_VERT_HIGH_ACT
> >
> > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> > Cc: Andrew Morton <akpm@linux-foundation.org>
> > Cc: linux-fbdev@vger.kernel.org
>
> CC'ed Steffen Trumtrar.
>
> The same patch was already submitted as below:
> (https://patchwork.kernel.org/patch/2183811/)
>
> I will resend this patch, soon.
did not see ok
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
so
Best Regards,
J.
^ permalink raw reply
* Re: [PATCH 1/2] video: ssd1307fb: Add support for SSD1306 OLED controller
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-03-29 18:38 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1362588251-1824-2-git-send-email-maxime.ripard@free-electrons.com>
On 17:44 Wed 06 Mar , Maxime Ripard wrote:
> The Solomon SSD1306 OLED controller is very similar to the SSD1307,
> except for the fact that the power is given through an external PWM for
> the 1307, and while the 1306 can generate its own power without any PWM.
>
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> ---
> .../devicetree/bindings/video/ssd1307fb.txt | 10 +-
> drivers/video/ssd1307fb.c | 267 ++++++++++++++------
> 2 files changed, 203 insertions(+), 74 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/video/ssd1307fb.txt b/Documentation/devicetree/bindings/video/ssd1307fb.txt
> index 3d0060c..7a12542 100644
> --- a/Documentation/devicetree/bindings/video/ssd1307fb.txt
> +++ b/Documentation/devicetree/bindings/video/ssd1307fb.txt
> @@ -1,13 +1,17 @@
> * Solomon SSD1307 Framebuffer Driver
>
> Required properties:
> - - compatible: Should be "solomon,ssd1307fb-<bus>". The only supported bus for
> - now is i2c.
> + - compatible: Should be "solomon,<chip>fb-<bus>". The only supported bus for
> + now is i2c, and the supported chips are ssd1306 and ssd1307.
> - reg: Should contain address of the controller on the I2C bus. Most likely
> 0x3c or 0x3d
> - pwm: Should contain the pwm to use according to the OF device tree PWM
> - specification [0]
> + specification [0]. Only required for the ssd1307.
> - reset-gpios: Should contain the GPIO used to reset the OLED display
> + - solomon,height: Height in pixel of the screen driven by the controller
> + - solomon,width: Width in pixel of the screen driven by the controller
> + - solomon,page-offset: Offset of pages (band of 8 pixels) that the screen is
> + mapped to.
>
> Optional properties:
> - reset-active-low: Is the reset gpio is active on physical low?
> diff --git a/drivers/video/ssd1307fb.c b/drivers/video/ssd1307fb.c
> index 395cb6a..95f76e2 100644
> --- a/drivers/video/ssd1307fb.c
> +++ b/drivers/video/ssd1307fb.c
> @@ -16,24 +16,39 @@
> #include <linux/pwm.h>
> #include <linux/delay.h>
>
> -#define SSD1307FB_WIDTH 96
> -#define SSD1307FB_HEIGHT 16
> -
> #define SSD1307FB_DATA 0x40
> #define SSD1307FB_COMMAND 0x80
>
> #define SSD1307FB_CONTRAST 0x81
> +#define SSD1307FB_CHARGE_PUMP 0x8d
> #define SSD1307FB_SEG_REMAP_ON 0xa1
> #define SSD1307FB_DISPLAY_OFF 0xae
> +#define SSD1307FB_SET_MULTIPLEX_RATIO 0xa8
> #define SSD1307FB_DISPLAY_ON 0xaf
> #define SSD1307FB_START_PAGE_ADDRESS 0xb0
> +#define SSD1307FB_SET_DISPLAY_OFFSET 0xd3
> +#define SSD1307FB_SET_CLOCK_FREQ 0xd5
> +#define SSD1307FB_SET_PRECHARGE_PERIOD 0xd9
> +#define SSD1307FB_SET_COM_PINS_CONFIG 0xda
> +#define SSD1307FB_SET_VCOMH 0xdb
> +
> +struct ssd1307fb_par;
> +
> +struct ssd1307fb_ops {
> + int (*init)(struct ssd1307fb_par *);
> + int (*remove)(struct ssd1307fb_par *);
> +};
>
> struct ssd1307fb_par {
> struct i2c_client *client;
> + u32 height;
> struct fb_info *info;
> + struct ssd1307fb_ops *ops;
> + u32 page_offset;
> struct pwm_device *pwm;
> u32 pwm_period;
> int reset;
> + u32 width;
> };
>
> static struct fb_fix_screeninfo ssd1307fb_fix = {
> @@ -43,15 +58,10 @@ static struct fb_fix_screeninfo ssd1307fb_fix = {
> .xpanstep = 0,
> .ypanstep = 0,
> .ywrapstep = 0,
> - .line_length = SSD1307FB_WIDTH / 8,
> .accel = FB_ACCEL_NONE,
> };
>
> static struct fb_var_screeninfo ssd1307fb_var = {
> - .xres = SSD1307FB_WIDTH,
> - .yres = SSD1307FB_HEIGHT,
> - .xres_virtual = SSD1307FB_WIDTH,
> - .yres_virtual = SSD1307FB_HEIGHT,
> .bits_per_pixel = 1,
> };
>
> @@ -134,16 +144,16 @@ static void ssd1307fb_update_display(struct ssd1307fb_par *par)
> * (5) A4 B4 C4 D4 E4 F4 G4 H4
> */
>
> - for (i = 0; i < (SSD1307FB_HEIGHT / 8); i++) {
> - ssd1307fb_write_cmd(par->client, SSD1307FB_START_PAGE_ADDRESS + (i + 1));
> + for (i = 0; i < (par->height / 8); i++) {
> + ssd1307fb_write_cmd(par->client, SSD1307FB_START_PAGE_ADDRESS + i + par->page_offset);
> ssd1307fb_write_cmd(par->client, 0x00);
> ssd1307fb_write_cmd(par->client, 0x10);
>
> - for (j = 0; j < SSD1307FB_WIDTH; j++) {
> + for (j = 0; j < par->width; j++) {
> u8 buf = 0;
> for (k = 0; k < 8; k++) {
> - u32 page_length = SSD1307FB_WIDTH * i;
> - u32 index = page_length + (SSD1307FB_WIDTH * k + j) / 8;
> + u32 page_length = par->width * i;
> + u32 index = page_length + (par->width * k + j) / 8;
> u8 byte = *(vmem + index);
> u8 bit = byte & (1 << (j % 8));
> bit = bit >> (j % 8);
> @@ -227,16 +237,137 @@ static struct fb_deferred_io ssd1307fb_defio = {
> .deferred_io = ssd1307fb_deferred_io,
> };
>
> +static int ssd1307fb_ssd1307_init(struct ssd1307fb_par *par) {
> + int ret;
> +
> + par->pwm = pwm_get(&par->client->dev, NULL);
> + if (IS_ERR(par->pwm)) {
> + dev_err(&par->client->dev, "Could not get PWM from device tree!\n");
> + return PTR_ERR(par->pwm);
> + }
> +
> + par->pwm_period = pwm_get_period(par->pwm);
> + /* Enable the PWM */
> + pwm_config(par->pwm, par->pwm_period / 2, par->pwm_period);
> + pwm_enable(par->pwm);
> +
> + dev_dbg(&par->client->dev, "Using PWM%d with a %dns period.\n", par->pwm->pwm, par->pwm_period);
> +
> + /* Map column 127 of the OLED to segment 0 */
> + ret = ssd1307fb_write_cmd(par->client, SSD1307FB_SEG_REMAP_ON);
> + if (ret < 0)
> + return ret;
> +
> + /* Turn on the display */
> + ret = ssd1307fb_write_cmd(par->client, SSD1307FB_DISPLAY_ON);
> + if (ret < 0)
> + return ret;
> +
> + return 0;
> +}
> +
> +static int ssd1307fb_ssd1307_remove(struct ssd1307fb_par *par) {
> + pwm_disable(par->pwm);
> + pwm_put(par->pwm);
> + return 0;
> +}
> +
> +static struct ssd1307fb_ops ssd1307fb_ssd1307_ops = {
> + .init = ssd1307fb_ssd1307_init,
> + .remove = ssd1307fb_ssd1307_remove,
> +};
> +
> +static int ssd1307fb_ssd1306_init(struct ssd1307fb_par *par) {
> + int ret;
> +
> + /* Set initial contrast */
> + ret = ssd1307fb_write_cmd(par->client, SSD1307FB_CONTRAST);
> + ret = ret & ssd1307fb_write_cmd(par->client, 0x7f);
> + if (ret < 0)
> + return ret;
> +
> + /* Set COM direction */
> + ret = ssd1307fb_write_cmd(par->client, 0xc8);
> + if (ret < 0)
> + return ret;
> +
> + /* Set segment re-map */
> + ret = ssd1307fb_write_cmd(par->client, SSD1307FB_SEG_REMAP_ON);
> + if (ret < 0)
> + return ret;
> +
> + /* Set multiplex ratio value */
> + ret = ssd1307fb_write_cmd(par->client, SSD1307FB_SET_MULTIPLEX_RATIO);
> + ret = ret & ssd1307fb_write_cmd(par->client, par->height - 1);
> + if (ret < 0)
> + return ret;
> +
> + /* set display offset value */
> + ret = ssd1307fb_write_cmd(par->client, SSD1307FB_SET_DISPLAY_OFFSET);
> + ret = ssd1307fb_write_cmd(par->client, 0x20);
> + if (ret < 0)
> + return ret;
> +
> + /* Set clock frequency */
> + ret = ssd1307fb_write_cmd(par->client, SSD1307FB_SET_CLOCK_FREQ);
> + ret = ret & ssd1307fb_write_cmd(par->client, 0xf0);
> + if (ret < 0)
> + return ret;
> +
> + /* Set precharge period in number of ticks from the internal clock */
> + ret = ssd1307fb_write_cmd(par->client, SSD1307FB_SET_PRECHARGE_PERIOD);
> + ret = ret & ssd1307fb_write_cmd(par->client, 0x22);
> + if (ret < 0)
> + return ret;
> +
> + /* Set COM pins configuration */
> + ret = ssd1307fb_write_cmd(par->client, SSD1307FB_SET_COM_PINS_CONFIG);
> + ret = ret & ssd1307fb_write_cmd(par->client, 0x22);
> + if (ret < 0)
> + return ret;
> +
> + /* Set VCOMH */
> + ret = ssd1307fb_write_cmd(par->client, SSD1307FB_SET_VCOMH);
> + ret = ret & ssd1307fb_write_cmd(par->client, 0x49);
> + if (ret < 0)
> + return ret;
> +
> + /* Turn on the DC-DC Charge Pump */
> + ret = ssd1307fb_write_cmd(par->client, SSD1307FB_CHARGE_PUMP);
> + ret = ret & ssd1307fb_write_cmd(par->client, 0x14);
> + if (ret < 0)
> + return ret;
> +
> + /* Turn on the display */
> + ret = ssd1307fb_write_cmd(par->client, SSD1307FB_DISPLAY_ON);
> + if (ret < 0)
> + return ret;
> +
> + return 0;
> +}
> +
> +static struct ssd1307fb_ops ssd1307fb_ssd1306_ops = {
> + .init = ssd1307fb_ssd1306_init,
> +};
> +
> +static const struct of_device_id ssd1307fb_of_match[] = {
> + { .compatible = "solomon,ssd1306fb-i2c", .data = (void*)&ssd1307fb_ssd1306_ops },
> + { .compatible = "solomon,ssd1307fb-i2c", .data = (void*)&ssd1307fb_ssd1307_ops },
> + {},
> +};
> +MODULE_DEVICE_TABLE(of, ssd1307fb_of_match);
> +
> static int ssd1307fb_probe(struct i2c_client *client,
> const struct i2c_device_id *id)
> {
> struct fb_info *info;
> - u32 vmem_size = SSD1307FB_WIDTH * SSD1307FB_HEIGHT / 8;
> + struct device_node *node = client->dev.of_node;
> + u32 vmem_size;
> struct ssd1307fb_par *par;
> u8 *vmem;
> int ret;
>
> - if (!client->dev.of_node) {
> + if (!node) {
why this will be DT only?
a platform or ARN that does not support DT can not use this driver
this looks not right
> dev_err(&client->dev, "No device tree data found!\n");
> return -EINVAL;
> }
> @@ -247,6 +378,36 @@ static int ssd1307fb_probe(struct i2c_client *client,
> return -ENOMEM;
> }
>
> + par = info->par;
> + par->info = info;
> + par->client = client;
> +
> + par->ops = (struct ssd1307fb_ops*)of_match_device(ssd1307fb_of_match, &client->dev)->data;
> +
> + par->reset = of_get_named_gpio(client->dev.of_node,
> + "reset-gpios", 0);
> + if (!gpio_is_valid(par->reset)) {
> + ret = -EINVAL;
> + goto fb_alloc_error;
> + }
> +
> + if (of_property_read_u32(node, "solomon,width", &par->width))
> + par->width = 96;
> +
> + printk("Width\t%u\n", par->width);
> +
> + if (of_property_read_u32(node, "solomon,height", &par->height))
> + par->width = 16;
> +
> + printk("Height\t%u\n", par->height);
> +
> + if (of_property_read_u32(node, "solomon,page-offset", &par->page_offset))
> + par->page_offset = 1;
> +
> + printk("Offset\t%u\n", par->page_offset);
> +
> + vmem_size = par->width * par->height / 8;
> +
> vmem = devm_kzalloc(&client->dev, vmem_size, GFP_KERNEL);
> if (!vmem) {
> dev_err(&client->dev, "Couldn't allocate graphical memory.\n");
> @@ -256,9 +417,15 @@ static int ssd1307fb_probe(struct i2c_client *client,
>
> info->fbops = &ssd1307fb_ops;
> info->fix = ssd1307fb_fix;
> + info->fix.line_length = par->width / 8;
> info->fbdefio = &ssd1307fb_defio;
>
> info->var = ssd1307fb_var;
> + info->var.xres = par->width;
> + info->var.xres_virtual = par->width;
> + info->var.yres = par->height;
> + info->var.yres_virtual = par->height;
> +
> info->var.red.length = 1;
> info->var.red.offset = 0;
> info->var.green.length = 1;
> @@ -272,17 +439,6 @@ static int ssd1307fb_probe(struct i2c_client *client,
>
> fb_deferred_io_init(info);
>
> - par = info->par;
> - par->info = info;
> - par->client = client;
> -
> - par->reset = of_get_named_gpio(client->dev.of_node,
> - "reset-gpios", 0);
> - if (!gpio_is_valid(par->reset)) {
> - ret = -EINVAL;
> - goto reset_oled_error;
> - }
> -
> ret = devm_gpio_request_one(&client->dev, par->reset,
> GPIOF_OUT_INIT_HIGH,
> "oled-reset");
> @@ -293,23 +449,6 @@ static int ssd1307fb_probe(struct i2c_client *client,
> goto reset_oled_error;
> }
>
> - par->pwm = pwm_get(&client->dev, NULL);
> - if (IS_ERR(par->pwm)) {
> - dev_err(&client->dev, "Could not get PWM from device tree!\n");
> - ret = PTR_ERR(par->pwm);
> - goto pwm_error;
> - }
> -
> - par->pwm_period = pwm_get_period(par->pwm);
> -
> - dev_dbg(&client->dev, "Using PWM%d with a %dns period.\n", par->pwm->pwm, par->pwm_period);
> -
> - ret = register_framebuffer(info);
> - if (ret) {
> - dev_err(&client->dev, "Couldn't register the framebuffer\n");
> - goto fbreg_error;
> - }
> -
> i2c_set_clientdata(client, info);
>
> /* Reset the screen */
> @@ -318,34 +457,25 @@ static int ssd1307fb_probe(struct i2c_client *client,
> gpio_set_value(par->reset, 1);
> udelay(4);
>
> - /* Enable the PWM */
> - pwm_config(par->pwm, par->pwm_period / 2, par->pwm_period);
> - pwm_enable(par->pwm);
> -
> - /* Map column 127 of the OLED to segment 0 */
> - ret = ssd1307fb_write_cmd(client, SSD1307FB_SEG_REMAP_ON);
> - if (ret < 0) {
> - dev_err(&client->dev, "Couldn't remap the screen.\n");
> - goto remap_error;
> + if (par->ops->init) {
> + ret = par->ops->init(par);
> + if (ret)
> + goto reset_oled_error;
> }
>
> - /* Turn on the display */
> - ret = ssd1307fb_write_cmd(client, SSD1307FB_DISPLAY_ON);
> - if (ret < 0) {
> - dev_err(&client->dev, "Couldn't turn the display on.\n");
> - goto remap_error;
> + ret = register_framebuffer(info);
> + if (ret) {
> + dev_err(&client->dev, "Couldn't register the framebuffer\n");
> + goto panel_init_error;
> }
>
> dev_info(&client->dev, "fb%d: %s framebuffer device registered, using %d bytes of video memory\n", info->node, info->fix.id, vmem_size);
>
> return 0;
>
> -remap_error:
> - unregister_framebuffer(info);
> - pwm_disable(par->pwm);
> -fbreg_error:
> - pwm_put(par->pwm);
> -pwm_error:
> +panel_init_error:
> + if (par->ops->remove)
> + par->ops->remove(par);
> reset_oled_error:
> fb_deferred_io_cleanup(info);
> fb_alloc_error:
> @@ -359,8 +489,8 @@ static int ssd1307fb_remove(struct i2c_client *client)
> struct ssd1307fb_par *par = info->par;
>
> unregister_framebuffer(info);
> - pwm_disable(par->pwm);
> - pwm_put(par->pwm);
> + if (par->ops->remove)
> + par->ops->remove(par);
> fb_deferred_io_cleanup(info);
> framebuffer_release(info);
>
> @@ -368,17 +498,12 @@ static int ssd1307fb_remove(struct i2c_client *client)
> }
>
> static const struct i2c_device_id ssd1307fb_i2c_id[] = {
> + { "ssd1306fb", 0 },
> { "ssd1307fb", 0 },
> { }
> };
> MODULE_DEVICE_TABLE(i2c, ssd1307fb_i2c_id);
>
> -static const struct of_device_id ssd1307fb_of_match[] = {
> - { .compatible = "solomon,ssd1307fb-i2c" },
> - {},
> -};
> -MODULE_DEVICE_TABLE(of, ssd1307fb_of_match);
> -
> static struct i2c_driver ssd1307fb_driver = {
> .probe = ssd1307fb_probe,
> .remove = ssd1307fb_remove,
> --
> 1.7.10.4
>
> _______________________________________________
> devicetree-discuss mailing list
> devicetree-discuss@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/devicetree-discuss
^ permalink raw reply
* Re: [PATCH 0/5] video: vt8500 patches for 3.10
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-03-29 18:44 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1364021193-19835-1-git-send-email-linux@prisktech.co.nz>
On 19:46 Sat 23 Mar , Tony Prisk wrote:
> Hi Florian,
>
> These patches were posted for 3.9, but I didn't recieve any reply back at the
> time. Reposting for 3.10 - based on 3.9-rc2
>
> Regards
> Tony P
look ok
Best Regards,
J.
>
> Julia Lawall (1):
> drivers/video/wm8505fb.c: use devm_ functions
>
> Tony Prisk (4):
> video: vt8500: Make wmt_ge_rops optional
> video: vt8500: Remove unused platform_data/video-vt8500lcdfb.h
> video: vt8500: Correct descriptions in video/Kconfig
> video: vt8500: Adjust contrast in wm8505 framebuffer driver.
>
> drivers/video/Kconfig | 31 ++++----
> drivers/video/vt8500lcdfb.c | 17 +++-
> drivers/video/wm8505fb.c | 96 ++++++++---------------
> include/linux/platform_data/video-vt8500lcdfb.h | 31 --------
> 4 files changed, 66 insertions(+), 109 deletions(-)
> delete mode 100644 include/linux/platform_data/video-vt8500lcdfb.h
>
> --
> 1.7.9.5
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
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