Commit graph

7 commits

Author SHA1 Message Date
Hartmut Knaack
399910534c iio:dac:m62332: use dynamic scale
Some regulators can supply multiple voltages. To take changing voltages
into account, the scale needs to be calculated on every read access.

Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-10-11 15:45:17 +01:00
Hartmut Knaack
acf2f67d05 iio:dac:m62332: address some style issues
Fix some indentation issues and separate returns by empty lines (IIO
style). Also rename the channel mask in _read_raw() to mask.

Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-10-11 15:44:42 +01:00
Hartmut Knaack
11687d4aae iio:dac:m62332: drop unrequired variable
A return variable is not required in _write_raw(), and dropping it reduces
complexity, as well.

Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Acked-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-10-11 15:43:51 +01:00
Hartmut Knaack
7d2da8eaa9 iio:dac:m62332: use ARRAY_SIZE
Make use of ARRAY_SIZE to prevent buffer issues.

Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Acked-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-10-11 15:42:41 +01:00
Hartmut Knaack
847e3928de iio:dac:m62332: shutdown on remove
The regulator framework requests to balance regulator_enable() calls with
regulator_disable() calls. To meet this requirement, set channels to 0 on
remove, which implies a regulator_disable() call in case that channel was
enabled.

Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Acked-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-10-11 15:41:36 +01:00
Hartmut Knaack
862a76acb2 iio:dac:m62332: share scale and offset
This device simply uses its Vcc as reference voltage, so the same scale
applies for all channels. Also offset doesn't appear to be different for
any channel. Represent this by switching these two attributes to
info_mask_shared_by_type.

Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-10-11 15:39:37 +01:00
Dmitry Eremin-Solenikov
b87b0c0f81 iio: add m62332 DAC driver
m62332 is a simple 2-channel DAC used on several Sharp Zaurus boards to
control LCD voltage, backlight and sound. The driver use regulators to
control the reference voltage and enabling/disabling the DAC.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-17 09:37:45 +01:00