1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Allwinner A64 Display Engine 2.0 Bus Driver
4 *
5 * Copyright (C) 2018 Icenowy Zheng <icenowy@aosc.io>
6 */
7
8#include <linux/of_platform.h>
9#include <linux/platform_device.h>
10#include <linux/soc/sunxi/sunxi_sram.h>
11
12static int sun50i_de2_bus_probe(struct platform_device *pdev)
13{
14 struct device_node *np = pdev->dev.of_node;
15 int ret;
16
17 ret = sunxi_sram_claim(dev: &pdev->dev);
18 if (ret)
19 return dev_err_probe(dev: &pdev->dev, err: ret,
20 fmt: "Couldn't map SRAM to device\n");
21
22 of_platform_populate(root: np, NULL, NULL, parent: &pdev->dev);
23
24 return 0;
25}
26
27static void sun50i_de2_bus_remove(struct platform_device *pdev)
28{
29 sunxi_sram_release(dev: &pdev->dev);
30}
31
32static const struct of_device_id sun50i_de2_bus_of_match[] = {
33 { .compatible = "allwinner,sun50i-a64-de2", },
34 { /* sentinel */ }
35};
36
37static struct platform_driver sun50i_de2_bus_driver = {
38 .probe = sun50i_de2_bus_probe,
39 .remove_new = sun50i_de2_bus_remove,
40 .driver = {
41 .name = "sun50i-de2-bus",
42 .of_match_table = sun50i_de2_bus_of_match,
43 },
44};
45
46builtin_platform_driver(sun50i_de2_bus_driver);
47

source code of linux/drivers/bus/sun50i-de2.c