--- zzzz-none-000/linux-4.4.60/drivers/hwmon/lm75.c 2017-04-08 07:53:53.000000000 +0000 +++ dragonfly-4020-701/linux-4.4.60/drivers/hwmon/lm75.c 2018-11-08 13:36:17.000000000 +0000 @@ -29,6 +29,11 @@ #include #include #include + +#if IS_ENABLED(CONFIG_AVM_POWER) +#include +#endif + #include "lm75.h" @@ -89,6 +94,9 @@ 0 = input 1 = max 2 = hyst */ +#if IS_ENABLED(CONFIG_AVM_POWER) + void *avm_power_handle; +#endif }; static int lm75_read_value(struct i2c_client *client, u8 reg); @@ -182,6 +190,20 @@ .get_temp = lm75_read_temp, }; +#if IS_ENABLED(CONFIG_AVM_POWER) +static int lm75_avm_power_cb(void *handle, void *dev, int *temp) +{ + struct lm75_data *data = lm75_update_device(dev); + + if (IS_ERR(data)) + return PTR_ERR(data); + + *temp = lm75_reg_to_mc(data->temp[0], data->resolution) / 100; + + return 0; +} +#endif + /*-----------------------------------------------------------------------*/ /* device probe and removal */ @@ -312,6 +334,12 @@ if (IS_ERR(data->tz)) data->tz = NULL; +#if IS_ENABLED(CONFIG_AVM_POWER) + data->avm_power_handle = TemperaturSensorRegister(client->name, lm75_avm_power_cb, dev); + if (IS_ERR(data->avm_power_handle)) + data->avm_power_handle = NULL; +#endif + dev_info(dev, "%s: sensor '%s'\n", dev_name(data->hwmon_dev), client->name);