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 LXA TAC hardware generation 3 support #64

Closed
wants to merge 1 commit into from

Conversation

hnez
Copy link
Member

@hnez hnez commented Mar 25, 2024

The ADC channels 0 and 1 on the STM32MP1 are a bit special, in that they are not muxable as GPIOs but connected directly to the ADC peripheral.
This has cause us a bit of trouble in the past, because these pins seem to leak current (like all other channels did until the transition into ADC standby was fixed by unmuxing the ADC pins beforehand). We could once again try to fix the issue with these pins, but that could also turn out to be impossible to do (since the pins can not be muxed away).
This is why we have instead decided to just not use these pins on generation 3 (and likely later) hardware and use other pins instead.

This means we have to detect which ADC pins we should use based on if we are running on Gen 1 / Gen 2 or Gen 3.

Luckily this can be decided without doing an explicit generation detection. Instead we can just try setting up channels voltage0 and voltage1 (Gen 1 and Gen 2) and if that fails fall back to setting up voltage18 and voltage14 instead (Gen 3), since these channels only exist on the respective hardware generations.

TODO before merging:

  • Test on actual generation 3 hardware

The ADC channels 0 and 1 on the STM32MP1 are a bit special,
in that they are not muxable as GPIOs but connected directly to the
ADC peripheral.
This has cause us a bit of trouble in the past, because these pins
seem to leak current (like all other channels did until the transition
into ADC standby was fixed by unmuxing the ADC pins beforehand).
We could once again try to fix the issue with these pins,
but that could also turn out to be impossible to do (since the pins
can not be muxed away).
This is why we have instead decided to just not use these pins on
generation 3 (and likely later) hardware and use other pins instead.

This means we have to detect which ADC pins we should use based on
if we are running on Gen 1 / Gen 2 or Gen 3.

Luckily this can be decided without doing an explicit generation
detection. Instead we can just try setting up channels voltage0 and
voltage1 (Gen 1 and Gen 2) and if that fails fall back to setting
up voltage18 and voltage14 instead (Gen 3), since these channels
only exist on the respective hardware generations.

Signed-off-by: Leonard Göhrs <[email protected]>
@hnez hnez requested a review from lichtfeind March 25, 2024 08:57
@hnez hnez self-assigned this Mar 25, 2024
@SmithChart
Copy link
Member

I would strongly vote against an implicit detection here. In the end we will have multiple ways to detect multiple features of the hardware all over the codebase.

For me we should use one of the following ways:

  • All devices carry bringup-data in the EEPROMs of both devices. We could, for example read /sys/firmware/devicetree/base/chosen/baseboard-factory-data/device-hardware-release. The Rnn will directly give you the generation you are running on.
  • You could read the Revision-Resistors on GPIO Bank Z.

@hnez
Copy link
Member Author

hnez commented Apr 2, 2024

I am convinced now that the solution proposed in #66 is better than what is proposed here.
So I will close this PR now.

@hnez hnez closed this Apr 2, 2024
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