Lines Matching +full:orientation +full:- +full:gpios
1 // SPDX-License-Identifier: GPL-2.0+
42 enum drm_panel_orientation orientation; member
54 if (lvds->enable_gpio) in panel_lvds_unprepare()
55 gpiod_set_value_cansleep(lvds->enable_gpio, 0); in panel_lvds_unprepare()
57 if (lvds->supply) in panel_lvds_unprepare()
58 regulator_disable(lvds->supply); in panel_lvds_unprepare()
67 if (lvds->supply) { in panel_lvds_prepare()
70 err = regulator_enable(lvds->supply); in panel_lvds_prepare()
72 dev_err(lvds->dev, "failed to enable supply: %d\n", in panel_lvds_prepare()
78 if (lvds->enable_gpio) in panel_lvds_prepare()
79 gpiod_set_value_cansleep(lvds->enable_gpio, 1); in panel_lvds_prepare()
90 mode = drm_mode_duplicate(connector->dev, &lvds->dmode); in panel_lvds_get_modes()
94 mode->type |= DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED; in panel_lvds_get_modes()
97 connector->display_info.width_mm = lvds->dmode.width_mm; in panel_lvds_get_modes()
98 connector->display_info.height_mm = lvds->dmode.height_mm; in panel_lvds_get_modes()
99 drm_display_info_set_bus_formats(&connector->display_info, in panel_lvds_get_modes()
100 &lvds->bus_format, 1); in panel_lvds_get_modes()
101 connector->display_info.bus_flags = lvds->bus_flags; in panel_lvds_get_modes()
107 drm_connector_set_panel_orientation(connector, lvds->orientation); in panel_lvds_get_modes()
116 return lvds->orientation; in panel_lvds_get_orientation()
128 struct device_node *np = lvds->dev->of_node; in panel_lvds_parse_dt()
131 ret = of_drm_get_panel_orientation(np, &lvds->orientation); in panel_lvds_parse_dt()
133 dev_err(lvds->dev, "%pOF: failed to get orientation %d\n", np, ret); in panel_lvds_parse_dt()
137 ret = of_get_drm_panel_display_mode(np, &lvds->dmode, &lvds->bus_flags); in panel_lvds_parse_dt()
139 dev_err(lvds->dev, "%pOF: problems parsing panel-timing (%d)\n", in panel_lvds_parse_dt()
144 of_property_read_string(np, "label", &lvds->label); in panel_lvds_parse_dt()
148 dev_err(lvds->dev, "%pOF: invalid or missing %s DT property\n", in panel_lvds_parse_dt()
149 np, "data-mapping"); in panel_lvds_parse_dt()
153 lvds->bus_format = ret; in panel_lvds_parse_dt()
155 lvds->bus_flags |= of_property_read_bool(np, "data-mirror") ? in panel_lvds_parse_dt()
167 lvds = devm_kzalloc(&pdev->dev, sizeof(*lvds), GFP_KERNEL); in panel_lvds_probe()
169 return -ENOMEM; in panel_lvds_probe()
171 lvds->dev = &pdev->dev; in panel_lvds_probe()
177 lvds->supply = devm_regulator_get_optional(lvds->dev, "power"); in panel_lvds_probe()
178 if (IS_ERR(lvds->supply)) { in panel_lvds_probe()
179 ret = PTR_ERR(lvds->supply); in panel_lvds_probe()
181 if (ret != -ENODEV) { in panel_lvds_probe()
182 if (ret != -EPROBE_DEFER) in panel_lvds_probe()
183 dev_err(lvds->dev, "failed to request regulator: %d\n", in panel_lvds_probe()
188 lvds->supply = NULL; in panel_lvds_probe()
191 /* Get GPIOs and backlight controller. */ in panel_lvds_probe()
192 lvds->enable_gpio = devm_gpiod_get_optional(lvds->dev, "enable", in panel_lvds_probe()
194 if (IS_ERR(lvds->enable_gpio)) { in panel_lvds_probe()
195 ret = PTR_ERR(lvds->enable_gpio); in panel_lvds_probe()
196 dev_err(lvds->dev, "failed to request %s GPIO: %d\n", in panel_lvds_probe()
201 lvds->reset_gpio = devm_gpiod_get_optional(lvds->dev, "reset", in panel_lvds_probe()
203 if (IS_ERR(lvds->reset_gpio)) { in panel_lvds_probe()
204 ret = PTR_ERR(lvds->reset_gpio); in panel_lvds_probe()
205 dev_err(lvds->dev, "failed to request %s GPIO: %d\n", in panel_lvds_probe()
218 drm_panel_init(&lvds->panel, lvds->dev, &panel_lvds_funcs, in panel_lvds_probe()
221 ret = drm_panel_of_backlight(&lvds->panel); in panel_lvds_probe()
225 drm_panel_add(&lvds->panel); in panel_lvds_probe()
227 dev_set_drvdata(lvds->dev, lvds); in panel_lvds_probe()
235 drm_panel_remove(&lvds->panel); in panel_lvds_remove()
237 drm_panel_disable(&lvds->panel); in panel_lvds_remove()
241 { .compatible = "panel-lvds", },
251 .name = "panel-lvds",