Add onboard LED support for Dragonboard410c. There are 4 user LEDs and
two LEDs for BT and WLAN.
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
1. Add support for initializing onboard LEDs based on board definition.
Maximum LED count has been set to 12.
2. Introduce mraa_led_init_raw API for initializing LEDs based on
function name. This API can be used by platforms which doesn't have mapping
in board definition.
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
On Dragonboard410c, configure SPI0_CS pin as GPIO for enabling the
user to control it without adding chip select property in Devicetree.
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
1. Extend the lookup count to phy_pin_count to cover all physical pins
exposed on the board
2. Ignore the non GPIO pins by checking for GPIO capability
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Multiple changes necessary to enable this. The main goal is to build
and run the C++ ioinit unit tests (which require c++11)
* Updated mraa required CMake version to 2.8.11 (this is needed for
the target_xxx_xxx CMake syntax.
* Added function for adding the c++11 flag give a CMake target.
* Updated unit tests for range of CMake versions (tested on 2.8.11,
3.8.2, 3.9.6, and 3.12.0).
* Added C++ unit test file (more needed here).)
Signed-off-by: Noel Eck <noel.eck@intel.com>
This commit adds Ultra96, one of the Consumer Edition boards of the
96Boards family.
Ultra96 is an Arm-based, Xilinx Zynq UltraScale+ MPSoC development board.
This board runs petalinux distribution on the ARM core and integrates
Xilinx programmable logic (PL) UltraScale architecture in a single fabric.
This board supports standard peripherals defined by 96Boards CE
Specification. Since it ships with >4.8 kernel, only chardev mapping
is supported for accessing GPIO.
More information about this board can be found in 96Boards product
page: https://www.96boards.org/product/ultra96/
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
This commit cleans up the 96boards board support by sorting the boards
in alphabetical manner and also executing clang-format for 96boards.c
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
If strtol fails to process any characters, return a failure.
Added protocol chunk string to each parse_xxx method for completeness
when printing to syslog.
Added more tests - passing and failing cases.
Signed-off-by: Noel Eck <noel.eck@intel.com>
Since peripheral manager does not build in the IIO source, ifdef's were
added around the initio functionality for IIO.
IMO this is an ugly fix, but I don't see a better way since the
PERIPHERALMAN architecture is qualified throughout the CMake and source
with ifdef's.
Signed-off-by: Noel Eck <noel.eck@intel.com>
This commit limits which tests run on which ARCH to allow all tests to
pass on CI.
* Qualify the FTDI tests with (FTDI4222 AND USBPLAT)
* Qualify the IO init tests with (DETECTED_ARCH == "MOCK")
* Renamed all unit tests to start with 'test_unit_' to facilitate
grouping with tab completion (or any other type of sorting)
* Updated docker targets with new unit test target name
Signed-off-by: Noel Eck <noel.eck@intel.com>
For all subplaform pins, save the subplatform index as dev->pin and the
actual platform index as dev->phy_pin.
Example:
pin 515 (subplatform pin 3)
dev->pin = 515
dev->phy_pin = 515 - 512 = 3
In this way, methods which get a mraa_gpio_context have a means
to tell whether the pin is on a subplatform or not.
Signed-off-by: Noel Eck <noel.eck@intel.com>
Updates to make the FT4222 platform extender more usable.
Previous implementation opened libft4222.so and loaded symbols as
needed. This implementation removes dynamic loading of libft4222 in
favor of creating a new shared libary which links against libft4222.so.
The dynamic loading is now done in mraa.c. One C method is exposed in
libmraa-platform-ft4222.so for finding/initializing an FT4222:
mraa_platform_t mraa_usb_platform_extender(mraa_board_t* board);
Mraa.c attempts to open this platform library and calls the
mraa_usb_platform_extender method. If an ftdi4222 is connected, the
user gets added IO from the extender. If no FT4222 device is connected,
continue as normal.
* Create a new platform library for the FT4222
* Expose only 1 C method from the library -
mraa_usb_platform_extender
* libmraa-platform-ft4222.so contains CXX code (as well as previous
C code). All *allocs have been removed in favor of global
C++ stl containers.
* Previously, the FT4222 would only initialize correctly if 2 ftdi
devices existed. Now, initialize FT4222 devices based on the
device id.
* Many fixes for various problems with the FT4222
* Added unit test for platform extender (minimal functionality w/o hw)
* Updated to FindFtd4222.cmake module to handle standard arguments
* Removed CMAKE_C_FLAGS addition of -DFTDID2XX and -DFTDI4222 since
these are NOT used anywhere in source.
* Building the FTDI4222 shim requires libft4222.h which requires
ftd2xx.h. Updated CMakeLists.txt to require both when building
the shim.
Signed-off-by: Noel Eck <noel.eck@intel.com>
The chardev feature changed the flow for most GPIO functions but did not take into account existing function hooks correctly.
This fixes the checks and restores subplatform GPIO access.
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
Went a bit too far with the previous commit. Added pointer to pointer
back to mraa_find_uart_bus_pci.
Tested leaks against valgrind and verified dev_path gets set with gdb.
Signed-off-by: Noel Eck <noel.eck@intel.com>
Unfortunately the device_path char* is dynamically allocated
and #defined and const char *'ed depending on how each platform provided the
uart device paths which makes cleaning it up more complicated.
Added a check for the IEI_TANK.
Removed the char** (in favor of a char*) for mraa_find_uart_bus_pci.)
Signed-off-by: Noel Eck <noel.eck@intel.com>
Fixes for assortment of memory leaks. Updated i2c_read/write_internal
methods to get the controller status ONLY when a read/write fails.
Signed-off-by: Noel Eck <noel.eck@intel.com>
* Fixed broken switch statement - missing 'case' in front of labels
* Added default case to switch statement
* Removed unused variable
* Removed unused static functions
* Attempted to fix cases where functions are returning/not returning
data incorrectly.
* Attempted to fix i2c read which was returning an
* uninitialized/unused variable.
Signed-off-by: Noel Eck <noel.eck@intel.com>
If numDevs is not == 2, the previous code would fail. If numDevs > 2
(example 1 ft2xx device connected and 1 ft4222 device in mode 3) then
the code would not initialize the FT4222 and give an error that the mode
must be 0 or 3.
Updated source to find the first index of a ft4222 device. Initialize
it as I2C. If another device of the same id exists, then initialize it
as GPIO.
Added more syslog messages for debugging.
Signed-off-by: Noel Eck <noel.eck@intel.com>
Add support for Hikey960 board from HiSilicon based on their Kirin960 SoC.
Peripherals supported:
1. GPIO
2. UART
3. I2C
For GPIO only Chardev interface has been added since this board only supports
>=4.15 kernel and using legacy sysfs interface is highly discouraged.
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: malikabhi05 <abhishek.malik@intel.com>
The following APIs are only used for getting the line information from
kernel by opening the gpiochip independently and they fails to close
the file descriptor when done:
1. mraa_get_line_info_by_chip_number()
2. mraa_get_line_info_by_chip_name()
3. mraa_get_line_info_by_chip_label()
This will create issue if these API consumers like mraa_gpio_read_dir(),
mraa_gpio_mode(), mraa_gpio_chardev_dir() gets called in a loop. The
system will run out of file descriptor after some time.
Fix this issue by closing the opened file descriptors before freeing
the cinfo struct.
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: malikabhi05 <abhishek.malik@intel.com>
Move the chardev enablement inside the platform check.
Some boards might not have the chardev mapping yet.
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: malikabhi05 <abhishek.malik@intel.com>
The flag used for checking the kernel owned gpio line is GPIOLINE_FLAG_KERNEL.
Hence use that instead of GPIOLINE_FLAG_IS_OUT.
Flag used for checking the open source gpio line is GPIOLINE_FLAG_OPEN_SOURCE.
Hence use that instead of GPIOHANDLE_REQUEST_OPEN_SOURCE, which should be
only used when requesting lines.
Reported-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: malikabhi05 <abhishek.malik@intel.com>
As of now both Dragonboard410c and Hikey boards run latest LTS kernel.
Hence, adding chardev support for those.
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: malikabhi05 <abhishek.malik@intel.com>