^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) #ifndef __LOCAL_MEI_PHY_H_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) #define __LOCAL_MEI_PHY_H_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) #include <linux/mei_cl_bus.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) #include <net/nfc/hci.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #include <linux/uuid.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #define MEI_NFC_UUID UUID_LE(0x0bb17a78, 0x2a8e, 0x4c50, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) 0x94, 0xd4, 0x50, 0x26, 0x67, 0x23, 0x77, 0x5c)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #define MEI_NFC_HEADER_SIZE 10
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #define MEI_NFC_MAX_HCI_PAYLOAD 300
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) * struct nfc_mei_phy
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) * @cldev: mei client device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) * @hdev: nfc hci device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) * @send_wq: send completion wait queue
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) * @fw_ivn: NFC Interface Version Number
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) * @vendor_id: NFC manufacturer ID
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) * @radio_type: NFC radio type
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) * @reserved: reserved for alignment
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) * @req_id: message counter
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) * @recv_req_id: reception message counter
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) * @powered: the device is in powered state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) * @hard_fault: < 0 if hardware error occurred
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) * and prevents normal operation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) struct nfc_mei_phy {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) struct mei_cl_device *cldev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) struct nfc_hci_dev *hdev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) wait_queue_head_t send_wq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) u8 fw_ivn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) u8 vendor_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) u8 radio_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) u8 reserved;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) u16 req_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) u16 recv_req_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) int powered;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) int hard_fault;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) extern struct nfc_phy_ops mei_phy_ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) struct nfc_mei_phy *nfc_mei_phy_alloc(struct mei_cl_device *device);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) void nfc_mei_phy_free(struct nfc_mei_phy *phy);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) #endif /* __LOCAL_MEI_PHY_H_ */