RK30 related bugfix when using TPS65910 regulator and drm related bugfix#2
Open
Galland wants to merge 2 commits into
Open
RK30 related bugfix when using TPS65910 regulator and drm related bugfix#2Galland wants to merge 2 commits into
Galland wants to merge 2 commits into
Conversation
Bugfix's bugfix
sram_gpio_init is called from mach-rk30/board-pmu-tps65910.c with
PMU_POWER_SLEEP (RK30_PIN6_PB1) as first argument. The return is -EINVAL
even though it's a valid pin.
This is caused, in rk3066, by the bad way in which sram_gpio_init checks
against the gpio_base array, taking into account that for RK3066 this
array is missing one element (RK30_GPIO5_BASE, which is ok). This makes
it give wrong results for any pin on GPIO6_BASE, because of this
comparison:
if(index/NUM_GROUP >= ARRAY_SIZE(gpio_base))
For example:
PMU_POWER_SLEEP = RK30_PIN6_PB1 = 361
Taking the previous line's index calc: index = gpio - PIN_BASE;
Knowing that:
- #define PIN_BASE NR_GIC_IRQS
- #define NR_GIC_IRQS (5 * 32)
index = gpio - PIN_BASE = 361 - 5*32 = 201
and then in the if we have:
- index/NUM_GROUP = 201 / 32 = 6.2 ... = 6
- ARRAY_SIZE(gpio_base) = 6
which is == to ARRAY_SIZE so RK30_PIN6_* fail here
due to using array_size without a RK30_GPIO5_BASE
Solution entails failing on pins in GPIO5_BASE, but allowing them in
GPIO6, and then pressing the right base into data->base by using index 5
for GPIO6, as expected.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.