blob: 4969c556e7521baf202127bc5e92fb5ea23d5c03 [file] [log] [blame]
Thomas Gleixnerc942fdd2019-05-27 08:55:06 +02001// SPDX-License-Identifier: GPL-2.0-or-later
Philip, Avinashaf0ba002012-11-27 14:18:06 +05302/*
3 * TI PWM Subsystem driver
4 *
5 * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
Philip, Avinashaf0ba002012-11-27 14:18:06 +05306 */
7
8#include <linux/module.h>
9#include <linux/platform_device.h>
10#include <linux/io.h>
11#include <linux/err.h>
12#include <linux/pm_runtime.h>
Rob Herring53c5ae62023-08-03 16:42:56 -060013#include <linux/of_platform.h>
Philip, Avinashaf0ba002012-11-27 14:18:06 +053014
Philip, Avinashaf0ba002012-11-27 14:18:06 +053015static const struct of_device_id pwmss_of_match[] = {
16 { .compatible = "ti,am33xx-pwmss" },
17 {},
18};
19MODULE_DEVICE_TABLE(of, pwmss_of_match);
20
21static int pwmss_probe(struct platform_device *pdev)
22{
23 int ret;
Philip, Avinashaf0ba002012-11-27 14:18:06 +053024 struct device_node *node = pdev->dev.of_node;
25
Philip, Avinashaf0ba002012-11-27 14:18:06 +053026 pm_runtime_enable(&pdev->dev);
Philip, Avinashaf0ba002012-11-27 14:18:06 +053027
28 /* Populate all the child nodes here... */
29 ret = of_platform_populate(node, NULL, NULL, &pdev->dev);
30 if (ret)
31 dev_err(&pdev->dev, "no child node found\n");
32
33 return ret;
34}
35
Uwe Kleine-König2754f612023-11-09 21:28:40 +010036static void pwmss_remove(struct platform_device *pdev)
Philip, Avinashaf0ba002012-11-27 14:18:06 +053037{
Philip, Avinashaf0ba002012-11-27 14:18:06 +053038 pm_runtime_disable(&pdev->dev);
Philip, Avinashaf0ba002012-11-27 14:18:06 +053039}
40
Philip, Avinashaf0ba002012-11-27 14:18:06 +053041static struct platform_driver pwmss_driver = {
42 .driver = {
43 .name = "pwmss",
Philip, Avinashaf0ba002012-11-27 14:18:06 +053044 .of_match_table = pwmss_of_match,
45 },
46 .probe = pwmss_probe,
Uwe Kleine-König2754f612023-11-09 21:28:40 +010047 .remove_new = pwmss_remove,
Philip, Avinashaf0ba002012-11-27 14:18:06 +053048};
49
50module_platform_driver(pwmss_driver);
51
52MODULE_DESCRIPTION("PWM Subsystem driver");
53MODULE_AUTHOR("Texas Instruments");
54MODULE_LICENSE("GPL");