Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 /*
0003  * Allwinner A64 Display Engine 2.0 Bus Driver
0004  *
0005  * Copyright (C) 2018 Icenowy Zheng <icenowy@aosc.io>
0006  */
0007 
0008 #include <linux/of_platform.h>
0009 #include <linux/platform_device.h>
0010 #include <linux/soc/sunxi/sunxi_sram.h>
0011 
0012 static int sun50i_de2_bus_probe(struct platform_device *pdev)
0013 {
0014     struct device_node *np = pdev->dev.of_node;
0015     int ret;
0016 
0017     ret = sunxi_sram_claim(&pdev->dev);
0018     if (ret)
0019         return dev_err_probe(&pdev->dev, ret,
0020                      "Couldn't map SRAM to device\n");
0021 
0022     of_platform_populate(np, NULL, NULL, &pdev->dev);
0023 
0024     return 0;
0025 }
0026 
0027 static int sun50i_de2_bus_remove(struct platform_device *pdev)
0028 {
0029     sunxi_sram_release(&pdev->dev);
0030     return 0;
0031 }
0032 
0033 static const struct of_device_id sun50i_de2_bus_of_match[] = {
0034     { .compatible = "allwinner,sun50i-a64-de2", },
0035     { /* sentinel */ }
0036 };
0037 
0038 static struct platform_driver sun50i_de2_bus_driver = {
0039     .probe = sun50i_de2_bus_probe,
0040     .remove = sun50i_de2_bus_remove,
0041     .driver = {
0042         .name = "sun50i-de2-bus",
0043         .of_match_table = sun50i_de2_bus_of_match,
0044     },
0045 };
0046 
0047 builtin_platform_driver(sun50i_de2_bus_driver);