2 * header file for pwm driver.
4 * Copyright 2016 Google Inc.
5 * Copyright (c) 2011 samsung electronics
6 * Donghwa Lee <dh09.lee@samsung.com>
8 * SPDX-License-Identifier: GPL-2.0+
14 /* struct pwm_ops: Operations for the PWM uclass */
17 * set_config() - Set the PWM configuration
19 * @dev: PWM device to update
20 * @channel: PWM channel to update
21 * @period_ns: PWM period in nanoseconds
22 * @duty_ns: PWM duty period in nanoseconds
23 * @return 0 if OK, -ve on error
25 int (*set_config)(struct udevice *dev, uint channel, uint period_ns,
29 * set_enable() - Enable or disable the PWM
31 * @dev: PWM device to update
32 * @channel: PWM channel to update
33 * @enable: true to enable, false to disable
34 * @return 0 if OK, -ve on error
36 int (*set_enable)(struct udevice *dev, uint channel, bool enable);
39 #define pwm_get_ops(dev) ((struct pwm_ops *)(dev)->driver->ops)
42 * pwm_set_config() - Set the PWM configuration
44 * @dev: PWM device to update
45 * @channel: PWM channel to update
46 * @period_ns: PWM period in nanoseconds
47 * @duty_ns: PWM duty period in nanoseconds
48 * @return 0 if OK, -ve on error
50 int pwm_set_config(struct udevice *dev, uint channel, uint period_ns,
54 * pwm_set_enable() - Enable or disable the PWM
56 * @dev: PWM device to update
57 * @channel: PWM channel to update
58 * @enable: true to enable, false to disable
59 * @return 0 if OK, -ve on error
61 int pwm_set_enable(struct udevice *dev, uint channel, bool enable);
63 /* Legacy interface */
65 int pwm_init (int pwm_id, int div, int invert);
66 int pwm_config (int pwm_id, int duty_ns, int period_ns);
67 int pwm_enable (int pwm_id);
68 void pwm_disable (int pwm_id);