* [PATCH 0/2] Support non-default LVDS data mapping for simple @ 2023-04-14 16:11 Johannes Zink 2023-04-14 16:11 ` [PATCH 1/2] dt-bindings: display: simple: support non-default data-mapping Johannes Zink 2023-04-14 16:11 ` [PATCH 2/2] drm/panel-simple: allow LVDS format override Johannes Zink 0 siblings, 2 replies; 7+ messages in thread From: Johannes Zink @ 2023-04-14 16:11 UTC (permalink / raw) To: thierry.reding, sam, airlied, daniel, robh+dt, krzysztof.kozlowski+dt, dri-devel, devicetree, linux-kernel, kernel Some LVDS panels, such as the innolux,g101ice-l01 support multiple LVDS data mapping modes, which can be configured by strapping a dataformat pin on the display to a specific voltage. This can be particularly useful for using the jeida-18 format, which requires only 3 instead of 4 LVDS lanes. This series adds an optional data-mapping property, analogously to the property on lvds-panel, which overrides the default data mapping set in the panel description in simple-panel. Best regards Johannes Johannes Zink (2): dt-bindings: display: simple: support non-default data-mapping drm/panel-simple: allow LVDS format override .../bindings/display/panel/panel-simple.yaml | 51 +++++++++++++++++++ drivers/gpu/drm/panel/panel-simple.c | 37 +++++++++++++- 2 files changed, 87 insertions(+), 1 deletion(-) -- 2.39.2 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/2] dt-bindings: display: simple: support non-default data-mapping 2023-04-14 16:11 [PATCH 0/2] Support non-default LVDS data mapping for simple Johannes Zink @ 2023-04-14 16:11 ` Johannes Zink 2023-04-18 21:20 ` Rob Herring 2023-04-14 16:11 ` [PATCH 2/2] drm/panel-simple: allow LVDS format override Johannes Zink 1 sibling, 1 reply; 7+ messages in thread From: Johannes Zink @ 2023-04-14 16:11 UTC (permalink / raw) To: thierry.reding, sam, airlied, daniel, robh+dt, krzysztof.kozlowski+dt, dri-devel, devicetree, linux-kernel, kernel Cc: Johannes Zink Some Displays support more than just a single default lvds data mapping, which can be used to run displays on only 3 LVDS lanes in the jeida-18 data-mapping mode. Add an optional data-mapping property, analogously to panel-lvds, to allow overriding the default data mapping. Signed-off-by: Johannes Zink <j.zink@pengutronix.de> --- .../bindings/display/panel/panel-simple.yaml | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/Documentation/devicetree/bindings/display/panel/panel-simple.yaml b/Documentation/devicetree/bindings/display/panel/panel-simple.yaml index 18241f4051d2..6e219f67dd67 100644 --- a/Documentation/devicetree/bindings/display/panel/panel-simple.yaml +++ b/Documentation/devicetree/bindings/display/panel/panel-simple.yaml @@ -349,6 +349,57 @@ properties: power-supply: true no-hpd: true hpd-gpios: true + data-mapping: + enum: + - jeida-18 + - jeida-24 + - vesa-24 + description: | + The color signals mapping order. + + LVDS data mappings are defined as follows. + + - "jeida-18" - 18-bit data mapping compatible with the [JEIDA], [LDI] and + [VESA] specifications. Data are transferred as follows on 3 LVDS lanes. + + Slot 0 1 2 3 4 5 6 + ________________ _________________ + Clock \_______________________/ + ______ ______ ______ ______ ______ ______ ______ + DATA0 ><__G0__><__R5__><__R4__><__R3__><__R2__><__R1__><__R0__>< + DATA1 ><__B1__><__B0__><__G5__><__G4__><__G3__><__G2__><__G1__>< + DATA2 ><_CTL2_><_CTL1_><_CTL0_><__B5__><__B4__><__B3__><__B2__>< + + - "jeida-24" - 24-bit data mapping compatible with the [DSIM] and [LDI] + specifications. Data are transferred as follows on 4 LVDS lanes. + + Slot 0 1 2 3 4 5 6 + ________________ _________________ + Clock \_______________________/ + ______ ______ ______ ______ ______ ______ ______ + DATA0 ><__G2__><__R7__><__R6__><__R5__><__R4__><__R3__><__R2__>< + DATA1 ><__B3__><__B2__><__G7__><__G6__><__G5__><__G4__><__G3__>< + DATA2 ><_CTL2_><_CTL1_><_CTL0_><__B7__><__B6__><__B5__><__B4__>< + DATA3 ><_CTL3_><__B1__><__B0__><__G1__><__G0__><__R1__><__R0__>< + + - "vesa-24" - 24-bit data mapping compatible with the [VESA] specification. + Data are transferred as follows on 4 LVDS lanes. + + Slot 0 1 2 3 4 5 6 + ________________ _________________ + Clock \_______________________/ + ______ ______ ______ ______ ______ ______ ______ + DATA0 ><__G0__><__R5__><__R4__><__R3__><__R2__><__R1__><__R0__>< + DATA1 ><__B1__><__B0__><__G5__><__G4__><__G3__><__G2__><__G1__>< + DATA2 ><_CTL2_><_CTL1_><_CTL0_><__B5__><__B4__><__B3__><__B2__>< + DATA3 ><_CTL3_><__B7__><__B6__><__G7__><__G6__><__R7__><__R6__>< + + Control signals are mapped as follows. + + CTL0: HSync + CTL1: VSync + CTL2: Data Enable + CTL3: 0 additionalProperties: false -- 2.39.2 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] dt-bindings: display: simple: support non-default data-mapping 2023-04-14 16:11 ` [PATCH 1/2] dt-bindings: display: simple: support non-default data-mapping Johannes Zink @ 2023-04-18 21:20 ` Rob Herring 2023-04-19 6:29 ` Johannes Zink 0 siblings, 1 reply; 7+ messages in thread From: Rob Herring @ 2023-04-18 21:20 UTC (permalink / raw) To: Johannes Zink Cc: thierry.reding, sam, airlied, daniel, krzysztof.kozlowski+dt, dri-devel, devicetree, linux-kernel, kernel On Fri, Apr 14, 2023 at 06:11:15PM +0200, Johannes Zink wrote: > Some Displays support more than just a single default lvds data mapping, > which can be used to run displays on only 3 LVDS lanes in the jeida-18 > data-mapping mode. > > Add an optional data-mapping property, analogously to panel-lvds, to > allow overriding the default data mapping. > > Signed-off-by: Johannes Zink <j.zink@pengutronix.de> > --- > .../bindings/display/panel/panel-simple.yaml | 51 +++++++++++++++++++ > 1 file changed, 51 insertions(+) > > diff --git a/Documentation/devicetree/bindings/display/panel/panel-simple.yaml b/Documentation/devicetree/bindings/display/panel/panel-simple.yaml > index 18241f4051d2..6e219f67dd67 100644 > --- a/Documentation/devicetree/bindings/display/panel/panel-simple.yaml > +++ b/Documentation/devicetree/bindings/display/panel/panel-simple.yaml > @@ -349,6 +349,57 @@ properties: > power-supply: true > no-hpd: true > hpd-gpios: true > + data-mapping: > + enum: > + - jeida-18 > + - jeida-24 > + - vesa-24 > + description: | > + The color signals mapping order. > + > + LVDS data mappings are defined as follows. > + > + - "jeida-18" - 18-bit data mapping compatible with the [JEIDA], [LDI] and > + [VESA] specifications. Data are transferred as follows on 3 LVDS lanes. > + > + Slot 0 1 2 3 4 5 6 > + ________________ _________________ > + Clock \_______________________/ > + ______ ______ ______ ______ ______ ______ ______ > + DATA0 ><__G0__><__R5__><__R4__><__R3__><__R2__><__R1__><__R0__>< > + DATA1 ><__B1__><__B0__><__G5__><__G4__><__G3__><__G2__><__G1__>< > + DATA2 ><_CTL2_><_CTL1_><_CTL0_><__B5__><__B4__><__B3__><__B2__>< > + > + - "jeida-24" - 24-bit data mapping compatible with the [DSIM] and [LDI] > + specifications. Data are transferred as follows on 4 LVDS lanes. > + > + Slot 0 1 2 3 4 5 6 > + ________________ _________________ > + Clock \_______________________/ > + ______ ______ ______ ______ ______ ______ ______ > + DATA0 ><__G2__><__R7__><__R6__><__R5__><__R4__><__R3__><__R2__>< > + DATA1 ><__B3__><__B2__><__G7__><__G6__><__G5__><__G4__><__G3__>< > + DATA2 ><_CTL2_><_CTL1_><_CTL0_><__B7__><__B6__><__B5__><__B4__>< > + DATA3 ><_CTL3_><__B1__><__B0__><__G1__><__G0__><__R1__><__R0__>< > + > + - "vesa-24" - 24-bit data mapping compatible with the [VESA] specification. > + Data are transferred as follows on 4 LVDS lanes. > + > + Slot 0 1 2 3 4 5 6 > + ________________ _________________ > + Clock \_______________________/ > + ______ ______ ______ ______ ______ ______ ______ > + DATA0 ><__G0__><__R5__><__R4__><__R3__><__R2__><__R1__><__R0__>< > + DATA1 ><__B1__><__B0__><__G5__><__G4__><__G3__><__G2__><__G1__>< > + DATA2 ><_CTL2_><_CTL1_><_CTL0_><__B5__><__B4__><__B3__><__B2__>< > + DATA3 ><_CTL3_><__B7__><__B6__><__G7__><__G6__><__R7__><__R6__>< > + > + Control signals are mapped as follows. > + > + CTL0: HSync > + CTL1: VSync > + CTL2: Data Enable > + CTL3: 0 Why do you duplicate what's in display/lvds.yaml? This also just made 'data-mapping' valid on non-LVDS panels. Rob ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] dt-bindings: display: simple: support non-default data-mapping 2023-04-18 21:20 ` Rob Herring @ 2023-04-19 6:29 ` Johannes Zink 2023-05-04 7:35 ` Johannes Zink 0 siblings, 1 reply; 7+ messages in thread From: Johannes Zink @ 2023-04-19 6:29 UTC (permalink / raw) To: Rob Herring Cc: thierry.reding, sam, airlied, daniel, krzysztof.kozlowski+dt, dri-devel, devicetree, linux-kernel, kernel Hi Rob, On 4/18/23 23:20, Rob Herring wrote: > On Fri, Apr 14, 2023 at 06:11:15PM +0200, Johannes Zink wrote: >> Some Displays support more than just a single default lvds data mapping, >> which can be used to run displays on only 3 LVDS lanes in the jeida-18 >> data-mapping mode. >> >> Add an optional data-mapping property, analogously to panel-lvds, to >> allow overriding the default data mapping. >> >> Signed-off-by: Johannes Zink <j.zink@pengutronix.de> >> --- >> .../bindings/display/panel/panel-simple.yaml | 51 +++++++++++++++++++ >> 1 file changed, 51 insertions(+) >> >> diff --git a/Documentation/devicetree/bindings/display/panel/panel-simple.yaml b/Documentation/devicetree/bindings/display/panel/panel-simple.yaml >> index 18241f4051d2..6e219f67dd67 100644 >> --- a/Documentation/devicetree/bindings/display/panel/panel-simple.yaml >> +++ b/Documentation/devicetree/bindings/display/panel/panel-simple.yaml >> @@ -349,6 +349,57 @@ properties: >> power-supply: true >> no-hpd: true >> hpd-gpios: true >> + data-mapping: >> + enum: >> + - jeida-18 >> + - jeida-24 >> + - vesa-24 >> + description: | >> + The color signals mapping order. >> + >> + LVDS data mappings are defined as follows. >> + >> + - "jeida-18" - 18-bit data mapping compatible with the [JEIDA], [LDI] and >> + [VESA] specifications. Data are transferred as follows on 3 LVDS lanes. >> + >> + Slot 0 1 2 3 4 5 6 >> + ________________ _________________ >> + Clock \_______________________/ >> + ______ ______ ______ ______ ______ ______ ______ >> + DATA0 ><__G0__><__R5__><__R4__><__R3__><__R2__><__R1__><__R0__>< >> + DATA1 ><__B1__><__B0__><__G5__><__G4__><__G3__><__G2__><__G1__>< >> + DATA2 ><_CTL2_><_CTL1_><_CTL0_><__B5__><__B4__><__B3__><__B2__>< >> + >> + - "jeida-24" - 24-bit data mapping compatible with the [DSIM] and [LDI] >> + specifications. Data are transferred as follows on 4 LVDS lanes. >> + >> + Slot 0 1 2 3 4 5 6 >> + ________________ _________________ >> + Clock \_______________________/ >> + ______ ______ ______ ______ ______ ______ ______ >> + DATA0 ><__G2__><__R7__><__R6__><__R5__><__R4__><__R3__><__R2__>< >> + DATA1 ><__B3__><__B2__><__G7__><__G6__><__G5__><__G4__><__G3__>< >> + DATA2 ><_CTL2_><_CTL1_><_CTL0_><__B7__><__B6__><__B5__><__B4__>< >> + DATA3 ><_CTL3_><__B1__><__B0__><__G1__><__G0__><__R1__><__R0__>< >> + >> + - "vesa-24" - 24-bit data mapping compatible with the [VESA] specification. >> + Data are transferred as follows on 4 LVDS lanes. >> + >> + Slot 0 1 2 3 4 5 6 >> + ________________ _________________ >> + Clock \_______________________/ >> + ______ ______ ______ ______ ______ ______ ______ >> + DATA0 ><__G0__><__R5__><__R4__><__R3__><__R2__><__R1__><__R0__>< >> + DATA1 ><__B1__><__B0__><__G5__><__G4__><__G3__><__G2__><__G1__>< >> + DATA2 ><_CTL2_><_CTL1_><_CTL0_><__B5__><__B4__><__B3__><__B2__>< >> + DATA3 ><_CTL3_><__B7__><__B6__><__G7__><__G6__><__R7__><__R6__>< >> + >> + Control signals are mapped as follows. >> + >> + CTL0: HSync >> + CTL1: VSync >> + CTL2: Data Enable >> + CTL3: 0 > > Why do you duplicate what's in display/lvds.yaml? I don't think any of the other properties from display/lvds.yaml currently make any sense to be put into simple-panel, thus I selectively picked this one. If there is a way to selectively pick only the data_mapping, please let me know and I send a V2 > > This also just made 'data-mapping' valid on non-LVDS panels. what is the canonical way of restricting the data-mapping property to LVDS panels only? Or ist the proper way to go to move the panel I use (innolux,g101ice-l01) to its own yaml file, include panel-simple.yaml and leave the others alone? I think other LVDS panels might benefit from this series though, which is why I think it makes sense to add the property to all LVDS panels. Best regards Johannes > > Rob > -- Pengutronix e.K. | Johannes Zink | Steuerwalder Str. 21 | https://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686| Fax: +49-5121-206917-5555 | ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] dt-bindings: display: simple: support non-default data-mapping 2023-04-19 6:29 ` Johannes Zink @ 2023-05-04 7:35 ` Johannes Zink 0 siblings, 0 replies; 7+ messages in thread From: Johannes Zink @ 2023-05-04 7:35 UTC (permalink / raw) To: Rob Herring Cc: devicetree, daniel, sam, linux-kernel, dri-devel, thierry.reding, krzysztof.kozlowski+dt, airlied, kernel, patchwork-jzi Hi Rob, On 4/19/23 08:29, Johannes Zink wrote: [snip] >> >> Why do you duplicate what's in display/lvds.yaml? > > I don't think any of the other properties from display/lvds.yaml > currently make any sense to be put into simple-panel, thus I selectively > picked this one. > > If there is a way to selectively pick only the data_mapping, please let > me know and I send a V2 > >> >> This also just made 'data-mapping' valid on non-LVDS panels. > > what is the canonical way of restricting the data-mapping property to > LVDS panels only? Or ist the proper way to go to move the panel I use > (innolux,g101ice-l01) to its own yaml file, include panel-simple.yaml > and leave the others alone? I think other LVDS panels might benefit from > this series though, which is why I think it makes sense to add the > property to all LVDS panels. > gentle ping. How do you suggest should I proceed here? Maybe pulling the data-mapping definition in a separate file and include it in both files? Can I enable the property selectively, e.g. only on the innolux,g101ice-l01 panel, in order not to enable it on non-LVDS panels or on LVDS-panels which might not support it? Best regards Johannes [snip] -- Pengutronix e.K. | Johannes Zink | Steuerwalder Str. 21 | https://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686| Fax: +49-5121-206917-5555 | ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2/2] drm/panel-simple: allow LVDS format override 2023-04-14 16:11 [PATCH 0/2] Support non-default LVDS data mapping for simple Johannes Zink 2023-04-14 16:11 ` [PATCH 1/2] dt-bindings: display: simple: support non-default data-mapping Johannes Zink @ 2023-04-14 16:11 ` Johannes Zink 2023-04-17 4:46 ` Dan Carpenter 1 sibling, 1 reply; 7+ messages in thread From: Johannes Zink @ 2023-04-14 16:11 UTC (permalink / raw) To: thierry.reding, sam, airlied, daniel, robh+dt, krzysztof.kozlowski+dt, dri-devel, devicetree, linux-kernel, kernel Cc: Johannes Zink Some panels support multiple LVDS data mapping formats, which can be used e.g. run displays on jeida-18 format when only 3 LVDS lanes are available. Add parsing of an optional data-mapping devicetree property, which also touches up the bits per color to match the bus format. Signed-off-by: Johannes Zink <j.zink@pengutronix.de> --- drivers/gpu/drm/panel/panel-simple.c | 37 +++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c index 065f378bba9d..7366ad13b3f1 100644 --- a/drivers/gpu/drm/panel/panel-simple.c +++ b/drivers/gpu/drm/panel/panel-simple.c @@ -40,6 +40,7 @@ #include <drm/drm_edid.h> #include <drm/drm_mipi_dsi.h> #include <drm/drm_panel.h> +#include <drm/drm_of.h> /** * struct panel_desc - Describes a simple panel. @@ -559,7 +560,7 @@ static int panel_simple_probe(struct device *dev, const struct panel_desc *desc) struct device_node *ddc; int connector_type; u32 bus_flags; - int err; + int err, ret; panel = devm_kzalloc(dev, sizeof(*panel), GFP_KERNEL); if (!panel) @@ -605,6 +606,40 @@ static int panel_simple_probe(struct device *dev, const struct panel_desc *desc) panel_simple_parse_panel_timing_node(dev, panel, &dt); } + + /* optional data-mapping property for overriding bus format */ + ret = drm_of_lvds_get_data_mapping(dev->of_node); + if (ret == -EINVAL) { + dev_warn(dev, "Ignore invalid data-mapping property"); + } else if (ret != -ENODEV) { + int bpc; + + switch (ret) { + default: + WARN_ON(1); + fallthrough; + case MEDIA_BUS_FMT_RGB888_1X7X4_SPWG: + fallthrough; + case MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA: + bpc = 8; + break; + case MEDIA_BUS_FMT_RGB666_1X7X3_SPWG: + bpc = 6; + } + + if (desc->bpc != bpc || desc->bus_format != ret) { + struct panel_desc *override_desc; + + override_desc = devm_kmemdup(dev, desc, sizeof(*desc), GFP_KERNEL); + if (!override_desc) + return -ENOMEM; + + override_desc->bus_format = ret; + override_desc->bpc = bpc; + panel->desc = override_desc; + } + } + connector_type = desc->connector_type; /* Catch common mistakes for panels. */ switch (connector_type) { -- 2.39.2 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] drm/panel-simple: allow LVDS format override 2023-04-14 16:11 ` [PATCH 2/2] drm/panel-simple: allow LVDS format override Johannes Zink @ 2023-04-17 4:46 ` Dan Carpenter 0 siblings, 0 replies; 7+ messages in thread From: Dan Carpenter @ 2023-04-17 4:46 UTC (permalink / raw) To: oe-kbuild, Johannes Zink, thierry.reding, sam, airlied, daniel, robh+dt, krzysztof.kozlowski+dt, dri-devel, devicetree, linux-kernel, kernel Cc: lkp, oe-kbuild-all, Johannes Zink Hi Johannes, kernel test robot noticed the following build warnings: https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Johannes-Zink/dt-bindings-display-simple-support-non-default-data-mapping/20230415-001256 base: git://anongit.freedesktop.org/drm/drm-misc drm-misc-next patch link: https://lore.kernel.org/r/20230414161116.3673911-3-j.zink%40pengutronix.de patch subject: [PATCH 2/2] drm/panel-simple: allow LVDS format override config: loongarch-randconfig-m031-20230415 (https://download.01.org/0day-ci/archive/20230416/202304160359.4LHmFOlU-lkp@intel.com/config) compiler: loongarch64-linux-gcc (GCC) 12.1.0 If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@intel.com> | Reported-by: Dan Carpenter <error27@gmail.com> | Link: https://lore.kernel.org/r/202304160359.4LHmFOlU-lkp@intel.com/ smatch warnings: drivers/gpu/drm/panel/panel-simple.c:635 panel_simple_probe() warn: missing unwind goto? vim +635 drivers/gpu/drm/panel/panel-simple.c 5f04e7ce392db9 Douglas Anderson 2021-09-14 556 static int panel_simple_probe(struct device *dev, const struct panel_desc *desc) 280921de7241ee Thierry Reding 2013-08-30 557 { 280921de7241ee Thierry Reding 2013-08-30 558 struct panel_simple *panel; b8a2948fa2b3a5 Sean Paul 2019-07-11 559 struct display_timing dt; 0fe1564bd61642 Sam Ravnborg 2019-12-07 560 struct device_node *ddc; 9f069c6fbc7266 Sam Ravnborg 2020-07-26 561 int connector_type; ddb8e853dc8507 Sam Ravnborg 2020-07-26 562 u32 bus_flags; fad6396eea4946 Johannes Zink 2023-04-14 563 int err, ret; 280921de7241ee Thierry Reding 2013-08-30 564 280921de7241ee Thierry Reding 2013-08-30 565 panel = devm_kzalloc(dev, sizeof(*panel), GFP_KERNEL); 280921de7241ee Thierry Reding 2013-08-30 566 if (!panel) 280921de7241ee Thierry Reding 2013-08-30 567 return -ENOMEM; 280921de7241ee Thierry Reding 2013-08-30 568 280921de7241ee Thierry Reding 2013-08-30 569 panel->enabled = false; 4beb04beb24afe Douglas Anderson 2020-11-09 570 panel->prepared_time = 0; 280921de7241ee Thierry Reding 2013-08-30 571 panel->desc = desc; 280921de7241ee Thierry Reding 2013-08-30 572 280921de7241ee Thierry Reding 2013-08-30 573 panel->supply = devm_regulator_get(dev, "power"); 280921de7241ee Thierry Reding 2013-08-30 574 if (IS_ERR(panel->supply)) 280921de7241ee Thierry Reding 2013-08-30 575 return PTR_ERR(panel->supply); 280921de7241ee Thierry Reding 2013-08-30 576 a61400d85c3ba4 Alexandre Courbot 2014-10-23 577 panel->enable_gpio = devm_gpiod_get_optional(dev, "enable", a61400d85c3ba4 Alexandre Courbot 2014-10-23 578 GPIOD_OUT_LOW); c9b48b91e2fbb7 Yuan Can 2022-09-29 579 if (IS_ERR(panel->enable_gpio)) c9b48b91e2fbb7 Yuan Can 2022-09-29 580 return dev_err_probe(dev, PTR_ERR(panel->enable_gpio), c9b48b91e2fbb7 Yuan Can 2022-09-29 581 "failed to request GPIO\n"); 280921de7241ee Thierry Reding 2013-08-30 582 5759c9674c20ff Dmitry Osipenko 2020-08-14 583 err = of_drm_get_panel_orientation(dev->of_node, &panel->orientation); 5759c9674c20ff Dmitry Osipenko 2020-08-14 584 if (err) { 5759c9674c20ff Dmitry Osipenko 2020-08-14 585 dev_err(dev, "%pOF: failed to get orientation %d\n", dev->of_node, err); 5759c9674c20ff Dmitry Osipenko 2020-08-14 586 return err; 5759c9674c20ff Dmitry Osipenko 2020-08-14 587 } 5759c9674c20ff Dmitry Osipenko 2020-08-14 588 280921de7241ee Thierry Reding 2013-08-30 589 ddc = of_parse_phandle(dev->of_node, "ddc-i2c-bus", 0); 280921de7241ee Thierry Reding 2013-08-30 590 if (ddc) { 280921de7241ee Thierry Reding 2013-08-30 591 panel->ddc = of_find_i2c_adapter_by_node(ddc); 280921de7241ee Thierry Reding 2013-08-30 592 of_node_put(ddc); 280921de7241ee Thierry Reding 2013-08-30 593 0fe1564bd61642 Sam Ravnborg 2019-12-07 594 if (!panel->ddc) 0fe1564bd61642 Sam Ravnborg 2019-12-07 595 return -EPROBE_DEFER; 280921de7241ee Thierry Reding 2013-08-30 596 } 280921de7241ee Thierry Reding 2013-08-30 597 4a1d0dbc833223 Sam Ravnborg 2020-02-16 598 if (desc == &panel_dpi) { 4a1d0dbc833223 Sam Ravnborg 2020-02-16 599 /* Handle the generic panel-dpi binding */ 4a1d0dbc833223 Sam Ravnborg 2020-02-16 600 err = panel_dpi_probe(dev, panel); 4a1d0dbc833223 Sam Ravnborg 2020-02-16 601 if (err) 4a1d0dbc833223 Sam Ravnborg 2020-02-16 602 goto free_ddc; 6df4432a5eca10 Christoph Niedermaier 2022-02-01 603 desc = panel->desc; 4a1d0dbc833223 Sam Ravnborg 2020-02-16 604 } else { b8a2948fa2b3a5 Sean Paul 2019-07-11 605 if (!of_get_display_timing(dev->of_node, "panel-timing", &dt)) e362cc6a247551 Douglas Anderson 2019-07-12 606 panel_simple_parse_panel_timing_node(dev, panel, &dt); 4a1d0dbc833223 Sam Ravnborg 2020-02-16 607 } b8a2948fa2b3a5 Sean Paul 2019-07-11 608 fad6396eea4946 Johannes Zink 2023-04-14 609 fad6396eea4946 Johannes Zink 2023-04-14 610 /* optional data-mapping property for overriding bus format */ fad6396eea4946 Johannes Zink 2023-04-14 611 ret = drm_of_lvds_get_data_mapping(dev->of_node); fad6396eea4946 Johannes Zink 2023-04-14 612 if (ret == -EINVAL) { fad6396eea4946 Johannes Zink 2023-04-14 613 dev_warn(dev, "Ignore invalid data-mapping property"); fad6396eea4946 Johannes Zink 2023-04-14 614 } else if (ret != -ENODEV) { fad6396eea4946 Johannes Zink 2023-04-14 615 int bpc; fad6396eea4946 Johannes Zink 2023-04-14 616 fad6396eea4946 Johannes Zink 2023-04-14 617 switch (ret) { fad6396eea4946 Johannes Zink 2023-04-14 618 default: fad6396eea4946 Johannes Zink 2023-04-14 619 WARN_ON(1); fad6396eea4946 Johannes Zink 2023-04-14 620 fallthrough; fad6396eea4946 Johannes Zink 2023-04-14 621 case MEDIA_BUS_FMT_RGB888_1X7X4_SPWG: fad6396eea4946 Johannes Zink 2023-04-14 622 fallthrough; fad6396eea4946 Johannes Zink 2023-04-14 623 case MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA: fad6396eea4946 Johannes Zink 2023-04-14 624 bpc = 8; fad6396eea4946 Johannes Zink 2023-04-14 625 break; fad6396eea4946 Johannes Zink 2023-04-14 626 case MEDIA_BUS_FMT_RGB666_1X7X3_SPWG: fad6396eea4946 Johannes Zink 2023-04-14 627 bpc = 6; fad6396eea4946 Johannes Zink 2023-04-14 628 } fad6396eea4946 Johannes Zink 2023-04-14 629 fad6396eea4946 Johannes Zink 2023-04-14 630 if (desc->bpc != bpc || desc->bus_format != ret) { fad6396eea4946 Johannes Zink 2023-04-14 631 struct panel_desc *override_desc; fad6396eea4946 Johannes Zink 2023-04-14 632 fad6396eea4946 Johannes Zink 2023-04-14 633 override_desc = devm_kmemdup(dev, desc, sizeof(*desc), GFP_KERNEL); fad6396eea4946 Johannes Zink 2023-04-14 634 if (!override_desc) fad6396eea4946 Johannes Zink 2023-04-14 @635 return -ENOMEM; goto free_ddc; fad6396eea4946 Johannes Zink 2023-04-14 636 fad6396eea4946 Johannes Zink 2023-04-14 637 override_desc->bus_format = ret; fad6396eea4946 Johannes Zink 2023-04-14 638 override_desc->bpc = bpc; fad6396eea4946 Johannes Zink 2023-04-14 639 panel->desc = override_desc; fad6396eea4946 Johannes Zink 2023-04-14 640 } fad6396eea4946 Johannes Zink 2023-04-14 641 } fad6396eea4946 Johannes Zink 2023-04-14 642 9f069c6fbc7266 Sam Ravnborg 2020-07-26 643 connector_type = desc->connector_type; ddb8e853dc8507 Sam Ravnborg 2020-07-26 644 /* Catch common mistakes for panels. */ 9f069c6fbc7266 Sam Ravnborg 2020-07-26 645 switch (connector_type) { ddb8e853dc8507 Sam Ravnborg 2020-07-26 646 case 0: ddb8e853dc8507 Sam Ravnborg 2020-07-26 647 dev_warn(dev, "Specify missing connector_type\n"); 9f069c6fbc7266 Sam Ravnborg 2020-07-26 648 connector_type = DRM_MODE_CONNECTOR_DPI; ddb8e853dc8507 Sam Ravnborg 2020-07-26 649 break; ddb8e853dc8507 Sam Ravnborg 2020-07-26 650 case DRM_MODE_CONNECTOR_LVDS: c4715837b02393 Laurent Pinchart 2020-06-30 651 WARN_ON(desc->bus_flags & c4715837b02393 Laurent Pinchart 2020-06-30 652 ~(DRM_BUS_FLAG_DE_LOW | c4715837b02393 Laurent Pinchart 2020-06-30 653 DRM_BUS_FLAG_DE_HIGH | c4715837b02393 Laurent Pinchart 2020-06-30 654 DRM_BUS_FLAG_DATA_MSB_TO_LSB | c4715837b02393 Laurent Pinchart 2020-06-30 655 DRM_BUS_FLAG_DATA_LSB_TO_MSB)); 1185c406f11a49 Laurent Pinchart 2020-06-30 656 WARN_ON(desc->bus_format != MEDIA_BUS_FMT_RGB666_1X7X3_SPWG && 1185c406f11a49 Laurent Pinchart 2020-06-30 657 desc->bus_format != MEDIA_BUS_FMT_RGB888_1X7X4_SPWG && 1185c406f11a49 Laurent Pinchart 2020-06-30 658 desc->bus_format != MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA); 1185c406f11a49 Laurent Pinchart 2020-06-30 659 WARN_ON(desc->bus_format == MEDIA_BUS_FMT_RGB666_1X7X3_SPWG && 1185c406f11a49 Laurent Pinchart 2020-06-30 660 desc->bpc != 6); 1185c406f11a49 Laurent Pinchart 2020-06-30 661 WARN_ON((desc->bus_format == MEDIA_BUS_FMT_RGB888_1X7X4_SPWG || 1185c406f11a49 Laurent Pinchart 2020-06-30 662 desc->bus_format == MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA) && 1185c406f11a49 Laurent Pinchart 2020-06-30 663 desc->bpc != 8); ddb8e853dc8507 Sam Ravnborg 2020-07-26 664 break; ddb8e853dc8507 Sam Ravnborg 2020-07-26 665 case DRM_MODE_CONNECTOR_eDP: 5f04e7ce392db9 Douglas Anderson 2021-09-14 666 dev_warn(dev, "eDP panels moved to panel-edp\n"); 5f04e7ce392db9 Douglas Anderson 2021-09-14 667 err = -EINVAL; 5f04e7ce392db9 Douglas Anderson 2021-09-14 668 goto free_ddc; ddb8e853dc8507 Sam Ravnborg 2020-07-26 669 case DRM_MODE_CONNECTOR_DSI: ddb8e853dc8507 Sam Ravnborg 2020-07-26 670 if (desc->bpc != 6 && desc->bpc != 8) ddb8e853dc8507 Sam Ravnborg 2020-07-26 671 dev_warn(dev, "Expected bpc in {6,8} but got: %u\n", desc->bpc); ddb8e853dc8507 Sam Ravnborg 2020-07-26 672 break; ddb8e853dc8507 Sam Ravnborg 2020-07-26 673 case DRM_MODE_CONNECTOR_DPI: ddb8e853dc8507 Sam Ravnborg 2020-07-26 674 bus_flags = DRM_BUS_FLAG_DE_LOW | ddb8e853dc8507 Sam Ravnborg 2020-07-26 675 DRM_BUS_FLAG_DE_HIGH | ddb8e853dc8507 Sam Ravnborg 2020-07-26 676 DRM_BUS_FLAG_PIXDATA_SAMPLE_POSEDGE | ddb8e853dc8507 Sam Ravnborg 2020-07-26 677 DRM_BUS_FLAG_PIXDATA_SAMPLE_NEGEDGE | ddb8e853dc8507 Sam Ravnborg 2020-07-26 678 DRM_BUS_FLAG_DATA_MSB_TO_LSB | ddb8e853dc8507 Sam Ravnborg 2020-07-26 679 DRM_BUS_FLAG_DATA_LSB_TO_MSB | ddb8e853dc8507 Sam Ravnborg 2020-07-26 680 DRM_BUS_FLAG_SYNC_SAMPLE_POSEDGE | ddb8e853dc8507 Sam Ravnborg 2020-07-26 681 DRM_BUS_FLAG_SYNC_SAMPLE_NEGEDGE; ddb8e853dc8507 Sam Ravnborg 2020-07-26 682 if (desc->bus_flags & ~bus_flags) ddb8e853dc8507 Sam Ravnborg 2020-07-26 683 dev_warn(dev, "Unexpected bus_flags(%d)\n", desc->bus_flags & ~bus_flags); ddb8e853dc8507 Sam Ravnborg 2020-07-26 684 if (!(desc->bus_flags & bus_flags)) ddb8e853dc8507 Sam Ravnborg 2020-07-26 685 dev_warn(dev, "Specify missing bus_flags\n"); ddb8e853dc8507 Sam Ravnborg 2020-07-26 686 if (desc->bus_format == 0) ddb8e853dc8507 Sam Ravnborg 2020-07-26 687 dev_warn(dev, "Specify missing bus_format\n"); ddb8e853dc8507 Sam Ravnborg 2020-07-26 688 if (desc->bpc != 6 && desc->bpc != 8) ddb8e853dc8507 Sam Ravnborg 2020-07-26 689 dev_warn(dev, "Expected bpc in {6,8} but got: %u\n", desc->bpc); ddb8e853dc8507 Sam Ravnborg 2020-07-26 690 break; ddb8e853dc8507 Sam Ravnborg 2020-07-26 691 default: ddb8e853dc8507 Sam Ravnborg 2020-07-26 692 dev_warn(dev, "Specify a valid connector_type: %d\n", desc->connector_type); 9f069c6fbc7266 Sam Ravnborg 2020-07-26 693 connector_type = DRM_MODE_CONNECTOR_DPI; ddb8e853dc8507 Sam Ravnborg 2020-07-26 694 break; 1185c406f11a49 Laurent Pinchart 2020-06-30 695 } c4715837b02393 Laurent Pinchart 2020-06-30 696 3235b0f20a0a41 Douglas Anderson 2021-04-16 697 dev_set_drvdata(dev, panel); 3235b0f20a0a41 Douglas Anderson 2021-04-16 698 3235b0f20a0a41 Douglas Anderson 2021-04-16 699 /* 3235b0f20a0a41 Douglas Anderson 2021-04-16 700 * We use runtime PM for prepare / unprepare since those power the panel 3235b0f20a0a41 Douglas Anderson 2021-04-16 701 * on and off and those can be very slow operations. This is important 3235b0f20a0a41 Douglas Anderson 2021-04-16 702 * to optimize powering the panel on briefly to read the EDID before 3235b0f20a0a41 Douglas Anderson 2021-04-16 703 * fully enabling the panel. 3235b0f20a0a41 Douglas Anderson 2021-04-16 704 */ 3235b0f20a0a41 Douglas Anderson 2021-04-16 705 pm_runtime_enable(dev); 3235b0f20a0a41 Douglas Anderson 2021-04-16 706 pm_runtime_set_autosuspend_delay(dev, 1000); 3235b0f20a0a41 Douglas Anderson 2021-04-16 707 pm_runtime_use_autosuspend(dev); 3235b0f20a0a41 Douglas Anderson 2021-04-16 708 9f069c6fbc7266 Sam Ravnborg 2020-07-26 709 drm_panel_init(&panel->base, dev, &panel_simple_funcs, connector_type); 280921de7241ee Thierry Reding 2013-08-30 710 0fe1564bd61642 Sam Ravnborg 2019-12-07 711 err = drm_panel_of_backlight(&panel->base); d9e74da2f1fc42 Alexander Stein 2022-06-21 712 if (err) { d9e74da2f1fc42 Alexander Stein 2022-06-21 713 dev_err_probe(dev, err, "Could not find backlight\n"); 70e12560126685 Douglas Anderson 2021-04-23 714 goto disable_pm_runtime; d9e74da2f1fc42 Alexander Stein 2022-06-21 715 } 0fe1564bd61642 Sam Ravnborg 2019-12-07 716 c3ee8c65f63799 Bernard Zhao 2020-08-01 717 drm_panel_add(&panel->base); 280921de7241ee Thierry Reding 2013-08-30 718 280921de7241ee Thierry Reding 2013-08-30 719 return 0; 280921de7241ee Thierry Reding 2013-08-30 720 70e12560126685 Douglas Anderson 2021-04-23 721 disable_pm_runtime: a596fcd9cbc781 Douglas Anderson 2021-05-17 722 pm_runtime_dont_use_autosuspend(dev); 70e12560126685 Douglas Anderson 2021-04-23 723 pm_runtime_disable(dev); 280921de7241ee Thierry Reding 2013-08-30 724 free_ddc: 5f04e7ce392db9 Douglas Anderson 2021-09-14 725 if (panel->ddc) 280921de7241ee Thierry Reding 2013-08-30 726 put_device(&panel->ddc->dev); 280921de7241ee Thierry Reding 2013-08-30 727 280921de7241ee Thierry Reding 2013-08-30 728 return err; 280921de7241ee Thierry Reding 2013-08-30 729 } -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-05-04 7:36 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2023-04-14 16:11 [PATCH 0/2] Support non-default LVDS data mapping for simple Johannes Zink 2023-04-14 16:11 ` [PATCH 1/2] dt-bindings: display: simple: support non-default data-mapping Johannes Zink 2023-04-18 21:20 ` Rob Herring 2023-04-19 6:29 ` Johannes Zink 2023-05-04 7:35 ` Johannes Zink 2023-04-14 16:11 ` [PATCH 2/2] drm/panel-simple: allow LVDS format override Johannes Zink 2023-04-17 4:46 ` Dan Carpenter
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).