summaryrefslogtreecommitdiffstats
path: root/drivers/aiodev
Commit message (Collapse)AuthorAgeFilesLines
* aiodev: stm32: add STM32MP13x supportAhmad Fatoum2023-12-051-0/+14
| | | | | | | | | The Linux driver for the STM32 ADC has only minor differences to the STM32MP15 driver. Add these changes to barebox, even if untested. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20231127064947.2207726-12-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/imx'Sascha Hauer2023-09-253-0/+628
|\
| * aiodev: port Linux vf610-adc driverChristian Eggers2023-09-043-0/+628
| | | | | | | | | | | | | | | | | | | | This driver works with the ADC on i.MX6SLX, i.MX6UL and i.MX6ULL. Port the Linux v6.4 driver of the peripheral to make them usable in barebox. Signed-off-by: Christian Eggers <ceggers@arri.de> Link: https://lore.barebox.org/20230825100031.11647-1-ceggers@arri.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | aiodev: imx_thermal: fix breakage after device tree syncAhmad Fatoum2023-09-121-21/+4
|/ | | | | | | | | | | | | | | | | | | fsl,tempmon-data is a deprecated property that has been replaced upstream by a NVMEM cell pointing at the calibration value and so made it into barebox breaking the driver. Switch to using the new property to fix the regression. We do not keep support for the old binding around as it would be dead code: barebox, unlike Linux, is always bundled with a device tree originating from its build tree and so we only need to ensure the driver matches that version. Fixes: abef60363d8e ("dts: update to v5.8-rc1") Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.barebox.org/20230911124808.2748160-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* treewide: add MODULE_DEVICE_TABLE markersAhmad Fatoum2023-06-138-0/+8
| | | | | | | | | | | | | | | | Syncing device trees with Linux upstream can lead to breakage, when the device trees are switched to newer bindings, which are not yet supported in barebox. To make it easier to spot such issues, we want to start applying some heuristics to flag possibly problematic DT changes. One step towards being able to do that is to know what nodes barebox actually consumes. Most of the nodes have a compatible entry, which is matched by an array of of_device_id, so let's have MODULE_DEVICE_TABLE point at it for future extraction. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230612125908.1087340-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* treewide: fix includes missed by multiarch supportAhmad Fatoum2023-04-112-2/+2
| | | | | | | | | | | Found by manual inspection of the results of: rg '#include\s*<mach/[^/]+>' | rg -v 'arch/(powerpc|sandbox|mips|x86|kvx)' Fixes: 68b778c24314 ("ARM: Drop mach dir include path") Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230411071436.1630752-13-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Rename struct driver_d to driverSascha Hauer2023-01-109-9/+9
| | | | | | | | | | | The '_d' suffix was originally meant to distinguish barebox struct names from Linux struct names. struct driver doesn't exist in Linux, so we can rename it and remove the meaningless suffix. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.barebox.org/20221214123512.189688-4-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Rename struct device_d to deviceSascha Hauer2023-01-1011-22/+22
| | | | | | | | | | | | | The '_d' suffix was originally introduced in case we want to import Linux struct device as a separate struct into barebox. Over time it became clear that this won't happen, instead barebox struct device_d is basically the same as Linux struct device. Rename the struct name accordingly to make porting Linux code easier. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.barebox.org/20221214123512.189688-3-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Rename device_d::device_node to device_d::of_nodeSascha Hauer2023-01-106-16/+18
| | | | | | | | | | | | | | | | | | | | Linux struct device has the member of_node for the device_node pointer. Rename this in barebox accordingly to minimize the necessary changes when porting Linux code. This was done with the semantic patch: @@ struct device_d E; @@ - E.device_node + E.of_node @@ struct device_d *E; @@ - E->device_node + E->of_node Plus some manual adjustments. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.barebox.org/20221214123512.189688-2-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* aiodev: port Linux imx7d-adc driverAhmad Fatoum2022-10-283-0/+440
| | | | | | | | | | The i.MX7 has two ADCs of 4 logical channels each. Port the Linux v6.0 driver of the peripheral to make them usable in barebox. This can be useful for board type/revision detection that employs voltage dividers. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20221024095612.1537704-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* aiodev: add ST L3GD20 Gyroscope and temperature sensor supportAhmad Fatoum2022-07-113-0/+129
| | | | | | | | | | | The L3GD0 is an on-board peripheral of the STM32F429-DISCOVERY and as such a good target to test out SPI driver support. Add a simple aiodev driver to interface with it. It can read the chip's angular rate in three dimensions as well as the temperature sensor embedded in it. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Link: https://lore.barebox.org/20220708055526.1177941-1-ahmad@a3f.at Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: rename of_find_node_by_name() to of_find_node_by_name_address()Sascha Hauer2022-03-081-1/+1
| | | | | | | | | | | | | of_find_node_by_name() has the same name as the corresponding kernel function but a different semantics. A node name is comprised of the nodes name and a unit address, separated with '@'. Linux of_find_node_by_name() matches only the name before the '@' whereas the barebox function compares the full name. As several callers depend on the barebox semantics we can't just change the semantics, so rename the barebox function to of_find_node_by_name_address(). Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: stm32mp: allow driver reuse for STM32 MCUsAhmad Fatoum2022-02-011-1/+1
| | | | | | | | | | | Most peripheral driver are usable for both STM32 MPUs and MCUs, but so far we they were only used for STM32MP1. In preparation for adding MCU support, introduce a new ARCH_STM32 selected by ARCH_STM32MP and migrate common drivers to it. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220131075725.1873026-12-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* drivers: migrate "GPL-2.0" license identifiers to SPDX 2.0Roland Hieber2021-11-229-9/+9
| | | | | | | | | | "GPL-2.0-only" was introduced in SPDX 2.0, and the old identifier "GPL-2.0" is now considered deprecated; see <https://spdx.org/licenses>. Fixes: 28f4a6a4df76f0f1581d (2021-10-30, "drivers: add missing SPDX-License-Identifier") Signed-off-by: Roland Hieber <rhi@pengutronix.de> Link: https://lore.barebox.org/20211117113851.2022669-2-rhi@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/spdx'Sascha Hauer2021-11-155-27/+5
|\
| * drivers: add missing SPDX-License-IdentifierAhmad Fatoum2021-11-015-27/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds the suitable SPDX-License-Identifier to all files in drivers/ that previously lacked one. To aid manual inspection, following heuristics can be used: * No changes outside of comments/whitespace: git show -U0 HEAD | rg -v '^(@@|diff|index)|[-+]([-+]|//|#|[\s/]\*)' * -or-later come in pairs: git show --inter-hunk-context=19 HEAD | \ perl -0777 -F'/^@/gm' -ne 'for (@F) { @m = /later/g; print if @m & 1 }' Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20211030175632.2276077-4-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | aiodev: fix bitrotted EXPORT_SYMBOLAhmad Fatoum2021-11-011-1/+1
|/ | | | | | | | | Build with module support enabled rightfully complains about the unknown symbol. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20211030175812.2276705-5-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* aiodev: add driver for Rockchip SARADCMichael Riesch2021-06-283-0/+206
| | | | | | | | | This commit adds support for the Successive Approximation Register (SAR) ADCs that can be found in Rockchip SoCs, such as the RK3568. Signed-off-by: Michael Riesch <michael.riesch@wolfvision.net> Link: https://lore.barebox.org/20210624160915.21897-2-michael.riesch@wolfvision.net Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* aiodev: lm75: Handle unknown lm75 typesSascha Hauer2021-05-181-0/+2
| | | | | | | | | lm75 type unknown is not handled in the switch/case handling all types. Handle it to avoid compiler warnings. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20210517185424.32145-14-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* aiodev: add support for STM32 ADCAhmad Fatoum2021-02-105-0/+645
| | | | | | | | | | | | This driver supports simple one-shot readings rather than continuous sampling with DMA, etc. ADC channels should be configured via device tree, using the kernel bindings. Code is based on the stm32-adc drivers of Linux v5.11-rc1 and U-Boot v2021.01-rc4. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc' into masterSascha Hauer2020-10-145-2/+357
|\
| * aiodev: am335x_adc: Driver for ADC on TI AM335x SoCsTrent Piepho2020-09-294-0/+355
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a simple driver for the ADC. It's designed to get single readings. Possible uses would be temperature sensing a thermistor, measuring a power rail, or a detecting multi-level board ID pin strapping. It's not designed to co-exist with a touch screen controller driver, which uses the same hardware on the AM335x, as there is no barebox touchscreen driver. The device tree binding is compatible with the Linux IIO driver. This is from the Linux driver: The ADC clock is expected to run at target of 3MHz, and expected to capture 12-bit data at a rate of 200 KSPS. The TSC_ADC_SS controller design assumes the OCP clock is at least 6x faster than the ADC clock. The OCP clock is 100 MHz, from CORE_CLKOUTM4/2. The AM335x Reference Manual §12.2.2 gives a max ADC clock of 24 MHz. There's nothing about the factor of 6x OCP to ADC, a 3 MHz ADC target, nor 200 kSPS. In §12.3.7 a limit of at least 15 ADC clock cycles per sample is given. The AM335x Datasheet §5.10 provides more parameters for the ADC: An ADC clock max of 3 MHz, a nominal conversion time of 13 cycles, min and max acquisition time of 2 to 257 cycles, and a max sample rate (@ 3 MHz) of 200 kSPS. A 3 MHz ADC clock at 15 cycles per sample provides for a 200 kSPS sampling rate. The minimum open, sampling, and conversion times are 0, 1, and 13 clocks, respectively. This would seem to indicate the sampling at 14 cyles per sample is possible. Perhaps the "Sample Delay" in the reference manual is called "Acquisition Time" in the datasheet, and the reference manual minimum of 1 cycle is incorrect and the minimum is actually 2 cycles. Which would then produce a minimum of 15 cycles per sample. This driver assumes the external references will be used (as does the Linux IIO driver). This would have been good to put into the device tree bindings, but the Linux driver's bindings did not do that. The Barebox driver will convert the ADC reading to mV, and assumes the external refs are GND and 1.8V. This also would have been nice to put into the device tree binding. It also doesn't allow for automatically adjusting for an external divider, commonly to measure power rails above 1.8V, e.g. the BeagleBone Black ain7 measures the 3.3V rail divided by 2. Signed-off-by: Trent Piepho <trent.piepho@synapse.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * aiodev: Name channels with device instance nameTrent Piepho2020-09-291-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When dynamically assigning device names, an aiodev's name will be "aiodev" and an index, not part of the name string itself, will be allocated dynamically. These are combined to register a device with a name like "aiodev0" or "aiodev1". The shell environment variables use the device name, so one might use "${aiodev0.in_value0_mV}" and "${aiodev1.in_value0_mV}". However, the channel names that are used with aiochannel_get_by_name() just use the aiodev's name and channel name. So channel 0 of the 1st aiodev would be "aiodev.in_value0_mV" and the 2nd aiodev would use the same name. Change the channel naming to use the device instance name, e.g. "aiodev0", rather than the aiodev's base name. This makes the names used aiochannel_get_by_name() match the environment variable names and also avoids duplicate names with more than one dynamically allocated aiodev. Rename aiochannel_get_by_name() to aiochannel_by_name() so that any out of tree boards that use it will fail to compile, since they now need to pass in a different name. Signed-off-by: Trent Piepho <trent.piepho@synapse.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | aiodev: lm75: fix out-of-bounds write on 64-bit SoCsAhmad Fatoum2020-10-091-3/+4
|/ | | | | | | | Probing the lm75 device driver on 64 bit systems invokes undefined behavior, because of an errant cast. Fix this. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* aiodev: Replace license and copyright boilerplate by SPDX identfiersUwe Kleine-König2020-05-252-29/+6
| | | | | | | | | | | | This adapts all files that were identifed by licensecheck (https://salsa.debian.org/build-common-team/licensecheck.git) as licensed under the GPL and that have a (IMHO) clear copyright statement. The advantage is that these specifiers are machine-parseable which helps license conformance, e.g. for packaging barebox in Debian. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2020-05-143-9/+0
|\
| * treewide: remove references to CREDITSUwe Kleine-König2020-04-273-9/+0
| | | | | | | | | | | | | | | | The CREDITS file was removed from barebox in 2015 by commit 6570288f2d97 ("Remove the CREDITS file"). Remove references to it from several files. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | drivers: mark first batch of compilable drivers for COMPILE_TESTAhmad Fatoum2020-05-081-1/+1
|/ | | | | | | | | All of these drivers have a runtime dependency on SoC peripherals, but can nevertheless be compile-tested. Add COMPILE_TEST as an alternate dependency. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* aiodev: mc13xxx: Mark mc13xxx_adc_do_conversion() staticAndrey Smirnov2018-11-191-2/+3
| | | | | | | | Mark mc13xxx_adc_do_conversion() static because it is not used outside the source file. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/net-switch-mv88e6xxx'Sascha Hauer2018-11-093-3/+3
|\
| * drivers: Introduce dev_set_name()Andrey Smirnov2018-10-181-1/+1
| | | | | | | | | | | | | | | | Introduce dev_set_name() in order to hide implementation details of setting device's name so it'd be easier to change it. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * aiodev: qoriq_thermal: Give aiodev a more descriptive nameAndrey Smirnov2018-10-181-0/+1
| | | | | | | | | | Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * aiodev: imx_thermal: Give aiodev a more descriptive nameAndrey Smirnov2018-10-181-0/+1
| | | | | | | | | | Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * aiodev: Don't try to use DT node name as aiodev->nameAndrey Smirnov2018-10-181-2/+0
| | | | | | | | | | | | | | | | | | Don't try to use DT node name as aiodev->name in aiodev_regster() since, for some devices (e. g. tempmon) than name would already be taken by parent platform device. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | i2c: introduce device_i2c_driver() macroMarco Felsch2018-10-191-9/+1
|/ | | | | | | | | Add macro and dependency to avoid boilerplate code. Since now simple i2c drivers only have to include the i2c.h header and call the device_i2c_driver() macro to register a i2c device driver. Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* aiodev: Port Linux driver for i.MX8MQ CPU thermal sensorAndrey Smirnov2018-09-243-0/+272
| | | | | | | | This patch is a minimal port of the corresponding driver that can be found in Linux kernel (drivers/thermal/qoriq_thermal.c). Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* imx_thermal: Fixed missing dependency for the IMX_THERMAL configEugen Wiens2018-08-061-0/+2
| | | | | | | The temperature sensor driver for Freescale i.MX SoCs use internaly the OCOTP character device. If the config IMX_THERMAL is selected the OCOTP config was not selected and comes up with an error during booting. Signed-off-by: Eugen Wiens <eugen.wiens@jumo.net> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* aiodev: Fix whitespaces in KconfigSascha Hauer2018-08-061-4/+4
| | | | | | Replace whitespaces with tabs. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* aiodev: mc13xxx: add adc supportAndrey Gusakov2018-04-103-0/+241
| | | | | Signed-off-by: Andrey Gusakov <andrey.gusakov@cogentembedded.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* imx_thermal: Remove leftover debug outputAndrey Smirnov2016-07-151-2/+0
| | | | | Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* aiodev: imx_thermal: depend on MACH_IMX6Lucas Stach2016-06-231-0/+1
| | | | | | | This driver uses private includes from the imx6 architecture. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* aiodev: imx_thermal: remove empty includeLucas Stach2016-06-231-1/+0
| | | | | | | | This file doesn't hold any content any more, so there is no need to include it. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* aiodev: Add basic LM75 temperature driverSascha Hauer2016-05-183-0/+269
| | | | | Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* aiodev: Add TEMPMON driverAndrey Smirnov2016-05-183-0/+225
| | | | | | | Port TEMPMON driver from U-Boot Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* drivers: Introduce AIODEV subsystemSascha Hauer2016-05-183-0/+158
AIODEV/Aiodevice is a analog I/O framework that can be thought of as a simplified hybrid between 'hwmon' and 'IIO' subsystems of Linux kernel This commit is very heavily based on 'iodevice' framework proposal written by Sascha Hauer. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>