| .. | .. |
|---|
| 11 | 11 | #include <linux/module.h> |
|---|
| 12 | 12 | #include <linux/i2c.h> |
|---|
| 13 | 13 | #include <linux/delay.h> |
|---|
| 14 | | -#include <linux/of.h> |
|---|
| 14 | +#include <linux/mod_devicetable.h> |
|---|
| 15 | 15 | #include <linux/regmap.h> |
|---|
| 16 | 16 | #include <linux/iio/iio.h> |
|---|
| 17 | 17 | #include <linux/iio/buffer.h> |
|---|
| .. | .. |
|---|
| 113 | 113 | return -EINVAL; |
|---|
| 114 | 114 | |
|---|
| 115 | 115 | /* delay till first temperature reading is complete */ |
|---|
| 116 | | - if ((state != channel) && (channel == LMP91000_REG_MODECN_TEMP)) |
|---|
| 116 | + if (state != channel && channel == LMP91000_REG_MODECN_TEMP) |
|---|
| 117 | 117 | usleep_range(3000, 4000); |
|---|
| 118 | 118 | |
|---|
| 119 | 119 | data->chan_select = channel != LMP91000_REG_MODECN_3LEAD; |
|---|
| .. | .. |
|---|
| 205 | 205 | static int lmp91000_read_config(struct lmp91000_data *data) |
|---|
| 206 | 206 | { |
|---|
| 207 | 207 | struct device *dev = data->dev; |
|---|
| 208 | | - struct device_node *np = dev->of_node; |
|---|
| 209 | 208 | unsigned int reg, val; |
|---|
| 210 | 209 | int i, ret; |
|---|
| 211 | 210 | |
|---|
| 212 | | - ret = of_property_read_u32(np, "ti,tia-gain-ohm", &val); |
|---|
| 211 | + ret = device_property_read_u32(dev, "ti,tia-gain-ohm", &val); |
|---|
| 213 | 212 | if (ret) { |
|---|
| 214 | | - if (of_property_read_bool(np, "ti,external-tia-resistor")) |
|---|
| 215 | | - val = 0; |
|---|
| 216 | | - else { |
|---|
| 217 | | - dev_err(dev, "no ti,tia-gain-ohm defined"); |
|---|
| 213 | + if (!device_property_read_bool(dev, "ti,external-tia-resistor")) { |
|---|
| 214 | + dev_err(dev, "no ti,tia-gain-ohm defined and external resistor not specified\n"); |
|---|
| 218 | 215 | return ret; |
|---|
| 219 | 216 | } |
|---|
| 217 | + val = 0; |
|---|
| 220 | 218 | } |
|---|
| 221 | 219 | |
|---|
| 222 | 220 | ret = -EINVAL; |
|---|
| .. | .. |
|---|
| 233 | 231 | return ret; |
|---|
| 234 | 232 | } |
|---|
| 235 | 233 | |
|---|
| 236 | | - ret = of_property_read_u32(np, "ti,rload-ohm", &val); |
|---|
| 234 | + ret = device_property_read_u32(dev, "ti,rload-ohm", &val); |
|---|
| 237 | 235 | if (ret) { |
|---|
| 238 | 236 | val = 100; |
|---|
| 239 | 237 | dev_info(dev, "no ti,rload-ohm defined, default to %d\n", val); |
|---|
| .. | .. |
|---|
| 255 | 253 | |
|---|
| 256 | 254 | regmap_write(data->regmap, LMP91000_REG_LOCK, 0); |
|---|
| 257 | 255 | regmap_write(data->regmap, LMP91000_REG_TIACN, reg); |
|---|
| 258 | | - regmap_write(data->regmap, LMP91000_REG_REFCN, LMP91000_REG_REFCN_EXT_REF |
|---|
| 259 | | - | LMP91000_REG_REFCN_50_ZERO); |
|---|
| 256 | + regmap_write(data->regmap, LMP91000_REG_REFCN, |
|---|
| 257 | + LMP91000_REG_REFCN_EXT_REF | LMP91000_REG_REFCN_50_ZERO); |
|---|
| 260 | 258 | regmap_write(data->regmap, LMP91000_REG_LOCK, 1); |
|---|
| 261 | 259 | |
|---|
| 262 | 260 | return 0; |
|---|
| .. | .. |
|---|
| 276 | 274 | static const struct iio_trigger_ops lmp91000_trigger_ops = { |
|---|
| 277 | 275 | }; |
|---|
| 278 | 276 | |
|---|
| 279 | | - |
|---|
| 280 | | -static int lmp91000_buffer_preenable(struct iio_dev *indio_dev) |
|---|
| 277 | +static int lmp91000_buffer_postenable(struct iio_dev *indio_dev) |
|---|
| 281 | 278 | { |
|---|
| 282 | 279 | struct lmp91000_data *data = iio_priv(indio_dev); |
|---|
| 283 | 280 | |
|---|
| .. | .. |
|---|
| 294 | 291 | } |
|---|
| 295 | 292 | |
|---|
| 296 | 293 | static const struct iio_buffer_setup_ops lmp91000_buffer_setup_ops = { |
|---|
| 297 | | - .preenable = lmp91000_buffer_preenable, |
|---|
| 298 | | - .postenable = iio_triggered_buffer_postenable, |
|---|
| 294 | + .postenable = lmp91000_buffer_postenable, |
|---|
| 299 | 295 | .predisable = lmp91000_buffer_predisable, |
|---|
| 300 | 296 | }; |
|---|
| 301 | 297 | |
|---|
| .. | .. |
|---|
| 315 | 311 | indio_dev->channels = lmp91000_channels; |
|---|
| 316 | 312 | indio_dev->num_channels = ARRAY_SIZE(lmp91000_channels); |
|---|
| 317 | 313 | indio_dev->name = LMP91000_DRV_NAME; |
|---|
| 318 | | - indio_dev->dev.parent = &client->dev; |
|---|
| 319 | 314 | indio_dev->modes = INDIO_DIRECT_MODE; |
|---|
| 320 | 315 | i2c_set_clientdata(client, indio_dev); |
|---|
| 321 | 316 | |
|---|
| .. | .. |
|---|
| 426 | 421 | static struct i2c_driver lmp91000_driver = { |
|---|
| 427 | 422 | .driver = { |
|---|
| 428 | 423 | .name = LMP91000_DRV_NAME, |
|---|
| 429 | | - .of_match_table = of_match_ptr(lmp91000_of_match), |
|---|
| 424 | + .of_match_table = lmp91000_of_match, |
|---|
| 430 | 425 | }, |
|---|
| 431 | 426 | .probe = lmp91000_probe, |
|---|
| 432 | 427 | .remove = lmp91000_remove, |
|---|