summaryrefstree
path: root/kernel/drivers/nfc/qti/nfc_i2c_drv.h
blob: 732c8ce1e3e7f64634a36d98da40398f56da63aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Copyright (c) 2015-2020, The Linux Foundation. All rights reserved.
 */

#ifndef _NFC_I2C_DRV_H_
#define _NFC_I2C_DRV_H_
#include <linux/i2c.h>

#define NFC_I2C_DRV_STR   "qcom,sn-nci"	/*kept same as dts */
#define NFC_I2C_DEV_ID		"sn-i2c"

struct nfc_dev;

//Interface specific parameters
struct i2c_dev {
	struct i2c_client *client;
	// IRQ parameters
	bool irq_enabled;
	spinlock_t irq_enabled_lock;
	// NFC_IRQ wake-up state
	bool irq_wake_up;
};
long nfc_i2c_dev_ioctl(struct file *pfile, unsigned int cmd, unsigned long arg);
int nfc_i2c_dev_probe(struct i2c_client *client,
		      const struct i2c_device_id *id);
int nfc_i2c_dev_remove(struct i2c_client *client);
int nfc_i2c_dev_suspend(struct device *device);
int nfc_i2c_dev_resume(struct device *device);

#if IS_ENABLED(CONFIG_NFC_QTI_I2C)

int i2c_enable_irq(struct nfc_dev *dev);
int i2c_disable_irq(struct nfc_dev *dev);
int i2c_write(struct nfc_dev *dev, const char *buf, size_t count,
						int max_retry_cnt);
int i2c_read(struct nfc_dev *dev, char *buf, size_t count);

#else

static inline int i2c_enable_irq(struct nfc_dev *dev)
{
	return -ENXIO;
}

static inline int i2c_disable_irq(struct nfc_dev *dev)
{
	return -ENXIO;
}

static inline int i2c_write(struct nfc_dev *dev, const char *buf,
					size_t count, int max_retry_cnt)
{
	return -ENXIO;
}

static inline int i2c_read(struct nfc_dev *dev, char *buf, size_t count)
{
	return -ENXIO;
}

#endif

#endif //_NFC_I2C_DRV_H_