Commit graph

24538 commits

Author SHA1 Message Date
Duy Nguyen
75f1f7e982 drivers: pinctrl: Add pinctrl driver for RA8 series
This is the initial commit to support minimum pinctrl
driver for Renesas MCU RA8M1.

Signed-off-by: Duy Nguyen <duy.nguyen.xa@renesas.com>
2024-06-26 13:36:14 -04:00
Declan Snyder
3f59cf9439 drivers: nxp_enet: Fix CID 363724
This addresses the coverity issue ID 363724.
This issue seems to have been a false positive, but the root complaint
from coverity was that within the callstack of ENET_Up, some functions
use the buffer config pointer as an array, whereas in the zephyr driver
it is declared as a singleton. Address it by redeclaring this as an
array of size 1 instead of a singleton.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2024-06-26 13:06:14 -04:00
Declan Snyder
b05d719107 drivers: nxp_enet: Fix CID 392512
This commit fixes coverity issue 392512.
The issue was that the return value of clock_control_on was not being
checked. Fix by checking the return value.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2024-06-26 13:06:14 -04:00
Ioannis Karachalios
0c5bfeefac drivers: usb: device: Fix disable sequece
This commit should deal with
fixing the way USB_MCTLR_REG
is zeroed in order to disable
the USB controller along with
its tranceiver.

Signed-off-by: Ioannis Karachalios <ioannis.karachalios.px@renesas.com>
2024-06-26 09:20:51 -04:00
Simon Frank
2ca7e41b26 drivers/sensor: lis2mdl: use common SPI duplex option
Driver used a custom SPI duplex option. Replaced with the common one
found in spi-device.yaml.

Signed-off-by: Simon Frank <simon.frank@lohmega.com>
2024-06-26 09:01:13 -04:00
Sadik Ozer
ada6ab25ee drivers: serial: Update MAX32xxx tx and rx ready functions
Update rx and tx ready function as per of its description.
For tx_ready if tx interrupt enabled AND tx fifo is not full
For rx_ready if rx interrupt enalbed AND rx fifo not empty

Signed-off-by: Sadik Ozer <sadik.ozer@analog.com>
2024-06-26 09:00:26 -04:00
Chris Friedt
9ada52f060 fdtable: replace z_ prefix with zvfs_ for fdtable.h functions
For each of the fdtable.h functions listed below, convert the
z_ prefixed semi-private functions to use the zvfs_ prefix.

ZVFS stands for Zephyr Virtual File System and
is intended to be a common library used by the C library,
POSIX API, Networking, Filesystem, and other areas.

There are already a few functions in fdtable.h that use the
zvfs_ prefix, so this change is mostly about unifying them in
a way that uses a suitable prefix ("namespace") so that it can
be considered a public API.

- z_alloc_fd
- z_fdtable_call_ioctl
- z_finalize_fd
- z_finalize_typed_fd
- z_free_fd
- z_get_fd_obj
- z_get_fd_obj_and_vtable
- z_get_obj_lock_and_cond
- z_reserve_fd

Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
2024-06-26 12:33:02 +02:00
Luis Ubieda
089eaf93ec sensor: lm75: Enforce dependency of int-gpios with Trigger feature
As pointed out on #57586: `LM75_TRIGGER_GLOBAL_THREAD` can't be enabled
without the int-gpios being present in the DTS node. This commit
requires at least one LM75 instance featuring it, otherwise it won't
work.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2024-06-25 14:16:28 -04:00
Bartosz Sokolski
72197097ae drivers: i2s_nrfx: Fix division by 0 in divider calculation
Skip cases which would result in division by 0 in clock calculation

Signed-off-by: Bartosz Sokolski <bartosz.sokolski@nordicsemi.no>
2024-06-25 12:19:20 -04:00
Bjarki Arge Andreasen
a58abd0450 drivers: modem: cellular: correct user DLCI channels
The supported modems don't have the same number or assignment
of DLCI channels. For example, the NRF91_SLM only has DLCI
channel 3 assigned to GNSS tunneling, where the ublox sara r5
has DLCI 3 assigned to an additional AT channel, and DLCI 4
assigned to GNSS tunneling.

This commit updates the creation and assignment of DLCI
channels and pipelinks to match the capabilties of each modem.

Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
2024-06-25 12:18:40 -04:00
Piotr Pryga
cbd85195e1 drivers: clock_control: Remove XTAL accuracy change for nRF54L
There was an error in calculation of LFXO INTCAP code that prevented
obtaining desired XTAL accuracy below 50PPM. The error was fixed
the accuracy should be within expected range.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2024-06-25 10:26:11 -04:00
Alberto Escolar Piedras
9d9cf4d17d drivers/gpio/gpio_rzt2m: Handle trig == GPIO_INT_TRIG_WAKE
Fix a build warning due to the enumerate for the trigger
polarity possibly being (from the point of the compiler)
also GPIO_INT_TRIG_WAKE.
We fix it by simply returning a not valid argument error
which is what most other drivers do if they do something
smart enough.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-06-25 10:25:04 -04:00
Lingao Meng
302422ad9d everywhere: replace double words
import os
import re

common_words = set([
    'about', 'after', 'all', 'also', 'an', 'and',
     'any', 'are', 'as', 'at',
    'be', 'because', 'but', 'by', 'can', 'come',
    'could', 'day', 'do', 'even',
    'first', 'for', 'get', 'give', 'go', 'has',
    'have', 'he', 'her',
    'him', 'his', 'how', 'I', 'in', 'into', 'it',
    'its', 'just',
    'know', 'like', 'look', 'make', 'man', 'many',
    'me', 'more', 'my', 'new',
    'no', 'not', 'now', 'of', 'one', 'only', 'or',
    'other', 'our', 'out',
    'over', 'people', 'say', 'see', 'she', 'so',
    'some', 'take', 'tell', 'than',
    'their', 'them', 'then', 'there', 'these',
    'they', 'think',
    'this', 'time', 'two', 'up', 'use', 'very',
    'want', 'was', 'way',
    'we', 'well', 'what', 'when', 'which', 'who',
    'will', 'with', 'would',
    'year', 'you', 'your'
])

valid_extensions = set([
    'c', 'h', 'yaml', 'cmake', 'conf', 'txt', 'overlay',
    'rst', 'dtsi',
    'Kconfig', 'dts', 'defconfig', 'yml', 'ld', 'sh', 'py',
    'soc', 'cfg'
])

def filter_repeated_words(text):
    # Split the text into lines
    lines = text.split('\n')

    # Combine lines into a single string with unique separator
    combined_text = '/*sep*/'.join(lines)

    # Replace repeated words within a line
    def replace_within_line(match):
        return match.group(1)

    # Regex for matching repeated words within a line
    within_line_pattern =
	re.compile(r'\b(' +
		'|'.join(map(re.escape, common_words)) +
		r')\b\s+\b\1\b')
    combined_text = within_line_pattern.
		sub(replace_within_line, combined_text)

    # Replace repeated words across line boundaries
    def replace_across_lines(match):
        return match.group(1) + match.group(2)

    # Regex for matching repeated words across line boundaries
    across_lines_pattern = re.
		compile(r'\b(' + '|'.join(
			map(re.escape, common_words)) +
			r')\b(\s*[*\/\n\s]*)\b\1\b')
    combined_text = across_lines_pattern.
		sub(replace_across_lines, combined_text)

    # Split the text back into lines
    filtered_text = combined_text.split('/*sep*/')

    return '\n'.join(filtered_text)

def process_file(file_path):
    with open(file_path, 'r', encoding='utf-8') as file:
        text = file.read()

    new_text = filter_repeated_words(text)

    with open(file_path, 'w', encoding='utf-8') as file:
        file.write(new_text)

def process_directory(directory_path):
    for root, dirs, files in os.walk(directory_path):
        dirs[:] = [d for d in dirs if not d.startswith('.')]
        for file in files:
            # Filter out hidden files
            if file.startswith('.'):
                continue
            file_extension = file.split('.')[-1]
            if
	file_extension in valid_extensions:  # 只处理指定后缀的文件
                file_path = os.path.join(root, file)
                print(f"Processed file: {file_path}")
                process_file(file_path)

directory_to_process = "/home/mi/works/github/zephyrproject/zephyr"
process_directory(directory_to_process)

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2024-06-25 06:05:35 -04:00
Maksim Salau
da9b308563 drivers: adc: saadc: Disable burst mode on unused channels
Burst mode enabled on an unused channel causes a freeze during a
conversion consisting of several channels (not including the one with
burst mode enabled).

Discovered on nRF52832 (nRF52-DK) using the following approach:
  channels 0-3 are used for application purposes as a sequence
  channel 4 is used for battery measurements with oversampling

After few successful conversions the sequence (channels 0-3) freezes the
thread while waiting for semaphore to end the conversion.

Signed-off-by: Maksim Salau <maksim.salau@gmail.com>
2024-06-25 09:04:41 +02:00
Daniel Leung
5c4c31cfe0 i3c: ccc: fix missing break in switch in _do__getcaps()
In i3c_ccc_do_getcaps(), there is a missing break statement
in the switch case for GETCAPS_FORMAT_2_CRCAPS. Add it.

Fixes #74764

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2024-06-24 22:25:57 -04:00
Sylvio Alves
6b4beb9494 drivers: eth_esp32: fix function call as from hal
When external PHY has crystal, ESP32 can be configured
to use custom GPIO as clock source for it. However, due to
latest clock subsystem and hal updates, current driver
fails to build and blocks its usage.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2024-06-24 14:49:16 -04:00
Sylvio Alves
cc29fc1182 driver: eth_esp32: fix shared clock check
Both MDIO and Ethernet drivers share the same clock subsystem.
After clock control update in #73807, clock_control_on()
now returns -EALREADY for already initialized clock subsystem.
As a result, ethernet driver won't initialize as needed.

Fixes #74440

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2024-06-24 14:49:16 -04:00
Bjarki Arge Andreasen
9d761a1769 drivers: rtc: rtc_ll_stm32: coverity 368806 fix
Replace DIV_ROUND_CLOSEST() with a normal division to simplify
operation and avoid redundant handling of signed integer rounding
as the temp value is an unsigned value. The temp value is in nano
precision, so rounding is largely inconsequencial anyway compared
to the comparatively low precision sync prescaler.

Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
2024-06-24 14:48:15 -04:00
Francois Ramu
b40c037233 drivers: flash: stm32 xspi driver supports the MemoryMapped mode
Adding the support of the memoryMapped mode
to the flash_stm32_xspi driver through the CONFIG_STM32_MEMMAP
That will allow XiP from the external octo_flash
Erase and Write operation must Abort operations.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2024-06-24 12:45:34 -04:00
Georgij Cernysiov
bb3737bde6 drivers: ethernet: adin2111: minor code style correction
Use tabs instead of spaces.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2024-06-24 12:44:04 -04:00
Georgij Cernysiov
104a019913 drivers: ethernet: adin2111: move OA buffers out from device data
Move OA-related TX and RX buffers out from the device data.
Don't define the buffers without the `spi-oa` property. That
saves ~32KB when using generic spi protocol.

Rearrange device data fields to reduce byte holes found with
Pahole.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2024-06-24 12:44:04 -04:00
Nazar Palamar
2eaae36220 driver/bluetooth/hci/hci_ifx_psoc6_bless: fix long bt startup time
Added force unblock psoc6 bless rx thread to process controller
events (at the end of psoc6_bless_send function)

Internal case: SWINTEGRAT-1767

Signed-off-by: Nazar Palamar <nazar.palamar@infineon.com>
2024-06-24 12:43:48 -04:00
Ioannis Karachalios
d5332532e5 drivers: mipi_dbi: smartbond: Unused symbol
Suppress warning thrown when
the reset line is not used.

Signed-off-by: Ioannis Karachalios <ioannis.karachalios.px@renesas.com>
2024-06-24 12:43:12 -04:00
Ioannis Karachalios
edd779dbed boards: renesas: dts: Various fixes
This commit should deal with fixing
various issues on the board's dts
overlay files:

1. PSRAM node was not enabled when
   display buffers were stored in
   psram and thus, raising linker
    error (overflow memory section).

2. Remove MIPI DBI read operations
   for the MIPI DBI driver. This is
   because not all drivers support
   read and most of the cases it does
   not have any practical usage.
   In addition, this might trigger
   conflicts with SPI sensors.
   If needed, users should explicitly
   enable read operations by defining
   an SPI device taking into consideration
   conflicts with SPI devices connected
   to the SPI bus.

3. Remove enabling the DMA driver.
   It should be enabled by default.

Signed-off-by: Ioannis Karachalios <ioannis.karachalios.px@renesas.com>
2024-06-24 12:43:12 -04:00
Ioannis Karachalios
9d1b62b8ac drivers: usb: device: smartbond: Use DMA driver
This commit should deal with updating
the way USBD was handling the DMA
engine. Based on the #73803 request
DMA should be handled via the DMA
driver API class and not directly.

Signed-off-by: Ioannis Karachalios <ioannis.karachalios.px@renesas.com>
2024-06-24 12:43:12 -04:00
Ioannis Karachalios
1bcff4130c drivers: dma: smartbond: Fix pending length
This commit should deal with fixing
the pending length value returned
upon requesting the status of a channel.

Signed-off-by: Ioannis Karachalios <ioannis.karachalios.px@renesas.com>
2024-06-24 12:43:12 -04:00
Martin Tverdal
b9aae1388c drivers/flash/nrf_rram: increase flash timeout multipler rram
Erasing rram is very similar to partial erase on flash.
So we should use the same multiplier as there, 1.5.
0.1 multipler is way to low and was causing timeouts.

Signed-off-by: Martin Tverdal <martin.tverdal@nordicsemi.no>
2024-06-24 08:28:13 -04:00
Lingao Meng
b11c43cb09 drivers: bluetooth: Remove unused rsp params
The `rsp` params actually not used, so removed.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2024-06-24 14:26:22 +02:00
Eric Holmberg
18ebfe59d0 drivers: serial: esp32_usb: fix interrupt-enable race condition
After enabling interrupts, serial_esp32_usb_irq_tx_enable() calls the
interrupt handler to handle any old events that occurred while interrupts
were disabled.  However, this happens in the callers context, so if an
interrupt arrives during the call, it will call the interrupt handler again
resulting in corruption if the interrupt handler is not reentrant.

Fixes #74569

Signed-off-by: Eric Holmberg <eric.holmberg@northriversystems.co.nz>
2024-06-24 09:47:05 +02:00
Nazar Palamar
41c9ec3e42 driver/bluetooth/h4_ifx_cyw43xxx: Allow CBUCK regulator to discharge
Problem:
re-plug USB (e.g cy8cproto_062_4343w kit) can cause that
CY43xx device become unresponsive (cy8cproto_062_4343w).
As result we catch ASSERTION FAIL (timeout) on HCI_Reset command.

Fix: added delay (BT_POWER_CBUCK_DISCHARGE_TIME_MS) to be sure
that BT CBUCK regulator to discharge.

Tested on:
cy8cproto_062_4343w, cy8ckit_062s2_ai and cy8ckit_062s2_43012 kits.

Signed-off-by: Nazar Palamar <nazar.palamar@infineon.com>
2024-06-24 09:46:01 +02:00
Nazar Palamar
b6d0958ab7 drivers: serial: CAT1 UART driver: fix HW flow control
fix HW flow control:
- remove cyhal_uart_enable_flow_control
- added Cy_SCB_UART_EnableCts if cfg->flow_ctrl = true
  (required to enable hw flow control)
- configuration of CTS/RTS done by pincntr driver

Signed-off-by: Nazar Palamar <nazar.palamar@infineon.com>
2024-06-24 09:46:01 +02:00
Jordan Yates
07870934e3 everywhere: replace double words
Treewide search and replace on a range of double word combinations:
    * `the the`
    * `to to`
    * `if if`
    * `that that`
    * `on on`
    * `is is`
    * `from from`

Signed-off-by: Jordan Yates <jordan@embeint.com>
2024-06-22 05:40:22 -04:00
Tomasz Bursztyka
b0e327bd9c drivers/spi: Fix context release in case of error
SPI context has to be released even in case of error.

Fixes: #72782

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@proton.me>
2024-06-22 05:39:55 -04:00
Sylvio Alves
844cb3e479 drivers: intc: esp32: fix kconfig visibility
Kconfig options in those drivers are visible and selectable
to any board/soc when it should not. This makes sure both
depends on proper family.

Fixes #74347

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2024-06-21 11:37:33 -04:00
Ioannis Damigos
b9dab49b13 drivers/smartbond: Remove atomic flags from drivers
Remove atomic flags from drivers that use balanced calls
for PM locking.

Signed-off-by: Ioannis Damigos <ioannis.damigos.uj@renesas.com>
2024-06-21 08:45:10 -04:00
Jun Lin
e555f20462 driver: bbram: npcx: fix the way to clear bbram status
Bits in the BBRAM status register (BKUP_STS) are write-1-to-clear bits.
The current driver writes 0 to clear those bits, which is incorrect.
Fix it in this commit.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2024-06-21 10:07:41 +02:00
Joakim Andersson
901a8f7efb drivers: pinctrl_nrf: : Allow applying pins of disabled peripherals
According to the nrfx peripheral resource sharing example in
samples/boards/nrf/nrfx_prs it should be possible to share a resource
and apply the pins on peripheral that share resource ID.
However the sample only works since it only demonstrates UART and SPIM,
and by enabling both another SPIM driver, and UART is enabled for the
console. It would not be possible to enable a TWIM driver in addition.
Instead allow the PSELs if the configuration for NRFX has been enabled.

Signed-off-by: Joakim Andersson <joerchan@gmail.com>
2024-06-20 12:09:24 -04:00
Mark Wang
e2ec54bb9d drivers: udc: mcux: remove CONFIG_DT_HAS_NXP_USBPHY_ENABLED
remove CONFIG_DT_HAS_NXP_USBPHY_ENABLED to make codes more simple

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
2024-06-20 12:07:07 -04:00
Maximilian Deubel
71c4526ab3 drivers: sensor: bmm150: Fix setting of attributes
Some functions in the bmm150 driver were depending on a define
that was never used. Changed it to the one that is actually defined.

Signed-off-by: Maximilian Deubel <maximilian.deubel@nordicsemi.no>
2024-06-20 12:05:23 -04:00
Luis Ubieda
7cda467cc1 sensor: vcnl36825t: Scrub redundant scaling on meas_timeout_us
Confirming the Proximity Integration is an integer, we don't need to
pre-apply the Scaling factor to then be accounted for when the actual
meas_timeout_us is calculated.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2024-06-20 12:05:07 -04:00
Luis Ubieda
51ad3d34bd sensor: vcnl36825t: fix: Address CID 347083
Coverity found this legitimate issue: the datasheet specifies PS_IT
being 2-bits long (1, 2, 4, 8) and this driver assumes more steps are
available. Remove extraneous fields so the Proximity integration
setting fits in the expected 16-bit value.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2024-06-20 12:05:07 -04:00
Piotr Kosycarz
4d01353640 drivers: serial: fix cfg.baudrate may be used uninitialized
drivers/serial/uart_async_to_irq.c: In function 'get_rx_timeout':
drivers/serial/uart_async_to_irq.c:51:26:
warning: 'cfg.baudrate' may be used uninitialized
   51 |                 baudrate = cfg.baudrate;
      |                 ~~~~~~~~~^~~~~~~~~~~~~~
drivers/serial/uart_async_to_irq.c:45:28: note: 'cfg' declared here
   45 |         struct uart_config cfg;

Signed-off-by: Piotr Kosycarz <piotr.kosycarz@nordicsemi.no>
2024-06-20 12:04:02 -04:00
TOKITA Hiroshi
daa3bb1d55 drivers: interrupt_controller: renesas_ra: Enable GEN_ISR_TABLES explicitly
Renesas RA ICU driver requires to generate ISR tables.
Adding `select GEN_ISR_TABLES` to force enable it.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2024-06-20 12:57:54 +02:00
Hake Huang
ef62bba336 driver: i3c: fixing i3c init error
i3c config need has i2x/i3c baudrate configured first.
so in i3c init we shall set the baudrate first

fixing: #65153

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2024-06-20 12:48:36 +02:00
Andy Sinclair
7f0f0a4f97 drivers: gpio: shell: Fixed gpio info crash bug
When getting gpio info for a specific device with no line
names, invalid memory was accessed.
The check for the length of the line name array has been
corrected to avoid this.

Signed-off-by: Andy Sinclair <andy.sinclair@nordicsemi.no>
2024-06-20 08:59:49 +02:00
Seppo Ingalsuo
1198c7ec29 Drivers: DAI: Intel: Move ACE DMIC start reset clear to earlier
The unreset of ACE PDM controllers is moved to beginning of
void dai_dmic_start() and done side-by-side. This change is done
for adhering to recommended hardware initialization flow to
avoid intermittent failures on ARL-S.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2024-06-20 08:59:20 +02:00
Seppo Ingalsuo
78920e839e Drivers: DAI: Intel: Reduce traces dai_dmic_start()
This patch removes the traces printed inside spinlock protected
code. The DMIC capture start code is timing critical. Traces
leave an unknown delay into start sequence, so it's better to not
produce them.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2024-06-20 08:59:20 +02:00
Seppo Ingalsuo
9db580357b Drivers: DAI: Intel: Remove trace from dai_dmic_update_bits()
The dai_dmic_update_bits() function is used in start trigger
code dai_dmic_start() and in capture runtime to control DMIC
IP in unmute sequence. Especially the start sequence is timing
critical so it's better not produce additional delay in this
function.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2024-06-20 08:59:20 +02:00
Jerzy Kasenberg
1464209173 drivers: usb_device: smartbond: Fix EP OUT after resume
When device was resumed from sleep OUT endpoints were most
likely not enabled due to condition that checked pending transfer.
Configured OUT endpoints should be enabled (ready for RX)
if they were enabled by interfaces.

Now separate bit field enabled is added and check to
see if OUT endpoint should be ready for reception after
sleep is done.

Signed-off-by: Jerzy Kasenberg <jerzy.kasenberg@codecoup.pl>
2024-06-19 13:44:32 -04:00
Jerzy Kasenberg
a953bdf309 drivers: usb_device: smartbond: Delay message USB_DC_EP_DATA_OUT
Callback with USB_DC_EP_DATA_OUT was called directly from
interrupt handler (handle_ep0_rx()) while rest of the interrupt
conditions were not checked yet.
Some interfaces started next transfer directly from this callback
resulting in case where TX endpoint was still marked as busy
and transfer was eventually abandoned.

Now message is sent from all affected endpoints after every USB
pending interrupt is handled.

Signed-off-by: Jerzy Kasenberg <jerzy.kasenberg@codecoup.pl>
2024-06-19 13:44:32 -04:00