| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * TI/National Semiconductor LP3943 PWM driver |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright 2013 Texas Instruments |
|---|
| 5 | 6 | * |
|---|
| 6 | 7 | * Author: Milo Kim <milo.kim@ti.com> |
|---|
| 7 | | - * |
|---|
| 8 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 9 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 10 | | - * the Free Software Foundation; version 2. |
|---|
| 11 | 8 | */ |
|---|
| 12 | 9 | |
|---|
| 13 | 10 | #include <linux/err.h> |
|---|
| .. | .. |
|---|
| 128 | 125 | if (err) |
|---|
| 129 | 126 | return err; |
|---|
| 130 | 127 | |
|---|
| 128 | + duty_ns = min(duty_ns, period_ns); |
|---|
| 131 | 129 | val = (u8)(duty_ns * LP3943_MAX_DUTY / period_ns); |
|---|
| 132 | 130 | |
|---|
| 133 | 131 | return lp3943_write_byte(lp3943, reg_duty, val); |
|---|