sunxi: pinephone: detect existed magnetometer and fixup dtb #2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In newer 1.2 PinePhone board revisions LIS3MDL magnetometer was replaced by AF8133J. They use the same PB1 pin in different modes.
LIS3MDL uses it as an gpio input to handle interrupt. AF8133J uses it as an gpio output as a reset signal.
It wasn't possible at runtime to enable both device tree nodes and detect supported sensor at probe time.
AF8133J has reset pin (PB1) connected to the SoC. By default AF8133J is in a reset state and don't respond to probe request on I2C bus. Extra code would be needed to handle reset signal. Therefore this code uses LIS3MDL magnetometer instead of AF8133J.
Introducing new dts 1.2b with AF8133J sensor would require probing in SPL. That would lead to pulling in into SPL I2C controller driver, RSB controller driver, introducing new AXP803 driver to power-up sensors for probe. It's working, but SPL is pretty size-constrained on A64 and doesn't have much space. Therefore fdt fixup is done in U-Boot proper without introducing new board revision and new dts.