1. 07 Nov, 2016 14 commits
  2. 06 Nov, 2016 6 commits
    • Brian Masney's avatar
      staging: iio: tsl2583: remove redudant i2c call in taos_als_calibrate() · c2b0d2cf
      Brian Masney authored
      taos_als_calibrate() queries the control register to determine if the
      unit is powered on and has the ADC enabled. It then queries the same
      register a second time to determine if the ADC reading is valid. This
      patch removes the redundant i2c_smbus_read_byte_data() call.
      
      Verified that the driver still functions correctly using a TSL2581
      hooked up to a Raspberry Pi 2.
      Signed-off-by: default avatarBrian Masney <masneyb@onstation.org>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      c2b0d2cf
    • Brian Masney's avatar
      staging: iio: tsl2583: don't shutdown chip when updating the lux table · 0561155f
      Brian Masney authored
      in_illuminance_lux_table_store() shuts down the chip, updates the
      contents of the lux table, and then turns the chip back on. The values
      in lux table are not used by the chip and are only used internally by
      the driver. It is not necessary to change the power state on the chip.
      This patch removes the calls to taos_chip_off() and taos_chip_on()
      in in_illuminance_lux_table_store().
      Signed-off-by: default avatarBrian Masney <masneyb@onstation.org>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      0561155f
    • Brian Masney's avatar
      staging: iio: tsl2583: remove redundant power off sequence in taos_chip_on() · babe4447
      Brian Masney authored
      taos_chip_on() explicitly turns the sensor power on and then writes the
      8 registers that are stored in taos_config. The first register in
      taos_config is the CONTROL register and the configuration is set to
      turn the power off. The existing state sequence in taos_chip_on() is:
      
      - Turn device power on
      - Turn device power off (via taos_config)
      - Configure other 7 registers (via taos_config)
      - Turn device power on, enable ADC
      
      This patch changes the code so that the device is not powered off via
      taos_config.
      
      Verified that the driver still functions correctly using a TSL2581
      hooked up to a Raspberry Pi 2.
      Signed-off-by: default avatarBrian Masney <masneyb@onstation.org>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      babe4447
    • Brian Masney's avatar
      staging: iio: tsl2583: fixed ordering of comments · 4a0f3614
      Brian Masney authored
      in taos_defaults()
      
      The comments in taos_defaults() appear after the line of code
      that they apply to. This patch moves the comments so that they appear
      before the code. Some of the comments were updated to be more
      informative.
      Signed-off-by: default avatarBrian Masney <masneyb@onstation.org>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      4a0f3614
    • Brian Masney's avatar
      staging: iio: tsl2583: removed unused code from device probing · 6bd0cb2b
      Brian Masney authored
      taos_probe() queries the all of the sensor's registers and loads all of
      the values into a buffer stored on the stack. Only the chip ID register
      was actually used. Change the probe function to just query the chip ID
      register on the device.
      
      Verified that the driver still functions correctly using a TSL2581
      hooked up to a Raspberry Pi 2.
      Signed-off-by: default avatarBrian Masney <masneyb@onstation.org>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      6bd0cb2b
    • Brian Masney's avatar
      staging: iio: tsl2583: i2c_smbus_write_byte() / i2c_smbus_read_byte() migration · 6ba5dee9
      Brian Masney authored
      There were several places where the driver would first call
      i2c_smbus_write_byte() to select the register on the device, and then
      call i2c_smbus_read_byte() to get the contents of that register. The
      code would look roughly like:
      
      /* Select register */
      i2c_smbus_write_byte(client, REGISTER);
      
      /* Read the the last register that was written to */
      int data = i2c_smbus_read_byte(client);
      
      Rewrite this to use i2c_smbus_read_byte_data() to combine the two
      calls into one:
      
      int data = i2c_smbus_read_byte_data(chip->client, REGISTER);
      
      Verified that the driver still functions correctly using a TSL2581
      hooked up to a Raspberry Pi 2.
      
      This fixes the following warnings that were found by the
      kbuild test robot that were introduced by commit 8ba355cce3c6 ("staging:
      iio: tsl2583: check for error code from i2c_smbus_read_byte()").
      
      drivers/staging/iio/light/tsl2583.c:365:5-12: WARNING: Unsigned
      expression compared with zero: reg_val < 0
      
      drivers/staging/iio/light/tsl2583.c:388:5-12: WARNING: Unsigned
      expression compared with zero: reg_val < 0
      
      This also removes the need for the taos_i2c_read() function since all
      callers were only calling the function with a length of 1.
      Signed-off-by: default avatarBrian Masney <masneyb@onstation.org>
      Cc: Julia Lawall <julia.lawall@lip6.fr>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      6ba5dee9
  3. 05 Nov, 2016 11 commits
  4. 01 Nov, 2016 9 commits