.. | .. |
---|
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. |
---|
11 | 5 | |
---|
| 6 | +#include <linux/acpi.h> |
---|
12 | 7 | #include <linux/module.h> |
---|
13 | 8 | #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> |
---|
16 | 11 | #include <linux/platform_device.h> |
---|
17 | 12 | #include <linux/slab.h> |
---|
18 | 13 | |
---|
.. | .. |
---|
246 | 241 | |
---|
247 | 242 | static int ec_i2c_probe(struct platform_device *pdev) |
---|
248 | 243 | { |
---|
249 | | - struct device_node *np = pdev->dev.of_node; |
---|
250 | 244 | struct cros_ec_device *ec = dev_get_drvdata(pdev->dev.parent); |
---|
251 | 245 | struct device *dev = &pdev->dev; |
---|
252 | 246 | struct ec_i2c_device *bus = NULL; |
---|
.. | .. |
---|
262 | 256 | if (bus == NULL) |
---|
263 | 257 | return -ENOMEM; |
---|
264 | 258 | |
---|
265 | | - err = of_property_read_u32(np, "google,remote-bus", &remote_bus); |
---|
| 259 | + err = device_property_read_u32(dev, "google,remote-bus", &remote_bus); |
---|
266 | 260 | if (err) { |
---|
267 | 261 | dev_err(dev, "Couldn't read remote-bus property\n"); |
---|
268 | 262 | return err; |
---|
.. | .. |
---|
277 | 271 | bus->adap.algo = &ec_i2c_algorithm; |
---|
278 | 272 | bus->adap.algo_data = bus; |
---|
279 | 273 | bus->adap.dev.parent = &pdev->dev; |
---|
280 | | - bus->adap.dev.of_node = np; |
---|
| 274 | + bus->adap.dev.of_node = pdev->dev.of_node; |
---|
281 | 275 | bus->adap.retries = I2C_MAX_RETRIES; |
---|
| 276 | + ACPI_COMPANION_SET(&bus->adap.dev, ACPI_COMPANION(&pdev->dev)); |
---|
282 | 277 | |
---|
283 | 278 | err = i2c_add_adapter(&bus->adap); |
---|
284 | 279 | if (err) |
---|
.. | .. |
---|
297 | 292 | return 0; |
---|
298 | 293 | } |
---|
299 | 294 | |
---|
300 | | -#ifdef CONFIG_OF |
---|
301 | 295 | static const struct of_device_id cros_ec_i2c_of_match[] = { |
---|
302 | 296 | { .compatible = "google,cros-ec-i2c-tunnel" }, |
---|
303 | 297 | {}, |
---|
304 | 298 | }; |
---|
305 | 299 | 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); |
---|
307 | 306 | |
---|
308 | 307 | static struct platform_driver ec_i2c_tunnel_driver = { |
---|
309 | 308 | .probe = ec_i2c_probe, |
---|
310 | 309 | .remove = ec_i2c_remove, |
---|
311 | 310 | .driver = { |
---|
312 | 311 | .name = "cros-ec-i2c-tunnel", |
---|
| 312 | + .acpi_match_table = ACPI_PTR(cros_ec_i2c_tunnel_acpi_id), |
---|
313 | 313 | .of_match_table = of_match_ptr(cros_ec_i2c_of_match), |
---|
314 | 314 | }, |
---|
315 | 315 | }; |
---|