display.c 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. * Copyright (C) 2009 Nokia Corporation
  3. * Author: Tomi Valkeinen <tomi.valkeinen@ti.com>
  4. *
  5. * Some code and ideas taken from drivers/video/omap/ driver
  6. * by Imre Deak.
  7. *
  8. * This program is free software; you can redistribute it and/or modify it
  9. * under the terms of the GNU General Public License version 2 as published by
  10. * the Free Software Foundation.
  11. *
  12. * This program is distributed in the hope that it will be useful, but WITHOUT
  13. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  14. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  15. * more details.
  16. *
  17. * You should have received a copy of the GNU General Public License along with
  18. * this program. If not, see <http://www.gnu.org/licenses/>.
  19. */
  20. #define DSS_SUBSYS_NAME "DISPLAY"
  21. #include <linux/kernel.h>
  22. #include <linux/of.h>
  23. #include "omapdss.h"
  24. static int disp_num_counter;
  25. void omapdss_display_init(struct omap_dss_device *dssdev)
  26. {
  27. int id;
  28. /*
  29. * Note: this presumes that all displays either have an DT alias, or
  30. * none has.
  31. */
  32. id = of_alias_get_id(dssdev->dev->of_node, "display");
  33. if (id < 0)
  34. id = disp_num_counter++;
  35. dssdev->alias_id = id;
  36. /* Use 'label' property for name, if it exists */
  37. of_property_read_string(dssdev->dev->of_node, "label", &dssdev->name);
  38. if (dssdev->name == NULL)
  39. dssdev->name = devm_kasprintf(dssdev->dev, GFP_KERNEL,
  40. "display%u", id);
  41. }
  42. EXPORT_SYMBOL_GPL(omapdss_display_init);
  43. struct omap_dss_device *omapdss_display_get(struct omap_dss_device *output)
  44. {
  45. while (output->next)
  46. output = output->next;
  47. return omapdss_device_get(output);
  48. }
  49. EXPORT_SYMBOL_GPL(omapdss_display_get);