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
a3201a0e
Commit
a3201a0e
authored
Mar 03, 2010
by
Tomi Valkeinen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OMAP: DSS2: Taal: add mutex to protect panel data
Signed-off-by:
Tomi Valkeinen
<
tomi.valkeinen@nokia.com
>
parent
f49a951f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
119 additions
and
21 deletions
+119
-21
drivers/video/omap2/displays/panel-taal.c
drivers/video/omap2/displays/panel-taal.c
+119
-21
No files found.
drivers/video/omap2/displays/panel-taal.c
View file @
a3201a0e
...
...
@@ -31,6 +31,7 @@
#include <linux/completion.h>
#include <linux/workqueue.h>
#include <linux/slab.h>
#include <linux/mutex.h>
#include <plat/display.h>
...
...
@@ -67,6 +68,8 @@
static
int
_taal_enable_te
(
struct
omap_dss_device
*
dssdev
,
bool
enable
);
struct
taal_data
{
struct
mutex
lock
;
struct
backlight_device
*
bldev
;
unsigned
long
hw_guard_end
;
/* next value of jiffies when we can
...
...
@@ -510,6 +513,8 @@ static int taal_probe(struct omap_dss_device *dssdev)
}
td
->
dssdev
=
dssdev
;
mutex_init
(
&
td
->
lock
);
td
->
esd_wq
=
create_singlethread_workqueue
(
"taal_esd"
);
if
(
td
->
esd_wq
==
NULL
)
{
dev_err
(
&
dssdev
->
dev
,
"can't create ESD workqueue
\n
"
);
...
...
@@ -733,54 +738,96 @@ static void taal_power_off(struct omap_dss_device *dssdev)
static
int
taal_enable
(
struct
omap_dss_device
*
dssdev
)
{
struct
taal_data
*
td
=
dev_get_drvdata
(
&
dssdev
->
dev
);
int
r
;
dev_dbg
(
&
dssdev
->
dev
,
"enable
\n
"
);
if
(
dssdev
->
state
!=
OMAP_DSS_DISPLAY_DISABLED
)
return
-
EINVAL
;
mutex_lock
(
&
td
->
lock
);
if
(
dssdev
->
state
!=
OMAP_DSS_DISPLAY_DISABLED
)
{
r
=
-
EINVAL
;
goto
err
;
}
r
=
taal_power_on
(
dssdev
);
if
(
r
)
return
r
;
goto
er
r
;
dssdev
->
state
=
OMAP_DSS_DISPLAY_ACTIVE
;
mutex_unlock
(
&
td
->
lock
);
return
0
;
err:
dev_dbg
(
&
dssdev
->
dev
,
"enable failed
\n
"
);
mutex_unlock
(
&
td
->
lock
);
return
r
;
}
static
void
taal_disable
(
struct
omap_dss_device
*
dssdev
)
{
struct
taal_data
*
td
=
dev_get_drvdata
(
&
dssdev
->
dev
);
dev_dbg
(
&
dssdev
->
dev
,
"disable
\n
"
);
mutex_lock
(
&
td
->
lock
);
if
(
dssdev
->
state
==
OMAP_DSS_DISPLAY_ACTIVE
)
taal_power_off
(
dssdev
);
dssdev
->
state
=
OMAP_DSS_DISPLAY_DISABLED
;
mutex_unlock
(
&
td
->
lock
);
}
static
int
taal_suspend
(
struct
omap_dss_device
*
dssdev
)
{
struct
taal_data
*
td
=
dev_get_drvdata
(
&
dssdev
->
dev
);
int
r
;
dev_dbg
(
&
dssdev
->
dev
,
"suspend
\n
"
);
if
(
dssdev
->
state
!=
OMAP_DSS_DISPLAY_ACTIVE
)
return
-
EINVAL
;
mutex_lock
(
&
td
->
lock
);
if
(
dssdev
->
state
!=
OMAP_DSS_DISPLAY_ACTIVE
)
{
r
=
-
EINVAL
;
goto
err
;
}
taal_power_off
(
dssdev
);
dssdev
->
state
=
OMAP_DSS_DISPLAY_SUSPENDED
;
mutex_unlock
(
&
td
->
lock
);
return
0
;
err:
mutex_unlock
(
&
td
->
lock
);
return
r
;
}
static
int
taal_resume
(
struct
omap_dss_device
*
dssdev
)
{
struct
taal_data
*
td
=
dev_get_drvdata
(
&
dssdev
->
dev
);
int
r
;
dev_dbg
(
&
dssdev
->
dev
,
"resume
\n
"
);
if
(
dssdev
->
state
!=
OMAP_DSS_DISPLAY_SUSPENDED
)
return
-
EINVAL
;
mutex_lock
(
&
td
->
lock
);
if
(
dssdev
->
state
!=
OMAP_DSS_DISPLAY_SUSPENDED
)
{
r
=
-
EINVAL
;
goto
err
;
}
r
=
taal_power_on
(
dssdev
);
dssdev
->
state
=
OMAP_DSS_DISPLAY_ACTIVE
;
mutex_unlock
(
&
td
->
lock
);
return
r
;
err:
mutex_unlock
(
&
td
->
lock
);
return
r
;
}
...
...
@@ -799,6 +846,7 @@ static int taal_update(struct omap_dss_device *dssdev,
dev_dbg
(
&
dssdev
->
dev
,
"update %d, %d, %d x %d
\n
"
,
x
,
y
,
w
,
h
);
mutex_lock
(
&
td
->
lock
);
dsi_bus_lock
();
if
(
!
td
->
enabled
)
{
...
...
@@ -820,18 +868,24 @@ static int taal_update(struct omap_dss_device *dssdev,
goto
err
;
/* note: no bus_unlock here. unlock is in framedone_cb */
mutex_unlock
(
&
td
->
lock
);
return
0
;
err:
dsi_bus_unlock
();
mutex_unlock
(
&
td
->
lock
);
return
r
;
}
static
int
taal_sync
(
struct
omap_dss_device
*
dssdev
)
{
struct
taal_data
*
td
=
dev_get_drvdata
(
&
dssdev
->
dev
);
dev_dbg
(
&
dssdev
->
dev
,
"sync
\n
"
);
mutex_lock
(
&
td
->
lock
);
dsi_bus_lock
();
dsi_bus_unlock
();
mutex_unlock
(
&
td
->
lock
);
dev_dbg
(
&
dssdev
->
dev
,
"sync done
\n
"
);
...
...
@@ -861,13 +915,16 @@ static int _taal_enable_te(struct omap_dss_device *dssdev, bool enable)
static
int
taal_enable_te
(
struct
omap_dss_device
*
dssdev
,
bool
enable
)
{
struct
taal_data
*
td
=
dev_get_drvdata
(
&
dssdev
->
dev
);
int
r
;
mutex_lock
(
&
td
->
lock
);
dsi_bus_lock
();
r
=
_taal_enable_te
(
dssdev
,
enable
);
dsi_bus_unlock
();
mutex_unlock
(
&
td
->
lock
);
return
r
;
}
...
...
@@ -875,7 +932,13 @@ static int taal_enable_te(struct omap_dss_device *dssdev, bool enable)
static
int
taal_get_te
(
struct
omap_dss_device
*
dssdev
)
{
struct
taal_data
*
td
=
dev_get_drvdata
(
&
dssdev
->
dev
);
return
td
->
te_enabled
;
int
r
;
mutex_lock
(
&
td
->
lock
);
r
=
td
->
te_enabled
;
mutex_unlock
(
&
td
->
lock
);
return
r
;
}
static
int
taal_rotate
(
struct
omap_dss_device
*
dssdev
,
u8
rotate
)
...
...
@@ -885,6 +948,7 @@ static int taal_rotate(struct omap_dss_device *dssdev, u8 rotate)
dev_dbg
(
&
dssdev
->
dev
,
"rotate %d
\n
"
,
rotate
);
mutex_lock
(
&
td
->
lock
);
dsi_bus_lock
();
if
(
td
->
enabled
)
{
...
...
@@ -896,16 +960,24 @@ static int taal_rotate(struct omap_dss_device *dssdev, u8 rotate)
td
->
rotate
=
rotate
;
dsi_bus_unlock
();
mutex_unlock
(
&
td
->
lock
);
return
0
;
err:
dsi_bus_unlock
();
mutex_unlock
(
&
td
->
lock
);
return
r
;
}
static
u8
taal_get_rotate
(
struct
omap_dss_device
*
dssdev
)
{
struct
taal_data
*
td
=
dev_get_drvdata
(
&
dssdev
->
dev
);
return
td
->
rotate
;
int
r
;
mutex_lock
(
&
td
->
lock
);
r
=
td
->
rotate
;
mutex_unlock
(
&
td
->
lock
);
return
r
;
}
static
int
taal_mirror
(
struct
omap_dss_device
*
dssdev
,
bool
enable
)
...
...
@@ -915,6 +987,7 @@ static int taal_mirror(struct omap_dss_device *dssdev, bool enable)
dev_dbg
(
&
dssdev
->
dev
,
"mirror %d
\n
"
,
enable
);
mutex_lock
(
&
td
->
lock
);
dsi_bus_lock
();
if
(
td
->
enabled
)
{
r
=
taal_set_addr_mode
(
td
->
rotate
,
enable
);
...
...
@@ -925,23 +998,33 @@ static int taal_mirror(struct omap_dss_device *dssdev, bool enable)
td
->
mirror
=
enable
;
dsi_bus_unlock
();
mutex_unlock
(
&
td
->
lock
);
return
0
;
err:
dsi_bus_unlock
();
mutex_unlock
(
&
td
->
lock
);
return
r
;
}
static
bool
taal_get_mirror
(
struct
omap_dss_device
*
dssdev
)
{
struct
taal_data
*
td
=
dev_get_drvdata
(
&
dssdev
->
dev
);
return
td
->
mirror
;
int
r
;
mutex_lock
(
&
td
->
lock
);
r
=
td
->
mirror
;
mutex_unlock
(
&
td
->
lock
);
return
r
;
}
static
int
taal_run_test
(
struct
omap_dss_device
*
dssdev
,
int
test_num
)
{
struct
taal_data
*
td
=
dev_get_drvdata
(
&
dssdev
->
dev
);
u8
id1
,
id2
,
id3
;
int
r
;
mutex_lock
(
&
td
->
lock
);
dsi_bus_lock
();
r
=
taal_dcs_read_1
(
DCS_GET_ID1
,
&
id1
);
...
...
@@ -955,9 +1038,11 @@ static int taal_run_test(struct omap_dss_device *dssdev, int test_num)
goto
err
;
dsi_bus_unlock
();
mutex_unlock
(
&
td
->
lock
);
return
0
;
err:
dsi_bus_unlock
();
mutex_unlock
(
&
td
->
lock
);
return
r
;
}
...
...
@@ -971,12 +1056,16 @@ static int taal_memory_read(struct omap_dss_device *dssdev,
unsigned
buf_used
=
0
;
struct
taal_data
*
td
=
dev_get_drvdata
(
&
dssdev
->
dev
);
if
(
!
td
->
enabled
)
return
-
ENODEV
;
if
(
size
<
w
*
h
*
3
)
return
-
ENOMEM
;
mutex_lock
(
&
td
->
lock
);
if
(
!
td
->
enabled
)
{
r
=
-
ENODEV
;
goto
err1
;
}
size
=
min
(
w
*
h
*
3
,
dssdev
->
panel
.
timings
.
x_res
*
dssdev
->
panel
.
timings
.
y_res
*
3
);
...
...
@@ -995,7 +1084,7 @@ static int taal_memory_read(struct omap_dss_device *dssdev,
r
=
dsi_vc_set_max_rx_packet_size
(
TCH
,
plen
);
if
(
r
)
goto
err
0
;
goto
err
2
;
while
(
buf_used
<
size
)
{
u8
dcs_cmd
=
first
?
0x2e
:
0x3e
;
...
...
@@ -1006,7 +1095,7 @@ static int taal_memory_read(struct omap_dss_device *dssdev,
if
(
r
<
0
)
{
dev_err
(
&
dssdev
->
dev
,
"read error
\n
"
);
goto
err
;
goto
err
3
;
}
buf_used
+=
r
;
...
...
@@ -1020,16 +1109,18 @@ static int taal_memory_read(struct omap_dss_device *dssdev,
dev_err
(
&
dssdev
->
dev
,
"signal pending, "
"aborting memory read
\n
"
);
r
=
-
ERESTARTSYS
;
goto
err
;
goto
err
3
;
}
}
r
=
buf_used
;
err:
err
3
:
dsi_vc_set_max_rx_packet_size
(
TCH
,
1
);
err
0
:
err
2
:
dsi_bus_unlock
();
err1:
mutex_unlock
(
&
td
->
lock
);
return
r
;
}
...
...
@@ -1041,8 +1132,12 @@ static void taal_esd_work(struct work_struct *work)
u8
state1
,
state2
;
int
r
;
if
(
!
td
->
enabled
)
mutex_lock
(
&
td
->
lock
);
if
(
!
td
->
enabled
)
{
mutex_unlock
(
&
td
->
lock
);
return
;
}
dsi_bus_lock
();
...
...
@@ -1084,16 +1179,19 @@ static void taal_esd_work(struct work_struct *work)
queue_delayed_work
(
td
->
esd_wq
,
&
td
->
esd_work
,
TAAL_ESD_CHECK_PERIOD
);
mutex_unlock
(
&
td
->
lock
);
return
;
err:
dev_err
(
&
dssdev
->
dev
,
"performing LCD reset
\n
"
);
taal_
disable
(
dssdev
);
taal_
enable
(
dssdev
);
taal_
power_off
(
dssdev
);
taal_
power_on
(
dssdev
);
dsi_bus_unlock
();
queue_delayed_work
(
td
->
esd_wq
,
&
td
->
esd_work
,
TAAL_ESD_CHECK_PERIOD
);
mutex_unlock
(
&
td
->
lock
);
}
static
int
taal_set_update_mode
(
struct
omap_dss_device
*
dssdev
,
...
...
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