aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/mediatek/patches-5.15/433-drivers-spi-mem-Add-spi-calibration-hook.patch
blob: aaacab013129724a3bfd71da12c5d7daa4d4c877 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
From 06640a5da2973318c06e516da16a5b579622e7c5 Mon Sep 17 00:00:00 2001
From: "SkyLake.Huang" <skylake.huang@mediatek.com>
Date: Thu, 23 Jun 2022 18:37:55 +0800
Subject: [PATCH 3/6] drivers: spi-mem: Add spi calibration hook

Signed-off-by: SkyLake.Huang <skylake.huang@mediatek.com>
---
 drivers/spi/spi-mem.c       | 8 ++++++++
 include/linux/spi/spi-mem.h | 4 ++++
 2 files changed, 12 insertions(+)

--- a/drivers/spi/spi-mem.c
+++ b/drivers/spi/spi-mem.c
@@ -410,6 +410,14 @@ int spi_mem_exec_op(struct spi_mem *mem,
 }
 EXPORT_SYMBOL_GPL(spi_mem_exec_op);
 
+int spi_mem_do_calibration(struct spi_mem *mem,
+	int (*cal_read)(void *priv, u32 *addr, int addrlen, u8 *buf, int readlen),
+	void *priv)
+{
+	return spi_do_calibration(mem->spi->controller, mem->spi, cal_read, priv);
+}
+EXPORT_SYMBOL_GPL(spi_mem_do_calibration);
+
 /**
  * spi_mem_get_name() - Return the SPI mem device name to be used by the
  *			upper layer if necessary
--- a/include/linux/spi/spi-mem.h
+++ b/include/linux/spi/spi-mem.h
@@ -366,6 +366,10 @@ bool spi_mem_supports_op(struct spi_mem
 int spi_mem_exec_op(struct spi_mem *mem,
 		    const struct spi_mem_op *op);
 
+int spi_mem_do_calibration(struct spi_mem *mem,
+			int (*cal_read)(void *, u32 *, int, u8 *, int),
+			void *priv);
+
 const char *spi_mem_get_name(struct spi_mem *mem);
 
 struct spi_mem_dirmap_desc *