summaryrefslogtreecommitdiff
path: root/drivers
AgeCommit message (Collapse)AuthorFilesLines
2026-06-29iio: proximity: cleanup fixes for vl53l1x-i2cSiratul Islam1-18/+19
Extract data-ready polling into a helper, fix regmap_read_poll_timeout() argument alignment, and add field definitions for BIT(0). No functional changes. Suggested-by: Andy Shevchenko <andriy.shevchenko@intel.com> Reviewed-by: Nuno Sá <nuno.sa@analog.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Signed-off-by: Siratul Islam <email@sirat.me> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2026-06-29iio: proximity: sort the register values for vl53l1x-i2cSiratul Islam1-1/+1
- Sort register defines list Suggested-by: Andy Shevchenko <andriy.shevchenko@intel.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Signed-off-by: Siratul Islam <email@sirat.me> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2026-06-29iio: todo: fix typo and refine resource management itemsSanjay Chitroda1-4/+9
Fix a typo in the staging documentation path and adjust formatting of existing entries for readability. Add TODO items to track conversion of selected drivers to device managed resource APIs and evaluate usage of cleanup.h helpers for simplifying resource management. These updates aim to better reflect ongoing cleanup efforts within the IIO subsystem. Signed-off-by: Sanjay Chitroda <sanjayembeddedse@gmail.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2026-06-29iio: light: tcs3472: implement wait time and sampling frequencyAldo Conte1-26/+291
The TCS3472 has a wait state controlled by the WEN bit in the ENABLE register and the WAIT register, with an additional WLONG bit in CONFIG that if set multiplies the wait step by 12. The driver previously defined TCS3472_WTIME but never used it leaving the TODO comment on the top of the source file. Implement control of the wait time through IIO_CHAN_INFO_SAMP_FREQ: - Reading sampling_frequency returns the chip's current cycle time, computed as the sum of ATIME, the fixed RGBC initialization time and the wait time (which depends on WEN and WLONG). - Writing sampling_frequency programs WTIME so that the resulting cycle period approximates the requested frequency. If the requested frequency cannot be reached with any non-zero wait time, WEN is disabled and the chip runs back-to-back conversions at the maximum rate allowed by ATIME. If the requested period exceeds the maximum WTIME range, WLONG is enabled to extend the wait step from 2.4 ms to 28.8 ms. - The user's last requested frequency is stored in the driver's private data so that subsequent changes to integration_time recompute WTIME and preserve the requested sampling rate as closely as possible. Add TCS3472_ENABLE_WEN, TCS3472_ENABLE_RUN and TCS3472_CONFIG_WLONG bit definitions. TCS3472_ENABLE_RUN bundles the bits (AEN | PON | WEN) that are simultaneously set when the chip is in running state and cleared during powerdown, and is used by tcs3472_probe(), tcs3472_powerdown(). Add a u8 enable_pre_suspend field to struct tcs3472_data: tcs3472_powerdown() snapshots data->enable into it, and tcs3472_resume() restores enable register content from the snapshot. This preserves the user's WEN choice across suspend/resume. Bound tcs3472_req_data() polling to the worst-case cycle time (~8 seconds with ATIME=0x00, WTIME=0x00, WLONG=1). Fix the event period calculation in tcs3472_read_event() and tcs3472_write_event() to use tcs3472_cycle_time_us() instead of ATIME alone. With WEN enabled, the chip cycle includes the wait time now. Remove the "TODO: wait time" comment at the top of the file. Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Signed-off-by: Aldo Conte <aldocontelk@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2026-06-29iio: frequency: adf4377: replace mutex_lock/unlock with guard(mutex)()Eduardo Guedes1-45/+36
Replace manual mutex_lock()/mutex_unlock() calls with guard(mutex)() from cleanup.h. Using guard(mutex)() from cleanup.h allows the compiler to enforce lock release on every exit path, eliminating the error-prone manual lock/unlock pattern and the goto-based exit labels that existed in adf4377_get_freq() and adf4377_set_freq(). This reduces the chance of lock imbalance bugs. Signed-off-by: Eduardo Guedes <educg550@usp.br> Co-developed-by: Lucca Ciriac <luccaciriac@usp.br> Signed-off-by: Lucca Ciriac <luccaciriac@usp.br> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2026-06-29iio: pressure: hid-sensor-press: use u32 instead of unsignedSanjay Chitroda1-3/+3
Prefer 'u32' instead of bare 'unsigned' for usage_id variable. This matches expected callback API type and improves code clarity. No functional change. Signed-off-by: Sanjay Chitroda <sanjayembeddedse@gmail.com> Reviewed-by: Maxwell Doose <m32285159@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2026-06-29iio: orientation: hid-sensor-rotation: use u32 instead of unsignedSanjay Chitroda1-3/+3
Prefer 'u32' instead of bare 'unsigned' for usage_id variable. This matches expected callback API type and improves code clarity. No functional change. Signed-off-by: Sanjay Chitroda <sanjayembeddedse@gmail.com> Reviewed-by: Maxwell Doose <m32285159@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2026-06-29iio: orientation: hid-sensor-incl-3d: use u32 instead of unsignedSanjay Chitroda1-3/+3
Prefer 'u32' instead of bare 'unsigned' for usage_id variable. This matches expected callback API type and improves code clarity. No functional change. Signed-off-by: Sanjay Chitroda <sanjayembeddedse@gmail.com> Reviewed-by: Maxwell Doose <m32285159@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2026-06-29iio: light: hid-sensor-prox: use u32 instead of unsignedSanjay Chitroda1-2/+2
Prefer 'u32' instead of bare 'unsigned' for usage_id variable. This matches expected callback API type and improves code clarity. No functional change. Signed-off-by: Sanjay Chitroda <sanjayembeddedse@gmail.com> Reviewed-by: Maxwell Doose <m32285159@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2026-06-29iio: light: hid-sensor-als: use u32 instead of unsignedSanjay Chitroda1-3/+3
Prefer 'u32' instead of bare 'unsigned' for usage_id variable. This matches expected callback API type and improves code clarity. No functional change. Signed-off-by: Sanjay Chitroda <sanjayembeddedse@gmail.com> Reviewed-by: Maxwell Doose <m32285159@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2026-06-29iio: accel: hid-sensor-accel-3d: use u32 instead of unsignedSanjay Chitroda1-3/+3
Prefer 'u32' instead of bare 'unsigned' for usage_id variable. This matches expected callback API type and improves code clarity. No functional change. Signed-off-by: Sanjay Chitroda <sanjayembeddedse@gmail.com> Reviewed-by: Maxwell Doose <m32285159@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2026-06-29iio: gyro: hid-sensor-gyro-3d: use u32 instead of unsignedSanjay Chitroda1-3/+3
Prefer 'u32' instead of bare 'unsigned' for usage_id variable. This matches expected callback API type and improves code clarity. No functional change. Signed-off-by: Sanjay Chitroda <sanjayembeddedse@gmail.com> Reviewed-by: Maxwell Doose <m32285159@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2026-06-29iio: core: trigger: correct CONFIG_IIO_TRIGGER macro name in #endif commentEthan Nelson-Moore1-1/+1
A comment in drivers/iio/iio_core_trigger.h incorrectly refers to CONFIG_TRIGGER_CONSUMER instead of CONFIG_IIO_TRIGGER. Correct it. Discovered while searching for CONFIG_* symbols referenced in code but not defined in any Kconfig file. Signed-off-by: Ethan Nelson-Moore <enelsonmoore@gmail.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2026-06-29iio: imu: bmi323: remove unnecessary cast in watermark limitHungyu Lin1-1/+1
Remove the explicit u32 cast in the watermark limit calculation. The BMI323_FIFO_FULL_IN_FRAMES macro can be used directly with min() without triggering type issues. Signed-off-by: Hungyu Lin <dennylin0707@gmail.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Reviewed-by: Nuno Sá <nuno.sa@analog.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2026-06-29iio: magnetometer: bmc150: use FIELD_PREP and FIELD_GET helpersHungyu Lin1-18/+15
Replace open-coded bitfield operations with FIELD_PREP() and FIELD_GET() helpers where appropriate. Also simplify bmc150_magn_set_odr() by returning directly from the matching table entry. Signed-off-by: Hungyu Lin <dennylin0707@gmail.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2026-06-29iio: magnetometer: bmc150: sort includesHungyu Lin1-8/+9
Sort the include list alphabetically. Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Hungyu Lin <dennylin0707@gmail.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2026-06-29Add support for the REFGEN in the IPQ9650 SoCMark Brown1-6/+107
Kathiravan Thirumoorthy <kathiravan.thirumoorthy@oss.qualcomm.com> says: IPQ9650 SoC has 2 REFGEN blocks providing the reference current to the PCIe and USB, UNIPHY PHYs. For the other SoCs, clocks for this block is enabled on power up but that's not the case for IPQ9650 and we have to explicitly enable those clocks. Document the same and add support for it. Correct the regulator type to REGULATOR_CURRENT, as the REFGEN block supplies the reference current to PHYs in the SoC, per the REFGEN IP team, aligning it with the hardware behavior. Link: https://patch.msgid.link/20260617-ipq9650_refgen-v4-0-c505ea6c6661@oss.qualcomm.com Signed-off-by: Mark Brown <broonie@kernel.org>
2026-06-29regulator: qcom-refgen: add support for the IPQ9650 SoCKathiravan Thirumoorthy1-4/+105
IPQ9650 SoC has 2 REFGEN blocks providing the reference current to the PCIe and USB, UNIPHY PHYs. For the other SoCs, clock for this block is enabled on power up but that's not the case for IPQ9650 and we have to enable those clocks explicitly to bring up the PHYs properly. Also, add the get_status() callback to report the regulator status to the userspace. Signed-off-by: Kathiravan Thirumoorthy <kathiravan.thirumoorthy@oss.qualcomm.com> Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> Link: https://patch.msgid.link/20260617-ipq9650_refgen-v4-3-c505ea6c6661@oss.qualcomm.com Signed-off-by: Mark Brown <broonie@kernel.org>
2026-06-29regulator: qcom-refgen: correct the regulator type to CURRENTKathiravan Thirumoorthy1-2/+2
As per the REFGEN IP team, this block supplies the reference current to the PHYs in the SoC. So, correct the regulator type to REGULATOR_CURRENT to match with the HW behavior. Fixes: 7cbfbe237960 ("regulator: Introduce Qualcomm REFGEN regulator driver") Cc: stable@vger.kernel.org Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> Signed-off-by: Kathiravan Thirumoorthy <kathiravan.thirumoorthy@oss.qualcomm.com> Link: https://patch.msgid.link/20260617-ipq9650_refgen-v4-1-c505ea6c6661@oss.qualcomm.com Signed-off-by: Mark Brown <broonie@kernel.org>
2026-06-29regulator: max14577: fix set_mode clobbering enable on MAX77836 LDOsJad Keskes1-4/+99
So the PWRMD field in CNFG1_LDO is both the enable bit and the mode. You can't change one without stepping on the other. The problem is that enable() from the regulator core just writes enable_mask (which is PWRMD_NORMAL). If you'd called set_mode(LPM) then disabled and re-enabled, the mode gets reset to NORMAL. And set_mode updates the register through the same field, so it can accidentally enable a disabled regulator. Fix it by storing the mode in per-regulator data. A custom enable writes whatever mode was last set. set_mode only touches hardware if the regulator is already on; otherwise it just caches the value. Add of_map_mode while here so the initial mode can be wired from DT. Signed-off-by: Jad Keskes <inasj268@gmail.com> Acked-by: Lee Jones <lee@kernel.org> Link: https://patch.msgid.link/20260617094622.1846471-1-inasj268@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2026-06-29cxl: Support dpa without a mailboxAlejandro Lucero3-50/+70
Type3 relies on mailbox CXL_MBOX_OP_IDENTIFY command for initializing memdev state params which end up being used for DPA initialization. Allow a Type2 driver to initialize DPA simply by giving the size of its volatile hardware partition. Move related functions to memdev. Signed-off-by: Alejandro Lucero <alucerop@amd.com> Reviewed-by: Dan Williams <dan.j.williams@intel.com> Reviewed-by: Dave Jiang <dave.jiang@intel.com> Reviewed-by: Ben Cheatham <benjamin.cheatham@amd.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Acked-by: Edward Cree <ecree.xilinx@gmail.com> Link: https://patch.msgid.link/20260629183727.51502-3-alejandro.lucero-palau@amd.com Signed-off-by: Dave Jiang <dave.jiang@intel.com>
2026-06-29cxl: Support Type2 cxl regs mappingAlejandro Lucero5-12/+4
Export cxl core functions for a Type2 driver being able to discover and map the device registers. Signed-off-by: Alejandro Lucero <alucerop@amd.com> Reviewed-by: Dan Williams <dan.j.williams@intel.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Dave Jiang <dave.jiang@intel.com> Reviewed-by: Ben Cheatham <benjamin.cheatham@amd.com> Acked-by: Edward Cree <ecree.xilinx@gmail.com> Link: https://patch.msgid.link/20260629183727.51502-2-alejandro.lucero-palau@amd.com Signed-off-by: Dave Jiang <dave.jiang@intel.com>
2026-06-29accel/amdxdna: Fix iommu domain lifetime race during device removalLizhi Hou1-14/+29
When force_iova mode is enabled, amdxdna_remove() frees xdna->domain. If amdxdna_gem_obj_free() is called after device removal, it may attempt to access xdna->domain, resulting in a use-after-free. Fix the race by adding freeing xdna->domain as a managed release action, so its lifetime is managed by DRM and remains valid until all managed resources are released. Fixes: ece3e8980907 ("accel/amdxdna: Allow forcing IOVA-based DMA via module parameter") Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org> Signed-off-by: Lizhi Hou <lizhi.hou@amd.com> Link: https://patch.msgid.link/20260611055150.3070216-3-lizhi.hou@amd.com
2026-06-29accel/amdxdna: Fix notifier_wq lifetime race during device removalLizhi Hou1-8/+4
amdxdna_remove() destroys notifier_wq. If amdxdna_gem_obj_free() is called after device removal, it may attempt to flush notifier_wq, resulting in a use-after-free. Fix the race by allocating notifier_wq with drmm_alloc_ordered_workqueue(), so its lifetime is managed by DRM and remains valid until all managed resources are released. Fixes: e486147c912f ("accel/amdxdna: Add BO import and export") Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org> Signed-off-by: Lizhi Hou <lizhi.hou@amd.com> Link: https://patch.msgid.link/20260611055150.3070216-2-lizhi.hou@amd.com
2026-06-29spi: qpic-snand: free OOB buffer with ECC contextPengpeng Hou1-1/+5
qcom_spi_ecc_init_ctx_pipelined() allocates qspi->oob_buf as part of the pipelined ECC context setup. The buffer is then used by the raw and ECC page I/O paths through the NAND ECC context. The matching cleanup callback only frees the qpic_ecc structure, and the init error path also skips the OOB buffer after it has been allocated. Free qspi->oob_buf on both paths and clear the pointer so the ECC context teardown owns all resources allocated during init. Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn> Link: https://patch.msgid.link/20260616151129.76060-1-pengpeng@iscas.ac.cn Signed-off-by: Mark Brown <broonie@kernel.org>
2026-06-29accel/amdxdna: Fix amdxdna_client lifetime race during device removalLizhi Hou2-13/+14
In amdxdna_remove(), all amdxdna_client structures are freed after calling drm_dev_unplug(). However, drm_dev_unplug() does not force existing file descriptors to be closed, so amdxdna_drm_close() may be called after amdxdna_remove() has completed. As a result, accessing client->pid for debug output in amdxdna_drm_close() can lead to a use-after-free, since the access is not protected by drm_dev_enter(). Fix this by decoupling hardware teardown from client cleanup. amdxdna_remove() only performs hardware-related cleanup, while per-client resources are released from amdxdna_drm_close() when the corresponding file is closed. Fixes: be462c97b7df ("accel/amdxdna: Add hardware context") Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org> Signed-off-by: Lizhi Hou <lizhi.hou@amd.com> Link: https://patch.msgid.link/20260611055150.3070216-1-lizhi.hou@amd.com
2026-06-29clk: stm32: add missing bitfield.h headerRosen Penev2-0/+2
It seems some ARM header includes this and the build passes there, but nowhere else. Note that the driver has COMPILE_TEST in depends. Fixes: 37ae8501cdb0 ("clk: stm32: introduce clocks for STM32MP21 platfor") Signed-off-by: Rosen Penev <rosenp@gmail.com> Reviewed-by: Brian Masney <bmasney@redhat.com> Signed-off-by: Brian Masney <bmasney@redhat.com>
2026-06-29spi: dw: use the correct error msg if request_irq() failsJisheng Zhang1-1/+1
If request_irq() fails, report "can not request IRQ" rather than "can not get IRQ" which may be misread as platform_get_irq() failure. Signed-off-by: Jisheng Zhang <jszhang@kernel.org> Link: https://patch.msgid.link/20260615044039.9750-3-jszhang@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
2026-06-29spi: dw: fix first spi transfer with dma always fallback to PIOJisheng Zhang1-1/+2
Even with proper dma engine support, the first spi transfer always fallback to PIO, the reason is the dws->n_bytes is 0 after initialization, so the dw_spi_can_dma() calling from __spi_map_msg() return false, thus both tx_sg_mapped and rx_sg_mapped are false, so for the first spi transfer, the spi_xfer_is_dma_mapped() reports false thus fallback to PIO. Although this brings no harm, we can simply fix this issue by calcuating the "n_bytes" from xfer->bits_per_word. Signed-off-by: Jisheng Zhang <jszhang@kernel.org> Link: https://patch.msgid.link/20260615044039.9750-2-jszhang@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
2026-06-29clk: nuvoton: ma35d1: fix ma35d1_clk_pll_determine_rate logicJoey Lu1-13/+13
ma35d1_clk_pll_determine_rate() called ma35d1_pll_find_closest() unconditionally before the switch statement, and then every case branch overwrote pll_freq by reading the current hardware registers. For CAPLL and DDRPLL this means find_closest() ran unnecessarily (and incorrectly, since those PLLs are read-only) and its result was silently discarded. Fix by moving the find_closest() call inside the APLL/EPLL/VPLL branch where it belongs. Group CAPLL and DDRPLL together as read-only PLLs that simply report their current rate; handle them with an explicit if/else to keep the CAPLL (SMIC design) and DDRPLL (standard design) paths distinct. Fixes: 691521a367cf ("clk: nuvoton: Add clock driver for ma35d1 clock controller") Signed-off-by: Joey Lu <a0987203069@gmail.com> Signed-off-by: Brian Masney <bmasney@redhat.com>
2026-06-29clk: nuvoton: ma35d1: fix PLL_CTL1_FRAC bit field width and fractional calcJoey Lu1-4/+4
PLL_CTL1_FRAC was defined as GENMASK(31, 24), covering only 8 bits. The hardware fractional field occupies bits [31:8] (24 bits), so the mask must be GENMASK(31, 8). The previous fractional-mode calculation used FIELD_MAX(PLL_CTL1_FRAC) as the denominator to obtain 2 decimal places. With the corrected 24-bit mask the old divisor is wrong; replace the arithmetic with a proper 24-bit fixed-point rounding to 3 decimal places using the kernel's DIV_ROUND_CLOSEST_ULL helper: n_frac = n * 1000 + DIV_ROUND_CLOSEST_ULL(x * 1000, 1 << 24) Fixes: 691521a367cf ("clk: nuvoton: Add clock driver for ma35d1 clock controller") Signed-off-by: Joey Lu <a0987203069@gmail.com> Reviewed-by: Brian Masney <bmasney@redhat.com> Signed-off-by: Brian Masney <bmasney@redhat.com>
2026-06-29clk: nuvoton: ma35d1: fix ignored div_u64 return values in PLL freq calculationJoey Lu1-2/+2
div_u64() does not modify its argument in place; the return value must be assigned. Both ma35d1_calc_smic_pll_freq() and ma35d1_calc_pll_freq() called div_u64() and discarded the result, leaving pll_freq holding the undivided product and thus returning a frequency orders of magnitude too high. Fixes: 691521a367cf ("clk: nuvoton: Add clock driver for ma35d1 clock controller") Reviewed-by: Brian Masney <bmasney@redhat.com> Signed-off-by: Joey Lu <a0987203069@gmail.com> Signed-off-by: Brian Masney <bmasney@redhat.com>
2026-06-29clk: mediatek: mt8196: Select REGMAP_MMIO for vlpckgenAkari Tsuyukusa1-0/+1
The MediaTek MT8196 vlpckgen clock driver uses __devm_regmap_init_mmio_clk() by devm_regmap_init_mmio(), which is defined in drivers/base/regmap/regmap-mmio.c. However, the driver's Kconfig entry does not select REGMAP_MMIO. This causes a linker error when REGMAP_MMIO is not enabled. Fix this by selecting REGMAP_MMIO in the Kconfig entry. Fixes: 2f8b3ae6f0cb ("clk: mediatek: Add MT8196 vlpckgen clock support") Cc: stable@vger.kernel.org Signed-off-by: Akari Tsuyukusa <akkun11.open@gmail.com> Reviewed-by: Brian Masney <bmasney@redhat.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Signed-off-by: Brian Masney <bmasney@redhat.com>
2026-06-29clk: moxart: remove unused variables, fix refcount leakAlexander A. Klimov1-14/+0
Not only these error checks are redundand, those of_clk_get() return values weren't cleaned up via clk_put(). Fixes: c7bb4fc16ead ("clk: add MOXA ART SoCs clock driver") Signed-off-by: Alexander A. Klimov <grandmaster@al2klimov.de> Reviewed-by: Brian Masney <bmasney@redhat.com> Signed-off-by: Brian Masney <bmasney@redhat.com>
2026-06-29clk: Use named initializers for platform_device_id arraysUwe Kleine-König (The Capable Hub)4-18/+18
Named initializers are better readable and more robust to changes of the struct definition. This robustness is relevant for a planned change to struct platform_device_id replacing .driver_data by an anonymous union. While touching these arrays unify spacing and usage of commas. Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com> Reviewed-by: Matti Vaittinen <mazziesaccount@gmail.com> Reviewed-by: Brian Masney <bmasney@redhat.com> Reviewed-by: Peter Griffin <peter.griffin@linaro.org> Reviewed-by: Tudor Ambarus <tudor.ambarus@linaro.org> Signed-off-by: Brian Masney <bmasney@redhat.com>
2026-06-29clk: bcm: kona: Stop defaulting to parent index 0 on errorYu-Chun Lin1-2/+1
Stop defaulting to 0 on BAD_CLK_INDEX (U8_MAX). Passing the out-of-bounds index directly allows the clk core to fail gracefully during parent lookup. Link: https://lore.kernel.org/lkml/177431305509.5403.15386021337517970667@lazor/ Signed-off-by: Yu-Chun Lin <eleanor.lin@realtek.com> Reviewed-by: Brian Masney <bmasney@redhat.com> Signed-off-by: Brian Masney <bmasney@redhat.com>
2026-06-29clk: zynq: handle kasprintf() failure in periph_clk registrationWilliam Theesfeld1-0/+8
zynq_clk_register_periph_clk() ignores the return value of the two kasprintf() calls used to build the mux and divider clock names, and passes the resulting (possibly NULL) pointers straight into clk_register_mux(), clk_register_divider() and clk_register_gate() as the clock '"'name'"' argument. On allocation failure that name later gets dereferenced by the clock framework (e.g. in debugfs name formatting), causing a NULL-pointer dereference. Check both kasprintf() returns. On failure unwind any allocated name buffer and the spinlock, then fall through to the existing err label which sets clks[] to ERR_PTR(-ENOMEM). Freeing the spinlock on the error path is correct here because no clk_register_*() call has had a chance to take ownership of it; the success path intentionally hands it off to the registered clocks. The neighbouring zynq_clk_register_fclk() in the same file already uses this per-allocation goto-label cleanup pattern; this change brings periph_clk into line with it. Signed-off-by: William Theesfeld <william@theesfeld.net> Reviewed-by: Brian Masney <bmasney@redhat.com> Reviewed-by: Michal Simek <michal.simek@amd.com> Signed-off-by: Brian Masney <bmasney@redhat.com>
2026-06-29clk: tegra: Support unique names for multi-socket platformsJon Hunter1-1/+9
On multi-socket platforms each socket has its own BPMP which exposes the same clock names. Fix this by using the NUMA ID as a prefix for the clock names on multi-socket platforms. Use 'sizeof(info->name)' in the strscpy() and snprintf() functions to future proof against anyone changing the size of the 'name' array. Co-developed-by: Timo Alho <talho@nvidia.com> Signed-off-by: Timo Alho <talho@nvidia.com> Signed-off-by: Jon Hunter <jonathanh@nvidia.com> Reviewed-by: Brian Masney <bmasney@redhat.com> Reviewed-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Brian Masney <bmasney@redhat.com>
2026-06-29clk: divider: Fix clk_divider_bestdiv() returning min rate for large rate ↵Lad Prabhakar2-10/+19
requests clk_divider_bestdiv() clamps maxdiv using: maxdiv = min(ULONG_MAX / rate, maxdiv); to avoid overflow in rate * i. However, requests like clk_round_rate(clk, ULONG_MAX), which are used to determine the maximum supported rate of a clock, result in maxdiv being clamped to 1. If no valid divider of 1 exists in the table the loop is never entered and bestdiv falls back to the maximum divider with the minimum parent rate, causing clk_round_rate(clk, ULONG_MAX) to incorrectly return the minimum supported rate instead of the maximum. Fix this by removing the pre-loop maxdiv clamping and replacing the unprotected rate * i multiplication with check_mul_overflow(). Guard the exact-match short-circuit with !overflow to prevent a clamped target_parent_rate of ULONG_MAX from falsely matching parent_rate_saved and causing premature loop exit. Break out of the loop after evaluating the first overflowing divider since clk_hw_round_rate(parent, ULONG_MAX) returns a constant for all subsequent iterations, meaning no better candidate can be found, and continuing would cause exponential recursive calls in chained divider clocks. Update the KUnit test expected values to reflect the corrected behaviour: - clk_divider_bestdiv_ulong_max_returns_max_rate: PARENT_RATE_1GHZ / 8 (minimum rate, pre-fix) -> PARENT_RATE_1GHZ / 2 (maximum rate) - clk_divider_bestdiv_mux_ulong_max_returns_max_rate: 0 (invalid, pre-fix) -> PARENT_RATE_4GHZ / 2 (maximum rate with mux selecting the 4 GHz parent and applying the smallest table divider of 2) Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Brian Masney <bmasney@redhat.com> Signed-off-by: Brian Masney <bmasney@redhat.com>
2026-06-29clk: divider: Add KUnit tests for clk_divider_bestdiv() ULONG_MAX handlingLad Prabhakar4-0/+163
Add KUnit tests to verify the behaviour of clk_divider_bestdiv() when clk_round_rate() is called with ULONG_MAX, which is the canonical way to probe the maximum rate a clock can produce. Two test cases are introduced: - clk_divider_bestdiv_ulong_max_returns_max_rate: registers a 1 GHz fixed-rate parent driving a table-based divider whose smallest entry is div=2 (entries: 2, 4, 8). Calls clk_hw_round_rate(div_hw, ULONG_MAX) and checks the result. - clk_divider_bestdiv_mux_ulong_max_returns_max_rate: places a two-input mux (4 GHz and 2 GHz fixed-rate parents, CLK_SET_RATE_PARENT) ahead of the same table-based divider to verify correct parent selection under ULONG_MAX. Both tests use an explicit clk_div_table with a minimum divider of 2 so that the pre-loop maxdiv clamping in clk_divider_bestdiv(): maxdiv = min(ULONG_MAX / rate, maxdiv); clamps maxdiv to 1, causing _next_div() to return 2 on the first iteration and skip the loop body entirely. This makes bestdiv fall back to the maximum divider, returning the minimum rate rather than the maximum. The expected values intentionally reflect the buggy output: - test 1: PARENT_RATE_1GHZ / 8 (minimum rate, not maximum) - test 2: 0 (invalid, loop never populated bestdiv) These will be corrected to PARENT_RATE_1GHZ / 2 and PARENT_RATE_4GHZ / 2 respectively once the fix to clk_divider_bestdiv() is applied. Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Brian Masney <bmasney@redhat.com> Signed-off-by: Brian Masney <bmasney@redhat.com>
2026-06-29reset: eswin: Add eic7700 HSP reset driverXuyang Dong3-0/+125
Add auxiliary driver to support ESWIN EIC7700 high-speed peripherals system. The reset controller is created using the auxiliary device framework and set up in the clock driver. Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Xuyang Dong <dongxuyang@eswincomputing.com> Signed-off-by: Brian Masney <bmasney@redhat.com>
2026-06-29clk: eswin: Add eic7700 HSP clock driverXuyang Dong3-0/+359
Add driver for the ESWIN EIC7700 high-speed peripherals system clock controller and register an auxiliary device for system reset controller which is named as "hsp-reset". Reviewed-by: Brian Masney <bmasney@redhat.com> Signed-off-by: Xuyang Dong <dongxuyang@eswincomputing.com> Signed-off-by: Brian Masney <bmasney@redhat.com>
2026-06-29clk: eswin: Add CLK_IGNORE_UNUSED to NoC clockXuyang Dong1-1/+2
The gate_noc_nsp_clk provides the essential clock source for NPU, DSP, and PCIe subsystems. During kernel init, the clock framework attempts to disable unused clocks when clk_ignore_unused kernel parameter is not set. However, gate_noc_nsp_clk is required to remain enabled for these critical subsystems to function properly, causing PCIe boot failures when auto-disabled. Add CLK_IGNORE_UNUSED flag to gate_noc_nsp_clk to ensure it stays enabled even when clk_ignore_unused is not specified in kernel command line. Fixes: cd44f127c1d4 ("clk: eswin: Add eic7700 clock driver") Signed-off-by: Xuyang Dong <dongxuyang@eswincomputing.com> Reviewed-by: Brian Masney <bmasney@redhat.com> Signed-off-by: Brian Masney <bmasney@redhat.com>
2026-06-29clk: clocking-wizard: fix integer overflow in rate calculationPavel Löbl1-2/+2
When using driver on Zynq-7000 (32-bit) determine_rate calculation overflows. For instance requesting 32MHz with 100MHz parent clock results in 100000000*(4*1000+0) 32-bit multiplication. Replace the expression with mult_frac which is already used in clk_wzrd_recalc_ratef. Cc: stable@vger.kernel.org Fixes: 7681f64e6404 ("clk: clocking-wizard: calculate dividers fractional parts") Signed-off-by: Pale Löbl <pavel@loebl.cz> Reviewed-by: Brian Masney <bmasney@redhat.com> Signed-off-by: Brian Masney <bmasney@redhat.com>
2026-06-29drivers/clk/clk_test: Use strscpy() to copy the test descriptionDavid Laight1-2/+2
The buffer length is known to be KUNIT_PARAM_DESC_SIZE Signed-off-by: David Laight <david.laight.linux@gmail.com> Reviewed-by: Brian Masney <bmasney@redhat.com> Signed-off-by: Brian Masney <bmasney@redhat.com>
2026-06-29clk: kirkwood: use kzalloc_flexRosen Penev1-13/+8
Simplify allocation by using a flexible array member and kzalloc_flex to combine allocations. Add __counted_by for extra runtime analysis. Move counting variable assignment to right after allocation. kzalloc_flex does this automatically with GCC >= 15. Signed-off-by: Rosen Penev <rosenp@gmail.com> Reviewed-by: Brian Masney <bmasney@redhat.com> Signed-off-by: Brian Masney <bmasney@redhat.com>
2026-06-29clk: scmi: Add i.MX95 OEM extension support for SCMI clock driverPeng Fan4-4/+136
- Introduce 'clk-scmi-oem.c' to support vendor-specific OEM extensions for the SCMI clock driver, allows clean integration of vendor-specific features without impacting the core SCMI clock driver logic. - Extend 'clk-scmi.h' with 'scmi_clk_oem' structure and related declarations. - Initialize OEM extensions via 'scmi_clk_oem_init()'. - Support querying OEM-specific features and setting spread spectrum. - Pass 'scmi_device' to 'scmi_clk_ops_select()' for OEM data access. Reviewed-by: Sebin Francis <sebin.francis@ti.com> Reviewed-by: Cristian Marussi <cristian.marussi@arm.com> Signed-off-by: Peng Fan <peng.fan@nxp.com> Signed-off-by: Brian Masney <bmasney@redhat.com>
2026-06-29clk: scmi: Introduce common header for SCMI clock interfacePeng Fan2-26/+41
Added a new header file 'clk-scmi.h' to define common structures and interfaces for the SCMI clock driver. This header will also be used by OEM-specific extensions to ensure consistency and reusability. Moved relevant structure definitions from the driver implementation to 'clk-scmi.h' to facilitate shared usage. Reviewed-by: Sebin Francis <sebin.francis@ti.com> Reviewed-by: Cristian Marussi <cristian.marussi@arm.com> Signed-off-by: Peng Fan <peng.fan@nxp.com> Signed-off-by: Brian Masney <bmasney@redhat.com>
2026-06-29clk: Add KUnit tests for assigned-clock-sscsPeng Fan17-3/+416
Add KUnit test coverage for the assigned-clock-sscs DT property that configures spread spectrum on clocks before they are used. Extend the existing test infrastructure to support spread spectrum: - Add struct clk_spread_spectrum field to clk_dummy_context and a clk_dummy_set_spread_spectrum callback - Wire set_spread_spectrum into all dummy clock ops - Extend clk_assigned_rates_register_clk and test parameter struct to propagate initial SSCS values Add a new separate test suite clk_assigned_sscs with three categories: 1. clk_assigned_sscs_assigns_one — verifies that a single assigned-clock-sscs entry correctly configures spread spectrum on one clock, testing both provider and consumer paths 2. clk_assigned_sscs_assigns_multiple — verifies that multiple assigned-clock-sscs entries configure spread spectrum on two clocks, testing both provider and consumer paths 3. clk_assigned_sscs_skips — verifies that malformed DT properties are correctly skipped without error: missing assigned-clocks, zero-valued SSCS, and null phandles, tested for both provider and consumer scenarios New DT overlays are added for all test scenarios: - kunit_clk_assigned_sscs_one{,consumer} — single valid entry - kunit_clk_assigned_sscs_multiple{,consumer} — two valid entries - kunit_clk_assigned_sscs_without{,consumer} — missing assigned-clocks - kunit_clk_assigned_sscs_zero{,consumer} — all-zero SSCS values - kunit_clk_assigned_sscs_null{,consumer} — null phandle Co-developed-by: Brian Masney <bmasney@redhat.com> Signed-off-by: Peng Fan <peng.fan@nxp.com> Signed-off-by: Brian Masney <bmasney@redhat.com>
2026-06-29clk: conf: Support assigned-clock-sscsPeng Fan1-0/+76
Parse the Spread Spectrum Configuration(SSC) from device tree and configure them before using the clock. Each SSC is three u32 elements which means '<modfreq spreaddepth modmethod>', so assigned-clock-sscs is an array of multiple three u32 elements. Reviewed-by: Brian Masney <bmasney@redhat.com> Reviewed-by: Sebin Francis <sebin.francis@ti.com> Signed-off-by: Peng Fan <peng.fan@nxp.com> Signed-off-by: Brian Masney <bmasney@redhat.com>