mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 07:12:09 +00:00
pwm: Rearrange structures to group members by purpose
In pwm_ops there are a few callbacks that are not supposed to be used by new drivers. Group them at the end of the structure and add a comment. Similarily for struct pwm_chip group the members that drivers shouldn't care about at the end and mark them as internal with another comment. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
This commit is contained in:
parent
cc2d224777
commit
5d0a4c1189
1 changed files with 18 additions and 15 deletions
|
@ -242,11 +242,7 @@ pwm_set_relative_duty_cycle(struct pwm_state *state, unsigned int duty_cycle,
|
||||||
* struct pwm_ops - PWM controller operations
|
* struct pwm_ops - PWM controller operations
|
||||||
* @request: optional hook for requesting a PWM
|
* @request: optional hook for requesting a PWM
|
||||||
* @free: optional hook for freeing a PWM
|
* @free: optional hook for freeing a PWM
|
||||||
* @config: configure duty cycles and period length for this PWM
|
|
||||||
* @set_polarity: configure the polarity of this PWM
|
|
||||||
* @capture: capture and report PWM signal
|
* @capture: capture and report PWM signal
|
||||||
* @enable: enable PWM output toggling
|
|
||||||
* @disable: disable PWM output toggling
|
|
||||||
* @apply: atomically apply a new PWM config. The state argument
|
* @apply: atomically apply a new PWM config. The state argument
|
||||||
* should be adjusted with the real hardware config (if the
|
* should be adjusted with the real hardware config (if the
|
||||||
* approximate the period or duty_cycle value, state should
|
* approximate the period or duty_cycle value, state should
|
||||||
|
@ -255,48 +251,55 @@ pwm_set_relative_duty_cycle(struct pwm_state *state, unsigned int duty_cycle,
|
||||||
* called once per PWM device when the PWM chip is
|
* called once per PWM device when the PWM chip is
|
||||||
* registered.
|
* registered.
|
||||||
* @owner: helps prevent removal of modules exporting active PWMs
|
* @owner: helps prevent removal of modules exporting active PWMs
|
||||||
|
* @config: configure duty cycles and period length for this PWM
|
||||||
|
* @set_polarity: configure the polarity of this PWM
|
||||||
|
* @enable: enable PWM output toggling
|
||||||
|
* @disable: disable PWM output toggling
|
||||||
*/
|
*/
|
||||||
struct pwm_ops {
|
struct pwm_ops {
|
||||||
int (*request)(struct pwm_chip *chip, struct pwm_device *pwm);
|
int (*request)(struct pwm_chip *chip, struct pwm_device *pwm);
|
||||||
void (*free)(struct pwm_chip *chip, struct pwm_device *pwm);
|
void (*free)(struct pwm_chip *chip, struct pwm_device *pwm);
|
||||||
int (*config)(struct pwm_chip *chip, struct pwm_device *pwm,
|
|
||||||
int duty_ns, int period_ns);
|
|
||||||
int (*set_polarity)(struct pwm_chip *chip, struct pwm_device *pwm,
|
|
||||||
enum pwm_polarity polarity);
|
|
||||||
int (*capture)(struct pwm_chip *chip, struct pwm_device *pwm,
|
int (*capture)(struct pwm_chip *chip, struct pwm_device *pwm,
|
||||||
struct pwm_capture *result, unsigned long timeout);
|
struct pwm_capture *result, unsigned long timeout);
|
||||||
int (*enable)(struct pwm_chip *chip, struct pwm_device *pwm);
|
|
||||||
void (*disable)(struct pwm_chip *chip, struct pwm_device *pwm);
|
|
||||||
int (*apply)(struct pwm_chip *chip, struct pwm_device *pwm,
|
int (*apply)(struct pwm_chip *chip, struct pwm_device *pwm,
|
||||||
struct pwm_state *state);
|
struct pwm_state *state);
|
||||||
void (*get_state)(struct pwm_chip *chip, struct pwm_device *pwm,
|
void (*get_state)(struct pwm_chip *chip, struct pwm_device *pwm,
|
||||||
struct pwm_state *state);
|
struct pwm_state *state);
|
||||||
struct module *owner;
|
struct module *owner;
|
||||||
|
|
||||||
|
/* Only used by legacy drivers */
|
||||||
|
int (*config)(struct pwm_chip *chip, struct pwm_device *pwm,
|
||||||
|
int duty_ns, int period_ns);
|
||||||
|
int (*set_polarity)(struct pwm_chip *chip, struct pwm_device *pwm,
|
||||||
|
enum pwm_polarity polarity);
|
||||||
|
int (*enable)(struct pwm_chip *chip, struct pwm_device *pwm);
|
||||||
|
void (*disable)(struct pwm_chip *chip, struct pwm_device *pwm);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* struct pwm_chip - abstract a PWM controller
|
* struct pwm_chip - abstract a PWM controller
|
||||||
* @dev: device providing the PWMs
|
* @dev: device providing the PWMs
|
||||||
* @list: list node for internal use
|
|
||||||
* @ops: callbacks for this PWM controller
|
* @ops: callbacks for this PWM controller
|
||||||
* @base: number of first PWM controlled by this chip
|
* @base: number of first PWM controlled by this chip
|
||||||
* @npwm: number of PWMs controlled by this chip
|
* @npwm: number of PWMs controlled by this chip
|
||||||
* @pwms: array of PWM devices allocated by the framework
|
|
||||||
* @of_xlate: request a PWM device given a device tree PWM specifier
|
* @of_xlate: request a PWM device given a device tree PWM specifier
|
||||||
* @of_pwm_n_cells: number of cells expected in the device tree PWM specifier
|
* @of_pwm_n_cells: number of cells expected in the device tree PWM specifier
|
||||||
|
* @list: list node for internal use
|
||||||
|
* @pwms: array of PWM devices allocated by the framework
|
||||||
*/
|
*/
|
||||||
struct pwm_chip {
|
struct pwm_chip {
|
||||||
struct device *dev;
|
struct device *dev;
|
||||||
struct list_head list;
|
|
||||||
const struct pwm_ops *ops;
|
const struct pwm_ops *ops;
|
||||||
int base;
|
int base;
|
||||||
unsigned int npwm;
|
unsigned int npwm;
|
||||||
|
|
||||||
struct pwm_device *pwms;
|
|
||||||
|
|
||||||
struct pwm_device * (*of_xlate)(struct pwm_chip *pc,
|
struct pwm_device * (*of_xlate)(struct pwm_chip *pc,
|
||||||
const struct of_phandle_args *args);
|
const struct of_phandle_args *args);
|
||||||
unsigned int of_pwm_n_cells;
|
unsigned int of_pwm_n_cells;
|
||||||
|
|
||||||
|
/* only used internally by the PWM framework */
|
||||||
|
struct list_head list;
|
||||||
|
struct pwm_device *pwms;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue