developer | 5d148cb | 2023-06-02 13:08:11 +0800 | [diff] [blame] | 1 | From 945b61ae2d00d59eacebb70496ce9bc530767929 Mon Sep 17 00:00:00 2001 |
| 2 | From: Sam Shih <sam.shih@mediatek.com> |
| 3 | Date: Fri, 2 Jun 2023 13:06:21 +0800 |
| 4 | Subject: [PATCH] |
| 5 | [spi-and-storage][999-2373-drivers-spi-mem-Add-spi-calibration-hook.patch] |
developer | 3c26b03 | 2022-06-23 19:02:08 +0800 | [diff] [blame] | 6 | |
developer | 3c26b03 | 2022-06-23 19:02:08 +0800 | [diff] [blame] | 7 | --- |
| 8 | drivers/spi/spi-mem.c | 8 ++++++++ |
| 9 | include/linux/spi/spi-mem.h | 4 ++++ |
| 10 | 2 files changed, 12 insertions(+) |
| 11 | |
| 12 | diff --git a/drivers/spi/spi-mem.c b/drivers/spi/spi-mem.c |
| 13 | index 33115bcfc..b5ab26e9c 100644 |
| 14 | --- a/drivers/spi/spi-mem.c |
| 15 | +++ b/drivers/spi/spi-mem.c |
| 16 | @@ -383,6 +383,14 @@ int spi_mem_exec_op(struct spi_mem *mem, const struct spi_mem_op *op) |
| 17 | } |
| 18 | EXPORT_SYMBOL_GPL(spi_mem_exec_op); |
| 19 | |
| 20 | +int spi_mem_do_calibration(struct spi_mem *mem, |
| 21 | + int (*cal_read)(void *priv, u32 *addr, int addrlen, u8 *buf, int readlen), |
| 22 | + void *priv) |
| 23 | +{ |
| 24 | + return spi_do_calibration(mem->spi->controller, mem->spi, cal_read, priv); |
| 25 | +} |
| 26 | +EXPORT_SYMBOL_GPL(spi_mem_do_calibration); |
| 27 | + |
| 28 | /** |
| 29 | * spi_mem_get_name() - Return the SPI mem device name to be used by the |
| 30 | * upper layer if necessary |
| 31 | diff --git a/include/linux/spi/spi-mem.h b/include/linux/spi/spi-mem.h |
| 32 | index af9ff2f0f..e2cde8305 100644 |
| 33 | --- a/include/linux/spi/spi-mem.h |
| 34 | +++ b/include/linux/spi/spi-mem.h |
| 35 | @@ -332,6 +332,10 @@ bool spi_mem_supports_op(struct spi_mem *mem, |
| 36 | int spi_mem_exec_op(struct spi_mem *mem, |
| 37 | const struct spi_mem_op *op); |
| 38 | |
| 39 | +int spi_mem_do_calibration(struct spi_mem *mem, |
| 40 | + int (*cal_read)(void *, u32 *, int, u8 *, int), |
| 41 | + void *priv); |
| 42 | + |
| 43 | const char *spi_mem_get_name(struct spi_mem *mem); |
| 44 | |
| 45 | struct spi_mem_dirmap_desc * |
| 46 | -- |
developer | 5d148cb | 2023-06-02 13:08:11 +0800 | [diff] [blame] | 47 | 2.34.1 |
developer | 3c26b03 | 2022-06-23 19:02:08 +0800 | [diff] [blame] | 48 | |