led.c 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // SPDX-License-Identifier: GPL-2.0-or-later
  2. /*
  3. * Registration of Cobalt LED platform device.
  4. *
  5. * Copyright (C) 2007 Yoichi Yuasa <[email protected]>
  6. */
  7. #include <linux/errno.h>
  8. #include <linux/init.h>
  9. #include <linux/ioport.h>
  10. #include <linux/platform_device.h>
  11. #include <cobalt.h>
  12. static struct resource cobalt_led_resource __initdata = {
  13. .start = 0x1c000000,
  14. .end = 0x1c000000,
  15. .flags = IORESOURCE_MEM,
  16. };
  17. static __init int cobalt_led_add(void)
  18. {
  19. struct platform_device *pdev;
  20. int retval;
  21. if (cobalt_board_id == COBALT_BRD_ID_QUBE1 ||
  22. cobalt_board_id == COBALT_BRD_ID_QUBE2)
  23. pdev = platform_device_alloc("cobalt-qube-leds", -1);
  24. else
  25. pdev = platform_device_alloc("cobalt-raq-leds", -1);
  26. if (!pdev)
  27. return -ENOMEM;
  28. retval = platform_device_add_resources(pdev, &cobalt_led_resource, 1);
  29. if (retval)
  30. goto err_free_device;
  31. retval = platform_device_add(pdev);
  32. if (retval)
  33. goto err_free_device;
  34. return 0;
  35. err_free_device:
  36. platform_device_put(pdev);
  37. return retval;
  38. }
  39. device_initcall(cobalt_led_add);