1170530Ssam/*- 2178354Ssam * Copyright (c) 2022 Vladimir Kondratyev <wulf@FreeBSD.org> 3170530Ssam * 4170530Ssam * Redistribution and use in source and binary forms, with or without 5170530Ssam * modification, are permitted provided that the following conditions 6170530Ssam * are met: 7170530Ssam * 1. Redistributions of source code must retain the above copyright 8170530Ssam * notice, this list of conditions and the following disclaimer. 9170530Ssam * 2. Redistributions in binary form must reproduce the above copyright 10170530Ssam * notice, this list of conditions and the following disclaimer in the 11170530Ssam * documentation and/or other materials provided with the distribution. 12170530Ssam * 13170530Ssam * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 14170530Ssam * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15170530Ssam * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16170530Ssam * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 17170530Ssam * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18170530Ssam * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19170530Ssam * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20170530Ssam * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21170530Ssam * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22170530Ssam * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23170530Ssam * SUCH DAMAGE. 24170530Ssam */ 25170530Ssam 26170530Ssam#ifndef _LINUXKPI_LINUX_PWM_H_ 27170530Ssam#define _LINUXKPI_LINUX_PWM_H_ 28170530Ssam 29170530Ssam#include <linux/device.h> 30170530Ssam#include <linux/err.h> 31170530Ssam 32178354Ssamstruct pwm_state { 33178354Ssam uint64_t period; 34170530Ssam bool enabled; 35170530Ssam}; 36170530Ssam 37170530Ssamstruct pwm_device { 38170530Ssam struct pwm_state state; 39170530Ssam}; 40170530Ssam 41170530Ssamstatic inline struct pwm_device * 42170530Ssampwm_get(struct device *dev, const char *consumer) 43170530Ssam{ 44170530Ssam return (ERR_PTR(-ENODEV)); 45170530Ssam} 46170530Ssam 47170530Ssamstatic inline void 48178354Ssampwm_put(struct pwm_device *pwm) 49178354Ssam{ 50170530Ssam} 51178354Ssam 52178354Ssamstatic inline int 53170530Ssampwm_enable(struct pwm_device *pwm) 54170530Ssam{ 55170530Ssam return (-EINVAL); 56178354Ssam} 57178354Ssam 58178354Ssamstatic inline void 59178354Ssampwm_disable(struct pwm_device *pwm) 60178354Ssam{ 61178354Ssam} 62178354Ssam 63178354Ssamstatic inline bool 64178354Ssampwm_is_enabled(const struct pwm_device *pwm) 65178354Ssam{ 66178354Ssam return (false); 67178354Ssam} 68170530Ssam 69178354Ssamstatic inline unsigned int 70178354Ssampwm_get_relative_duty_cycle(const struct pwm_state *state, unsigned int scale) 71170530Ssam{ 72170530Ssam return (0); 73170530Ssam} 74170530Ssam 75178354Ssamstatic inline int 76170530Ssampwm_set_relative_duty_cycle(struct pwm_state *state, unsigned int duty_cycle, 77170530Ssam unsigned int scale) 78170530Ssam{ 79170530Ssam return (0); 80170530Ssam} 81178354Ssam 82178354Ssamstatic inline void 83178354Ssampwm_get_state(const struct pwm_device *pwm, struct pwm_state *state) 84178354Ssam{ 85178354Ssam *state = pwm->state; 86170530Ssam} 87170530Ssam 88178354Ssamstatic inline int 89170530Ssampwm_apply_state(struct pwm_device *pwm, const struct pwm_state *state) 90170530Ssam{ 91170530Ssam return (-ENOTSUPP); 92170530Ssam} 93170530Ssam 94178354Ssam#endif /* _LINUXKPI_LINUX_PWM_H_ */ 95170530Ssam