summaryrefslogtreecommitdiff
path: root/drivers/iio/dac/stm32-dac.c
AgeCommit message (Collapse)Author
2021-11-27iio: expose shared parameter in IIO_ENUM_AVAILABLEAntoniu Miclaus
The shared parameter should be configurable based on its usage, and not constrained to IIO_SHARED_BY_TYPE. This patch aims to improve the flexibility in using the IIO_ENUM_AVAILABLE define and avoid redefining custom iio enums that expose the shared parameter. An example is the ad5766.c driver where IIO_ENUM_AVAILABLE_SHARED was defined in order to achieve `shared` parameter customization. The current state of the IIO_ENUM_AVAILABLE implementation will imply similar redefinitions each time a driver will require access to the `shared` parameter. An example would be admv1013 driver which will require custom device attribute for the frequency translation modes: Quadrature I/Q mode and Intermediate Frequency mode. Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com> Reviewed-by: Alexandru Ardelean <ardeleanalex@gmail.com> Link: https://lore.kernel.org/r/20211119085627.6348-1-antoniu.miclaus@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-05-17iio: dac: stm32-dac: Use pm_runtime_resume_and_get() to replace open coding.Jonathan Cameron
Found using coccicheck script under review at: https://lore.kernel.org/lkml/20210427141946.2478411-1-Julia.Lawall@inria.fr/ This is a prequel to taking a closer look at the runtime pm in IIO drivers in general Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Cc: Fabrice Gasnier <fabrice.gasnier@foss.st.com> Reviewed-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com> Reviewed-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Link: https://lore.kernel.org/r/20210509113354.660190-17-jic23@kernel.org
2021-03-29iio: dac: Convert powerdown read callbacks to sysfs_emit()Lars-Peter Clausen
Update DAC drivers powerdown attribute show callback to use the new sysfs_emit() function. sysfs_emit() is preferred over raw s*printf() for sysfs attributes since it knows about the sysfs buffer specifics and has some built-in sanity checks. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Link: https://lore.kernel.org/r/20210320071405.9347-5-lars@metafoo.de Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-09-16iio: stm32-dac: Replace indio_dev->mlock with own device lockSergiu Cuciurean
As part of the general cleanup of indio_dev->mlock, this change replaces it with a local lock. The lock protects against potential races when reading the CR reg and then updating, so that the state of pm_runtime is consistent between the two operations. This is part of a bigger cleanup. Link: https://lore.kernel.org/linux-iio/CA+U=Dsoo6YABe5ODLp+eFNPGFDjk5ZeQEceGkqjxXcVEhLWubw@mail.gmail.com/ Signed-off-by: Sergiu Cuciurean <sergiu.cuciurean@analog.com> Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Reviewed-by: Fabrice Gasnier <fabrice.gasnier@st.com> Link: https://lore.kernel.org/r/20200916092349.75647-1-alexandru.ardelean@analog.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>
2019-10-15iio: dac: stm32: add power management supportFabrice Gasnier
Add support for runtime PM & sleep. Provide pclk to regmap as registers access doesn't need full power (e.g. regulator). Always restore HFSEL when resuming. It may get lost depending on low power level that has been achieved. Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-01-08iio: stm32: Adopt SPDX identifierBenjamin Gaignard
Add SPDX identifier in stm32's files in IIO directory Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com> Acked-by: Fabrice Gasnier <fabrice.gasnier@st.com> Acked-by: Philippe Ombredanne <pombredanne@nexb.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-08-22iio:dac: drop assignment of iio_info.driver_moduleJonathan Cameron
The equivalent of this is now done via macro magic when the relevant register call is made. The actual structure element will shortly go away. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
2017-07-15iio: dac: stm32: fix error messageFabrice Gasnier
Fix error message, there's no 'st,dac-channel' property, but 'reg' (see https://lkml.org/lkml/2017/4/3/567). Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-04-14iio: dac: add support for stm32 DACFabrice Gasnier
Add support for STMicroelectronics STM32 DAC. It's a 12-bit, voltage output digital-to-analog converter. It has two output channels, each with its own converter. It supports 8 bits or 12bits left/right aligned data format. Only 12bits right-aligned is used here. It has built-in noise or triangle waveform generator, and supports external triggers for conversions. Each channel can be used independently, with separate trigger, then separate IIO devices are used to handle this. Core driver is intended to share common resources such as clock, reset, reference voltage and registers. Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>