hc
2024-10-12 a5969cabbb4660eab42b6ef0412cbbd1200cf14d
kernel/drivers/i2c/busses/i2c-cros-ec-tunnel.c
....@@ -1,18 +1,13 @@
1
-/*
2
- * Copyright (C) 2013 Google, Inc
3
- *
4
- * This program is free software; you can redistribute it and/or modify
5
- * it under the terms of the GNU General Public License as published by
6
- * the Free Software Foundation; either version 2 of the License, or
7
- * (at your option) any later version.
8
- *
9
- * Expose an I2C passthrough to the ChromeOS EC.
10
- */
1
+// SPDX-License-Identifier: GPL-2.0+
2
+// Expose an I2C passthrough to the ChromeOS EC.
3
+//
4
+// Copyright (C) 2013 Google, Inc.
115
6
+#include <linux/acpi.h>
127 #include <linux/module.h>
138 #include <linux/i2c.h>
14
-#include <linux/mfd/cros_ec.h>
15
-#include <linux/mfd/cros_ec_commands.h>
9
+#include <linux/platform_data/cros_ec_commands.h>
10
+#include <linux/platform_data/cros_ec_proto.h>
1611 #include <linux/platform_device.h>
1712 #include <linux/slab.h>
1813
....@@ -246,7 +241,6 @@
246241
247242 static int ec_i2c_probe(struct platform_device *pdev)
248243 {
249
- struct device_node *np = pdev->dev.of_node;
250244 struct cros_ec_device *ec = dev_get_drvdata(pdev->dev.parent);
251245 struct device *dev = &pdev->dev;
252246 struct ec_i2c_device *bus = NULL;
....@@ -262,7 +256,7 @@
262256 if (bus == NULL)
263257 return -ENOMEM;
264258
265
- err = of_property_read_u32(np, "google,remote-bus", &remote_bus);
259
+ err = device_property_read_u32(dev, "google,remote-bus", &remote_bus);
266260 if (err) {
267261 dev_err(dev, "Couldn't read remote-bus property\n");
268262 return err;
....@@ -277,8 +271,9 @@
277271 bus->adap.algo = &ec_i2c_algorithm;
278272 bus->adap.algo_data = bus;
279273 bus->adap.dev.parent = &pdev->dev;
280
- bus->adap.dev.of_node = np;
274
+ bus->adap.dev.of_node = pdev->dev.of_node;
281275 bus->adap.retries = I2C_MAX_RETRIES;
276
+ ACPI_COMPANION_SET(&bus->adap.dev, ACPI_COMPANION(&pdev->dev));
282277
283278 err = i2c_add_adapter(&bus->adap);
284279 if (err)
....@@ -297,19 +292,24 @@
297292 return 0;
298293 }
299294
300
-#ifdef CONFIG_OF
301295 static const struct of_device_id cros_ec_i2c_of_match[] = {
302296 { .compatible = "google,cros-ec-i2c-tunnel" },
303297 {},
304298 };
305299 MODULE_DEVICE_TABLE(of, cros_ec_i2c_of_match);
306
-#endif
300
+
301
+static const struct acpi_device_id cros_ec_i2c_tunnel_acpi_id[] = {
302
+ { "GOOG0012", 0 },
303
+ { }
304
+};
305
+MODULE_DEVICE_TABLE(acpi, cros_ec_i2c_tunnel_acpi_id);
307306
308307 static struct platform_driver ec_i2c_tunnel_driver = {
309308 .probe = ec_i2c_probe,
310309 .remove = ec_i2c_remove,
311310 .driver = {
312311 .name = "cros-ec-i2c-tunnel",
312
+ .acpi_match_table = ACPI_PTR(cros_ec_i2c_tunnel_acpi_id),
313313 .of_match_table = of_match_ptr(cros_ec_i2c_of_match),
314314 },
315315 };