Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an overlay for the Ti ADS1015 A/D #1504

Closed
wants to merge 9 commits into from
Closed

Add an overlay for the Ti ADS1015 A/D #1504

wants to merge 9 commits into from

Conversation

eriksejr
Copy link

I created this for a project I did recently. This overlay works with the existing ads1015 hwmon kernel driver. I tried to make it as flexible as possible, making most options configurable via config.txt.

I would have liked to target the alias "i2c_arm" rather then the exact path with the memory address but I could not get the enabling/disabling of fragments to work properly as I could not seem to target a previous fragment with a later one. This is my first device tree overlay so there may be a way to do that which I am not aware of.

I created a README.md in my repo for it: https://github.com/eriksejr/rpi_ads1015

Feedback is welcome.

@pelwell
Copy link
Contributor

pelwell commented Jun 6, 2016

That's a good attempt, but you'd be better off doing something like this. It uses the exported symbol i2c_arm which is mapped to the correct i2c interface for the model in use. Fragment 0 uses a target property with a phandle reference (<&i2c_arm>), while the others use target-path with an alias as the start of the path and append the name of the added node (i2c_arm/ads1015). You could use the target-path + alias format for fragment 0, but I prefer to use the more common format where possible.

Note that target-path = "alias/subnode"; requires very recent firmware - May 31st 2016 is the first compatible release, available using rpi-update. Prior to that you could only use target-path = "/absolute/path"; or target-path = "alias";.

If your channel numbers are arbitrary then I think it would be less confusing to either make the default numbers match your virtual channel names, i.e. 1-4, or use letters for your virtual channels.

In order to be accepted you will also need to add your overlay to the Makefile and README - observe the strict formatting (80 columns, no TABs) and alphabetical order rules.

@eriksejr
Copy link
Author

eriksejr commented Jun 7, 2016

Phil,
Thank you for the help & feedback. I have made all the changes you suggested and updated the Makefile/README. I upgraded my Pi 3 Rev B to the latest firmware as of tonight (kernel 4.4.12) and re-compiled it including the ads1015 kernel module along with all the changes.

@@ -167,6 +167,27 @@ Info: Overlay for activation of ADAU1977 ADC codec over I2C for control
Load: dtoverlay=adau1977-adc
Params: <None>

Copy link
Contributor

Choose a reason for hiding this comment

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

Add another blank line here.

@pelwell
Copy link
Contributor

pelwell commented Jun 7, 2016

Address the comments above, squash the commits down to one (use git rebase -i) and update the PR (git push -f), then I'll merge it.

@eriksejr
Copy link
Author

eriksejr commented Jun 8, 2016

Having problems squashing this, when I caught up my fork there ended up being a few hundred commits between my first commit and my later commits. I'm just going to close this and re-open it with everything as one big commit

@eriksejr eriksejr closed this Jun 8, 2016
@eriksejr eriksejr mentioned this pull request Jun 8, 2016
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