1. 26 Sep, 2012 27 commits
  2. 25 Sep, 2012 3 commits
    • Greg Kroah-Hartman's avatar
      Merge tag 'iio-for-v3.7e' of... · 71c62902
      Greg Kroah-Hartman authored
      Merge tag 'iio-for-v3.7e' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next
      
      Fifth round of new drivers and device support for the IIO
      subsystem in the 3.7 cycle.
      
      Here we have a mixed bag of new stuff, minor fixes and
      more major fixes for drivers added earlier in this cycle.
      
      1) A number of fixes for the HID sensors code added in previous
      pull request.  Typical stuff that has become apparent as more eyes
      have looked at the code post merging. Similar case for the ad5755 dac.
      
      2) Cleanups of error handing in inkern.c - again typical stuff to see
      as code comes into heavier use and people notice the naughty short
      cuts that snuck in originally and kindly fix them.
      
      3) A series from Lars that removes some incorrect error handling
      from the remove functions of a number of drivers.  These have been
      there for a very long time hence I'm not pushing these out for the
      3.6 cycle.
      
      4) Support for more parts in the ad7780 driver.
      
      5) A driver for the adcs on the lp8788 power management unit
      
      6) A client driver for IIO to allow it's ADCs to be used for
      battery status measurement.  Note this driver has some dependencies
      on some utility functions added to IIO in this series, hence it is
      coming via this tree rather than Anton's.
      
      7) A null pointer dereference bug in the 'fake' driver. I'm not
      doing this as a fix for the 3.6 cycle because it only effects
      'fake' hardware and that code is typically only used by people
      investigating how IIO works as part of writing new drivers. Hence
      it's hardly a critical fix.
      71c62902
    • Harsh Kumar's avatar
      staging: winbond: Coding Style correction and removal of unused macro · 9970eeae
      Harsh Kumar authored
      
      
      Removed an unused macro. Plus, couple of grammatical and coding style fixes.
      
      1) The macro _INLINE is not used anywhere. Anyways __inline is not portable.
      2) Changed comment from "Not use" to "Unused" make it grammatically correct and
         to fit in 80 word limit.
      3.) Removed space after *
      
      Signed-off-by: default avatarHarsh Kumar <harsh1kumar@gmail.com>
      Acked-by: default avatarPavel Machek <pavel@ucw.cz>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9970eeae
    • Alexey Khoroshilov's avatar
      staging: sbe-2t3e3: fix error handling in t3e3_init_channel() · 4c229df0
      Alexey Khoroshilov authored
      
      
      t3e3_init_channel() incorrectly handles errors in several places:
      it returns zero and does not deallocate all required resources.
      The patch fixes that places.
      
      Found by Linux Driver Verification project (linuxtesting.org).
      
      Signed-off-by: default avatarAlexey Khoroshilov <khoroshilov@ispras.ru>
      Reviewed-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4c229df0
  3. 22 Sep, 2012 10 commits
    • Lars-Peter Clausen's avatar
      staging:iio:dummy: Fix potential NULL pointer dereference · 3fff2274
      Lars-Peter Clausen authored
      
      
      If the config contains CONFIG_IIO_BUFFER=y and CONFIG_IIO_SIMPLE_DUMMY_BUFFER=n
      iio_simple_dummy_configure_buffer() is stubbed out and iio_buffer_register() is
      not. As a result we try to register a buffer which has not been configured.
      This will causes a NULL pointer deref in iio_buffer_register. To solve this
      issue move the iio_buffer_register() call to iio_simple_dummy_configure_buffer(),
      so it will only be called if iio_simple_dummy_configure_buffer() has been called.
      
      Reported-by: default avatarFengguang Wu <fengguang.wu@intel.com>
      Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      3fff2274
    • anish kumar's avatar
      power: battery: Generic battery driver using IIO · e60fea79
      anish kumar authored
      
      
      Driver to allow use of the ADC drivers supported by the IIO
      subsystem for battery status monitoring. Connecting this
      driver to the relevant IIO device requires registration of
      the appropriate iio_map structure array by the IIO device
      driver (usually from platform data).  If specified the driver
      will also make use of a gpio to provide interrupt driven
      notification that the battery is fully charged.
      
      In last version:
      Addressed concerns raised by lars:
      a. made the adc_bat per device.
      b. get the IIO channel using hardcoded channel names.
      c. Minor issues related to gpio_is_valid and some code
         refactoring.
      
      In V1:
      Addressed concerns raised by Anton:
      a. changed the struct name to gab(generic adc battery).
      b. Added some functions to neaten the code.
      c. Some minor coding guidelines changes.
      d. Used the latest function introduce by lars:
         iio_read_channel_processed to streamline the code.
      
      In V2:
      Addressed concerns by lars:
      a. No need of allocating memory for channels.Make it array.
      b. Code restructring, coding style and following kernel guidelines changes
         suggested by him.
      
      In V3:
      Addressed conerns by Anton:
      a. Added the copyright.
      b. Coding guidelines changes suggested by him.
      c. Added Makefile and Kconfig
      
      Signed-off-by: default avataranish kumar <anish198519851985@gmail.com>
      Acked-by: default avatarAnton Vorontsov <cbouatmailru@gmail.com>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      e60fea79
    • Axel Lin's avatar
      HID: hid-sensor-hub: Fix sensor_hub_probe error handling · f2f13a68
      Axel Lin authored
      
      
      Fix below issues:
      1. In the case of goto err_close, hid_hw_stop(hdev) is called twice. Fix it.
      2. If fails to allocate MFD device name, we also need to free all
         successfully allocated names in previous iterations.
      3. In sensor_hub_remove(), Call hid_hw_close() before hid_hw_stop().
      4. Adjust unnecessary change lines for hid_err.
      
      Signed-off-by: default avatarAxel Lin <axel.lin@gmail.com>
      Acked-by: default avatarJiri Kosina <jkosina@suse.cz>
      Acked-by: default avatarSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      f2f13a68
    • Axel Lin's avatar
      HID: hid-sensor-hub: Remove hdev->claimed setting · 3f257caf
      Axel Lin authored
      
      
      Current implementation of hid_hw_start() allows connect_mask to be 0.
      Setting hdev->claimed = HID_CLAIMED_INPUT before calling hid_hw_start()
      is not necessary. Remove it.
      
      Signed-off-by: default avatarAxel Lin <axel.lin@gmail.com>
      Acked-by: default avatarJiri Kosina <jkosina@suse.cz>
      Acked-by: default avatarSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      3f257caf
    • Kim, Milo's avatar
      iio: adc: add new lp8788 adc driver · f0347c36
      Kim, Milo authored
      
      
       TI LP8788 PMU provides regulators, battery charger, ADC,
       RTC, backlight driver and current sinks.
      
       This patch enables the LP8788 ADC functions.
      
       The LP8788 ADC has several ADC input selection and supports 12bit resolution.
       Internal operation of getting ADC is access to registers of LP8788.
       The LP8788 ADC uses exported functions for accessing these registers.
       (exported by LP8788 MFD device driver)
      
       This driver supports IIO_CHAN_INFO_RAW and SCALE.
       So the IIO consumer can calculate the value with raw and scale.
       The unit of scale is micro.
      
       (ADC Input Selection)
      
       Voltage: battery voltage (MAX 5.0, 5.5 and 6.0V)
                charger input voltage
                four general ADC inputs
                coin cell voltage
       Current: battery charging current
       Temperature: IC temperature
      
       (The IIO map for the IIO consumer)
      
       The ADC input is configurable in the platform side.
       Even though this platform data is not defined,
       the default IIO map is created for supporting the power supply driver.
       The battery voltage and temperature are used inside this driver.
      
       (History)
      
       Patch v6.
       (a) Fix scale value for each ADC input selection
       Voltage and current type are mili unit and temperature is degree.
       To calculate the IC temperature,
       temp = raw * scaleint + (raw * scalepart)/ 1000000, scaleint is always 0.
            = raw * 0.061050, raw: 0 ~ 4095
       Then range of IC temperature(ADC result) is 0 ~ 250'C
      
       (b) Reorganization of the IIO channel Spec
       Remove address, scan_type and scan_index and rollback the datasheet name.
       The reason why 'address' field is unnecessary is no relation with each channel.
       Moreover, to get the raw ADC value, the address info is not only one register
       but also several registers.
       Therefore specific function(lp8788_get_adc_result) is called rather than
       using one 'address' field.
      
       (c) Fix coding style
       Remove duplicated checking routine while unregistering the IIO map.
       Fix code for space and parenthesis.
      
       Patch v5.
       Fix default consumer name as 'lp8788-charger'.
       Add mutex for ADC read operation.
       Reorganization on lp8788_adc_read_raw().
      
       Patch v4.
       Fix adc_raw function: support RAW and SCALE channel info.
       Change LP8788 ADC platform data - iio map.
       Enables the default IIO map.
      
       Patch v3.
       Fix wrong size of allocating iio private data.
       Fix coding styles.
      
       Patch v2.
       Support RAW and SCALE interface for IIO consumer.
       Clean up the iio channel spec macro.
      
      Signed-off-by: default avatarMilo(Woogyom) Kim <milo.kim@ti.com>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      f0347c36
    • Lars-Peter Clausen's avatar
      staging:iio:ad7780: Add support for the ad7170/ad7171 · 7aecec98
      Lars-Peter Clausen authored
      
      
      The ad7170/ad7171 have a software interface similar to the ad7780. They do not
      have an external pin which allows to change the internal gain and the what is
      used for the gain bit in the ad7780/ad7781 becomes part of the check pattern.
      
      Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      7aecec98
    • Lars-Peter Clausen's avatar
      staging:iio:ad7780: Make powerdown GPIO optional · 332ed63e
      Lars-Peter Clausen authored
      
      
      Some designs hardwire the PDRST pin to always on. In this case there is no GPIO
      to control the mode of the device, so make the GPIO optional. Since now all of
      the the platform data fields are optional now, make the platform data as a whole
      optional as well.
      
      Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      332ed63e
    • Lars-Peter Clausen's avatar
      staging:iio:sca3000: Do not return a error in remove function · 67ad4e08
      Lars-Peter Clausen authored
      
      
      In the Linux device driver model the remove callback is not allowed to fail and
      the device will be removed regardless of the return value of the remove
      callback. So if we abort in the remove function and do not free all resources we
      will create a resource leak. Also all kinds of undefined behaviour are expected
      to happen since the IIO device is still there while its parent is already gone.
      
      The errors which the driver tries to handle in the remove function are
      non-critical, so we can just ignore them and continue to free all resources and
      remove the IIO device.
      
      Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      67ad4e08
    • Lars-Peter Clausen's avatar
      staging:iio:lis3l02dq: Do not return a error in remove function · e71a837c
      Lars-Peter Clausen authored
      
      
      In the Linux device driver model the remove callback is not allowed to fail and
      the device will be removed regardless of the return value of the remove
      callback. So if we abort in the remove function and do not free all resources we
      will create a resource leak. Also all kinds of undefined behaviour are expected
      to happen since the IIO device is still there while its parent is already gone.
      
      The errors which the driver tries to handle in the remove function are
      non-critical, so we can just ignore them and continue to free all resources and
      remove the IIO device.
      
      Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      e71a837c
    • Lars-Peter Clausen's avatar
      staging:iio:ade7759: Do not return a error in remove function · e854bcc9
      Lars-Peter Clausen authored
      
      
      In the Linux device driver model the remove callback is not allowed to fail and
      the device will be removed regardless of the return value of the remove
      callback. So if we abort in the remove function and do not free all resources we
      will create a resource leak. Also all kinds of undefined behaviour are expected
      to happen since the IIO device is still there while its parent is already gone.
      
      The error which the driver tries to handle in the remove function is
      non-critical, so we can just ignore it and continue to free all resources and
      remove the IIO device.
      
      Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      e854bcc9