1. 21 11月, 2012 7 次提交
  2. 20 11月, 2012 2 次提交
  3. 17 11月, 2012 3 次提交
  4. 10 11月, 2012 4 次提交
  5. 06 11月, 2012 1 次提交
  6. 02 11月, 2012 3 次提交
  7. 31 10月, 2012 2 次提交
  8. 26 10月, 2012 1 次提交
  9. 20 10月, 2012 5 次提交
  10. 19 10月, 2012 4 次提交
  11. 22 9月, 2012 5 次提交
    • K
      iio: adc: add new lp8788 adc driver · f0347c36
      Kim, Milo 提交于
       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: NMilo(Woogyom) Kim <milo.kim@ti.com>
      Signed-off-by: NJonathan Cameron <jic23@kernel.org>
      f0347c36
    • K
      iio: inkern: clean up error return code · 3183bac1
      Kim, Milo 提交于
       When the IIO consumer tries to get specific IIO channel,
       few error cases can be happened.
       (a) Memory allocation failure
       (b) No matched ADC channel error
       (c) Invalid input arguments
       This patch enables cleaning up error handling in case of (a) and (b).
      
       In error handling code,
       (a): the reference count of the IIO device should be decreased.
       (b): the allocated memory should be freed with restoring the reference count.
       Therefore iio_deivce_put() is called in both cases.
       This can be handled in the last error statement.
      
       Additionally, integer variable is used for stating each error case explicitly.
       Then, the error returns as ERR_PTR() with this value.
      Signed-off-by: NMilo(Woogyom) Kim <milo.kim@ti.com>
      Signed-off-by: NJonathan Cameron <jic23@kernel.org>
      3183bac1
    • K
      iio: inkern: put the IIO device when it fails to allocate memory · 801c4b5c
      Kim, Milo 提交于
       The reference count of the IIO device is increased if the IIO map has
       matched consumer name.
       After then, it tries to allocate the iio_channel which is used by the consumer.
       If it fails to allocate memory, the reference count should be decreased.
      
       This patch enables restoring the reference count of the IIO device.
      Signed-off-by: NMilo(Woogyom) Kim <milo.kim@ti.com>
      Signed-off-by: NJonathan Cameron <jic23@kernel.org>
      801c4b5c
    • D
      iio: dac/ad5755: signedness bug in ad5755_setup_pdata() · 369d0e20
      Dan Carpenter 提交于
      We need "ret" to be signed for the error handling to work correctly.
      Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
      Acked-by: NLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: NJonathan Cameron <jic23@kernel.org>
      369d0e20
    • S
      iio: hid-sensors: Prevent crash during hot-unplug · f07b60b7
      Srinivas Pandruvada 提交于
      When hid sensor hub is unplugged, there is a crash in
      iio_device_unregister_trigger_consumer.
      In a typical IIO driver when remove is called, it will unregister and free
      trigger and then it will call iio_device_free.
      The function iio_trigger_free() will free the allocated memory for trigger.
      If this trigger was assigned to iio_dev->trig, then it should be set to NULL.
      Othewise when iio_device_free() is called later, it finally calls
      iio_device_unregsister_trigger(), which checks for
             if (indio_dev->trig)
                      iio_trigger_put(indio_dev->trig);
      If indio_dev->trig is not set to NULL, it calls iio_trigger_put on a bad
      pointer causing crash.
      This scenerio can happen in any driver, which is storing trigger pointer in
      iio_dev structure and following current procedure during remove.
      Signed-off-by: NSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
      Signed-off-by: NJonathan Cameron <jic23@kernel.org>
      f07b60b7
  12. 18 9月, 2012 3 次提交
    • L
      iio: ad7476: Add support for the ad7091r · 87c5b10f
      Lars-Peter Clausen 提交于
      Add support for the ad7091r 12 bit ADC to the ad7476 driver. Although the
      ad7091r is not really related to any of the other devices supported by this
      driver, luckily for us there are not so many ways (which are not totally insane)
      how sampling a single channel ADC via SPI can be implemented and support for the
      ad7091r can be added to the driver with just a few adjustments.
      
      The ad7091r requires an external "conversion start" pulse to start a sample
      conversion. After the conversion has finished the result can be read via SPI. We
      depend on a IIO trigger to generate this signal, as a result only sampling in
      buffered mode and not in manual mode is available.
      Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: NJonathan Cameron <jic23@kernel.org>
      87c5b10f
    • L
      iio:inkern: Add function to read the processed value · 48e44ce0
      Lars-Peter Clausen 提交于
      Add a function to read a processed value from a channel. The function will first
      attempt to read the IIO_CHAN_INFO_PROCESSED attribute. If that fails it will
      read the IIO_CHAN_INFO_RAW attribute and convert the result from a raw value to
      a processed value.
      
      The patch also introduces a function to convert raw value to a processed value
      and exports it, in case a user needs or wants to do the conversion by itself.
      Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: NJonathan Cameron <jic23@kernel.org>
      48e44ce0
    • L
      iio:dac: Add ad5755 driver · c499d029
      Lars-Peter Clausen 提交于
      This patch adds support for the AD5755, AD5755-1, AD5757, AD5735, AD5737 16 and
      14 bit quad-channel DACs. The AD5757/AD5737 only have current outputs, but
      for the AD5755/AD5757 each of the outputs can be configured to either be a
      voltage or a current output. We only allow to configure this at device probe
      time since usually this needs to match the external circuitry and should not be
      changed on the fly.
      
      A few trivial formatting changes on merge.
      Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: NJonathan Cameron <jic23@kernel.org>
      c499d029