Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
a3201a0e
cloud-kernel
项目概览
openanolis
/
cloud-kernel
1 年多 前同步成功
通知
160
Star
36
Fork
7
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
10
列表
看板
标记
里程碑
合并请求
2
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
cloud-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
10
Issue
10
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
a3201a0e
编写于
3月 03, 2010
作者:
T
Tomi Valkeinen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
OMAP: DSS2: Taal: add mutex to protect panel data
Signed-off-by:
N
Tomi Valkeinen
<
tomi.valkeinen@nokia.com
>
上级
f49a951f
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
119 addition
and
21 deletion
+119
-21
drivers/video/omap2/displays/panel-taal.c
drivers/video/omap2/displays/panel-taal.c
+119
-21
未找到文件。
drivers/video/omap2/displays/panel-taal.c
浏览文件 @
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
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录