This pushes the handling of inversion semantics and open drain settings to the GPIO descriptor and gpiolib. All affected board files are also augmented. This is especially nice since we don't have to have any confusing flags passed around to the left and right littering the fixed and GPIO regulator drivers and the regulator core. It is all just very straight-forward: the core asks the GPIO line to be asserted or deasserted and gpiolib deals with the rest depending on how the platform is configured: if the line is active low, it deals with that, if the line is open drain, it deals with that too.
Showing the changes to include/linux (2 of 17 files). Show all
Unified · Split
| @@ -25,14 +25,6 @@ struct regulator_init_data; · 24 unmodified lines | ||
| 25 | 25 | * @input_supply: Name of the input regulator supply |
| 26 | 26 | * @microvolts: Output voltage of regulator |
| 27 | 27 | * @startup_delay: Start-up time in microseconds |
| 28 | − * @gpio_is_open_drain: Gpio pin is open drain or normal type. | |
| 29 | − * If it is open drain type then HIGH will be set | |
| 30 | − * through PULL-UP with setting gpio as input | |
| 31 | − * and low will be set as gpio-output with driven | |
| 32 | − * to low. For non-open-drain case, the gpio will | |
| 33 | − * will be in output and drive to low/high accordingly. | |
| 34 | − * @enable_high: Polarity of enable GPIO | |
| 35 | − * 1 = Active high, 0 = Active low | |
| 36 | 28 | * @enabled_at_boot: Whether regulator has been enabled at |
| 37 | 29 | * boot or not. 1 = Yes, 0 = No |
| 38 | 30 | * This is used to keep the regulator at |
| @@ -48,8 +40,6 @@ struct fixed_voltage_config { · 9 unmodified lines | ||
| 48 | 40 | const char *input_supply; |
| 49 | 41 | int microvolts; |
| 50 | 42 | unsigned startup_delay; |
| 51 | − unsigned gpio_is_open_drain:1; | |
| 52 | − unsigned enable_high:1; | |
| 53 | 43 | unsigned enabled_at_boot:1; |
| 54 | 44 | struct regulator_init_data *init_data; |
| 55 | 45 | }; |
| @@ -46,10 +46,6 @@ struct gpio_regulator_state { · 45 unmodified lines | ||
| 46 | 46 | /** |
| 47 | 47 | * struct gpio_regulator_config - config structure |
| 48 | 48 | * @supply_name: Name of the regulator supply |
| 49 | − * @enable_gpio: GPIO to use for enable control | |
| 50 | − * set to -EINVAL if not used | |
| 51 | − * @enable_high: Polarity of enable GPIO | |
| 52 | − * 1 = Active high, 0 = Active low | |
| 53 | 49 | * @enabled_at_boot: Whether regulator has been enabled at |
| 54 | 50 | * boot or not. 1 = Yes, 0 = No |
| 55 | 51 | * This is used to keep the regulator at |
| @@ -71,8 +67,6 @@ struct gpio_regulator_state { · 15 unmodified lines | ||
| 71 | 67 | struct gpio_regulator_config { |
| 72 | 68 | const char *supply_name; |
| 73 | 69 | |
| 74 | − int enable_gpio; | |
| 75 | − unsigned enable_high:1; | |
| 76 | 70 | unsigned enabled_at_boot:1; |
| 77 | 71 | unsigned startup_delay; |
| 78 | 72 | |