xref: /freebsd/sys/dev/pwm/pwmc.h (revision 71fb373934f636f01d0d3de44519d06ce8582a1c)
1*71fb3739SIan Lepore /*-
2*71fb3739SIan Lepore  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3*71fb3739SIan Lepore  *
4*71fb3739SIan Lepore  * Copyright (c) 2018 Emmanuel Vadot <manu@FreeBSD.org>
5*71fb3739SIan Lepore  * All rights reserved.
6*71fb3739SIan Lepore  *
7*71fb3739SIan Lepore  * Redistribution and use in source and binary forms, with or without
8*71fb3739SIan Lepore  * modification, are permitted provided that the following conditions
9*71fb3739SIan Lepore  * are met:
10*71fb3739SIan Lepore  * 1. Redistributions of source code must retain the above copyright
11*71fb3739SIan Lepore  *    notice, this list of conditions and the following disclaimer.
12*71fb3739SIan Lepore  * 2. Redistributions in binary form must reproduce the above copyright
13*71fb3739SIan Lepore  *    notice, this list of conditions and the following disclaimer in the
14*71fb3739SIan Lepore  *    documentation and/or other materials provided with the distribution.
15*71fb3739SIan Lepore  *
16*71fb3739SIan Lepore  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17*71fb3739SIan Lepore  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18*71fb3739SIan Lepore  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19*71fb3739SIan Lepore  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20*71fb3739SIan Lepore  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21*71fb3739SIan Lepore  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22*71fb3739SIan Lepore  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23*71fb3739SIan Lepore  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24*71fb3739SIan Lepore  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25*71fb3739SIan Lepore  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26*71fb3739SIan Lepore  * SUCH DAMAGE.
27*71fb3739SIan Lepore  *
28*71fb3739SIan Lepore  * $FreeBSD$
29*71fb3739SIan Lepore  */
30*71fb3739SIan Lepore 
31*71fb3739SIan Lepore #ifndef _PWM_H_
32*71fb3739SIan Lepore #define	_PWM_H_
33*71fb3739SIan Lepore 
34*71fb3739SIan Lepore #define	PWM_POLARITY_INVERTED	(1 << 0)
35*71fb3739SIan Lepore 
36*71fb3739SIan Lepore struct pwm_state {
37*71fb3739SIan Lepore 	int		channel;
38*71fb3739SIan Lepore 	unsigned int	period;
39*71fb3739SIan Lepore 	unsigned int	duty;
40*71fb3739SIan Lepore 	uint32_t	flags;
41*71fb3739SIan Lepore 	bool		enable;
42*71fb3739SIan Lepore };
43*71fb3739SIan Lepore 
44*71fb3739SIan Lepore /*
45*71fb3739SIan Lepore  * ioctls
46*71fb3739SIan Lepore  */
47*71fb3739SIan Lepore 
48*71fb3739SIan Lepore #define	PWMMAXCHANNEL	_IOWR('G', 0, int)
49*71fb3739SIan Lepore #define	PWMGETSTATE	_IOWR('G', 1, struct pwm_state)
50*71fb3739SIan Lepore #define	PWMSETSTATE	_IOWR('G', 2, struct pwm_state)
51*71fb3739SIan Lepore 
52*71fb3739SIan Lepore 
53*71fb3739SIan Lepore #endif /* _PWM_H_ */
54