Merge remote-tracking branches 'regulator/topic/pwm', 'regulator/topic/qcom-spmi', 'regulator/topic/rk808' and 'regulator/topic/s2mps11' into regulator-next
This commit is contained in:
commit
39d652e066
10 changed files with 445 additions and 331 deletions
|
|
@ -30,6 +30,9 @@
|
|||
#define MIN_600_MV 600000
|
||||
#define MIN_500_MV 500000
|
||||
|
||||
/* Ramp delay in uV/us */
|
||||
#define RAMP_DELAY_12_MVUS 12000
|
||||
|
||||
/* Macros to represent steps for LDO/BUCK */
|
||||
#define STEP_50_MV 50000
|
||||
#define STEP_25_MV 25000
|
||||
|
|
|
|||
|
|
@ -74,6 +74,24 @@ enum pwm_polarity {
|
|||
PWM_POLARITY_INVERSED,
|
||||
};
|
||||
|
||||
/**
|
||||
* struct pwm_args - board-dependent PWM arguments
|
||||
* @period: reference period
|
||||
* @polarity: reference polarity
|
||||
*
|
||||
* This structure describes board-dependent arguments attached to a PWM
|
||||
* device. These arguments are usually retrieved from the PWM lookup table or
|
||||
* device tree.
|
||||
*
|
||||
* Do not confuse this with the PWM state: PWM arguments represent the initial
|
||||
* configuration that users want to use on this PWM device rather than the
|
||||
* current PWM hardware state.
|
||||
*/
|
||||
struct pwm_args {
|
||||
unsigned int period;
|
||||
enum pwm_polarity polarity;
|
||||
};
|
||||
|
||||
enum {
|
||||
PWMF_REQUESTED = 1 << 0,
|
||||
PWMF_ENABLED = 1 << 1,
|
||||
|
|
@ -92,6 +110,7 @@ enum {
|
|||
* @period: period of the PWM signal (in nanoseconds)
|
||||
* @duty_cycle: duty cycle of the PWM signal (in nanoseconds)
|
||||
* @polarity: polarity of the PWM signal
|
||||
* @args: PWM arguments
|
||||
*/
|
||||
struct pwm_device {
|
||||
const char *label;
|
||||
|
|
@ -105,6 +124,8 @@ struct pwm_device {
|
|||
unsigned int period;
|
||||
unsigned int duty_cycle;
|
||||
enum pwm_polarity polarity;
|
||||
|
||||
struct pwm_args args;
|
||||
};
|
||||
|
||||
static inline bool pwm_is_enabled(const struct pwm_device *pwm)
|
||||
|
|
@ -144,6 +165,18 @@ static inline enum pwm_polarity pwm_get_polarity(const struct pwm_device *pwm)
|
|||
return pwm ? pwm->polarity : PWM_POLARITY_NORMAL;
|
||||
}
|
||||
|
||||
static inline void pwm_get_args(const struct pwm_device *pwm,
|
||||
struct pwm_args *args)
|
||||
{
|
||||
*args = pwm->args;
|
||||
}
|
||||
|
||||
static inline void pwm_apply_args(struct pwm_device *pwm)
|
||||
{
|
||||
pwm_set_period(pwm, pwm->args.period);
|
||||
pwm_set_polarity(pwm, pwm->args.polarity);
|
||||
}
|
||||
|
||||
/**
|
||||
* struct pwm_ops - PWM controller operations
|
||||
* @request: optional hook for requesting a PWM
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue