xref: /openbmc/linux/drivers/bus/ti-pwmss.c (revision 53c5ae63)
17cabf925SDavid Lechner // SPDX-License-Identifier: GPL-2.0-or-later
27cabf925SDavid Lechner /*
37cabf925SDavid Lechner  * TI PWM Subsystem driver
47cabf925SDavid Lechner  *
57cabf925SDavid Lechner  * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
67cabf925SDavid Lechner  */
77cabf925SDavid Lechner 
87cabf925SDavid Lechner #include <linux/module.h>
97cabf925SDavid Lechner #include <linux/platform_device.h>
107cabf925SDavid Lechner #include <linux/io.h>
117cabf925SDavid Lechner #include <linux/err.h>
127cabf925SDavid Lechner #include <linux/pm_runtime.h>
13*53c5ae63SRob Herring #include <linux/of_platform.h>
147cabf925SDavid Lechner 
157cabf925SDavid Lechner static const struct of_device_id pwmss_of_match[] = {
167cabf925SDavid Lechner 	{ .compatible	= "ti,am33xx-pwmss" },
177cabf925SDavid Lechner 	{},
187cabf925SDavid Lechner };
197cabf925SDavid Lechner MODULE_DEVICE_TABLE(of, pwmss_of_match);
207cabf925SDavid Lechner 
pwmss_probe(struct platform_device * pdev)217cabf925SDavid Lechner static int pwmss_probe(struct platform_device *pdev)
227cabf925SDavid Lechner {
237cabf925SDavid Lechner 	int ret;
247cabf925SDavid Lechner 	struct device_node *node = pdev->dev.of_node;
257cabf925SDavid Lechner 
267cabf925SDavid Lechner 	pm_runtime_enable(&pdev->dev);
277cabf925SDavid Lechner 
287cabf925SDavid Lechner 	/* Populate all the child nodes here... */
297cabf925SDavid Lechner 	ret = of_platform_populate(node, NULL, NULL, &pdev->dev);
307cabf925SDavid Lechner 	if (ret)
317cabf925SDavid Lechner 		dev_err(&pdev->dev, "no child node found\n");
327cabf925SDavid Lechner 
337cabf925SDavid Lechner 	return ret;
347cabf925SDavid Lechner }
357cabf925SDavid Lechner 
pwmss_remove(struct platform_device * pdev)367cabf925SDavid Lechner static int pwmss_remove(struct platform_device *pdev)
377cabf925SDavid Lechner {
387cabf925SDavid Lechner 	pm_runtime_disable(&pdev->dev);
397cabf925SDavid Lechner 	return 0;
407cabf925SDavid Lechner }
417cabf925SDavid Lechner 
427cabf925SDavid Lechner static struct platform_driver pwmss_driver = {
437cabf925SDavid Lechner 	.driver	= {
447cabf925SDavid Lechner 		.name	= "pwmss",
457cabf925SDavid Lechner 		.of_match_table	= pwmss_of_match,
467cabf925SDavid Lechner 	},
477cabf925SDavid Lechner 	.probe	= pwmss_probe,
487cabf925SDavid Lechner 	.remove	= pwmss_remove,
497cabf925SDavid Lechner };
507cabf925SDavid Lechner 
517cabf925SDavid Lechner module_platform_driver(pwmss_driver);
527cabf925SDavid Lechner 
537cabf925SDavid Lechner MODULE_DESCRIPTION("PWM Subsystem driver");
547cabf925SDavid Lechner MODULE_AUTHOR("Texas Instruments");
557cabf925SDavid Lechner MODULE_LICENSE("GPL");
56