From ac306864d4d678b48333ded174f6e2554bed3781 Mon Sep 17 00:00:00 2001 From: Michael Hennerich Date: Wed, 10 Dec 2025 16:48:26 +0100 Subject: [PATCH 01/13] jesd204: fsm: fix uninitialized return value in propagate_cb_top_level() Initialize ret to 0 in jesd204_fsm_propagate_cb_top_level(). If num_links is 0, the for loop never executes and ret would be returned uninitialized, leading to undefined behavior. Fixes: f72853dbf6f0 ("jesd204: rework the state machine for top-device propagation") Signed-off-by: Michael Hennerich --- drivers/jesd204/jesd204-fsm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/jesd204/jesd204-fsm.c b/drivers/jesd204/jesd204-fsm.c index 4f0c657bfc8981..8c50cfd0156140 100644 --- a/drivers/jesd204/jesd204-fsm.c +++ b/drivers/jesd204/jesd204-fsm.c @@ -318,7 +318,7 @@ static int jesd204_fsm_propagate_rollback_cb_outputs(struct jesd204_dev *jdev_it static int jesd204_fsm_propagate_cb_top_level(struct jesd204_dev *jdev_it, struct jesd204_fsm_data *fsm_data) { - int i, ret; + int i, ret = 0; if (fsm_data->link_idx != JESD204_LINKS_ALL) return jesd204_fsm_handle_con_cb(jdev_it, NULL, @@ -330,7 +330,6 @@ static int jesd204_fsm_propagate_cb_top_level(struct jesd204_dev *jdev_it, if (ret) break; } - /* FIXME: error message here? */ return ret; } From 61b7850b8aff3f0eb885a32d41249d71f18fefb8 Mon Sep 17 00:00:00 2001 From: Michael Hennerich Date: Wed, 10 Dec 2025 16:49:04 +0100 Subject: [PATCH 02/13] jesd204: sysfs: fix missing iterator increment in output connection show Add missing iter_idx++ in the list_for_each_entry loop when showing output connection attributes. Without this increment, only index 0 would ever match, making sysfs attributes for output connections beyond the first one inaccessible. Fixes: 1080c2efcfb2 ("jesd204: sysfs: add initial version for sysfs") Signed-off-by: Michael Hennerich --- drivers/jesd204/jesd204-sysfs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/jesd204/jesd204-sysfs.c b/drivers/jesd204/jesd204-sysfs.c index a4e90a1935ffa6..4cea2749512064 100644 --- a/drivers/jesd204/jesd204-sysfs.c +++ b/drivers/jesd204/jesd204-sysfs.c @@ -308,6 +308,7 @@ static ssize_t jesd204_con_show(struct device *dev, rc = jesd204_con_printf(e->jdev, ptr1, con, buf); break; } + iter_idx++; } out: From f3007b5b93b45b262db31ea87101697daab99f52 Mon Sep 17 00:00:00 2001 From: Michael Hennerich Date: Wed, 10 Dec 2025 16:50:19 +0100 Subject: [PATCH 03/13] jesd204: sysfs: fix str_cut_from_chr() ignoring character parameter The str_cut_from_chr() function takes a character parameter 'c' but was hardcoded to always search for '_' instead of using the passed parameter. Fix by using strchr(s, c) instead of strchr(s, '_'). While all current callers pass '_', this fix ensures the function behaves as its signature indicates and prevents bugs if future callers use a different character. Fixes: 1080c2efcfb2 ("jesd204: sysfs: add initial version for sysfs") Signed-off-by: Michael Hennerich --- drivers/jesd204/jesd204-sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/jesd204/jesd204-sysfs.c b/drivers/jesd204/jesd204-sysfs.c index 4cea2749512064..b741ca506c8bf8 100644 --- a/drivers/jesd204/jesd204-sysfs.c +++ b/drivers/jesd204/jesd204-sysfs.c @@ -212,7 +212,7 @@ static ssize_t jesd204_con_printf(struct jesd204_dev *jdev, static char *str_cut_from_chr(char *s, char c) { - char *ptr = strchr(s, '_'); + char *ptr = strchr(s, c); if (!ptr) return NULL; From a1464f99390bf761647e59fc8901345ee53f8551 Mon Sep 17 00:00:00 2001 From: Michael Hennerich Date: Wed, 10 Dec 2025 16:51:06 +0100 Subject: [PATCH 04/13] jesd204: sysfs: fix integer overflow in max value validation The max variable was declared as 'int' but assigned 0xffffffff for 32-bit value validation, which overflows to -1 on most systems. This caused the comparison 'val1 > max' to incorrectly reject valid values when storing 32-bit attributes via sysfs. Fix by: - Changing max type from 'int' to 'u64' to hold all valid maximums - Using U8_MAX, U16_MAX, U32_MAX macros for clarity and correctness - Adding proper cast for kstrtoll() to avoid type mismatch warning Fixes: 1080c2efcfb2 ("jesd204: sysfs: add initial version for sysfs") Signed-off-by: Michael Hennerich --- drivers/jesd204/jesd204-sysfs.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/jesd204/jesd204-sysfs.c b/drivers/jesd204/jesd204-sysfs.c index b741ca506c8bf8..4831a1724ff21a 100644 --- a/drivers/jesd204/jesd204-sysfs.c +++ b/drivers/jesd204/jesd204-sysfs.c @@ -321,7 +321,8 @@ static ssize_t jesd204_show_store_int(u64 *val, size_t usize, size_t count, bool store, bool is_signed) { u64 val1 = 0; - int ret, max; + u64 max; + int ret; if (!store) { memcpy(&val1, val, usize); @@ -331,7 +332,7 @@ static ssize_t jesd204_show_store_int(u64 *val, size_t usize, } if (is_signed) - ret = kstrtoll(rbuf, 0, &val1); + ret = kstrtoll(rbuf, 0, (s64 *)&val1); else ret = kstrtoull(rbuf, 0, &val1); if (ret) @@ -339,13 +340,13 @@ static ssize_t jesd204_show_store_int(u64 *val, size_t usize, switch (usize) { case 1: - max = 0xff; + max = U8_MAX; break; case 2: - max = 0xffff; + max = U16_MAX; break; case 4: - max = 0xffffffff; + max = U32_MAX; break; case 8: max = 0; From b68f7d17494d75389e7566ef581fe21d68dc4a54 Mon Sep 17 00:00:00 2001 From: Michael Hennerich Date: Wed, 10 Dec 2025 17:02:55 +0100 Subject: [PATCH 05/13] jesd204: add mutex locking for FSM state transitions Add proper mutex serialization for FSM state transitions to prevent concurrent access to FSM state data. This addresses the FIXME comment in jesd204_fsm_table_single() about needing proper locking. Changes: - Add fsm_lock mutex to jesd204_dev_top structure - Initialize mutex in jesd204_dev_alloc() - Destroy mutex in jesd204_of_unregister_devices() - Lock/unlock mutex around FSM table transitions in jesd204_fsm_table() - Remove FIXME comment that was documenting this issue This ensures thread-safe FSM operations when multiple contexts might attempt state transitions simultaneously. Signed-off-by: Michael Hennerich --- drivers/jesd204/jesd204-core.c | 3 +++ drivers/jesd204/jesd204-fsm.c | 8 ++++---- drivers/jesd204/jesd204-priv.h | 2 ++ 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/jesd204/jesd204-core.c b/drivers/jesd204/jesd204-core.c index 73cb051d22c3d6..d238a10ac888ed 100644 --- a/drivers/jesd204/jesd204-core.c +++ b/drivers/jesd204/jesd204-core.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -725,6 +726,7 @@ static struct jesd204_dev *jesd204_dev_alloc(struct device_node *np) jdev = &jdev_top->jdev; + mutex_init(&jdev_top->fsm_lock); jdev_top->topo_id = topo_id; jdev_top->num_links = ret; for (i = 0; i < jdev_top->num_links; i++) @@ -1177,6 +1179,7 @@ static void jesd204_of_unregister_devices(void) } jdev_top = jesd204_dev_top_dev(jdev); list_del(&jdev_top->entry); + mutex_destroy(&jdev_top->fsm_lock); kfree(jdev_top); jesd204_topologies_count--; } diff --git a/drivers/jesd204/jesd204-fsm.c b/drivers/jesd204/jesd204-fsm.c index 8c50cfd0156140..cfba012a7a18fb 100644 --- a/drivers/jesd204/jesd204-fsm.c +++ b/drivers/jesd204/jesd204-fsm.c @@ -1299,10 +1299,6 @@ static int jesd204_fsm_table_single(struct jesd204_dev *jdev, ret1 = 0; ret = 0; - /** - * FIXME: the handle_busy_flags logic needs re-visit, we should lock - * here and unlock after the loop is done - */ while (!jesd204_fsm_table_end(&it->table[0], rollback, jdev->fsm_rb_to_init)) { it->table = table; @@ -1413,6 +1409,8 @@ static int jesd204_fsm_table(struct jesd204_dev *jdev, if (!jdev_top) return -EFAULT; + mutex_lock(&jdev_top->fsm_lock); + memset(&data, 0, sizeof(data)); data.fsm_change_cb = jesd204_fsm_table_entry_cb; data.fsm_complete_cb = jesd204_fsm_table_entry_done; @@ -1442,6 +1440,8 @@ static int jesd204_fsm_table(struct jesd204_dev *jdev, jesd204_fsm_run_finished_cb(jdev, jdev_top, link_idx, handle_busy_flags); + mutex_unlock(&jdev_top->fsm_lock); + return ret; } diff --git a/drivers/jesd204/jesd204-priv.h b/drivers/jesd204/jesd204-priv.h index 62ede2aaf76ca6..d6d526be36d4d9 100644 --- a/drivers/jesd204/jesd204-priv.h +++ b/drivers/jesd204/jesd204-priv.h @@ -191,6 +191,7 @@ struct jesd204_link_opaque { * cb_ref on the jesd204_link_opaque struct, but each link * increments/decrements it, to group transitions of multiple * JESD204 links + * @fsm_lock mutex to serialize FSM state transitions * @topo_id topology ID for this device (and top-level device) * (connections should match against this) * @link_ids JESD204 link IDs for this top-level device @@ -211,6 +212,7 @@ struct jesd204_dev_top { struct jesd204_fsm_data *fsm_data; struct kref cb_ref; + struct mutex fsm_lock; int topo_id; unsigned int link_ids[JESD204_MAX_LINKS]; From 09f4b7f886fbbb29db682f032e9bc343230d118f Mon Sep 17 00:00:00 2001 From: Michael Hennerich Date: Wed, 10 Dec 2025 17:04:36 +0100 Subject: [PATCH 06/13] jesd204: fix memory leak in lane_ids on device removal Add jesd204_dev_free_links() function to properly free dynamically allocated lane_ids arrays when unregistering JESD204 devices. The lane_ids are allocated in jesd204_dev_init_link_lane_ids() for both active_links and staged_links, but were never freed on device removal. The function only frees lane_ids that were dynamically allocated (not provided statically via init_links) to avoid double-free issues. Fixes: 34b513cd91c6 ("jesd204: init JESD204 links info from driver") Signed-off-by: Michael Hennerich --- drivers/jesd204/jesd204-core.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drivers/jesd204/jesd204-core.c b/drivers/jesd204/jesd204-core.c index d238a10ac888ed..add50a986de3ce 100644 --- a/drivers/jesd204/jesd204-core.c +++ b/drivers/jesd204/jesd204-core.c @@ -664,6 +664,30 @@ static int jesd204_dev_alloc_links(struct jesd204_dev_top *jdev_top) return 0; } +static void jesd204_dev_free_links(struct jesd204_dev_top *jdev_top) +{ + unsigned int i; + + if (jdev_top->active_links) { + for (i = 0; i < jdev_top->num_links; i++) { + /* Only free if not from init_links (static allocation) */ + if (!jdev_top->init_links || + !jdev_top->init_links[i].lane_ids) + kfree(jdev_top->active_links[i].link.lane_ids); + } + kfree(jdev_top->active_links); + } + + if (jdev_top->staged_links) { + for (i = 0; i < jdev_top->num_links; i++) { + if (!jdev_top->init_links || + !jdev_top->init_links[i].lane_ids) + kfree(jdev_top->staged_links[i].link.lane_ids); + } + kfree(jdev_top->staged_links); + } +} + static int jesd204_dev_init_stop_states(struct jesd204_dev *jdev, struct device_node *np) { @@ -1179,6 +1203,7 @@ static void jesd204_of_unregister_devices(void) } jdev_top = jesd204_dev_top_dev(jdev); list_del(&jdev_top->entry); + jesd204_dev_free_links(jdev_top); mutex_destroy(&jdev_top->fsm_lock); kfree(jdev_top); jesd204_topologies_count--; From 8c9c7d8b364baacf6af6a23f67255c86e9261d16 Mon Sep 17 00:00:00 2001 From: Michael Hennerich Date: Wed, 10 Dec 2025 17:05:07 +0100 Subject: [PATCH 07/13] jesd204: warn when device belongs to multiple topologies Add validation in jesd204_dev_get_topology_top_dev() to detect and warn when a JESD204 device is found in multiple topologies. This addresses the FIXME comment about enforcing single-topology membership. The function now iterates through all topologies to check for multiple memberships, warns if detected, and returns the first topology found for consistent behavior. This helps identify misconfigured device trees where a device incorrectly spans multiple JESD204 topologies. Signed-off-by: Michael Hennerich --- drivers/jesd204/jesd204-core.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/jesd204/jesd204-core.c b/drivers/jesd204/jesd204-core.c index add50a986de3ce..0102383d49da39 100644 --- a/drivers/jesd204/jesd204-core.c +++ b/drivers/jesd204/jesd204-core.c @@ -436,17 +436,26 @@ EXPORT_SYMBOL_GPL(jesd204_link_get_lmfc_lemc_rate); struct jesd204_dev_top *jesd204_dev_get_topology_top_dev(struct jesd204_dev *jdev) { struct jesd204_dev_top *jdev_top = jesd204_dev_top_dev(jdev); + struct jesd204_dev_top *found = NULL; if (jdev_top) return jdev_top; - /* FIXME: enforce that one jdev object can only be in one topology */ list_for_each_entry(jdev_top, &jesd204_topologies, entry) { if (!jesd204_dev_has_con_in_topology(jdev, jdev_top)) continue; - return jdev_top; + if (found) { + jesd204_warn(jdev, + "Device belongs to multiple topologies (%d, %d); using first\n", + found->topo_id, jdev_top->topo_id); + break; + } + found = jdev_top; } + if (found) + return found; + jesd204_warn(jdev, "Device isn't a top-device, nor does it belong to topology with top-device\n"); return NULL; From 78735477e22dcc51d70d7c482bb79ca380aa7408 Mon Sep 17 00:00:00 2001 From: Michael Hennerich Date: Wed, 10 Dec 2025 17:12:10 +0100 Subject: [PATCH 08/13] jesd204: fix missing of_node_put() in error path Add missing of_node_put() call when jesd204_dev_alloc() fails during device tree node iteration. The for_each_node_with_property() macro takes a reference on each node, which must be released when breaking out of the loop early due to an error. Fixes: 98086f392799 ("jesd204: collect all devices on framework init") Signed-off-by: Michael Hennerich --- drivers/jesd204/jesd204-core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/jesd204/jesd204-core.c b/drivers/jesd204/jesd204-core.c index 0102383d49da39..2574ce24bd5839 100644 --- a/drivers/jesd204/jesd204-core.c +++ b/drivers/jesd204/jesd204-core.c @@ -958,8 +958,10 @@ static int jesd204_of_create_devices(void) for_each_node_with_property(np, "jesd204-device") { jdev = jesd204_dev_alloc(np); - if (IS_ERR(jdev)) + if (IS_ERR(jdev)) { + of_node_put(np); return PTR_ERR(jdev); + } } list_for_each_entry(jdev, &jesd204_device_list, entry) { From f5aa232c8d78a69b9bc8e477504764b2d378d134 Mon Sep 17 00:00:00 2001 From: Michael Hennerich Date: Wed, 10 Dec 2025 17:13:15 +0100 Subject: [PATCH 09/13] jesd204: fsm: add NULL check for dev_data in table entry callback Add defensive NULL check for jdev->dev_data before accessing state_ops array in jesd204_fsm_table_entry_cb(). While dev_data should always be set for registered devices, this check prevents potential NULL pointer dereference if the FSM callback is invoked on a partially initialized or corrupted device structure. Signed-off-by: Michael Hennerich --- drivers/jesd204/jesd204-fsm.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/jesd204/jesd204-fsm.c b/drivers/jesd204/jesd204-fsm.c index cfba012a7a18fb..87b63b4f960db1 100644 --- a/drivers/jesd204/jesd204-fsm.c +++ b/drivers/jesd204/jesd204-fsm.c @@ -1179,6 +1179,9 @@ static int jesd204_fsm_table_entry_cb(struct jesd204_dev *jdev, jesd204_fsm_handle_stop_state(jdev, link_idx, fsm_data); + if (!jdev->dev_data) + return JESD204_STATE_CHANGE_DONE; + state_op = &jdev->dev_data->state_ops[it->table[0].op]; if (fsm_data->rollback) From 72b1b15d3300b67b66b7c6a703bfe60f20866b6d Mon Sep 17 00:00:00 2001 From: Michael Hennerich Date: Wed, 10 Dec 2025 17:13:43 +0100 Subject: [PATCH 10/13] jesd204: fsm: document EINVALID_STATE error code Add documentation comment explaining the purpose and value choice of the EINVALID_STATE internal error code. This magic number is used to signal FSM state validation failures and is intentionally chosen to be outside the standard errno range to allow special handling during state transitions and resume operations. Signed-off-by: Michael Hennerich --- drivers/jesd204/jesd204-fsm.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/jesd204/jesd204-fsm.c b/drivers/jesd204/jesd204-fsm.c index 87b63b4f960db1..0a655f25c9796b 100644 --- a/drivers/jesd204/jesd204-fsm.c +++ b/drivers/jesd204/jesd204-fsm.c @@ -14,6 +14,13 @@ #define JESD204_FSM_BUSY BIT(0) +/* + * Internal error code used to signal that the current FSM state doesn't match + * the expected state during validation. This is distinct from standard errno + * values to allow special handling (e.g., skipping states during resume). + * The value 9000 is chosen to be well outside the range of standard errno + * values (typically 1-4095) to avoid conflicts. + */ #define EINVALID_STATE 9000 typedef int (*jesd204_fsm_cb)(struct jesd204_dev *jdev, From 29d27395dafce079feb259ee9a726a6f57de8b80 Mon Sep 17 00:00:00 2001 From: Michael Hennerich Date: Wed, 10 Dec 2025 17:14:59 +0100 Subject: [PATCH 11/13] jesd204: fsm: add debug logging for rollback operations Add debug-level logging when FSM rollback operations are initiated. This helps with debugging FSM state transition failures by logging the source and target states during rollback, making it easier to trace the sequence of state changes when errors occur. Signed-off-by: Michael Hennerich --- drivers/jesd204/jesd204-fsm.c | 4 ++++ include/linux/jesd204/jesd204.h | 2 ++ 2 files changed, 6 insertions(+) diff --git a/drivers/jesd204/jesd204-fsm.c b/drivers/jesd204/jesd204-fsm.c index 0a655f25c9796b..bf2518e320f74c 100644 --- a/drivers/jesd204/jesd204-fsm.c +++ b/drivers/jesd204/jesd204-fsm.c @@ -377,6 +377,10 @@ static int __jesd204_fsm_propagate_cb(struct jesd204_dev *jdev, static int __jesd204_fsm_propagate_rollback_cb(struct jesd204_dev *jdev, struct jesd204_fsm_data *data) { + jesd204_dbg(jdev, "Rolling back from state %s to %s\n", + jesd204_state_str(data->cur_state), + jesd204_state_str(data->nxt_state)); + jesd204_fsm_propagate_rollback_cb_top_level(jdev, data); jesd204_fsm_propagate_rollback_cb_outputs(jdev, data); jesd204_fsm_propagate_rollback_cb_inputs(jdev, data); diff --git a/include/linux/jesd204/jesd204.h b/include/linux/jesd204/jesd204.h index 1b6cc58fa85026..19250ff2ad3f2f 100644 --- a/include/linux/jesd204/jesd204.h +++ b/include/linux/jesd204/jesd204.h @@ -438,5 +438,7 @@ void jesd204_printk(const char *level, const struct jesd204_dev *jdev, jesd204_printk(KERN_NOTICE, dev, fmt, ##__VA_ARGS__) #define jesd204_info(dev, fmt, ...) \ jesd204_printk(KERN_INFO, dev, fmt, ##__VA_ARGS__) +#define jesd204_dbg(dev, fmt, ...) \ + jesd204_printk(KERN_DEBUG, dev, fmt, ##__VA_ARGS__) #endif From e17e8bf49ec398a805b6e1fc465f219394d6b8c9 Mon Sep 17 00:00:00 2001 From: Michael Hennerich Date: Wed, 10 Dec 2025 17:16:35 +0100 Subject: [PATCH 12/13] jesd204: add kernel-doc comments for undocumented functions Add kernel-doc documentation comments to the following functions that were previously undocumented: - jesd204_device_count_get(): Returns the count of registered devices - jesd204_dev_get_topology_top_dev(): Finds top-level device for a topology - jesd204_printk(): Prints kernel messages with JESD204 device context These functions are part of the JESD204 framework API and benefit from proper documentation for maintainability and developer reference. Signed-off-by: Michael Hennerich --- drivers/jesd204/jesd204-core.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/drivers/jesd204/jesd204-core.c b/drivers/jesd204/jesd204-core.c index 2574ce24bd5839..b57d1326e4f5fa 100644 --- a/drivers/jesd204/jesd204-core.c +++ b/drivers/jesd204/jesd204-core.c @@ -141,6 +141,11 @@ bool jesd204_link_get_paused(const struct jesd204_link *lnk) } EXPORT_SYMBOL_GPL(jesd204_link_get_paused); +/** + * jesd204_device_count_get() - Get the total number of registered JESD204 devices + * + * Return: The current count of registered JESD204 devices in the framework. + */ int jesd204_device_count_get(void) { return jesd204_device_count; @@ -433,6 +438,19 @@ int jesd204_link_get_lmfc_lemc_rate(struct jesd204_link *lnk, } EXPORT_SYMBOL_GPL(jesd204_link_get_lmfc_lemc_rate); +/** + * jesd204_dev_get_topology_top_dev() - Get the top-level device for a JESD204 topology + * @jdev: Pointer to a JESD204 device within the topology + * + * This function finds and returns the top-level device (typically ADC, DAC, + * or transceiver) for the JESD204 topology that contains the given device. + * If the device itself is a top-level device, it returns that directly. + * Otherwise, it searches through all topologies to find where this device + * has connections. + * + * Return: Pointer to the top-level jesd204_dev_top structure, or NULL if + * the device doesn't belong to any topology. + */ struct jesd204_dev_top *jesd204_dev_get_topology_top_dev(struct jesd204_dev *jdev) { struct jesd204_dev_top *jdev_top = jesd204_dev_top_dev(jdev); @@ -627,6 +645,17 @@ static void __jesd204_printk(const char *level, const struct jesd204_dev *jdev, vaf); } +/** + * jesd204_printk() - Print a kernel message for a JESD204 device + * @level: Kernel log level string (e.g., KERN_ERR, KERN_INFO) + * @jdev: Pointer to the JESD204 device structure (may be NULL) + * @fmt: printf-style format string + * @...: Arguments for the format string + * + * This function prints a kernel message with JESD204 device context. + * It handles NULL device pointers gracefully and includes device tree + * node information when available. + */ void jesd204_printk(const char *level, const struct jesd204_dev *jdev, const char *fmt, ...) { From 85b372776900742cb9f6416419572bb5853d2cf1 Mon Sep 17 00:00:00 2001 From: Michael Hennerich Date: Thu, 11 Dec 2025 09:03:43 +0100 Subject: [PATCH 13/13] jesd204: sysfs: expose sample_rate_div link attribute Add the sample_rate_div member of struct jesd204_link to the sysfs interface. This attribute was missing from the exported link parameters. The sample_rate_div is an optional sample rate divider where the final effective sample rate is calculated as: sample_rate / sample_rate_div. The new attribute will appear as linkX_sample_rate_div in sysfs for each JESD204 link. Signed-off-by: Michael Hennerich --- drivers/jesd204/jesd204-sysfs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/jesd204/jesd204-sysfs.c b/drivers/jesd204/jesd204-sysfs.c index 4831a1724ff21a..912ac9f24e5d64 100644 --- a/drivers/jesd204/jesd204-sysfs.c +++ b/drivers/jesd204/jesd204-sysfs.c @@ -92,6 +92,7 @@ enum { JESD204_LNK_ATTR_fsm_paused, JESD204_LNK_ATTR_fsm_ignore_errors, JESD204_LNK_ATTR_sample_rate, + JESD204_LNK_ATTR_sample_rate_div, JESD204_LNK_ATTR_is_transmit, JESD204_LNK_ATTR_num_lanes, JESD204_LNK_ATTR_num_converters, @@ -122,6 +123,7 @@ static const struct jesd204_attr jesd204_lnk_attrs[] = { JESD204_LNK_ATTR_BOOL_PRIV(fsm_paused), JESD204_LNK_ATTR_BOOL_PRIV(fsm_ignore_errors), JESD204_LNK_ATTR_UINT(sample_rate), + JESD204_LNK_ATTR_UINT(sample_rate_div), JESD204_LNK_ATTR_BOOL(is_transmit), JESD204_LNK_ATTR_UINT(num_lanes), JESD204_LNK_ATTR_UINT(num_converters),