354764cf5f7a73428ff02ac4df72b23c7313e55b
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 * enum pwm_polarity - polarity of a PWM signal
39 * @PWM_POLARITY_NORMAL: a high signal for the duration of the duty-
40 * cycle, followed by a low signal for the remainder of the pulse
42 * @PWM_POLARITY_INVERSED: a low signal for the duration of the duty-
43 * cycle, followed by a high signal for the remainder of the pulse
48 PWM_POLARITY_INVERSED
,
52 PWMF_REQUESTED
= 1 << 0,
53 PWMF_ENABLED
= 1 << 1,
61 struct pwm_chip
*chip
;
64 unsigned int period
; /* in nanoseconds */
67 static inline void pwm_set_period(struct pwm_device
*pwm
, unsigned int period
)
73 static inline unsigned int pwm_get_period(struct pwm_device
*pwm
)
75 return pwm
? pwm
->period
: 0;
79 * pwm_set_polarity - configure the polarity of a PWM signal
81 int pwm_set_polarity(struct pwm_device
*pwm
, enum pwm_polarity polarity
);
84 * struct pwm_ops - PWM controller operations
85 * @request: optional hook for requesting a PWM
86 * @free: optional hook for freeing a PWM
87 * @config: configure duty cycles and period length for this PWM
88 * @set_polarity: configure the polarity of this PWM
89 * @enable: enable PWM output toggling
90 * @disable: disable PWM output toggling
91 * @dbg_show: optional routine to show contents in debugfs
92 * @owner: helps prevent removal of modules exporting active PWMs
95 int (*request
)(struct pwm_chip
*chip
,
96 struct pwm_device
*pwm
);
97 void (*free
)(struct pwm_chip
*chip
,
98 struct pwm_device
*pwm
);
99 int (*config
)(struct pwm_chip
*chip
,
100 struct pwm_device
*pwm
,
101 int duty_ns
, int period_ns
);
102 int (*set_polarity
)(struct pwm_chip
*chip
,
103 struct pwm_device
*pwm
,
104 enum pwm_polarity polarity
);
105 int (*enable
)(struct pwm_chip
*chip
,
106 struct pwm_device
*pwm
);
107 void (*disable
)(struct pwm_chip
*chip
,
108 struct pwm_device
*pwm
);
109 #ifdef CONFIG_DEBUG_FS
110 void (*dbg_show
)(struct pwm_chip
*chip
,
113 struct module
*owner
;
117 * struct pwm_chip - abstract a PWM controller
118 * @dev: device providing the PWMs
119 * @list: list node for internal use
120 * @ops: callbacks for this PWM controller
121 * @base: number of first PWM controlled by this chip
122 * @npwm: number of PWMs controlled by this chip
123 * @pwms: array of PWM devices allocated by the framework
127 struct list_head list
;
128 const struct pwm_ops
*ops
;
132 struct pwm_device
*pwms
;
134 struct pwm_device
* (*of_xlate
)(struct pwm_chip
*pc
,
135 const struct of_phandle_args
*args
);
136 unsigned int of_pwm_n_cells
;
139 int pwm_set_chip_data(struct pwm_device
*pwm
, void *data
);
140 void *pwm_get_chip_data(struct pwm_device
*pwm
);
142 int pwmchip_add(struct pwm_chip
*chip
);
143 int pwmchip_remove(struct pwm_chip
*chip
);
144 struct pwm_device
*pwm_request_from_chip(struct pwm_chip
*chip
,
148 struct pwm_device
*pwm_get(struct device
*dev
, const char *consumer
);
149 void pwm_put(struct pwm_device
*pwm
);
152 struct list_head list
;
153 const char *provider
;
159 #define PWM_LOOKUP(_provider, _index, _dev_id, _con_id) \
161 .provider = _provider, \
167 void pwm_add_table(struct pwm_lookup
*table
, size_t num
);
171 #endif /* __LINUX_PWM_H */
This page took 0.032582 seconds and 4 git commands to generate.