These are all the case that coccinelle cannot find as they are inside
macro declarations.
Fixed via:
git grep -rlz -E "\(struct device \*" |
xargs -0 sed -i 's/(struct device/(const struct device/g'
Fixes#27399
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Now that device_api attribute is unmodified at runtime, as well as all
the other attributes, it is possible to switch all device driver
instance to be constant.
A coccinelle rule is used for this:
@r_const_dev_1
disable optional_qualifier
@
@@
-struct device *
+const struct device *
@r_const_dev_2
disable optional_qualifier
@
@@
-struct device * const
+const struct device *
Fixes#27399
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Let's set the api at built time, or this will create a bug once device
instance pointers become constant.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Add an emulation controller which routes I2C traffic to attached
emulators depending on the I2C address selected. This allows drivers
for I2C peripherals to be tested on systems that don't have that
peripheral attached, with the emulator handling the I2C traffic.
Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Removed all nrf_power/USB related stuff from clock control
driver to USB driver.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
The driver utilizes the CONFIG_NET_OFFLOAD setting to avoid the
normal handling of IP packets, and instead uses a socket-like
UART interface to handle incoming and outgoing data via AT commands.
Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
This patch adds support for the Texas Instruments LP5030 and LP5036
I2C LED controllers. They are respectively providing up to 30 and 36
channels (i.e. 10 or 12 RGB LEDs).
In addition to the channel/color registers this LED controller provides
a per-LED brigthness register. This driver implements both LED-based and
channel-based API methods:
- led_on
- led_off
- led_get_info
- led_set_brightness
- led_set_color
- led_set_channel
- led_write_channels
Signed-off-by: Simon Guinot <simon.guinot@seagate.com>
Some LED controllers are connected to a large number of LEDs (i.e.
array/strip of LEDs). A user may need to set several LEDs at the same
time. The LED oriented syscalls are not adapted to this task. Indeed a
call per LED is needed to configure a group of LEDs. To that end, this
patch adds the led_set_channel and led_write_channels syscalls to the
LED API. They offer direct access to the raw channels. They respectively
allow to set a single channel and to write several contiguous channels
(and therefore to configure a group of LEDs).
Moreover the addition of the led_write_channels syscall also aims at
closing the gap with the LED strip API.
Signed-off-by: Simon Guinot <simon.guinot@seagate.com>
Signed-off-by: Maxime Bittan <maxime.bittan@seagate.com>
For the LED controller without any hardware blinking capability this
doesn't really make sense to make the blink callback mandatory. It is
better to let it undefined. This way this will allow the LED API to
fall back to a common software blink implementation.
In addition some controllers with RGB LEDs don't have the capability
to configure the LED brightness but only the channel/color levels.
Their drivers may only implement the set_color callback.
That's why this patch makes the blink and set_brightness LED API
callbacks optional.
Signed-off-by: Simon Guinot <simon.guinot@seagate.com>
The led_set_color syscall adds support for multicolor (i.e.
multi-channel) LEDs to the LED API. It allows a user to set all the
colors/channels of a LED at once by passing a color array. Note that
this array must provide an entry per color/channel and must also be
ordered following the color mapping of the LED. This color mapping can
be either retrieved from the "color-mapping" DT property or from the LED
driver itself (by using the led_get_info syscall).
Signed-off-by: Simon Guinot <simon.guinot@seagate.com>
When supported by the driver the led_get_info syscall allows a user
to retrieve the following information about each LED available:
- The LED label.
- The number of colors/channels.
- And for a multicolor LED a pointer to a channel-color mapping.
Signed-off-by: Simon Guinot <simon.guinot@seagate.com>
Signed-off-by: Maxime Bittan <maxime.bittan@seagate.com>
Actually the LED API functions are handling channel objects. The "led"
parameter passed to the functions is defined as a channel number. This
patch redefines it as a LED number instead.
Note that this patch doesn't change anything for the drivers handling
mono-color (or single channel) LEDs. For the drivers handling multicolor
(or multi-channel) LEDs, such as the lp5562, then the API is broken.
Signed-off-by: Simon Guinot <simon.guinot@seagate.com>
Most if not all drivers use an internal function
spi_context_configured() to bypass reconfiguring the SPI peripheral
when nothing has changed. That function determines change based on
comparing the struct spi_config pointer that was last used. This does
not work if a user changes fields within the pointed-to structure.
Document that pointer comparison may be used to detect changes.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
-Wimplicit-fallthrough=2 requires a fallthrough comment or a compiler
to tells gcc that this happens intentionally.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
Many developers will be unfamiliar with UM10204 so document the rates
that are associated with the standard, fast, etc. speed names.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
The header was missing the language linkage wrapper that allows the
driver-specific function to be located from C++.
Also it helps the poor user to be informed that the function is only
available when a special Kconfig option is set.
Signed-off-by: Peter A. Bigot <pab@pabigot.com>
Some flash drivers are capable of issuing a JESD216 READ_SFDP command
to read serial flash discoverable parameters. Allow applications and
utilities access to API that reads the JEDEC ID from those devices.
Signed-off-by: Peter A. Bigot <pab@pabigot.com>
Some flash drivers are capable of issuing a JESD216 READ_SFDP command
to read serial flash discoverable parameters. Allow applications and
utilities access to that capability where it's supported.
Signed-off-by: Peter A. Bigot <pab@pabigot.com>
This device isn't an actual hardware driver: it's a virtual EEPROM
that stores data in an instance-specific RAM buffer, with the data
exposed on an I2C bus as a I2C follower (slave) device that can be
controlled by another device acting as a leader (master) on that same
bus.
As such it's a reasonable example of how to write an I2C follower
driver, but it's not clear that it has a real use in applications. A
Zephyr application that needs to emulate an EEPROM in a real-world
system would be unlikely to provide its data from a RAM buffer.
The sole in-tree reference is in the i2c_slave_api test, so move the
driver implementation into that test.
The Kconfig and hierarchy are being left in place until it is more
clear how this functionality should be selectable within Zephyr. The
I2C_SLAVE symbol has been converted from menuconfig to config to
eliminate a Kconfig style diagnostic.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
There use to be a config attribute of type device_config, on which
config_info could be found. config_info was thus named that way to
differentiate easily from config attribute in struct device.
Now that there is no such device_config structure, config_info in
structure device now, can be renamed to config.
Semantically, it makes for sense. We have an attribute pointing to the
configuration of the device driver instance. Configuration information
is correct but has a redundant meaning.
Fixes#27397
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
It does not auto-initiate the DLE procedure if the default data length
parameters are not equal to the initial parameters.
Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
Some controllers do not follow the recommendation of auto-initiating
a data length update if the host writes default data length parameters.
If the controller follows this recommendation, calling
LE Write Suggested Default Data Length command is sufficient
to ensure that the LL will auto-initiate the DLE procedure. Performing
a second procedure is unecessary.
In Core v5.2, Vol 4, Part E, Section 7.8.35:
The HCI_LE_Write_Suggested_Default_Data_Length command allows the
Host to specify its suggested values for the Controller's maximum
transmission number of payload octets and maximum packet
transmission time for packets containing LL Data PDUs to be used
for new connections. The Controller may use smaller or larger values
for connInitialMaxTxOctets and connInitialMaxTxTime based on local
information.
In short, this command sets connInitialMaxTxOctets
and connInitialMaxTxTime.
In Core v5.2, Vol 6, Part B, Section 4.5.10:
For a new connection: connMaxTxOctets shall be set to
connInitialMaxTxOctets and connMaxRxOctets shall be chosen by the
Controller. If either value is not 27 then the Controller should
initiate the Data Length Update Procedure at the earliest practical
opportunity.
Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
Unaligned read-out capability become fact among all drivers.
Let's cut this in stone as API requirement.
fixes#16439
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
API did not cover a case when uart_rx_buf_rsp is called when receiver
is already disabled. It may happen if uart_rx_buf_rsp is called too
late and active transfer is already finished. In that case -EACCES is
returned.
Some implementations already returned that error in that case.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Let's normalize the callback like it is done in other APIs.
This will avoid the need to do not so nice code (storing the ipm device
pointer as global, or else) and more importantly will help to move all
device instance to constant.
Fixes#26923
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Until now, each and every driver had to redeclare the type to store such
pointer, now they will be using this typedef.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Normalize callback like other APIs.
This clarifies the callback usage. It will also help to switch all
device instance to constants.
Fixes#26923
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
All other API provide the device pointer to the callback it's going to
call. So fixing this in UART.
This will avoid passing the actual device pointer as a user data (thus
enabling user data for something else).
Fixes#26923
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
All other API provide the device pointer to the callback it's going to
call. So fixing this in UART.
This will avoid passing the actual device pointer as a user data (thus
enabling user data for something else).
Fixes#26923
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
s/port/dev
dev is being used everywhere else so let's rename port to dev.
And the parameter documentation should be the same for all.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This commit adds basic support for the clock controller used in
lpc11u6x MCUs.
Signed-off-by: Maxime Bittan <maxime.bittan@seagate.com>
Signed-off-by: Simon Guinot <simon.guinot@seagate.com>
Add 64bit source_address/dest_address fields support.
This is needed in situation where DMA controller is capable
of handling more than 32bit source and destination addresses.
Signed-off-by: Raveendra Padasalagi <raveendra.padasalagi@broadcom.com>
The EEPROM device doesn't mutate the source data it's given, so update
the API signature to reflect this fact.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
This is called when the USB host changes the virtual baud rate.
This is used by Arduino style boards to signal that the board should
reset into the bootloader.
Signed-off-by: Michael Hope <mlhx@google.com>
Updated nrf clock control driver to use onoff service for managing
multiple users.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Conditional API was removed by preprocessor which violates zephyr
coding style. Removed ifdefs around conditional API.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
A hack was required for the loapic code due to the address
range not being in DTS. A bug was filed.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Allow feed operations that would stall due to internal peripheral
delays to complete immediately with -EAGAIN indicating that the feed
did not occur as expected.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
The PCI API was originally limited to 32 bit addresses. Even though
it had code to skip over the high word in 64 bit BAR entries, it
refused to use it and returned a 32 bit value. Some devices in the
wild have default mappings from the firmware for devices above 4G.
Also remove the "iobar" API. It's dead code, we don't call it and we
don't test it. IO space BAR entries are a legacy feature from way,
way back in PCI history (I genuinely have never heard of a real device
that uses them!). And there's no difference in format between one of
these and a 32 bit "memory" BAR anyway, someone who actually had this
requirement could just use the existing API without worry.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
Fix host RX thread being deadlocked. The deadlock occurs because the
RX thread is stuck waiting in conn_tx_alloc with K_FOREVER but if the
connection is disconnected only the RX thread can unblock it in the
handling of the disconnect event.
This commit fixes this deadlock by splitting the processing of the
disconnected event into two parts.
The part needed to unblock the RX is to release resources held by
unack'ed TX packets and mark the connection state as not connected
anymore.
The RX thread waiting for free_tx fifo and the TX thread waiting for
the bt_dev.le.pkts semaphore will both check the connected state after
having acquired them and will abort if disconnected.
The rest of the processing will be handled at normal RX thread
priority like normal.
Move the bt_recv_prio handling to the Bluetooth host when the host
has defined its own RX thread (CONFIG_BT_RECV_IS_RX_THREAD=n).
If the HCI driver has the RX thread (CONFIG_BT_RECV_IS_RX_THREAD=y),
then the responsibility to call bt_recv and bt_recv_prio correctly
falls to the HCI driver.
The helper function bt_hci_evt_is_prio() is replaced with
bt_hci_evt_get_flags() so that the HCI driver can do this correctly.
This decision to replace was made so that existing HCI drivers
maintained out-of-tree will fail at compile time with the new system.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Bluetooth: host: Move bt_recv_prio to host when RX thread is defined
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>