Re: [PATCH 2/4 v4] video, sm501: add edid and commandline support

2011-01-25 Thread Heiko Schocher
Hello Paul,

Paul Mundt wrote:
 On Mon, Jan 24, 2011 at 10:57:27AM +0100, Heiko Schocher wrote:
 @@ -1884,7 +1935,6 @@ static int __devinit sm501fb_probe(struct 
 platform_device *pdev)
  
  if (info-pdata == NULL) {
  dev_info(dev, using default configuration data\n);
 -info-pdata = sm501fb_def_pdata;
  }
  
  /* probe for the presence of each panel */
 
 I assume this is accidental? I don't see how you're compensating for this
 in any of the other patches at least, as it's orthogonal from the default
 mode settings.

Seems so, rework this too, thanks!

bye,
heiko
-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk  Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH 2/4 v4] video, sm501: add edid and commandline support

2011-01-24 Thread Heiko Schocher
- add commandline options:
  sm501fb.mode:
Specify resolution as xresxyres[-bpp][@refresh]
  sm501fb.bpp:
Specify bit-per-pixel if not specified mode

- Add support for encoding display mode information
  in the device tree using verbatim EDID block.

  If the edid entry in the smi,sm501 node is present,
  the driver will build mode database using EDID data
  and allow setting the display modes from this database.

Signed-off-by: Heiko Schocher h...@denx.de
cc: linux-fb...@vger.kernel.org
cc: devicetree-disc...@ozlabs.org
cc: Ben Dooks b...@simtec.co.uk
cc: Vincent Sanders vi...@simtec.co.uk
cc: Samuel Ortiz sa...@linux.intel.com
cc: linux-ker...@vger.kernel.org
cc: Randy Dunlap rdun...@xenotime.net
cc: Paul Mundt let...@linux-sh.org

---
- changes since v1:
  add Ben Dooks, Vincent Sanders and Samuel Ortiz to cc, as suggested from
  Paul Mundt.
- changes since v2:
  add comments from Randy Dunlap:
  - move parameter documentation to Documentation/fb/sm501.txt
- changes since v3:
  - rebased against v2.6.38-rc2
  - split in 3 patches
- of support patch
- i/o routine patch
- edid support patch

./scripts/checkpatch.pl 0002-video-sm501-add-edid-and-commandline-support.patch
total: 0 errors, 0 warnings, 123 lines checked

0002-video-sm501-add-edid-and-commandline-support.patch has no obvious style 
problems and is ready for submission.

 Documentation/fb/sm501.txt |   10 ++
 drivers/video/sm501fb.c|   67 
 2 files changed, 71 insertions(+), 6 deletions(-)
 create mode 100644 Documentation/fb/sm501.txt

diff --git a/Documentation/fb/sm501.txt b/Documentation/fb/sm501.txt
new file mode 100644
index 000..8d17aeb
--- /dev/null
+++ b/Documentation/fb/sm501.txt
@@ -0,0 +1,10 @@
+Configuration:
+
+You can pass the following kernel command line options to sm501 
videoframebuffer:
+
+   sm501fb.bpp=SM501 Display driver:
+   Specifiy bits-per-pixel if not specified by 'mode'
+
+   sm501fb.mode=   SM501 Display driver:
+   Specify resolution as
+   xresxyres[-bpp][@refresh]
diff --git a/drivers/video/sm501fb.c b/drivers/video/sm501fb.c
index c5b4b95..30b53ae 100644
--- a/drivers/video/sm501fb.c
+++ b/drivers/video/sm501fb.c
@@ -41,6 +41,26 @@
 #include linux/sm501.h
 #include linux/sm501-regs.h
 
+#include edid.h
+
+static char *fb_mode = 640x480-16@60;
+static unsigned long default_bpp = 16;
+
+static struct fb_videomode __devinitdata sm501_default_mode = {
+   .refresh= 60,
+   .xres   = 640,
+   .yres   = 480,
+   .pixclock   = 20833,
+   .left_margin= 142,
+   .right_margin   = 13,
+   .upper_margin   = 21,
+   .lower_margin   = 1,
+   .hsync_len  = 69,
+   .vsync_len  = 3,
+   .sync   = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
+   .vmode  = FB_VMODE_NONINTERLACED
+};
+
 #define NR_PALETTE 256
 
 enum sm501_controller {
@@ -77,6 +97,7 @@ struct sm501fb_info {
void __iomem*regs2d;/* 2d remapped registers */
void __iomem*fbmem; /* remapped framebuffer */
size_t   fbmem_len; /* length of remapped region */
+   u8 *edid_data;
 };
 
 /* per-framebuffer private data */
@@ -1725,9 +1746,16 @@ static int sm501fb_init_fb(struct fb_info *fb,
fb-var.vmode   = FB_VMODE_NONINTERLACED;
fb-var.bits_per_pixel  = 16;
 
+   if (info-edid_data) {
+   /* Now build modedb from EDID */
+   fb_edid_to_monspecs(info-edid_data, fb-monspecs);
+   fb_videomode_to_modelist(fb-monspecs.modedb,
+fb-monspecs.modedb_len,
+fb-modelist);
+   }
+
if (enable  (pd-flags  SM501FB_FLAG_USE_INIT_MODE)  0) {
/* TODO read the mode from the current display */
-
} else {
if (pd-def_mode) {
dev_info(info-dev, using supplied mode\n);
@@ -1737,12 +1765,34 @@ static int sm501fb_init_fb(struct fb_info *fb,
fb-var.xres_virtual = fb-var.xres;
fb-var.yres_virtual = fb-var.yres;
} else {
-   ret = fb_find_mode(fb-var, fb,
+   if (info-edid_data)
+   ret = fb_find_mode(fb-var, fb, fb_mode,
+   fb-monspecs.modedb,
+   fb-monspecs.modedb_len,
+   sm501_default_mode, default_bpp);
+   else
+   ret = fb_find_mode(fb-var, fb,
   NULL, NULL, 0, NULL, 8);
 
-   if (ret == 0 || ret == 4) {
-   

Re: [PATCH 2/4 v4] video, sm501: add edid and commandline support

2011-01-24 Thread Paul Mundt
On Mon, Jan 24, 2011 at 10:57:27AM +0100, Heiko Schocher wrote:
 @@ -1884,7 +1935,6 @@ static int __devinit sm501fb_probe(struct 
 platform_device *pdev)
  
   if (info-pdata == NULL) {
   dev_info(dev, using default configuration data\n);
 - info-pdata = sm501fb_def_pdata;
   }
  
   /* probe for the presence of each panel */

I assume this is accidental? I don't see how you're compensating for this
in any of the other patches at least, as it's orthogonal from the default
mode settings.
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev