* [PATCH] fb_defio: add first_io callback
From: Heiko Stübner @ 2011-12-31 10:45 UTC (permalink / raw)
To: linux-fbdev
With this optional callback the driver is notified when the first page
is entered into the pagelist and a new deferred_io call is scheduled.
A possible use-case for this is runtime-pm. In the first_io call
pm_runtime_get()
could be called, which starts an asynchronous runtime_resume of the
device. In the deferred_io callback a call to
pm_runtime_barrier()
makes the sure, the device is resumed by then and a
pm_runtime_put()
may put the device back to sleep.
Also, some SoCs may use the runtime-pm system to determine if they
are able to enter deeper idle states. Therefore it is necessary to
keep the use-count from the first written page until the conclusion
of the screen update, to prevent the system from going to sleep before
completing the pending update.
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
---
drivers/video/fb_defio.c | 4 ++++
include/linux/fb.h | 1 +
2 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/drivers/video/fb_defio.c b/drivers/video/fb_defio.c
index c27e153..070f26f 100644
--- a/drivers/video/fb_defio.c
+++ b/drivers/video/fb_defio.c
@@ -107,6 +107,10 @@ static int fb_deferred_io_mkwrite(struct vm_area_struct *vma,
/* protect against the workqueue changing the page list */
mutex_lock(&fbdefio->lock);
+ /* first write in this cycle, notify the driver */
+ if (fbdefio->first_io && list_empty(&fbdefio->pagelist))
+ fbdefio->first_io(info);
+
/*
* We want the page to remain locked from ->page_mkwrite until
* the PTE is marked dirty to avoid page_mkclean() being called
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 1d6836c..b86cd41 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -602,6 +602,7 @@ struct fb_deferred_io {
struct mutex lock; /* mutex that protects the page list */
struct list_head pagelist; /* list of touched pages */
/* callback */
+ void (*first_io)(struct fb_info *info);
void (*deferred_io)(struct fb_info *info, struct list_head *pagelist);
};
#endif
--
1.7.2.3
^ permalink raw reply related
* [PATCH] video/omap2. dispc_mgr_enable needs runtime PM
From: NeilBrown @ 2011-12-30 1:37 UTC (permalink / raw)
To: Kevin Hilman, Tony Lindgren, Tomi Valkeinen, linux-omap; +Cc: linux-fbdev
[-- Attachment #1: Type: text/plain, Size: 810 bytes --]
When dispc_mgr_enable is called during shutdown the device might
be asleep, which causes problems. So ensure it is awake.
Signed-off-by: NeilBrown <neilb@suse.de>
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index 5c81533..75a767f 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -2052,12 +2052,14 @@ bool dispc_mgr_is_enabled(enum omap_channel channel)
void dispc_mgr_enable(enum omap_channel channel, bool enable)
{
+ dispc_runtime_get();
if (dispc_mgr_is_lcd(channel))
dispc_mgr_enable_lcd_out(channel, enable);
else if (channel == OMAP_DSS_CHANNEL_DIGIT)
dispc_mgr_enable_digit_out(enable);
else
BUG();
+ dispc_runtime_put();
}
void dispc_lcd_enable_signal_polarity(bool act_high)
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
^ permalink raw reply related
* [PATCH 2/2] backlight: Convert pwm_bl to dev_pm_ops
From: Mark Brown @ 2011-12-29 18:20 UTC (permalink / raw)
To: linux-fbdev
Should be no functional changes, mainly a reorganisation to support
future work.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
drivers/video/backlight/pwm_bl.c | 19 ++++++++++---------
1 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
index b811e8f..13ba95b 100644
--- a/drivers/video/backlight/pwm_bl.c
+++ b/drivers/video/backlight/pwm_bl.c
@@ -169,10 +169,9 @@ static int pwm_backlight_remove(struct platform_device *pdev)
}
#ifdef CONFIG_PM
-static int pwm_backlight_suspend(struct platform_device *pdev,
- pm_message_t state)
+static int pwm_backlight_suspend(struct device *dev)
{
- struct backlight_device *bl = platform_get_drvdata(pdev);
+ struct backlight_device *bl = dev_get_drvdata(dev);
struct pwm_bl_data *pb = dev_get_drvdata(&bl->dev);
if (pb->notify)
@@ -184,27 +183,29 @@ static int pwm_backlight_suspend(struct platform_device *pdev,
return 0;
}
-static int pwm_backlight_resume(struct platform_device *pdev)
+static int pwm_backlight_resume(struct device *dev)
{
- struct backlight_device *bl = platform_get_drvdata(pdev);
+ struct backlight_device *bl = dev_get_drvdata(dev);
backlight_update_status(bl);
return 0;
}
+
+static SIMPLE_DEV_PM_OPS(pwm_backlight_pm_ops, pwm_backlight_suspend,
+ pwm_backlight_resume);
+
#else
-#define pwm_backlight_suspend NULL
-#define pwm_backlight_resume NULL
+#define pwm_backlight_pm_ops NULL
#endif
static struct platform_driver pwm_backlight_driver = {
.driver = {
.name = "pwm-backlight",
.owner = THIS_MODULE,
+ .pm = &pwm_backlight_pm_ops,
},
.probe = pwm_backlight_probe,
.remove = pwm_backlight_remove,
- .suspend = pwm_backlight_suspend,
- .resume = pwm_backlight_resume,
};
module_platform_driver(pwm_backlight_driver);
--
1.7.7.3
^ permalink raw reply related
* [PATCH 1/2] backlight: Convert platform_lcd to devm_kzalloc()
From: Mark Brown @ 2011-12-29 18:20 UTC (permalink / raw)
To: linux-fbdev
Saves some error handling code and eliminates a class of leaks.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
drivers/video/backlight/platform_lcd.c | 9 ++++-----
1 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/video/backlight/platform_lcd.c b/drivers/video/backlight/platform_lcd.c
index 187da59..f0bf491 100644
--- a/drivers/video/backlight/platform_lcd.c
+++ b/drivers/video/backlight/platform_lcd.c
@@ -85,7 +85,8 @@ static int __devinit platform_lcd_probe(struct platform_device *pdev)
return -EINVAL;
}
- plcd = kzalloc(sizeof(struct platform_lcd), GFP_KERNEL);
+ plcd = devm_kzalloc(&pdev->dev, sizeof(struct platform_lcd),
+ GFP_KERNEL);
if (!plcd) {
dev_err(dev, "no memory for state\n");
return -ENOMEM;
@@ -98,7 +99,7 @@ static int __devinit platform_lcd_probe(struct platform_device *pdev)
if (IS_ERR(plcd->lcd)) {
dev_err(dev, "cannot register lcd device\n");
err = PTR_ERR(plcd->lcd);
- goto err_mem;
+ goto err;
}
platform_set_drvdata(pdev, plcd);
@@ -106,8 +107,7 @@ static int __devinit platform_lcd_probe(struct platform_device *pdev)
return 0;
- err_mem:
- kfree(plcd);
+ err:
return err;
}
@@ -116,7 +116,6 @@ static int __devexit platform_lcd_remove(struct platform_device *pdev)
struct platform_lcd *plcd = platform_get_drvdata(pdev);
lcd_device_unregister(plcd->lcd);
- kfree(plcd);
return 0;
}
--
1.7.7.3
^ permalink raw reply related
* RE: [PATCH 6/6] video: s3c-fb: Don't keep device runtime active when
From: Jingoo Han @ 2011-12-28 23:55 UTC (permalink / raw)
To: 'Mark Brown', 'Florian Tobias Schandinat'
Cc: linux-fbdev, linux-kernel
In-Reply-To: <1324995372-3410-6-git-send-email-broonie@opensource.wolfsonmicro.com>
> -----Original Message-----
> From: Mark Brown [mailto:broonie@opensource.wolfsonmicro.com]
> Sent: Tuesday, December 27, 2011 11:16 PM
> To: Jingoo Han; Florian Tobias Schandinat
> Cc: linux-fbdev@vger.kernel.org; linux-kernel@vger.kernel.org; Mark Brown
> Subject: [PATCH 6/6] video: s3c-fb: Don't keep device runtime active when open
>
> Allow the controller to be runtime suspended when the screen is blanked
> by not taking a runtime reference while the device is open. This allows
> greater system wide power savings when used with a standard application
> layer and ensures that the screen does not blank unless requested.
>
> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Jingoo Han <jg1.han@samsung.com>
> ---
> drivers/video/s3c-fb.c | 22 ----------------------
> 1 files changed, 0 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/video/s3c-fb.c b/drivers/video/s3c-fb.c
> index 84cf631..0c63b69 100644
> --- a/drivers/video/s3c-fb.c
> +++ b/drivers/video/s3c-fb.c
> @@ -1070,30 +1070,8 @@ static int s3c_fb_ioctl(struct fb_info *info, unsigned int cmd,
> return ret;
> }
>
> -static int s3c_fb_open(struct fb_info *info, int user)
> -{
> - struct s3c_fb_win *win = info->par;
> - struct s3c_fb *sfb = win->parent;
> -
> - pm_runtime_get_sync(sfb->dev);
> -
> - return 0;
> -}
> -
> -static int s3c_fb_release(struct fb_info *info, int user)
> -{
> - struct s3c_fb_win *win = info->par;
> - struct s3c_fb *sfb = win->parent;
> -
> - pm_runtime_put_sync(sfb->dev);
> -
> - return 0;
> -}
> -
> static struct fb_ops s3c_fb_ops = {
> .owner = THIS_MODULE,
> - .fb_open = s3c_fb_open,
> - .fb_release = s3c_fb_release,
> .fb_check_var = s3c_fb_check_var,
> .fb_set_par = s3c_fb_set_par,
> .fb_blank = s3c_fb_blank,
> --
> 1.7.7.3
^ permalink raw reply
* RE: [PATCH 5/6] video: s3c-fb: Hold runtime PM references when
From: Jingoo Han @ 2011-12-28 23:55 UTC (permalink / raw)
To: 'Mark Brown', 'Florian Tobias Schandinat'
Cc: linux-fbdev, linux-kernel
In-Reply-To: <1324995372-3410-5-git-send-email-broonie@opensource.wolfsonmicro.com>
> -----Original Message-----
> From: Mark Brown [mailto:broonie@opensource.wolfsonmicro.com]
> Sent: Tuesday, December 27, 2011 11:16 PM
> To: Jingoo Han; Florian Tobias Schandinat
> Cc: linux-fbdev@vger.kernel.org; linux-kernel@vger.kernel.org; Mark Brown
> Subject: [PATCH 5/6] video: s3c-fb: Hold runtime PM references when touching registers
>
> Take a runtime PM reference whenever updating registers in preparation
> for suspending the device when the framebuffer is blanked.
>
> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Jingoo Han <jg1.han@samsung.com>
> ---
> drivers/video/s3c-fb.c | 22 ++++++++++++++++++++++
> 1 files changed, 22 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/video/s3c-fb.c b/drivers/video/s3c-fb.c
> index 688b9d8..84cf631 100644
> --- a/drivers/video/s3c-fb.c
> +++ b/drivers/video/s3c-fb.c
> @@ -496,6 +496,8 @@ static int s3c_fb_set_par(struct fb_info *info)
>
> dev_dbg(sfb->dev, "setting framebuffer parameters\n");
>
> + pm_runtime_get_sync(sfb->dev);
> +
> shadow_protect_win(win, 1);
>
> switch (var->bits_per_pixel) {
> @@ -692,6 +694,8 @@ static int s3c_fb_set_par(struct fb_info *info)
>
> shadow_protect_win(win, 0);
>
> + pm_runtime_put_sync(sfb->dev);
> +
> return 0;
> }
>
> @@ -763,6 +767,8 @@ static int s3c_fb_setcolreg(unsigned regno,
> dev_dbg(sfb->dev, "%s: win %d: %d => rgb=%d/%d/%d\n",
> __func__, win->index, regno, red, green, blue);
>
> + pm_runtime_get_sync(sfb->dev);
> +
> switch (info->fix.visual) {
> case FB_VISUAL_TRUECOLOR:
> /* true-colour, use pseudo-palette */
> @@ -790,9 +796,11 @@ static int s3c_fb_setcolreg(unsigned regno,
> break;
>
> default:
> + pm_runtime_put_sync(sfb->dev);
> return 1; /* unknown type */
> }
>
> + pm_runtime_put_sync(sfb->dev);
> return 0;
> }
>
> @@ -812,6 +820,8 @@ static int s3c_fb_blank(int blank_mode, struct fb_info *info)
>
> dev_dbg(sfb->dev, "blank mode %d\n", blank_mode);
>
> + pm_runtime_get_sync(sfb->dev);
> +
> wincon = readl(sfb->regs + sfb->variant.wincon + (index * 4));
>
> switch (blank_mode) {
> @@ -839,6 +849,7 @@ static int s3c_fb_blank(int blank_mode, struct fb_info *info)
> case FB_BLANK_VSYNC_SUSPEND:
> case FB_BLANK_HSYNC_SUSPEND:
> default:
> + pm_runtime_put_sync(sfb->dev);
> return 1;
> }
>
> @@ -869,6 +880,8 @@ static int s3c_fb_blank(int blank_mode, struct fb_info *info)
> shadow_protect_win(win, 0);
> }
>
> + pm_runtime_put_sync(sfb->dev);
> +
> return 0;
> }
>
> @@ -891,6 +904,8 @@ static int s3c_fb_pan_display(struct fb_var_screeninfo *var,
> void __iomem *buf = sfb->regs + win->index * 8;
> unsigned int start_boff, end_boff;
>
> + pm_runtime_get_sync(sfb->dev);
> +
> /* Offset in bytes to the start of the displayed area */
> start_boff = var->yoffset * info->fix.line_length;
> /* X offset depends on the current bpp */
> @@ -909,6 +924,7 @@ static int s3c_fb_pan_display(struct fb_var_screeninfo *var,
> break;
> default:
> dev_err(sfb->dev, "invalid bpp\n");
> + pm_runtime_put_sync(sfb->dev);
> return -EINVAL;
> }
> }
> @@ -924,6 +940,7 @@ static int s3c_fb_pan_display(struct fb_var_screeninfo *var,
>
> shadow_protect_win(win, 0);
>
> + pm_runtime_put_sync(sfb->dev);
> return 0;
> }
>
> @@ -1013,11 +1030,16 @@ static int s3c_fb_wait_for_vsync(struct s3c_fb *sfb, u32 crtc)
> if (crtc != 0)
> return -ENODEV;
>
> + pm_runtime_get_sync(sfb->dev);
> +
> count = sfb->vsync_info.count;
> s3c_fb_enable_irq(sfb);
> ret = wait_event_interruptible_timeout(sfb->vsync_info.wait,
> count != sfb->vsync_info.count,
> msecs_to_jiffies(VSYNC_TIMEOUT_MSEC));
> +
> + pm_runtime_put_sync(sfb->dev);
> +
> if (ret = 0)
> return -ETIMEDOUT;
>
> --
> 1.7.7.3
^ permalink raw reply
* RE: [PATCH 4/6] video: s3c-fb: Take a runtime PM reference when
From: Jingoo Han @ 2011-12-28 23:54 UTC (permalink / raw)
To: 'Mark Brown', 'Florian Tobias Schandinat'
Cc: linux-fbdev, linux-kernel
In-Reply-To: <1324995372-3410-4-git-send-email-broonie@opensource.wolfsonmicro.com>
> -----Original Message-----
> From: Mark Brown [mailto:broonie@opensource.wolfsonmicro.com]
> Sent: Tuesday, December 27, 2011 11:16 PM
> To: Jingoo Han; Florian Tobias Schandinat
> Cc: linux-fbdev@vger.kernel.org; linux-kernel@vger.kernel.org; Mark Brown
> Subject: [PATCH 4/6] video: s3c-fb: Take a runtime PM reference when unblanked
>
> When the framebuffer is unblanked hold a runtime PM reference. This
> prevents us powering down when userspace has left an image on the
> framebuffer and prepares the way for being able to power down the hardware
> when an application still has the device open.
>
> Since we now hold a runtime PM reference whenever the display is unblanked
> there is no need for the runtime power management to disable and enable
> the display, and doing so would lead to runtime PM trying to recurse into
> itself when called from the blanking code, so split the runtime PM into
> separate functions which only deal with the clocks. The PM core will
> runtime resume the device prior to system suspend.
>
> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Jingoo Han <jg1.han@samsung.com>
> ---
> drivers/video/s3c-fb.c | 66 +++++++++++++++++++++++++++++++++++++++--------
> 1 files changed, 54 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/video/s3c-fb.c b/drivers/video/s3c-fb.c
> index 2e0eef0..688b9d8 100644
> --- a/drivers/video/s3c-fb.c
> +++ b/drivers/video/s3c-fb.c
> @@ -192,6 +192,7 @@ struct s3c_fb_vsync {
> * @regs: The mapped hardware registers.
> * @variant: Variant information for this hardware.
> * @enabled: A bitmask of enabled hardware windows.
> + * @output_on: Flag if the physical output is enabled.
> * @pdata: The platform configuration data passed with the device.
> * @windows: The hardware windows that have been claimed.
> * @irq_no: IRQ line number
> @@ -208,6 +209,7 @@ struct s3c_fb {
> struct s3c_fb_variant variant;
>
> unsigned char enabled;
> + bool output_on;
>
> struct s3c_fb_platdata *pdata;
> struct s3c_fb_win *windows[S3C_FB_MAX_WIN];
> @@ -449,21 +451,28 @@ static void s3c_fb_enable(struct s3c_fb *sfb, int enable)
> {
> u32 vidcon0 = readl(sfb->regs + VIDCON0);
>
> - if (enable)
> + if (enable && !sfb->output_on)
> + pm_runtime_get_sync(sfb->dev);
> +
> + if (enable) {
> vidcon0 |= VIDCON0_ENVID | VIDCON0_ENVID_F;
> - else {
> + } else {
> /* see the note in the framebuffer datasheet about
> * why you cannot take both of these bits down at the
> * same time. */
>
> - if (!(vidcon0 & VIDCON0_ENVID))
> - return;
> -
> - vidcon0 |= VIDCON0_ENVID;
> - vidcon0 &= ~VIDCON0_ENVID_F;
> + if (vidcon0 & VIDCON0_ENVID) {
> + vidcon0 |= VIDCON0_ENVID;
> + vidcon0 &= ~VIDCON0_ENVID_F;
> + }
> }
>
> writel(vidcon0, sfb->regs + VIDCON0);
> +
> + if (!enable && sfb->output_on)
> + pm_runtime_put_sync(sfb->dev);
> +
> + sfb->output_on = enable;
> }
>
> /**
> @@ -1539,7 +1548,7 @@ static int __devexit s3c_fb_remove(struct platform_device *pdev)
> return 0;
> }
>
> -#ifdef CONFIG_PM
> +#ifdef CONFIG_PM_SLEEP
> static int s3c_fb_suspend(struct device *dev)
> {
> struct platform_device *pdev = to_platform_device(dev);
> @@ -1609,11 +1618,40 @@ static int s3c_fb_resume(struct device *dev)
>
> return 0;
> }
> -#else
> -#define s3c_fb_suspend NULL
> -#define s3c_fb_resume NULL
> #endif
>
> +#ifdef CONFIG_PM_RUNTIME
> +static int s3c_fb_runtime_suspend(struct device *dev)
> +{
> + struct platform_device *pdev = to_platform_device(dev);
> + struct s3c_fb *sfb = platform_get_drvdata(pdev);
> +
> + if (!sfb->variant.has_clksel)
> + clk_disable(sfb->lcd_clk);
> +
> + clk_disable(sfb->bus_clk);
> +
> + return 0;
> +}
> +
> +static int s3c_fb_runtime_resume(struct device *dev)
> +{
> + struct platform_device *pdev = to_platform_device(dev);
> + struct s3c_fb *sfb = platform_get_drvdata(pdev);
> + struct s3c_fb_platdata *pd = sfb->pdata;
> +
> + clk_enable(sfb->bus_clk);
> +
> + if (!sfb->variant.has_clksel)
> + clk_enable(sfb->lcd_clk);
> +
> + /* setup gpio and output polarity controls */
> + pd->setup_gpio();
> + writel(pd->vidcon1, sfb->regs + VIDCON1);
> +
> + return 0;
> +}
> +#endif
>
> #define VALID_BPP124 (VALID_BPP(1) | VALID_BPP(2) | VALID_BPP(4))
> #define VALID_BPP1248 (VALID_BPP124 | VALID_BPP(8))
> @@ -1936,7 +1974,11 @@ static struct platform_device_id s3c_fb_driver_ids[] = {
> };
> MODULE_DEVICE_TABLE(platform, s3c_fb_driver_ids);
>
> -static UNIVERSAL_DEV_PM_OPS(s3cfb_pm_ops, s3c_fb_suspend, s3c_fb_resume, NULL);
> +static const struct dev_pm_ops s3cfb_pm_ops = {
> + SET_SYSTEM_SLEEP_PM_OPS(s3c_fb_suspend, s3c_fb_resume)
> + SET_RUNTIME_PM_OPS(s3c_fb_runtime_suspend, s3c_fb_runtime_resume,
> + NULL)
> +};
>
> static struct platform_driver s3c_fb_driver = {
> .probe = s3c_fb_probe,
> --
> 1.7.7.3
^ permalink raw reply
* RE: [PATCH 3/6] video: s3c-fb: Disable runtime PM in error paths from
From: Jingoo Han @ 2011-12-28 23:54 UTC (permalink / raw)
To: 'Mark Brown', 'Florian Tobias Schandinat'
Cc: linux-fbdev, linux-kernel
In-Reply-To: <1324995372-3410-3-git-send-email-broonie@opensource.wolfsonmicro.com>
> -----Original Message-----
> From: Mark Brown [mailto:broonie@opensource.wolfsonmicro.com]
> Sent: Tuesday, December 27, 2011 11:16 PM
> To: Jingoo Han; Florian Tobias Schandinat
> Cc: linux-fbdev@vger.kernel.org; linux-kernel@vger.kernel.org; Mark Brown
> Subject: [PATCH 3/6] video: s3c-fb: Disable runtime PM in error paths from probe
>
> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Jingoo Han <jg1.han@samsung.com>
> ---
> drivers/video/s3c-fb.c | 7 +++++--
> 1 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/video/s3c-fb.c b/drivers/video/s3c-fb.c
> index be4c218..2e0eef0 100644
> --- a/drivers/video/s3c-fb.c
> +++ b/drivers/video/s3c-fb.c
> @@ -1464,7 +1464,7 @@ static int __devinit s3c_fb_probe(struct platform_device *pdev)
> dev_err(dev, "failed to create window %d\n", win);
> for (; win >= 0; win--)
> s3c_fb_release_win(sfb, sfb->windows[win]);
> - goto err_irq;
> + goto err_pm_runtime;
> }
> }
>
> @@ -1473,7 +1473,8 @@ static int __devinit s3c_fb_probe(struct platform_device *pdev)
>
> return 0;
>
> -err_irq:
> +err_pm_runtime:
> + pm_runtime_put_sync(sfb->dev);
> free_irq(sfb->irq_no, sfb);
>
> err_ioremap:
> @@ -1483,6 +1484,8 @@ err_req_region:
> release_mem_region(sfb->regs_res->start, resource_size(sfb->regs_res));
>
> err_lcd_clk:
> + pm_runtime_disable(sfb->dev);
> +
> if (!sfb->variant.has_clksel) {
> clk_disable(sfb->lcd_clk);
> clk_put(sfb->lcd_clk);
> --
> 1.7.7.3
^ permalink raw reply
* RE: [PATCH 1/6] video: s3c-fb: Make runtime PM functional again
From: Jingoo Han @ 2011-12-28 23:54 UTC (permalink / raw)
To: 'Mark Brown', 'Florian Tobias Schandinat'
Cc: linux-fbdev, linux-kernel
In-Reply-To: <1324995372-3410-1-git-send-email-broonie@opensource.wolfsonmicro.com>
> -----Original Message-----
> From: Mark Brown [mailto:broonie@opensource.wolfsonmicro.com]
> Sent: Tuesday, December 27, 2011 11:16 PM
> To: Jingoo Han; Florian Tobias Schandinat
> Cc: linux-fbdev@vger.kernel.org; linux-kernel@vger.kernel.org; Mark Brown
> Subject: [PATCH 1/6] video: s3c-fb: Make runtime PM functional again
>
> The change in "video: s3c-fb: modify runtime pm functions" (commit
> 35784b) renders the runtime power management for the device completely
> ineffectual as while it leaves runtime power management notionally
> enabled a runtime power reference is held for the entire time the device
> is registered meaning it will never actually do anything.
>
> A further issue is introduced as runtime power management is added
> during the system suspend path which is not something which drivers are
> supposed to do and would interact poorly if there were any operations
> done in the runtime power management callbacks.
>
> While this does make things simpler (the main motivation for the
> original change) it will not only cause us to use more power in the
> framebuffer controller but will also prevent us entering lower power
> domain and SoC wide states as we can never power down the domain
> containing the device. Since neither of these things is desirable
> revert the change.
>
> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Jingoo Han <jg1.han@samsung.com>
> ---
> drivers/video/s3c-fb.c | 51 +++++++++++++++++++++++++++++------------------
> 1 files changed, 31 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/video/s3c-fb.c b/drivers/video/s3c-fb.c
> index a0b3fd6..b1a75a0 100644
> --- a/drivers/video/s3c-fb.c
> +++ b/drivers/video/s3c-fb.c
> @@ -1038,8 +1038,30 @@ static int s3c_fb_ioctl(struct fb_info *info, unsigned int cmd,
> return ret;
> }
>
> +static int s3c_fb_open(struct fb_info *info, int user)
> +{
> + struct s3c_fb_win *win = info->par;
> + struct s3c_fb *sfb = win->parent;
> +
> + pm_runtime_get_sync(sfb->dev);
> +
> + return 0;
> +}
> +
> +static int s3c_fb_release(struct fb_info *info, int user)
> +{
> + struct s3c_fb_win *win = info->par;
> + struct s3c_fb *sfb = win->parent;
> +
> + pm_runtime_put_sync(sfb->dev);
> +
> + return 0;
> +}
> +
> static struct fb_ops s3c_fb_ops = {
> .owner = THIS_MODULE,
> + .fb_open = s3c_fb_open,
> + .fb_release = s3c_fb_release,
> .fb_check_var = s3c_fb_check_var,
> .fb_set_par = s3c_fb_set_par,
> .fb_blank = s3c_fb_blank,
> @@ -1446,6 +1468,7 @@ static int __devinit s3c_fb_probe(struct platform_device *pdev)
> }
>
> platform_set_drvdata(pdev, sfb);
> + pm_runtime_put_sync(sfb->dev);
>
> return 0;
>
> @@ -1485,6 +1508,8 @@ static int __devexit s3c_fb_remove(struct platform_device *pdev)
> struct s3c_fb *sfb = platform_get_drvdata(pdev);
> int win;
>
> + pm_runtime_get_sync(sfb->dev);
> +
> for (win = 0; win < S3C_FB_MAX_WIN; win++)
> if (sfb->windows[win])
> s3c_fb_release_win(sfb, sfb->windows[win]);
> @@ -1510,7 +1535,7 @@ static int __devexit s3c_fb_remove(struct platform_device *pdev)
> return 0;
> }
>
> -#ifdef CONFIG_PM_SLEEP
> +#ifdef CONFIG_PM
> static int s3c_fb_suspend(struct device *dev)
> {
> struct platform_device *pdev = to_platform_device(dev);
> @@ -1531,8 +1556,6 @@ static int s3c_fb_suspend(struct device *dev)
> clk_disable(sfb->lcd_clk);
>
> clk_disable(sfb->bus_clk);
> - pm_runtime_put_sync(sfb->dev);
> -
> return 0;
> }
>
> @@ -1544,7 +1567,6 @@ static int s3c_fb_resume(struct device *dev)
> struct s3c_fb_win *win;
> int win_no;
>
> - pm_runtime_get_sync(sfb->dev);
> clk_enable(sfb->bus_clk);
>
> if (!sfb->variant.has_clksel)
> @@ -1583,19 +1605,11 @@ static int s3c_fb_resume(struct device *dev)
>
> return 0;
> }
> +#else
> +#define s3c_fb_suspend NULL
> +#define s3c_fb_resume NULL
> #endif
>
> -#ifdef CONFIG_PM_RUNTIME
> -static int s3c_fb_runtime_suspend(struct device *dev)
> -{
> - return 0;
> -}
> -
> -static int s3c_fb_runtime_resume(struct device *dev)
> -{
> - return 0;
> -}
> -#endif
>
> #define VALID_BPP124 (VALID_BPP(1) | VALID_BPP(2) | VALID_BPP(4))
> #define VALID_BPP1248 (VALID_BPP124 | VALID_BPP(8))
> @@ -1918,10 +1932,7 @@ static struct platform_device_id s3c_fb_driver_ids[] = {
> };
> MODULE_DEVICE_TABLE(platform, s3c_fb_driver_ids);
>
> -static const struct dev_pm_ops s3c_fb_pm_ops = {
> - SET_SYSTEM_SLEEP_PM_OPS(s3c_fb_suspend, s3c_fb_resume)
> - SET_RUNTIME_PM_OPS(s3c_fb_runtime_suspend, s3c_fb_runtime_resume, NULL)
> -};
> +static UNIVERSAL_DEV_PM_OPS(s3cfb_pm_ops, s3c_fb_suspend, s3c_fb_resume, NULL);
>
> static struct platform_driver s3c_fb_driver = {
> .probe = s3c_fb_probe,
> @@ -1930,7 +1941,7 @@ static struct platform_driver s3c_fb_driver = {
> .driver = {
> .name = "s3c-fb",
> .owner = THIS_MODULE,
> - .pm = &s3c_fb_pm_ops,
> + .pm = &s3cfb_pm_ops,
> },
> };
>
> --
> 1.7.7.3
^ permalink raw reply
* [PATCH] offb: Fix setting of the pseudo-palette for >8bpp
From: Benjamin Herrenschmidt @ 2011-12-28 10:10 UTC (permalink / raw)
To: linux-fbdev; +Cc: linuxppc-dev
When using a >8bpp framebuffer, offb advertises truecolor, not directcolor,
and doesn't touch the color map even if it has a corresponding access method
for the real hardware.
Thus it needs to set the pseudo-palette with all 3 components of the color,
like other truecolor framebuffers, not with copies of the color index like
a directcolor framebuffer would do.
This went unnoticed for a long time because it's pretty hard to get offb
to kick in with anything but 8bpp (old BootX under MacOS will do that and
qemu does it).
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
(resent to the right list)
BTW. Do we have a maintainer to pick up those offb patches I sent ? I'm
happy to carry them in -powerpc instead, it would actually make it easier
for me....
diff --git a/drivers/video/offb.c b/drivers/video/offb.c
index cb163a5..24e1fc6 100644
--- a/drivers/video/offb.c
+++ b/drivers/video/offb.c
@@ -100,36 +100,32 @@ static int offb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
u_int transp, struct fb_info *info)
{
struct offb_par *par = (struct offb_par *) info->par;
- int i, depth;
- u32 *pal = info->pseudo_palette;
-
- depth = info->var.bits_per_pixel;
- if (depth = 16)
- depth = (info->var.green.length = 5) ? 15 : 16;
-
- if (regno > 255 ||
- (depth = 16 && regno > 63) ||
- (depth = 15 && regno > 31))
- return 1;
-
- if (regno < 16) {
- switch (depth) {
- case 15:
- pal[regno] = (regno << 10) | (regno << 5) | regno;
- break;
- case 16:
- pal[regno] = (regno << 11) | (regno << 5) | regno;
- break;
- case 24:
- pal[regno] = (regno << 16) | (regno << 8) | regno;
- break;
- case 32:
- i = (regno << 8) | regno;
- pal[regno] = (i << 16) | i;
- break;
+
+ if (info->fix.visual = FB_VISUAL_TRUECOLOR) {
+ u32 *pal = info->pseudo_palette;
+ u32 cr = red >> (16 - info->var.red.length);
+ u32 cg = green >> (16 - info->var.green.length);
+ u32 cb = blue >> (16 - info->var.blue.length);
+ u32 value;
+
+ if (regno >= 16)
+ return -EINVAL;
+
+ value = (cr << info->var.red.offset) |
+ (cg << info->var.green.offset) |
+ (cb << info->var.blue.offset);
+ if (info->var.transp.length > 0) {
+ u32 mask = (1 << info->var.transp.length) - 1;
+ mask <<= info->var.transp.offset;
+ value |= mask;
}
+ pal[regno] = value;
+ return 0;
}
+ if (regno > 255)
+ return -EINVAL;
+
red >>= 8;
green >>= 8;
blue >>= 8;
^ permalink raw reply related
* [PATCH] offb: Fix setting of the pseudo-palette for >8bpp
From: Benjamin Herrenschmidt @ 2011-12-28 10:08 UTC (permalink / raw)
To: linux-fbdev-devel; +Cc: linuxppc-dev
When using a >8bpp framebuffer, offb advertises truecolor, not directcolor,
and doesn't touch the color map even if it has a corresponding access method
for the real hardware.
Thus it needs to set the pseudo-palette with all 3 components of the color,
like other truecolor framebuffers, not with copies of the color index like
a directcolor framebuffer would do.
This went unnoticed for a long time because it's pretty hard to get offb
to kick in with anything but 8bpp (old BootX under MacOS will do that and
qemu does it).
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
diff --git a/drivers/video/offb.c b/drivers/video/offb.c
index cb163a5..24e1fc6 100644
--- a/drivers/video/offb.c
+++ b/drivers/video/offb.c
@@ -100,36 +100,32 @@ static int offb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
u_int transp, struct fb_info *info)
{
struct offb_par *par = (struct offb_par *) info->par;
- int i, depth;
- u32 *pal = info->pseudo_palette;
-
- depth = info->var.bits_per_pixel;
- if (depth == 16)
- depth = (info->var.green.length == 5) ? 15 : 16;
-
- if (regno > 255 ||
- (depth == 16 && regno > 63) ||
- (depth == 15 && regno > 31))
- return 1;
-
- if (regno < 16) {
- switch (depth) {
- case 15:
- pal[regno] = (regno << 10) | (regno << 5) | regno;
- break;
- case 16:
- pal[regno] = (regno << 11) | (regno << 5) | regno;
- break;
- case 24:
- pal[regno] = (regno << 16) | (regno << 8) | regno;
- break;
- case 32:
- i = (regno << 8) | regno;
- pal[regno] = (i << 16) | i;
- break;
+
+ if (info->fix.visual == FB_VISUAL_TRUECOLOR) {
+ u32 *pal = info->pseudo_palette;
+ u32 cr = red >> (16 - info->var.red.length);
+ u32 cg = green >> (16 - info->var.green.length);
+ u32 cb = blue >> (16 - info->var.blue.length);
+ u32 value;
+
+ if (regno >= 16)
+ return -EINVAL;
+
+ value = (cr << info->var.red.offset) |
+ (cg << info->var.green.offset) |
+ (cb << info->var.blue.offset);
+ if (info->var.transp.length > 0) {
+ u32 mask = (1 << info->var.transp.length) - 1;
+ mask <<= info->var.transp.offset;
+ value |= mask;
}
+ pal[regno] = value;
+ return 0;
}
+ if (regno > 255)
+ return -EINVAL;
+
red >>= 8;
green >>= 8;
blue >>= 8;
^ permalink raw reply related
* [PATCH] grvga: fix section mismatch warnings
From: Sam Ravnborg @ 2011-12-27 21:57 UTC (permalink / raw)
To: linux-fbdev
From 7368b53b755a66c69b2b5ede30e2effe960ad59a Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <sam@ravnborg.org>
Date: Tue, 27 Dec 2011 22:55:49 +0100
Subject: [PATCH] grvga: fix section mismatch warnings
Fix following section mismatch warnings:
WARNING: drivers/video/built-in.o(.devinit.text+0x110): Section mismatch in reference from the function grvga_probe() to the function .init.text:grvga_parse_custom()
The function __devinit grvga_probe() references
a function __init grvga_parse_custom().
If grvga_parse_custom is only used by grvga_probe then
annotate grvga_parse_custom with a matching annotation.
WARNING: drivers/video/built-in.o(.devinit.text+0x1f8): Section mismatch in reference from the function grvga_probe() to the variable .init.data:grvga_fix
The function __devinit grvga_probe() references
a variable __initdata grvga_fix.
If grvga_fix is only used by grvga_probe then
annotate grvga_fix with a matching annotation.
WARNING: drivers/video/built-in.o(.devinit.text+0x204): Section mismatch in reference from the function grvga_probe() to the variable .init.data:grvga_fix
The function __devinit grvga_probe() references
a variable __initdata grvga_fix.
If grvga_fix is only used by grvga_probe then
annotate grvga_fix with a matching annotation.
grvga_fix is used in a function annotated __devinit - so
match this using a __devinitdata annotation on grvga_fix.
grvga_parse_custom() is used in a function annotated
__devinit - so match this by annotating grvga_parse_custom()
with __devinit too.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Kristoffer Glembo <kristoffer@gaisler.com>
Cc: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
---
drivers/video/grvga.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/video/grvga.c b/drivers/video/grvga.c
index f37e025..da066c2 100644
--- a/drivers/video/grvga.c
+++ b/drivers/video/grvga.c
@@ -70,7 +70,7 @@ static const struct fb_videomode grvga_modedb[] = {
}
};
-static struct fb_fix_screeninfo grvga_fix __initdata = {
+static struct fb_fix_screeninfo grvga_fix __devinitdata = {
.id = "AG SVGACTRL",
.type = FB_TYPE_PACKED_PIXELS,
.visual = FB_VISUAL_PSEUDOCOLOR,
@@ -267,7 +267,7 @@ static struct fb_ops grvga_ops = {
.fb_imageblit = cfb_imageblit
};
-static int __init grvga_parse_custom(char *options,
+static int __devinit grvga_parse_custom(char *options,
struct fb_var_screeninfo *screendata)
{
char *this_opt;
--
1.6.0.6
^ permalink raw reply related
* [PATCH 6/6] video: s3c-fb: Don't keep device runtime active when open
From: Mark Brown @ 2011-12-27 14:16 UTC (permalink / raw)
To: Jingoo Han, Florian Tobias Schandinat
Cc: linux-fbdev, linux-kernel, Mark Brown
In-Reply-To: <1324995372-3410-1-git-send-email-broonie@opensource.wolfsonmicro.com>
Allow the controller to be runtime suspended when the screen is blanked
by not taking a runtime reference while the device is open. This allows
greater system wide power savings when used with a standard application
layer and ensures that the screen does not blank unless requested.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
drivers/video/s3c-fb.c | 22 ----------------------
1 files changed, 0 insertions(+), 22 deletions(-)
diff --git a/drivers/video/s3c-fb.c b/drivers/video/s3c-fb.c
index 84cf631..0c63b69 100644
--- a/drivers/video/s3c-fb.c
+++ b/drivers/video/s3c-fb.c
@@ -1070,30 +1070,8 @@ static int s3c_fb_ioctl(struct fb_info *info, unsigned int cmd,
return ret;
}
-static int s3c_fb_open(struct fb_info *info, int user)
-{
- struct s3c_fb_win *win = info->par;
- struct s3c_fb *sfb = win->parent;
-
- pm_runtime_get_sync(sfb->dev);
-
- return 0;
-}
-
-static int s3c_fb_release(struct fb_info *info, int user)
-{
- struct s3c_fb_win *win = info->par;
- struct s3c_fb *sfb = win->parent;
-
- pm_runtime_put_sync(sfb->dev);
-
- return 0;
-}
-
static struct fb_ops s3c_fb_ops = {
.owner = THIS_MODULE,
- .fb_open = s3c_fb_open,
- .fb_release = s3c_fb_release,
.fb_check_var = s3c_fb_check_var,
.fb_set_par = s3c_fb_set_par,
.fb_blank = s3c_fb_blank,
--
1.7.7.3
^ permalink raw reply related
* [PATCH 5/6] video: s3c-fb: Hold runtime PM references when touching registers
From: Mark Brown @ 2011-12-27 14:16 UTC (permalink / raw)
To: Jingoo Han, Florian Tobias Schandinat
Cc: linux-fbdev, linux-kernel, Mark Brown
In-Reply-To: <1324995372-3410-1-git-send-email-broonie@opensource.wolfsonmicro.com>
Take a runtime PM reference whenever updating registers in preparation
for suspending the device when the framebuffer is blanked.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
drivers/video/s3c-fb.c | 22 ++++++++++++++++++++++
1 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/drivers/video/s3c-fb.c b/drivers/video/s3c-fb.c
index 688b9d8..84cf631 100644
--- a/drivers/video/s3c-fb.c
+++ b/drivers/video/s3c-fb.c
@@ -496,6 +496,8 @@ static int s3c_fb_set_par(struct fb_info *info)
dev_dbg(sfb->dev, "setting framebuffer parameters\n");
+ pm_runtime_get_sync(sfb->dev);
+
shadow_protect_win(win, 1);
switch (var->bits_per_pixel) {
@@ -692,6 +694,8 @@ static int s3c_fb_set_par(struct fb_info *info)
shadow_protect_win(win, 0);
+ pm_runtime_put_sync(sfb->dev);
+
return 0;
}
@@ -763,6 +767,8 @@ static int s3c_fb_setcolreg(unsigned regno,
dev_dbg(sfb->dev, "%s: win %d: %d => rgb=%d/%d/%d\n",
__func__, win->index, regno, red, green, blue);
+ pm_runtime_get_sync(sfb->dev);
+
switch (info->fix.visual) {
case FB_VISUAL_TRUECOLOR:
/* true-colour, use pseudo-palette */
@@ -790,9 +796,11 @@ static int s3c_fb_setcolreg(unsigned regno,
break;
default:
+ pm_runtime_put_sync(sfb->dev);
return 1; /* unknown type */
}
+ pm_runtime_put_sync(sfb->dev);
return 0;
}
@@ -812,6 +820,8 @@ static int s3c_fb_blank(int blank_mode, struct fb_info *info)
dev_dbg(sfb->dev, "blank mode %d\n", blank_mode);
+ pm_runtime_get_sync(sfb->dev);
+
wincon = readl(sfb->regs + sfb->variant.wincon + (index * 4));
switch (blank_mode) {
@@ -839,6 +849,7 @@ static int s3c_fb_blank(int blank_mode, struct fb_info *info)
case FB_BLANK_VSYNC_SUSPEND:
case FB_BLANK_HSYNC_SUSPEND:
default:
+ pm_runtime_put_sync(sfb->dev);
return 1;
}
@@ -869,6 +880,8 @@ static int s3c_fb_blank(int blank_mode, struct fb_info *info)
shadow_protect_win(win, 0);
}
+ pm_runtime_put_sync(sfb->dev);
+
return 0;
}
@@ -891,6 +904,8 @@ static int s3c_fb_pan_display(struct fb_var_screeninfo *var,
void __iomem *buf = sfb->regs + win->index * 8;
unsigned int start_boff, end_boff;
+ pm_runtime_get_sync(sfb->dev);
+
/* Offset in bytes to the start of the displayed area */
start_boff = var->yoffset * info->fix.line_length;
/* X offset depends on the current bpp */
@@ -909,6 +924,7 @@ static int s3c_fb_pan_display(struct fb_var_screeninfo *var,
break;
default:
dev_err(sfb->dev, "invalid bpp\n");
+ pm_runtime_put_sync(sfb->dev);
return -EINVAL;
}
}
@@ -924,6 +940,7 @@ static int s3c_fb_pan_display(struct fb_var_screeninfo *var,
shadow_protect_win(win, 0);
+ pm_runtime_put_sync(sfb->dev);
return 0;
}
@@ -1013,11 +1030,16 @@ static int s3c_fb_wait_for_vsync(struct s3c_fb *sfb, u32 crtc)
if (crtc != 0)
return -ENODEV;
+ pm_runtime_get_sync(sfb->dev);
+
count = sfb->vsync_info.count;
s3c_fb_enable_irq(sfb);
ret = wait_event_interruptible_timeout(sfb->vsync_info.wait,
count != sfb->vsync_info.count,
msecs_to_jiffies(VSYNC_TIMEOUT_MSEC));
+
+ pm_runtime_put_sync(sfb->dev);
+
if (ret = 0)
return -ETIMEDOUT;
--
1.7.7.3
^ permalink raw reply related
* [PATCH 4/6] video: s3c-fb: Take a runtime PM reference when unblanked
From: Mark Brown @ 2011-12-27 14:16 UTC (permalink / raw)
To: Jingoo Han, Florian Tobias Schandinat
Cc: linux-fbdev, linux-kernel, Mark Brown
In-Reply-To: <1324995372-3410-1-git-send-email-broonie@opensource.wolfsonmicro.com>
When the framebuffer is unblanked hold a runtime PM reference. This
prevents us powering down when userspace has left an image on the
framebuffer and prepares the way for being able to power down the hardware
when an application still has the device open.
Since we now hold a runtime PM reference whenever the display is unblanked
there is no need for the runtime power management to disable and enable
the display, and doing so would lead to runtime PM trying to recurse into
itself when called from the blanking code, so split the runtime PM into
separate functions which only deal with the clocks. The PM core will
runtime resume the device prior to system suspend.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
drivers/video/s3c-fb.c | 66 +++++++++++++++++++++++++++++++++++++++--------
1 files changed, 54 insertions(+), 12 deletions(-)
diff --git a/drivers/video/s3c-fb.c b/drivers/video/s3c-fb.c
index 2e0eef0..688b9d8 100644
--- a/drivers/video/s3c-fb.c
+++ b/drivers/video/s3c-fb.c
@@ -192,6 +192,7 @@ struct s3c_fb_vsync {
* @regs: The mapped hardware registers.
* @variant: Variant information for this hardware.
* @enabled: A bitmask of enabled hardware windows.
+ * @output_on: Flag if the physical output is enabled.
* @pdata: The platform configuration data passed with the device.
* @windows: The hardware windows that have been claimed.
* @irq_no: IRQ line number
@@ -208,6 +209,7 @@ struct s3c_fb {
struct s3c_fb_variant variant;
unsigned char enabled;
+ bool output_on;
struct s3c_fb_platdata *pdata;
struct s3c_fb_win *windows[S3C_FB_MAX_WIN];
@@ -449,21 +451,28 @@ static void s3c_fb_enable(struct s3c_fb *sfb, int enable)
{
u32 vidcon0 = readl(sfb->regs + VIDCON0);
- if (enable)
+ if (enable && !sfb->output_on)
+ pm_runtime_get_sync(sfb->dev);
+
+ if (enable) {
vidcon0 |= VIDCON0_ENVID | VIDCON0_ENVID_F;
- else {
+ } else {
/* see the note in the framebuffer datasheet about
* why you cannot take both of these bits down at the
* same time. */
- if (!(vidcon0 & VIDCON0_ENVID))
- return;
-
- vidcon0 |= VIDCON0_ENVID;
- vidcon0 &= ~VIDCON0_ENVID_F;
+ if (vidcon0 & VIDCON0_ENVID) {
+ vidcon0 |= VIDCON0_ENVID;
+ vidcon0 &= ~VIDCON0_ENVID_F;
+ }
}
writel(vidcon0, sfb->regs + VIDCON0);
+
+ if (!enable && sfb->output_on)
+ pm_runtime_put_sync(sfb->dev);
+
+ sfb->output_on = enable;
}
/**
@@ -1539,7 +1548,7 @@ static int __devexit s3c_fb_remove(struct platform_device *pdev)
return 0;
}
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
static int s3c_fb_suspend(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
@@ -1609,11 +1618,40 @@ static int s3c_fb_resume(struct device *dev)
return 0;
}
-#else
-#define s3c_fb_suspend NULL
-#define s3c_fb_resume NULL
#endif
+#ifdef CONFIG_PM_RUNTIME
+static int s3c_fb_runtime_suspend(struct device *dev)
+{
+ struct platform_device *pdev = to_platform_device(dev);
+ struct s3c_fb *sfb = platform_get_drvdata(pdev);
+
+ if (!sfb->variant.has_clksel)
+ clk_disable(sfb->lcd_clk);
+
+ clk_disable(sfb->bus_clk);
+
+ return 0;
+}
+
+static int s3c_fb_runtime_resume(struct device *dev)
+{
+ struct platform_device *pdev = to_platform_device(dev);
+ struct s3c_fb *sfb = platform_get_drvdata(pdev);
+ struct s3c_fb_platdata *pd = sfb->pdata;
+
+ clk_enable(sfb->bus_clk);
+
+ if (!sfb->variant.has_clksel)
+ clk_enable(sfb->lcd_clk);
+
+ /* setup gpio and output polarity controls */
+ pd->setup_gpio();
+ writel(pd->vidcon1, sfb->regs + VIDCON1);
+
+ return 0;
+}
+#endif
#define VALID_BPP124 (VALID_BPP(1) | VALID_BPP(2) | VALID_BPP(4))
#define VALID_BPP1248 (VALID_BPP124 | VALID_BPP(8))
@@ -1936,7 +1974,11 @@ static struct platform_device_id s3c_fb_driver_ids[] = {
};
MODULE_DEVICE_TABLE(platform, s3c_fb_driver_ids);
-static UNIVERSAL_DEV_PM_OPS(s3cfb_pm_ops, s3c_fb_suspend, s3c_fb_resume, NULL);
+static const struct dev_pm_ops s3cfb_pm_ops = {
+ SET_SYSTEM_SLEEP_PM_OPS(s3c_fb_suspend, s3c_fb_resume)
+ SET_RUNTIME_PM_OPS(s3c_fb_runtime_suspend, s3c_fb_runtime_resume,
+ NULL)
+};
static struct platform_driver s3c_fb_driver = {
.probe = s3c_fb_probe,
--
1.7.7.3
^ permalink raw reply related
* [PATCH 3/6] video: s3c-fb: Disable runtime PM in error paths from probe
From: Mark Brown @ 2011-12-27 14:16 UTC (permalink / raw)
To: Jingoo Han, Florian Tobias Schandinat
Cc: linux-fbdev, linux-kernel, Mark Brown
In-Reply-To: <1324995372-3410-1-git-send-email-broonie@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
drivers/video/s3c-fb.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/video/s3c-fb.c b/drivers/video/s3c-fb.c
index be4c218..2e0eef0 100644
--- a/drivers/video/s3c-fb.c
+++ b/drivers/video/s3c-fb.c
@@ -1464,7 +1464,7 @@ static int __devinit s3c_fb_probe(struct platform_device *pdev)
dev_err(dev, "failed to create window %d\n", win);
for (; win >= 0; win--)
s3c_fb_release_win(sfb, sfb->windows[win]);
- goto err_irq;
+ goto err_pm_runtime;
}
}
@@ -1473,7 +1473,8 @@ static int __devinit s3c_fb_probe(struct platform_device *pdev)
return 0;
-err_irq:
+err_pm_runtime:
+ pm_runtime_put_sync(sfb->dev);
free_irq(sfb->irq_no, sfb);
err_ioremap:
@@ -1483,6 +1484,8 @@ err_req_region:
release_mem_region(sfb->regs_res->start, resource_size(sfb->regs_res));
err_lcd_clk:
+ pm_runtime_disable(sfb->dev);
+
if (!sfb->variant.has_clksel) {
clk_disable(sfb->lcd_clk);
clk_put(sfb->lcd_clk);
--
1.7.7.3
^ permalink raw reply related
* [PATCH 2/6] video: s3c-fb: Use s3c_fb_enable() to enable the framebuffer
From: Mark Brown @ 2011-12-27 14:16 UTC (permalink / raw)
To: Jingoo Han, Florian Tobias Schandinat
Cc: linux-fbdev, linux-kernel, Mark Brown
In-Reply-To: <1324995372-3410-1-git-send-email-broonie@opensource.wolfsonmicro.com>
The s3c-fb driver has a function called s3c_fb_enable() which turns on
and off the physical output. However it is only actually used in paths
which disable the screen, the enabling just writes to the register. Make
the code less confusing by ensuring that the enable also goes through
the same path.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Jingoo Han <jg1.han@samsung.com>
---
drivers/video/s3c-fb.c | 55 ++++++++++++++++++++++++-----------------------
1 files changed, 28 insertions(+), 27 deletions(-)
diff --git a/drivers/video/s3c-fb.c b/drivers/video/s3c-fb.c
index b1a75a0..be4c218 100644
--- a/drivers/video/s3c-fb.c
+++ b/drivers/video/s3c-fb.c
@@ -441,6 +441,32 @@ static void shadow_protect_win(struct s3c_fb_win *win, bool protect)
}
/**
+ * s3c_fb_enable() - Set the state of the main LCD output
+ * @sfb: The main framebuffer state.
+ * @enable: The state to set.
+ */
+static void s3c_fb_enable(struct s3c_fb *sfb, int enable)
+{
+ u32 vidcon0 = readl(sfb->regs + VIDCON0);
+
+ if (enable)
+ vidcon0 |= VIDCON0_ENVID | VIDCON0_ENVID_F;
+ else {
+ /* see the note in the framebuffer datasheet about
+ * why you cannot take both of these bits down at the
+ * same time. */
+
+ if (!(vidcon0 & VIDCON0_ENVID))
+ return;
+
+ vidcon0 |= VIDCON0_ENVID;
+ vidcon0 &= ~VIDCON0_ENVID_F;
+ }
+
+ writel(vidcon0, sfb->regs + VIDCON0);
+}
+
+/**
* s3c_fb_set_par() - framebuffer request to set new framebuffer state.
* @info: The framebuffer to change.
*
@@ -510,9 +536,10 @@ static int s3c_fb_set_par(struct fb_info *info)
if (sfb->variant.is_2443)
data |= (1 << 5);
- data |= VIDCON0_ENVID | VIDCON0_ENVID_F;
writel(data, regs + VIDCON0);
+ s3c_fb_enable(sfb, 1);
+
data = VIDTCON0_VBPD(var->upper_margin - 1) |
VIDTCON0_VFPD(var->lower_margin - 1) |
VIDTCON0_VSPW(var->vsync_len - 1);
@@ -761,32 +788,6 @@ static int s3c_fb_setcolreg(unsigned regno,
}
/**
- * s3c_fb_enable() - Set the state of the main LCD output
- * @sfb: The main framebuffer state.
- * @enable: The state to set.
- */
-static void s3c_fb_enable(struct s3c_fb *sfb, int enable)
-{
- u32 vidcon0 = readl(sfb->regs + VIDCON0);
-
- if (enable)
- vidcon0 |= VIDCON0_ENVID | VIDCON0_ENVID_F;
- else {
- /* see the note in the framebuffer datasheet about
- * why you cannot take both of these bits down at the
- * same time. */
-
- if (!(vidcon0 & VIDCON0_ENVID))
- return;
-
- vidcon0 |= VIDCON0_ENVID;
- vidcon0 &= ~VIDCON0_ENVID_F;
- }
-
- writel(vidcon0, sfb->regs + VIDCON0);
-}
-
-/**
* s3c_fb_blank() - blank or unblank the given window
* @blank_mode: The blank state from FB_BLANK_*
* @info: The framebuffer to blank.
--
1.7.7.3
^ permalink raw reply related
* [PATCH 1/6] video: s3c-fb: Make runtime PM functional again
From: Mark Brown @ 2011-12-27 14:16 UTC (permalink / raw)
To: Jingoo Han, Florian Tobias Schandinat
Cc: linux-fbdev, linux-kernel, Mark Brown
In-Reply-To: <20111227141550.GA3331@opensource.wolfsonmicro.com>
The change in "video: s3c-fb: modify runtime pm functions" (commit
35784b) renders the runtime power management for the device completely
ineffectual as while it leaves runtime power management notionally
enabled a runtime power reference is held for the entire time the device
is registered meaning it will never actually do anything.
A further issue is introduced as runtime power management is added
during the system suspend path which is not something which drivers are
supposed to do and would interact poorly if there were any operations
done in the runtime power management callbacks.
While this does make things simpler (the main motivation for the
original change) it will not only cause us to use more power in the
framebuffer controller but will also prevent us entering lower power
domain and SoC wide states as we can never power down the domain
containing the device. Since neither of these things is desirable
revert the change.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
drivers/video/s3c-fb.c | 51 +++++++++++++++++++++++++++++------------------
1 files changed, 31 insertions(+), 20 deletions(-)
diff --git a/drivers/video/s3c-fb.c b/drivers/video/s3c-fb.c
index a0b3fd6..b1a75a0 100644
--- a/drivers/video/s3c-fb.c
+++ b/drivers/video/s3c-fb.c
@@ -1038,8 +1038,30 @@ static int s3c_fb_ioctl(struct fb_info *info, unsigned int cmd,
return ret;
}
+static int s3c_fb_open(struct fb_info *info, int user)
+{
+ struct s3c_fb_win *win = info->par;
+ struct s3c_fb *sfb = win->parent;
+
+ pm_runtime_get_sync(sfb->dev);
+
+ return 0;
+}
+
+static int s3c_fb_release(struct fb_info *info, int user)
+{
+ struct s3c_fb_win *win = info->par;
+ struct s3c_fb *sfb = win->parent;
+
+ pm_runtime_put_sync(sfb->dev);
+
+ return 0;
+}
+
static struct fb_ops s3c_fb_ops = {
.owner = THIS_MODULE,
+ .fb_open = s3c_fb_open,
+ .fb_release = s3c_fb_release,
.fb_check_var = s3c_fb_check_var,
.fb_set_par = s3c_fb_set_par,
.fb_blank = s3c_fb_blank,
@@ -1446,6 +1468,7 @@ static int __devinit s3c_fb_probe(struct platform_device *pdev)
}
platform_set_drvdata(pdev, sfb);
+ pm_runtime_put_sync(sfb->dev);
return 0;
@@ -1485,6 +1508,8 @@ static int __devexit s3c_fb_remove(struct platform_device *pdev)
struct s3c_fb *sfb = platform_get_drvdata(pdev);
int win;
+ pm_runtime_get_sync(sfb->dev);
+
for (win = 0; win < S3C_FB_MAX_WIN; win++)
if (sfb->windows[win])
s3c_fb_release_win(sfb, sfb->windows[win]);
@@ -1510,7 +1535,7 @@ static int __devexit s3c_fb_remove(struct platform_device *pdev)
return 0;
}
-#ifdef CONFIG_PM_SLEEP
+#ifdef CONFIG_PM
static int s3c_fb_suspend(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
@@ -1531,8 +1556,6 @@ static int s3c_fb_suspend(struct device *dev)
clk_disable(sfb->lcd_clk);
clk_disable(sfb->bus_clk);
- pm_runtime_put_sync(sfb->dev);
-
return 0;
}
@@ -1544,7 +1567,6 @@ static int s3c_fb_resume(struct device *dev)
struct s3c_fb_win *win;
int win_no;
- pm_runtime_get_sync(sfb->dev);
clk_enable(sfb->bus_clk);
if (!sfb->variant.has_clksel)
@@ -1583,19 +1605,11 @@ static int s3c_fb_resume(struct device *dev)
return 0;
}
+#else
+#define s3c_fb_suspend NULL
+#define s3c_fb_resume NULL
#endif
-#ifdef CONFIG_PM_RUNTIME
-static int s3c_fb_runtime_suspend(struct device *dev)
-{
- return 0;
-}
-
-static int s3c_fb_runtime_resume(struct device *dev)
-{
- return 0;
-}
-#endif
#define VALID_BPP124 (VALID_BPP(1) | VALID_BPP(2) | VALID_BPP(4))
#define VALID_BPP1248 (VALID_BPP124 | VALID_BPP(8))
@@ -1918,10 +1932,7 @@ static struct platform_device_id s3c_fb_driver_ids[] = {
};
MODULE_DEVICE_TABLE(platform, s3c_fb_driver_ids);
-static const struct dev_pm_ops s3c_fb_pm_ops = {
- SET_SYSTEM_SLEEP_PM_OPS(s3c_fb_suspend, s3c_fb_resume)
- SET_RUNTIME_PM_OPS(s3c_fb_runtime_suspend, s3c_fb_runtime_resume, NULL)
-};
+static UNIVERSAL_DEV_PM_OPS(s3cfb_pm_ops, s3c_fb_suspend, s3c_fb_resume, NULL);
static struct platform_driver s3c_fb_driver = {
.probe = s3c_fb_probe,
@@ -1930,7 +1941,7 @@ static struct platform_driver s3c_fb_driver = {
.driver = {
.name = "s3c-fb",
.owner = THIS_MODULE,
- .pm = &s3c_fb_pm_ops,
+ .pm = &s3cfb_pm_ops,
},
};
--
1.7.7.3
^ permalink raw reply related
* [PATCH 0/6] video: s3c-fb: Use runtime suspend while blanked
From: Mark Brown @ 2011-12-27 14:15 UTC (permalink / raw)
To: Jingoo Han, 'Florian Tobias Schandinat'; +Cc: linux-kernel, linux-fbdev
This patch series (the first two of which I posted the other day)
improves the runtime power management in the s3c-fb driver by moving it
to keeping the device runtime suspended when the screen is powered down
by userspace. This saves a trivial amount of power in the framebuffer
controller and allows the SoC core code to enter system wide idle
states which offer much more substantial gains.
Currently it's only lightly tested but it certainly seems to the right
thing for me.
Mark Brown (6):
video: s3c-fb: Make runtime PM functional again
video: s3c-fb: Use s3c_fb_enable() to enable the framebuffer
video: s3c-fb: Disable runtime PM in error paths from probe
video: s3c-fb: Take a runtime PM reference when unblanked
video: s3c-fb: Hold runtime PM references when touching registers
video: s3c-fb: Don't keep device runtime active when open
drivers/video/s3c-fb.c | 127 ++++++++++++++++++++++++++++++++++-------------
1 files changed, 92 insertions(+), 35 deletions(-)
^ permalink raw reply
* [RFC PATCH 29/29] OMAPDSS: FEATURES: Allow WB panels to attach to managers
From: Archit Taneja @ 2011-12-27 12:49 UTC (permalink / raw)
To: tomi.valkeinen; +Cc: rohitkc, linux-omap, linux-fbdev, Archit Taneja
In-Reply-To: <1324989432-3625-1-git-send-email-archit@ti.com>
Add WB panel type in supported displays for all managers of OMAP4. A manager can
now use set/unset ops on the dummy writeback panel.
Signed-off-by: Archit Taneja <archit@ti.com>
---
drivers/video/omap2/dss/dss_features.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/video/omap2/dss/dss_features.c b/drivers/video/omap2/dss/dss_features.c
index 9478ed8..dbde3b9 100644
--- a/drivers/video/omap2/dss/dss_features.c
+++ b/drivers/video/omap2/dss/dss_features.c
@@ -132,14 +132,16 @@ static const enum omap_display_type omap3630_dss_supported_displays[] = {
static const enum omap_display_type omap4_dss_supported_displays[] = {
/* OMAP_DSS_CHANNEL_LCD */
- OMAP_DISPLAY_TYPE_DBI | OMAP_DISPLAY_TYPE_DSI,
+ OMAP_DISPLAY_TYPE_DBI | OMAP_DISPLAY_TYPE_DSI |
+ OMAP_DISPLAY_TYPE_WB,
/* OMAP_DSS_CHANNEL_DIGIT */
OMAP_DISPLAY_TYPE_VENC | OMAP_DISPLAY_TYPE_HDMI,
+ OMAP_DISPLAY_TYPE_WB,
/* OMAP_DSS_CHANNEL_LCD2 */
OMAP_DISPLAY_TYPE_DPI | OMAP_DISPLAY_TYPE_DBI |
- OMAP_DISPLAY_TYPE_DSI,
+ OMAP_DISPLAY_TYPE_DSI | OMAP_DISPLAY_TYPE_WB,
};
static const enum omap_color_mode omap2_dss_supported_color_modes[] = {
--
1.7.4.1
^ permalink raw reply related
* [RFC PATCH 28/29] OMAPDSS: MANAGER: Add writeback as a sysfs attribute
From: Archit Taneja @ 2011-12-27 12:49 UTC (permalink / raw)
To: tomi.valkeinen; +Cc: rohitkc, linux-omap, linux-fbdev, Archit Taneja
In-Reply-To: <1324989432-3625-1-git-send-email-archit@ti.com>
Add writeback as a sysfs attribute. This can be used to show and store the dummy
writeback panel that the manager can connect to.
Add checks so that in the store functions so that a display store cant set a
writeback device and vice versa.
Signed-off-by: Archit Taneja <archit@ti.com>
---
drivers/video/omap2/dss/manager.c | 38 +++++++++++++++++++++++++++++++++++++
1 files changed, 38 insertions(+), 0 deletions(-)
diff --git a/drivers/video/omap2/dss/manager.c b/drivers/video/omap2/dss/manager.c
index fb7c1e6..a064656 100644
--- a/drivers/video/omap2/dss/manager.c
+++ b/drivers/video/omap2/dss/manager.c
@@ -129,6 +129,41 @@ static ssize_t manager_display_store(struct omap_overlay_manager *mgr,
if (r)
return r;
+ if (dssdev->wbdev) {
+ r = -EINVAL;
+ return r;
+ }
+
+ r = dss_mgr_set_output(mgr, dssdev);
+ if (r)
+ return r;
+
+ return size;
+}
+
+static ssize_t manager_writeback_show(struct omap_overlay_manager *mgr, char *buf)
+{
+ struct omap_dss_device *wb_device = mgr->get_writeback(mgr);
+
+ return snprintf(buf, PAGE_SIZE, "%s\n", wb_device ?
+ wb_device->name : "<none>");
+}
+
+static ssize_t manager_writeback_store(struct omap_overlay_manager *mgr,
+ const char *buf, size_t size)
+{
+ int r;
+ struct omap_dss_device *dssdev;
+
+ r = dss_find_device_buf(&dssdev, buf, size);
+ if (r)
+ return r;
+
+ if (!dssdev->wbdev) {
+ r = -EINVAL;
+ return r;
+ }
+
r = dss_mgr_set_output(mgr, dssdev);
if (r)
return r;
@@ -452,6 +487,8 @@ struct manager_attribute {
static MANAGER_ATTR(name, S_IRUGO, manager_name_show, NULL);
static MANAGER_ATTR(display, S_IRUGO|S_IWUSR,
manager_display_show, manager_display_store);
+static MANAGER_ATTR(writeback, S_IRUGO|S_IWUSR,
+ manager_writeback_show, manager_writeback_store);
static MANAGER_ATTR(default_color, S_IRUGO|S_IWUSR,
manager_default_color_show, manager_default_color_store);
static MANAGER_ATTR(trans_key_type, S_IRUGO|S_IWUSR,
@@ -475,6 +512,7 @@ static MANAGER_ATTR(cpr_coef, S_IRUGO|S_IWUSR,
static struct attribute *manager_sysfs_attrs[] = {
&manager_attr_name.attr,
&manager_attr_display.attr,
+ &manager_attr_writeback.attr,
&manager_attr_default_color.attr,
&manager_attr_trans_key_type.attr,
&manager_attr_trans_key_value.attr,
--
1.7.4.1
^ permalink raw reply related
* [RFC PATCH 27/29] OMAPDSS: MANAGER: Split manager_display_store into smaller functions
From: Archit Taneja @ 2011-12-27 12:49 UTC (permalink / raw)
To: tomi.valkeinen; +Cc: rohitkc, linux-omap, linux-fbdev, Archit Taneja
In-Reply-To: <1324989432-3625-1-git-send-email-archit@ti.com>
Split manager_display_store() into two function, the first function finds a
device with the same name. The second unsets the current output attached and
sets the one we had searched for.
This is done so that there can be re use between display store and writeback
store sysfs ops.
Signed-off-by: Archit Taneja <archit@ti.com>
---
drivers/video/omap2/dss/manager.c | 46 ++++++++++++++++++++++++++++++------
1 files changed, 38 insertions(+), 8 deletions(-)
diff --git a/drivers/video/omap2/dss/manager.c b/drivers/video/omap2/dss/manager.c
index f4fd3d8..fb7c1e6 100644
--- a/drivers/video/omap2/dss/manager.c
+++ b/drivers/video/omap2/dss/manager.c
@@ -49,13 +49,11 @@ static ssize_t manager_display_show(struct omap_overlay_manager *mgr, char *buf)
dssdev->name : "<none>");
}
-static ssize_t manager_display_store(struct omap_overlay_manager *mgr,
+static int dss_find_device_buf(struct omap_dss_device **pdssdev,
const char *buf, size_t size)
{
- int r = 0;
size_t len = size;
struct omap_dss_device *dssdev = NULL;
- struct omap_dss_device *curr_display;
int match(struct omap_dss_device *dssdev, void *data)
{
@@ -73,12 +71,25 @@ static ssize_t manager_display_store(struct omap_overlay_manager *mgr,
return -EINVAL;
if (dssdev)
- DSSDBG("display %s found\n", dssdev->name);
+ DSSDBG("device %s found\n", dssdev->name);
+
+ *pdssdev = dssdev;
+
+ return 0;
+}
+static int dss_mgr_set_output(struct omap_overlay_manager *mgr,
+ struct omap_dss_device *dssdev)
+{
+ int r;
+ struct omap_dss_device *curr_dssdev;
- curr_display = mgr->get_display(mgr);
+ if (dssdev->wbdev)
+ curr_dssdev = mgr->get_writeback(mgr);
+ else
+ curr_dssdev = mgr->get_display(mgr);
- if (curr_display) {
- r = mgr->unset_device(mgr, curr_display);
+ if (curr_dssdev) {
+ r = mgr->unset_device(mgr, curr_dssdev);
if (r) {
DSSERR("failed to unset display\n");
goto put_device;
@@ -99,11 +110,30 @@ static ssize_t manager_display_store(struct omap_overlay_manager *mgr,
}
}
+ return 0;
+
put_device:
if (dssdev)
omap_dss_put_device(dssdev);
- return r ? r : size;
+ return r;
+}
+
+static ssize_t manager_display_store(struct omap_overlay_manager *mgr,
+ const char *buf, size_t size)
+{
+ int r;
+ struct omap_dss_device *dssdev;
+
+ r = dss_find_device_buf(&dssdev, buf, size);
+ if (r)
+ return r;
+
+ r = dss_mgr_set_output(mgr, dssdev);
+ if (r)
+ return r;
+
+ return size;
}
static ssize_t manager_default_color_show(struct omap_overlay_manager *mgr,
--
1.7.4.1
^ permalink raw reply related
* [RFC PATCH 26/29] OMAPDSS: DISPLAY: Add a manager apply to sysfs store attributes for writeback
From: Archit Taneja @ 2011-12-27 12:49 UTC (permalink / raw)
To: tomi.valkeinen; +Cc: rohitkc, linux-omap, linux-fbdev, Archit Taneja
In-Reply-To: <1324989432-3625-1-git-send-email-archit@ti.com>
Writeback driver ops don't apply the writeback attribute changes, they just set
the writeback info parameters. Add manager apply calls in sysfs store ops for
timings, rotation and mirroring when its the writeback panel.
Signed-off-by: Archit Taneja <archit@ti.com>
---
drivers/video/omap2/dss/display.c | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/drivers/video/omap2/dss/display.c b/drivers/video/omap2/dss/display.c
index 03d7fb0..71ef0d7 100644
--- a/drivers/video/omap2/dss/display.c
+++ b/drivers/video/omap2/dss/display.c
@@ -144,6 +144,12 @@ static ssize_t display_timings_store(struct device *dev,
dssdev->driver->set_timings(dssdev, &t);
+ if (dssdev->wbdev && dssdev->manager) {
+ r = dssdev->manager->apply(dssdev->manager);
+ if (r)
+ return r;
+ }
+
return size;
}
@@ -175,6 +181,12 @@ static ssize_t display_rotate_store(struct device *dev,
if (r)
return r;
+ if (dssdev->wbdev && dssdev->manager) {
+ r = dssdev->manager->apply(dssdev->manager);
+ if (r)
+ return r;
+ }
+
return size;
}
@@ -207,6 +219,12 @@ static ssize_t display_mirror_store(struct device *dev,
if (r)
return r;
+ if (dssdev->wbdev && dssdev->manager) {
+ r = dssdev->manager->apply(dssdev->manager);
+ if (r)
+ return r;
+ }
+
return size;
}
--
1.7.4.1
^ permalink raw reply related
* [RFC PATCH 25/29] OMAPDSS: Writeback: Add sysfs attributes to writeback panel
From: Archit Taneja @ 2011-12-27 12:49 UTC (permalink / raw)
To: tomi.valkeinen; +Cc: rohitkc, linux-omap, linux-fbdev, Archit Taneja
In-Reply-To: <1324989432-3625-1-git-send-email-archit@ti.com>
Add the following sysfs attributes to the writeback panel driver:
- paddr
- p_uv_addr
- rotation_type
- color_mode
- pre_mult_alpha
- capture_rate
Signed-off-by: Archit Taneja <archit@ti.com>
---
drivers/video/omap2/dss/writeback.c | 210 +++++++++++++++++++++++++++++++++++
1 files changed, 210 insertions(+), 0 deletions(-)
diff --git a/drivers/video/omap2/dss/writeback.c b/drivers/video/omap2/dss/writeback.c
index 215958e..c6450e7 100644
--- a/drivers/video/omap2/dss/writeback.c
+++ b/drivers/video/omap2/dss/writeback.c
@@ -214,8 +214,218 @@ int dss_wb_simple_check(struct omap_dss_writeback *wb,
/* Dummy Writeback Panel driver */
+static ssize_t writeback_panel_paddr_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct omap_dss_writeback_info info;
+ struct omap_dss_device *dssdev = to_dss_device(dev);
+ struct omap_dss_writeback *wb = dssdev->wbdev;
+
+ wb->get_wb_info(wb, &info);
+
+ return snprintf(buf, PAGE_SIZE, "%x\n", info.paddr);
+}
+
+static ssize_t writeback_panel_p_uv_addr_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct omap_dss_writeback_info info;
+ struct omap_dss_device *dssdev = to_dss_device(dev);
+ struct omap_dss_writeback *wb = dssdev->wbdev;
+
+ wb->get_wb_info(wb, &info);
+
+ return snprintf(buf, PAGE_SIZE, "%x\n", info.p_uv_addr);
+}
+
+static ssize_t writeback_panel_rotation_type_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct omap_dss_writeback_info info;
+ struct omap_dss_device *dssdev = to_dss_device(dev);
+ struct omap_dss_writeback *wb = dssdev->wbdev;
+
+ wb->get_wb_info(wb, &info);
+
+ return snprintf(buf, PAGE_SIZE, "%d\n", info.rotation_type);
+}
+
+static ssize_t writeback_panel_color_mode_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct omap_dss_writeback_info info;
+ struct omap_dss_device *dssdev = to_dss_device(dev);
+ struct omap_dss_writeback *wb = dssdev->wbdev;
+
+ wb->get_wb_info(wb, &info);
+
+ return snprintf(buf, PAGE_SIZE, "%d\n", info.color_mode);
+}
+
+static ssize_t writeback_panel_color_mode_store(struct device *dev,
+ struct device_attribute *attr, const char *buf,
+ size_t size)
+{
+ int r;
+ int color_mode;
+ struct omap_dss_writeback_info info;
+ struct omap_dss_device *dssdev = to_dss_device(dev);
+ struct omap_dss_writeback *wb = dssdev->wbdev;
+
+ r = kstrtoint(buf, 0, &color_mode);
+ if (r)
+ return r;
+
+ wb->get_wb_info(wb, &info);
+
+ info.color_mode = color_mode;
+
+ r = wb->set_wb_info(wb, &info);
+ if (r) {
+ dev_err(&dssdev->dev, "failed to set color mode %d\n",
+ color_mode);
+ return r;
+ }
+
+ if (dssdev->manager) {
+ r = dssdev->manager->apply(dssdev->manager);
+ if (r)
+ return r;
+ }
+
+ return size;
+}
+
+static ssize_t writeback_panel_pre_mult_alpha_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct omap_dss_writeback_info info;
+ struct omap_dss_device *dssdev = to_dss_device(dev);
+ struct omap_dss_writeback *wb = dssdev->wbdev;
+
+ wb->get_wb_info(wb, &info);
+
+ return snprintf(buf, PAGE_SIZE, "%d\n", info.pre_mult_alpha);
+}
+
+static ssize_t writeback_panel_pre_mult_alpha_store(struct device *dev,
+ struct device_attribute *attr, const char *buf,
+ size_t size)
+{
+ int r;
+ u8 pre_mult_alpha;
+ struct omap_dss_writeback_info info;
+ struct omap_dss_device *dssdev = to_dss_device(dev);
+ struct omap_dss_writeback *wb = dssdev->wbdev;
+
+ r = kstrtou8(buf, 0, &pre_mult_alpha);
+ if (r)
+ return r;
+
+ wb->get_wb_info(wb, &info);
+
+ info.pre_mult_alpha = pre_mult_alpha;
+
+ r = wb->set_wb_info(wb, &info);
+ if (r) {
+ dev_err(&dssdev->dev, "failed to set pre_mult_alpha %d\n",
+ pre_mult_alpha);
+ return r;
+ }
+
+ if (dssdev->manager) {
+ r = dssdev->manager->apply(dssdev->manager);
+ if (r)
+ return r;
+ }
+
+ return size;
+}
+
+static ssize_t writeback_panel_capture_rate_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct omap_dss_writeback_info info;
+ struct omap_dss_device *dssdev = to_dss_device(dev);
+ struct omap_dss_writeback *wb = dssdev->wbdev;
+
+ wb->get_wb_info(wb, &info);
+
+ return snprintf(buf, PAGE_SIZE, "%d\n", info.capture_rate);
+}
+
+static ssize_t writeback_panel_capture_rate_store(struct device *dev,
+ struct device_attribute *attr, const char *buf,
+ size_t size)
+{
+ int r;
+ int capture_rate;
+ struct omap_dss_writeback_info info;
+ struct omap_dss_device *dssdev = to_dss_device(dev);
+ struct omap_dss_writeback *wb = dssdev->wbdev;
+
+ r = kstrtoint(buf, 0, &capture_rate);
+ if (r)
+ return r;
+
+ wb->get_wb_info(wb, &info);
+
+ info.capture_rate = capture_rate;
+
+ r = wb->set_wb_info(wb, &info);
+ if (r) {
+ dev_err(&dssdev->dev, "failed to set capture_rate %d\n",
+ capture_rate);
+ return r;
+ }
+
+ if (dssdev->manager) {
+ r = dssdev->manager->apply(dssdev->manager);
+ if (r)
+ return r;
+ }
+
+ return size;
+}
+
+static DEVICE_ATTR(paddr, S_IRUGO, writeback_panel_paddr_show, NULL);
+static DEVICE_ATTR(p_uv_addr, S_IRUGO, writeback_panel_p_uv_addr_show, NULL);
+static DEVICE_ATTR(rotation_type, S_IRUGO, writeback_panel_rotation_type_show,
+ NULL);
+static DEVICE_ATTR(color_mode, S_IRUGO | S_IWUSR,
+ writeback_panel_color_mode_show,
+ writeback_panel_color_mode_store);
+static DEVICE_ATTR(pre_mult_alpha, S_IRUGO | S_IWUSR,
+ writeback_panel_pre_mult_alpha_show,
+ writeback_panel_pre_mult_alpha_store);
+static DEVICE_ATTR(capture_rate, S_IRUGO | S_IWUSR,
+ writeback_panel_capture_rate_show,
+ writeback_panel_capture_rate_store);
+
+static struct attribute *writeback_attrs[] = {
+ &dev_attr_paddr.attr,
+ &dev_attr_p_uv_addr.attr,
+ &dev_attr_rotation_type.attr,
+ &dev_attr_color_mode.attr,
+ &dev_attr_pre_mult_alpha.attr,
+ &dev_attr_capture_rate.attr,
+ NULL,
+};
+
+static struct attribute_group writeback_attr_group = {
+ .attrs = writeback_attrs,
+};
+
static int writeback_panel_probe(struct omap_dss_device *dssdev)
{
+ int r;
+
+ r = sysfs_create_group(&dssdev->dev.kobj, &writeback_attr_group);
+ if (r) {
+ dev_err(&dssdev->dev, "failed to create sysfs files\n");
+ return r;
+ }
+
return 0;
}
--
1.7.4.1
^ permalink raw reply related
* [RFC PATCH 24/29] OMAPDSS: Writeback: Use panel driver ops to configure mirroring rotation and buffe
From: Archit Taneja @ 2011-12-27 12:49 UTC (permalink / raw)
To: tomi.valkeinen; +Cc: rohitkc, linux-omap, linux-fbdev, Archit Taneja
In-Reply-To: <1324989432-3625-1-git-send-email-archit@ti.com>
Add rotation and mirroring ops to writeback panel driver. Use these ops to
get/set wb info.
Signed-off-by: Archit Taneja <archit@ti.com>
---
drivers/video/omap2/dss/writeback.c | 79 +++++++++++++++++++++++++++++++++++
1 files changed, 79 insertions(+), 0 deletions(-)
diff --git a/drivers/video/omap2/dss/writeback.c b/drivers/video/omap2/dss/writeback.c
index 82d601c..215958e 100644
--- a/drivers/video/omap2/dss/writeback.c
+++ b/drivers/video/omap2/dss/writeback.c
@@ -287,9 +287,83 @@ static int writeback_panel_resume(struct omap_dss_device *dssdev)
return 0;
}
+static int writeback_panel_rotate(struct omap_dss_device *dssdev, u8 rotate)
+{
+ int r;
+ struct omap_dss_writeback *wb = dssdev->wbdev;
+ struct omap_dss_writeback_info info;
+
+ wb->get_wb_info(wb, &info);
+
+ info.rotation = rotate;
+
+ r = wb->set_wb_info(wb, &info);
+ if (r) {
+ dev_err(&dssdev->dev, "failed to set rotation %d\n", rotate);
+ return -EINVAL;
+ }
+
+ return 0;
+}
+
+static u8 writeback_panel_get_rotate(struct omap_dss_device *dssdev)
+{
+ struct omap_dss_writeback *wb = dssdev->wbdev;
+ struct omap_dss_writeback_info info;
+
+ wb->get_wb_info(wb, &info);
+
+ return info.rotation;
+}
+
+static int writeback_panel_mirror(struct omap_dss_device *dssdev, bool mirror)
+{
+ int r;
+ struct omap_dss_writeback *wb = dssdev->wbdev;
+ struct omap_dss_writeback_info info;
+
+ wb->get_wb_info(wb, &info);
+
+ info.mirror = mirror;
+
+ r = wb->set_wb_info(wb, &info);
+ if (r) {
+ dev_err(&dssdev->dev, "failed to set mirror %d\n", mirror);
+ return -EINVAL;
+ }
+
+ return 0;
+}
+
+static bool writeback_panel_get_mirror(struct omap_dss_device *dssdev)
+{
+ struct omap_dss_writeback *wb = dssdev->wbdev;
+ struct omap_dss_writeback_info info;
+
+ wb->get_wb_info(wb, &info);
+
+ return info.mirror;
+}
+
static void writeback_panel_set_timings(struct omap_dss_device *dssdev,
struct omap_video_timings *timings)
{
+ int r;
+ struct omap_dss_writeback *wb = dssdev->wbdev;
+ struct omap_dss_writeback_info info;
+
+ wb->get_wb_info(wb, &info);
+
+ info.buf_width = timings->x_res;
+ info.buf_height = timings->y_res;
+
+ r = wb->set_wb_info(wb, &info);
+ if (r) {
+ dev_err(&dssdev->dev, "failed to set timings %d, %d\n",
+ timings->x_res, timings->y_res);
+ return;
+ }
+
dssdev->panel.timings.x_res = timings->x_res;
dssdev->panel.timings.y_res = timings->y_res;
}
@@ -315,6 +389,11 @@ static struct omap_dss_driver writeback_panel_driver = {
.suspend = writeback_panel_suspend,
.resume = writeback_panel_resume,
+ .set_rotate = writeback_panel_rotate,
+ .get_rotate = writeback_panel_get_rotate,
+ .set_mirror = writeback_panel_mirror,
+ .get_mirror = writeback_panel_get_mirror,
+
.set_timings = writeback_panel_set_timings,
.get_timings = writeback_panel_get_timings,
.check_timings = writeback_panel_check_timings,
--
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