Commit 7bc4824e authored by Robert Dolca's avatar Robert Dolca Committed by Samuel Ortiz

NFC: nci: Introduce nci_core_cmd

This allows sending core commands from the driver. The driver
should be able to send NCI core commands like CORE_GET_CONFIG_CMD.
Signed-off-by: default avatarRobert Dolca <robert.dolca@intel.com>
Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent e4dbd625
...@@ -278,6 +278,7 @@ int nci_request(struct nci_dev *ndev, ...@@ -278,6 +278,7 @@ int nci_request(struct nci_dev *ndev,
unsigned long opt), unsigned long opt),
unsigned long opt, __u32 timeout); unsigned long opt, __u32 timeout);
int nci_prop_cmd(struct nci_dev *ndev, __u8 oid, size_t len, __u8 *payload); int nci_prop_cmd(struct nci_dev *ndev, __u8 oid, size_t len, __u8 *payload);
int nci_core_cmd(struct nci_dev *ndev, __u16 opcode, size_t len, __u8 *payload);
int nci_core_reset(struct nci_dev *ndev); int nci_core_reset(struct nci_dev *ndev);
int nci_core_init(struct nci_dev *ndev); int nci_core_init(struct nci_dev *ndev);
......
...@@ -325,32 +325,46 @@ static void nci_rf_deactivate_req(struct nci_dev *ndev, unsigned long opt) ...@@ -325,32 +325,46 @@ static void nci_rf_deactivate_req(struct nci_dev *ndev, unsigned long opt)
sizeof(struct nci_rf_deactivate_cmd), &cmd); sizeof(struct nci_rf_deactivate_cmd), &cmd);
} }
struct nci_prop_cmd_param { struct nci_cmd_param {
__u16 opcode; __u16 opcode;
size_t len; size_t len;
__u8 *payload; __u8 *payload;
}; };
static void nci_prop_cmd_req(struct nci_dev *ndev, unsigned long opt) static void nci_generic_req(struct nci_dev *ndev, unsigned long opt)
{ {
struct nci_prop_cmd_param *param = (struct nci_prop_cmd_param *)opt; struct nci_cmd_param *param =
(struct nci_cmd_param *)opt;
nci_send_cmd(ndev, param->opcode, param->len, param->payload); nci_send_cmd(ndev, param->opcode, param->len, param->payload);
} }
int nci_prop_cmd(struct nci_dev *ndev, __u8 oid, size_t len, __u8 *payload) int nci_prop_cmd(struct nci_dev *ndev, __u8 oid, size_t len, __u8 *payload)
{ {
struct nci_prop_cmd_param param; struct nci_cmd_param param;
param.opcode = nci_opcode_pack(NCI_GID_PROPRIETARY, oid); param.opcode = nci_opcode_pack(NCI_GID_PROPRIETARY, oid);
param.len = len; param.len = len;
param.payload = payload; param.payload = payload;
return __nci_request(ndev, nci_prop_cmd_req, (unsigned long)&param, return __nci_request(ndev, nci_generic_req, (unsigned long)&param,
msecs_to_jiffies(NCI_CMD_TIMEOUT)); msecs_to_jiffies(NCI_CMD_TIMEOUT));
} }
EXPORT_SYMBOL(nci_prop_cmd); EXPORT_SYMBOL(nci_prop_cmd);
int nci_core_cmd(struct nci_dev *ndev, __u16 opcode, size_t len, __u8 *payload)
{
struct nci_cmd_param param;
param.opcode = opcode;
param.len = len;
param.payload = payload;
return __nci_request(ndev, nci_generic_req, (unsigned long)&param,
msecs_to_jiffies(NCI_CMD_TIMEOUT));
}
EXPORT_SYMBOL(nci_core_cmd);
int nci_core_reset(struct nci_dev *ndev) int nci_core_reset(struct nci_dev *ndev)
{ {
return __nci_request(ndev, nci_reset_req, 0, return __nci_request(ndev, nci_reset_req, 0,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment