| @@ -21,8 +21,6 @@ · 20 unmodified lines |
| 21 | #include <linux/mutex.h> | 21 | #include <linux/mutex.h> |
| 22 | #include <linux/delay.h> | 22 | #include <linux/delay.h> |
| 23 | | 23 | |
| 24 | #include <linux/platform_data/ads1015.h> | | |
| 25 | | | |
| 26 | #include <linux/iio/iio.h> | 24 | #include <linux/iio/iio.h> |
| 27 | #include <linux/iio/types.h> | 25 | #include <linux/iio/types.h> |
| 28 | #include <linux/iio/sysfs.h> | 26 | #include <linux/iio/sysfs.h> |
| @@ -33,6 +31,8 @@ · 4 unmodified lines |
| 33 | | 31 | |
| 34 | #define ADS1015_DRV_NAME "ads1015" | 32 | #define ADS1015_DRV_NAME "ads1015" |
| 35 | | 33 | |
| | 34 | #define ADS1015_CHANNELS 8 |
| | 35 | |
| 36 | #define ADS1015_CONV_REG 0x00 | 36 | #define ADS1015_CONV_REG 0x00 |
| 37 | #define ADS1015_CFG_REG 0x01 | 37 | #define ADS1015_CFG_REG 0x01 |
| 38 | #define ADS1015_LO_THRESH_REG 0x02 | 38 | #define ADS1015_LO_THRESH_REG 0x02 |
| @@ -219,6 +219,12 @@ static const struct iio_event_spec ads1015_events[] = { · 180 unmodified lines |
| 219 | .datasheet_name = "AIN"#_chan"-AIN"#_chan2, \ | 219 | .datasheet_name = "AIN"#_chan"-AIN"#_chan2, \ |
| 220 | } | 220 | } |
| 221 | | 221 | |
| | 222 | struct ads1015_channel_data { |
| | 223 | bool enabled; |
| | 224 | unsigned int pga; |
| | 225 | unsigned int data_rate; |
| | 226 | }; |
| | 227 | |
| 222 | struct ads1015_thresh_data { | 228 | struct ads1015_thresh_data { |
| 223 | unsigned int comp_queue; | 229 | unsigned int comp_queue; |
| 224 | int high_thresh; | 230 | int high_thresh; |
| @@ -903,14 +909,6 @@ static void ads1015_get_channels_config(struct i2c_client *client) · 678 unmodified lines |
| 903 | | 909 | |
| 904 | struct iio_dev *indio_dev = i2c_get_clientdata(client); | 910 | struct iio_dev *indio_dev = i2c_get_clientdata(client); |
| 905 | struct ads1015_data *data = iio_priv(indio_dev); | 911 | struct ads1015_data *data = iio_priv(indio_dev); |
| 906 | struct ads1015_platform_data *pdata = dev_get_platdata(&client->dev); | | |
| 907 | | | |
| 908 | /* prefer platform data */ | | |
| 909 | if (pdata) { | | |
| 910 | memcpy(data->channel_data, pdata->channel_data, | | |
| 911 | sizeof(data->channel_data)); | | |
| 912 | return; | | |
| 913 | } | | |
| 914 | | 912 | |
| 915 | #ifdef CONFIG_OF | 913 | #ifdef CONFIG_OF |
| 916 | if (!ads1015_get_channels_config_of(client)) | 914 | if (!ads1015_get_channels_config_of(client)) |