wcd-spi.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License version 2 and
  6. * only version 2 as published by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. */
  13. #ifndef __WCD_SPI_H__
  14. #define __WCD_SPI_H__
  15. struct wcd_spi_msg {
  16. /*
  17. * Caller's buffer pointer that holds data to
  18. * be transmitted in case of data_write and
  19. * data to be copied to in case of data_read.
  20. */
  21. void *data;
  22. /* Length of data to write/read */
  23. size_t len;
  24. /*
  25. * Address in remote memory to write to
  26. * or read from.
  27. */
  28. u32 remote_addr;
  29. /* Bitmask of flags, currently unused */
  30. u32 flags;
  31. };
  32. struct wcd_spi_ops {
  33. struct spi_device *spi_dev;
  34. int (*read_dev)(struct spi_device *spi, struct wcd_spi_msg *msg);
  35. int (*write_dev)(struct spi_device *spi, struct wcd_spi_msg *msg);
  36. };
  37. #endif /* End of __WCD_SPI_H__ */