crust-firmware / crust

SCP (power management) firmware for sunxi SoCs
Other
154 stars 34 forks source link

drivers: Update GPIO pin mode setting #123

Closed drewwalters96 closed 6 years ago

drewwalters96 commented 6 years ago

Purpose

The purpose of this PR is to create a common way of setting the modes of the pins defined in a device description.

Closes #105

Considerations for reviewers

This has been tested with a stub axp803 driver.

smaeul commented 6 years ago

You'll need to put the commit adding the pins to the device description before the commit modifying the driver to call dm_setup_pins. Otherwise, you'll break the firmware for that commit.

smaeul commented 6 years ago

The current way you're doing it is fine, but if you think something a bit more generic makes sense, the way I handled the handle arrays in #120 was:

#define CLOCK_PARENTS(n) (struct clock_handle[n])

The equivalent here would be (in gpio.h):

#define GPIO_PINS(n) (struct gpio_handle[n])

I don't know if you think that's better or worse. It's a bit different for clocks, where the number of parents is more variable.

drewwalters96 commented 6 years ago

@smaeul I think this approach makes much more sense, and it is always good to be consistent :blush: