aboutsummaryrefslogtreecommitdiffstats
path: root/src/linux/gpio.h
Commit message (Collapse)AuthorAgeFilesLines
* i2c: handle errors at i2ccmdsTimofey Titovets2024-10-261-2/+2
| | | | Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
* linux: Fast Linux MCU i2c_read() with I2C_RDRW (#6101)Dr. Matthew Swabey2023-03-141-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Reading an I2C device from the Linux MCU used a separate write(2) to select the target register & read(2) to get the value(s). This implementation uses ioctl(file, I2C_RDWR, ...) to skip a large bus idle period and extra process sleep by combining them like the stm32. I2C_RDRW requires I2C_FUNC_I2C flag in the I2C driver. I2C_FUNC_I2C is defined in: BCM2835: Pi 1 Models A, A+, B, B+, the Raspberry Pi Zero, the Raspberry Pi Zero W, and the Raspberry Pi Compute Module 1 BCM2836: Pi 2 Model B Identical to BCM2835 except Cortex BCM2837: Pi 3 Model B, later models of the Raspberry Pi 2 Model B, and the Raspberry Pi Compute Module 3 BCM2837B0: Pi 3 Models A+, B+, and the Raspberry Pi Compute Module 3+ BCM2711: Pi 4 Model B, the Raspberry Pi 400, and the Raspberry Pi Compute Module 4 RK3xxx: Rockchips SoCs NanoPi, RockPi, Tinker, etc. SUNXI: H2, H3, etc. Orange Pi AMLOGIC: S905x, Banana Pi, Odroid, etc. TEGRA: NVidia Jetson etc. MediaTek: Several SBCs in other ranges Signed-off-by: Matthew Swabey <matthew@swabey.org>
* linux: Disable hardware pwm when it is set to zeroKevin O'Connor2020-07-201-1/+1
| | | | | | | | | | | Only write "1" to the "enable" file when a non-zero pwm width is requested. Write "0" to the "enable" file when a zero pwm width is requested. This fixes a problem on the replicape servo lines that prevented them from being fully disabled. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* linux: userspace GPIO controlandryblack2020-05-171-4/+12
| | | | | | Allow use host GPIO pins for non-realtime purposes. Signed-off-by: Andrey Kunitsyn <blackicebox@gmail.com>
* linux: implement i2cArksine2020-01-131-0/+9
| | | | Signed-off-by: Eric Callahan <arksine.code@gmail.com>
* linux: add support for Linux hardware PWMJanne Grunau2019-04-051-0/+7
| | | | | | | | | | The replicape servo pins (P9_14/P9_16) are muxed to the SOCs hardware PWM unit driven by a 13MHz GP timer. They have to be driven by the linux host mcu. This commits adds hardware PWM support using the linux sysfs user space interface. Signed-off-by: Janne Grunau <janne-3d@jannau.net> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* linux: Add support for bi-directional SPI communicationRicardo Amezquita2018-07-241-0/+1
| | | | | Signed-off-by: Ricardo Amézquita <ramezquitao@cihologramas.com> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* SPI: introduce spi_prepare functionGrigori Goronzy2018-07-081-0/+1
| | | | | | | | | | | | | | | | The SPI interface needs to be enabled and configured to the correct settings of a given oid before CS is asserted. The new function spi_prepare() allows ports to do that. This port only introduces the new function in all ports with no implementation and adds the call to the Klipper generic firmware code. That means everything still works as before. Ports need to be changed to fix the underlying issue. Discussion about the motivation here: https://github.com/KevinOConnor/klipper/pull/453#issuecomment-403131149 Signed-off-by: Grigori Goronzy <greg@chown.ath.cx>
* stepper: Introduce and use gpio_out_toggle_noirq()Kevin O'Connor2018-05-151-0/+1
| | | | | | | | | | | | | | | The gpio_out_toggle() function in the sam3x8e and stm32f1 code was only valid if it was called with irqs disabled. Commits 018c5daa and 9c52ad43 enabled the lcd code which called gpio_out_toggle() with irqs enabled. This could cause corruption of the gpio state. Introduce a gpio_out_toggle_noirq() function that will only be invoked with irqs disabled, and fix gpio_out_toggle() on sam3x8e and stm32f1 so that it safe to call even if irqs are enabled. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* linux: Convert linux SPI code to use the generic spicmds.c codeKevin O'Connor2018-05-071-0/+14
| | | | | | | | | | Use the generic spi send/receive code on Linux. Update the replicape code to use the updated command format. Also, update the replicape code to turn off the stepper motors on a shutdown event. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* linux: Add support for analog IIO devicesKevin O'Connor2017-09-201-0/+14
Add support for reading analog values via the standard Linux IIO interface. This can be used on Replicape boards to sample analog input pins. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>