Source
x
int st21nfca_hci_loopback_event_received(struct nfc_hci_dev *hdev, u8 event,
/*
* Proprietary commands extension for STMicroelectronics NFC Chip
*
* Copyright (C) 2014-2015 STMicroelectronics SAS. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
struct get_param_data {
u8 gate;
u8 data;
} __packed;
static int st21nfca_factory_mode(struct nfc_dev *dev, void *data,
size_t data_len)
{
struct nfc_hci_dev *hdev = nfc_get_drvdata(dev);
if (data_len != 1)
return -EINVAL;
pr_debug("factory mode: %x\n", ((u8 *)data)[0]);
switch (((u8 *)data)[0]) {
case ST21NFCA_FACTORY_MODE_ON:
test_and_set_bit(ST21NFCA_FACTORY_MODE, &hdev->quirks);
break;
case ST21NFCA_FACTORY_MODE_OFF:
clear_bit(ST21NFCA_FACTORY_MODE, &hdev->quirks);
break;
default:
return -EINVAL;
}
return 0;
}
static int st21nfca_hci_clear_all_pipes(struct nfc_dev *dev, void *data,
size_t data_len)
{
struct nfc_hci_dev *hdev = nfc_get_drvdata(dev);
return nfc_hci_disconnect_all_gates(hdev);
}
static int st21nfca_hci_dm_put_data(struct nfc_dev *dev, void *data,
size_t data_len)
{
struct nfc_hci_dev *hdev = nfc_get_drvdata(dev);
return nfc_hci_send_cmd(hdev, ST21NFCA_DEVICE_MGNT_GATE,
ST21NFCA_HCI_DM_PUTDATA, data,
data_len, NULL);
}
static int st21nfca_hci_dm_update_aid(struct nfc_dev *dev, void *data,
size_t data_len)
{
struct nfc_hci_dev *hdev = nfc_get_drvdata(dev);