1. 14 Jan, 2016 13 commits
    • Thomas Betker's avatar
      iio: adc: xilinx: Fix VREFN scale · 32d839d9
      Thomas Betker authored
      commit a57f8dac upstream.
      
      The scaling factor for VREFN is 3.0/4096 (not 1.0/4096), just as for
      VREFP. This is not immediately obvious from the specification (Xilinx
      UG480), but has been confirmed by Xilinx support.
      Suggested-by: default avatarHartmut Knaack <knaack.h@gmx.de>
      Signed-off-by: default avatarThomas Betker <thomas.betker@rohde-schwarz.com>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      32d839d9
    • Chris Lesiak's avatar
      iio: si7020: Swap data byte order · 1c2e1ba3
      Chris Lesiak authored
      commit 0d2f6fd3 upstream.
      
      The Silicon Labs Si7013, Si7020, and Si7021 family of I2C humidity and
      temperature sensors deliver 16 bit data high byte first.
      
      See the datasheet available at:
      https://www.silabs.com/Support%20Documents%2fTechnicalDocs%2fSi7020-A20.pdf
      
      But as documented in Documentation/i2c/smbus-protocol,
      i2c_smbus_read_word_data() expects the low byte first.
      
      Change the driver to use i2c_smbus_read_word_swapped to get correct byte
      order.
      Signed-off-by: default avatarChris Lesiak <chris.lesiak@licor.com>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      1c2e1ba3
    • Tadeusz Struk's avatar
      crypto: qat - don't use userspace pointer · cb796350
      Tadeusz Struk authored
      commit 176155da upstream.
      
      Bugfix - don't dereference userspace pointer.
      Signed-off-by: default avatarTadeusz Struk <tadeusz.struk@intel.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      cb796350
    • Adrian Hunter's avatar
      mmc: mmc: Improve reliability of mmc_select_hs400() · ff334ca3
      Adrian Hunter authored
      commit d2302933 upstream.
      
      mmc_select_hs400() calls __mmc_switch() which checks the switch is
      successful using CMD13 (SEND_STATUS).  The problem is that it does that
      using the timing settings of the previous mode.  That is prone to error,
      especially when switching from HS to HS400 because the timing parameters
      for HS mode are tighter than the timing parameters for HS400 mode.
      
      In the case when CMD13 polling is used (i.e. not MMC_CAP_WAIT_WHILE_BUSY)
      with the switch command, it must be assumed that using different modes on
      the card and host must work.
      
      However in the case when CMD13 polling is not used
      (i.e. MMC_CAP_WAIT_WHILE_BUSY) mmc_select_hs400() can be made more
      reliable by setting the host to the correct timing before sending CMD13.
      
      This patch does that.
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Tested-by: default avatarAlim Akhtar <alim.akhtar@samsung.com>
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      ff334ca3
    • Adrian Hunter's avatar
      mmc: mmc: Move mmc_switch_status() · 6ab0355a
      Adrian Hunter authored
      commit 974007aa upstream.
      
      Move the mmc_switch_status() function in preparation for calling it
      in mmc_select_hs400().
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Tested-by: default avatarAlim Akhtar <alim.akhtar@samsung.com>
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      6ab0355a
    • Adrian Hunter's avatar
      mmc: mmc: Fix HS setting in mmc_select_hs400() · c50e7347
      Adrian Hunter authored
      commit 51b12f77 upstream.
      
      mmc_select_hs400() begins with the card and host in HS200 mode.
      Therefore, any commands sent to the card should use HS200 timing.
      It is incorrect to set the host to High Speed (HS) timing before
      sending the switch command.  Doing so is unreliable because
      the timing parameters for HS mode are tighter than the timing
      parameters for HS200 mode.  Thus the HS timings should be set
      only after the card has switched mode.
      
      However, it is not unreasonable first to reduce the frequency to
      the HS mode frequency, which should make the switch command and
      subsequent CMD13 commands more reliable.
      
      This patch does that.
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Tested-by: default avatarAlim Akhtar <alim.akhtar@samsung.com>
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      c50e7347
    • Adrian Hunter's avatar
      mmc: mmc: Improve reliability of mmc_select_hs200() · 57f65c4e
      Adrian Hunter authored
      commit 1815e61b upstream.
      
      Currently mmc_select_hs200() uses __mmc_switch() which checks the
      success of the switch to HS200 mode using CMD13 (SEND_STATUS).
      The problem is that it does that using the timing settings of legacy
      mode.  That is prone to error, not least because the timing parameters
      for legacy mode are tighter than the timing parameters for HS200 mode.
      
      In the case when CMD13 polling is used (i.e. not MMC_CAP_WAIT_WHILE_BUSY)
      with the switch command, it must be assumed that using different modes on
      the card and host must work.
      
      However in the case when CMD13 polling is not used
      (i.e. MMC_CAP_WAIT_WHILE_BUSY) mmc_select_hs200() can be made more
      reliable by setting the host to the correct timing before sending CMD13.
      
      This patch does that.
      
      A complication is that the caller, mmc_select_timing(), will ignore a
      switch error (indicated by -EBADMSG), assume the old mode is valid
      and continue, so the old timing must be restored in that case.
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Tested-by: default avatarAlim Akhtar <alim.akhtar@samsung.com>
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      57f65c4e
    • Sanchayan Maity's avatar
      iio: adc: vf610_adc: Fix division by zero error · 6dedf343
      Sanchayan Maity authored
      commit 8546d2e5 upstream.
      
      In case the fsl,adck-max-frequency property is not present in
      the device tree, a division by zero error results during the
      probe call on kernel boot (see below). This patch fixes it and
      also restores device tree compatibility in case kernels are
      booting with old device trees without this property specified.
      
      [    1.063229] Division by zero in kernel.
      [    1.067152] CPU: 0 PID: 1 Comm: swapper Not tainted
      4.3.0-rc5-00212-gcc88cef #37
      [    1.074650] Hardware name: Freescale Vybrid VF5xx/VF6xx (Device Tree)
      [    1.081135] Backtrace:
      [    1.083694] [<800134a4>] (dump_backtrace) from [<8001369c>]
      (show_stack+0x18/0x1c)
      [    1.091340]  r7:00000008 r6:8e0ae210 r5:00000000 r4:8e299800
      [    1.097146] [<80013684>] (show_stack) from [<80297b1c>]
      (dump_stack+0x24/0x28)
      [    1.104483] [<80297af8>] (dump_stack) from [<80013608>]
      (__div0+0x1c/0x20)
      [    1.111421] [<800135ec>] (__div0) from [<802968b4>] (Ldiv0+0x8/0x10)
      [    1.117865] [<80424350>] (vf610_adc_probe) from [<803153b4>]
      (platform_drv_probe+0x4c/0xac)
      [    1.126311]  r10:00000000 r9:8076a5ec r8:00000000 r7:fffffdfb
      r6:807cc67c r5:8e0ae210
      [    1.134319]  r4:807f6c54
      [    1.136915] [<80315368>] (platform_drv_probe) from [<803138bc>]
      (driver_probe_device+0x20c/0x2f8)
      [    1.145882]  r7:807cc67c r6:00000000 r5:8e0ae210 r4:807f6c54
      [    1.151657] [<803136b0>] (driver_probe_device) from [<80313a3c>]
      (__driver_attach+0x94/0x98)
      [    1.160190]  r9:8076a5ec r8:00000098 r7:00000000 r6:8e0ae244
      r5:807cc67c r4:8e0ae210
      [    1.168112] [<803139a8>] (__driver_attach) from [<80311cb8>]
      (bus_for_each_dev+0x70/0xa4)
      [    1.176383]  r7:00000000 r6:803139a8 r5:807cc67c r4:00000000
      [    1.182159] [<80311c48>] (bus_for_each_dev) from [<80313318>]
      (driver_attach+0x24/0x28)
      [    1.190260]  r6:807bb568 r5:8e2a5b00 r4:807cc67c
      [    1.194996] [<803132f4>] (driver_attach) from [<80312f50>]
      (bus_add_driver+0x1a4/0x21c)
      [    1.203113] [<80312dac>] (bus_add_driver) from [<803142a8>]
      (driver_register+0x80/0x100)
      [    1.211275]  r7:8e2a7dc0 r6:807a8160 r5:80789e14 r4:807cc67c
      [    1.217075] [<80314228>] (driver_register) from [<803152f8>]
      (__platform_driver_register+0x5c/0x64)
      [    1.226216]  r5:80789e14 r4:807a8160
      [    1.229877] [<8031529c>] (__platform_driver_register) from
      [<80789e30>] (vf610_adc_driver_init+0x1c/0x20)
      [    1.239556] [<80789e14>] (vf610_adc_driver_init) from [<800095f8>]
      (do_one_initcall+0x94/0x1dc)
      [    1.248365] [<80009564>] (do_one_initcall) from [<8076ae34>]
      (kernel_init_freeable+0x13c/0x1e0)
      [    1.257155]  r10:80794830 r9:8076a5ec r8:00000098 r7:807d5780
      r6:807d5780 r5:00000006
      [    1.265153]  r4:807a0ee8
      [    1.267753] [<8076acf8>] (kernel_init_freeable) from [<80590ef0>]
      (kernel_init+0x18/0xf0)
      [    1.276021]  r10:00000000 r9:00000000 r8:00000000 r7:00000000
      r6:00000000 r5:80590ed8
      [    1.284015]  r4:807d5780
      [    1.286615] [<80590ed8>] (kernel_init) from [<8000f878>]
      (ret_from_fork+0x14/0x3c)
      [    1.294278]  r5:80590ed8 r4:00000000
      Signed-off-by: default avatarSanchayan Maity <maitysanchayan@gmail.com>
      Acked-by: default avatarFugang Duan <B38611@freescale.com>
      Acked-by: default avatarStefan Agner <stefan@agner.ch>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      6dedf343
    • Lars-Peter Clausen's avatar
      iio:ad7793: Fix ad7785 product ID · e481c3ac
      Lars-Peter Clausen authored
      commit 785171fd upstream.
      
      While the datasheet for the AD7785 lists 0xXB as the product ID the actual
      product ID is 0xX3.
      
      Fix the product ID otherwise the driver will reject the device due to non
      matching IDs.
      
      Fixes: e786cc26 ("staging:iio:ad7793: Implement stricter id checking")
      Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      e481c3ac
    • Lars-Peter Clausen's avatar
      iio: ad5064: Fix ad5629/ad5669 shift · 70d1f4f9
      Lars-Peter Clausen authored
      commit 5dcbe97b upstream.
      
      The ad5629/ad5669 are the I2C variant of the ad5628/ad5668, which has a SPI
      interface. They are mostly identical with the exception that the shift
      factor is different. Currently the driver does not take care of this
      difference which leads to incorrect DAC output values.
      
      Fix this by introducing a custom channel spec for the ad5629/ad5669 with
      the correct shift factor.
      
      Fixes: commit 6a17a076 ("iio:dac:ad5064: Add support for the ad5629r and ad5669r")
      Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      70d1f4f9
    • Michael Hennerich's avatar
      iio:ad5064: Make sure ad5064_i2c_write() returns 0 on success · 79be0f00
      Michael Hennerich authored
      commit 03fe472e upstream.
      
      i2c_master_send() returns the number of bytes transferred on success while
      the ad5064 driver expects that the write() callback returns 0 on success.
      Fix that by translating any non negative return value of i2c_master_send()
      to 0.
      
      Fixes: commit 6a17a076 ("iio:dac:ad5064: Add support for the ad5629r and ad5669r")
      Signed-off-by: default avatarMichael Hennerich <michael.hennerich@analog.com>
      Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      79be0f00
    • Vladimir Zapolskiy's avatar
      iio: lpc32xx_adc: fix warnings caused by enabling unprepared clock · ff742452
      Vladimir Zapolskiy authored
      commit 01bb70ae upstream.
      
      If common clock framework is configured, the driver generates a warning,
      which is fixed by this change:
      
          root@devkit3250:~# cat /sys/bus/iio/devices/iio\:device0/in_voltage0_raw
          ------------[ cut here ]------------
          WARNING: CPU: 0 PID: 724 at drivers/clk/clk.c:727 clk_core_enable+0x2c/0xa4()
          Modules linked in: sc16is7xx snd_soc_uda1380
          CPU: 0 PID: 724 Comm: cat Not tainted 4.3.0-rc2+ #198
          Hardware name: LPC32XX SoC (Flattened Device Tree)
          Backtrace:
          [<>] (dump_backtrace) from [<>] (show_stack+0x18/0x1c)
          [<>] (show_stack) from [<>] (dump_stack+0x20/0x28)
          [<>] (dump_stack) from [<>] (warn_slowpath_common+0x90/0xb8)
          [<>] (warn_slowpath_common) from [<>] (warn_slowpath_null+0x24/0x2c)
          [<>] (warn_slowpath_null) from [<>] (clk_core_enable+0x2c/0xa4)
          [<>] (clk_core_enable) from [<>] (clk_enable+0x24/0x38)
          [<>] (clk_enable) from [<>] (lpc32xx_read_raw+0x38/0x80)
          [<>] (lpc32xx_read_raw) from [<>] (iio_read_channel_info+0x70/0x94)
          [<>] (iio_read_channel_info) from [<>] (dev_attr_show+0x28/0x4c)
          [<>] (dev_attr_show) from [<>] (sysfs_kf_seq_show+0x8c/0xf0)
          [<>] (sysfs_kf_seq_show) from [<>] (kernfs_seq_show+0x2c/0x30)
          [<>] (kernfs_seq_show) from [<>] (seq_read+0x1c8/0x440)
          [<>] (seq_read) from [<>] (kernfs_fop_read+0x38/0x170)
          [<>] (kernfs_fop_read) from [<>] (do_readv_writev+0x16c/0x238)
          [<>] (do_readv_writev) from [<>] (vfs_readv+0x50/0x58)
          [<>] (vfs_readv) from [<>] (default_file_splice_read+0x1a4/0x308)
          [<>] (default_file_splice_read) from [<>] (do_splice_to+0x78/0x84)
          [<>] (do_splice_to) from [<>] (splice_direct_to_actor+0xc8/0x1cc)
          [<>] (splice_direct_to_actor) from [<>] (do_splice_direct+0xa0/0xb8)
          [<>] (do_splice_direct) from [<>] (do_sendfile+0x1a8/0x30c)
          [<>] (do_sendfile) from [<>] (SyS_sendfile64+0x104/0x10c)
          [<>] (SyS_sendfile64) from [<>] (ret_fast_syscall+0x0/0x38)
      Signed-off-by: default avatarVladimir Zapolskiy <vz@mleia.com>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      ff742452
    • Bhuvanchandra DV's avatar
      vf610_adc: Fix internal temperature calculation · 348e722d
      Bhuvanchandra DV authored
      commit 6219f432 upstream.
      
      Calculate ADCR_VTEMP25 using VTEMP25 at VREFH_ADC 3V3. Existing
      calculations consider the typical values provided in datasheet.
      Those typical values are valid for VREFH_ADC at 3.0V. VTEMP25
      is different for different VREFH_ADC voltages. With VREFH_ADC
      at 3.3V, voltage at 25°C is 0.699V. Hence update the VTEMP25
      to 0.699V which gives ADCR@Temp25 as 867.
      
      Formula for finding ADCR@Temp25:
      ADCR@Temp25 = (ADCR@Vdd * V@TEMP25 * 10) / VDDconv
      
      ADCR@Vdd for 12-Bit ADC = 4095
      VDDconv = VREFH_ADC * 10
      
      VREFH_ADC@3.3V
      ADCR@Temp25 = (4095 * .699 * 10) / 33
      ADCR@Temp25 ~= 867
      
      | VREFH_ADC | V@TEMP25 | VDDconv | ADCR@Temp25 |
      |   3.0V    | 0.696mV  |    30   |     950     |
      |   3.3V    | 0.699mV  |    33   |     867     |
      Signed-off-by: default avatarBhuvanchandra DV <bhuvanchandra.dv@toradex.com>
      Acked-by: default avatarFugang Duan <B38611@freescale.com>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      348e722d
  2. 08 Jan, 2016 2 commits
  3. 06 Jan, 2016 25 commits