BigW Consortium Gitlab

Commit 6f0f2231 by Zahid Chowdhury

Merge branch 'master' of ssh://github.com/mangOH/mangOH

wlan2 changed to wlan1
parents 1e512007 270e63d3
...@@ -25,6 +25,10 @@ ...@@ -25,6 +25,10 @@
#define IIO_SUPPORTS_OVERSAMPLING_RATIO #define IIO_SUPPORTS_OVERSAMPLING_RATIO
#endif #endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0)
#define REGMAP_SUPPORTS_GET_DEVICE
#endif
struct bme680_calib { struct bme680_calib {
u16 par_t1; u16 par_t1;
s16 par_t2; s16 par_t2;
...@@ -67,6 +71,10 @@ struct bme680_data { ...@@ -67,6 +71,10 @@ struct bme680_data {
* and humidity compensation calculations. * and humidity compensation calculations.
*/ */
s32 t_fine; s32 t_fine;
#ifndef REGMAP_SUPPORTS_GET_DEVICE
struct device *dev;
#endif /* REGMAP_SUPPORTS_GET_DEVICE */
}; };
const struct regmap_config bme680_regmap_config = { const struct regmap_config bme680_regmap_config = {
...@@ -106,7 +114,11 @@ static const struct iio_chan_spec bme680_channels[] = { ...@@ -106,7 +114,11 @@ static const struct iio_chan_spec bme680_channels[] = {
static int bme680_read_calib(struct bme680_data *data, static int bme680_read_calib(struct bme680_data *data,
struct bme680_calib *calib) struct bme680_calib *calib)
{ {
#ifdef REGMAP_SUPPORTS_GET_DEVICE
struct device *dev = regmap_get_device(data->regmap); struct device *dev = regmap_get_device(data->regmap);
#else
struct device *dev = data->dev;
#endif
unsigned int tmp, tmp_msb, tmp_lsb; unsigned int tmp, tmp_msb, tmp_lsb;
int ret; int ret;
__le16 buf; __le16 buf;
...@@ -493,7 +505,11 @@ static u8 bme680_calc_heater_dur(u16 dur) ...@@ -493,7 +505,11 @@ static u8 bme680_calc_heater_dur(u16 dur)
static int bme680_set_mode(struct bme680_data *data, bool mode) static int bme680_set_mode(struct bme680_data *data, bool mode)
{ {
#ifdef REGMAP_SUPPORTS_GET_DEVICE
struct device *dev = regmap_get_device(data->regmap); struct device *dev = regmap_get_device(data->regmap);
#else
struct device *dev = data->dev;
#endif
int ret; int ret;
if (mode) { if (mode) {
...@@ -520,7 +536,11 @@ static u8 bme680_oversampling_to_reg(u8 val) ...@@ -520,7 +536,11 @@ static u8 bme680_oversampling_to_reg(u8 val)
static int bme680_chip_config(struct bme680_data *data) static int bme680_chip_config(struct bme680_data *data)
{ {
#ifdef REGMAP_SUPPORTS_GET_DEVICE
struct device *dev = regmap_get_device(data->regmap); struct device *dev = regmap_get_device(data->regmap);
#else
struct device *dev = data->dev;
#endif
int ret; int ret;
u8 osrs; u8 osrs;
...@@ -562,7 +582,11 @@ static int bme680_chip_config(struct bme680_data *data) ...@@ -562,7 +582,11 @@ static int bme680_chip_config(struct bme680_data *data)
static int bme680_gas_config(struct bme680_data *data) static int bme680_gas_config(struct bme680_data *data)
{ {
#ifdef REGMAP_SUPPORTS_GET_DEVICE
struct device *dev = regmap_get_device(data->regmap); struct device *dev = regmap_get_device(data->regmap);
#else
struct device *dev = data->dev;
#endif
int ret; int ret;
u8 heatr_res, heatr_dur; u8 heatr_res, heatr_dur;
...@@ -598,7 +622,11 @@ static int bme680_gas_config(struct bme680_data *data) ...@@ -598,7 +622,11 @@ static int bme680_gas_config(struct bme680_data *data)
static int bme680_read_temp(struct bme680_data *data, static int bme680_read_temp(struct bme680_data *data,
int *val, int *val2) int *val, int *val2)
{ {
#ifdef REGMAP_SUPPORTS_GET_DEVICE
struct device *dev = regmap_get_device(data->regmap); struct device *dev = regmap_get_device(data->regmap);
#else
struct device *dev = data->dev;
#endif
int ret; int ret;
__be32 tmp = 0; __be32 tmp = 0;
s32 adc_temp; s32 adc_temp;
...@@ -641,7 +669,11 @@ static int bme680_read_temp(struct bme680_data *data, ...@@ -641,7 +669,11 @@ static int bme680_read_temp(struct bme680_data *data,
static int bme680_read_press(struct bme680_data *data, static int bme680_read_press(struct bme680_data *data,
int *val, int *val2) int *val, int *val2)
{ {
#ifdef REGMAP_SUPPORTS_GET_DEVICE
struct device *dev = regmap_get_device(data->regmap); struct device *dev = regmap_get_device(data->regmap);
#else
struct device *dev = data->dev;
#endif
int ret; int ret;
__be32 tmp = 0; __be32 tmp = 0;
s32 adc_press; s32 adc_press;
...@@ -673,7 +705,11 @@ static int bme680_read_press(struct bme680_data *data, ...@@ -673,7 +705,11 @@ static int bme680_read_press(struct bme680_data *data,
static int bme680_read_humid(struct bme680_data *data, static int bme680_read_humid(struct bme680_data *data,
int *val, int *val2) int *val, int *val2)
{ {
#ifdef REGMAP_SUPPORTS_GET_DEVICE
struct device *dev = regmap_get_device(data->regmap); struct device *dev = regmap_get_device(data->regmap);
#else
struct device *dev = data->dev;
#endif
int ret; int ret;
__be16 tmp = 0; __be16 tmp = 0;
s32 adc_humidity; s32 adc_humidity;
...@@ -707,7 +743,11 @@ static int bme680_read_humid(struct bme680_data *data, ...@@ -707,7 +743,11 @@ static int bme680_read_humid(struct bme680_data *data,
static int bme680_read_gas(struct bme680_data *data, static int bme680_read_gas(struct bme680_data *data,
int *val) int *val)
{ {
#ifdef REGMAP_SUPPORTS_GET_DEVICE
struct device *dev = regmap_get_device(data->regmap); struct device *dev = regmap_get_device(data->regmap);
#else
struct device *dev = data->dev;
#endif
int ret; int ret;
__be16 tmp = 0; __be16 tmp = 0;
unsigned int check; unsigned int check;
...@@ -903,6 +943,9 @@ int bme680_core_probe(struct device *dev, struct regmap *regmap, ...@@ -903,6 +943,9 @@ int bme680_core_probe(struct device *dev, struct regmap *regmap,
data = iio_priv(indio_dev); data = iio_priv(indio_dev);
dev_set_drvdata(dev, indio_dev); dev_set_drvdata(dev, indio_dev);
data->regmap = regmap; data->regmap = regmap;
#ifndef REGMAP_SUPPORTS_GET_DEVICE
data->dev = dev;
#endif
indio_dev->dev.parent = dev; indio_dev->dev.parent = dev;
indio_dev->name = name; indio_dev->name = name;
indio_dev->channels = bme680_channels; indio_dev->channels = bme680_channels;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment