[RFC v2 0/5] Common Display Framework

2012-11-23 Thread Sascha Hauer
Hi Laurent,

On Thu, Nov 22, 2012 at 10:45:31PM +0100, Laurent Pinchart wrote:
> From: Laurent Pinchart 
> 

> The CDF models this using a Russian doll's model. From the display controller
> point of view only the first external entity (LVDS to DSI converter) is
> visible. The display controller thus calls the control operations implemented
> by the LVDS to DSI transmitter driver (left-most green arrow). The driver is
> aware of the next entity in the chain,

I can't find this in the code. I can see the video operations
propagating upstream using the source field of struct display_entity,
but how do the control operations propagate downstream? Am I missing
something?

Sascha


-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |


RE: [PATCH v2] drm: exynos: hdmi: sending AVI and AUI info frames

2012-11-23 Thread Inki Dae
Let's update one more time. Below is my comments.

> -Original Message-
> From: Rahul Sharma [mailto:rahul.sha...@samsung.com]
> Sent: Friday, November 23, 2012 9:04 PM
> To: dri-devel@lists.freedesktop.org
> Cc: inki@samsung.com; kgene@samsung.com; r.sh.o...@gmail.com;
> sw0312@samsung.com; jo...@samsung.com
> Subject: [PATCH v2] drm: exynos: hdmi: sending AVI and AUI info frames
> 
> This patch adds code for composing AVI and AUI info frames
> and send them every VSYNC.
> 
> This patch is important for hdmi certification.
> 
> v1:
> - Remove un-necessary blank lines.
> - Change the case of hex constants.
> 
> v2:
> - Added few blank lines.
> - Corrected comments format.
> - Added comments for 2's Complement calculation for check sum.
> 
> Signed-off-by: Rahul Sharma 
> Signed-off-by: Fahad Kunnathadi 
> Signed-off-by: Shirish S 
> 
> ---
> Based on exynos-drm-next branch of
> http://git.kernel.org/?p=linux/kernel/git/daeinki/drm-exynos.git
> 
>  drivers/gpu/drm/exynos/exynos_hdmi.c |  142
> +-
>  drivers/gpu/drm/exynos/exynos_hdmi.h |   23 ++
>  drivers/gpu/drm/exynos/regs-hdmi.h   |   17 -
>  3 files changed, 161 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c
> b/drivers/gpu/drm/exynos/exynos_hdmi.c
> index 59839cc..af956c7 100644
> --- a/drivers/gpu/drm/exynos/exynos_hdmi.c
> +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
> @@ -183,6 +183,7 @@ struct hdmi_v13_conf {
>   int height;
>   int vrefresh;
>   bool interlace;
> + int cea_video_id;
>   const u8 *hdmiphy_data;
>   const struct hdmi_v13_preset_conf *conf;
>  };
> @@ -354,15 +355,20 @@ static const struct hdmi_v13_preset_conf
> hdmi_v13_conf_1080p60 = {
>  };
> 
>  static const struct hdmi_v13_conf hdmi_v13_confs[] = {
> - { 1280, 720, 60, false, hdmiphy_v13_conf74_25,
> &hdmi_v13_conf_720p60 },
> - { 1280, 720, 50, false, hdmiphy_v13_conf74_25,
> &hdmi_v13_conf_720p60 },
> - { 720, 480, 60, false, hdmiphy_v13_conf27_027,
> &hdmi_v13_conf_480p },
> - { 1920, 1080, 50, true, hdmiphy_v13_conf74_25,
> &hdmi_v13_conf_1080i50 },
> - { 1920, 1080, 50, false, hdmiphy_v13_conf148_5,
> -  &hdmi_v13_conf_1080p50 },
> - { 1920, 1080, 60, true, hdmiphy_v13_conf74_25,
> &hdmi_v13_conf_1080i60 },
> - { 1920, 1080, 60, false, hdmiphy_v13_conf148_5,
> -  &hdmi_v13_conf_1080p60 },
> + { 1280, 720, 60, false, 4, hdmiphy_v13_conf74_25,
> + &hdmi_v13_conf_720p60 },
> + { 1280, 720, 50, false, 19, hdmiphy_v13_conf74_25,
> + &hdmi_v13_conf_720p60 },
> + { 720, 480, 60, false, 3, hdmiphy_v13_conf27_027,
> + &hdmi_v13_conf_480p },
> + { 1920, 1080, 50, true, 20, hdmiphy_v13_conf74_25,
> + &hdmi_v13_conf_1080i50 },
> + { 1920, 1080, 50, false, 31, hdmiphy_v13_conf148_5,
> + &hdmi_v13_conf_1080p50 },
> + { 1920, 1080, 60, true, 5, hdmiphy_v13_conf74_25,
> + &hdmi_v13_conf_1080i60 },
> + { 1920, 1080, 60, false, 16, hdmiphy_v13_conf148_5,
> + &hdmi_v13_conf_1080p60 },
>  };
> 
>  /* HDMI Version 1.4 */
> @@ -480,6 +486,7 @@ struct hdmi_conf {
>   int height;
>   int vrefresh;
>   bool interlace;
> + int cea_video_id;
>   const u8 *hdmiphy_data;
>   const struct hdmi_preset_conf *conf;
>  };
> @@ -935,16 +942,21 @@ static const struct hdmi_preset_conf
> hdmi_conf_1080p60 = {
>  };
> 
>  static const struct hdmi_conf hdmi_confs[] = {
> - { 720, 480, 60, false, hdmiphy_conf27_027, &hdmi_conf_480p60 },
> - { 1280, 720, 50, false, hdmiphy_conf74_25, &hdmi_conf_720p50 },
> - { 1280, 720, 60, false, hdmiphy_conf74_25, &hdmi_conf_720p60 },
> - { 1920, 1080, 50, true, hdmiphy_conf74_25, &hdmi_conf_1080i50 },
> - { 1920, 1080, 60, true, hdmiphy_conf74_25, &hdmi_conf_1080i60 },
> - { 1920, 1080, 30, false, hdmiphy_conf74_176, &hdmi_conf_1080p30 },
> - { 1920, 1080, 50, false, hdmiphy_conf148_5, &hdmi_conf_1080p50 },
> - { 1920, 1080, 60, false, hdmiphy_conf148_5, &hdmi_conf_1080p60 },
> + { 720, 480, 60, false, 3, hdmiphy_conf27_027, &hdmi_conf_480p60 },
> + { 1280, 720, 50, false, 19, hdmiphy_conf74_25, &hdmi_conf_720p50 },
> + { 1280, 720, 60, false, 4, hdmiphy_conf74_25, &hdmi_conf_720p60 },
> + { 1920, 1080, 50, true, 20, hdmiphy_conf74_25, &hdmi_conf_1080i50 },
> + { 1920, 1080, 60, true, 5, hdmiphy_conf74_25, &hdmi_conf_1080i60 },
> + { 1920, 1080, 30, false, 34, hdmiphy_conf74_176,
> &hdmi_conf_1080p30 },
> + { 1920, 1080, 50, false, 31, hdmiphy_conf148_5,
> &hdmi_conf_1080p50 },
> + { 1920, 1080, 60, false, 16, hdmiphy_conf148_5,
> &hdmi_conf_1080p60 },
>  };
> 
> +struct hdmi_infoframe {
> + enum HDMI_PACKET_TYPE type;
> + u8 ver;
> + u8 len;
> +};
> 
>  static inline u32 hdmi_reg_read(struct hdmi_context *hdata,

RE: [PATCH 1/1] drm/exynos: remove unnecessary clk_disable calls in exynos_drm_fimd.c

2012-11-23 Thread Inki Dae


> -Original Message-
> From: Sachin Kamat [mailto:sachin.ka...@linaro.org]
> Sent: Friday, November 23, 2012 7:06 PM
> To: dri-devel@lists.freedesktop.org
> Cc: inki@samsung.com; sachin.ka...@linaro.org; patc...@linaro.org
> Subject: [PATCH 1/1] drm/exynos: remove unnecessary clk_disable calls in
> exynos_drm_fimd.c
> 
> Also fixes an error related to returning 'ret' without initialising
> with error code.
> 
> Signed-off-by: Sachin Kamat 
> ---
>  drivers/gpu/drm/exynos/exynos_drm_fimd.c |   22 +-
>  1 files changed, 5 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> index 57851cc..00bd266 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> @@ -849,15 +849,13 @@ static int __devinit fimd_probe(struct
> platform_device *pdev)
>   ctx->bus_clk = devm_clk_get(dev, "fimd");
>   if (IS_ERR(ctx->bus_clk)) {
>   dev_err(dev, "failed to get bus clock\n");
> - ret = PTR_ERR(ctx->bus_clk);
> - goto err_clk_get;
> + return PTR_ERR(ctx->bus_clk);
>   }
> 
>   ctx->lcd_clk = devm_clk_get(dev, "sclk_fimd");
>   if (IS_ERR(ctx->lcd_clk)) {
>   dev_err(dev, "failed to get lcd clock\n");
> - ret = PTR_ERR(ctx->lcd_clk);
> - goto err_bus_clk;
> + return PTR_ERR(ctx->lcd_clk);
>   }
> 
>   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> @@ -865,14 +863,13 @@ static int __devinit fimd_probe(struct
> platform_device *pdev)
>   ctx->regs = devm_request_and_ioremap(&pdev->dev, res);
>   if (!ctx->regs) {
>   dev_err(dev, "failed to map registers\n");
> - ret = -ENXIO;
> - goto err_clk;
> + return -ENXIO;
>   }
> 
>   res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
>   if (!res) {
>   dev_err(dev, "irq request failed.\n");
> - goto err_clk;
> + return -ENXIO;

Let's combine the above changes with previous patch, 'drm/exynos: Use
devm_clk_get in exynos_drm_fimd.c'. For this, reverted old one.

>   }
> 
>   ctx->irq = res->start;
> @@ -881,7 +878,7 @@ static int __devinit fimd_probe(struct platform_device
> *pdev)
>   0, "drm_fimd", ctx);
>   if (ret) {
>   dev_err(dev, "irq request failed.\n");
> - goto err_clk;
> + return ret;
>   }
> 
>   ctx->vidcon0 = pdata->vidcon0;
> @@ -915,15 +912,6 @@ static int __devinit fimd_probe(struct
> platform_device *pdev)
>   exynos_drm_subdrv_register(subdrv);
> 
>   return 0;
> -
> -err_clk:
> - clk_disable(ctx->lcd_clk);
> -
> -err_bus_clk:
> - clk_disable(ctx->bus_clk);
> -
> -err_clk_get:
> - return ret;

And separated one.

Thanks,
Inki Dae

>  }
> 
>  static int __devexit fimd_remove(struct platform_device *pdev)
> --
> 1.7.4.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[RFC v2 0/5] Common Display Framework

2012-11-23 Thread Thierry Reding
On Thu, Nov 22, 2012 at 10:45:31PM +0100, Laurent Pinchart wrote:
[...]
> Display entities are accessed by driver using notifiers. Any driver can
> register a display entity notifier with the CDF, which then calls the notifier
> when a matching display entity is registered. The reason for this asynchronous
> mode of operation, compared to how drivers acquire regulator or clock
> resources, is that the display entities can use resources provided by the
> display driver. For instance a panel can be a child of the DBI or DSI bus
> controlled by the display device, or use a clock provided by that device. We
> can't defer the display device probe until the panel is registered and also
> defer the panel device probe until the display is registered. As most display
> drivers need to handle output devices hotplug (HDMI monitors for instance),
> handling other display entities through a notification system seemed to be the
> easiest solution.
> 
> Note that this brings a different issue after registration, as display
> controller and display entity drivers would take a reference to each other.
> Those circular references would make driver unloading impossible. One possible
> solution to this problem would be to simulate an unplug event for the display
> entity, to force the display driver to release the dislay entities it uses. We
> would need a userspace API for that though. Better solutions would of course
> be welcome.

Maybe I don't understand all of the underlying issues correctly, but a
parent/child model would seem like a better solution to me. We discussed
this back when designing the DT bindings for Tegra DRM and came to the
conclusion that the output resource of the display controller (RGB,
HDMI, DSI or TVO) was the most suitable candidate to be the parent of
the panel or display attached to it. The reason for that decision was
that it keeps the flow of data or addressing of nodes consistent. So the
chain would look something like this (on Tegra):

CPU
+-host1x
  +-dc
+-rgb
| +-panel
+-hdmi
  +-monitor

In a natural way this makes the output resource the master of the panel
or display. From a programming point of view this becomes quite easy to
implement and is very similar to how other busses like I2C or SPI are
modelled. In device tree these would be represented as subnodes, while
with platform data some kind of lookup could be done like for regulators
or alternatively a board setup registration mechanism like what's in
place for I2C or SPI.

Thierry
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20121123/fe2d67cc/attachment.pgp>


[PATCH] drm: exynos: hdmi: sending AVI and AUI info frames

2012-11-23 Thread Inki Dae
Sorry but could you re-send this one more time? below is my comment.

Thanks,
Inki Dae

> -Original Message-
> From: Rahul Sharma [mailto:rahul.sharma at samsung.com]
> Sent: Friday, November 23, 2012 6:17 PM
> To: dri-devel at lists.freedesktop.org
> Cc: airlied at redhat.com; inki.dae at samsung.com; kgene.kim at samsung.com;
> r.sh.open at gmail.com; marcheu at chromium.org; sw0312.kim at samsung.com;
> kyungmin.park at samsung.com
> Subject: [PATCH] drm: exynos: hdmi: sending AVI and AUI info frames
> 
> This patch adds code for composing AVI and AUI info frames
> and send them every VSYNC.
> 
> This patch is important for hdmi certification.
> 
> Signed-off-by: Rahul Sharma 
> Signed-off-by: Fahad Kunnathadi 
> Signed-off-by: Shirish S 
> 
> Based on exynos-drm-next branch of
> http://git.kernel.org/?p=linux/kernel/git/daeinki/drm-exynos.git
> ---
>  drivers/gpu/drm/exynos/exynos_hdmi.c |  139
> +-
>  drivers/gpu/drm/exynos/exynos_hdmi.h |   23 ++
>  drivers/gpu/drm/exynos/regs-hdmi.h   |   17 -
>  3 files changed, 158 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c
> b/drivers/gpu/drm/exynos/exynos_hdmi.c
> index 59839cc..49332bd 100644
> --- a/drivers/gpu/drm/exynos/exynos_hdmi.c
> +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
> @@ -183,6 +183,7 @@ struct hdmi_v13_conf {
>   int height;
>   int vrefresh;
>   bool interlace;
> + int cea_video_id;
>   const u8 *hdmiphy_data;
>   const struct hdmi_v13_preset_conf *conf;
>  };
> @@ -354,15 +355,20 @@ static const struct hdmi_v13_preset_conf
> hdmi_v13_conf_1080p60 = {
>  };
> 
>  static const struct hdmi_v13_conf hdmi_v13_confs[] = {
> - { 1280, 720, 60, false, hdmiphy_v13_conf74_25,
> &hdmi_v13_conf_720p60 },
> - { 1280, 720, 50, false, hdmiphy_v13_conf74_25,
> &hdmi_v13_conf_720p60 },
> - { 720, 480, 60, false, hdmiphy_v13_conf27_027,
> &hdmi_v13_conf_480p },
> - { 1920, 1080, 50, true, hdmiphy_v13_conf74_25,
> &hdmi_v13_conf_1080i50 },
> - { 1920, 1080, 50, false, hdmiphy_v13_conf148_5,
> -  &hdmi_v13_conf_1080p50 },
> - { 1920, 1080, 60, true, hdmiphy_v13_conf74_25,
> &hdmi_v13_conf_1080i60 },
> - { 1920, 1080, 60, false, hdmiphy_v13_conf148_5,
> -  &hdmi_v13_conf_1080p60 },
> + { 1280, 720, 60, false, 4, hdmiphy_v13_conf74_25,
> + &hdmi_v13_conf_720p60 },
> + { 1280, 720, 50, false, 19, hdmiphy_v13_conf74_25,
> + &hdmi_v13_conf_720p60 },
> + { 720, 480, 60, false, 3, hdmiphy_v13_conf27_027,
> + &hdmi_v13_conf_480p },
> + { 1920, 1080, 50, true, 20, hdmiphy_v13_conf74_25,
> + &hdmi_v13_conf_1080i50 },
> + { 1920, 1080, 50, false, 31, hdmiphy_v13_conf148_5,
> + &hdmi_v13_conf_1080p50 },
> + { 1920, 1080, 60, true, 5, hdmiphy_v13_conf74_25,
> + &hdmi_v13_conf_1080i60 },
> + { 1920, 1080, 60, false, 16, hdmiphy_v13_conf148_5,
> + &hdmi_v13_conf_1080p60 },
>  };
> 
>  /* HDMI Version 1.4 */
> @@ -480,6 +486,7 @@ struct hdmi_conf {
>   int height;
>   int vrefresh;
>   bool interlace;
> + int cea_video_id;
>   const u8 *hdmiphy_data;
>   const struct hdmi_preset_conf *conf;
>  };
> @@ -935,16 +942,21 @@ static const struct hdmi_preset_conf
> hdmi_conf_1080p60 = {
>  };
> 
>  static const struct hdmi_conf hdmi_confs[] = {
> - { 720, 480, 60, false, hdmiphy_conf27_027, &hdmi_conf_480p60 },
> - { 1280, 720, 50, false, hdmiphy_conf74_25, &hdmi_conf_720p50 },
> - { 1280, 720, 60, false, hdmiphy_conf74_25, &hdmi_conf_720p60 },
> - { 1920, 1080, 50, true, hdmiphy_conf74_25, &hdmi_conf_1080i50 },
> - { 1920, 1080, 60, true, hdmiphy_conf74_25, &hdmi_conf_1080i60 },
> - { 1920, 1080, 30, false, hdmiphy_conf74_176, &hdmi_conf_1080p30 },
> - { 1920, 1080, 50, false, hdmiphy_conf148_5, &hdmi_conf_1080p50 },
> - { 1920, 1080, 60, false, hdmiphy_conf148_5, &hdmi_conf_1080p60 },
> + { 720, 480, 60, false, 3, hdmiphy_conf27_027, &hdmi_conf_480p60 },
> + { 1280, 720, 50, false, 19, hdmiphy_conf74_25, &hdmi_conf_720p50 },
> + { 1280, 720, 60, false, 4, hdmiphy_conf74_25, &hdmi_conf_720p60 },
> + { 1920, 1080, 50, true, 20, hdmiphy_conf74_25, &hdmi_conf_1080i50 },
> + { 1920, 1080, 60, true, 5, hdmiphy_conf74_25, &hdmi_conf_1080i60 },
> + { 1920, 1080, 30, false, 34, hdmiphy_conf74_176,
> &hdmi_conf_1080p30 },
> + { 1920, 1080, 50, false, 31, hdmiphy_conf148_5,
> &hdmi_conf_1080p50 },
> + { 1920, 1080, 60, false, 16, hdmiphy_conf148_5,
> &hdmi_conf_1080p60 },
>  };
> 
> +struct hdmi_infoframe {
> + enum HDMI_PACKET_TYPE type;
> + u8 ver;
> + u8 len;
> +};
> 
>  static inline u32 hdmi_reg_read(struct hdmi_context *hdata, u32 reg_id)
>  {
> @@ -1268,6 +1280,85 @@ static int hdmi_conf_index(struct hdmi_context
> *hdata,
> 

[PATCH Resend] drm/exynos: Use devm_clk_get in exynos_drm_fimd.c

2012-11-23 Thread Inki Dae
The subject mentions just only 'use devm_clk_get in exynos_dev_fimd.c' but
this patch removes unnecessary clk_disable calls also. Just separate this
patch into two as you mentioned. For this, already applied old one. So could
you send another one? Sorry for inconvenient. :)

Thanks,
Inki Dae

> -Original Message-
> From: Sachin Kamat [mailto:sachin.kamat at linaro.org]
> Sent: Friday, November 23, 2012 5:43 PM
> To: dri-devel at lists.freedesktop.org
> Cc: inki.dae at samsung.com; sachin.kamat at linaro.org; patches at linaro.org
> Subject: [PATCH Resend] drm/exynos: Use devm_clk_get in exynos_drm_fimd.c
> 
> devm_clk_get is device managed and makes error handling and exit code
> simpler.
> 
> Signed-off-by: Sachin Kamat 
> ---
>  drivers/gpu/drm/exynos/exynos_drm_fimd.c |   31
++
> ---
>  1 files changed, 7 insertions(+), 24 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> index ad04edd..00bd266 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> @@ -846,18 +846,16 @@ static int __devinit fimd_probe(struct
> platform_device *pdev)
>   if (!ctx)
>   return -ENOMEM;
> 
> - ctx->bus_clk = clk_get(dev, "fimd");
> + ctx->bus_clk = devm_clk_get(dev, "fimd");
>   if (IS_ERR(ctx->bus_clk)) {
>   dev_err(dev, "failed to get bus clock\n");
> - ret = PTR_ERR(ctx->bus_clk);
> - goto err_clk_get;
> + return PTR_ERR(ctx->bus_clk);
>   }
> 
> - ctx->lcd_clk = clk_get(dev, "sclk_fimd");
> + ctx->lcd_clk = devm_clk_get(dev, "sclk_fimd");
>   if (IS_ERR(ctx->lcd_clk)) {
>   dev_err(dev, "failed to get lcd clock\n");
> - ret = PTR_ERR(ctx->lcd_clk);
> - goto err_bus_clk;
> + return PTR_ERR(ctx->lcd_clk);
>   }
> 
>   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> @@ -865,14 +863,13 @@ static int __devinit fimd_probe(struct
> platform_device *pdev)
>   ctx->regs = devm_request_and_ioremap(&pdev->dev, res);
>   if (!ctx->regs) {
>   dev_err(dev, "failed to map registers\n");
> - ret = -ENXIO;
> - goto err_clk;
> + return -ENXIO;
>   }
> 
>   res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
>   if (!res) {
>   dev_err(dev, "irq request failed.\n");
> - goto err_clk;
> + return -ENXIO;
>   }
> 
>   ctx->irq = res->start;
> @@ -881,7 +878,7 @@ static int __devinit fimd_probe(struct platform_device
> *pdev)
>   0, "drm_fimd", ctx);
>   if (ret) {
>   dev_err(dev, "irq request failed.\n");
> - goto err_clk;
> + return ret;
>   }
> 
>   ctx->vidcon0 = pdata->vidcon0;
> @@ -915,17 +912,6 @@ static int __devinit fimd_probe(struct
> platform_device *pdev)
>   exynos_drm_subdrv_register(subdrv);
> 
>   return 0;
> -
> -err_clk:
> - clk_disable(ctx->lcd_clk);
> - clk_put(ctx->lcd_clk);
> -
> -err_bus_clk:
> - clk_disable(ctx->bus_clk);
> - clk_put(ctx->bus_clk);
> -
> -err_clk_get:
> - return ret;
>  }
> 
>  static int __devexit fimd_remove(struct platform_device *pdev)
> @@ -949,9 +935,6 @@ static int __devexit fimd_remove(struct
> platform_device *pdev)
>  out:
>   pm_runtime_disable(dev);
> 
> - clk_put(ctx->lcd_clk);
> - clk_put(ctx->bus_clk);
> -
>   return 0;
>  }
> 
> --
> 1.7.4.1



[PATCH Resend] drm/exynos: Use devm_* APIs in exynos_hdmi.c

2012-11-23 Thread Inki Dae
Applied.

Thanks,
Inki Dae

> -Original Message-
> From: Sachin Kamat [mailto:sachin.kamat at linaro.org]
> Sent: Friday, November 23, 2012 5:43 PM
> To: dri-devel at lists.freedesktop.org
> Cc: inki.dae at samsung.com; sachin.kamat at linaro.org; patches at linaro.org
> Subject: [PATCH Resend] drm/exynos: Use devm_* APIs in exynos_hdmi.c
> 
> devm_* functions are device managed and make error handling and exit code
> simpler.
> 
> Signed-off-by: Sachin Kamat 
> ---
>  drivers/gpu/drm/exynos/exynos_hdmi.c |   60
+++---
> ---
>  1 files changed, 13 insertions(+), 47 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c
> b/drivers/gpu/drm/exynos/exynos_hdmi.c
> index 59839cc..af5c8ac 100644
> --- a/drivers/gpu/drm/exynos/exynos_hdmi.c
> +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
> @@ -2197,27 +2197,27 @@ static int __devinit hdmi_resources_init(struct
> hdmi_context *hdata)
>   memset(res, 0, sizeof(*res));
> 
>   /* get clocks, power */
> - res->hdmi = clk_get(dev, "hdmi");
> + res->hdmi = devm_clk_get(dev, "hdmi");
>   if (IS_ERR_OR_NULL(res->hdmi)) {
>   DRM_ERROR("failed to get clock 'hdmi'\n");
>   goto fail;
>   }
> - res->sclk_hdmi = clk_get(dev, "sclk_hdmi");
> + res->sclk_hdmi = devm_clk_get(dev, "sclk_hdmi");
>   if (IS_ERR_OR_NULL(res->sclk_hdmi)) {
>   DRM_ERROR("failed to get clock 'sclk_hdmi'\n");
>   goto fail;
>   }
> - res->sclk_pixel = clk_get(dev, "sclk_pixel");
> + res->sclk_pixel = devm_clk_get(dev, "sclk_pixel");
>   if (IS_ERR_OR_NULL(res->sclk_pixel)) {
>   DRM_ERROR("failed to get clock 'sclk_pixel'\n");
>   goto fail;
>   }
> - res->sclk_hdmiphy = clk_get(dev, "sclk_hdmiphy");
> + res->sclk_hdmiphy = devm_clk_get(dev, "sclk_hdmiphy");
>   if (IS_ERR_OR_NULL(res->sclk_hdmiphy)) {
>   DRM_ERROR("failed to get clock 'sclk_hdmiphy'\n");
>   goto fail;
>   }
> - res->hdmiphy = clk_get(dev, "hdmiphy");
> + res->hdmiphy = devm_clk_get(dev, "hdmiphy");
>   if (IS_ERR_OR_NULL(res->hdmiphy)) {
>   DRM_ERROR("failed to get clock 'hdmiphy'\n");
>   goto fail;
> @@ -2225,7 +2225,7 @@ static int __devinit hdmi_resources_init(struct
> hdmi_context *hdata)
> 
>   clk_set_parent(res->sclk_hdmi, res->sclk_pixel);
> 
> - res->regul_bulk = kzalloc(ARRAY_SIZE(supply) *
> + res->regul_bulk = devm_kzalloc(dev, ARRAY_SIZE(supply) *
>   sizeof(res->regul_bulk[0]), GFP_KERNEL);
>   if (!res->regul_bulk) {
>   DRM_ERROR("failed to get memory for regulators\n");
> @@ -2235,7 +2235,7 @@ static int __devinit hdmi_resources_init(struct
> hdmi_context *hdata)
>   res->regul_bulk[i].supply = supply[i];
>   res->regul_bulk[i].consumer = NULL;
>   }
> - ret = regulator_bulk_get(dev, ARRAY_SIZE(supply), res->regul_bulk);
> + ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(supply), res-
> >regul_bulk);
>   if (ret) {
>   DRM_ERROR("failed to get regulators\n");
>   goto fail;
> @@ -2248,28 +2248,6 @@ fail:
>   return -ENODEV;
>  }
> 
> -static int hdmi_resources_cleanup(struct hdmi_context *hdata)
> -{
> - struct hdmi_resources *res = &hdata->res;
> -
> - regulator_bulk_free(res->regul_count, res->regul_bulk);
> - /* kfree is NULL-safe */
> - kfree(res->regul_bulk);
> - if (!IS_ERR_OR_NULL(res->hdmiphy))
> - clk_put(res->hdmiphy);
> - if (!IS_ERR_OR_NULL(res->sclk_hdmiphy))
> - clk_put(res->sclk_hdmiphy);
> - if (!IS_ERR_OR_NULL(res->sclk_pixel))
> - clk_put(res->sclk_pixel);
> - if (!IS_ERR_OR_NULL(res->sclk_hdmi))
> - clk_put(res->sclk_hdmi);
> - if (!IS_ERR_OR_NULL(res->hdmi))
> - clk_put(res->hdmi);
> - memset(res, 0, sizeof(*res));
> -
> - return 0;
> -}
> -
>  static struct i2c_client *hdmi_ddc, *hdmi_hdmiphy;
> 
>  void hdmi_attach_ddc_client(struct i2c_client *ddc)
> @@ -2409,36 +2387,32 @@ static int __devinit hdmi_probe(struct
> platform_device *pdev)
>   ret = hdmi_resources_init(hdata);
> 
>   if (ret) {
> - ret = -EINVAL;
>   DRM_ERROR("hdmi_resources_init failed\n");
> - goto err_data;
> + return -EINVAL;
>   }
> 
>   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>   if (!res) {
>   DRM_ERROR("failed to find registers\n");
> - ret = -ENOENT;
> - goto err_resource;
> + return -ENOENT;
>   }
> 
>   hdata->regs = devm_request_and_ioremap(&pdev->dev, res);
>   if (!hdata->regs) {
>   DRM_ERROR("failed to map registers\n");
> - ret = -ENXIO;
> - goto err_resource;
> + return -ENXIO;
>   }
> 
> - ret = gpio_request(hdata->hpd_gpio, "HPD");
> + ret = devm_gpio_request

[PATCH Resend] drm/exynos: Use devm_clk_get in exynos_mixer.c

2012-11-23 Thread Inki Dae
Applied.

Thanks,
Inki Dae

> -Original Message-
> From: Sachin Kamat [mailto:sachin.kamat at linaro.org]
> Sent: Friday, November 23, 2012 5:43 PM
> To: dri-devel at lists.freedesktop.org
> Cc: inki.dae at samsung.com; sachin.kamat at linaro.org; patches at linaro.org
> Subject: [PATCH Resend] drm/exynos: Use devm_clk_get in exynos_mixer.c
> 
> devm_clk_get is device managed and makes error handling and exit code
> simpler.
> 
> Signed-off-by: Sachin Kamat 
> ---
>  drivers/gpu/drm/exynos/exynos_mixer.c |   59
+
> 
>  1 files changed, 16 insertions(+), 43 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c
> b/drivers/gpu/drm/exynos/exynos_mixer.c
> index 0d3ed28..5712b0e 100644
> --- a/drivers/gpu/drm/exynos/exynos_mixer.c
> +++ b/drivers/gpu/drm/exynos/exynos_mixer.c
> @@ -962,57 +962,45 @@ static int __devinit mixer_resources_init(struct
> exynos_drm_hdmi_context *ctx,
> 
>   spin_lock_init(&mixer_res->reg_slock);
> 
> - mixer_res->mixer = clk_get(dev, "mixer");
> + mixer_res->mixer = devm_clk_get(dev, "mixer");
>   if (IS_ERR_OR_NULL(mixer_res->mixer)) {
>   dev_err(dev, "failed to get clock 'mixer'\n");
> - ret = -ENODEV;
> - goto fail;
> + return -ENODEV;
>   }
> 
> - mixer_res->sclk_hdmi = clk_get(dev, "sclk_hdmi");
> + mixer_res->sclk_hdmi = devm_clk_get(dev, "sclk_hdmi");
>   if (IS_ERR_OR_NULL(mixer_res->sclk_hdmi)) {
>   dev_err(dev, "failed to get clock 'sclk_hdmi'\n");
> - ret = -ENODEV;
> - goto fail;
> + return -ENODEV;
>   }
>   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>   if (res == NULL) {
>   dev_err(dev, "get memory resource failed.\n");
> - ret = -ENXIO;
> - goto fail;
> + return -ENXIO;
>   }
> 
>   mixer_res->mixer_regs = devm_ioremap(&pdev->dev, res->start,
>   resource_size(res));
>   if (mixer_res->mixer_regs == NULL) {
>   dev_err(dev, "register mapping failed.\n");
> - ret = -ENXIO;
> - goto fail;
> + return -ENXIO;
>   }
> 
>   res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
>   if (res == NULL) {
>   dev_err(dev, "get interrupt resource failed.\n");
> - ret = -ENXIO;
> - goto fail;
> + return -ENXIO;
>   }
> 
>   ret = devm_request_irq(&pdev->dev, res->start, mixer_irq_handler,
>   0, "drm_mixer",
ctx);
>   if (ret) {
>   dev_err(dev, "request interrupt failed.\n");
> - goto fail;
> + return ret;
>   }
>   mixer_res->irq = res->start;
> 
>   return 0;
> -
> -fail:
> - if (!IS_ERR_OR_NULL(mixer_res->sclk_hdmi))
> - clk_put(mixer_res->sclk_hdmi);
> - if (!IS_ERR_OR_NULL(mixer_res->mixer))
> - clk_put(mixer_res->mixer);
> - return ret;
>  }
> 
>  static int __devinit vp_resources_init(struct exynos_drm_hdmi_context
> *ctx,
> @@ -1022,25 +1010,21 @@ static int __devinit vp_resources_init(struct
> exynos_drm_hdmi_context *ctx,
>   struct device *dev = &pdev->dev;
>   struct mixer_resources *mixer_res = &mixer_ctx->mixer_res;
>   struct resource *res;
> - int ret;
> 
> - mixer_res->vp = clk_get(dev, "vp");
> + mixer_res->vp = devm_clk_get(dev, "vp");
>   if (IS_ERR_OR_NULL(mixer_res->vp)) {
>   dev_err(dev, "failed to get clock 'vp'\n");
> - ret = -ENODEV;
> - goto fail;
> + return -ENODEV;
>   }
> - mixer_res->sclk_mixer = clk_get(dev, "sclk_mixer");
> + mixer_res->sclk_mixer = devm_clk_get(dev, "sclk_mixer");
>   if (IS_ERR_OR_NULL(mixer_res->sclk_mixer)) {
>   dev_err(dev, "failed to get clock 'sclk_mixer'\n");
> - ret = -ENODEV;
> - goto fail;
> + return -ENODEV;
>   }
> - mixer_res->sclk_dac = clk_get(dev, "sclk_dac");
> + mixer_res->sclk_dac = devm_clk_get(dev, "sclk_dac");
>   if (IS_ERR_OR_NULL(mixer_res->sclk_dac)) {
>   dev_err(dev, "failed to get clock 'sclk_dac'\n");
> - ret = -ENODEV;
> - goto fail;
> + return -ENODEV;
>   }
> 
>   if (mixer_res->sclk_hdmi)
> @@ -1049,28 +1033,17 @@ static int __devinit vp_resources_init(struct
> exynos_drm_hdmi_context *ctx,
>   res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
>   if (res == NULL) {
>   dev_err(dev, "get memory resource failed.\n");
> - ret = -ENXIO;
> - goto fail;
> + return -ENXIO;
>   }
> 
>   mixer_res->vp_regs = devm_ioremap(&pdev->dev, res->start,
>   resource_size(res));
>   if (mixer_res->vp_regs == NULL) {

[Bug 16140] [RADEON:KMS:RV250:RESUME] suspend to RAM resume broken

2012-11-23 Thread bugzilla-dae...@bugzilla.kernel.org
https://bugzilla.kernel.org/show_bug.cgi?id=16140





--- Comment #49 from Sedat Dilek   2012-11-23 
18:33:14 ---
Just FYI: There is now an upstream fix (see [1]).

commit 45171002b01b2e2ec4f991eca81ffd8430fd0aec
"radeon: add AGPMode 1 quirk for RV250"

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=commit;h=45171002b01b2e2ec4f991eca81ffd8430fd0aec

- Sedat -

-- 
Configure bugmail: https://bugzilla.kernel.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are watching the assignee of the bug.


[PATCH] drm: exynos: hdmi: sending AVI and AUI info frames

2012-11-23 Thread 김승우
On 2012? 11? 23? 18:17, Rahul Sharma wrote:
> This patch adds code for composing AVI and AUI info frames
> and send them every VSYNC.
> 
> This patch is important for hdmi certification.
> 
> Signed-off-by: Rahul Sharma 
> Signed-off-by: Fahad Kunnathadi 
> Signed-off-by: Shirish S 

Acked-by : Seung-Woo Kim 

> 
> Based on exynos-drm-next branch of
> http://git.kernel.org/?p=linux/kernel/git/daeinki/drm-exynos.git
> ---
>  drivers/gpu/drm/exynos/exynos_hdmi.c |  139 
> +-
>  drivers/gpu/drm/exynos/exynos_hdmi.h |   23 ++
>  drivers/gpu/drm/exynos/regs-hdmi.h   |   17 -
>  3 files changed, 158 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c 
> b/drivers/gpu/drm/exynos/exynos_hdmi.c
> index 59839cc..49332bd 100644
> --- a/drivers/gpu/drm/exynos/exynos_hdmi.c
> +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
> @@ -183,6 +183,7 @@ struct hdmi_v13_conf {
>   int height;
>   int vrefresh;
>   bool interlace;
> + int cea_video_id;
>   const u8 *hdmiphy_data;
>   const struct hdmi_v13_preset_conf *conf;
>  };
> @@ -354,15 +355,20 @@ static const struct hdmi_v13_preset_conf 
> hdmi_v13_conf_1080p60 = {
>  };
>  
>  static const struct hdmi_v13_conf hdmi_v13_confs[] = {
> - { 1280, 720, 60, false, hdmiphy_v13_conf74_25, &hdmi_v13_conf_720p60 },
> - { 1280, 720, 50, false, hdmiphy_v13_conf74_25, &hdmi_v13_conf_720p60 },
> - { 720, 480, 60, false, hdmiphy_v13_conf27_027, &hdmi_v13_conf_480p },
> - { 1920, 1080, 50, true, hdmiphy_v13_conf74_25, &hdmi_v13_conf_1080i50 },
> - { 1920, 1080, 50, false, hdmiphy_v13_conf148_5,
> -  &hdmi_v13_conf_1080p50 },
> - { 1920, 1080, 60, true, hdmiphy_v13_conf74_25, &hdmi_v13_conf_1080i60 },
> - { 1920, 1080, 60, false, hdmiphy_v13_conf148_5,
> -  &hdmi_v13_conf_1080p60 },
> + { 1280, 720, 60, false, 4, hdmiphy_v13_conf74_25,
> + &hdmi_v13_conf_720p60 },
> + { 1280, 720, 50, false, 19, hdmiphy_v13_conf74_25,
> + &hdmi_v13_conf_720p60 },
> + { 720, 480, 60, false, 3, hdmiphy_v13_conf27_027,
> + &hdmi_v13_conf_480p },
> + { 1920, 1080, 50, true, 20, hdmiphy_v13_conf74_25,
> + &hdmi_v13_conf_1080i50 },
> + { 1920, 1080, 50, false, 31, hdmiphy_v13_conf148_5,
> + &hdmi_v13_conf_1080p50 },
> + { 1920, 1080, 60, true, 5, hdmiphy_v13_conf74_25,
> + &hdmi_v13_conf_1080i60 },
> + { 1920, 1080, 60, false, 16, hdmiphy_v13_conf148_5,
> + &hdmi_v13_conf_1080p60 },
>  };
>  
>  /* HDMI Version 1.4 */
> @@ -480,6 +486,7 @@ struct hdmi_conf {
>   int height;
>   int vrefresh;
>   bool interlace;
> + int cea_video_id;
>   const u8 *hdmiphy_data;
>   const struct hdmi_preset_conf *conf;
>  };
> @@ -935,16 +942,21 @@ static const struct hdmi_preset_conf hdmi_conf_1080p60 
> = {
>  };
>  
>  static const struct hdmi_conf hdmi_confs[] = {
> - { 720, 480, 60, false, hdmiphy_conf27_027, &hdmi_conf_480p60 },
> - { 1280, 720, 50, false, hdmiphy_conf74_25, &hdmi_conf_720p50 },
> - { 1280, 720, 60, false, hdmiphy_conf74_25, &hdmi_conf_720p60 },
> - { 1920, 1080, 50, true, hdmiphy_conf74_25, &hdmi_conf_1080i50 },
> - { 1920, 1080, 60, true, hdmiphy_conf74_25, &hdmi_conf_1080i60 },
> - { 1920, 1080, 30, false, hdmiphy_conf74_176, &hdmi_conf_1080p30 },
> - { 1920, 1080, 50, false, hdmiphy_conf148_5, &hdmi_conf_1080p50 },
> - { 1920, 1080, 60, false, hdmiphy_conf148_5, &hdmi_conf_1080p60 },
> + { 720, 480, 60, false, 3, hdmiphy_conf27_027, &hdmi_conf_480p60 },
> + { 1280, 720, 50, false, 19, hdmiphy_conf74_25, &hdmi_conf_720p50 },
> + { 1280, 720, 60, false, 4, hdmiphy_conf74_25, &hdmi_conf_720p60 },
> + { 1920, 1080, 50, true, 20, hdmiphy_conf74_25, &hdmi_conf_1080i50 },
> + { 1920, 1080, 60, true, 5, hdmiphy_conf74_25, &hdmi_conf_1080i60 },
> + { 1920, 1080, 30, false, 34, hdmiphy_conf74_176, &hdmi_conf_1080p30 },
> + { 1920, 1080, 50, false, 31, hdmiphy_conf148_5, &hdmi_conf_1080p50 },
> + { 1920, 1080, 60, false, 16, hdmiphy_conf148_5, &hdmi_conf_1080p60 },
>  };
>  
> +struct hdmi_infoframe {
> + enum HDMI_PACKET_TYPE type;
> + u8 ver;
> + u8 len;
> +};
>  
>  static inline u32 hdmi_reg_read(struct hdmi_context *hdata, u32 reg_id)
>  {
> @@ -1268,6 +1280,85 @@ static int hdmi_conf_index(struct hdmi_context *hdata,
>   return hdmi_v14_conf_index(mode);
>  }
>  
> +static u8 hdmi_chksum(struct hdmi_context *hdata,
> + u32 start, u8 len, u32 hdr_sum)
> +{
> + int i;
> + /* hdr_sum : header0 + header1 + header2
> + * start : start address of packet byte1
> + * len : packet bytes - 1 */
> + for (i = 0; i < len; ++i)
> + hdr_sum += 0xff & hdmi_reg_read(hdata, start + i * 4);
> +
> + return (u8)(0x100 - (hdr_sum & 0x

[pull] drm-fixes

2012-11-23 Thread Daniel Vetter
Hi Dave,

Two small fixes for 3.7:
- Unbreak mbp retina, this time with a much more fine-grained approach
  (since the previous "completely ignore edp vbt bpp value" regressed some
  machines even after fixing a bug in our dp bw code).
- Disable cloning on sdvo. It just doesn't work (yeah took us a while to
  figure out), leading to jittery outputs in the best case.

Cheers, Daniel


The following changes since commit f4a75d2eb7b1e2206094b901be09adb31ba63681:

  Linux 3.7-rc6 (2012-11-16 17:42:40 -0800)

are available in the git repository at:

  git://people.freedesktop.org/~danvet/drm-intel drm-intel-fixes

for you to fetch changes up to 9a30a61f3516871c5c638fd7c025fbaa11ddf7fe:

  drm/i915: do not default to 18 bpp for eDP if missing from VBT (2012-11-22 
21:34:32 +0100)


Daniel Vetter (1):
  drm/i915: disable cloning on sdvo

Jani Nikula (1):
  drm/i915: do not default to 18 bpp for eDP if missing from VBT

 drivers/gpu/drm/i915/intel_bios.c|   11 ++-
 drivers/gpu/drm/i915/intel_display.c |2 +-
 drivers/gpu/drm/i915/intel_sdvo.c|   17 ++---
 3 files changed, 13 insertions(+), 17 deletions(-)
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch


[PATCH] drm: kms_helper: don't lose hotplug event

2012-11-23 Thread Daniel Vetter
Hi Dave,

Will hunting down a patch in my machine farm I've stumbled over this
one here. It fixes a detection race I've noticed while testing the new
hpd stuff a while back. Chris already smashed his r-b onto it.

Can you please include this in drm-next for 3.8?

Thanks, Daniel

On Wed, Oct 24, 2012 at 9:16 PM, Daniel Vetter  
wrote:
> There's a race window (small for hpd, 10s large for polled outputs)
> where userspace could sneak in with an unrelated connnector probe
> ioctl call and eat the hotplug event (since neither the hpd nor the
> poll code see a state change).
>
> To avoid this, check whether the connector state changes in all other
> ->detect calls (in the current helper code that's only probe_single)
> and if that's the case, fire off a hotplug event. Note that we can't
> directly call the hotplug event handler, since that expects that no
> locks are held (due to reentrancy with the fb code to update the kms
> console).
>
> Also, this requires that drivers using the probe_single helper
> function set up the poll work. All current drivers do that already,
> and with the reworked hpd handling there'll be no downside to
> unconditionally setting up the poll work any more.
>
> Signed-off-by: Daniel Vetter 
> ---
>  drivers/gpu/drm/drm_crtc_helper.c | 33 -
>  include/drm/drm_crtc.h|  1 +
>  2 files changed, 33 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/drm_crtc_helper.c 
> b/drivers/gpu/drm/drm_crtc_helper.c
> index 9d186d0..b79d7cb 100644
> --- a/drivers/gpu/drm/drm_crtc_helper.c
> +++ b/drivers/gpu/drm/drm_crtc_helper.c
> @@ -62,6 +62,7 @@ static void drm_mode_validate_flag(struct drm_connector 
> *connector,
> return;
>  }
>
> +
>  /**
>   * drm_helper_probe_single_connector_modes - get complete set of display 
> modes
>   * @dev: DRM device
> @@ -93,6 +94,7 @@ int drm_helper_probe_single_connector_modes(struct 
> drm_connector *connector,
> connector->helper_private;
> int count = 0;
> int mode_flags = 0;
> +   enum drm_connector_status old_status;
>
> DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n", connector->base.id,
> drm_get_connector_name(connector));
> @@ -108,7 +110,32 @@ int drm_helper_probe_single_connector_modes(struct 
> drm_connector *connector,
> if (connector->funcs->force)
> connector->funcs->force(connector);
> } else {
> +   old_status = connector->status;
> +
> connector->status = connector->funcs->detect(connector, true);
> +
> +   /*
> +* Normally either the driver's hpd code or the poll loop 
> should
> +* pick up any changes and fire the hotplug event. But if
> +* userspace sneaks in a probe, we might miss a change. Hence
> +* check here, and if anything changed start the hotplug code.
> +*/
> +   if (old_status != connector->status) {
> +   DRM_DEBUG_KMS("[CONNECTOR:%d:%s] status updated from 
> %d to %d\n",
> + connector->base.id,
> + drm_get_connector_name(connector),
> + old_status, connector->status);
> +
> +   /*
> +* The hotplug event code might call into the fb
> +* helpers, and so expects that we do not hold any
> +* locks. Fire up the poll struct instead, it will
> +* disable itself again.
> +*/
> +   dev->mode_config.delayed_event = true;
> +   
> schedule_delayed_work(&dev->mode_config.output_poll_work,
> + 0);
> +   }
> }
>
> /* Re-enable polling in case the global poll config changed. */
> @@ -939,7 +966,11 @@ static void output_poll_execute(struct work_struct *work)
> struct drm_device *dev = container_of(delayed_work, struct 
> drm_device, mode_config.output_poll_work);
> struct drm_connector *connector;
> enum drm_connector_status old_status;
> -   bool repoll = false, changed = false;
> +   bool repoll = false, changed;
> +
> +   /* Pick up any changes detected by the probe functions. */
> +   changed = dev->mode_config.delayed_event;
> +   dev->mode_config.delayed_event = false;
>
> if (!drm_kms_helper_poll)
> return;
> diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
> index 89f8f7f..ec207a2 100644
> --- a/include/drm/drm_crtc.h
> +++ b/include/drm/drm_crtc.h
> @@ -793,6 +793,7 @@ struct drm_mode_config {
> /* output poll support */
> bool poll_enabled;
> bool poll_running;
> +   bool delayed_event;
> struct delayed_work output_poll_work;
>
> /* pointers to 

[PATCH v2] drm: exynos: hdmi: sending AVI and AUI info frames

2012-11-23 Thread Rahul Sharma
This patch adds code for composing AVI and AUI info frames
and send them every VSYNC.

This patch is important for hdmi certification.

v1:
- Remove un-necessary blank lines.
- Change the case of hex constants.

v2:
- Added few blank lines.
- Corrected comments format.
- Added comments for 2's Complement calculation for check sum.

Signed-off-by: Rahul Sharma 
Signed-off-by: Fahad Kunnathadi 
Signed-off-by: Shirish S 

---
Based on exynos-drm-next branch of
http://git.kernel.org/?p=linux/kernel/git/daeinki/drm-exynos.git

 drivers/gpu/drm/exynos/exynos_hdmi.c |  142 +-
 drivers/gpu/drm/exynos/exynos_hdmi.h |   23 ++
 drivers/gpu/drm/exynos/regs-hdmi.h   |   17 -
 3 files changed, 161 insertions(+), 21 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c 
b/drivers/gpu/drm/exynos/exynos_hdmi.c
index 59839cc..af956c7 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -183,6 +183,7 @@ struct hdmi_v13_conf {
int height;
int vrefresh;
bool interlace;
+   int cea_video_id;
const u8 *hdmiphy_data;
const struct hdmi_v13_preset_conf *conf;
 };
@@ -354,15 +355,20 @@ static const struct hdmi_v13_preset_conf 
hdmi_v13_conf_1080p60 = {
 };

 static const struct hdmi_v13_conf hdmi_v13_confs[] = {
-   { 1280, 720, 60, false, hdmiphy_v13_conf74_25, &hdmi_v13_conf_720p60 },
-   { 1280, 720, 50, false, hdmiphy_v13_conf74_25, &hdmi_v13_conf_720p60 },
-   { 720, 480, 60, false, hdmiphy_v13_conf27_027, &hdmi_v13_conf_480p },
-   { 1920, 1080, 50, true, hdmiphy_v13_conf74_25, &hdmi_v13_conf_1080i50 },
-   { 1920, 1080, 50, false, hdmiphy_v13_conf148_5,
-&hdmi_v13_conf_1080p50 },
-   { 1920, 1080, 60, true, hdmiphy_v13_conf74_25, &hdmi_v13_conf_1080i60 },
-   { 1920, 1080, 60, false, hdmiphy_v13_conf148_5,
-&hdmi_v13_conf_1080p60 },
+   { 1280, 720, 60, false, 4, hdmiphy_v13_conf74_25,
+   &hdmi_v13_conf_720p60 },
+   { 1280, 720, 50, false, 19, hdmiphy_v13_conf74_25,
+   &hdmi_v13_conf_720p60 },
+   { 720, 480, 60, false, 3, hdmiphy_v13_conf27_027,
+   &hdmi_v13_conf_480p },
+   { 1920, 1080, 50, true, 20, hdmiphy_v13_conf74_25,
+   &hdmi_v13_conf_1080i50 },
+   { 1920, 1080, 50, false, 31, hdmiphy_v13_conf148_5,
+   &hdmi_v13_conf_1080p50 },
+   { 1920, 1080, 60, true, 5, hdmiphy_v13_conf74_25,
+   &hdmi_v13_conf_1080i60 },
+   { 1920, 1080, 60, false, 16, hdmiphy_v13_conf148_5,
+   &hdmi_v13_conf_1080p60 },
 };

 /* HDMI Version 1.4 */
@@ -480,6 +486,7 @@ struct hdmi_conf {
int height;
int vrefresh;
bool interlace;
+   int cea_video_id;
const u8 *hdmiphy_data;
const struct hdmi_preset_conf *conf;
 };
@@ -935,16 +942,21 @@ static const struct hdmi_preset_conf hdmi_conf_1080p60 = {
 };

 static const struct hdmi_conf hdmi_confs[] = {
-   { 720, 480, 60, false, hdmiphy_conf27_027, &hdmi_conf_480p60 },
-   { 1280, 720, 50, false, hdmiphy_conf74_25, &hdmi_conf_720p50 },
-   { 1280, 720, 60, false, hdmiphy_conf74_25, &hdmi_conf_720p60 },
-   { 1920, 1080, 50, true, hdmiphy_conf74_25, &hdmi_conf_1080i50 },
-   { 1920, 1080, 60, true, hdmiphy_conf74_25, &hdmi_conf_1080i60 },
-   { 1920, 1080, 30, false, hdmiphy_conf74_176, &hdmi_conf_1080p30 },
-   { 1920, 1080, 50, false, hdmiphy_conf148_5, &hdmi_conf_1080p50 },
-   { 1920, 1080, 60, false, hdmiphy_conf148_5, &hdmi_conf_1080p60 },
+   { 720, 480, 60, false, 3, hdmiphy_conf27_027, &hdmi_conf_480p60 },
+   { 1280, 720, 50, false, 19, hdmiphy_conf74_25, &hdmi_conf_720p50 },
+   { 1280, 720, 60, false, 4, hdmiphy_conf74_25, &hdmi_conf_720p60 },
+   { 1920, 1080, 50, true, 20, hdmiphy_conf74_25, &hdmi_conf_1080i50 },
+   { 1920, 1080, 60, true, 5, hdmiphy_conf74_25, &hdmi_conf_1080i60 },
+   { 1920, 1080, 30, false, 34, hdmiphy_conf74_176, &hdmi_conf_1080p30 },
+   { 1920, 1080, 50, false, 31, hdmiphy_conf148_5, &hdmi_conf_1080p50 },
+   { 1920, 1080, 60, false, 16, hdmiphy_conf148_5, &hdmi_conf_1080p60 },
 };

+struct hdmi_infoframe {
+   enum HDMI_PACKET_TYPE type;
+   u8 ver;
+   u8 len;
+};

 static inline u32 hdmi_reg_read(struct hdmi_context *hdata, u32 reg_id)
 {
@@ -1268,6 +1280,88 @@ static int hdmi_conf_index(struct hdmi_context *hdata,
return hdmi_v14_conf_index(mode);
 }

+static u8 hdmi_chksum(struct hdmi_context *hdata,
+   u32 start, u8 len, u32 hdr_sum)
+{
+   int i;
+
+   /* hdr_sum : header0 + header1 + header2
+   * start : start address of packet byte1
+   * len : packet bytes - 1 */
+   for (i = 0; i < len; ++i)
+   hdr_sum += 0xff & hdmi_reg_read(hdata, start + i * 4);
+
+   /* return 2's comp

[RFC v2 0/5] Common Display Framework

2012-11-23 Thread Tomi Valkeinen
Hi,

On 2012-11-22 23:45, Laurent Pinchart wrote:
> From: Laurent Pinchart 
> 
> Hi everybody,
> 
> Here's the second RFC of what was previously known as the Generic Panel
> Framework.

Nice work! Thanks for working on this.

I was doing some testing with the code, seeing how to use it in omapdss.
Here are some thoughts:

In your model the DSS gets the panel devices connected to it from
platform data. After the DSS and the panel drivers are loaded, DSS gets
a notification and connects DSS and the panel.

I think it's a bit limited way. First of all, it'll make the DT data a
bit more complex (although this is not a major problem). With your
model, you'll need something like:

soc-base.dtsi:

dss {
dpi0: dpi {
};
};

board.dts:

&dpi0 {
panel = &dpi-panel;
};

/ {
dpi-panel: dpi-panel {
...panel data...;
};
};

Second, it'll prevent hotplug, and even if real hotplug would not be
supported, it'll prevent cases where the connected panel must be found
dynamically (like reading ID from eeprom).

Third, it kinda creates a cyclical dependency: the DSS needs to know
about the panel and calls ops in the panel, and the panel calls ops in
the DSS. I'm not sure if this is an actual problem, but I usually find
it simpler if calls are done only in one direction.


What I suggest is take a simpler approach, something alike to how
regulators or gpios are used, even if slightly more complex than those:
the entity that has a video output (SoC's DSS, external chips) offers
that video output as resource. It doesn't know or care who uses it. The
user of the video output (panel, external chips) will find the video
output (to which it is connected in the HW) by some means, and will use
different operations on that output to operate the device.

This would give us something like the following DT data:

soc-base.dtsi:

dss {
dpi0: dpi {
};
};

board.dts:

/ {
dpi-panel: dpi-panel {
source = <&dpi0>;
...panel data...;
};
};

The panel driver would do something like this in its probe:

int dpi_panel_probe()
{
// Find the video source, increase ref
src = get_video_source_from_of("source");

// Reserve the video source for us. others can still get and
// observe it, but cannot use it as video data source.
// I think this should cascade upstream, so that after this call
// each video entity from the panel to the SoC's CRTC is
// reserved and locked for this video pipeline.
reserve_video_source(src);

// set DPI HW configuration, like DPI data lines. The
// configuration would come from panel's platform data
set_dpi_config(src, config);

// register this panel as a display.
register_display(this);
}


The DSS's dpi driver would do something like:

int dss_dpi_probe()
{
// register as a DPI video source
register_video_source(this);
}

A DSI-2-DPI chip would do something like:

int dsi2dpi_probe()
{
// get, reserve and config the DSI bus from SoC
src = get_video_source_from_of("source");
reserve_video_source(src);
set_dsi_config(src, config);

// register as a DPI video source
register_video_source(this);
}


Here we wouldn't have similar display_entity as you have, but video
sources and displays. Video sources are elements in the video pipeline,
and a video source is used only by the next downstream element. The last
element in the pipeline would not be a video source, but a display,
which would be used by the upper layer.

Video source's ops would deal with things related to the video bus in
question, like configuring data lanes, sending DSI packets, etc. The
display ops would be more high level things, like enable, update, etc.
Actually, I guess you could consider the display to represent and deal
with the whole pipeline, while video source deals with the bus between
two display entities.

 Tomi


-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 899 bytes
Desc: OpenPGP digital signature
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20121123/fd2895cc/attachment.pgp>


[PATCH] drm: exynos: hdmi: sending AVI and AUI info frames

2012-11-23 Thread Rahul Sharma
Hi Mr. Dae,

On Fri, Nov 23, 2012 at 3:38 PM, Inki Dae  wrote:
> Sorry but could you re-send this one more time? below is my comment.
>
> Thanks,
> Inki Dae
>
>> -Original Message-
>> From: Rahul Sharma [mailto:rahul.sharma at samsung.com]
>> Sent: Friday, November 23, 2012 6:17 PM
>> To: dri-devel at lists.freedesktop.org
>> Cc: airlied at redhat.com; inki.dae at samsung.com; kgene.kim at samsung.com;
>> r.sh.open at gmail.com; marcheu at chromium.org; sw0312.kim at samsung.com;
>> kyungmin.park at samsung.com
>> Subject: [PATCH] drm: exynos: hdmi: sending AVI and AUI info frames
>>
>> This patch adds code for composing AVI and AUI info frames
>> and send them every VSYNC.
>>
>> This patch is important for hdmi certification.
>>
>> Signed-off-by: Rahul Sharma 
>> Signed-off-by: Fahad Kunnathadi 
>> Signed-off-by: Shirish S 
>>
>> Based on exynos-drm-next branch of
>> http://git.kernel.org/?p=linux/kernel/git/daeinki/drm-exynos.git
>> ---
>>  drivers/gpu/drm/exynos/exynos_hdmi.c |  139
>> +-
>>  drivers/gpu/drm/exynos/exynos_hdmi.h |   23 ++
>>  drivers/gpu/drm/exynos/regs-hdmi.h   |   17 -
>>  3 files changed, 158 insertions(+), 21 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c
>> b/drivers/gpu/drm/exynos/exynos_hdmi.c
>> index 59839cc..49332bd 100644
>> --- a/drivers/gpu/drm/exynos/exynos_hdmi.c
>> +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
>> @@ -183,6 +183,7 @@ struct hdmi_v13_conf {
>>   int height;
>>   int vrefresh;
>>   bool interlace;
>> + int cea_video_id;
>>   const u8 *hdmiphy_data;
>>   const struct hdmi_v13_preset_conf *conf;
>>  };
>> @@ -354,15 +355,20 @@ static const struct hdmi_v13_preset_conf
>> hdmi_v13_conf_1080p60 = {
>>  };
>>
>>  static const struct hdmi_v13_conf hdmi_v13_confs[] = {
>> - { 1280, 720, 60, false, hdmiphy_v13_conf74_25,
>> &hdmi_v13_conf_720p60 },
>> - { 1280, 720, 50, false, hdmiphy_v13_conf74_25,
>> &hdmi_v13_conf_720p60 },
>> - { 720, 480, 60, false, hdmiphy_v13_conf27_027,
>> &hdmi_v13_conf_480p },
>> - { 1920, 1080, 50, true, hdmiphy_v13_conf74_25,
>> &hdmi_v13_conf_1080i50 },
>> - { 1920, 1080, 50, false, hdmiphy_v13_conf148_5,
>> -  &hdmi_v13_conf_1080p50 },
>> - { 1920, 1080, 60, true, hdmiphy_v13_conf74_25,
>> &hdmi_v13_conf_1080i60 },
>> - { 1920, 1080, 60, false, hdmiphy_v13_conf148_5,
>> -  &hdmi_v13_conf_1080p60 },
>> + { 1280, 720, 60, false, 4, hdmiphy_v13_conf74_25,
>> + &hdmi_v13_conf_720p60 },
>> + { 1280, 720, 50, false, 19, hdmiphy_v13_conf74_25,
>> + &hdmi_v13_conf_720p60 },
>> + { 720, 480, 60, false, 3, hdmiphy_v13_conf27_027,
>> + &hdmi_v13_conf_480p },
>> + { 1920, 1080, 50, true, 20, hdmiphy_v13_conf74_25,
>> + &hdmi_v13_conf_1080i50 },
>> + { 1920, 1080, 50, false, 31, hdmiphy_v13_conf148_5,
>> + &hdmi_v13_conf_1080p50 },
>> + { 1920, 1080, 60, true, 5, hdmiphy_v13_conf74_25,
>> + &hdmi_v13_conf_1080i60 },
>> + { 1920, 1080, 60, false, 16, hdmiphy_v13_conf148_5,
>> + &hdmi_v13_conf_1080p60 },
>>  };
>>
>>  /* HDMI Version 1.4 */
>> @@ -480,6 +486,7 @@ struct hdmi_conf {
>>   int height;
>>   int vrefresh;
>>   bool interlace;
>> + int cea_video_id;
>>   const u8 *hdmiphy_data;
>>   const struct hdmi_preset_conf *conf;
>>  };
>> @@ -935,16 +942,21 @@ static const struct hdmi_preset_conf
>> hdmi_conf_1080p60 = {
>>  };
>>
>>  static const struct hdmi_conf hdmi_confs[] = {
>> - { 720, 480, 60, false, hdmiphy_conf27_027, &hdmi_conf_480p60 },
>> - { 1280, 720, 50, false, hdmiphy_conf74_25, &hdmi_conf_720p50 },
>> - { 1280, 720, 60, false, hdmiphy_conf74_25, &hdmi_conf_720p60 },
>> - { 1920, 1080, 50, true, hdmiphy_conf74_25, &hdmi_conf_1080i50 },
>> - { 1920, 1080, 60, true, hdmiphy_conf74_25, &hdmi_conf_1080i60 },
>> - { 1920, 1080, 30, false, hdmiphy_conf74_176, &hdmi_conf_1080p30 },
>> - { 1920, 1080, 50, false, hdmiphy_conf148_5, &hdmi_conf_1080p50 },
>> - { 1920, 1080, 60, false, hdmiphy_conf148_5, &hdmi_conf_1080p60 },
>> + { 720, 480, 60, false, 3, hdmiphy_conf27_027, &hdmi_conf_480p60 },
>> + { 1280, 720, 50, false, 19, hdmiphy_conf74_25, &hdmi_conf_720p50 },
>> + { 1280, 720, 60, false, 4, hdmiphy_conf74_25, &hdmi_conf_720p60 },
>> + { 1920, 1080, 50, true, 20, hdmiphy_conf74_25, &hdmi_conf_1080i50 },
>> + { 1920, 1080, 60, true, 5, hdmiphy_conf74_25, &hdmi_conf_1080i60 },
>> + { 1920, 1080, 30, false, 34, hdmiphy_conf74_176,
>> &hdmi_conf_1080p30 },
>> + { 1920, 1080, 50, false, 31, hdmiphy_conf148_5,
>> &hdmi_conf_1080p50 },
>> + { 1920, 1080, 60, false, 16, hdmiphy_conf148_5,
>> &hdmi_conf_1080p60 },
>>  };
>>
>> +struct hdmi_infoframe {
>> + enum HDMI_PACKET_TYPE type;
>> + u8 ver;
>> + u8 len;
>

[PATCH 5/5] drm/exynos: Fix potential NULL pointer dereference

2012-11-23 Thread Inki Dae
This was my missing point. Applied.

Thanks,
Inki Dae

> -Original Message-
> From: Sachin Kamat [mailto:sachin.kamat at linaro.org]
> Sent: Friday, November 23, 2012 12:42 PM
> To: dri-devel at lists.freedesktop.org
> Cc: inki.dae at samsung.com; jy0922.shim at samsung.com; airlied at linux.ie;
> sachin.kamat at linaro.org; patches at linaro.org
> Subject: [PATCH 5/5] drm/exynos: Fix potential NULL pointer dereference
> 
> Pointer was being dereferenced after freeing.
> 
> Fixes the following error:
> drivers/gpu/drm/exynos/exynos_drm_g2d.c:323 g2d_userptr_put_dma_addr()
> error:
> dereferencing freed memory 'g2d_userptr'
> 
> Signed-off-by: Sachin Kamat 
> ---
>  drivers/gpu/drm/exynos/exynos_drm_g2d.c |2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_g2d.c
> b/drivers/gpu/drm/exynos/exynos_drm_g2d.c
> index c1054cb..6ffa076 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_g2d.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_g2d.c
> @@ -319,8 +319,8 @@ out:
>   g2d_userptr->sgt = NULL;
> 
>   kfree(g2d_userptr->pages);
> - kfree(g2d_userptr);
>   g2d_userptr->pages = NULL;
> + kfree(g2d_userptr);
>   g2d_userptr = NULL;
>  }
> 
> --
> 1.7.4.1



[PATCH 4/5] drm/exynos: Use devm_clk_get in exynos_drm_g2d.c

2012-11-23 Thread Inki Dae
Applied.

Thanks,
Inki Dae

> -Original Message-
> From: Sachin Kamat [mailto:sachin.kamat at linaro.org]
> Sent: Friday, November 23, 2012 12:42 PM
> To: dri-devel at lists.freedesktop.org
> Cc: inki.dae at samsung.com; jy0922.shim at samsung.com; airlied at linux.ie;
> sachin.kamat at linaro.org; patches at linaro.org
> Subject: [PATCH 4/5] drm/exynos: Use devm_clk_get in exynos_drm_g2d.c
> 
> devm_clk_get is device managed and makes error handling and exit code
> simpler.
> 
> Signed-off-by: Sachin Kamat 
> ---
>  drivers/gpu/drm/exynos/exynos_drm_g2d.c |4 +---
>  1 files changed, 1 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_g2d.c
> b/drivers/gpu/drm/exynos/exynos_drm_g2d.c
> index a9002ad..c1054cb 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_g2d.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_g2d.c
> @@ -1125,7 +1125,7 @@ static int __devinit g2d_probe(struct
> platform_device *pdev)
>   mutex_init(&g2d->cmdlist_mutex);
>   mutex_init(&g2d->runqueue_mutex);
> 
> - g2d->gate_clk = clk_get(dev, "fimg2d");
> + g2d->gate_clk = devm_clk_get(dev, "fimg2d");
>   if (IS_ERR(g2d->gate_clk)) {
>   dev_err(dev, "failed to get gate clock\n");
>   ret = PTR_ERR(g2d->gate_clk);
> @@ -1181,7 +1181,6 @@ static int __devinit g2d_probe(struct
> platform_device *pdev)
> 
>  err_put_clk:
>   pm_runtime_disable(dev);
> - clk_put(g2d->gate_clk);
>  err_destroy_workqueue:
>   destroy_workqueue(g2d->g2d_workq);
>  err_destroy_slab:
> @@ -1202,7 +1201,6 @@ static int __devexit g2d_remove(struct
> platform_device *pdev)
>   }
> 
>   pm_runtime_disable(&pdev->dev);
> - clk_put(g2d->gate_clk);
> 
>   g2d_fini_cmdlist(g2d);
>   destroy_workqueue(g2d->g2d_workq);
> --
> 1.7.4.1



[PATCH 3/5] drm/exynos: Use devm_clk_get in exynos_mixer.c

2012-11-23 Thread Inki Dae


> -Original Message-
> From: Sachin Kamat [mailto:sachin.kamat at linaro.org]
> Sent: Friday, November 23, 2012 12:42 PM
> To: dri-devel at lists.freedesktop.org
> Cc: inki.dae at samsung.com; jy0922.shim at samsung.com; airlied at linux.ie;
> sachin.kamat at linaro.org; patches at linaro.org
> Subject: [PATCH 3/5] drm/exynos: Use devm_clk_get in exynos_mixer.c
> 
> devm_clk_get is device managed and makes error handling and exit code
> simpler.
> 
> Signed-off-by: Sachin Kamat 
> ---
>  drivers/gpu/drm/exynos/exynos_mixer.c |   20 +---
>  1 files changed, 5 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c
> b/drivers/gpu/drm/exynos/exynos_mixer.c
> index 0d3ed28..88fcb40 100644
> --- a/drivers/gpu/drm/exynos/exynos_mixer.c
> +++ b/drivers/gpu/drm/exynos/exynos_mixer.c
> @@ -962,14 +962,14 @@ static int __devinit mixer_resources_init(struct
> exynos_drm_hdmi_context *ctx,
> 
>   spin_lock_init(&mixer_res->reg_slock);
> 
> - mixer_res->mixer = clk_get(dev, "mixer");
> + mixer_res->mixer = devm_clk_get(dev, "mixer");
>   if (IS_ERR_OR_NULL(mixer_res->mixer)) {
>   dev_err(dev, "failed to get clock 'mixer'\n");
>   ret = -ENODEV;

Just return ret;

>   goto fail;
>   }
> 
> - mixer_res->sclk_hdmi = clk_get(dev, "sclk_hdmi");
> + mixer_res->sclk_hdmi = devm_clk_get(dev, "sclk_hdmi");
>   if (IS_ERR_OR_NULL(mixer_res->sclk_hdmi)) {
>   dev_err(dev, "failed to get clock 'sclk_hdmi'\n");
>   ret = -ENODEV;

Ditto.

> @@ -1008,10 +1008,6 @@ static int __devinit mixer_resources_init(struct
> exynos_drm_hdmi_context *ctx,
>   return 0;
> 
>  fail:
> - if (!IS_ERR_OR_NULL(mixer_res->sclk_hdmi))
> - clk_put(mixer_res->sclk_hdmi);
> - if (!IS_ERR_OR_NULL(mixer_res->mixer))
> - clk_put(mixer_res->mixer);
>   return ret;
>  }
> 
> @@ -1024,19 +1020,19 @@ static int __devinit vp_resources_init(struct
> exynos_drm_hdmi_context *ctx,
>   struct resource *res;
>   int ret;
> 
> - mixer_res->vp = clk_get(dev, "vp");
> + mixer_res->vp = devm_clk_get(dev, "vp");
>   if (IS_ERR_OR_NULL(mixer_res->vp)) {
>   dev_err(dev, "failed to get clock 'vp'\n");
>   ret = -ENODEV;
>   goto fail;

Just return ret;

>   }
> - mixer_res->sclk_mixer = clk_get(dev, "sclk_mixer");
> + mixer_res->sclk_mixer = devm_clk_get(dev, "sclk_mixer");
>   if (IS_ERR_OR_NULL(mixer_res->sclk_mixer)) {
>   dev_err(dev, "failed to get clock 'sclk_mixer'\n");
>   ret = -ENODEV;
>   goto fail;

Ditto.

>   }
> - mixer_res->sclk_dac = clk_get(dev, "sclk_dac");
> + mixer_res->sclk_dac = devm_clk_get(dev, "sclk_dac");
>   if (IS_ERR_OR_NULL(mixer_res->sclk_dac)) {
>   dev_err(dev, "failed to get clock 'sclk_dac'\n");
>   ret = -ENODEV;
> @@ -1064,12 +1060,6 @@ static int __devinit vp_resources_init(struct
> exynos_drm_hdmi_context *ctx,
>   return 0;
> 
>  fail:
> - if (!IS_ERR_OR_NULL(mixer_res->sclk_dac))
> - clk_put(mixer_res->sclk_dac);
> - if (!IS_ERR_OR_NULL(mixer_res->sclk_mixer))
> - clk_put(mixer_res->sclk_mixer);
> - if (!IS_ERR_OR_NULL(mixer_res->vp))
> - clk_put(mixer_res->vp);
>   return ret;

And remove this.

>  }
> 
> --
> 1.7.4.1



[PATCH 2/5] drm/exynos: Use devm_gpio_request in exynos_hdmi.c

2012-11-23 Thread Inki Dae


> -Original Message-
> From: Sachin Kamat [mailto:sachin.kamat at linaro.org]
> Sent: Friday, November 23, 2012 12:42 PM
> To: dri-devel at lists.freedesktop.org
> Cc: inki.dae at samsung.com; jy0922.shim at samsung.com; airlied at linux.ie;
> sachin.kamat at linaro.org; patches at linaro.org
> Subject: [PATCH 2/5] drm/exynos: Use devm_gpio_request in exynos_hdmi.c
> 
> devm_gpio_request is device managed and makes error handling and exit code
> simpler.
> 
> Signed-off-by: Sachin Kamat 
> ---
>  drivers/gpu/drm/exynos/exynos_hdmi.c |8 ++--
>  1 files changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c
> b/drivers/gpu/drm/exynos/exynos_hdmi.c
> index 59839cc..3fe2d61 100644
> --- a/drivers/gpu/drm/exynos/exynos_hdmi.c
> +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
> @@ -2428,7 +2428,7 @@ static int __devinit hdmi_probe(struct
> platform_device *pdev)
>   goto err_resource;
>   }
> 
> - ret = gpio_request(hdata->hpd_gpio, "HPD");
> + ret = devm_gpio_request(&pdev->dev, hdata->hpd_gpio, "HPD");
>   if (ret) {
>   DRM_ERROR("failed to request HPD gpio\n");
>   goto err_resource;
> @@ -2438,7 +2438,7 @@ static int __devinit hdmi_probe(struct
> platform_device *pdev)
>   if (i2c_add_driver(&ddc_driver)) {
>   DRM_ERROR("failed to register ddc i2c driver\n");
>   ret = -ENOENT;
> - goto err_gpio;
> + goto err_resource;
>   }
> 
>   hdata->ddc_port = hdmi_ddc;
> @@ -2501,8 +2501,6 @@ err_hdmiphy:
>   i2c_del_driver(&hdmiphy_driver);
>  err_ddc:
>   i2c_del_driver(&ddc_driver);
> -err_gpio:
> - gpio_free(hdata->hpd_gpio);
>  err_resource:
>   hdmi_resources_cleanup(hdata);

With cleanup to hdmi_resources_init, we can remove hdmi_resource_cleanup
function. So could you please re-send updated patches?

You've been submitting patches into too small pieces.
Because they are trivial enough and in the same context, please merge this
kind of patches as long as they are related with the same class or topics. I
think you can combine them. :)

Thanks,
Inki Dae

>  err_data:
> @@ -2522,8 +2520,6 @@ static int __devexit hdmi_remove(struct
> platform_device *pdev)
>   free_irq(hdata->internal_irq, hdata);
>   free_irq(hdata->external_irq, hdata);
> 
> - gpio_free(hdata->hpd_gpio);
> -
>   hdmi_resources_cleanup(hdata);
> 
>   /* hdmiphy i2c driver */
> --
> 1.7.4.1



[PATCHv14 3/7] video: add of helper for display timings/videomode

2012-11-23 Thread Leela Krishna Amudala
Hello Steffen,

On Fri, Nov 23, 2012 at 2:34 PM, Steffen Trumtrar
 wrote:
> This adds support for reading display timings from DT into a struct
> display_timings. The of_display_timing implementation supports multiple
> subnodes. All children are read into an array, that can be queried.
>
> If no native mode is specified, the first subnode will be used.
>
> For cases, where the graphics drivers knows, there can be only one
> mode description or where the driver only supports one mode, a helper
> function of_get_videomode is added, that gets a struct videomode from DT.
> (As this function is implemented in an expensive fashion, it should only
> be used in the aforementioned case).
>
> This also demonstrates how of_display_timings may be utilized.
>
> Signed-off-by: Steffen Trumtrar 
> Signed-off-by: Philipp Zabel 
> Acked-by: Stephen Warren 
> Reviewed-by: Thierry Reding 
> Acked-by: Thierry Reding 
> Tested-by: Thierry Reding 
> Tested-by: Philipp Zabel 
> Reviewed-by: Laurent Pinchart 
> Acked-by: Laurent Pinchart 
> ---
>  .../devicetree/bindings/video/display-timings.txt  |  107 ++
>  drivers/video/Kconfig  |   15 ++
>  drivers/video/Makefile |2 +
>  drivers/video/of_display_timing.c  |  223 
> 
>  drivers/video/of_videomode.c   |   48 +
>  include/linux/of_display_timings.h |   20 ++
>  include/linux/of_videomode.h   |   18 ++
>  7 files changed, 433 insertions(+)
>  create mode 100644 
> Documentation/devicetree/bindings/video/display-timings.txt
>  create mode 100644 drivers/video/of_display_timing.c
>  create mode 100644 drivers/video/of_videomode.c
>  create mode 100644 include/linux/of_display_timings.h
>  create mode 100644 include/linux/of_videomode.h
>

<<>>

> diff --git a/drivers/video/of_display_timing.c 
> b/drivers/video/of_display_timing.c
> new file mode 100644
> index 000..645f43d
> --- /dev/null
> +++ b/drivers/video/of_display_timing.c
> @@ -0,0 +1,223 @@
> +/*
> + * OF helpers for parsing display timings
> + *
> + * Copyright (c) 2012 Steffen Trumtrar , 
> Pengutronix
> + *
> + * based on of_videomode.c by Sascha Hauer 
> + *
> + * This file is released under the GPLv2
> + */
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +/**
> + * parse_property - parse timing_entry from device_node
> + * @np: device_node with the property
> + * @name: name of the property
> + * @result: will be set to the return value
> + *
> + * DESCRIPTION:
> + * Every display_timing can be specified with either just the typical value 
> or
> + * a range consisting of min/typ/max. This function helps handling this
> + **/
> +static int parse_property(const struct device_node *np, const char *name,
> + struct timing_entry *result)
> +{
> +   struct property *prop;
> +   int length, cells, ret;
> +
> +   prop = of_find_property(np, name, &length);
> +   if (!prop) {
> +   pr_err("%s: could not find property %s\n", __func__, name);
> +   return -EINVAL;
> +   }
> +
> +   cells = length / sizeof(u32);
> +   if (cells == 1) {
> +   ret = of_property_read_u32(np, name, &result->typ);
> +   result->min = result->typ;
> +   result->max = result->typ;
> +   } else if (cells == 3) {
> +   ret = of_property_read_u32_array(np, name, &result->min, 
> cells);
> +   } else {
> +   pr_err("%s: illegal timing specification in %s\n", __func__,
> +   name);
> +   return -EINVAL;
> +   }
> +
> +   return ret;
> +}
> +
> +/**
> + * of_get_display_timing - parse display_timing entry from device_node
> + * @np: device_node with the properties
> + **/
> +static struct display_timing *of_get_display_timing(const struct device_node
> +   *np)
> +{
> +   struct display_timing *dt;
> +   int ret = 0;
> +
> +   dt = kzalloc(sizeof(*dt), GFP_KERNEL);
> +   if (!dt) {
> +   pr_err("%s: could not allocate display_timing struct\n",
> +   __func__);
> +   return NULL;
> +   }
> +
> +   ret |= parse_property(np, "hback-porch", &dt->hback_porch);
> +   ret |= parse_property(np, "hfront-porch", &dt->hfront_porch);
> +   ret |= parse_property(np, "hactive", &dt->hactive);
> +   ret |= parse_property(np, "hsync-len", &dt->hsync_len);
> +   ret |= parse_property(np, "vback-porch", &dt->vback_porch);
> +   ret |= parse_property(np, "vfront-porch", &dt->vfront_porch);
> +   ret |= parse_property(np, "vactive", &dt->vactive);
> +   ret |= parse_property(np, "vsync-len", &dt->vsync_len);
> +   ret |= parse_property(np, "clock-frequency", &dt->pixelclock);
> +
> +   of_property_read_u32(np, "vsync-active", &dt->vsync_pol_active);
> +   of_property

[PATCH 1/5] drm/exynos: Use devm_clk_get in exynos_drm_fimd.c

2012-11-23 Thread Inki Dae


> -Original Message-
> From: Sachin Kamat [mailto:sachin.kamat at linaro.org]
> Sent: Friday, November 23, 2012 12:42 PM
> To: dri-devel at lists.freedesktop.org
> Cc: inki.dae at samsung.com; jy0922.shim at samsung.com; airlied at linux.ie;
> sachin.kamat at linaro.org; patches at linaro.org
> Subject: [PATCH 1/5] drm/exynos: Use devm_clk_get in exynos_drm_fimd.c
> 
> devm_clk_get is device managed and makes error handling and exit code
> simpler.
> 
> Signed-off-by: Sachin Kamat 
> ---
>  drivers/gpu/drm/exynos/exynos_drm_fimd.c |9 ++---
>  1 files changed, 2 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> index ad04edd..57851cc 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> @@ -846,14 +846,14 @@ static int __devinit fimd_probe(struct
> platform_device *pdev)
>   if (!ctx)
>   return -ENOMEM;
> 
> - ctx->bus_clk = clk_get(dev, "fimd");
> + ctx->bus_clk = devm_clk_get(dev, "fimd");
>   if (IS_ERR(ctx->bus_clk)) {
>   dev_err(dev, "failed to get bus clock\n");
>   ret = PTR_ERR(ctx->bus_clk);
>   goto err_clk_get;
>   }
> 
> - ctx->lcd_clk = clk_get(dev, "sclk_fimd");
> + ctx->lcd_clk = devm_clk_get(dev, "sclk_fimd");
>   if (IS_ERR(ctx->lcd_clk)) {
>   dev_err(dev, "failed to get lcd clock\n");
>   ret = PTR_ERR(ctx->lcd_clk);
> @@ -918,11 +918,9 @@ static int __devinit fimd_probe(struct
> platform_device *pdev)
> 
>  err_clk:
>   clk_disable(ctx->lcd_clk);
> - clk_put(ctx->lcd_clk);

clk_disable shouldn't be called here so let's cleanup this also to reduce
unnecessary cleanup commits.

> 
>  err_bus_clk:
>   clk_disable(ctx->bus_clk);
> - clk_put(ctx->bus_clk);
> 

Ditto.

Thanks,
Inki Dae

>  err_clk_get:
>   return ret;
> @@ -949,9 +947,6 @@ static int __devexit fimd_remove(struct
> platform_device *pdev)
>  out:
>   pm_runtime_disable(dev);
> 
> - clk_put(ctx->lcd_clk);
> - clk_put(ctx->bus_clk);
> -
>   return 0;
>  }
> 
> --
> 1.7.4.1



[PATCH 1/1] drm/exynos: remove unnecessary clk_disable calls in exynos_drm_fimd.c

2012-11-23 Thread Sachin Kamat
Also fixes an error related to returning 'ret' without initialising
with error code.

Signed-off-by: Sachin Kamat 
---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c |   22 +-
 1 files changed, 5 insertions(+), 17 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 57851cc..00bd266 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -849,15 +849,13 @@ static int __devinit fimd_probe(struct platform_device 
*pdev)
ctx->bus_clk = devm_clk_get(dev, "fimd");
if (IS_ERR(ctx->bus_clk)) {
dev_err(dev, "failed to get bus clock\n");
-   ret = PTR_ERR(ctx->bus_clk);
-   goto err_clk_get;
+   return PTR_ERR(ctx->bus_clk);
}

ctx->lcd_clk = devm_clk_get(dev, "sclk_fimd");
if (IS_ERR(ctx->lcd_clk)) {
dev_err(dev, "failed to get lcd clock\n");
-   ret = PTR_ERR(ctx->lcd_clk);
-   goto err_bus_clk;
+   return PTR_ERR(ctx->lcd_clk);
}

res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -865,14 +863,13 @@ static int __devinit fimd_probe(struct platform_device 
*pdev)
ctx->regs = devm_request_and_ioremap(&pdev->dev, res);
if (!ctx->regs) {
dev_err(dev, "failed to map registers\n");
-   ret = -ENXIO;
-   goto err_clk;
+   return -ENXIO;
}

res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
if (!res) {
dev_err(dev, "irq request failed.\n");
-   goto err_clk;
+   return -ENXIO;
}

ctx->irq = res->start;
@@ -881,7 +878,7 @@ static int __devinit fimd_probe(struct platform_device 
*pdev)
0, "drm_fimd", ctx);
if (ret) {
dev_err(dev, "irq request failed.\n");
-   goto err_clk;
+   return ret;
}

ctx->vidcon0 = pdata->vidcon0;
@@ -915,15 +912,6 @@ static int __devinit fimd_probe(struct platform_device 
*pdev)
exynos_drm_subdrv_register(subdrv);

return 0;
-
-err_clk:
-   clk_disable(ctx->lcd_clk);
-
-err_bus_clk:
-   clk_disable(ctx->bus_clk);
-
-err_clk_get:
-   return ret;
 }

 static int __devexit fimd_remove(struct platform_device *pdev)
-- 
1.7.4.1



[PATCH Resend] drm/exynos: Use devm_clk_get in exynos_drm_fimd.c

2012-11-23 Thread Sachin Kamat
On 23 November 2012 15:21, Inki Dae  wrote:
> The subject mentions just only 'use devm_clk_get in exynos_dev_fimd.c' but
> this patch removes unnecessary clk_disable calls also. Just separate this
> patch into two as you mentioned. For this, already applied old one. So could
> you send another one? Sorry for inconvenient. :)

He he.. no problem.. i will send another patch which just contains
removing clk_disable.

>
> Thanks,
> Inki Dae
>
>> -Original Message-
>> From: Sachin Kamat [mailto:sachin.kamat at linaro.org]
>> Sent: Friday, November 23, 2012 5:43 PM
>> To: dri-devel at lists.freedesktop.org
>> Cc: inki.dae at samsung.com; sachin.kamat at linaro.org; patches at 
>> linaro.org
>> Subject: [PATCH Resend] drm/exynos: Use devm_clk_get in exynos_drm_fimd.c
>>
>> devm_clk_get is device managed and makes error handling and exit code
>> simpler.
>>
>> Signed-off-by: Sachin Kamat 
>> ---
>>  drivers/gpu/drm/exynos/exynos_drm_fimd.c |   31
> ++
>> ---
>>  1 files changed, 7 insertions(+), 24 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
>> b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
>> index ad04edd..00bd266 100644
>> --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
>> +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
>> @@ -846,18 +846,16 @@ static int __devinit fimd_probe(struct
>> platform_device *pdev)
>>   if (!ctx)
>>   return -ENOMEM;
>>
>> - ctx->bus_clk = clk_get(dev, "fimd");
>> + ctx->bus_clk = devm_clk_get(dev, "fimd");
>>   if (IS_ERR(ctx->bus_clk)) {
>>   dev_err(dev, "failed to get bus clock\n");
>> - ret = PTR_ERR(ctx->bus_clk);
>> - goto err_clk_get;
>> + return PTR_ERR(ctx->bus_clk);
>>   }
>>
>> - ctx->lcd_clk = clk_get(dev, "sclk_fimd");
>> + ctx->lcd_clk = devm_clk_get(dev, "sclk_fimd");
>>   if (IS_ERR(ctx->lcd_clk)) {
>>   dev_err(dev, "failed to get lcd clock\n");
>> - ret = PTR_ERR(ctx->lcd_clk);
>> - goto err_bus_clk;
>> + return PTR_ERR(ctx->lcd_clk);
>>   }
>>
>>   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>> @@ -865,14 +863,13 @@ static int __devinit fimd_probe(struct
>> platform_device *pdev)
>>   ctx->regs = devm_request_and_ioremap(&pdev->dev, res);
>>   if (!ctx->regs) {
>>   dev_err(dev, "failed to map registers\n");
>> - ret = -ENXIO;
>> - goto err_clk;
>> + return -ENXIO;
>>   }
>>
>>   res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
>>   if (!res) {
>>   dev_err(dev, "irq request failed.\n");
>> - goto err_clk;
>> + return -ENXIO;
>>   }
>>
>>   ctx->irq = res->start;
>> @@ -881,7 +878,7 @@ static int __devinit fimd_probe(struct platform_device
>> *pdev)
>>   0, "drm_fimd", ctx);
>>   if (ret) {
>>   dev_err(dev, "irq request failed.\n");
>> - goto err_clk;
>> + return ret;
>>   }
>>
>>   ctx->vidcon0 = pdata->vidcon0;
>> @@ -915,17 +912,6 @@ static int __devinit fimd_probe(struct
>> platform_device *pdev)
>>   exynos_drm_subdrv_register(subdrv);
>>
>>   return 0;
>> -
>> -err_clk:
>> - clk_disable(ctx->lcd_clk);
>> - clk_put(ctx->lcd_clk);
>> -
>> -err_bus_clk:
>> - clk_disable(ctx->bus_clk);
>> - clk_put(ctx->bus_clk);
>> -
>> -err_clk_get:
>> - return ret;
>>  }
>>
>>  static int __devexit fimd_remove(struct platform_device *pdev)
>> @@ -949,9 +935,6 @@ static int __devexit fimd_remove(struct
>> platform_device *pdev)
>>  out:
>>   pm_runtime_disable(dev);
>>
>> - clk_put(ctx->lcd_clk);
>> - clk_put(ctx->bus_clk);
>> -
>>   return 0;
>>  }
>>
>> --
>> 1.7.4.1
>



-- 
With warm regards,
Sachin


[PATCH 0/2] drm: exynos: hdmi: sending AVI and AUI info frames

2012-11-23 Thread Inki Dae
2012/11/10 Rahul Sharma 

> This patch set adds provision for composing and sending AVI and AUI
> infoframes by exynos drm hdmi driver.
>
> It also adds provision to get CEA Video ID Code through the display mode
> which is required for making AVI infoframe.
>
> Based on exynos-drm-fixes branch of
> git://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos.git
>
>
Please rebase these patches to be based on exynos-drm-next. These should go
to -next.

Thanks,
Inki Dae



> Rahul Sharma (1):
>   drm: exynos: compose and send avi and aui info frames
>
> Stephane Marchesin (1):
>   drm: get cea video id code for a given display mode
>
>  drivers/gpu/drm/drm_edid.c   |   20 +++
>  drivers/gpu/drm/exynos/exynos_hdmi.c |   97
> +-
>  drivers/gpu/drm/exynos/exynos_hdmi.h |   23 
>  drivers/gpu/drm/exynos/regs-hdmi.h   |   17 +-
>  include/drm/drm_crtc.h   |1 +
>  5 files changed, 154 insertions(+), 4 deletions(-)
>
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20121123/c0174769/attachment.html>


[PATCH 1/2] drm: add drm_mode_cea_vic

2012-11-23 Thread Thierry Reding
On Fri, Nov 23, 2012 at 12:09:26PM -0200, Paulo Zanoni wrote:
> From: Paulo Zanoni 
> 
> This function returns the VIC of the mode. This value can be used when
> creating AVI InfoFrames.
> 
> Cc: Thierry Reding 
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=50371
> Signed-off-by: Paulo Zanoni 
> ---
>  drivers/gpu/drm/drm_edid.c |   19 +++
>  include/drm/drm_crtc.h |1 +
>  2 files changed, 20 insertions(+)
> 
> Since drm-intel-next-queued is too old for this patch, I am rebasing it 
> against
> drm-next and splitting into 2 patches: one drm-only and the other i915-only, 
> so
> I imagine the first will be merged by Dave and the second by Daniel.
> 
> New version:
>  - Based on Dave's drm-next
>  - Fix function name inside the comments
>  - Remove the i915 chunk
>  - Constification of other functions is no more required as they are already
>const here.

Looks good to me:

Reviewed-by: Thierry Reding 
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20121123/1e8c0697/attachment-0001.pgp>


[PATCH] drm/i915: set the AVI VIC of the HDMI mode

2012-11-23 Thread Thierry Reding
On Fri, Nov 23, 2012 at 11:46:10AM -0200, Paulo Zanoni wrote:
> Hi
> 
> 2012/11/22 Thierry Reding :
> > On Wed, Nov 21, 2012 at 01:39:48PM -0200, Paulo Zanoni wrote:
[...]
> >> + * @mode: mode
> >> + *
> >> + * RETURNS:
> >> + * The VIC number, 0 in case it's not a CEA-861 mode.
> >> + */
> >> +uint8_t drm_mode_cea_vic(const struct drm_display_mode *mode)
> >
> > I understand the reason for returning an uint8_t here, but ...
> >
> >> +{
> >> + uint8_t i;
> >> +
> >> + for (i = 0; i < drm_num_cea_modes; i++)
> >
> > ... maybe unsigned int would be better for the iteration variable here.
> > Looking at drm_edid_modes.h, drm_num_cea_modes is actually signed, which
> > isn't necessary to store an array size, so maybe that should be changed
> > as well.
> 
> I used uint8_t because "i" is the thing we return. I don't think
> there's a perfect solution to this problem and I don't really think it
> matters too much.

Fair enough, uint8_t should work fine.

Thierry
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20121123/9468863f/attachment.pgp>


[PATCH] drm: exynos: hdmi: sending AVI and AUI info frames

2012-11-23 Thread Rahul Sharma
This patch adds code for composing AVI and AUI info frames
and send them every VSYNC.

This patch is important for hdmi certification.

Signed-off-by: Rahul Sharma 
Signed-off-by: Fahad Kunnathadi 
Signed-off-by: Shirish S 

Based on exynos-drm-next branch of
http://git.kernel.org/?p=linux/kernel/git/daeinki/drm-exynos.git
---
 drivers/gpu/drm/exynos/exynos_hdmi.c |  139 +-
 drivers/gpu/drm/exynos/exynos_hdmi.h |   23 ++
 drivers/gpu/drm/exynos/regs-hdmi.h   |   17 -
 3 files changed, 158 insertions(+), 21 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c 
b/drivers/gpu/drm/exynos/exynos_hdmi.c
index 59839cc..49332bd 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -183,6 +183,7 @@ struct hdmi_v13_conf {
int height;
int vrefresh;
bool interlace;
+   int cea_video_id;
const u8 *hdmiphy_data;
const struct hdmi_v13_preset_conf *conf;
 };
@@ -354,15 +355,20 @@ static const struct hdmi_v13_preset_conf 
hdmi_v13_conf_1080p60 = {
 };

 static const struct hdmi_v13_conf hdmi_v13_confs[] = {
-   { 1280, 720, 60, false, hdmiphy_v13_conf74_25, &hdmi_v13_conf_720p60 },
-   { 1280, 720, 50, false, hdmiphy_v13_conf74_25, &hdmi_v13_conf_720p60 },
-   { 720, 480, 60, false, hdmiphy_v13_conf27_027, &hdmi_v13_conf_480p },
-   { 1920, 1080, 50, true, hdmiphy_v13_conf74_25, &hdmi_v13_conf_1080i50 },
-   { 1920, 1080, 50, false, hdmiphy_v13_conf148_5,
-&hdmi_v13_conf_1080p50 },
-   { 1920, 1080, 60, true, hdmiphy_v13_conf74_25, &hdmi_v13_conf_1080i60 },
-   { 1920, 1080, 60, false, hdmiphy_v13_conf148_5,
-&hdmi_v13_conf_1080p60 },
+   { 1280, 720, 60, false, 4, hdmiphy_v13_conf74_25,
+   &hdmi_v13_conf_720p60 },
+   { 1280, 720, 50, false, 19, hdmiphy_v13_conf74_25,
+   &hdmi_v13_conf_720p60 },
+   { 720, 480, 60, false, 3, hdmiphy_v13_conf27_027,
+   &hdmi_v13_conf_480p },
+   { 1920, 1080, 50, true, 20, hdmiphy_v13_conf74_25,
+   &hdmi_v13_conf_1080i50 },
+   { 1920, 1080, 50, false, 31, hdmiphy_v13_conf148_5,
+   &hdmi_v13_conf_1080p50 },
+   { 1920, 1080, 60, true, 5, hdmiphy_v13_conf74_25,
+   &hdmi_v13_conf_1080i60 },
+   { 1920, 1080, 60, false, 16, hdmiphy_v13_conf148_5,
+   &hdmi_v13_conf_1080p60 },
 };

 /* HDMI Version 1.4 */
@@ -480,6 +486,7 @@ struct hdmi_conf {
int height;
int vrefresh;
bool interlace;
+   int cea_video_id;
const u8 *hdmiphy_data;
const struct hdmi_preset_conf *conf;
 };
@@ -935,16 +942,21 @@ static const struct hdmi_preset_conf hdmi_conf_1080p60 = {
 };

 static const struct hdmi_conf hdmi_confs[] = {
-   { 720, 480, 60, false, hdmiphy_conf27_027, &hdmi_conf_480p60 },
-   { 1280, 720, 50, false, hdmiphy_conf74_25, &hdmi_conf_720p50 },
-   { 1280, 720, 60, false, hdmiphy_conf74_25, &hdmi_conf_720p60 },
-   { 1920, 1080, 50, true, hdmiphy_conf74_25, &hdmi_conf_1080i50 },
-   { 1920, 1080, 60, true, hdmiphy_conf74_25, &hdmi_conf_1080i60 },
-   { 1920, 1080, 30, false, hdmiphy_conf74_176, &hdmi_conf_1080p30 },
-   { 1920, 1080, 50, false, hdmiphy_conf148_5, &hdmi_conf_1080p50 },
-   { 1920, 1080, 60, false, hdmiphy_conf148_5, &hdmi_conf_1080p60 },
+   { 720, 480, 60, false, 3, hdmiphy_conf27_027, &hdmi_conf_480p60 },
+   { 1280, 720, 50, false, 19, hdmiphy_conf74_25, &hdmi_conf_720p50 },
+   { 1280, 720, 60, false, 4, hdmiphy_conf74_25, &hdmi_conf_720p60 },
+   { 1920, 1080, 50, true, 20, hdmiphy_conf74_25, &hdmi_conf_1080i50 },
+   { 1920, 1080, 60, true, 5, hdmiphy_conf74_25, &hdmi_conf_1080i60 },
+   { 1920, 1080, 30, false, 34, hdmiphy_conf74_176, &hdmi_conf_1080p30 },
+   { 1920, 1080, 50, false, 31, hdmiphy_conf148_5, &hdmi_conf_1080p50 },
+   { 1920, 1080, 60, false, 16, hdmiphy_conf148_5, &hdmi_conf_1080p60 },
 };

+struct hdmi_infoframe {
+   enum HDMI_PACKET_TYPE type;
+   u8 ver;
+   u8 len;
+};

 static inline u32 hdmi_reg_read(struct hdmi_context *hdata, u32 reg_id)
 {
@@ -1268,6 +1280,85 @@ static int hdmi_conf_index(struct hdmi_context *hdata,
return hdmi_v14_conf_index(mode);
 }

+static u8 hdmi_chksum(struct hdmi_context *hdata,
+   u32 start, u8 len, u32 hdr_sum)
+{
+   int i;
+   /* hdr_sum : header0 + header1 + header2
+   * start : start address of packet byte1
+   * len : packet bytes - 1 */
+   for (i = 0; i < len; ++i)
+   hdr_sum += 0xff & hdmi_reg_read(hdata, start + i * 4);
+
+   return (u8)(0x100 - (hdr_sum & 0xff));
+}
+
+void hdmi_reg_infoframe(struct hdmi_context *hdata,
+   struct hdmi_infoframe *infoframe)
+{
+   u32 hdr_sum;
+   u8 chksum;
+   u32 aspect_ra

[PATCH 0/2] drm: exynos: hdmi: sending AVI and AUI info frames

2012-11-23 Thread Rahul Sharma
Thanks Thierry,

It is good idea to use generic code. I would like to see your patches.

regards,
Rahul Sharma

On Fri, Nov 23, 2012 at 11:45 AM, Inki Dae  wrote:
>
>
> 2012/11/10 Rahul Sharma 
>>
>> This patch set adds provision for composing and sending AVI and AUI
>> infoframes by exynos drm hdmi driver.
>>
>> It also adds provision to get CEA Video ID Code through the display mode
>> which is required for making AVI infoframe.
>>
>> Based on exynos-drm-fixes branch of
>> git://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos.git
>>
>
> Please rebase these patches to be based on exynos-drm-next. These should go
> to -next.
>
> Thanks,
> Inki Dae
>
>
>>
>> Rahul Sharma (1):
>>   drm: exynos: compose and send avi and aui info frames
>>
>> Stephane Marchesin (1):
>>   drm: get cea video id code for a given display mode
>>
>>  drivers/gpu/drm/drm_edid.c   |   20 +++
>>  drivers/gpu/drm/exynos/exynos_hdmi.c |   97
>> +-
>>  drivers/gpu/drm/exynos/exynos_hdmi.h |   23 
>>  drivers/gpu/drm/exynos/regs-hdmi.h   |   17 +-
>>  include/drm/drm_crtc.h   |1 +
>>  5 files changed, 154 insertions(+), 4 deletions(-)
>>
>> ___
>> dri-devel mailing list
>> dri-devel at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>
>
>
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>


[PATCH Resend] drm/exynos: Use devm_clk_get in exynos_drm_fimd.c

2012-11-23 Thread Sachin Kamat
devm_clk_get is device managed and makes error handling and exit code
simpler.

Signed-off-by: Sachin Kamat 
---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c |   31 ++---
 1 files changed, 7 insertions(+), 24 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index ad04edd..00bd266 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -846,18 +846,16 @@ static int __devinit fimd_probe(struct platform_device 
*pdev)
if (!ctx)
return -ENOMEM;

-   ctx->bus_clk = clk_get(dev, "fimd");
+   ctx->bus_clk = devm_clk_get(dev, "fimd");
if (IS_ERR(ctx->bus_clk)) {
dev_err(dev, "failed to get bus clock\n");
-   ret = PTR_ERR(ctx->bus_clk);
-   goto err_clk_get;
+   return PTR_ERR(ctx->bus_clk);
}

-   ctx->lcd_clk = clk_get(dev, "sclk_fimd");
+   ctx->lcd_clk = devm_clk_get(dev, "sclk_fimd");
if (IS_ERR(ctx->lcd_clk)) {
dev_err(dev, "failed to get lcd clock\n");
-   ret = PTR_ERR(ctx->lcd_clk);
-   goto err_bus_clk;
+   return PTR_ERR(ctx->lcd_clk);
}

res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -865,14 +863,13 @@ static int __devinit fimd_probe(struct platform_device 
*pdev)
ctx->regs = devm_request_and_ioremap(&pdev->dev, res);
if (!ctx->regs) {
dev_err(dev, "failed to map registers\n");
-   ret = -ENXIO;
-   goto err_clk;
+   return -ENXIO;
}

res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
if (!res) {
dev_err(dev, "irq request failed.\n");
-   goto err_clk;
+   return -ENXIO;
}

ctx->irq = res->start;
@@ -881,7 +878,7 @@ static int __devinit fimd_probe(struct platform_device 
*pdev)
0, "drm_fimd", ctx);
if (ret) {
dev_err(dev, "irq request failed.\n");
-   goto err_clk;
+   return ret;
}

ctx->vidcon0 = pdata->vidcon0;
@@ -915,17 +912,6 @@ static int __devinit fimd_probe(struct platform_device 
*pdev)
exynos_drm_subdrv_register(subdrv);

return 0;
-
-err_clk:
-   clk_disable(ctx->lcd_clk);
-   clk_put(ctx->lcd_clk);
-
-err_bus_clk:
-   clk_disable(ctx->bus_clk);
-   clk_put(ctx->bus_clk);
-
-err_clk_get:
-   return ret;
 }

 static int __devexit fimd_remove(struct platform_device *pdev)
@@ -949,9 +935,6 @@ static int __devexit fimd_remove(struct platform_device 
*pdev)
 out:
pm_runtime_disable(dev);

-   clk_put(ctx->lcd_clk);
-   clk_put(ctx->bus_clk);
-
return 0;
 }

-- 
1.7.4.1



[PATCH Resend] drm/exynos: Use devm_* APIs in exynos_hdmi.c

2012-11-23 Thread Sachin Kamat
devm_* functions are device managed and make error handling and exit code
simpler.

Signed-off-by: Sachin Kamat 
---
 drivers/gpu/drm/exynos/exynos_hdmi.c |   60 +++--
 1 files changed, 13 insertions(+), 47 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c 
b/drivers/gpu/drm/exynos/exynos_hdmi.c
index 59839cc..af5c8ac 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -2197,27 +2197,27 @@ static int __devinit hdmi_resources_init(struct 
hdmi_context *hdata)
memset(res, 0, sizeof(*res));

/* get clocks, power */
-   res->hdmi = clk_get(dev, "hdmi");
+   res->hdmi = devm_clk_get(dev, "hdmi");
if (IS_ERR_OR_NULL(res->hdmi)) {
DRM_ERROR("failed to get clock 'hdmi'\n");
goto fail;
}
-   res->sclk_hdmi = clk_get(dev, "sclk_hdmi");
+   res->sclk_hdmi = devm_clk_get(dev, "sclk_hdmi");
if (IS_ERR_OR_NULL(res->sclk_hdmi)) {
DRM_ERROR("failed to get clock 'sclk_hdmi'\n");
goto fail;
}
-   res->sclk_pixel = clk_get(dev, "sclk_pixel");
+   res->sclk_pixel = devm_clk_get(dev, "sclk_pixel");
if (IS_ERR_OR_NULL(res->sclk_pixel)) {
DRM_ERROR("failed to get clock 'sclk_pixel'\n");
goto fail;
}
-   res->sclk_hdmiphy = clk_get(dev, "sclk_hdmiphy");
+   res->sclk_hdmiphy = devm_clk_get(dev, "sclk_hdmiphy");
if (IS_ERR_OR_NULL(res->sclk_hdmiphy)) {
DRM_ERROR("failed to get clock 'sclk_hdmiphy'\n");
goto fail;
}
-   res->hdmiphy = clk_get(dev, "hdmiphy");
+   res->hdmiphy = devm_clk_get(dev, "hdmiphy");
if (IS_ERR_OR_NULL(res->hdmiphy)) {
DRM_ERROR("failed to get clock 'hdmiphy'\n");
goto fail;
@@ -2225,7 +2225,7 @@ static int __devinit hdmi_resources_init(struct 
hdmi_context *hdata)

clk_set_parent(res->sclk_hdmi, res->sclk_pixel);

-   res->regul_bulk = kzalloc(ARRAY_SIZE(supply) *
+   res->regul_bulk = devm_kzalloc(dev, ARRAY_SIZE(supply) *
sizeof(res->regul_bulk[0]), GFP_KERNEL);
if (!res->regul_bulk) {
DRM_ERROR("failed to get memory for regulators\n");
@@ -2235,7 +2235,7 @@ static int __devinit hdmi_resources_init(struct 
hdmi_context *hdata)
res->regul_bulk[i].supply = supply[i];
res->regul_bulk[i].consumer = NULL;
}
-   ret = regulator_bulk_get(dev, ARRAY_SIZE(supply), res->regul_bulk);
+   ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(supply), res->regul_bulk);
if (ret) {
DRM_ERROR("failed to get regulators\n");
goto fail;
@@ -2248,28 +2248,6 @@ fail:
return -ENODEV;
 }

-static int hdmi_resources_cleanup(struct hdmi_context *hdata)
-{
-   struct hdmi_resources *res = &hdata->res;
-
-   regulator_bulk_free(res->regul_count, res->regul_bulk);
-   /* kfree is NULL-safe */
-   kfree(res->regul_bulk);
-   if (!IS_ERR_OR_NULL(res->hdmiphy))
-   clk_put(res->hdmiphy);
-   if (!IS_ERR_OR_NULL(res->sclk_hdmiphy))
-   clk_put(res->sclk_hdmiphy);
-   if (!IS_ERR_OR_NULL(res->sclk_pixel))
-   clk_put(res->sclk_pixel);
-   if (!IS_ERR_OR_NULL(res->sclk_hdmi))
-   clk_put(res->sclk_hdmi);
-   if (!IS_ERR_OR_NULL(res->hdmi))
-   clk_put(res->hdmi);
-   memset(res, 0, sizeof(*res));
-
-   return 0;
-}
-
 static struct i2c_client *hdmi_ddc, *hdmi_hdmiphy;

 void hdmi_attach_ddc_client(struct i2c_client *ddc)
@@ -2409,36 +2387,32 @@ static int __devinit hdmi_probe(struct platform_device 
*pdev)
ret = hdmi_resources_init(hdata);

if (ret) {
-   ret = -EINVAL;
DRM_ERROR("hdmi_resources_init failed\n");
-   goto err_data;
+   return -EINVAL;
}

res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res) {
DRM_ERROR("failed to find registers\n");
-   ret = -ENOENT;
-   goto err_resource;
+   return -ENOENT;
}

hdata->regs = devm_request_and_ioremap(&pdev->dev, res);
if (!hdata->regs) {
DRM_ERROR("failed to map registers\n");
-   ret = -ENXIO;
-   goto err_resource;
+   return -ENXIO;
}

-   ret = gpio_request(hdata->hpd_gpio, "HPD");
+   ret = devm_gpio_request(&pdev->dev, hdata->hpd_gpio, "HPD");
if (ret) {
DRM_ERROR("failed to request HPD gpio\n");
-   goto err_resource;
+   return ret;
}

/* DDC i2c driver */
if (i2c_add_driver(&ddc_driver)) {
DRM_ERROR("failed to register ddc i2c driver\n");
-   ret = -ENOENT;
-   goto err_gpio;
+   return -ENOENT;
}


[PATCH Resend] drm/exynos: Use devm_clk_get in exynos_mixer.c

2012-11-23 Thread Sachin Kamat
devm_clk_get is device managed and makes error handling and exit code
simpler.

Signed-off-by: Sachin Kamat 
---
 drivers/gpu/drm/exynos/exynos_mixer.c |   59 +
 1 files changed, 16 insertions(+), 43 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c 
b/drivers/gpu/drm/exynos/exynos_mixer.c
index 0d3ed28..5712b0e 100644
--- a/drivers/gpu/drm/exynos/exynos_mixer.c
+++ b/drivers/gpu/drm/exynos/exynos_mixer.c
@@ -962,57 +962,45 @@ static int __devinit mixer_resources_init(struct 
exynos_drm_hdmi_context *ctx,

spin_lock_init(&mixer_res->reg_slock);

-   mixer_res->mixer = clk_get(dev, "mixer");
+   mixer_res->mixer = devm_clk_get(dev, "mixer");
if (IS_ERR_OR_NULL(mixer_res->mixer)) {
dev_err(dev, "failed to get clock 'mixer'\n");
-   ret = -ENODEV;
-   goto fail;
+   return -ENODEV;
}

-   mixer_res->sclk_hdmi = clk_get(dev, "sclk_hdmi");
+   mixer_res->sclk_hdmi = devm_clk_get(dev, "sclk_hdmi");
if (IS_ERR_OR_NULL(mixer_res->sclk_hdmi)) {
dev_err(dev, "failed to get clock 'sclk_hdmi'\n");
-   ret = -ENODEV;
-   goto fail;
+   return -ENODEV;
}
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (res == NULL) {
dev_err(dev, "get memory resource failed.\n");
-   ret = -ENXIO;
-   goto fail;
+   return -ENXIO;
}

mixer_res->mixer_regs = devm_ioremap(&pdev->dev, res->start,
resource_size(res));
if (mixer_res->mixer_regs == NULL) {
dev_err(dev, "register mapping failed.\n");
-   ret = -ENXIO;
-   goto fail;
+   return -ENXIO;
}

res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
if (res == NULL) {
dev_err(dev, "get interrupt resource failed.\n");
-   ret = -ENXIO;
-   goto fail;
+   return -ENXIO;
}

ret = devm_request_irq(&pdev->dev, res->start, mixer_irq_handler,
0, "drm_mixer", ctx);
if (ret) {
dev_err(dev, "request interrupt failed.\n");
-   goto fail;
+   return ret;
}
mixer_res->irq = res->start;

return 0;
-
-fail:
-   if (!IS_ERR_OR_NULL(mixer_res->sclk_hdmi))
-   clk_put(mixer_res->sclk_hdmi);
-   if (!IS_ERR_OR_NULL(mixer_res->mixer))
-   clk_put(mixer_res->mixer);
-   return ret;
 }

 static int __devinit vp_resources_init(struct exynos_drm_hdmi_context *ctx,
@@ -1022,25 +1010,21 @@ static int __devinit vp_resources_init(struct 
exynos_drm_hdmi_context *ctx,
struct device *dev = &pdev->dev;
struct mixer_resources *mixer_res = &mixer_ctx->mixer_res;
struct resource *res;
-   int ret;

-   mixer_res->vp = clk_get(dev, "vp");
+   mixer_res->vp = devm_clk_get(dev, "vp");
if (IS_ERR_OR_NULL(mixer_res->vp)) {
dev_err(dev, "failed to get clock 'vp'\n");
-   ret = -ENODEV;
-   goto fail;
+   return -ENODEV;
}
-   mixer_res->sclk_mixer = clk_get(dev, "sclk_mixer");
+   mixer_res->sclk_mixer = devm_clk_get(dev, "sclk_mixer");
if (IS_ERR_OR_NULL(mixer_res->sclk_mixer)) {
dev_err(dev, "failed to get clock 'sclk_mixer'\n");
-   ret = -ENODEV;
-   goto fail;
+   return -ENODEV;
}
-   mixer_res->sclk_dac = clk_get(dev, "sclk_dac");
+   mixer_res->sclk_dac = devm_clk_get(dev, "sclk_dac");
if (IS_ERR_OR_NULL(mixer_res->sclk_dac)) {
dev_err(dev, "failed to get clock 'sclk_dac'\n");
-   ret = -ENODEV;
-   goto fail;
+   return -ENODEV;
}

if (mixer_res->sclk_hdmi)
@@ -1049,28 +1033,17 @@ static int __devinit vp_resources_init(struct 
exynos_drm_hdmi_context *ctx,
res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
if (res == NULL) {
dev_err(dev, "get memory resource failed.\n");
-   ret = -ENXIO;
-   goto fail;
+   return -ENXIO;
}

mixer_res->vp_regs = devm_ioremap(&pdev->dev, res->start,
resource_size(res));
if (mixer_res->vp_regs == NULL) {
dev_err(dev, "register mapping failed.\n");
-   ret = -ENXIO;
-   goto fail;
+   return -ENXIO;
}

return 0;
-
-fail:
-   if (!IS_ERR_OR_NULL(mixer_res->sclk_dac))
-   clk_put(mixer_res->sclk_dac);
-   if (!IS_ERR_OR_NULL(mixer_res->sclk_mixer))
-   clk_put(mixer_res->sclk_mixer);
-   if (!IS_ERR_OR_NULL(mixer_res->v

Re: [RFC v2 0/5] Common Display Framework

2012-11-23 Thread Sascha Hauer
Hi Laurent,

On Thu, Nov 22, 2012 at 10:45:31PM +0100, Laurent Pinchart wrote:
> From: Laurent Pinchart 
> 
 
> The CDF models this using a Russian doll's model. From the display controller
> point of view only the first external entity (LVDS to DSI converter) is
> visible. The display controller thus calls the control operations implemented
> by the LVDS to DSI transmitter driver (left-most green arrow). The driver is
> aware of the next entity in the chain,

I can't find this in the code. I can see the video operations
propagating upstream using the source field of struct display_entity,
but how do the control operations propagate downstream? Am I missing
something?

Sascha


-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCHv14 4/7] fbmon: add videomode helpers

2012-11-23 Thread Steffen Trumtrar
Hi Laurent,

On Fri, Nov 23, 2012 at 11:53:10AM +0100, Laurent Pinchart wrote:
> Hi Steffen,
> 
> On Friday 23 November 2012 10:04:24 Steffen Trumtrar wrote:
> > Add a function to convert from the generic videomode to a fb_videomode.
> > 
> > Signed-off-by: Steffen Trumtrar 
> > Reviewed-by: Thierry Reding 
> > Acked-by: Thierry Reding 
> > Tested-by: Thierry Reding 
> > Tested-by: Philipp Zabel 
> > Reviewed-by: Laurent Pinchart 
> > Acked-by: Laurent Pinchart 
> > ---
> >  drivers/video/fbmon.c |   49 ++
> >  include/linux/fb.h|6 ++
> >  2 files changed, 55 insertions(+)
> > 
> > diff --git a/drivers/video/fbmon.c b/drivers/video/fbmon.c
> > index cef6557..bcbfe8f 100644
> > --- a/drivers/video/fbmon.c
> > +++ b/drivers/video/fbmon.c
> > @@ -31,6 +31,7 @@
> >  #include 
> >  #include 
> >  #include 
> > +#include 
> 
> You could move this one line up to keep headers sorted alphabetically 
> (assuming they are in the first place).
> 

Because of the careless mistake below, I will do that.

> >  #ifdef CONFIG_PPC_OF
> >  #include 
> >  #include 
> > @@ -1373,6 +1374,54 @@ int fb_get_mode(int flags, u32 val, struct
> > fb_var_screeninfo *var, struct fb_inf kfree(timings);
> > return err;
> >  }
> > +
> > +#if IS_ENABLED(CONFIG_VIDEOMODE)
> > +int fb_videomode_from_videomode(const struct videomode *vm,
> > +   struct fb_videomode *fbmode)
> 
> This is inside the #if CONFIG_FB_MODE_HELPERS block, is that intentional ?
> 

Yes. Intentional. It is a fb_mode helper, that is why ... oh, wait. I should
add a "depends on" to the Kconfig then.

> > +{
> > +   unsigned int htotal, vtotal;
> > +
> > +   fbmode->xres = vm->hactive;
> > +   fbmode->left_margin = vm->hback_porch;
> > +   fbmode->right_margin = vm->hfront_porch;
> > +   fbmode->hsync_len = vm->hsync_len;
> > +
> > +   fbmode->yres = vm->vactive;
> > +   fbmode->upper_margin = vm->vback_porch;
> > +   fbmode->lower_margin = vm->vfront_porch;
> > +   fbmode->vsync_len = vm->vsync_len;
> > +
> > +   /* prevent division by zero in KHZ2PICOS macro */
> > +   fbmode->pixclock = vm->pixelclock ? KHZ2PICOS(vm->pixelclock / 1000) : 
> > 0;
> > +
> > +   fbmode->sync = 0;
> > +   fbmode->vmode = 0;
> > +   if (vm->hah)
> > +   fbmode->sync |= FB_SYNC_HOR_HIGH_ACT;
> > +   if (vm->vah)
> > +   fbmode->sync |= FB_SYNC_VERT_HIGH_ACT;
> > +   if (vm->interlaced)
> > +   fbmode->vmode |= FB_VMODE_INTERLACED;
> > +   if (vm->doublescan)
> > +   fbmode->vmode |= FB_VMODE_DOUBLE;
> > +   fbmode->flag = 0;
> > +
> > +   htotal = vm->hactive + vm->hfront_porch + vm->hback_porch +
> > +vm->hsync_len;
> > +   vtotal = vm->vactive + vm->vfront_porch + vm->vback_porch +
> > +vm->vsync_len;
> > +   /* prevent division by zero */
> > +   if (htotal && vtotal)
> > +   fbmode->refresh = vm->pixelclock / (htotal * vtotal);
> > +   else
> > +   fbmode->refresh = vm->pixelclock;
> 
> What about returning an error if htotal * vtotal == 0 ? The input is clearly 
> invalid in that case. I would then set fbmode->refresh to 0, setting it to vm-
> >pixelclock doesn't really make sense.
> 

Yes, pixelclock makes no sense. It was supposed to be 0. I was careless here.

> > +
> > +   return 0;
> > +}
> > +EXPORT_SYMBOL_GPL(fb_videomode_from_videomode);
> > +#endif
> > +
> > +
> 
> A single blank line should be enough.
> 

Regards,
Steffen

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |


[PATCH 2/5] drm/exynos: Use devm_gpio_request in exynos_hdmi.c

2012-11-23 Thread Sachin Kamat
On 23 November 2012 12:21, Inki Dae  wrote:
[snip]

> With cleanup to hdmi_resources_init, we can remove hdmi_resource_cleanup
> function. So could you please re-send updated patches?

OK. I will update and re-send.

>
> You've been submitting patches into too small pieces.
> Because they are trivial enough and in the same context, please merge this
> kind of patches as long as they are related with the same class or topics. I
> think you can combine them. :)

Generally, the accepted practice is to combine patches if they do
similar changes in the same file.
Else, separate patches is preferred as it makes things easier for
reviewers and maintainer by improving readability and less rework
effort.
Since you have specifically requested for combining the patches I will
squash patches related to clk_get together and resend the series.

>
> Thanks,
> Inki Dae
>


-- 
With warm regards,
Sachin


[PATCH 1/5] drm/exynos: Use devm_clk_get in exynos_drm_fimd.c

2012-11-23 Thread Sachin Kamat
On 23 November 2012 12:10, Inki Dae  wrote:
>
>
>> -Original Message-
>> From: Sachin Kamat [mailto:sachin.kamat at linaro.org]
>> Sent: Friday, November 23, 2012 12:42 PM
>> To: dri-devel at lists.freedesktop.org
>> Cc: inki.dae at samsung.com; jy0922.shim at samsung.com; airlied at linux.ie;
>> sachin.kamat at linaro.org; patches at linaro.org
>> Subject: [PATCH 1/5] drm/exynos: Use devm_clk_get in exynos_drm_fimd.c
>>
>> devm_clk_get is device managed and makes error handling and exit code
>> simpler.
>>
>> Signed-off-by: Sachin Kamat 
>> ---
>>  drivers/gpu/drm/exynos/exynos_drm_fimd.c |9 ++---
>>  1 files changed, 2 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
>> b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
>> index ad04edd..57851cc 100644
>> --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
>> +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
>> @@ -846,14 +846,14 @@ static int __devinit fimd_probe(struct
>> platform_device *pdev)
>>   if (!ctx)
>>   return -ENOMEM;
>>
>> - ctx->bus_clk = clk_get(dev, "fimd");
>> + ctx->bus_clk = devm_clk_get(dev, "fimd");
>>   if (IS_ERR(ctx->bus_clk)) {
>>   dev_err(dev, "failed to get bus clock\n");
>>   ret = PTR_ERR(ctx->bus_clk);
>>   goto err_clk_get;
>>   }
>>
>> - ctx->lcd_clk = clk_get(dev, "sclk_fimd");
>> + ctx->lcd_clk = devm_clk_get(dev, "sclk_fimd");
>>   if (IS_ERR(ctx->lcd_clk)) {
>>   dev_err(dev, "failed to get lcd clock\n");
>>   ret = PTR_ERR(ctx->lcd_clk);
>> @@ -918,11 +918,9 @@ static int __devinit fimd_probe(struct
>> platform_device *pdev)
>>
>>  err_clk:
>>   clk_disable(ctx->lcd_clk);
>> - clk_put(ctx->lcd_clk);
>
> clk_disable shouldn't be called here so let's cleanup this also to reduce
> unnecessary cleanup commits.
>
>>
>>  err_bus_clk:
>>   clk_disable(ctx->bus_clk);
>> - clk_put(ctx->bus_clk);
>>
>
> Ditto.

OK. I will remove it. Do you want me to re-send only this patch or the
entire series?

>
> Thanks,
> Inki Dae
>
>>  err_clk_get:
>>   return ret;
>> @@ -949,9 +947,6 @@ static int __devexit fimd_remove(struct
>> platform_device *pdev)
>>  out:
>>   pm_runtime_disable(dev);
>>
>> - clk_put(ctx->lcd_clk);
>> - clk_put(ctx->bus_clk);
>> -
>>   return 0;
>>  }
>>
>> --
>> 1.7.4.1
>



-- 
With warm regards,
Sachin


[PATCH 2/2] drm/i915: set the VIC of the mode on the AVI InfoFrame

2012-11-23 Thread Paulo Zanoni
From: Paulo Zanoni 

We currently set "0" as the VIC value of the AVI InfoFrames. According
to the specs this should be fine and work for every mode, so to my
point of view we can't consider the current behavior as a bug. The
problem is that  we recently received a bug report (Kernel bug #50371)
from a user that has an AV receiver that gives a black screen for any
mode with VIC set to 0.

So in order to make at least some modes work for him, this patch sets
the correct VIC number when sending AVI InfoFrames.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=50371
Signed-off-by: Paulo Zanoni 
---
 drivers/gpu/drm/i915/intel_hdmi.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_hdmi.c 
b/drivers/gpu/drm/i915/intel_hdmi.c
index 1dcfd5b..eaf70d6 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -340,6 +340,8 @@ static void intel_hdmi_set_avi_infoframe(struct drm_encoder 
*encoder,
if (adjusted_mode->flags & DRM_MODE_FLAG_DBLCLK)
avi_if.body.avi.YQ_CN_PR |= DIP_AVI_PR_2;

+   avi_if.body.avi.VIC = drm_mode_cea_vic(adjusted_mode);
+
intel_set_infoframe(encoder, &avi_if);
 }

-- 
1.7.10.4



[PATCH 1/2] drm: add drm_mode_cea_vic

2012-11-23 Thread Paulo Zanoni
From: Paulo Zanoni 

This function returns the VIC of the mode. This value can be used when
creating AVI InfoFrames.

Cc: Thierry Reding 
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=50371
Signed-off-by: Paulo Zanoni 
---
 drivers/gpu/drm/drm_edid.c |   19 +++
 include/drm/drm_crtc.h |1 +
 2 files changed, 20 insertions(+)

Since drm-intel-next-queued is too old for this patch, I am rebasing it against
drm-next and splitting into 2 patches: one drm-only and the other i915-only, so
I imagine the first will be merged by Dave and the second by Daniel.

New version:
 - Based on Dave's drm-next
 - Fix function name inside the comments
 - Remove the i915 chunk
 - Constification of other functions is no more required as they are already
   const here.

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 1648200..011bd4f 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -2079,3 +2079,22 @@ int drm_add_modes_noedid(struct drm_connector *connector,
return num_modes;
 }
 EXPORT_SYMBOL(drm_add_modes_noedid);
+
+/**
+ * drm_mode_cea_vic - return the CEA-861 VIC of a given mode
+ * @mode: mode
+ *
+ * RETURNS:
+ * The VIC number, 0 in case it's not a CEA-861 mode.
+ */
+uint8_t drm_mode_cea_vic(const struct drm_display_mode *mode)
+{
+   uint8_t i;
+
+   for (i = 0; i < drm_num_cea_modes; i++)
+   if (drm_mode_equal(mode, &edid_cea_modes[i]))
+   return i + 1;
+
+   return 0;
+}
+EXPORT_SYMBOL(drm_mode_cea_vic);
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index c0635b7..3538eda 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -1055,6 +1055,7 @@ extern struct drm_display_mode 
*drm_gtf_mode_complex(struct drm_device *dev,
int GTF_2C, int GTF_K, int GTF_2J);
 extern int drm_add_modes_noedid(struct drm_connector *connector,
int hdisplay, int vdisplay);
+extern uint8_t drm_mode_cea_vic(const struct drm_display_mode *mode);

 extern int drm_edid_header_is_valid(const u8 *raw_edid);
 extern bool drm_edid_block_valid(u8 *raw_edid, int block, bool print_bad_edid);
-- 
1.7.10.4



Re: [RFC v2 0/5] Common Display Framework

2012-11-23 Thread Thierry Reding
On Thu, Nov 22, 2012 at 10:45:31PM +0100, Laurent Pinchart wrote:
[...]
> Display entities are accessed by driver using notifiers. Any driver can
> register a display entity notifier with the CDF, which then calls the notifier
> when a matching display entity is registered. The reason for this asynchronous
> mode of operation, compared to how drivers acquire regulator or clock
> resources, is that the display entities can use resources provided by the
> display driver. For instance a panel can be a child of the DBI or DSI bus
> controlled by the display device, or use a clock provided by that device. We
> can't defer the display device probe until the panel is registered and also
> defer the panel device probe until the display is registered. As most display
> drivers need to handle output devices hotplug (HDMI monitors for instance),
> handling other display entities through a notification system seemed to be the
> easiest solution.
> 
> Note that this brings a different issue after registration, as display
> controller and display entity drivers would take a reference to each other.
> Those circular references would make driver unloading impossible. One possible
> solution to this problem would be to simulate an unplug event for the display
> entity, to force the display driver to release the dislay entities it uses. We
> would need a userspace API for that though. Better solutions would of course
> be welcome.

Maybe I don't understand all of the underlying issues correctly, but a
parent/child model would seem like a better solution to me. We discussed
this back when designing the DT bindings for Tegra DRM and came to the
conclusion that the output resource of the display controller (RGB,
HDMI, DSI or TVO) was the most suitable candidate to be the parent of
the panel or display attached to it. The reason for that decision was
that it keeps the flow of data or addressing of nodes consistent. So the
chain would look something like this (on Tegra):

CPU
+-host1x
  +-dc
+-rgb
| +-panel
+-hdmi
  +-monitor

In a natural way this makes the output resource the master of the panel
or display. From a programming point of view this becomes quite easy to
implement and is very similar to how other busses like I2C or SPI are
modelled. In device tree these would be represented as subnodes, while
with platform data some kind of lookup could be done like for regulators
or alternatively a board setup registration mechanism like what's in
place for I2C or SPI.

Thierry


pgpggbwaQzVkj.pgp
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Linux 3.7-rc6

2012-11-23 Thread Jani Nikula
On Thu, 22 Nov 2012, Henrik Rydberg  wrote:
>> Yeah, the utter lack of a vbt fits very nicely, thanks for checking,
>> I've merged the patch into drm-intel-fixes and will forward it for
>> inclusion into 3.7 rsn.
>
> Great, thanks. One thing about that patch: if we would ever encounter
> a non-zero edp.bpp < 3, display_bpc would not be clamped. I suppose
> monochrome screens went out of fashion twenty years ago, but who
> knows...

ATM, edp.bpp is known to be 18, 24, or 30. It's mapped from a two-bit
value in the VBT.

Glad to hear the patch works for you.

BR,
Jani.


[PATCHv14 4/7] fbmon: add videomode helpers

2012-11-23 Thread Laurent Pinchart
Hi Steffen,

On Friday 23 November 2012 10:04:24 Steffen Trumtrar wrote:
> Add a function to convert from the generic videomode to a fb_videomode.
> 
> Signed-off-by: Steffen Trumtrar 
> Reviewed-by: Thierry Reding 
> Acked-by: Thierry Reding 
> Tested-by: Thierry Reding 
> Tested-by: Philipp Zabel 
> Reviewed-by: Laurent Pinchart 
> Acked-by: Laurent Pinchart 
> ---
>  drivers/video/fbmon.c |   49 ++
>  include/linux/fb.h|6 ++
>  2 files changed, 55 insertions(+)
> 
> diff --git a/drivers/video/fbmon.c b/drivers/video/fbmon.c
> index cef6557..bcbfe8f 100644
> --- a/drivers/video/fbmon.c
> +++ b/drivers/video/fbmon.c
> @@ -31,6 +31,7 @@
>  #include 
>  #include 
>  #include 
> +#include 

You could move this one line up to keep headers sorted alphabetically 
(assuming they are in the first place).

>  #ifdef CONFIG_PPC_OF
>  #include 
>  #include 
> @@ -1373,6 +1374,54 @@ int fb_get_mode(int flags, u32 val, struct
> fb_var_screeninfo *var, struct fb_inf kfree(timings);
>   return err;
>  }
> +
> +#if IS_ENABLED(CONFIG_VIDEOMODE)
> +int fb_videomode_from_videomode(const struct videomode *vm,
> + struct fb_videomode *fbmode)

This is inside the #if CONFIG_FB_MODE_HELPERS block, is that intentional ?

> +{
> + unsigned int htotal, vtotal;
> +
> + fbmode->xres = vm->hactive;
> + fbmode->left_margin = vm->hback_porch;
> + fbmode->right_margin = vm->hfront_porch;
> + fbmode->hsync_len = vm->hsync_len;
> +
> + fbmode->yres = vm->vactive;
> + fbmode->upper_margin = vm->vback_porch;
> + fbmode->lower_margin = vm->vfront_porch;
> + fbmode->vsync_len = vm->vsync_len;
> +
> + /* prevent division by zero in KHZ2PICOS macro */
> + fbmode->pixclock = vm->pixelclock ? KHZ2PICOS(vm->pixelclock / 1000) : 
> 0;
> +
> + fbmode->sync = 0;
> + fbmode->vmode = 0;
> + if (vm->hah)
> + fbmode->sync |= FB_SYNC_HOR_HIGH_ACT;
> + if (vm->vah)
> + fbmode->sync |= FB_SYNC_VERT_HIGH_ACT;
> + if (vm->interlaced)
> + fbmode->vmode |= FB_VMODE_INTERLACED;
> + if (vm->doublescan)
> + fbmode->vmode |= FB_VMODE_DOUBLE;
> + fbmode->flag = 0;
> +
> + htotal = vm->hactive + vm->hfront_porch + vm->hback_porch +
> +  vm->hsync_len;
> + vtotal = vm->vactive + vm->vfront_porch + vm->vback_porch +
> +  vm->vsync_len;
> + /* prevent division by zero */
> + if (htotal && vtotal)
> + fbmode->refresh = vm->pixelclock / (htotal * vtotal);
> + else
> + fbmode->refresh = vm->pixelclock;

What about returning an error if htotal * vtotal == 0 ? The input is clearly 
invalid in that case. I would then set fbmode->refresh to 0, setting it to vm-
>pixelclock doesn't really make sense.

> +
> + return 0;
> +}
> +EXPORT_SYMBOL_GPL(fb_videomode_from_videomode);
> +#endif
> +
> +

A single blank line should be enough.

>  #else
>  int fb_parse_edid(unsigned char *edid, struct fb_var_screeninfo *var)
>  {
> diff --git a/include/linux/fb.h b/include/linux/fb.h
> index c7a9571..4404ec2 100644
> --- a/include/linux/fb.h
> +++ b/include/linux/fb.h
> @@ -19,6 +19,7 @@ struct vm_area_struct;
>  struct fb_info;
>  struct device;
>  struct file;
> +struct videomode;
> 
>  /* Definitions below are used in the parsed monitor specs */
>  #define FB_DPMS_ACTIVE_OFF   1
> @@ -714,6 +715,11 @@ extern void fb_destroy_modedb(struct fb_videomode
> *modedb); extern int fb_find_mode_cvt(struct fb_videomode *mode, int
> margins, int rb); extern unsigned char *fb_ddc_read(struct i2c_adapter
> *adapter);
> 
> +#if IS_ENABLED(CONFIG_VIDEOMODE)
> +extern int fb_videomode_from_videomode(const struct videomode *vm,
> +struct fb_videomode *fbmode);
> +#endif
> +
>  /* drivers/video/modedb.c */
>  #define VESA_MODEDB_SIZE 34
>  extern void fb_var_to_videomode(struct fb_videomode *mode,
-- 
Regards,

Laurent Pinchart



[PATCH] drm/i915: set the AVI VIC of the HDMI mode

2012-11-23 Thread Paulo Zanoni
Hi

2012/11/22 Thierry Reding :
> On Wed, Nov 21, 2012 at 01:39:48PM -0200, Paulo Zanoni wrote:
>> From: Paulo Zanoni 
>>
>> We currently set "0" as the VIC value of the AVI InfoFrames. According
>> to the specs this should be fine and work for every mode, so to my
>> point of view we can't consider the current behavior as a bug. The
>> problem is that  we recently received a bug report (Kernel bug #50371)
>> from a user that has an AV receiver that gives a black screen for any
>> mode with VIC set to 0.
>>
>> So in order to make at least some modes work for him, this patch sets
>> the correct VIC number when sending AVI InfoFrames. We add a generic
>> drm function to calculate the VIC number and then call it from the
>> i915 driver.
>>
>> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=50371
>> Cc: Thierry Reding 
>> Signed-off-by: Paulo Zanoni 
>> ---
>>  drivers/gpu/drm/drm_edid.c|   19 +++
>>  drivers/gpu/drm/drm_modes.c   |3 ++-
>>  drivers/gpu/drm/i915/intel_hdmi.c |2 ++
>>  include/drm/drm_crtc.h|4 +++-
>>  4 files changed, 26 insertions(+), 2 deletions(-)
>>
>> Patch applies on top of Daniel's drm-intel-next-queued. I'm not sure who 
>> exactly
>> is going to merge this (Dave or Daniel).
>>
>> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
>> index fadcd44..c57fc46 100644
>> --- a/drivers/gpu/drm/drm_edid.c
>> +++ b/drivers/gpu/drm/drm_edid.c
>> @@ -2062,3 +2062,22 @@ int drm_add_modes_noedid(struct drm_connector 
>> *connector,
>>   return num_modes;
>>  }
>>  EXPORT_SYMBOL(drm_add_modes_noedid);
>> +
>> +/**
>> + * drm_mode_vic - return the CEA-861 VIC of a given mode
>
> The name in the comment here doesn't match the actual function name.

Will fix.

>
>> + * @mode: mode
>> + *
>> + * RETURNS:
>> + * The VIC number, 0 in case it's not a CEA-861 mode.
>> + */
>> +uint8_t drm_mode_cea_vic(const struct drm_display_mode *mode)
>
> I understand the reason for returning an uint8_t here, but ...
>
>> +{
>> + uint8_t i;
>> +
>> + for (i = 0; i < drm_num_cea_modes; i++)
>
> ... maybe unsigned int would be better for the iteration variable here.
> Looking at drm_edid_modes.h, drm_num_cea_modes is actually signed, which
> isn't necessary to store an array size, so maybe that should be changed
> as well.

I used uint8_t because "i" is the thing we return. I don't think
there's a perfect solution to this problem and I don't really think it
matters too much.

>
>> + if (drm_mode_equal(mode, &edid_cea_modes[i]))
>> + return i + 1;
>> +
>> + return 0;
>> +}
>> +EXPORT_SYMBOL(drm_mode_cea_vic);
>> diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
>> index 59450f3..9ef6750 100644
>> --- a/drivers/gpu/drm/drm_modes.c
>> +++ b/drivers/gpu/drm/drm_modes.c
>> @@ -768,7 +768,8 @@ EXPORT_SYMBOL(drm_mode_duplicate);
>>   * RETURNS:
>>   * True if the modes are equal, false otherwise.
>>   */
>> -bool drm_mode_equal(struct drm_display_mode *mode1, struct drm_display_mode 
>> *mode2)
>> +bool drm_mode_equal(const struct drm_display_mode *mode1,
>> + const struct drm_display_mode *mode2)
>
> I think this change warrants a separate commit.

I just noticed Dave's tree already has these things as const. So V2
will be based on Dave's drm-next tree.

>
> Thierry



-- 
Paulo Zanoni


[PATCHv14 3/7] video: add of helper for display timings/videomode

2012-11-23 Thread Steffen Trumtrar
On Fri, Nov 23, 2012 at 03:49:37PM +0530, Leela Krishna Amudala wrote:
> Hello Steffen,
> 
> On Fri, Nov 23, 2012 at 2:34 PM, Steffen Trumtrar
>  wrote:
> > This adds support for reading display timings from DT into a struct
> > display_timings. The of_display_timing implementation supports multiple
> > subnodes. All children are read into an array, that can be queried.
> >
> > If no native mode is specified, the first subnode will be used.
> >
> > For cases, where the graphics drivers knows, there can be only one
> > mode description or where the driver only supports one mode, a helper
> > function of_get_videomode is added, that gets a struct videomode from DT.
> > (As this function is implemented in an expensive fashion, it should only
> > be used in the aforementioned case).
> >
> > This also demonstrates how of_display_timings may be utilized.
> >
> > Signed-off-by: Steffen Trumtrar 
> > Signed-off-by: Philipp Zabel 
> > Acked-by: Stephen Warren 
> > Reviewed-by: Thierry Reding 
> > Acked-by: Thierry Reding 
> > Tested-by: Thierry Reding 
> > Tested-by: Philipp Zabel 
> > Reviewed-by: Laurent Pinchart 
> > Acked-by: Laurent Pinchart 
> > ---
> >  .../devicetree/bindings/video/display-timings.txt  |  107 ++
> >  drivers/video/Kconfig  |   15 ++
> >  drivers/video/Makefile |2 +
> >  drivers/video/of_display_timing.c  |  223 
> > 
> >  drivers/video/of_videomode.c   |   48 +
> >  include/linux/of_display_timings.h |   20 ++
> >  include/linux/of_videomode.h   |   18 ++
> >  7 files changed, 433 insertions(+)
> >  create mode 100644 
> > Documentation/devicetree/bindings/video/display-timings.txt
> >  create mode 100644 drivers/video/of_display_timing.c
> >  create mode 100644 drivers/video/of_videomode.c
> >  create mode 100644 include/linux/of_display_timings.h
> >  create mode 100644 include/linux/of_videomode.h
> >
> 
> <<>>
> 
> > diff --git a/drivers/video/of_display_timing.c 
> > b/drivers/video/of_display_timing.c
> > new file mode 100644
> > index 000..645f43d
> > --- /dev/null
> > +++ b/drivers/video/of_display_timing.c
> > @@ -0,0 +1,223 @@
> > +/*
> > + * OF helpers for parsing display timings
> > + *
> > + * Copyright (c) 2012 Steffen Trumtrar , 
> > Pengutronix
> > + *
> > + * based on of_videomode.c by Sascha Hauer 
> > + *
> > + * This file is released under the GPLv2
> > + */
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +
> > +/**
> > + * parse_property - parse timing_entry from device_node
> > + * @np: device_node with the property
> > + * @name: name of the property
> > + * @result: will be set to the return value
> > + *
> > + * DESCRIPTION:
> > + * Every display_timing can be specified with either just the typical 
> > value or
> > + * a range consisting of min/typ/max. This function helps handling this
> > + **/
> > +static int parse_property(const struct device_node *np, const char *name,
> > + struct timing_entry *result)
> > +{
> > +   struct property *prop;
> > +   int length, cells, ret;
> > +
> > +   prop = of_find_property(np, name, &length);
> > +   if (!prop) {
> > +   pr_err("%s: could not find property %s\n", __func__, name);
> > +   return -EINVAL;
> > +   }
> > +
> > +   cells = length / sizeof(u32);
> > +   if (cells == 1) {
> > +   ret = of_property_read_u32(np, name, &result->typ);
> > +   result->min = result->typ;
> > +   result->max = result->typ;
> > +   } else if (cells == 3) {
> > +   ret = of_property_read_u32_array(np, name, &result->min, 
> > cells);
> > +   } else {
> > +   pr_err("%s: illegal timing specification in %s\n", __func__,
> > +   name);
> > +   return -EINVAL;
> > +   }
> > +
> > +   return ret;
> > +}
> > +
> > +/**
> > + * of_get_display_timing - parse display_timing entry from device_node
> > + * @np: device_node with the properties
> > + **/
> > +static struct display_timing *of_get_display_timing(const struct 
> > device_node
> > +   *np)
> > +{
> > +   struct display_timing *dt;
> > +   int ret = 0;
> > +
> > +   dt = kzalloc(sizeof(*dt), GFP_KERNEL);
> > +   if (!dt) {
> > +   pr_err("%s: could not allocate display_timing struct\n",
> > +   __func__);
> > +   return NULL;
> > +   }
> > +
> > +   ret |= parse_property(np, "hback-porch", &dt->hback_porch);
> > +   ret |= parse_property(np, "hfront-porch", &dt->hfront_porch);
> > +   ret |= parse_property(np, "hactive", &dt->hactive);
> > +   ret |= parse_property(np, "hsync-len", &dt->hsync_len);
> > +   ret |= parse_property(np, "vback-porch", &dt->vback_porch);
> > +   ret |= parse_property(n

[PATCH] drm: exynos: hdmi: sending AVI and AUI info frames

2012-11-23 Thread 김승우
Hi Rahul,

I think this patch is almost ready just except few trivial check.

On 2012? 11? 22? 23:12, Rahul Sharma wrote:
> This patch adds code for composing AVI and AUI info frames
> and send them every VSYNC.
> 
> This patch is important for hdmi certification.
> 
> Based on exynos-drm-fixes branch of
> git://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos.git

This comment don't need to apply, so it's better to be moved to below line.

> 
> Signed-off-by: Rahul Sharma 
> Signed-off-by: Fahad Kunnathadi 
> Signed-off-by: Shirish S 
> ---

Here.

>  drivers/gpu/drm/exynos/exynos_hdmi.c |  142 
> +-
>  drivers/gpu/drm/exynos/exynos_hdmi.h |   23 ++
>  drivers/gpu/drm/exynos/regs-hdmi.h   |   17 -
>  3 files changed, 161 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c 
> b/drivers/gpu/drm/exynos/exynos_hdmi.c
> index ee110c9..5ffedc3 100644
> --- a/drivers/gpu/drm/exynos/exynos_hdmi.c
> +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
> @@ -185,6 +185,7 @@ struct hdmi_v13_conf {
>   int height;
>   int vrefresh;
>   bool interlace;
> + int cea_video_id;
>   const u8 *hdmiphy_data;
>   const struct hdmi_v13_preset_conf *conf;
>  };
> @@ -356,15 +357,20 @@ static const struct hdmi_v13_preset_conf 
> hdmi_v13_conf_1080p60 = {
>  };
>  
>  static const struct hdmi_v13_conf hdmi_v13_confs[] = {
> - { 1280, 720, 60, false, hdmiphy_v13_conf74_25, &hdmi_v13_conf_720p60 },
> - { 1280, 720, 50, false, hdmiphy_v13_conf74_25, &hdmi_v13_conf_720p60 },
> - { 720, 480, 60, false, hdmiphy_v13_conf27_027, &hdmi_v13_conf_480p },
> - { 1920, 1080, 50, true, hdmiphy_v13_conf74_25, &hdmi_v13_conf_1080i50 },
> - { 1920, 1080, 50, false, hdmiphy_v13_conf148_5,
> -  &hdmi_v13_conf_1080p50 },
> - { 1920, 1080, 60, true, hdmiphy_v13_conf74_25, &hdmi_v13_conf_1080i60 },
> - { 1920, 1080, 60, false, hdmiphy_v13_conf148_5,
> -  &hdmi_v13_conf_1080p60 },
> + { 1280, 720, 60, false, 4, hdmiphy_v13_conf74_25,
> + &hdmi_v13_conf_720p60 },
> + { 1280, 720, 50, false, 19, hdmiphy_v13_conf74_25,
> + &hdmi_v13_conf_720p60 },
> + { 720, 480, 60, false, 3, hdmiphy_v13_conf27_027,
> + &hdmi_v13_conf_480p },
> + { 1920, 1080, 50, true, 20, hdmiphy_v13_conf74_25,
> + &hdmi_v13_conf_1080i50 },
> + { 1920, 1080, 50, false, 31, hdmiphy_v13_conf148_5,
> + &hdmi_v13_conf_1080p50 },
> + { 1920, 1080, 60, true, 5, hdmiphy_v13_conf74_25,
> + &hdmi_v13_conf_1080i60 },
> + { 1920, 1080, 60, false, 16, hdmiphy_v13_conf148_5,
> + &hdmi_v13_conf_1080p60 },
>  };
>  
>  /* HDMI Version 1.4 */
> @@ -482,6 +488,7 @@ struct hdmi_conf {
>   int height;
>   int vrefresh;
>   bool interlace;
> + int cea_video_id;
>   const u8 *hdmiphy_data;
>   const struct hdmi_preset_conf *conf;
>  };
> @@ -937,16 +944,21 @@ static const struct hdmi_preset_conf hdmi_conf_1080p60 
> = {
>  };
>  
>  static const struct hdmi_conf hdmi_confs[] = {
> - { 720, 480, 60, false, hdmiphy_conf27_027, &hdmi_conf_480p60 },
> - { 1280, 720, 50, false, hdmiphy_conf74_25, &hdmi_conf_720p50 },
> - { 1280, 720, 60, false, hdmiphy_conf74_25, &hdmi_conf_720p60 },
> - { 1920, 1080, 50, true, hdmiphy_conf74_25, &hdmi_conf_1080i50 },
> - { 1920, 1080, 60, true, hdmiphy_conf74_25, &hdmi_conf_1080i60 },
> - { 1920, 1080, 30, false, hdmiphy_conf74_176, &hdmi_conf_1080p30 },
> - { 1920, 1080, 50, false, hdmiphy_conf148_5, &hdmi_conf_1080p50 },
> - { 1920, 1080, 60, false, hdmiphy_conf148_5, &hdmi_conf_1080p60 },
> + { 720, 480, 60, false, 3, hdmiphy_conf27_027, &hdmi_conf_480p60 },
> + { 1280, 720, 50, false, 19, hdmiphy_conf74_25, &hdmi_conf_720p50 },
> + { 1280, 720, 60, false, 4, hdmiphy_conf74_25, &hdmi_conf_720p60 },
> + { 1920, 1080, 50, true, 20, hdmiphy_conf74_25, &hdmi_conf_1080i50 },
> + { 1920, 1080, 60, true, 5, hdmiphy_conf74_25, &hdmi_conf_1080i60 },
> + { 1920, 1080, 30, false, 34, hdmiphy_conf74_176, &hdmi_conf_1080p30 },
> + { 1920, 1080, 50, false, 31, hdmiphy_conf148_5, &hdmi_conf_1080p50 },
> + { 1920, 1080, 60, false, 16, hdmiphy_conf148_5, &hdmi_conf_1080p60 },
>  };
>  
> +struct hdmi_infoframe {
> + enum HDMI_PACKET_TYPE type;
> + u8 ver;
> + u8 len;
> +};
>  
>  static inline u32 hdmi_reg_read(struct hdmi_context *hdata, u32 reg_id)
>  {
> @@ -1270,6 +1282,88 @@ static int hdmi_conf_index(struct hdmi_context *hdata,
>   return hdmi_v14_conf_index(mode);
>  }
>  
> +static u8 hdmi_chksum(struct hdmi_context *hdata,
> + u32 start, u8 len, u32 hdr_sum)
> +{
> + int i;
> + /* hdr_sum : header0 + header1 + header2
> + * start : start address of packet byte1
> + * len : packet bytes - 1 */
> + f

[PATCH 1/1] drm: only build ati_pcigart if PCI enabled

2012-11-23 Thread James Hogan
Prevent ati_pcigart.c being built unless PCI is enabled. The exported
functions in this file are only used by drivers which depend on PCI
(namely r128 and radeon), and it tries to use PCI specific functions
(pci_unmap_page, pci_map_page, and pci_dma_mapping_error) that cause
compiler errors when PCI is disabled.

Signed-off-by: James Hogan 
Cc: David Airlie 
---
 drivers/gpu/drm/Makefile |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
index 2ff5cef..3e303b1b 100644
--- a/drivers/gpu/drm/Makefile
+++ b/drivers/gpu/drm/Makefile
@@ -8,7 +8,7 @@ drm-y   :=  drm_auth.o drm_buffer.o drm_bufs.o drm_cache.o \
drm_context.o drm_dma.o \
drm_drv.o drm_fops.o drm_gem.o drm_ioctl.o drm_irq.o \
drm_lock.o drm_memory.o drm_proc.o drm_stub.o drm_vm.o \
-   drm_agpsupport.o drm_scatter.o ati_pcigart.o drm_pci.o \
+   drm_agpsupport.o drm_scatter.o drm_pci.o \
drm_platform.o drm_sysfs.o drm_hashtab.o drm_mm.o \
drm_crtc.o drm_modes.o drm_edid.o \
drm_info.o drm_debugfs.o drm_encoder_slave.o \
@@ -16,6 +16,7 @@ drm-y   :=drm_auth.o drm_buffer.o drm_bufs.o 
drm_cache.o \

 drm-$(CONFIG_COMPAT) += drm_ioc32.o
 drm-$(CONFIG_DRM_GEM_CMA_HELPER) += drm_gem_cma_helper.o
+drm-$(CONFIG_PCI) += ati_pcigart.o

 drm-usb-y   := drm_usb.o

-- 
1.7.7.6




[RFC 0/2] Add HDMI helpers

2012-11-23 Thread Christian König
On 23.11.2012 10:38, Thierry Reding wrote:
> On Fri, Nov 23, 2012 at 10:24:22AM +0100, Christian K?nig wrote:
>> Hi Thierry,
>>
>> On 21.11.2012 16:01, Thierry Reding wrote:
>>> This small series is very much work in progress, but I still wanted to
>>> get feedback in this early stage to gather requirements from the folks
>>> working on the display drivers that these helpers target.
>>>
>>> Patch 1 in the series adds a generic helper to pack a structure that
>>> describes an HDMI AVI infoframe into the binary format as specified in
>>> the HDMI specification. The resulting binary buffer should be easily
>>> programmable into the HDMI controller.
>>>
>>> Patch 2 provides a helper to fill an HDMI AVI infoframe with data from
>>> a struct drm_display_mode.
>>>
>>> This is all pretty rough right now, but I think some feedback would be
>>> good at this point, to see if the design is at all sensible. I should
>>> also mention that I haven't actually tested this on real hardware yet.
>>> Furthermore I have plans to add something similar for the other types
>>> of infoframes specified by HDMI once the direction becomes clearer.
>> In general I like the idea of storing the informations in a C struct
>> and only packing it into the binary form when needed.
>>
>> I would rather like to see a complete implementation of all the
>> interesting HDMI packets, including the necessary
>> calculations/tables for audio timing recovery etc before it gets
>> committed upstream.
> I'm afraid I'm not very familiar with those packets. Also I haven't seen
> any actual users of audio timing recovery packets so far, so I'm not
> sure that adding support for them would be very useful.

Take a look at: drivers/gpu/drm/radeon/r600_hdmi.c There we have 
r600_hdmi_predefined_acr, r600_hdmi_calc_cts and r600_hdmi_acr doing the 
audio clock recovery calculation/table manually. Those values are only 
used as fallback, since the hardware can do the calculation on their own.

I'm not sure if anybody else is doing this calculation in any driver 
code, but it definitely isn't driver specific and part of the HDMI 
specification, so I would say that it belongs into the general purpose 
file as well.

> What I have added so far is support for audio and vendor-specific
> infoframes, since those have actual users. I also noticed that i915
> implements SPD infoframes as well, so I can extract that code into the
> generic helpers as well.
>
>> Not sure about the separate configuration option. I'm not so much
>> into the config/build system of linux (I know that it is rather
>> complicated), but in general I would like to see that activated
>> automatically as soon as any driver starts using it (or at least the
>> driver depending on that option to be active).
> The configuration option isn't supposed to be user visible. Drivers that
> make use of this are supposed to select HDMI or DRM_HDMI to cause the
> generic code to be pulled in.
>
>> Also two notes about the code in itself:
>> 1. hdmi_avi_infoframe_pack: gets the size of the target buffer, but
>> unfortunately doesn't checks it.
> That should already be fixed in the latest code in my local working
> branch.
>
>> 2. Separate the CRC calculation, we probably need that more than once.
> I've also pulled that out into a separate function. I haven't made it a
> public function yet, but I don't think that'll be necessary either since
> it is used internally by the various infoframe packing functions.
>

Sounds good, let me know when you need a review of the code.

Christian.


[RFC 0/2] Add HDMI helpers

2012-11-23 Thread Rafał Miłecki
2012/11/23 Christian K?nig :
> Hi Thierry,
>
>
> On 21.11.2012 16:01, Thierry Reding wrote:
>>
>> This small series is very much work in progress, but I still wanted to
>> get feedback in this early stage to gather requirements from the folks
>> working on the display drivers that these helpers target.
>>
>> Patch 1 in the series adds a generic helper to pack a structure that
>> describes an HDMI AVI infoframe into the binary format as specified in
>> the HDMI specification. The resulting binary buffer should be easily
>> programmable into the HDMI controller.
>>
>> Patch 2 provides a helper to fill an HDMI AVI infoframe with data from
>> a struct drm_display_mode.
>>
>> This is all pretty rough right now, but I think some feedback would be
>> good at this point, to see if the design is at all sensible. I should
>> also mention that I haven't actually tested this on real hardware yet.
>> Furthermore I have plans to add something similar for the other types
>> of infoframes specified by HDMI once the direction becomes clearer.
>
> In general I like the idea of storing the informations in a C struct and
> only packing it into the binary form when needed.
>
> I would rather like to see a complete implementation of all the interesting
> HDMI packets, including the necessary calculations/tables for audio timing
> recovery etc before it gets committed upstream.
>
> Not sure about the separate configuration option. I'm not so much into the
> config/build system of linux (I know that it is rather complicated), but in
> general I would like to see that activated automatically as soon as any
> driver starts using it (or at least the driver depending on that option to
> be active).

It's rather trivial ;) You just use "select FOO_BAR".

-- 
Rafa?


[RFC 0/2] Add HDMI helpers

2012-11-23 Thread Thierry Reding
On Fri, Nov 23, 2012 at 10:24:22AM +0100, Christian K?nig wrote:
> Hi Thierry,
> 
> On 21.11.2012 16:01, Thierry Reding wrote:
> >This small series is very much work in progress, but I still wanted to
> >get feedback in this early stage to gather requirements from the folks
> >working on the display drivers that these helpers target.
> >
> >Patch 1 in the series adds a generic helper to pack a structure that
> >describes an HDMI AVI infoframe into the binary format as specified in
> >the HDMI specification. The resulting binary buffer should be easily
> >programmable into the HDMI controller.
> >
> >Patch 2 provides a helper to fill an HDMI AVI infoframe with data from
> >a struct drm_display_mode.
> >
> >This is all pretty rough right now, but I think some feedback would be
> >good at this point, to see if the design is at all sensible. I should
> >also mention that I haven't actually tested this on real hardware yet.
> >Furthermore I have plans to add something similar for the other types
> >of infoframes specified by HDMI once the direction becomes clearer.
> In general I like the idea of storing the informations in a C struct
> and only packing it into the binary form when needed.
> 
> I would rather like to see a complete implementation of all the
> interesting HDMI packets, including the necessary
> calculations/tables for audio timing recovery etc before it gets
> committed upstream.

I'm afraid I'm not very familiar with those packets. Also I haven't seen
any actual users of audio timing recovery packets so far, so I'm not
sure that adding support for them would be very useful.

What I have added so far is support for audio and vendor-specific
infoframes, since those have actual users. I also noticed that i915
implements SPD infoframes as well, so I can extract that code into the
generic helpers as well.

> Not sure about the separate configuration option. I'm not so much
> into the config/build system of linux (I know that it is rather
> complicated), but in general I would like to see that activated
> automatically as soon as any driver starts using it (or at least the
> driver depending on that option to be active).

The configuration option isn't supposed to be user visible. Drivers that
make use of this are supposed to select HDMI or DRM_HDMI to cause the
generic code to be pulled in.

> Also two notes about the code in itself:
> 1. hdmi_avi_infoframe_pack: gets the size of the target buffer, but
> unfortunately doesn't checks it.

That should already be fixed in the latest code in my local working
branch.

> 2. Separate the CRC calculation, we probably need that more than once.

I've also pulled that out into a separate function. I haven't made it a
public function yet, but I don't think that'll be necessary either since
it is used internally by the various infoframe packing functions.

Thierry
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20121123/b4a9834e/attachment.pgp>


[Bug 16140] [RADEON:KMS:RV250:RESUME] suspend to RAM resume broken

2012-11-23 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=16140





--- Comment #49 from Sedat Dilek   2012-11-23 18:33:14 
---
Just FYI: There is now an upstream fix (see [1]).

commit 45171002b01b2e2ec4f991eca81ffd8430fd0aec
"radeon: add AGPMode 1 quirk for RV250"

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=commit;h=45171002b01b2e2ec4f991eca81ffd8430fd0aec

- Sedat -

-- 
Configure bugmail: https://bugzilla.kernel.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are watching the assignee of the bug.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 42627] Hibernation fails to resume - Toshiba Satellite L755-161 notebook

2012-11-23 Thread bugzilla-dae...@bugzilla.kernel.org
https://bugzilla.kernel.org/show_bug.cgi?id=42627





--- Comment #24 from Harald Brennich   2012-11-23 
10:30:38 ---
As suspend/resume bugs do not seem to be in focus of nouveau-developers I have
decided to replace nouveau by the current nvidia driver (310.19). With this
driver, both s2ram and s2disk work. Hopefully in the future also a working
nouveau is available.
See also bug #45981

-- 
Configure bugmail: https://bugzilla.kernel.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are watching the assignee of the bug.


[RFC 0/2] Add HDMI helpers

2012-11-23 Thread Christian König
Hi Thierry,

On 21.11.2012 16:01, Thierry Reding wrote:
> This small series is very much work in progress, but I still wanted to
> get feedback in this early stage to gather requirements from the folks
> working on the display drivers that these helpers target.
>
> Patch 1 in the series adds a generic helper to pack a structure that
> describes an HDMI AVI infoframe into the binary format as specified in
> the HDMI specification. The resulting binary buffer should be easily
> programmable into the HDMI controller.
>
> Patch 2 provides a helper to fill an HDMI AVI infoframe with data from
> a struct drm_display_mode.
>
> This is all pretty rough right now, but I think some feedback would be
> good at this point, to see if the design is at all sensible. I should
> also mention that I haven't actually tested this on real hardware yet.
> Furthermore I have plans to add something similar for the other types
> of infoframes specified by HDMI once the direction becomes clearer.
In general I like the idea of storing the informations in a C struct and 
only packing it into the binary form when needed.

I would rather like to see a complete implementation of all the 
interesting HDMI packets, including the necessary calculations/tables 
for audio timing recovery etc before it gets committed upstream.

Not sure about the separate configuration option. I'm not so much into 
the config/build system of linux (I know that it is rather complicated), 
but in general I would like to see that activated automatically as soon 
as any driver starts using it (or at least the driver depending on that 
option to be active).

Also two notes about the code in itself:
1. hdmi_avi_infoframe_pack: gets the size of the target buffer, but 
unfortunately doesn't checks it.
2. Separate the CRC calculation, we probably need that more than once.

Thanks for looking into that, keep up with the work.

Cheers,
Christian.


[PATCH] drm: tegra: Use framebuffer pitch as line stride

2012-11-23 Thread Terje Bergström
On 22.11.2012 21:37, Thierry Reding wrote:
> Instead of using the stride derived from the display mode, use the pitch
> associated with the currently active framebuffer. This fixes a bug where
> the LCD display content would be skewed when enabling HDMI with a video
> mode different from that of the LCD.
> 
> Signed-off-by: Thierry Reding 

Hi,

I tested and verified that this fixes our stride problem. Thanks!

Tested-by: Terje Bergstrom 



[PATCH] drm/omap: Fix usage of IS_ERR_OR_NULL and PTR_ERR

2012-11-23 Thread Jani Nikula
On Tue, 13 Nov 2012, Andy Gross  wrote:
> Return PTR_ERR(-ENOMEM) if dmm_txn_init cannot allocate a
> refill engine.
>
> Signed-off-by: Andy Gross 
> ---
>  drivers/staging/omapdrm/omap_dmm_tiler.c |2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/staging/omapdrm/omap_dmm_tiler.c 
> b/drivers/staging/omapdrm/omap_dmm_tiler.c
> index 3ae3955..1a5a7ca 100644
> --- a/drivers/staging/omapdrm/omap_dmm_tiler.c
> +++ b/drivers/staging/omapdrm/omap_dmm_tiler.c
> @@ -279,7 +279,7 @@ static int fill(struct tcm_area *area, struct page 
> **pages,
>  
>   txn = dmm_txn_init(omap_dmm, area->tcm);
>   if (IS_ERR_OR_NULL(txn))
> - return PTR_ERR(txn);
> + return PTR_ERR(-ENOMEM);

return -ENOMEM;

BR,
Jani.

>  
>   tcm_for_each_slice(slice, *area, area_s) {
>   struct pat_area p_area = {
> -- 
> 1.7.5.4
>
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCHv14 7/7] drm_modes: add of_videomode helpers

2012-11-23 Thread Steffen Trumtrar
Add helper to get drm_display_mode from devicetree.

Signed-off-by: Steffen Trumtrar 
Reviewed-by: Thierry Reding 
Acked-by: Thierry Reding 
Tested-by: Thierry Reding 
Tested-by: Philipp Zabel 
Reviewed-by: Laurent Pinchart 
Acked-by: Laurent Pinchart 
---
 drivers/gpu/drm/drm_modes.c |   34 +-
 include/drm/drmP.h  |6 ++
 2 files changed, 39 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
index 0073b27..2d6edfa 100644
--- a/drivers/gpu/drm/drm_modes.c
+++ b/drivers/gpu/drm/drm_modes.c
@@ -35,7 +35,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 

 /**
  * drm_mode_debug_printmodeline - debug print a mode
@@ -541,6 +541,38 @@ int drm_display_mode_from_videomode(const struct videomode 
*vm,
 EXPORT_SYMBOL_GPL(drm_display_mode_from_videomode);
 #endif

+#if IS_ENABLED(CONFIG_OF_VIDEOMODE)
+/**
+ * of_get_drm_display_mode - get a drm_display_mode from devicetree
+ * @np: device_node with the timing specification
+ * @dmode: will be set to the return value
+ * @index: index into the list of display timings in devicetree
+ *
+ * This function is expensive and should only be used, if only one mode is to 
be
+ * read from DT. To get multiple modes start with of_get_display_timings and
+ * work with that instead.
+ */
+int of_get_drm_display_mode(struct device_node *np,
+   struct drm_display_mode *dmode, unsigned int index)
+{
+   struct videomode vm;
+   int ret;
+
+   ret = of_get_videomode(np, &vm, index);
+   if (ret)
+   return ret;
+
+   drm_display_mode_from_videomode(&vm, dmode);
+
+   pr_info("%s: got %dx%d display mode from %s\n", __func__, vm.hactive,
+   vm.vactive, np->name);
+   drm_mode_debug_printmodeline(dmode);
+
+   return 0;
+}
+EXPORT_SYMBOL_GPL(of_get_drm_display_mode);
+#endif
+
 /**
  * drm_mode_set_name - set the name on a mode
  * @mode: name will be set in this mode
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 3d0ccaa..84ecabd 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -86,6 +86,7 @@ struct drm_file;
 struct drm_device;

 struct videomode;
+struct device_node;
 #include 
 #include 
 #include 
@@ -1459,6 +1460,11 @@ drm_mode_create_from_cmdline_mode(struct drm_device *dev,
 extern int drm_display_mode_from_videomode(const struct videomode *vm,
   struct drm_display_mode *dmode);
 #endif
+#if IS_ENABLED(CONFIG_OF_VIDEOMODE)
+extern int of_get_drm_display_mode(struct device_node *np,
+  struct drm_display_mode *dmode,
+  unsigned int index);
+#endif

 /* Modesetting support */
 extern void drm_vblank_pre_modeset(struct drm_device *dev, int crtc);
-- 
1.7.10.4



[PATCHv14 6/7] drm_modes: add videomode helpers

2012-11-23 Thread Steffen Trumtrar
Add conversion from videomode to drm_display_mode

Signed-off-by: Steffen Trumtrar 
Reviewed-by: Thierry Reding 
Acked-by: Thierry Reding 
Tested-by: Thierry Reding 
Tested-by: Philipp Zabel 
Reviewed-by: Laurent Pinchart 
Acked-by: Laurent Pinchart 
---
 drivers/gpu/drm/drm_modes.c |   37 +
 include/drm/drmP.h  |6 ++
 2 files changed, 43 insertions(+)

diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
index 59450f3..0073b27 100644
--- a/drivers/gpu/drm/drm_modes.c
+++ b/drivers/gpu/drm/drm_modes.c
@@ -35,6 +35,7 @@
 #include 
 #include 
 #include 
+#include 

 /**
  * drm_mode_debug_printmodeline - debug print a mode
@@ -504,6 +505,42 @@ drm_gtf_mode(struct drm_device *dev, int hdisplay, int 
vdisplay, int vrefresh,
 }
 EXPORT_SYMBOL(drm_gtf_mode);

+#if IS_ENABLED(CONFIG_VIDEOMODE)
+int drm_display_mode_from_videomode(const struct videomode *vm,
+   struct drm_display_mode *dmode)
+{
+   dmode->hdisplay = vm->hactive;
+   dmode->hsync_start = dmode->hdisplay + vm->hfront_porch;
+   dmode->hsync_end = dmode->hsync_start + vm->hsync_len;
+   dmode->htotal = dmode->hsync_end + vm->hback_porch;
+
+   dmode->vdisplay = vm->vactive;
+   dmode->vsync_start = dmode->vdisplay + vm->vfront_porch;
+   dmode->vsync_end = dmode->vsync_start + vm->vsync_len;
+   dmode->vtotal = dmode->vsync_end + vm->vback_porch;
+
+   dmode->clock = vm->pixelclock / 1000;
+
+   dmode->flags = 0;
+   if (vm->hah)
+   dmode->flags |= DRM_MODE_FLAG_PHSYNC;
+   else
+   dmode->flags |= DRM_MODE_FLAG_NHSYNC;
+   if (vm->vah)
+   dmode->flags |= DRM_MODE_FLAG_PVSYNC;
+   else
+   dmode->flags |= DRM_MODE_FLAG_NVSYNC;
+   if (vm->interlaced)
+   dmode->flags |= DRM_MODE_FLAG_INTERLACE;
+   if (vm->doublescan)
+   dmode->flags |= DRM_MODE_FLAG_DBLSCAN;
+   drm_mode_set_name(dmode);
+
+   return 0;
+}
+EXPORT_SYMBOL_GPL(drm_display_mode_from_videomode);
+#endif
+
 /**
  * drm_mode_set_name - set the name on a mode
  * @mode: name will be set in this mode
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 3fd8280..3d0ccaa 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -85,6 +85,7 @@ struct module;
 struct drm_file;
 struct drm_device;

+struct videomode;
 #include 
 #include 
 #include 
@@ -1454,6 +1455,11 @@ extern struct drm_display_mode *
 drm_mode_create_from_cmdline_mode(struct drm_device *dev,
  struct drm_cmdline_mode *cmd);

+#if IS_ENABLED(CONFIG_VIDEOMODE)
+extern int drm_display_mode_from_videomode(const struct videomode *vm,
+  struct drm_display_mode *dmode);
+#endif
+
 /* Modesetting support */
 extern void drm_vblank_pre_modeset(struct drm_device *dev, int crtc);
 extern void drm_vblank_post_modeset(struct drm_device *dev, int crtc);
-- 
1.7.10.4



[PATCHv14 5/7] fbmon: add of_videomode helpers

2012-11-23 Thread Steffen Trumtrar
Add helper to get fb_videomode from devicetree.

Signed-off-by: Steffen Trumtrar 
Reviewed-by: Thierry Reding 
Acked-by: Thierry Reding 
Tested-by: Thierry Reding 
Tested-by: Philipp Zabel 
Reviewed-by: Laurent Pinchart 
Acked-by: Laurent Pinchart 
---
 drivers/video/fbmon.c |   42 +-
 include/linux/fb.h|6 ++
 2 files changed, 47 insertions(+), 1 deletion(-)

diff --git a/drivers/video/fbmon.c b/drivers/video/fbmon.c
index bcbfe8f..287e66b 100644
--- a/drivers/video/fbmon.c
+++ b/drivers/video/fbmon.c
@@ -31,7 +31,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #ifdef CONFIG_PPC_OF
 #include 
 #include 
@@ -1421,6 +1421,46 @@ int fb_videomode_from_videomode(const struct videomode 
*vm,
 EXPORT_SYMBOL_GPL(fb_videomode_from_videomode);
 #endif

+#if IS_ENABLED(CONFIG_OF_VIDEOMODE)
+static inline void dump_fb_videomode(const struct fb_videomode *m)
+{
+   pr_debug("fb_videomode = %ux%u@%uHz (%ukHz) %u %u %u %u %u %u %u %u 
%u\n",
+m->xres, m->yres, m->refresh, m->pixclock, m->left_margin,
+m->right_margin, m->upper_margin, m->lower_margin,
+m->hsync_len, m->vsync_len, m->sync, m->vmode, m->flag);
+}
+
+/**
+ * of_get_fb_videomode - get a fb_videomode from devicetree
+ * @np: device_node with the timing specification
+ * @fb: will be set to the return value
+ * @index: index into the list of display timings in devicetree
+ *
+ * DESCRIPTION:
+ * This function is expensive and should only be used, if only one mode is to 
be
+ * read from DT. To get multiple modes start with of_get_display_timings ond
+ * work with that instead.
+ */
+int of_get_fb_videomode(struct device_node *np, struct fb_videomode *fb,
+   unsigned int index)
+{
+   struct videomode vm;
+   int ret;
+
+   ret = of_get_videomode(np, &vm, index);
+   if (ret)
+   return ret;
+
+   fb_videomode_from_videomode(&vm, fb);
+
+   pr_info("%s: got %dx%d display mode from %s\n", __func__, vm.hactive,
+   vm.vactive, np->name);
+   dump_fb_videomode(fb);
+
+   return 0;
+}
+EXPORT_SYMBOL_GPL(of_get_fb_videomode);
+#endif

 #else
 int fb_parse_edid(unsigned char *edid, struct fb_var_screeninfo *var)
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 4404ec2..7e1c8cf 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -20,6 +20,7 @@ struct fb_info;
 struct device;
 struct file;
 struct videomode;
+struct device_node;

 /* Definitions below are used in the parsed monitor specs */
 #define FB_DPMS_ACTIVE_OFF 1
@@ -715,6 +716,11 @@ extern void fb_destroy_modedb(struct fb_videomode *modedb);
 extern int fb_find_mode_cvt(struct fb_videomode *mode, int margins, int rb);
 extern unsigned char *fb_ddc_read(struct i2c_adapter *adapter);

+#if IS_ENABLED(CONFIG_OF_VIDEOMODE)
+extern int of_get_fb_videomode(struct device_node *np,
+  struct fb_videomode *fb,
+  unsigned int index);
+#endif
 #if IS_ENABLED(CONFIG_VIDEOMODE)
 extern int fb_videomode_from_videomode(const struct videomode *vm,
   struct fb_videomode *fbmode);
-- 
1.7.10.4



[PATCHv14 4/7] fbmon: add videomode helpers

2012-11-23 Thread Steffen Trumtrar
Add a function to convert from the generic videomode to a fb_videomode.

Signed-off-by: Steffen Trumtrar 
Reviewed-by: Thierry Reding 
Acked-by: Thierry Reding 
Tested-by: Thierry Reding 
Tested-by: Philipp Zabel 
Reviewed-by: Laurent Pinchart 
Acked-by: Laurent Pinchart 
---
 drivers/video/fbmon.c |   49 +
 include/linux/fb.h|6 ++
 2 files changed, 55 insertions(+)

diff --git a/drivers/video/fbmon.c b/drivers/video/fbmon.c
index cef6557..bcbfe8f 100644
--- a/drivers/video/fbmon.c
+++ b/drivers/video/fbmon.c
@@ -31,6 +31,7 @@
 #include 
 #include 
 #include 
+#include 
 #ifdef CONFIG_PPC_OF
 #include 
 #include 
@@ -1373,6 +1374,54 @@ int fb_get_mode(int flags, u32 val, struct 
fb_var_screeninfo *var, struct fb_inf
kfree(timings);
return err;
 }
+
+#if IS_ENABLED(CONFIG_VIDEOMODE)
+int fb_videomode_from_videomode(const struct videomode *vm,
+   struct fb_videomode *fbmode)
+{
+   unsigned int htotal, vtotal;
+
+   fbmode->xres = vm->hactive;
+   fbmode->left_margin = vm->hback_porch;
+   fbmode->right_margin = vm->hfront_porch;
+   fbmode->hsync_len = vm->hsync_len;
+
+   fbmode->yres = vm->vactive;
+   fbmode->upper_margin = vm->vback_porch;
+   fbmode->lower_margin = vm->vfront_porch;
+   fbmode->vsync_len = vm->vsync_len;
+
+   /* prevent division by zero in KHZ2PICOS macro */
+   fbmode->pixclock = vm->pixelclock ? KHZ2PICOS(vm->pixelclock / 1000) : 
0;
+
+   fbmode->sync = 0;
+   fbmode->vmode = 0;
+   if (vm->hah)
+   fbmode->sync |= FB_SYNC_HOR_HIGH_ACT;
+   if (vm->vah)
+   fbmode->sync |= FB_SYNC_VERT_HIGH_ACT;
+   if (vm->interlaced)
+   fbmode->vmode |= FB_VMODE_INTERLACED;
+   if (vm->doublescan)
+   fbmode->vmode |= FB_VMODE_DOUBLE;
+   fbmode->flag = 0;
+
+   htotal = vm->hactive + vm->hfront_porch + vm->hback_porch +
+vm->hsync_len;
+   vtotal = vm->vactive + vm->vfront_porch + vm->vback_porch +
+vm->vsync_len;
+   /* prevent division by zero */
+   if (htotal && vtotal)
+   fbmode->refresh = vm->pixelclock / (htotal * vtotal);
+   else
+   fbmode->refresh = vm->pixelclock;
+
+   return 0;
+}
+EXPORT_SYMBOL_GPL(fb_videomode_from_videomode);
+#endif
+
+
 #else
 int fb_parse_edid(unsigned char *edid, struct fb_var_screeninfo *var)
 {
diff --git a/include/linux/fb.h b/include/linux/fb.h
index c7a9571..4404ec2 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -19,6 +19,7 @@ struct vm_area_struct;
 struct fb_info;
 struct device;
 struct file;
+struct videomode;

 /* Definitions below are used in the parsed monitor specs */
 #define FB_DPMS_ACTIVE_OFF 1
@@ -714,6 +715,11 @@ extern void fb_destroy_modedb(struct fb_videomode *modedb);
 extern int fb_find_mode_cvt(struct fb_videomode *mode, int margins, int rb);
 extern unsigned char *fb_ddc_read(struct i2c_adapter *adapter);

+#if IS_ENABLED(CONFIG_VIDEOMODE)
+extern int fb_videomode_from_videomode(const struct videomode *vm,
+  struct fb_videomode *fbmode);
+#endif
+
 /* drivers/video/modedb.c */
 #define VESA_MODEDB_SIZE 34
 extern void fb_var_to_videomode(struct fb_videomode *mode,
-- 
1.7.10.4



[PATCHv14 3/7] video: add of helper for display timings/videomode

2012-11-23 Thread Steffen Trumtrar
This adds support for reading display timings from DT into a struct
display_timings. The of_display_timing implementation supports multiple
subnodes. All children are read into an array, that can be queried.

If no native mode is specified, the first subnode will be used.

For cases, where the graphics drivers knows, there can be only one
mode description or where the driver only supports one mode, a helper
function of_get_videomode is added, that gets a struct videomode from DT.
(As this function is implemented in an expensive fashion, it should only
be used in the aforementioned case).

This also demonstrates how of_display_timings may be utilized.

Signed-off-by: Steffen Trumtrar 
Signed-off-by: Philipp Zabel 
Acked-by: Stephen Warren 
Reviewed-by: Thierry Reding 
Acked-by: Thierry Reding 
Tested-by: Thierry Reding 
Tested-by: Philipp Zabel 
Reviewed-by: Laurent Pinchart 
Acked-by: Laurent Pinchart 
---
 .../devicetree/bindings/video/display-timings.txt  |  107 ++
 drivers/video/Kconfig  |   15 ++
 drivers/video/Makefile |2 +
 drivers/video/of_display_timing.c  |  223 
 drivers/video/of_videomode.c   |   48 +
 include/linux/of_display_timings.h |   20 ++
 include/linux/of_videomode.h   |   18 ++
 7 files changed, 433 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/video/display-timings.txt
 create mode 100644 drivers/video/of_display_timing.c
 create mode 100644 drivers/video/of_videomode.c
 create mode 100644 include/linux/of_display_timings.h
 create mode 100644 include/linux/of_videomode.h

diff --git a/Documentation/devicetree/bindings/video/display-timings.txt 
b/Documentation/devicetree/bindings/video/display-timings.txt
new file mode 100644
index 000..2b25d58
--- /dev/null
+++ b/Documentation/devicetree/bindings/video/display-timings.txt
@@ -0,0 +1,107 @@
+display-timings bindings
+
+
+display-timings node
+
+
+required properties:
+ - none
+
+optional properties:
+ - native-mode: The native mode for the display, in case multiple modes are
+   provided. When omitted, assume the first node is the native.
+
+timings subnode
+---
+
+required properties:
+ - hactive, vactive: Display resolution
+ - hfront-porch, hback-porch, hsync-len: Horizontal Display timing parameters
+   in pixels
+   vfront-porch, vback-porch, vsync-len: Vertical display timing parameters in
+   lines
+ - clock-frequency: display clock in Hz
+
+optional properties:
+ - hsync-active: Hsync pulse is active low/high/ignored
+ - vsync-active: Vsync pulse is active low/high/ignored
+ - de-active: Data-Enable pulse is active low/high/ignored
+ - pixelclk-inverted: pixelclock is inverted (active on falling edge)/
+   non-inverted (active on rising edge)/
+ignored (ignore property)
+ - interlaced (bool): boolean to enable interlaced mode
+ - doublescan (bool): boolean to enable doublescan mode
+ - doubleclk (bool)
+
+All the optional properties that are not bool follow the following logic:
+<1>: high active
+<0>: low active
+omitted: not used on hardware
+
+There are different ways of describing the capabilities of a display. The 
devicetree
+representation corresponds to the one commonly found in datasheets for 
displays.
+If a display supports multiple signal timings, the native-mode can be 
specified.
+
+The parameters are defined as
+
+  +--+-+--+---+
+  |  |?|  |   |
+  |  ||vback_porch |  |   |
+  |  |?|  |   |
+  +--###--+---+
+  |  #?#  |   |
+  |  #|#  |   |
+  |  hback   #|#  hfront  | hsync |
+  |   porch  #|   hactive  #  porch   |  len  |
+  |<>#<---+--->#<>|<->|
+  |  #|#  |   |
+  |  #|vactive #  |   |
+  |  #|#  |   |
+  |  #?#  |   |
+  +--###--+---+
+  |  |?|  |   |
+  |  ||vfront_porch|  |   |
+  |  |  

[PATCHv14 2/7] video: add display_timing and videomode

2012-11-23 Thread Steffen Trumtrar
Add display_timing structure and the according helper functions. This allows
the description of a display via its supported timing parameters.

Also, add helper functions to convert from display timings to a generic 
videomode
structure.

The struct display_timing specifies all needed parameters to describe the signal
properties of a display in one mode. This includes
- ranges for signals that may have min-, max- and typical values
- single integers for signals that can be on, off or are ignored
- booleans for signals that are either on or off

As a display may support multiple modes like this, a struct display_timings is
added, that holds all given struct display_timing pointers and declares the
native mode of the display.

Although a display may state that a signal can be in a range, it is driven with
fixed values that indicate a videomode. Therefore graphic drivers don't need all
the information of struct display_timing, but would generate a videomode from
the given set of supported signal timings and work with that.

The video subsystems all define their own structs that describe a mode and work
with that (e.g. fb_videomode or drm_display_mode). To slowly replace all those
various structures and allow code reuse across those subsystems, add struct
videomode as a generic description.

This patch only includes the most basic fields in struct videomode. All missing
fields that are needed to have a really generic video mode description can be
added at a later stage.

Signed-off-by: Steffen Trumtrar 
Reviewed-by: Thierry Reding 
Acked-by: Thierry Reding 
Tested-by: Thierry Reding 
Tested-by: Philipp Zabel 
Reviewed-by: Laurent Pinchart 
Acked-by: Laurent Pinchart 
---
 drivers/video/Kconfig  |6 +++
 drivers/video/Makefile |2 +
 drivers/video/display_timing.c |   24 ++
 drivers/video/videomode.c  |   45 +
 include/linux/display_timing.h |  104 
 include/linux/videomode.h  |   52 
 6 files changed, 233 insertions(+)
 create mode 100644 drivers/video/display_timing.c
 create mode 100644 drivers/video/videomode.c
 create mode 100644 include/linux/display_timing.h
 create mode 100644 include/linux/videomode.h

diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index d08d799..2a23b18 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -33,6 +33,12 @@ config VIDEO_OUTPUT_CONTROL
  This framework adds support for low-level control of the video 
  output switch.

+config DISPLAY_TIMING
+   bool
+
+config VIDEOMODE
+   bool
+
 menuconfig FB
tristate "Support for frame buffer devices"
---help---
diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index 23e948e..fc30439 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -167,3 +167,5 @@ obj-$(CONFIG_FB_VIRTUAL)  += vfb.o

 #video output switch sysfs driver
 obj-$(CONFIG_VIDEO_OUTPUT_CONTROL) += output.o
+obj-$(CONFIG_DISPLAY_TIMING) += display_timing.o
+obj-$(CONFIG_VIDEOMODE) += videomode.o
diff --git a/drivers/video/display_timing.c b/drivers/video/display_timing.c
new file mode 100644
index 000..ac9bbbc
--- /dev/null
+++ b/drivers/video/display_timing.c
@@ -0,0 +1,24 @@
+/*
+ * generic display timing functions
+ *
+ * Copyright (c) 2012 Steffen Trumtrar , 
Pengutronix
+ *
+ * This file is released under the GPLv2
+ */
+
+#include 
+#include 
+#include 
+
+void display_timings_release(struct display_timings *disp)
+{
+   if (disp->timings) {
+   unsigned int i;
+
+   for (i = 0; i < disp->num_timings; i++)
+   kfree(disp->timings[i]);
+   kfree(disp->timings);
+   }
+   kfree(disp);
+}
+EXPORT_SYMBOL_GPL(display_timings_release);
diff --git a/drivers/video/videomode.c b/drivers/video/videomode.c
new file mode 100644
index 000..86a8558
--- /dev/null
+++ b/drivers/video/videomode.c
@@ -0,0 +1,45 @@
+/*
+ * generic display timing functions
+ *
+ * Copyright (c) 2012 Steffen Trumtrar , 
Pengutronix
+ *
+ * This file is released under the GPLv2
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+int videomode_from_timing(const struct display_timings *disp,
+ struct videomode *vm, unsigned int index)
+{
+   struct display_timing *dt;
+
+   dt = display_timings_get(disp, index);
+   if (!dt)
+   return -EINVAL;
+
+   vm->pixelclock = display_timing_get_value(&dt->pixelclock, TE_TYP);
+   vm->hactive = display_timing_get_value(&dt->hactive, TE_TYP);
+   vm->hfront_porch = display_timing_get_value(&dt->hfront_porch, TE_TYP);
+   vm->hback_porch = display_timing_get_value(&dt->hback_porch, TE_TYP);
+   vm->hsync_len = display_timing_get_value(&dt->hsync_len, TE_TYP);
+
+   vm->vactive = display_timing_get_value(&dt->vactive, TE_TYP);
+   vm->vfront_porch = display_timing_get_value(&d

[PATCHv14 1/7] viafb: rename display_timing to via_display_timing

2012-11-23 Thread Steffen Trumtrar
The struct display_timing is specific to the via subsystem. The naming leads to
collisions with the new struct display_timing, that is supposed to be a shared
struct between different subsystems.
To clean this up, prepend the existing struct with the subsystem it is specific
to.

Signed-off-by: Steffen Trumtrar 
---
 drivers/video/via/hw.c  |6 +++---
 drivers/video/via/hw.h  |2 +-
 drivers/video/via/lcd.c |2 +-
 drivers/video/via/share.h   |2 +-
 drivers/video/via/via_modesetting.c |8 
 drivers/video/via/via_modesetting.h |6 +++---
 6 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/drivers/video/via/hw.c b/drivers/video/via/hw.c
index 898590d..5563c67 100644
--- a/drivers/video/via/hw.c
+++ b/drivers/video/via/hw.c
@@ -1467,10 +1467,10 @@ void viafb_set_vclock(u32 clk, int set_iga)
via_write_misc_reg_mask(0x0C, 0x0C); /* select external clock */
 }

-struct display_timing var_to_timing(const struct fb_var_screeninfo *var,
+struct via_display_timing var_to_timing(const struct fb_var_screeninfo *var,
u16 cxres, u16 cyres)
 {
-   struct display_timing timing;
+   struct via_display_timing timing;
u16 dx = (var->xres - cxres) / 2, dy = (var->yres - cyres) / 2;

timing.hor_addr = cxres;
@@ -1491,7 +1491,7 @@ struct display_timing var_to_timing(const struct 
fb_var_screeninfo *var,
 void viafb_fill_crtc_timing(const struct fb_var_screeninfo *var,
u16 cxres, u16 cyres, int iga)
 {
-   struct display_timing crt_reg = var_to_timing(var,
+   struct via_display_timing crt_reg = var_to_timing(var,
cxres ? cxres : var->xres, cyres ? cyres : var->yres);

if (iga == IGA1)
diff --git a/drivers/video/via/hw.h b/drivers/video/via/hw.h
index 6be243c..c3f2572 100644
--- a/drivers/video/via/hw.h
+++ b/drivers/video/via/hw.h
@@ -637,7 +637,7 @@ extern int viafb_LCD_ON;
 extern int viafb_DVI_ON;
 extern int viafb_hotplug;

-struct display_timing var_to_timing(const struct fb_var_screeninfo *var,
+struct via_display_timing var_to_timing(const struct fb_var_screeninfo *var,
u16 cxres, u16 cyres);
 void viafb_fill_crtc_timing(const struct fb_var_screeninfo *var,
u16 cxres, u16 cyres, int iga);
diff --git a/drivers/video/via/lcd.c b/drivers/video/via/lcd.c
index 1650379..022b0df 100644
--- a/drivers/video/via/lcd.c
+++ b/drivers/video/via/lcd.c
@@ -549,7 +549,7 @@ void viafb_lcd_set_mode(const struct fb_var_screeninfo 
*var, u16 cxres,
int panel_hres = plvds_setting_info->lcd_panel_hres;
int panel_vres = plvds_setting_info->lcd_panel_vres;
u32 clock;
-   struct display_timing timing;
+   struct via_display_timing timing;
struct fb_var_screeninfo panel_var;
const struct fb_videomode *mode_crt_table, *panel_crt_table;

diff --git a/drivers/video/via/share.h b/drivers/video/via/share.h
index 3158dfc..65c65c6 100644
--- a/drivers/video/via/share.h
+++ b/drivers/video/via/share.h
@@ -319,7 +319,7 @@ struct crt_mode_table {
int refresh_rate;
int h_sync_polarity;
int v_sync_polarity;
-   struct display_timing crtc;
+   struct via_display_timing crtc;
 };

 struct io_reg {
diff --git a/drivers/video/via/via_modesetting.c 
b/drivers/video/via/via_modesetting.c
index 0e431ae..0b414b0 100644
--- a/drivers/video/via/via_modesetting.c
+++ b/drivers/video/via/via_modesetting.c
@@ -30,9 +30,9 @@
 #include "debug.h"


-void via_set_primary_timing(const struct display_timing *timing)
+void via_set_primary_timing(const struct via_display_timing *timing)
 {
-   struct display_timing raw;
+   struct via_display_timing raw;

raw.hor_total = timing->hor_total / 8 - 5;
raw.hor_addr = timing->hor_addr / 8 - 1;
@@ -88,9 +88,9 @@ void via_set_primary_timing(const struct display_timing 
*timing)
via_write_reg_mask(VIACR, 0x17, 0x80, 0x80);
 }

-void via_set_secondary_timing(const struct display_timing *timing)
+void via_set_secondary_timing(const struct via_display_timing *timing)
 {
-   struct display_timing raw;
+   struct via_display_timing raw;

raw.hor_total = timing->hor_total - 1;
raw.hor_addr = timing->hor_addr - 1;
diff --git a/drivers/video/via/via_modesetting.h 
b/drivers/video/via/via_modesetting.h
index 06e09fe..f6a6503 100644
--- a/drivers/video/via/via_modesetting.h
+++ b/drivers/video/via/via_modesetting.h
@@ -33,7 +33,7 @@
 #define VIA_PITCH_MAX  0x3FF8


-struct display_timing {
+struct via_display_timing {
u16 hor_total;
u16 hor_addr;
u16 hor_blank_start;
@@ -49,8 +49,8 @@ struct display_timing {
 };


-void via_set_primary_timing(const struct display_timing *timing);
-void via_set_secondary_timing(const struct display_timing *timing);
+void via_set_primary_timing(const struct via_display_timing *timing);
+void via_set_secondary_timing(const struct via_display_timing *timing);
 void via_set_primary_a

[PATCHv14 0/7] of: add display helper

2012-11-23 Thread Steffen Trumtrar
Hi!

Changes since v13:
- fix "const struct *" warning
(reported by: Laurent Pinchart )
- prevent division by zero in fb_videomode_from_videomode

Changes since v12:
- rename struct display_timing to via_display_timing in via subsystem
- fix refreshrate calculation
- fix "const struct *" warnings
(reported by: Manjunathappa, Prakash )
- some CodingStyle fixes
- rewrite parts of commit messages and display-timings.txt
- let display_timing_get_value get all values instead of just typical

Changes since v11:
- make pointers const where applicable
- add reviewed-by Laurent Pinchart

Changes since v10:
- fix function name (drm_)display_mode_from_videomode
- add acked-by, reviewed-by, tested-by

Changes since v9:
- don't leak memory when previous timings were correct
- CodingStyle fixes
- move blank lines around

Changes since v8:
- fix memory leaks
- change API to be more consistent (foo_from_bar(struct bar, struct 
foo))
- include headers were necessary
- misc minor bufixe

Changes since v7:
- move of_xxx to drivers/video
- remove non-binding documentation from display-timings.txt
- squash display_timings and videomode in one patch
- misc minor fixes

Changes since v6:
- get rid of some empty lines etc.
- move functions to their subsystems
- split of_ from non-of_ functions
- add at least some kerneldoc to some functions

Changes since v5:
- removed all display stuff and just describe timings

Changes since v4:
- refactored functions

Changes since v3:
- print error messages
- free alloced memory
- general cleanup

Changes since v2:
- use hardware-near property-names
- provide a videomode structure
- allow ranges for all properties ()
- functions to get display_mode or fb_videomode


Steffen Trumtrar (7):
  viafb: rename display_timing to via_display_timing
  video: add display_timing and videomode
  video: add of helper for display timings/videomode
  fbmon: add videomode helpers
  fbmon: add of_videomode helpers
  drm_modes: add videomode helpers
  drm_modes: add of_videomode helpers

 .../devicetree/bindings/video/display-timings.txt  |  107 ++
 drivers/gpu/drm/drm_modes.c|   69 ++
 drivers/video/Kconfig  |   21 ++
 drivers/video/Makefile |4 +
 drivers/video/display_timing.c |   24 +++
 drivers/video/fbmon.c  |   89 
 drivers/video/of_display_timing.c  |  223 
 drivers/video/of_videomode.c   |   48 +
 drivers/video/via/hw.c |6 +-
 drivers/video/via/hw.h |2 +-
 drivers/video/via/lcd.c|2 +-
 drivers/video/via/share.h  |2 +-
 drivers/video/via/via_modesetting.c|8 +-
 drivers/video/via/via_modesetting.h|6 +-
 drivers/video/videomode.c  |   45 
 include/drm/drmP.h |   12 ++
 include/linux/display_timing.h |  104 +
 include/linux/fb.h |   12 ++
 include/linux/of_display_timings.h |   20 ++
 include/linux/of_videomode.h   |   18 ++
 include/linux/videomode.h  |   52 +
 21 files changed, 861 insertions(+), 13 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/video/display-timings.txt
 create mode 100644 drivers/video/display_timing.c
 create mode 100644 drivers/video/of_display_timing.c
 create mode 100644 drivers/video/of_videomode.c
 create mode 100644 drivers/video/videomode.c
 create mode 100644 include/linux/display_timing.h
 create mode 100644 include/linux/of_display_timings.h
 create mode 100644 include/linux/of_videomode.h
 create mode 100644 include/linux/videomode.h

-- 
1.7.10.4



Re: [RFC v2 0/5] Common Display Framework

2012-11-23 Thread Tomi Valkeinen
Hi,

On 2012-11-22 23:45, Laurent Pinchart wrote:
> From: Laurent Pinchart 
> 
> Hi everybody,
> 
> Here's the second RFC of what was previously known as the Generic Panel
> Framework.

Nice work! Thanks for working on this.

I was doing some testing with the code, seeing how to use it in omapdss.
Here are some thoughts:

In your model the DSS gets the panel devices connected to it from
platform data. After the DSS and the panel drivers are loaded, DSS gets
a notification and connects DSS and the panel.

I think it's a bit limited way. First of all, it'll make the DT data a
bit more complex (although this is not a major problem). With your
model, you'll need something like:

soc-base.dtsi:

dss {
dpi0: dpi {
};
};

board.dts:

&dpi0 {
panel = &dpi-panel;
};

/ {
dpi-panel: dpi-panel {
...panel data...;
};
};

Second, it'll prevent hotplug, and even if real hotplug would not be
supported, it'll prevent cases where the connected panel must be found
dynamically (like reading ID from eeprom).

Third, it kinda creates a cyclical dependency: the DSS needs to know
about the panel and calls ops in the panel, and the panel calls ops in
the DSS. I'm not sure if this is an actual problem, but I usually find
it simpler if calls are done only in one direction.


What I suggest is take a simpler approach, something alike to how
regulators or gpios are used, even if slightly more complex than those:
the entity that has a video output (SoC's DSS, external chips) offers
that video output as resource. It doesn't know or care who uses it. The
user of the video output (panel, external chips) will find the video
output (to which it is connected in the HW) by some means, and will use
different operations on that output to operate the device.

This would give us something like the following DT data:

soc-base.dtsi:

dss {
dpi0: dpi {
};
};

board.dts:

/ {
dpi-panel: dpi-panel {
source = <&dpi0>;
...panel data...;
};
};

The panel driver would do something like this in its probe:

int dpi_panel_probe()
{
// Find the video source, increase ref
src = get_video_source_from_of("source");

// Reserve the video source for us. others can still get and
// observe it, but cannot use it as video data source.
// I think this should cascade upstream, so that after this call
// each video entity from the panel to the SoC's CRTC is
// reserved and locked for this video pipeline.
reserve_video_source(src);

// set DPI HW configuration, like DPI data lines. The
// configuration would come from panel's platform data
set_dpi_config(src, config);

// register this panel as a display.
register_display(this);
}


The DSS's dpi driver would do something like:

int dss_dpi_probe()
{
// register as a DPI video source
register_video_source(this);
}

A DSI-2-DPI chip would do something like:

int dsi2dpi_probe()
{
// get, reserve and config the DSI bus from SoC
src = get_video_source_from_of("source");
reserve_video_source(src);
set_dsi_config(src, config);

// register as a DPI video source
register_video_source(this);
}


Here we wouldn't have similar display_entity as you have, but video
sources and displays. Video sources are elements in the video pipeline,
and a video source is used only by the next downstream element. The last
element in the pipeline would not be a video source, but a display,
which would be used by the upper layer.

Video source's ops would deal with things related to the video bus in
question, like configuring data lanes, sending DSI packets, etc. The
display ops would be more high level things, like enable, update, etc.
Actually, I guess you could consider the display to represent and deal
with the whole pipeline, while video source deals with the bus between
two display entities.

 Tomi




signature.asc
Description: OpenPGP digital signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2] drm: exynos: hdmi: sending AVI and AUI info frames

2012-11-23 Thread Rahul Sharma
This patch adds code for composing AVI and AUI info frames
and send them every VSYNC.

This patch is important for hdmi certification.

v1:
- Remove un-necessary blank lines.
- Change the case of hex constants.

v2:
- Added few blank lines.
- Corrected comments format.
- Added comments for 2's Complement calculation for check sum.

Signed-off-by: Rahul Sharma 
Signed-off-by: Fahad Kunnathadi 
Signed-off-by: Shirish S 

---
Based on exynos-drm-next branch of
http://git.kernel.org/?p=linux/kernel/git/daeinki/drm-exynos.git

 drivers/gpu/drm/exynos/exynos_hdmi.c |  142 +-
 drivers/gpu/drm/exynos/exynos_hdmi.h |   23 ++
 drivers/gpu/drm/exynos/regs-hdmi.h   |   17 -
 3 files changed, 161 insertions(+), 21 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c 
b/drivers/gpu/drm/exynos/exynos_hdmi.c
index 59839cc..af956c7 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -183,6 +183,7 @@ struct hdmi_v13_conf {
int height;
int vrefresh;
bool interlace;
+   int cea_video_id;
const u8 *hdmiphy_data;
const struct hdmi_v13_preset_conf *conf;
 };
@@ -354,15 +355,20 @@ static const struct hdmi_v13_preset_conf 
hdmi_v13_conf_1080p60 = {
 };
 
 static const struct hdmi_v13_conf hdmi_v13_confs[] = {
-   { 1280, 720, 60, false, hdmiphy_v13_conf74_25, &hdmi_v13_conf_720p60 },
-   { 1280, 720, 50, false, hdmiphy_v13_conf74_25, &hdmi_v13_conf_720p60 },
-   { 720, 480, 60, false, hdmiphy_v13_conf27_027, &hdmi_v13_conf_480p },
-   { 1920, 1080, 50, true, hdmiphy_v13_conf74_25, &hdmi_v13_conf_1080i50 },
-   { 1920, 1080, 50, false, hdmiphy_v13_conf148_5,
-&hdmi_v13_conf_1080p50 },
-   { 1920, 1080, 60, true, hdmiphy_v13_conf74_25, &hdmi_v13_conf_1080i60 },
-   { 1920, 1080, 60, false, hdmiphy_v13_conf148_5,
-&hdmi_v13_conf_1080p60 },
+   { 1280, 720, 60, false, 4, hdmiphy_v13_conf74_25,
+   &hdmi_v13_conf_720p60 },
+   { 1280, 720, 50, false, 19, hdmiphy_v13_conf74_25,
+   &hdmi_v13_conf_720p60 },
+   { 720, 480, 60, false, 3, hdmiphy_v13_conf27_027,
+   &hdmi_v13_conf_480p },
+   { 1920, 1080, 50, true, 20, hdmiphy_v13_conf74_25,
+   &hdmi_v13_conf_1080i50 },
+   { 1920, 1080, 50, false, 31, hdmiphy_v13_conf148_5,
+   &hdmi_v13_conf_1080p50 },
+   { 1920, 1080, 60, true, 5, hdmiphy_v13_conf74_25,
+   &hdmi_v13_conf_1080i60 },
+   { 1920, 1080, 60, false, 16, hdmiphy_v13_conf148_5,
+   &hdmi_v13_conf_1080p60 },
 };
 
 /* HDMI Version 1.4 */
@@ -480,6 +486,7 @@ struct hdmi_conf {
int height;
int vrefresh;
bool interlace;
+   int cea_video_id;
const u8 *hdmiphy_data;
const struct hdmi_preset_conf *conf;
 };
@@ -935,16 +942,21 @@ static const struct hdmi_preset_conf hdmi_conf_1080p60 = {
 };
 
 static const struct hdmi_conf hdmi_confs[] = {
-   { 720, 480, 60, false, hdmiphy_conf27_027, &hdmi_conf_480p60 },
-   { 1280, 720, 50, false, hdmiphy_conf74_25, &hdmi_conf_720p50 },
-   { 1280, 720, 60, false, hdmiphy_conf74_25, &hdmi_conf_720p60 },
-   { 1920, 1080, 50, true, hdmiphy_conf74_25, &hdmi_conf_1080i50 },
-   { 1920, 1080, 60, true, hdmiphy_conf74_25, &hdmi_conf_1080i60 },
-   { 1920, 1080, 30, false, hdmiphy_conf74_176, &hdmi_conf_1080p30 },
-   { 1920, 1080, 50, false, hdmiphy_conf148_5, &hdmi_conf_1080p50 },
-   { 1920, 1080, 60, false, hdmiphy_conf148_5, &hdmi_conf_1080p60 },
+   { 720, 480, 60, false, 3, hdmiphy_conf27_027, &hdmi_conf_480p60 },
+   { 1280, 720, 50, false, 19, hdmiphy_conf74_25, &hdmi_conf_720p50 },
+   { 1280, 720, 60, false, 4, hdmiphy_conf74_25, &hdmi_conf_720p60 },
+   { 1920, 1080, 50, true, 20, hdmiphy_conf74_25, &hdmi_conf_1080i50 },
+   { 1920, 1080, 60, true, 5, hdmiphy_conf74_25, &hdmi_conf_1080i60 },
+   { 1920, 1080, 30, false, 34, hdmiphy_conf74_176, &hdmi_conf_1080p30 },
+   { 1920, 1080, 50, false, 31, hdmiphy_conf148_5, &hdmi_conf_1080p50 },
+   { 1920, 1080, 60, false, 16, hdmiphy_conf148_5, &hdmi_conf_1080p60 },
 };
 
+struct hdmi_infoframe {
+   enum HDMI_PACKET_TYPE type;
+   u8 ver;
+   u8 len;
+};
 
 static inline u32 hdmi_reg_read(struct hdmi_context *hdata, u32 reg_id)
 {
@@ -1268,6 +1280,88 @@ static int hdmi_conf_index(struct hdmi_context *hdata,
return hdmi_v14_conf_index(mode);
 }
 
+static u8 hdmi_chksum(struct hdmi_context *hdata,
+   u32 start, u8 len, u32 hdr_sum)
+{
+   int i;
+
+   /* hdr_sum : header0 + header1 + header2
+   * start : start address of packet byte1
+   * len : packet bytes - 1 */
+   for (i = 0; i < len; ++i)
+   hdr_sum += 0xff & hdmi_reg_read(hdata, start + i * 4);
+
+   /* return 2'

[PATCH 1/1] drm: only build ati_pcigart if PCI enabled

2012-11-23 Thread James Hogan
Prevent ati_pcigart.c being built unless PCI is enabled. The exported
functions in this file are only used by drivers which depend on PCI
(namely r128 and radeon), and it tries to use PCI specific functions
(pci_unmap_page, pci_map_page, and pci_dma_mapping_error) that cause
compiler errors when PCI is disabled.

Signed-off-by: James Hogan 
Cc: David Airlie 
---
 drivers/gpu/drm/Makefile |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
index 2ff5cef..3e303b1b 100644
--- a/drivers/gpu/drm/Makefile
+++ b/drivers/gpu/drm/Makefile
@@ -8,7 +8,7 @@ drm-y   :=  drm_auth.o drm_buffer.o drm_bufs.o drm_cache.o \
drm_context.o drm_dma.o \
drm_drv.o drm_fops.o drm_gem.o drm_ioctl.o drm_irq.o \
drm_lock.o drm_memory.o drm_proc.o drm_stub.o drm_vm.o \
-   drm_agpsupport.o drm_scatter.o ati_pcigart.o drm_pci.o \
+   drm_agpsupport.o drm_scatter.o drm_pci.o \
drm_platform.o drm_sysfs.o drm_hashtab.o drm_mm.o \
drm_crtc.o drm_modes.o drm_edid.o \
drm_info.o drm_debugfs.o drm_encoder_slave.o \
@@ -16,6 +16,7 @@ drm-y   :=drm_auth.o drm_buffer.o drm_bufs.o 
drm_cache.o \
 
 drm-$(CONFIG_COMPAT) += drm_ioc32.o
 drm-$(CONFIG_DRM_GEM_CMA_HELPER) += drm_gem_cma_helper.o
+drm-$(CONFIG_PCI) += ati_pcigart.o
 
 drm-usb-y   := drm_usb.o
 
-- 
1.7.7.6


___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 5/5] drm/exynos: Fix potential NULL pointer dereference

2012-11-23 Thread Sachin Kamat
Pointer was being dereferenced after freeing.

Fixes the following error:
drivers/gpu/drm/exynos/exynos_drm_g2d.c:323 g2d_userptr_put_dma_addr() error:
dereferencing freed memory 'g2d_userptr'

Signed-off-by: Sachin Kamat 
---
 drivers/gpu/drm/exynos/exynos_drm_g2d.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_g2d.c 
b/drivers/gpu/drm/exynos/exynos_drm_g2d.c
index c1054cb..6ffa076 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_g2d.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_g2d.c
@@ -319,8 +319,8 @@ out:
g2d_userptr->sgt = NULL;

kfree(g2d_userptr->pages);
-   kfree(g2d_userptr);
g2d_userptr->pages = NULL;
+   kfree(g2d_userptr);
g2d_userptr = NULL;
 }

-- 
1.7.4.1



[PATCH 4/5] drm/exynos: Use devm_clk_get in exynos_drm_g2d.c

2012-11-23 Thread Sachin Kamat
devm_clk_get is device managed and makes error handling and exit code
simpler.

Signed-off-by: Sachin Kamat 
---
 drivers/gpu/drm/exynos/exynos_drm_g2d.c |4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_g2d.c 
b/drivers/gpu/drm/exynos/exynos_drm_g2d.c
index a9002ad..c1054cb 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_g2d.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_g2d.c
@@ -1125,7 +1125,7 @@ static int __devinit g2d_probe(struct platform_device 
*pdev)
mutex_init(&g2d->cmdlist_mutex);
mutex_init(&g2d->runqueue_mutex);

-   g2d->gate_clk = clk_get(dev, "fimg2d");
+   g2d->gate_clk = devm_clk_get(dev, "fimg2d");
if (IS_ERR(g2d->gate_clk)) {
dev_err(dev, "failed to get gate clock\n");
ret = PTR_ERR(g2d->gate_clk);
@@ -1181,7 +1181,6 @@ static int __devinit g2d_probe(struct platform_device 
*pdev)

 err_put_clk:
pm_runtime_disable(dev);
-   clk_put(g2d->gate_clk);
 err_destroy_workqueue:
destroy_workqueue(g2d->g2d_workq);
 err_destroy_slab:
@@ -1202,7 +1201,6 @@ static int __devexit g2d_remove(struct platform_device 
*pdev)
}

pm_runtime_disable(&pdev->dev);
-   clk_put(g2d->gate_clk);

g2d_fini_cmdlist(g2d);
destroy_workqueue(g2d->g2d_workq);
-- 
1.7.4.1



[PATCH 3/5] drm/exynos: Use devm_clk_get in exynos_mixer.c

2012-11-23 Thread Sachin Kamat
devm_clk_get is device managed and makes error handling and exit code
simpler.

Signed-off-by: Sachin Kamat 
---
 drivers/gpu/drm/exynos/exynos_mixer.c |   20 +---
 1 files changed, 5 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c 
b/drivers/gpu/drm/exynos/exynos_mixer.c
index 0d3ed28..88fcb40 100644
--- a/drivers/gpu/drm/exynos/exynos_mixer.c
+++ b/drivers/gpu/drm/exynos/exynos_mixer.c
@@ -962,14 +962,14 @@ static int __devinit mixer_resources_init(struct 
exynos_drm_hdmi_context *ctx,

spin_lock_init(&mixer_res->reg_slock);

-   mixer_res->mixer = clk_get(dev, "mixer");
+   mixer_res->mixer = devm_clk_get(dev, "mixer");
if (IS_ERR_OR_NULL(mixer_res->mixer)) {
dev_err(dev, "failed to get clock 'mixer'\n");
ret = -ENODEV;
goto fail;
}

-   mixer_res->sclk_hdmi = clk_get(dev, "sclk_hdmi");
+   mixer_res->sclk_hdmi = devm_clk_get(dev, "sclk_hdmi");
if (IS_ERR_OR_NULL(mixer_res->sclk_hdmi)) {
dev_err(dev, "failed to get clock 'sclk_hdmi'\n");
ret = -ENODEV;
@@ -1008,10 +1008,6 @@ static int __devinit mixer_resources_init(struct 
exynos_drm_hdmi_context *ctx,
return 0;

 fail:
-   if (!IS_ERR_OR_NULL(mixer_res->sclk_hdmi))
-   clk_put(mixer_res->sclk_hdmi);
-   if (!IS_ERR_OR_NULL(mixer_res->mixer))
-   clk_put(mixer_res->mixer);
return ret;
 }

@@ -1024,19 +1020,19 @@ static int __devinit vp_resources_init(struct 
exynos_drm_hdmi_context *ctx,
struct resource *res;
int ret;

-   mixer_res->vp = clk_get(dev, "vp");
+   mixer_res->vp = devm_clk_get(dev, "vp");
if (IS_ERR_OR_NULL(mixer_res->vp)) {
dev_err(dev, "failed to get clock 'vp'\n");
ret = -ENODEV;
goto fail;
}
-   mixer_res->sclk_mixer = clk_get(dev, "sclk_mixer");
+   mixer_res->sclk_mixer = devm_clk_get(dev, "sclk_mixer");
if (IS_ERR_OR_NULL(mixer_res->sclk_mixer)) {
dev_err(dev, "failed to get clock 'sclk_mixer'\n");
ret = -ENODEV;
goto fail;
}
-   mixer_res->sclk_dac = clk_get(dev, "sclk_dac");
+   mixer_res->sclk_dac = devm_clk_get(dev, "sclk_dac");
if (IS_ERR_OR_NULL(mixer_res->sclk_dac)) {
dev_err(dev, "failed to get clock 'sclk_dac'\n");
ret = -ENODEV;
@@ -1064,12 +1060,6 @@ static int __devinit vp_resources_init(struct 
exynos_drm_hdmi_context *ctx,
return 0;

 fail:
-   if (!IS_ERR_OR_NULL(mixer_res->sclk_dac))
-   clk_put(mixer_res->sclk_dac);
-   if (!IS_ERR_OR_NULL(mixer_res->sclk_mixer))
-   clk_put(mixer_res->sclk_mixer);
-   if (!IS_ERR_OR_NULL(mixer_res->vp))
-   clk_put(mixer_res->vp);
return ret;
 }

-- 
1.7.4.1



[PATCH 2/5] drm/exynos: Use devm_gpio_request in exynos_hdmi.c

2012-11-23 Thread Sachin Kamat
devm_gpio_request is device managed and makes error handling and exit code
simpler.

Signed-off-by: Sachin Kamat 
---
 drivers/gpu/drm/exynos/exynos_hdmi.c |8 ++--
 1 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c 
b/drivers/gpu/drm/exynos/exynos_hdmi.c
index 59839cc..3fe2d61 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -2428,7 +2428,7 @@ static int __devinit hdmi_probe(struct platform_device 
*pdev)
goto err_resource;
}

-   ret = gpio_request(hdata->hpd_gpio, "HPD");
+   ret = devm_gpio_request(&pdev->dev, hdata->hpd_gpio, "HPD");
if (ret) {
DRM_ERROR("failed to request HPD gpio\n");
goto err_resource;
@@ -2438,7 +2438,7 @@ static int __devinit hdmi_probe(struct platform_device 
*pdev)
if (i2c_add_driver(&ddc_driver)) {
DRM_ERROR("failed to register ddc i2c driver\n");
ret = -ENOENT;
-   goto err_gpio;
+   goto err_resource;
}

hdata->ddc_port = hdmi_ddc;
@@ -2501,8 +2501,6 @@ err_hdmiphy:
i2c_del_driver(&hdmiphy_driver);
 err_ddc:
i2c_del_driver(&ddc_driver);
-err_gpio:
-   gpio_free(hdata->hpd_gpio);
 err_resource:
hdmi_resources_cleanup(hdata);
 err_data:
@@ -2522,8 +2520,6 @@ static int __devexit hdmi_remove(struct platform_device 
*pdev)
free_irq(hdata->internal_irq, hdata);
free_irq(hdata->external_irq, hdata);

-   gpio_free(hdata->hpd_gpio);
-
hdmi_resources_cleanup(hdata);

/* hdmiphy i2c driver */
-- 
1.7.4.1



[PATCH 1/5] drm/exynos: Use devm_clk_get in exynos_drm_fimd.c

2012-11-23 Thread Sachin Kamat
devm_clk_get is device managed and makes error handling and exit code
simpler.

Signed-off-by: Sachin Kamat 
---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c |9 ++---
 1 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index ad04edd..57851cc 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -846,14 +846,14 @@ static int __devinit fimd_probe(struct platform_device 
*pdev)
if (!ctx)
return -ENOMEM;

-   ctx->bus_clk = clk_get(dev, "fimd");
+   ctx->bus_clk = devm_clk_get(dev, "fimd");
if (IS_ERR(ctx->bus_clk)) {
dev_err(dev, "failed to get bus clock\n");
ret = PTR_ERR(ctx->bus_clk);
goto err_clk_get;
}

-   ctx->lcd_clk = clk_get(dev, "sclk_fimd");
+   ctx->lcd_clk = devm_clk_get(dev, "sclk_fimd");
if (IS_ERR(ctx->lcd_clk)) {
dev_err(dev, "failed to get lcd clock\n");
ret = PTR_ERR(ctx->lcd_clk);
@@ -918,11 +918,9 @@ static int __devinit fimd_probe(struct platform_device 
*pdev)

 err_clk:
clk_disable(ctx->lcd_clk);
-   clk_put(ctx->lcd_clk);

 err_bus_clk:
clk_disable(ctx->bus_clk);
-   clk_put(ctx->bus_clk);

 err_clk_get:
return ret;
@@ -949,9 +947,6 @@ static int __devexit fimd_remove(struct platform_device 
*pdev)
 out:
pm_runtime_disable(dev);

-   clk_put(ctx->lcd_clk);
-   clk_put(ctx->bus_clk);
-
return 0;
 }

-- 
1.7.4.1



[PATCH 0/5] drm/exynos: Bug fix and devm_* usage

2012-11-23 Thread Sachin Kamat
First 4 patches use devm_* APIs for simpler code and cleanup.
Last one fixes a potential bug.

Series is build tested and based on the exynos-drm-next branch of the
following tree:
git://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos.git

Sachin Kamat (5):
  drm/exynos: Use devm_clk_get in exynos_drm_fimd.c
  drm/exynos: Use devm_gpio_request in exynos_hdmi.c
  drm/exynos: Use devm_clk_get in exynos_mixer.c
  drm/exynos: Use devm_clk_get in exynos_drm_g2d.c
  drm/exynos: Fix potential NULL pointer dereference

 drivers/gpu/drm/exynos/exynos_drm_fimd.c |9 ++---
 drivers/gpu/drm/exynos/exynos_drm_g2d.c  |6 ++
 drivers/gpu/drm/exynos/exynos_hdmi.c |8 ++--
 drivers/gpu/drm/exynos/exynos_mixer.c|   20 +---
 4 files changed, 11 insertions(+), 32 deletions(-)

-- 
1.7.4.1



[PATCHv13 4/7] fbmon: add videomode helpers

2012-11-23 Thread Steffen Trumtrar
On Fri, Nov 23, 2012 at 12:52:08AM +0100, Laurent Pinchart wrote:
> On Friday 23 November 2012 00:09:49 Steffen Trumtrar wrote:
> > On Thu, Nov 22, 2012 at 07:31:39PM +0100, Laurent Pinchart wrote:
> > > On Thursday 22 November 2012 17:00:12 Steffen Trumtrar wrote:
> > > > Add a function to convert from the generic videomode to a fb_videomode.
> > > > 
> > > > Signed-off-by: Steffen Trumtrar 
> > > > Reviewed-by: Thierry Reding 
> > > > Acked-by: Thierry Reding 
> > > > Tested-by: Thierry Reding 
> > > > Tested-by: Philipp Zabel 
> > > > Reviewed-by: Laurent Pinchart 
> > > > Acked-by: Laurent Pinchart 
> > > > Signed-off-by: Steffen Trumtrar 
> > > > ---
> > > > 
> > > >  drivers/video/fbmon.c |   44 ++
> > > >  include/linux/fb.h|6 ++
> > > >  2 files changed, 50 insertions(+)
> > > > 
> > > > diff --git a/drivers/video/fbmon.c b/drivers/video/fbmon.c
> > > > index cef6557..a6a564d 100644
> > > > --- a/drivers/video/fbmon.c
> > > > +++ b/drivers/video/fbmon.c
> > > > @@ -31,6 +31,7 @@
> > > > 
> > > >  #include 
> > > >  #include 
> > > >  #include 
> > > > 
> > > > +#include 
> > > > 
> > > >  #ifdef CONFIG_PPC_OF
> > > >  #include 
> > > >  #include 
> > > > 
> > > > @@ -1373,6 +1374,49 @@ int fb_get_mode(int flags, u32 val, struct
> > > > fb_var_screeninfo *var, struct fb_inf kfree(timings);
> > > > 
> > > > return err;
> > > >  
> > > >  }
> > > > 
> > > > +
> > > > +#if IS_ENABLED(CONFIG_VIDEOMODE)
> > > > +int fb_videomode_from_videomode(const struct videomode *vm,
> > > > +   struct fb_videomode *fbmode)
> > > > +{
> > > > +   unsigned int htotal, vtotal;
> > > > +
> > > > +   fbmode->xres = vm->hactive;
> > > > +   fbmode->left_margin = vm->hback_porch;
> > > > +   fbmode->right_margin = vm->hfront_porch;
> > > > +   fbmode->hsync_len = vm->hsync_len;
> > > > +
> > > > +   fbmode->yres = vm->vactive;
> > > > +   fbmode->upper_margin = vm->vback_porch;
> > > > +   fbmode->lower_margin = vm->vfront_porch;
> > > > +   fbmode->vsync_len = vm->vsync_len;
> > > > +
> > > > +   fbmode->pixclock = KHZ2PICOS(vm->pixelclock / 1000);
> > > 
> > > This results in a division by 0 if vm->pixelclock is equal to zero. As the
> > > information is missing from many board files, what would you think about
> > > the following ?
> > > 
> > >   fbmode->pixclock = vm->pixelclock ? KHZ2PICOS(vm->pixelclock / 1000) : 
> > > 0;
> > 
> > Grrr...you are right. I will fix that...
> 
> Thank you.
> 

I have to thank you for bulletproofing my code o/\o

> > > > +   htotal = vm->hactive + vm->hfront_porch + vm->hback_porch +
> > > > +vm->hsync_len;
> > > > +   vtotal = vm->vactive + vm->vfront_porch + vm->vback_porch +
> > > > +vm->vsync_len;
> > > > +   fbmode->refresh = vm->pixelclock / (htotal * vtotal);
> > > > +
> > 
> > ...and obviously this, too.
> 
> That one is less of an issue in my opinion. A mode with a zero htotal or 
> vtotal is clearly invalid, while we have modes with no pixel clock value.
> 

Yes, you I are right. But while I'm on it, might as well prevent an error.

Regards,
Steffen
-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |


[pull] drm-fixes

2012-11-23 Thread Daniel Vetter
Hi Dave,

Two small fixes for 3.7:
- Unbreak mbp retina, this time with a much more fine-grained approach
  (since the previous "completely ignore edp vbt bpp value" regressed some
  machines even after fixing a bug in our dp bw code).
- Disable cloning on sdvo. It just doesn't work (yeah took us a while to
  figure out), leading to jittery outputs in the best case.

Cheers, Daniel


The following changes since commit f4a75d2eb7b1e2206094b901be09adb31ba63681:

  Linux 3.7-rc6 (2012-11-16 17:42:40 -0800)

are available in the git repository at:

  git://people.freedesktop.org/~danvet/drm-intel drm-intel-fixes

for you to fetch changes up to 9a30a61f3516871c5c638fd7c025fbaa11ddf7fe:

  drm/i915: do not default to 18 bpp for eDP if missing from VBT (2012-11-22 
21:34:32 +0100)


Daniel Vetter (1):
  drm/i915: disable cloning on sdvo

Jani Nikula (1):
  drm/i915: do not default to 18 bpp for eDP if missing from VBT

 drivers/gpu/drm/i915/intel_bios.c|   11 ++-
 drivers/gpu/drm/i915/intel_display.c |2 +-
 drivers/gpu/drm/i915/intel_sdvo.c|   17 ++---
 3 files changed, 13 insertions(+), 17 deletions(-)
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCHv13 5/7] fbmon: add of_videomode helpers

2012-11-23 Thread Steffen Trumtrar
Hi Laurent,

On Thu, Nov 22, 2012 at 06:58:09PM +0100, Laurent Pinchart wrote:
> Hi Steffen,
> 
> On Thursday 22 November 2012 17:00:13 Steffen Trumtrar wrote:
> > Add helper to get fb_videomode from devicetree.
> > 
> > Signed-off-by: Steffen Trumtrar 
> > Reviewed-by: Thierry Reding 
> > Acked-by: Thierry Reding 
> > Tested-by: Thierry Reding 
> > Tested-by: Philipp Zabel 
> > Reviewed-by: Laurent Pinchart 
> > Acked-by: Laurent Pinchart 
> 
> This patch results in the following build warning:
> 
> drivers/video/fbmon.c: In function 'of_get_fb_videomode':
> drivers/video/fbmon.c:1445: warning: passing argument 1 of 'of_get_videomode' 
> discards qualifiers from pointer target type
> include/linux/of_videomode.h:15: note: expected 'struct device_node *' but 
> argument is of type 'const struct device_node *'
> 

This I don't get. Well, looking at the code, the warning is correct. I fixed
that now. But, I do not get the warning. Just tried it again before fixing:
cleaned, cleaned and touching file, just "make drivers/video/fbmon.o". Nothing.
Weird.

So, thanks for reporting it.

Regards,
Steffen

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |


Re: [PATCH] drm: kms_helper: don't lose hotplug event

2012-11-23 Thread Daniel Vetter
Hi Dave,

Will hunting down a patch in my machine farm I've stumbled over this
one here. It fixes a detection race I've noticed while testing the new
hpd stuff a while back. Chris already smashed his r-b onto it.

Can you please include this in drm-next for 3.8?

Thanks, Daniel

On Wed, Oct 24, 2012 at 9:16 PM, Daniel Vetter  wrote:
> There's a race window (small for hpd, 10s large for polled outputs)
> where userspace could sneak in with an unrelated connnector probe
> ioctl call and eat the hotplug event (since neither the hpd nor the
> poll code see a state change).
>
> To avoid this, check whether the connector state changes in all other
> ->detect calls (in the current helper code that's only probe_single)
> and if that's the case, fire off a hotplug event. Note that we can't
> directly call the hotplug event handler, since that expects that no
> locks are held (due to reentrancy with the fb code to update the kms
> console).
>
> Also, this requires that drivers using the probe_single helper
> function set up the poll work. All current drivers do that already,
> and with the reworked hpd handling there'll be no downside to
> unconditionally setting up the poll work any more.
>
> Signed-off-by: Daniel Vetter 
> ---
>  drivers/gpu/drm/drm_crtc_helper.c | 33 -
>  include/drm/drm_crtc.h|  1 +
>  2 files changed, 33 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/drm_crtc_helper.c 
> b/drivers/gpu/drm/drm_crtc_helper.c
> index 9d186d0..b79d7cb 100644
> --- a/drivers/gpu/drm/drm_crtc_helper.c
> +++ b/drivers/gpu/drm/drm_crtc_helper.c
> @@ -62,6 +62,7 @@ static void drm_mode_validate_flag(struct drm_connector 
> *connector,
> return;
>  }
>
> +
>  /**
>   * drm_helper_probe_single_connector_modes - get complete set of display 
> modes
>   * @dev: DRM device
> @@ -93,6 +94,7 @@ int drm_helper_probe_single_connector_modes(struct 
> drm_connector *connector,
> connector->helper_private;
> int count = 0;
> int mode_flags = 0;
> +   enum drm_connector_status old_status;
>
> DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n", connector->base.id,
> drm_get_connector_name(connector));
> @@ -108,7 +110,32 @@ int drm_helper_probe_single_connector_modes(struct 
> drm_connector *connector,
> if (connector->funcs->force)
> connector->funcs->force(connector);
> } else {
> +   old_status = connector->status;
> +
> connector->status = connector->funcs->detect(connector, true);
> +
> +   /*
> +* Normally either the driver's hpd code or the poll loop 
> should
> +* pick up any changes and fire the hotplug event. But if
> +* userspace sneaks in a probe, we might miss a change. Hence
> +* check here, and if anything changed start the hotplug code.
> +*/
> +   if (old_status != connector->status) {
> +   DRM_DEBUG_KMS("[CONNECTOR:%d:%s] status updated from 
> %d to %d\n",
> + connector->base.id,
> + drm_get_connector_name(connector),
> + old_status, connector->status);
> +
> +   /*
> +* The hotplug event code might call into the fb
> +* helpers, and so expects that we do not hold any
> +* locks. Fire up the poll struct instead, it will
> +* disable itself again.
> +*/
> +   dev->mode_config.delayed_event = true;
> +   
> schedule_delayed_work(&dev->mode_config.output_poll_work,
> + 0);
> +   }
> }
>
> /* Re-enable polling in case the global poll config changed. */
> @@ -939,7 +966,11 @@ static void output_poll_execute(struct work_struct *work)
> struct drm_device *dev = container_of(delayed_work, struct 
> drm_device, mode_config.output_poll_work);
> struct drm_connector *connector;
> enum drm_connector_status old_status;
> -   bool repoll = false, changed = false;
> +   bool repoll = false, changed;
> +
> +   /* Pick up any changes detected by the probe functions. */
> +   changed = dev->mode_config.delayed_event;
> +   dev->mode_config.delayed_event = false;
>
> if (!drm_kms_helper_poll)
> return;
> diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
> index 89f8f7f..ec207a2 100644
> --- a/include/drm/drm_crtc.h
> +++ b/include/drm/drm_crtc.h
> @@ -793,6 +793,7 @@ struct drm_mode_config {
> /* output poll support */
> bool poll_enabled;
> bool poll_running;
> +   bool delayed_event;
> struct delayed_work output_poll_work;
>
> /* pointers to s

[PATCH] drm: tegra: Use framebuffer pitch as line stride

2012-11-23 Thread Terje Bergström
On 22.11.2012 21:37, Thierry Reding wrote:
> Instead of using the stride derived from the display mode, use the pitch
> associated with the currently active framebuffer. This fixes a bug where
> the LCD display content would be skewed when enabling HDMI with a video
> mode different from that of the LCD.

Hi

This might fix the issue we had with the stride when doing our 2D
blitting on frame buffer. I'll test with your patch instead. We were
using a different stride due to limitations of 2D unit, so we hacked
this into our code:

diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c
b/drivers/gpu/drm/drm_fb_cma_he
index fd9d0af..65b12ba 100644
--- a/drivers/gpu/drm/drm_fb_cma_helper.c
+++ b/drivers/gpu/drm/drm_fb_cma_helper.c
@@ -214,7 +214,7 @@ static int drm_fbdev_cma_create(struct drm_fb_helper
*helper

mode_cmd.width = sizes->surface_width;
mode_cmd.height = sizes->surface_height;
-   mode_cmd.pitches[0] = sizes->surface_width * bytes_per_pixel;
+   mode_cmd.pitches[0] = roundup(sizes->surface_width *
bytes_per_pixel, 32);
mode_cmd.pixel_format =
drm_mode_legacy_fb_format(sizes->surface_bpp,
sizes->surface_depth);

diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c
index b9e5a79..d70c488 100644
--- a/drivers/gpu/drm/tegra/dc.c
+++ b/drivers/gpu/drm/tegra/dc.c
@@ -219,7 +219,7 @@ static int tegra_crtc_mode_set(struct drm_crtc *crtc,
}

bpp = crtc->fb->bits_per_pixel / 8;
-   win.stride = win.outw * bpp;
+   win.stride = roundup(win.outw * bpp, 32);

/* program window registers */
value = tegra_dc_readl(dc, DC_CMD_DISPLAY_WINDOW_HEADER);



Re: [PATCH 1/2] drm: add drm_mode_cea_vic

2012-11-23 Thread Thierry Reding
On Fri, Nov 23, 2012 at 12:09:26PM -0200, Paulo Zanoni wrote:
> From: Paulo Zanoni 
> 
> This function returns the VIC of the mode. This value can be used when
> creating AVI InfoFrames.
> 
> Cc: Thierry Reding 
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=50371
> Signed-off-by: Paulo Zanoni 
> ---
>  drivers/gpu/drm/drm_edid.c |   19 +++
>  include/drm/drm_crtc.h |1 +
>  2 files changed, 20 insertions(+)
> 
> Since drm-intel-next-queued is too old for this patch, I am rebasing it 
> against
> drm-next and splitting into 2 patches: one drm-only and the other i915-only, 
> so
> I imagine the first will be merged by Dave and the second by Daniel.
> 
> New version:
>  - Based on Dave's drm-next
>  - Fix function name inside the comments
>  - Remove the i915 chunk
>  - Constification of other functions is no more required as they are already
>const here.

Looks good to me:

Reviewed-by: Thierry Reding 


pgpC1coIwgac6.pgp
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 2/2] drm/i915: set the VIC of the mode on the AVI InfoFrame

2012-11-23 Thread Paulo Zanoni
From: Paulo Zanoni 

We currently set "0" as the VIC value of the AVI InfoFrames. According
to the specs this should be fine and work for every mode, so to my
point of view we can't consider the current behavior as a bug. The
problem is that  we recently received a bug report (Kernel bug #50371)
from a user that has an AV receiver that gives a black screen for any
mode with VIC set to 0.

So in order to make at least some modes work for him, this patch sets
the correct VIC number when sending AVI InfoFrames.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=50371
Signed-off-by: Paulo Zanoni 
---
 drivers/gpu/drm/i915/intel_hdmi.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_hdmi.c 
b/drivers/gpu/drm/i915/intel_hdmi.c
index 1dcfd5b..eaf70d6 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -340,6 +340,8 @@ static void intel_hdmi_set_avi_infoframe(struct drm_encoder 
*encoder,
if (adjusted_mode->flags & DRM_MODE_FLAG_DBLCLK)
avi_if.body.avi.YQ_CN_PR |= DIP_AVI_PR_2;
 
+   avi_if.body.avi.VIC = drm_mode_cea_vic(adjusted_mode);
+
intel_set_infoframe(encoder, &avi_if);
 }
 
-- 
1.7.10.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 1/2] drm: add drm_mode_cea_vic

2012-11-23 Thread Paulo Zanoni
From: Paulo Zanoni 

This function returns the VIC of the mode. This value can be used when
creating AVI InfoFrames.

Cc: Thierry Reding 
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=50371
Signed-off-by: Paulo Zanoni 
---
 drivers/gpu/drm/drm_edid.c |   19 +++
 include/drm/drm_crtc.h |1 +
 2 files changed, 20 insertions(+)

Since drm-intel-next-queued is too old for this patch, I am rebasing it against
drm-next and splitting into 2 patches: one drm-only and the other i915-only, so
I imagine the first will be merged by Dave and the second by Daniel.

New version:
 - Based on Dave's drm-next
 - Fix function name inside the comments
 - Remove the i915 chunk
 - Constification of other functions is no more required as they are already
   const here.

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 1648200..011bd4f 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -2079,3 +2079,22 @@ int drm_add_modes_noedid(struct drm_connector *connector,
return num_modes;
 }
 EXPORT_SYMBOL(drm_add_modes_noedid);
+
+/**
+ * drm_mode_cea_vic - return the CEA-861 VIC of a given mode
+ * @mode: mode
+ *
+ * RETURNS:
+ * The VIC number, 0 in case it's not a CEA-861 mode.
+ */
+uint8_t drm_mode_cea_vic(const struct drm_display_mode *mode)
+{
+   uint8_t i;
+
+   for (i = 0; i < drm_num_cea_modes; i++)
+   if (drm_mode_equal(mode, &edid_cea_modes[i]))
+   return i + 1;
+
+   return 0;
+}
+EXPORT_SYMBOL(drm_mode_cea_vic);
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index c0635b7..3538eda 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -1055,6 +1055,7 @@ extern struct drm_display_mode 
*drm_gtf_mode_complex(struct drm_device *dev,
int GTF_2C, int GTF_K, int GTF_2J);
 extern int drm_add_modes_noedid(struct drm_connector *connector,
int hdisplay, int vdisplay);
+extern uint8_t drm_mode_cea_vic(const struct drm_display_mode *mode);
 
 extern int drm_edid_header_is_valid(const u8 *raw_edid);
 extern bool drm_edid_block_valid(u8 *raw_edid, int block, bool print_bad_edid);
-- 
1.7.10.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/i915: set the AVI VIC of the HDMI mode

2012-11-23 Thread Thierry Reding
On Fri, Nov 23, 2012 at 11:46:10AM -0200, Paulo Zanoni wrote:
> Hi
> 
> 2012/11/22 Thierry Reding :
> > On Wed, Nov 21, 2012 at 01:39:48PM -0200, Paulo Zanoni wrote:
[...]
> >> + * @mode: mode
> >> + *
> >> + * RETURNS:
> >> + * The VIC number, 0 in case it's not a CEA-861 mode.
> >> + */
> >> +uint8_t drm_mode_cea_vic(const struct drm_display_mode *mode)
> >
> > I understand the reason for returning an uint8_t here, but ...
> >
> >> +{
> >> + uint8_t i;
> >> +
> >> + for (i = 0; i < drm_num_cea_modes; i++)
> >
> > ... maybe unsigned int would be better for the iteration variable here.
> > Looking at drm_edid_modes.h, drm_num_cea_modes is actually signed, which
> > isn't necessary to store an array size, so maybe that should be changed
> > as well.
> 
> I used uint8_t because "i" is the thing we return. I don't think
> there's a perfect solution to this problem and I don't really think it
> matters too much.

Fair enough, uint8_t should work fine.

Thierry


pgpeKDXEO5UZC.pgp
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/i915: set the AVI VIC of the HDMI mode

2012-11-23 Thread Paulo Zanoni
Hi

2012/11/22 Thierry Reding :
> On Wed, Nov 21, 2012 at 01:39:48PM -0200, Paulo Zanoni wrote:
>> From: Paulo Zanoni 
>>
>> We currently set "0" as the VIC value of the AVI InfoFrames. According
>> to the specs this should be fine and work for every mode, so to my
>> point of view we can't consider the current behavior as a bug. The
>> problem is that  we recently received a bug report (Kernel bug #50371)
>> from a user that has an AV receiver that gives a black screen for any
>> mode with VIC set to 0.
>>
>> So in order to make at least some modes work for him, this patch sets
>> the correct VIC number when sending AVI InfoFrames. We add a generic
>> drm function to calculate the VIC number and then call it from the
>> i915 driver.
>>
>> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=50371
>> Cc: Thierry Reding 
>> Signed-off-by: Paulo Zanoni 
>> ---
>>  drivers/gpu/drm/drm_edid.c|   19 +++
>>  drivers/gpu/drm/drm_modes.c   |3 ++-
>>  drivers/gpu/drm/i915/intel_hdmi.c |2 ++
>>  include/drm/drm_crtc.h|4 +++-
>>  4 files changed, 26 insertions(+), 2 deletions(-)
>>
>> Patch applies on top of Daniel's drm-intel-next-queued. I'm not sure who 
>> exactly
>> is going to merge this (Dave or Daniel).
>>
>> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
>> index fadcd44..c57fc46 100644
>> --- a/drivers/gpu/drm/drm_edid.c
>> +++ b/drivers/gpu/drm/drm_edid.c
>> @@ -2062,3 +2062,22 @@ int drm_add_modes_noedid(struct drm_connector 
>> *connector,
>>   return num_modes;
>>  }
>>  EXPORT_SYMBOL(drm_add_modes_noedid);
>> +
>> +/**
>> + * drm_mode_vic - return the CEA-861 VIC of a given mode
>
> The name in the comment here doesn't match the actual function name.

Will fix.

>
>> + * @mode: mode
>> + *
>> + * RETURNS:
>> + * The VIC number, 0 in case it's not a CEA-861 mode.
>> + */
>> +uint8_t drm_mode_cea_vic(const struct drm_display_mode *mode)
>
> I understand the reason for returning an uint8_t here, but ...
>
>> +{
>> + uint8_t i;
>> +
>> + for (i = 0; i < drm_num_cea_modes; i++)
>
> ... maybe unsigned int would be better for the iteration variable here.
> Looking at drm_edid_modes.h, drm_num_cea_modes is actually signed, which
> isn't necessary to store an array size, so maybe that should be changed
> as well.

I used uint8_t because "i" is the thing we return. I don't think
there's a perfect solution to this problem and I don't really think it
matters too much.

>
>> + if (drm_mode_equal(mode, &edid_cea_modes[i]))
>> + return i + 1;
>> +
>> + return 0;
>> +}
>> +EXPORT_SYMBOL(drm_mode_cea_vic);
>> diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
>> index 59450f3..9ef6750 100644
>> --- a/drivers/gpu/drm/drm_modes.c
>> +++ b/drivers/gpu/drm/drm_modes.c
>> @@ -768,7 +768,8 @@ EXPORT_SYMBOL(drm_mode_duplicate);
>>   * RETURNS:
>>   * True if the modes are equal, false otherwise.
>>   */
>> -bool drm_mode_equal(struct drm_display_mode *mode1, struct drm_display_mode 
>> *mode2)
>> +bool drm_mode_equal(const struct drm_display_mode *mode1,
>> + const struct drm_display_mode *mode2)
>
> I think this change warrants a separate commit.

I just noticed Dave's tree already has these things as const. So V2
will be based on Dave's drm-next tree.

>
> Thierry



-- 
Paulo Zanoni
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[drm-intel:drm-intel-next-queued 31/31] drivers/gpu/drm/i915/intel_lvds.c:1098:34: error: 'mode' undeclared

2012-11-23 Thread kbuild test robot
tree:   git://people.freedesktop.org/~danvet/drm-intel.git drm-intel-next-queued
head:   9352dce341352e32a221aabf03f8b7c7b141c96a
commit: 9352dce341352e32a221aabf03f8b7c7b141c96a [31/31] drm/i915: Report the 
origin of the LVDS fixed panel mode
config: make ARCH=x86_64 allmodconfig

All error/warnings:

drivers/gpu/drm/i915/intel_lvds.c: In function 'intel_lvds_init':
drivers/gpu/drm/i915/intel_lvds.c:1098:34: error: 'mode' undeclared (first use 
in this function)
drivers/gpu/drm/i915/intel_lvds.c:1098:34: note: each undeclared identifier is 
reported only once for each function it appears in

vim +1098 +/mode drivers/gpu/drm/i915/intel_lvds.c

f875c15a Chris Wilson 2010-09-09  1092  crtc = 
intel_get_crtc_for_pipe(dev, pipe);
79e53945 Jesse Barnes 2008-11-07  1093  
79e53945 Jesse Barnes 2008-11-07  1094  if (crtc && (lvds & 
LVDS_PORT_EN)) {
dd06f90e Jani Nikula  2012-10-19  1095  fixed_mode = 
intel_crtc_mode_get(dev, crtc);
dd06f90e Jani Nikula  2012-10-19  1096  if (fixed_mode) {
9352dce3 Chris Wilson 2012-11-21  1097  
DRM_DEBUG_KMS("using current (BIOS) mode: ");
9352dce3 Chris Wilson 2012-11-21 @1098  
drm_mode_debug_printmodeline(&mode);
dd06f90e Jani Nikula  2012-10-19  1099  
fixed_mode->type |= DRM_MODE_TYPE_PREFERRED;
565dcd46 Paul Collins 2009-02-04  1100  goto out;
79e53945 Jesse Barnes 2008-11-07  1101  }

---
0-DAY kernel build testing backend Open Source Technology Center
Fengguang Wu, Yuanhan Liu  Intel Corporation


Re: [PATCHv14 4/7] fbmon: add videomode helpers

2012-11-23 Thread Steffen Trumtrar
Hi Laurent,

On Fri, Nov 23, 2012 at 11:53:10AM +0100, Laurent Pinchart wrote:
> Hi Steffen,
> 
> On Friday 23 November 2012 10:04:24 Steffen Trumtrar wrote:
> > Add a function to convert from the generic videomode to a fb_videomode.
> > 
> > Signed-off-by: Steffen Trumtrar 
> > Reviewed-by: Thierry Reding 
> > Acked-by: Thierry Reding 
> > Tested-by: Thierry Reding 
> > Tested-by: Philipp Zabel 
> > Reviewed-by: Laurent Pinchart 
> > Acked-by: Laurent Pinchart 
> > ---
> >  drivers/video/fbmon.c |   49 ++
> >  include/linux/fb.h|6 ++
> >  2 files changed, 55 insertions(+)
> > 
> > diff --git a/drivers/video/fbmon.c b/drivers/video/fbmon.c
> > index cef6557..bcbfe8f 100644
> > --- a/drivers/video/fbmon.c
> > +++ b/drivers/video/fbmon.c
> > @@ -31,6 +31,7 @@
> >  #include 
> >  #include 
> >  #include 
> > +#include 
> 
> You could move this one line up to keep headers sorted alphabetically 
> (assuming they are in the first place).
> 

Because of the careless mistake below, I will do that.

> >  #ifdef CONFIG_PPC_OF
> >  #include 
> >  #include 
> > @@ -1373,6 +1374,54 @@ int fb_get_mode(int flags, u32 val, struct
> > fb_var_screeninfo *var, struct fb_inf kfree(timings);
> > return err;
> >  }
> > +
> > +#if IS_ENABLED(CONFIG_VIDEOMODE)
> > +int fb_videomode_from_videomode(const struct videomode *vm,
> > +   struct fb_videomode *fbmode)
> 
> This is inside the #if CONFIG_FB_MODE_HELPERS block, is that intentional ?
> 

Yes. Intentional. It is a fb_mode helper, that is why ... oh, wait. I should
add a "depends on" to the Kconfig then.

> > +{
> > +   unsigned int htotal, vtotal;
> > +
> > +   fbmode->xres = vm->hactive;
> > +   fbmode->left_margin = vm->hback_porch;
> > +   fbmode->right_margin = vm->hfront_porch;
> > +   fbmode->hsync_len = vm->hsync_len;
> > +
> > +   fbmode->yres = vm->vactive;
> > +   fbmode->upper_margin = vm->vback_porch;
> > +   fbmode->lower_margin = vm->vfront_porch;
> > +   fbmode->vsync_len = vm->vsync_len;
> > +
> > +   /* prevent division by zero in KHZ2PICOS macro */
> > +   fbmode->pixclock = vm->pixelclock ? KHZ2PICOS(vm->pixelclock / 1000) : 
> > 0;
> > +
> > +   fbmode->sync = 0;
> > +   fbmode->vmode = 0;
> > +   if (vm->hah)
> > +   fbmode->sync |= FB_SYNC_HOR_HIGH_ACT;
> > +   if (vm->vah)
> > +   fbmode->sync |= FB_SYNC_VERT_HIGH_ACT;
> > +   if (vm->interlaced)
> > +   fbmode->vmode |= FB_VMODE_INTERLACED;
> > +   if (vm->doublescan)
> > +   fbmode->vmode |= FB_VMODE_DOUBLE;
> > +   fbmode->flag = 0;
> > +
> > +   htotal = vm->hactive + vm->hfront_porch + vm->hback_porch +
> > +vm->hsync_len;
> > +   vtotal = vm->vactive + vm->vfront_porch + vm->vback_porch +
> > +vm->vsync_len;
> > +   /* prevent division by zero */
> > +   if (htotal && vtotal)
> > +   fbmode->refresh = vm->pixelclock / (htotal * vtotal);
> > +   else
> > +   fbmode->refresh = vm->pixelclock;
> 
> What about returning an error if htotal * vtotal == 0 ? The input is clearly 
> invalid in that case. I would then set fbmode->refresh to 0, setting it to vm-
> >pixelclock doesn't really make sense.
> 

Yes, pixelclock makes no sense. It was supposed to be 0. I was careless here.

> > +
> > +   return 0;
> > +}
> > +EXPORT_SYMBOL_GPL(fb_videomode_from_videomode);
> > +#endif
> > +
> > +
> 
> A single blank line should be enough.
> 

Regards,
Steffen

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm: exynos: hdmi: sending AVI and AUI info frames

2012-11-23 Thread Rahul Sharma
Hi Mr. Dae,

On Fri, Nov 23, 2012 at 3:38 PM, Inki Dae  wrote:
> Sorry but could you re-send this one more time? below is my comment.
>
> Thanks,
> Inki Dae
>
>> -Original Message-
>> From: Rahul Sharma [mailto:rahul.sha...@samsung.com]
>> Sent: Friday, November 23, 2012 6:17 PM
>> To: dri-devel@lists.freedesktop.org
>> Cc: airl...@redhat.com; inki@samsung.com; kgene@samsung.com;
>> r.sh.o...@gmail.com; marc...@chromium.org; sw0312@samsung.com;
>> kyungmin.p...@samsung.com
>> Subject: [PATCH] drm: exynos: hdmi: sending AVI and AUI info frames
>>
>> This patch adds code for composing AVI and AUI info frames
>> and send them every VSYNC.
>>
>> This patch is important for hdmi certification.
>>
>> Signed-off-by: Rahul Sharma 
>> Signed-off-by: Fahad Kunnathadi 
>> Signed-off-by: Shirish S 
>>
>> Based on exynos-drm-next branch of
>> http://git.kernel.org/?p=linux/kernel/git/daeinki/drm-exynos.git
>> ---
>>  drivers/gpu/drm/exynos/exynos_hdmi.c |  139
>> +-
>>  drivers/gpu/drm/exynos/exynos_hdmi.h |   23 ++
>>  drivers/gpu/drm/exynos/regs-hdmi.h   |   17 -
>>  3 files changed, 158 insertions(+), 21 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c
>> b/drivers/gpu/drm/exynos/exynos_hdmi.c
>> index 59839cc..49332bd 100644
>> --- a/drivers/gpu/drm/exynos/exynos_hdmi.c
>> +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
>> @@ -183,6 +183,7 @@ struct hdmi_v13_conf {
>>   int height;
>>   int vrefresh;
>>   bool interlace;
>> + int cea_video_id;
>>   const u8 *hdmiphy_data;
>>   const struct hdmi_v13_preset_conf *conf;
>>  };
>> @@ -354,15 +355,20 @@ static const struct hdmi_v13_preset_conf
>> hdmi_v13_conf_1080p60 = {
>>  };
>>
>>  static const struct hdmi_v13_conf hdmi_v13_confs[] = {
>> - { 1280, 720, 60, false, hdmiphy_v13_conf74_25,
>> &hdmi_v13_conf_720p60 },
>> - { 1280, 720, 50, false, hdmiphy_v13_conf74_25,
>> &hdmi_v13_conf_720p60 },
>> - { 720, 480, 60, false, hdmiphy_v13_conf27_027,
>> &hdmi_v13_conf_480p },
>> - { 1920, 1080, 50, true, hdmiphy_v13_conf74_25,
>> &hdmi_v13_conf_1080i50 },
>> - { 1920, 1080, 50, false, hdmiphy_v13_conf148_5,
>> -  &hdmi_v13_conf_1080p50 },
>> - { 1920, 1080, 60, true, hdmiphy_v13_conf74_25,
>> &hdmi_v13_conf_1080i60 },
>> - { 1920, 1080, 60, false, hdmiphy_v13_conf148_5,
>> -  &hdmi_v13_conf_1080p60 },
>> + { 1280, 720, 60, false, 4, hdmiphy_v13_conf74_25,
>> + &hdmi_v13_conf_720p60 },
>> + { 1280, 720, 50, false, 19, hdmiphy_v13_conf74_25,
>> + &hdmi_v13_conf_720p60 },
>> + { 720, 480, 60, false, 3, hdmiphy_v13_conf27_027,
>> + &hdmi_v13_conf_480p },
>> + { 1920, 1080, 50, true, 20, hdmiphy_v13_conf74_25,
>> + &hdmi_v13_conf_1080i50 },
>> + { 1920, 1080, 50, false, 31, hdmiphy_v13_conf148_5,
>> + &hdmi_v13_conf_1080p50 },
>> + { 1920, 1080, 60, true, 5, hdmiphy_v13_conf74_25,
>> + &hdmi_v13_conf_1080i60 },
>> + { 1920, 1080, 60, false, 16, hdmiphy_v13_conf148_5,
>> + &hdmi_v13_conf_1080p60 },
>>  };
>>
>>  /* HDMI Version 1.4 */
>> @@ -480,6 +486,7 @@ struct hdmi_conf {
>>   int height;
>>   int vrefresh;
>>   bool interlace;
>> + int cea_video_id;
>>   const u8 *hdmiphy_data;
>>   const struct hdmi_preset_conf *conf;
>>  };
>> @@ -935,16 +942,21 @@ static const struct hdmi_preset_conf
>> hdmi_conf_1080p60 = {
>>  };
>>
>>  static const struct hdmi_conf hdmi_confs[] = {
>> - { 720, 480, 60, false, hdmiphy_conf27_027, &hdmi_conf_480p60 },
>> - { 1280, 720, 50, false, hdmiphy_conf74_25, &hdmi_conf_720p50 },
>> - { 1280, 720, 60, false, hdmiphy_conf74_25, &hdmi_conf_720p60 },
>> - { 1920, 1080, 50, true, hdmiphy_conf74_25, &hdmi_conf_1080i50 },
>> - { 1920, 1080, 60, true, hdmiphy_conf74_25, &hdmi_conf_1080i60 },
>> - { 1920, 1080, 30, false, hdmiphy_conf74_176, &hdmi_conf_1080p30 },
>> - { 1920, 1080, 50, false, hdmiphy_conf148_5, &hdmi_conf_1080p50 },
>> - { 1920, 1080, 60, false, hdmiphy_conf148_5, &hdmi_conf_1080p60 },
>> + { 720, 480, 60, false, 3, hdmiphy_conf27_027, &hdmi_conf_480p60 },
>> + { 1280, 720, 50, false, 19, hdmiphy_conf74_25, &hdmi_conf_720p50 },
>> + { 1280, 720, 60, false, 4, hdmiphy_conf74_25, &hdmi_conf_720p60 },
>> + { 1920, 1080, 50, true, 20, hdmiphy_conf74_25, &hdmi_conf_1080i50 },
>> + { 1920, 1080, 60, true, 5, hdmiphy_conf74_25, &hdmi_conf_1080i60 },
>> + { 1920, 1080, 30, false, 34, hdmiphy_conf74_176,
>> &hdmi_conf_1080p30 },
>> + { 1920, 1080, 50, false, 31, hdmiphy_conf148_5,
>> &hdmi_conf_1080p50 },
>> + { 1920, 1080, 60, false, 16, hdmiphy_conf148_5,
>> &hdmi_conf_1080p60 },
>>  };
>>
>> +struct hdmi_infoframe {
>> + enum HDMI_PACKET_TYPE type;
>> + u8 ver;
>> + u8 len;
>> +};
>>
>>  static inline 

Re: [PATCHv14 4/7] fbmon: add videomode helpers

2012-11-23 Thread Laurent Pinchart
Hi Steffen,

On Friday 23 November 2012 10:04:24 Steffen Trumtrar wrote:
> Add a function to convert from the generic videomode to a fb_videomode.
> 
> Signed-off-by: Steffen Trumtrar 
> Reviewed-by: Thierry Reding 
> Acked-by: Thierry Reding 
> Tested-by: Thierry Reding 
> Tested-by: Philipp Zabel 
> Reviewed-by: Laurent Pinchart 
> Acked-by: Laurent Pinchart 
> ---
>  drivers/video/fbmon.c |   49 ++
>  include/linux/fb.h|6 ++
>  2 files changed, 55 insertions(+)
> 
> diff --git a/drivers/video/fbmon.c b/drivers/video/fbmon.c
> index cef6557..bcbfe8f 100644
> --- a/drivers/video/fbmon.c
> +++ b/drivers/video/fbmon.c
> @@ -31,6 +31,7 @@
>  #include 
>  #include 
>  #include 
> +#include 

You could move this one line up to keep headers sorted alphabetically 
(assuming they are in the first place).

>  #ifdef CONFIG_PPC_OF
>  #include 
>  #include 
> @@ -1373,6 +1374,54 @@ int fb_get_mode(int flags, u32 val, struct
> fb_var_screeninfo *var, struct fb_inf kfree(timings);
>   return err;
>  }
> +
> +#if IS_ENABLED(CONFIG_VIDEOMODE)
> +int fb_videomode_from_videomode(const struct videomode *vm,
> + struct fb_videomode *fbmode)

This is inside the #if CONFIG_FB_MODE_HELPERS block, is that intentional ?

> +{
> + unsigned int htotal, vtotal;
> +
> + fbmode->xres = vm->hactive;
> + fbmode->left_margin = vm->hback_porch;
> + fbmode->right_margin = vm->hfront_porch;
> + fbmode->hsync_len = vm->hsync_len;
> +
> + fbmode->yres = vm->vactive;
> + fbmode->upper_margin = vm->vback_porch;
> + fbmode->lower_margin = vm->vfront_porch;
> + fbmode->vsync_len = vm->vsync_len;
> +
> + /* prevent division by zero in KHZ2PICOS macro */
> + fbmode->pixclock = vm->pixelclock ? KHZ2PICOS(vm->pixelclock / 1000) : 
> 0;
> +
> + fbmode->sync = 0;
> + fbmode->vmode = 0;
> + if (vm->hah)
> + fbmode->sync |= FB_SYNC_HOR_HIGH_ACT;
> + if (vm->vah)
> + fbmode->sync |= FB_SYNC_VERT_HIGH_ACT;
> + if (vm->interlaced)
> + fbmode->vmode |= FB_VMODE_INTERLACED;
> + if (vm->doublescan)
> + fbmode->vmode |= FB_VMODE_DOUBLE;
> + fbmode->flag = 0;
> +
> + htotal = vm->hactive + vm->hfront_porch + vm->hback_porch +
> +  vm->hsync_len;
> + vtotal = vm->vactive + vm->vfront_porch + vm->vback_porch +
> +  vm->vsync_len;
> + /* prevent division by zero */
> + if (htotal && vtotal)
> + fbmode->refresh = vm->pixelclock / (htotal * vtotal);
> + else
> + fbmode->refresh = vm->pixelclock;

What about returning an error if htotal * vtotal == 0 ? The input is clearly 
invalid in that case. I would then set fbmode->refresh to 0, setting it to vm-
>pixelclock doesn't really make sense.

> +
> + return 0;
> +}
> +EXPORT_SYMBOL_GPL(fb_videomode_from_videomode);
> +#endif
> +
> +

A single blank line should be enough.

>  #else
>  int fb_parse_edid(unsigned char *edid, struct fb_var_screeninfo *var)
>  {
> diff --git a/include/linux/fb.h b/include/linux/fb.h
> index c7a9571..4404ec2 100644
> --- a/include/linux/fb.h
> +++ b/include/linux/fb.h
> @@ -19,6 +19,7 @@ struct vm_area_struct;
>  struct fb_info;
>  struct device;
>  struct file;
> +struct videomode;
> 
>  /* Definitions below are used in the parsed monitor specs */
>  #define FB_DPMS_ACTIVE_OFF   1
> @@ -714,6 +715,11 @@ extern void fb_destroy_modedb(struct fb_videomode
> *modedb); extern int fb_find_mode_cvt(struct fb_videomode *mode, int
> margins, int rb); extern unsigned char *fb_ddc_read(struct i2c_adapter
> *adapter);
> 
> +#if IS_ENABLED(CONFIG_VIDEOMODE)
> +extern int fb_videomode_from_videomode(const struct videomode *vm,
> +struct fb_videomode *fbmode);
> +#endif
> +
>  /* drivers/video/modedb.c */
>  #define VESA_MODEDB_SIZE 34
>  extern void fb_var_to_videomode(struct fb_videomode *mode,
-- 
Regards,

Laurent Pinchart

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 1/1] drm/exynos: remove unnecessary clk_disable calls in exynos_drm_fimd.c

2012-11-23 Thread Sachin Kamat
Also fixes an error related to returning 'ret' without initialising
with error code.

Signed-off-by: Sachin Kamat 
---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c |   22 +-
 1 files changed, 5 insertions(+), 17 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 57851cc..00bd266 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -849,15 +849,13 @@ static int __devinit fimd_probe(struct platform_device 
*pdev)
ctx->bus_clk = devm_clk_get(dev, "fimd");
if (IS_ERR(ctx->bus_clk)) {
dev_err(dev, "failed to get bus clock\n");
-   ret = PTR_ERR(ctx->bus_clk);
-   goto err_clk_get;
+   return PTR_ERR(ctx->bus_clk);
}
 
ctx->lcd_clk = devm_clk_get(dev, "sclk_fimd");
if (IS_ERR(ctx->lcd_clk)) {
dev_err(dev, "failed to get lcd clock\n");
-   ret = PTR_ERR(ctx->lcd_clk);
-   goto err_bus_clk;
+   return PTR_ERR(ctx->lcd_clk);
}
 
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -865,14 +863,13 @@ static int __devinit fimd_probe(struct platform_device 
*pdev)
ctx->regs = devm_request_and_ioremap(&pdev->dev, res);
if (!ctx->regs) {
dev_err(dev, "failed to map registers\n");
-   ret = -ENXIO;
-   goto err_clk;
+   return -ENXIO;
}
 
res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
if (!res) {
dev_err(dev, "irq request failed.\n");
-   goto err_clk;
+   return -ENXIO;
}
 
ctx->irq = res->start;
@@ -881,7 +878,7 @@ static int __devinit fimd_probe(struct platform_device 
*pdev)
0, "drm_fimd", ctx);
if (ret) {
dev_err(dev, "irq request failed.\n");
-   goto err_clk;
+   return ret;
}
 
ctx->vidcon0 = pdata->vidcon0;
@@ -915,15 +912,6 @@ static int __devinit fimd_probe(struct platform_device 
*pdev)
exynos_drm_subdrv_register(subdrv);
 
return 0;
-
-err_clk:
-   clk_disable(ctx->lcd_clk);
-
-err_bus_clk:
-   clk_disable(ctx->bus_clk);
-
-err_clk_get:
-   return ret;
 }
 
 static int __devexit fimd_remove(struct platform_device *pdev)
-- 
1.7.4.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH Resend] drm/exynos: Use devm_clk_get in exynos_drm_fimd.c

2012-11-23 Thread Sachin Kamat
On 23 November 2012 15:21, Inki Dae  wrote:
> The subject mentions just only 'use devm_clk_get in exynos_dev_fimd.c' but
> this patch removes unnecessary clk_disable calls also. Just separate this
> patch into two as you mentioned. For this, already applied old one. So could
> you send another one? Sorry for inconvenient. :)

He he.. no problem.. i will send another patch which just contains
removing clk_disable.

>
> Thanks,
> Inki Dae
>
>> -Original Message-
>> From: Sachin Kamat [mailto:sachin.ka...@linaro.org]
>> Sent: Friday, November 23, 2012 5:43 PM
>> To: dri-devel@lists.freedesktop.org
>> Cc: inki@samsung.com; sachin.ka...@linaro.org; patc...@linaro.org
>> Subject: [PATCH Resend] drm/exynos: Use devm_clk_get in exynos_drm_fimd.c
>>
>> devm_clk_get is device managed and makes error handling and exit code
>> simpler.
>>
>> Signed-off-by: Sachin Kamat 
>> ---
>>  drivers/gpu/drm/exynos/exynos_drm_fimd.c |   31
> ++
>> ---
>>  1 files changed, 7 insertions(+), 24 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
>> b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
>> index ad04edd..00bd266 100644
>> --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
>> +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
>> @@ -846,18 +846,16 @@ static int __devinit fimd_probe(struct
>> platform_device *pdev)
>>   if (!ctx)
>>   return -ENOMEM;
>>
>> - ctx->bus_clk = clk_get(dev, "fimd");
>> + ctx->bus_clk = devm_clk_get(dev, "fimd");
>>   if (IS_ERR(ctx->bus_clk)) {
>>   dev_err(dev, "failed to get bus clock\n");
>> - ret = PTR_ERR(ctx->bus_clk);
>> - goto err_clk_get;
>> + return PTR_ERR(ctx->bus_clk);
>>   }
>>
>> - ctx->lcd_clk = clk_get(dev, "sclk_fimd");
>> + ctx->lcd_clk = devm_clk_get(dev, "sclk_fimd");
>>   if (IS_ERR(ctx->lcd_clk)) {
>>   dev_err(dev, "failed to get lcd clock\n");
>> - ret = PTR_ERR(ctx->lcd_clk);
>> - goto err_bus_clk;
>> + return PTR_ERR(ctx->lcd_clk);
>>   }
>>
>>   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>> @@ -865,14 +863,13 @@ static int __devinit fimd_probe(struct
>> platform_device *pdev)
>>   ctx->regs = devm_request_and_ioremap(&pdev->dev, res);
>>   if (!ctx->regs) {
>>   dev_err(dev, "failed to map registers\n");
>> - ret = -ENXIO;
>> - goto err_clk;
>> + return -ENXIO;
>>   }
>>
>>   res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
>>   if (!res) {
>>   dev_err(dev, "irq request failed.\n");
>> - goto err_clk;
>> + return -ENXIO;
>>   }
>>
>>   ctx->irq = res->start;
>> @@ -881,7 +878,7 @@ static int __devinit fimd_probe(struct platform_device
>> *pdev)
>>   0, "drm_fimd", ctx);
>>   if (ret) {
>>   dev_err(dev, "irq request failed.\n");
>> - goto err_clk;
>> + return ret;
>>   }
>>
>>   ctx->vidcon0 = pdata->vidcon0;
>> @@ -915,17 +912,6 @@ static int __devinit fimd_probe(struct
>> platform_device *pdev)
>>   exynos_drm_subdrv_register(subdrv);
>>
>>   return 0;
>> -
>> -err_clk:
>> - clk_disable(ctx->lcd_clk);
>> - clk_put(ctx->lcd_clk);
>> -
>> -err_bus_clk:
>> - clk_disable(ctx->bus_clk);
>> - clk_put(ctx->bus_clk);
>> -
>> -err_clk_get:
>> - return ret;
>>  }
>>
>>  static int __devexit fimd_remove(struct platform_device *pdev)
>> @@ -949,9 +935,6 @@ static int __devexit fimd_remove(struct
>> platform_device *pdev)
>>  out:
>>   pm_runtime_disable(dev);
>>
>> - clk_put(ctx->lcd_clk);
>> - clk_put(ctx->bus_clk);
>> -
>>   return 0;
>>  }
>>
>> --
>> 1.7.4.1
>



-- 
With warm regards,
Sachin
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH] drm: exynos: hdmi: sending AVI and AUI info frames

2012-11-23 Thread Rahul Sharma
This patch adds code for composing AVI and AUI info frames
and send them every VSYNC.

This patch is important for hdmi certification.

Signed-off-by: Rahul Sharma 
Signed-off-by: Fahad Kunnathadi 
Signed-off-by: Shirish S 

Based on exynos-drm-next branch of
http://git.kernel.org/?p=linux/kernel/git/daeinki/drm-exynos.git
---
 drivers/gpu/drm/exynos/exynos_hdmi.c |  139 +-
 drivers/gpu/drm/exynos/exynos_hdmi.h |   23 ++
 drivers/gpu/drm/exynos/regs-hdmi.h   |   17 -
 3 files changed, 158 insertions(+), 21 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c 
b/drivers/gpu/drm/exynos/exynos_hdmi.c
index 59839cc..49332bd 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -183,6 +183,7 @@ struct hdmi_v13_conf {
int height;
int vrefresh;
bool interlace;
+   int cea_video_id;
const u8 *hdmiphy_data;
const struct hdmi_v13_preset_conf *conf;
 };
@@ -354,15 +355,20 @@ static const struct hdmi_v13_preset_conf 
hdmi_v13_conf_1080p60 = {
 };
 
 static const struct hdmi_v13_conf hdmi_v13_confs[] = {
-   { 1280, 720, 60, false, hdmiphy_v13_conf74_25, &hdmi_v13_conf_720p60 },
-   { 1280, 720, 50, false, hdmiphy_v13_conf74_25, &hdmi_v13_conf_720p60 },
-   { 720, 480, 60, false, hdmiphy_v13_conf27_027, &hdmi_v13_conf_480p },
-   { 1920, 1080, 50, true, hdmiphy_v13_conf74_25, &hdmi_v13_conf_1080i50 },
-   { 1920, 1080, 50, false, hdmiphy_v13_conf148_5,
-&hdmi_v13_conf_1080p50 },
-   { 1920, 1080, 60, true, hdmiphy_v13_conf74_25, &hdmi_v13_conf_1080i60 },
-   { 1920, 1080, 60, false, hdmiphy_v13_conf148_5,
-&hdmi_v13_conf_1080p60 },
+   { 1280, 720, 60, false, 4, hdmiphy_v13_conf74_25,
+   &hdmi_v13_conf_720p60 },
+   { 1280, 720, 50, false, 19, hdmiphy_v13_conf74_25,
+   &hdmi_v13_conf_720p60 },
+   { 720, 480, 60, false, 3, hdmiphy_v13_conf27_027,
+   &hdmi_v13_conf_480p },
+   { 1920, 1080, 50, true, 20, hdmiphy_v13_conf74_25,
+   &hdmi_v13_conf_1080i50 },
+   { 1920, 1080, 50, false, 31, hdmiphy_v13_conf148_5,
+   &hdmi_v13_conf_1080p50 },
+   { 1920, 1080, 60, true, 5, hdmiphy_v13_conf74_25,
+   &hdmi_v13_conf_1080i60 },
+   { 1920, 1080, 60, false, 16, hdmiphy_v13_conf148_5,
+   &hdmi_v13_conf_1080p60 },
 };
 
 /* HDMI Version 1.4 */
@@ -480,6 +486,7 @@ struct hdmi_conf {
int height;
int vrefresh;
bool interlace;
+   int cea_video_id;
const u8 *hdmiphy_data;
const struct hdmi_preset_conf *conf;
 };
@@ -935,16 +942,21 @@ static const struct hdmi_preset_conf hdmi_conf_1080p60 = {
 };
 
 static const struct hdmi_conf hdmi_confs[] = {
-   { 720, 480, 60, false, hdmiphy_conf27_027, &hdmi_conf_480p60 },
-   { 1280, 720, 50, false, hdmiphy_conf74_25, &hdmi_conf_720p50 },
-   { 1280, 720, 60, false, hdmiphy_conf74_25, &hdmi_conf_720p60 },
-   { 1920, 1080, 50, true, hdmiphy_conf74_25, &hdmi_conf_1080i50 },
-   { 1920, 1080, 60, true, hdmiphy_conf74_25, &hdmi_conf_1080i60 },
-   { 1920, 1080, 30, false, hdmiphy_conf74_176, &hdmi_conf_1080p30 },
-   { 1920, 1080, 50, false, hdmiphy_conf148_5, &hdmi_conf_1080p50 },
-   { 1920, 1080, 60, false, hdmiphy_conf148_5, &hdmi_conf_1080p60 },
+   { 720, 480, 60, false, 3, hdmiphy_conf27_027, &hdmi_conf_480p60 },
+   { 1280, 720, 50, false, 19, hdmiphy_conf74_25, &hdmi_conf_720p50 },
+   { 1280, 720, 60, false, 4, hdmiphy_conf74_25, &hdmi_conf_720p60 },
+   { 1920, 1080, 50, true, 20, hdmiphy_conf74_25, &hdmi_conf_1080i50 },
+   { 1920, 1080, 60, true, 5, hdmiphy_conf74_25, &hdmi_conf_1080i60 },
+   { 1920, 1080, 30, false, 34, hdmiphy_conf74_176, &hdmi_conf_1080p30 },
+   { 1920, 1080, 50, false, 31, hdmiphy_conf148_5, &hdmi_conf_1080p50 },
+   { 1920, 1080, 60, false, 16, hdmiphy_conf148_5, &hdmi_conf_1080p60 },
 };
 
+struct hdmi_infoframe {
+   enum HDMI_PACKET_TYPE type;
+   u8 ver;
+   u8 len;
+};
 
 static inline u32 hdmi_reg_read(struct hdmi_context *hdata, u32 reg_id)
 {
@@ -1268,6 +1280,85 @@ static int hdmi_conf_index(struct hdmi_context *hdata,
return hdmi_v14_conf_index(mode);
 }
 
+static u8 hdmi_chksum(struct hdmi_context *hdata,
+   u32 start, u8 len, u32 hdr_sum)
+{
+   int i;
+   /* hdr_sum : header0 + header1 + header2
+   * start : start address of packet byte1
+   * len : packet bytes - 1 */
+   for (i = 0; i < len; ++i)
+   hdr_sum += 0xff & hdmi_reg_read(hdata, start + i * 4);
+
+   return (u8)(0x100 - (hdr_sum & 0xff));
+}
+
+void hdmi_reg_infoframe(struct hdmi_context *hdata,
+   struct hdmi_infoframe *infoframe)
+{
+   u32 hdr_sum;
+   u8 chksum;
+   u32 asp

[PATCH Resend] drm/exynos: Use devm_clk_get in exynos_drm_fimd.c

2012-11-23 Thread Sachin Kamat
devm_clk_get is device managed and makes error handling and exit code
simpler.

Signed-off-by: Sachin Kamat 
---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c |   31 ++---
 1 files changed, 7 insertions(+), 24 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index ad04edd..00bd266 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -846,18 +846,16 @@ static int __devinit fimd_probe(struct platform_device 
*pdev)
if (!ctx)
return -ENOMEM;
 
-   ctx->bus_clk = clk_get(dev, "fimd");
+   ctx->bus_clk = devm_clk_get(dev, "fimd");
if (IS_ERR(ctx->bus_clk)) {
dev_err(dev, "failed to get bus clock\n");
-   ret = PTR_ERR(ctx->bus_clk);
-   goto err_clk_get;
+   return PTR_ERR(ctx->bus_clk);
}
 
-   ctx->lcd_clk = clk_get(dev, "sclk_fimd");
+   ctx->lcd_clk = devm_clk_get(dev, "sclk_fimd");
if (IS_ERR(ctx->lcd_clk)) {
dev_err(dev, "failed to get lcd clock\n");
-   ret = PTR_ERR(ctx->lcd_clk);
-   goto err_bus_clk;
+   return PTR_ERR(ctx->lcd_clk);
}
 
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -865,14 +863,13 @@ static int __devinit fimd_probe(struct platform_device 
*pdev)
ctx->regs = devm_request_and_ioremap(&pdev->dev, res);
if (!ctx->regs) {
dev_err(dev, "failed to map registers\n");
-   ret = -ENXIO;
-   goto err_clk;
+   return -ENXIO;
}
 
res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
if (!res) {
dev_err(dev, "irq request failed.\n");
-   goto err_clk;
+   return -ENXIO;
}
 
ctx->irq = res->start;
@@ -881,7 +878,7 @@ static int __devinit fimd_probe(struct platform_device 
*pdev)
0, "drm_fimd", ctx);
if (ret) {
dev_err(dev, "irq request failed.\n");
-   goto err_clk;
+   return ret;
}
 
ctx->vidcon0 = pdata->vidcon0;
@@ -915,17 +912,6 @@ static int __devinit fimd_probe(struct platform_device 
*pdev)
exynos_drm_subdrv_register(subdrv);
 
return 0;
-
-err_clk:
-   clk_disable(ctx->lcd_clk);
-   clk_put(ctx->lcd_clk);
-
-err_bus_clk:
-   clk_disable(ctx->bus_clk);
-   clk_put(ctx->bus_clk);
-
-err_clk_get:
-   return ret;
 }
 
 static int __devexit fimd_remove(struct platform_device *pdev)
@@ -949,9 +935,6 @@ static int __devexit fimd_remove(struct platform_device 
*pdev)
 out:
pm_runtime_disable(dev);
 
-   clk_put(ctx->lcd_clk);
-   clk_put(ctx->bus_clk);
-
return 0;
 }
 
-- 
1.7.4.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH Resend] drm/exynos: Use devm_* APIs in exynos_hdmi.c

2012-11-23 Thread Sachin Kamat
devm_* functions are device managed and make error handling and exit code
simpler.

Signed-off-by: Sachin Kamat 
---
 drivers/gpu/drm/exynos/exynos_hdmi.c |   60 +++--
 1 files changed, 13 insertions(+), 47 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c 
b/drivers/gpu/drm/exynos/exynos_hdmi.c
index 59839cc..af5c8ac 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -2197,27 +2197,27 @@ static int __devinit hdmi_resources_init(struct 
hdmi_context *hdata)
memset(res, 0, sizeof(*res));
 
/* get clocks, power */
-   res->hdmi = clk_get(dev, "hdmi");
+   res->hdmi = devm_clk_get(dev, "hdmi");
if (IS_ERR_OR_NULL(res->hdmi)) {
DRM_ERROR("failed to get clock 'hdmi'\n");
goto fail;
}
-   res->sclk_hdmi = clk_get(dev, "sclk_hdmi");
+   res->sclk_hdmi = devm_clk_get(dev, "sclk_hdmi");
if (IS_ERR_OR_NULL(res->sclk_hdmi)) {
DRM_ERROR("failed to get clock 'sclk_hdmi'\n");
goto fail;
}
-   res->sclk_pixel = clk_get(dev, "sclk_pixel");
+   res->sclk_pixel = devm_clk_get(dev, "sclk_pixel");
if (IS_ERR_OR_NULL(res->sclk_pixel)) {
DRM_ERROR("failed to get clock 'sclk_pixel'\n");
goto fail;
}
-   res->sclk_hdmiphy = clk_get(dev, "sclk_hdmiphy");
+   res->sclk_hdmiphy = devm_clk_get(dev, "sclk_hdmiphy");
if (IS_ERR_OR_NULL(res->sclk_hdmiphy)) {
DRM_ERROR("failed to get clock 'sclk_hdmiphy'\n");
goto fail;
}
-   res->hdmiphy = clk_get(dev, "hdmiphy");
+   res->hdmiphy = devm_clk_get(dev, "hdmiphy");
if (IS_ERR_OR_NULL(res->hdmiphy)) {
DRM_ERROR("failed to get clock 'hdmiphy'\n");
goto fail;
@@ -2225,7 +2225,7 @@ static int __devinit hdmi_resources_init(struct 
hdmi_context *hdata)
 
clk_set_parent(res->sclk_hdmi, res->sclk_pixel);
 
-   res->regul_bulk = kzalloc(ARRAY_SIZE(supply) *
+   res->regul_bulk = devm_kzalloc(dev, ARRAY_SIZE(supply) *
sizeof(res->regul_bulk[0]), GFP_KERNEL);
if (!res->regul_bulk) {
DRM_ERROR("failed to get memory for regulators\n");
@@ -2235,7 +2235,7 @@ static int __devinit hdmi_resources_init(struct 
hdmi_context *hdata)
res->regul_bulk[i].supply = supply[i];
res->regul_bulk[i].consumer = NULL;
}
-   ret = regulator_bulk_get(dev, ARRAY_SIZE(supply), res->regul_bulk);
+   ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(supply), res->regul_bulk);
if (ret) {
DRM_ERROR("failed to get regulators\n");
goto fail;
@@ -2248,28 +2248,6 @@ fail:
return -ENODEV;
 }
 
-static int hdmi_resources_cleanup(struct hdmi_context *hdata)
-{
-   struct hdmi_resources *res = &hdata->res;
-
-   regulator_bulk_free(res->regul_count, res->regul_bulk);
-   /* kfree is NULL-safe */
-   kfree(res->regul_bulk);
-   if (!IS_ERR_OR_NULL(res->hdmiphy))
-   clk_put(res->hdmiphy);
-   if (!IS_ERR_OR_NULL(res->sclk_hdmiphy))
-   clk_put(res->sclk_hdmiphy);
-   if (!IS_ERR_OR_NULL(res->sclk_pixel))
-   clk_put(res->sclk_pixel);
-   if (!IS_ERR_OR_NULL(res->sclk_hdmi))
-   clk_put(res->sclk_hdmi);
-   if (!IS_ERR_OR_NULL(res->hdmi))
-   clk_put(res->hdmi);
-   memset(res, 0, sizeof(*res));
-
-   return 0;
-}
-
 static struct i2c_client *hdmi_ddc, *hdmi_hdmiphy;
 
 void hdmi_attach_ddc_client(struct i2c_client *ddc)
@@ -2409,36 +2387,32 @@ static int __devinit hdmi_probe(struct platform_device 
*pdev)
ret = hdmi_resources_init(hdata);
 
if (ret) {
-   ret = -EINVAL;
DRM_ERROR("hdmi_resources_init failed\n");
-   goto err_data;
+   return -EINVAL;
}
 
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res) {
DRM_ERROR("failed to find registers\n");
-   ret = -ENOENT;
-   goto err_resource;
+   return -ENOENT;
}
 
hdata->regs = devm_request_and_ioremap(&pdev->dev, res);
if (!hdata->regs) {
DRM_ERROR("failed to map registers\n");
-   ret = -ENXIO;
-   goto err_resource;
+   return -ENXIO;
}
 
-   ret = gpio_request(hdata->hpd_gpio, "HPD");
+   ret = devm_gpio_request(&pdev->dev, hdata->hpd_gpio, "HPD");
if (ret) {
DRM_ERROR("failed to request HPD gpio\n");
-   goto err_resource;
+   return ret;
}
 
/* DDC i2c driver */
if (i2c_add_driver(&ddc_driver)) {
DRM_ERROR("failed to register ddc i2c driver\n");
-   ret = -ENOENT;
-   goto err_gpio;
+   return -ENOENT;
 

[PATCH Resend] drm/exynos: Use devm_clk_get in exynos_mixer.c

2012-11-23 Thread Sachin Kamat
devm_clk_get is device managed and makes error handling and exit code
simpler.

Signed-off-by: Sachin Kamat 
---
 drivers/gpu/drm/exynos/exynos_mixer.c |   59 +
 1 files changed, 16 insertions(+), 43 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c 
b/drivers/gpu/drm/exynos/exynos_mixer.c
index 0d3ed28..5712b0e 100644
--- a/drivers/gpu/drm/exynos/exynos_mixer.c
+++ b/drivers/gpu/drm/exynos/exynos_mixer.c
@@ -962,57 +962,45 @@ static int __devinit mixer_resources_init(struct 
exynos_drm_hdmi_context *ctx,
 
spin_lock_init(&mixer_res->reg_slock);
 
-   mixer_res->mixer = clk_get(dev, "mixer");
+   mixer_res->mixer = devm_clk_get(dev, "mixer");
if (IS_ERR_OR_NULL(mixer_res->mixer)) {
dev_err(dev, "failed to get clock 'mixer'\n");
-   ret = -ENODEV;
-   goto fail;
+   return -ENODEV;
}
 
-   mixer_res->sclk_hdmi = clk_get(dev, "sclk_hdmi");
+   mixer_res->sclk_hdmi = devm_clk_get(dev, "sclk_hdmi");
if (IS_ERR_OR_NULL(mixer_res->sclk_hdmi)) {
dev_err(dev, "failed to get clock 'sclk_hdmi'\n");
-   ret = -ENODEV;
-   goto fail;
+   return -ENODEV;
}
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (res == NULL) {
dev_err(dev, "get memory resource failed.\n");
-   ret = -ENXIO;
-   goto fail;
+   return -ENXIO;
}
 
mixer_res->mixer_regs = devm_ioremap(&pdev->dev, res->start,
resource_size(res));
if (mixer_res->mixer_regs == NULL) {
dev_err(dev, "register mapping failed.\n");
-   ret = -ENXIO;
-   goto fail;
+   return -ENXIO;
}
 
res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
if (res == NULL) {
dev_err(dev, "get interrupt resource failed.\n");
-   ret = -ENXIO;
-   goto fail;
+   return -ENXIO;
}
 
ret = devm_request_irq(&pdev->dev, res->start, mixer_irq_handler,
0, "drm_mixer", ctx);
if (ret) {
dev_err(dev, "request interrupt failed.\n");
-   goto fail;
+   return ret;
}
mixer_res->irq = res->start;
 
return 0;
-
-fail:
-   if (!IS_ERR_OR_NULL(mixer_res->sclk_hdmi))
-   clk_put(mixer_res->sclk_hdmi);
-   if (!IS_ERR_OR_NULL(mixer_res->mixer))
-   clk_put(mixer_res->mixer);
-   return ret;
 }
 
 static int __devinit vp_resources_init(struct exynos_drm_hdmi_context *ctx,
@@ -1022,25 +1010,21 @@ static int __devinit vp_resources_init(struct 
exynos_drm_hdmi_context *ctx,
struct device *dev = &pdev->dev;
struct mixer_resources *mixer_res = &mixer_ctx->mixer_res;
struct resource *res;
-   int ret;
 
-   mixer_res->vp = clk_get(dev, "vp");
+   mixer_res->vp = devm_clk_get(dev, "vp");
if (IS_ERR_OR_NULL(mixer_res->vp)) {
dev_err(dev, "failed to get clock 'vp'\n");
-   ret = -ENODEV;
-   goto fail;
+   return -ENODEV;
}
-   mixer_res->sclk_mixer = clk_get(dev, "sclk_mixer");
+   mixer_res->sclk_mixer = devm_clk_get(dev, "sclk_mixer");
if (IS_ERR_OR_NULL(mixer_res->sclk_mixer)) {
dev_err(dev, "failed to get clock 'sclk_mixer'\n");
-   ret = -ENODEV;
-   goto fail;
+   return -ENODEV;
}
-   mixer_res->sclk_dac = clk_get(dev, "sclk_dac");
+   mixer_res->sclk_dac = devm_clk_get(dev, "sclk_dac");
if (IS_ERR_OR_NULL(mixer_res->sclk_dac)) {
dev_err(dev, "failed to get clock 'sclk_dac'\n");
-   ret = -ENODEV;
-   goto fail;
+   return -ENODEV;
}
 
if (mixer_res->sclk_hdmi)
@@ -1049,28 +1033,17 @@ static int __devinit vp_resources_init(struct 
exynos_drm_hdmi_context *ctx,
res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
if (res == NULL) {
dev_err(dev, "get memory resource failed.\n");
-   ret = -ENXIO;
-   goto fail;
+   return -ENXIO;
}
 
mixer_res->vp_regs = devm_ioremap(&pdev->dev, res->start,
resource_size(res));
if (mixer_res->vp_regs == NULL) {
dev_err(dev, "register mapping failed.\n");
-   ret = -ENXIO;
-   goto fail;
+   return -ENXIO;
}
 
return 0;
-
-fail:
-   if (!IS_ERR_OR_NULL(mixer_res->sclk_dac))
-   clk_put(mixer_res->sclk_dac);
-   if (!IS_ERR_OR_NULL(mixer_res->sclk_mixer))
-   clk_put(mixer_res->sclk_mixer);
-   if (!IS_ERR_OR_NULL(

Re: [PATCH] drm: tegra: Use framebuffer pitch as line stride

2012-11-23 Thread Terje Bergström
On 22.11.2012 21:37, Thierry Reding wrote:
> Instead of using the stride derived from the display mode, use the pitch
> associated with the currently active framebuffer. This fixes a bug where
> the LCD display content would be skewed when enabling HDMI with a video
> mode different from that of the LCD.
> 
> Signed-off-by: Thierry Reding 

Hi,

I tested and verified that this fixes our stride problem. Thanks!

Tested-by: Terje Bergstrom 

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 2/5] drm/exynos: Use devm_gpio_request in exynos_hdmi.c

2012-11-23 Thread Sachin Kamat
On 23 November 2012 12:21, Inki Dae  wrote:
[snip]

> With cleanup to hdmi_resources_init, we can remove hdmi_resource_cleanup
> function. So could you please re-send updated patches?

OK. I will update and re-send.

>
> You've been submitting patches into too small pieces.
> Because they are trivial enough and in the same context, please merge this
> kind of patches as long as they are related with the same class or topics. I
> think you can combine them. :)

Generally, the accepted practice is to combine patches if they do
similar changes in the same file.
Else, separate patches is preferred as it makes things easier for
reviewers and maintainer by improving readability and less rework
effort.
Since you have specifically requested for combining the patches I will
squash patches related to clk_get together and resend the series.

>
> Thanks,
> Inki Dae
>


-- 
With warm regards,
Sachin
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 1/5] drm/exynos: Use devm_clk_get in exynos_drm_fimd.c

2012-11-23 Thread Sachin Kamat
On 23 November 2012 12:10, Inki Dae  wrote:
>
>
>> -Original Message-
>> From: Sachin Kamat [mailto:sachin.ka...@linaro.org]
>> Sent: Friday, November 23, 2012 12:42 PM
>> To: dri-devel@lists.freedesktop.org
>> Cc: inki@samsung.com; jy0922.s...@samsung.com; airl...@linux.ie;
>> sachin.ka...@linaro.org; patc...@linaro.org
>> Subject: [PATCH 1/5] drm/exynos: Use devm_clk_get in exynos_drm_fimd.c
>>
>> devm_clk_get is device managed and makes error handling and exit code
>> simpler.
>>
>> Signed-off-by: Sachin Kamat 
>> ---
>>  drivers/gpu/drm/exynos/exynos_drm_fimd.c |9 ++---
>>  1 files changed, 2 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
>> b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
>> index ad04edd..57851cc 100644
>> --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
>> +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
>> @@ -846,14 +846,14 @@ static int __devinit fimd_probe(struct
>> platform_device *pdev)
>>   if (!ctx)
>>   return -ENOMEM;
>>
>> - ctx->bus_clk = clk_get(dev, "fimd");
>> + ctx->bus_clk = devm_clk_get(dev, "fimd");
>>   if (IS_ERR(ctx->bus_clk)) {
>>   dev_err(dev, "failed to get bus clock\n");
>>   ret = PTR_ERR(ctx->bus_clk);
>>   goto err_clk_get;
>>   }
>>
>> - ctx->lcd_clk = clk_get(dev, "sclk_fimd");
>> + ctx->lcd_clk = devm_clk_get(dev, "sclk_fimd");
>>   if (IS_ERR(ctx->lcd_clk)) {
>>   dev_err(dev, "failed to get lcd clock\n");
>>   ret = PTR_ERR(ctx->lcd_clk);
>> @@ -918,11 +918,9 @@ static int __devinit fimd_probe(struct
>> platform_device *pdev)
>>
>>  err_clk:
>>   clk_disable(ctx->lcd_clk);
>> - clk_put(ctx->lcd_clk);
>
> clk_disable shouldn't be called here so let's cleanup this also to reduce
> unnecessary cleanup commits.
>
>>
>>  err_bus_clk:
>>   clk_disable(ctx->bus_clk);
>> - clk_put(ctx->bus_clk);
>>
>
> Ditto.

OK. I will remove it. Do you want me to re-send only this patch or the
entire series?

>
> Thanks,
> Inki Dae
>
>>  err_clk_get:
>>   return ret;
>> @@ -949,9 +947,6 @@ static int __devexit fimd_remove(struct
>> platform_device *pdev)
>>  out:
>>   pm_runtime_disable(dev);
>>
>> - clk_put(ctx->lcd_clk);
>> - clk_put(ctx->bus_clk);
>> -
>>   return 0;
>>  }
>>
>> --
>> 1.7.4.1
>



-- 
With warm regards,
Sachin
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCHv14 3/7] video: add of helper for display timings/videomode

2012-11-23 Thread Steffen Trumtrar
On Fri, Nov 23, 2012 at 03:49:37PM +0530, Leela Krishna Amudala wrote:
> Hello Steffen,
> 
> On Fri, Nov 23, 2012 at 2:34 PM, Steffen Trumtrar
>  wrote:
> > This adds support for reading display timings from DT into a struct
> > display_timings. The of_display_timing implementation supports multiple
> > subnodes. All children are read into an array, that can be queried.
> >
> > If no native mode is specified, the first subnode will be used.
> >
> > For cases, where the graphics drivers knows, there can be only one
> > mode description or where the driver only supports one mode, a helper
> > function of_get_videomode is added, that gets a struct videomode from DT.
> > (As this function is implemented in an expensive fashion, it should only
> > be used in the aforementioned case).
> >
> > This also demonstrates how of_display_timings may be utilized.
> >
> > Signed-off-by: Steffen Trumtrar 
> > Signed-off-by: Philipp Zabel 
> > Acked-by: Stephen Warren 
> > Reviewed-by: Thierry Reding 
> > Acked-by: Thierry Reding 
> > Tested-by: Thierry Reding 
> > Tested-by: Philipp Zabel 
> > Reviewed-by: Laurent Pinchart 
> > Acked-by: Laurent Pinchart 
> > ---
> >  .../devicetree/bindings/video/display-timings.txt  |  107 ++
> >  drivers/video/Kconfig  |   15 ++
> >  drivers/video/Makefile |2 +
> >  drivers/video/of_display_timing.c  |  223 
> > 
> >  drivers/video/of_videomode.c   |   48 +
> >  include/linux/of_display_timings.h |   20 ++
> >  include/linux/of_videomode.h   |   18 ++
> >  7 files changed, 433 insertions(+)
> >  create mode 100644 
> > Documentation/devicetree/bindings/video/display-timings.txt
> >  create mode 100644 drivers/video/of_display_timing.c
> >  create mode 100644 drivers/video/of_videomode.c
> >  create mode 100644 include/linux/of_display_timings.h
> >  create mode 100644 include/linux/of_videomode.h
> >
> 
> <<>>
> 
> > diff --git a/drivers/video/of_display_timing.c 
> > b/drivers/video/of_display_timing.c
> > new file mode 100644
> > index 000..645f43d
> > --- /dev/null
> > +++ b/drivers/video/of_display_timing.c
> > @@ -0,0 +1,223 @@
> > +/*
> > + * OF helpers for parsing display timings
> > + *
> > + * Copyright (c) 2012 Steffen Trumtrar , 
> > Pengutronix
> > + *
> > + * based on of_videomode.c by Sascha Hauer 
> > + *
> > + * This file is released under the GPLv2
> > + */
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +
> > +/**
> > + * parse_property - parse timing_entry from device_node
> > + * @np: device_node with the property
> > + * @name: name of the property
> > + * @result: will be set to the return value
> > + *
> > + * DESCRIPTION:
> > + * Every display_timing can be specified with either just the typical 
> > value or
> > + * a range consisting of min/typ/max. This function helps handling this
> > + **/
> > +static int parse_property(const struct device_node *np, const char *name,
> > + struct timing_entry *result)
> > +{
> > +   struct property *prop;
> > +   int length, cells, ret;
> > +
> > +   prop = of_find_property(np, name, &length);
> > +   if (!prop) {
> > +   pr_err("%s: could not find property %s\n", __func__, name);
> > +   return -EINVAL;
> > +   }
> > +
> > +   cells = length / sizeof(u32);
> > +   if (cells == 1) {
> > +   ret = of_property_read_u32(np, name, &result->typ);
> > +   result->min = result->typ;
> > +   result->max = result->typ;
> > +   } else if (cells == 3) {
> > +   ret = of_property_read_u32_array(np, name, &result->min, 
> > cells);
> > +   } else {
> > +   pr_err("%s: illegal timing specification in %s\n", __func__,
> > +   name);
> > +   return -EINVAL;
> > +   }
> > +
> > +   return ret;
> > +}
> > +
> > +/**
> > + * of_get_display_timing - parse display_timing entry from device_node
> > + * @np: device_node with the properties
> > + **/
> > +static struct display_timing *of_get_display_timing(const struct 
> > device_node
> > +   *np)
> > +{
> > +   struct display_timing *dt;
> > +   int ret = 0;
> > +
> > +   dt = kzalloc(sizeof(*dt), GFP_KERNEL);
> > +   if (!dt) {
> > +   pr_err("%s: could not allocate display_timing struct\n",
> > +   __func__);
> > +   return NULL;
> > +   }
> > +
> > +   ret |= parse_property(np, "hback-porch", &dt->hback_porch);
> > +   ret |= parse_property(np, "hfront-porch", &dt->hfront_porch);
> > +   ret |= parse_property(np, "hactive", &dt->hactive);
> > +   ret |= parse_property(np, "hsync-len", &dt->hsync_len);
> > +   ret |= parse_property(np, "vback-porch", &dt->vback_porch);
> > +   ret |= parse_property(n

[Bug 42627] Hibernation fails to resume - Toshiba Satellite L755-161 notebook

2012-11-23 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=42627





--- Comment #24 from Harald Brennich   2012-11-23 
10:30:38 ---
As suspend/resume bugs do not seem to be in focus of nouveau-developers I have
decided to replace nouveau by the current nvidia driver (310.19). With this
driver, both s2ram and s2disk work. Hopefully in the future also a working
nouveau is available.
See also bug #45981

-- 
Configure bugmail: https://bugzilla.kernel.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are watching the assignee of the bug.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCHv14 3/7] video: add of helper for display timings/videomode

2012-11-23 Thread Leela Krishna Amudala
Hello Steffen,

On Fri, Nov 23, 2012 at 2:34 PM, Steffen Trumtrar
 wrote:
> This adds support for reading display timings from DT into a struct
> display_timings. The of_display_timing implementation supports multiple
> subnodes. All children are read into an array, that can be queried.
>
> If no native mode is specified, the first subnode will be used.
>
> For cases, where the graphics drivers knows, there can be only one
> mode description or where the driver only supports one mode, a helper
> function of_get_videomode is added, that gets a struct videomode from DT.
> (As this function is implemented in an expensive fashion, it should only
> be used in the aforementioned case).
>
> This also demonstrates how of_display_timings may be utilized.
>
> Signed-off-by: Steffen Trumtrar 
> Signed-off-by: Philipp Zabel 
> Acked-by: Stephen Warren 
> Reviewed-by: Thierry Reding 
> Acked-by: Thierry Reding 
> Tested-by: Thierry Reding 
> Tested-by: Philipp Zabel 
> Reviewed-by: Laurent Pinchart 
> Acked-by: Laurent Pinchart 
> ---
>  .../devicetree/bindings/video/display-timings.txt  |  107 ++
>  drivers/video/Kconfig  |   15 ++
>  drivers/video/Makefile |2 +
>  drivers/video/of_display_timing.c  |  223 
> 
>  drivers/video/of_videomode.c   |   48 +
>  include/linux/of_display_timings.h |   20 ++
>  include/linux/of_videomode.h   |   18 ++
>  7 files changed, 433 insertions(+)
>  create mode 100644 
> Documentation/devicetree/bindings/video/display-timings.txt
>  create mode 100644 drivers/video/of_display_timing.c
>  create mode 100644 drivers/video/of_videomode.c
>  create mode 100644 include/linux/of_display_timings.h
>  create mode 100644 include/linux/of_videomode.h
>

<<>>

> diff --git a/drivers/video/of_display_timing.c 
> b/drivers/video/of_display_timing.c
> new file mode 100644
> index 000..645f43d
> --- /dev/null
> +++ b/drivers/video/of_display_timing.c
> @@ -0,0 +1,223 @@
> +/*
> + * OF helpers for parsing display timings
> + *
> + * Copyright (c) 2012 Steffen Trumtrar , 
> Pengutronix
> + *
> + * based on of_videomode.c by Sascha Hauer 
> + *
> + * This file is released under the GPLv2
> + */
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +/**
> + * parse_property - parse timing_entry from device_node
> + * @np: device_node with the property
> + * @name: name of the property
> + * @result: will be set to the return value
> + *
> + * DESCRIPTION:
> + * Every display_timing can be specified with either just the typical value 
> or
> + * a range consisting of min/typ/max. This function helps handling this
> + **/
> +static int parse_property(const struct device_node *np, const char *name,
> + struct timing_entry *result)
> +{
> +   struct property *prop;
> +   int length, cells, ret;
> +
> +   prop = of_find_property(np, name, &length);
> +   if (!prop) {
> +   pr_err("%s: could not find property %s\n", __func__, name);
> +   return -EINVAL;
> +   }
> +
> +   cells = length / sizeof(u32);
> +   if (cells == 1) {
> +   ret = of_property_read_u32(np, name, &result->typ);
> +   result->min = result->typ;
> +   result->max = result->typ;
> +   } else if (cells == 3) {
> +   ret = of_property_read_u32_array(np, name, &result->min, 
> cells);
> +   } else {
> +   pr_err("%s: illegal timing specification in %s\n", __func__,
> +   name);
> +   return -EINVAL;
> +   }
> +
> +   return ret;
> +}
> +
> +/**
> + * of_get_display_timing - parse display_timing entry from device_node
> + * @np: device_node with the properties
> + **/
> +static struct display_timing *of_get_display_timing(const struct device_node
> +   *np)
> +{
> +   struct display_timing *dt;
> +   int ret = 0;
> +
> +   dt = kzalloc(sizeof(*dt), GFP_KERNEL);
> +   if (!dt) {
> +   pr_err("%s: could not allocate display_timing struct\n",
> +   __func__);
> +   return NULL;
> +   }
> +
> +   ret |= parse_property(np, "hback-porch", &dt->hback_porch);
> +   ret |= parse_property(np, "hfront-porch", &dt->hfront_porch);
> +   ret |= parse_property(np, "hactive", &dt->hactive);
> +   ret |= parse_property(np, "hsync-len", &dt->hsync_len);
> +   ret |= parse_property(np, "vback-porch", &dt->vback_porch);
> +   ret |= parse_property(np, "vfront-porch", &dt->vfront_porch);
> +   ret |= parse_property(np, "vactive", &dt->vactive);
> +   ret |= parse_property(np, "vsync-len", &dt->vsync_len);
> +   ret |= parse_property(np, "clock-frequency", &dt->pixelclock);
> +
> +   of_property_read_u32(np, "vsync-active", &dt->vsync_pol_active);
> +   of_property

RE: [PATCH] drm: exynos: hdmi: sending AVI and AUI info frames

2012-11-23 Thread Inki Dae
Sorry but could you re-send this one more time? below is my comment.

Thanks,
Inki Dae

> -Original Message-
> From: Rahul Sharma [mailto:rahul.sha...@samsung.com]
> Sent: Friday, November 23, 2012 6:17 PM
> To: dri-devel@lists.freedesktop.org
> Cc: airl...@redhat.com; inki@samsung.com; kgene@samsung.com;
> r.sh.o...@gmail.com; marc...@chromium.org; sw0312@samsung.com;
> kyungmin.p...@samsung.com
> Subject: [PATCH] drm: exynos: hdmi: sending AVI and AUI info frames
> 
> This patch adds code for composing AVI and AUI info frames
> and send them every VSYNC.
> 
> This patch is important for hdmi certification.
> 
> Signed-off-by: Rahul Sharma 
> Signed-off-by: Fahad Kunnathadi 
> Signed-off-by: Shirish S 
> 
> Based on exynos-drm-next branch of
> http://git.kernel.org/?p=linux/kernel/git/daeinki/drm-exynos.git
> ---
>  drivers/gpu/drm/exynos/exynos_hdmi.c |  139
> +-
>  drivers/gpu/drm/exynos/exynos_hdmi.h |   23 ++
>  drivers/gpu/drm/exynos/regs-hdmi.h   |   17 -
>  3 files changed, 158 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c
> b/drivers/gpu/drm/exynos/exynos_hdmi.c
> index 59839cc..49332bd 100644
> --- a/drivers/gpu/drm/exynos/exynos_hdmi.c
> +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
> @@ -183,6 +183,7 @@ struct hdmi_v13_conf {
>   int height;
>   int vrefresh;
>   bool interlace;
> + int cea_video_id;
>   const u8 *hdmiphy_data;
>   const struct hdmi_v13_preset_conf *conf;
>  };
> @@ -354,15 +355,20 @@ static const struct hdmi_v13_preset_conf
> hdmi_v13_conf_1080p60 = {
>  };
> 
>  static const struct hdmi_v13_conf hdmi_v13_confs[] = {
> - { 1280, 720, 60, false, hdmiphy_v13_conf74_25,
> &hdmi_v13_conf_720p60 },
> - { 1280, 720, 50, false, hdmiphy_v13_conf74_25,
> &hdmi_v13_conf_720p60 },
> - { 720, 480, 60, false, hdmiphy_v13_conf27_027,
> &hdmi_v13_conf_480p },
> - { 1920, 1080, 50, true, hdmiphy_v13_conf74_25,
> &hdmi_v13_conf_1080i50 },
> - { 1920, 1080, 50, false, hdmiphy_v13_conf148_5,
> -  &hdmi_v13_conf_1080p50 },
> - { 1920, 1080, 60, true, hdmiphy_v13_conf74_25,
> &hdmi_v13_conf_1080i60 },
> - { 1920, 1080, 60, false, hdmiphy_v13_conf148_5,
> -  &hdmi_v13_conf_1080p60 },
> + { 1280, 720, 60, false, 4, hdmiphy_v13_conf74_25,
> + &hdmi_v13_conf_720p60 },
> + { 1280, 720, 50, false, 19, hdmiphy_v13_conf74_25,
> + &hdmi_v13_conf_720p60 },
> + { 720, 480, 60, false, 3, hdmiphy_v13_conf27_027,
> + &hdmi_v13_conf_480p },
> + { 1920, 1080, 50, true, 20, hdmiphy_v13_conf74_25,
> + &hdmi_v13_conf_1080i50 },
> + { 1920, 1080, 50, false, 31, hdmiphy_v13_conf148_5,
> + &hdmi_v13_conf_1080p50 },
> + { 1920, 1080, 60, true, 5, hdmiphy_v13_conf74_25,
> + &hdmi_v13_conf_1080i60 },
> + { 1920, 1080, 60, false, 16, hdmiphy_v13_conf148_5,
> + &hdmi_v13_conf_1080p60 },
>  };
> 
>  /* HDMI Version 1.4 */
> @@ -480,6 +486,7 @@ struct hdmi_conf {
>   int height;
>   int vrefresh;
>   bool interlace;
> + int cea_video_id;
>   const u8 *hdmiphy_data;
>   const struct hdmi_preset_conf *conf;
>  };
> @@ -935,16 +942,21 @@ static const struct hdmi_preset_conf
> hdmi_conf_1080p60 = {
>  };
> 
>  static const struct hdmi_conf hdmi_confs[] = {
> - { 720, 480, 60, false, hdmiphy_conf27_027, &hdmi_conf_480p60 },
> - { 1280, 720, 50, false, hdmiphy_conf74_25, &hdmi_conf_720p50 },
> - { 1280, 720, 60, false, hdmiphy_conf74_25, &hdmi_conf_720p60 },
> - { 1920, 1080, 50, true, hdmiphy_conf74_25, &hdmi_conf_1080i50 },
> - { 1920, 1080, 60, true, hdmiphy_conf74_25, &hdmi_conf_1080i60 },
> - { 1920, 1080, 30, false, hdmiphy_conf74_176, &hdmi_conf_1080p30 },
> - { 1920, 1080, 50, false, hdmiphy_conf148_5, &hdmi_conf_1080p50 },
> - { 1920, 1080, 60, false, hdmiphy_conf148_5, &hdmi_conf_1080p60 },
> + { 720, 480, 60, false, 3, hdmiphy_conf27_027, &hdmi_conf_480p60 },
> + { 1280, 720, 50, false, 19, hdmiphy_conf74_25, &hdmi_conf_720p50 },
> + { 1280, 720, 60, false, 4, hdmiphy_conf74_25, &hdmi_conf_720p60 },
> + { 1920, 1080, 50, true, 20, hdmiphy_conf74_25, &hdmi_conf_1080i50 },
> + { 1920, 1080, 60, true, 5, hdmiphy_conf74_25, &hdmi_conf_1080i60 },
> + { 1920, 1080, 30, false, 34, hdmiphy_conf74_176,
> &hdmi_conf_1080p30 },
> + { 1920, 1080, 50, false, 31, hdmiphy_conf148_5,
> &hdmi_conf_1080p50 },
> + { 1920, 1080, 60, false, 16, hdmiphy_conf148_5,
> &hdmi_conf_1080p60 },
>  };
> 
> +struct hdmi_infoframe {
> + enum HDMI_PACKET_TYPE type;
> + u8 ver;
> + u8 len;
> +};
> 
>  static inline u32 hdmi_reg_read(struct hdmi_context *hdata, u32 reg_id)
>  {
> @@ -1268,6 +1280,85 @@ static int hdmi_conf_index(struct hdmi_context
> *hdata,
>   return hdmi_v14_conf_inde

Re: [RFC 0/2] Add HDMI helpers

2012-11-23 Thread Christian König

On 23.11.2012 10:38, Thierry Reding wrote:

On Fri, Nov 23, 2012 at 10:24:22AM +0100, Christian König wrote:

Hi Thierry,

On 21.11.2012 16:01, Thierry Reding wrote:

This small series is very much work in progress, but I still wanted to
get feedback in this early stage to gather requirements from the folks
working on the display drivers that these helpers target.

Patch 1 in the series adds a generic helper to pack a structure that
describes an HDMI AVI infoframe into the binary format as specified in
the HDMI specification. The resulting binary buffer should be easily
programmable into the HDMI controller.

Patch 2 provides a helper to fill an HDMI AVI infoframe with data from
a struct drm_display_mode.

This is all pretty rough right now, but I think some feedback would be
good at this point, to see if the design is at all sensible. I should
also mention that I haven't actually tested this on real hardware yet.
Furthermore I have plans to add something similar for the other types
of infoframes specified by HDMI once the direction becomes clearer.

In general I like the idea of storing the informations in a C struct
and only packing it into the binary form when needed.

I would rather like to see a complete implementation of all the
interesting HDMI packets, including the necessary
calculations/tables for audio timing recovery etc before it gets
committed upstream.

I'm afraid I'm not very familiar with those packets. Also I haven't seen
any actual users of audio timing recovery packets so far, so I'm not
sure that adding support for them would be very useful.


Take a look at: drivers/gpu/drm/radeon/r600_hdmi.c There we have 
r600_hdmi_predefined_acr, r600_hdmi_calc_cts and r600_hdmi_acr doing the 
audio clock recovery calculation/table manually. Those values are only 
used as fallback, since the hardware can do the calculation on their own.


I'm not sure if anybody else is doing this calculation in any driver 
code, but it definitely isn't driver specific and part of the HDMI 
specification, so I would say that it belongs into the general purpose 
file as well.



What I have added so far is support for audio and vendor-specific
infoframes, since those have actual users. I also noticed that i915
implements SPD infoframes as well, so I can extract that code into the
generic helpers as well.


Not sure about the separate configuration option. I'm not so much
into the config/build system of linux (I know that it is rather
complicated), but in general I would like to see that activated
automatically as soon as any driver starts using it (or at least the
driver depending on that option to be active).

The configuration option isn't supposed to be user visible. Drivers that
make use of this are supposed to select HDMI or DRM_HDMI to cause the
generic code to be pulled in.


Also two notes about the code in itself:
1. hdmi_avi_infoframe_pack: gets the size of the target buffer, but
unfortunately doesn't checks it.

That should already be fixed in the latest code in my local working
branch.


2. Separate the CRC calculation, we probably need that more than once.

I've also pulled that out into a separate function. I haven't made it a
public function yet, but I don't think that'll be necessary either since
it is used internally by the various infoframe packing functions.



Sounds good, let me know when you need a review of the code.

Christian.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: Linux 3.7-rc6

2012-11-23 Thread Jani Nikula
On Thu, 22 Nov 2012, Henrik Rydberg  wrote:
>> Yeah, the utter lack of a vbt fits very nicely, thanks for checking,
>> I've merged the patch into drm-intel-fixes and will forward it for
>> inclusion into 3.7 rsn.
>
> Great, thanks. One thing about that patch: if we would ever encounter
> a non-zero edp.bpp < 3, display_bpc would not be clamped. I suppose
> monochrome screens went out of fashion twenty years ago, but who
> knows...

ATM, edp.bpp is known to be 18, 24, or 30. It's mapped from a two-bit
value in the VBT.

Glad to hear the patch works for you.

BR,
Jani.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


RE: [PATCH Resend] drm/exynos: Use devm_clk_get in exynos_drm_fimd.c

2012-11-23 Thread Inki Dae
The subject mentions just only 'use devm_clk_get in exynos_dev_fimd.c' but
this patch removes unnecessary clk_disable calls also. Just separate this
patch into two as you mentioned. For this, already applied old one. So could
you send another one? Sorry for inconvenient. :)

Thanks,
Inki Dae

> -Original Message-
> From: Sachin Kamat [mailto:sachin.ka...@linaro.org]
> Sent: Friday, November 23, 2012 5:43 PM
> To: dri-devel@lists.freedesktop.org
> Cc: inki@samsung.com; sachin.ka...@linaro.org; patc...@linaro.org
> Subject: [PATCH Resend] drm/exynos: Use devm_clk_get in exynos_drm_fimd.c
> 
> devm_clk_get is device managed and makes error handling and exit code
> simpler.
> 
> Signed-off-by: Sachin Kamat 
> ---
>  drivers/gpu/drm/exynos/exynos_drm_fimd.c |   31
++
> ---
>  1 files changed, 7 insertions(+), 24 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> index ad04edd..00bd266 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> @@ -846,18 +846,16 @@ static int __devinit fimd_probe(struct
> platform_device *pdev)
>   if (!ctx)
>   return -ENOMEM;
> 
> - ctx->bus_clk = clk_get(dev, "fimd");
> + ctx->bus_clk = devm_clk_get(dev, "fimd");
>   if (IS_ERR(ctx->bus_clk)) {
>   dev_err(dev, "failed to get bus clock\n");
> - ret = PTR_ERR(ctx->bus_clk);
> - goto err_clk_get;
> + return PTR_ERR(ctx->bus_clk);
>   }
> 
> - ctx->lcd_clk = clk_get(dev, "sclk_fimd");
> + ctx->lcd_clk = devm_clk_get(dev, "sclk_fimd");
>   if (IS_ERR(ctx->lcd_clk)) {
>   dev_err(dev, "failed to get lcd clock\n");
> - ret = PTR_ERR(ctx->lcd_clk);
> - goto err_bus_clk;
> + return PTR_ERR(ctx->lcd_clk);
>   }
> 
>   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> @@ -865,14 +863,13 @@ static int __devinit fimd_probe(struct
> platform_device *pdev)
>   ctx->regs = devm_request_and_ioremap(&pdev->dev, res);
>   if (!ctx->regs) {
>   dev_err(dev, "failed to map registers\n");
> - ret = -ENXIO;
> - goto err_clk;
> + return -ENXIO;
>   }
> 
>   res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
>   if (!res) {
>   dev_err(dev, "irq request failed.\n");
> - goto err_clk;
> + return -ENXIO;
>   }
> 
>   ctx->irq = res->start;
> @@ -881,7 +878,7 @@ static int __devinit fimd_probe(struct platform_device
> *pdev)
>   0, "drm_fimd", ctx);
>   if (ret) {
>   dev_err(dev, "irq request failed.\n");
> - goto err_clk;
> + return ret;
>   }
> 
>   ctx->vidcon0 = pdata->vidcon0;
> @@ -915,17 +912,6 @@ static int __devinit fimd_probe(struct
> platform_device *pdev)
>   exynos_drm_subdrv_register(subdrv);
> 
>   return 0;
> -
> -err_clk:
> - clk_disable(ctx->lcd_clk);
> - clk_put(ctx->lcd_clk);
> -
> -err_bus_clk:
> - clk_disable(ctx->bus_clk);
> - clk_put(ctx->bus_clk);
> -
> -err_clk_get:
> - return ret;
>  }
> 
>  static int __devexit fimd_remove(struct platform_device *pdev)
> @@ -949,9 +935,6 @@ static int __devexit fimd_remove(struct
> platform_device *pdev)
>  out:
>   pm_runtime_disable(dev);
> 
> - clk_put(ctx->lcd_clk);
> - clk_put(ctx->bus_clk);
> -
>   return 0;
>  }
> 
> --
> 1.7.4.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [RFC 0/2] Add HDMI helpers

2012-11-23 Thread Rafał Miłecki
2012/11/23 Christian König :
> Hi Thierry,
>
>
> On 21.11.2012 16:01, Thierry Reding wrote:
>>
>> This small series is very much work in progress, but I still wanted to
>> get feedback in this early stage to gather requirements from the folks
>> working on the display drivers that these helpers target.
>>
>> Patch 1 in the series adds a generic helper to pack a structure that
>> describes an HDMI AVI infoframe into the binary format as specified in
>> the HDMI specification. The resulting binary buffer should be easily
>> programmable into the HDMI controller.
>>
>> Patch 2 provides a helper to fill an HDMI AVI infoframe with data from
>> a struct drm_display_mode.
>>
>> This is all pretty rough right now, but I think some feedback would be
>> good at this point, to see if the design is at all sensible. I should
>> also mention that I haven't actually tested this on real hardware yet.
>> Furthermore I have plans to add something similar for the other types
>> of infoframes specified by HDMI once the direction becomes clearer.
>
> In general I like the idea of storing the informations in a C struct and
> only packing it into the binary form when needed.
>
> I would rather like to see a complete implementation of all the interesting
> HDMI packets, including the necessary calculations/tables for audio timing
> recovery etc before it gets committed upstream.
>
> Not sure about the separate configuration option. I'm not so much into the
> config/build system of linux (I know that it is rather complicated), but in
> general I would like to see that activated automatically as soon as any
> driver starts using it (or at least the driver depending on that option to
> be active).

It's rather trivial ;) You just use "select FOO_BAR".

-- 
Rafał
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


  1   2   >