Skip to content

Commit

Permalink
Merge tag 'staging-4.8-rc5' of git://git.kernel.org/pub/scm/linux/ker…
Browse files Browse the repository at this point in the history
…nel/git/gregkh/staging

Pull staging/IIO driver fixes from Greg KH:
 "Here are a number of small fixes for staging and IIO drivers that
  resolve reported problems.

  Full details are in the shortlog.  All of these have been in
  linux-next with no reported issues"

* tag 'staging-4.8-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (35 commits)
  arm: dts: rockchip: add reset node for the exist saradc SoCs
  arm64: dts: rockchip: add reset saradc node for rk3368 SoCs
  iio: adc: rockchip_saradc: reset saradc controller before programming it
  iio: accel: kxsd9: Fix raw read return
  iio: adc: ti_am335x_adc: Increase timeout value waiting for ADC sample
  iio: adc: ti_am335x_adc: Protect FIFO1 from concurrent access
  include/linux: fix excess fence.h kernel-doc notation
  staging: wilc1000: correctly check if associatedsta has not been found
  staging: wilc1000: NULL dereference on error
  staging: wilc1000: txq_event: Fix coding error
  MAINTAINERS: Add file patterns for ion device tree bindings
  MAINTAINERS: Update maintainer entry for wilc1000
  iio: chemical: atlas-ph-sensor: fix typo in val assignment
  iio: fix sched WARNING "do not call blocking ops when !TASK_RUNNING"
  staging: comedi: ni_mio_common: fix AO inttrig backwards compatibility
  staging: comedi: dt2811: fix a precedence bug
  staging: comedi: adv_pci1760: Do not return EINVAL for CMDF_ROUND_DOWN.
  staging: comedi: ni_mio_common: fix wrong insn_write handler
  staging: comedi: comedi_test: fix timer race conditions
  staging: comedi: daqboard2000: bug fix board type matching code
  ...
  • Loading branch information
torvalds committed Sep 3, 2016
2 parents 39da979 + eafe5cf commit 018c81b
Show file tree
Hide file tree
Showing 38 changed files with 198 additions and 128 deletions.
7 changes: 7 additions & 0 deletions Documentation/devicetree/bindings/iio/adc/rockchip-saradc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,20 @@ Required properties:
- vref-supply: The regulator supply ADC reference voltage.
- #io-channel-cells: Should be 1, see ../iio-bindings.txt

Optional properties:
- resets: Must contain an entry for each entry in reset-names if need support
this option. See ../reset/reset.txt for details.
- reset-names: Must include the name "saradc-apb".

Example:
saradc: saradc@2006c000 {
compatible = "rockchip,saradc";
reg = <0x2006c000 0x100>;
interrupts = <GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&cru SCLK_SARADC>, <&cru PCLK_SARADC>;
clock-names = "saradc", "apb_pclk";
resets = <&cru SRST_SARADC>;
reset-names = "saradc-apb";
#io-channel-cells = <1>;
vref-supply = <&vcc18>;
};
9 changes: 3 additions & 6 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -798,6 +798,7 @@ M: Laura Abbott <[email protected]>
M: Sumit Semwal <[email protected]>
L: [email protected]
S: Supported
F: Documentation/devicetree/bindings/staging/ion/
F: drivers/staging/android/ion
F: drivers/staging/android/uapi/ion.h
F: drivers/staging/android/uapi/ion_test.h
Expand Down Expand Up @@ -11232,12 +11233,8 @@ S: Odd Fixes
F: drivers/staging/vt665?/

STAGING - WILC1000 WIFI DRIVER
M: Johnny Kim <[email protected]>
M: Austin Shin <[email protected]>
M: Chris Park <[email protected]>
M: Tony Cho <[email protected]>
M: Glen Lee <[email protected]>
M: Leo Kim <[email protected]>
M: Aditya Shankar <[email protected]>
M: Ganesh Krishna <[email protected]>
L: [email protected]
S: Supported
F: drivers/staging/wilc1000/
Expand Down
2 changes: 2 additions & 0 deletions arch/arm/boot/dts/rk3066a.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,8 @@
clock-names = "saradc", "apb_pclk";
interrupts = <GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH>;
#io-channel-cells = <1>;
resets = <&cru SRST_SARADC>;
reset-names = "saradc-apb";
status = "disabled";
};

Expand Down
2 changes: 2 additions & 0 deletions arch/arm/boot/dts/rk3288.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,8 @@
#io-channel-cells = <1>;
clocks = <&cru SCLK_SARADC>, <&cru PCLK_SARADC>;
clock-names = "saradc", "apb_pclk";
resets = <&cru SRST_SARADC>;
reset-names = "saradc-apb";
status = "disabled";
};

Expand Down
2 changes: 2 additions & 0 deletions arch/arm/boot/dts/rk3xxx.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,8 @@
#io-channel-cells = <1>;
clocks = <&cru SCLK_SARADC>, <&cru PCLK_SARADC>;
clock-names = "saradc", "apb_pclk";
resets = <&cru SRST_SARADC>;
reset-names = "saradc-apb";
status = "disabled";
};

Expand Down
2 changes: 2 additions & 0 deletions arch/arm64/boot/dts/rockchip/rk3368.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,8 @@
#io-channel-cells = <1>;
clocks = <&cru SCLK_SARADC>, <&cru PCLK_SARADC>;
clock-names = "saradc", "apb_pclk";
resets = <&cru SRST_SARADC>;
reset-names = "saradc-apb";
status = "disabled";
};

Expand Down
5 changes: 4 additions & 1 deletion drivers/iio/accel/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ config BMA180
config BMA220
tristate "Bosch BMA220 3-Axis Accelerometer Driver"
depends on SPI
select IIO_BUFFER
select IIO_TRIGGERED_BUFFER
help
Say yes here to add support for the Bosch BMA220 triaxial
acceleration sensor.
Expand Down Expand Up @@ -234,7 +236,8 @@ config STK8312
config STK8BA50
tristate "Sensortek STK8BA50 3-Axis Accelerometer Driver"
depends on I2C
depends on IIO_TRIGGER
select IIO_BUFFER
select IIO_TRIGGERED_BUFFER
help
Say yes here to get support for the Sensortek STK8BA50 3-axis
accelerometer.
Expand Down
2 changes: 1 addition & 1 deletion drivers/iio/accel/bma220_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ static int bma220_probe(struct spi_device *spi)
if (ret < 0)
return ret;

ret = iio_triggered_buffer_setup(indio_dev, NULL,
ret = iio_triggered_buffer_setup(indio_dev, iio_pollfunc_store_time,
bma220_trigger_handler, NULL);
if (ret < 0) {
dev_err(&spi->dev, "iio triggered buffer setup failed\n");
Expand Down
1 change: 1 addition & 0 deletions drivers/iio/accel/kxsd9.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ static int kxsd9_read_raw(struct iio_dev *indio_dev,
if (ret < 0)
goto error_ret;
*val = ret;
ret = IIO_VAL_INT;
break;
case IIO_CHAN_INFO_SCALE:
ret = spi_w8r8(st->us, KXSD9_READ(KXSD9_REG_CTRL_C));
Expand Down
1 change: 1 addition & 0 deletions drivers/iio/adc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,7 @@ config QCOM_SPMI_VADC
config ROCKCHIP_SARADC
tristate "Rockchip SARADC driver"
depends on ARCH_ROCKCHIP || (ARM && COMPILE_TEST)
depends on RESET_CONTROLLER
help
Say yes here to build support for the SARADC found in SoCs from
Rockchip.
Expand Down
1 change: 1 addition & 0 deletions drivers/iio/adc/ad799x.c
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,7 @@ static struct attribute_group ad799x_event_attrs_group = {
static const struct iio_info ad7991_info = {
.read_raw = &ad799x_read_raw,
.driver_module = THIS_MODULE,
.update_scan_mode = ad799x_update_scan_mode,
};

static const struct iio_info ad7993_4_7_8_noirq_info = {
Expand Down
4 changes: 2 additions & 2 deletions drivers/iio/adc/at91_adc.c
Original file line number Diff line number Diff line change
Expand Up @@ -381,8 +381,8 @@ static irqreturn_t at91_adc_rl_interrupt(int irq, void *private)
st->ts_bufferedmeasure = false;
input_report_key(st->ts_input, BTN_TOUCH, 0);
input_sync(st->ts_input);
} else if (status & AT91_ADC_EOC(3)) {
/* Conversion finished */
} else if (status & AT91_ADC_EOC(3) && st->ts_input) {
/* Conversion finished and we've a touchscreen */
if (st->ts_bufferedmeasure) {
/*
* Last measurement is always discarded, since it can
Expand Down
30 changes: 30 additions & 0 deletions drivers/iio/adc/rockchip_saradc.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
#include <linux/of_device.h>
#include <linux/clk.h>
#include <linux/completion.h>
#include <linux/delay.h>
#include <linux/reset.h>
#include <linux/regulator/consumer.h>
#include <linux/iio/iio.h>

Expand Down Expand Up @@ -53,6 +55,7 @@ struct rockchip_saradc {
struct clk *clk;
struct completion completion;
struct regulator *vref;
struct reset_control *reset;
const struct rockchip_saradc_data *data;
u16 last_val;
};
Expand Down Expand Up @@ -190,6 +193,16 @@ static const struct of_device_id rockchip_saradc_match[] = {
};
MODULE_DEVICE_TABLE(of, rockchip_saradc_match);

/**
* Reset SARADC Controller.
*/
static void rockchip_saradc_reset_controller(struct reset_control *reset)
{
reset_control_assert(reset);
usleep_range(10, 20);
reset_control_deassert(reset);
}

static int rockchip_saradc_probe(struct platform_device *pdev)
{
struct rockchip_saradc *info = NULL;
Expand Down Expand Up @@ -218,6 +231,20 @@ static int rockchip_saradc_probe(struct platform_device *pdev)
if (IS_ERR(info->regs))
return PTR_ERR(info->regs);

/*
* The reset should be an optional property, as it should work
* with old devicetrees as well
*/
info->reset = devm_reset_control_get(&pdev->dev, "saradc-apb");
if (IS_ERR(info->reset)) {
ret = PTR_ERR(info->reset);
if (ret != -ENOENT)
return ret;

dev_dbg(&pdev->dev, "no reset control found\n");
info->reset = NULL;
}

init_completion(&info->completion);

irq = platform_get_irq(pdev, 0);
Expand Down Expand Up @@ -252,6 +279,9 @@ static int rockchip_saradc_probe(struct platform_device *pdev)
return PTR_ERR(info->vref);
}

if (info->reset)
rockchip_saradc_reset_controller(info->reset);

/*
* Use a default value for the converter clock.
* This may become user-configurable in the future.
Expand Down
3 changes: 2 additions & 1 deletion drivers/iio/adc/ti-ads1015.c
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,8 @@ static struct iio_info ads1115_info = {
#ifdef CONFIG_OF
static int ads1015_get_channels_config_of(struct i2c_client *client)
{
struct ads1015_data *data = i2c_get_clientdata(client);
struct iio_dev *indio_dev = i2c_get_clientdata(client);
struct ads1015_data *data = iio_priv(indio_dev);
struct device_node *node;

if (!client->dev.of_node ||
Expand Down
16 changes: 12 additions & 4 deletions drivers/iio/adc/ti_am335x_adc.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

struct tiadc_device {
struct ti_tscadc_dev *mfd_tscadc;
struct mutex fifo1_lock; /* to protect fifo access */
int channels;
u8 channel_line[8];
u8 channel_step[8];
Expand Down Expand Up @@ -359,6 +360,7 @@ static int tiadc_read_raw(struct iio_dev *indio_dev,
int *val, int *val2, long mask)
{
struct tiadc_device *adc_dev = iio_priv(indio_dev);
int ret = IIO_VAL_INT;
int i, map_val;
unsigned int fifo1count, read, stepid;
bool found = false;
Expand All @@ -372,13 +374,14 @@ static int tiadc_read_raw(struct iio_dev *indio_dev,
if (!step_en)
return -EINVAL;

mutex_lock(&adc_dev->fifo1_lock);
fifo1count = tiadc_readl(adc_dev, REG_FIFO1CNT);
while (fifo1count--)
tiadc_readl(adc_dev, REG_FIFO1);

am335x_tsc_se_set_once(adc_dev->mfd_tscadc, step_en);

timeout = jiffies + usecs_to_jiffies
timeout = jiffies + msecs_to_jiffies
(IDLE_TIMEOUT * adc_dev->channels);
/* Wait for Fifo threshold interrupt */
while (1) {
Expand All @@ -388,7 +391,8 @@ static int tiadc_read_raw(struct iio_dev *indio_dev,

if (time_after(jiffies, timeout)) {
am335x_tsc_se_adc_done(adc_dev->mfd_tscadc);
return -EAGAIN;
ret = -EAGAIN;
goto err_unlock;
}
}
map_val = adc_dev->channel_step[chan->scan_index];
Expand All @@ -414,8 +418,11 @@ static int tiadc_read_raw(struct iio_dev *indio_dev,
am335x_tsc_se_adc_done(adc_dev->mfd_tscadc);

if (found == false)
return -EBUSY;
return IIO_VAL_INT;
ret = -EBUSY;

err_unlock:
mutex_unlock(&adc_dev->fifo1_lock);
return ret;
}

static const struct iio_info tiadc_info = {
Expand Down Expand Up @@ -483,6 +490,7 @@ static int tiadc_probe(struct platform_device *pdev)

tiadc_step_config(indio_dev);
tiadc_writel(adc_dev, REG_FIFO1THR, FIFO1_THRESHOLD);
mutex_init(&adc_dev->fifo1_lock);

err = tiadc_channel_init(indio_dev, adc_dev->channels);
if (err < 0)
Expand Down
2 changes: 1 addition & 1 deletion drivers/iio/chemical/atlas-ph-sensor.c
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ static int atlas_read_raw(struct iio_dev *indio_dev,
break;
case IIO_ELECTRICALCONDUCTIVITY:
*val = 1; /* 0.00001 */
*val = 100000;
*val2 = 100000;
break;
case IIO_CONCENTRATION:
*val = 0; /* 0.000000001 */
Expand Down
38 changes: 29 additions & 9 deletions drivers/iio/dac/stx104.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,16 @@ struct stx104_gpio {
unsigned int out_state;
};

/**
* struct stx104_dev - STX104 device private data structure
* @indio_dev: IIO device
* @chip: instance of the gpio_chip
*/
struct stx104_dev {
struct iio_dev *indio_dev;
struct gpio_chip *chip;
};

static int stx104_read_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan, int *val, int *val2, long mask)
{
Expand Down Expand Up @@ -107,6 +117,7 @@ static const struct iio_chan_spec stx104_channels[STX104_NUM_CHAN] = {
static int stx104_gpio_get_direction(struct gpio_chip *chip,
unsigned int offset)
{
/* GPIO 0-3 are input only, while the rest are output only */
if (offset < 4)
return 1;

Expand Down Expand Up @@ -169,6 +180,7 @@ static int stx104_probe(struct device *dev, unsigned int id)
struct iio_dev *indio_dev;
struct stx104_iio *priv;
struct stx104_gpio *stx104gpio;
struct stx104_dev *stx104dev;
int err;

indio_dev = devm_iio_device_alloc(dev, sizeof(*priv));
Expand All @@ -179,6 +191,10 @@ static int stx104_probe(struct device *dev, unsigned int id)
if (!stx104gpio)
return -ENOMEM;

stx104dev = devm_kzalloc(dev, sizeof(*stx104dev), GFP_KERNEL);
if (!stx104dev)
return -ENOMEM;

if (!devm_request_region(dev, base[id], STX104_EXTENT,
dev_name(dev))) {
dev_err(dev, "Unable to lock port addresses (0x%X-0x%X)\n",
Expand All @@ -199,12 +215,6 @@ static int stx104_probe(struct device *dev, unsigned int id)
outw(0, base[id] + 4);
outw(0, base[id] + 6);

err = devm_iio_device_register(dev, indio_dev);
if (err) {
dev_err(dev, "IIO device registering failed (%d)\n", err);
return err;
}

stx104gpio->chip.label = dev_name(dev);
stx104gpio->chip.parent = dev;
stx104gpio->chip.owner = THIS_MODULE;
Expand All @@ -220,22 +230,32 @@ static int stx104_probe(struct device *dev, unsigned int id)

spin_lock_init(&stx104gpio->lock);

dev_set_drvdata(dev, stx104gpio);
stx104dev->indio_dev = indio_dev;
stx104dev->chip = &stx104gpio->chip;
dev_set_drvdata(dev, stx104dev);

err = gpiochip_add_data(&stx104gpio->chip, stx104gpio);
if (err) {
dev_err(dev, "GPIO registering failed (%d)\n", err);
return err;
}

err = iio_device_register(indio_dev);
if (err) {
dev_err(dev, "IIO device registering failed (%d)\n", err);
gpiochip_remove(&stx104gpio->chip);
return err;
}

return 0;
}

static int stx104_remove(struct device *dev, unsigned int id)
{
struct stx104_gpio *const stx104gpio = dev_get_drvdata(dev);
struct stx104_dev *const stx104dev = dev_get_drvdata(dev);

gpiochip_remove(&stx104gpio->chip);
iio_device_unregister(stx104dev->indio_dev);
gpiochip_remove(stx104dev->chip);

return 0;
}
Expand Down
2 changes: 2 additions & 0 deletions drivers/iio/humidity/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ menu "Humidity sensors"
config AM2315
tristate "Aosong AM2315 relative humidity and temperature sensor"
depends on I2C
select IIO_BUFFER
select IIO_TRIGGERED_BUFFER
help
If you say yes here you get support for the Aosong AM2315
relative humidity and ambient temperature sensor.
Expand Down
Loading

0 comments on commit 018c81b

Please sign in to comment.