blob: c2200af8a554676d9bb6b040302e15f187ee0648 [file] [log] [blame]
Simon Glassb3f07562016-01-21 19:44:54 -07001/*
2 * Copyright (c) 2016 Google, Inc
3 * Written by Simon Glass <sjg@chromium.org>
4 *
5 * SPDX-License-Identifier: GPL-2.0+
6 */
7
8#include <common.h>
9#include <dm.h>
10#include <pwm.h>
11
12int pwm_set_config(struct udevice *dev, uint channel, uint period_ns,
13 uint duty_ns)
14{
15 struct pwm_ops *ops = pwm_get_ops(dev);
16
17 if (!ops->set_config)
18 return -ENOSYS;
19
20 return ops->set_config(dev, channel, period_ns, duty_ns);
21}
22
23int pwm_set_enable(struct udevice *dev, uint channel, bool enable)
24{
25 struct pwm_ops *ops = pwm_get_ops(dev);
26
27 if (!ops->set_enable)
28 return -ENOSYS;
29
30 return ops->set_enable(dev, channel, enable);
31}
32
33UCLASS_DRIVER(pwm) = {
34 .id = UCLASS_PWM,
35 .name = "pwm",
36};