vsc-tp.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2023, Intel Corporation.
  4. * Intel Visual Sensing Controller Transport Layer Linux driver
  5. */
  6. #ifndef _VSC_TP_H_
  7. #define _VSC_TP_H_
  8. #include <linux/types.h>
  9. #define VSC_TP_CMD_WRITE 0x01
  10. #define VSC_TP_CMD_READ 0x02
  11. #define VSC_TP_CMD_ACK 0x10
  12. #define VSC_TP_CMD_NACK 0x11
  13. #define VSC_TP_CMD_BUSY 0x12
  14. struct vsc_tp;
  15. /**
  16. * typedef vsc_event_cb_t - event callback function signature
  17. * @context: the execution context of who registered this callback
  18. *
  19. * The callback function is called in interrupt context and the data
  20. * payload is only valid during the call. If the user needs access
  21. * the data payload later, it must copy the payload.
  22. */
  23. typedef void (*vsc_tp_event_cb_t)(void *context);
  24. int vsc_tp_rom_xfer(struct vsc_tp *tp, const void *obuf, void *ibuf,
  25. size_t len);
  26. int vsc_tp_xfer(struct vsc_tp *tp, u8 cmd, const void *obuf, size_t olen,
  27. void *ibuf, size_t ilen);
  28. int vsc_tp_register_event_cb(struct vsc_tp *tp, vsc_tp_event_cb_t event_cb,
  29. void *context);
  30. int vsc_tp_request_irq(struct vsc_tp *tp);
  31. void vsc_tp_free_irq(struct vsc_tp *tp);
  32. void vsc_tp_intr_enable(struct vsc_tp *tp);
  33. void vsc_tp_intr_disable(struct vsc_tp *tp);
  34. void vsc_tp_intr_synchronize(struct vsc_tp *tp);
  35. void vsc_tp_reset(struct vsc_tp *tp);
  36. bool vsc_tp_need_read(struct vsc_tp *tp);
  37. int vsc_tp_init(struct vsc_tp *tp, struct device *dev);
  38. #endif