All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Alpha Channel support for Samsung SoC Framebuffer driver.
@ 2009-05-07  4:47 InKi Dae
       [not found] ` <20090508121739.b58b2d57.akpm@linux-foundation.org>
  0 siblings, 1 reply; 2+ messages in thread
From: InKi Dae @ 2009-05-07  4:47 UTC (permalink / raw)
  To: ben-linux, linux-fbdev-devel, linux-kernel

This patch supports ARGB1888 and ARGB4888 for Samsung SoC Framebuffer
driver. (s3c-fb.c)

ARGB1888 and ARGB4888 is decided by var->transp.length and this
variable is set by s3c_fb_check_var().
In s3c_fb_check_var(), if var->vits_per_pixel is 25 or 28, then
var->transp.length would be 1 or 3.
Therefore alpha mode(ARGB1888 or ARGB4888) could be decided through
that variable.


For using alpha mode, you need setting the following:
This code should be added to your machine code as platform data.

static struct s3c_fb_pd_win xxx_fb_win0 = {
	/* this is to ensure we use win0 */
	.win_mode = {
		.pixclock		= (8+8+8+240)*(38+4+38+400),
		.left_margin	= 8,
		.right_margin	= 8,
		.upper_margin	= 38,
		.lower_margin	= 38,
		.hsync_len		= 8,
		.vsync_len		= 4,
		.xres			= 240,
		.yres			= 400,
	},
	.max_bpp		= 32,
	.default_bpp	= 24,
};

static struct s3c_fb_pd_win xxx_fb_win1 = {
	.win_mode = {
		.pixclock		= (8+8+8+240)*(38+4+38+400),
		.left_margin	= 8,
		.right_margin	= 8,
		.upper_margin	= 38,
		.lower_margin	= 38,
		.hsync_len		= 8,
		.vsync_len		= 4,
		.xres			= 240,
		.yres			= 400,
	},
	.max_bpp		= 32,
	.default_bpp	= 28,
};


static struct s3c_fb_platdata xxx_lcd_pdata __initdata = {
	.win[0]		= &ncp_fb_win0,
	.win[1]		= &ncp_fb_win1,
	.vidcon0	= VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
	.vidcon1	= VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
	.setup_gpio	= xxx_fb_gpio_setup,
};

s3c_fb_set_platdata(&xxx_lcd_pdata);


Above code sets pixelformat for window0 layer to RGB888 and window1
layer to ARGB4888.
I'll look forward to applying to mainline.

signed-off-by: InKi Dae. <inki.dae@samsung.com>

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
diff --git a/drivers/video/s3c-fb.c b/drivers/video/s3c-fb.c
index e0e7899..55d2298 100644
--- a/drivers/video/s3c-fb.c
+++ b/drivers/video/s3c-fb.c
@@ -358,9 +358,16 @@ static int s3c_fb_set_par(struct fb_info *info)
 writel(data, regs + VIDOSD_B(win_no));

 data = var->xres * var->yres;
+
+ u32 osdc_data = 0;
+
+ osdc_data = VIDISD14C_ALPHA1_R(0xf) |
+  VIDISD14C_ALPHA1_G(0xf) |
+  VIDISD14C_ALPHA1_B(0xf);
+
 if (s3c_fb_has_osd_d(win_no)) {
  writel(data, regs + VIDOSD_D(win_no));
-  writel(0, regs + VIDOSD_C(win_no));
+  writel(osdc_data, regs + VIDOSD_C(win_no));
 } else
  writel(data, regs + VIDOSD_C(win_no));

@@ -409,8 +416,12 @@ static int s3c_fb_set_par(struct fb_info *info)
    data |= WINCON1_BPPMODE_19BPP_A1666;
   else
    data |= WINCON1_BPPMODE_18BPP_666;
-  } else if (var->transp.length != 0)
-   data |= WINCON1_BPPMODE_25BPP_A1888;
+  } else if (var->transp.length == 1)
+   data |= WINCON1_BPPMODE_25BPP_A1888
+    | WINCON1_BLD_PIX;
+  else if (var->transp.length == 4)
+   data |= WINCON1_BPPMODE_28BPP_A4888
+    | WINCON1_BLD_PIX | WINCON1_ALPHA_SEL;
  else
   data |= WINCON0_BPPMODE_24BPP_888;

@@ -418,6 +429,20 @@ static int s3c_fb_set_par(struct fb_info *info)
  break;
 }

+ /* It has no color key control register for window0 */
+ if (win_no > 0) {
+  u32 keycon0_data = 0, keycon1_data = 0;
+
+  keycon0_data = ~(WxKEYCON0_KEYBL_EN |
+    WxKEYCON0_KEYEN_F |
+    WxKEYCON0_DIRCON) | WxKEYCON0_COMPKEY(0);
+
+  keycon1_data = WxKEYCON1_COLVAL(0xffffff);
+
+  writel(keycon0_data, regs + WxKEYCONy(win_no-1, 0));
+  writel(keycon1_data, regs + WxKEYCONy(win_no-1, 1));
+ }
+
 writel(data, regs + WINCON(win_no));
 writel(0x0, regs + WINxMAP(win_no));

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Alpha Channel support for Samsung SoC Framebuffer driver.
       [not found] ` <20090508121739.b58b2d57.akpm@linux-foundation.org>
@ 2009-05-10  7:31   ` InKi Dae
  0 siblings, 0 replies; 2+ messages in thread
From: InKi Dae @ 2009-05-10  7:31 UTC (permalink / raw)
  To: ben-linux, linux-fbdev-devel, linux-kernel; +Cc: Andrew Morton, Kyungmin Park

[-- Attachment #1: Type: text/plain, Size: 601 bytes --]

I have modifed the space problem of my patch and then I am sending
this patch modified again.
You can see attached file.

Thank you for your indication, Andrew Morton.

2009/5/9 Andrew Morton <akpm@linux-foundation.org>:
> On Thu, 7 May 2009 13:47:16 +0900
> InKi Dae <daeinki@gmail.com> wrote:
>
>> This patch supports ARGB1888 and ARGB4888 for Samsung SoC Framebuffer
>> driver. (s3c-fb.c)
>
> The patch was hopelessly mangled by your email client - all tabs
> were replaced with single spaces.
>
> Please fix that up then resend.  Please cc myself on that resend.
>
> Thanks.
>

[-- Attachment #2: s3c_lcd_alpha.patch --]
[-- Type: application/octet-stream, Size: 1713 bytes --]

diff --git a/drivers/video/s3c-fb.c b/drivers/video/s3c-fb.c
index e0e7899..55d2298 100644
--- a/drivers/video/s3c-fb.c
+++ b/drivers/video/s3c-fb.c
@@ -358,9 +358,16 @@ static int s3c_fb_set_par(struct fb_info *info)
 	writel(data, regs + VIDOSD_B(win_no));
 
 	data = var->xres * var->yres;
+
+	u32 osdc_data = 0;
+
+	osdc_data = VIDISD14C_ALPHA1_R(0xf) |
+		VIDISD14C_ALPHA1_G(0xf) |
+		VIDISD14C_ALPHA1_B(0xf);
+
 	if (s3c_fb_has_osd_d(win_no)) {
 		writel(data, regs + VIDOSD_D(win_no));
-		writel(0, regs + VIDOSD_C(win_no));
+		writel(osdc_data, regs + VIDOSD_C(win_no));
 	} else
 		writel(data, regs + VIDOSD_C(win_no));
 
@@ -409,8 +416,12 @@ static int s3c_fb_set_par(struct fb_info *info)
 				data |= WINCON1_BPPMODE_19BPP_A1666;
 			else
 				data |= WINCON1_BPPMODE_18BPP_666;
-		} else if (var->transp.length != 0)
-			data |= WINCON1_BPPMODE_25BPP_A1888;
+		} else if (var->transp.length == 1)
+			data |= WINCON1_BPPMODE_25BPP_A1888
+				| WINCON1_BLD_PIX;
+		else if (var->transp.length == 4)
+			data |= WINCON1_BPPMODE_28BPP_A4888
+				| WINCON1_BLD_PIX | WINCON1_ALPHA_SEL;
 		else
 			data |= WINCON0_BPPMODE_24BPP_888;
 
@@ -418,6 +429,20 @@ static int s3c_fb_set_par(struct fb_info *info)
 		break;
 	}
 
+	/* It has no color key control register for window0 */
+	if (win_no > 0) {
+		u32 keycon0_data = 0, keycon1_data = 0;
+
+		keycon0_data = ~(WxKEYCON0_KEYBL_EN |
+				WxKEYCON0_KEYEN_F |
+				WxKEYCON0_DIRCON) | WxKEYCON0_COMPKEY(0);
+
+		keycon1_data = WxKEYCON1_COLVAL(0xffffff);
+
+		writel(keycon0_data, regs + WxKEYCONy(win_no-1, 0));
+		writel(keycon1_data, regs + WxKEYCONy(win_no-1, 1));
+	}
+
 	writel(data, regs + WINCON(win_no));
 	writel(0x0, regs + WINxMAP(win_no));
 

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-05-10  7:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-07  4:47 [PATCH] Alpha Channel support for Samsung SoC Framebuffer driver InKi Dae
     [not found] ` <20090508121739.b58b2d57.akpm@linux-foundation.org>
2009-05-10  7:31   ` InKi Dae

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.