'\" t .\" Title: pwm_init_state .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.79.1 .\" Date: January 2017 .\" Manual: Pulse-Width Modulation (PWM) .\" Source: Kernel Hackers Manual 4.8.15 .\" Language: English .\" .TH "PWM_INIT_STATE" "9" "January 2017" "Kernel Hackers Manual 4\&.8\&." "Pulse-Width Modulation (PWM)" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" pwm_init_state \- prepare a new state to be applied with \fBpwm_apply_state\fR .SH "SYNOPSIS" .HP \w'void\ pwm_init_state('u .BI "void pwm_init_state(const\ struct\ pwm_device\ *\ " "pwm" ", struct\ pwm_state\ *\ " "state" ");" .SH "ARGUMENTS" .PP \fIpwm\fR .RS 4 PWM device .RE .PP \fIstate\fR .RS 4 state to fill with the prepared PWM state .RE .SH "DESCRIPTION" .PP This functions prepares a state that can later be tweaked and applied to the PWM device with \fBpwm_apply_state\fR\&. This is a convenient function that first retrieves the current PWM state and the replaces the period and polarity fields with the reference values defined in pwm\->args\&. Once the function returns, you can adjust the \->enabled and \->duty_cycle fields according to your needs before calling \fBpwm_apply_state\fR\&. .PP \->duty_cycle is initially set to zero to avoid cases where the current \->duty_cycle value exceed the pwm_args\->period one, which would trigger an error if the user calls \fBpwm_apply_state\fR without adjusting \->duty_cycle first\&. .SH "COPYRIGHT" .br