Thomas Gleixner | c942fdd | 2019-05-27 08:55:06 +0200 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0-or-later |
Philip, Avinash | af0ba00 | 2012-11-27 14:18:06 +0530 | [diff] [blame] | 2 | /* |
| 3 | * TI PWM Subsystem driver |
| 4 | * |
| 5 | * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/ |
Philip, Avinash | af0ba00 | 2012-11-27 14:18:06 +0530 | [diff] [blame] | 6 | */ |
| 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> |
| 13 | #include <linux/of_device.h> |
| 14 | |
Philip, Avinash | af0ba00 | 2012-11-27 14:18:06 +0530 | [diff] [blame] | 15 | static const struct of_device_id pwmss_of_match[] = { |
| 16 | { .compatible = "ti,am33xx-pwmss" }, |
| 17 | {}, |
| 18 | }; |
| 19 | MODULE_DEVICE_TABLE(of, pwmss_of_match); |
| 20 | |
| 21 | static int pwmss_probe(struct platform_device *pdev) |
| 22 | { |
| 23 | int ret; |
Philip, Avinash | af0ba00 | 2012-11-27 14:18:06 +0530 | [diff] [blame] | 24 | struct device_node *node = pdev->dev.of_node; |
| 25 | |
Philip, Avinash | af0ba00 | 2012-11-27 14:18:06 +0530 | [diff] [blame] | 26 | pm_runtime_enable(&pdev->dev); |
Philip, Avinash | af0ba00 | 2012-11-27 14:18:06 +0530 | [diff] [blame] | 27 | |
| 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 | |
| 36 | static int pwmss_remove(struct platform_device *pdev) |
| 37 | { |
Philip, Avinash | af0ba00 | 2012-11-27 14:18:06 +0530 | [diff] [blame] | 38 | pm_runtime_disable(&pdev->dev); |
Philip, Avinash | af0ba00 | 2012-11-27 14:18:06 +0530 | [diff] [blame] | 39 | return 0; |
| 40 | } |
| 41 | |
Philip, Avinash | af0ba00 | 2012-11-27 14:18:06 +0530 | [diff] [blame] | 42 | static struct platform_driver pwmss_driver = { |
| 43 | .driver = { |
| 44 | .name = "pwmss", |
Philip, Avinash | af0ba00 | 2012-11-27 14:18:06 +0530 | [diff] [blame] | 45 | .of_match_table = pwmss_of_match, |
| 46 | }, |
| 47 | .probe = pwmss_probe, |
| 48 | .remove = pwmss_remove, |
| 49 | }; |
| 50 | |
| 51 | module_platform_driver(pwmss_driver); |
| 52 | |
| 53 | MODULE_DESCRIPTION("PWM Subsystem driver"); |
| 54 | MODULE_AUTHOR("Texas Instruments"); |
| 55 | MODULE_LICENSE("GPL"); |