i2c_drv.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /******************************************************************************
  2. * Copyright (C) 2015, The Linux Foundation. All rights reserved.
  3. * Copyright (C) 2019-2021 NXP
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  18. *
  19. ******************************************************************************/
  20. /*
  21. * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
  22. *
  23. ******************************************************************************/
  24. #ifndef _I2C_DRV_H_
  25. #define _I2C_DRV_H_
  26. #include <linux/i2c.h>
  27. #define NFC_I2C_DRV_STR "qcom,sn-nci" /*kept same as dts */
  28. #define NFC_I2C_DEV_ID "sn-i2c"
  29. struct nfc_dev;
  30. /* Interface specific parameters */
  31. struct i2c_dev {
  32. struct i2c_client *client;
  33. /* IRQ parameters */
  34. bool irq_enabled;
  35. spinlock_t irq_enabled_lock;
  36. /* NFC_IRQ wake-up state */
  37. bool irq_wake_up;
  38. };
  39. long nfc_i2c_dev_ioctl(struct file *pfile, unsigned int cmd, unsigned long arg);
  40. int nfc_i2c_dev_probe(struct i2c_client *client,
  41. const struct i2c_device_id *id);
  42. int nfc_i2c_dev_remove(struct i2c_client *client);
  43. int nfc_i2c_dev_suspend(struct device *device);
  44. int nfc_i2c_dev_resume(struct device *device);
  45. #if IS_ENABLED(CONFIG_NXP_NFC_I2C)
  46. int i2c_enable_irq(struct nfc_dev *dev);
  47. int i2c_disable_irq(struct nfc_dev *dev);
  48. int i2c_write(struct nfc_dev *dev, const char *buf, size_t count,
  49. int max_retry_cnt);
  50. int i2c_read(struct nfc_dev *dev, char *buf, size_t count, int timeout);
  51. #endif
  52. #endif //_I2C_DRV_H_