staging driver fixes for 4.3-rc7
Here are 4 iio driver fixes for 4.3-rc7, fixing some reported issues. All of these have been in linux-next for a while. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iEYEABECAAYFAlYqpboACgkQMUfUDdst+ynA4wCdHD56pe0cNCX4yNrcLMlXqVSK 7tUAoIMVLgr3Q8NOWhfGEyKIV5WBDd4U =bEcI -----END PGP SIGNATURE----- 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
This commit is contained in:
commit
4ee8019d3f
|
@ -149,8 +149,6 @@
|
|||
#define ST_ACCEL_4_BDU_MASK 0x40
|
||||
#define ST_ACCEL_4_DRDY_IRQ_ADDR 0x21
|
||||
#define ST_ACCEL_4_DRDY_IRQ_INT1_MASK 0x04
|
||||
#define ST_ACCEL_4_IG1_EN_ADDR 0x21
|
||||
#define ST_ACCEL_4_IG1_EN_MASK 0x08
|
||||
#define ST_ACCEL_4_MULTIREAD_BIT true
|
||||
|
||||
/* CUSTOM VALUES FOR SENSOR 5 */
|
||||
|
@ -489,10 +487,6 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = {
|
|||
.drdy_irq = {
|
||||
.addr = ST_ACCEL_4_DRDY_IRQ_ADDR,
|
||||
.mask_int1 = ST_ACCEL_4_DRDY_IRQ_INT1_MASK,
|
||||
.ig1 = {
|
||||
.en_addr = ST_ACCEL_4_IG1_EN_ADDR,
|
||||
.en_mask = ST_ACCEL_4_IG1_EN_MASK,
|
||||
},
|
||||
},
|
||||
.multi_read_bit = ST_ACCEL_4_MULTIREAD_BIT,
|
||||
.bootime = 2, /* guess */
|
||||
|
|
|
@ -45,13 +45,18 @@
|
|||
#include <linux/types.h>
|
||||
#include <linux/gfp.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/regulator/consumer.h>
|
||||
|
||||
#include <linux/iio/iio.h>
|
||||
|
||||
#define TWL4030_USB_SEL_MADC_MCPC (1<<3)
|
||||
#define TWL4030_USB_CARKIT_ANA_CTRL 0xBB
|
||||
|
||||
/**
|
||||
* struct twl4030_madc_data - a container for madc info
|
||||
* @dev: Pointer to device structure for madc
|
||||
* @lock: Mutex protecting this data structure
|
||||
* @regulator: Pointer to bias regulator for madc
|
||||
* @requests: Array of request struct corresponding to SW1, SW2 and RT
|
||||
* @use_second_irq: IRQ selection (main or co-processor)
|
||||
* @imr: Interrupt mask register of MADC
|
||||
|
@ -60,6 +65,7 @@
|
|||
struct twl4030_madc_data {
|
||||
struct device *dev;
|
||||
struct mutex lock; /* mutex protecting this data structure */
|
||||
struct regulator *usb3v1;
|
||||
struct twl4030_madc_request requests[TWL4030_MADC_NUM_METHODS];
|
||||
bool use_second_irq;
|
||||
u8 imr;
|
||||
|
@ -841,6 +847,32 @@ static int twl4030_madc_probe(struct platform_device *pdev)
|
|||
}
|
||||
twl4030_madc = madc;
|
||||
|
||||
/* Configure MADC[3:6] */
|
||||
ret = twl_i2c_read_u8(TWL_MODULE_USB, ®val,
|
||||
TWL4030_USB_CARKIT_ANA_CTRL);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "unable to read reg CARKIT_ANA_CTRL 0x%X\n",
|
||||
TWL4030_USB_CARKIT_ANA_CTRL);
|
||||
goto err_i2c;
|
||||
}
|
||||
regval |= TWL4030_USB_SEL_MADC_MCPC;
|
||||
ret = twl_i2c_write_u8(TWL_MODULE_USB, regval,
|
||||
TWL4030_USB_CARKIT_ANA_CTRL);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "unable to write reg CARKIT_ANA_CTRL 0x%X\n",
|
||||
TWL4030_USB_CARKIT_ANA_CTRL);
|
||||
goto err_i2c;
|
||||
}
|
||||
|
||||
/* Enable 3v1 bias regulator for MADC[3:6] */
|
||||
madc->usb3v1 = devm_regulator_get(madc->dev, "vusb3v1");
|
||||
if (IS_ERR(madc->usb3v1))
|
||||
return -ENODEV;
|
||||
|
||||
ret = regulator_enable(madc->usb3v1);
|
||||
if (ret)
|
||||
dev_err(madc->dev, "could not enable 3v1 bias regulator\n");
|
||||
|
||||
ret = iio_device_register(iio_dev);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "could not register iio device\n");
|
||||
|
@ -866,6 +898,8 @@ static int twl4030_madc_remove(struct platform_device *pdev)
|
|||
twl4030_madc_set_current_generator(madc, 0, 0);
|
||||
twl4030_madc_set_power(madc, 0);
|
||||
|
||||
regulator_disable(madc->usb3v1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -116,7 +116,7 @@ static int sca3000_read_first_n_hw_rb(struct iio_buffer *r,
|
|||
if (ret)
|
||||
goto error_ret;
|
||||
|
||||
for (i = 0; i < num_read; i++)
|
||||
for (i = 0; i < num_read / sizeof(u16); i++)
|
||||
*(((u16 *)rx) + i) = be16_to_cpup((__be16 *)rx + i);
|
||||
|
||||
if (copy_to_user(buf, rx, num_read))
|
||||
|
|
|
@ -915,11 +915,12 @@ static int mxs_lradc_read_raw(struct iio_dev *iio_dev,
|
|||
case IIO_CHAN_INFO_OFFSET:
|
||||
if (chan->type == IIO_TEMP) {
|
||||
/* The calculated value from the ADC is in Kelvin, we
|
||||
* want Celsius for hwmon so the offset is
|
||||
* -272.15 * scale
|
||||
* want Celsius for hwmon so the offset is -273.15
|
||||
* The offset is applied before scaling so it is
|
||||
* actually -213.15 * 4 / 1.012 = -1079.644268
|
||||
*/
|
||||
*val = -1075;
|
||||
*val2 = 691699;
|
||||
*val = -1079;
|
||||
*val2 = 644268;
|
||||
|
||||
return IIO_VAL_INT_PLUS_MICRO;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue