* Re: [PATCH 16/21] OMAPDSS: handle output-driver reg/unreg more dynamically
From: Archit Taneja @ 2012-03-08 9:34 UTC (permalink / raw)
To: Tomi Valkeinen; +Cc: linux-omap, linux-fbdev
In-Reply-To: <1331196364.2354.49.camel@deskari>
On Thursday 08 March 2012 02:16 PM, Tomi Valkeinen wrote:
> On Thu, 2012-03-08 at 14:04 +0530, Archit Taneja wrote:
>> On Wednesday 07 March 2012 06:14 PM, Tomi Valkeinen wrote:
>
>>> - r = hdmi_init_platform_driver();
>>> - if (r) {
>>> - DSSERR("Failed to initialize hdmi\n");
>>> - goto err_hdmi;
>>> + /*
>>> + * It's ok if the output-driver register fails. It happens, for example,
>>> + * when there is no output-device (e.g. SDI for OMAP4).
>>> + */
>>
>> Suppose we do a omap2plus_defconfig, CONFIG_OMAP2_DSS_SDI would be
>> selected, and sdi.c would be built, if we boot on OMAP4, why would a sdi
>> driver register cause a failure? Wouldn't the sdi driver just get
>> registered, and wait till eternity for the corresponding sdi platform
>> device to get registered?
>
> No. Well, yes.
>
> Currently we use platform_driver_register() to register the drivers, and
> it does just what you described. But a few patches later I change
> platform_driver_register() to platform_driver_probe(), which will return
> ENODEV if there are no matching devices for the driver.
>
> I originally had the platform_driver_probe() patch before this patch,
> and thus the comment above made sense. Now the patch is after this
> patch, so the comment is not exactly right until the probe patch is also
> applied.
Oh okay. But the comment after the patch set still says "It's ok if the
output-driver register fails.", we could change it to "It's ok if the
output-driver probe fails."
>
> The point with platform_driver_probe() is that it can be used with
> non-removable devices which are created at boot time, like the DSS
> components. With platform_driver_probe() the probe function is called
> only at that one time, and never afterwards. So probe can be in __init
> section, and thrown away after init.
So platform_driver_probe() is like a driver_register() + probe().
Okay, in our case, all the devices are created at boot time, and if
omapdss were a module, the probes would have been thrown away after
module_init(), right?
>
> One side effect of using platform_driver_probe() is that it returns
> ENODEV is there are no devices. In a simple module, the error can be
> then returned from module_init, thus causing the whole module to be
> unloaded. Our case is a bit more complex as we have multiple drivers in
> the same module.
>
> A downside with that is that we don't really know if the ENODEV error
> happened because there were no devices (which is ok), or if it came from
> probe function (which is not so ok). However, I thought that it doesn't
> matter if an output driver has failed. We can still continue with the
> other output drivers just fine.
If we ensure that none of our probes return ENODEV(even though it may
make sense to return it if a func within probe fails), we could
differentiate between the 2 cases, right?
>
> Actually, there is a small problem. If, for example, DSI driver fails to
> load, and DPI driver tries to use DSI PLL...
If we could differentiate between an error occuring because the device
doesn't exist and an error occuring because the probe failed, we could
bail out if any of the probes fail, right?
Archit
>
> Tomi
>
^ permalink raw reply
* Re: [RFC PATCH] video:backlight: add dimming sysfs node
From: Lars-Peter Clausen @ 2012-03-08 9:25 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <4F58573C.3020407@samsung.com>
On 03/08/2012 07:52 AM, Donghwa Lee wrote:
> In backlight class, update_status() callback function is mostly used to change
> backlight brightness. When platform enter the dimming state, it is usually used.
> But, I think dimming state can be defined variety of method including brightness.
> So, it is need to differentiated node from brightness node.
What do you mean by dimming? Completely blank the display or just lower the
brightness to a certain level > 0? In the former case the bl_power sysfs
node already exposes such functionality. In the later case can you give an
example how this will be used and how a typical driver would implement this
functionality?
>
> In set_dimming() callback function, developers can define variety dimming functions.
>
> Signed-off-by: Donghwa Lee <dh09.lee@samsung.com>
> Signed-off-by: Inki Dae <inki.dae@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> ---
> drivers/video/backlight/backlight.c | 37 +++++++++++++++++++++++++++++++++++
> include/linux/backlight.h | 9 ++++++++
> 2 files changed, 46 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c
> index bf5b1ec..44a77e4 100644
> --- a/drivers/video/backlight/backlight.c
> +++ b/drivers/video/backlight/backlight.c
> @@ -101,6 +101,43 @@ static void backlight_generate_event(struct backlight_device *bd,
> sysfs_notify(&bd->dev.kobj, NULL, "actual_brightness");
> }
>
> +static ssize_t backlight_store_dimming(struct device *dev,
> + struct device_attribute *attr, const char *buf, size_t count)
> +{
> + int rc;
> + struct backlight_device *bd = to_backlight_device(dev);
> + unsigned long dimming;
> +
> + rc = strict_strtoul(buf, 0, &dimming);
> + if (rc)
> + return rc;
> +
> + if (dimming < 0)
> + rc = -EINVAL;
> + else {
> + pr_debug("set dimming mode\n");
> +
> + if (dimming)
> + bd->props.dimming = true;
> + else
> + bd->props.dimming = false;
> +
> + backlight_set_dimming(bd);
> +
> + rc = count;
> + }
> +
> + return rc;
> +}
> +
> +static ssize_t backlight_show_dimming(struct device *dev,
> + struct device_attribute *attr,char *buf)
> +{
> + struct backlight_device *bd = to_backlight_device(dev);
> +
> + return sprintf(buf, "%d\n", bd->props.dimming);
> +}
> +
> static ssize_t backlight_show_power(struct device *dev,
> struct device_attribute *attr, char *buf)
> {
> diff --git a/include/linux/backlight.h b/include/linux/backlight.h
> index 5ffc6dd..823717e 100644
> --- a/include/linux/backlight.h
> +++ b/include/linux/backlight.h
> @@ -55,10 +55,13 @@ struct backlight_ops {
> /* Check if given framebuffer device is the one bound to this backlight;
> return 0 if not, !=0 if it is. If NULL, backlight always matches the fb. */
> int (*check_fb)(struct backlight_device *, struct fb_info *);
> + /* Notify the backlight driver to enter the dimming state */
> + int (*set_dimming)(struct backlight_device *);
> };
>
> /* This structure defines all the properties of a backlight */
> struct backlight_properties {
> + bool dimming;
> /* Current User requested brightness (0 - max_brightness) */
> int brightness;
> /* Maximal value for brightness (read-only) */
> @@ -111,6 +114,12 @@ static inline void backlight_update_status(struct backlight_device *bd)
> mutex_unlock(&bd->update_lock);
> }
>
> +static inline void backlight_set_dimming(struct backlight_device *bd)
> +{
> + if (bd->ops && bd->ops->set_dimming)
> + bd->ops->set_dimming(bd);
> +}
> +
> extern struct backlight_device *backlight_device_register(const char *name,
> struct device *dev, void *devdata, const struct backlight_ops *ops,
> const struct backlight_properties *props);
^ permalink raw reply
* Re: [PATCH 08/21] OMAPDSS: clean up the omapdss platform data mess
From: Archit Taneja @ 2012-03-08 8:55 UTC (permalink / raw)
To: Tomi Valkeinen; +Cc: linux-omap, linux-fbdev
In-Reply-To: <1331195632.2354.37.camel@deskari>
On Thursday 08 March 2012 02:03 PM, Tomi Valkeinen wrote:
> On Thu, 2012-03-08 at 13:47 +0530, Archit Taneja wrote:
>> On Thursday 08 March 2012 01:32 PM, Tomi Valkeinen wrote:
>
>>>> why do we check board_data being NULL here and not in omap_display_init()?
>>>
>>> I added it for DT case, because then we don't have board_data for the
>>> devices defined in the DT data. However, for now we always have the
>>> board_data, and in this patch I should just move the code. So I'll
>>> remove the check, and add it later with DT code if needed.
>>
>> Ok. When DT will be in use, would omap_display_init() be called or not?
>
> No. Currently the board files create and fill the board_data, and then
> call omap_display_init.
>
> With DT, the DT data will contain all the dynamic, per-board
> information. Something like:
>
> dss {
> dpi {
> dvi {
> pd-gpio =<10>;
> ...
> };
> };
>
> dsi@1 {
> taal {
> reset-gpio =<20>;
> ...
> };
> }
>
> ...
> };
>
> The DT data will be passed individually to each dss driver (i.e. dsi
> driver will get its DT node, etc.). The drivers will read the data, and
> initialize themselves with that, more or less the same manner they'd do
> with the board_data from board files.
>
> However, we currently have this "omapdss" device, which is not a hwmod
> device at all. In the long run I think the omapdss device should be
> removed, but for now we need it. And device has to be created in the
> arch code, the same way it's now created in omap_display_init().
>
> So with DT we need a new func, omap_display_init_dt() or such, which
> creates the omapdss device, and also creates a board_data which contains
> the ctx_loss etc function pointers. But the board data won't have any
> display data, those come directly from DT data.
>
> It's a bit messy solution, but it should allow us to have both DT and
> non-DT working at the same time, with quite minimal changes to the board
> files.
Okay, thanks for the clarification.
Archit
>
> Tomi
>
^ permalink raw reply
* Re: [PATCH 16/21] OMAPDSS: handle output-driver reg/unreg more dynamically
From: Archit Taneja @ 2012-03-08 8:46 UTC (permalink / raw)
To: Tomi Valkeinen; +Cc: linux-omap, linux-fbdev
In-Reply-To: <1331124290-6285-17-git-send-email-tomi.valkeinen@ti.com>
On Wednesday 07 March 2012 06:14 PM, Tomi Valkeinen wrote:
> Initialize and uninitialize the output drivers by using arrays of
> pointers to the init/uninit functions. This simplifies the code
> slightly.
>
> Signed-off-by: Tomi Valkeinen<tomi.valkeinen@ti.com>
> ---
> drivers/video/omap2/dss/core.c | 111 +++++++++++++++++++++-------------------
> drivers/video/omap2/dss/dss.h | 41 ---------------
> 2 files changed, 59 insertions(+), 93 deletions(-)
>
> diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
> index 654962a..ac4f2cb 100644
> --- a/drivers/video/omap2/dss/core.c
> +++ b/drivers/video/omap2/dss/core.c
> @@ -503,10 +503,54 @@ static int omap_dss_bus_register(void)
> }
>
> /* INIT */
> +static int (*dss_output_drv_reg_funcs[])(void) __initdata = {
> +#ifdef CONFIG_OMAP2_DSS_DPI
> + dpi_init_platform_driver,
> +#endif
> +#ifdef CONFIG_OMAP2_DSS_SDI
> + sdi_init_platform_driver,
> +#endif
> +#ifdef CONFIG_OMAP2_DSS_RFBI
> + rfbi_init_platform_driver,
> +#endif
> +#ifdef CONFIG_OMAP2_DSS_VENC
> + venc_init_platform_driver,
> +#endif
> +#ifdef CONFIG_OMAP2_DSS_DSI
> + dsi_init_platform_driver,
> +#endif
> +#ifdef CONFIG_OMAP4_DSS_HDMI
> + hdmi_init_platform_driver,
> +#endif
> +};
> +
> +static void (*dss_output_drv_unreg_funcs[])(void) __exitdata = {
> +#ifdef CONFIG_OMAP2_DSS_DPI
> + dpi_uninit_platform_driver,
> +#endif
> +#ifdef CONFIG_OMAP2_DSS_SDI
> + sdi_uninit_platform_driver,
> +#endif
> +#ifdef CONFIG_OMAP2_DSS_RFBI
> + rfbi_uninit_platform_driver,
> +#endif
> +#ifdef CONFIG_OMAP2_DSS_VENC
> + venc_uninit_platform_driver,
> +#endif
> +#ifdef CONFIG_OMAP2_DSS_DSI
> + dsi_uninit_platform_driver,
> +#endif
> +#ifdef CONFIG_OMAP4_DSS_HDMI
> + hdmi_uninit_platform_driver,
> +#endif
> +};
> +
> +static bool dss_output_drv_loaded[ARRAY_SIZE(dss_output_drv_reg_funcs)];
>
> static int __init omap_dss_register_drivers(void)
> {
> int r;
> + int i;
>
> r = platform_driver_probe(&omap_dss_driver, omap_dss_probe);
> if (r)
> @@ -524,56 +568,18 @@ static int __init omap_dss_register_drivers(void)
> goto err_dispc;
> }
>
> - r = dpi_init_platform_driver();
> - if (r) {
> - DSSERR("Failed to initialize dpi platform driver\n");
> - goto err_dpi;
> - }
> -
> - r = sdi_init_platform_driver();
> - if (r) {
> - DSSERR("Failed to initialize sdi platform driver\n");
> - goto err_sdi;
> - }
> -
> - r = rfbi_init_platform_driver();
> - if (r) {
> - DSSERR("Failed to initialize rfbi platform driver\n");
> - goto err_rfbi;
> - }
> -
> - r = venc_init_platform_driver();
> - if (r) {
> - DSSERR("Failed to initialize venc platform driver\n");
> - goto err_venc;
> - }
> -
> - r = dsi_init_platform_driver();
> - if (r) {
> - DSSERR("Failed to initialize DSI platform driver\n");
> - goto err_dsi;
> - }
> -
> - r = hdmi_init_platform_driver();
> - if (r) {
> - DSSERR("Failed to initialize hdmi\n");
> - goto err_hdmi;
> + /*
> + * It's ok if the output-driver register fails. It happens, for example,
> + * when there is no output-device (e.g. SDI for OMAP4).
> + */
Suppose we do a omap2plus_defconfig, CONFIG_OMAP2_DSS_SDI would be
selected, and sdi.c would be built, if we boot on OMAP4, why would a sdi
driver register cause a failure? Wouldn't the sdi driver just get
registered, and wait till eternity for the corresponding sdi platform
device to get registered?
Archit
> + for (i = 0; i< ARRAY_SIZE(dss_output_drv_reg_funcs); ++i) {
> + r = dss_output_drv_reg_funcs[i]();
> + if (r = 0)
> + dss_output_drv_loaded[i] = true;
> }
>
> return 0;
>
> -err_hdmi:
> - dsi_uninit_platform_driver();
> -err_dsi:
> - venc_uninit_platform_driver();
> -err_venc:
> - rfbi_uninit_platform_driver();
> -err_rfbi:
> - sdi_uninit_platform_driver();
> -err_sdi:
> - dpi_uninit_platform_driver();
> -err_dpi:
> - dispc_uninit_platform_driver();
> err_dispc:
> dss_uninit_platform_driver();
> err_dss:
> @@ -584,12 +590,13 @@ err_dss:
>
> static void __exit omap_dss_unregister_drivers(void)
> {
> - hdmi_uninit_platform_driver();
> - dsi_uninit_platform_driver();
> - venc_uninit_platform_driver();
> - rfbi_uninit_platform_driver();
> - sdi_uninit_platform_driver();
> - dpi_uninit_platform_driver();
> + int i;
> +
> + for (i = 0; i< ARRAY_SIZE(dss_output_drv_unreg_funcs); ++i) {
> + if (dss_output_drv_loaded[i])
> + dss_output_drv_unreg_funcs[i]();
> + }
> +
> dispc_uninit_platform_driver();
> dss_uninit_platform_driver();
>
> diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
> index 24aadde..af7bed1 100644
> --- a/drivers/video/omap2/dss/dss.h
> +++ b/drivers/video/omap2/dss/dss.h
> @@ -265,14 +265,9 @@ int dss_calc_clock_div(bool is_tft, unsigned long req_pck,
> struct dispc_clock_info *dispc_cinfo);
>
> /* SDI */
> -#ifdef CONFIG_OMAP2_DSS_SDI
> int sdi_init_platform_driver(void);
> void sdi_uninit_platform_driver(void);
> int sdi_init_display(struct omap_dss_device *display);
> -#else
> -static inline int sdi_init_platform_driver(void) { return 0; }
> -static inline void sdi_uninit_platform_driver(void) { }
> -#endif
>
> /* DSI */
> #ifdef CONFIG_OMAP2_DSS_DSI
> @@ -309,13 +304,6 @@ void dsi_wait_pll_hsdiv_dispc_active(struct platform_device *dsidev);
> void dsi_wait_pll_hsdiv_dsi_active(struct platform_device *dsidev);
> struct platform_device *dsi_get_dsidev_from_id(int module);
> #else
> -static inline int dsi_init_platform_driver(void)
> -{
> - return 0;
> -}
> -static inline void dsi_uninit_platform_driver(void)
> -{
> -}
> static inline int dsi_runtime_get(struct platform_device *dsidev)
> {
> return 0;
> @@ -372,14 +360,9 @@ static inline struct platform_device *dsi_get_dsidev_from_id(int module)
> #endif
>
> /* DPI */
> -#ifdef CONFIG_OMAP2_DSS_DPI
> int dpi_init_platform_driver(void);
> void dpi_uninit_platform_driver(void);
> int dpi_init_display(struct omap_dss_device *dssdev);
> -#else
> -static inline int dpi_init_platform_driver(void) { return 0; }
> -static inline void dpi_uninit_platform_driver(void) { }
> -#endif
>
> /* DISPC */
> int dispc_init_platform_driver(void);
> @@ -456,13 +439,6 @@ void venc_dump_regs(struct seq_file *s);
> int venc_init_display(struct omap_dss_device *display);
> unsigned long venc_get_pixel_clock(void);
> #else
> -static inline int venc_init_platform_driver(void)
> -{
> - return 0;
> -}
> -static inline void venc_uninit_platform_driver(void)
> -{
> -}
> static inline unsigned long venc_get_pixel_clock(void)
> {
> WARN("%s: VENC not compiled in, returning pclk as 0\n", __func__);
> @@ -482,13 +458,6 @@ static inline int hdmi_init_display(struct omap_dss_device *dssdev)
> {
> return 0;
> }
> -static inline int hdmi_init_platform_driver(void)
> -{
> - return 0;
> -}
> -static inline void hdmi_uninit_platform_driver(void)
> -{
> -}
> static inline unsigned long hdmi_get_pixel_clock(void)
> {
> WARN("%s: HDMI not compiled in, returning pclk as 0\n", __func__);
> @@ -506,20 +475,10 @@ int hdmi_panel_init(void);
> void hdmi_panel_exit(void);
>
> /* RFBI */
> -#ifdef CONFIG_OMAP2_DSS_RFBI
> int rfbi_init_platform_driver(void);
> void rfbi_uninit_platform_driver(void);
> void rfbi_dump_regs(struct seq_file *s);
> int rfbi_init_display(struct omap_dss_device *display);
> -#else
> -static inline int rfbi_init_platform_driver(void)
> -{
> - return 0;
> -}
> -static inline void rfbi_uninit_platform_driver(void)
> -{
> -}
> -#endif
>
>
> #ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS
^ permalink raw reply
* Re: [PATCH 16/21] OMAPDSS: handle output-driver reg/unreg more dynamically
From: Tomi Valkeinen @ 2012-03-08 8:46 UTC (permalink / raw)
To: Archit Taneja; +Cc: linux-omap, linux-fbdev
In-Reply-To: <4F586EFD.1020208@ti.com>
[-- Attachment #1: Type: text/plain, Size: 2330 bytes --]
On Thu, 2012-03-08 at 14:04 +0530, Archit Taneja wrote:
> On Wednesday 07 March 2012 06:14 PM, Tomi Valkeinen wrote:
> > - r = hdmi_init_platform_driver();
> > - if (r) {
> > - DSSERR("Failed to initialize hdmi\n");
> > - goto err_hdmi;
> > + /*
> > + * It's ok if the output-driver register fails. It happens, for example,
> > + * when there is no output-device (e.g. SDI for OMAP4).
> > + */
>
> Suppose we do a omap2plus_defconfig, CONFIG_OMAP2_DSS_SDI would be
> selected, and sdi.c would be built, if we boot on OMAP4, why would a sdi
> driver register cause a failure? Wouldn't the sdi driver just get
> registered, and wait till eternity for the corresponding sdi platform
> device to get registered?
No. Well, yes.
Currently we use platform_driver_register() to register the drivers, and
it does just what you described. But a few patches later I change
platform_driver_register() to platform_driver_probe(), which will return
ENODEV if there are no matching devices for the driver.
I originally had the platform_driver_probe() patch before this patch,
and thus the comment above made sense. Now the patch is after this
patch, so the comment is not exactly right until the probe patch is also
applied.
The point with platform_driver_probe() is that it can be used with
non-removable devices which are created at boot time, like the DSS
components. With platform_driver_probe() the probe function is called
only at that one time, and never afterwards. So probe can be in __init
section, and thrown away after init.
One side effect of using platform_driver_probe() is that it returns
ENODEV is there are no devices. In a simple module, the error can be
then returned from module_init, thus causing the whole module to be
unloaded. Our case is a bit more complex as we have multiple drivers in
the same module.
A downside with that is that we don't really know if the ENODEV error
happened because there were no devices (which is ok), or if it came from
probe function (which is not so ok). However, I thought that it doesn't
matter if an output driver has failed. We can still continue with the
other output drivers just fine.
Actually, there is a small problem. If, for example, DSI driver fails to
load, and DPI driver tries to use DSI PLL...
Tomi
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply
* Re: [PATCH 08/21] OMAPDSS: clean up the omapdss platform data mess
From: Tomi Valkeinen @ 2012-03-08 8:33 UTC (permalink / raw)
To: Archit Taneja; +Cc: linux-omap, linux-fbdev
In-Reply-To: <4F586B28.1050403@ti.com>
[-- Attachment #1: Type: text/plain, Size: 1870 bytes --]
On Thu, 2012-03-08 at 13:47 +0530, Archit Taneja wrote:
> On Thursday 08 March 2012 01:32 PM, Tomi Valkeinen wrote:
> >> why do we check board_data being NULL here and not in omap_display_init()?
> >
> > I added it for DT case, because then we don't have board_data for the
> > devices defined in the DT data. However, for now we always have the
> > board_data, and in this patch I should just move the code. So I'll
> > remove the check, and add it later with DT code if needed.
>
> Ok. When DT will be in use, would omap_display_init() be called or not?
No. Currently the board files create and fill the board_data, and then
call omap_display_init.
With DT, the DT data will contain all the dynamic, per-board
information. Something like:
dss {
dpi {
dvi {
pd-gpio = <10>;
...
};
};
dsi@1 {
taal {
reset-gpio = <20>;
...
};
}
...
};
The DT data will be passed individually to each dss driver (i.e. dsi
driver will get its DT node, etc.). The drivers will read the data, and
initialize themselves with that, more or less the same manner they'd do
with the board_data from board files.
However, we currently have this "omapdss" device, which is not a hwmod
device at all. In the long run I think the omapdss device should be
removed, but for now we need it. And device has to be created in the
arch code, the same way it's now created in omap_display_init().
So with DT we need a new func, omap_display_init_dt() or such, which
creates the omapdss device, and also creates a board_data which contains
the ctx_loss etc function pointers. But the board data won't have any
display data, those come directly from DT data.
It's a bit messy solution, but it should allow us to have both DT and
non-DT working at the same time, with quite minimal changes to the board
files.
Tomi
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply
* Re: [PATCH 08/21] OMAPDSS: clean up the omapdss platform data mess
From: Archit Taneja @ 2012-03-08 8:29 UTC (permalink / raw)
To: Tomi Valkeinen; +Cc: linux-omap, linux-fbdev
In-Reply-To: <1331193777.2354.21.camel@deskari>
On Thursday 08 March 2012 01:32 PM, Tomi Valkeinen wrote:
> On Wed, 2012-03-07 at 23:41 +0530, Archit Taneja wrote:
>> On Wednesday 07 March 2012 06:14 PM, Tomi Valkeinen wrote:
>>> The omapdss pdata handling is a mess. This is more evident when trying
>>> to use device tree for DSS, as we don't have platform data anymore in
>>> that case. This patch cleans the pdata handling by:
>>>
>>> - Remove struct omap_display_platform_data. It was used just as a
>>> wrapper for struct omap_dss_board_info.
>>> - Pass the platform data only to omapdss device. The drivers for omap
>>> dss hwmods do not need the platform data. This should also work better
>>> for DT, as we can create omapdss device programmatically in generic omap
>>> boot code, and thus we can pass the pdata to it.
>>> - Create dss functions for get_ctx_loss_count and dsi_enable/disable_pads
>>> that the dss hwmod drivers can call.
>>>
>>> Signed-off-by: Tomi Valkeinen<tomi.valkeinen@ti.com>
>>> ---
>>> arch/arm/mach-omap2/display.c | 37 ++++++++++++++++++-------------------
>>> drivers/video/omap2/dss/core.c | 35 +++++++++++++++++++++++++++++++++++
>>> drivers/video/omap2/dss/dispc.c | 21 ++-------------------
>>> drivers/video/omap2/dss/dsi.c | 17 +++--------------
>>> drivers/video/omap2/dss/dss.h | 3 +++
>>> drivers/video/omap2/dss/hdmi.c | 2 --
>>> include/video/omapdss.h | 5 -----
>>> 7 files changed, 61 insertions(+), 59 deletions(-)
>>>
>>> diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
>>> index 3677b1f..279c124 100644
>>> --- a/arch/arm/mach-omap2/display.c
>>> +++ b/arch/arm/mach-omap2/display.c
>>> @@ -185,10 +185,23 @@ int __init omap_display_init(struct omap_dss_board_info *board_data)
>>> struct omap_hwmod *oh;
>>> struct platform_device *pdev;
>>> int i, oh_count;
>>> - struct omap_display_platform_data pdata;
>>> const struct omap_dss_hwmod_data *curr_dss_hwmod;
>>>
>>> - memset(&pdata, 0, sizeof(pdata));
>>> + /* create omapdss device */
>>> +
>>> + board_data->dsi_enable_pads = omap_dsi_enable_pads;
>>> + board_data->dsi_disable_pads = omap_dsi_disable_pads;
>>> + board_data->get_context_loss_count = omap_pm_get_dev_context_loss_count;
>>
>> Why are the checks for board data being NULL removed here?
>
> We didn't check if board_data is NULL in the earlier version either. And
> I don't think there's need to check that, because if the board file
> calls this function, it should also give the board data.
>
> However, the earlier version didn't set the func pointers if the func
> pointer in the board_data was != NULL. Did you mean that? I removed that
> check, as I don't see a need for it. The func pointers should be set by
> this function, and I don't see why the board file would need to use its
> own versions.
Yes, I had meant the function pointers being != NULL, yes it doesn't
make sense for the board file to populate these.
>
>>> diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
>>> index 8613f86..3efd473 100644
>>> --- a/drivers/video/omap2/dss/core.c
>>> +++ b/drivers/video/omap2/dss/core.c
>>> @@ -87,6 +87,41 @@ struct regulator *dss_get_vdds_sdi(void)
>>> return reg;
>>> }
>>>
>>> +int dss_get_ctx_loss_count(struct device *dev)
>>> +{
>>> + struct omap_dss_board_info *board_data = core.pdev->dev.platform_data;
>>> + int cnt;
>>> +
>>> + if (!board_data || !board_data->get_context_loss_count)
>>> + return -ENOENT;
>>
>> why do we check board_data being NULL here and not in omap_display_init()?
>
> I added it for DT case, because then we don't have board_data for the
> devices defined in the DT data. However, for now we always have the
> board_data, and in this patch I should just move the code. So I'll
> remove the check, and add it later with DT code if needed.
Ok. When DT will be in use, would omap_display_init() be called or not?
>
> (and actually, I don' think the check is needed in DT case either...)
I don't know how things would work in DT case. So I'm not sure what's
happening here.
Archit
>
> Tomi
>
>
>
>
^ permalink raw reply
* Re: [PATCH 08/21] OMAPDSS: clean up the omapdss platform data mess
From: Tomi Valkeinen @ 2012-03-08 8:02 UTC (permalink / raw)
To: Archit Taneja; +Cc: linux-omap, linux-fbdev, archit
In-Reply-To: <4F57A4E5.6070201@ti.com>
[-- Attachment #1: Type: text/plain, Size: 3802 bytes --]
On Wed, 2012-03-07 at 23:41 +0530, Archit Taneja wrote:
> On Wednesday 07 March 2012 06:14 PM, Tomi Valkeinen wrote:
> > The omapdss pdata handling is a mess. This is more evident when trying
> > to use device tree for DSS, as we don't have platform data anymore in
> > that case. This patch cleans the pdata handling by:
> >
> > - Remove struct omap_display_platform_data. It was used just as a
> > wrapper for struct omap_dss_board_info.
> > - Pass the platform data only to omapdss device. The drivers for omap
> > dss hwmods do not need the platform data. This should also work better
> > for DT, as we can create omapdss device programmatically in generic omap
> > boot code, and thus we can pass the pdata to it.
> > - Create dss functions for get_ctx_loss_count and dsi_enable/disable_pads
> > that the dss hwmod drivers can call.
> >
> > Signed-off-by: Tomi Valkeinen<tomi.valkeinen@ti.com>
> > ---
> > arch/arm/mach-omap2/display.c | 37 ++++++++++++++++++-------------------
> > drivers/video/omap2/dss/core.c | 35 +++++++++++++++++++++++++++++++++++
> > drivers/video/omap2/dss/dispc.c | 21 ++-------------------
> > drivers/video/omap2/dss/dsi.c | 17 +++--------------
> > drivers/video/omap2/dss/dss.h | 3 +++
> > drivers/video/omap2/dss/hdmi.c | 2 --
> > include/video/omapdss.h | 5 -----
> > 7 files changed, 61 insertions(+), 59 deletions(-)
> >
> > diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
> > index 3677b1f..279c124 100644
> > --- a/arch/arm/mach-omap2/display.c
> > +++ b/arch/arm/mach-omap2/display.c
> > @@ -185,10 +185,23 @@ int __init omap_display_init(struct omap_dss_board_info *board_data)
> > struct omap_hwmod *oh;
> > struct platform_device *pdev;
> > int i, oh_count;
> > - struct omap_display_platform_data pdata;
> > const struct omap_dss_hwmod_data *curr_dss_hwmod;
> >
> > - memset(&pdata, 0, sizeof(pdata));
> > + /* create omapdss device */
> > +
> > + board_data->dsi_enable_pads = omap_dsi_enable_pads;
> > + board_data->dsi_disable_pads = omap_dsi_disable_pads;
> > + board_data->get_context_loss_count = omap_pm_get_dev_context_loss_count;
>
> Why are the checks for board data being NULL removed here?
We didn't check if board_data is NULL in the earlier version either. And
I don't think there's need to check that, because if the board file
calls this function, it should also give the board data.
However, the earlier version didn't set the func pointers if the func
pointer in the board_data was != NULL. Did you mean that? I removed that
check, as I don't see a need for it. The func pointers should be set by
this function, and I don't see why the board file would need to use its
own versions.
> > diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
> > index 8613f86..3efd473 100644
> > --- a/drivers/video/omap2/dss/core.c
> > +++ b/drivers/video/omap2/dss/core.c
> > @@ -87,6 +87,41 @@ struct regulator *dss_get_vdds_sdi(void)
> > return reg;
> > }
> >
> > +int dss_get_ctx_loss_count(struct device *dev)
> > +{
> > + struct omap_dss_board_info *board_data = core.pdev->dev.platform_data;
> > + int cnt;
> > +
> > + if (!board_data || !board_data->get_context_loss_count)
> > + return -ENOENT;
>
> why do we check board_data being NULL here and not in omap_display_init()?
I added it for DT case, because then we don't have board_data for the
devices defined in the DT data. However, for now we always have the
board_data, and in this patch I should just move the code. So I'll
remove the check, and add it later with DT code if needed.
(and actually, I don' think the check is needed in DT case either...)
Tomi
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply
* Re: [PATCH 01/21] OMAPDSS: panel-dvi: add PD gpio handling
From: Tomi Valkeinen @ 2012-03-08 7:54 UTC (permalink / raw)
To: Archit Taneja; +Cc: linux-omap, linux-fbdev
In-Reply-To: <4F579F1B.7040503@ti.com>
[-- Attachment #1: Type: text/plain, Size: 1051 bytes --]
On Wed, 2012-03-07 at 23:17 +0530, Archit Taneja wrote:
> Hi,
>
> On Wednesday 07 March 2012 06:14 PM, Tomi Valkeinen wrote:
> > The driver for the DVI framer should handle the power-down signal of the
> > framer, instead of the current way of handling it in the board files.
>
> What does framer mean?
I don't know where the word has come, and I can't find it in the TFP410
documentation. I guess the idea with the word was that the chip
"frames", i.e. packetizes, the incoming parallel data to DVI.
But I think it's better to remove the use of the word to avoid any
confusion. I'll make the change.
> > + if (gpio_is_valid(ddata->pd_gpio)) {
> > + r = gpio_request_one(ddata->pd_gpio, GPIOF_OUT_INIT_LOW,
> > + "tfp410 pd");
> > + if (r) {
> > + dev_err(&dssdev->dev, "Failed to request PD GPIO %d\n",
> > + ddata->pd_gpio);
> > + ddata->pd_gpio = -1;
>
> Is the power down gpio not a necessary thing? If it is, we should quit
> here itself, shouldn't we?
Hmm, yes, I think you are right.
Tomi
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply
* Re: [PATCH 7/7] OMAPDSS: HDMI: hot plug detect fix
From: Tomi Valkeinen @ 2012-03-08 7:35 UTC (permalink / raw)
To: Greg KH; +Cc: stable, linux-fbdev, linux-omap, Rob Clark
In-Reply-To: <20120307200146.GA26451@kroah.com>
[-- Attachment #1: Type: text/plain, Size: 1006 bytes --]
On Wed, 2012-03-07 at 12:01 -0800, Greg KH wrote:
> On Thu, Mar 01, 2012 at 02:26:35PM +0200, Tomi Valkeinen wrote:
> > From: Rob Clark <rob@ti.com>
> >
> > The "OMAPDSS: HDMI: PHY burnout fix" commit switched the HDMI driver
> > over to using a GPIO for plug detect. Unfortunately the ->detect()
> > method was not also updated, causing HDMI to no longer work for the
> > omapdrm driver (because it would actually check if a connection was
> > detected before attempting to enable display).
> >
> > Signed-off-by: Rob Clark <rob@ti.com>
> > Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
>
> You forgot to tell me what the git commit id is for this patch (it's
> ca888a7958b3d808e4efd08ceff88913f4212c69, right?)
Yes, that's the one. It wasn't in Linus's tree yet, only in fbdev tree,
so I wasn't sure what the commit id is.
> And why isn't this needed for the 3.0 kernel as well?
The detect() function is not present in 3.0, so there was nothing to
break.
Tomi
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply
* [RFC PATCH] video:backlight: add dimming sysfs node
From: Donghwa Lee @ 2012-03-08 6:52 UTC (permalink / raw)
To: linux-arm-kernel
In backlight class, update_status() callback function is mostly used to change
backlight brightness. When platform enter the dimming state, it is usually used.
But, I think dimming state can be defined variety of method including brightness.
So, it is need to differentiated node from brightness node.
In set_dimming() callback function, developers can define variety dimming functions.
Signed-off-by: Donghwa Lee <dh09.lee@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
drivers/video/backlight/backlight.c | 37 +++++++++++++++++++++++++++++++++++
include/linux/backlight.h | 9 ++++++++
2 files changed, 46 insertions(+), 0 deletions(-)
diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c
index bf5b1ec..44a77e4 100644
--- a/drivers/video/backlight/backlight.c
+++ b/drivers/video/backlight/backlight.c
@@ -101,6 +101,43 @@ static void backlight_generate_event(struct backlight_device *bd,
sysfs_notify(&bd->dev.kobj, NULL, "actual_brightness");
}
+static ssize_t backlight_store_dimming(struct device *dev,
+ struct device_attribute *attr, const char *buf, size_t count)
+{
+ int rc;
+ struct backlight_device *bd = to_backlight_device(dev);
+ unsigned long dimming;
+
+ rc = strict_strtoul(buf, 0, &dimming);
+ if (rc)
+ return rc;
+
+ if (dimming < 0)
+ rc = -EINVAL;
+ else {
+ pr_debug("set dimming mode\n");
+
+ if (dimming)
+ bd->props.dimming = true;
+ else
+ bd->props.dimming = false;
+
+ backlight_set_dimming(bd);
+
+ rc = count;
+ }
+
+ return rc;
+}
+
+static ssize_t backlight_show_dimming(struct device *dev,
+ struct device_attribute *attr,char *buf)
+{
+ struct backlight_device *bd = to_backlight_device(dev);
+
+ return sprintf(buf, "%d\n", bd->props.dimming);
+}
+
static ssize_t backlight_show_power(struct device *dev,
struct device_attribute *attr, char *buf)
{
diff --git a/include/linux/backlight.h b/include/linux/backlight.h
index 5ffc6dd..823717e 100644
--- a/include/linux/backlight.h
+++ b/include/linux/backlight.h
@@ -55,10 +55,13 @@ struct backlight_ops {
/* Check if given framebuffer device is the one bound to this backlight;
return 0 if not, !=0 if it is. If NULL, backlight always matches the fb. */
int (*check_fb)(struct backlight_device *, struct fb_info *);
+ /* Notify the backlight driver to enter the dimming state */
+ int (*set_dimming)(struct backlight_device *);
};
/* This structure defines all the properties of a backlight */
struct backlight_properties {
+ bool dimming;
/* Current User requested brightness (0 - max_brightness) */
int brightness;
/* Maximal value for brightness (read-only) */
@@ -111,6 +114,12 @@ static inline void backlight_update_status(struct backlight_device *bd)
mutex_unlock(&bd->update_lock);
}
+static inline void backlight_set_dimming(struct backlight_device *bd)
+{
+ if (bd->ops && bd->ops->set_dimming)
+ bd->ops->set_dimming(bd);
+}
+
extern struct backlight_device *backlight_device_register(const char *name,
struct device *dev, void *devdata, const struct backlight_ops *ops,
const struct backlight_properties *props);
--
1.7.4.1
^ permalink raw reply related
* RE: [GIT PULL] udlfb patches for fbdev-next
From: Jingoo Han @ 2012-03-08 0:12 UTC (permalink / raw)
To: linux-fbdev
In-Reply-To: <CAO1w=s86ykpLJC8KkTbUn1qhvO52CJnzCKz5+rhS7mQtnwR4_w@mail.gmail.com>
> -----Original Message-----
> From: linux-fbdev-owner@vger.kernel.org [mailto:linux-fbdev-owner@vger.kernel.org] On Behalf Of Bernie
> Thompson
> Sent: Thursday, March 08, 2012 3:40 AM
> To: Florian Tobias Schandinat
> Cc: Linux Fbdev development list
> Subject: Re: [GIT PULL] udlfb patches for fbdev-next
>
> Hi Florian,
>
> On Wed, Mar 7, 2012 at 2:06 AM, Florian Tobias Schandinat
> <FlorianSchandinat@gmx.de> wrote:
> > Merged.
>
> Thanks so much for doing that review/merge work.
>
> > I was wondering about
> > the patch of Olivier Sobrie as it was neither part of this pull-request
> > nor did you comment on it, but probably you read my comment I wrote when
> > I cc'ed you as you added yourself to MAINTAINERS.
>
> That patch looks good. I didn't include it only because I hadn't
> tested it. Note that Jingoo's recommendation might run afoul of
> checkpatch.pl (but Olivier's 2nd version worked around that anyway, so
> it's fine - I'd recommend you take it).
Yes, you are right.
Also, Oliver's 2nd version patch looks good.
Good luck.
Best regards,
Jingoo Han
>
> Thanks for your work maintaining fbdev. Best wishes,
> Bernie
> --
> 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
* Re: [PATCH 7/7] OMAPDSS: HDMI: hot plug detect fix
From: Greg KH @ 2012-03-07 20:01 UTC (permalink / raw)
To: Tomi Valkeinen; +Cc: stable, linux-fbdev, linux-omap, Rob Clark
In-Reply-To: <1330604795-29156-8-git-send-email-tomi.valkeinen@ti.com>
On Thu, Mar 01, 2012 at 02:26:35PM +0200, Tomi Valkeinen wrote:
> From: Rob Clark <rob@ti.com>
>
> The "OMAPDSS: HDMI: PHY burnout fix" commit switched the HDMI driver
> over to using a GPIO for plug detect. Unfortunately the ->detect()
> method was not also updated, causing HDMI to no longer work for the
> omapdrm driver (because it would actually check if a connection was
> detected before attempting to enable display).
>
> Signed-off-by: Rob Clark <rob@ti.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
You forgot to tell me what the git commit id is for this patch (it's
ca888a7958b3d808e4efd08ceff88913f4212c69, right?)
And why isn't this needed for the 3.0 kernel as well?
thanks,
greg k-h
^ permalink raw reply
* Re: [GIT PULL] udlfb patches for fbdev-next
From: Bernie Thompson @ 2012-03-07 18:39 UTC (permalink / raw)
To: linux-fbdev
In-Reply-To: <CAO1w=s86ykpLJC8KkTbUn1qhvO52CJnzCKz5+rhS7mQtnwR4_w@mail.gmail.com>
Hi Florian,
On Wed, Mar 7, 2012 at 2:06 AM, Florian Tobias Schandinat
<FlorianSchandinat@gmx.de> wrote:
> Merged.
Thanks so much for doing that review/merge work.
> I was wondering about
> the patch of Olivier Sobrie as it was neither part of this pull-request
> nor did you comment on it, but probably you read my comment I wrote when
> I cc'ed you as you added yourself to MAINTAINERS.
That patch looks good. I didn't include it only because I hadn't
tested it. Note that Jingoo's recommendation might run afoul of
checkpatch.pl (but Olivier's 2nd version worked around that anyway, so
it's fine - I'd recommend you take it).
Thanks for your work maintaining fbdev. Best wishes,
Bernie
^ permalink raw reply
* Re: [PATCH 08/21] OMAPDSS: clean up the omapdss platform data mess
From: Archit Taneja @ 2012-03-07 18:23 UTC (permalink / raw)
To: Tomi Valkeinen; +Cc: linux-omap, linux-fbdev, archit
In-Reply-To: <1331124290-6285-9-git-send-email-tomi.valkeinen@ti.com>
On Wednesday 07 March 2012 06:14 PM, Tomi Valkeinen wrote:
> The omapdss pdata handling is a mess. This is more evident when trying
> to use device tree for DSS, as we don't have platform data anymore in
> that case. This patch cleans the pdata handling by:
>
> - Remove struct omap_display_platform_data. It was used just as a
> wrapper for struct omap_dss_board_info.
> - Pass the platform data only to omapdss device. The drivers for omap
> dss hwmods do not need the platform data. This should also work better
> for DT, as we can create omapdss device programmatically in generic omap
> boot code, and thus we can pass the pdata to it.
> - Create dss functions for get_ctx_loss_count and dsi_enable/disable_pads
> that the dss hwmod drivers can call.
>
> Signed-off-by: Tomi Valkeinen<tomi.valkeinen@ti.com>
> ---
> arch/arm/mach-omap2/display.c | 37 ++++++++++++++++++-------------------
> drivers/video/omap2/dss/core.c | 35 +++++++++++++++++++++++++++++++++++
> drivers/video/omap2/dss/dispc.c | 21 ++-------------------
> drivers/video/omap2/dss/dsi.c | 17 +++--------------
> drivers/video/omap2/dss/dss.h | 3 +++
> drivers/video/omap2/dss/hdmi.c | 2 --
> include/video/omapdss.h | 5 -----
> 7 files changed, 61 insertions(+), 59 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
> index 3677b1f..279c124 100644
> --- a/arch/arm/mach-omap2/display.c
> +++ b/arch/arm/mach-omap2/display.c
> @@ -185,10 +185,23 @@ int __init omap_display_init(struct omap_dss_board_info *board_data)
> struct omap_hwmod *oh;
> struct platform_device *pdev;
> int i, oh_count;
> - struct omap_display_platform_data pdata;
> const struct omap_dss_hwmod_data *curr_dss_hwmod;
>
> - memset(&pdata, 0, sizeof(pdata));
> + /* create omapdss device */
> +
> + board_data->dsi_enable_pads = omap_dsi_enable_pads;
> + board_data->dsi_disable_pads = omap_dsi_disable_pads;
> + board_data->get_context_loss_count = omap_pm_get_dev_context_loss_count;
Why are the checks for board data being NULL removed here?
> +
> + omap_display_device.dev.platform_data = board_data;
> +
> + r = platform_device_register(&omap_display_device);
> + if (r< 0) {
> + pr_err("Unable to register omapdss device\n");
> + return r;
> + }
> +
> + /* create devices for dss hwmods */
>
> if (cpu_is_omap24xx()) {
> curr_dss_hwmod = omap2_dss_hwmod_data;
> @@ -201,15 +214,6 @@ int __init omap_display_init(struct omap_dss_board_info *board_data)
> oh_count = ARRAY_SIZE(omap4_dss_hwmod_data);
> }
>
> - if (board_data->dsi_enable_pads = NULL)
> - board_data->dsi_enable_pads = omap_dsi_enable_pads;
> - if (board_data->dsi_disable_pads = NULL)
> - board_data->dsi_disable_pads = omap_dsi_disable_pads;
> -
> - pdata.board_data = board_data;
> - pdata.board_data->get_context_loss_count > - omap_pm_get_dev_context_loss_count;
> -
> for (i = 0; i< oh_count; i++) {
> oh = omap_hwmod_lookup(curr_dss_hwmod[i].oh_name);
> if (!oh) {
> @@ -219,21 +223,16 @@ int __init omap_display_init(struct omap_dss_board_info *board_data)
> }
>
> pdev = omap_device_build(curr_dss_hwmod[i].dev_name,
> - curr_dss_hwmod[i].id, oh,&pdata,
> - sizeof(struct omap_display_platform_data),
> + curr_dss_hwmod[i].id, oh,
> + NULL, 0,
> NULL, 0, 0);
>
> if (WARN((IS_ERR(pdev)), "Could not build omap_device for %s\n",
> curr_dss_hwmod[i].oh_name))
> return -ENODEV;
> }
> - omap_display_device.dev.platform_data = board_data;
>
> - r = platform_device_register(&omap_display_device);
> - if (r< 0)
> - printk(KERN_ERR "Unable to register OMAP-Display device\n");
> -
> - return r;
> + return 0;
> }
>
> static void dispc_disable_outputs(void)
> diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
> index 8613f86..3efd473 100644
> --- a/drivers/video/omap2/dss/core.c
> +++ b/drivers/video/omap2/dss/core.c
> @@ -87,6 +87,41 @@ struct regulator *dss_get_vdds_sdi(void)
> return reg;
> }
>
> +int dss_get_ctx_loss_count(struct device *dev)
> +{
> + struct omap_dss_board_info *board_data = core.pdev->dev.platform_data;
> + int cnt;
> +
> + if (!board_data || !board_data->get_context_loss_count)
> + return -ENOENT;
why do we check board_data being NULL here and not in omap_display_init()?
Archit
> +
> + cnt = board_data->get_context_loss_count(dev);
> +
> + WARN_ONCE(cnt< 0, "get_context_loss_count failed: %d\n", cnt);
> +
> + return cnt;
> +}
> +
> +int dss_dsi_enable_pads(int dsi_id, unsigned lane_mask)
> +{
> + struct omap_dss_board_info *board_data = core.pdev->dev.platform_data;
> +
> + if (!board_data || !board_data->dsi_enable_pads)
> + return -ENOENT;
> +
> + return board_data->dsi_enable_pads(dsi_id, lane_mask);
> +}
> +
> +void dss_dsi_disable_pads(int dsi_id, unsigned lane_mask)
> +{
> + struct omap_dss_board_info *board_data = core.pdev->dev.platform_data;
> +
> + if (!board_data || !board_data->dsi_enable_pads)
> + return;
> +
> + return board_data->dsi_disable_pads(dsi_id, lane_mask);
> +}
> +
> #if defined(CONFIG_DEBUG_FS)&& defined(CONFIG_OMAP2_DSS_DEBUG_SUPPORT)
> static int dss_debug_show(struct seq_file *s, void *unused)
> {
> diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
> index bddd64b..703bb20 100644
> --- a/drivers/video/omap2/dss/dispc.c
> +++ b/drivers/video/omap2/dss/dispc.c
> @@ -131,23 +131,6 @@ static inline u32 dispc_read_reg(const u16 idx)
> return __raw_readl(dispc.base + idx);
> }
>
> -static int dispc_get_ctx_loss_count(void)
> -{
> - struct device *dev =&dispc.pdev->dev;
> - struct omap_display_platform_data *pdata = dev->platform_data;
> - struct omap_dss_board_info *board_data = pdata->board_data;
> - int cnt;
> -
> - if (!board_data->get_context_loss_count)
> - return -ENOENT;
> -
> - cnt = board_data->get_context_loss_count(dev);
> -
> - WARN_ONCE(cnt< 0, "get_context_loss_count failed: %d\n", cnt);
> -
> - return cnt;
> -}
> -
> #define SR(reg) \
> dispc.ctx[DISPC_##reg / sizeof(u32)] = dispc_read_reg(DISPC_##reg)
> #define RR(reg) \
> @@ -251,7 +234,7 @@ static void dispc_save_context(void)
> if (dss_has_feature(FEAT_CORE_CLK_DIV))
> SR(DIVISOR);
>
> - dispc.ctx_loss_cnt = dispc_get_ctx_loss_count();
> + dispc.ctx_loss_cnt = dss_get_ctx_loss_count(&dispc.pdev->dev);
> dispc.ctx_valid = true;
>
> DSSDBG("context saved, ctx_loss_count %d\n", dispc.ctx_loss_cnt);
> @@ -266,7 +249,7 @@ static void dispc_restore_context(void)
> if (!dispc.ctx_valid)
> return;
>
> - ctx = dispc_get_ctx_loss_count();
> + ctx = dss_get_ctx_loss_count(&dispc.pdev->dev);
>
> if (ctx>= 0&& ctx = dispc.ctx_loss_cnt)
> return;
> diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
> index 3e656be..4e2f7ff 100644
> --- a/drivers/video/omap2/dss/dsi.c
> +++ b/drivers/video/omap2/dss/dsi.c
> @@ -261,9 +261,6 @@ struct dsi_data {
> struct clk *dss_clk;
> struct clk *sys_clk;
>
> - int (*enable_pads)(int dsi_id, unsigned lane_mask);
> - void (*disable_pads)(int dsi_id, unsigned lane_mask);
> -
> struct dsi_clock_info current_cinfo;
>
> bool vdds_dsi_enabled;
> @@ -2396,7 +2393,7 @@ static int dsi_cio_init(struct omap_dss_device *dssdev)
>
> DSSDBGF();
>
> - r = dsi->enable_pads(dsi_get_dsidev_id(dsidev), dsi_get_lane_mask(dssdev));
> + r = dss_dsi_enable_pads(dsi_get_dsidev_id(dsidev), dsi_get_lane_mask(dssdev));
> if (r)
> return r;
>
> @@ -2506,21 +2503,20 @@ err_cio_pwr:
> dsi_cio_disable_lane_override(dsidev);
> err_scp_clk_dom:
> dsi_disable_scp_clk(dsidev);
> - dsi->disable_pads(dsi_get_dsidev_id(dsidev), dsi_get_lane_mask(dssdev));
> + dss_dsi_disable_pads(dsi_get_dsidev_id(dsidev), dsi_get_lane_mask(dssdev));
> return r;
> }
>
> static void dsi_cio_uninit(struct omap_dss_device *dssdev)
> {
> struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev);
> - struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
>
> /* DDR_CLK_ALWAYS_ON */
> REG_FLD_MOD(dsidev, DSI_CLK_CTRL, 0, 13, 13);
>
> dsi_cio_power(dsidev, DSI_COMPLEXIO_POWER_OFF);
> dsi_disable_scp_clk(dsidev);
> - dsi->disable_pads(dsi_get_dsidev_id(dsidev), dsi_get_lane_mask(dssdev));
> + dss_dsi_disable_pads(dsi_get_dsidev_id(dsidev), dsi_get_lane_mask(dssdev));
> }
>
> static void dsi_config_tx_fifo(struct platform_device *dsidev,
> @@ -4680,8 +4676,6 @@ static void dsi_put_clocks(struct platform_device *dsidev)
> /* DSI1 HW IP initialisation */
> static int omap_dsihw_probe(struct platform_device *dsidev)
> {
> - struct omap_display_platform_data *dss_plat_data;
> - struct omap_dss_board_info *board_info;
> u32 rev;
> int r, i, dsi_module = dsi_get_dsidev_id(dsidev);
> struct resource *dsi_mem;
> @@ -4695,11 +4689,6 @@ static int omap_dsihw_probe(struct platform_device *dsidev)
> dsi_pdev_map[dsi_module] = dsidev;
> dev_set_drvdata(&dsidev->dev, dsi);
>
> - dss_plat_data = dsidev->dev.platform_data;
> - board_info = dss_plat_data->board_data;
> - dsi->enable_pads = board_info->dsi_enable_pads;
> - dsi->disable_pads = board_info->dsi_disable_pads;
> -
> spin_lock_init(&dsi->irq_lock);
> spin_lock_init(&dsi->errors_lock);
> dsi->errors = 0;
> diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
> index d4b3dff..d37ed80 100644
> --- a/drivers/video/omap2/dss/dss.h
> +++ b/drivers/video/omap2/dss/dss.h
> @@ -162,6 +162,9 @@ struct platform_device;
> struct bus_type *dss_get_bus(void);
> struct regulator *dss_get_vdds_dsi(void);
> struct regulator *dss_get_vdds_sdi(void);
> +int dss_get_ctx_loss_count(struct device *dev);
> +int dss_dsi_enable_pads(int dsi_id, unsigned lane_mask);
> +void dss_dsi_disable_pads(int dsi_id, unsigned lane_mask);
>
> /* apply */
> void dss_apply_init(void);
> diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
> index c4b4f69..cacf856 100644
> --- a/drivers/video/omap2/dss/hdmi.c
> +++ b/drivers/video/omap2/dss/hdmi.c
> @@ -63,7 +63,6 @@
>
> static struct {
> struct mutex lock;
> - struct omap_display_platform_data *pdata;
> struct platform_device *pdev;
> struct hdmi_ip_data ip_data;
>
> @@ -796,7 +795,6 @@ static int omapdss_hdmihw_probe(struct platform_device *pdev)
> struct resource *hdmi_mem;
> int r;
>
> - hdmi.pdata = pdev->dev.platform_data;
> hdmi.pdev = pdev;
>
> mutex_init(&hdmi.lock);
> diff --git a/include/video/omapdss.h b/include/video/omapdss.h
> index 483f67c..b499ccb 100644
> --- a/include/video/omapdss.h
> +++ b/include/video/omapdss.h
> @@ -316,11 +316,6 @@ extern int omap_display_init(struct omap_dss_board_info *board_data);
> /* HDMI mux init*/
> extern int omap_hdmi_init(enum omap_hdmi_flags flags);
>
> -struct omap_display_platform_data {
> - struct omap_dss_board_info *board_data;
> - /* TODO: Additional members to be added when PM is considered */
> -};
> -
> struct omap_video_timings {
> /* Unit: pixels */
> u16 x_res;
^ permalink raw reply
* Re: [PATCH 01/21] OMAPDSS: panel-dvi: add PD gpio handling
From: Archit Taneja @ 2012-03-07 17:59 UTC (permalink / raw)
To: Tomi Valkeinen; +Cc: linux-omap, linux-fbdev
In-Reply-To: <1331124290-6285-2-git-send-email-tomi.valkeinen@ti.com>
Hi,
On Wednesday 07 March 2012 06:14 PM, Tomi Valkeinen wrote:
> The driver for the DVI framer should handle the power-down signal of the
> framer, instead of the current way of handling it in the board files.
What does framer mean?
>
> This patch adds power_down_gpio into the device's platform data, and
> adds the necessary code in the driver to request and handle the GPIO.
>
> Signed-off-by: Tomi Valkeinen<tomi.valkeinen@ti.com>
> ---
> drivers/video/omap2/displays/panel-dvi.c | 31 ++++++++++++++++++++++++++++++
> include/video/omap-panel-dvi.h | 2 +
> 2 files changed, 33 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/video/omap2/displays/panel-dvi.c b/drivers/video/omap2/displays/panel-dvi.c
> index 03eb14a..876b798 100644
> --- a/drivers/video/omap2/displays/panel-dvi.c
> +++ b/drivers/video/omap2/displays/panel-dvi.c
> @@ -21,6 +21,7 @@
> #include<linux/slab.h>
> #include<video/omapdss.h>
> #include<linux/i2c.h>
> +#include<linux/gpio.h>
> #include<drm/drm_edid.h>
>
> #include<video/omap-panel-dvi.h>
> @@ -44,6 +45,8 @@ struct panel_drv_data {
> struct omap_dss_device *dssdev;
>
> struct mutex lock;
> +
> + int pd_gpio;
> };
>
> static inline struct panel_dvi_platform_data
> @@ -54,6 +57,7 @@ static inline struct panel_dvi_platform_data
>
> static int panel_dvi_power_on(struct omap_dss_device *dssdev)
> {
> + struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev);
> struct panel_dvi_platform_data *pdata = get_pdata(dssdev);
> int r;
>
> @@ -70,6 +74,9 @@ static int panel_dvi_power_on(struct omap_dss_device *dssdev)
> goto err1;
> }
>
> + if (gpio_is_valid(ddata->pd_gpio))
> + gpio_set_value(ddata->pd_gpio, 1);
> +
> return 0;
> err1:
> omapdss_dpi_display_disable(dssdev);
> @@ -79,11 +86,15 @@ err0:
>
> static void panel_dvi_power_off(struct omap_dss_device *dssdev)
> {
> + struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev);
> struct panel_dvi_platform_data *pdata = get_pdata(dssdev);
>
> if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE)
> return;
>
> + if (gpio_is_valid(ddata->pd_gpio))
> + gpio_set_value(ddata->pd_gpio, 0);
> +
> if (pdata->platform_disable)
> pdata->platform_disable(dssdev);
>
> @@ -92,7 +103,9 @@ static void panel_dvi_power_off(struct omap_dss_device *dssdev)
>
> static int panel_dvi_probe(struct omap_dss_device *dssdev)
> {
> + struct panel_dvi_platform_data *pdata = get_pdata(dssdev);
> struct panel_drv_data *ddata;
> + int r;
>
> ddata = kzalloc(sizeof(*ddata), GFP_KERNEL);
> if (!ddata)
> @@ -104,6 +117,21 @@ static int panel_dvi_probe(struct omap_dss_device *dssdev)
> ddata->dssdev = dssdev;
> mutex_init(&ddata->lock);
>
> + if (pdata)
> + ddata->pd_gpio = pdata->power_down_gpio;
> + else
> + ddata->pd_gpio = -1;
> +
> + if (gpio_is_valid(ddata->pd_gpio)) {
> + r = gpio_request_one(ddata->pd_gpio, GPIOF_OUT_INIT_LOW,
> + "tfp410 pd");
> + if (r) {
> + dev_err(&dssdev->dev, "Failed to request PD GPIO %d\n",
> + ddata->pd_gpio);
> + ddata->pd_gpio = -1;
Is the power down gpio not a necessary thing? If it is, we should quit
here itself, shouldn't we?
Archit
> + }
> + }
> +
> dev_set_drvdata(&dssdev->dev, ddata);
>
> return 0;
> @@ -115,6 +143,9 @@ static void __exit panel_dvi_remove(struct omap_dss_device *dssdev)
>
> mutex_lock(&ddata->lock);
>
> + if (gpio_is_valid(ddata->pd_gpio))
> + gpio_free(ddata->pd_gpio);
> +
> dev_set_drvdata(&dssdev->dev, NULL);
>
> mutex_unlock(&ddata->lock);
> diff --git a/include/video/omap-panel-dvi.h b/include/video/omap-panel-dvi.h
> index 87ad567b..4ad41fc 100644
> --- a/include/video/omap-panel-dvi.h
> +++ b/include/video/omap-panel-dvi.h
> @@ -27,11 +27,13 @@ struct omap_dss_device;
> * @platform_enable: platform specific panel enable function
> * @platform_disable: platform specific panel disable function
> * @i2c_bus_num: i2c bus id for the panel
> + * @power_down_gpio: gpio number for PD pin (or -1 if not available)
> */
> struct panel_dvi_platform_data {
> int (*platform_enable)(struct omap_dss_device *dssdev);
> void (*platform_disable)(struct omap_dss_device *dssdev);
> u16 i2c_bus_num;
> + int power_down_gpio;
> };
>
> #endif /* __OMAP_PANEL_DVI_H */
^ permalink raw reply
* [PATCH 21/21] OMAPDSS: change default_device handling
From: Tomi Valkeinen @ 2012-03-07 12:44 UTC (permalink / raw)
To: linux-omap, linux-fbdev; +Cc: archit, Tomi Valkeinen
In-Reply-To: <1331124290-6285-1-git-send-email-tomi.valkeinen@ti.com>
We currently have a two ways to set a "default panel device" for dss, to
which the overlays are connected when the omapdss driver is loaded:
- in textual format (name of the display) as cmdline parameter
- as a pointer to the panel device from board file via pdata
The current code handles this in a bit too complex way by using both of
the above methods during runtime. However, with DT we don't have pdata
anymore, so the code handling the second case won't work anymore. The
current code has also the problem that it modifies the platform_data.
This patch simplifies the code a bit by using the pointer method only
inside the probe function, and stores the name of the panel device. This
way we only need to handle the textual format during operation and also
avoid modifying the platform_data.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
drivers/video/omap2/dss/core.c | 14 +++++++++-----
1 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
index aa294d7..dd8f07c 100644
--- a/drivers/video/omap2/dss/core.c
+++ b/drivers/video/omap2/dss/core.c
@@ -43,6 +43,8 @@ static struct {
struct regulator *vdds_dsi_reg;
struct regulator *vdds_sdi_reg;
+
+ const char *default_display_name;
} core;
static char *def_disp_name;
@@ -212,6 +214,11 @@ static int __init omap_dss_probe(struct platform_device *pdev)
if (r)
goto err_debugfs;
+ if (def_disp_name)
+ core.default_display_name = def_disp_name;
+ else if (pdata->default_device)
+ core.default_display_name = pdata->default_device->name;
+
for (i = 0; i < pdata->num_devices; ++i) {
struct omap_dss_device *dssdev = pdata->devices[i];
@@ -225,9 +232,6 @@ static int __init omap_dss_probe(struct platform_device *pdev)
goto err_register;
}
-
- if (def_disp_name && strcmp(def_disp_name, dssdev->name) = 0)
- pdata->default_device = dssdev;
}
return 0;
@@ -350,7 +354,6 @@ static int dss_driver_probe(struct device *dev)
int r;
struct omap_dss_driver *dssdrv = to_dss_driver(dev->driver);
struct omap_dss_device *dssdev = to_dss_device(dev);
- struct omap_dss_board_info *pdata = core.pdev->dev.platform_data;
bool force;
DSSDBG("driver_probe: dev %s/%s, drv %s\n",
@@ -359,7 +362,8 @@ static int dss_driver_probe(struct device *dev)
dss_init_device(core.pdev, dssdev);
- force = pdata->default_device = dssdev;
+ force = core.default_display_name &&
+ strcmp(core.default_display_name, dssdev->name) = 0;
dss_recheck_connections(dssdev, force);
r = dssdrv->probe(dssdev);
--
1.7.4.1
^ permalink raw reply related
* [PATCH 20/21] OMAPFB: add __init & __exit
From: Tomi Valkeinen @ 2012-03-07 12:44 UTC (permalink / raw)
To: linux-omap, linux-fbdev; +Cc: archit, Tomi Valkeinen
In-Reply-To: <1331124290-6285-1-git-send-email-tomi.valkeinen@ti.com>
Change omapfb to use platform_driver_probe and add __init & __exit.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
drivers/video/omap2/omapfb/omapfb-main.c | 9 ++++-----
1 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/video/omap2/omapfb/omapfb-main.c b/drivers/video/omap2/omapfb/omapfb-main.c
index b00db40..a0967dc 100644
--- a/drivers/video/omap2/omapfb/omapfb-main.c
+++ b/drivers/video/omap2/omapfb/omapfb-main.c
@@ -2307,7 +2307,7 @@ static int omapfb_init_display(struct omapfb2_device *fbdev,
return 0;
}
-static int omapfb_probe(struct platform_device *pdev)
+static int __init omapfb_probe(struct platform_device *pdev)
{
struct omapfb2_device *fbdev = NULL;
int r = 0;
@@ -2448,7 +2448,7 @@ err0:
return r;
}
-static int omapfb_remove(struct platform_device *pdev)
+static int __exit omapfb_remove(struct platform_device *pdev)
{
struct omapfb2_device *fbdev = platform_get_drvdata(pdev);
@@ -2462,8 +2462,7 @@ static int omapfb_remove(struct platform_device *pdev)
}
static struct platform_driver omapfb_driver = {
- .probe = omapfb_probe,
- .remove = omapfb_remove,
+ .remove = __exit_p(omapfb_remove),
.driver = {
.name = "omapfb",
.owner = THIS_MODULE,
@@ -2474,7 +2473,7 @@ static int __init omapfb_init(void)
{
DBG("omapfb_init\n");
- if (platform_driver_register(&omapfb_driver)) {
+ if (platform_driver_probe(&omapfb_driver, omapfb_probe)) {
printk(KERN_ERR "failed to register omapfb driver\n");
return -ENODEV;
}
--
1.7.4.1
^ permalink raw reply related
* [PATCH 19/21] OMAPDSS: add __init & __exit
From: Tomi Valkeinen @ 2012-03-07 12:44 UTC (permalink / raw)
To: linux-omap, linux-fbdev; +Cc: archit, Tomi Valkeinen
In-Reply-To: <1331124290-6285-1-git-send-email-tomi.valkeinen@ti.com>
Now that we are using platform_driver_probe() we can add __inits and
__exits all around.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
drivers/video/omap2/dss/core.c | 4 ++--
drivers/video/omap2/dss/dispc.c | 10 +++++-----
drivers/video/omap2/dss/dpi.c | 10 +++++-----
drivers/video/omap2/dss/dsi.c | 10 +++++-----
drivers/video/omap2/dss/dss.c | 10 +++++-----
drivers/video/omap2/dss/hdmi.c | 10 +++++-----
drivers/video/omap2/dss/rfbi.c | 10 +++++-----
drivers/video/omap2/dss/sdi.c | 10 +++++-----
drivers/video/omap2/dss/venc.c | 10 +++++-----
9 files changed, 42 insertions(+), 42 deletions(-)
diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
index a744474..aa294d7 100644
--- a/drivers/video/omap2/dss/core.c
+++ b/drivers/video/omap2/dss/core.c
@@ -193,7 +193,7 @@ static inline int dss_debugfs_create_file(const char *name,
#endif /* CONFIG_DEBUG_FS && CONFIG_OMAP2_DSS_DEBUG_SUPPORT */
/* PLATFORM DEVICE */
-static int omap_dss_probe(struct platform_device *pdev)
+static int __init omap_dss_probe(struct platform_device *pdev)
{
struct omap_dss_board_info *pdata = pdev->dev.platform_data;
int r;
@@ -471,7 +471,7 @@ static void omap_dss_unregister_device(struct omap_dss_device *dssdev)
}
/* BUS */
-static int omap_dss_bus_register(void)
+static int __init omap_dss_bus_register(void)
{
int r;
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index a555e32..71272a6 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -3318,7 +3318,7 @@ static void _omap_dispc_initial_config(void)
}
/* DISPC HW IP initialisation */
-static int omap_dispchw_probe(struct platform_device *pdev)
+static int __init omap_dispchw_probe(struct platform_device *pdev)
{
u32 rev;
int r = 0;
@@ -3400,7 +3400,7 @@ err_runtime_get:
return r;
}
-static int omap_dispchw_remove(struct platform_device *pdev)
+static int __exit omap_dispchw_remove(struct platform_device *pdev)
{
pm_runtime_disable(&pdev->dev);
@@ -3429,7 +3429,7 @@ static const struct dev_pm_ops dispc_pm_ops = {
};
static struct platform_driver omap_dispchw_driver = {
- .remove = omap_dispchw_remove,
+ .remove = __exit_p(omap_dispchw_remove),
.driver = {
.name = "omapdss_dispc",
.owner = THIS_MODULE,
@@ -3437,12 +3437,12 @@ static struct platform_driver omap_dispchw_driver = {
},
};
-int dispc_init_platform_driver(void)
+__init int dispc_init_platform_driver(void)
{
return platform_driver_probe(&omap_dispchw_driver, omap_dispchw_probe);
}
-void dispc_uninit_platform_driver(void)
+__exit void dispc_uninit_platform_driver(void)
{
platform_driver_unregister(&omap_dispchw_driver);
}
diff --git a/drivers/video/omap2/dss/dpi.c b/drivers/video/omap2/dss/dpi.c
index 5ca216b..f93c3ad 100644
--- a/drivers/video/omap2/dss/dpi.c
+++ b/drivers/video/omap2/dss/dpi.c
@@ -364,30 +364,30 @@ int dpi_init_display(struct omap_dss_device *dssdev)
return 0;
}
-static int omap_dpi_probe(struct platform_device *pdev)
+static int __init omap_dpi_probe(struct platform_device *pdev)
{
return 0;
}
-static int omap_dpi_remove(struct platform_device *pdev)
+static int __exit omap_dpi_remove(struct platform_device *pdev)
{
return 0;
}
static struct platform_driver omap_dpi_driver = {
- .remove = omap_dpi_remove,
+ .remove = __exit_p(omap_dpi_remove),
.driver = {
.name = "omapdss_dpi",
.owner = THIS_MODULE,
},
};
-int dpi_init_platform_driver(void)
+__init int dpi_init_platform_driver(void)
{
return platform_driver_probe(&omap_dpi_driver, omap_dpi_probe);
}
-void dpi_uninit_platform_driver(void)
+__exit void dpi_uninit_platform_driver(void)
{
platform_driver_unregister(&omap_dpi_driver);
}
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index 9402d00..d510d0e 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -4643,7 +4643,7 @@ static void dsi_put_clocks(struct platform_device *dsidev)
}
/* DSI1 HW IP initialisation */
-static int omap_dsihw_probe(struct platform_device *dsidev)
+static int __init omap_dsihw_probe(struct platform_device *dsidev)
{
u32 rev;
int r, i, dsi_module = dsi_get_dsidev_id(dsidev);
@@ -4756,7 +4756,7 @@ err_runtime_get:
return r;
}
-static int omap_dsihw_remove(struct platform_device *dsidev)
+static int __exit omap_dsihw_remove(struct platform_device *dsidev)
{
struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
@@ -4803,7 +4803,7 @@ static const struct dev_pm_ops dsi_pm_ops = {
};
static struct platform_driver omap_dsihw_driver = {
- .remove = omap_dsihw_remove,
+ .remove = __exit_p(omap_dsihw_remove),
.driver = {
.name = "omapdss_dsi",
.owner = THIS_MODULE,
@@ -4811,12 +4811,12 @@ static struct platform_driver omap_dsihw_driver = {
},
};
-int dsi_init_platform_driver(void)
+__init int dsi_init_platform_driver(void)
{
return platform_driver_probe(&omap_dsihw_driver, omap_dsihw_probe);
}
-void dsi_uninit_platform_driver(void)
+__exit void dsi_uninit_platform_driver(void)
{
platform_driver_unregister(&omap_dsihw_driver);
}
diff --git a/drivers/video/omap2/dss/dss.c b/drivers/video/omap2/dss/dss.c
index 47a4c2a..c1f7dec 100644
--- a/drivers/video/omap2/dss/dss.c
+++ b/drivers/video/omap2/dss/dss.c
@@ -740,7 +740,7 @@ void dss_debug_dump_clocks(struct seq_file *s)
#endif
/* DSS HW IP initialisation */
-static int omap_dsshw_probe(struct platform_device *pdev)
+static int __init omap_dsshw_probe(struct platform_device *pdev)
{
struct resource *dss_mem;
u32 rev;
@@ -801,7 +801,7 @@ err_runtime_get:
return r;
}
-static int omap_dsshw_remove(struct platform_device *pdev)
+static int __exit omap_dsshw_remove(struct platform_device *pdev)
{
pm_runtime_disable(&pdev->dev);
@@ -828,7 +828,7 @@ static const struct dev_pm_ops dss_pm_ops = {
};
static struct platform_driver omap_dsshw_driver = {
- .remove = omap_dsshw_remove,
+ .remove = __exit_p(omap_dsshw_remove),
.driver = {
.name = "omapdss_dss",
.owner = THIS_MODULE,
@@ -836,12 +836,12 @@ static struct platform_driver omap_dsshw_driver = {
},
};
-int dss_init_platform_driver(void)
+__init int dss_init_platform_driver(void)
{
return platform_driver_probe(&omap_dsshw_driver, omap_dsshw_probe);
}
-void dss_uninit_platform_driver(void)
+__exit void dss_uninit_platform_driver(void)
{
platform_driver_unregister(&omap_dsshw_driver);
}
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index 2f369ed..18e4b65 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -771,7 +771,7 @@ static void hdmi_put_clocks(void)
}
/* HDMI HW IP initialisation */
-static int omapdss_hdmihw_probe(struct platform_device *pdev)
+static int __init omapdss_hdmihw_probe(struct platform_device *pdev)
{
struct resource *hdmi_mem;
int r;
@@ -825,7 +825,7 @@ static int omapdss_hdmihw_probe(struct platform_device *pdev)
return 0;
}
-static int omapdss_hdmihw_remove(struct platform_device *pdev)
+static int __exit omapdss_hdmihw_remove(struct platform_device *pdev)
{
hdmi_panel_exit();
@@ -871,7 +871,7 @@ static const struct dev_pm_ops hdmi_pm_ops = {
};
static struct platform_driver omapdss_hdmihw_driver = {
- .remove = omapdss_hdmihw_remove,
+ .remove = __exit_p(omapdss_hdmihw_remove),
.driver = {
.name = "omapdss_hdmi",
.owner = THIS_MODULE,
@@ -879,12 +879,12 @@ static struct platform_driver omapdss_hdmihw_driver = {
},
};
-int hdmi_init_platform_driver(void)
+__init int hdmi_init_platform_driver(void)
{
return platform_driver_probe(&omapdss_hdmihw_driver, omapdss_hdmihw_probe);
}
-void hdmi_uninit_platform_driver(void)
+__exit void hdmi_uninit_platform_driver(void)
{
platform_driver_unregister(&omapdss_hdmihw_driver);
}
diff --git a/drivers/video/omap2/dss/rfbi.c b/drivers/video/omap2/dss/rfbi.c
index b2b0d5e..bc83d44 100644
--- a/drivers/video/omap2/dss/rfbi.c
+++ b/drivers/video/omap2/dss/rfbi.c
@@ -908,7 +908,7 @@ int rfbi_init_display(struct omap_dss_device *dssdev)
}
/* RFBI HW IP initialisation */
-static int omap_rfbihw_probe(struct platform_device *pdev)
+static int __init omap_rfbihw_probe(struct platform_device *pdev)
{
u32 rev;
struct resource *rfbi_mem;
@@ -965,7 +965,7 @@ err_runtime_get:
return r;
}
-static int omap_rfbihw_remove(struct platform_device *pdev)
+static int __exit omap_rfbihw_remove(struct platform_device *pdev)
{
pm_runtime_disable(&pdev->dev);
return 0;
@@ -995,7 +995,7 @@ static const struct dev_pm_ops rfbi_pm_ops = {
};
static struct platform_driver omap_rfbihw_driver = {
- .remove = omap_rfbihw_remove,
+ .remove = __exit_p(omap_rfbihw_remove),
.driver = {
.name = "omapdss_rfbi",
.owner = THIS_MODULE,
@@ -1003,12 +1003,12 @@ static struct platform_driver omap_rfbihw_driver = {
},
};
-int rfbi_init_platform_driver(void)
+__init int rfbi_init_platform_driver(void)
{
return platform_driver_probe(&omap_rfbihw_driver, omap_rfbihw_probe);
}
-void rfbi_uninit_platform_driver(void)
+__exit void rfbi_uninit_platform_driver(void)
{
platform_driver_unregister(&omap_rfbihw_driver);
}
diff --git a/drivers/video/omap2/dss/sdi.c b/drivers/video/omap2/dss/sdi.c
index 2cbcc00..df3b431 100644
--- a/drivers/video/omap2/dss/sdi.c
+++ b/drivers/video/omap2/dss/sdi.c
@@ -176,30 +176,30 @@ int sdi_init_display(struct omap_dss_device *dssdev)
return 0;
}
-static int omap_sdi_probe(struct platform_device *pdev)
+static int __init omap_sdi_probe(struct platform_device *pdev)
{
return 0;
}
-static int omap_sdi_remove(struct platform_device *pdev)
+static int __exit omap_sdi_remove(struct platform_device *pdev)
{
return 0;
}
static struct platform_driver omap_sdi_driver = {
- .remove = omap_sdi_remove,
+ .remove = __exit_p(omap_sdi_remove),
.driver = {
.name = "omapdss_sdi",
.owner = THIS_MODULE,
},
};
-int sdi_init_platform_driver(void)
+__init int sdi_init_platform_driver(void)
{
return platform_driver_probe(&omap_sdi_driver, omap_sdi_probe);
}
-void sdi_uninit_platform_driver(void)
+__exit void sdi_uninit_platform_driver(void)
{
platform_driver_unregister(&omap_sdi_driver);
}
diff --git a/drivers/video/omap2/dss/venc.c b/drivers/video/omap2/dss/venc.c
index ca0bcdd..cc772a7 100644
--- a/drivers/video/omap2/dss/venc.c
+++ b/drivers/video/omap2/dss/venc.c
@@ -780,7 +780,7 @@ static void venc_put_clocks(void)
}
/* VENC HW IP initialisation */
-static int omap_venchw_probe(struct platform_device *pdev)
+static int __init omap_venchw_probe(struct platform_device *pdev)
{
u8 rev_id;
struct resource *venc_mem;
@@ -835,7 +835,7 @@ err_runtime_get:
return r;
}
-static int omap_venchw_remove(struct platform_device *pdev)
+static int __exit omap_venchw_remove(struct platform_device *pdev)
{
if (venc.vdda_dac_reg != NULL) {
regulator_put(venc.vdda_dac_reg);
@@ -879,7 +879,7 @@ static const struct dev_pm_ops venc_pm_ops = {
};
static struct platform_driver omap_venchw_driver = {
- .remove = omap_venchw_remove,
+ .remove = __exit_p(omap_venchw_remove),
.driver = {
.name = "omapdss_venc",
.owner = THIS_MODULE,
@@ -887,7 +887,7 @@ static struct platform_driver omap_venchw_driver = {
},
};
-int venc_init_platform_driver(void)
+__init int venc_init_platform_driver(void)
{
if (cpu_is_omap44xx())
return 0;
@@ -895,7 +895,7 @@ int venc_init_platform_driver(void)
return platform_driver_probe(&omap_venchw_driver, omap_venchw_probe);
}
-void venc_uninit_platform_driver(void)
+__exit void venc_uninit_platform_driver(void)
{
if (cpu_is_omap44xx())
return;
--
1.7.4.1
^ permalink raw reply related
* [PATCH 18/21] OMAPDSS: use platform_driver_probe for dsi/hdmi/rfbi/venc/dpi/sdi
From: Tomi Valkeinen @ 2012-03-07 12:44 UTC (permalink / raw)
To: linux-omap, linux-fbdev; +Cc: archit, Tomi Valkeinen
In-Reply-To: <1331124290-6285-1-git-send-email-tomi.valkeinen@ti.com>
Now that the core.c doesn't fail if output driver's init fails, we can
change the uses of platform_driver_register to platform_driver_probe.
This will allow us to use __init in the following patches.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
drivers/video/omap2/dss/dpi.c | 3 +--
drivers/video/omap2/dss/dsi.c | 3 +--
drivers/video/omap2/dss/hdmi.c | 3 +--
drivers/video/omap2/dss/rfbi.c | 3 +--
drivers/video/omap2/dss/sdi.c | 3 +--
drivers/video/omap2/dss/venc.c | 3 +--
6 files changed, 6 insertions(+), 12 deletions(-)
diff --git a/drivers/video/omap2/dss/dpi.c b/drivers/video/omap2/dss/dpi.c
index 511df3c..5ca216b 100644
--- a/drivers/video/omap2/dss/dpi.c
+++ b/drivers/video/omap2/dss/dpi.c
@@ -375,7 +375,6 @@ static int omap_dpi_remove(struct platform_device *pdev)
}
static struct platform_driver omap_dpi_driver = {
- .probe = omap_dpi_probe,
.remove = omap_dpi_remove,
.driver = {
.name = "omapdss_dpi",
@@ -385,7 +384,7 @@ static struct platform_driver omap_dpi_driver = {
int dpi_init_platform_driver(void)
{
- return platform_driver_register(&omap_dpi_driver);
+ return platform_driver_probe(&omap_dpi_driver, omap_dpi_probe);
}
void dpi_uninit_platform_driver(void)
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index 0a1c5e3..9402d00 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -4803,7 +4803,6 @@ static const struct dev_pm_ops dsi_pm_ops = {
};
static struct platform_driver omap_dsihw_driver = {
- .probe = omap_dsihw_probe,
.remove = omap_dsihw_remove,
.driver = {
.name = "omapdss_dsi",
@@ -4814,7 +4813,7 @@ static struct platform_driver omap_dsihw_driver = {
int dsi_init_platform_driver(void)
{
- return platform_driver_register(&omap_dsihw_driver);
+ return platform_driver_probe(&omap_dsihw_driver, omap_dsihw_probe);
}
void dsi_uninit_platform_driver(void)
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index 10295fc..2f369ed 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -871,7 +871,6 @@ static const struct dev_pm_ops hdmi_pm_ops = {
};
static struct platform_driver omapdss_hdmihw_driver = {
- .probe = omapdss_hdmihw_probe,
.remove = omapdss_hdmihw_remove,
.driver = {
.name = "omapdss_hdmi",
@@ -882,7 +881,7 @@ static struct platform_driver omapdss_hdmihw_driver = {
int hdmi_init_platform_driver(void)
{
- return platform_driver_register(&omapdss_hdmihw_driver);
+ return platform_driver_probe(&omapdss_hdmihw_driver, omapdss_hdmihw_probe);
}
void hdmi_uninit_platform_driver(void)
diff --git a/drivers/video/omap2/dss/rfbi.c b/drivers/video/omap2/dss/rfbi.c
index b07010b..b2b0d5e 100644
--- a/drivers/video/omap2/dss/rfbi.c
+++ b/drivers/video/omap2/dss/rfbi.c
@@ -995,7 +995,6 @@ static const struct dev_pm_ops rfbi_pm_ops = {
};
static struct platform_driver omap_rfbihw_driver = {
- .probe = omap_rfbihw_probe,
.remove = omap_rfbihw_remove,
.driver = {
.name = "omapdss_rfbi",
@@ -1006,7 +1005,7 @@ static struct platform_driver omap_rfbihw_driver = {
int rfbi_init_platform_driver(void)
{
- return platform_driver_register(&omap_rfbihw_driver);
+ return platform_driver_probe(&omap_rfbihw_driver, omap_rfbihw_probe);
}
void rfbi_uninit_platform_driver(void)
diff --git a/drivers/video/omap2/dss/sdi.c b/drivers/video/omap2/dss/sdi.c
index 684a4de..2cbcc00 100644
--- a/drivers/video/omap2/dss/sdi.c
+++ b/drivers/video/omap2/dss/sdi.c
@@ -187,7 +187,6 @@ static int omap_sdi_remove(struct platform_device *pdev)
}
static struct platform_driver omap_sdi_driver = {
- .probe = omap_sdi_probe,
.remove = omap_sdi_remove,
.driver = {
.name = "omapdss_sdi",
@@ -197,7 +196,7 @@ static struct platform_driver omap_sdi_driver = {
int sdi_init_platform_driver(void)
{
- return platform_driver_register(&omap_sdi_driver);
+ return platform_driver_probe(&omap_sdi_driver, omap_sdi_probe);
}
void sdi_uninit_platform_driver(void)
diff --git a/drivers/video/omap2/dss/venc.c b/drivers/video/omap2/dss/venc.c
index a9c7c7c..ca0bcdd 100644
--- a/drivers/video/omap2/dss/venc.c
+++ b/drivers/video/omap2/dss/venc.c
@@ -879,7 +879,6 @@ static const struct dev_pm_ops venc_pm_ops = {
};
static struct platform_driver omap_venchw_driver = {
- .probe = omap_venchw_probe,
.remove = omap_venchw_remove,
.driver = {
.name = "omapdss_venc",
@@ -893,7 +892,7 @@ int venc_init_platform_driver(void)
if (cpu_is_omap44xx())
return 0;
- return platform_driver_register(&omap_venchw_driver);
+ return platform_driver_probe(&omap_venchw_driver, omap_venchw_probe);
}
void venc_uninit_platform_driver(void)
--
1.7.4.1
^ permalink raw reply related
* [PATCH 17/21] OMAPDSS: move the creation of debugfs files
From: Tomi Valkeinen @ 2012-03-07 12:44 UTC (permalink / raw)
To: linux-omap, linux-fbdev; +Cc: archit, Tomi Valkeinen
In-Reply-To: <1331124290-6285-1-git-send-email-tomi.valkeinen@ti.com>
Instead of having an ugly #ifdef mess in the core.c for creating debugfs
files, add a dss_debugfs_create_file() function that the dss drivers
can use to create the debugfs files.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
drivers/video/omap2/dss/core.c | 46 +++++++++++++++-----------------------
drivers/video/omap2/dss/dispc.c | 7 +++++-
drivers/video/omap2/dss/dsi.c | 42 +++++++++--------------------------
drivers/video/omap2/dss/dss.c | 4 ++-
drivers/video/omap2/dss/dss.h | 11 +--------
drivers/video/omap2/dss/hdmi.c | 4 ++-
drivers/video/omap2/dss/rfbi.c | 4 ++-
drivers/video/omap2/dss/venc.c | 4 ++-
8 files changed, 48 insertions(+), 74 deletions(-)
diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
index ac4f2cb..a744474 100644
--- a/drivers/video/omap2/dss/core.c
+++ b/drivers/video/omap2/dss/core.c
@@ -156,34 +156,6 @@ static int dss_initialize_debugfs(void)
debugfs_create_file("clk", S_IRUGO, dss_debugfs_dir,
&dss_debug_dump_clocks, &dss_debug_fops);
-#ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS
- debugfs_create_file("dispc_irq", S_IRUGO, dss_debugfs_dir,
- &dispc_dump_irqs, &dss_debug_fops);
-#endif
-
-#if defined(CONFIG_OMAP2_DSS_DSI) && defined(CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS)
- dsi_create_debugfs_files_irq(dss_debugfs_dir, &dss_debug_fops);
-#endif
-
- debugfs_create_file("dss", S_IRUGO, dss_debugfs_dir,
- &dss_dump_regs, &dss_debug_fops);
- debugfs_create_file("dispc", S_IRUGO, dss_debugfs_dir,
- &dispc_dump_regs, &dss_debug_fops);
-#ifdef CONFIG_OMAP2_DSS_RFBI
- debugfs_create_file("rfbi", S_IRUGO, dss_debugfs_dir,
- &rfbi_dump_regs, &dss_debug_fops);
-#endif
-#ifdef CONFIG_OMAP2_DSS_DSI
- dsi_create_debugfs_files_reg(dss_debugfs_dir, &dss_debug_fops);
-#endif
-#ifdef CONFIG_OMAP2_DSS_VENC
- debugfs_create_file("venc", S_IRUGO, dss_debugfs_dir,
- &venc_dump_regs, &dss_debug_fops);
-#endif
-#ifdef CONFIG_OMAP4_DSS_HDMI
- debugfs_create_file("hdmi", S_IRUGO, dss_debugfs_dir,
- &hdmi_dump_regs, &dss_debug_fops);
-#endif
return 0;
}
@@ -192,6 +164,19 @@ static void dss_uninitialize_debugfs(void)
if (dss_debugfs_dir)
debugfs_remove_recursive(dss_debugfs_dir);
}
+
+int dss_debugfs_create_file(const char *name, void (*write)(struct seq_file *))
+{
+ struct dentry *d;
+
+ d = debugfs_create_file(name, S_IRUGO, dss_debugfs_dir,
+ write, &dss_debug_fops);
+
+ if (IS_ERR(d))
+ return PTR_ERR(d);
+
+ return 0;
+}
#else /* CONFIG_DEBUG_FS && CONFIG_OMAP2_DSS_DEBUG_SUPPORT */
static inline int dss_initialize_debugfs(void)
{
@@ -200,6 +185,11 @@ static inline int dss_initialize_debugfs(void)
static inline void dss_uninitialize_debugfs(void)
{
}
+static inline int dss_debugfs_create_file(const char *name,
+ void (*write)(struct seq_file *))
+{
+ return 0;
+}
#endif /* CONFIG_DEBUG_FS && CONFIG_OMAP2_DSS_DEBUG_SUPPORT */
/* PLATFORM DEVICE */
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index 1fbe480..a555e32 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -2571,7 +2571,7 @@ void dispc_dump_irqs(struct seq_file *s)
}
#endif
-void dispc_dump_regs(struct seq_file *s)
+static void dispc_dump_regs(struct seq_file *s)
{
int i, j;
const char *mgr_names[] = {
@@ -3387,6 +3387,11 @@ static int omap_dispchw_probe(struct platform_device *pdev)
dispc_runtime_put();
+ dss_debugfs_create_file("dispc", dispc_dump_regs);
+
+#ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS
+ dss_debugfs_create_file("dispc_irq", dispc_dump_irqs);
+#endif
return 0;
err_runtime_get:
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index 4bee235..0a1c5e3 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -1883,22 +1883,6 @@ static void dsi2_dump_irqs(struct seq_file *s)
dsi_dump_dsidev_irqs(dsidev, s);
}
-
-void dsi_create_debugfs_files_irq(struct dentry *debugfs_dir,
- const struct file_operations *debug_fops)
-{
- struct platform_device *dsidev;
-
- dsidev = dsi_get_dsidev_from_id(0);
- if (dsidev)
- debugfs_create_file("dsi1_irqs", S_IRUGO, debugfs_dir,
- &dsi1_dump_irqs, debug_fops);
-
- dsidev = dsi_get_dsidev_from_id(1);
- if (dsidev)
- debugfs_create_file("dsi2_irqs", S_IRUGO, debugfs_dir,
- &dsi2_dump_irqs, debug_fops);
-}
#endif
static void dsi_dump_dsidev_regs(struct platform_device *dsidev,
@@ -1999,21 +1983,6 @@ static void dsi2_dump_regs(struct seq_file *s)
dsi_dump_dsidev_regs(dsidev, s);
}
-void dsi_create_debugfs_files_reg(struct dentry *debugfs_dir,
- const struct file_operations *debug_fops)
-{
- struct platform_device *dsidev;
-
- dsidev = dsi_get_dsidev_from_id(0);
- if (dsidev)
- debugfs_create_file("dsi1_regs", S_IRUGO, debugfs_dir,
- &dsi1_dump_regs, debug_fops);
-
- dsidev = dsi_get_dsidev_from_id(1);
- if (dsidev)
- debugfs_create_file("dsi2_regs", S_IRUGO, debugfs_dir,
- &dsi2_dump_regs, debug_fops);
-}
enum dsi_cio_power_state {
DSI_COMPLEXIO_POWER_OFF = 0x0,
DSI_COMPLEXIO_POWER_ON = 0x1,
@@ -4768,6 +4737,17 @@ static int omap_dsihw_probe(struct platform_device *dsidev)
dsi_runtime_put(dsidev);
+ if (dsi_module = 0)
+ dss_debugfs_create_file("dsi1_regs", dsi1_dump_regs);
+ else if (dsi_module = 1)
+ dss_debugfs_create_file("dsi2_regs", dsi2_dump_regs);
+
+#ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS
+ if (dsi_module = 0)
+ dss_debugfs_create_file("dsi1_irqs", dsi1_dump_irqs);
+ else if (dsi_module = 1)
+ dss_debugfs_create_file("dsi2_irqs", dsi2_dump_irqs);
+#endif
return 0;
err_runtime_get:
diff --git a/drivers/video/omap2/dss/dss.c b/drivers/video/omap2/dss/dss.c
index da528b7..47a4c2a 100644
--- a/drivers/video/omap2/dss/dss.c
+++ b/drivers/video/omap2/dss/dss.c
@@ -277,7 +277,7 @@ void dss_dump_clocks(struct seq_file *s)
dss_runtime_put();
}
-void dss_dump_regs(struct seq_file *s)
+static void dss_dump_regs(struct seq_file *s)
{
#define DUMPREG(r) seq_printf(s, "%-35s %08x\n", #r, dss_read_reg(r))
@@ -791,6 +791,8 @@ static int omap_dsshw_probe(struct platform_device *pdev)
dss_runtime_put();
+ dss_debugfs_create_file("dss", dss_dump_regs);
+
return 0;
err_runtime_get:
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index af7bed1..5746bed 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -165,6 +165,7 @@ struct regulator *dss_get_vdds_sdi(void);
int dss_get_ctx_loss_count(struct device *dev);
int dss_dsi_enable_pads(int dsi_id, unsigned lane_mask);
void dss_dsi_disable_pads(int dsi_id, unsigned lane_mask);
+int dss_debugfs_create_file(const char *name, void (*write)(struct seq_file *));
/* apply */
void dss_apply_init(void);
@@ -235,7 +236,6 @@ enum dss_hdmi_venc_clk_source_select dss_get_hdmi_venc_clk_source(void);
const char *dss_get_generic_clk_source_name(enum omap_dss_clk_source clk_src);
void dss_dump_clocks(struct seq_file *s);
-void dss_dump_regs(struct seq_file *s);
#if defined(CONFIG_DEBUG_FS) && defined(CONFIG_OMAP2_DSS_DEBUG_SUPPORT)
void dss_debug_dump_clocks(struct seq_file *s);
#endif
@@ -282,10 +282,6 @@ int dsi_runtime_get(struct platform_device *dsidev);
void dsi_runtime_put(struct platform_device *dsidev);
void dsi_dump_clocks(struct seq_file *s);
-void dsi_create_debugfs_files_irq(struct dentry *debugfs_dir,
- const struct file_operations *debug_fops);
-void dsi_create_debugfs_files_reg(struct dentry *debugfs_dir,
- const struct file_operations *debug_fops);
int dsi_init_display(struct omap_dss_device *display);
void dsi_irq_handler(void);
@@ -368,8 +364,6 @@ int dpi_init_display(struct omap_dss_device *dssdev);
int dispc_init_platform_driver(void);
void dispc_uninit_platform_driver(void);
void dispc_dump_clocks(struct seq_file *s);
-void dispc_dump_irqs(struct seq_file *s);
-void dispc_dump_regs(struct seq_file *s);
void dispc_irq_handler(void);
void dispc_fake_vsync_irq(void);
@@ -435,7 +429,6 @@ void dispc_mgr_setup(enum omap_channel channel,
#ifdef CONFIG_OMAP2_DSS_VENC
int venc_init_platform_driver(void);
void venc_uninit_platform_driver(void);
-void venc_dump_regs(struct seq_file *s);
int venc_init_display(struct omap_dss_device *display);
unsigned long venc_get_pixel_clock(void);
#else
@@ -452,7 +445,6 @@ int hdmi_init_platform_driver(void);
void hdmi_uninit_platform_driver(void);
int hdmi_init_display(struct omap_dss_device *dssdev);
unsigned long hdmi_get_pixel_clock(void);
-void hdmi_dump_regs(struct seq_file *s);
#else
static inline int hdmi_init_display(struct omap_dss_device *dssdev)
{
@@ -477,7 +469,6 @@ void hdmi_panel_exit(void);
/* RFBI */
int rfbi_init_platform_driver(void);
void rfbi_uninit_platform_driver(void);
-void rfbi_dump_regs(struct seq_file *s);
int rfbi_init_display(struct omap_dss_device *display);
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index 08a316b..10295fc 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -419,7 +419,7 @@ void omapdss_hdmi_display_set_timing(struct omap_dss_device *dssdev)
}
}
-void hdmi_dump_regs(struct seq_file *s)
+static void hdmi_dump_regs(struct seq_file *s)
{
mutex_lock(&hdmi.lock);
@@ -809,6 +809,8 @@ static int omapdss_hdmihw_probe(struct platform_device *pdev)
hdmi_panel_init();
+ dss_debugfs_create_file("hdmi", hdmi_dump_regs);
+
#if defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI) || \
defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI_MODULE)
diff --git a/drivers/video/omap2/dss/rfbi.c b/drivers/video/omap2/dss/rfbi.c
index b6990ba..b07010b 100644
--- a/drivers/video/omap2/dss/rfbi.c
+++ b/drivers/video/omap2/dss/rfbi.c
@@ -799,7 +799,7 @@ int omap_rfbi_update(struct omap_dss_device *dssdev,
}
EXPORT_SYMBOL(omap_rfbi_update);
-void rfbi_dump_regs(struct seq_file *s)
+static void rfbi_dump_regs(struct seq_file *s)
{
#define DUMPREG(r) seq_printf(s, "%-35s %08x\n", #r, rfbi_read_reg(r))
@@ -956,6 +956,8 @@ static int omap_rfbihw_probe(struct platform_device *pdev)
rfbi_runtime_put();
+ dss_debugfs_create_file("rfbi", rfbi_dump_regs);
+
return 0;
err_runtime_get:
diff --git a/drivers/video/omap2/dss/venc.c b/drivers/video/omap2/dss/venc.c
index 637abcb..a9c7c7c 100644
--- a/drivers/video/omap2/dss/venc.c
+++ b/drivers/video/omap2/dss/venc.c
@@ -695,7 +695,7 @@ int venc_init_display(struct omap_dss_device *dssdev)
return 0;
}
-void venc_dump_regs(struct seq_file *s)
+static void venc_dump_regs(struct seq_file *s)
{
#define DUMPREG(r) seq_printf(s, "%-35s %08x\n", #r, venc_read_reg(r))
@@ -824,6 +824,8 @@ static int omap_venchw_probe(struct platform_device *pdev)
if (r)
goto err_reg_panel_driver;
+ dss_debugfs_create_file("venc", venc_dump_regs);
+
return 0;
err_reg_panel_driver:
--
1.7.4.1
^ permalink raw reply related
* [PATCH 16/21] OMAPDSS: handle output-driver reg/unreg more dynamically
From: Tomi Valkeinen @ 2012-03-07 12:44 UTC (permalink / raw)
To: linux-omap, linux-fbdev; +Cc: archit, Tomi Valkeinen
In-Reply-To: <1331124290-6285-1-git-send-email-tomi.valkeinen@ti.com>
Initialize and uninitialize the output drivers by using arrays of
pointers to the init/uninit functions. This simplifies the code
slightly.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
drivers/video/omap2/dss/core.c | 111 +++++++++++++++++++++-------------------
drivers/video/omap2/dss/dss.h | 41 ---------------
2 files changed, 59 insertions(+), 93 deletions(-)
diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
index 654962a..ac4f2cb 100644
--- a/drivers/video/omap2/dss/core.c
+++ b/drivers/video/omap2/dss/core.c
@@ -503,10 +503,54 @@ static int omap_dss_bus_register(void)
}
/* INIT */
+static int (*dss_output_drv_reg_funcs[])(void) __initdata = {
+#ifdef CONFIG_OMAP2_DSS_DPI
+ dpi_init_platform_driver,
+#endif
+#ifdef CONFIG_OMAP2_DSS_SDI
+ sdi_init_platform_driver,
+#endif
+#ifdef CONFIG_OMAP2_DSS_RFBI
+ rfbi_init_platform_driver,
+#endif
+#ifdef CONFIG_OMAP2_DSS_VENC
+ venc_init_platform_driver,
+#endif
+#ifdef CONFIG_OMAP2_DSS_DSI
+ dsi_init_platform_driver,
+#endif
+#ifdef CONFIG_OMAP4_DSS_HDMI
+ hdmi_init_platform_driver,
+#endif
+};
+
+static void (*dss_output_drv_unreg_funcs[])(void) __exitdata = {
+#ifdef CONFIG_OMAP2_DSS_DPI
+ dpi_uninit_platform_driver,
+#endif
+#ifdef CONFIG_OMAP2_DSS_SDI
+ sdi_uninit_platform_driver,
+#endif
+#ifdef CONFIG_OMAP2_DSS_RFBI
+ rfbi_uninit_platform_driver,
+#endif
+#ifdef CONFIG_OMAP2_DSS_VENC
+ venc_uninit_platform_driver,
+#endif
+#ifdef CONFIG_OMAP2_DSS_DSI
+ dsi_uninit_platform_driver,
+#endif
+#ifdef CONFIG_OMAP4_DSS_HDMI
+ hdmi_uninit_platform_driver,
+#endif
+};
+
+static bool dss_output_drv_loaded[ARRAY_SIZE(dss_output_drv_reg_funcs)];
static int __init omap_dss_register_drivers(void)
{
int r;
+ int i;
r = platform_driver_probe(&omap_dss_driver, omap_dss_probe);
if (r)
@@ -524,56 +568,18 @@ static int __init omap_dss_register_drivers(void)
goto err_dispc;
}
- r = dpi_init_platform_driver();
- if (r) {
- DSSERR("Failed to initialize dpi platform driver\n");
- goto err_dpi;
- }
-
- r = sdi_init_platform_driver();
- if (r) {
- DSSERR("Failed to initialize sdi platform driver\n");
- goto err_sdi;
- }
-
- r = rfbi_init_platform_driver();
- if (r) {
- DSSERR("Failed to initialize rfbi platform driver\n");
- goto err_rfbi;
- }
-
- r = venc_init_platform_driver();
- if (r) {
- DSSERR("Failed to initialize venc platform driver\n");
- goto err_venc;
- }
-
- r = dsi_init_platform_driver();
- if (r) {
- DSSERR("Failed to initialize DSI platform driver\n");
- goto err_dsi;
- }
-
- r = hdmi_init_platform_driver();
- if (r) {
- DSSERR("Failed to initialize hdmi\n");
- goto err_hdmi;
+ /*
+ * It's ok if the output-driver register fails. It happens, for example,
+ * when there is no output-device (e.g. SDI for OMAP4).
+ */
+ for (i = 0; i < ARRAY_SIZE(dss_output_drv_reg_funcs); ++i) {
+ r = dss_output_drv_reg_funcs[i]();
+ if (r = 0)
+ dss_output_drv_loaded[i] = true;
}
return 0;
-err_hdmi:
- dsi_uninit_platform_driver();
-err_dsi:
- venc_uninit_platform_driver();
-err_venc:
- rfbi_uninit_platform_driver();
-err_rfbi:
- sdi_uninit_platform_driver();
-err_sdi:
- dpi_uninit_platform_driver();
-err_dpi:
- dispc_uninit_platform_driver();
err_dispc:
dss_uninit_platform_driver();
err_dss:
@@ -584,12 +590,13 @@ err_dss:
static void __exit omap_dss_unregister_drivers(void)
{
- hdmi_uninit_platform_driver();
- dsi_uninit_platform_driver();
- venc_uninit_platform_driver();
- rfbi_uninit_platform_driver();
- sdi_uninit_platform_driver();
- dpi_uninit_platform_driver();
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(dss_output_drv_unreg_funcs); ++i) {
+ if (dss_output_drv_loaded[i])
+ dss_output_drv_unreg_funcs[i]();
+ }
+
dispc_uninit_platform_driver();
dss_uninit_platform_driver();
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index 24aadde..af7bed1 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -265,14 +265,9 @@ int dss_calc_clock_div(bool is_tft, unsigned long req_pck,
struct dispc_clock_info *dispc_cinfo);
/* SDI */
-#ifdef CONFIG_OMAP2_DSS_SDI
int sdi_init_platform_driver(void);
void sdi_uninit_platform_driver(void);
int sdi_init_display(struct omap_dss_device *display);
-#else
-static inline int sdi_init_platform_driver(void) { return 0; }
-static inline void sdi_uninit_platform_driver(void) { }
-#endif
/* DSI */
#ifdef CONFIG_OMAP2_DSS_DSI
@@ -309,13 +304,6 @@ void dsi_wait_pll_hsdiv_dispc_active(struct platform_device *dsidev);
void dsi_wait_pll_hsdiv_dsi_active(struct platform_device *dsidev);
struct platform_device *dsi_get_dsidev_from_id(int module);
#else
-static inline int dsi_init_platform_driver(void)
-{
- return 0;
-}
-static inline void dsi_uninit_platform_driver(void)
-{
-}
static inline int dsi_runtime_get(struct platform_device *dsidev)
{
return 0;
@@ -372,14 +360,9 @@ static inline struct platform_device *dsi_get_dsidev_from_id(int module)
#endif
/* DPI */
-#ifdef CONFIG_OMAP2_DSS_DPI
int dpi_init_platform_driver(void);
void dpi_uninit_platform_driver(void);
int dpi_init_display(struct omap_dss_device *dssdev);
-#else
-static inline int dpi_init_platform_driver(void) { return 0; }
-static inline void dpi_uninit_platform_driver(void) { }
-#endif
/* DISPC */
int dispc_init_platform_driver(void);
@@ -456,13 +439,6 @@ void venc_dump_regs(struct seq_file *s);
int venc_init_display(struct omap_dss_device *display);
unsigned long venc_get_pixel_clock(void);
#else
-static inline int venc_init_platform_driver(void)
-{
- return 0;
-}
-static inline void venc_uninit_platform_driver(void)
-{
-}
static inline unsigned long venc_get_pixel_clock(void)
{
WARN("%s: VENC not compiled in, returning pclk as 0\n", __func__);
@@ -482,13 +458,6 @@ static inline int hdmi_init_display(struct omap_dss_device *dssdev)
{
return 0;
}
-static inline int hdmi_init_platform_driver(void)
-{
- return 0;
-}
-static inline void hdmi_uninit_platform_driver(void)
-{
-}
static inline unsigned long hdmi_get_pixel_clock(void)
{
WARN("%s: HDMI not compiled in, returning pclk as 0\n", __func__);
@@ -506,20 +475,10 @@ int hdmi_panel_init(void);
void hdmi_panel_exit(void);
/* RFBI */
-#ifdef CONFIG_OMAP2_DSS_RFBI
int rfbi_init_platform_driver(void);
void rfbi_uninit_platform_driver(void);
void rfbi_dump_regs(struct seq_file *s);
int rfbi_init_display(struct omap_dss_device *display);
-#else
-static inline int rfbi_init_platform_driver(void)
-{
- return 0;
-}
-static inline void rfbi_uninit_platform_driver(void)
-{
-}
-#endif
#ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS
--
1.7.4.1
^ permalink raw reply related
* [PATCH 15/21] OMAPDSS: remove uses of dss_runtime_get/put
From: Tomi Valkeinen @ 2012-03-07 12:44 UTC (permalink / raw)
To: linux-omap, linux-fbdev; +Cc: archit, Tomi Valkeinen
In-Reply-To: <1331124290-6285-1-git-send-email-tomi.valkeinen@ti.com>
Now that the omapdss_core device is the parent for all other dss
devices, we don't need to use the dss_runtime_get/put anymore. Instead,
enabling omapdss_core will happen automatically when a child device is
enabled.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
drivers/video/omap2/dss/dispc.c | 7 -------
drivers/video/omap2/dss/dpi.c | 16 +---------------
drivers/video/omap2/dss/dsi.c | 12 +-----------
drivers/video/omap2/dss/dss.c | 7 +++++--
drivers/video/omap2/dss/dss.h | 3 ---
drivers/video/omap2/dss/hdmi.c | 34 ++--------------------------------
drivers/video/omap2/dss/rfbi.c | 12 +-----------
drivers/video/omap2/dss/sdi.c | 7 -------
drivers/video/omap2/dss/venc.c | 12 +-----------
9 files changed, 11 insertions(+), 99 deletions(-)
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index c71d4c5..1fbe480 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -3407,19 +3407,12 @@ static int omap_dispchw_remove(struct platform_device *pdev)
static int dispc_runtime_suspend(struct device *dev)
{
dispc_save_context();
- dss_runtime_put();
return 0;
}
static int dispc_runtime_resume(struct device *dev)
{
- int r;
-
- r = dss_runtime_get();
- if (r < 0)
- return r;
-
dispc_restore_context();
return 0;
diff --git a/drivers/video/omap2/dss/dpi.c b/drivers/video/omap2/dss/dpi.c
index 5b7bbab..511df3c 100644
--- a/drivers/video/omap2/dss/dpi.c
+++ b/drivers/video/omap2/dss/dpi.c
@@ -202,10 +202,6 @@ int omapdss_dpi_display_enable(struct omap_dss_device *dssdev)
goto err_reg_enable;
}
- r = dss_runtime_get();
- if (r)
- goto err_get_dss;
-
r = dispc_runtime_get();
if (r)
goto err_get_dispc;
@@ -244,8 +240,6 @@ err_dsi_pll_init:
err_get_dsi:
dispc_runtime_put();
err_get_dispc:
- dss_runtime_put();
-err_get_dss:
if (cpu_is_omap34xx())
regulator_disable(dpi.vdds_dsi_reg);
err_reg_enable:
@@ -266,7 +260,6 @@ void omapdss_dpi_display_disable(struct omap_dss_device *dssdev)
}
dispc_runtime_put();
- dss_runtime_put();
if (cpu_is_omap34xx())
regulator_disable(dpi.vdds_dsi_reg);
@@ -283,21 +276,14 @@ void dpi_set_timings(struct omap_dss_device *dssdev,
DSSDBG("dpi_set_timings\n");
dssdev->panel.timings = *timings;
if (dssdev->state = OMAP_DSS_DISPLAY_ACTIVE) {
- r = dss_runtime_get();
- if (r)
- return;
-
r = dispc_runtime_get();
- if (r) {
- dss_runtime_put();
+ if (r)
return;
- }
dpi_set_mode(dssdev);
dispc_mgr_go(dssdev->manager->id);
dispc_runtime_put();
- dss_runtime_put();
}
}
EXPORT_SYMBOL(dpi_set_timings);
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index cf59f40..4bee235 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -4802,7 +4802,6 @@ static int omap_dsihw_remove(struct platform_device *dsidev)
static int dsi_runtime_suspend(struct device *dev)
{
dispc_runtime_put();
- dss_runtime_put();
return 0;
}
@@ -4811,20 +4810,11 @@ static int dsi_runtime_resume(struct device *dev)
{
int r;
- r = dss_runtime_get();
- if (r)
- goto err_get_dss;
-
r = dispc_runtime_get();
if (r)
- goto err_get_dispc;
+ return r;
return 0;
-
-err_get_dispc:
- dss_runtime_put();
-err_get_dss:
- return r;
}
static const struct dev_pm_ops dsi_pm_ops = {
diff --git a/drivers/video/omap2/dss/dss.c b/drivers/video/omap2/dss/dss.c
index 3156851..da528b7 100644
--- a/drivers/video/omap2/dss/dss.c
+++ b/drivers/video/omap2/dss/dss.c
@@ -59,6 +59,9 @@ struct dss_reg {
#define REG_FLD_MOD(idx, val, start, end) \
dss_write_reg(idx, FLD_MOD(dss_read_reg(idx), val, start, end))
+static int dss_runtime_get(void);
+static void dss_runtime_put(void);
+
static struct {
struct platform_device *pdev;
void __iomem *base;
@@ -703,7 +706,7 @@ static void dss_put_clocks(void)
clk_put(dss.dss_clk);
}
-int dss_runtime_get(void)
+static int dss_runtime_get(void)
{
int r;
@@ -714,7 +717,7 @@ int dss_runtime_get(void)
return r < 0 ? r : 0;
}
-void dss_runtime_put(void)
+static void dss_runtime_put(void)
{
int r;
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index 1981626..24aadde 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -230,9 +230,6 @@ int dss_ovl_check(struct omap_overlay *ovl,
int dss_init_platform_driver(void);
void dss_uninit_platform_driver(void);
-int dss_runtime_get(void);
-void dss_runtime_put(void);
-
void dss_select_hdmi_venc_clk_source(enum dss_hdmi_venc_clk_source_select);
enum dss_hdmi_venc_clk_source_select dss_get_hdmi_venc_clk_source(void);
const char *dss_get_generic_clk_source_name(enum omap_dss_clk_source clk_src);
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index b4ad13b..08a316b 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -129,25 +129,12 @@ static int hdmi_runtime_get(void)
DSSDBG("hdmi_runtime_get\n");
- /*
- * HACK: Add dss_runtime_get() to ensure DSS clock domain is enabled.
- * This should be removed later.
- */
- r = dss_runtime_get();
- if (r < 0)
- goto err_get_dss;
-
r = pm_runtime_get_sync(&hdmi.pdev->dev);
WARN_ON(r < 0);
if (r < 0)
- goto err_get_hdmi;
+ return r;
return 0;
-
-err_get_hdmi:
- dss_runtime_put();
-err_get_dss:
- return r;
}
static void hdmi_runtime_put(void)
@@ -158,12 +145,6 @@ static void hdmi_runtime_put(void)
r = pm_runtime_put_sync(&hdmi.pdev->dev);
WARN_ON(r < 0);
-
- /*
- * HACK: This is added to complement the dss_runtime_get() call in
- * hdmi_runtime_get(). This should be removed later.
- */
- dss_runtime_put();
}
int hdmi_init_display(struct omap_dss_device *dssdev)
@@ -865,7 +846,6 @@ static int hdmi_runtime_suspend(struct device *dev)
clk_disable(hdmi.sys_clk);
dispc_runtime_put();
- dss_runtime_put();
return 0;
}
@@ -874,23 +854,13 @@ static int hdmi_runtime_resume(struct device *dev)
{
int r;
- r = dss_runtime_get();
- if (r < 0)
- goto err_get_dss;
-
r = dispc_runtime_get();
if (r < 0)
- goto err_get_dispc;
-
+ return r;
clk_enable(hdmi.sys_clk);
return 0;
-
-err_get_dispc:
- dss_runtime_put();
-err_get_dss:
- return r;
}
static const struct dev_pm_ops hdmi_pm_ops = {
diff --git a/drivers/video/omap2/dss/rfbi.c b/drivers/video/omap2/dss/rfbi.c
index dfd8ec5..b6990ba 100644
--- a/drivers/video/omap2/dss/rfbi.c
+++ b/drivers/video/omap2/dss/rfbi.c
@@ -972,7 +972,6 @@ static int omap_rfbihw_remove(struct platform_device *pdev)
static int rfbi_runtime_suspend(struct device *dev)
{
dispc_runtime_put();
- dss_runtime_put();
return 0;
}
@@ -981,20 +980,11 @@ static int rfbi_runtime_resume(struct device *dev)
{
int r;
- r = dss_runtime_get();
- if (r < 0)
- goto err_get_dss;
-
r = dispc_runtime_get();
if (r < 0)
- goto err_get_dispc;
+ return r;
return 0;
-
-err_get_dispc:
- dss_runtime_put();
-err_get_dss:
- return r;
}
static const struct dev_pm_ops rfbi_pm_ops = {
diff --git a/drivers/video/omap2/dss/sdi.c b/drivers/video/omap2/dss/sdi.c
index d886d93..684a4de 100644
--- a/drivers/video/omap2/dss/sdi.c
+++ b/drivers/video/omap2/dss/sdi.c
@@ -72,10 +72,6 @@ int omapdss_sdi_display_enable(struct omap_dss_device *dssdev)
if (r)
goto err_reg_enable;
- r = dss_runtime_get();
- if (r)
- goto err_get_dss;
-
r = dispc_runtime_get();
if (r)
goto err_get_dispc;
@@ -138,8 +134,6 @@ err_set_dss_clock_div:
err_calc_clock_div:
dispc_runtime_put();
err_get_dispc:
- dss_runtime_put();
-err_get_dss:
regulator_disable(sdi.vdds_sdi_reg);
err_reg_enable:
omap_dss_stop_device(dssdev);
@@ -155,7 +149,6 @@ void omapdss_sdi_display_disable(struct omap_dss_device *dssdev)
dss_sdi_disable();
dispc_runtime_put();
- dss_runtime_put();
regulator_disable(sdi.vdds_sdi_reg);
diff --git a/drivers/video/omap2/dss/venc.c b/drivers/video/omap2/dss/venc.c
index c933733..637abcb 100644
--- a/drivers/video/omap2/dss/venc.c
+++ b/drivers/video/omap2/dss/venc.c
@@ -853,7 +853,6 @@ static int venc_runtime_suspend(struct device *dev)
clk_disable(venc.tv_dac_clk);
dispc_runtime_put();
- dss_runtime_put();
return 0;
}
@@ -862,23 +861,14 @@ static int venc_runtime_resume(struct device *dev)
{
int r;
- r = dss_runtime_get();
- if (r < 0)
- goto err_get_dss;
-
r = dispc_runtime_get();
if (r < 0)
- goto err_get_dispc;
+ return r;
if (venc.tv_dac_clk)
clk_enable(venc.tv_dac_clk);
return 0;
-
-err_get_dispc:
- dss_runtime_put();
-err_get_dss:
- return r;
}
static const struct dev_pm_ops venc_pm_ops = {
--
1.7.4.1
^ permalink raw reply related
* [PATCH 14/21] OMAPDSS: create DPI & SDI drivers
From: Tomi Valkeinen @ 2012-03-07 12:44 UTC (permalink / raw)
To: linux-omap, linux-fbdev; +Cc: archit, Tomi Valkeinen
In-Reply-To: <1331124290-6285-1-git-send-email-tomi.valkeinen@ti.com>
We currently have separate device/driver for each DSS HW module. The DPI
and SDI outputs are more or less parts of the DSS or DISPC hardware
modules, but in SW it makes sense to represent them as device/driver
pairs similarly to all the other outputs. This also makes sense for
device tree, as each node under dss will be a platform device, and
handling DPI & SDI somehow differently than the rest would just make the
code more complex.
This patch modifies the dpi.c and sdi.c to create drivers for the
platform devices.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
drivers/video/omap2/dss/core.c | 18 ++++++++++++++++++
drivers/video/omap2/dss/dpi.c | 23 +++++++++++++++++++++--
drivers/video/omap2/dss/dss.c | 20 +-------------------
drivers/video/omap2/dss/dss.h | 26 ++++++++------------------
drivers/video/omap2/dss/sdi.c | 25 +++++++++++++++++++++++--
5 files changed, 71 insertions(+), 41 deletions(-)
diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
index 95d312c..654962a 100644
--- a/drivers/video/omap2/dss/core.c
+++ b/drivers/video/omap2/dss/core.c
@@ -524,6 +524,18 @@ static int __init omap_dss_register_drivers(void)
goto err_dispc;
}
+ r = dpi_init_platform_driver();
+ if (r) {
+ DSSERR("Failed to initialize dpi platform driver\n");
+ goto err_dpi;
+ }
+
+ r = sdi_init_platform_driver();
+ if (r) {
+ DSSERR("Failed to initialize sdi platform driver\n");
+ goto err_sdi;
+ }
+
r = rfbi_init_platform_driver();
if (r) {
DSSERR("Failed to initialize rfbi platform driver\n");
@@ -557,6 +569,10 @@ err_dsi:
err_venc:
rfbi_uninit_platform_driver();
err_rfbi:
+ sdi_uninit_platform_driver();
+err_sdi:
+ dpi_uninit_platform_driver();
+err_dpi:
dispc_uninit_platform_driver();
err_dispc:
dss_uninit_platform_driver();
@@ -572,6 +588,8 @@ static void __exit omap_dss_unregister_drivers(void)
dsi_uninit_platform_driver();
venc_uninit_platform_driver();
rfbi_uninit_platform_driver();
+ sdi_uninit_platform_driver();
+ dpi_uninit_platform_driver();
dispc_uninit_platform_driver();
dss_uninit_platform_driver();
diff --git a/drivers/video/omap2/dss/dpi.c b/drivers/video/omap2/dss/dpi.c
index faaf305..5b7bbab 100644
--- a/drivers/video/omap2/dss/dpi.c
+++ b/drivers/video/omap2/dss/dpi.c
@@ -378,12 +378,31 @@ int dpi_init_display(struct omap_dss_device *dssdev)
return 0;
}
-int dpi_init(void)
+static int omap_dpi_probe(struct platform_device *pdev)
{
return 0;
}
-void dpi_exit(void)
+static int omap_dpi_remove(struct platform_device *pdev)
{
+ return 0;
}
+static struct platform_driver omap_dpi_driver = {
+ .probe = omap_dpi_probe,
+ .remove = omap_dpi_remove,
+ .driver = {
+ .name = "omapdss_dpi",
+ .owner = THIS_MODULE,
+ },
+};
+
+int dpi_init_platform_driver(void)
+{
+ return platform_driver_register(&omap_dpi_driver);
+}
+
+void dpi_uninit_platform_driver(void)
+{
+ platform_driver_unregister(&omap_dpi_driver);
+}
diff --git a/drivers/video/omap2/dss/dss.c b/drivers/video/omap2/dss/dss.c
index 34cc84f..3156851 100644
--- a/drivers/video/omap2/dss/dss.c
+++ b/drivers/video/omap2/dss/dss.c
@@ -782,18 +782,6 @@ static int omap_dsshw_probe(struct platform_device *pdev)
dss.lcd_clk_source[0] = OMAP_DSS_CLK_SRC_FCK;
dss.lcd_clk_source[1] = OMAP_DSS_CLK_SRC_FCK;
- r = dpi_init();
- if (r) {
- DSSERR("Failed to initialize DPI\n");
- goto err_dpi;
- }
-
- r = sdi_init();
- if (r) {
- DSSERR("Failed to initialize SDI\n");
- goto err_sdi;
- }
-
rev = dss_read_reg(DSS_REVISION);
printk(KERN_INFO "OMAP DSS rev %d.%d\n",
FLD_GET(rev, 7, 4), FLD_GET(rev, 3, 0));
@@ -801,10 +789,7 @@ static int omap_dsshw_probe(struct platform_device *pdev)
dss_runtime_put();
return 0;
-err_sdi:
- dpi_exit();
-err_dpi:
- dss_runtime_put();
+
err_runtime_get:
pm_runtime_disable(&pdev->dev);
dss_put_clocks();
@@ -813,9 +798,6 @@ err_runtime_get:
static int omap_dsshw_remove(struct platform_device *pdev)
{
- dpi_exit();
- sdi_exit();
-
pm_runtime_disable(&pdev->dev);
dss_put_clocks();
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index d37ed80..1981626 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -269,17 +269,12 @@ int dss_calc_clock_div(bool is_tft, unsigned long req_pck,
/* SDI */
#ifdef CONFIG_OMAP2_DSS_SDI
-int sdi_init(void);
-void sdi_exit(void);
+int sdi_init_platform_driver(void);
+void sdi_uninit_platform_driver(void);
int sdi_init_display(struct omap_dss_device *display);
#else
-static inline int sdi_init(void)
-{
- return 0;
-}
-static inline void sdi_exit(void)
-{
-}
+static inline int sdi_init_platform_driver(void) { return 0; }
+static inline void sdi_uninit_platform_driver(void) { }
#endif
/* DSI */
@@ -381,17 +376,12 @@ static inline struct platform_device *dsi_get_dsidev_from_id(int module)
/* DPI */
#ifdef CONFIG_OMAP2_DSS_DPI
-int dpi_init(void);
-void dpi_exit(void);
+int dpi_init_platform_driver(void);
+void dpi_uninit_platform_driver(void);
int dpi_init_display(struct omap_dss_device *dssdev);
#else
-static inline int dpi_init(void)
-{
- return 0;
-}
-static inline void dpi_exit(void)
-{
-}
+static inline int dpi_init_platform_driver(void) { return 0; }
+static inline void dpi_uninit_platform_driver(void) { }
#endif
/* DISPC */
diff --git a/drivers/video/omap2/dss/sdi.c b/drivers/video/omap2/dss/sdi.c
index 8266ca0..d886d93 100644
--- a/drivers/video/omap2/dss/sdi.c
+++ b/drivers/video/omap2/dss/sdi.c
@@ -24,6 +24,7 @@
#include <linux/err.h>
#include <linux/regulator/consumer.h>
#include <linux/export.h>
+#include <linux/platform_device.h>
#include <video/omapdss.h>
#include "dss.h"
@@ -182,11 +183,31 @@ int sdi_init_display(struct omap_dss_device *dssdev)
return 0;
}
-int sdi_init(void)
+static int omap_sdi_probe(struct platform_device *pdev)
{
return 0;
}
-void sdi_exit(void)
+static int omap_sdi_remove(struct platform_device *pdev)
{
+ return 0;
+}
+
+static struct platform_driver omap_sdi_driver = {
+ .probe = omap_sdi_probe,
+ .remove = omap_sdi_remove,
+ .driver = {
+ .name = "omapdss_sdi",
+ .owner = THIS_MODULE,
+ },
+};
+
+int sdi_init_platform_driver(void)
+{
+ return platform_driver_register(&omap_sdi_driver);
+}
+
+void sdi_uninit_platform_driver(void)
+{
+ platform_driver_unregister(&omap_sdi_driver);
}
--
1.7.4.1
^ permalink raw reply related
* [PATCH 13/21] OMAPDSS: create DPI & SDI devices
From: Tomi Valkeinen @ 2012-03-07 12:44 UTC (permalink / raw)
To: linux-omap, linux-fbdev; +Cc: archit, Tomi Valkeinen
In-Reply-To: <1331124290-6285-1-git-send-email-tomi.valkeinen@ti.com>
We currently have separate device/driver for each DSS HW module. The DPI
and SDI outputs are more or less parts of the DSS or DISPC hardware
modules, but in SW it makes sense to represent them as device/driver
pairs similarly to all the other outputs. This also makes sense for
device tree, as each node under dss will be a platform device, and
handling DPI & SDI somehow differently than the rest would just make the
code more complex.
This patch modifies arch/arm/mach-omap2/display.c to create platform
devices for DPI and SDI, and later patches will implement driver for
them.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
arch/arm/mach-omap2/display.c | 57 +++++++++++++++++++++++++++++++++++++++++
1 files changed, 57 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
index 3227eca..f102d1f 100644
--- a/arch/arm/mach-omap2/display.c
+++ b/arch/arm/mach-omap2/display.c
@@ -237,6 +237,46 @@ err:
return ERR_PTR(r);
}
+static struct platform_device *create_simple_dss_pdev(const char *pdev_name,
+ int pdev_id, void *pdata, int pdata_len,
+ struct platform_device *parent)
+{
+ struct platform_device *pdev;
+ int r;
+
+ pdev = platform_device_alloc(pdev_name, pdev_id);
+ if (!pdev) {
+ pr_err("Could not create pdev for %s\n", pdev_name);
+ r = -ENOMEM;
+ goto err;
+ }
+
+ if (parent != NULL)
+ pdev->dev.parent = &parent->dev;
+
+ if (pdev->id != -1)
+ dev_set_name(&pdev->dev, "%s.%d", pdev->name, pdev->id);
+ else
+ dev_set_name(&pdev->dev, "%s", pdev->name);
+
+ r = platform_device_add_data(pdev, pdata, pdata_len);
+ if (r) {
+ pr_err("Could not set pdata for %s\n", pdev_name);
+ goto err;
+ }
+
+ r = omap_device_register(pdev);
+ if (r) {
+ pr_err("Could not register omap_device for %s\n", pdev_name);
+ goto err;
+ }
+
+ return pdev;
+
+err:
+ return ERR_PTR(r);
+}
+
int __init omap_display_init(struct omap_dss_board_info *board_data)
{
int r = 0;
@@ -292,6 +332,23 @@ int __init omap_display_init(struct omap_dss_board_info *board_data)
dss_pdev = pdev;
}
+ /* Create devices for DPI and SDI */
+
+ pdev = create_simple_dss_pdev("omapdss_dpi", -1, NULL, 0, dss_pdev);
+ if (IS_ERR(pdev)) {
+ pr_err("Could not build platform_device for omapdss_dpi\n");
+ return PTR_ERR(pdev);
+ }
+
+ if (cpu_is_omap34xx()) {
+ pdev = create_simple_dss_pdev("omapdss_sdi", -1, NULL, 0,
+ dss_pdev);
+ if (IS_ERR(pdev)) {
+ pr_err("Could not build platform_device for omapdss_sdi\n");
+ return PTR_ERR(pdev);
+ }
+ }
+
return 0;
}
--
1.7.4.1
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox