diff options
author | Kristoffer Ericson <kristoffer.ericson@gmail.com> | 2009-03-31 18:25:31 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-04-01 11:59:32 -0400 |
commit | afbb9d8d5266b4121cb503b4e097f8e65286a077 (patch) | |
tree | 51463d6338f1e541c3bfc004c05a7fb76c4ebbe1 /drivers | |
parent | 91ad1203535da95bb13072bdb59e1dc3ca76ec5d (diff) |
fbdev: update s1d13xxxfb to differ between revisions and production ids
The s1d13xxx chip provides two values of identification value: the
Production id (e.g 13506/13505/13806..) and a revision number 0,1,2,3).
Together these can help us to differentiate between similiar setups.
This patch adds the proper way of grabbing both those values and save them
for future reference (in order to decide what functions a card supports,
e.g acceleration).
We also move away from the concept of all s1d13xxx = s1d13806 when we
really support alot more.
[akpm@linux-foundation.org: coding-style fixes]
[akpm@linux-foundation.org: simplify s1d13xxxfb_probe()]
Signed-off-by: Kristoffer Ericson <kristoffer.ericson@gmail.com
Cc: Krzysztof Helt <krzysztof.h1@poczta.fm>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/video/s1d13xxxfb.c | 48 |
1 files changed, 36 insertions, 12 deletions
diff --git a/drivers/video/s1d13xxxfb.c b/drivers/video/s1d13xxxfb.c index a7b01d2724b5..0726aecf3b7e 100644 --- a/drivers/video/s1d13xxxfb.c +++ b/drivers/video/s1d13xxxfb.c | |||
@@ -50,9 +50,22 @@ | |||
50 | #define dbg(fmt, args...) do { } while (0) | 50 | #define dbg(fmt, args...) do { } while (0) |
51 | #endif | 51 | #endif |
52 | 52 | ||
53 | static const int __devinitconst s1d13xxxfb_revisions[] = { | 53 | /* |
54 | S1D13506_CHIP_REV, /* Rev.4 on HP Jornada 7xx S1D13506 */ | 54 | * List of card production ids |
55 | S1D13806_CHIP_REV, /* Rev.7 on .. */ | 55 | */ |
56 | static const int s1d13xxxfb_prod_ids[] = { | ||
57 | S1D13505_PROD_ID, | ||
58 | S1D13506_PROD_ID, | ||
59 | S1D13806_PROD_ID, | ||
60 | }; | ||
61 | |||
62 | /* | ||
63 | * List of card strings | ||
64 | */ | ||
65 | static const char *s1d13xxxfb_prod_names[] = { | ||
66 | "S1D13505", | ||
67 | "S1D13506", | ||
68 | "S1D13806", | ||
56 | }; | 69 | }; |
57 | 70 | ||
58 | /* | 71 | /* |
@@ -377,7 +390,6 @@ s1d13xxxfb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info) | |||
377 | return 0; | 390 | return 0; |
378 | } | 391 | } |
379 | 392 | ||
380 | |||
381 | /* framebuffer information structures */ | 393 | /* framebuffer information structures */ |
382 | 394 | ||
383 | static struct fb_ops s1d13xxxfb_fbops = { | 395 | static struct fb_ops s1d13xxxfb_fbops = { |
@@ -544,7 +556,7 @@ s1d13xxxfb_probe(struct platform_device *pdev) | |||
544 | struct s1d13xxxfb_pdata *pdata = NULL; | 556 | struct s1d13xxxfb_pdata *pdata = NULL; |
545 | int ret = 0; | 557 | int ret = 0; |
546 | int i; | 558 | int i; |
547 | u8 revision; | 559 | u8 revision, prod_id; |
548 | 560 | ||
549 | dbg("probe called: device is %p\n", pdev); | 561 | dbg("probe called: device is %p\n", pdev); |
550 | 562 | ||
@@ -613,19 +625,31 @@ s1d13xxxfb_probe(struct platform_device *pdev) | |||
613 | goto bail; | 625 | goto bail; |
614 | } | 626 | } |
615 | 627 | ||
616 | revision = s1d13xxxfb_readreg(default_par, S1DREG_REV_CODE) >> 2; | 628 | /* production id is top 6 bits */ |
617 | 629 | prod_id = s1d13xxxfb_readreg(default_par, S1DREG_REV_CODE) >> 2; | |
630 | /* revision id is lower 2 bits */ | ||
631 | revision = s1d13xxxfb_readreg(default_par, S1DREG_REV_CODE) & 0x3; | ||
618 | ret = -ENODEV; | 632 | ret = -ENODEV; |
619 | 633 | ||
620 | for (i = 0; i < ARRAY_SIZE(s1d13xxxfb_revisions); i++) { | 634 | for (i = 0; i < ARRAY_SIZE(s1d13xxxfb_prod_ids); i++) { |
621 | if (revision == s1d13xxxfb_revisions[i]) | 635 | if (prod_id == s1d13xxxfb_prod_ids[i]) { |
636 | /* looks like we got it in our list */ | ||
637 | default_par->prod_id = prod_id; | ||
638 | default_par->revision = revision; | ||
622 | ret = 0; | 639 | ret = 0; |
640 | break; | ||
641 | } | ||
623 | } | 642 | } |
624 | 643 | ||
625 | if (!ret) | 644 | if (!ret) { |
645 | printk(KERN_INFO PFX "chip production id %i = %s\n", | ||
646 | prod_id, s1d13xxxfb_prod_names[i]); | ||
626 | printk(KERN_INFO PFX "chip revision %i\n", revision); | 647 | printk(KERN_INFO PFX "chip revision %i\n", revision); |
627 | else { | 648 | } else { |
628 | printk(KERN_INFO PFX "unknown chip revision %i\n", revision); | 649 | printk(KERN_INFO PFX |
650 | "unknown chip production id %i, revision %i\n", | ||
651 | prod_id, revision); | ||
652 | printk(KERN_INFO PFX "please contant maintainer\n"); | ||
629 | goto bail; | 653 | goto bail; |
630 | } | 654 | } |
631 | 655 | ||