• Jeremy Fertic's avatar
    staging: iio: adt7316: fix dac_bits assignment · 1ad62489
    Jeremy Fertic authored
    [ Upstream commit e9de4757 ]
    
    The value of dac_bits is used in adt7316_show_DAC() and adt7316_store_DAC(),
    and it should be either 8, 10, or 12 bits depending on the device in use. The
    driver currently only assigns a value to dac_bits in
    adt7316_store_da_high_resolution(). The purpose of the dac high resolution
    option is not to change dac resolution for normal operation. Instead, it
    is specific to an optional feature where one or two of the four dacs can
    be set to output voltage proportional to temperature. If the user chooses
    to set dac a and/or dac b to output voltage proportional to temperature,
    the da_high_resolution attribute can optionally be enabled to use 10 bit
    resolution rather than the default 8 bits. This is only available on the
    10 and 12 bit dac devices. If the user attempts to read or write dacs a
    or b under these settings, the driver's current behaviour is to return an
    error. Dacs c and d continue to operate normally under these conditions.
    With the above in mind, remove the dac_bits assignments from this function
    since the value of dac_bits as used in the driver is not dependent on this
    dac high resolution option.
    
    Since the dac_bits assignments discussed above are currently the only ones
    in this driver, the default value of dac_bits is 0. This results in incorrect
    calculations when the dacs are read or written in adt7316_show_DAC() and
    adt7316_store_DAC(). To correct this, assign a value to dac_bits in
    adt7316_probe() to ensure correct operation as soon as the device is
    registered and available to userspace.
    
    Fixes: 35f6b6b8 ("staging: iio: new ADT7316/7/8 and ADT7516/7/9 driver")
    Signed-off-by: 's avatarJeremy Fertic <jeremyfertic@gmail.com>
    Signed-off-by: 's avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
    Signed-off-by: 's avatarSasha Levin <sashal@kernel.org>
    1ad62489
Name
Last commit
Last update
Documentation Loading commit data...
LICENSES Loading commit data...
arch Loading commit data...
block Loading commit data...
certs Loading commit data...
crypto Loading commit data...
drivers Loading commit data...
firmware Loading commit data...
fs Loading commit data...
include Loading commit data...
init Loading commit data...
ipc Loading commit data...
kernel Loading commit data...
lib Loading commit data...
mm Loading commit data...
net Loading commit data...
samples Loading commit data...
scripts Loading commit data...
security Loading commit data...
sound Loading commit data...
tools Loading commit data...
usr Loading commit data...
virt Loading commit data...
.clang-format Loading commit data...
.cocciconfig Loading commit data...
.get_maintainer.ignore Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
.mailmap Loading commit data...
COPYING Loading commit data...
CREDITS Loading commit data...
Kbuild Loading commit data...
Kconfig Loading commit data...
MAINTAINERS Loading commit data...
Makefile Loading commit data...
README Loading commit data...