summaryrefslogtreecommitdiff
path: root/drivers/iio/adc/berlin2-adc.c
AgeCommit message (Collapse)Author
2021-10-19iio: adc: berlin2-adc: convert probe to device-managed onlyAlexandru Ardelean
This driver requires only a devm_add_action_or_reset() hook for the power-down of the device, and then devm_iio_device_register() can be used directly. Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com> Link: https://lore.kernel.org/r/20210926192642.4051329-1-aardelean@deviqon.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-06-14iio: remove explicit IIO device parent assignmentAlexandru Ardelean
This patch applies the semantic patch: @@ expression I, P, SP; @@ I = devm_iio_device_alloc(P, SP); ... - I->dev.parent = P; It updates 302 files and does 307 deletions. This semantic patch also removes some comments like '/* Establish that the iio_dev is a child of the i2c device */' But this is is only done in case where the block is left empty. The patch does not seem to cover all cases. It looks like in some cases a different variable is used in some cases to assign the parent, but it points to the same reference. In other cases, the block covered by ... may be just too big to be covered by the semantic patch. However, this looks pretty good as well, as it does cover a big bulk of the drivers that should remove the parent assignment. Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-08-22iio:adc: drop assign iio_info.driver_module and iio_trigger_ops.ownerJonathan Cameron
The equivalent of both of these are now done via macro magic when the relevant register calls are made. The actual structure elements will shortly go away. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
2015-08-12iio:adc:berlin2-adc: coding style cleanupHartmut Knaack
Some adjustment of indentation to make checkpatch.pl happy in strict mode. Signed-off-by: Hartmut Knaack <knaack.h@gmx.de> Acked-by: Antoine Tenart <antoine.tenart@free-electrons.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-12iio:adc:berlin2-adc: enable interrupts with mutex lockedHartmut Knaack
Move the call to enable channel interrupts into its _read() function to have it protected by a mutex. This ensures that only one channel is sampled at a time. Signed-off-by: Hartmut Knaack <knaack.h@gmx.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-12iio:adc:berlin2-adc: use GENMASK and BIT for masksHartmut Knaack
Make use of GENMASK for consecutive bitmasks and BIT for single bitmasks. Signed-off-by: Hartmut Knaack <knaack.h@gmx.de> Acked-by: Antoine Tenart <antoine.tenart@free-electrons.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-12iio:adc:berlin2-adc: Fix register definitionHartmut Knaack
Active channel number is stored in BERLIN2_SM_CTRL as value, instead of a bit map. The masks for channel interrupts and data ready are a 16 bits wide bit map each, instead of just 4 bits. Also correct the data mask for the temperature sensor, which was Reported-by: Antoine Tenart <antoine.tenart@free-electrons.com> Signed-off-by: Hartmut Knaack <knaack.h@gmx.de> Acked-by: Antoine Tenart <antoine.tenart@free-electrons.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-02iio:adc:berlin2-adc: use channel-array size directlyHartmut Knaack
Drop the otherwise unused definition of the channel-array size and use it directly in _probe - makes it a bit more obvious. Signed-off-by: Hartmut Knaack <knaack.h@gmx.de> Acked-by: Antoine Tenart <antoine.tenart@free-electrons.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-02iio:adc:berlin2-adc: use short operator formatHartmut Knaack
Use augmented assignment to subtract the offset for negative temperature values. Specify the amount of private data to be allocated through devm_iio_device_alloc() with sizeof(*priv), as it is shorter and common practice in IIO. Signed-off-by: Hartmut Knaack <knaack.h@gmx.de> Acked-by: Antoine Tenart <antoine.tenart@free-electrons.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-02iio:adc:berlin2-adc: constify iio_chan_specHartmut Knaack
Mark berlin2_adc_channels array as constant. Signed-off-by: Hartmut Knaack <knaack.h@gmx.de> Acked-by: Antoine Tenart <antoine.tenart@free-electrons.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-02iio:adc:berlin2-adc: pass up real error codeHartmut Knaack
Pass up the real error code returned by platform_get_irq_byname(). Signed-off-by: Hartmut Knaack <knaack.h@gmx.de> Acked-by: Antoine Tenart <antoine.tenart@free-electrons.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-23iio: adc: add support for BerlinAntoine Tenart
This patch adds the support of the Berlin ADC, available on Berlin SoCs. This ADC has 8 channels available, with one connected to a temperature sensor. The particularity here, is that the temperature sensor connected to the ADC has its own registers, and both the ADC and the temperature sensor must be configured when using it. Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>