1. 09 4月, 2017 5 次提交
    • L
      iio: adc: add a driver for Qualcomm PM8xxx HK/XOADC · 63c3ecd9
      Linus Walleij 提交于
      The Qualcomm PM8xxx PMICs contain a simpler ADC than its
      successors (already in the kernel as qcom-spmi-vadc.c):
      the HK/XO ADC (Housekeeping/Chrystal oscillator ADC).
      
      As far as I can understand this is equal to the PMICs
      using SSBI transport and encompass PM8018, PM8038,
      PM8058, and PM8921, so this is shortly named PM8xxx.
      
      This ADC monitors a bunch of on-board voltages and the die
      temperature of the PMIC itself, but it can also be routed
      to convert a few external MPPs (multi-purpose pins). On
      the APQ8060 DragonBoard this feature is used to let this
      ADC convert an analog ALS (Ambient Light Sensor) voltage
      signal from a Capella CM3605 ALS into a LUX value.
      
      Developed and tested with APQ8060 DragonBoard based on
      Ivan's driver and Rama Krishna's patches. The SPMI VADC
      driver is quite different, but share enough minor
      functionality that I have split out to the common file
      in a previous patch.
      
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: linux-arm-msm@vger.kernel.org
      Cc: Ivan T. Ivanov <iivanov.xz@gmail.com>
      Cc: Andy Gross <andy.gross@linaro.org>
      Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
      Cc: Stephen Boyd <sboyd@codeaurora.org>
      Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
      Cc: Rama Krishna Phani A <rphani@codeaurora.org>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: NJonathan Cameron <jic23@kernel.org>
      63c3ecd9
    • L
      iio: adc: break out common code from SPMI VADC · e932d4f0
      Linus Walleij 提交于
      The SPMI VADC and the earlier XOADC share a subset of
      common code, so to be able to use the same code in both
      drivers, we break out a separate file with the common code,
      prefix exported functions that are no longer static with
      qcom_* and bake an object qcom-spmi-vadc.o that contains both
      files: qcom-vadc-common.o and qcom-spmi-vadc-core.o.
      
      As we need to follow the procedure for making a kernel module
      or compiled in object from several files, but still want to
      produce the same module name, rename the qcom-spmi-vadc.c
      file to qcom-spmi-vadc-core.c so we can bake the two objects
      into qcom-spmi-vadc.o
      
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: linux-arm-msm@vger.kernel.org
      Cc: Ivan T. Ivanov <iivanov.xz@gmail.com>
      Cc: Andy Gross <andy.gross@linaro.org>
      Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
      Cc: Stephen Boyd <sboyd@codeaurora.org>
      Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
      Cc: Rama Krishna Phani A <rphani@codeaurora.org>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: NJonathan Cameron <jic23@kernel.org>
      e932d4f0
    • Q
      iio: adc: sun4i-gpadc-iio: add support for A33 thermal sensor · 808a8b73
      Quentin Schulz 提交于
      This adds support for the Allwinner A33 thermal sensor.
      
      Unlike the A10, A13 and A31, the Allwinner A33 only has one channel
      which is dedicated to the thermal sensor. Moreover, its thermal sensor
      does not generate interruptions, thus we only need to directly read the
      register storing the temperature value.
      
      The MFD used by the A10, A13 and A31, was created to avoid breaking the
      DT binding, but since the nodes for the ADC weren't there for the A33,
      it is not needed.
      
      Though the A33 does not have an internal ADC, it has a thermal sensor
      which shares the same registers with GPADC of the already supported SoCs
      and almost the same bits, for the same purpose (thermal sensor).
      
      The thermal sensor behaves exactly the same (except the presence of
      interrupts or not) on the different SoCs.
      Signed-off-by: NQuentin Schulz <quentin.schulz@free-electrons.com>
      Acked-by: NLee Jones <lee.jones@linaro.org>
      Signed-off-by: NJonathan Cameron <jic23@kernel.org>
      808a8b73
    • Q
      iio: adc: sun4i-gpadc-iio: move code used in MFD probing to new function · e3f6e726
      Quentin Schulz 提交于
      This moves code used in MFD probing to a new sun4i_gpadc_probe_mfd
      function.
      
      This driver was initially written for A10, A13 and A31 SoCs which
      already had a DT binding for this IP, thus we needed to use an MFD to
      probe the different drivers without changing the DT binding of these
      SoCs.
      
      For SoCs that will require to create a DT binding for this IP, we can
      avoid using an MFD, thus we need two separate functions: one for probing
      via MFD and one for probing without MFD.
      
      This split the code specific to MFD probing in a function separated from
      the driver probe function.
      Signed-off-by: NQuentin Schulz <quentin.schulz@free-electrons.com>
      Signed-off-by: NJonathan Cameron <jic23@kernel.org>
      e3f6e726
    • J
      iio: adc: Add Maxim max9611 ADC driver · 69780a3b
      Jacopo Mondi 提交于
      Add iio driver for Maxim max9611 and max9612 current-sense amplifiers
      with 12-bits ADC interface.
      
      Datasheet publicly available at:
      https://datasheets.maximintegrated.com/en/ds/MAX9611-MAX9612.pdfSigned-off-by: NJacopo Mondi <jacopo+renesas@jmondi.org>
      Signed-off-by: NJonathan Cameron <jic23@kernel.org>
      69780a3b
  2. 04 4月, 2017 1 次提交
  3. 02 4月, 2017 3 次提交
  4. 01 4月, 2017 2 次提交
    • R
      iio: Aspeed ADC · 57380323
      Rick Altherr 提交于
      Aspeed BMC SoCs include a 16 channel, 10-bit ADC. Low and high threshold
      interrupts are supported by the hardware but are not currently implemented.
      Signed-off-by: NRick Altherr <raltherr@google.com>
      Tested-by: NXo Wang <xow@google.com>
      Reviewed-by: NJoel Stanley <joel@jms.id.au>
      Signed-off-by: NJonathan Cameron <jic23@kernel.org>
      57380323
    • S
      iio: adc: hx711: constify attribute_group structures · 4214dc18
      simran singhal 提交于
      Check for attribute_group structures that are only stored in the
      attrs filed of iio_info structure. As the attrs field of iio_info
      structures is constant, so these attribute_group structures can also be
      declared constant.
      Done using coccinelle:
      
      @r1 disable optional_qualifier @
      identifier i;
      position p;
      @@
      static struct attribute_group i@p = {...};
      
      @ok1@
      identifier r1.i;
      position p;
      struct iio_info x;
      @@
      x.attrs=&i@p;
      
      @bad@
      position p!={r1.p,ok1.p};
      identifier r1.i;
      @@
      i@p
      
      @depends on !bad disable optional_qualifier@
      identifier r1.i;
      @@
      static
      +const
      struct attribute_group i={...};
      
      @depends on !bad disable optional_qualifier@
      identifier r1.i;
      @@
      +const
      struct attribute_group i;
      
      File size before:
         text	   data	    bss	    dec	    hex	filename
         3042	    480	      0	   3522	    dc2	drivers/iio/adc/hx711.o
      
      File size after:
         text	   data	    bss	    dec	    hex	filename
         3098	    416	      0	   3514	    dba	drivers/iio/adc/hx711.o
      Signed-off-by: Nsimran singhal <singhalsimran0@gmail.com>
      Signed-off-by: NJonathan Cameron <jic23@kernel.org>
      4214dc18
  5. 31 3月, 2017 2 次提交
    • T
      iio: adc: cpcap: Add minimal support for CPCAP PMIC ADC · 25ec2496
      Tony Lindgren 提交于
      On Motorola phones like droid 4 there is a custom CPCAP PMIC. This PMIC
      has ADCs that are used for battery charging and USB PHY VBUS and ID pin
      detection.
      
      Unfortunately the only documentation for this ADC seems to be the
      Motorola mapphone Linux kernel tree. I have tested that reading raw and
      scaled values works, but I have not used the timed sampling that the ADC
      seems to support.
      
      Let's add a minimal support for it so we can eventually provide IIO
      channels for the related battery charging and USB PHY drivers.
      
      Cc: devicetree@vger.kernel.org
      Cc: Marcel Partap <mpartap@gmx.net>
      Cc: Michael Scott <michael.scott@linaro.org>
      Cc: Sebastian Reichel <sre@kernel.org>
      Signed-off-by: NTony Lindgren <tony@atomide.com>
      Acked-by: NRob Herring <robh@kernel.org>
      Signed-off-by: NJonathan Cameron <jic23@kernel.org>
      25ec2496
    • A
      iio: adc: replace comma with a semicolon · bb4787f5
      Arushi Singhal 提交于
      Replace a comma between expression statements by a semicolon. This
      changes the semantics of the code, but given the current indentation
      appears to be what is intended.
      A simplified version of the Coccinelle semantic patch that performs this
      transformation is as follows:
      
      // <smpl>
      @r@
      expression e1,e2;
      @@
      
       e1
      -,
      +;
       e2;
      // </smpl>
      Signed-off-by: NArushi Singhal <arushisinghal19971997@gmail.com>
      Signed-off-by: NJonathan Cameron <jic23@kernel.org>
      bb4787f5
  6. 30 3月, 2017 2 次提交
    • S
      iio: adc: ad799x: constify attribute_group structures · 612dc0e2
      simran singhal 提交于
      Check for attribute_group structures that are only stored in the
      event_attrs filed of iio_info structure. As the event_attrs field of
      iio_info structures is constant, so these attribute_group structures can
      also be declared constant.
      Done using coccinelle:
      
      @r1 disable optional_qualifier @
      identifier i;
      position p;
      @@
      static struct attribute_group i@p = {...};
      
      @ok1@
      identifier r1.i;
      position p;
      struct iio_info x;
      @@
      x.event_attrs=&i@p;
      
      @bad@
      position p!={r1.p,ok1.p};
      identifier r1.i;
      @@
      i@p
      
      @depends on !bad disable optional_qualifier@
      identifier r1.i;
      @@
      static
      +const
      struct attribute_group i={...};
      
      @depends on !bad disable optional_qualifier@
      identifier r1.i;
      @@
      +const
      struct attribute_group i;
      
      File size before:
         text    data     bss     dec     hex filename
        26051     464       0   26515    6793 drivers/iio/adc/ad799x.o
      
      File size after:
         text	   data	    bss	    dec	    hex	filename
        26115	    400	      0	  26515	   6793	drivers/iio/adc/ad799x.o
      Signed-off-by: Nsimran singhal <singhalsimran0@gmail.com>
      Signed-off-by: NJonathan Cameron <jic23@kernel.org>
      612dc0e2
    • S
      iio: adc: max1363: constify attribute_group structures · c94645b1
      simran singhal 提交于
      Check for attribute_group structures that are only stored in the
      event_attrs filed of iio_info structure. As the event_attrs field of
      iio_info structures is constant, so these attribute_group structures can
      also be declared constant. Done using coccinelle:
      
      @r1 disable optional_qualifier @
      identifier i;
      position p;
      @@
      static struct attribute_group i@p = {...};
      
      @ok1@
      identifier r1.i;
      position p;
      struct iio_info x;
      @@
      x.event_attrs=&i@p;
      
      @bad@
      position p!={r1.p,ok1.p};
      identifier r1.i;
      @@
      i@p
      
      @depends on !bad disable optional_qualifier@
      identifier r1.i;
      @@
      static
      +const
      struct attribute_group i={...};
      
      @depends on !bad disable optional_qualifier@
      identifier r1.i;
      @@
      +const
      struct attribute_group i;
      
      File size before:
         text    data     bss     dec     hex filename
        36951     448       0   37399    9217 drivers/iio/adc/max1363.o
      
      File size after:
         text	   data	    bss	    dec	    hex	filename
        37015	    384	      0	  37399	   9217	drivers/iio/adc/max1363.o
      Signed-off-by: Nsimran singhal <singhalsimran0@gmail.com>
      Signed-off-by: NJonathan Cameron <jic23@kernel.org>
      c94645b1
  7. 25 3月, 2017 1 次提交
  8. 19 3月, 2017 2 次提交
  9. 16 3月, 2017 2 次提交
    • W
      iio: pc104: Mask PC/104 drivers via the PC104 Kconfig option · 3c1de602
      William Breathitt Gray 提交于
      PC/104 drivers should be hidden on machines which do not support PC/104
      devices. This patch adds the PC104 Kconfig option as a dependency for
      the relevant PC/104 device driver Kconfig options.
      
      Cc: Jonathan Cameron <jic23@kernel.org>
      Cc: Hartmut Knaack <knaack.h@gmx.de>
      Cc: Lars-Peter Clausen <lars@metafoo.de>
      Cc: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
      Signed-off-by: NWilliam Breathitt Gray <vilhelm.gray@gmail.com>
      Signed-off-by: NJonathan Cameron <jic23@kernel.org>
      3c1de602
    • M
      iio: adc: ti_am335x_adc: fix fifo overrun recovery · e83bb3e6
      Michael Engl 提交于
      The tiadc_irq_h(int irq, void *private) function is handling FIFO
      overruns by clearing flags, disabling and enabling the ADC to
      recover.
      
      If the ADC is running in continuous mode a FIFO overrun happens
      regularly. If the disabling of the ADC happens concurrently with
      a new conversion. It might happen that the enabling of the ADC
      is ignored by the hardware. This stops the ADC permanently. No
      more interrupts are triggered.
      
      According to the AM335x Reference Manual (SPRUH73H October 2011 -
      Revised April 2013 - Chapter 12.4 and 12.5) it is necessary to
      check the ADC FSM bits in REG_ADCFSM before enabling the ADC
      again. Because the disabling of the ADC is done right after the
      current conversion has been finished.
      
      To trigger this bug it is necessary to run the ADC in continuous
      mode. The ADC values of all channels need to be read in an endless
      loop. The bug appears within the first 6 hours (~5.4 million
      handled FIFO overruns). The user space application will hang on
      reading new values from the character device.
      
      Fixes: ca9a5638 ("iio: ti_am335x_adc: Add continuous sampling
      support")
      Signed-off-by: NMichael Engl <michael.engl@wjw-solutions.com>
      Cc: <Stable@vger.kernel.org>
      Signed-off-by: NJonathan Cameron <jic23@kernel.org>
      e83bb3e6
  10. 09 3月, 2017 2 次提交
    • Q
      iio: adc: add support for Allwinner SoCs ADC · d1caa990
      Quentin Schulz 提交于
      The Allwinner SoCs all have an ADC that can also act as a touchscreen
      controller and a thermal sensor. This patch adds the ADC driver which is
      based on the MFD for the same SoCs ADC.
      
      This also registers the thermal adc channel in the iio map array so
      iio_hwmon could use it without modifying the Device Tree. This registers
      the driver in the thermal framework.
      
      The thermal sensor requires the IP to be in touchscreen mode to return
      correct values. Therefore, if the user is continuously reading the ADC
      channel(s), the thermal framework in which the thermal sensor is
      registered will switch the IP in touchscreen mode to get a temperature
      value and requires a delay of 100ms (because of the mode switching),
      then the ADC will switch back to ADC mode and requires also a delay of
      100ms. If the ADC readings are critical to user and the SoC temperature
      is not, this driver is capable of not registering the thermal sensor in
      the thermal framework and thus, "quicken" the ADC readings.
      
      This driver probes on three different platform_device_id to take into
      account slight differences (registers bit and temperature computation)
      between Allwinner SoCs ADCs.
      Signed-off-by: NQuentin Schulz <quentin.schulz@free-electrons.com>
      Acked-by: NMaxime Ripard <maxime.ripard@free-electrons.com>
      Acked-by: NJonathan Cameron <jic23@kernel.org>
      Acked-for-MFD-by: NLee Jones <lee.jones@linaro.org>
      Signed-off-by: NJonathan Cameron <jic23@kernel.org>
      d1caa990
    • W
      iio: adc: max11100: remove .owner field for driver · db233ef8
      Wei Yongjun 提交于
      Remove .owner field if calls are used which set it automatically.
      
      Generated by: scripts/coccinelle/api/platform_no_drv_owner.cocci
      Signed-off-by: NWei Yongjun <weiyongjun1@huawei.com>
      Signed-off-by: NJonathan Cameron <jic23@kernel.org>
      db233ef8
  11. 26 2月, 2017 1 次提交
  12. 19 2月, 2017 3 次提交
  13. 11 2月, 2017 2 次提交
    • J
      staging:iio:adc:lpc32xx Move out of staging. · 0097e20e
      Jonathan Cameron 提交于
      There are a few more little cleanups that could be done on this driver, but
      I don't think any are sufficient to justify not moving it out of staging.
      
      It's a very simple driver (presumably for a simple part) so not much that can
      go wrong.  I think it was only ever in staging because that's where IIO was
      as a whole at the time and then we forgot about it!
      Signed-off-by: NJonathan Cameron <jic23@kernel.org>
      Cc: Roland Stigge <stigge@antcom.de>
      Signed-off-by: NJonathan Cameron <jic23@kernel.org>
      0097e20e
    • J
      staging:iio:adc:spear Move out of staging. · af8f651b
      Jonathan Cameron 提交于
      There are some unanswered questions due to disagreements between the code
      and various datasheets (including between different datasheets for the same
      part).
      
      I don't think that is necessarily a reason to keep it in staging however.
      I'm partly posting this patch inorder to reignite debate and with a bit
      of luck find someone who has one of these to test!
      Signed-off-by: NJonathan Cameron <jic23@kernel.org>
      af8f651b
  14. 05 2月, 2017 1 次提交
    • A
      iio: adc: handle unknow of_device_id data · 17fa2dcb
      Arnd Bergmann 提交于
      If we get an unknown 'childmode' value, a number of variables are not
      initialized properly:
      
      drivers/iio/adc/rcar-gyroadc.c: In function 'rcar_gyroadc_probe':
      drivers/iio/adc/rcar-gyroadc.c:390:5: error: 'num_channels' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      drivers/iio/adc/rcar-gyroadc.c:426:22: error: 'sample_width' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      drivers/iio/adc/rcar-gyroadc.c:428:23: error: 'channels' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      
      The driver is currently correct, but handling this properly is more robust
      for possible modifications.
      
      There is also a false-positive warning about adcmode being possibly uninitialized,
      but that cannot happen as we also check the 'first' flag:
      
      drivers/iio/adc/rcar-gyroadc.c:398:26: error: 'adcmode' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      
      This adds an initialization for 'adcmode' and bails out for any unknown childmode.
      
      Fixes: 059c53b3 ("iio: adc: Add Renesas GyroADC driver")
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Acked-by: NMarek Vasut <marek.vasut@gmail.com>
      Signed-off-by: NJonathan Cameron <jic23@kernel.org>
      17fa2dcb
  15. 02 2月, 2017 1 次提交
  16. 01 2月, 2017 1 次提交
  17. 31 1月, 2017 1 次提交
  18. 29 1月, 2017 4 次提交
  19. 28 1月, 2017 3 次提交
    • W
      iio: stx104: Utilize devm_ functions in driver probe callback · b2d226ca
      William Breathitt Gray 提交于
      The devm_ resource manager functions allow memory to be automatically
      released when a device is unbound. This patch takes advantage of the
      resource manager functions and replaces the gpiochip_add_data call and
      iio_device_register call with the devm_gpiochip_add_data call and
      devm_iio_device_register call respectively. In addition, the
      stx104_remove function has been removed as no longer necessary due to
      the use of the relevant devm_ resource manager functions.
      Signed-off-by: NWilliam Breathitt Gray <vilhelm.gray@gmail.com>
      Signed-off-by: NJonathan Cameron <jic23@kernel.org>
      b2d226ca
    • M
      iio: adc: add a driver for the SAR ADC found in Amlogic Meson SoCs · 3adbf342
      Martin Blumenstingl 提交于
      This adds support for the SAR (Successive Approximation Register) ADC
      on the Amlogic Meson SoCs.
      
      The code is based on the public S805 (Meson8b) and S905 (GXBB)
      datasheets (see [0] and [1]), as well as by reading (various versions
      of) the vendor driver and by inspecting the registers on the vendor
      kernels of my testing-hardware.
      
      Currently the GXBB, GXL and GXM SoCs are supported. GXBB hardware has
      10-bit ADC resolution, while GXL and GXM have 12-bit ADC resolution.
      The code was written to support older SoCs (Meson8 and Meson8b) as well,
      but due to lack of actual testing-hardware no of_device_id was added for
      these.
      
      Two "features" from the vendor driver are currently missing:
      - the vendor driver uses channel #7 for calibration (this improves the
        accuracy of the results - in my tests the results were less than 3%
        off without calibration compared to the vendor driver). Adding support
        for this should be easy, but is not required for most applications.
      - channel #6 is connected to the SoCs internal temperature sensor.
        Adding support for this is probably not so easy since (based on the
        u-boot sources) most SoC versions are using different registers and
        algorithms for the conversion from "ADC value" to temperature.
      
      Supported by the hardware but currently not supported by the driver:
      - reading multiple channels at the same time (the hardware has a FIFO
        buffer which stores multiple results)
      - continuous sampling (this would require a way to enable this
        individually because otherwise the ADC would be drawing power
        constantly)
      - interrupt support (similar to the vendor driver this new driver is
        polling the results. It is unclear if the IRQ-mode is supported on
        older (Meson6 or Meson8) hardware as well or if there are any errata)
      
      [0]
      http://dn.odroid.com/S805/Datasheet/S805_Datasheet%20V0.8%2020150126.pdf
      [1] http://dn.odroid.com/S905/DataSheet/S905_Public_Datasheet_V1.1.4.pdfSigned-off-by: NMartin Blumenstingl <martin.blumenstingl@googlemail.com>
      Tested-by: NNeil Armstrong <narmstrong@baylibre.com>
      Signed-off-by: NJonathan Cameron <jic23@kernel.org>
      3adbf342
    • M
      iio: adc: Add Renesas GyroADC driver · 059c53b3
      Marek Vasut 提交于
      Add IIO driver for the Renesas RCar GyroADC block. This block is a
      simple 4/8-channel ADC which samples 12/15/24 bits of data every
      cycle from all channels.
      Signed-off-by: NMarek Vasut <marek.vasut+renesas@gmail.com>
      Cc: Geert Uytterhoeven <geert+renesas@glider.be>
      Cc: Simon Horman <horms+renesas@verge.net.au>
      Cc: Jonathan Cameron <jic23@kernel.org>
      Cc: linux-renesas-soc@vger.kernel.org
      Cc: Wolfram Sang <wsa@the-dreams.de>
      Signed-off-by: NJonathan Cameron <jic23@kernel.org>
      059c53b3
  20. 22 1月, 2017 1 次提交
    • B
      iio: adc: constify iio_info structures · 99a22f06
      Bhumika Goyal 提交于
      Declare iio_info structures as const as they are only stored in
      the info field of a iio_dev structure. This field is of type const,
      so iio_info structures having similar properties can be made const too.
      
      File size before:
         text	   data	    bss	    dec	    hex	filename
         6944	    792	      0	   7736	   1e38	drivers/iio/adc/ti-ads1015.o
      
      File size after:
         text   data	    bss	    dec	    hex	filename
         7264	    472	      0	   7736	   1e38	drivers/iio/adc/ti-ads1015.o
      Signed-off-by: NBhumika Goyal <bhumirks@gmail.com>
      Signed-off-by: NJonathan Cameron <jic23@kernel.org>
      99a22f06