2 * Copyright (c) 2016-2017 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
21 * @brief Enumeration for Polarity
24 PWM_POLARITY_NORMAL = 0,
25 PWM_POLARITY_INVERSED,
29 * @brief pwm_open() init pwm pin.
31 * @param[in] chip pwm chip number
32 * @param[in] pin pwm pin number
33 * @return On success, 0 is returned. On failure, a negative value is returned.
35 int pwm_open(int chip, int pin);
38 * @brief pwm_close() deinit pwm pin.
40 * @param[in] chip pwm chip number
41 * @param[in] pin pwm pin number
42 * @return On success, 0 is returned. On failure, a negative value is returned.
44 int pwm_close(int chip, int pin);
47 * @brief pwm_set_period() sets the pwm period.
49 * @param[in] chip pwm chip number
50 * @param[in] pin pwm pin number
51 * @param[in] period pwm period
52 * @return On success, 0 is returned. On failure, a negative value is returned.
54 int pwm_set_period(int chip, int pin, int period);
57 * @brief pwm_get_period() gets the pwm period.
59 * @param[in] chip pwm chip number
60 * @param[in] pin pwm pin number
61 * @param[out] period pwm period
62 * @return On success, 0 is returned. On failure, a negative value is returned.
64 int pwm_get_period(int chip, int pin, int *period);
67 * @brief pwm_set_duty_cycle() sets the pwm duty cycle.
69 * @param[in] chip pwm chip number
70 * @param[in] pin pwm pin number
71 * @param[in] duty_cycle pwm duty cycle
72 * @return On success, 0 is returned. On failure, a negative value is returned.
74 int pwm_set_duty_cycle(int chip, int pin, int duty_cycle);
77 * @brief pwm_get_duty_cycle() gets the pwm duty cycle.
79 * @param[in] chip pwm chip number
80 * @param[in] pin pwm pin number
81 * @param[out] duty_cycle pwm duty cycle
82 * @return On success, 0 is returned. On failure, a negative value is returned.
84 int pwm_get_duty_cycle(int chip, int pin, int *duty_cycle);
87 * @brief pwm_set_polarity() sets the pwm polarity.
89 * @param[in] chip pwm chip number
90 * @param[in] pin pwm pin number
91 * @param[in] polarity pwm polarity
92 * @return On success, 0 is returned. On failure, a negative value is returned.
94 int pwm_set_polarity(int chip, int pin, pwm_polarity_e polarity);
96 * @brief pwm_get_polarity() gets the pwm polarity.
98 * @param[in] chip pwm chip number
99 * @param[in] pin pwm pin number
100 * @param[out] polarity pwm polarity
101 * @return On success, 0 is returned. On failure, a negative value is returned.
103 int pwm_get_polarity(int chip, int pin, pwm_polarity_e *polarity);
106 * @brief pwm_set_enable() sets the pwm state.
108 * @param[in] chip pwm chip number
109 * @param[in] pin pwm pin number
110 * @param[in] enable pwm enable/disabled state value
111 * @return On success, 0 is returned. On failure, a negative value is returned.
113 int pwm_set_enable(int chip, int pin, bool enable);
116 * @brief pwm_get_enable() checks if pwm state is enabled.
118 * @param[in] chip pwm chip number
119 * @param[in] pin pwm pin number
120 * @param[out] enable pwm enable/disabled state value
121 * @return On success, 0 is returned. On failure, a negative value is returned.
123 int pwm_get_enable(int chip, int pin, bool *enable);
125 #endif /* __PWM_H__ */