Skip to content

ADS1115: allow specification of the i2c bus - #5755

Closed
JinShil wants to merge 2 commits into
raspberrypi:rpi-6.1.yfrom
JinShil:rpi-6.1.y
Closed

JinShil wants to merge 2 commits into
raspberrypi:rpi-6.1.yfrom
JinShil:rpi-6.1.y

Conversation

@JinShil

@JinShil JinShil commented Nov 28, 2023

Copy link
Copy Markdown

Analogous to #5650

@pelwell

pelwell commented Nov 28, 2023

Copy link
Copy Markdown
Contributor

Even allowing for the checkpatch warnings (*), this is not going to work. The problem is the merge order of the fragments.

Fragments are merged in two linear passes:

  1. Fragments that target other fragments (I call them intra- fragments because they operate within the overlay) are applied.
  2. Fragments that target the base dtb (inter- fragments) are applied.

This scheme is more forgiving than the obvious one-pass, top-to-bottom scheme, but perhaps it lulls people into a false sense of security. What it lacks is a pass 0 that applies fragments that target intra fragments (intra-intra?), and a pass -1 that applies fragments that target intra fragments that target intra fragments (intra-intra-intra). As a result, all intra fragments (or at least intra fragments with dependency relationships) have to be written in the order in which they are applied.

Your modifications have fallen foul of this restriction by introducing an extra level to the hierarchy, and for no good reason. You could just as easily have put the frag100 label (ideally with a different name) on fragment 0 and deleted fragment 100 itself.

(*) I'm annoyed because I thought I had added enough infrastructure to the automated build checks to spot this kind of problem, but it clearly doesn't work. You can prove the problem exists yourself like this:

$ make ARCH=arm bcm2711_defconfig
$ make ARCH=arm dtbs
$ cd arch/arm/boot/dts
$ dtmerge bcm2711-rpi-4-b.dtb merged1.dtb overlays/ads1115.dtbo
$ dtmerge bcm2711-rpi-4-b.dtb merged2.dtb overlays/ads1115.dtbo chb_enable
$ dtdiff merged1.dtb merged2.dtb

(dtmerge is from the raspi-utils package which should be installed by default, or you can build it from our raspberrypi/utils repo)

@JinShil

JinShil commented Nov 29, 2023

Copy link
Copy Markdown
Author

@pelwell

pelwell commented Nov 29, 2023

Copy link
Copy Markdown
Contributor

In your overlay, fragment 0 will be added to fragment 100 before e.g. fragment 1 is added to fragment 0.

Show me a problematic fragment in either of those overlays - I can't see one which doesn't obey the rules.

@pelwell

pelwell commented Nov 29, 2023

Copy link
Copy Markdown
Contributor

I've fixed the problem with the overlay checker, which now correctly reports:

* fragment@1 should precede fragment@0
*   Error ^ in overlay ads1115

Note that this is after checking all of the overlays, not just ads1115.

@JinShil

JinShil commented Nov 30, 2023

Copy link
Copy Markdown
Author

I think I understand, but I'm not able to get overlaycheck to reproduce the error locally, and the time I've allotted to this has expired for now.

@JinShil JinShil closed this Nov 30, 2023
@pelwell

pelwell commented Nov 30, 2023

Copy link
Copy Markdown
Contributor

Are you happy for me to fix this version of the overlay and add it for you?

@pelwell

pelwell commented Nov 30, 2023

Copy link
Copy Markdown
Contributor

See: #5762

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.

2 participants