From 77fb5dfe140c3c3c9fb03dfc33ae78ed5a36de98 Mon Sep 17 00:00:00 2001 From: Kristoffer Ericson Date: Wed, 15 Oct 2008 22:03:51 -0700 Subject: [PATCH] --- yaml --- r: 114870 b: refs/heads/master c: 0b178883b36e6f522e4a7019bf5a147daf521a01 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/drivers/video/s1d13xxxfb.c | 23 +++++++++++++++++++---- trunk/include/video/s1d13xxxfb.h | 3 ++- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/[refs] b/[refs] index 418ffce628bf..ae4635c1be3a 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 4d31a2b74c6d063362ae10ce3be3e80d8713bf23 +refs/heads/master: 0b178883b36e6f522e4a7019bf5a147daf521a01 diff --git a/trunk/drivers/video/s1d13xxxfb.c b/trunk/drivers/video/s1d13xxxfb.c index b829dc7c5edf..a7b01d2724b5 100644 --- a/trunk/drivers/video/s1d13xxxfb.c +++ b/trunk/drivers/video/s1d13xxxfb.c @@ -50,6 +50,11 @@ #define dbg(fmt, args...) do { } while (0) #endif +static const int __devinitconst s1d13xxxfb_revisions[] = { + S1D13506_CHIP_REV, /* Rev.4 on HP Jornada 7xx S1D13506 */ + S1D13806_CHIP_REV, /* Rev.7 on .. */ +}; + /* * Here we define the default struct fb_fix_screeninfo */ @@ -538,6 +543,7 @@ s1d13xxxfb_probe(struct platform_device *pdev) struct fb_info *info; struct s1d13xxxfb_pdata *pdata = NULL; int ret = 0; + int i; u8 revision; dbg("probe called: device is %p\n", pdev); @@ -607,10 +613,19 @@ s1d13xxxfb_probe(struct platform_device *pdev) goto bail; } - revision = s1d13xxxfb_readreg(default_par, S1DREG_REV_CODE); - if ((revision >> 2) != S1D_CHIP_REV) { - printk(KERN_INFO PFX "chip not found: %i\n", (revision >> 2)); - ret = -ENODEV; + revision = s1d13xxxfb_readreg(default_par, S1DREG_REV_CODE) >> 2; + + ret = -ENODEV; + + for (i = 0; i < ARRAY_SIZE(s1d13xxxfb_revisions); i++) { + if (revision == s1d13xxxfb_revisions[i]) + ret = 0; + } + + if (!ret) + printk(KERN_INFO PFX "chip revision %i\n", revision); + else { + printk(KERN_INFO PFX "unknown chip revision %i\n", revision); goto bail; } diff --git a/trunk/include/video/s1d13xxxfb.h b/trunk/include/video/s1d13xxxfb.h index c99d261df8f7..fe41b8407946 100644 --- a/trunk/include/video/s1d13xxxfb.h +++ b/trunk/include/video/s1d13xxxfb.h @@ -14,7 +14,8 @@ #define S1D13XXXFB_H #define S1D_PALETTE_SIZE 256 -#define S1D_CHIP_REV 7 /* expected chip revision number for s1d13806 */ +#define S1D13506_CHIP_REV 4 /* expected chip revision number for s1d13506 */ +#define S1D13806_CHIP_REV 7 /* expected chip revision number for s1d13806 */ #define S1D_FBID "S1D13806" #define S1D_DEVICENAME "s1d13806fb"