Skip to contentSkip to conversation

Improvments for tc358775 with support for tc358765

PATCH Superseded Tony Lindgren 5 participants 21 messages Feb 11, 2024 – Feb 13, 2024

Subsystems (4)

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v3 cover Improvments for tc358775 with support for tc358765

Hi all,

Here are v3 patches to improve tc358775 driver and add support for tc358765.

Regards,

Tony

Changes since v2:

- Only make stby-gpios optional for tc358775, and disallow them for tc358765 as noted by Krzysztof

- Added additionalProperties: false for port-base as noted by Krzysztof

- Updated patch description for why there can be a data-lanes property for both the DSI host and the bridge as noted by Dmitry

- Improved the old dtb data-lanes warning as suggested by Michael

- Fix warning on casting of_device_get_match_data() as noted by the kernel test robot

Changes since v1:

- After a brief offline discussion with Michael, merge series with Michael's patch series to make stby gpio and supplies optional as they may be hardwired

- Use Michael's better patch for the jeida timings change

- Parse lanes on the bridge side like other bridge devices do, and if not found, also parse on the DSI host side and warn

Michael Walle (3):
dt-bindings: display: bridge: tc358775: make stby gpio optional drm/bridge: tc358775: fix support for jeida-18 and jeida-24 drm/bridge: tc358775: make standby GPIO optional

Tony Lindgren (7):
dt-bindings: display: bridge: tc358775: Add data-lanes
dt-bindings: display: bridge: tc358775: Add support for tc358765 drm/bridge: tc358775: Get bridge data lanes instead of the DSI host
lanes
drm/bridge: tc358775: Add burst and low-power modes drm/bridge: tc358775: Enable pre_enable_prev_first flag drm/bridge: tc358775: Add support for tc358765 drm/bridge: tc358775: Configure hs_rate and lp_rate

 .../display/bridge/toshiba,tc358775.yaml      | 38 +++++--
 drivers/gpu/drm/bridge/tc358775.c             | 98 ++++++++++++-------
 2 files changed, 93 insertions(+), 43 deletions(-)
Signature · 1 line
2.43.0
#1 lore raw

PATCH v3 1/10 dt-bindings: display: bridge: tc358775: make stby gpio optional

From: Michael Walle <[email protected]>

For a normal operation, the stby GPIO is not needed.

The reset pin is required because once the PPI (PHY protocol interface) is started, it can only be stopped by asserting the reset pin.

[[email protected]: dropped regulator related changes]
---
 .../devicetree/bindings/display/bridge/toshiba,tc358775.yaml     | 1 -
 1 file changed, 1 deletion(-)
Documentation/devicetree/bindings/display/bridge/toshiba,tc358775.yaml +0 -1
@@ -70,7 +70,6 @@ required:
   - reg
   - vdd-supply
   - vddio-supply
-  - stby-gpios
   - reset-gpios
   - ports
 
Signature · 1 line
2.43.0
Acked-by on v3 1/10
#2 lore raw

Re: [PATCH v3 01/10] dt-bindings: display: bridge: tc358775: make stby gpio optional

Quoted 11 lines · Tony Lindgren

From: Michael Walle <[email protected]>

For a normal operation, the stby GPIO is not needed.

The reset pin is required because once the PPI (PHY protocol interface) is started, it can only be stopped by asserting the reset pin.

[[email protected]: dropped regulator related changes]

---

Best regards,
Krzysztof

#3 lore raw

PATCH v3 2/10 dt-bindings: display: bridge: tc358775: Add data-lanes

In reply to Tony Lindgren

The device uses a clock lane, and 1 to 4 DSI data lanes. Let's add the data-lanes property starting at 1 similar to what the other bridge bindings are doing.

Let's also drop the data-lanes properties in the example for the DSI host controller to avoid confusion. The configuration of the DSI host depends on the controller used and is unrelated to the bridge binding.

---
 .../display/bridge/toshiba,tc358775.yaml      | 22 ++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/display/bridge/toshiba,tc358775.yaml +19 -3
@@ -46,11 +46,27 @@ properties:
 
     properties:
       port@0:
-        $ref: /schemas/graph.yaml#/properties/port
+        $ref: /schemas/graph.yaml#/$defs/port-base
+        unevaluatedProperties: false
         description: |
           DSI Input. The remote endpoint phandle should be a
           reference to a valid mipi_dsi_host device node.
 
+        properties:
+          endpoint:
+            $ref: /schemas/media/video-interfaces.yaml#
+            unevaluatedProperties: false
+
+            properties:
+              data-lanes:
+                description: array of physical DSI data lane indexes.
+                minItems: 1
+                items:
+                  - const: 1
+                  - const: 2
+                  - const: 3
+                  - const: 4
+
       port@1:
         $ref: /schemas/graph.yaml#/properties/port
         description: |
@@ -107,6 +123,7 @@ examples:
                     reg = <0>;
                     d2l_in_test: endpoint {
                         remote-endpoint = <&dsi0_out>;
+                        data-lanes = <1 2 3 4>;
                     };
                 };
 
@@ -131,7 +148,6 @@ examples:
                 reg = <1>;
                 dsi0_out: endpoint {
                     remote-endpoint = <&d2l_in_test>;
-                    data-lanes = <0 1 2 3>;
                 };
              };
          };
@@ -166,6 +182,7 @@ examples:
                     reg = <0>;
                     d2l_in_dual: endpoint {
                         remote-endpoint = <&dsi0_out_dual>;
+                        data-lanes = <1 2 3 4>;
                     };
                 };
 
@@ -197,7 +214,6 @@ examples:
                 reg = <1>;
                 dsi0_out_dual: endpoint {
                     remote-endpoint = <&d2l_in_dual>;
-                    data-lanes = <0 1 2 3>;
                 };
              };
          };
Signature · 1 line
2.43.0
Reviewed-by on v3 2/10
#4 lore raw

Re: [PATCH v3 02/10] dt-bindings: display: bridge: tc358775: Add data-lanes

Quoted 10 lines · Tony Lindgren

The device uses a clock lane, and 1 to 4 DSI data lanes. Let's add the data-lanes property starting at 1 similar to what the other bridge bindings are doing.

Let's also drop the data-lanes properties in the example for the DSI host controller to avoid confusion. The configuration of the DSI host depends on the controller used and is unrelated to the bridge binding.

---

Best regards,
Krzysztof

#5 lore raw

PATCH v3 3/10 dt-bindings: display: bridge: tc358775: Add support for tc358765

In reply to Tony Lindgren

The tc358765 is similar to tc358775. The tc358765 just an earlier version of the hardware, and it's pin and register compatible with tc358775 for most part.

From the binding point of view the only difference is that the tc358765 does not have stdby-gpios.

---
 .../bindings/display/bridge/toshiba,tc358775.yaml | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/display/bridge/toshiba,tc358775.yaml +13 -2
@@ -10,7 +10,7 @@ maintainers:
   - Vinay Simha BN <[email protected]>
 
 description: |
-  This binding supports DSI to LVDS bridge TC358775
+  This binding supports DSI to LVDS bridges TC358765 and TC358775
 
   MIPI DSI-RX Data 4-lane, CLK 1-lane with data rates up to 800 Mbps/lane.
   Video frame size:
@@ -21,7 +21,9 @@ description: |
 
 properties:
   compatible:
-    const: toshiba,tc358775
+    enum:
+      - toshiba,tc358765
+      - toshiba,tc358775
 
   reg:
     maxItems: 1
@@ -81,6 +83,15 @@ properties:
       - port@0
       - port@1
 
+allOf:
+  - if:
+    properties:
+      compatible:
+        contains:
+          const: toshiba,tc358765
+    then:
+      stby-gpios: false
+
 required:
   - compatible
   - reg
Signature · 1 line
2.43.0
maintainer
#6 lore raw

Re: [PATCH v3 03/10] dt-bindings: display: bridge: tc358775: Add support for tc358765

Quoted 5 lines · Tony Lindgren

The tc358765 is similar to tc358775. The tc358765 just an earlier version of the hardware, and it's pin and register compatible with tc358775 for most part.

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check' on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:
./Documentation/devicetree/bindings/display/bridge/toshiba,tc358775.yaml:87:8: [error] empty value in block mapping (empty-values)

dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/display/bridge/toshiba,tc358775.yaml: allOf:0:if: None is not of type 'object', 'boolean'
from schema $id: http://json-schema.org/draft-07/schema#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/display/bridge/toshiba,tc358775.yaml: allOf:0:then: 'anyOf' conditional failed, one must be fixed:
'stby-gpios' is not one of ['$ref', 'additionalItems', 'additionalProperties', 'allOf', 'anyOf', 'const', 'contains', 'default', 'dependencies', 'dependentRequired', 'dependentSchemas', 'deprecated', 'description', 'else', 'enum', 'exclusiveMaximum', 'exclusiveMinimum', 'items', 'if', 'minItems', 'minimum', 'maxItems', 'maximum', 'multipleOf', 'not', 'oneOf', 'pattern', 'patternProperties', 'properties', 'required', 'then', 'typeSize', 'unevaluatedProperties', 'uniqueItems'] 'type' was expected
from schema $id: http://devicetree.org/meta-schemas/keywords.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/display/bridge/toshiba,tc358775.yaml: ignoring, error in schema: allOf: 0: if
Documentation/devicetree/bindings/display/bridge/toshiba,tc358775.example.dtb: /example-0/i2c@78b8000/bridge@f: failed to match any schema with compatible: ['toshiba,tc358775']
Documentation/devicetree/bindings/display/bridge/toshiba,tc358775.example.dtb: /example-1/i2c@78b8000/bridge@f: failed to match any schema with compatible: ['toshiba,tc358775']

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]

The base for the series is generally the latest rc1. A different dependency should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note that DT_SCHEMA_FILES can be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema.

#7 lore raw

Re: [PATCH v3 03/10] dt-bindings: display: bridge: tc358775: Add support for tc358765

In reply to Tony Lindgren
kernel test robot noticed the following build warnings:

Hi Tony,

kernel test robot noticed the following build warnings:

[auto build test WARNING on drm-misc/drm-misc-next]
[also build test WARNING on linus/master v6.8-rc3 next-20240209] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Tony-Lindgren/dt-bindings-display-bridge-tc358775-make-stby-gpio-optional/20240211-180213
base:   git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
patch link:    https://lore.kernel.org/r/20240211095144.2589-4-tony%40atomide.com
patch subject: [PATCH v3 03/10] dt-bindings: display: bridge: tc358775: Add support for tc358765
compiler: loongarch64-linux-gcc (GCC) 13.2.0
reproduce: (https://download.01.org/0day-ci/archive/20240212/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/r/[email protected]/

dtcheck warnings: (new ones prefixed by >>)

>> Documentation/devicetree/bindings/display/bridge/toshiba,tc358775.yaml:87:8: [error] empty value in block mapping (empty-values)
--
>> Documentation/devicetree/bindings/display/bridge/toshiba,tc358775.yaml: allOf:0:if: None is not of type 'object', 'boolean'
   	from schema $id: http://json-schema.org/draft-07/schema#
>> Documentation/devicetree/bindings/display/bridge/toshiba,tc358775.yaml: allOf:0:then: 'anyOf' conditional failed, one must be fixed:

'stby-gpios' is not one of ['$ref', 'additionalItems', 'additionalProperties', 'allOf', 'anyOf', 'const', 'contains', 'default', 'dependencies', 'dependentRequired', 'dependentSchemas', 'deprecated', 'description', 'else', 'enum', 'exclusiveMaximum', 'exclusiveMinimum', 'items', 'if', 'minItems', 'minimum', 'maxItems', 'maximum', 'multipleOf', 'not', 'oneOf', 'pattern', 'patternProperties', 'properties', 'required', 'then', 'typeSize', 'unevaluatedProperties', 'uniqueItems'] 'type' was expected
from schema $id: http://devicetree.org/meta-schemas/keywords.yaml#
--

>> Documentation/devicetree/bindings/display/bridge/toshiba,tc358775.yaml: ignoring, error in schema: allOf: 0: if

vim +87 Documentation/devicetree/bindings/display/bridge/toshiba,tc358775.yaml

8b0d47e879b8fe Vinay Simha BN      2020-07-10    1  # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
8b0d47e879b8fe Vinay Simha BN      2020-07-10    2  %YAML 1.2
8b0d47e879b8fe Vinay Simha BN      2020-07-10    3  ---
8b0d47e879b8fe Vinay Simha BN      2020-07-10    4  $id: http://devicetree.org/schemas/display/bridge/toshiba,tc358775.yaml#
8b0d47e879b8fe Vinay Simha BN      2020-07-10    5  $schema: http://devicetree.org/meta-schemas/core.yaml#
8b0d47e879b8fe Vinay Simha BN      2020-07-10    6  
84e85359f4999a Krzysztof Kozlowski 2022-12-16    7  title: Toshiba TC358775 DSI to LVDS bridge
8b0d47e879b8fe Vinay Simha BN      2020-07-10    8  
8b0d47e879b8fe Vinay Simha BN      2020-07-10    9  maintainers:
8b0d47e879b8fe Vinay Simha BN      2020-07-10   10    - Vinay Simha BN <[email protected]>
8b0d47e879b8fe Vinay Simha BN      2020-07-10   11  
8b0d47e879b8fe Vinay Simha BN      2020-07-10   12  description: |
6b27cbab742a1a Tony Lindgren       2024-02-11   13    This binding supports DSI to LVDS bridges TC358765 and TC358775
8b0d47e879b8fe Vinay Simha BN      2020-07-10   14  
8b0d47e879b8fe Vinay Simha BN      2020-07-10   15    MIPI DSI-RX Data 4-lane, CLK 1-lane with data rates up to 800 Mbps/lane.
8b0d47e879b8fe Vinay Simha BN      2020-07-10   16    Video frame size:
8b0d47e879b8fe Vinay Simha BN      2020-07-10   17    Up to 1600x1200 24-bit/pixel resolution for single-link LVDS display panel
8b0d47e879b8fe Vinay Simha BN      2020-07-10   18    limited by 135 MHz LVDS speed
8b0d47e879b8fe Vinay Simha BN      2020-07-10   19    Up to WUXGA (1920x1200 24-bit pixels) resolution for dual-link LVDS display
8b0d47e879b8fe Vinay Simha BN      2020-07-10   20    panel, limited by 270 MHz LVDS speed.
8b0d47e879b8fe Vinay Simha BN      2020-07-10   21  
8b0d47e879b8fe Vinay Simha BN      2020-07-10   22  properties:
8b0d47e879b8fe Vinay Simha BN      2020-07-10   23    compatible:
6b27cbab742a1a Tony Lindgren       2024-02-11   24      enum:
6b27cbab742a1a Tony Lindgren       2024-02-11   25        - toshiba,tc358765
6b27cbab742a1a Tony Lindgren       2024-02-11   26        - toshiba,tc358775
8b0d47e879b8fe Vinay Simha BN      2020-07-10   27  
8b0d47e879b8fe Vinay Simha BN      2020-07-10   28    reg:
8b0d47e879b8fe Vinay Simha BN      2020-07-10   29      maxItems: 1
8b0d47e879b8fe Vinay Simha BN      2020-07-10   30      description: i2c address of the bridge, 0x0f
8b0d47e879b8fe Vinay Simha BN      2020-07-10   31  
8b0d47e879b8fe Vinay Simha BN      2020-07-10   32    vdd-supply:
8b0d47e879b8fe Vinay Simha BN      2020-07-10   33      description: 1.2V LVDS Power Supply
8b0d47e879b8fe Vinay Simha BN      2020-07-10   34  
8b0d47e879b8fe Vinay Simha BN      2020-07-10   35    vddio-supply:
8b0d47e879b8fe Vinay Simha BN      2020-07-10   36      description: 1.8V IO Power Supply
8b0d47e879b8fe Vinay Simha BN      2020-07-10   37  
8b0d47e879b8fe Vinay Simha BN      2020-07-10   38    stby-gpios:
8b0d47e879b8fe Vinay Simha BN      2020-07-10   39      maxItems: 1
8b0d47e879b8fe Vinay Simha BN      2020-07-10   40      description: Standby pin, Low active
8b0d47e879b8fe Vinay Simha BN      2020-07-10   41  
8b0d47e879b8fe Vinay Simha BN      2020-07-10   42    reset-gpios:
8b0d47e879b8fe Vinay Simha BN      2020-07-10   43      maxItems: 1
8b0d47e879b8fe Vinay Simha BN      2020-07-10   44      description: Hardware reset, Low active
8b0d47e879b8fe Vinay Simha BN      2020-07-10   45  
8b0d47e879b8fe Vinay Simha BN      2020-07-10   46    ports:
b67554232307e7 Rob Herring         2021-01-04   47      $ref: /schemas/graph.yaml#/properties/ports
8b0d47e879b8fe Vinay Simha BN      2020-07-10   48  
b67554232307e7 Rob Herring         2021-01-04   49      properties:
8b0d47e879b8fe Vinay Simha BN      2020-07-10   50        port@0:
9a017bf40a32e5 Tony Lindgren       2024-02-11   51          $ref: /schemas/graph.yaml#/$defs/port-base
9a017bf40a32e5 Tony Lindgren       2024-02-11   52          unevaluatedProperties: false
8b0d47e879b8fe Vinay Simha BN      2020-07-10   53          description: |
8b0d47e879b8fe Vinay Simha BN      2020-07-10   54            DSI Input. The remote endpoint phandle should be a
8b0d47e879b8fe Vinay Simha BN      2020-07-10   55            reference to a valid mipi_dsi_host device node.
8b0d47e879b8fe Vinay Simha BN      2020-07-10   56  
9a017bf40a32e5 Tony Lindgren       2024-02-11   57          properties:
9a017bf40a32e5 Tony Lindgren       2024-02-11   58            endpoint:
9a017bf40a32e5 Tony Lindgren       2024-02-11   59              $ref: /schemas/media/video-interfaces.yaml#
9a017bf40a32e5 Tony Lindgren       2024-02-11   60              unevaluatedProperties: false
9a017bf40a32e5 Tony Lindgren       2024-02-11   61  
9a017bf40a32e5 Tony Lindgren       2024-02-11   62              properties:
9a017bf40a32e5 Tony Lindgren       2024-02-11   63                data-lanes:
9a017bf40a32e5 Tony Lindgren       2024-02-11   64                  description: array of physical DSI data lane indexes.
9a017bf40a32e5 Tony Lindgren       2024-02-11   65                  minItems: 1
9a017bf40a32e5 Tony Lindgren       2024-02-11   66                  items:
9a017bf40a32e5 Tony Lindgren       2024-02-11   67                    - const: 1
9a017bf40a32e5 Tony Lindgren       2024-02-11   68                    - const: 2
9a017bf40a32e5 Tony Lindgren       2024-02-11   69                    - const: 3
9a017bf40a32e5 Tony Lindgren       2024-02-11   70                    - const: 4
9a017bf40a32e5 Tony Lindgren       2024-02-11   71  
8b0d47e879b8fe Vinay Simha BN      2020-07-10   72        port@1:
b67554232307e7 Rob Herring         2021-01-04   73          $ref: /schemas/graph.yaml#/properties/port
8b0d47e879b8fe Vinay Simha BN      2020-07-10   74          description: |
8b0d47e879b8fe Vinay Simha BN      2020-07-10   75            Video port for LVDS output (panel or connector).
8b0d47e879b8fe Vinay Simha BN      2020-07-10   76  
8b0d47e879b8fe Vinay Simha BN      2020-07-10   77        port@2:
b67554232307e7 Rob Herring         2021-01-04   78          $ref: /schemas/graph.yaml#/properties/port
8b0d47e879b8fe Vinay Simha BN      2020-07-10   79          description: |
8b0d47e879b8fe Vinay Simha BN      2020-07-10   80            Video port for Dual link LVDS output (panel or connector).
8b0d47e879b8fe Vinay Simha BN      2020-07-10   81  
8b0d47e879b8fe Vinay Simha BN      2020-07-10   82      required:
8b0d47e879b8fe Vinay Simha BN      2020-07-10   83        - port@0
8b0d47e879b8fe Vinay Simha BN      2020-07-10   84        - port@1
8b0d47e879b8fe Vinay Simha BN      2020-07-10   85  
6b27cbab742a1a Tony Lindgren       2024-02-11   86  allOf:
6b27cbab742a1a Tony Lindgren       2024-02-11  @87    - if:
6b27cbab742a1a Tony Lindgren       2024-02-11   88      properties:
6b27cbab742a1a Tony Lindgren       2024-02-11   89        compatible:
6b27cbab742a1a Tony Lindgren       2024-02-11   90          contains:
6b27cbab742a1a Tony Lindgren       2024-02-11   91            const: toshiba,tc358765
6b27cbab742a1a Tony Lindgren       2024-02-11   92      then:
6b27cbab742a1a Tony Lindgren       2024-02-11   93        stby-gpios: false
6b27cbab742a1a Tony Lindgren       2024-02-11   94  
8b0d47e879b8fe Vinay Simha BN      2020-07-10   95  required:
8b0d47e879b8fe Vinay Simha BN      2020-07-10   96    - compatible
8b0d47e879b8fe Vinay Simha BN      2020-07-10   97    - reg
8b0d47e879b8fe Vinay Simha BN      2020-07-10   98    - vdd-supply
8b0d47e879b8fe Vinay Simha BN      2020-07-10   99    - vddio-supply
8b0d47e879b8fe Vinay Simha BN      2020-07-10  100    - reset-gpios
8b0d47e879b8fe Vinay Simha BN      2020-07-10  101    - ports
8b0d47e879b8fe Vinay Simha BN      2020-07-10  102  
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#8 lore raw

Re: [PATCH v3 03/10] dt-bindings: display: bridge: tc358775: Add support for tc358765

In reply to Tony Lindgren
Quoted 9 lines · Tony Lindgren

The tc358765 is similar to tc358775. The tc358765 just an earlier version of the hardware, and it's pin and register compatible with tc358775 for most part.

From the binding point of view the only difference is that the tc358765 does not have stdby-gpios.

---

It does not look like you tested the bindings, at least after quick look. Please run make dt_binding_check (see Documentation/devicetree/bindings/writing-schema.rst for instructions). Maybe you need to update your dtschema and yamllint.

Best regards,
Krzysztof

#9 lore raw

Re: [PATCH v3 03/10] dt-bindings: display: bridge: tc358775: Add support for tc358765

Quoted 8 lines · Krzysztof Kozlowski
Quoted 7 lines · Tony Lindgren

The tc358765 is similar to tc358775. The tc358765 just an earlier version of the hardware, and it's pin and register compatible with tc358775 for most part.

From the binding point of view the only difference is that the tc358765 does not have stdby-gpios.

Quoted 7 lines
Quoted 2 lines

---

It does not look like you tested the bindings, at least after quick look. Please run make dt_binding_check (see Documentation/devicetree/bindings/writing-schema.rst for instructions). Maybe you need to update your dtschema and yamllint.

I did.. But I did not notice that this no longer works:

$ make dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/display/bridge/toshiba,tc358775.yaml
  LINT    Documentation/devicetree/bindings
usage: yamllint [-h] [-] [-c CONFIG_FILE | -d CONFIG_DATA] [--list-files] [-f {parsable,standard,colored,github,auto}] [-s] [--no-warnings] [-v] [FILE_OR_DIR ...]
yamllint: error: one of the arguments FILE_OR_DIR - is required
  CHKDT   Documentation/devicetree/bindings/processed-schema.json
  SCHEMA  Documentation/devicetree/bindings/processed-schema.json

After removing the ">2&1" from the Makefile, there's some more info:

yamllint: error: one of the arguments FILE_OR_DIR - is required

Where DT_SCHEMA_FILES ends up empty. I guess dt_binding_check needs to be now run with just:

$ make dt_binding_check DT_SCHEMA_FILES=toshiba,tc358775.yaml

Regards,

Tony

#10 lore raw

Re: [PATCH v3 03/10] dt-bindings: display: bridge: tc358775: Add support for tc358765

Quoted 26 lines · Tony Lindgren
Quoted 8 lines · Krzysztof Kozlowski
Quoted 7 lines · Tony Lindgren

The tc358765 is similar to tc358775. The tc358765 just an earlier version of the hardware, and it's pin and register compatible with tc358775 for most part.

From the binding point of view the only difference is that the tc358765 does not have stdby-gpios.

Quoted 7 lines
Quoted 2 lines

---

It does not look like you tested the bindings, at least after quick look. Please run make dt_binding_check (see Documentation/devicetree/bindings/writing-schema.rst for instructions). Maybe you need to update your dtschema and yamllint.

I did.. But I did not notice that this no longer works:

$ make dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/display/bridge/toshiba,tc358775.yaml
  LINT    Documentation/devicetree/bindings
usage: yamllint [-h] [-] [-c CONFIG_FILE | -d CONFIG_DATA] [--list-files] [-f {parsable,standard,colored,github,auto}] [-s] [--no-warnings] [-v] [FILE_OR_DIR ...]
yamllint: error: one of the arguments FILE_OR_DIR - is required
  CHKDT   Documentation/devicetree/bindings/processed-schema.json
  SCHEMA  Documentation/devicetree/bindings/processed-schema.json
Quoted 9 lines

After removing the ">2&1" from the Makefile, there's some more info:

yamllint: error: one of the arguments FILE_OR_DIR - is required

Where DT_SCHEMA_FILES ends up empty. I guess dt_binding_check needs to be now run with just:

$ make dt_binding_check DT_SCHEMA_FILES=toshiba,tc358775.yaml

Yes, since June last year. Rob later brought (in July) backwards compatible way, but apparently something changed now in Makefile.

Anyway full Linux path should be considered deprecated. The same for dtbs_check.

Best regards,
Krzysztof

maintainer
#11 lore raw

Re: [PATCH v3 03/10] dt-bindings: display: bridge: tc358775: Add support for tc358765

Quoted 31 lines · Krzysztof Kozlowski
Quoted 30 lines · Tony Lindgren
Quoted 8 lines · Krzysztof Kozlowski
Quoted 7 lines · Tony Lindgren

The tc358765 is similar to tc358775. The tc358765 just an earlier version of the hardware, and it's pin and register compatible with tc358775 for most part.

From the binding point of view the only difference is that the tc358765 does not have stdby-gpios.

Quoted 7 lines
Quoted 2 lines

---

It does not look like you tested the bindings, at least after quick look. Please run make dt_binding_check (see Documentation/devicetree/bindings/writing-schema.rst for instructions). Maybe you need to update your dtschema and yamllint.

I did.. But I did not notice that this no longer works:

$ make dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/display/bridge/toshiba,tc358775.yaml
  LINT    Documentation/devicetree/bindings
usage: yamllint [-h] [-] [-c CONFIG_FILE | -d CONFIG_DATA] [--list-files] [-f {parsable,standard,colored,github,auto}] [-s] [--no-warnings] [-v] [FILE_OR_DIR ...]
yamllint: error: one of the arguments FILE_OR_DIR - is required
  CHKDT   Documentation/devicetree/bindings/processed-schema.json
  SCHEMA  Documentation/devicetree/bindings/processed-schema.json

After removing the ">2&1" from the Makefile, there's some more info:

yamllint: error: one of the arguments FILE_OR_DIR - is required

Quoted 8 lines
Quoted 5 lines

Where DT_SCHEMA_FILES ends up empty. I guess dt_binding_check needs to be now run with just:

$ make dt_binding_check DT_SCHEMA_FILES=toshiba,tc358775.yaml

Yes, since June last year. Rob later brought (in July) backwards compatible way, but apparently something changed now in Makefile.

It broke in 6.8-rc1. I have a fix in my tree which I'll send to Linus this week.

Rob

#12 lore raw

Re: [PATCH v3 03/10] dt-bindings: display: bridge: tc358775: Add support for tc358765

Quoted 14 lines · Rob Herring
Quoted 13 lines · Krzysztof Kozlowski
Quoted 12 lines · Tony Lindgren

usage: yamllint [-h] [-] [-c CONFIG_FILE | -d CONFIG_DATA] [--list-files] [-f {parsable,standard,colored,github,auto}] [-s] [--no-warnings] [-v] [FILE_OR_DIR ...]
yamllint: error: one of the arguments FILE_OR_DIR - is required
CHKDT Documentation/devicetree/bindings/processed-schema.json
SCHEMA Documentation/devicetree/bindings/processed-schema.json

After removing the ">2&1" from the Makefile, there's some more info:

yamllint: error: one of the arguments FILE_OR_DIR - is required

Where DT_SCHEMA_FILES ends up empty. I guess dt_binding_check needs to be now run with just:

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
$ make dt_binding_check DT_SCHEMA_FILES=toshiba,tc358775.yaml

Yes, since June last year. Rob later brought (in July) backwards compatible way, but apparently something changed now in Makefile.

It broke in 6.8-rc1. I have a fix in my tree which I'll send to Linus this week.

OK good to hear, thanks!

Tony

#13 lore raw

PATCH v3 4/10 drm/bridge: tc358775: fix support for jeida-18 and jeida-24

In reply to Tony Lindgren

From: Michael Walle <[email protected]>

The bridge always uses 24bpp internally. Therefore, for jeida-18 mapping we need to discard the lowest two bits for each channel and thus starting with LV_[RGB]2. jeida-24 has the same mapping but uses four lanes instead of three, with the forth pair transmitting the lowest two bits of each channel. Thus, the mapping between jeida-18 and jeida-24 is actually the same, except that one channel is turned off (by selecting the RGB666 format in VPCTRL).

While at it, remove the bogus comment about the hardware default because the default is overwritten in any case.

Tested with a jeida-18 display (Evervision VGG644804).

Fixes b26975593b17 ("display/drm/bridge: TC358775 DSI/LVDS driver")
---
 drivers/gpu/drm/bridge/tc358775.c | 21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)
drivers/gpu/drm/bridge/tc358775.c +9 -12
@@ -454,10 +454,6 @@ static void tc_bridge_enable(struct drm_bridge *bridge)
 	dev_dbg(tc->dev, "bus_formats %04x bpc %d\n",
 		connector->display_info.bus_formats[0],
 		tc->bpc);
-	/*
-	 * Default hardware register settings of tc358775 configured
-	 * with MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA jeida-24 format
-	 */
 	if (connector->display_info.bus_formats[0] ==
 		MEDIA_BUS_FMT_RGB888_1X7X4_SPWG) {
 		/* VESA-24 */
@@ -468,14 +464,15 @@ static void tc_bridge_enable(struct drm_bridge *bridge)
 		d2l_write(tc->i2c, LV_MX1619, LV_MX(LVI_B6, LVI_B7, LVI_B1, LVI_B2));
 		d2l_write(tc->i2c, LV_MX2023, LV_MX(LVI_B3, LVI_B4, LVI_B5, LVI_L0));
 		d2l_write(tc->i2c, LV_MX2427, LV_MX(LVI_HS, LVI_VS, LVI_DE, LVI_R6));
-	} else { /*  MEDIA_BUS_FMT_RGB666_1X7X3_SPWG - JEIDA-18 */
-		d2l_write(tc->i2c, LV_MX0003, LV_MX(LVI_R0, LVI_R1, LVI_R2, LVI_R3));
-		d2l_write(tc->i2c, LV_MX0407, LV_MX(LVI_R4, LVI_L0, LVI_R5, LVI_G0));
-		d2l_write(tc->i2c, LV_MX0811, LV_MX(LVI_G1, LVI_G2, LVI_L0, LVI_L0));
-		d2l_write(tc->i2c, LV_MX1215, LV_MX(LVI_G3, LVI_G4, LVI_G5, LVI_B0));
-		d2l_write(tc->i2c, LV_MX1619, LV_MX(LVI_L0, LVI_L0, LVI_B1, LVI_B2));
-		d2l_write(tc->i2c, LV_MX2023, LV_MX(LVI_B3, LVI_B4, LVI_B5, LVI_L0));
-		d2l_write(tc->i2c, LV_MX2427, LV_MX(LVI_HS, LVI_VS, LVI_DE, LVI_L0));
+	} else {
+		/* JEIDA-18 and JEIDA-24 */
+		d2l_write(tc->i2c, LV_MX0003, LV_MX(LVI_R2, LVI_R3, LVI_R4, LVI_R5));
+		d2l_write(tc->i2c, LV_MX0407, LV_MX(LVI_R6, LVI_R1, LVI_R7, LVI_G2));
+		d2l_write(tc->i2c, LV_MX0811, LV_MX(LVI_G3, LVI_G4, LVI_G0, LVI_G1));
+		d2l_write(tc->i2c, LV_MX1215, LV_MX(LVI_G5, LVI_G6, LVI_G7, LVI_B2));
+		d2l_write(tc->i2c, LV_MX1619, LV_MX(LVI_B0, LVI_B1, LVI_B3, LVI_B4));
+		d2l_write(tc->i2c, LV_MX2023, LV_MX(LVI_B5, LVI_B6, LVI_B7, LVI_L0));
+		d2l_write(tc->i2c, LV_MX2427, LV_MX(LVI_HS, LVI_VS, LVI_DE, LVI_R0));
 	}
 
 	d2l_write(tc->i2c, VFUEN, VFUEN_EN);
Signature · 1 line
2.43.0
#14 lore raw

PATCH v3 5/10 drm/bridge: tc358775: make standby GPIO optional

In reply to Tony Lindgren

From: Michael Walle <[email protected]>

The stby pin is optional. It is only needed for power-up and down sequencing. It is not needed, if the power rails cannot by dynamically enabled.

Because the GPIO is now optional, remove the error message.

---
 drivers/gpu/drm/bridge/tc358775.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/gpu/drm/bridge/tc358775.c +3 -6
@@ -669,12 +669,9 @@ static int tc_probe(struct i2c_client *client)
 		return ret;
 	}
 
-	tc->stby_gpio = devm_gpiod_get(dev, "stby", GPIOD_OUT_HIGH);
-	if (IS_ERR(tc->stby_gpio)) {
-		ret = PTR_ERR(tc->stby_gpio);
-		dev_err(dev, "cannot get stby-gpio %d\n", ret);
-		return ret;
-	}
+	tc->stby_gpio = devm_gpiod_get_optional(dev, "stby", GPIOD_OUT_HIGH);
+	if (IS_ERR(tc->stby_gpio))
+		return PTR_ERR(tc->stby_gpio);
 
 	tc->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH);
 	if (IS_ERR(tc->reset_gpio)) {
Signature · 1 line
2.43.0
#15 lore raw

PATCH v3 6/10 drm/bridge: tc358775: Get bridge data lanes instead of the DSI host lanes

In reply to Tony Lindgren

The current code assumes the data-lanes property is configured on the DSI host side instead of the bridge side, and assumes DSI host endpoint 1.

Let's standardize on what the other bridge drivers are doing and parse the data-lanes property for the bridge. Only if data-lanes property is not found, let's be nice and also check the DSI host for old dtb in use and warn.

And as Dmitry pointed out, the lanes for the host and the bridge may be different because the lanes may be swapped on the host side.

---
 drivers/gpu/drm/bridge/tc358775.c | 25 +++++++++++--------------
 1 file changed, 11 insertions(+), 14 deletions(-)
drivers/gpu/drm/bridge/tc358775.c +11 -14
@@ -525,27 +525,24 @@ tc_mode_valid(struct drm_bridge *bridge,
 static int tc358775_parse_dt(struct device_node *np, struct tc_data *tc)
 {
 	struct device_node *endpoint;
-	struct device_node *parent;
 	struct device_node *remote;
 	int dsi_lanes = -1;
 
-	/*
-	 * To get the data-lanes of dsi, we need to access the dsi0_out of port1
-	 *  of dsi0 endpoint from bridge port0 of d2l_in
-	 */
 	endpoint = of_graph_get_endpoint_by_regs(tc->dev->of_node,
 						 TC358775_DSI_IN, -1);
-	if (endpoint) {
-		/* dsi0_out node */
-		parent = of_graph_get_remote_port_parent(endpoint);
-		of_node_put(endpoint);
-		if (parent) {
-			/* dsi0 port 1 */
-			dsi_lanes = drm_of_get_data_lanes_count_ep(parent, 1, -1, 1, 4);
-			of_node_put(parent);
-		}
+	dsi_lanes = drm_of_get_data_lanes_count(endpoint, 1, 4);
+
+	/* Quirk old dtb: Use data lanes from the DSI host side instead of bridge */
+	if (dsi_lanes == -EINVAL || dsi_lanes == -ENODEV) {
+		remote = of_graph_get_remote_endpoint(endpoint);
+		dsi_lanes = drm_of_get_data_lanes_count(remote, 1, 4);
+		of_node_put(remote);
+		if (dsi_lanes >= 1)
+			dev_warn(tc->dev, "no dsi-lanes for the bridge, using host lanes\n");
 	}
 
+	of_node_put(endpoint);
+
 	if (dsi_lanes < 0)
 		return dsi_lanes;
 
Signature · 1 line
2.43.0
#16 lore raw

PATCH v3 7/10 drm/bridge: tc358775: Add burst and low-power modes

In reply to Tony Lindgren

Burst and low-power modes are supported both for tc358765 and tc358775.

---
 drivers/gpu/drm/bridge/tc358775.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/bridge/tc358775.c +2 -1
@@ -619,7 +619,8 @@ static int tc_attach_host(struct tc_data *tc)
 
 	dsi->lanes = tc->num_dsi_lanes;
 	dsi->format = MIPI_DSI_FMT_RGB888;
-	dsi->mode_flags = MIPI_DSI_MODE_VIDEO;
+	dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST |
+			  MIPI_DSI_MODE_LPM;
 
 	ret = devm_mipi_dsi_attach(dev, dsi);
 	if (ret < 0) {
Signature · 1 line
2.43.0
#17 lore raw

PATCH v3 8/10 drm/bridge: tc358775: Enable pre_enable_prev_first flag

In reply to Tony Lindgren

Set pre_enable_prev_first to ensure the previous bridge is enabled first.

---
 drivers/gpu/drm/bridge/tc358775.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/bridge/tc358775.c +1 -0
@@ -680,6 +680,7 @@ static int tc_probe(struct i2c_client *client)
 
 	tc->bridge.funcs = &tc_bridge_funcs;
 	tc->bridge.of_node = dev->of_node;
+	tc->bridge.pre_enable_prev_first = true;
 	drm_bridge_add(&tc->bridge);
 
 	i2c_set_clientdata(client, tc);
Signature · 1 line
2.43.0
#18 lore raw

PATCH v3 9/10 drm/bridge: tc358775: Add support for tc358765

In reply to Tony Lindgren

The tc358775 bridge is pin compatible with earlier tc358765 according to the tc358774xbg_datasheet_en_20190118.pdf documentation. Compared to the tc358765, the tc358775 supports a STBY GPIO and higher data rates.

The tc358765 has a register bit for video event mode vs video pulse mode. We must set it to video event mode for the LCD output to work, and on the tc358775, this bit no longer exists.

Looks like the registers seem to match otherwise based on a quick glance comparing the defines to the earlier Android kernel tc358765 driver.

---
 drivers/gpu/drm/bridge/tc358775.c | 26 ++++++++++++++++++++++----
 1 file changed, 22 insertions(+), 4 deletions(-)
drivers/gpu/drm/bridge/tc358775.c +22 -4
@@ -15,6 +15,7 @@
 #include <linux/kernel.h>
 #include <linux/media-bus-format.h>
 #include <linux/module.h>
+#include <linux/of_device.h>
 #include <linux/regulator/consumer.h>
 #include <linux/slab.h>
 
@@ -107,6 +108,7 @@
 #define RDPKTLN         0x0404  /* Command Read Packet Length */
 
 #define VPCTRL          0x0450  /* Video Path Control */
+#define EVTMODE		BIT(5)  /* Video event mode enable, tc35876x only */
 #define HTIM1           0x0454  /* Horizontal Timing Control 1 */
 #define HTIM2           0x0458  /* Horizontal Timing Control 2 */
 #define VTIM1           0x045C  /* Vertical Timing Control 1 */
@@ -254,6 +256,11 @@ enum tc358775_ports {
 	TC358775_LVDS_OUT1,
 };
 
+enum tc3587x5_type {
+	TC358765 = 0x65,
+	TC358775 = 0x75,
+};
+
 struct tc_data {
 	struct i2c_client	*i2c;
 	struct device		*dev;
@@ -271,6 +278,8 @@ struct tc_data {
 	struct gpio_desc	*stby_gpio;
 	u8			lvds_link; /* single-link or dual-link */
 	u8			bpc;
+
+	enum tc3587x5_type	type;
 };
 
 static inline struct tc_data *bridge_to_tc(struct drm_bridge *b)
@@ -424,10 +433,16 @@ static void tc_bridge_enable(struct drm_bridge *bridge)
 	d2l_write(tc->i2c, PPI_STARTPPI, PPI_START_FUNCTION);
 	d2l_write(tc->i2c, DSI_STARTDSI, DSI_RX_START);
 
+	/* Video event mode vs pulse mode bit, does not exist for tc358775 */
+	if (tc->type == TC358765)
+		val = EVTMODE;
+	else
+		val = 0;
+
 	if (tc->bpc == 8)
-		val = TC358775_VPCTRL_OPXLFMT(1);
+		val |= TC358775_VPCTRL_OPXLFMT(1);
 	else /* bpc = 6; */
-		val = TC358775_VPCTRL_MSF(1);
+		val |= TC358775_VPCTRL_MSF(1);
 
 	dsiclk = mode->crtc_clock * 3 * tc->bpc / tc->num_dsi_lanes / 1000;
 	clkdiv = dsiclk / (tc->lvds_link == DUAL_LINK ? DIVIDE_BY_6 : DIVIDE_BY_3);
@@ -643,6 +658,7 @@ static int tc_probe(struct i2c_client *client)
 
 	tc->dev = dev;
 	tc->i2c = client;
+	tc->type = (enum tc3587x5_type)(unsigned long)of_device_get_match_data(dev);
 
 	tc->panel_bridge = devm_drm_of_get_bridge(dev, dev->of_node,
 						  TC358775_LVDS_OUT0, 0);
@@ -704,13 +720,15 @@ static void tc_remove(struct i2c_client *client)
 }
 
 static const struct i2c_device_id tc358775_i2c_ids[] = {
-	{ "tc358775", 0 },
+	{ "tc358765", TC358765, },
+	{ "tc358775", TC358775, },
 	{ }
 };
 MODULE_DEVICE_TABLE(i2c, tc358775_i2c_ids);
 
 static const struct of_device_id tc358775_of_ids[] = {
-	{ .compatible = "toshiba,tc358775", },
+	{ .compatible = "toshiba,tc358765", .data = (void *)TC358765, },
+	{ .compatible = "toshiba,tc358775", .data = (void *)TC358775, },
 	{ }
 };
 MODULE_DEVICE_TABLE(of, tc358775_of_ids);
Signature · 1 line
2.43.0
#19 lore raw

PATCH v3 10/10 drm/bridge: tc358775: Configure hs_rate and lp_rate

In reply to Tony Lindgren

The hs_rate and lp_rate may be used by the dsi host for timing calculations. The tc358775 has a maximum bit rate of 1 Gbps/lane, tc358765 has maximurate of 800 Mbps per lane.

---
 drivers/gpu/drm/bridge/tc358775.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
drivers/gpu/drm/bridge/tc358775.c +13 -0
@@ -637,6 +637,19 @@ static int tc_attach_host(struct tc_data *tc)
 	dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST |
 			  MIPI_DSI_MODE_LPM;
 
+	/*
+	 * The hs_rate and lp_rate are data rate values. The HS mode is
+	 * differential, while the LP mode is single ended. As the HS mode
+	 * uses DDR, the DSI clock frequency is half the hs_rate. The 10 Mbs
+	 * data rate for LP mode is not specified in the bridge data sheet,
+	 * but seems to be part of the MIPI DSI spec.
+	 */
+	if (tc->type == TC358765)
+		dsi->hs_rate = 800000000;
+	else
+		dsi->hs_rate = 1000000000;
+	dsi->lp_rate = 10000000;
+
 	ret = devm_mipi_dsi_attach(dev, dsi);
 	if (ret < 0) {
 		dev_err(dev, "failed to attach dsi to host\n");
Signature · 1 line
2.43.0
Reviewed-by on v3 10/10
#20 lore raw

Re: [PATCH v3 10/10] drm/bridge: tc358775: Configure hs_rate and lp_rate

Quoted 5 lines · Tony Lindgren

The hs_rate and lp_rate may be used by the dsi host for timing calculations. The tc358775 has a maximum bit rate of 1 Gbps/lane, tc358765 has maximurate of 800 Mbps per lane.

-michael