@@ -18,6 +18,7 @@
#include <linux/hwmon-sysfs.h>
#include <linux/err.h>
#include <linux/mutex.h>
+#include <linux/platform_device.h>
/*
* Addresses to scan.
@@ -900,9 +901,8 @@ static int amc6821_init_client(struct i2c_client *client)
return 0;
}
-static int amc6821_probe(struct i2c_client *client)
+static int probe(struct device *dev, struct i2c_client *client)
{
- struct device *dev = &client->dev;
struct amc6821_data *data;
struct device *hwmon_dev;
int err;
@@ -927,6 +927,18 @@ static int amc6821_probe(struct i2c_client *client)
return PTR_ERR_OR_ZERO(hwmon_dev);
}
+static int amc6821_probe(struct i2c_client *client)
+{
+ return probe(&client->dev, client);
+}
+
+static int amc6821_platform_probe(struct platform_device *pdev)
+{
+ struct device *dev = &pdev->dev;
+
+ return probe(dev, to_i2c_client(dev->parent));
+}
+
static const struct i2c_device_id amc6821_id[] = {
{ "amc6821", amc6821 },
{ }
@@ -958,6 +970,16 @@ static struct i2c_driver amc6821_driver = {
module_i2c_driver(amc6821_driver);
+static struct platform_driver amc6821_platform_driver = {
+ .driver = {
+ .name = "amc6821",
+ .of_match_table = of_match_ptr(amc6821_of_match),
+ },
+ .probe = amc6821_platform_probe,
+};
+
+module_platform_driver(amc6821_platform_driver);
+
MODULE_LICENSE("GPL");
MODULE_AUTHOR("T. Mertelj <tomaz.mertelj@guest.arnes.si>");
MODULE_DESCRIPTION("Texas Instruments amc6821 hwmon driver");
Prepare for probing amc6821 in an I2C MFD device, by adding support to probing amc6821 as a platform device. Signed-off-by: Farouk Bouabid <farouk.bouabid@cherry.de> --- drivers/hwmon/amc6821.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-)