File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change 14
14
struct clk_pwm {
15
15
struct clk_hw hw ;
16
16
struct pwm_device * pwm ;
17
+ struct pwm_state state ;
17
18
u32 fixed_rate ;
18
19
};
19
20
@@ -26,7 +27,7 @@ static int clk_pwm_prepare(struct clk_hw *hw)
26
27
{
27
28
struct clk_pwm * clk_pwm = to_clk_pwm (hw );
28
29
29
- return pwm_enable (clk_pwm -> pwm );
30
+ return pwm_apply_might_sleep (clk_pwm -> pwm , & clk_pwm -> state );
30
31
}
31
32
32
33
static void clk_pwm_unprepare (struct clk_hw * hw )
@@ -106,15 +107,16 @@ static int clk_pwm_probe(struct platform_device *pdev)
106
107
return - EINVAL ;
107
108
}
108
109
109
- /*
110
- * FIXME: pwm_apply_args() should be removed when switching to the
111
- * atomic PWM API.
112
- */
113
- pwm_apply_args (pwm );
114
- ret = pwm_config (pwm , (pargs .period + 1 ) >> 1 , pargs .period );
110
+ pwm_init_state (pwm , & clk_pwm -> state );
111
+ pwm_set_relative_duty_cycle (& clk_pwm -> state , 1 , 2 );
112
+
113
+ ret = pwm_apply_might_sleep (pwm , & clk_pwm -> state );
115
114
if (ret < 0 )
116
115
return ret ;
117
116
117
+ /* set enabled only now to not enable output above */
118
+ clk_pwm -> state .enabled = true;
119
+
118
120
clk_name = node -> name ;
119
121
of_property_read_string (node , "clock-output-names" , & clk_name );
120
122
You can’t perform that action at this time.
0 commit comments