sun50i-de2.c 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. #include <linux/of_platform.h>
  8. #include <linux/platform_device.h>
  9. #include <linux/soc/sunxi/sunxi_sram.h>
  10. static int sun50i_de2_bus_probe(struct platform_device *pdev)
  11. {
  12. struct device_node *np = pdev->dev.of_node;
  13. int ret;
  14. ret = sunxi_sram_claim(&pdev->dev);
  15. if (ret)
  16. return dev_err_probe(&pdev->dev, ret,
  17. "Couldn't map SRAM to device\n");
  18. of_platform_populate(np, NULL, NULL, &pdev->dev);
  19. return 0;
  20. }
  21. static void sun50i_de2_bus_remove(struct platform_device *pdev)
  22. {
  23. sunxi_sram_release(&pdev->dev);
  24. }
  25. static const struct of_device_id sun50i_de2_bus_of_match[] = {
  26. { .compatible = "allwinner,sun50i-a64-de2", },
  27. { /* sentinel */ }
  28. };
  29. static struct platform_driver sun50i_de2_bus_driver = {
  30. .probe = sun50i_de2_bus_probe,
  31. .remove_new = sun50i_de2_bus_remove,
  32. .driver = {
  33. .name = "sun50i-de2-bus",
  34. .of_match_table = sun50i_de2_bus_of_match,
  35. },
  36. };
  37. builtin_platform_driver(sun50i_de2_bus_driver);