| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0+ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * 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> |
|---|
| 10 | 5 | */ |
|---|
| 11 | 6 | |
|---|
| 12 | 7 | #include <linux/clk.h> |
|---|
| .. | .. |
|---|
| 48 | 43 | static unsigned int clps711x_get_duty(struct pwm_device *pwm, unsigned int v) |
|---|
| 49 | 44 | { |
|---|
| 50 | 45 | /* 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); |
|---|
| 54 | 47 | } |
|---|
| 55 | 48 | |
|---|
| 56 | 49 | static int clps711x_pwm_request(struct pwm_chip *chip, struct pwm_device *pwm) |
|---|