Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
fe7c5800
R
raspberrypi-kernel
项目概览
openeuler
/
raspberrypi-kernel
通知
13
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
raspberrypi-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
fe7c5800
编写于
5月 15, 2012
作者:
S
Samuel Ortiz
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
NFC: Add target mode protocols to the polling loop startup routine
Signed-off-by:
N
Samuel Ortiz
<
sameo@linux.intel.com
>
上级
ab73b751
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
77 addition
and
34 deletion
+77
-34
drivers/nfc/pn533.c
drivers/nfc/pn533.c
+29
-10
drivers/nfc/pn544_hci.c
drivers/nfc/pn544_hci.c
+6
-4
include/linux/nfc.h
include/linux/nfc.h
+4
-0
include/net/nfc/hci.h
include/net/nfc/hci.h
+2
-1
include/net/nfc/nfc.h
include/net/nfc/nfc.h
+2
-1
include/net/nfc/shdlc.h
include/net/nfc/shdlc.h
+2
-1
net/nfc/core.c
net/nfc/core.c
+5
-5
net/nfc/hci/core.c
net/nfc/hci/core.c
+3
-2
net/nfc/hci/shdlc.c
net/nfc/hci/shdlc.c
+4
-2
net/nfc/nci/core.c
net/nfc/nci/core.c
+4
-3
net/nfc/netlink.c
net/nfc/netlink.c
+15
-4
net/nfc/nfc.h
net/nfc/nfc.h
+1
-1
未找到文件。
drivers/nfc/pn533.c
浏览文件 @
fe7c5800
...
...
@@ -1078,27 +1078,23 @@ static int pn533_start_poll_complete(struct pn533 *dev, void *arg,
return
0
;
}
static
int
pn533_start_poll
(
struct
nfc_dev
*
nfc_dev
,
u32
protocols
)
static
int
pn533_init_target
(
struct
nfc_dev
*
nfc_dev
,
u32
protocols
)
{
return
0
;
}
static
int
pn533_start_im_poll
(
struct
nfc_dev
*
nfc_dev
,
u32
protocols
)
{
struct
pn533
*
dev
=
nfc_get_drvdata
(
nfc_dev
);
struct
pn533_poll_modulations
*
start_mod
;
int
rc
;
nfc_dev_dbg
(
&
dev
->
interface
->
dev
,
"%s - protocols=0x%x"
,
__func__
,
protocols
);
if
(
dev
->
poll_mod_count
)
{
nfc_dev_err
(
&
dev
->
interface
->
dev
,
"Polling operation already"
" active"
);
return
-
EBUSY
;
}
if
(
dev
->
tgt_active_prot
)
{
nfc_dev_err
(
&
dev
->
interface
->
dev
,
"Cannot poll with a target"
" already activated"
);
return
-
EBUSY
;
}
pn533_poll_create_mod_list
(
dev
,
protocols
);
if
(
!
dev
->
poll_mod_count
)
{
...
...
@@ -1135,6 +1131,29 @@ static int pn533_start_poll(struct nfc_dev *nfc_dev, u32 protocols)
return
rc
;
}
static
int
pn533_start_poll
(
struct
nfc_dev
*
nfc_dev
,
u32
im_protocols
,
u32
tm_protocols
)
{
struct
pn533
*
dev
=
nfc_get_drvdata
(
nfc_dev
);
nfc_dev_dbg
(
&
dev
->
interface
->
dev
,
"%s: im protocols 0x%x tm protocols 0x%x"
,
__func__
,
im_protocols
,
tm_protocols
);
if
(
dev
->
tgt_active_prot
)
{
nfc_dev_err
(
&
dev
->
interface
->
dev
,
"Cannot poll with a target already activated"
);
return
-
EBUSY
;
}
if
(
!
tm_protocols
)
return
pn533_start_im_poll
(
nfc_dev
,
im_protocols
);
else
if
(
!
im_protocols
)
return
pn533_init_target
(
nfc_dev
,
tm_protocols
);
else
return
-
EINVAL
;
}
static
void
pn533_stop_poll
(
struct
nfc_dev
*
nfc_dev
)
{
struct
pn533
*
dev
=
nfc_get_drvdata
(
nfc_dev
);
...
...
drivers/nfc/pn544_hci.c
浏览文件 @
fe7c5800
...
...
@@ -576,7 +576,8 @@ static int pn544_hci_xmit(struct nfc_shdlc *shdlc, struct sk_buff *skb)
return
pn544_hci_i2c_write
(
client
,
skb
->
data
,
skb
->
len
);
}
static
int
pn544_hci_start_poll
(
struct
nfc_shdlc
*
shdlc
,
u32
protocols
)
static
int
pn544_hci_start_poll
(
struct
nfc_shdlc
*
shdlc
,
u32
im_protocols
,
u32
tm_protocols
)
{
struct
nfc_hci_dev
*
hdev
=
nfc_shdlc_get_hci_dev
(
shdlc
);
u8
phases
=
0
;
...
...
@@ -584,7 +585,8 @@ static int pn544_hci_start_poll(struct nfc_shdlc *shdlc, u32 protocols)
u8
duration
[
2
];
u8
activated
;
pr_info
(
DRIVER_DESC
": %s protocols = %d
\n
"
,
__func__
,
protocols
);
pr_info
(
DRIVER_DESC
": %s protocols 0x%x 0x%x
\n
"
,
__func__
,
im_protocols
,
tm_protocols
);
r
=
nfc_hci_send_event
(
hdev
,
NFC_HCI_RF_READER_A_GATE
,
NFC_HCI_EVT_END_OPERATION
,
NULL
,
0
);
...
...
@@ -604,10 +606,10 @@ static int pn544_hci_start_poll(struct nfc_shdlc *shdlc, u32 protocols)
if
(
r
<
0
)
return
r
;
if
(
protocols
&
(
NFC_PROTO_ISO14443_MASK
|
NFC_PROTO_MIFARE_MASK
|
if
(
im_
protocols
&
(
NFC_PROTO_ISO14443_MASK
|
NFC_PROTO_MIFARE_MASK
|
NFC_PROTO_JEWEL_MASK
))
phases
|=
1
;
/* Type A */
if
(
protocols
&
NFC_PROTO_FELICA_MASK
)
{
if
(
im_
protocols
&
NFC_PROTO_FELICA_MASK
)
{
phases
|=
(
1
<<
2
);
/* Type F 212 */
phases
|=
(
1
<<
3
);
/* Type F 424 */
}
...
...
include/linux/nfc.h
浏览文件 @
fe7c5800
...
...
@@ -94,6 +94,8 @@ enum nfc_commands {
* @NFC_ATTR_TARGET_SENSF_RES: NFC-F targets extra information, max 18 bytes
* @NFC_ATTR_COMM_MODE: Passive or active mode
* @NFC_ATTR_RF_MODE: Initiator or target
* @NFC_ATTR_IM_PROTOCOLS: Initiator mode protocols to poll for
* @NFC_ATTR_TM_PROTOCOLS: Target mode protocols to listen for
*/
enum
nfc_attrs
{
NFC_ATTR_UNSPEC
,
...
...
@@ -109,6 +111,8 @@ enum nfc_attrs {
NFC_ATTR_COMM_MODE
,
NFC_ATTR_RF_MODE
,
NFC_ATTR_DEVICE_POWERED
,
NFC_ATTR_IM_PROTOCOLS
,
NFC_ATTR_TM_PROTOCOLS
,
/* private: internal use only */
__NFC_ATTR_AFTER_LAST
};
...
...
include/net/nfc/hci.h
浏览文件 @
fe7c5800
...
...
@@ -31,7 +31,8 @@ struct nfc_hci_ops {
void
(
*
close
)
(
struct
nfc_hci_dev
*
hdev
);
int
(
*
hci_ready
)
(
struct
nfc_hci_dev
*
hdev
);
int
(
*
xmit
)
(
struct
nfc_hci_dev
*
hdev
,
struct
sk_buff
*
skb
);
int
(
*
start_poll
)
(
struct
nfc_hci_dev
*
hdev
,
u32
protocols
);
int
(
*
start_poll
)
(
struct
nfc_hci_dev
*
hdev
,
u32
im_protocols
,
u32
tm_protocols
);
int
(
*
target_from_gate
)
(
struct
nfc_hci_dev
*
hdev
,
u8
gate
,
struct
nfc_target
*
target
);
int
(
*
complete_target_discovered
)
(
struct
nfc_hci_dev
*
hdev
,
u8
gate
,
...
...
include/net/nfc/nfc.h
浏览文件 @
fe7c5800
...
...
@@ -53,7 +53,8 @@ struct nfc_target;
struct
nfc_ops
{
int
(
*
dev_up
)(
struct
nfc_dev
*
dev
);
int
(
*
dev_down
)(
struct
nfc_dev
*
dev
);
int
(
*
start_poll
)(
struct
nfc_dev
*
dev
,
u32
protocols
);
int
(
*
start_poll
)(
struct
nfc_dev
*
dev
,
u32
im_protocols
,
u32
tm_protocols
);
void
(
*
stop_poll
)(
struct
nfc_dev
*
dev
);
int
(
*
dep_link_up
)(
struct
nfc_dev
*
dev
,
struct
nfc_target
*
target
,
u8
comm_mode
,
u8
*
gb
,
size_t
gb_len
);
...
...
include/net/nfc/shdlc.h
浏览文件 @
fe7c5800
...
...
@@ -27,7 +27,8 @@ struct nfc_shdlc_ops {
void
(
*
close
)
(
struct
nfc_shdlc
*
shdlc
);
int
(
*
hci_ready
)
(
struct
nfc_shdlc
*
shdlc
);
int
(
*
xmit
)
(
struct
nfc_shdlc
*
shdlc
,
struct
sk_buff
*
skb
);
int
(
*
start_poll
)
(
struct
nfc_shdlc
*
shdlc
,
u32
protocols
);
int
(
*
start_poll
)
(
struct
nfc_shdlc
*
shdlc
,
u32
im_protocols
,
u32
tm_protocols
);
int
(
*
target_from_gate
)
(
struct
nfc_shdlc
*
shdlc
,
u8
gate
,
struct
nfc_target
*
target
);
int
(
*
complete_target_discovered
)
(
struct
nfc_shdlc
*
shdlc
,
u8
gate
,
...
...
net/nfc/core.c
浏览文件 @
fe7c5800
...
...
@@ -121,14 +121,14 @@ int nfc_dev_down(struct nfc_dev *dev)
* The device remains polling for targets until a target is found or
* the nfc_stop_poll function is called.
*/
int
nfc_start_poll
(
struct
nfc_dev
*
dev
,
u32
protocols
)
int
nfc_start_poll
(
struct
nfc_dev
*
dev
,
u32
im_protocols
,
u32
tm_
protocols
)
{
int
rc
;
pr_debug
(
"dev_name
=%s protocols=
0x%x
\n
"
,
dev_name
(
&
dev
->
dev
),
protocols
);
pr_debug
(
"dev_name
%s initiator protocols 0x%x target protocols
0x%x
\n
"
,
dev_name
(
&
dev
->
dev
),
im_protocols
,
tm_
protocols
);
if
(
!
protocols
)
if
(
!
im_protocols
&&
!
tm_
protocols
)
return
-
EINVAL
;
device_lock
(
&
dev
->
dev
);
...
...
@@ -143,7 +143,7 @@ int nfc_start_poll(struct nfc_dev *dev, u32 protocols)
goto
error
;
}
rc
=
dev
->
ops
->
start_poll
(
dev
,
protocols
);
rc
=
dev
->
ops
->
start_poll
(
dev
,
im_protocols
,
tm_
protocols
);
if
(
!
rc
)
dev
->
polling
=
true
;
...
...
net/nfc/hci/core.c
浏览文件 @
fe7c5800
...
...
@@ -481,12 +481,13 @@ static int hci_dev_down(struct nfc_dev *nfc_dev)
return
0
;
}
static
int
hci_start_poll
(
struct
nfc_dev
*
nfc_dev
,
u32
protocols
)
static
int
hci_start_poll
(
struct
nfc_dev
*
nfc_dev
,
u32
im_protocols
,
u32
tm_protocols
)
{
struct
nfc_hci_dev
*
hdev
=
nfc_get_drvdata
(
nfc_dev
);
if
(
hdev
->
ops
->
start_poll
)
return
hdev
->
ops
->
start_poll
(
hdev
,
protocols
);
return
hdev
->
ops
->
start_poll
(
hdev
,
im_protocols
,
tm_
protocols
);
else
return
nfc_hci_send_event
(
hdev
,
NFC_HCI_RF_READER_A_GATE
,
NFC_HCI_EVT_READER_REQUESTED
,
NULL
,
0
);
...
...
net/nfc/hci/shdlc.c
浏览文件 @
fe7c5800
...
...
@@ -765,14 +765,16 @@ static int nfc_shdlc_xmit(struct nfc_hci_dev *hdev, struct sk_buff *skb)
return
0
;
}
static
int
nfc_shdlc_start_poll
(
struct
nfc_hci_dev
*
hdev
,
u32
protocols
)
static
int
nfc_shdlc_start_poll
(
struct
nfc_hci_dev
*
hdev
,
u32
im_protocols
,
u32
tm_protocols
)
{
struct
nfc_shdlc
*
shdlc
=
nfc_hci_get_clientdata
(
hdev
);
pr_debug
(
"
\n
"
);
if
(
shdlc
->
ops
->
start_poll
)
return
shdlc
->
ops
->
start_poll
(
shdlc
,
protocols
);
return
shdlc
->
ops
->
start_poll
(
shdlc
,
im_protocols
,
tm_protocols
);
return
0
;
}
...
...
net/nfc/nci/core.c
浏览文件 @
fe7c5800
...
...
@@ -387,7 +387,8 @@ static int nci_dev_down(struct nfc_dev *nfc_dev)
return
nci_close_device
(
ndev
);
}
static
int
nci_start_poll
(
struct
nfc_dev
*
nfc_dev
,
__u32
protocols
)
static
int
nci_start_poll
(
struct
nfc_dev
*
nfc_dev
,
__u32
im_protocols
,
__u32
tm_protocols
)
{
struct
nci_dev
*
ndev
=
nfc_get_drvdata
(
nfc_dev
);
int
rc
;
...
...
@@ -413,11 +414,11 @@ static int nci_start_poll(struct nfc_dev *nfc_dev, __u32 protocols)
return
-
EBUSY
;
}
rc
=
nci_request
(
ndev
,
nci_rf_discover_req
,
protocols
,
rc
=
nci_request
(
ndev
,
nci_rf_discover_req
,
im_
protocols
,
msecs_to_jiffies
(
NCI_RF_DISC_TIMEOUT
));
if
(
!
rc
)
ndev
->
poll_prots
=
protocols
;
ndev
->
poll_prots
=
im_
protocols
;
return
rc
;
}
...
...
net/nfc/netlink.c
浏览文件 @
fe7c5800
...
...
@@ -49,6 +49,8 @@ static const struct nla_policy nfc_genl_policy[NFC_ATTR_MAX + 1] = {
[
NFC_ATTR_COMM_MODE
]
=
{
.
type
=
NLA_U8
},
[
NFC_ATTR_RF_MODE
]
=
{
.
type
=
NLA_U8
},
[
NFC_ATTR_DEVICE_POWERED
]
=
{
.
type
=
NLA_U8
},
[
NFC_ATTR_IM_PROTOCOLS
]
=
{
.
type
=
NLA_U32
},
[
NFC_ATTR_TM_PROTOCOLS
]
=
{
.
type
=
NLA_U32
},
};
static
int
nfc_genl_send_target
(
struct
sk_buff
*
msg
,
struct
nfc_target
*
target
,
...
...
@@ -519,16 +521,25 @@ static int nfc_genl_start_poll(struct sk_buff *skb, struct genl_info *info)
struct
nfc_dev
*
dev
;
int
rc
;
u32
idx
;
u32
protocols
;
u32
im_protocols
=
0
,
tm_protocols
=
0
;
pr_debug
(
"Poll start
\n
"
);
if
(
!
info
->
attrs
[
NFC_ATTR_DEVICE_INDEX
]
||
!
info
->
attrs
[
NFC_ATTR_PROTOCOLS
])
((
!
info
->
attrs
[
NFC_ATTR_IM_PROTOCOLS
]
&&
!
info
->
attrs
[
NFC_ATTR_PROTOCOLS
])
&&
!
info
->
attrs
[
NFC_ATTR_TM_PROTOCOLS
]))
return
-
EINVAL
;
idx
=
nla_get_u32
(
info
->
attrs
[
NFC_ATTR_DEVICE_INDEX
]);
protocols
=
nla_get_u32
(
info
->
attrs
[
NFC_ATTR_PROTOCOLS
]);
if
(
info
->
attrs
[
NFC_ATTR_TM_PROTOCOLS
])
tm_protocols
=
nla_get_u32
(
info
->
attrs
[
NFC_ATTR_TM_PROTOCOLS
]);
else
if
(
info
->
attrs
[
NFC_ATTR_PROTOCOLS
])
tm_protocols
=
nla_get_u32
(
info
->
attrs
[
NFC_ATTR_PROTOCOLS
]);
if
(
info
->
attrs
[
NFC_ATTR_IM_PROTOCOLS
])
im_protocols
=
nla_get_u32
(
info
->
attrs
[
NFC_ATTR_IM_PROTOCOLS
]);
dev
=
nfc_get_device
(
idx
);
if
(
!
dev
)
...
...
@@ -536,7 +547,7 @@ static int nfc_genl_start_poll(struct sk_buff *skb, struct genl_info *info)
mutex_lock
(
&
dev
->
genl_data
.
genl_data_mutex
);
rc
=
nfc_start_poll
(
dev
,
protocols
);
rc
=
nfc_start_poll
(
dev
,
im_protocols
,
tm_
protocols
);
if
(
!
rc
)
dev
->
genl_data
.
poll_req_pid
=
info
->
snd_pid
;
...
...
net/nfc/nfc.h
浏览文件 @
fe7c5800
...
...
@@ -158,7 +158,7 @@ int nfc_dev_up(struct nfc_dev *dev);
int
nfc_dev_down
(
struct
nfc_dev
*
dev
);
int
nfc_start_poll
(
struct
nfc_dev
*
dev
,
u32
protocols
);
int
nfc_start_poll
(
struct
nfc_dev
*
dev
,
u32
im_protocols
,
u32
tm_
protocols
);
int
nfc_stop_poll
(
struct
nfc_dev
*
dev
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录