10 * pwm_request - request a PWM device
12 struct pwm_device
*pwm_request(int pwm_id
, const char *label
);
15 * pwm_free - free a PWM device
17 void pwm_free(struct pwm_device
*pwm
);
20 * pwm_config - change a PWM device configuration
22 int pwm_config(struct pwm_device
*pwm
, int duty_ns
, int period_ns
);
25 * pwm_enable - start a PWM output toggling
27 int pwm_enable(struct pwm_device
*pwm
);
30 * pwm_disable - stop a PWM output toggling
32 void pwm_disable(struct pwm_device
*pwm
);
38 PWMF_REQUESTED
= 1 << 0,
39 PWMF_ENABLED
= 1 << 1,
47 struct pwm_chip
*chip
;
50 unsigned int period
; /* in nanoseconds */
53 static inline void pwm_set_period(struct pwm_device
*pwm
, unsigned int period
)
59 static inline unsigned int pwm_get_period(struct pwm_device
*pwm
)
61 return pwm
? pwm
->period
: 0;
65 * struct pwm_ops - PWM controller operations
66 * @request: optional hook for requesting a PWM
67 * @free: optional hook for freeing a PWM
68 * @config: configure duty cycles and period length for this PWM
69 * @enable: enable PWM output toggling
70 * @disable: disable PWM output toggling
71 * @dbg_show: optional routine to show contents in debugfs
72 * @owner: helps prevent removal of modules exporting active PWMs
75 int (*request
)(struct pwm_chip
*chip
,
76 struct pwm_device
*pwm
);
77 void (*free
)(struct pwm_chip
*chip
,
78 struct pwm_device
*pwm
);
79 int (*config
)(struct pwm_chip
*chip
,
80 struct pwm_device
*pwm
,
81 int duty_ns
, int period_ns
);
82 int (*enable
)(struct pwm_chip
*chip
,
83 struct pwm_device
*pwm
);
84 void (*disable
)(struct pwm_chip
*chip
,
85 struct pwm_device
*pwm
);
86 #ifdef CONFIG_DEBUG_FS
87 void (*dbg_show
)(struct pwm_chip
*chip
,
94 * struct pwm_chip - abstract a PWM controller
95 * @dev: device providing the PWMs
96 * @list: list node for internal use
97 * @ops: callbacks for this PWM controller
98 * @base: number of first PWM controlled by this chip
99 * @npwm: number of PWMs controlled by this chip
100 * @pwms: array of PWM devices allocated by the framework
104 struct list_head list
;
105 const struct pwm_ops
*ops
;
109 struct pwm_device
*pwms
;
111 struct pwm_device
* (*of_xlate
)(struct pwm_chip
*pc
,
112 const struct of_phandle_args
*args
);
113 unsigned int of_pwm_n_cells
;
116 int pwm_set_chip_data(struct pwm_device
*pwm
, void *data
);
117 void *pwm_get_chip_data(struct pwm_device
*pwm
);
119 int pwmchip_add(struct pwm_chip
*chip
);
120 int pwmchip_remove(struct pwm_chip
*chip
);
121 struct pwm_device
*pwm_request_from_chip(struct pwm_chip
*chip
,
125 struct pwm_device
*pwm_get(struct device
*dev
, const char *consumer
);
126 void pwm_put(struct pwm_device
*pwm
);
129 struct list_head list
;
130 const char *provider
;
136 #define PWM_LOOKUP(_provider, _index, _dev_id, _con_id) \
138 .provider = _provider, \
144 void pwm_add_table(struct pwm_lookup
*table
, size_t num
);
148 #endif /* __LINUX_PWM_H */
This page took 0.034544 seconds and 6 git commands to generate.