2 * Copyright (C) 2009 Nokia Corporation
3 * Author: Tomi Valkeinen <tomi.valkeinen@ti.com>
5 * Some code and ideas taken from drivers/video/omap/ driver
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.
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
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/>.
21 #define DSS_SUBSYS_NAME "DISPLAY"
23 #include <linux/kernel.h>
26 #include <drm/drm_connector.h>
27 #include <drm/drm_modes.h>
31 static int disp_num_counter;
33 void omapdss_display_init(struct omap_dss_device *dssdev)
38 * Note: this presumes that all displays either have an DT alias, or
41 id = of_alias_get_id(dssdev->dev->of_node, "display");
43 id = disp_num_counter++;
45 /* Use 'label' property for name, if it exists */
46 of_property_read_string(dssdev->dev->of_node, "label", &dssdev->name);
48 if (dssdev->name == NULL)
49 dssdev->name = devm_kasprintf(dssdev->dev, GFP_KERNEL,
52 EXPORT_SYMBOL_GPL(omapdss_display_init);
54 struct omap_dss_device *omapdss_display_get(struct omap_dss_device *output)
57 output = output->next;
59 return omapdss_device_get(output);
61 EXPORT_SYMBOL_GPL(omapdss_display_get);
63 int omapdss_display_get_modes(struct drm_connector *connector,
64 const struct videomode *vm)
66 struct drm_display_mode *mode;
68 mode = drm_mode_create(connector->dev);
72 drm_display_mode_from_videomode(vm, mode);
74 mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
75 drm_mode_set_name(mode);
76 drm_mode_probed_add(connector, mode);
80 EXPORT_SYMBOL_GPL(omapdss_display_get_modes);