From 953791baf27ea161378af5c78d8db337472507c8 Mon Sep 17 00:00:00 2001 From: Dmitry Osipenko Date: Fri, 14 Aug 2020 00:56:09 +0300 Subject: [PATCH 3/4] drm/panel-simple: Read panel orientation The panel orientation needs to parsed from a device-tree and assigned to the panel's connector in order to make orientation property available to userspace. That's what this patch does for the panel-simple driver. Signed-off-by: Dmitry Osipenko Signed-off-by: Sam Ravnborg Link: https://patchwork.freedesktop.org/patch/msgid/20200813215609.28643-5-digetx@gmail.com --- drivers/gpu/drm/panel/panel-simple.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c index f41d4e091..f10181b93 100644 --- a/drivers/gpu/drm/panel/panel-simple.c +++ b/drivers/gpu/drm/panel/panel-simple.c @@ -127,6 +127,8 @@ struct panel_simple { struct gpio_desc *spi_scl_gpio; struct gpio_desc *spi_cs_gpio; struct device_node *np_crtc; + + enum drm_panel_orientation orientation; }; enum rockchip_cmd_type { @@ -442,6 +444,9 @@ static int panel_simple_get_fixed_modes(struct panel_simple *panel) if (panel->desc->bus_flags) connector->display_info.bus_flags = panel->desc->bus_flags; + /* set up connector's "panel orientation" property */ + drm_connector_set_panel_orientation(connector, panel->orientation); + return num; } @@ -789,6 +794,12 @@ static int panel_simple_probe(struct device *dev, const struct panel_desc *desc) return -EPROBE_DEFER; } + err = of_drm_get_panel_orientation(dev->of_node, &panel->orientation); + if (err) { + dev_err(dev, "%pOF: failed to get orientation %d\n", dev->of_node, err); + return err; + } + ddc = of_parse_phandle(dev->of_node, "ddc-i2c-bus", 0); if (ddc) { panel->ddc = of_find_i2c_adapter_by_node(ddc); -- 2.34.1