hc
2024-10-12 a5969cabbb4660eab42b6ef0412cbbd1200cf14d
kernel/drivers/pwm/pwm-clps711x.c
....@@ -1,12 +1,7 @@
1
+// SPDX-License-Identifier: GPL-2.0+
12 /*
23 * Cirrus Logic CLPS711X PWM driver
3
- *
4
- * Copyright (C) 2014 Alexander Shiyan <shc_work@mail.ru>
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation; either version 2 of the License, or
9
- * (at your option) any later version.
4
+ * Author: Alexander Shiyan <shc_work@mail.ru>
105 */
116
127 #include <linux/clk.h>
....@@ -48,9 +43,7 @@
4843 static unsigned int clps711x_get_duty(struct pwm_device *pwm, unsigned int v)
4944 {
5045 /* Duty cycle 0..15 max */
51
- /* DIV_ROUND_CLOSEST(v * 0xf, pwm->args.period) with u64 divisor */
52
- unsigned long long tmp = (v * 0xf) + do_div(pwm->args.period, 2);
53
- return div64_u64(tmp, pwm->args.period);
46
+ return DIV64_U64_ROUND_CLOSEST(v * 0xf, pwm->args.period);
5447 }
5548
5649 static int clps711x_pwm_request(struct pwm_chip *chip, struct pwm_device *pwm)