Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1552682
| From | Alexander Koch <mail@alexanderkoch.net> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v3 4/4] hwmon: adc128d818: Preserve operation mode |
| Date | 2017-01-06 11:50 +0100 |
| Message-ID | <sWAfU-w2-25@gated-at.bofh.it> (permalink) |
| References | <sWAfT-w2-7@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Preserve chip operation mode if no mode is specified via devicetree. This
enables operation when chip configuration is done by BIOS/ROMMON.
Signed-off-by: Alexander Koch <mail@alexanderkoch.net>
Acked-by: Michael Hornung <mhornung.linux@gmail.com>
---
drivers/hwmon/adc128d818.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/hwmon/adc128d818.c b/drivers/hwmon/adc128d818.c
index 0502af963f73..bbe3a5c5b3f5 100644
--- a/drivers/hwmon/adc128d818.c
+++ b/drivers/hwmon/adc128d818.c
@@ -491,7 +491,7 @@ static int adc128_probe(struct i2c_client *client,
data->vref = 2560; /* 2.56V, in mV */
}
- /* Operation mode is optional and defaults to mode 0 */
+ /* Operation mode is optional. If unspecified, keep current mode */
if (of_property_read_u8(dev->of_node, "ti,mode", &data->mode) == 0) {
if (data->mode > 3) {
dev_err(dev, "invalid operation mode %d\n",
@@ -500,7 +500,10 @@ static int adc128_probe(struct i2c_client *client,
goto error;
}
} else {
- data->mode = 0;
+ err = i2c_smbus_read_byte_data(client, ADC128_REG_CONFIG_ADV);
+ if (err < 0)
+ goto error;
+ data->mode = (err >> 1) & ADC128_REG_MASK;
}
data->client = client;
--
2.11.0
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v3 0/4] hwmon: adc128d818: Support missing operation modes Alexander Koch <mail@alexanderkoch.net> - 2017-01-06 11:50 +0100
[PATCH v3 4/4] hwmon: adc128d818: Preserve operation mode Alexander Koch <mail@alexanderkoch.net> - 2017-01-06 11:50 +0100
[PATCH v3 2/4] hwmon: adc128d818: Implement mode selection via dt Alexander Koch <mail@alexanderkoch.net> - 2017-01-06 11:50 +0100
[PATCH v3 1/4] devicetree: hwmon: Add bindings for ADC128D818 Alexander Koch <mail@alexanderkoch.net> - 2017-01-06 11:50 +0100
Re: [PATCH v3 1/4] devicetree: hwmon: Add bindings for ADC128D818 Rob Herring <robh@kernel.org> - 2017-01-10 06:40 +0100
Re: [PATCH v3 0/4] hwmon: adc128d818: Support missing operation modes Guenter Roeck <linux@roeck-us.net> - 2017-01-10 18:20 +0100
csiph-web