This repository has been archived by the owner on Jan 26, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcs35l41.patch
226 lines (189 loc) · 7.17 KB
/
cs35l41.patch
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
From e5eca2fa7eb0038e4e0348d38c6e7e4ffe942587 Mon Sep 17 00:00:00 2001
From: Cristian Ciocaltea <[email protected]>
Date: Wed, 22 Jun 2022 00:38:19 +0300
Subject: [PATCH 1/6] ASoC: cs35l41: Add support for CLSA3541 ACPI device ID
Add support for the CLSA3541 ACPI device ID used on Valve's Steam Deck.
The driver is fully compatible with the indicated hardware, hence no
additional changes are required.
Signed-off-by: Cristian Ciocaltea <[email protected]>
Acked-by: David Rhodes <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Mark Brown <[email protected]>
---
sound/soc/codecs/cs35l41-spi.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/sound/soc/codecs/cs35l41-spi.c b/sound/soc/codecs/cs35l41-spi.c
index 9e19c946a66b..5c8bb24909eb 100644
--- a/sound/soc/codecs/cs35l41-spi.c
+++ b/sound/soc/codecs/cs35l41-spi.c
@@ -74,6 +74,7 @@ MODULE_DEVICE_TABLE(of, cs35l41_of_match);
#ifdef CONFIG_ACPI
static const struct acpi_device_id cs35l41_acpi_match[] = {
{ "CSC3541", 0 }, /* Cirrus Logic PnP ID + part ID */
+ { "CLSA3541", 0 }, /* Cirrus Logic PnP ID + part ID */
{},
};
MODULE_DEVICE_TABLE(acpi, cs35l41_acpi_match);
--
2.37.3
From daa62f4beb0eea18293fb1df63ccaab362c3e960 Mon Sep 17 00:00:00 2001
From: Cristian Ciocaltea <[email protected]>
Date: Tue, 5 Jul 2022 23:46:42 +0300
Subject: [PATCH 3/6] spi: amd: Make use of devm_spi_alloc_master()
Make use of the devm variant of spi_alloc_master() in order to cleanup
and simplify the error handling in the probe function by getting rid
of the goto statements.
Signed-off-by: Cristian Ciocaltea <[email protected]>
---
drivers/spi/spi-amd.c | 15 ++++-----------
1 file changed, 4 insertions(+), 11 deletions(-)
diff --git a/drivers/spi/spi-amd.c b/drivers/spi/spi-amd.c
index efdcbe6c4c26..3dc17a80c55c 100644
--- a/drivers/spi/spi-amd.c
+++ b/drivers/spi/spi-amd.c
@@ -281,10 +281,10 @@ static int amd_spi_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev;
struct spi_master *master;
struct amd_spi *amd_spi;
- int err = 0;
+ int err;
/* Allocate storage for spi_master and driver private data */
- master = spi_alloc_master(dev, sizeof(struct amd_spi));
+ master = devm_spi_alloc_master(dev, sizeof(struct amd_spi));
if (!master) {
dev_err(dev, "Error allocating SPI master\n");
return -ENOMEM;
@@ -295,7 +295,7 @@ static int amd_spi_probe(struct platform_device *pdev)
if (IS_ERR(amd_spi->io_remap_addr)) {
err = PTR_ERR(amd_spi->io_remap_addr);
dev_err(dev, "error %d ioremap of SPI registers failed\n", err);
- goto err_free_master;
+ return err;
}
dev_dbg(dev, "io_remap_address: %p\n", amd_spi->io_remap_addr);
@@ -313,15 +313,8 @@ static int amd_spi_probe(struct platform_device *pdev)
/* Register the controller with SPI framework */
err = devm_spi_register_master(dev, master);
- if (err) {
+ if (err)
dev_err(dev, "error %d registering SPI controller\n", err);
- goto err_free_master;
- }
-
- return 0;
-
-err_free_master:
- spi_master_put(master);
return err;
}
--
2.37.3
From 2c90c6053e37b270f8a60c48e49b92403bea74bb Mon Sep 17 00:00:00 2001
From: Cristian Ciocaltea <[email protected]>
Date: Wed, 6 Jul 2022 00:50:05 +0300
Subject: [PATCH 4/6] spi: amd: Make use of dev_err_probe()
Simplify the error handling in probe function by switching from
dev_err() to dev_err_probe().
Signed-off-by: Cristian Ciocaltea <[email protected]>
---
drivers/spi/spi-amd.c | 19 ++++++++-----------
1 file changed, 8 insertions(+), 11 deletions(-)
diff --git a/drivers/spi/spi-amd.c b/drivers/spi/spi-amd.c
index 3dc17a80c55c..1aa19a02a7b6 100644
--- a/drivers/spi/spi-amd.c
+++ b/drivers/spi/spi-amd.c
@@ -285,18 +285,15 @@ static int amd_spi_probe(struct platform_device *pdev)
/* Allocate storage for spi_master and driver private data */
master = devm_spi_alloc_master(dev, sizeof(struct amd_spi));
- if (!master) {
- dev_err(dev, "Error allocating SPI master\n");
- return -ENOMEM;
- }
+ if (!master)
+ return dev_err_probe(dev, -ENOMEM, "Error allocating SPI master\n");
amd_spi = spi_master_get_devdata(master);
amd_spi->io_remap_addr = devm_platform_ioremap_resource(pdev, 0);
- if (IS_ERR(amd_spi->io_remap_addr)) {
- err = PTR_ERR(amd_spi->io_remap_addr);
- dev_err(dev, "error %d ioremap of SPI registers failed\n", err);
- return err;
- }
+ if (IS_ERR(amd_spi->io_remap_addr))
+ return dev_err_probe(dev, PTR_ERR(amd_spi->io_remap_addr),
+ "ioremap of SPI registers failed\n");
+
dev_dbg(dev, "io_remap_address: %p\n", amd_spi->io_remap_addr);
amd_spi->version = (enum amd_spi_versions) device_get_match_data(dev);
@@ -314,9 +311,9 @@ static int amd_spi_probe(struct platform_device *pdev)
/* Register the controller with SPI framework */
err = devm_spi_register_master(dev, master);
if (err)
- dev_err(dev, "error %d registering SPI controller\n", err);
+ return dev_err_probe(dev, err, "error registering SPI controller\n");
- return err;
+ return 0;
}
#ifdef CONFIG_ACPI
--
2.37.3
From bdfe77cb6dbba7e4f5493788bcf46f56f80ac9fd Mon Sep 17 00:00:00 2001
From: Cristian Ciocaltea <[email protected]>
Date: Wed, 6 Jul 2022 01:27:42 +0300
Subject: [PATCH 5/6] spi: amd: Drop io_base_addr member from struct amd_spi
The io_base_addr member of struct amd_spi is not referenced anywhere
in the driver implementation and there is no indication that it could
be used in the future, hence drop it.
Signed-off-by: Cristian Ciocaltea <[email protected]>
---
drivers/spi/spi-amd.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/spi/spi-amd.c b/drivers/spi/spi-amd.c
index 1aa19a02a7b6..6eddb950e1ad 100644
--- a/drivers/spi/spi-amd.c
+++ b/drivers/spi/spi-amd.c
@@ -47,7 +47,6 @@ enum amd_spi_versions {
struct amd_spi {
void __iomem *io_remap_addr;
- unsigned long io_base_addr;
enum amd_spi_versions version;
};
--
2.37.3
From 40d5946557794a6302192ffd6e320c50989122f5 Mon Sep 17 00:00:00 2001
From: Cristian Ciocaltea <[email protected]>
Date: Wed, 6 Jul 2022 11:36:05 +0300
Subject: [PATCH 6/6] spi: amd: Add struct and enum kernel-doc comments
Provide documentation comments in the kernel-doc format
for enum amd_spi_versions and struct amd_spi.
Signed-off-by: Cristian Ciocaltea <[email protected]>
---
drivers/spi/spi-amd.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/drivers/spi/spi-amd.c b/drivers/spi/spi-amd.c
index 6eddb950e1ad..08df4f8d0531 100644
--- a/drivers/spi/spi-amd.c
+++ b/drivers/spi/spi-amd.c
@@ -40,11 +40,21 @@
#define AMD_SPI_XFER_TX 1
#define AMD_SPI_XFER_RX 2
+/**
+ * enum amd_spi_versions - SPI controller versions
+ * @AMD_SPI_V1: AMDI0061 hardware version
+ * @AMD_SPI_V2: AMDI0062 hardware version
+ */
enum amd_spi_versions {
- AMD_SPI_V1 = 1, /* AMDI0061 */
- AMD_SPI_V2, /* AMDI0062 */
+ AMD_SPI_V1 = 1,
+ AMD_SPI_V2,
};
+/**
+ * struct amd_spi - SPI driver instance
+ * @io_remap_addr: Start address of the SPI controller registers
+ * @version: SPI controller hardware version
+ */
struct amd_spi {
void __iomem *io_remap_addr;
enum amd_spi_versions version;
--
2.37.3