Lines Matching full:panel

46  * struct panel_delay - Describes delays for a simple panel.
52 * The time (in milliseconds) that it takes after powering the panel
56 * NOTE: on some old panel data this number appears to be much too big.
74 * @powered_on_to_enable: Time between panel powered on and enable.
77 * between when panel powered on and enable may begin.
123 * @enable: Time for the panel to display a valid frame.
125 * The time (in milliseconds) that it takes for the panel to
136 * @disable: Time for the panel to turn the display off.
138 * The time (in milliseconds) that it takes for the panel to
149 * The time (in milliseconds) that it takes for the panel
163 * struct panel_desc - Describes a simple panel.
167 * @modes: Pointer to array of fixed modes appropriate for this panel.
192 /** @size: Structure containing the physical size of this panel. */
205 /** @delay: Structure containing various delay values for this panel. */
210 * struct edp_panel_entry - Maps panel ID to delay / panel name.
213 /** @ident: edid identity used for panel matching. */
216 /** @delay: The power sequencing delays needed for this panel. */
249 static inline struct panel_edp *to_panel_edp(struct drm_panel *panel) in to_panel_edp() argument
251 return container_of(panel, struct panel_edp, base); in to_panel_edp()
254 static unsigned int panel_edp_get_timings_modes(struct panel_edp *panel, in panel_edp_get_timings_modes() argument
260 for (i = 0; i < panel->desc->num_timings; i++) { in panel_edp_get_timings_modes()
261 const struct display_timing *dt = &panel->desc->timings[i]; in panel_edp_get_timings_modes()
267 dev_err(panel->base.dev, "failed to add mode %ux%u\n", in panel_edp_get_timings_modes()
276 if (panel->desc->num_timings == 1) in panel_edp_get_timings_modes()
286 static unsigned int panel_edp_get_display_modes(struct panel_edp *panel, in panel_edp_get_display_modes() argument
292 for (i = 0; i < panel->desc->num_modes; i++) { in panel_edp_get_display_modes()
293 const struct drm_display_mode *m = &panel->desc->modes[i]; in panel_edp_get_display_modes()
297 dev_err(panel->base.dev, "failed to add mode %ux%u@%u\n", in panel_edp_get_display_modes()
305 if (panel->desc->num_modes == 1) in panel_edp_get_display_modes()
317 static int panel_edp_override_edid_mode(struct panel_edp *panel, in panel_edp_override_edid_mode() argument
325 dev_err(panel->base.dev, "failed to add additional mode\n"); in panel_edp_override_edid_mode()
335 static int panel_edp_get_non_edid_modes(struct panel_edp *panel, in panel_edp_get_non_edid_modes() argument
339 bool has_override = panel->override_mode.type; in panel_edp_get_non_edid_modes()
342 if (!panel->desc) in panel_edp_get_non_edid_modes()
347 &panel->override_mode); in panel_edp_get_non_edid_modes()
352 dev_err(panel->base.dev, "failed to add override mode\n"); in panel_edp_get_non_edid_modes()
357 if (num == 0 && panel->desc->num_timings) in panel_edp_get_non_edid_modes()
358 num = panel_edp_get_timings_modes(panel, connector); in panel_edp_get_non_edid_modes()
366 WARN_ON(panel->desc->num_timings && panel->desc->num_modes); in panel_edp_get_non_edid_modes()
368 num = panel_edp_get_display_modes(panel, connector); in panel_edp_get_non_edid_modes()
370 connector->display_info.bpc = panel->desc->bpc; in panel_edp_get_non_edid_modes()
371 connector->display_info.width_mm = panel->desc->size.width; in panel_edp_get_non_edid_modes()
372 connector->display_info.height_mm = panel->desc->size.height; in panel_edp_get_non_edid_modes()
391 static int panel_edp_disable(struct drm_panel *panel) in panel_edp_disable() argument
393 struct panel_edp *p = to_panel_edp(panel); in panel_edp_disable()
413 static int panel_edp_unprepare(struct drm_panel *panel) in panel_edp_unprepare() argument
417 ret = pm_runtime_put_sync_suspend(panel->dev); in panel_edp_unprepare()
529 static int panel_edp_prepare(struct drm_panel *panel) in panel_edp_prepare() argument
533 ret = pm_runtime_get_sync(panel->dev); in panel_edp_prepare()
535 pm_runtime_put_autosuspend(panel->dev); in panel_edp_prepare()
542 static int panel_edp_enable(struct drm_panel *panel) in panel_edp_enable() argument
544 struct panel_edp *p = to_panel_edp(panel); in panel_edp_enable()
552 * However, we can only count this if HPD is readable by the panel in panel_edp_enable()
580 static int panel_edp_get_modes(struct drm_panel *panel, in panel_edp_get_modes() argument
583 struct panel_edp *p = to_panel_edp(panel); in panel_edp_get_modes()
592 pm_runtime_get_sync(panel->dev); in panel_edp_get_modes()
616 pm_runtime_mark_last_busy(panel->dev); in panel_edp_get_modes()
617 pm_runtime_put_autosuspend(panel->dev); in panel_edp_get_modes()
634 static int panel_edp_get_timings(struct drm_panel *panel, in panel_edp_get_timings() argument
638 struct panel_edp *p = to_panel_edp(panel); in panel_edp_get_timings()
651 static enum drm_panel_orientation panel_edp_get_orientation(struct drm_panel *panel) in panel_edp_get_orientation() argument
653 struct panel_edp *p = to_panel_edp(panel); in panel_edp_get_orientation()
660 struct drm_panel *panel = s->private; in detected_panel_show() local
661 struct panel_edp *p = to_panel_edp(panel); in detected_panel_show()
675 static void panel_edp_debugfs_init(struct drm_panel *panel, struct dentry *root) in panel_edp_debugfs_init() argument
677 debugfs_create_file("detected_panel", 0600, root, panel, &detected_panel_fops); in panel_edp_debugfs_init()
695 struct panel_edp *panel, in panel_edp_parse_panel_timing_node() argument
698 const struct panel_desc *desc = panel->desc; in panel_edp_parse_panel_timing_node()
703 dev_err(dev, "Reject override mode: panel has a fixed mode\n"); in panel_edp_parse_panel_timing_node()
711 for (i = 0; i < panel->desc->num_timings; i++) { in panel_edp_parse_panel_timing_node()
712 const struct display_timing *dt = &panel->desc->timings[i]; in panel_edp_parse_panel_timing_node()
728 drm_display_mode_from_videomode(&vm, &panel->override_mode); in panel_edp_parse_panel_timing_node()
729 panel->override_mode.type |= DRM_MODE_TYPE_DRIVER | in panel_edp_parse_panel_timing_node()
734 if (WARN_ON(!panel->override_mode.type)) in panel_edp_parse_panel_timing_node()
740 static void panel_edp_set_conservative_timings(struct panel_edp *panel, struct panel_desc *desc) in panel_edp_set_conservative_timings() argument
743 * It's highly likely that the panel will work if we use very in panel_edp_set_conservative_timings()
756 panel->detected_panel = ERR_PTR(-EINVAL); in panel_edp_set_conservative_timings()
759 static int generic_edp_panel_probe(struct device *dev, struct panel_edp *panel) in generic_edp_panel_probe() argument
773 panel->desc = desc; in generic_edp_panel_probe()
785 /* Power the panel on so we can read the EDID */ in generic_edp_panel_probe()
789 "Couldn't power on panel to ID it; using conservative timings: %d\n", in generic_edp_panel_probe()
791 panel_edp_set_conservative_timings(panel, desc); in generic_edp_panel_probe()
795 base_block = drm_edid_read_base_block(panel->ddc); in generic_edp_panel_probe()
800 panel_edp_set_conservative_timings(panel, desc); in generic_edp_panel_probe()
805 panel->detected_panel = find_edp_panel(panel_id, base_block); in generic_edp_panel_probe()
814 if (WARN_ON(!panel->detected_panel)) { in generic_edp_panel_probe()
816 "Unknown panel %s %#06x, using conservative timings\n", in generic_edp_panel_probe()
818 panel_edp_set_conservative_timings(panel, desc); in generic_edp_panel_probe()
821 vend, panel->detected_panel->ident.name, product_id); in generic_edp_panel_probe()
824 desc->delay = *panel->detected_panel->delay; in generic_edp_panel_probe()
837 struct panel_edp *panel; in panel_edp_probe() local
842 panel = devm_kzalloc(dev, sizeof(*panel), GFP_KERNEL); in panel_edp_probe()
843 if (!panel) in panel_edp_probe()
846 panel->prepared_time = 0; in panel_edp_probe()
847 panel->desc = desc; in panel_edp_probe()
848 panel->aux = aux; in panel_edp_probe()
850 panel->no_hpd = of_property_read_bool(dev->of_node, "no-hpd"); in panel_edp_probe()
851 if (!panel->no_hpd) { in panel_edp_probe()
852 err = panel_edp_get_hpd_gpio(dev, panel); in panel_edp_probe()
857 panel->supply = devm_regulator_get(dev, "power"); in panel_edp_probe()
858 if (IS_ERR(panel->supply)) in panel_edp_probe()
859 return PTR_ERR(panel->supply); in panel_edp_probe()
861 panel->enable_gpio = devm_gpiod_get_optional(dev, "enable", in panel_edp_probe()
863 if (IS_ERR(panel->enable_gpio)) in panel_edp_probe()
864 return dev_err_probe(dev, PTR_ERR(panel->enable_gpio), in panel_edp_probe()
867 err = of_drm_get_panel_orientation(dev->of_node, &panel->orientation); in panel_edp_probe()
875 panel->ddc = of_find_i2c_adapter_by_node(ddc); in panel_edp_probe()
878 if (!panel->ddc) in panel_edp_probe()
881 panel->ddc = &aux->ddc; in panel_edp_probe()
884 if (!of_get_display_timing(dev->of_node, "panel-timing", &dt)) in panel_edp_probe()
885 panel_edp_parse_panel_timing_node(dev, panel, &dt); in panel_edp_probe()
887 dev_set_drvdata(dev, panel); in panel_edp_probe()
889 drm_panel_init(&panel->base, dev, &panel_edp_funcs, DRM_MODE_CONNECTOR_eDP); in panel_edp_probe()
891 err = drm_panel_of_backlight(&panel->base); in panel_edp_probe()
896 * We use runtime PM for prepare / unprepare since those power the panel in panel_edp_probe()
898 * to optimize powering the panel on briefly to read the EDID before in panel_edp_probe()
899 * fully enabling the panel. in panel_edp_probe()
905 if (of_device_is_compatible(dev->of_node, "edp-panel")) { in panel_edp_probe()
906 err = generic_edp_panel_probe(dev, panel); in panel_edp_probe()
909 "Couldn't detect panel nor find a fallback\n"); in panel_edp_probe()
912 /* generic_edp_panel_probe() replaces desc in the panel */ in panel_edp_probe()
913 desc = panel->desc; in panel_edp_probe()
918 if (!panel->base.backlight && panel->aux) { in panel_edp_probe()
920 err = drm_panel_dp_aux_backlight(&panel->base, panel->aux); in panel_edp_probe()
926 * a panel where we can't control the backlight is better than in panel_edp_probe()
927 * no panel. in panel_edp_probe()
933 drm_panel_add(&panel->base); in panel_edp_probe()
941 if (panel->ddc && (!panel->aux || panel->ddc != &panel->aux->ddc)) in panel_edp_probe()
942 put_device(&panel->ddc->dev); in panel_edp_probe()
949 struct panel_edp *panel = dev_get_drvdata(dev); in panel_edp_shutdown() local
955 * cause the panel to be disabled / unprepared if needed. For now, in panel_edp_shutdown()
957 * different DRM modeset drivers used with panel-edp. Once we've in panel_edp_shutdown()
958 * confirmed that all DRM modeset drivers using this panel properly in panel_edp_shutdown()
963 * PANEL DRIVERS. in panel_edp_shutdown()
968 * callback before the panel's shutdown() callback (perhaps using in panel_edp_shutdown()
971 if (panel->base.enabled) in panel_edp_shutdown()
972 drm_panel_disable(&panel->base); in panel_edp_shutdown()
973 if (panel->base.prepared) in panel_edp_shutdown()
974 drm_panel_unprepare(&panel->base); in panel_edp_shutdown()
979 struct panel_edp *panel = dev_get_drvdata(dev); in panel_edp_remove() local
981 drm_panel_remove(&panel->base); in panel_edp_remove()
986 if (panel->ddc && (!panel->aux || panel->ddc != &panel->aux->ddc)) in panel_edp_remove()
987 put_device(&panel->ddc->dev); in panel_edp_remove()
989 drm_edid_free(panel->drm_edid); in panel_edp_remove()
990 panel->drm_edid = NULL; in panel_edp_remove()
1214 * When power is first given to the panel there's a short
1622 .compatible = "edp-panel",
1626 * the generic edp-panel compatible.
1629 * - Because of the panel issues (e.g. broken EDID or broken
1637 * the panel using the 'edp-panel' compatible as a device on the AUX
1829 * platform_of_match table (if a panel is listed in both places).
1993 const struct edp_panel_entry *panel; in find_edp_panel() local
2000 * vendors incorrectly reused the same panel ID for multiple panels that in find_edp_panel()
2001 * need different settings. If there's no match, try again with panel in find_edp_panel()
2004 for (panel = edp_panels; panel->ident.panel_id; panel++) in find_edp_panel()
2005 if (drm_edid_match(edid, &panel->ident)) in find_edp_panel()
2006 return panel; in find_edp_panel()
2008 for (panel = edp_panels; panel->ident.panel_id; panel++) in find_edp_panel()
2009 if (panel->ident.panel_id == panel_id) in find_edp_panel()
2010 return panel; in find_edp_panel()
2019 /* Skip one since "edp-panel" is only supported on DP AUX bus */ in panel_edp_platform_probe()
2045 .name = "panel-edp",
2077 .name = "panel-simple-dp-aux",