433-drivers-spi-mem-Add-spi-calibration-hook.patch 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. From 06640a5da2973318c06e516da16a5b579622e7c5 Mon Sep 17 00:00:00 2001
  2. From: "SkyLake.Huang" <[email protected]>
  3. Date: Thu, 23 Jun 2022 18:37:55 +0800
  4. Subject: [PATCH 3/6] drivers: spi-mem: Add spi calibration hook
  5. Signed-off-by: SkyLake.Huang <[email protected]>
  6. ---
  7. drivers/spi/spi-mem.c | 8 ++++++++
  8. include/linux/spi/spi-mem.h | 4 ++++
  9. 2 files changed, 12 insertions(+)
  10. --- a/drivers/spi/spi-mem.c
  11. +++ b/drivers/spi/spi-mem.c
  12. @@ -419,6 +419,14 @@ int spi_mem_exec_op(struct spi_mem *mem,
  13. }
  14. EXPORT_SYMBOL_GPL(spi_mem_exec_op);
  15. +int spi_mem_do_calibration(struct spi_mem *mem,
  16. + int (*cal_read)(void *priv, u32 *addr, int addrlen, u8 *buf, int readlen),
  17. + void *priv)
  18. +{
  19. + return spi_do_calibration(mem->spi->controller, mem->spi, cal_read, priv);
  20. +}
  21. +EXPORT_SYMBOL_GPL(spi_mem_do_calibration);
  22. +
  23. /**
  24. * spi_mem_get_name() - Return the SPI mem device name to be used by the
  25. * upper layer if necessary
  26. --- a/include/linux/spi/spi-mem.h
  27. +++ b/include/linux/spi/spi-mem.h
  28. @@ -366,6 +366,10 @@ bool spi_mem_supports_op(struct spi_mem
  29. int spi_mem_exec_op(struct spi_mem *mem,
  30. const struct spi_mem_op *op);
  31. +int spi_mem_do_calibration(struct spi_mem *mem,
  32. + int (*cal_read)(void *, u32 *, int, u8 *, int),
  33. + void *priv);
  34. +
  35. const char *spi_mem_get_name(struct spi_mem *mem);
  36. struct spi_mem_dirmap_desc *