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
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
|
From adc957ce85d431da42dc42ed4074322d6c94932f Mon Sep 17 00:00:00 2001
From: Mark Hatle <mark.hatle@amd.com>
Date: Thu, 16 May 2024 20:31:29 -0600
Subject: [PATCH] Support both pre 6.4.0 and current i2c probing
Signed-off-by: Mark Hatle <mark.hatle@amd.com>
---
dp/xfmc/dp141.c | 13 +++++++++++++
dp/xfmc/fmc.c | 13 +++++++++++++
dp/xfmc/fmc64.c | 14 ++++++++++++++
dp/xfmc/fmc65.c | 13 +++++++++++++
dp/xfmc/idt.c | 21 +++++++++++++++++----
dp/xfmc/mcdp6000.c | 13 +++++++++++++
dp/xfmc/tipower.c | 13 +++++++++++++
7 files changed, 96 insertions(+), 4 deletions(-)
diff --git a/dp/xfmc/dp141.c b/dp/xfmc/dp141.c
index dfdb6f4..5fddd2b
--- a/dp/xfmc/dp141.c
+++ b/dp/xfmc/dp141.c
@@ -14,6 +14,7 @@
#include <linux/module.h>
#include <linux/regmap.h>
#include <linux/slab.h>
+#include <linux/version.h>
/**************************** Type Definitions *******************************/
@@ -105,7 +106,12 @@ static const struct i2c_device_id dp141_id[] = {
};
MODULE_DEVICE_TABLE(i2c, dp141_id);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 4, 0)
static int dp141_probe(struct i2c_client *client)
+#else
+static int dp141_probe(struct i2c_client *client,
+ const struct i2c_device_id *id)
+#endif
{
int ret;
@@ -134,9 +140,16 @@ err_regmap:
return ret;
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)
static void dp141_remove(struct i2c_client *client)
{
}
+#else
+static int dp141_remove(struct i2c_client *client)
+{
+ return 0;
+}
+#endif
static struct i2c_driver dp141_i2c_driver = {
.driver = {
diff --git a/dp/xfmc/fmc.c b/dp/xfmc/fmc.c
index 3447785..2ed136c
--- a/dp/xfmc/fmc.c
+++ b/dp/xfmc/fmc.c
@@ -14,6 +14,7 @@
#include <linux/module.h>
#include <linux/regmap.h>
#include <linux/slab.h>
+#include <linux/version.h>
/**************************** Type Definitions *******************************/
@@ -93,7 +94,12 @@ static const struct i2c_device_id fmc_id[] = {
};
MODULE_DEVICE_TABLE(i2c, fmc_id);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 4, 0)
static int fmc_probe(struct i2c_client *client)
+#else
+static int fmc_probe(struct i2c_client *client,
+ const struct i2c_device_id *id)
+#endif
{
int ret;
@@ -121,9 +127,16 @@ err_regmap:
return ret;
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)
static void fmc_remove(struct i2c_client *client)
{
}
+#else
+static int fmc_remove(struct i2c_client *client)
+{
+ return 0;
+}
+#endif
static struct i2c_driver fmc_i2c_driver = {
.driver = {
diff --git a/dp/xfmc/fmc64.c b/dp/xfmc/fmc64.c
index 6f5562c..a0bad7a
--- a/dp/xfmc/fmc64.c
+++ b/dp/xfmc/fmc64.c
@@ -14,6 +14,8 @@
#include <linux/module.h>
#include <linux/regmap.h>
#include <linux/slab.h>
+#include <linux/version.h>
+
/**************************** Type Definitions *******************************/
static const struct regmap_config fmc64_regmap_config = {
.reg_bits = 16,
@@ -89,7 +91,12 @@ static const struct i2c_device_id fmc64_id[] = {
};
MODULE_DEVICE_TABLE(i2c, fmc64_id);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 4, 0)
static int fmc64_probe(struct i2c_client *client)
+#else
+static int fmc64_probe(struct i2c_client *client,
+ const struct i2c_device_id *id)
+#endif
{
int ret;
@@ -118,9 +125,16 @@ err_regmap:
return ret;
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)
static void fmc64_remove(struct i2c_client *client)
{
}
+#else
+static int fmc64_remove(struct i2c_client *client)
+{
+ return 0;
+}
+#endif
static struct i2c_driver fmc64_i2c_driver = {
.driver = {
diff --git a/dp/xfmc/fmc65.c b/dp/xfmc/fmc65.c
index 9f091f9..ce7f884
--- a/dp/xfmc/fmc65.c
+++ b/dp/xfmc/fmc65.c
@@ -14,6 +14,7 @@
#include <linux/module.h>
#include <linux/regmap.h>
#include <linux/slab.h>
+#include <linux/version.h>
/**************************** Type Definitions *******************************/
@@ -91,7 +92,12 @@ static const struct i2c_device_id fmc65_id[] = {
};
MODULE_DEVICE_TABLE(i2c, fmc65_id);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 4, 0)
static int fmc65_probe(struct i2c_client *client)
+#else
+static int fmc65_probe(struct i2c_client *client,
+ const struct i2c_device_id *id)
+#endif
{
int ret;
@@ -120,9 +126,16 @@ err_regmap:
return ret;
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)
static void fmc65_remove(struct i2c_client *client)
{
}
+#else
+static int fmc65_remove(struct i2c_client *client)
+{
+ return 0;
+}
+#endif
static struct i2c_driver fmc65_i2c_driver = {
.driver = {
diff --git a/dp/xfmc/idt.c b/dp/xfmc/idt.c
index 348c863..f332277
--- a/dp/xfmc/idt.c
+++ b/dp/xfmc/idt.c
@@ -17,6 +17,7 @@
#include <linux/of_gpio.h>
#include <linux/regmap.h>
#include <linux/slab.h>
+#include <linux/version.h>
#define IDT_8T49N24X_REVID 0x0 /**< Device Revision */
#define IDT_8T49N24X_DEVID 0x0607 /**< Device ID Code */
@@ -38,8 +39,8 @@
#define IDT_8T49N24X_P_MAX pow(2, 22) //!< Maximum P divider value
#define IDT_8T49N24X_M_MAX pow(2, 24) //!< Maximum M multiplier value
-#define TRUE 1
-#define FALSE 0
+#define IDT_TRUE 1
+#define IDT_FALSE 0
#define XPAR_IIC_0_BASEADDR 0xA0080000
#define I2C_IDT8N49_ADDR 0x7C
/*
@@ -455,7 +456,7 @@ int IDT_8T49N24x_Init(void)
int ret = 0;
msleep_range(30);
- ret = idt_enable(FALSE);
+ ret = idt_enable(IDT_FALSE);
if (ret)
dev_dbg(&idt->client->dev,
"IDT_8T49N24x_enable 0 I2C progmming failed\n");
@@ -468,7 +469,7 @@ int IDT_8T49N24x_Init(void)
msleep_range(30);
/* enable DPLL and APLL calibration. */
- ret = idt_enable(TRUE);
+ ret = idt_enable(IDT_TRUE);
if (ret)
dev_dbg(&idt->client->dev,
"IDT_8T49N24x_enable 1 I2C progmming failed\n");
@@ -489,7 +490,12 @@ static const struct i2c_device_id idt_id[] = {
};
MODULE_DEVICE_TABLE(i2c, idt_id);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 4, 0)
static int idt_probe(struct i2c_client *client)
+#else
+static int idt_probe(struct i2c_client *client,
+ const struct i2c_device_id *id)
+#endif
{
int ret;
@@ -517,9 +523,16 @@ err_regmap:
return ret;
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)
static void idt_remove(struct i2c_client *client)
{
}
+#else
+static int idt_remove(struct i2c_client *client)
+{
+ return 0;
+}
+#endif
static struct i2c_driver idt_i2c_driver = {
.driver = {
diff --git a/dp/xfmc/mcdp6000.c b/dp/xfmc/mcdp6000.c
index 5a7c5b2..f13979b
--- a/dp/xfmc/mcdp6000.c
+++ b/dp/xfmc/mcdp6000.c
@@ -14,6 +14,7 @@
#include <linux/module.h>
#include <linux/regmap.h>
#include <linux/slab.h>
+#include <linux/version.h>
#define SWAP_BYTES(u32Value) ((u32Value & 0x000000FF) << 24)\
|((u32Value & 0x0000FF00) << 8) \
@@ -363,7 +364,12 @@ static const struct i2c_device_id mcdp6000_id[] = {
};
MODULE_DEVICE_TABLE(i2c, mcdp6000_id);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 4, 0)
static int mcdp6000_probe(struct i2c_client *client)
+#else
+static int mcdp6000_probe(struct i2c_client *client,
+ const struct i2c_device_id *id)
+#endif
{
int ret;
@@ -393,9 +399,16 @@ err_regmap:
return ret;
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)
static void mcdp6000_remove(struct i2c_client *client)
{
}
+#else
+static int mcdp6000_remove(struct i2c_client *client)
+{
+ return 0;
+}
+#endif
static struct i2c_driver mcdp6000_i2c_driver = {
.driver = {
diff --git a/dp/xfmc/tipower.c b/dp/xfmc/tipower.c
index 46c3de1..6d247a8
--- a/dp/xfmc/tipower.c
+++ b/dp/xfmc/tipower.c
@@ -14,6 +14,7 @@
#include <linux/module.h>
#include <linux/regmap.h>
#include <linux/slab.h>
+#include <linux/version.h>
/**************************** Type Definitions *******************************/
@@ -131,7 +132,12 @@ static const struct i2c_device_id tipower_id[] = {
};
MODULE_DEVICE_TABLE(i2c, tipower_id);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 4, 0)
static int tipower_probe(struct i2c_client *client)
+#else
+static int tipower_probe(struct i2c_client *client,
+ const struct i2c_device_id *id)
+#endif
{
int ret;
@@ -162,9 +168,16 @@ err_regmap:
return ret;
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)
static void tipower_remove(struct i2c_client *client)
{
}
+#else
+static int tipower_remove(struct i2c_client *client)
+{
+ return 0;
+}
+#endif
static struct i2c_driver tipower_i2c_driver = {
.driver = {
--
2.34.1
|