summaryrefslogtreecommitdiffstats
path: root/drivers/aiodev
Commit message (Collapse)AuthorAgeFilesLines
* 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>