Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+40 -11
-6
drivers/iio/accel/st_accel_core.c
··· 149 149 #define ST_ACCEL_4_BDU_MASK 0x40 150 150 #define ST_ACCEL_4_DRDY_IRQ_ADDR 0x21 151 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 152 #define ST_ACCEL_4_MULTIREAD_BIT true 155 153 156 154 /* CUSTOM VALUES FOR SENSOR 5 */ ··· 487 489 .drdy_irq = { 488 490 .addr = ST_ACCEL_4_DRDY_IRQ_ADDR, 489 491 .mask_int1 = ST_ACCEL_4_DRDY_IRQ_INT1_MASK, 490 - .ig1 = { 491 - .en_addr = ST_ACCEL_4_IG1_EN_ADDR, 492 - .en_mask = ST_ACCEL_4_IG1_EN_MASK, 493 - }, 494 492 }, 495 493 .multi_read_bit = ST_ACCEL_4_MULTIREAD_BIT, 496 494 .bootime = 2, /* guess */
+34
drivers/iio/adc/twl4030-madc.c
··· 45 45 #include <linux/types.h> 46 46 #include <linux/gfp.h> 47 47 #include <linux/err.h> 48 + #include <linux/regulator/consumer.h> 48 49 49 50 #include <linux/iio/iio.h> 51 + 52 + #define TWL4030_USB_SEL_MADC_MCPC (1<<3) 53 + #define TWL4030_USB_CARKIT_ANA_CTRL 0xBB 50 54 51 55 /** 52 56 * struct twl4030_madc_data - a container for madc info 53 57 * @dev: Pointer to device structure for madc 54 58 * @lock: Mutex protecting this data structure 59 + * @regulator: Pointer to bias regulator for madc 55 60 * @requests: Array of request struct corresponding to SW1, SW2 and RT 56 61 * @use_second_irq: IRQ selection (main or co-processor) 57 62 * @imr: Interrupt mask register of MADC ··· 65 60 struct twl4030_madc_data { 66 61 struct device *dev; 67 62 struct mutex lock; /* mutex protecting this data structure */ 63 + struct regulator *usb3v1; 68 64 struct twl4030_madc_request requests[TWL4030_MADC_NUM_METHODS]; 69 65 bool use_second_irq; 70 66 u8 imr; ··· 847 841 } 848 842 twl4030_madc = madc; 849 843 844 + /* Configure MADC[3:6] */ 845 + ret = twl_i2c_read_u8(TWL_MODULE_USB, &regval, 846 + TWL4030_USB_CARKIT_ANA_CTRL); 847 + if (ret) { 848 + dev_err(&pdev->dev, "unable to read reg CARKIT_ANA_CTRL 0x%X\n", 849 + TWL4030_USB_CARKIT_ANA_CTRL); 850 + goto err_i2c; 851 + } 852 + regval |= TWL4030_USB_SEL_MADC_MCPC; 853 + ret = twl_i2c_write_u8(TWL_MODULE_USB, regval, 854 + TWL4030_USB_CARKIT_ANA_CTRL); 855 + if (ret) { 856 + dev_err(&pdev->dev, "unable to write reg CARKIT_ANA_CTRL 0x%X\n", 857 + TWL4030_USB_CARKIT_ANA_CTRL); 858 + goto err_i2c; 859 + } 860 + 861 + /* Enable 3v1 bias regulator for MADC[3:6] */ 862 + madc->usb3v1 = devm_regulator_get(madc->dev, "vusb3v1"); 863 + if (IS_ERR(madc->usb3v1)) 864 + return -ENODEV; 865 + 866 + ret = regulator_enable(madc->usb3v1); 867 + if (ret) 868 + dev_err(madc->dev, "could not enable 3v1 bias regulator\n"); 869 + 850 870 ret = iio_device_register(iio_dev); 851 871 if (ret) { 852 872 dev_err(&pdev->dev, "could not register iio device\n"); ··· 897 865 898 866 twl4030_madc_set_current_generator(madc, 0, 0); 899 867 twl4030_madc_set_power(madc, 0); 868 + 869 + regulator_disable(madc->usb3v1); 900 870 901 871 return 0; 902 872 }
+1 -1
drivers/staging/iio/accel/sca3000_ring.c
··· 116 116 if (ret) 117 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 120 *(((u16 *)rx) + i) = be16_to_cpup((__be16 *)rx + i); 121 121 122 122 if (copy_to_user(buf, rx, num_read))
+5 -4
drivers/staging/iio/adc/mxs-lradc.c
··· 915 915 case IIO_CHAN_INFO_OFFSET: 916 916 if (chan->type == IIO_TEMP) { 917 917 /* The calculated value from the ADC is in Kelvin, we 918 - * want Celsius for hwmon so the offset is 919 - * -272.15 * scale 918 + * want Celsius for hwmon so the offset is -273.15 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 - *val2 = 691699; 922 + *val = -1079; 923 + *val2 = 644268; 923 924 924 925 return IIO_VAL_INT_PLUS_MICRO; 925 926 }