nfc: support tcmd test

TCMD use 32bit system, we need to add new
ioctl to make sure tcmd test pass

Change-Id: I255862644691755fb91727c5c0b856a3a80d3670
Signed-off-by: wuwl10 <wuwl10@motorola.com>
Reviewed-on: https://gerrit.mot.com/1791777
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
wuwl10 2020-11-03 11:18:18 +08:00 • committed by Xiaojun Ji
commit ae26b5ff07
3 changed files with 40 additions and 0 deletions

View file

@ -651,6 +651,40 @@ unsigned int nfc_ioctl_nfcc_info(struct file *filp, unsigned long arg)
*
* @return 0 on success, error code for failures.
*/
#ifdef CONFIG_COMPAT
long nfc_compat_dev_ioctl(struct file *pfile, unsigned int cmd, unsigned long arg)
{
int ret = 0;
struct nfc_dev *nfc_dev = pfile->private_data;
arg = (compat_u64)arg;
pr_debug("%s cmd = %x arg = %zx\n", __func__, cmd, arg);
switch (cmd) {
case NFC_SET_PWR:
ret = nfc_ioctl_power_states(nfc_dev, arg);
break;
case ESE_SET_PWR:
ret = nfc_ese_pwr(nfc_dev, arg);
break;
case ESE_GET_PWR:
ret = nfc_ese_pwr(nfc_dev, ESE_POWER_STATE);
break;
case NFCC_GET_INFO:
ret = nfc_ioctl_nfcc_info(pfile, arg);
break;
case NFC_GET_PLATFORM_TYPE:
ret = nfc_dev->interface;
break;
default:
pr_err("%s bad cmd %lu\n", __func__, arg);
ret = -ENOIOCTLCMD;
}
return ret;
}
#endif
long nfc_dev_ioctl(struct file *pfile, unsigned int cmd, unsigned long arg)
{
int ret = 0;

View file

@ -254,6 +254,9 @@ struct nfc_dev {
int nfc_dev_open(struct inode *inode, struct file *filp);
int nfc_dev_close(struct inode *inode, struct file *filp);
long nfc_dev_ioctl(struct file *pfile, unsigned int cmd, unsigned long arg);
#ifdef CONFIG_COMPAT
long nfc_compat_dev_ioctl(struct file *pfile, unsigned int cmd, unsigned long arg);
#endif
int nfc_parse_dt(struct device *dev, struct platform_gpio *nfc_gpio,
struct platform_ldo *ldo, uint8_t interface);
int nfc_misc_probe(struct nfc_dev *nfc_dev,

View file

@ -266,6 +266,9 @@ static const struct file_operations nfc_i2c_dev_fops = {
.open = nfc_dev_open,
.release = nfc_dev_close,
.unlocked_ioctl = nfc_dev_ioctl,
#ifdef CONFIG_COMPAT
.compat_ioctl = nfc_compat_dev_ioctl,
#endif
};
int nfc_i2c_dev_probe(struct i2c_client *client, const struct i2c_device_id *id)