* [PATCH] sh: clkfwk: sh_clk_init_parent() should be called after clk_register()
From: Kuninori Morimoto @ 2011-12-12 3:02 UTC (permalink / raw)
To: linux-sh
sh_clk_init_parent() are using clk->mapped_reg
which is mapped in clk_register()
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
This is for latest paul/common/clkfwk
drivers/sh/clk/cpg.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/sh/clk/cpg.c b/drivers/sh/clk/cpg.c
index a0d8faa..45fee36 100644
--- a/drivers/sh/clk/cpg.c
+++ b/drivers/sh/clk/cpg.c
@@ -222,11 +222,11 @@ static int __init sh_clk_div6_register_ops(struct clk *clks, int nr,
clkp->ops = ops;
clkp->freq_table = freq_table + (k * freq_table_size);
clkp->freq_table[nr_divs].frequency = CPUFREQ_TABLE_END;
- ret = sh_clk_init_parent(clkp);
+ ret = clk_register(clkp);
if (ret < 0)
break;
- ret = clk_register(clkp);
+ ret = sh_clk_init_parent(clkp);
}
return ret;
--
1.7.5.4
^ permalink raw reply related
* [NEXT] mach-shmobile and sh compilation broken
From: Guennadi Liakhovetski @ 2011-12-12 8:18 UTC (permalink / raw)
To: linux-sh
Hi all
Current next fails to compile for mach-shmobile:
arch/arm/include/asm/pgtable.h:47: warning: #warning "SH-Mobile's consistent DMA size conflicts with VMALLOC_END by 144MB"
In file included from /opt/src/linux-2.6/arch/arm/kernel/process.c:64:
arch/arm/mach-shmobile/include/mach/system.h:9: error: #error Fix me up
make[2]: *** [arch/arm/kernel/process.o] Error 1
(the first line is an unrelated warning, it's actually repeated multiple
times throughout compilation), and arch/sh:
mm/pgtable-generic.c: In function 'pmdp_clear_flush_young':
mm/pgtable-generic.c:76: error: call to '__build_bug_failed' declared with attribute error: BUILD_BUG failed
make[2]: *** [mm/pgtable-generic.o] Error 1
The latter has been there since a few days already, possibly longer than
a week.
Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
^ permalink raw reply
* Re: [PATCH (sh-2.6)] sh: do not export syscalls that are actually
From: Carmelo AMOROSO @ 2011-12-12 10:58 UTC (permalink / raw)
To: linux-sh
In-Reply-To: <1322685809-15587-1-git-send-email-carmelo.amoroso@st.com>
On 30/11/2011 21.56, Mike Frysinger wrote:
> On Wednesday 30 November 2011 15:43:29 Carmelo AMOROSO wrote:
>> Avoid user space to erroneously assume that a syscall is
>> implemented by picking __NR_xxx from kernel headers that are
>> actually mapped to sys_ni_syscall.
>
> Acked-by: Mike Frysinger <vapier@gentoo.org> -mike
Paul,
anu chance to include it ? to avoid any doubts, patch was done against
HEAD, the subject sh-2.6 was due to a old git setting.
cheers,
carmelo
^ permalink raw reply
* Xmas Lening Aanbieding
From: Joseph Evans @ 2011-12-12 13:12 UTC (permalink / raw)
Wir sind auf dem XAMS Kredit Angebot mit so viel Bonus, bitte
kontaktieren Sie mich, wenn Sie tun müssen, jede Form von Darlehen von
unserer Firma.
Grüße
We are on our xams loan special offer with so much bonus, please do
contact me if you do need any form of loan from our firm.
Regards
^ permalink raw reply
* Re: [RFC][PATCH 4/4] PM / input / touchscreen: Make st1232 use device
From: Guennadi Liakhovetski @ 2011-12-12 14:34 UTC (permalink / raw)
To: Rafael J. Wysocki; +Cc: Linux-sh list, Linux PM list, Magnus Damm, LKML
In-Reply-To: <201112100046.32206.rjw@sisk.pl>
Hi Rafael
On Sat, 10 Dec 2011, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rjw@sisk.pl>
>
> Make the st1232 driver use dev_pm_qos_add_ancestor_request() to
> add a device PM QoS latency constraint for the I2C controller it
> depends on, so that the controller won't go into an overly deep
> low-power state when the touchscreen has to be particularly
> responsive (e.g. when the user moves his or her finger on it)
> and allow the A4R domain to be turned off if that doesn't violate
> the PM QoS latency constraints.
>
> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
> ---
> arch/arm/mach-shmobile/pm-sh7372.c | 28 +++++++++++++++++++++++++++-
> drivers/input/touchscreen/st1232.c | 14 +++++++++++++-
I don't think you wanted to put these two files in one patch.
> 2 files changed, 40 insertions(+), 2 deletions(-)
>
> Index: linux/arch/arm/mach-shmobile/pm-sh7372.c
> =================================> --- linux.orig/arch/arm/mach-shmobile/pm-sh7372.c
> +++ linux/arch/arm/mach-shmobile/pm-sh7372.c
[snip]
> Index: linux/drivers/input/touchscreen/st1232.c
> =================================> --- linux.orig/drivers/input/touchscreen/st1232.c
> +++ linux/drivers/input/touchscreen/st1232.c
After you have separated this file, you might as well notice, that it is
almost identical to my version, that we discussed privately previously.
Your changes include:
> @@ -25,6 +25,7 @@
> #include <linux/module.h>
> #include <linux/slab.h>
> #include <linux/types.h>
> +#include <linux/pm_qos.h>
in my version I preserved the alphabetic order of include files, you break
it
>
> #define ST1232_TS_NAME "st1232-ts"
>
> @@ -46,6 +47,8 @@ struct st1232_ts_data {
> struct i2c_client *client;
> struct input_dev *input_dev;
> struct st1232_ts_finger finger[MAX_FINGERS];
> + struct dev_pm_qos_request low_latency_req;
> + bool pen_down;
> };
>
> static int st1232_ts_read_data(struct st1232_ts_data *ts)
> @@ -118,8 +121,17 @@ static irqreturn_t st1232_ts_irq_handler
> }
>
> /* SYN_MT_REPORT only if no contact */
> - if (!count)
> + if (!count) {
> input_mt_sync(input_dev);
> + if (ts->pen_down) {
> + dev_pm_qos_remove_request(&ts->low_latency_req);
> + ts->pen_down = false;
> + }
> + } else if (!ts->pen_down) {
> + /* First contact, request 100 mcs latency. */
> + dev_pm_qos_add_ancestor_request(&ts->client->dev,
> + &ts->low_latency_req, 100);
in my version I also was actually setting pen_down to true, which you seem
to have dropped, so, your version just wouldn't work. Of course, I wasn't
using the "ancestor" version of the above call, because it didn't exist
back then.
You also removed my debugging, which is, of course, correct - thanks for
doing that.
Given the above, I would appreciate it, if you split this patch into two
and make the st1232 part of it
From: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
after which you can add your
[rjw@sisk.pl: use dev_pm_qos_add_ancestor_request() to reach the correct ancestor]
and your Sob.
Thanks
Guennadi
> + }
>
> /* SYN_REPORT */
> input_sync(input_dev);
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
^ permalink raw reply
* [PATCH/RFC] mmc: add a device PM QoS constraint when a host is first
From: Guennadi Liakhovetski @ 2011-12-12 15:46 UTC (permalink / raw)
To: linux-mmc; +Cc: linux-pm, Chris Ball, linux-sh, Rafael J. Wysocki
Some MMC hosts implement a fine-grained runtime PM, whereby they
runtime-suspend and -resume the host interface on each transfer. This can
negatively affect performance, if the user was trying to transfer data
blocks back-to-back. This patch adds a PM QoS constraint to avoid such a
throughput reduction. This constraint prevents runtime-suspending the
device, if the expected wakeup latency is larger than 100us.
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
---
This patch has been tested on SuperH and ARM sh-mobile hosts with
sh_mobile_sdhi and sh_mmcif drivers. Would be good to also have it tested
on other platforms, enabling PM QoS, e.g., those, using the simple QoS
PM domain governor.
drivers/mmc/core/core.c | 16 +++++++++++++++-
include/linux/mmc/host.h | 2 ++
2 files changed, 17 insertions(+), 1 deletions(-)
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index b27b940..40f666f 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -22,6 +22,7 @@
#include <linux/scatterlist.h>
#include <linux/log2.h>
#include <linux/regulator/consumer.h>
+#include <linux/pm_domain.h>
#include <linux/pm_runtime.h>
#include <linux/suspend.h>
@@ -589,8 +590,16 @@ int __mmc_claim_host(struct mmc_host *host, atomic_t *abort)
wake_up(&host->wq);
spin_unlock_irqrestore(&host->lock, flags);
remove_wait_queue(&host->wq, &wait);
- if (!stop)
+ if (!stop) {
+ if (host->claim_cnt = 1) {
+ int ret = dev_pm_qos_add_request(host->parent,
+ &host->pm_qos, 100);
+ if (ret < 0)
+ dev_err(host->parent,
+ "PM QoS request failed: %d\n", ret);
+ }
mmc_host_enable(host);
+ }
return stop;
}
@@ -615,6 +624,10 @@ int mmc_try_claim_host(struct mmc_host *host)
claimed_host = 1;
}
spin_unlock_irqrestore(&host->lock, flags);
+
+ if (claimed_host && host->claim_cnt = 1)
+ dev_pm_qos_add_request(host->parent, &host->pm_qos, 100);
+
return claimed_host;
}
EXPORT_SYMBOL(mmc_try_claim_host);
@@ -639,6 +652,7 @@ void mmc_do_release_host(struct mmc_host *host)
host->claimer = NULL;
spin_unlock_irqrestore(&host->lock, flags);
wake_up(&host->wq);
+ dev_pm_qos_remove_request(&host->pm_qos);
}
}
EXPORT_SYMBOL(mmc_do_release_host);
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 1d09562..3e9d2f3 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -11,6 +11,7 @@
#define LINUX_MMC_HOST_H
#include <linux/leds.h>
+#include <linux/pm_qos.h>
#include <linux/sched.h>
#include <linux/mmc/core.h>
@@ -175,6 +176,7 @@ struct mmc_host {
u32 ocr_avail_sd; /* SD-specific OCR */
u32 ocr_avail_mmc; /* MMC-specific OCR */
struct notifier_block pm_notify;
+ struct dev_pm_qos_request pm_qos;
#define MMC_VDD_165_195 0x00000080 /* VDD voltage 1.65 - 1.95 */
#define MMC_VDD_20_21 0x00000100 /* VDD voltage 2.0 ~ 2.1 */
--
1.7.2.5
^ permalink raw reply related
* Re: [PATCH] sh: clkfwk: sh_clk_init_parent() should be called after clk_register()
From: Paul Mundt @ 2011-12-13 2:21 UTC (permalink / raw)
To: linux-sh
In-Reply-To: <877h22h4r5.wl%kuninori.morimoto.gx@renesas.com>
On Sun, Dec 11, 2011 at 07:02:09PM -0800, Kuninori Morimoto wrote:
> sh_clk_init_parent() are using clk->mapped_reg
> which is mapped in clk_register()
>
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Applied, thanks.
^ permalink raw reply
* Re: [PATCH (sh-2.6)] sh: do not export syscalls that are actually not implemented
From: Paul Mundt @ 2011-12-13 2:22 UTC (permalink / raw)
To: linux-sh
In-Reply-To: <1322685809-15587-1-git-send-email-carmelo.amoroso@st.com>
On Mon, Dec 12, 2011 at 11:58:39AM +0100, Carmelo AMOROSO wrote:
> On 30/11/2011 21.56, Mike Frysinger wrote:
> > On Wednesday 30 November 2011 15:43:29 Carmelo AMOROSO wrote:
> >> Avoid user space to erroneously assume that a syscall is
> >> implemented by picking __NR_xxx from kernel headers that are
> >> actually mapped to sys_ni_syscall.
> >
> > Acked-by: Mike Frysinger <vapier@gentoo.org> -mike
>
> Paul,
> anu chance to include it ? to avoid any doubts, patch was done against
> HEAD, the subject sh-2.6 was due to a old git setting.
>
It's on my review list, just haven't had a chance to go through it yet.
^ permalink raw reply
* [PATCH] ARM: mach-shmobile: fix AP4EVB A3SP domain PM
From: Guennadi Liakhovetski @ 2011-12-13 11:09 UTC (permalink / raw)
To: linux-sh
On SH7372 it is important to stop MSTP clock of all registered USB host
devices. Otherwise powering down the A3SP domain will become impossible:
the domain-specific bit in SPDCR will remain set. Subsequently, any attempt
to power down any further domains will fail in the same way. To fix this
problem the USB1 host device has to be added to the A3SP domain on AP4EVB,
similarly as it is done on mackerel.
While not that critical, this patch also adds the HDMI device to the A4LC
domain.
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
---
arch/arm/mach-shmobile/board-ap4evb.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c
index 7e90d06..15a210a 100644
--- a/arch/arm/mach-shmobile/board-ap4evb.c
+++ b/arch/arm/mach-shmobile/board-ap4evb.c
@@ -1412,6 +1412,8 @@ static void __init ap4evb_init(void)
sh7372_add_device_to_domain(&sh7372_a3sp, &sh_mmcif_device);
sh7372_add_device_to_domain(&sh7372_a3sp, &sdhi0_device);
sh7372_add_device_to_domain(&sh7372_a3sp, &sdhi1_device);
+ sh7372_add_device_to_domain(&sh7372_a3sp, &usb1_host_device);
+ sh7372_add_device_to_domain(&sh7372_a4lc, &hdmi_device);
sh7372_add_device_to_domain(&sh7372_a4r, &ceu_device);
hdmi_init_pm_clock();
--
1.7.2.5
^ permalink raw reply related
* [PATCH 00/57] SH Mobile LCDC: rework DSI/HDMI interface and add overlays support
From: Laurent Pinchart @ 2011-12-13 14:01 UTC (permalink / raw)
To: linux-fbdev
Hi everybody,
First of all, sorry for the patch bomb. I usually try to send smaller patch
sets by splitting them into coherent subsets, but getting the code in a proper
shape took time and required several iterations of the whole set.
These patches can be divided in 4 groups.
- Patches 01 to 29 rework the interface between the LCDC and MIPI/DSI and HDMI
drivers. The MIPI/DSI and HDMI drivers are now FB-agnostic, except for the
usage of the fb_videomode structure used to pass video mode information to
the LCDC driver.
- Patches 30 to 38 perform additional cleanup to the LCDC driver made possible
by the previous patches.
- Patches 39 to 54 rework the MERAM driver to allocate ICBs and MERAM regions
automatically instead of relying on manually allocated regions specified in
platform data. They're a first step in the longer term goal of making MERAM
usable for other purpose than LCDC cache.
- Patches 55 to 57 add overlays support to the LCDC driver. They should be
considered as a prototype implementation for now. I plan to rework them, but
early feedback is always appreciated.
I would like to push patches 01 to 54 (after review of course) to v3.4 (or
v3.3 if time and review permits).
Laurent Pinchart (57):
fbdev: sh_mobile_lcdc: Reorder code into sections
fbdev: sh_mobile_lcdc: Mark init-only symbols with __devinit(const)
fbdev: sh_mobile_lcdc: Move pm runtime enable to probe()
fbdev: sh_mobile_lcdc: Don't pass struct device around
fbdev: sh_mobile_lcdc: Create functions to turn the display on/off
fbdev: sh_mobile_hdmi: Don't access LCDC channel in notifier callback
sh_mobile_hdmi: Remove platform data lcd_dev field
fbdev: sh_mobile_lcdc: Add sh_mobile_lcdc_entity definition
fbdev: sh_mobile_hdmi: Implement sh_mobile_lcdc_entity interface
fbdev: sh_mipi_dsi: Implement sh_mobile_lcdc_entity interface
fbdev: sh_mobile_lcdc: Handle HDMI/MIPI transmitter device directly
arm: mach-shmobile: Add LCDC tx_dev field to platform data
fbdev: sh_mipi_dsi: Don't hook up into board_cfg display operations
fbdev: sh_mobile_hdmi: Don't hook up into board_cfg display
operations
arm: mach-shmobile: Don't initialize the hdmi_info lcd_chan field
fbdev: sh_mobile_hdmi: Remove sh_mobile_hdmi_info lcd_chan field
fbdev: sh_mobile_lcdc: Remove board configuration owner field
fbdev: sh_mobile_lcdc: Remove board configuration board_data field
fbdev: sh_mobile_lcdc: Move brightness ops to sh_mobile_lcdc_bl_info
fbdev: sh_mobile_lcdc: Merge board_cfg and lcd_size_cfg into
panel_cfg
sh_mobile_lcdc: Add an lcdc channel pointer to sh_mobile_lcdc_entity
sh_mobile_hdmi: Use sh_mobile_lcdc_entity::channel to access fb_info
fbdev: sh_mobile_lcdc: Remove fb_info parameter to display_on
operation
fbdev: sh_mobile_lcdc: Return display connection state in display_on
sh_mobile_lcdc: Add display notify callback to sh_mobile_lcdc_chan
sh_mobile_hdmi: Use LCDC notification callback
fbdev: sh_mobile_lcdc: Pass a video mode to the notify callback
fbdev: sh_mobile_hdmi: Don't set sh_hdmi::mode in the display on
handler
fbdev: sh_mobile_hdmi: Don't access LCDC fb_info
fbdev: sh_mobile_lcdc: Store display mode in a struct fb_videomode
fbdev: sh_mobile_lcdc: Rename (lcd|num)_cfg (lcd|num)_modes
fbdev: sh_mobile_lcdc: Reorganize the sh_mobile_lcdc_chan structure
fbdev: sh_mobile_lcdc: Add sh_mobile_format_info() function
fbdev: sh_mobile_lcdc: Store the format in struct sh_mobile_lcdc_chan
fbdev: sh_mobile_lcdc: Split fb init/cleanup from channel
init/cleanup
fbdev: sh_mobile_lcdc: Pass physical device pointer to DMA functions
fbdev: sh_mobile_lcdc: Store configuration in channel structure
fbdev: sh_mobile_lcdc: Pass channel pointer to
sh_mobile_wait_for_vsync
arm: mach-shmobile: Split MERAM resources into regs and meram
fbdev: sh_mobile_meram: Request memory regions for memory resources
fbdev: sh_mobile_meram: Add _cfg suffix to struct sh_mobile_meram_icb
fbdev: sh_mobile_meram: Make variables unsigned where applicable
fbdev: sh_mobile_meram: Make current_reg field store the current reg
set
fbdev: sh_mobile_meram: Add struct sh_mobile_meram_icb
fbdev: sh_mobile_meram: Don't inline everything
fbdev: sh_mobile_meram: Divide the code into sections
fbdev: sh_mobile_meram: Use genalloc to manage MERAM allocation
fbdev: sh_mobile_meram: Allocate ICBs automatically
arm: mach-shmobile: Don't set MERAM ICB numbers in platform data
fbdev: sh_mobile_meram: Remove unused sh_mobile_meram_icb_cfg fields
fbdev: sh_mobile_lcdc: Don't store copy of platform data
arm: mach-shmobile: Constify sh_mobile_meram_cfg structures
fbdev: sh_mobile_meram: Don't perform update in register operation
fbdev: sh_mobile_meram: Remove unneeded sanity checks
fbdev: sh_mobile_lcdc: Constify sh_mobile_lcdc_fix structure
fbdev: sh_mobile_lcdc: Rename fb operation handlers with a common
prefix
fbdev: sh_mobile_lcdc: Implement overlays support
arch/arm/mach-shmobile/board-ag5evm.c | 24 +-
arch/arm/mach-shmobile/board-ap4evb.c | 289 ++--
arch/arm/mach-shmobile/board-mackerel.c | 106 +-
arch/sh/boards/mach-ap325rxa/setup.c | 22 +-
arch/sh/boards/mach-ecovec24/setup.c | 20 +-
arch/sh/boards/mach-kfr2r09/lcd_wqvga.c | 10 +-
arch/sh/boards/mach-kfr2r09/setup.c | 8 +-
arch/sh/boards/mach-migor/lcd_qvga.c | 3 +-
arch/sh/boards/mach-migor/setup.c | 16 +-
arch/sh/boards/mach-se/7724/setup.c | 12 +-
arch/sh/include/mach-kfr2r09/mach/kfr2r09.h | 16 +-
arch/sh/include/mach-migor/mach/migor.h | 2 +-
drivers/video/Kconfig | 1 +
drivers/video/sh_mipi_dsi.c | 97 +-
drivers/video/sh_mobile_hdmi.c | 297 +---
drivers/video/sh_mobile_lcdcfb.c | 2357 +++++++++++++++++++--------
drivers/video/sh_mobile_lcdcfb.h | 84 +-
drivers/video/sh_mobile_meram.c | 673 ++++----
include/video/sh_mobile_hdmi.h | 2 -
include/video/sh_mobile_lcdc.h | 42 +-
include/video/sh_mobile_meram.h | 40 +-
21 files changed, 2518 insertions(+), 1603 deletions(-)
--
Regards,
Laurent Pinchart
^ permalink raw reply
* [PATCH 01/57] fbdev: sh_mobile_lcdc: Reorder code into sections
From: Laurent Pinchart @ 2011-12-13 14:01 UTC (permalink / raw)
To: linux-fbdev
Make the driver more readable by reordering code and splitting it into
logical sections. Reorder the headers alphabetically.
No modification to the code have been performed.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
drivers/video/sh_mobile_lcdcfb.c | 421 +++++++++++++++++++++-----------------
1 files changed, 231 insertions(+), 190 deletions(-)
diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
index aac5b36..8b18360 100644
--- a/drivers/video/sh_mobile_lcdcfb.c
+++ b/drivers/video/sh_mobile_lcdcfb.c
@@ -8,26 +8,27 @@
* for more details.
*/
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/delay.h>
-#include <linux/mm.h>
+#include <linux/atomic.h>
+#include <linux/backlight.h>
#include <linux/clk.h>
-#include <linux/pm_runtime.h>
-#include <linux/platform_device.h>
+#include <linux/console.h>
#include <linux/dma-mapping.h>
+#include <linux/delay.h>
+#include <linux/gpio.h>
+#include <linux/init.h>
#include <linux/interrupt.h>
-#include <linux/videodev2.h>
-#include <linux/vmalloc.h>
#include <linux/ioctl.h>
-#include <linux/slab.h>
-#include <linux/console.h>
-#include <linux/backlight.h>
-#include <linux/gpio.h>
+#include <linux/kernel.h>
+#include <linux/mm.h>
#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
+#include <linux/slab.h>
+#include <linux/videodev2.h>
+#include <linux/vmalloc.h>
+
#include <video/sh_mobile_lcdc.h>
#include <video/sh_mobile_meram.h>
-#include <linux/atomic.h>
#include "sh_mobile_lcdcfb.h"
@@ -37,6 +38,24 @@
#define MAX_XRES 1920
#define MAX_YRES 1080
+struct sh_mobile_lcdc_priv {
+ void __iomem *base;
+ int irq;
+ atomic_t hw_usecnt;
+ struct device *dev;
+ struct clk *dot_clk;
+ unsigned long lddckr;
+ struct sh_mobile_lcdc_chan ch[2];
+ struct notifier_block notifier;
+ int started;
+ int forced_fourcc; /* 2 channel LCDC must share fourcc setting */
+ struct sh_mobile_meram_info *meram_dev;
+};
+
+/* -----------------------------------------------------------------------------
+ * Registers access
+ */
+
static unsigned long lcdc_offs_mainlcd[NR_CH_REGS] = {
[LDDCKPAT1R] = 0x400,
[LDDCKPAT2R] = 0x404,
@@ -75,38 +94,6 @@ static unsigned long lcdc_offs_sublcd[NR_CH_REGS] = {
[LDPMR] = 0x63c,
};
-static const struct fb_videomode default_720p = {
- .name = "HDMI 720p",
- .xres = 1280,
- .yres = 720,
-
- .left_margin = 220,
- .right_margin = 110,
- .hsync_len = 40,
-
- .upper_margin = 20,
- .lower_margin = 5,
- .vsync_len = 5,
-
- .pixclock = 13468,
- .refresh = 60,
- .sync = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT,
-};
-
-struct sh_mobile_lcdc_priv {
- void __iomem *base;
- int irq;
- atomic_t hw_usecnt;
- struct device *dev;
- struct clk *dot_clk;
- unsigned long lddckr;
- struct sh_mobile_lcdc_chan ch[2];
- struct notifier_block notifier;
- int started;
- int forced_fourcc; /* 2 channel LCDC must share fourcc setting */
- struct sh_mobile_meram_info *meram_dev;
-};
-
static bool banked(int reg_nr)
{
switch (reg_nr) {
@@ -127,6 +114,11 @@ static bool banked(int reg_nr)
return false;
}
+static int lcdc_chan_is_sublcd(struct sh_mobile_lcdc_chan *chan)
+{
+ return chan->cfg.chan = LCDC_CHAN_SUBLCD;
+}
+
static void lcdc_write_chan(struct sh_mobile_lcdc_chan *chan,
int reg_nr, unsigned long data)
{
@@ -169,11 +161,77 @@ static void lcdc_wait_bit(struct sh_mobile_lcdc_priv *priv,
cpu_relax();
}
-static int lcdc_chan_is_sublcd(struct sh_mobile_lcdc_chan *chan)
+/* -----------------------------------------------------------------------------
+ * Clock management
+ */
+
+static void sh_mobile_lcdc_clk_on(struct sh_mobile_lcdc_priv *priv)
{
- return chan->cfg.chan = LCDC_CHAN_SUBLCD;
+ if (atomic_inc_and_test(&priv->hw_usecnt)) {
+ if (priv->dot_clk)
+ clk_enable(priv->dot_clk);
+ pm_runtime_get_sync(priv->dev);
+ if (priv->meram_dev && priv->meram_dev->pdev)
+ pm_runtime_get_sync(&priv->meram_dev->pdev->dev);
+ }
}
+static void sh_mobile_lcdc_clk_off(struct sh_mobile_lcdc_priv *priv)
+{
+ if (atomic_sub_return(1, &priv->hw_usecnt) = -1) {
+ if (priv->meram_dev && priv->meram_dev->pdev)
+ pm_runtime_put_sync(&priv->meram_dev->pdev->dev);
+ pm_runtime_put(priv->dev);
+ if (priv->dot_clk)
+ clk_disable(priv->dot_clk);
+ }
+}
+
+static int sh_mobile_lcdc_setup_clocks(struct platform_device *pdev,
+ int clock_source,
+ struct sh_mobile_lcdc_priv *priv)
+{
+ char *str;
+
+ switch (clock_source) {
+ case LCDC_CLK_BUS:
+ str = "bus_clk";
+ priv->lddckr = LDDCKR_ICKSEL_BUS;
+ break;
+ case LCDC_CLK_PERIPHERAL:
+ str = "peripheral_clk";
+ priv->lddckr = LDDCKR_ICKSEL_MIPI;
+ break;
+ case LCDC_CLK_EXTERNAL:
+ str = NULL;
+ priv->lddckr = LDDCKR_ICKSEL_HDMI;
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ if (str) {
+ priv->dot_clk = clk_get(&pdev->dev, str);
+ if (IS_ERR(priv->dot_clk)) {
+ dev_err(&pdev->dev, "cannot get dot clock %s\n", str);
+ return PTR_ERR(priv->dot_clk);
+ }
+ }
+
+ /* Runtime PM support involves two step for this driver:
+ * 1) Enable Runtime PM
+ * 2) Force Runtime PM Resume since hardware is accessed from probe()
+ */
+ priv->dev = &pdev->dev;
+ pm_runtime_enable(priv->dev);
+ pm_runtime_resume(priv->dev);
+ return 0;
+}
+
+/* -----------------------------------------------------------------------------
+ * Sys panel and deferred I/O
+ */
+
static void lcdc_sys_write_index(void *handle, unsigned long data)
{
struct sh_mobile_lcdc_chan *ch = handle;
@@ -216,69 +274,6 @@ struct sh_mobile_lcdc_sys_bus_ops sh_mobile_lcdc_sys_bus_ops = {
lcdc_sys_read_data,
};
-static int sh_mobile_format_fourcc(const struct fb_var_screeninfo *var)
-{
- if (var->grayscale > 1)
- return var->grayscale;
-
- switch (var->bits_per_pixel) {
- case 16:
- return V4L2_PIX_FMT_RGB565;
- case 24:
- return V4L2_PIX_FMT_BGR24;
- case 32:
- return V4L2_PIX_FMT_BGR32;
- default:
- return 0;
- }
-}
-
-static int sh_mobile_format_is_fourcc(const struct fb_var_screeninfo *var)
-{
- return var->grayscale > 1;
-}
-
-static bool sh_mobile_format_is_yuv(const struct fb_var_screeninfo *var)
-{
- if (var->grayscale <= 1)
- return false;
-
- switch (var->grayscale) {
- case V4L2_PIX_FMT_NV12:
- case V4L2_PIX_FMT_NV21:
- case V4L2_PIX_FMT_NV16:
- case V4L2_PIX_FMT_NV61:
- case V4L2_PIX_FMT_NV24:
- case V4L2_PIX_FMT_NV42:
- return true;
-
- default:
- return false;
- }
-}
-
-static void sh_mobile_lcdc_clk_on(struct sh_mobile_lcdc_priv *priv)
-{
- if (atomic_inc_and_test(&priv->hw_usecnt)) {
- if (priv->dot_clk)
- clk_enable(priv->dot_clk);
- pm_runtime_get_sync(priv->dev);
- if (priv->meram_dev && priv->meram_dev->pdev)
- pm_runtime_get_sync(&priv->meram_dev->pdev->dev);
- }
-}
-
-static void sh_mobile_lcdc_clk_off(struct sh_mobile_lcdc_priv *priv)
-{
- if (atomic_sub_return(1, &priv->hw_usecnt) = -1) {
- if (priv->meram_dev && priv->meram_dev->pdev)
- pm_runtime_put_sync(&priv->meram_dev->pdev->dev);
- pm_runtime_put(priv->dev);
- if (priv->dot_clk)
- clk_disable(priv->dot_clk);
- }
-}
-
static int sh_mobile_lcdc_sginit(struct fb_info *info,
struct list_head *pagelist)
{
@@ -345,6 +340,55 @@ static void sh_mobile_lcdc_deferred_io_touch(struct fb_info *info)
schedule_delayed_work(&info->deferred_work, fbdefio->delay);
}
+/* -----------------------------------------------------------------------------
+ * Format helpers
+ */
+
+static int sh_mobile_format_fourcc(const struct fb_var_screeninfo *var)
+{
+ if (var->grayscale > 1)
+ return var->grayscale;
+
+ switch (var->bits_per_pixel) {
+ case 16:
+ return V4L2_PIX_FMT_RGB565;
+ case 24:
+ return V4L2_PIX_FMT_BGR24;
+ case 32:
+ return V4L2_PIX_FMT_BGR32;
+ default:
+ return 0;
+ }
+}
+
+static int sh_mobile_format_is_fourcc(const struct fb_var_screeninfo *var)
+{
+ return var->grayscale > 1;
+}
+
+static bool sh_mobile_format_is_yuv(const struct fb_var_screeninfo *var)
+{
+ if (var->grayscale <= 1)
+ return false;
+
+ switch (var->grayscale) {
+ case V4L2_PIX_FMT_NV12:
+ case V4L2_PIX_FMT_NV21:
+ case V4L2_PIX_FMT_NV16:
+ case V4L2_PIX_FMT_NV61:
+ case V4L2_PIX_FMT_NV24:
+ case V4L2_PIX_FMT_NV42:
+ return true;
+
+ default:
+ return false;
+ }
+}
+
+/* -----------------------------------------------------------------------------
+ * Start, stop and IRQ
+ */
+
static irqreturn_t sh_mobile_lcdc_irq(int irq, void *data)
{
struct sh_mobile_lcdc_priv *priv = data;
@@ -790,86 +834,9 @@ static void sh_mobile_lcdc_stop(struct sh_mobile_lcdc_priv *priv)
sh_mobile_lcdc_clk_off(priv);
}
-static int sh_mobile_lcdc_check_interface(struct sh_mobile_lcdc_chan *ch)
-{
- int interface_type = ch->cfg.interface_type;
-
- switch (interface_type) {
- case RGB8:
- case RGB9:
- case RGB12A:
- case RGB12B:
- case RGB16:
- case RGB18:
- case RGB24:
- case SYS8A:
- case SYS8B:
- case SYS8C:
- case SYS8D:
- case SYS9:
- case SYS12:
- case SYS16A:
- case SYS16B:
- case SYS16C:
- case SYS18:
- case SYS24:
- break;
- default:
- return -EINVAL;
- }
-
- /* SUBLCD only supports SYS interface */
- if (lcdc_chan_is_sublcd(ch)) {
- if (!(interface_type & LDMT1R_IFM))
- return -EINVAL;
-
- interface_type &= ~LDMT1R_IFM;
- }
-
- ch->ldmt1r_value = interface_type;
- return 0;
-}
-
-static int sh_mobile_lcdc_setup_clocks(struct platform_device *pdev,
- int clock_source,
- struct sh_mobile_lcdc_priv *priv)
-{
- char *str;
-
- switch (clock_source) {
- case LCDC_CLK_BUS:
- str = "bus_clk";
- priv->lddckr = LDDCKR_ICKSEL_BUS;
- break;
- case LCDC_CLK_PERIPHERAL:
- str = "peripheral_clk";
- priv->lddckr = LDDCKR_ICKSEL_MIPI;
- break;
- case LCDC_CLK_EXTERNAL:
- str = NULL;
- priv->lddckr = LDDCKR_ICKSEL_HDMI;
- break;
- default:
- return -EINVAL;
- }
-
- if (str) {
- priv->dot_clk = clk_get(&pdev->dev, str);
- if (IS_ERR(priv->dot_clk)) {
- dev_err(&pdev->dev, "cannot get dot clock %s\n", str);
- return PTR_ERR(priv->dot_clk);
- }
- }
-
- /* Runtime PM support involves two step for this driver:
- * 1) Enable Runtime PM
- * 2) Force Runtime PM Resume since hardware is accessed from probe()
- */
- priv->dev = &pdev->dev;
- pm_runtime_enable(priv->dev);
- pm_runtime_resume(priv->dev);
- return 0;
-}
+/* -----------------------------------------------------------------------------
+ * Frame buffer operations
+ */
static int sh_mobile_lcdc_setcolreg(u_int regno,
u_int red, u_int green, u_int blue,
@@ -1334,6 +1301,10 @@ static struct fb_ops sh_mobile_lcdc_ops = {
.fb_set_par = sh_mobile_set_par,
};
+/* -----------------------------------------------------------------------------
+ * Backlight
+ */
+
static int sh_mobile_lcdc_update_bl(struct backlight_device *bdev)
{
struct sh_mobile_lcdc_chan *ch = bl_get_data(bdev);
@@ -1393,6 +1364,10 @@ static void sh_mobile_lcdc_bl_remove(struct backlight_device *bdev)
backlight_device_unregister(bdev);
}
+/* -----------------------------------------------------------------------------
+ * Power management
+ */
+
static int sh_mobile_lcdc_suspend(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
@@ -1436,6 +1411,10 @@ static const struct dev_pm_ops sh_mobile_lcdc_dev_pm_ops = {
.runtime_resume = sh_mobile_lcdc_runtime_resume,
};
+/* -----------------------------------------------------------------------------
+ * Framebuffer notifier
+ */
+
/* locking: called with info->lock held */
static int sh_mobile_lcdc_notify(struct notifier_block *nb,
unsigned long action, void *data)
@@ -1476,6 +1455,28 @@ static int sh_mobile_lcdc_notify(struct notifier_block *nb,
return NOTIFY_OK;
}
+/* -----------------------------------------------------------------------------
+ * Probe/remove and driver init/exit
+ */
+
+static const struct fb_videomode default_720p = {
+ .name = "HDMI 720p",
+ .xres = 1280,
+ .yres = 720,
+
+ .left_margin = 220,
+ .right_margin = 110,
+ .hsync_len = 40,
+
+ .upper_margin = 20,
+ .lower_margin = 5,
+ .vsync_len = 5,
+
+ .pixclock = 13468,
+ .refresh = 60,
+ .sync = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT,
+};
+
static int sh_mobile_lcdc_remove(struct platform_device *pdev)
{
struct sh_mobile_lcdc_priv *priv = platform_get_drvdata(pdev);
@@ -1527,6 +1528,46 @@ static int sh_mobile_lcdc_remove(struct platform_device *pdev)
return 0;
}
+static int sh_mobile_lcdc_check_interface(struct sh_mobile_lcdc_chan *ch)
+{
+ int interface_type = ch->cfg.interface_type;
+
+ switch (interface_type) {
+ case RGB8:
+ case RGB9:
+ case RGB12A:
+ case RGB12B:
+ case RGB16:
+ case RGB18:
+ case RGB24:
+ case SYS8A:
+ case SYS8B:
+ case SYS8C:
+ case SYS8D:
+ case SYS9:
+ case SYS12:
+ case SYS16A:
+ case SYS16B:
+ case SYS16C:
+ case SYS18:
+ case SYS24:
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ /* SUBLCD only supports SYS interface */
+ if (lcdc_chan_is_sublcd(ch)) {
+ if (!(interface_type & LDMT1R_IFM))
+ return -EINVAL;
+
+ interface_type &= ~LDMT1R_IFM;
+ }
+
+ ch->ldmt1r_value = interface_type;
+ return 0;
+}
+
static int __devinit sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_chan *ch,
struct device *dev)
{
--
1.7.3.4
^ permalink raw reply related
* [PATCH 02/57] fbdev: sh_mobile_lcdc: Mark init-only symbols with __devinit(const)
From: Laurent Pinchart @ 2011-12-13 14:01 UTC (permalink / raw)
To: linux-fbdev
default_720p and sh_mobile_lcdc_check_interface are used at device
initialization time only. Mark them as __devinitconst and __devinit
respectively.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
drivers/video/sh_mobile_lcdcfb.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
index 8b18360..a6bf4fb 100644
--- a/drivers/video/sh_mobile_lcdcfb.c
+++ b/drivers/video/sh_mobile_lcdcfb.c
@@ -1459,7 +1459,7 @@ static int sh_mobile_lcdc_notify(struct notifier_block *nb,
* Probe/remove and driver init/exit
*/
-static const struct fb_videomode default_720p = {
+static const struct fb_videomode default_720p __devinitconst = {
.name = "HDMI 720p",
.xres = 1280,
.yres = 720,
@@ -1528,7 +1528,8 @@ static int sh_mobile_lcdc_remove(struct platform_device *pdev)
return 0;
}
-static int sh_mobile_lcdc_check_interface(struct sh_mobile_lcdc_chan *ch)
+static int __devinit
+sh_mobile_lcdc_check_interface(struct sh_mobile_lcdc_chan *ch)
{
int interface_type = ch->cfg.interface_type;
--
1.7.3.4
^ permalink raw reply related
* [PATCH 03/57] fbdev: sh_mobile_lcdc: Move pm runtime enable to probe()
From: Laurent Pinchart @ 2011-12-13 14:01 UTC (permalink / raw)
To: linux-fbdev
The pm_runtime_enable() and pm_runtime_resume() calls don't belong to
sh_mobile_lcdc_setup_clocks(). Move them to the probe function. Remove
the unneeded pm_runtime_resume() call.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
drivers/video/sh_mobile_lcdcfb.c | 34 ++++++++++++++++------------------
1 files changed, 16 insertions(+), 18 deletions(-)
diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
index a6bf4fb..7ceeed4 100644
--- a/drivers/video/sh_mobile_lcdcfb.c
+++ b/drivers/video/sh_mobile_lcdcfb.c
@@ -191,6 +191,7 @@ static int sh_mobile_lcdc_setup_clocks(struct platform_device *pdev,
int clock_source,
struct sh_mobile_lcdc_priv *priv)
{
+ struct clk *clk;
char *str;
switch (clock_source) {
@@ -210,21 +211,16 @@ static int sh_mobile_lcdc_setup_clocks(struct platform_device *pdev,
return -EINVAL;
}
- if (str) {
- priv->dot_clk = clk_get(&pdev->dev, str);
- if (IS_ERR(priv->dot_clk)) {
- dev_err(&pdev->dev, "cannot get dot clock %s\n", str);
- return PTR_ERR(priv->dot_clk);
- }
+ if (str = NULL)
+ return 0;
+
+ clk = clk_get(&pdev->dev, str);
+ if (IS_ERR(clk)) {
+ dev_err(&pdev->dev, "cannot get dot clock %s\n", str);
+ return PTR_ERR(clk);
}
- /* Runtime PM support involves two step for this driver:
- * 1) Enable Runtime PM
- * 2) Force Runtime PM Resume since hardware is accessed from probe()
- */
- priv->dev = &pdev->dev;
- pm_runtime_enable(priv->dev);
- pm_runtime_resume(priv->dev);
+ priv->dot_clk = clk;
return 0;
}
@@ -1513,11 +1509,10 @@ static int sh_mobile_lcdc_remove(struct platform_device *pdev)
sh_mobile_lcdc_bl_remove(priv->ch[i].bl);
}
- if (priv->dot_clk)
+ if (priv->dot_clk) {
+ pm_runtime_disable(&pdev->dev);
clk_put(priv->dot_clk);
-
- if (priv->dev)
- pm_runtime_disable(priv->dev);
+ }
if (priv->base)
iounmap(priv->base);
@@ -1740,6 +1735,8 @@ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev)
return -ENOMEM;
}
+ priv->dev = &pdev->dev;
+ priv->meram_dev = pdata->meram_dev;
platform_set_drvdata(pdev, priv);
error = request_irq(i, sh_mobile_lcdc_irq, 0,
@@ -1805,7 +1802,8 @@ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev)
goto err1;
}
- priv->meram_dev = pdata->meram_dev;
+ /* Enable runtime PM. */
+ pm_runtime_enable(&pdev->dev);
for (i = 0; i < num_channels; i++) {
struct sh_mobile_lcdc_chan *ch = priv->ch + i;
--
1.7.3.4
^ permalink raw reply related
* [PATCH 04/57] fbdev: sh_mobile_lcdc: Don't pass struct device around
From: Laurent Pinchart @ 2011-12-13 14:01 UTC (permalink / raw)
To: linux-fbdev
Pass a pointer to a struct sh_mobile_lcdc_priv instead, which stores a
pointer to the device.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
drivers/video/sh_mobile_lcdcfb.c | 41 +++++++++++++++++++------------------
1 files changed, 21 insertions(+), 20 deletions(-)
diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
index 7ceeed4..8b78487 100644
--- a/drivers/video/sh_mobile_lcdcfb.c
+++ b/drivers/video/sh_mobile_lcdcfb.c
@@ -187,9 +187,8 @@ static void sh_mobile_lcdc_clk_off(struct sh_mobile_lcdc_priv *priv)
}
}
-static int sh_mobile_lcdc_setup_clocks(struct platform_device *pdev,
- int clock_source,
- struct sh_mobile_lcdc_priv *priv)
+static int sh_mobile_lcdc_setup_clocks(struct sh_mobile_lcdc_priv *priv,
+ int clock_source)
{
struct clk *clk;
char *str;
@@ -214,9 +213,9 @@ static int sh_mobile_lcdc_setup_clocks(struct platform_device *pdev,
if (str = NULL)
return 0;
- clk = clk_get(&pdev->dev, str);
+ clk = clk_get(priv->dev, str);
if (IS_ERR(clk)) {
- dev_err(&pdev->dev, "cannot get dot clock %s\n", str);
+ dev_err(priv->dev, "cannot get dot clock %s\n", str);
return PTR_ERR(clk);
}
@@ -1564,8 +1563,9 @@ sh_mobile_lcdc_check_interface(struct sh_mobile_lcdc_chan *ch)
return 0;
}
-static int __devinit sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_chan *ch,
- struct device *dev)
+static int __devinit
+sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_priv *priv,
+ struct sh_mobile_lcdc_chan *ch)
{
struct sh_mobile_lcdc_chan_cfg *cfg = &ch->cfg;
const struct fb_videomode *max_mode;
@@ -1581,9 +1581,9 @@ static int __devinit sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_chan *ch,
mutex_init(&ch->open_lock);
/* Allocate the frame buffer device. */
- ch->info = framebuffer_alloc(0, dev);
+ ch->info = framebuffer_alloc(0, priv->dev);
if (!ch->info) {
- dev_err(dev, "unable to allocate fb_info\n");
+ dev_err(priv->dev, "unable to allocate fb_info\n");
return -ENOMEM;
}
@@ -1605,8 +1605,8 @@ static int __devinit sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_chan *ch,
/* NV12/NV21 buffers must have even number of lines */
if ((cfg->fourcc = V4L2_PIX_FMT_NV12 ||
cfg->fourcc = V4L2_PIX_FMT_NV21) && (mode->yres & 0x1)) {
- dev_err(dev, "yres must be multiple of 2 for YCbCr420 "
- "mode.\n");
+ dev_err(priv->dev, "yres must be multiple of 2 for "
+ "YCbCr420 mode.\n");
return -EINVAL;
}
@@ -1619,7 +1619,7 @@ static int __devinit sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_chan *ch,
if (!max_size)
max_size = MAX_XRES * MAX_YRES;
else
- dev_dbg(dev, "Found largest videomode %ux%u\n",
+ dev_dbg(priv->dev, "Found largest videomode %ux%u\n",
max_mode->xres, max_mode->yres);
/* Create the mode list. */
@@ -1670,16 +1670,17 @@ static int __devinit sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_chan *ch,
max_size = max_size * var->bits_per_pixel / 8 * 2;
/* Allocate frame buffer memory and color map. */
- buf = dma_alloc_coherent(dev, max_size, &ch->dma_handle, GFP_KERNEL);
+ buf = dma_alloc_coherent(priv->dev, max_size, &ch->dma_handle,
+ GFP_KERNEL);
if (!buf) {
- dev_err(dev, "unable to allocate buffer\n");
+ dev_err(priv->dev, "unable to allocate buffer\n");
return -ENOMEM;
}
ret = fb_alloc_cmap(&info->cmap, PALETTE_NR, 0);
if (ret < 0) {
- dev_err(dev, "unable to allocate cmap\n");
- dma_free_coherent(dev, max_size, buf, ch->dma_handle);
+ dev_err(priv->dev, "unable to allocate cmap\n");
+ dma_free_coherent(priv->dev, max_size, buf, ch->dma_handle);
return ret;
}
@@ -1702,7 +1703,7 @@ static int __devinit sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_chan *ch,
}
info->screen_base = buf;
- info->device = dev;
+ info->device = priv->dev;
ch->display_var = *var;
return 0;
@@ -1796,7 +1797,7 @@ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev)
if (!priv->base)
goto err1;
- error = sh_mobile_lcdc_setup_clocks(pdev, pdata->clock_source, priv);
+ error = sh_mobile_lcdc_setup_clocks(priv, pdata->clock_source);
if (error) {
dev_err(&pdev->dev, "unable to setup clocks\n");
goto err1;
@@ -1808,7 +1809,7 @@ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev)
for (i = 0; i < num_channels; i++) {
struct sh_mobile_lcdc_chan *ch = priv->ch + i;
- error = sh_mobile_lcdc_channel_init(ch, &pdev->dev);
+ error = sh_mobile_lcdc_channel_init(priv, ch);
if (error)
goto err1;
}
@@ -1838,7 +1839,7 @@ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev)
if (error < 0)
goto err1;
- dev_info(info->dev, "registered %s/%s as %dx%d %dbpp.\n",
+ dev_info(&pdev->dev, "registered %s/%s as %dx%d %dbpp.\n",
pdev->name, (ch->cfg.chan = LCDC_CHAN_MAINLCD) ?
"mainlcd" : "sublcd", info->var.xres, info->var.yres,
info->var.bits_per_pixel);
--
1.7.3.4
^ permalink raw reply related
* [PATCH 05/57] fbdev: sh_mobile_lcdc: Create functions to turn the display on/off
From: Laurent Pinchart @ 2011-12-13 14:02 UTC (permalink / raw)
To: linux-fbdev
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
drivers/video/sh_mobile_lcdcfb.c | 53 ++++++++++++++++++++------------------
1 files changed, 28 insertions(+), 25 deletions(-)
diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
index 8b78487..afa1fac 100644
--- a/drivers/video/sh_mobile_lcdcfb.c
+++ b/drivers/video/sh_mobile_lcdcfb.c
@@ -224,7 +224,7 @@ static int sh_mobile_lcdc_setup_clocks(struct sh_mobile_lcdc_priv *priv,
}
/* -----------------------------------------------------------------------------
- * Sys panel and deferred I/O
+ * Display, panel and deferred I/O
*/
static void lcdc_sys_write_index(void *handle, unsigned long data)
@@ -335,6 +335,27 @@ static void sh_mobile_lcdc_deferred_io_touch(struct fb_info *info)
schedule_delayed_work(&info->deferred_work, fbdefio->delay);
}
+static void sh_mobile_lcdc_display_on(struct sh_mobile_lcdc_chan *ch)
+{
+ struct sh_mobile_lcdc_board_cfg *board_cfg = &ch->cfg.board_cfg;
+
+ /* HDMI must be enabled before LCDC configuration */
+ if (board_cfg->display_on && try_module_get(board_cfg->owner)) {
+ board_cfg->display_on(board_cfg->board_data, ch->info);
+ module_put(board_cfg->owner);
+ }
+}
+
+static void sh_mobile_lcdc_display_off(struct sh_mobile_lcdc_chan *ch)
+{
+ struct sh_mobile_lcdc_board_cfg *board_cfg = &ch->cfg.board_cfg;
+
+ if (board_cfg->display_off && try_module_get(board_cfg->owner)) {
+ board_cfg->display_off(board_cfg->board_data);
+ module_put(board_cfg->owner);
+ }
+}
+
/* -----------------------------------------------------------------------------
* Format helpers
*/
@@ -648,7 +669,6 @@ static void __sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
{
struct sh_mobile_meram_info *mdev = priv->meram_dev;
- struct sh_mobile_lcdc_board_cfg *board_cfg;
struct sh_mobile_lcdc_chan *ch;
unsigned long tmp;
int ret;
@@ -665,8 +685,9 @@ static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
lcdc_wait_bit(priv, _LDCNT2R, LDCNT2R_BR, 0);
for (k = 0; k < ARRAY_SIZE(priv->ch); k++) {
- ch = &priv->ch[k];
+ struct sh_mobile_lcdc_board_cfg *board_cfg;
+ ch = &priv->ch[k];
if (!ch->enabled)
continue;
@@ -754,11 +775,7 @@ static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
fb_deferred_io_init(ch->info);
}
- board_cfg = &ch->cfg.board_cfg;
- if (board_cfg->display_on && try_module_get(board_cfg->owner)) {
- board_cfg->display_on(board_cfg->board_data, ch->info);
- module_put(board_cfg->owner);
- }
+ sh_mobile_lcdc_display_on(ch);
if (ch->bl) {
ch->bl->props.power = FB_BLANK_UNBLANK;
@@ -772,7 +789,6 @@ static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
static void sh_mobile_lcdc_stop(struct sh_mobile_lcdc_priv *priv)
{
struct sh_mobile_lcdc_chan *ch;
- struct sh_mobile_lcdc_board_cfg *board_cfg;
int k;
/* clean up deferred io and ask board code to disable panel */
@@ -799,11 +815,7 @@ static void sh_mobile_lcdc_stop(struct sh_mobile_lcdc_priv *priv)
backlight_update_status(ch->bl);
}
- board_cfg = &ch->cfg.board_cfg;
- if (board_cfg->display_off && try_module_get(board_cfg->owner)) {
- board_cfg->display_off(board_cfg->board_data);
- module_put(board_cfg->owner);
- }
+ sh_mobile_lcdc_display_off(ch);
/* disable the meram */
if (ch->meram_enabled) {
@@ -1417,7 +1429,6 @@ static int sh_mobile_lcdc_notify(struct notifier_block *nb,
struct fb_event *event = data;
struct fb_info *info = event->info;
struct sh_mobile_lcdc_chan *ch = info->par;
- struct sh_mobile_lcdc_board_cfg *board_cfg = &ch->cfg.board_cfg;
if (&ch->lcdc->notifier != nb)
return NOTIFY_DONE;
@@ -1427,10 +1438,7 @@ static int sh_mobile_lcdc_notify(struct notifier_block *nb,
switch(action) {
case FB_EVENT_SUSPEND:
- if (board_cfg->display_off && try_module_get(board_cfg->owner)) {
- board_cfg->display_off(board_cfg->board_data);
- module_put(board_cfg->owner);
- }
+ sh_mobile_lcdc_display_off(ch);
sh_mobile_lcdc_stop(ch->lcdc);
break;
case FB_EVENT_RESUME:
@@ -1438,12 +1446,7 @@ static int sh_mobile_lcdc_notify(struct notifier_block *nb,
sh_mobile_fb_reconfig(info);
mutex_unlock(&ch->open_lock);
- /* HDMI must be enabled before LCDC configuration */
- if (board_cfg->display_on && try_module_get(board_cfg->owner)) {
- board_cfg->display_on(board_cfg->board_data, info);
- module_put(board_cfg->owner);
- }
-
+ sh_mobile_lcdc_display_on(ch);
sh_mobile_lcdc_start(ch->lcdc);
}
--
1.7.3.4
^ permalink raw reply related
* [PATCH 06/57] fbdev: sh_mobile_hdmi: Don't access LCDC channel in notifier callback
From: Laurent Pinchart @ 2011-12-13 14:02 UTC (permalink / raw)
To: linux-fbdev
Instead of relying on info->par being a pointer to an LCDC channel, cast
the notifier block pointer to an sh_hdmi pointer.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
drivers/video/sh_mobile_hdmi.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/video/sh_mobile_hdmi.c b/drivers/video/sh_mobile_hdmi.c
index 647ba98..b1e90f5 100644
--- a/drivers/video/sh_mobile_hdmi.c
+++ b/drivers/video/sh_mobile_hdmi.c
@@ -225,6 +225,8 @@ struct sh_hdmi {
struct notifier_block notifier;
};
+#define notifier_to_hdmi(n) container_of(n, struct sh_hdmi, notifier)
+
static void hdmi_write(struct sh_hdmi *hdmi, u8 data, u8 reg)
{
iowrite8(data, hdmi->base + reg);
@@ -1204,9 +1206,7 @@ static int sh_hdmi_notify(struct notifier_block *nb,
{
struct fb_event *event = data;
struct fb_info *info = event->info;
- struct sh_mobile_lcdc_chan *ch = info->par;
- struct sh_mobile_lcdc_board_cfg *board_cfg = &ch->cfg.board_cfg;
- struct sh_hdmi *hdmi = board_cfg->board_data;
+ struct sh_hdmi *hdmi = notifier_to_hdmi(nb);
if (!hdmi || nb != &hdmi->notifier || hdmi->info != info)
return NOTIFY_DONE;
--
1.7.3.4
^ permalink raw reply related
* [PATCH 07/57] sh_mobile_hdmi: Remove platform data lcd_dev field
From: Laurent Pinchart @ 2011-12-13 14:02 UTC (permalink / raw)
To: linux-fbdev
The field is used to print debug messages only. Remove it.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
arch/arm/mach-shmobile/board-ap4evb.c | 1 -
arch/arm/mach-shmobile/board-mackerel.c | 1 -
drivers/video/sh_mobile_hdmi.c | 17 +++++------------
include/video/sh_mobile_hdmi.h | 1 -
4 files changed, 5 insertions(+), 15 deletions(-)
diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c
index 42b4dda..dca4860 100644
--- a/arch/arm/mach-shmobile/board-ap4evb.c
+++ b/arch/arm/mach-shmobile/board-ap4evb.c
@@ -851,7 +851,6 @@ static long ap4evb_clk_optimize(unsigned long target, unsigned long *best_freq,
static struct sh_mobile_hdmi_info hdmi_info = {
.lcd_chan = &sh_mobile_lcdc1_info.ch[0],
- .lcd_dev = &lcdc1_device.dev,
.flags = HDMI_SND_SRC_SPDIF,
.clk_optimize_parent = ap4evb_clk_optimize,
};
diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c
index 7db6a17..4ed0138 100644
--- a/arch/arm/mach-shmobile/board-mackerel.c
+++ b/arch/arm/mach-shmobile/board-mackerel.c
@@ -485,7 +485,6 @@ static struct platform_device hdmi_lcdc_device = {
static struct sh_mobile_hdmi_info hdmi_info = {
.lcd_chan = &hdmi_lcdc_info.ch[0],
- .lcd_dev = &hdmi_lcdc_device.dev,
.flags = HDMI_SND_SRC_SPDIF,
};
diff --git a/drivers/video/sh_mobile_hdmi.c b/drivers/video/sh_mobile_hdmi.c
index b1e90f5..1ff3baf 100644
--- a/drivers/video/sh_mobile_hdmi.c
+++ b/drivers/video/sh_mobile_hdmi.c
@@ -1008,11 +1008,9 @@ static void sh_hdmi_display_on(void *arg, struct fb_info *info)
* FB_EVENT_FB_UNBIND notify is also called with info->lock held
*/
struct sh_hdmi *hdmi = arg;
- struct sh_mobile_hdmi_info *pdata = hdmi->dev->platform_data;
struct sh_mobile_lcdc_chan *ch = info->par;
- dev_dbg(hdmi->dev, "%s(%p): state %x\n", __func__,
- pdata->lcd_dev, info->state);
+ dev_dbg(hdmi->dev, "%s(%p): state %x\n", __func__, hdmi, info->state);
/* No need to lock */
hdmi->info = info;
@@ -1040,9 +1038,8 @@ static void sh_hdmi_display_on(void *arg, struct fb_info *info)
static void sh_hdmi_display_off(void *arg)
{
struct sh_hdmi *hdmi = arg;
- struct sh_mobile_hdmi_info *pdata = hdmi->dev->platform_data;
- dev_dbg(hdmi->dev, "%s(%p)\n", __func__, pdata->lcd_dev);
+ dev_dbg(hdmi->dev, "%s(%p)\n", __func__, hdmi);
/* PS mode e->a */
hdmi_write(hdmi, 0x10, HDMI_SYSTEM_CTRL);
}
@@ -1114,15 +1111,11 @@ static void sh_hdmi_edid_work_fn(struct work_struct *work)
{
struct sh_hdmi *hdmi = container_of(work, struct sh_hdmi, edid_work.work);
struct fb_info *info;
- struct sh_mobile_hdmi_info *pdata = hdmi->dev->platform_data;
struct sh_mobile_lcdc_chan *ch;
int ret;
- dev_dbg(hdmi->dev, "%s(%p): begin, hotplug status %d\n", __func__,
- pdata->lcd_dev, hdmi->hp_state);
-
- if (!pdata->lcd_dev)
- return;
+ dev_dbg(hdmi->dev, "%s(%p): begin, hotplug status %d\n", __func__, hdmi,
+ hdmi->hp_state);
mutex_lock(&hdmi->mutex);
@@ -1198,7 +1191,7 @@ out:
hdmi->hp_state = HDMI_HOTPLUG_DISCONNECTED;
mutex_unlock(&hdmi->mutex);
- dev_dbg(hdmi->dev, "%s(%p): end\n", __func__, pdata->lcd_dev);
+ dev_dbg(hdmi->dev, "%s(%p): end\n", __func__, hdmi);
}
static int sh_hdmi_notify(struct notifier_block *nb,
diff --git a/include/video/sh_mobile_hdmi.h b/include/video/sh_mobile_hdmi.h
index b569329..0b8d2cf 100644
--- a/include/video/sh_mobile_hdmi.h
+++ b/include/video/sh_mobile_hdmi.h
@@ -32,7 +32,6 @@ struct clk;
struct sh_mobile_hdmi_info {
struct sh_mobile_lcdc_chan_cfg *lcd_chan;
- struct device *lcd_dev;
unsigned int flags;
long (*clk_optimize_parent)(unsigned long target, unsigned long *best_freq,
unsigned long *parent_freq);
--
1.7.3.4
^ permalink raw reply related
* [PATCH 08/57] fbdev: sh_mobile_lcdc: Add sh_mobile_lcdc_entity definition
From: Laurent Pinchart @ 2011-12-13 14:02 UTC (permalink / raw)
To: linux-fbdev
The sh_mobile_lcdc_entity structure will be used to abstract operations
performed by transceivers (such as MIPI/DSI and HDMI).
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
drivers/video/sh_mobile_lcdcfb.h | 18 ++++++++++++++++--
1 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/drivers/video/sh_mobile_lcdcfb.h b/drivers/video/sh_mobile_lcdcfb.h
index a58a0f3..d79e5aa 100644
--- a/drivers/video/sh_mobile_lcdcfb.h
+++ b/drivers/video/sh_mobile_lcdcfb.h
@@ -14,9 +14,23 @@ enum { LDDCKPAT1R, LDDCKPAT2R, LDMT1R, LDMT2R, LDMT3R, LDDFR, LDSM1R,
#define PALETTE_NR 16
-struct sh_mobile_lcdc_priv;
-struct fb_info;
struct backlight_device;
+struct fb_info;
+struct module;
+struct sh_mobile_lcdc_entity;
+struct sh_mobile_lcdc_priv;
+
+struct sh_mobile_lcdc_entity_ops {
+ /* Display */
+ int (*display_on)(struct sh_mobile_lcdc_entity *entity,
+ struct fb_info *info);
+ void (*display_off)(struct sh_mobile_lcdc_entity *entity);
+};
+
+struct sh_mobile_lcdc_entity {
+ struct module *owner;
+ const struct sh_mobile_lcdc_entity_ops *ops;
+};
/*
* struct sh_mobile_lcdc_chan - LCDC display channel
--
1.7.3.4
^ permalink raw reply related
* [PATCH 09/57] fbdev: sh_mobile_hdmi: Implement sh_mobile_lcdc_entity interface
From: Laurent Pinchart @ 2011-12-13 14:02 UTC (permalink / raw)
To: linux-fbdev
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
drivers/video/sh_mobile_hdmi.c | 39 +++++++++++++++++++++++++++++++--------
1 files changed, 31 insertions(+), 8 deletions(-)
diff --git a/drivers/video/sh_mobile_hdmi.c b/drivers/video/sh_mobile_hdmi.c
index 1ff3baf..f961fa2 100644
--- a/drivers/video/sh_mobile_hdmi.c
+++ b/drivers/video/sh_mobile_hdmi.c
@@ -208,6 +208,8 @@ enum hotplug_state {
};
struct sh_hdmi {
+ struct sh_mobile_lcdc_entity entity;
+
void __iomem *base;
enum hotplug_state hp_state; /* hot-plug status */
u8 preprogrammed_vic; /* use a pre-programmed VIC or
@@ -225,6 +227,7 @@ struct sh_hdmi {
struct notifier_block notifier;
};
+#define entity_to_sh_hdmi(e) container_of(e, struct sh_hdmi, entity)
#define notifier_to_hdmi(n) container_of(n, struct sh_hdmi, notifier)
static void hdmi_write(struct sh_hdmi *hdmi, u8 data, u8 reg)
@@ -1001,13 +1004,14 @@ static irqreturn_t sh_hdmi_hotplug(int irq, void *dev_id)
}
/* locking: called with info->lock held, or before register_framebuffer() */
-static void sh_hdmi_display_on(void *arg, struct fb_info *info)
+static int __sh_hdmi_display_on(struct sh_mobile_lcdc_entity *entity,
+ struct fb_info *info)
{
/*
* info is guaranteed to be valid, when we are called, because our
* FB_EVENT_FB_UNBIND notify is also called with info->lock held
*/
- struct sh_hdmi *hdmi = arg;
+ struct sh_hdmi *hdmi = entity_to_sh_hdmi(entity);
struct sh_mobile_lcdc_chan *ch = info->par;
dev_dbg(hdmi->dev, "%s(%p): state %x\n", __func__, hdmi, info->state);
@@ -1032,18 +1036,35 @@ static void sh_hdmi_display_on(void *arg, struct fb_info *info)
default:
hdmi->var = ch->display_var;
}
+
+ return 0;
+}
+
+static void sh_hdmi_display_on(void *arg, struct fb_info *info)
+{
+ __sh_hdmi_display_on(arg, info);
}
/* locking: called with info->lock held */
-static void sh_hdmi_display_off(void *arg)
+static void __sh_hdmi_display_off(struct sh_mobile_lcdc_entity *entity)
{
- struct sh_hdmi *hdmi = arg;
+ struct sh_hdmi *hdmi = entity_to_sh_hdmi(entity);
dev_dbg(hdmi->dev, "%s(%p)\n", __func__, hdmi);
/* PS mode e->a */
hdmi_write(hdmi, 0x10, HDMI_SYSTEM_CTRL);
}
+static void sh_hdmi_display_off(void *arg)
+{
+ __sh_hdmi_display_off(arg);
+}
+
+static const struct sh_mobile_lcdc_entity_ops sh_hdmi_ops = {
+ .display_on = __sh_hdmi_display_on,
+ .display_off = __sh_hdmi_display_off,
+};
+
static bool sh_hdmi_must_reconfigure(struct sh_hdmi *hdmi)
{
struct fb_info *info = hdmi->info;
@@ -1157,7 +1178,7 @@ static void sh_hdmi_edid_work_fn(struct work_struct *work)
*/
info->var.width = hdmi->var.width;
info->var.height = hdmi->var.height;
- sh_hdmi_display_on(hdmi, info);
+ __sh_hdmi_display_on(&hdmi->entity, info);
} else {
/* New monitor or have to wake up */
fb_set_suspend(info, 0);
@@ -1251,6 +1272,8 @@ static int __init sh_hdmi_probe(struct platform_device *pdev)
mutex_init(&hdmi->mutex);
hdmi->dev = &pdev->dev;
+ hdmi->entity.owner = THIS_MODULE;
+ hdmi->entity.ops = &sh_hdmi_ops;
hdmi->hdmi_clk = clk_get(&pdev->dev, "ick");
if (IS_ERR(hdmi->hdmi_clk)) {
@@ -1290,12 +1313,12 @@ static int __init sh_hdmi_probe(struct platform_device *pdev)
goto emap;
}
- platform_set_drvdata(pdev, hdmi);
+ platform_set_drvdata(pdev, &hdmi->entity);
/* Set up LCDC callbacks */
board_cfg = &pdata->lcd_chan->board_cfg;
board_cfg->owner = THIS_MODULE;
- board_cfg->board_data = hdmi;
+ board_cfg->board_data = &hdmi->entity;
board_cfg->display_on = sh_hdmi_display_on;
board_cfg->display_off = sh_hdmi_display_off;
@@ -1349,7 +1372,7 @@ egetclk:
static int __exit sh_hdmi_remove(struct platform_device *pdev)
{
struct sh_mobile_hdmi_info *pdata = pdev->dev.platform_data;
- struct sh_hdmi *hdmi = platform_get_drvdata(pdev);
+ struct sh_hdmi *hdmi = entity_to_sh_hdmi(platform_get_drvdata(pdev));
struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
struct sh_mobile_lcdc_board_cfg *board_cfg = &pdata->lcd_chan->board_cfg;
int irq = platform_get_irq(pdev, 0);
--
1.7.3.4
^ permalink raw reply related
* [PATCH 10/57] fbdev: sh_mipi_dsi: Implement sh_mobile_lcdc_entity interface
From: Laurent Pinchart @ 2011-12-13 14:02 UTC (permalink / raw)
To: linux-fbdev
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
drivers/video/sh_mipi_dsi.c | 66 +++++++++++++++++++++++++++++++++----------
1 files changed, 51 insertions(+), 15 deletions(-)
diff --git a/drivers/video/sh_mipi_dsi.c b/drivers/video/sh_mipi_dsi.c
index 05151b8..58744fe 100644
--- a/drivers/video/sh_mipi_dsi.c
+++ b/drivers/video/sh_mipi_dsi.c
@@ -24,6 +24,8 @@
#include <video/sh_mipi_dsi.h>
#include <video/sh_mobile_lcdc.h>
+#include "sh_mobile_lcdcfb.h"
+
#define SYSCTRL 0x0000
#define SYSCONF 0x0004
#define TIMSET 0x0008
@@ -50,6 +52,8 @@
#define MAX_SH_MIPI_DSI 2
struct sh_mipi {
+ struct sh_mobile_lcdc_entity entity;
+
void __iomem *base;
void __iomem *linkbase;
struct clk *dsit_clk;
@@ -60,6 +64,8 @@ struct sh_mipi {
void (*next_display_off)(void *board_data);
};
+#define to_sh_mipi(e) container_of(e, struct sh_mipi, entity)
+
static struct sh_mipi *mipi_dsi[MAX_SH_MIPI_DSI];
/* Protect the above array */
@@ -120,7 +126,7 @@ static void sh_mipi_dsi_enable(struct sh_mipi *mipi, bool enable)
static void sh_mipi_shutdown(struct platform_device *pdev)
{
- struct sh_mipi *mipi = platform_get_drvdata(pdev);
+ struct sh_mipi *mipi = to_sh_mipi(platform_get_drvdata(pdev));
sh_mipi_dsi_enable(mipi, false);
}
@@ -392,9 +398,10 @@ static int __init sh_mipi_setup(struct sh_mipi *mipi,
return 0;
}
-static void mipi_display_on(void *arg, struct fb_info *info)
+static int __mipi_display_on(struct sh_mobile_lcdc_entity *entity,
+ struct fb_info *info)
{
- struct sh_mipi *mipi = arg;
+ struct sh_mipi *mipi = to_sh_mipi(entity);
struct sh_mipi_dsi_info *pdata = mipi->pdev->dev.platform_data;
int ret;
@@ -410,24 +417,34 @@ static void mipi_display_on(void *arg, struct fb_info *info)
sh_mipi_dsi_enable(mipi, true);
- if (mipi->next_display_on)
- mipi->next_display_on(mipi->next_board_data, info);
-
- return;
+ return 0;
mipi_display_on_fail1:
pm_runtime_put_sync(&mipi->pdev->dev);
mipi_display_on_fail2:
pdata->set_dot_clock(mipi->pdev, mipi->base, 0);
+
+ return ret;
}
-static void mipi_display_off(void *arg)
+static void mipi_display_on(void *arg, struct fb_info *info)
{
- struct sh_mipi *mipi = arg;
- struct sh_mipi_dsi_info *pdata = mipi->pdev->dev.platform_data;
+ struct sh_mobile_lcdc_entity *entity = arg;
+ struct sh_mipi *mipi = to_sh_mipi(entity);
+ int ret;
- if (mipi->next_display_off)
- mipi->next_display_off(mipi->next_board_data);
+ ret = __mipi_display_on(entity, info);
+ if (ret < 0)
+ return;
+
+ if (mipi->next_display_on)
+ mipi->next_display_on(mipi->next_board_data, info);
+}
+
+static void __mipi_display_off(struct sh_mobile_lcdc_entity *entity)
+{
+ struct sh_mipi *mipi = to_sh_mipi(entity);
+ struct sh_mipi_dsi_info *pdata = mipi->pdev->dev.platform_data;
sh_mipi_dsi_enable(mipi, false);
@@ -436,6 +453,22 @@ static void mipi_display_off(void *arg)
pm_runtime_put_sync(&mipi->pdev->dev);
}
+static void mipi_display_off(void *arg)
+{
+ struct sh_mobile_lcdc_entity *entity = arg;
+ struct sh_mipi *mipi = to_sh_mipi(entity);
+
+ if (mipi->next_display_off)
+ mipi->next_display_off(mipi->next_board_data);
+
+ __mipi_display_off(entity);
+}
+
+static const struct sh_mobile_lcdc_entity_ops mipi_ops = {
+ .display_on = __mipi_display_on,
+ .display_off = __mipi_display_off,
+};
+
static int __init sh_mipi_probe(struct platform_device *pdev)
{
struct sh_mipi *mipi;
@@ -467,6 +500,9 @@ static int __init sh_mipi_probe(struct platform_device *pdev)
goto ealloc;
}
+ mipi->entity.owner = THIS_MODULE;
+ mipi->entity.ops = &mipi_ops;
+
if (!request_mem_region(res->start, resource_size(res), pdev->name)) {
dev_err(&pdev->dev, "MIPI register region already claimed\n");
ret = -EBUSY;
@@ -521,7 +557,7 @@ static int __init sh_mipi_probe(struct platform_device *pdev)
pm_runtime_resume(&pdev->dev);
mutex_unlock(&array_lock);
- platform_set_drvdata(pdev, mipi);
+ platform_set_drvdata(pdev, &mipi->entity);
/* Save original LCDC callbacks */
mipi->next_board_data = pdata->lcd_chan->board_cfg.board_data;
@@ -529,7 +565,7 @@ static int __init sh_mipi_probe(struct platform_device *pdev)
mipi->next_display_off = pdata->lcd_chan->board_cfg.display_off;
/* Set up LCDC callbacks */
- pdata->lcd_chan->board_cfg.board_data = mipi;
+ pdata->lcd_chan->board_cfg.board_data = &mipi->entity;
pdata->lcd_chan->board_cfg.display_on = mipi_display_on;
pdata->lcd_chan->board_cfg.display_off = mipi_display_off;
pdata->lcd_chan->board_cfg.owner = THIS_MODULE;
@@ -561,7 +597,7 @@ static int __exit sh_mipi_remove(struct platform_device *pdev)
struct sh_mipi_dsi_info *pdata = pdev->dev.platform_data;
struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
struct resource *res2 = platform_get_resource(pdev, IORESOURCE_MEM, 1);
- struct sh_mipi *mipi = platform_get_drvdata(pdev);
+ struct sh_mipi *mipi = to_sh_mipi(platform_get_drvdata(pdev));
int i, ret;
mutex_lock(&array_lock);
--
1.7.3.4
^ permalink raw reply related
* [PATCH 11/57] fbdev: sh_mobile_lcdc: Handle HDMI/MIPI transmitter device directly
From: Laurent Pinchart @ 2011-12-13 14:02 UTC (permalink / raw)
To: linux-fbdev
Pass a pointer to the transmitter device through platform data, retrieve
the corresponding sh_mobile_lcdc_entity structure in the probe method
and call the transmitter display_on/off methods directly.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
drivers/video/sh_mobile_lcdcfb.c | 33 ++++++++++++++++++++++++++++-----
drivers/video/sh_mobile_lcdcfb.h | 2 ++
include/video/sh_mobile_lcdc.h | 2 ++
3 files changed, 32 insertions(+), 5 deletions(-)
diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
index afa1fac..f1bbae6 100644
--- a/drivers/video/sh_mobile_lcdcfb.c
+++ b/drivers/video/sh_mobile_lcdcfb.c
@@ -338,6 +338,13 @@ static void sh_mobile_lcdc_deferred_io_touch(struct fb_info *info)
static void sh_mobile_lcdc_display_on(struct sh_mobile_lcdc_chan *ch)
{
struct sh_mobile_lcdc_board_cfg *board_cfg = &ch->cfg.board_cfg;
+ int ret;
+
+ if (ch->tx_dev) {
+ ret = ch->tx_dev->ops->display_on(ch->tx_dev, ch->info);
+ if (ret < 0)
+ return;
+ }
/* HDMI must be enabled before LCDC configuration */
if (board_cfg->display_on && try_module_get(board_cfg->owner)) {
@@ -354,6 +361,9 @@ static void sh_mobile_lcdc_display_off(struct sh_mobile_lcdc_chan *ch)
board_cfg->display_off(board_cfg->board_data);
module_put(board_cfg->owner);
}
+
+ if (ch->tx_dev)
+ ch->tx_dev->ops->display_off(ch->tx_dev);
}
/* -----------------------------------------------------------------------------
@@ -1490,18 +1500,21 @@ static int sh_mobile_lcdc_remove(struct platform_device *pdev)
sh_mobile_lcdc_stop(priv);
for (i = 0; i < ARRAY_SIZE(priv->ch); i++) {
- info = priv->ch[i].info;
+ struct sh_mobile_lcdc_chan *ch = &priv->ch[i];
+ info = ch->info;
if (!info || !info->device)
continue;
- if (priv->ch[i].sglist)
- vfree(priv->ch[i].sglist);
+ if (ch->tx_dev)
+ module_put(ch->cfg.tx_dev->dev.driver->owner);
+
+ if (ch->sglist)
+ vfree(ch->sglist);
if (info->screen_base)
dma_free_coherent(&pdev->dev, info->fix.smem_len,
- info->screen_base,
- priv->ch[i].dma_handle);
+ info->screen_base, ch->dma_handle);
fb_dealloc_cmap(&info->cmap);
framebuffer_release(info);
}
@@ -1596,6 +1609,16 @@ sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_priv *priv,
info->pseudo_palette = &ch->pseudo_palette;
info->flags = FBINFO_FLAG_DEFAULT;
+ if (cfg->tx_dev) {
+ if (!cfg->tx_dev->dev.driver ||
+ !try_module_get(cfg->tx_dev->dev.driver->owner)) {
+ dev_warn(priv->dev, "unable to get transmitter "
+ "device\n");
+ return -EINVAL;
+ }
+ ch->tx_dev = platform_get_drvdata(cfg->tx_dev);
+ }
+
/* Iterate through the modes to validate them and find the highest
* resolution.
*/
diff --git a/drivers/video/sh_mobile_lcdcfb.h b/drivers/video/sh_mobile_lcdcfb.h
index d79e5aa..9601b92 100644
--- a/drivers/video/sh_mobile_lcdcfb.h
+++ b/drivers/video/sh_mobile_lcdcfb.h
@@ -41,6 +41,8 @@ struct sh_mobile_lcdc_entity {
*/
struct sh_mobile_lcdc_chan {
struct sh_mobile_lcdc_priv *lcdc;
+ struct sh_mobile_lcdc_entity *tx_dev;
+
unsigned long *reg_offs;
unsigned long ldmt1r_value;
unsigned long enabled; /* ME and SE in LDCNT2R */
diff --git a/include/video/sh_mobile_lcdc.h b/include/video/sh_mobile_lcdc.h
index fe30b75..0ec59e1 100644
--- a/include/video/sh_mobile_lcdc.h
+++ b/include/video/sh_mobile_lcdc.h
@@ -186,6 +186,8 @@ struct sh_mobile_lcdc_chan_cfg {
struct sh_mobile_lcdc_bl_info bl_info;
struct sh_mobile_lcdc_sys_bus_cfg sys_bus_cfg; /* only for SYSn I/F */
struct sh_mobile_meram_cfg *meram_cfg;
+
+ struct platform_device *tx_dev; /* HDMI/MIPI transmitter device */
};
struct sh_mobile_lcdc_info {
--
1.7.3.4
^ permalink raw reply related
* [PATCH 12/57] arm: mach-shmobile: Add LCDC tx_dev field to platform data
From: Laurent Pinchart @ 2011-12-13 14:02 UTC (permalink / raw)
To: linux-fbdev
Make sure the transmitter devices get registered before the associated
LCDC devices.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
arch/arm/mach-shmobile/board-ap4evb.c | 272 ++++++++++++++++---------------
arch/arm/mach-shmobile/board-mackerel.c | 66 ++++----
2 files changed, 176 insertions(+), 162 deletions(-)
diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c
index dca4860..e0a6b3d 100644
--- a/arch/arm/mach-shmobile/board-ap4evb.c
+++ b/arch/arm/mach-shmobile/board-ap4evb.c
@@ -445,82 +445,6 @@ static struct platform_device usb1_host_device = {
.resource = usb1_host_resources,
};
-static const struct fb_videomode ap4evb_lcdc_modes[] = {
- {
-#ifdef CONFIG_AP4EVB_QHD
- .name = "R63302(QHD)",
- .xres = 544,
- .yres = 961,
- .left_margin = 72,
- .right_margin = 600,
- .hsync_len = 16,
- .upper_margin = 8,
- .lower_margin = 8,
- .vsync_len = 2,
- .sync = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT,
-#else
- .name = "WVGA Panel",
- .xres = 800,
- .yres = 480,
- .left_margin = 220,
- .right_margin = 110,
- .hsync_len = 70,
- .upper_margin = 20,
- .lower_margin = 5,
- .vsync_len = 5,
- .sync = 0,
-#endif
- },
-};
-static struct sh_mobile_meram_cfg lcd_meram_cfg = {
- .icb[0] = {
- .marker_icb = 28,
- .cache_icb = 24,
- .meram_offset = 0x0,
- .meram_size = 0x40,
- },
- .icb[1] = {
- .marker_icb = 29,
- .cache_icb = 25,
- .meram_offset = 0x40,
- .meram_size = 0x40,
- },
-};
-
-static struct sh_mobile_lcdc_info lcdc_info = {
- .meram_dev = &meram_info,
- .ch[0] = {
- .chan = LCDC_CHAN_MAINLCD,
- .fourcc = V4L2_PIX_FMT_RGB565,
- .lcd_cfg = ap4evb_lcdc_modes,
- .num_cfg = ARRAY_SIZE(ap4evb_lcdc_modes),
- .meram_cfg = &lcd_meram_cfg,
- }
-};
-
-static struct resource lcdc_resources[] = {
- [0] = {
- .name = "LCDC",
- .start = 0xfe940000, /* P4-only space */
- .end = 0xfe943fff,
- .flags = IORESOURCE_MEM,
- },
- [1] = {
- .start = intcs_evt2irq(0x580),
- .flags = IORESOURCE_IRQ,
- },
-};
-
-static struct platform_device lcdc_device = {
- .name = "sh_mobile_lcdc_fb",
- .num_resources = ARRAY_SIZE(lcdc_resources),
- .resource = lcdc_resources,
- .dev = {
- .platform_data = &lcdc_info,
- .coherent_dma_mask = ~0,
- },
-};
-
/*
* QHD display
*/
@@ -601,6 +525,8 @@ static struct resource mipidsi0_resources[] = {
},
};
+static struct sh_mobile_lcdc_info lcdc_info;
+
static struct sh_mipi_dsi_info mipidsi0_info = {
.data_format = MIPI_RGB888,
.lcd_chan = &lcdc_info.ch[0],
@@ -627,6 +553,86 @@ static struct platform_device *qhd_devices[] __initdata = {
};
#endif /* CONFIG_AP4EVB_QHD */
+/* LCDC0 */
+static const struct fb_videomode ap4evb_lcdc_modes[] = {
+ {
+#ifdef CONFIG_AP4EVB_QHD
+ .name = "R63302(QHD)",
+ .xres = 544,
+ .yres = 961,
+ .left_margin = 72,
+ .right_margin = 600,
+ .hsync_len = 16,
+ .upper_margin = 8,
+ .lower_margin = 8,
+ .vsync_len = 2,
+ .sync = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT,
+#else
+ .name = "WVGA Panel",
+ .xres = 800,
+ .yres = 480,
+ .left_margin = 220,
+ .right_margin = 110,
+ .hsync_len = 70,
+ .upper_margin = 20,
+ .lower_margin = 5,
+ .vsync_len = 5,
+ .sync = 0,
+#endif
+ },
+};
+static struct sh_mobile_meram_cfg lcd_meram_cfg = {
+ .icb[0] = {
+ .marker_icb = 28,
+ .cache_icb = 24,
+ .meram_offset = 0x0,
+ .meram_size = 0x40,
+ },
+ .icb[1] = {
+ .marker_icb = 29,
+ .cache_icb = 25,
+ .meram_offset = 0x40,
+ .meram_size = 0x40,
+ },
+};
+
+static struct sh_mobile_lcdc_info lcdc_info = {
+ .meram_dev = &meram_info,
+ .ch[0] = {
+ .chan = LCDC_CHAN_MAINLCD,
+ .fourcc = V4L2_PIX_FMT_RGB565,
+ .lcd_cfg = ap4evb_lcdc_modes,
+ .num_cfg = ARRAY_SIZE(ap4evb_lcdc_modes),
+ .meram_cfg = &lcd_meram_cfg,
+#ifdef CONFIG_AP4EVB_QHD
+ .tx_dev = &mipidsi0_device,
+#endif
+ }
+};
+
+static struct resource lcdc_resources[] = {
+ [0] = {
+ .name = "LCDC",
+ .start = 0xfe940000, /* P4-only space */
+ .end = 0xfe943fff,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = intcs_evt2irq(0x580),
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+static struct platform_device lcdc_device = {
+ .name = "sh_mobile_lcdc_fb",
+ .num_resources = ARRAY_SIZE(lcdc_resources),
+ .resource = lcdc_resources,
+ .dev = {
+ .platform_data = &lcdc_info,
+ .coherent_dma_mask = ~0,
+ },
+};
+
/* FSI */
#define IRQ_FSI evt2irq(0x1840)
static int __fsi_set_rate(struct clk *clk, long rate, int enable)
@@ -793,6 +799,62 @@ static struct platform_device fsi_device = {
static struct platform_device fsi_ak4643_device = {
.name = "sh_fsi2_a_ak4643",
};
+
+/* LCDC1 */
+static long ap4evb_clk_optimize(unsigned long target, unsigned long *best_freq,
+ unsigned long *parent_freq);
+
+static struct sh_mobile_lcdc_info sh_mobile_lcdc1_info;
+
+static struct sh_mobile_hdmi_info hdmi_info = {
+ .lcd_chan = &sh_mobile_lcdc1_info.ch[0],
+ .flags = HDMI_SND_SRC_SPDIF,
+ .clk_optimize_parent = ap4evb_clk_optimize,
+};
+
+static struct resource hdmi_resources[] = {
+ [0] = {
+ .name = "HDMI",
+ .start = 0xe6be0000,
+ .end = 0xe6be00ff,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ /* There's also an HDMI interrupt on INTCS @ 0x18e0 */
+ .start = evt2irq(0x17e0),
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+static struct platform_device hdmi_device = {
+ .name = "sh-mobile-hdmi",
+ .num_resources = ARRAY_SIZE(hdmi_resources),
+ .resource = hdmi_resources,
+ .id = -1,
+ .dev = {
+ .platform_data = &hdmi_info,
+ },
+};
+
+static long ap4evb_clk_optimize(unsigned long target, unsigned long *best_freq,
+ unsigned long *parent_freq)
+{
+ struct clk *hdmi_ick = clk_get(&hdmi_device.dev, "ick");
+ long error;
+
+ if (IS_ERR(hdmi_ick)) {
+ int ret = PTR_ERR(hdmi_ick);
+ pr_err("Cannot get HDMI ICK: %d\n", ret);
+ return ret;
+ }
+
+ error = clk_round_parent(hdmi_ick, target, best_freq, parent_freq, 1, 64);
+
+ clk_put(hdmi_ick);
+
+ return error;
+}
+
static struct sh_mobile_meram_cfg hdmi_meram_cfg = {
.icb[0] = {
.marker_icb = 30,
@@ -818,6 +880,7 @@ static struct sh_mobile_lcdc_info sh_mobile_lcdc1_info = {
.clock_divider = 1,
.flags = LCDC_FLAGS_DWPOL,
.meram_cfg = &hdmi_meram_cfg,
+ .tx_dev = &hdmi_device,
}
};
@@ -845,63 +908,10 @@ static struct platform_device lcdc1_device = {
},
};
-static long ap4evb_clk_optimize(unsigned long target, unsigned long *best_freq,
- unsigned long *parent_freq);
-
-
-static struct sh_mobile_hdmi_info hdmi_info = {
- .lcd_chan = &sh_mobile_lcdc1_info.ch[0],
- .flags = HDMI_SND_SRC_SPDIF,
- .clk_optimize_parent = ap4evb_clk_optimize,
-};
-
-static struct resource hdmi_resources[] = {
- [0] = {
- .name = "HDMI",
- .start = 0xe6be0000,
- .end = 0xe6be00ff,
- .flags = IORESOURCE_MEM,
- },
- [1] = {
- /* There's also an HDMI interrupt on INTCS @ 0x18e0 */
- .start = evt2irq(0x17e0),
- .flags = IORESOURCE_IRQ,
- },
-};
-
-static struct platform_device hdmi_device = {
- .name = "sh-mobile-hdmi",
- .num_resources = ARRAY_SIZE(hdmi_resources),
- .resource = hdmi_resources,
- .id = -1,
- .dev = {
- .platform_data = &hdmi_info,
- },
-};
-
static struct platform_device fsi_hdmi_device = {
.name = "sh_fsi2_b_hdmi",
};
-static long ap4evb_clk_optimize(unsigned long target, unsigned long *best_freq,
- unsigned long *parent_freq)
-{
- struct clk *hdmi_ick = clk_get(&hdmi_device.dev, "ick");
- long error;
-
- if (IS_ERR(hdmi_ick)) {
- int ret = PTR_ERR(hdmi_ick);
- pr_err("Cannot get HDMI ICK: %d\n", ret);
- return ret;
- }
-
- error = clk_round_parent(hdmi_ick, target, best_freq, parent_freq, 1, 64);
-
- clk_put(hdmi_ick);
-
- return error;
-}
-
static struct gpio_led ap4evb_leds[] = {
{
.name = "led4",
@@ -1036,9 +1046,9 @@ static struct platform_device *ap4evb_devices[] __initdata = {
&fsi_ak4643_device,
&fsi_hdmi_device,
&sh_mmcif_device,
- &lcdc1_device,
- &lcdc_device,
&hdmi_device,
+ &lcdc_device,
+ &lcdc1_device,
&ceu_device,
&ap4evb_camera,
&meram_device,
diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c
index 4ed0138..ccdd9fc 100644
--- a/arch/arm/mach-shmobile/board-mackerel.c
+++ b/arch/arm/mach-shmobile/board-mackerel.c
@@ -431,6 +431,38 @@ static struct platform_device lcdc_device = {
},
};
+/* HDMI */
+static struct sh_mobile_lcdc_info hdmi_lcdc_info;
+
+static struct sh_mobile_hdmi_info hdmi_info = {
+ .lcd_chan = &hdmi_lcdc_info.ch[0],
+ .flags = HDMI_SND_SRC_SPDIF,
+};
+
+static struct resource hdmi_resources[] = {
+ [0] = {
+ .name = "HDMI",
+ .start = 0xe6be0000,
+ .end = 0xe6be00ff,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ /* There's also an HDMI interrupt on INTCS @ 0x18e0 */
+ .start = evt2irq(0x17e0),
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+static struct platform_device hdmi_device = {
+ .name = "sh-mobile-hdmi",
+ .num_resources = ARRAY_SIZE(hdmi_resources),
+ .resource = hdmi_resources,
+ .id = -1,
+ .dev = {
+ .platform_data = &hdmi_info,
+ },
+};
+
static struct sh_mobile_meram_cfg hdmi_meram_cfg = {
.icb[0] = {
.marker_icb = 30,
@@ -445,7 +477,7 @@ static struct sh_mobile_meram_cfg hdmi_meram_cfg = {
.meram_size = 0x100,
},
};
-/* HDMI */
+
static struct sh_mobile_lcdc_info hdmi_lcdc_info = {
.meram_dev = &mackerel_meram_info,
.clock_source = LCDC_CLK_EXTERNAL,
@@ -456,6 +488,7 @@ static struct sh_mobile_lcdc_info hdmi_lcdc_info = {
.clock_divider = 1,
.flags = LCDC_FLAGS_DWPOL,
.meram_cfg = &hdmi_meram_cfg,
+ .tx_dev = &hdmi_device,
}
};
@@ -483,35 +516,6 @@ static struct platform_device hdmi_lcdc_device = {
},
};
-static struct sh_mobile_hdmi_info hdmi_info = {
- .lcd_chan = &hdmi_lcdc_info.ch[0],
- .flags = HDMI_SND_SRC_SPDIF,
-};
-
-static struct resource hdmi_resources[] = {
- [0] = {
- .name = "HDMI",
- .start = 0xe6be0000,
- .end = 0xe6be00ff,
- .flags = IORESOURCE_MEM,
- },
- [1] = {
- /* There's also an HDMI interrupt on INTCS @ 0x18e0 */
- .start = evt2irq(0x17e0),
- .flags = IORESOURCE_IRQ,
- },
-};
-
-static struct platform_device hdmi_device = {
- .name = "sh-mobile-hdmi",
- .num_resources = ARRAY_SIZE(hdmi_resources),
- .resource = hdmi_resources,
- .id = -1,
- .dev = {
- .platform_data = &hdmi_info,
- },
-};
-
static struct platform_device fsi_hdmi_device = {
.name = "sh_fsi2_b_hdmi",
};
@@ -1313,8 +1317,8 @@ static struct platform_device *mackerel_devices[] __initdata = {
&sh_mmcif_device,
&ceu_device,
&mackerel_camera,
- &hdmi_lcdc_device,
&hdmi_device,
+ &hdmi_lcdc_device,
&meram_device,
};
--
1.7.3.4
^ permalink raw reply related
* [PATCH 13/57] fbdev: sh_mipi_dsi: Don't hook up into board_cfg display operations
From: Laurent Pinchart @ 2011-12-13 14:02 UTC (permalink / raw)
To: linux-fbdev
The display_on/off operations are now accessed through the
sh_mobile_lcdc_entity operations.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
drivers/video/sh_mipi_dsi.c | 56 ++++---------------------------------------
1 files changed, 5 insertions(+), 51 deletions(-)
diff --git a/drivers/video/sh_mipi_dsi.c b/drivers/video/sh_mipi_dsi.c
index 58744fe..ad09a05 100644
--- a/drivers/video/sh_mipi_dsi.c
+++ b/drivers/video/sh_mipi_dsi.c
@@ -58,10 +58,6 @@ struct sh_mipi {
void __iomem *linkbase;
struct clk *dsit_clk;
struct platform_device *pdev;
-
- void *next_board_data;
- void (*next_display_on)(void *board_data, struct fb_info *info);
- void (*next_display_off)(void *board_data);
};
#define to_sh_mipi(e) container_of(e, struct sh_mipi, entity)
@@ -398,8 +394,8 @@ static int __init sh_mipi_setup(struct sh_mipi *mipi,
return 0;
}
-static int __mipi_display_on(struct sh_mobile_lcdc_entity *entity,
- struct fb_info *info)
+static int mipi_display_on(struct sh_mobile_lcdc_entity *entity,
+ struct fb_info *info)
{
struct sh_mipi *mipi = to_sh_mipi(entity);
struct sh_mipi_dsi_info *pdata = mipi->pdev->dev.platform_data;
@@ -427,21 +423,7 @@ mipi_display_on_fail2:
return ret;
}
-static void mipi_display_on(void *arg, struct fb_info *info)
-{
- struct sh_mobile_lcdc_entity *entity = arg;
- struct sh_mipi *mipi = to_sh_mipi(entity);
- int ret;
-
- ret = __mipi_display_on(entity, info);
- if (ret < 0)
- return;
-
- if (mipi->next_display_on)
- mipi->next_display_on(mipi->next_board_data, info);
-}
-
-static void __mipi_display_off(struct sh_mobile_lcdc_entity *entity)
+static void mipi_display_off(struct sh_mobile_lcdc_entity *entity)
{
struct sh_mipi *mipi = to_sh_mipi(entity);
struct sh_mipi_dsi_info *pdata = mipi->pdev->dev.platform_data;
@@ -453,20 +435,9 @@ static void __mipi_display_off(struct sh_mobile_lcdc_entity *entity)
pm_runtime_put_sync(&mipi->pdev->dev);
}
-static void mipi_display_off(void *arg)
-{
- struct sh_mobile_lcdc_entity *entity = arg;
- struct sh_mipi *mipi = to_sh_mipi(entity);
-
- if (mipi->next_display_off)
- mipi->next_display_off(mipi->next_board_data);
-
- __mipi_display_off(entity);
-}
-
static const struct sh_mobile_lcdc_entity_ops mipi_ops = {
- .display_on = __mipi_display_on,
- .display_off = __mipi_display_off,
+ .display_on = mipi_display_on,
+ .display_off = mipi_display_off,
};
static int __init sh_mipi_probe(struct platform_device *pdev)
@@ -559,17 +530,6 @@ static int __init sh_mipi_probe(struct platform_device *pdev)
mutex_unlock(&array_lock);
platform_set_drvdata(pdev, &mipi->entity);
- /* Save original LCDC callbacks */
- mipi->next_board_data = pdata->lcd_chan->board_cfg.board_data;
- mipi->next_display_on = pdata->lcd_chan->board_cfg.display_on;
- mipi->next_display_off = pdata->lcd_chan->board_cfg.display_off;
-
- /* Set up LCDC callbacks */
- pdata->lcd_chan->board_cfg.board_data = &mipi->entity;
- pdata->lcd_chan->board_cfg.display_on = mipi_display_on;
- pdata->lcd_chan->board_cfg.display_off = mipi_display_off;
- pdata->lcd_chan->board_cfg.owner = THIS_MODULE;
-
return 0;
eclkton:
@@ -594,7 +554,6 @@ efindslot:
static int __exit sh_mipi_remove(struct platform_device *pdev)
{
- struct sh_mipi_dsi_info *pdata = pdev->dev.platform_data;
struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
struct resource *res2 = platform_get_resource(pdev, IORESOURCE_MEM, 1);
struct sh_mipi *mipi = to_sh_mipi(platform_get_drvdata(pdev));
@@ -617,11 +576,6 @@ static int __exit sh_mipi_remove(struct platform_device *pdev)
if (ret < 0)
return ret;
- pdata->lcd_chan->board_cfg.owner = NULL;
- pdata->lcd_chan->board_cfg.display_on = NULL;
- pdata->lcd_chan->board_cfg.display_off = NULL;
- pdata->lcd_chan->board_cfg.board_data = NULL;
-
pm_runtime_disable(&pdev->dev);
clk_disable(mipi->dsit_clk);
clk_put(mipi->dsit_clk);
--
1.7.3.4
^ permalink raw reply related
* [PATCH 14/57] fbdev: sh_mobile_hdmi: Don't hook up into board_cfg display operations
From: Laurent Pinchart @ 2011-12-13 14:02 UTC (permalink / raw)
To: linux-fbdev
The display_on/off operations are now accessed through the
sh_mobile_lcdc_entity operations.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
drivers/video/sh_mobile_hdmi.c | 37 ++++++-------------------------------
1 files changed, 6 insertions(+), 31 deletions(-)
diff --git a/drivers/video/sh_mobile_hdmi.c b/drivers/video/sh_mobile_hdmi.c
index f961fa2..1e78100 100644
--- a/drivers/video/sh_mobile_hdmi.c
+++ b/drivers/video/sh_mobile_hdmi.c
@@ -1004,8 +1004,8 @@ static irqreturn_t sh_hdmi_hotplug(int irq, void *dev_id)
}
/* locking: called with info->lock held, or before register_framebuffer() */
-static int __sh_hdmi_display_on(struct sh_mobile_lcdc_entity *entity,
- struct fb_info *info)
+static int sh_hdmi_display_on(struct sh_mobile_lcdc_entity *entity,
+ struct fb_info *info)
{
/*
* info is guaranteed to be valid, when we are called, because our
@@ -1040,13 +1040,8 @@ static int __sh_hdmi_display_on(struct sh_mobile_lcdc_entity *entity,
return 0;
}
-static void sh_hdmi_display_on(void *arg, struct fb_info *info)
-{
- __sh_hdmi_display_on(arg, info);
-}
-
/* locking: called with info->lock held */
-static void __sh_hdmi_display_off(struct sh_mobile_lcdc_entity *entity)
+static void sh_hdmi_display_off(struct sh_mobile_lcdc_entity *entity)
{
struct sh_hdmi *hdmi = entity_to_sh_hdmi(entity);
@@ -1055,14 +1050,9 @@ static void __sh_hdmi_display_off(struct sh_mobile_lcdc_entity *entity)
hdmi_write(hdmi, 0x10, HDMI_SYSTEM_CTRL);
}
-static void sh_hdmi_display_off(void *arg)
-{
- __sh_hdmi_display_off(arg);
-}
-
static const struct sh_mobile_lcdc_entity_ops sh_hdmi_ops = {
- .display_on = __sh_hdmi_display_on,
- .display_off = __sh_hdmi_display_off,
+ .display_on = sh_hdmi_display_on,
+ .display_off = sh_hdmi_display_off,
};
static bool sh_hdmi_must_reconfigure(struct sh_hdmi *hdmi)
@@ -1178,7 +1168,7 @@ static void sh_hdmi_edid_work_fn(struct work_struct *work)
*/
info->var.width = hdmi->var.width;
info->var.height = hdmi->var.height;
- __sh_hdmi_display_on(&hdmi->entity, info);
+ sh_hdmi_display_on(&hdmi->entity, info);
} else {
/* New monitor or have to wake up */
fb_set_suspend(info, 0);
@@ -1255,7 +1245,6 @@ static int __init sh_hdmi_probe(struct platform_device *pdev)
{
struct sh_mobile_hdmi_info *pdata = pdev->dev.platform_data;
struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- struct sh_mobile_lcdc_board_cfg *board_cfg;
int irq = platform_get_irq(pdev, 0), ret;
struct sh_hdmi *hdmi;
long rate;
@@ -1315,13 +1304,6 @@ static int __init sh_hdmi_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, &hdmi->entity);
- /* Set up LCDC callbacks */
- board_cfg = &pdata->lcd_chan->board_cfg;
- board_cfg->owner = THIS_MODULE;
- board_cfg->board_data = &hdmi->entity;
- board_cfg->display_on = sh_hdmi_display_on;
- board_cfg->display_off = sh_hdmi_display_off;
-
INIT_DELAYED_WORK(&hdmi->edid_work, sh_hdmi_edid_work_fn);
pm_runtime_enable(&pdev->dev);
@@ -1371,21 +1353,14 @@ egetclk:
static int __exit sh_hdmi_remove(struct platform_device *pdev)
{
- struct sh_mobile_hdmi_info *pdata = pdev->dev.platform_data;
struct sh_hdmi *hdmi = entity_to_sh_hdmi(platform_get_drvdata(pdev));
struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- struct sh_mobile_lcdc_board_cfg *board_cfg = &pdata->lcd_chan->board_cfg;
int irq = platform_get_irq(pdev, 0);
snd_soc_unregister_codec(&pdev->dev);
fb_unregister_client(&hdmi->notifier);
- board_cfg->display_on = NULL;
- board_cfg->display_off = NULL;
- board_cfg->board_data = NULL;
- board_cfg->owner = NULL;
-
/* No new work will be scheduled, wait for running ISR */
free_irq(irq, hdmi);
/* Wait for already scheduled work */
--
1.7.3.4
^ permalink raw reply related
* [PATCH 15/57] arm: mach-shmobile: Don't initialize the hdmi_info lcd_chan field
From: Laurent Pinchart @ 2011-12-13 14:02 UTC (permalink / raw)
To: linux-fbdev
The field is unused and will be removed. Don't initialize it.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
arch/arm/mach-shmobile/board-ap4evb.c | 3 ---
arch/arm/mach-shmobile/board-mackerel.c | 3 ---
2 files changed, 0 insertions(+), 6 deletions(-)
diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c
index e0a6b3d..92bb59e 100644
--- a/arch/arm/mach-shmobile/board-ap4evb.c
+++ b/arch/arm/mach-shmobile/board-ap4evb.c
@@ -804,10 +804,7 @@ static struct platform_device fsi_ak4643_device = {
static long ap4evb_clk_optimize(unsigned long target, unsigned long *best_freq,
unsigned long *parent_freq);
-static struct sh_mobile_lcdc_info sh_mobile_lcdc1_info;
-
static struct sh_mobile_hdmi_info hdmi_info = {
- .lcd_chan = &sh_mobile_lcdc1_info.ch[0],
.flags = HDMI_SND_SRC_SPDIF,
.clk_optimize_parent = ap4evb_clk_optimize,
};
diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c
index ccdd9fc..5d3be90 100644
--- a/arch/arm/mach-shmobile/board-mackerel.c
+++ b/arch/arm/mach-shmobile/board-mackerel.c
@@ -432,10 +432,7 @@ static struct platform_device lcdc_device = {
};
/* HDMI */
-static struct sh_mobile_lcdc_info hdmi_lcdc_info;
-
static struct sh_mobile_hdmi_info hdmi_info = {
- .lcd_chan = &hdmi_lcdc_info.ch[0],
.flags = HDMI_SND_SRC_SPDIF,
};
--
1.7.3.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