* Re: possible typo in ancient radeon code
From: Geert Uytterhoeven @ 2015-03-19 12:52 UTC (permalink / raw)
To: linux-fbdev
In-Reply-To: <20150319123021.GA12264@mwanda>
CC BenH
On Thu, Mar 19, 2015 at 1:30 PM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> Hello FB devs,
>
> This ancient code from 1da177e4c3f4: "Linux-2.6.12-rc2" from Apr 16,
> 2005, leads to the following static checker warning:
Nah, it's a little bit older (in full-history-linux ;-)
commit 9ff343f3d155aa35f79bae8607d7c4500d7ef848
Author: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Date: Thu Feb 10 16:03:30 2005 -0800
[PATCH] radeonfb update
>
> drivers/video/fbdev/aty/radeon_pm.c:417 radeon_pm_enable_dynamic_mode()
> warn: we tested 'tmp & (1 << 21)' before and it was 'true'
>
> include/video/radeon.h
> 1216 #define MCLK_CNTL__MRDCKA1_SOUTSEL_MASK 0x0c000000L
> 1217 #define MCLK_CNTL__MRDCKB0_SOUTSEL_MASK 0x30000000L
> 1218 #define MCLK_CNTL__MRDCKB1_SOUTSEL_MASK 0xc0000000L
> 1219 #define MCLK_CNTL__R300_DISABLE_MC_MCLKA (1 << 21)
> 1220 #define MCLK_CNTL__R300_DISABLE_MC_MCLKB (1 << 21)
>
> These are probably supposed to refer to different bits.
>
> 1221
> 1222 // MCLK_MISC
>
> drivers/video/fbdev/aty/radeon_pm.c
> 411 /* Some releases of vbios have set DISABLE_MC_MCLKA
> 412 * and DISABLE_MC_MCLKB bits in the vbios table. Setting these
> 413 * bits will cause H/W hang when reading video memory with dynamic
> 414 * clocking enabled.
> 415 */
> 416 if ((tmp & MCLK_CNTL__R300_DISABLE_MC_MCLKA) &&
> 417 (tmp & MCLK_CNTL__R300_DISABLE_MC_MCLKB)) {
>
> The duplicate check here causes a warning. I guess it probably doesn't
> matter if no one complains...
>
> 418 /* If both bits are set, then check the active channels */
> 419 tmp = INPLL(pllMCLK_CNTL);
> 420 if (rinfo->vram_width = 64) {
> 421 if (INREG(MEM_CNTL) & R300_MEM_USE_CD_CH_ONLY)
> 422 tmp &= ~MCLK_CNTL__R300_DISABLE_MC_MCLKB;
> 423 else
> 424 tmp &= ~MCLK_CNTL__R300_DISABLE_MC_MCLKA;
> 425 } else {
> 426 tmp &= ~(MCLK_CNTL__R300_DISABLE_MC_MCLKA |
> 427 MCLK_CNTL__R300_DISABLE_MC_MCLKB);
> 428 }
> 429 }
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply
* Re: [PATCHv4 07/10] fbdev: ssd1307fb: Add a module parameter to set the refresh rate
From: Maxime Ripard @ 2015-03-19 13:18 UTC (permalink / raw)
To: Thomas Niederprüm
Cc: plagnioj, tomi.valkeinen, kernel, shawn.guo, robh+dt, linux-fbdev,
linux-kernel
In-Reply-To: <1426525918-12745-8-git-send-email-niederp@physik.uni-kl.de>
[-- Attachment #1: Type: text/plain, Size: 1132 bytes --]
On Mon, Mar 16, 2015 at 06:11:55PM +0100, Thomas Niederprüm wrote:
> This patch adds the module parameter "refreshrate" to set delay for the
> deferred io. The refresh rate is given in units of Hertz. The default
> refresh rate is 1 Hz. The refresh rate set through the newly introduced
> parameter applies to all instances of the driver and for now it is not
> possible to change it individually.
>
> Signed-off-by: Thomas Niederprüm <niederp@physik.uni-kl.de>
> ---
> drivers/video/fbdev/ssd1307fb.c | 23 +++++++++++++++++------
> 1 file changed, 17 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/video/fbdev/ssd1307fb.c b/drivers/video/fbdev/ssd1307fb.c
> index 6fecec8..8a8d305 100644
> --- a/drivers/video/fbdev/ssd1307fb.c
> +++ b/drivers/video/fbdev/ssd1307fb.c
> @@ -42,6 +42,11 @@
> #define SSD1307FB_SET_COM_PINS_CONFIG 0xda
> #define SSD1307FB_SET_VCOMH 0xdb
>
> +#define REFRASHRATE 1
> +
> +static u_int refreshrate = REFRASHRATE;
s/REFRASH/REFRESH/ :)
Maxime
--
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply
* Re: [PATCHv4 09/10] fbdev: ssd1307fb: add backlight controls for setting the contrast
From: Maxime Ripard @ 2015-03-19 13:22 UTC (permalink / raw)
To: Thomas Niederprüm
Cc: plagnioj, tomi.valkeinen, kernel, shawn.guo, robh+dt, linux-fbdev,
linux-kernel
In-Reply-To: <1426525918-12745-10-git-send-email-niederp@physik.uni-kl.de>
[-- Attachment #1: Type: text/plain, Size: 422 bytes --]
On Mon, Mar 16, 2015 at 06:11:57PM +0100, Thomas Niederprüm wrote:
> The backlight class is used to create userspace handles for
> setting the OLED contrast.
>
> Signed-off-by: Thomas Niederprüm <niederp@physik.uni-kl.de>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Thanks!
Maxime
--
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply
* Re: [PATCH] sm750fb: Fix C99 Comments and if else braces
From: Giedrius Statkevičius @ 2015-03-19 17:42 UTC (permalink / raw)
To: Amitoj Kaur Chawla, sudipm.mukherjee, teddy.wang, gregkh,
linux-fbdev, devel, linux-kernel
In-Reply-To: <20150319173947.GA12061@amitoj-Inspiron-3542>
Hi Amitoj Kaur Chawla,
On 2015.03.19 19:39, Amitoj Kaur Chawla wrote:
> The edits have been made to remove C99 Comments and properly indent
> the if-else statements in the file while taking care of the braces according to
> Linux coding style.
>
> Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
> ---
> drivers/staging/sm750fb/ddk750_chip.c | 25 +++++++++++--------------
> 1 file changed, 11 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/staging/sm750fb/ddk750_chip.c b/drivers/staging/sm750fb/ddk750_chip.c
> index 33add64..33fa456 100644
> --- a/drivers/staging/sm750fb/ddk750_chip.c
> +++ b/drivers/staging/sm750fb/ddk750_chip.c
> @@ -17,25 +17,22 @@ logical_chip_type_t getChipType(void)
> char physicalRev;
> logical_chip_type_t chip;
>
> - physicalID = devId750;//either 0x718 or 0x750
> + physicalID = devId750;/* either 0x718 or 0x750 */
Add a space here after ;?
> physicalRev = revId750;
>
> - if (physicalID = 0x718)
> - {
> - chip = SM718;
> - }
> - else if (physicalID = 0x750)
> - {
> - chip = SM750;
> + if (physicalID = 0x718) {
> + chip = SM718;
> + }
> + else if (physicalID = 0x750) {
> + chip = SM750;
> /* SM750 and SM750LE are different in their revision ID only. */
> - if (physicalRev = SM750LE_REVISION_ID){
> + if (physicalRev = SM750LE_REVISION_ID) {
> chip = SM750LE;
> }
> - }
> - else
> - {
> - chip = SM_UNKNOWN;
> - }
> + }
> + else {
> + chip = SM_UNKNOWN;
> + }
>
> return chip;
> }
>
--
Thanks,
Giedrius
^ permalink raw reply
* [PATCH] sm750fb: Fix C99 Comments and if else braces
From: Amitoj Kaur Chawla @ 2015-03-19 17:51 UTC (permalink / raw)
To: sudipm.mukherjee, teddy.wang, gregkh, linux-fbdev, devel,
linux-kernel
In-Reply-To: <550B0A6B.5090008@gmail.com>
The edits have been made to remove C99 Comments and properly indent
the if-else statements in the file while taking care of the braces according to
Linux coding style.
Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
---
drivers/staging/sm750fb/ddk750_chip.c | 25 +++++++++++--------------
1 file changed, 11 insertions(+), 14 deletions(-)
diff --git a/drivers/staging/sm750fb/ddk750_chip.c b/drivers/staging/sm750fb/ddk750_chip.c
index 33add64..33fa456 100644
--- a/drivers/staging/sm750fb/ddk750_chip.c
+++ b/drivers/staging/sm750fb/ddk750_chip.c
@@ -17,25 +17,22 @@ logical_chip_type_t getChipType(void)
char physicalRev;
logical_chip_type_t chip;
- physicalID = devId750;//either 0x718 or 0x750
+ physicalID = devId750;/* either 0x718 or 0x750 */
physicalRev = revId750;
- if (physicalID = 0x718)
- {
- chip = SM718;
- }
- else if (physicalID = 0x750)
- {
- chip = SM750;
+ if (physicalID = 0x718) {
+ chip = SM718;
+ }
+ else if (physicalID = 0x750) {
+ chip = SM750;
/* SM750 and SM750LE are different in their revision ID only. */
- if (physicalRev = SM750LE_REVISION_ID){
+ if (physicalRev = SM750LE_REVISION_ID) {
chip = SM750LE;
}
- }
- else
- {
- chip = SM_UNKNOWN;
- }
+ }
+ else {
+ chip = SM_UNKNOWN;
+ }
return chip;
}
--
1.9.1
^ permalink raw reply related
* Re: [PATCH] sm750fb: Fix C99 Comments and if else braces
From: Joe Perches @ 2015-03-19 18:06 UTC (permalink / raw)
To: Amitoj Kaur Chawla
Cc: sudipm.mukherjee, teddy.wang, gregkh, linux-fbdev, devel,
linux-kernel
In-Reply-To: <20150319173947.GA12061@amitoj-Inspiron-3542>
On Thu, 2015-03-19 at 23:09 +0530, Amitoj Kaur Chawla wrote:
> The edits have been made to remove C99 Comments and properly indent
> the if-else statements in the file while taking care of the braces according to
> Linux coding style.
Please scan your proposed patches with checkpatch
and fix possible style defects before sending them.
^ permalink raw reply
* Re: [PATCH] sm750fb: Fix Comment and if else braces
From: Giedrius Statkevičius @ 2015-03-19 18:13 UTC (permalink / raw)
To: Amitoj Kaur Chawla, sudipm.mukherjee, teddy.wang, gregkh,
linux-fbdev, devel, linux-kernel
In-Reply-To: <20150319180556.GA12241@amitoj-Inspiron-3542>
Hi Amitoj Kaur Chawla,
On 2015.03.19 20:05, Amitoj Kaur Chawla wrote:
> The edits have been made to add a space before the comment and the errors in
> braces in the if-else statements.
> Previously in commit 2d34f53f1065878cd881ac61a183f8e836583d51, removed
> the C99 comments and errors in if-else indentation and braces.
The previous patch isn't in the git repo yet so it doesn't have a commit
id thus this one is wrong. You should've just made a v2 and made that
change. I recommend you to look over this:
http://kernelnewbies.org/FirstKernelPatch Just remove the HEAD commit in
your local git repo, add that space and then when using `git
format-patch` use the "--subject-prefix" option to add that it's a
second version. Then after "---" you can say what was changed in the
second version. For example (I'm sure you can think of a better one!):
Signed-off-by: ...
---
v2: added a space after a statement in a line where a coding style error
was fixed.
drivers/...
>
> Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
> ---
> drivers/staging/sm750fb/ddk750_chip.c | 11 ++++-------
> 1 file changed, 4 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/staging/sm750fb/ddk750_chip.c b/drivers/staging/sm750fb/ddk750_chip.c
> index 33fa456..bdf6a73 100644
> --- a/drivers/staging/sm750fb/ddk750_chip.c
> +++ b/drivers/staging/sm750fb/ddk750_chip.c
> @@ -17,20 +17,17 @@ logical_chip_type_t getChipType(void)
> char physicalRev;
> logical_chip_type_t chip;
>
> - physicalID = devId750;/* either 0x718 or 0x750 */
> + physicalID = devId750; /* either 0x718 or 0x750 */
> physicalRev = revId750;
>
> if (physicalID = 0x718) {
> chip = SM718;
> - }
> - else if (physicalID = 0x750) {
> + } else if (physicalID = 0x750) {
> chip = SM750;
> /* SM750 and SM750LE are different in their revision ID only. */
> - if (physicalRev = SM750LE_REVISION_ID) {
> + if (physicalRev = SM750LE_REVISION_ID)
> chip = SM750LE;
> - }
> - }
> - else {
> + } else {
> chip = SM_UNKNOWN;
> }
>
>
--
Thanks,
Giedrius
^ permalink raw reply
* [PATCH] sm750fb: Fix Comment and if else braces
From: Amitoj Kaur Chawla @ 2015-03-19 18:17 UTC (permalink / raw)
To: sudipm.mukherjee, teddy.wang, gregkh, linux-fbdev, devel,
linux-kernel
In-Reply-To: <550B11C0.1030300@gmail.com>
The edits have been made to add a space before the comment and the errors in
braces in the if-else statements.
Previously in commit 2d34f53f1065878cd881ac61a183f8e836583d51, removed
the C99 comments and errors in if-else indentation and braces.
Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
---
drivers/staging/sm750fb/ddk750_chip.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/drivers/staging/sm750fb/ddk750_chip.c b/drivers/staging/sm750fb/ddk750_chip.c
index 33fa456..bdf6a73 100644
--- a/drivers/staging/sm750fb/ddk750_chip.c
+++ b/drivers/staging/sm750fb/ddk750_chip.c
@@ -17,20 +17,17 @@ logical_chip_type_t getChipType(void)
char physicalRev;
logical_chip_type_t chip;
- physicalID = devId750;/* either 0x718 or 0x750 */
+ physicalID = devId750; /* either 0x718 or 0x750 */
physicalRev = revId750;
if (physicalID = 0x718) {
chip = SM718;
- }
- else if (physicalID = 0x750) {
+ } else if (physicalID = 0x750) {
chip = SM750;
/* SM750 and SM750LE are different in their revision ID only. */
- if (physicalRev = SM750LE_REVISION_ID) {
+ if (physicalRev = SM750LE_REVISION_ID)
chip = SM750LE;
- }
- }
- else {
+ } else {
chip = SM_UNKNOWN;
}
--
1.9.1
^ permalink raw reply related
* [PATCH] staging: sm750fb: fixing multiple checkpatch errors and warnings
From: Michel von Czettritz @ 2015-03-19 19:26 UTC (permalink / raw)
To: sudipm.mukherjee
Cc: teddy.wang, gregkh, linux-kernel, kernel-janitors, linux-fbdev
This patch formats sm750.c to
- correct intendations
- no leading or trailing whitespaces
- no C99 Style comments
- correct braces and spacings for if, for and functions
- no initalisation of static variables to 0 or NULL
- no assignments in if conditions
- correct spacings arround pointers and function arguments
and some other warnings
Signed-off-by: Michel von Czettritz <michel.von.czettritz@gmail.com>
---
drivers/staging/sm750fb/sm750.c | 1306 ++++++++++++++++++++-------------------
1 file changed, 674 insertions(+), 632 deletions(-)
diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index a7b1b9c..b81e5b7 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -33,15 +33,15 @@ int smi_indent = 0;
/*
#ifdef __BIG_ENDIAN
ssize_t lynxfb_ops_write(struct fb_info *info, const char __user *buf,
- size_t count, loff_t *ppos);
+ size_t count, loff_t *ppos);
ssize_t lynxfb_ops_read(struct fb_info *info, char __user *buf,
- size_t count, loff_t *ppos);
+ size_t count, loff_t *ppos);
#endif
*/
-typedef void (*PROC_SPEC_SETUP)(struct lynx_share*,char *);
-typedef int (*PROC_SPEC_MAP)(struct lynx_share*,struct pci_dev*);
-typedef int (*PROC_SPEC_INITHW)(struct lynx_share*,struct pci_dev*);
+typedef void (*PROC_SPEC_SETUP)(struct lynx_share*, char *);
+typedef int (*PROC_SPEC_MAP)(struct lynx_share*, struct pci_dev*);
+typedef int (*PROC_SPEC_INITHW)(struct lynx_share*, struct pci_dev*);
/* common var for all device */
@@ -50,59 +50,61 @@ static int g_noaccel;
#ifdef CONFIG_MTRR
static int g_nomtrr;
#endif
-static const char * g_fbmode[] = {NULL,NULL};
-static const char * g_def_fbmode = "800x600-16@60";
-static char * g_settings = NULL;
+static const char *g_fbmode[] = {NULL, NULL};
+static const char *g_def_fbmode = "800x600-16@60";
+static char *g_settings;
static int g_dualview;
-static char * g_option = NULL;
+static char *g_option;
/* if not use spin_lock,system will die if user load driver
* and immediatly unload driver frequently (dual)*/
-static inline void myspin_lock(spinlock_t * sl){
- struct lynx_share * share;
- share = container_of(sl,struct lynx_share,slock);
- if(share->dual){
+static inline void myspin_lock(spinlock_t *sl)
+{
+ struct lynx_share *share;
+
+ share = container_of(sl, struct lynx_share, slock);
+ if (share->dual)
spin_lock(sl);
- }
}
-static inline void myspin_unlock(spinlock_t * sl){
- struct lynx_share * share;
- share = container_of(sl,struct lynx_share,slock);
- if(share->dual){
+static inline void myspin_unlock(spinlock_t *sl)
+{
+ struct lynx_share *share;
+
+ share = container_of(sl, struct lynx_share, slock);
+ if (share->dual)
spin_unlock(sl);
- }
}
static const struct fb_videomode lynx750_ext[] = {
- /* 1024x600-60 VESA [1.71:1] */
- {NULL, 60, 1024, 600, 20423, 144, 40, 18, 1, 104, 3,
+ /* 1024x600-60 VESA [1.71:1] */
+ {NULL, 60, 1024, 600, 20423, 144, 40, 18, 1, 104, 3,
FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED},
- /* 1024x600-70 VESA */
- {NULL, 70, 1024, 600, 17211, 152, 48, 21, 1, 104, 3,
+ /* 1024x600-70 VESA */
+ {NULL, 70, 1024, 600, 17211, 152, 48, 21, 1, 104, 3,
FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED},
- /* 1024x600-75 VESA */
- {NULL, 75, 1024, 600, 15822, 160, 56, 23, 1, 104, 3,
+ /* 1024x600-75 VESA */
+ {NULL, 75, 1024, 600, 15822, 160, 56, 23, 1, 104, 3,
FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED},
- /* 1024x600-85 VESA */
- {NULL, 85, 1024, 600, 13730, 168, 56, 26, 1, 112, 3,
+ /* 1024x600-85 VESA */
+ {NULL, 85, 1024, 600, 13730, 168, 56, 26, 1, 112, 3,
FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED},
/* 720x480 */
- {NULL, 60, 720, 480, 37427, 88, 16, 13, 1, 72, 3,
+ {NULL, 60, 720, 480, 37427, 88, 16, 13, 1, 72, 3,
FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED},
- /* 1280x720 [1.78:1] */
- {NULL, 60, 1280, 720, 13426, 162, 86, 22, 1, 136, 3,
- FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,FB_VMODE_NONINTERLACED},
+ /* 1280x720 [1.78:1] */
+ {NULL, 60, 1280, 720, 13426, 162, 86, 22, 1, 136, 3,
+ FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED},
- /* 1280x768@60 */
- {NULL,60,1280,768,12579,192,64,20,3,128,7,
- FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,FB_VMODE_NONINTERLACED},
+ /* 1280x768@60 */
+ {NULL, 60, 1280, 768, 12579, 192, 64, 20, 3, 128, 7,
+ FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED},
- {NULL,60,1360,768,11804,208,64,23,1,144,3,
+ {NULL, 60, 1360, 768, 11804, 208, 64, 23, 1, 144, 3,
FB_SYNC_HOR_HIGH_ACT|FB_VMODE_NONINTERLACED},
/* 1360 x 768 [1.77083:1] */
@@ -113,89 +115,87 @@ static const struct fb_videomode lynx750_ext[] = {
{NULL, 60, 1368, 768, 11647, 216, 72, 23, 1, 144, 3,
FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED},
- /* 1440 x 900 [16:10] */
+ /* 1440 x 900 [16:10] */
{NULL, 60, 1440, 900, 9392, 232, 80, 28, 1, 152, 3,
- FB_SYNC_VERT_HIGH_ACT,FB_VMODE_NONINTERLACED},
+ FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED},
- /* 1440x960 [15:10] */
+ /* 1440x960 [15:10] */
{NULL, 60, 1440, 960, 8733, 240, 88, 30, 1, 152, 3,
FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED},
/* 1920x1080 [16:9] */
{NULL, 60, 1920, 1080, 6734, 148, 88, 41, 1, 44, 3,
- FB_SYNC_VERT_HIGH_ACT,FB_VMODE_NONINTERLACED},
+ FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED},
};
/* no hardware cursor supported under version 2.6.10, kernel bug */
-static int lynxfb_ops_cursor(struct fb_info* info,struct fb_cursor* fbcursor)
+static int lynxfb_ops_cursor(struct fb_info *info, struct fb_cursor *fbcursor)
{
- struct lynxfb_par * par;
- struct lynxfb_crtc * crtc;
- struct lynx_cursor * cursor;
+ struct lynxfb_par *par;
+ struct lynxfb_crtc *crtc;
+ struct lynx_cursor *cursor;
par = info->par;
crtc = &par->crtc;
cursor = &crtc->cursor;
- if(fbcursor->image.width > cursor->maxW ||
+ if (fbcursor->image.width > cursor->maxW ||
fbcursor->image.height > cursor->maxH ||
- fbcursor->image.depth > 1){
+ fbcursor->image.depth > 1) {
return -ENXIO;
}
cursor->disable(cursor);
- if(fbcursor->set & FB_CUR_SETSIZE){
- cursor->setSize(cursor,fbcursor->image.width,fbcursor->image.height);
- }
+ if (fbcursor->set & FB_CUR_SETSIZE)
+ cursor->setSize(cursor, fbcursor->image.width,
+ fbcursor->image.height);
- if(fbcursor->set & FB_CUR_SETPOS){
- cursor->setPos(cursor,fbcursor->image.dx - info->var.xoffset,
- fbcursor->image.dy - info->var.yoffset);
- }
+ if (fbcursor->set & FB_CUR_SETPOS)
+ cursor->setPos(cursor, fbcursor->image.dx - info->var.xoffset,
+ fbcursor->image.dy - info->var.yoffset);
- if(fbcursor->set & FB_CUR_SETCMAP){
+ if (fbcursor->set & FB_CUR_SETCMAP) {
/* get the 16bit color of kernel means */
- u16 fg,bg;
- fg = ((info->cmap.red[fbcursor->image.fg_color] & 0xf800))|
- ((info->cmap.green[fbcursor->image.fg_color] & 0xfc00) >> 5)|
- ((info->cmap.blue[fbcursor->image.fg_color] & 0xf800) >> 11);
+ u16 fg, bg;
- bg = ((info->cmap.red[fbcursor->image.bg_color] & 0xf800))|
- ((info->cmap.green[fbcursor->image.bg_color] & 0xfc00) >> 5)|
- ((info->cmap.blue[fbcursor->image.bg_color] & 0xf800) >> 11);
+ fg = ((info->cmap.red[fbcursor->image.fg_color] & 0xf800)) |
+ ((info->cmap.green[fbcursor->image.fg_color] & 0xfc00) >> 5) |
+ ((info->cmap.blue[fbcursor->image.fg_color] & 0xf800) >> 11);
- cursor->setColor(cursor,fg,bg);
+ bg = ((info->cmap.red[fbcursor->image.bg_color] & 0xf800)) |
+ ((info->cmap.green[fbcursor->image.bg_color] & 0xfc00) >> 5) |
+ ((info->cmap.blue[fbcursor->image.bg_color] & 0xf800) >> 11);
+
+ cursor->setColor(cursor, fg, bg);
}
- if(fbcursor->set & (FB_CUR_SETSHAPE | FB_CUR_SETIMAGE))
- {
+ if (fbcursor->set & (FB_CUR_SETSHAPE | FB_CUR_SETIMAGE)) {
cursor->setData(cursor,
- fbcursor->rop,
- fbcursor->image.data,
- fbcursor->mask);
+ fbcursor->rop,
+ fbcursor->image.data,
+ fbcursor->mask);
}
- if(fbcursor->enable){
+ if (fbcursor->enable)
cursor->enable(cursor);
- }
return 0;
}
-static void lynxfb_ops_fillrect(struct fb_info* info,const struct fb_fillrect* region)
+static void lynxfb_ops_fillrect(struct fb_info *info,
+ const struct fb_fillrect *region)
{
- struct lynxfb_par * par;
- struct lynx_share * share;
- unsigned int base,pitch,Bpp,rop;
+ struct lynxfb_par *par;
+ struct lynx_share *share;
+ unsigned int base, pitch, Bpp, rop;
u32 color;
- if(info->state != FBINFO_STATE_RUNNING){
+ if (info->state != FBINFO_STATE_RUNNING)
return;
- }
par = info->par;
share = par->share;
@@ -206,23 +206,29 @@ static void lynxfb_ops_fillrect(struct fb_info* info,const struct fb_fillrect* r
pitch = info->fix.line_length;
Bpp = info->var.bits_per_pixel >> 3;
- color = (Bpp = 1)?region->color:((u32*)info->pseudo_palette)[region->color];
- rop = ( region->rop != ROP_COPY ) ? HW_ROP2_XOR:HW_ROP2_COPY;
+ color = (Bpp = 1)?region->color:((u32 *)info->pseudo_palette)[region->color];
+ rop = (region->rop != ROP_COPY) ? HW_ROP2_XOR:HW_ROP2_COPY;
myspin_lock(&share->slock);
share->accel.de_fillrect(&share->accel,
- base,pitch,Bpp,
- region->dx,region->dy,
- region->width,region->height,
- color,rop);
+ base,
+ pitch,
+ Bpp,
+ region->dx,
+ region->dy,
+ region->width,
+ region->height,
+ color,
+ rop);
myspin_unlock(&share->slock);
}
-static void lynxfb_ops_copyarea(struct fb_info * info,const struct fb_copyarea * region)
+static void lynxfb_ops_copyarea(struct fb_info *info,
+ const struct fb_copyarea *region)
{
- struct lynxfb_par * par;
- struct lynx_share * share;
- unsigned int base,pitch,Bpp;
+ struct lynxfb_par *par;
+ struct lynx_share *share;
+ unsigned int base, pitch, Bpp;
par = info->par;
share = par->share;
@@ -235,18 +241,28 @@ static void lynxfb_ops_copyarea(struct fb_info * info,const struct fb_copyarea *
myspin_lock(&share->slock);
share->accel.de_copyarea(&share->accel,
- base,pitch,region->sx,region->sy,
- base,pitch,Bpp,region->dx,region->dy,
- region->width,region->height,HW_ROP2_COPY);
+ base,
+ pitch,
+ region->sx,
+ region->sy,
+ base,
+ pitch,
+ Bpp,
+ region->dx,
+ region->dy,
+ region->width,
+ region->height,
+ HW_ROP2_COPY);
myspin_unlock(&share->slock);
}
-static void lynxfb_ops_imageblit(struct fb_info*info,const struct fb_image* image)
+static void lynxfb_ops_imageblit(struct fb_info *info,
+ const struct fb_image *image)
{
- unsigned int base,pitch,Bpp;
- unsigned int fgcol,bgcol;
- struct lynxfb_par * par;
- struct lynx_share * share;
+ unsigned int base, pitch, Bpp;
+ unsigned int fgcol, bgcol;
+ struct lynxfb_par *par;
+ struct lynx_share *share;
par = info->par;
share = par->share;
@@ -256,15 +272,12 @@ static void lynxfb_ops_imageblit(struct fb_info*info,const struct fb_image* imag
pitch = info->fix.line_length;
Bpp = info->var.bits_per_pixel >> 3;
- if(image->depth = 1){
- if(info->fix.visual = FB_VISUAL_TRUECOLOR ||
- info->fix.visual = FB_VISUAL_DIRECTCOLOR)
- {
- fgcol = ((u32*)info->pseudo_palette)[image->fg_color];
- bgcol = ((u32*)info->pseudo_palette)[image->bg_color];
- }
- else
- {
+ if (image->depth = 1) {
+ if (info->fix.visual = FB_VISUAL_TRUECOLOR ||
+ info->fix.visual = FB_VISUAL_DIRECTCOLOR) {
+ fgcol = ((u32 *)info->pseudo_palette)[image->fg_color];
+ bgcol = ((u32 *)info->pseudo_palette)[image->bg_color];
+ } else {
fgcol = image->fg_color;
bgcol = image->bg_color;
}
@@ -274,45 +287,52 @@ static void lynxfb_ops_imageblit(struct fb_info*info,const struct fb_image* imag
_do_work:
myspin_lock(&share->slock);
share->accel.de_imageblit(&share->accel,
- image->data,image->width>>3,0,
- base,pitch,Bpp,
- image->dx,image->dy,
- image->width,image->height,
- fgcol,bgcol,HW_ROP2_COPY);
+ image->data,
+ image->width>>3,
+ 0,
+ base,
+ pitch,
+ Bpp,
+ image->dx,
+ image->dy,
+ image->width,
+ image->height,
+ fgcol,
+ bgcol,
+ HW_ROP2_COPY);
myspin_unlock(&share->slock);
}
static int lynxfb_ops_pan_display(struct fb_var_screeninfo *var,
- struct fb_info *info)
+ struct fb_info *info)
{
- struct lynxfb_par * par;
- struct lynxfb_crtc * crtc;
- int ret;
-
+ struct lynxfb_par *par;
+ struct lynxfb_crtc *crtc;
+ int ret;
- if(!info)
- return -EINVAL;
+ if (!info)
+ return -EINVAL;
- ret = 0;
- par = info->par;
- crtc = &par->crtc;
- ret = crtc->proc_panDisplay(crtc, var, info);
+ ret = 0;
+ par = info->par;
+ crtc = &par->crtc;
+ ret = crtc->proc_panDisplay(crtc, var, info);
- return ret;
+ return ret;
}
-static int lynxfb_ops_set_par(struct fb_info * info)
+static int lynxfb_ops_set_par(struct fb_info *info)
{
- struct lynxfb_par * par;
- struct lynx_share * share;
- struct lynxfb_crtc * crtc;
- struct lynxfb_output * output;
- struct fb_var_screeninfo * var;
- struct fb_fix_screeninfo * fix;
+ struct lynxfb_par *par;
+ struct lynx_share *share;
+ struct lynxfb_crtc *crtc;
+ struct lynxfb_output *output;
+ struct fb_var_screeninfo *var;
+ struct fb_fix_screeninfo *fix;
int ret;
unsigned int line_length;
- if(!info)
+ if (!info)
return -EINVAL;
ret = 0;
@@ -325,15 +345,15 @@ static int lynxfb_ops_set_par(struct fb_info * info)
/* fix structur is not so FIX ... */
line_length = var->xres_virtual * var->bits_per_pixel / 8;
- line_length = PADDING(crtc->line_pad,line_length);
+ line_length = PADDING(crtc->line_pad, line_length);
fix->line_length = line_length;
- pr_err("fix->line_length = %d\n",fix->line_length);
+ pr_err("fix->line_length = %d\n", fix->line_length);
/* var->red,green,blue,transp are need to be set by driver
* and these data should be set before setcolreg routine
* */
- switch(var->bits_per_pixel){
+ switch (var->bits_per_pixel) {
case 8:
fix->visual = FB_VISUAL_PSEUDOCOLOR;
var->red.offset = 0;
@@ -362,7 +382,7 @@ static int lynxfb_ops_set_par(struct fb_info * info)
var->red.length = 8;
var->green.offset = 8;
var->green.length = 8;
- var->blue.offset = 0 ;
+ var->blue.offset = 0;
var->blue.length = 8;
fix->visual = FB_VISUAL_TRUECOLOR;
break;
@@ -373,17 +393,18 @@ static int lynxfb_ops_set_par(struct fb_info * info)
var->height = var->width = -1;
var->accel_flags = 0;/*FB_ACCELF_TEXT;*/
- if(ret){
+ if (ret) {
pr_err("pixel bpp format not satisfied\n.");
return ret;
}
- ret = crtc->proc_setMode(crtc,var,fix);
- if(!ret)
- ret = output->proc_setMode(output,var,fix);
+ ret = crtc->proc_setMode(crtc, var, fix);
+ if (!ret)
+ ret = output->proc_setMode(output, var, fix);
return ret;
}
-static inline unsigned int chan_to_field(unsigned int chan,struct fb_bitfield * bf)
+static inline unsigned int chan_to_field(unsigned int chan,
+ struct fb_bitfield *bf)
{
chan &= 0xffff;
chan >>= 16 - bf->length;
@@ -443,63 +464,65 @@ static int lynxfb_suspend(struct pci_dev *pdev, pm_message_t mesg)
return ret;
}
-static int lynxfb_resume(struct pci_dev* pdev)
+static int lynxfb_resume(struct pci_dev *pdev)
{
- struct fb_info * info;
- struct lynx_share * share;
+ struct fb_info *info;
+ struct lynx_share *share;
- struct lynxfb_par * par;
- struct lynxfb_crtc * crtc;
- struct lynx_cursor * cursor;
+ struct lynxfb_par *par;
+ struct lynxfb_crtc *crtc;
+ struct lynx_cursor *cursor;
int ret;
-
+
ret = 0;
share = pci_get_drvdata(pdev);
console_lock();
- if((ret = pci_set_power_state(pdev, PCI_D0)) != 0){
- pr_err("error:%d occured in pci_set_power_state\n",ret);
+ ret = pci_set_power_state(pdev, PCI_D0);
+ if (ret) {
+ pr_err("error:%d occured in pci_set_power_state\n", ret);
return ret;
}
- if(pdev->dev.power.power_state.event != PM_EVENT_FREEZE){
+ if (pdev->dev.power.power_state.event != PM_EVENT_FREEZE) {
pci_restore_state(pdev);
- if ((ret = pci_enable_device(pdev)) != 0){
- pr_err("error:%d occured in pci_enable_device\n",ret);
+ ret = pci_enable_device(pdev);
+ if (ret) {
+ pr_err("error:%d occured in pci_enable_device\n", ret);
return ret;
}
pci_set_master(pdev);
}
- if(share->resume)
+ if (share->resume)
(*share->resume)(share);
- hw_sm750_inithw(share,pdev);
+ hw_sm750_inithw(share, pdev);
info = share->fbinfo[0];
- if(info){
+ if (info) {
par = info->par;
crtc = &par->crtc;
cursor = &crtc->cursor;
memset(cursor->vstart, 0x0, cursor->size);
- memset(crtc->vScreen,0x0,crtc->vidmem_size);
+ memset(crtc->vScreen, 0x0, crtc->vidmem_size);
lynxfb_ops_set_par(info);
fb_set_suspend(info, 0);
}
info = share->fbinfo[1];
- if(info){
+ if (info) {
par = info->par;
crtc = &par->crtc;
cursor = &crtc->cursor;
memset(cursor->vstart, 0x0, cursor->size);
- memset(crtc->vScreen,0x0,crtc->vidmem_size);
+ memset(crtc->vScreen, 0x0, crtc->vidmem_size);
lynxfb_ops_set_par(info);
fb_set_suspend(info, 0);
}
@@ -510,16 +533,16 @@ static int lynxfb_resume(struct pci_dev* pdev)
}
#endif
-static int lynxfb_ops_check_var(struct fb_var_screeninfo* var,struct fb_info* info)
+static int lynxfb_ops_check_var(struct fb_var_screeninfo *var,
+ struct fb_info *info)
{
- struct lynxfb_par * par;
- struct lynxfb_crtc * crtc;
- struct lynxfb_output * output;
- struct lynx_share * share;
+ struct lynxfb_par *par;
+ struct lynxfb_crtc *crtc;
+ struct lynxfb_output *output;
+ struct lynx_share *share;
int ret;
resource_size_t request;
-
par = info->par;
crtc = &par->crtc;
output = &par->output;
@@ -532,19 +555,19 @@ static int lynxfb_ops_check_var(struct fb_var_screeninfo* var,struct fb_info* in
var->bits_per_pixel);
- switch(var->bits_per_pixel){
+ switch (var->bits_per_pixel) {
case 8:
case 16:
case 24: /* support 24 bpp for only lynx712/722/720 */
case 32:
break;
default:
- pr_err("bpp %d not supported\n",var->bits_per_pixel);
+ pr_err("bpp %d not supported\n", var->bits_per_pixel);
ret = -EINVAL;
goto exit;
}
- switch(var->bits_per_pixel){
+ switch (var->bits_per_pixel) {
case 8:
info->fix.visual = FB_VISUAL_PSEUDOCOLOR;
var->red.offset = 0;
@@ -573,7 +596,7 @@ static int lynxfb_ops_check_var(struct fb_var_screeninfo* var,struct fb_info* in
var->red.length = 8;
var->green.offset = 8;
var->green.length = 8;
- var->blue.offset = 0 ;
+ var->blue.offset = 0;
var->blue.length = 8;
info->fix.visual = FB_VISUAL_TRUECOLOR;
break;
@@ -584,178 +607,183 @@ static int lynxfb_ops_check_var(struct fb_var_screeninfo* var,struct fb_info* in
var->height = var->width = -1;
var->accel_flags = 0;/*FB_ACCELF_TEXT;*/
- /* check if current fb's video memory big enought to hold the onscreen */
+ /*
+ * check if current fb's video memory big enought to hold the onscreen
+ */
request = var->xres_virtual * (var->bits_per_pixel >> 3);
/* defaulty crtc->channel go with par->index */
- request = PADDING(crtc->line_pad,request);
+ request = PADDING(crtc->line_pad, request);
request = request * var->yres_virtual;
- if(crtc->vidmem_size < request){
+ if (crtc->vidmem_size < request) {
pr_err("not enough video memory for mode\n");
return -ENOMEM;
}
- ret = output->proc_checkMode(output,var);
- if(!ret)
- ret = crtc->proc_checkMode(crtc,var);
+ ret = output->proc_checkMode(output, var);
+ if (!ret)
+ ret = crtc->proc_checkMode(crtc, var);
exit:
return ret;
}
-static int lynxfb_ops_setcolreg(unsigned regno,unsigned red,
- unsigned green,unsigned blue,
- unsigned transp,struct fb_info * info)
+static int lynxfb_ops_setcolreg(unsigned regno,
+ unsigned red,
+ unsigned green,
+ unsigned blue,
+ unsigned transp,
+ struct fb_info *info)
{
- struct lynxfb_par * par;
- struct lynxfb_crtc * crtc;
- struct fb_var_screeninfo * var;
- int ret;
-
- par = info->par;
- crtc = &par->crtc;
- var = &info->var;
- ret = 0;
-
- //pr_debug("regno=%d,red=%d,green=%d,blue=%d\n",regno,red,green,blue);
- if(regno > 256){
- pr_err("regno = %d\n",regno);
- return -EINVAL;
- }
-
- if(info->var.grayscale)
- red = green = blue = (red * 77 + green * 151 + blue * 28) >> 8;
-
- if(var->bits_per_pixel = 8 && info->fix.visual = FB_VISUAL_PSEUDOCOLOR)
- {
- red >>= 8;
- green >>= 8;
- blue >>= 8;
- ret = crtc->proc_setColReg(crtc,regno,red,green,blue);
- goto exit;
- }
-
-
- if(info->fix.visual = FB_VISUAL_TRUECOLOR && regno < 256 )
- {
- u32 val;
- if(var->bits_per_pixel = 16 ||
- var->bits_per_pixel = 32 ||
- var->bits_per_pixel = 24)
- {
- val = chan_to_field(red,&var->red);
- val |= chan_to_field(green,&var->green);
- val |= chan_to_field(blue,&var->blue);
- par->pseudo_palette[regno] = val;
- goto exit;
- }
- }
-
- ret = -EINVAL;
+ struct lynxfb_par *par;
+ struct lynxfb_crtc *crtc;
+ struct fb_var_screeninfo *var;
+ int ret;
+
+ par = info->par;
+ crtc = &par->crtc;
+ var = &info->var;
+ ret = 0;
+
+ /*
+ * pr_debug("regno=%d,red=%d,green=%d,blue=%d\n",regno,red,green,blue);
+ */
+ if (regno > 256) {
+ pr_err("regno = %d\n", regno);
+ return -EINVAL;
+ }
+
+ if (info->var.grayscale)
+ red = green = blue = (red * 77 + green * 151 + blue * 28) >> 8;
+
+ if (var->bits_per_pixel = 8 &&
+ info->fix.visual = FB_VISUAL_PSEUDOCOLOR) {
+ red >>= 8;
+ green >>= 8;
+ blue >>= 8;
+ ret = crtc->proc_setColReg(crtc, regno, red, green, blue);
+ goto exit;
+ }
+
+
+ if (info->fix.visual = FB_VISUAL_TRUECOLOR && regno < 256) {
+ u32 val;
+
+ if (var->bits_per_pixel = 16 ||
+ var->bits_per_pixel = 32 ||
+ var->bits_per_pixel = 24) {
+ val = chan_to_field(red, &var->red);
+ val |= chan_to_field(green, &var->green);
+ val |= chan_to_field(blue, &var->blue);
+ par->pseudo_palette[regno] = val;
+ goto exit;
+ }
+ }
+
+ ret = -EINVAL;
exit:
- return ret;
+ return ret;
}
-static int lynxfb_ops_blank(int blank,struct fb_info* info)
+static int lynxfb_ops_blank(int blank, struct fb_info *info)
{
- struct lynxfb_par * par;
- struct lynxfb_output * output;
-
- pr_debug("blank = %d.\n",blank);
+ struct lynxfb_par *par;
+ struct lynxfb_output *output;
+
+ pr_debug("blank = %d.\n", blank);
par = info->par;
output = &par->output;
- return output->proc_setBLANK(output,blank);
+ return output->proc_setBLANK(output, blank);
}
-static int sm750fb_set_drv(struct lynxfb_par * par)
+static int sm750fb_set_drv(struct lynxfb_par *par)
{
- int ret;
- struct lynx_share * share;
- struct sm750_share * spec_share;
- struct lynxfb_output * output;
- struct lynxfb_crtc * crtc;
-
- ret = 0;
-
- share = par->share;
- spec_share = container_of(share,struct sm750_share,share);
- output = &par->output;
- crtc = &par->crtc;
-
- crtc->vidmem_size = (share->dual)?share->vidmem_size>>1:share->vidmem_size;
- /* setup crtc and output member */
- spec_share->hwCursor = g_hwcursor;
-
- crtc->proc_setMode = hw_sm750_crtc_setMode;
- crtc->proc_checkMode = hw_sm750_crtc_checkMode;
- crtc->proc_setColReg = hw_sm750_setColReg;
- crtc->proc_panDisplay = hw_sm750_pan_display;
- crtc->clear = hw_sm750_crtc_clear;
- crtc->line_pad = 16;
- //crtc->xpanstep = crtc->ypanstep = crtc->ywrapstep = 0;
- crtc->xpanstep = 8;
- crtc->ypanstep = 1;
- crtc->ywrapstep = 0;
-
- output->proc_setMode = hw_sm750_output_setMode;
- output->proc_checkMode = hw_sm750_output_checkMode;
-
- output->proc_setBLANK = (share->revid = SM750LE_REVISION_ID)?hw_sm750le_setBLANK:hw_sm750_setBLANK;
- output->clear = hw_sm750_output_clear;
- /* chip specific phase */
- share->accel.de_wait = (share->revid = SM750LE_REVISION_ID)?hw_sm750le_deWait: hw_sm750_deWait;
- switch (spec_share->state.dataflow)
- {
- case sm750_simul_pri:
- output->paths = sm750_pnc;
- crtc->channel = sm750_primary;
- crtc->oScreen = 0;
- crtc->vScreen = share->pvMem;
- pr_info("use simul primary mode\n");
- break;
- case sm750_simul_sec:
- output->paths = sm750_pnc;
- crtc->channel = sm750_secondary;
- crtc->oScreen = 0;
- crtc->vScreen = share->pvMem;
- break;
- case sm750_dual_normal:
- if(par->index = 0){
- output->paths = sm750_panel;
- crtc->channel = sm750_primary;
- crtc->oScreen = 0;
- crtc->vScreen = share->pvMem;
- }else{
- output->paths = sm750_crt;
- crtc->channel = sm750_secondary;
- /* not consider of padding stuffs for oScreen,need fix*/
- crtc->oScreen = (share->vidmem_size >> 1);
- crtc->vScreen = share->pvMem + crtc->oScreen;
- }
- break;
- case sm750_dual_swap:
- if(par->index = 0){
- output->paths = sm750_panel;
- crtc->channel = sm750_secondary;
- crtc->oScreen = 0;
- crtc->vScreen = share->pvMem;
- }else{
- output->paths = sm750_crt;
- crtc->channel = sm750_primary;
- /* not consider of padding stuffs for oScreen,need fix*/
- crtc->oScreen = (share->vidmem_size >> 1);
- crtc->vScreen = share->pvMem + crtc->oScreen;
- }
- break;
- default:
- ret = -EINVAL;
- }
-
- return ret;
+ int ret;
+ struct lynx_share *share;
+ struct sm750_share *spec_share;
+ struct lynxfb_output *output;
+ struct lynxfb_crtc *crtc;
+
+ ret = 0;
+
+ share = par->share;
+ spec_share = container_of(share, struct sm750_share, share);
+ output = &par->output;
+ crtc = &par->crtc;
+
+ crtc->vidmem_size = (share->dual)?share->vidmem_size>>1:share->vidmem_size;
+ /* setup crtc and output member */
+ spec_share->hwCursor = g_hwcursor;
+
+ crtc->proc_setMode = hw_sm750_crtc_setMode;
+ crtc->proc_checkMode = hw_sm750_crtc_checkMode;
+ crtc->proc_setColReg = hw_sm750_setColReg;
+ crtc->proc_panDisplay = hw_sm750_pan_display;
+ crtc->clear = hw_sm750_crtc_clear;
+ crtc->line_pad = 16;
+ /*crtc->xpanstep = crtc->ypanstep = crtc->ywrapstep = 0;*/
+ crtc->xpanstep = 8;
+ crtc->ypanstep = 1;
+ crtc->ywrapstep = 0;
+
+ output->proc_setMode = hw_sm750_output_setMode;
+ output->proc_checkMode = hw_sm750_output_checkMode;
+
+ output->proc_setBLANK = (share->revid = SM750LE_REVISION_ID)?hw_sm750le_setBLANK : hw_sm750_setBLANK;
+ output->clear = hw_sm750_output_clear;
+ /* chip specific phase */
+ share->accel.de_wait = (share->revid = SM750LE_REVISION_ID)?hw_sm750le_deWait : hw_sm750_deWait;
+ switch (spec_share->state.dataflow) {
+ case sm750_simul_pri:
+ output->paths = sm750_pnc;
+ crtc->channel = sm750_primary;
+ crtc->oScreen = 0;
+ crtc->vScreen = share->pvMem;
+ pr_info("use simul primary mode\n");
+ break;
+ case sm750_simul_sec:
+ output->paths = sm750_pnc;
+ crtc->channel = sm750_secondary;
+ crtc->oScreen = 0;
+ crtc->vScreen = share->pvMem;
+ break;
+ case sm750_dual_normal:
+ if (par->index = 0) {
+ output->paths = sm750_panel;
+ crtc->channel = sm750_primary;
+ crtc->oScreen = 0;
+ crtc->vScreen = share->pvMem;
+ } else {
+ output->paths = sm750_crt;
+ crtc->channel = sm750_secondary;
+ /* not consider of padding stuffs for oScreen,need fix*/
+ crtc->oScreen = (share->vidmem_size >> 1);
+ crtc->vScreen = share->pvMem + crtc->oScreen;
+ }
+ break;
+ case sm750_dual_swap:
+ if (par->index = 0) {
+ output->paths = sm750_panel;
+ crtc->channel = sm750_secondary;
+ crtc->oScreen = 0;
+ crtc->vScreen = share->pvMem;
+ } else {
+ output->paths = sm750_crt;
+ crtc->channel = sm750_primary;
+ /* not consider of padding stuffs for oScreen,need fix*/
+ crtc->oScreen = (share->vidmem_size >> 1);
+ crtc->vScreen = share->pvMem + crtc->oScreen;
+ }
+ break;
+ default:
+ ret = -EINVAL;
+ }
+
+ return ret;
}
-static struct fb_ops lynxfb_ops={
+static struct fb_ops lynxfb_ops = {
.owner = THIS_MODULE,
.fb_check_var = lynxfb_ops_check_var,
.fb_set_par = lynxfb_ops_set_par,
@@ -769,338 +797,353 @@ static struct fb_ops lynxfb_ops={
};
-static int lynxfb_set_fbinfo(struct fb_info* info,int index)
+static int lynxfb_set_fbinfo(struct fb_info *info, int index)
{
- int i;
- struct lynxfb_par * par;
- struct lynx_share * share;
- struct lynxfb_crtc * crtc;
- struct lynxfb_output * output;
- struct fb_var_screeninfo * var;
- struct fb_fix_screeninfo * fix;
-
- const struct fb_videomode * pdb[] = {
- lynx750_ext, NULL,vesa_modes,
- };
- int cdb[] = {ARRAY_SIZE(lynx750_ext),0,VESA_MODEDB_SIZE};
- static const char * mdb_desc[] ={
- "driver prepared modes",
- "kernel prepared default modedb",
- "kernel HELPERS prepared vesa_modes",
- };
-
-
- static const char * fixId[2]- {
- "sm750_fb1","sm750_fb2",
- };
-
- int ret,line_length;
-
- ret = 0;
- par = (struct lynxfb_par *)info->par;
- share = par->share;
- crtc = &par->crtc;
- output = &par->output;
- var = &info->var;
- fix = &info->fix;
-
- /* set index */
- par->index = index;
- output->channel = &crtc->channel;
- sm750fb_set_drv(par);
- lynxfb_ops.fb_pan_display = lynxfb_ops_pan_display;
+ int i;
+ struct lynxfb_par *par;
+ struct lynx_share *share;
+ struct lynxfb_crtc *crtc;
+ struct lynxfb_output *output;
+ struct fb_var_screeninfo *var;
+ struct fb_fix_screeninfo *fix;
+ const struct fb_videomode *pdb[] = {
+ lynx750_ext, NULL, vesa_modes,
+ };
+ int cdb[] = {ARRAY_SIZE(lynx750_ext), 0, VESA_MODEDB_SIZE};
+ static const char *mdb_desc[] = {
+ "driver prepared modes",
+ "kernel prepared default modedb",
+ "kernel HELPERS prepared vesa_modes",
+ };
- /* set current cursor variable and proc pointer,
- * must be set after crtc member initialized */
- crtc->cursor.offset = crtc->oScreen + crtc->vidmem_size - 1024;
- crtc->cursor.mmio = share->pvReg + 0x800f0 + (int)crtc->channel * 0x140;
- pr_info("crtc->cursor.mmio = %p\n",crtc->cursor.mmio);
- crtc->cursor.maxH = crtc->cursor.maxW = 64;
- crtc->cursor.size = crtc->cursor.maxH*crtc->cursor.maxW*2/8;
- crtc->cursor.disable = hw_cursor_disable;
- crtc->cursor.enable = hw_cursor_enable;
- crtc->cursor.setColor = hw_cursor_setColor;
- crtc->cursor.setPos = hw_cursor_setPos;
- crtc->cursor.setSize = hw_cursor_setSize;
- crtc->cursor.setData = hw_cursor_setData;
- crtc->cursor.vstart = share->pvMem + crtc->cursor.offset;
+ static const char *fixId[2] = {
+ "sm750_fb1", "sm750_fb2",
+ };
+ int ret, line_length;
- crtc->cursor.share = share;
- memset(crtc->cursor.vstart, 0, crtc->cursor.size);
- if(!g_hwcursor){
- lynxfb_ops.fb_cursor = NULL;
- crtc->cursor.disable(&crtc->cursor);
- }
+ ret = 0;
+ par = (struct lynxfb_par *)info->par;
+ share = par->share;
+ crtc = &par->crtc;
+ output = &par->output;
+ var = &info->var;
+ fix = &info->fix;
+ /* set index */
+ par->index = index;
+ output->channel = &crtc->channel;
+ sm750fb_set_drv(par);
+ lynxfb_ops.fb_pan_display = lynxfb_ops_pan_display;
+
+
+ /* set current cursor variable and proc pointer,
+ * must be set after crtc member initialized */
+ crtc->cursor.offset = crtc->oScreen + crtc->vidmem_size - 1024;
+ crtc->cursor.mmio = share->pvReg + 0x800f0 + (int)crtc->channel * 0x140;
+
+ pr_info("crtc->cursor.mmio = %p\n", crtc->cursor.mmio);
+ crtc->cursor.maxH = crtc->cursor.maxW = 64;
+ crtc->cursor.size = crtc->cursor.maxH*crtc->cursor.maxW*2/8;
+ crtc->cursor.disable = hw_cursor_disable;
+ crtc->cursor.enable = hw_cursor_enable;
+ crtc->cursor.setColor = hw_cursor_setColor;
+ crtc->cursor.setPos = hw_cursor_setPos;
+ crtc->cursor.setSize = hw_cursor_setSize;
+ crtc->cursor.setData = hw_cursor_setData;
+ crtc->cursor.vstart = share->pvMem + crtc->cursor.offset;
+
+
+ crtc->cursor.share = share;
+ memset(crtc->cursor.vstart, 0, crtc->cursor.size);
+ if (!g_hwcursor) {
+ lynxfb_ops.fb_cursor = NULL;
+ crtc->cursor.disable(&crtc->cursor);
+ }
- /* set info->fbops, must be set before fb_find_mode */
- if(!share->accel_off){
- /* use 2d acceleration */
- lynxfb_ops.fb_fillrect = lynxfb_ops_fillrect;
- lynxfb_ops.fb_copyarea = lynxfb_ops_copyarea;
- lynxfb_ops.fb_imageblit = lynxfb_ops_imageblit;
- }
- info->fbops = &lynxfb_ops;
- if(!g_fbmode[index]){
- g_fbmode[index] = g_def_fbmode;
- if(index)
- g_fbmode[index] = g_fbmode[0];
- }
+ /* set info->fbops, must be set before fb_find_mode */
+ if (!share->accel_off) {
+ /* use 2d acceleration */
+ lynxfb_ops.fb_fillrect = lynxfb_ops_fillrect;
+ lynxfb_ops.fb_copyarea = lynxfb_ops_copyarea;
+ lynxfb_ops.fb_imageblit = lynxfb_ops_imageblit;
+ }
+ info->fbops = &lynxfb_ops;
+ if (!g_fbmode[index]) {
+ g_fbmode[index] = g_def_fbmode;
+ if (index)
+ g_fbmode[index] = g_fbmode[0];
+ }
- for(i=0;i<3;i++){
- ret = fb_find_mode(var,info,g_fbmode[index],
- pdb[i],cdb[i],NULL,8);
+ for (i = 0; i < 3; i++) {
- if(ret = 1){
+ ret = fb_find_mode(
+ var,
+ info,
+ g_fbmode[index],
+ pdb[i],
+ cdb[i],
+ NULL,
+ 8);
+
+ if (ret = 1) {
pr_info("success! use specified mode:%s in %s\n",
g_fbmode[index],
mdb_desc[i]);
break;
- }else if(ret = 2){
+ } else if (ret = 2) {
pr_warn("use specified mode:%s in %s,with an ignored refresh rate\n",
g_fbmode[index],
mdb_desc[i]);
break;
- }else if(ret = 3){
+ } else if (ret = 3) {
pr_warn("wanna use default mode\n");
-// break;
- }else if(ret = 4){
+/* break;*/
+ } else if (ret = 4) {
pr_warn("fall back to any valid mode\n");
- }else{
- pr_warn("ret = %d,fb_find_mode failed,with %s\n",ret,mdb_desc[i]);
+ } else {
+ pr_warn("ret = %d,fb_find_mode failed,with %s\n",
+ ret,
+ mdb_desc[i]);
}
}
- /* some member of info->var had been set by fb_find_mode */
-
- pr_info("Member of info->var is :\n\
- xres=%d\n\
- yres=%d\n\
- xres_virtual=%d\n\
- yres_virtual=%d\n\
- xoffset=%d\n\
- yoffset=%d\n\
- bits_per_pixel=%d\n \
- ...\n",var->xres,var->yres,var->xres_virtual,var->yres_virtual,
- var->xoffset,var->yoffset,var->bits_per_pixel);
-
- /* set par */
- par->info = info;
-
- /* set info */
- line_length = PADDING(crtc->line_pad,
- (var->xres_virtual * var->bits_per_pixel/8));
-
- info->pseudo_palette = &par->pseudo_palette[0];
- info->screen_base = crtc->vScreen;
- pr_debug("screen_base vaddr = %p\n",info->screen_base);
+ /* some member of info->var had been set by fb_find_mode */
+
+ pr_info("Member of info->var is :\n\
+ xres=%d\n\
+ yres=%d\n\
+ xres_virtual=%d\n\
+ yres_virtual=%d\n\
+ xoffset=%d\n\
+ yoffset=%d\n\
+ bits_per_pixel=%d\n \
+ ...\n",
+ var->xres,
+ var->yres,
+ var->xres_virtual,
+ var->yres_virtual,
+ var->xoffset,
+ var->yoffset,
+ var->bits_per_pixel);
+
+ /* set par */
+ par->info = info;
+
+ /* set info */
+ line_length = PADDING(crtc->line_pad,
+ (var->xres_virtual * var->bits_per_pixel / 8));
+
+ info->pseudo_palette = &par->pseudo_palette[0];
+ info->screen_base = crtc->vScreen;
+ pr_debug("screen_base vaddr = %p\n", info->screen_base);
info->screen_size = line_length * var->yres_virtual;
info->flags = FBINFO_FLAG_DEFAULT|0;
- /* set info->fix */
- fix->type = FB_TYPE_PACKED_PIXELS;
- fix->type_aux = 0;
- fix->xpanstep = crtc->xpanstep;
- fix->ypanstep = crtc->ypanstep;
- fix->ywrapstep = crtc->ywrapstep;
- fix->accel = FB_ACCEL_SMI;
+ /* set info->fix */
+ fix->type = FB_TYPE_PACKED_PIXELS;
+ fix->type_aux = 0;
+ fix->xpanstep = crtc->xpanstep;
+ fix->ypanstep = crtc->ypanstep;
+ fix->ywrapstep = crtc->ywrapstep;
+ fix->accel = FB_ACCEL_SMI;
- strlcpy(fix->id,fixId[index],sizeof(fix->id));
+ strlcpy(fix->id, fixId[index], sizeof(fix->id));
fix->smem_start = crtc->oScreen + share->vidmem_start;
- pr_info("fix->smem_start = %lx\n",fix->smem_start);
- /* according to mmap experiment from user space application,
- * fix->mmio_len should not larger than virtual size
- * (xres_virtual x yres_virtual x ByPP)
- * Below line maybe buggy when user mmap fb dev node and write
- * data into the bound over virtual size
- * */
- fix->smem_len = crtc->vidmem_size;
- pr_info("fix->smem_len = %x\n",fix->smem_len);
- info->screen_size = fix->smem_len;
- fix->line_length = line_length;
- fix->mmio_start = share->vidreg_start;
- pr_info("fix->mmio_start = %lx\n",fix->mmio_start);
- fix->mmio_len = share->vidreg_size;
- pr_info("fix->mmio_len = %x\n",fix->mmio_len);
- switch(var->bits_per_pixel)
- {
- case 8:
- fix->visual = FB_VISUAL_PSEUDOCOLOR;
- break;
- case 16:
- case 32:
- fix->visual = FB_VISUAL_TRUECOLOR;
- break;
- }
-
- /* set var */
- var->activate = FB_ACTIVATE_NOW;
- var->accel_flags = 0;
- var->vmode = FB_VMODE_NONINTERLACED;
-
- pr_debug("#1 show info->cmap : \nstart=%d,len=%d,red=%p,green=%p,blue=%p,transp=%p\n",
- info->cmap.start,info->cmap.len,
- info->cmap.red,info->cmap.green,info->cmap.blue,
- info->cmap.transp);
-
- if((ret = fb_alloc_cmap(&info->cmap,256,0)) < 0){
- pr_err("Could not allcate memory for cmap.\n");
- goto exit;
- }
-
- pr_debug("#2 show info->cmap : \nstart=%d,len=%d,red=%p,green=%p,blue=%p,transp=%p\n",
- info->cmap.start,info->cmap.len,
- info->cmap.red,info->cmap.green,info->cmap.blue,
- info->cmap.transp);
+ pr_info("fix->smem_start = %lx\n", fix->smem_start);
+ /* according to mmap experiment from user space application,
+ * fix->mmio_len should not larger than virtual size
+ * (xres_virtual x yres_virtual x ByPP)
+ * Below line maybe buggy when user mmap fb dev node and write
+ * data into the bound over virtual size
+ * */
+ fix->smem_len = crtc->vidmem_size;
+ pr_info("fix->smem_len = %x\n", fix->smem_len);
+ info->screen_size = fix->smem_len;
+ fix->line_length = line_length;
+ fix->mmio_start = share->vidreg_start;
+ pr_info("fix->mmio_start = %lx\n", fix->mmio_start);
+ fix->mmio_len = share->vidreg_size;
+ pr_info("fix->mmio_len = %x\n", fix->mmio_len);
+ switch (var->bits_per_pixel) {
+ case 8:
+ fix->visual = FB_VISUAL_PSEUDOCOLOR;
+ break;
+ case 16:
+ case 32:
+ fix->visual = FB_VISUAL_TRUECOLOR;
+ break;
+ }
+
+ /* set var */
+ var->activate = FB_ACTIVATE_NOW;
+ var->accel_flags = 0;
+ var->vmode = FB_VMODE_NONINTERLACED;
+
+ pr_debug("#1 show info->cmap :\nstart=%d,len=%d,red=%p,green=%p,blue=%p,transp=%p\n",
+ info->cmap.start,
+ info->cmap.len,
+ info->cmap.red,
+ info->cmap.green,
+ info->cmap.blue,
+ info->cmap.transp);
+ ret = fb_alloc_cmap(&info->cmap, 256, 0);
+ if (ret < 0) {
+ pr_err("Could not allcate memory for cmap.\n");
+ goto exit;
+ }
+
+ pr_debug("#2 show info->cmap :\nstart=%d,len=%d,red=%p,green=%p,blue=%p,transp=%p\n",
+ info->cmap.start,
+ info->cmap.len,
+ info->cmap.red,
+ info->cmap.green,
+ info->cmap.blue,
+ info->cmap.transp);
exit:
- lynxfb_ops_check_var(var,info);
-// lynxfb_ops_set_par(info);
- return ret;
+ lynxfb_ops_check_var(var, info);
+/* lynxfb_ops_set_par(info);*/
+ return ret;
}
-/* chip specific g_option configuration routine */
-static void sm750fb_setup(struct lynx_share * share,char * src)
+/* chip specific g_option configuration routine */
+static void sm750fb_setup(struct lynx_share *share, char *src)
{
- struct sm750_share * spec_share;
- char * opt;
+ struct sm750_share *spec_share;
+ char *opt;
#ifdef CAP_EXPENSION
- char * exp_res;
+ char *exp_res;
#endif
int swap;
-
- spec_share = container_of(share,struct sm750_share,share);
+
+ spec_share = container_of(share, struct sm750_share, share);
#ifdef CAP_EXPENSIION
- exp_res = NULL;
+ exp_res = NULL;
#endif
- swap = 0;
-
- spec_share->state.initParm.chip_clk = 0;
- spec_share->state.initParm.mem_clk = 0;
- spec_share->state.initParm.master_clk = 0;
- spec_share->state.initParm.powerMode = 0;
- spec_share->state.initParm.setAllEngOff = 0;
- spec_share->state.initParm.resetMemory = 1;
-
- /*defaultly turn g_hwcursor on for both view */
- g_hwcursor = 3;
-
- if(!src || !*src){
- pr_warn("no specific g_option.\n");
- goto NO_PARAM;
- }
-
- while((opt = strsep(&src,":")) != NULL && *opt != 0){
- pr_err("opt=%s\n",opt);
- pr_err("src=%s\n",src);
-
- if(!strncmp(opt,"swap",strlen("swap")))
- swap = 1;
- else if(!strncmp(opt,"nocrt",strlen("nocrt")))
- spec_share->state.nocrt = 1;
- else if(!strncmp(opt,"36bit",strlen("36bit")))
- spec_share->state.pnltype = sm750_doubleTFT;
- else if(!strncmp(opt,"18bit",strlen("18bit")))
- spec_share->state.pnltype = sm750_dualTFT;
- else if(!strncmp(opt,"24bit",strlen("24bit")))
- spec_share->state.pnltype = sm750_24TFT;
+ swap = 0;
+
+ spec_share->state.initParm.chip_clk = 0;
+ spec_share->state.initParm.mem_clk = 0;
+ spec_share->state.initParm.master_clk = 0;
+ spec_share->state.initParm.powerMode = 0;
+ spec_share->state.initParm.setAllEngOff = 0;
+ spec_share->state.initParm.resetMemory = 1;
+
+ /*defaultly turn g_hwcursor on for both view */
+ g_hwcursor = 3;
+
+ if (!src || !*src) {
+ pr_warn("no specific g_option.\n");
+ goto NO_PARAM;
+ }
+
+ while ((opt = strsep(&src, ":")) != NULL && *opt != 0) {
+ pr_err("opt=%s\n", opt);
+ pr_err("src=%s\n", src);
+
+ if (!strncmp(opt, "swap", strlen("swap")))
+ swap = 1;
+ else if (!strncmp(opt, "nocrt", strlen("nocrt")))
+ spec_share->state.nocrt = 1;
+ else if (!strncmp(opt, "36bit", strlen("36bit")))
+ spec_share->state.pnltype = sm750_doubleTFT;
+ else if (!strncmp(opt, "18bit", strlen("18bit")))
+ spec_share->state.pnltype = sm750_dualTFT;
+ else if (!strncmp(opt, "24bit", strlen("24bit")))
+ spec_share->state.pnltype = sm750_24TFT;
#ifdef CAP_EXPANSION
- else if(!strncmp(opt,"exp:",strlen("exp:")))
- exp_res = opt + strlen("exp:");
+ else if (!strncmp(opt, "exp:", strlen("exp:")))
+ exp_res = opt + strlen("exp:");
#endif
- else if(!strncmp(opt,"nohwc0",strlen("nohwc0")))
- g_hwcursor &= ~0x1;
- else if(!strncmp(opt,"nohwc1",strlen("nohwc1")))
- g_hwcursor &= ~0x2;
- else if(!strncmp(opt,"nohwc",strlen("nohwc")))
- g_hwcursor = 0;
- else
- {
- if(!g_fbmode[0]){
- g_fbmode[0] = opt;
- pr_info("find fbmode0 : %s\n",g_fbmode[0]);
- }else if(!g_fbmode[1]){
- g_fbmode[1] = opt;
- pr_info("find fbmode1 : %s\n",g_fbmode[1]);
- }else{
- pr_warn("How many view you wann set?\n");
- }
- }
- }
+ else if (!strncmp(opt, "nohwc0", strlen("nohwc0")))
+ g_hwcursor &= ~0x1;
+ else if (!strncmp(opt, "nohwc1", strlen("nohwc1")))
+ g_hwcursor &= ~0x2;
+ else if (!strncmp(opt, "nohwc", strlen("nohwc")))
+ g_hwcursor = 0;
+ else {
+ if (!g_fbmode[0]) {
+ g_fbmode[0] = opt;
+ pr_info("find fbmode0 : %s\n", g_fbmode[0]);
+ } else if (!g_fbmode[1]) {
+ g_fbmode[1] = opt;
+ pr_info("find fbmode1 : %s\n", g_fbmode[1]);
+ } else {
+ pr_warn("How many view you wann set?\n");
+ }
+ }
+ }
#ifdef CAP_EXPANSION
- if(getExpRes(exp_res,&spec_share->state.xLCD,&spec_share->state.yLCD))
- {
- /* seems exp_res is not valid*/
- spec_share->state.xLCD = spec_share->state.yLCD = 0;
- }
+ if (getExpRes(exp_res, &spec_share->state.xLCD, &spec_share->state.yLCD)) {
+ /* seems exp_res is not valid*/
+ spec_share->state.xLCD = spec_share->state.yLCD = 0;
+ }
#endif
NO_PARAM:
- if(share->revid != SM750LE_REVISION_ID){
- if(share->dual)
- {
- if(swap)
- spec_share->state.dataflow = sm750_dual_swap;
- else
- spec_share->state.dataflow = sm750_dual_normal;
- }else{
- if(swap)
- spec_share->state.dataflow = sm750_simul_sec;
- else
- spec_share->state.dataflow = sm750_simul_pri;
- }
- }else{
- /* SM750LE only have one crt channel */
- spec_share->state.dataflow = sm750_simul_sec;
- /* sm750le do not have complex attributes*/
- spec_share->state.nocrt = 0;
- }
+ if (share->revid != SM750LE_REVISION_ID) {
+ if (share->dual) {
+ if (swap)
+ spec_share->state.dataflow = sm750_dual_swap;
+ else
+ spec_share->state.dataflow = sm750_dual_normal;
+ } else {
+ if (swap)
+ spec_share->state.dataflow = sm750_simul_sec;
+ else
+ spec_share->state.dataflow = sm750_simul_pri;
+ }
+ } else {
+ /* SM750LE only have one crt channel */
+ spec_share->state.dataflow = sm750_simul_sec;
+ /* sm750le do not have complex attributes*/
+ spec_share->state.nocrt = 0;
+ }
}
-static int lynxfb_pci_probe(struct pci_dev * pdev,
- const struct pci_device_id * ent)
+static int lynxfb_pci_probe(struct pci_dev *pdev,
+ const struct pci_device_id *ent)
{
- struct fb_info * info[] = {NULL,NULL};
- struct lynx_share * share = NULL;
+ struct fb_info *info[] = {NULL, NULL};
+ struct lynx_share *share = NULL;
struct sm750_share *spec_share = NULL;
size_t spec_offset = 0;
int fbidx;
-
+
/* enable device */
- if(pci_enable_device(pdev)){
+ if (pci_enable_device(pdev)) {
pr_err("can not enable device.\n");
goto err_enable;
}
/* though offset of share in sm750_share is 0,
* we use this marcro as the same */
- spec_offset = offsetof(struct sm750_share,share);
+ spec_offset = offsetof(struct sm750_share, share);
- spec_share = kzalloc(sizeof(*spec_share),GFP_KERNEL);
- if(!spec_share){
+ spec_share = kzalloc(sizeof(*spec_share), GFP_KERNEL);
+ if (!spec_share) {
pr_err("Could not allocate memory for share.\n");
goto err_share;
}
/* setting share structure */
- share = (struct lynx_share * )(&(spec_share->share));
+ share = (struct lynx_share *)(&(spec_share->share));
share->fbinfo[0] = share->fbinfo[1] = NULL;
share->devid = pdev->device;
share->revid = pdev->revision;
- pr_info("share->revid = %02x\n",share->revid);
+ pr_info("share->revid = %02x\n", share->revid);
share->pdev = pdev;
#ifdef CONFIG_MTRR
share->mtrr_off = g_nomtrr;
@@ -1111,7 +1154,7 @@ static int lynxfb_pci_probe(struct pci_dev * pdev,
share->dual = g_dualview;
spin_lock_init(&share->slock);
- if(!share->accel_off){
+ if (!share->accel_off) {
/* hook deInit and 2d routines, notes that below hw_xxx
* routine can work on most of lynx chips
* if some chip need specific function,please hook it in smXXX_set_drv
@@ -1121,91 +1164,90 @@ static int lynxfb_pci_probe(struct pci_dev * pdev,
share->accel.de_copyarea = hw_copyarea;
share->accel.de_imageblit = hw_imageblit;
pr_info("enable 2d acceleration\n");
- }else{
+ } else {
pr_info("disable 2d acceleration\n");
}
/* call chip specific setup routine */
- sm750fb_setup(share,g_settings);
+ sm750fb_setup(share, g_settings);
/* call chip specific mmap routine */
- if(hw_sm750_map(share,pdev)){
+ if (hw_sm750_map(share, pdev)) {
pr_err("Memory map failed\n");
goto err_map;
}
#ifdef CONFIG_MTRR
- if(!share->mtrr_off){
+ if (!share->mtrr_off) {
pr_info("enable mtrr\n");
share->mtrr.vram = mtrr_add(share->vidmem_start,
share->vidmem_size,
- MTRR_TYPE_WRCOMB,1);
+ MTRR_TYPE_WRCOMB,
+ 1);
- if(share->mtrr.vram < 0){
+ if (share->mtrr.vram < 0) {
/* don't block driver with the failure of MTRR */
pr_err("Unable to setup MTRR.\n");
- }else{
+ } else {
share->mtrr.vram_added = 1;
pr_info("MTRR added succesfully\n");
}
}
#endif
- memset(share->pvMem,0,share->vidmem_size);
+ memset(share->pvMem, 0, share->vidmem_size);
- pr_info("sm%3x mmio address = %p\n",share->devid,share->pvReg);
+ pr_info("sm%3x mmio address = %p\n", share->devid, share->pvReg);
- pci_set_drvdata(pdev,share);
+ pci_set_drvdata(pdev, share);
/* call chipInit routine */
- hw_sm750_inithw(share,pdev);
+ hw_sm750_inithw(share, pdev);
/* allocate frame buffer info structor according to g_dualview */
- fbidx = 0;
+ fbidx = 0;
ALLOC_FB:
- info[fbidx] = framebuffer_alloc(sizeof(struct lynxfb_par),&pdev->dev);
- if(!info[fbidx])
- {
- pr_err("Could not allocate framebuffer #%d.\n",fbidx);
- if(fbidx = 0)
- goto err_info0_alloc;
- else
- goto err_info1_alloc;
- }
+ info[fbidx] = framebuffer_alloc(sizeof(struct lynxfb_par), &pdev->dev);
+ if (!info[fbidx]) {
+ pr_err("Could not allocate framebuffer #%d.\n", fbidx);
+ if (fbidx = 0)
+ goto err_info0_alloc;
else
- {
- struct lynxfb_par * par;
+ goto err_info1_alloc;
+ } else {
+ struct lynxfb_par *par;
int errno;
- pr_info("framebuffer #%d alloc okay\n",fbidx);
+
+ pr_info("framebuffer #%d alloc okay\n", fbidx);
share->fbinfo[fbidx] = info[fbidx];
par = info[fbidx]->par;
par->share = share;
/* set fb_info structure */
- if(lynxfb_set_fbinfo(info[fbidx],fbidx)){
- pr_err("Failed to initial fb_info #%d.\n",fbidx);
- if(fbidx = 0)
+ if (lynxfb_set_fbinfo(info[fbidx], fbidx)) {
+ pr_err("Failed to initial fb_info #%d.\n", fbidx);
+ if (fbidx = 0)
goto err_info0_set;
else
goto err_info1_set;
}
/* register frame buffer*/
- pr_info("Ready to register framebuffer #%d.\n",fbidx);
+ pr_info("Ready to register framebuffer #%d.\n", fbidx);
errno = register_framebuffer(info[fbidx]);
if (errno < 0) {
- pr_err("Failed to register fb_info #%d. err %d\n",fbidx, errno);
- if(fbidx = 0)
+ pr_err("Failed to register fb_info #%d. err %d\n", fbidx, errno);
+ if (fbidx = 0)
goto err_register0;
else
goto err_register1;
}
- pr_info("Accomplished register framebuffer #%d.\n",fbidx);
+ pr_info("Accomplished register framebuffer #%d.\n", fbidx);
}
/* no dual view by far */
fbidx++;
- if(share->dual && fbidx < 2)
+ if (share->dual && fbidx < 2)
goto ALLOC_FB;
return 0;
@@ -1226,20 +1268,20 @@ err_enable:
return -ENODEV;
}
-static void __exit lynxfb_pci_remove(struct pci_dev * pdev)
+static void __exit lynxfb_pci_remove(struct pci_dev *pdev)
{
- struct fb_info * info;
- struct lynx_share * share;
- void * spec_share;
- struct lynxfb_par * par;
+ struct fb_info *info;
+ struct lynx_share *share;
+ void *spec_share;
+ struct lynxfb_par *par;
int cnt;
cnt = 2;
share = pci_get_drvdata(pdev);
- while(cnt-- > 0){
+ while (cnt-- > 0) {
info = share->fbinfo[cnt];
- if(!info)
+ if (!info)
continue;
par = info->par;
@@ -1251,40 +1293,42 @@ static void __exit lynxfb_pci_remove(struct pci_dev * pdev)
framebuffer_release(info);
}
#ifdef CONFIG_MTRR
- if(share->mtrr.vram_added)
- mtrr_del(share->mtrr.vram,share->vidmem_start,share->vidmem_size);
+ if (share->mtrr.vram_added)
+ mtrr_del(share->mtrr.vram,
+ share->vidmem_start,
+ share->vidmem_size);
#endif
- // pci_release_regions(pdev);
+ /* pci_release_regions(pdev);*/
iounmap(share->pvReg);
iounmap(share->pvMem);
- spec_share = container_of(share,struct sm750_share,share);
+ spec_share = container_of(share, struct sm750_share, share);
kfree(g_settings);
kfree(spec_share);
- pci_set_drvdata(pdev,NULL);
+ pci_set_drvdata(pdev, NULL);
}
-static int __init lynxfb_setup(char * options)
+static int __init lynxfb_setup(char *options)
{
int len;
- char * opt,*tmp;
-
+ char *opt, *tmp;
+
- if(!options || !*options){
+ if (!options || !*options) {
pr_warn("no options.\n");
return 0;
}
- pr_info("options:%s\n",options);
+ pr_info("options:%s\n", options);
len = strlen(options) + 1;
g_settings = kzalloc(len, GFP_KERNEL);
- if(!g_settings)
+ if (!g_settings)
return -ENOMEM;
tmp = g_settings;
- /* Notes:
+ /* Notes:
char * strsep(char **s,const char * ct);
@s: the string to be searched
@ct :the characters to search for
@@ -1292,22 +1336,20 @@ static int __init lynxfb_setup(char * options)
strsep() updates @options to pointer after the first found token
it also returns the pointer ahead the token.
*/
- while((opt = strsep(&options,":"))!=NULL)
- {
+ while ((opt = strsep(&options, ":")) != NULL) {
/* options that mean for any lynx chips are configured here */
- if(!strncmp(opt,"noaccel",strlen("noaccel")))
+ if (!strncmp(opt, "noaccel", strlen("noaccel")))
g_noaccel = 1;
#ifdef CONFIG_MTRR
- else if(!strncmp(opt,"nomtrr",strlen("nomtrr")))
+ else if (!strncmp(opt, "nomtrr", strlen("nomtrr")))
g_nomtrr = 1;
#endif
- else if(!strncmp(opt,"dual",strlen("dual")))
+ else if (!strncmp(opt, "dual", strlen("dual")))
g_dualview = 1;
- else
- {
- strcat(tmp,opt);
+ else {
+ strcat(tmp, opt);
tmp += strlen(opt);
- if(options != NULL)
+ if (options != NULL)
*tmp++ = ':';
else
*tmp++ = 0;
@@ -1315,7 +1357,7 @@ static int __init lynxfb_setup(char * options)
}
/* misc g_settings are transport to chip specific routines */
- pr_info("parameter left for chip specific analysis:%s\n",g_settings);
+ pr_info("parameter left for chip specific analysis:%s\n", g_settings);
return 0;
}
@@ -1324,7 +1366,7 @@ static struct pci_device_id smi_pci_table[] = {
{0,}
};
-MODULE_DEVICE_TABLE(pci,smi_pci_table);
+MODULE_DEVICE_TABLE(pci, smi_pci_table);
static struct pci_driver lynxfb_driver = {
.name = "sm750fb",
@@ -1340,13 +1382,13 @@ static struct pci_driver lynxfb_driver = {
static int __init lynxfb_init(void)
{
- char *option ;
+ char *option;
int ret;
#ifdef MODULE
option = g_option;
#else
- if(fb_get_options("sm750fb",&option))
+ if (fb_get_options("sm750fb", &option))
return -ENODEV;
#endif
@@ -1362,7 +1404,7 @@ static void __exit lynxfb_exit(void)
}
module_exit(lynxfb_exit);
-module_param(g_option,charp,S_IRUGO);
+module_param(g_option, charp, S_IRUGO);
MODULE_PARM_DESC(g_option,
"\n\t\tCommon options:\n"
--
2.3.3
^ permalink raw reply related
* Re: [PATCH] staging: sm750fb: fixing multiple checkpatch errors and warnings
From: Dan Carpenter @ 2015-03-19 20:21 UTC (permalink / raw)
To: Michel von Czettritz
Cc: sudipm.mukherjee, teddy.wang, gregkh, linux-kernel,
kernel-janitors, linux-fbdev
In-Reply-To: <20150319192603.GA26974@x230-arch.club.entropia.de>
On Thu, Mar 19, 2015 at 08:26:03PM +0100, Michel von Czettritz wrote:
> This patch formats sm750.c to
> - correct intendations
> - no leading or trailing whitespaces
> - no C99 Style comments
> - correct braces and spacings for if, for and functions
> - no initalisation of static variables to 0 or NULL
> - no assignments in if conditions
> - correct spacings arround pointers and function arguments
>
> and some other warnings
This patch does too many things at once. Split it up into one type of
warning per patch.
regards,
dan carpenter
^ permalink raw reply
* Re: [PATCH] video: fbdev: sh_mobile_lcdcfb: Fix ROP3 sysfs attribute parsing
From: Tomi Valkeinen @ 2015-03-20 11:15 UTC (permalink / raw)
To: linux-fbdev
In-Reply-To: <1426347519-2541-1-git-send-email-laurent.pinchart+renesas@ideasonboard.com>
[-- Attachment #1: Type: text/plain, Size: 682 bytes --]
On 18/03/15 00:27, Laurent Pinchart wrote:
> Hi Tomi,
>
> Could you please pick this patch up for v4.1 ? I can send a pull request if it
> makes your life easier.
>
> On Sunday 15 March 2015 10:32:11 Geert Uytterhoeven wrote:
>> On Sat, Mar 14, 2015 at 4:38 PM, Laurent Pinchart wrote:
>>> The ROP3 attribute is expressed as an integer in the 0-255 range. Remove
>>> the wrong conversion to boolean when parsing it.
>>>
>>> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
>>> Signed-off-by: Laurent Pinchart
>>> <laurent.pinchart+renesas@ideasonboard.com>
>>
>> Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
Thanks, queued for 4.1.
Tomi
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply
* Re: [PATCH v2] video: mxsfb: Make sure axi clock is enabled when accessing registers
From: Tomi Valkeinen @ 2015-03-20 11:26 UTC (permalink / raw)
To: Liu Ying
Cc: linux-fbdev, Peter Chen, Jean-Christophe Plagniol-Villard,
Fabio Estevam, Greg Kroah-Hartman, linux-kernel, stable
In-Reply-To: <20150311030327.GA3724@victor>
[-- Attachment #1: Type: text/plain, Size: 441 bytes --]
On 11/03/15 05:03, Liu Ying wrote:
>> Why do you check for host->enabled here, but not elsewhere?
>
> We need this check here to make sure the axi clock reference count is no greater
> than 1. Looking at the context of mxsfb_set_par(), mxsfb_restore_mode() and
Why is that? The clock framework handles ref counting for you. All the
driver needs to take care of is to call as many times disable as it
calls enable.
Tomi
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply
* Re: [PATCH 4/8] fbdev: ssd1307fb: Use vmalloc to allocate video memory.
From: Tomi Valkeinen @ 2015-03-20 11:37 UTC (permalink / raw)
To: Geert Uytterhoeven, Thomas Niederprüm
Cc: Maxime Ripard, Linux Fbdev development list,
Jean-Christophe PLAGNIOL-VILLARD, linux-kernel@vger.kernel.org
In-Reply-To: <CAMuHMdXTinYuQTpQGc6WyVNpCOhAHPrkHKfRRQAM3Wy6Cg4wvQ@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1377 bytes --]
On 15/03/15 00:02, Geert Uytterhoeven wrote:
> On Fri, Mar 13, 2015 at 10:31 PM, Thomas Niederprüm
> <niederp@physik.uni-kl.de> wrote:
>> Am Tue, 10 Mar 2015 13:28:25 +0200
>> schrieb Tomi Valkeinen <tomi.valkeinen@ti.com>:
>>> Also, isn't doing __pa() for the memory returned by vmalloc plain
>>> wrong?
>>
>>> What was the crash about when using kmalloc? It would be good to fix
>>> defio, as I don't see why it should not work with kmalloced memory.
>>
>> The main challenge here is that the memory handed to userspace upon
>> mmap call needs to be page aligned. The memory returned by kmalloc has
>> no such alignment, but the pointer presented to the userspace program
>> gets aligned to next page boundary. It's not clear to me whether there
>> is an easy way to obtain page aligned kmalloc memory. Memory
>> allocated by vmalloc on the other hand is always aligned to page
>> boundaries. This is why I chose to go for vmalloc.
>
> __get_free_pages()?
I'm not that experienced with mem management, so I have to ask...
__get_free_pages() probably works fine, but isn't vmalloc better here?
__get_free_pages() will give you possibly a lot more memory than you
need. And the memory is contiguous, so it could be difficult to allocate
a larger memory area. The driver doesn't need contiguous memory (except
in the virtual sense).
Tomi
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply
* Re: [PATCH 4/8] fbdev: ssd1307fb: Use vmalloc to allocate video memory.
From: Geert Uytterhoeven @ 2015-03-20 12:12 UTC (permalink / raw)
To: Tomi Valkeinen
Cc: Thomas Niederprüm, Maxime Ripard,
Linux Fbdev development list, Jean-Christophe PLAGNIOL-VILLARD,
linux-kernel@vger.kernel.org
In-Reply-To: <550C068E.1070305@ti.com>
On Fri, Mar 20, 2015 at 12:37 PM, Tomi Valkeinen <tomi.valkeinen@ti.com> wrote:
> On 15/03/15 00:02, Geert Uytterhoeven wrote:
>> On Fri, Mar 13, 2015 at 10:31 PM, Thomas Niederprüm
>> <niederp@physik.uni-kl.de> wrote:
>>> Am Tue, 10 Mar 2015 13:28:25 +0200
>>> schrieb Tomi Valkeinen <tomi.valkeinen@ti.com>:
>>>> Also, isn't doing __pa() for the memory returned by vmalloc plain
>>>> wrong?
>>>
>>>> What was the crash about when using kmalloc? It would be good to fix
>>>> defio, as I don't see why it should not work with kmalloced memory.
>>>
>>> The main challenge here is that the memory handed to userspace upon
>>> mmap call needs to be page aligned. The memory returned by kmalloc has
>>> no such alignment, but the pointer presented to the userspace program
>>> gets aligned to next page boundary. It's not clear to me whether there
>>> is an easy way to obtain page aligned kmalloc memory. Memory
>>> allocated by vmalloc on the other hand is always aligned to page
>>> boundaries. This is why I chose to go for vmalloc.
>>
>> __get_free_pages()?
>
> I'm not that experienced with mem management, so I have to ask...
> __get_free_pages() probably works fine, but isn't vmalloc better here?
>
> __get_free_pages() will give you possibly a lot more memory than you
> need. And the memory is contiguous, so it could be difficult to allocate
> a larger memory area. The driver doesn't need contiguous memory (except
> in the virtual sense).
I was responding to the question about obtaining page aligned kmalloc
memory.
If it doesn't need to be physically contiguous, vmalloc() is fine.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply
* Re: [PATCH] omapdss: extend pm notifier to handle hibernation
From: Tomi Valkeinen @ 2015-03-20 12:20 UTC (permalink / raw)
To: grygorii.strashko
Cc: Jean-Christophe Plagniol-Villard, nm, sumit.semwal, linux-omap,
kishon, linux-fbdev
In-Reply-To: <1424883836-9119-1-git-send-email-grygorii.strashko@linaro.org>
[-- Attachment #1: Type: text/plain, Size: 1238 bytes --]
On 25/02/15 19:03, grygorii.strashko@linaro.org wrote:
> From: Grygorii Strashko <Grygorii.Strashko@linaro.org>
>
> Add handling of missed events in omap_dss_pm_notif which are
> needed to support hibernation (suspend to disk).
>
> Signed-off-by: Grygorii Strashko <Grygorii.Strashko@linaro.org>
> ---
> drivers/video/fbdev/omap2/dss/core.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/video/fbdev/omap2/dss/core.c b/drivers/video/fbdev/omap2/dss/core.c
> index 6b74f73..e60976a 100644
> --- a/drivers/video/fbdev/omap2/dss/core.c
> +++ b/drivers/video/fbdev/omap2/dss/core.c
> @@ -178,11 +178,15 @@ static int omap_dss_pm_notif(struct notifier_block *b, unsigned long v, void *d)
> DSSDBG("pm notif %lu\n", v);
>
> switch (v) {
> + case PM_HIBERNATION_PREPARE:
> case PM_SUSPEND_PREPARE:
> + case PM_RESTORE_PREPARE:
> DSSDBG("suspending displays\n");
> return dss_suspend_all_devices();
>
> case PM_POST_SUSPEND:
> + case PM_POST_HIBERNATION:
> + case PM_POST_RESTORE:
> DSSDBG("resuming displays\n");
> return dss_resume_all_devices();
>
Why suspend displays when PM_RESTORE_PREPARE happens? Why resume when
PM_POST_RESTORE happens?
Tomi
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply
* Re: [PATCH RESEND v2 4/5] staging: sm750fb: Fix __iomem pointer types
From: Greg KH @ 2015-03-20 13:03 UTC (permalink / raw)
To: Lorenzo Stoakes
Cc: sudipm.mukherjee, teddy.wang, devel, linux-fbdev, linux-kernel
In-Reply-To: <1426705493-26615-2-git-send-email-lstoakes@gmail.com>
On Wed, Mar 18, 2015 at 07:04:53PM +0000, Lorenzo Stoakes wrote:
> This patch annotates pointers as referring to I/O mapped memory where they ought
> to be, removes now unnecessary ugly casts, eliminates an incorrect deref on I/O
> mapped memory by using iowrite16 instead, and updates the pointer arithmetic
> accordingly to take into account that the pointers are now byte-sized. This
> fixes the following sparse warnings:-
>
> drivers/staging/sm750fb/sm750_cursor.c:113:19: warning: cast removes address space of expression
> drivers/staging/sm750fb/sm750_cursor.c:204:19: warning: cast removes address space of expression
>
> Signed-off-by: Lorenzo Stoakes <lstoakes@gmail.com>
> ---
> v2: Whitespace fixups
>
> drivers/staging/sm750fb/sm750_cursor.c | 24 ++++++++++++------------
> 1 file changed, 12 insertions(+), 12 deletions(-)
I only see 2 patches in this "series", yet you refer to 5? Please
resend the whole series, I dropped your previous ones from my queue.
thanks,
greg k-h
^ permalink raw reply
* Re: [PATCH] sm750fb: Fix Comment and if else braces
From: Greg KH @ 2015-03-20 13:04 UTC (permalink / raw)
To: Giedrius Statkevičius
Cc: Amitoj Kaur Chawla, sudipm.mukherjee, teddy.wang, linux-fbdev,
devel, linux-kernel
In-Reply-To: <550B11C0.1030300@gmail.com>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="windows-1254", Size: 1339 bytes --]
On Thu, Mar 19, 2015 at 08:13:20PM +0200, Giedrius Statkevičius wrote:
> Hi Amitoj Kaur Chawla,
>
> On 2015.03.19 20:05, Amitoj Kaur Chawla wrote:
> > The edits have been made to add a space before the comment and the errors in
> > braces in the if-else statements.
> > Previously in commit 2d34f53f1065878cd881ac61a183f8e836583d51, removed
> > the C99 comments and errors in if-else indentation and braces.
>
> The previous patch isn't in the git repo yet so it doesn't have a commit
> id thus this one is wrong. You should've just made a v2 and made that
> change. I recommend you to look over this:
> http://kernelnewbies.org/FirstKernelPatch Just remove the HEAD commit in
> your local git repo, add that space and then when using `git
> format-patch` use the "--subject-prefix" option to add that it's a
> second version. Then after "---" you can say what was changed in the
> second version. For example (I'm sure you can think of a better one!):
>
> Signed-off-by: ...
> ---
> v2: added a space after a statement in a line where a coding style error
> was fixed.
>
> drivers/...
Yes, please resend both of these.
thanks,
greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* [PATCH] sm750fb: Fix C99 comment and if-else braces
From: Amitoj Kaur Chawla @ 2015-03-20 14:36 UTC (permalink / raw)
To: sudipm.mukherjee, teddy.wang, gregkh, linux-fbdev, devel,
linux-kernel
The edits have been made to fix C99 Comment and properly indent
the if-else statements with the braces.
Also, to use tabs instead of spaces.
Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
---
drivers/staging/sm750fb/ddk750_chip.c | 35 ++++++++++++++---------------------
1 file changed, 14 insertions(+), 21 deletions(-)
diff --git a/drivers/staging/sm750fb/ddk750_chip.c b/drivers/staging/sm750fb/ddk750_chip.c
index 33add64..1e6b474 100644
--- a/drivers/staging/sm750fb/ddk750_chip.c
+++ b/drivers/staging/sm750fb/ddk750_chip.c
@@ -17,38 +17,31 @@ logical_chip_type_t getChipType(void)
char physicalRev;
logical_chip_type_t chip;
- physicalID = devId750;//either 0x718 or 0x750
+ physicalID = devId750; /* either 0x718 or 0x750 */
physicalRev = revId750;
- if (physicalID = 0x718)
- {
- chip = SM718;
- }
- else if (physicalID = 0x750)
- {
- chip = SM750;
+ if (physicalID = 0x718) {
+ chip = SM718;
+ } else if (physicalID = 0x750) {
+ chip = SM750;
/* SM750 and SM750LE are different in their revision ID only. */
- if (physicalRev = SM750LE_REVISION_ID){
+ if (physicalRev = SM750LE_REVISION_ID)
chip = SM750LE;
- }
- }
- else
- {
- chip = SM_UNKNOWN;
- }
+ } else {
+ chip = SM_UNKNOWN;
+ }
return chip;
}
-
inline unsigned int twoToPowerOfx(unsigned long x)
{
- unsigned long i;
- unsigned long result = 1;
+ unsigned long i;
+ unsigned long result = 1;
- for (i=1; i<=x; i++)
- result *= 2;
- return result;
+ for (i = 1; i <= x; i++)
+ result *= 2;
+ return result;
}
inline unsigned int calcPLL(pll_value_t *pPLL)
--
1.9.1
^ permalink raw reply related
* Re: [PATCH 4/8] fbdev: ssd1307fb: Use vmalloc to allocate video memory.
From: Maxime Ripard @ 2015-03-20 14:47 UTC (permalink / raw)
To: Tomi Valkeinen
Cc: Geert Uytterhoeven, Thomas Niederprüm,
Linux Fbdev development list, Jean-Christophe PLAGNIOL-VILLARD,
linux-kernel@vger.kernel.org
In-Reply-To: <550C068E.1070305@ti.com>
[-- Attachment #1: Type: text/plain, Size: 1841 bytes --]
On Fri, Mar 20, 2015 at 01:37:50PM +0200, Tomi Valkeinen wrote:
> On 15/03/15 00:02, Geert Uytterhoeven wrote:
> > On Fri, Mar 13, 2015 at 10:31 PM, Thomas Niederprüm
> > <niederp@physik.uni-kl.de> wrote:
> >> Am Tue, 10 Mar 2015 13:28:25 +0200
> >> schrieb Tomi Valkeinen <tomi.valkeinen@ti.com>:
> >>> Also, isn't doing __pa() for the memory returned by vmalloc plain
> >>> wrong?
> >>
> >>> What was the crash about when using kmalloc? It would be good to fix
> >>> defio, as I don't see why it should not work with kmalloced memory.
> >>
> >> The main challenge here is that the memory handed to userspace upon
> >> mmap call needs to be page aligned. The memory returned by kmalloc has
> >> no such alignment, but the pointer presented to the userspace program
> >> gets aligned to next page boundary. It's not clear to me whether there
> >> is an easy way to obtain page aligned kmalloc memory. Memory
> >> allocated by vmalloc on the other hand is always aligned to page
> >> boundaries. This is why I chose to go for vmalloc.
> >
> > __get_free_pages()?
>
> I'm not that experienced with mem management, so I have to ask...
> __get_free_pages() probably works fine, but isn't vmalloc better here?
>
> __get_free_pages() will give you possibly a lot more memory than you
> need. And the memory is contiguous, so it could be difficult to allocate
> a larger memory area. The driver doesn't need contiguous memory (except
> in the virtual sense).
vmalloc also returns pages, so the size will be page-aligned. It
doesn't make much of a difference here, since we will only use a
single page in both case (the max resolution of these screens is
128x39, with one bit per pixel).
Maxime
--
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply
* Re: [PATCH] omapdss: extend pm notifier to handle hibernation
From: Grygorii.Strashko@linaro.org @ 2015-03-20 14:57 UTC (permalink / raw)
To: Tomi Valkeinen
Cc: Jean-Christophe Plagniol-Villard, nm, sumit.semwal, linux-omap,
kishon, linux-fbdev
In-Reply-To: <550C108E.3020907@ti.com>
Hi Tomi,
On 03/20/2015 02:20 PM, Tomi Valkeinen wrote:
> On 25/02/15 19:03, grygorii.strashko@linaro.org wrote:
>> From: Grygorii Strashko <Grygorii.Strashko@linaro.org>
>>
>> Add handling of missed events in omap_dss_pm_notif which are
>> needed to support hibernation (suspend to disk).
>>
>> Signed-off-by: Grygorii Strashko <Grygorii.Strashko@linaro.org>
>> ---
>> drivers/video/fbdev/omap2/dss/core.c | 4 ++++
>> 1 file changed, 4 insertions(+)
>>
>> diff --git a/drivers/video/fbdev/omap2/dss/core.c b/drivers/video/fbdev/omap2/dss/core.c
>> index 6b74f73..e60976a 100644
>> --- a/drivers/video/fbdev/omap2/dss/core.c
>> +++ b/drivers/video/fbdev/omap2/dss/core.c
>> @@ -178,11 +178,15 @@ static int omap_dss_pm_notif(struct notifier_block *b, unsigned long v, void *d)
>> DSSDBG("pm notif %lu\n", v);
>>
>> switch (v) {
>> + case PM_HIBERNATION_PREPARE:
>> case PM_SUSPEND_PREPARE:
>> + case PM_RESTORE_PREPARE:
>> DSSDBG("suspending displays\n");
>> return dss_suspend_all_devices();
>>
>> case PM_POST_SUSPEND:
>> + case PM_POST_HIBERNATION:
>> + case PM_POST_RESTORE:
>> DSSDBG("resuming displays\n");
>> return dss_resume_all_devices();
>>
>
> Why suspend displays when PM_RESTORE_PREPARE happens? Why resume when
> PM_POST_RESTORE happens?
We have following sequence when system is restored from hibernation:
- original kernel booted;
- late_initcall_sync(software_resume);
- pm_notifier_call_chain(PM_RESTORE_PREPARE);
- freeze_processes
- check & read hibernation image
- suspend all devices (.freeze())
- jump to stored kernel
- restore devices
...
So, all devices should be in frozen/suspended state when we will jump to stored kernel
(device's state should be the same as before creating hib image).
Without this patch I can see a lot of log messages like below:
[ 3.642499] Freezing user space processes ...
[ 3.647029] mmcblk1boot1: unknown partition table
[ 3.647043] (elapsed 0.000 seconds) done.
[ 3.686414] mmcblk1boot0: unknown partition table
[ 3.714552] PM: Using 1 thread(s) for decompression.
[ 3.714552] PM: Loading and decompressing image data (144641 pages)...
[ 4.520388] PM: Image loading progress: 0%
[ 5.153715] PM: Image loading progress: 10%
[ 5.847731] PM: Image loading progress: 20%
[ 6.622024] PM: Image loading progress: 30%
[ 7.023830] PM: Image loading progress: 40%
[ 7.455959] PM: Image loading progress: 50%
[ 8.137186] PM: Image loading progress: 60%
[ 8.567899] PM: Image loading progress: 70%
[ 9.670371] PM: Image loading progress: 80%
[ 10.130646] PM: Image loading progress: 90%
[ 10.525035] PM: Image loading progress: 100%
[ 10.529565] PM: Image loading done.
[ 10.533262] PM: Read 578564 kbytes in 6.80 seconds (85.08 MB/s)
[ 10.545313] Suspending console(s) (use no_console_suspend to debug)
[ 193.721284] PM: freeze of devices complete after 7.891 msecs
[ 193.722618] PM: late freeze of devices complete after 1.325 msecs
[ 193.723969] PM: noirq freeze of devices complete after 1.343 msecs
[ 193.724133] Disabling non-boot CPUs ...
[ 193.724792] CPU1: shutdown
[ 193.725387] PM: Creating hibernation image:
[ 193.725387] PM: Need to copy 144499 pages
[ 193.725439] Enabling non-boot CPUs ...
[ 193.725783] CPU1: smp_ops.cpu_die() returned, trying to resuscitate
[ 193.725790] CPU1: Booted secondary processor
[ 193.726069] CPU1 is up
[ 193.743772] PM: noirq restore of devices complete after 17.693 msecs
[ 193.744691] PM: early restore of devices complete after 0.634 msecs
[ 193.951382] [drm:omap_crtc_error_irq] *ERROR* tv: errors: 00008000
[ 193.951389] [drm:omap_plane_error_irq] *ERROR* gfx: errors: 00000040
[ 193.951402] [drm:omap_crtc_error_irq] *ERROR* tv: errors: 00008000
[ 193.951413] [drm:omap_crtc_error_irq] *ERROR* tv: errors: 00008000
[ 193.951424] [drm:omap_crtc_error_irq] *ERROR* tv: errors: 00008000
[ 193.951435] [drm:omap_crtc_error_irq] *ERROR* tv: errors: 00008000
[ 193.951445] [drm:omap_crtc_error_irq] *ERROR* tv: errors: 00008000
[ 193.951455] [drm:omap_crtc_error_irq] *ERROR* tv: errors: 00008000
[ 193.951465] [drm:omap_crtc_error_irq] *ERROR* tv: errors: 00008000
[ 193.951475] [drm:omap_crtc_error_irq] *ERROR* tv: errors: 00008000
[ 193.951484] [drm:omap_crtc_error_irq] *ERROR* tv: errors: 00008000
[ 193.951567] omap_l3_noc 44000000.ocp: L3 application error: target 2 mod:1 (unclearable)
[ 193.951605] omap_l3_noc 44000000.ocp: L3 debug error: target 2 mod:1 (unclearable)
[ 194.293226] ata1: SATA link down (SStatus 0 SControl 300)
[ 194.560684] PM: restore of devices complete after 610.740 msecs
--
regards,
-grygorii
^ permalink raw reply
* Re: [PATCH] omapdss: extend pm notifier to handle hibernation
From: Tomi Valkeinen @ 2015-03-20 15:21 UTC (permalink / raw)
To: Grygorii.Strashko@linaro.org
Cc: Jean-Christophe Plagniol-Villard, nm, sumit.semwal, linux-omap,
kishon, linux-fbdev
In-Reply-To: <550C3545.8060702@linaro.org>
[-- Attachment #1: Type: text/plain, Size: 2504 bytes --]
On 20/03/15 16:57, Grygorii.Strashko@linaro.org wrote:
> Hi Tomi,
>
> On 03/20/2015 02:20 PM, Tomi Valkeinen wrote:
>> On 25/02/15 19:03, grygorii.strashko@linaro.org wrote:
>>> From: Grygorii Strashko <Grygorii.Strashko@linaro.org>
>>>
>>> Add handling of missed events in omap_dss_pm_notif which are
>>> needed to support hibernation (suspend to disk).
>>>
>>> Signed-off-by: Grygorii Strashko <Grygorii.Strashko@linaro.org>
>>> ---
>>> drivers/video/fbdev/omap2/dss/core.c | 4 ++++
>>> 1 file changed, 4 insertions(+)
>>>
>>> diff --git a/drivers/video/fbdev/omap2/dss/core.c b/drivers/video/fbdev/omap2/dss/core.c
>>> index 6b74f73..e60976a 100644
>>> --- a/drivers/video/fbdev/omap2/dss/core.c
>>> +++ b/drivers/video/fbdev/omap2/dss/core.c
>>> @@ -178,11 +178,15 @@ static int omap_dss_pm_notif(struct notifier_block *b, unsigned long v, void *d)
>>> DSSDBG("pm notif %lu\n", v);
>>>
>>> switch (v) {
>>> + case PM_HIBERNATION_PREPARE:
>>> case PM_SUSPEND_PREPARE:
>>> + case PM_RESTORE_PREPARE:
>>> DSSDBG("suspending displays\n");
>>> return dss_suspend_all_devices();
>>>
>>> case PM_POST_SUSPEND:
>>> + case PM_POST_HIBERNATION:
>>> + case PM_POST_RESTORE:
>>> DSSDBG("resuming displays\n");
>>> return dss_resume_all_devices();
>>>
>>
>> Why suspend displays when PM_RESTORE_PREPARE happens? Why resume when
>> PM_POST_RESTORE happens?
>
> We have following sequence when system is restored from hibernation:
> - original kernel booted;
> - late_initcall_sync(software_resume);
> - pm_notifier_call_chain(PM_RESTORE_PREPARE);
> - freeze_processes
> - check & read hibernation image
> - suspend all devices (.freeze())
> - jump to stored kernel
> - restore devices
> ...
>
> So, all devices should be in frozen/suspended state when we will jump to stored kernel
> (device's state should be the same as before creating hib image).
>
> Without this patch I can see a lot of log messages like below:
Yes, I am sure a fix is needed for hibernation. But I still don't quite
understand PM_RESTORE_PREPARE and PM_POST_RESTORE.
When we enter hibernation, there's only PM_HIBERNATION_PREPARE?
When waking from hibernation, there's first PM_RESTORE_PREPARE, where we
need to disable displays that were enabled during boot. Then either
PM_POST_HIBERNATION if all went well, or PM_POST_RESTORE if there was an
error, and in both cases we want to enable the displays?
Tomi
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply
* [PATCH RESEND 2 1/5] staging: sm750fb: Use memset_io instead of memset
From: Lorenzo Stoakes @ 2015-03-20 15:22 UTC (permalink / raw)
To: sudipm.mukherjee, teddy.wang, gregkh
Cc: linux-fbdev, devel, linux-kernel, Lorenzo Stoakes
This patch takes into account that cursor->vstart, crtc->vScreen and
share->pvMem are pointers to memory-mapped I/O and thus we should use memset_io
to make this explicit. In addition, some architectures require special treatment
of memory-mapped I/O so the previous code could actually break without this
change.
This fixes the following sparse warnings:-
drivers/staging/sm750fb/sm750.c:489:17: warning: incorrect type in argument 1 (different address spaces)
drivers/staging/sm750fb/sm750.c:490:17: warning: incorrect type in argument 1 (different address spaces)
drivers/staging/sm750fb/sm750.c:501:17: warning: incorrect type in argument 1 (different address spaces)
drivers/staging/sm750fb/sm750.c:502:17: warning: incorrect type in argument 1 (different address spaces)
drivers/staging/sm750fb/sm750.c:833:5: warning: incorrect type in argument 1 (different address spaces)
drivers/staging/sm750fb/sm750.c:1154:9: warning: incorrect type in argument 1 (different address spaces)
Signed-off-by: Lorenzo Stoakes <lstoakes@gmail.com>
---
drivers/staging/sm750fb/sm750.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index aa0888c..3e36b6a 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -486,8 +486,8 @@ static int lynxfb_resume(struct pci_dev* pdev)
par = info->par;
crtc = &par->crtc;
cursor = &crtc->cursor;
- memset(cursor->vstart, 0x0, cursor->size);
- memset(crtc->vScreen,0x0,crtc->vidmem_size);
+ memset_io(cursor->vstart, 0x0, cursor->size);
+ memset_io(crtc->vScreen, 0x0, crtc->vidmem_size);
lynxfb_ops_set_par(info);
fb_set_suspend(info, 0);
}
@@ -498,8 +498,8 @@ static int lynxfb_resume(struct pci_dev* pdev)
par = info->par;
crtc = &par->crtc;
cursor = &crtc->cursor;
- memset(cursor->vstart, 0x0, cursor->size);
- memset(crtc->vScreen,0x0,crtc->vidmem_size);
+ memset_io(cursor->vstart, 0x0, cursor->size);
+ memset_io(crtc->vScreen, 0x0, crtc->vidmem_size);
lynxfb_ops_set_par(info);
fb_set_suspend(info, 0);
}
@@ -830,7 +830,7 @@ static int lynxfb_set_fbinfo(struct fb_info* info,int index)
crtc->cursor.share = share;
- memset(crtc->cursor.vstart, 0, crtc->cursor.size);
+ memset_io(crtc->cursor.vstart, 0, crtc->cursor.size);
if(!g_hwcursor){
lynxfb_ops.fb_cursor = NULL;
crtc->cursor.disable(&crtc->cursor);
@@ -1151,7 +1151,7 @@ static int lynxfb_pci_probe(struct pci_dev * pdev,
}
#endif
- memset(share->pvMem,0,share->vidmem_size);
+ memset_io(share->pvMem, 0, share->vidmem_size);
pr_info("sm%3x mmio address = %p\n",share->devid,share->pvReg);
--
2.3.2
^ permalink raw reply related
* [PATCH RESEND 2 2/5] staging: sm750fb: Make internal functions static
From: Lorenzo Stoakes @ 2015-03-20 15:22 UTC (permalink / raw)
To: sudipm.mukherjee, teddy.wang, gregkh
Cc: linux-fbdev, devel, linux-kernel, Lorenzo Stoakes
In-Reply-To: <1426864935-29350-1-git-send-email-lstoakes@gmail.com>
This patch declares externally unavailable functions static. This fixes
the following sparse warnings:-
drivers/staging/sm750fb/ddk750_hwi2c.c:63:6: warning: symbol 'hwI2CWaitTXDone' was not declared. Should it be static?
drivers/staging/sm750fb/ddk750_hwi2c.c:93:14: warning: symbol 'hwI2CWriteData' was not declared. Should it be static?
drivers/staging/sm750fb/ddk750_hwi2c.c:160:14: warning: symbol 'hwI2CReadData' was not declared. Should it be static?
Signed-off-by: Lorenzo Stoakes <lstoakes@gmail.com>
---
drivers/staging/sm750fb/ddk750_hwi2c.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/sm750fb/ddk750_hwi2c.c b/drivers/staging/sm750fb/ddk750_hwi2c.c
index 84dfb6f..7826376 100644
--- a/drivers/staging/sm750fb/ddk750_hwi2c.c
+++ b/drivers/staging/sm750fb/ddk750_hwi2c.c
@@ -60,7 +60,7 @@ void hwI2CClose(void)
}
-long hwI2CWaitTXDone(void)
+static long hwI2CWaitTXDone(void)
{
unsigned int timeout;
@@ -90,7 +90,7 @@ long hwI2CWaitTXDone(void)
* Return Value:
* Total number of bytes those are actually written.
*/
-unsigned int hwI2CWriteData(
+static unsigned int hwI2CWriteData(
unsigned char deviceAddress,
unsigned int length,
unsigned char *pBuffer
@@ -157,7 +157,7 @@ unsigned int hwI2CWriteData(
* Return Value:
* Total number of actual bytes read from the slave device
*/
-unsigned int hwI2CReadData(
+static unsigned int hwI2CReadData(
unsigned char deviceAddress,
unsigned int length,
unsigned char *pBuffer
--
2.3.2
^ permalink raw reply related
* [PATCH RESEND 2 3/5] staging: sm750fb: Remove unused function
From: Lorenzo Stoakes @ 2015-03-20 15:22 UTC (permalink / raw)
To: sudipm.mukherjee, teddy.wang, gregkh
Cc: linux-fbdev, devel, linux-kernel, Lorenzo Stoakes
In-Reply-To: <1426864935-29350-1-git-send-email-lstoakes@gmail.com>
This patch removes the unused hw712_fillrect function. This patch fixes
the following sparse warning:-
drivers/staging/sm750fb/sm750_accel.c:95:5: warning: symbol 'hw712_fillrect' was not declared. Should it be static?
Signed-off-by: Lorenzo Stoakes <lstoakes@gmail.com>
---
drivers/staging/sm750fb/sm750_accel.c | 78 -----------------------------------
1 file changed, 78 deletions(-)
diff --git a/drivers/staging/sm750fb/sm750_accel.c b/drivers/staging/sm750fb/sm750_accel.c
index 6521c3b..c5a3726 100644
--- a/drivers/staging/sm750fb/sm750_accel.c
+++ b/drivers/staging/sm750fb/sm750_accel.c
@@ -89,84 +89,6 @@ void hw_set2dformat(struct lynx_accel * accel,int fmt)
write_dpr(accel,DE_STRETCH_FORMAT,reg);
}
-/* seems sm712 RectFill command is broken,so need use BitBlt to
- * replace it. */
-
-int hw712_fillrect(struct lynx_accel * accel,
- u32 base,u32 pitch,u32 Bpp,
- u32 x,u32 y,u32 width,u32 height,
- u32 color,u32 rop)
-{
- u32 deCtrl;
- if(accel->de_wait() != 0)
- {
- /* int time wait and always busy,seems hardware
- * got something error */
- pr_debug("%s:De engine always bussy\n",__func__);
- return -1;
- }
- /* 24bpp 2d acceleration still not work,we already support 2d on
- * both 8/16/32 bpp now, so there is no harm if we disable 2d on
- * 24bpp for current stage. */
-#if 0
- if(Bpp = 3){
- width *= 3;
- x *= 3;
- write_dpr(accel,DE_PITCH,
- FIELD_VALUE(0,DE_PITCH,DESTINATION,pitch)|
- FIELD_VALUE(0,DE_PITCH,SOURCE,pitch));//dpr10
- }
- else
-#endif
- {
- write_dpr(accel,DE_PITCH,
- FIELD_VALUE(0,DE_PITCH,DESTINATION,pitch/Bpp)|
- FIELD_VALUE(0,DE_PITCH,SOURCE,pitch/Bpp));//dpr10
-
- }
-
- write_dpr(accel,DE_FOREGROUND,color);//DPR14
- write_dpr(accel,DE_MONO_PATTERN_HIGH,~0);//DPR34
- write_dpr(accel,DE_MONO_PATTERN_LOW,~0);//DPR38
-
- write_dpr(accel,DE_WINDOW_SOURCE_BASE,base);//dpr44
- write_dpr(accel,DE_WINDOW_DESTINATION_BASE,base);//dpr40
-
-
- write_dpr(accel,DE_WINDOW_WIDTH,
- FIELD_VALUE(0,DE_WINDOW_WIDTH,DESTINATION,pitch/Bpp)|
- FIELD_VALUE(0,DE_WINDOW_WIDTH,SOURCE,pitch/Bpp));//dpr3c
-
-
- write_dpr(accel,DE_DESTINATION,
- FIELD_SET(0,DE_DESTINATION,WRAP,DISABLE)|
- FIELD_VALUE(0,DE_DESTINATION,X,x)|
- FIELD_VALUE(0,DE_DESTINATION,Y,y));//dpr4
-
- write_dpr(accel,DE_DIMENSION,
- FIELD_VALUE(0,DE_DIMENSION,X,width)|
- FIELD_VALUE(0,DE_DIMENSION,Y_ET,height));//dpr8
-
- deCtrl - FIELD_SET(0,DE_CONTROL,STATUS,START)|
- FIELD_SET(0,DE_CONTROL,COMMAND,BITBLT)|
- FIELD_SET(0,DE_CONTROL,ROP2_SOURCE,PATTERN)|
- FIELD_SET(0,DE_CONTROL,ROP_SELECT,ROP2)|
- FIELD_VALUE(0,DE_CONTROL,ROP,rop);//dpr0xc
-#if 0
- /* dump registers */
- int i;
- inf_msg("x,y,w,h = %d,%d,%d,%d\n",x,y,width,height);
- for(i=0x04;i<=0x44;i+=4){
- inf_msg("dpr%02x = %08x\n",i,read_dpr(accel,i));
- }
- inf_msg("deCtrl = %08x\n",deCtrl);
-#endif
-
- write_dpr(accel,DE_CONTROL,deCtrl);
- return 0;
-}
-
int hw_fillrect(struct lynx_accel * accel,
u32 base,u32 pitch,u32 Bpp,
u32 x,u32 y,u32 width,u32 height,
--
2.3.2
^ permalink raw reply related
* [PATCH RESEND 2 4/5] staging: sm750fb: Fix __iomem pointer types
From: Lorenzo Stoakes @ 2015-03-20 15:22 UTC (permalink / raw)
To: sudipm.mukherjee, teddy.wang, gregkh
Cc: linux-fbdev, devel, linux-kernel, Lorenzo Stoakes
In-Reply-To: <1426864935-29350-1-git-send-email-lstoakes@gmail.com>
This patch annotates pointers as referring to I/O mapped memory where they ought
to be, removes now unnecessary ugly casts, eliminates an incorrect deref on I/O
mapped memory by using iowrite16 instead, and updates the pointer arithmetic
accordingly to take into account that the pointers are now byte-sized. This
fixes the following sparse warnings:-
drivers/staging/sm750fb/sm750_cursor.c:113:19: warning: cast removes address space of expression
drivers/staging/sm750fb/sm750_cursor.c:204:19: warning: cast removes address space of expression
Signed-off-by: Lorenzo Stoakes <lstoakes@gmail.com>
---
drivers/staging/sm750fb/sm750_cursor.c | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/drivers/staging/sm750fb/sm750_cursor.c b/drivers/staging/sm750fb/sm750_cursor.c
index 6cceef1..c2ff3bd 100644
--- a/drivers/staging/sm750fb/sm750_cursor.c
+++ b/drivers/staging/sm750fb/sm750_cursor.c
@@ -98,7 +98,7 @@ void hw_cursor_setData(struct lynx_cursor * cursor,
int i,j,count,pitch,offset;
u8 color,mask,opr;
u16 data;
- u16 * pbuffer,*pstart;
+ void __iomem *pbuffer, *pstart;
/* in byte*/
pitch = cursor->w >> 3;
@@ -106,11 +106,11 @@ void hw_cursor_setData(struct lynx_cursor * cursor,
/* in byte */
count = pitch * cursor->h;
- /* in ushort */
- offset = cursor->maxW * 2 / 8 / 2;
+ /* in byte */
+ offset = cursor->maxW * 2 / 8;
data = 0;
- pstart = (u16 *)cursor->vstart;
+ pstart = cursor->vstart;
pbuffer = pstart;
/*
@@ -161,7 +161,7 @@ void hw_cursor_setData(struct lynx_cursor * cursor,
}
}
#endif
- *pbuffer = data;
+ iowrite16(data, pbuffer);
/* assume pitch is 1,2,4,8,...*/
#if 0
@@ -174,7 +174,7 @@ void hw_cursor_setData(struct lynx_cursor * cursor,
pstart += offset;
pbuffer = pstart;
}else{
- pbuffer++;
+ pbuffer += sizeof(u16);
}
}
@@ -189,7 +189,7 @@ void hw_cursor_setData2(struct lynx_cursor * cursor,
int i,j,count,pitch,offset;
u8 color, mask;
u16 data;
- u16 * pbuffer,*pstart;
+ void __iomem *pbuffer, *pstart;
/* in byte*/
pitch = cursor->w >> 3;
@@ -197,11 +197,11 @@ void hw_cursor_setData2(struct lynx_cursor * cursor,
/* in byte */
count = pitch * cursor->h;
- /* in ushort */
- offset = cursor->maxW * 2 / 8 / 2;
+ /* in byte */
+ offset = cursor->maxW * 2 / 8;
data = 0;
- pstart = (u16 *)cursor->vstart;
+ pstart = cursor->vstart;
pbuffer = pstart;
for(i=0;i<count;i++)
@@ -234,7 +234,7 @@ void hw_cursor_setData2(struct lynx_cursor * cursor,
data |= ((color & (1<<j))?1:2)<<(j*2);
}
#endif
- *pbuffer = data;
+ iowrite16(data, pbuffer);
/* assume pitch is 1,2,4,8,...*/
if(!(i&(pitch-1)))
@@ -244,7 +244,7 @@ void hw_cursor_setData2(struct lynx_cursor * cursor,
pstart += offset;
pbuffer = pstart;
}else{
- pbuffer++;
+ pbuffer += sizeof(u16);
}
}
--
2.3.2
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox