Skip to content

Conversation

@danmois
Copy link
Contributor

@danmois danmois commented Nov 13, 2025

PR Description

Add DPD functionality to the Madura driver.

PR Type

  • Bug fix (a change that fixes an issue)
  • New feature (a change that adds new functionality)
  • Breaking change (a change that affects other repos or cause CIs to fail)

PR Checklist

  • I have conducted a self-review of my own code changes
  • I have compiled my changes, including the documentation
  • I have tested the changes on the relevant hardware
  • [] I have updated the documentation outside this repo accordingly
  • [] I have provided links for the relevant upstream lore

Copy link
Contributor

@gastmaier gastmaier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looked into the ci output to check sanity. the two new warnings seems to be valid, I highlighted with comments.
There are extra warnings outside touched lines, that would be nice to progressively resolve.

In the files changed tab, action summary page, and log file, you can see the ci warnings


ret = sysfs_create_bin_file(&indio_dev->dev.kobj, &phy->bin);
if (ret < 0)
return ret;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From ci: shouldn't this go to the error de-initialization path?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it should, thank you! I will update the function.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also do not use the above function. Directly accessing a fundamental thing as kobjects from a driver is a very strong sign of something very odd. Use the device_create_bin_file() wrapper.


ret = sscanf(line, "%hhu %hhu %hhu %hhu %s", &i, &j, &k, &lut, coef);
if (ret != 5)
return ret;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From ci: this is never a error code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True. I wonder if an error message should be displayed before returning -EINVAL?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likely yes 😉

@danmois
Copy link
Contributor Author

danmois commented Nov 13, 2025

V2

  • fix error de-initialization path
  • display message and return correct value in case of error in adrv9025_parse_dpd_coef
  • use device_create_bin_file() instead of sysfs_create_bin_file()

return 0;

out_remove_device_bin:
device_remove_bin_file(&phy->indio_dev->dev, &phy->bin);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't you remove the bin file at the remove method as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Thanks!

!!(phy->cal_mask.calMask & val));
break;
case ADRV9025_CAL_MASK:
ret = sprintf(buf, "%d\n",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may be outside the scope of this PR as it looks like a minor addition, but sysfs_emit() should be used instead of sprintf() for sysfs attributes (proper bounds checking, preferred kernel way. Just a thought, might be a chance to modernise the sysfs methods of the driver.

Copy link
Contributor Author

@danmois danmois Nov 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, Vas! You are right, thank you for the observation. However, I used sprintf to keep the current structure of the driver unchanged. I am also not completely sure that we should include this refactoring in this PR, since the current version was tested as it is. From my point of view, DPD is a fairly complex addition to the driver. Do you have any recommendation regarding this @gastmaier , @nunojsa ?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I do agree we should modernize it (because copy paste is a fairly common practice for these devices and we do not want to copy old APIs all over).

That said, it needs to be in it's own patch (a precursor patch) and it should be pretty safe to do it even in this PR. I mean, it should be a matter of s/sprintf/sysfs_emit (or using an IDE replace kind of thing).

@danmois
Copy link
Contributor Author

danmois commented Nov 17, 2025

V3

  • remove bin file at the remove method as well

@danmois
Copy link
Contributor Author

danmois commented Nov 17, 2025

V4

  • use sysfs_emit instead of sprintf

@danmois
Copy link
Contributor Author

danmois commented Nov 17, 2025

V5

  • fix status display

@danmois danmois force-pushed the staging/madura_dpd branch 2 times, most recently from 567c271 to db4f953 Compare November 17, 2025 15:39
Address CI warnings.
No functional change.

Signed-off-by: George Mois <[email protected]>
Use sysfs_emit instead of sprintf.
Use safe functions for formatting buffers.

Signed-off-by: George Mois <[email protected]>
Add Orx to Tx mapping setting functionality.

Signed-off-by: George Mois <[email protected]>
Add external path delay initial calibration selection.

Signed-off-by: George Mois <[email protected]>
Add an IIO attribute that allows changing the calibration mask.

Signed-off-by: George Mois <[email protected]>
Add a bin_attribute for loading the data structure to hold Tx DPD
Model initialization parameters, without floats.

Signed-off-by: George Mois <[email protected]>
Add IIO attribute for selecting the target Tx channel for DPD.

Signed-off-by: George Mois <[email protected]>
Add IIO attribute for resetting DPD.

Signed-off-by: George Mois <[email protected]>
Add DEBUGF attribut for getting DPD status on each of the 4 Tx
channels.

Signed-off-by: George Mois <[email protected]>
Add tracking configuration settings.

Signed-off-by: George Mois <[email protected]>
Add IIO attribute for enabling DPD.

Signed-off-by: George Mois <[email protected]>
@danmois
Copy link
Contributor Author

danmois commented Nov 18, 2025

V6

  • address CI warnings

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants