Lines Matching +full:lvds +full:- +full:encoder

1 // SPDX-License-Identifier: GPL-2.0+
4 * Maxime Ripard <maxime.ripard@free-electrons.com>
23 struct drm_encoder encoder; member
36 drm_encoder_to_sun4i_lvds(struct drm_encoder *encoder) in drm_encoder_to_sun4i_lvds() argument
38 return container_of(encoder, struct sun4i_lvds, in drm_encoder_to_sun4i_lvds()
39 encoder); in drm_encoder_to_sun4i_lvds()
44 struct sun4i_lvds *lvds = in sun4i_lvds_get_modes() local
47 return drm_panel_get_modes(lvds->panel, connector); in sun4i_lvds_get_modes()
68 static void sun4i_lvds_encoder_enable(struct drm_encoder *encoder) in sun4i_lvds_encoder_enable() argument
70 struct sun4i_lvds *lvds = drm_encoder_to_sun4i_lvds(encoder); in sun4i_lvds_encoder_enable() local
72 DRM_DEBUG_DRIVER("Enabling LVDS output\n"); in sun4i_lvds_encoder_enable()
74 if (lvds->panel) { in sun4i_lvds_encoder_enable()
75 drm_panel_prepare(lvds->panel); in sun4i_lvds_encoder_enable()
76 drm_panel_enable(lvds->panel); in sun4i_lvds_encoder_enable()
80 static void sun4i_lvds_encoder_disable(struct drm_encoder *encoder) in sun4i_lvds_encoder_disable() argument
82 struct sun4i_lvds *lvds = drm_encoder_to_sun4i_lvds(encoder); in sun4i_lvds_encoder_disable() local
84 DRM_DEBUG_DRIVER("Disabling LVDS output\n"); in sun4i_lvds_encoder_disable()
86 if (lvds->panel) { in sun4i_lvds_encoder_disable()
87 drm_panel_disable(lvds->panel); in sun4i_lvds_encoder_disable()
88 drm_panel_unprepare(lvds->panel); in sun4i_lvds_encoder_disable()
99 struct drm_encoder *encoder; in sun4i_lvds_init() local
101 struct sun4i_lvds *lvds; in sun4i_lvds_init() local
104 lvds = devm_kzalloc(drm->dev, sizeof(*lvds), GFP_KERNEL); in sun4i_lvds_init()
105 if (!lvds) in sun4i_lvds_init()
106 return -ENOMEM; in sun4i_lvds_init()
107 encoder = &lvds->encoder; in sun4i_lvds_init()
109 ret = drm_of_find_panel_or_bridge(tcon->dev->of_node, 1, 0, in sun4i_lvds_init()
110 &lvds->panel, &bridge); in sun4i_lvds_init()
112 dev_info(drm->dev, "No panel or bridge found... LVDS output disabled\n"); in sun4i_lvds_init()
116 drm_encoder_helper_add(&lvds->encoder, in sun4i_lvds_init()
118 ret = drm_simple_encoder_init(drm, &lvds->encoder, in sun4i_lvds_init()
121 dev_err(drm->dev, "Couldn't initialise the lvds encoder\n"); in sun4i_lvds_init()
125 /* The LVDS encoder can only work with the TCON channel 0 */ in sun4i_lvds_init()
126 lvds->encoder.possible_crtcs = drm_crtc_mask(&tcon->crtc->crtc); in sun4i_lvds_init()
128 if (lvds->panel) { in sun4i_lvds_init()
129 drm_connector_helper_add(&lvds->connector, in sun4i_lvds_init()
131 ret = drm_connector_init(drm, &lvds->connector, in sun4i_lvds_init()
135 dev_err(drm->dev, "Couldn't initialise the lvds connector\n"); in sun4i_lvds_init()
139 drm_connector_attach_encoder(&lvds->connector, in sun4i_lvds_init()
140 &lvds->encoder); in sun4i_lvds_init()
144 ret = drm_bridge_attach(encoder, bridge, NULL, 0); in sun4i_lvds_init()
152 drm_encoder_cleanup(&lvds->encoder); in sun4i_lvds_init()