diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-10-23 18:51:13 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-10-23 18:51:13 -0400 |
commit | 4ee8019d3fdc6cce14129a954632c0f81d456884 (patch) | |
tree | 9b9061e01f1a57ee3572c2f80e01746a4f0eca7f | |
parent | 410694e214d5b479bc8b035ded0bb832f1c469b4 (diff) | |
parent | 4301de3b0ac4614fdf629fa414fb94f598e7ad6f (diff) |
Merge tag 'staging-4.3-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
Pull staging driver fixes from Greg KH:
"Here are four iio driver fixes for 4.3-rc7, fixing some reported
issues. All of these have been in linux-next for a while"
* tag 'staging-4.3-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging:
iio: mxs-lradc: Fix temperature offset
iio: accel: sca3000: memory corruption in sca3000_read_first_n_hw_rb()
iio: st_accel: fix interrupt handling on LIS3LV02
iio: adc: twl4030: Fix ADC[3:6] readings
-rw-r--r-- | drivers/iio/accel/st_accel_core.c | 6 | ||||
-rw-r--r-- | drivers/iio/adc/twl4030-madc.c | 34 | ||||
-rw-r--r-- | drivers/staging/iio/accel/sca3000_ring.c | 2 | ||||
-rw-r--r-- | drivers/staging/iio/adc/mxs-lradc.c | 9 |
4 files changed, 40 insertions, 11 deletions
diff --git a/drivers/iio/accel/st_accel_core.c b/drivers/iio/accel/st_accel_core.c index ff30f8806880..fb9311110424 100644 --- a/drivers/iio/accel/st_accel_core.c +++ b/drivers/iio/accel/st_accel_core.c | |||
@@ -149,8 +149,6 @@ | |||
149 | #define ST_ACCEL_4_BDU_MASK 0x40 | 149 | #define ST_ACCEL_4_BDU_MASK 0x40 |
150 | #define ST_ACCEL_4_DRDY_IRQ_ADDR 0x21 | 150 | #define ST_ACCEL_4_DRDY_IRQ_ADDR 0x21 |
151 | #define ST_ACCEL_4_DRDY_IRQ_INT1_MASK 0x04 | 151 | #define ST_ACCEL_4_DRDY_IRQ_INT1_MASK 0x04 |
152 | #define ST_ACCEL_4_IG1_EN_ADDR 0x21 | ||
153 | #define ST_ACCEL_4_IG1_EN_MASK 0x08 | ||
154 | #define ST_ACCEL_4_MULTIREAD_BIT true | 152 | #define ST_ACCEL_4_MULTIREAD_BIT true |
155 | 153 | ||
156 | /* CUSTOM VALUES FOR SENSOR 5 */ | 154 | /* CUSTOM VALUES FOR SENSOR 5 */ |
@@ -489,10 +487,6 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = { | |||
489 | .drdy_irq = { | 487 | .drdy_irq = { |
490 | .addr = ST_ACCEL_4_DRDY_IRQ_ADDR, | 488 | .addr = ST_ACCEL_4_DRDY_IRQ_ADDR, |
491 | .mask_int1 = ST_ACCEL_4_DRDY_IRQ_INT1_MASK, | 489 | .mask_int1 = ST_ACCEL_4_DRDY_IRQ_INT1_MASK, |
492 | .ig1 = { | ||
493 | .en_addr = ST_ACCEL_4_IG1_EN_ADDR, | ||
494 | .en_mask = ST_ACCEL_4_IG1_EN_MASK, | ||
495 | }, | ||
496 | }, | 490 | }, |
497 | .multi_read_bit = ST_ACCEL_4_MULTIREAD_BIT, | 491 | .multi_read_bit = ST_ACCEL_4_MULTIREAD_BIT, |
498 | .bootime = 2, /* guess */ | 492 | .bootime = 2, /* guess */ |
diff --git a/drivers/iio/adc/twl4030-madc.c b/drivers/iio/adc/twl4030-madc.c index ebe415f10640..0c74869a540a 100644 --- a/drivers/iio/adc/twl4030-madc.c +++ b/drivers/iio/adc/twl4030-madc.c | |||
@@ -45,13 +45,18 @@ | |||
45 | #include <linux/types.h> | 45 | #include <linux/types.h> |
46 | #include <linux/gfp.h> | 46 | #include <linux/gfp.h> |
47 | #include <linux/err.h> | 47 | #include <linux/err.h> |
48 | #include <linux/regulator/consumer.h> | ||
48 | 49 | ||
49 | #include <linux/iio/iio.h> | 50 | #include <linux/iio/iio.h> |
50 | 51 | ||
52 | #define TWL4030_USB_SEL_MADC_MCPC (1<<3) | ||
53 | #define TWL4030_USB_CARKIT_ANA_CTRL 0xBB | ||
54 | |||
51 | /** | 55 | /** |
52 | * struct twl4030_madc_data - a container for madc info | 56 | * struct twl4030_madc_data - a container for madc info |
53 | * @dev: Pointer to device structure for madc | 57 | * @dev: Pointer to device structure for madc |
54 | * @lock: Mutex protecting this data structure | 58 | * @lock: Mutex protecting this data structure |
59 | * @regulator: Pointer to bias regulator for madc | ||
55 | * @requests: Array of request struct corresponding to SW1, SW2 and RT | 60 | * @requests: Array of request struct corresponding to SW1, SW2 and RT |
56 | * @use_second_irq: IRQ selection (main or co-processor) | 61 | * @use_second_irq: IRQ selection (main or co-processor) |
57 | * @imr: Interrupt mask register of MADC | 62 | * @imr: Interrupt mask register of MADC |
@@ -60,6 +65,7 @@ | |||
60 | struct twl4030_madc_data { | 65 | struct twl4030_madc_data { |
61 | struct device *dev; | 66 | struct device *dev; |
62 | struct mutex lock; /* mutex protecting this data structure */ | 67 | struct mutex lock; /* mutex protecting this data structure */ |
68 | struct regulator *usb3v1; | ||
63 | struct twl4030_madc_request requests[TWL4030_MADC_NUM_METHODS]; | 69 | struct twl4030_madc_request requests[TWL4030_MADC_NUM_METHODS]; |
64 | bool use_second_irq; | 70 | bool use_second_irq; |
65 | u8 imr; | 71 | u8 imr; |
@@ -841,6 +847,32 @@ static int twl4030_madc_probe(struct platform_device *pdev) | |||
841 | } | 847 | } |
842 | twl4030_madc = madc; | 848 | twl4030_madc = madc; |
843 | 849 | ||
850 | /* Configure MADC[3:6] */ | ||
851 | ret = twl_i2c_read_u8(TWL_MODULE_USB, ®val, | ||
852 | TWL4030_USB_CARKIT_ANA_CTRL); | ||
853 | if (ret) { | ||
854 | dev_err(&pdev->dev, "unable to read reg CARKIT_ANA_CTRL 0x%X\n", | ||
855 | TWL4030_USB_CARKIT_ANA_CTRL); | ||
856 | goto err_i2c; | ||
857 | } | ||
858 | regval |= TWL4030_USB_SEL_MADC_MCPC; | ||
859 | ret = twl_i2c_write_u8(TWL_MODULE_USB, regval, | ||
860 | TWL4030_USB_CARKIT_ANA_CTRL); | ||
861 | if (ret) { | ||
862 | dev_err(&pdev->dev, "unable to write reg CARKIT_ANA_CTRL 0x%X\n", | ||
863 | TWL4030_USB_CARKIT_ANA_CTRL); | ||
864 | goto err_i2c; | ||
865 | } | ||
866 | |||
867 | /* Enable 3v1 bias regulator for MADC[3:6] */ | ||
868 | madc->usb3v1 = devm_regulator_get(madc->dev, "vusb3v1"); | ||
869 | if (IS_ERR(madc->usb3v1)) | ||
870 | return -ENODEV; | ||
871 | |||
872 | ret = regulator_enable(madc->usb3v1); | ||
873 | if (ret) | ||
874 | dev_err(madc->dev, "could not enable 3v1 bias regulator\n"); | ||
875 | |||
844 | ret = iio_device_register(iio_dev); | 876 | ret = iio_device_register(iio_dev); |
845 | if (ret) { | 877 | if (ret) { |
846 | dev_err(&pdev->dev, "could not register iio device\n"); | 878 | dev_err(&pdev->dev, "could not register iio device\n"); |
@@ -866,6 +898,8 @@ static int twl4030_madc_remove(struct platform_device *pdev) | |||
866 | twl4030_madc_set_current_generator(madc, 0, 0); | 898 | twl4030_madc_set_current_generator(madc, 0, 0); |
867 | twl4030_madc_set_power(madc, 0); | 899 | twl4030_madc_set_power(madc, 0); |
868 | 900 | ||
901 | regulator_disable(madc->usb3v1); | ||
902 | |||
869 | return 0; | 903 | return 0; |
870 | } | 904 | } |
871 | 905 | ||
diff --git a/drivers/staging/iio/accel/sca3000_ring.c b/drivers/staging/iio/accel/sca3000_ring.c index 23685e74917e..bd2c69f85949 100644 --- a/drivers/staging/iio/accel/sca3000_ring.c +++ b/drivers/staging/iio/accel/sca3000_ring.c | |||
@@ -116,7 +116,7 @@ static int sca3000_read_first_n_hw_rb(struct iio_buffer *r, | |||
116 | if (ret) | 116 | if (ret) |
117 | goto error_ret; | 117 | goto error_ret; |
118 | 118 | ||
119 | for (i = 0; i < num_read; i++) | 119 | for (i = 0; i < num_read / sizeof(u16); i++) |
120 | *(((u16 *)rx) + i) = be16_to_cpup((__be16 *)rx + i); | 120 | *(((u16 *)rx) + i) = be16_to_cpup((__be16 *)rx + i); |
121 | 121 | ||
122 | if (copy_to_user(buf, rx, num_read)) | 122 | if (copy_to_user(buf, rx, num_read)) |
diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c index 3f7715c9968b..47fc00a3f63b 100644 --- a/drivers/staging/iio/adc/mxs-lradc.c +++ b/drivers/staging/iio/adc/mxs-lradc.c | |||
@@ -915,11 +915,12 @@ static int mxs_lradc_read_raw(struct iio_dev *iio_dev, | |||
915 | case IIO_CHAN_INFO_OFFSET: | 915 | case IIO_CHAN_INFO_OFFSET: |
916 | if (chan->type == IIO_TEMP) { | 916 | if (chan->type == IIO_TEMP) { |
917 | /* The calculated value from the ADC is in Kelvin, we | 917 | /* The calculated value from the ADC is in Kelvin, we |
918 | * want Celsius for hwmon so the offset is | 918 | * want Celsius for hwmon so the offset is -273.15 |
919 | * -272.15 * scale | 919 | * The offset is applied before scaling so it is |
920 | * actually -213.15 * 4 / 1.012 = -1079.644268 | ||
920 | */ | 921 | */ |
921 | *val = -1075; | 922 | *val = -1079; |
922 | *val2 = 691699; | 923 | *val2 = 644268; |
923 | 924 | ||
924 | return IIO_VAL_INT_PLUS_MICRO; | 925 | return IIO_VAL_INT_PLUS_MICRO; |
925 | } | 926 | } |