sun50i-de2.c 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. dev_err(&pdev->dev, "Error couldn't map SRAM to device\n");
  17. return ret;
  18. }
  19. of_platform_populate(np, NULL, NULL, &pdev->dev);
  20. return 0;
  21. }
  22. static int sun50i_de2_bus_remove(struct platform_device *pdev)
  23. {
  24. sunxi_sram_release(&pdev->dev);
  25. return 0;
  26. }
  27. static const struct of_device_id sun50i_de2_bus_of_match[] = {
  28. { .compatible = "allwinner,sun50i-a64-de2", },
  29. { /* sentinel */ }
  30. };
  31. static struct platform_driver sun50i_de2_bus_driver = {
  32. .probe = sun50i_de2_bus_probe,
  33. .remove = sun50i_de2_bus_remove,
  34. .driver = {
  35. .name = "sun50i-de2-bus",
  36. .of_match_table = sun50i_de2_bus_of_match,
  37. },
  38. };
  39. builtin_platform_driver(sun50i_de2_bus_driver);