All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pawel Moll <pawel.moll@arm.com>
To: linux-fbdev@vger.kernel.org, linux-media@vger.kernel.org,
	dri-devel@lists.freedesktop.org,
	devicetree-discuss@lists.ozlabs.org,
	linux-arm-kernel@lists.infradead.org
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	Russell King - ARM Linux <linux@arm.linux.org.uk>,
	Pawel Moll <pawel.moll@arm.com>
Subject: [RFC 05/10] fbmon: Add extra video helper
Date: Wed, 17 Apr 2013 16:17:17 +0100	[thread overview]
Message-ID: <1366211842-21497-6-git-send-email-pawel.moll@arm.com> (raw)
In-Reply-To: <1366211842-21497-1-git-send-email-pawel.moll@arm.com>

This function converts the fb_var_screeninfo to the videomode
structure, to be used in fbdev drivers working with the
Common Display Framework.

Signed-off-by: Pawel Moll <pawel.moll@arm.com>
---
 drivers/video/fbmon.c |   29 +++++++++++++++++++++++++++++
 include/linux/fb.h    |    3 +++
 2 files changed, 32 insertions(+)

diff --git a/drivers/video/fbmon.c b/drivers/video/fbmon.c
index 7f67099..f0ff2bf 100644
--- a/drivers/video/fbmon.c
+++ b/drivers/video/fbmon.c
@@ -1424,6 +1424,35 @@ int fb_videomode_from_videomode(const struct videomode *vm,
 	return 0;
 }
 EXPORT_SYMBOL_GPL(fb_videomode_from_videomode);
+
+void videomode_from_fb_var_screeninfo(const struct fb_var_screeninfo *var,
+				      struct videomode *vm)
+{
+	vm->pixelclock = PICOS2KHZ(var->pixclock) * 1000;
+
+	vm->hactive = var->xres;
+	vm->hfront_porch = var->right_margin;
+	vm->hback_porch = var->left_margin;
+	vm->hsync_len = var->hsync_len;
+
+	vm->vactive = var->yres;
+	vm->vfront_porch = var->lower_margin;
+	vm->vback_porch = var->upper_margin;
+	vm->vsync_len = var->vsync_len;
+
+	vm->dmt_flags = 0;
+	if (var->sync & FB_SYNC_HOR_HIGH_ACT)
+		vm->dmt_flags |= VESA_DMT_HSYNC_HIGH;
+	if (var->sync & FB_SYNC_VERT_HIGH_ACT)
+		vm->dmt_flags |= VESA_DMT_VSYNC_HIGH;
+
+	vm->data_flags = 0;
+	if (var->vmode & FB_VMODE_INTERLACED)
+		vm->data_flags |= DISPLAY_FLAGS_INTERLACED;
+	if (var->vmode & FB_VMODE_DOUBLE)
+		vm->data_flags |= DISPLAY_FLAGS_DOUBLESCAN;
+}
+EXPORT_SYMBOL_GPL(videomode_from_fb_var_screeninfo);
 #endif
 
 #if IS_ENABLED(CONFIG_OF_VIDEOMODE)
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 58b9860..aae2ed3 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -721,6 +721,9 @@ extern int of_get_fb_videomode(struct device_node *np,
 			       int index);
 extern int fb_videomode_from_videomode(const struct videomode *vm,
 				       struct fb_videomode *fbmode);
+extern void videomode_from_fb_var_screeninfo(
+				const struct fb_var_screeninfo *var,
+				struct videomode *vm);
 
 /* drivers/video/modedb.c */
 #define VESA_MODEDB_SIZE 34
-- 
1.7.10.4

WARNING: multiple messages have this Message-ID (diff)
From: Pawel Moll <pawel.moll@arm.com>
To: linux-fbdev@vger.kernel.org, linux-media@vger.kernel.org,
	dri-devel@lists.freedesktop.org,
	devicetree-discuss@lists.ozlabs.org,
	linux-arm-kernel@lists.infradead.org
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	Russell King - ARM Linux <linux@arm.linux.org.uk>,
	Pawel Moll <pawel.moll@arm.com>
Subject: [RFC 05/10] fbmon: Add extra video helper
Date: Wed, 17 Apr 2013 15:17:17 +0000	[thread overview]
Message-ID: <1366211842-21497-6-git-send-email-pawel.moll@arm.com> (raw)
In-Reply-To: <1366211842-21497-1-git-send-email-pawel.moll@arm.com>

This function converts the fb_var_screeninfo to the videomode
structure, to be used in fbdev drivers working with the
Common Display Framework.

Signed-off-by: Pawel Moll <pawel.moll@arm.com>
---
 drivers/video/fbmon.c |   29 +++++++++++++++++++++++++++++
 include/linux/fb.h    |    3 +++
 2 files changed, 32 insertions(+)

diff --git a/drivers/video/fbmon.c b/drivers/video/fbmon.c
index 7f67099..f0ff2bf 100644
--- a/drivers/video/fbmon.c
+++ b/drivers/video/fbmon.c
@@ -1424,6 +1424,35 @@ int fb_videomode_from_videomode(const struct videomode *vm,
 	return 0;
 }
 EXPORT_SYMBOL_GPL(fb_videomode_from_videomode);
+
+void videomode_from_fb_var_screeninfo(const struct fb_var_screeninfo *var,
+				      struct videomode *vm)
+{
+	vm->pixelclock = PICOS2KHZ(var->pixclock) * 1000;
+
+	vm->hactive = var->xres;
+	vm->hfront_porch = var->right_margin;
+	vm->hback_porch = var->left_margin;
+	vm->hsync_len = var->hsync_len;
+
+	vm->vactive = var->yres;
+	vm->vfront_porch = var->lower_margin;
+	vm->vback_porch = var->upper_margin;
+	vm->vsync_len = var->vsync_len;
+
+	vm->dmt_flags = 0;
+	if (var->sync & FB_SYNC_HOR_HIGH_ACT)
+		vm->dmt_flags |= VESA_DMT_HSYNC_HIGH;
+	if (var->sync & FB_SYNC_VERT_HIGH_ACT)
+		vm->dmt_flags |= VESA_DMT_VSYNC_HIGH;
+
+	vm->data_flags = 0;
+	if (var->vmode & FB_VMODE_INTERLACED)
+		vm->data_flags |= DISPLAY_FLAGS_INTERLACED;
+	if (var->vmode & FB_VMODE_DOUBLE)
+		vm->data_flags |= DISPLAY_FLAGS_DOUBLESCAN;
+}
+EXPORT_SYMBOL_GPL(videomode_from_fb_var_screeninfo);
 #endif
 
 #if IS_ENABLED(CONFIG_OF_VIDEOMODE)
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 58b9860..aae2ed3 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -721,6 +721,9 @@ extern int of_get_fb_videomode(struct device_node *np,
 			       int index);
 extern int fb_videomode_from_videomode(const struct videomode *vm,
 				       struct fb_videomode *fbmode);
+extern void videomode_from_fb_var_screeninfo(
+				const struct fb_var_screeninfo *var,
+				struct videomode *vm);
 
 /* drivers/video/modedb.c */
 #define VESA_MODEDB_SIZE 34
-- 
1.7.10.4



  parent reply	other threads:[~2013-04-17 15:17 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-17 15:17 [RFC 00/10] Versatile Express CLCD DVI output support Pawel Moll
2013-04-17 15:17 ` Pawel Moll
2013-04-17 15:17 ` Pawel Moll
2013-04-17 15:17 ` [RFC 01/10] video: Add generic display entity core Pawel Moll
2013-04-17 15:17   ` Pawel Moll
2013-04-17 15:17 ` [RFC 02/10] video: display: Update the display with the video mode data Pawel Moll
2013-04-17 15:17   ` Pawel Moll
2013-04-17 15:17 ` [RFC 03/10] video: display: Add Device Tree bindings Pawel Moll
2013-04-17 15:17   ` Pawel Moll
2013-04-17 15:17 ` [RFC 04/10] video: display: Add generic TFT display type Pawel Moll
2013-04-17 15:17   ` Pawel Moll
2013-04-17 15:17 ` Pawel Moll [this message]
2013-04-17 15:17   ` [RFC 05/10] fbmon: Add extra video helper Pawel Moll
2013-04-17 15:17 ` [RFC 06/10] video: ARM CLCD: Add DT & CDF support Pawel Moll
2013-04-17 15:17   ` Pawel Moll
2013-04-18 10:24   ` Russell King - ARM Linux
2013-04-18 10:24     ` Russell King - ARM Linux
2013-04-18 10:24     ` Russell King - ARM Linux
2013-04-18 17:33     ` [RFC v2] " Pawel Moll
2013-04-18 17:33       ` Pawel Moll
2013-04-22 14:28       ` Russell King - ARM Linux
2013-04-22 14:28         ` Russell King - ARM Linux
2013-04-22 14:28         ` Russell King - ARM Linux
2013-04-17 15:17 ` [RFC 07/10] mfd: vexpress: Allow external drivers to parse site ids Pawel Moll
2013-04-17 15:17   ` Pawel Moll
2013-04-17 15:17 ` [RFC 08/10] video: Versatile Express MUXFPGA driver Pawel Moll
2013-04-17 15:17   ` Pawel Moll
2013-04-17 15:17 ` [RFC 09/10] video: Versatile Express DVI mode driver Pawel Moll
2013-04-17 15:17   ` Pawel Moll
2013-04-17 15:17 ` [RFC 10/10] ARM: vexpress: Add CLCD Device Tree properties Pawel Moll
2013-04-17 15:17   ` Pawel Moll

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1366211842-21497-6-git-send-email-pawel.moll@arm.com \
    --to=pawel.moll@arm.com \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.