linux_dsm_epyc7002/include/linux/regulator/gpio-regulator.h
Linus Walleij 01dc79cd6f
regulator: fixed/gpio: Pull inversion/OD into gpiolib
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.

Cc: Alexander Shiyan <shc_work@mail.ru> # i.MX boards user
Cc: Haojian Zhuang <haojian.zhuang@gmail.com> # MMP2 maintainer
Cc: Aaro Koskinen <aaro.koskinen@iki.fi> # OMAP1 maintainer
Cc: Tony Lindgren <tony@atomide.com> # OMAP1,2,3 maintainer
Cc: Mike Rapoport <rppt@linux.vnet.ibm.com> # EM-X270 maintainer
Cc: Robert Jarzmik <robert.jarzmik@free.fr> # EZX maintainer
Cc: Philipp Zabel <philipp.zabel@gmail.com> # Magician maintainer
Cc: Petr Cvek <petr.cvek@tul.cz> # Magician
Cc: Robert Jarzmik <robert.jarzmik@free.fr> # PXA
Cc: Paul Parsons <lost.distance@yahoo.com> # hx4700
Cc: Daniel Mack <zonque@gmail.com> # Raumfeld maintainer
Cc: Marc Zyngier <marc.zyngier@arm.com> # Zeus maintainer
Cc: Geert Uytterhoeven <geert+renesas@glider.be> # SuperH pinctrl/GPIO maintainer
Cc: Russell King <rmk+kernel@armlinux.org.uk> # SA1100
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Tested-by: Janusz Krzysztofik <jmkrzyszt@gmail.com> #OMAP1 Amstrad Delta
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-02-06 15:58:29 +00:00

84 lines
2.2 KiB
C

/*
* gpio-regulator.h
*
* Copyright 2011 Heiko Stuebner <heiko@sntech.de>
*
* based on fixed.h
*
* Copyright 2008 Wolfson Microelectronics PLC.
*
* Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
*
* Copyright (c) 2009 Nokia Corporation
* Roger Quadros <ext-roger.quadros@nokia.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*/
#ifndef __REGULATOR_GPIO_H
#define __REGULATOR_GPIO_H
#include <linux/gpio/consumer.h>
struct regulator_init_data;
enum regulator_type;
/**
* struct gpio_regulator_state - state description
* @value: microvolts or microamps
* @gpios: bitfield of gpio target-states for the value
*
* This structure describes a supported setting of the regulator
* and the necessary gpio-state to achieve it.
*
* The n-th bit in the bitfield describes the state of the n-th GPIO
* from the gpios-array defined in gpio_regulator_config below.
*/
struct gpio_regulator_state {
int value;
int gpios;
};
/**
* struct gpio_regulator_config - config structure
* @supply_name: Name of the regulator supply
* @enabled_at_boot: Whether regulator has been enabled at
* boot or not. 1 = Yes, 0 = No
* This is used to keep the regulator at
* the default state
* @startup_delay: Start-up time in microseconds
* @gflags: Array of GPIO configuration flags for initial
* states
* @ngpios: Number of GPIOs and configurations available
* @states: Array of gpio_regulator_state entries describing
* the gpio state for specific voltages
* @nr_states: Number of states available
* @regulator_type: either REGULATOR_CURRENT or REGULATOR_VOLTAGE
* @init_data: regulator_init_data
*
* This structure contains gpio-voltage regulator configuration
* information that must be passed by platform code to the
* gpio-voltage regulator driver.
*/
struct gpio_regulator_config {
const char *supply_name;
unsigned enabled_at_boot:1;
unsigned startup_delay;
enum gpiod_flags *gflags;
int ngpios;
struct gpio_regulator_state *states;
int nr_states;
enum regulator_type type;
struct regulator_init_data *init_data;
};
#endif