xref: /freebsd/sys/dev/pwm/pwmc.h (revision 95ee2897e98f5d444f26ed2334cc7c439f9c16c6)
171fb3739SIan Lepore /*-
2*4d846d26SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
371fb3739SIan Lepore  *
471fb3739SIan Lepore  * Copyright (c) 2018 Emmanuel Vadot <manu@FreeBSD.org>
571fb3739SIan Lepore  *
671fb3739SIan Lepore  * Redistribution and use in source and binary forms, with or without
771fb3739SIan Lepore  * modification, are permitted provided that the following conditions
871fb3739SIan Lepore  * are met:
971fb3739SIan Lepore  * 1. Redistributions of source code must retain the above copyright
1071fb3739SIan Lepore  *    notice, this list of conditions and the following disclaimer.
1171fb3739SIan Lepore  * 2. Redistributions in binary form must reproduce the above copyright
1271fb3739SIan Lepore  *    notice, this list of conditions and the following disclaimer in the
1371fb3739SIan Lepore  *    documentation and/or other materials provided with the distribution.
1471fb3739SIan Lepore  *
1571fb3739SIan Lepore  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1671fb3739SIan Lepore  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1771fb3739SIan Lepore  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1871fb3739SIan Lepore  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1971fb3739SIan Lepore  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2071fb3739SIan Lepore  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2171fb3739SIan Lepore  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2271fb3739SIan Lepore  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2371fb3739SIan Lepore  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2471fb3739SIan Lepore  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2571fb3739SIan Lepore  * SUCH DAMAGE.
2671fb3739SIan Lepore  */
2771fb3739SIan Lepore 
2871fb3739SIan Lepore #ifndef _PWM_H_
2971fb3739SIan Lepore #define	_PWM_H_
3071fb3739SIan Lepore 
3171fb3739SIan Lepore #define	PWM_POLARITY_INVERTED	(1 << 0)
3271fb3739SIan Lepore 
3371fb3739SIan Lepore struct pwm_state {
3409ebe549SIan Lepore 	u_int		period;
3509ebe549SIan Lepore 	u_int		duty;
3671fb3739SIan Lepore 	uint32_t	flags;
3771fb3739SIan Lepore 	bool		enable;
3871fb3739SIan Lepore };
3971fb3739SIan Lepore 
4071fb3739SIan Lepore /*
4171fb3739SIan Lepore  * ioctls
4271fb3739SIan Lepore  */
4371fb3739SIan Lepore 
44780c3de8SIan Lepore #define	PWMGETSTATE	_IOWR('G', 0, struct pwm_state)
45780c3de8SIan Lepore #define	PWMSETSTATE	_IOWR('G', 1, struct pwm_state)
4671fb3739SIan Lepore 
4771fb3739SIan Lepore #endif /* _PWM_H_ */
48