Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
66c8719b
Commit
66c8719b
authored
Dec 16, 2008
by
Sascha Hauer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
i.MX Framebuffer: Cleanup Coding style
Signed-off-by:
Sascha Hauer
<
s.hauer@pengutronix.de
>
parent
24b9baf7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
36 deletions
+34
-36
drivers/video/imxfb.c
drivers/video/imxfb.c
+34
-36
No files found.
drivers/video/imxfb.c
View file @
66c8719b
/*
/*
* linux/drivers/video/imxfb.c
*
* Freescale i.MX Frame Buffer device driver
* Freescale i.MX Frame Buffer device driver
*
*
* Copyright (C) 2004 Sascha Hauer, Pengutronix
* Copyright (C) 2004 Sascha Hauer, Pengutronix
...
@@ -168,20 +166,21 @@ struct imxfb_info {
...
@@ -168,20 +166,21 @@ struct imxfb_info {
#define MIN_YRES 64
#define MIN_YRES 64
static
struct
imxfb_rgb
def_rgb_16
=
{
static
struct
imxfb_rgb
def_rgb_16
=
{
.
red
=
{
.
offset
=
8
,
.
length
=
4
,
},
.
red
=
{
.
offset
=
8
,
.
length
=
4
,
},
.
green
=
{
.
offset
=
4
,
.
length
=
4
,
},
.
green
=
{
.
offset
=
4
,
.
length
=
4
,
},
.
blue
=
{
.
offset
=
0
,
.
length
=
4
,
},
.
blue
=
{
.
offset
=
0
,
.
length
=
4
,
},
.
transp
=
{
.
offset
=
0
,
.
length
=
0
,
},
.
transp
=
{
.
offset
=
0
,
.
length
=
0
,
},
};
};
static
struct
imxfb_rgb
def_rgb_8
=
{
static
struct
imxfb_rgb
def_rgb_8
=
{
.
red
=
{
.
offset
=
0
,
.
length
=
8
,
},
.
red
=
{
.
offset
=
0
,
.
length
=
8
,
},
.
green
=
{
.
offset
=
0
,
.
length
=
8
,
},
.
green
=
{
.
offset
=
0
,
.
length
=
8
,
},
.
blue
=
{
.
offset
=
0
,
.
length
=
8
,
},
.
blue
=
{
.
offset
=
0
,
.
length
=
8
,
},
.
transp
=
{
.
offset
=
0
,
.
length
=
0
,
},
.
transp
=
{
.
offset
=
0
,
.
length
=
0
,
},
};
};
static
int
imxfb_activate_var
(
struct
fb_var_screeninfo
*
var
,
struct
fb_info
*
info
);
static
int
imxfb_activate_var
(
struct
fb_var_screeninfo
*
var
,
struct
fb_info
*
info
);
static
inline
u_int
chan_to_field
(
u_int
chan
,
struct
fb_bitfield
*
bf
)
static
inline
u_int
chan_to_field
(
u_int
chan
,
struct
fb_bitfield
*
bf
)
{
{
...
@@ -190,9 +189,8 @@ static inline u_int chan_to_field(u_int chan, struct fb_bitfield *bf)
...
@@ -190,9 +189,8 @@ static inline u_int chan_to_field(u_int chan, struct fb_bitfield *bf)
return
chan
<<
bf
->
offset
;
return
chan
<<
bf
->
offset
;
}
}
static
int
static
int
imxfb_setpalettereg
(
u_int
regno
,
u_int
red
,
u_int
green
,
u_int
blue
,
imxfb_setpalettereg
(
u_int
regno
,
u_int
red
,
u_int
green
,
u_int
blue
,
u_int
trans
,
struct
fb_info
*
info
)
u_int
trans
,
struct
fb_info
*
info
)
{
{
struct
imxfb_info
*
fbi
=
info
->
par
;
struct
imxfb_info
*
fbi
=
info
->
par
;
u_int
val
,
ret
=
1
;
u_int
val
,
ret
=
1
;
...
@@ -209,8 +207,7 @@ imxfb_setpalettereg(u_int regno, u_int red, u_int green, u_int blue,
...
@@ -209,8 +207,7 @@ imxfb_setpalettereg(u_int regno, u_int red, u_int green, u_int blue,
return
ret
;
return
ret
;
}
}
static
int
static
int
imxfb_setcolreg
(
u_int
regno
,
u_int
red
,
u_int
green
,
u_int
blue
,
imxfb_setcolreg
(
u_int
regno
,
u_int
red
,
u_int
green
,
u_int
blue
,
u_int
trans
,
struct
fb_info
*
info
)
u_int
trans
,
struct
fb_info
*
info
)
{
{
struct
imxfb_info
*
fbi
=
info
->
par
;
struct
imxfb_info
*
fbi
=
info
->
par
;
...
@@ -270,8 +267,7 @@ imxfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
...
@@ -270,8 +267,7 @@ imxfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
* yres, xres_virtual, yres_virtual, xoffset, yoffset, grayscale,
* yres, xres_virtual, yres_virtual, xoffset, yoffset, grayscale,
* bitfields, horizontal timing, vertical timing.
* bitfields, horizontal timing, vertical timing.
*/
*/
static
int
static
int
imxfb_check_var
(
struct
fb_var_screeninfo
*
var
,
struct
fb_info
*
info
)
imxfb_check_var
(
struct
fb_var_screeninfo
*
var
,
struct
fb_info
*
info
)
{
{
struct
imxfb_info
*
fbi
=
info
->
par
;
struct
imxfb_info
*
fbi
=
info
->
par
;
int
rgbidx
;
int
rgbidx
;
...
@@ -343,8 +339,7 @@ static int imxfb_set_par(struct fb_info *info)
...
@@ -343,8 +339,7 @@ static int imxfb_set_par(struct fb_info *info)
info
->
fix
.
visual
=
FB_VISUAL_STATIC_PSEUDOCOLOR
;
info
->
fix
.
visual
=
FB_VISUAL_STATIC_PSEUDOCOLOR
;
}
}
info
->
fix
.
line_length
=
var
->
xres_virtual
*
info
->
fix
.
line_length
=
var
->
xres_virtual
*
var
->
bits_per_pixel
/
8
;
var
->
bits_per_pixel
/
8
;
fbi
->
palette_size
=
var
->
bits_per_pixel
==
8
?
256
:
16
;
fbi
->
palette_size
=
var
->
bits_per_pixel
==
8
?
256
:
16
;
imxfb_activate_var
(
var
,
info
);
imxfb_activate_var
(
var
,
info
);
...
@@ -375,9 +370,9 @@ static void imxfb_enable_controller(struct imxfb_info *fbi)
...
@@ -375,9 +370,9 @@ static void imxfb_enable_controller(struct imxfb_info *fbi)
writel
(
RMCR_LCDC_EN
,
fbi
->
regs
+
LCDC_RMCR
);
writel
(
RMCR_LCDC_EN
,
fbi
->
regs
+
LCDC_RMCR
);
if
(
fbi
->
backlight_power
)
if
(
fbi
->
backlight_power
)
fbi
->
backlight_power
(
1
);
fbi
->
backlight_power
(
1
);
if
(
fbi
->
lcd_power
)
if
(
fbi
->
lcd_power
)
fbi
->
lcd_power
(
1
);
fbi
->
lcd_power
(
1
);
}
}
...
@@ -385,9 +380,9 @@ static void imxfb_disable_controller(struct imxfb_info *fbi)
...
@@ -385,9 +380,9 @@ static void imxfb_disable_controller(struct imxfb_info *fbi)
{
{
pr_debug
(
"Disabling LCD controller
\n
"
);
pr_debug
(
"Disabling LCD controller
\n
"
);
if
(
fbi
->
backlight_power
)
if
(
fbi
->
backlight_power
)
fbi
->
backlight_power
(
0
);
fbi
->
backlight_power
(
0
);
if
(
fbi
->
lcd_power
)
if
(
fbi
->
lcd_power
)
fbi
->
lcd_power
(
0
);
fbi
->
lcd_power
(
0
);
writel
(
0
,
fbi
->
regs
+
LCDC_RMCR
);
writel
(
0
,
fbi
->
regs
+
LCDC_RMCR
);
...
@@ -495,7 +490,8 @@ static int imxfb_activate_var(struct fb_var_screeninfo *var, struct fb_info *inf
...
@@ -495,7 +490,8 @@ static int imxfb_activate_var(struct fb_var_screeninfo *var, struct fb_info *inf
static
int
imxfb_suspend
(
struct
platform_device
*
dev
,
pm_message_t
state
)
static
int
imxfb_suspend
(
struct
platform_device
*
dev
,
pm_message_t
state
)
{
{
struct
imxfb_info
*
fbi
=
platform_get_drvdata
(
dev
);
struct
imxfb_info
*
fbi
=
platform_get_drvdata
(
dev
);
pr_debug
(
"%s
\n
"
,
__func__
);
pr_debug
(
"%s
\n
"
,
__func__
);
imxfb_disable_controller
(
fbi
);
imxfb_disable_controller
(
fbi
);
return
0
;
return
0
;
...
@@ -504,7 +500,8 @@ static int imxfb_suspend(struct platform_device *dev, pm_message_t state)
...
@@ -504,7 +500,8 @@ static int imxfb_suspend(struct platform_device *dev, pm_message_t state)
static
int
imxfb_resume
(
struct
platform_device
*
dev
)
static
int
imxfb_resume
(
struct
platform_device
*
dev
)
{
{
struct
imxfb_info
*
fbi
=
platform_get_drvdata
(
dev
);
struct
imxfb_info
*
fbi
=
platform_get_drvdata
(
dev
);
pr_debug
(
"%s
\n
"
,
__func__
);
pr_debug
(
"%s
\n
"
,
__func__
);
imxfb_enable_controller
(
fbi
);
imxfb_enable_controller
(
fbi
);
return
0
;
return
0
;
...
@@ -522,7 +519,7 @@ static int __init imxfb_init_fbinfo(struct platform_device *pdev)
...
@@ -522,7 +519,7 @@ static int __init imxfb_init_fbinfo(struct platform_device *pdev)
pr_debug
(
"%s
\n
"
,
__func__
);
pr_debug
(
"%s
\n
"
,
__func__
);
info
->
pseudo_palette
=
kmalloc
(
sizeof
(
u32
)
*
16
,
GFP_KERNEL
);
info
->
pseudo_palette
=
kmalloc
(
sizeof
(
u32
)
*
16
,
GFP_KERNEL
);
if
(
!
info
->
pseudo_palette
)
if
(
!
info
->
pseudo_palette
)
return
-
ENOMEM
;
return
-
ENOMEM
;
...
@@ -530,22 +527,23 @@ static int __init imxfb_init_fbinfo(struct platform_device *pdev)
...
@@ -530,22 +527,23 @@ static int __init imxfb_init_fbinfo(struct platform_device *pdev)
strlcpy
(
info
->
fix
.
id
,
IMX_NAME
,
sizeof
(
info
->
fix
.
id
));
strlcpy
(
info
->
fix
.
id
,
IMX_NAME
,
sizeof
(
info
->
fix
.
id
));
info
->
fix
.
type
=
FB_TYPE_PACKED_PIXELS
;
info
->
fix
.
type
=
FB_TYPE_PACKED_PIXELS
;
info
->
fix
.
type_aux
=
0
;
info
->
fix
.
type_aux
=
0
;
info
->
fix
.
xpanstep
=
0
;
info
->
fix
.
xpanstep
=
0
;
info
->
fix
.
ypanstep
=
0
;
info
->
fix
.
ypanstep
=
0
;
info
->
fix
.
ywrapstep
=
0
;
info
->
fix
.
ywrapstep
=
0
;
info
->
fix
.
accel
=
FB_ACCEL_NONE
;
info
->
fix
.
accel
=
FB_ACCEL_NONE
;
info
->
var
.
nonstd
=
0
;
info
->
var
.
nonstd
=
0
;
info
->
var
.
activate
=
FB_ACTIVATE_NOW
;
info
->
var
.
activate
=
FB_ACTIVATE_NOW
;
info
->
var
.
height
=
-
1
;
info
->
var
.
height
=
-
1
;
info
->
var
.
width
=
-
1
;
info
->
var
.
width
=
-
1
;
info
->
var
.
accel_flags
=
0
;
info
->
var
.
accel_flags
=
0
;
info
->
var
.
vmode
=
FB_VMODE_NONINTERLACED
;
info
->
var
.
vmode
=
FB_VMODE_NONINTERLACED
;
info
->
fbops
=
&
imxfb_ops
;
info
->
fbops
=
&
imxfb_ops
;
info
->
flags
=
FBINFO_FLAG_DEFAULT
|
FBINFO_READS_FAST
;
info
->
flags
=
FBINFO_FLAG_DEFAULT
|
FBINFO_READS_FAST
;
fbi
->
rgb
[
RGB_16
]
=
&
def_rgb_16
;
fbi
->
rgb
[
RGB_16
]
=
&
def_rgb_16
;
fbi
->
rgb
[
RGB_8
]
=
&
def_rgb_8
;
fbi
->
rgb
[
RGB_8
]
=
&
def_rgb_8
;
...
@@ -593,17 +591,17 @@ static int __init imxfb_probe(struct platform_device *pdev)
...
@@ -593,17 +591,17 @@ static int __init imxfb_probe(struct platform_device *pdev)
printk
(
"i.MX Framebuffer driver
\n
"
);
printk
(
"i.MX Framebuffer driver
\n
"
);
res
=
platform_get_resource
(
pdev
,
IORESOURCE_MEM
,
0
);
res
=
platform_get_resource
(
pdev
,
IORESOURCE_MEM
,
0
);
if
(
!
res
)
if
(
!
res
)
return
-
ENODEV
;
return
-
ENODEV
;
inf
=
pdev
->
dev
.
platform_data
;
inf
=
pdev
->
dev
.
platform_data
;
if
(
!
inf
)
{
if
(
!
inf
)
{
dev_err
(
&
pdev
->
dev
,
"No platform_data available
\n
"
);
dev_err
(
&
pdev
->
dev
,
"No platform_data available
\n
"
);
return
-
ENOMEM
;
return
-
ENOMEM
;
}
}
info
=
framebuffer_alloc
(
sizeof
(
struct
imxfb_info
),
&
pdev
->
dev
);
info
=
framebuffer_alloc
(
sizeof
(
struct
imxfb_info
),
&
pdev
->
dev
);
if
(
!
info
)
if
(
!
info
)
return
-
ENOMEM
;
return
-
ENOMEM
;
fbi
=
info
->
par
;
fbi
=
info
->
par
;
...
@@ -611,7 +609,7 @@ static int __init imxfb_probe(struct platform_device *pdev)
...
@@ -611,7 +609,7 @@ static int __init imxfb_probe(struct platform_device *pdev)
platform_set_drvdata
(
pdev
,
info
);
platform_set_drvdata
(
pdev
,
info
);
ret
=
imxfb_init_fbinfo
(
pdev
);
ret
=
imxfb_init_fbinfo
(
pdev
);
if
(
ret
<
0
)
if
(
ret
<
0
)
goto
failed_init
;
goto
failed_init
;
res
=
request_mem_region
(
res
->
start
,
resource_size
(
res
),
res
=
request_mem_region
(
res
->
start
,
resource_size
(
res
),
...
@@ -658,7 +656,7 @@ static int __init imxfb_probe(struct platform_device *pdev)
...
@@ -658,7 +656,7 @@ static int __init imxfb_probe(struct platform_device *pdev)
*/
*/
imxfb_check_var
(
&
info
->
var
,
info
);
imxfb_check_var
(
&
info
->
var
,
info
);
ret
=
fb_alloc_cmap
(
&
info
->
cmap
,
1
<<
info
->
var
.
bits_per_pixel
,
0
);
ret
=
fb_alloc_cmap
(
&
info
->
cmap
,
1
<<
info
->
var
.
bits_per_pixel
,
0
);
if
(
ret
<
0
)
if
(
ret
<
0
)
goto
failed_cmap
;
goto
failed_cmap
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment