Skip to contentSkip to conversation

MIPI DSI Controller support for SAM9X75 series

PATCH Superseded Manikandan Muralidharan 3 participants 11 messages Aug 14, 2024 – Sep 18, 2024

Subsystems (6)

v3 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v3 cover MIPI DSI Controller support for SAM9X75 series

This patch series adds support for the Microchip's MIPI DSI Controller wrapper driver that uses the Synopsys DesignWare MIPI DSI host controller bridge for SAM9X75 SoC series.

Changelogs are available in respective patches.

Manikandan Muralidharan (4):
dt-bindings: display: bridge: add sam9x75-mipi-dsi binding drm/bridge: add Microchip DSI controller support for sam9x7 SoC series
MAINTAINERS: add SAM9X7 SoC's Microchip's MIPI DSI host wrapper driver
ARM: configs: at91: Enable Microchip's MIPI DSI Host Controller
support

 .../bridge/microchip,sam9x75-mipi-dsi.yaml    | 116 ++++
 MAINTAINERS                                   |   7 +
 arch/arm/configs/at91_dt_defconfig            |   1 +
 drivers/gpu/drm/bridge/Kconfig                |   8 +
 drivers/gpu/drm/bridge/Makefile               |   1 +
 drivers/gpu/drm/bridge/dw-mipi-dsi-mchp.c     | 544 ++++++++++++++++++
 6 files changed, 677 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/bridge/microchip,sam9x75-mipi-dsi.yaml
 create mode 100644 drivers/gpu/drm/bridge/dw-mipi-dsi-mchp.c
Signature · 1 line
2.25.1
#1 lore raw

PATCH v3 1/4 dt-bindings: display: bridge: add sam9x75-mipi-dsi binding

Add the 'sam9x75-mipi-dsi' compatible binding, which describes the Microchip's specific wrapper for the Synopsys DesignWare MIPI DSI HOST Controller for the sam9x75 series System-on-Chip (SoC) devices.

---
changes in v3:
- Describe the clocks used

changes in v2:
- List the clocks with description
- remove describing 'remove-endpoint' properties
- remove unused label, node and fix example DT indentation
- cosmetic fixes

---
 .../bridge/microchip,sam9x75-mipi-dsi.yaml    | 116 ++++++++++++++++++
 1 file changed, 116 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/bridge/microchip,sam9x75-mipi-dsi.yaml
Documentation/devicetree/bindings/display/bridge/microchip,sam9x75-mipi-dsi.yaml new file +116 -0
new file mode 100644
index 000000000000..3c86f0cd49e9
@@ -0,0 +1,116 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/bridge/microchip,sam9x75-mipi-dsi.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Microchip SAM9X75 MIPI DSI Controller
+
+maintainers:
+  - Manikandan Muralidharan <[email protected]>
+
+description:
+  Microchip specific extensions or wrapper to the Synopsys Designware MIPI DSI.
+  The MIPI Display Serial Interface (DSI) Host Controller implements all
+  protocol functions defined in the MIPI DSI Specification.The DSI Host
+  provides an interface between the LCD Controller (LCDC) and the MIPI D-PHY,
+  allowing communication with a DSI-compliant display.
+
+allOf:
+  - $ref: /schemas/display/dsi-controller.yaml#
+
+properties:
+  compatible:
+    const: microchip,sam9x75-mipi-dsi
+
+  reg:
+    maxItems: 1
+
+  clocks:
+    items:
+      - description:
+          Peripheral Bus Clock between LCDC and MIPI DPHY
+      - description:
+          MIPI DPHY Interface reference clock for PLL block
+
+  clock-names:
+    items:
+      - const: pclk
+      - const: refclk
+
+  microchip,sfr:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description:
+      phandle to Special Function Register (SFR) node.To enable the DSI/CSI
+      selection bit in SFR's ISS Configuration Register.
+
+  ports:
+    $ref: /schemas/graph.yaml#/properties/ports
+
+    properties:
+      port@0:
+        $ref: /schemas/graph.yaml#/$defs/port-base
+        unevaluatedProperties: false
+        description:
+          DSI Input port node, connected to the LCDC RGB output port.
+
+        properties:
+          endpoint:
+            $ref: /schemas/media/video-interfaces.yaml#
+            unevaluatedProperties: false
+
+      port@1:
+        $ref: /schemas/graph.yaml#/$defs/port-base
+        unevaluatedProperties: false
+        description:
+          DSI Output port node, connected to a panel or a bridge input port.
+
+        properties:
+          endpoint:
+            $ref: /schemas/media/video-interfaces.yaml#
+            unevaluatedProperties: false
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - clock-names
+  - ports
+
+unevaluatedProperties: false
+
+examples:
+  - |
+     #include <dt-bindings/clock/at91.h>
+     #include <dt-bindings/gpio/gpio.h>
+
+     dsi@f8054000 {
+       compatible = "microchip,sam9x75-mipi-dsi";
+       reg = <0xf8054000 0x200>;
+       clocks = <&pmc PMC_TYPE_PERIPHERAL 54>, <&pmc PMC_TYPE_GCK 55>;
+       clock-names = "pclk", "refclk";
+       microchip,sfr = <&sfr>;
+
+       #address-cells = <1>;
+       #size-cells = <0>;
+
+       ports {
+         #address-cells = <1>;
+         #size-cells = <0>;
+
+         port@0 {
+           reg = <0>;
+           dsi_in: endpoint {
+             remote-endpoint = <&hlcdc_panel_output>;
+           };
+         };
+
+         port@1 {
+           reg = <1>;
+           dsi_out: endpoint {
+             remote-endpoint = <&mipi_in_panel>;
+           };
+         };
+       };
+     };
+...
Signature · 1 line
2.25.1
#2 lore raw

Re: [PATCH v3 1/4] dt-bindings: display: bridge: add sam9x75-mipi-dsi binding

Quoted 60 lines · Manikandan Muralidharan

Add the 'sam9x75-mipi-dsi' compatible binding, which describes the Microchip's specific wrapper for the Synopsys DesignWare MIPI DSI HOST Controller for the sam9x75 series System-on-Chip (SoC) devices.

---
changes in v3:
- Describe the clocks used

changes in v2:
- List the clocks with description
- remove describing 'remove-endpoint' properties
- remove unused label, node and fix example DT indentation
- cosmetic fixes

---
 .../bridge/microchip,sam9x75-mipi-dsi.yaml    | 116 ++++++++++++++++++
 1 file changed, 116 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/bridge/microchip,sam9x75-mipi-dsi.yaml
Documentation/devicetree/bindings/display/bridge/microchip,sam9x75-mipi-dsi.yaml new file +35 -0
new file mode 100644
index 000000000000..3c86f0cd49e9
@@ -0,0 +1,116 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/bridge/microchip,sam9x75-mipi-dsi.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Microchip SAM9X75 MIPI DSI Controller
+
+maintainers:
+  - Manikandan Muralidharan <[email protected]>
+
+description:
+  Microchip specific extensions or wrapper to the Synopsys Designware MIPI DSI.
+  The MIPI Display Serial Interface (DSI) Host Controller implements all
+  protocol functions defined in the MIPI DSI Specification.The DSI Host
+  provides an interface between the LCD Controller (LCDC) and the MIPI D-PHY,
+  allowing communication with a DSI-compliant display.
+
+allOf:
+  - $ref: /schemas/display/dsi-controller.yaml#
+
+properties:
+  compatible:
+    const: microchip,sam9x75-mipi-dsi
+
+  reg:
+    maxItems: 1
+
+  clocks:
+    items:
+      - description:
+          Peripheral Bus Clock between LCDC and MIPI DPHY
+      - description:
+          MIPI DPHY Interface reference clock for PLL block
+

Documentation/devicetree/bindings/display/bridge/microchip,sam9x75-mipi-dsi.yaml line 45

Quoted 10 lines
Documentation/devicetree/bindings/display/bridge/microchip,sam9x75-mipi-dsi.yaml new file +10 -0
+  clock-names:
+    items:
+      - const: pclk
+      - const: refclk
+
+  microchip,sfr:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description:
+      phandle to Special Function Register (SFR) node.To enable the DSI/CSI
+      selection bit in SFR's ISS Configuration Register.

I'm curious - why is this phandle required? How many SFR nodes are there on the platform?

#3 lore raw

Re: [PATCH v3 1/4] dt-bindings: display: bridge: add sam9x75-mipi-dsi binding

Hi Conor,

Quoted 65 lines · Conor Dooley
Quoted 64 lines · Manikandan Muralidharan

Add the 'sam9x75-mipi-dsi' compatible binding, which describes the Microchip's specific wrapper for the Synopsys DesignWare MIPI DSI HOST Controller for the sam9x75 series System-on-Chip (SoC) devices.

---
changes in v3:
- Describe the clocks used

changes in v2:
- List the clocks with description
- remove describing 'remove-endpoint' properties
- remove unused label, node and fix example DT indentation
- cosmetic fixes

---
  .../bridge/microchip,sam9x75-mipi-dsi.yaml    | 116 ++++++++++++++++++
  1 file changed, 116 insertions(+)

create mode 100644 Documentation/devicetree/bindings/display/bridge/microchip,sam9x75-mipi-dsi.yaml

Documentation/devicetree/bindings/display/bridge/microchip,sam9x75-mipi-dsi.yaml new file +39 -0
new file mode 100644
index 000000000000..3c86f0cd49e9
@@ -0,0 +1,116 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id:http://devicetree.org/schemas/display/bridge/microchip,sam9x75-mipi-dsi.yaml#
+$schema:http://devicetree.org/meta-schemas/core.yaml#
+
+title: Microchip SAM9X75 MIPI DSI Controller
+
+maintainers:
+  - Manikandan Muralidharan<[email protected]>
+
+description:
+  Microchip specific extensions or wrapper to the Synopsys Designware MIPI DSI.
+  The MIPI Display Serial Interface (DSI) Host Controller implements all
+  protocol functions defined in the MIPI DSI Specification.The DSI Host
+  provides an interface between the LCD Controller (LCDC) and the MIPI D-PHY,
+  allowing communication with a DSI-compliant display.
+
+allOf:
+  - $ref: /schemas/display/dsi-controller.yaml#
+
+properties:
+  compatible:
+    const: microchip,sam9x75-mipi-dsi
+
+  reg:
+    maxItems: 1
+
+  clocks:
+    items:
+      - description:
+          Peripheral Bus Clock between LCDC and MIPI DPHY
+      - description:
+          MIPI DPHY Interface reference clock for PLL block
+
+  clock-names:
+    items:
+      - const: pclk
+      - const: refclk
Quoted 8 lines

Documentation/devicetree/bindings/display/bridge/microchip,sam9x75-mipi-dsi.yaml line 45

Quoted 6 lines
Documentation/devicetree/bindings/display/bridge/microchip,sam9x75-mipi-dsi.yaml new file +6 -0
+
+  microchip,sfr:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description:
+      phandle to Special Function Register (SFR) node.To enable the DSI/CSI
+      selection bit in SFR's ISS Configuration Register.

I'm curious - why is this phandle required? How many SFR nodes are there on the platform?

This phandle is to map the memory region of SFR node and configure the DSI bit in the SFR's ISS configuration register.
currently there is only one SFR node in this platform.

Signature · 2 lines
Thanks and Regards,
Manikandan M.
#4 lore raw

Re: [PATCH v3 1/4] dt-bindings: display: bridge: add sam9x75-mipi-dsi binding

Quoted 76 lines · On Tue, Sep 17, 2024 at 03:16:53AM +0000, [email protected] wrote:

Hi Conor,

Quoted 65 lines · Conor Dooley
Quoted 64 lines · Manikandan Muralidharan

Add the 'sam9x75-mipi-dsi' compatible binding, which describes the Microchip's specific wrapper for the Synopsys DesignWare MIPI DSI HOST Controller for the sam9x75 series System-on-Chip (SoC) devices.

---
changes in v3:
- Describe the clocks used

changes in v2:
- List the clocks with description
- remove describing 'remove-endpoint' properties
- remove unused label, node and fix example DT indentation
- cosmetic fixes

---
  .../bridge/microchip,sam9x75-mipi-dsi.yaml    | 116 ++++++++++++++++++
  1 file changed, 116 insertions(+)

create mode 100644 Documentation/devicetree/bindings/display/bridge/microchip,sam9x75-mipi-dsi.yaml

Documentation/devicetree/bindings/display/bridge/microchip,sam9x75-mipi-dsi.yaml new file +39 -0
new file mode 100644
index 000000000000..3c86f0cd49e9
@@ -0,0 +1,116 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id:http://devicetree.org/schemas/display/bridge/microchip,sam9x75-mipi-dsi.yaml#
+$schema:http://devicetree.org/meta-schemas/core.yaml#
+
+title: Microchip SAM9X75 MIPI DSI Controller
+
+maintainers:
+  - Manikandan Muralidharan<[email protected]>
+
+description:
+  Microchip specific extensions or wrapper to the Synopsys Designware MIPI DSI.
+  The MIPI Display Serial Interface (DSI) Host Controller implements all
+  protocol functions defined in the MIPI DSI Specification.The DSI Host
+  provides an interface between the LCD Controller (LCDC) and the MIPI D-PHY,
+  allowing communication with a DSI-compliant display.
+
+allOf:
+  - $ref: /schemas/display/dsi-controller.yaml#
+
+properties:
+  compatible:
+    const: microchip,sam9x75-mipi-dsi
+
+  reg:
+    maxItems: 1
+
+  clocks:
+    items:
+      - description:
+          Peripheral Bus Clock between LCDC and MIPI DPHY
+      - description:
+          MIPI DPHY Interface reference clock for PLL block
+
+  clock-names:
+    items:
+      - const: pclk
+      - const: refclk
Quoted 8 lines

Documentation/devicetree/bindings/display/bridge/microchip,sam9x75-mipi-dsi.yaml line 45

Quoted 6 lines
Documentation/devicetree/bindings/display/bridge/microchip,sam9x75-mipi-dsi.yaml new file +6 -0
+
+  microchip,sfr:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description:
+      phandle to Special Function Register (SFR) node.To enable the DSI/CSI
+      selection bit in SFR's ISS Configuration Register.

I'm curious - why is this phandle required? How many SFR nodes are there on the platform?

Quoted 3 lines

This phandle is to map the memory region of SFR node and configure the DSI bit in the SFR's ISS configuration register.
currently there is only one SFR node in this platform.

What does "currently" mean? The platform either has one or it does not, currently makes it sound like it has more than one but the dts only has one.

#5 lore raw

Re: [PATCH v3 1/4] dt-bindings: display: bridge: add sam9x75-mipi-dsi binding

Quoted 77 lines · Conor Dooley
Quoted 76 lines · On Tue, Sep 17, 2024 at 03:16:53AM +0000,[email protected] wrote:

Hi Conor,

Quoted 73 lines · Conor Dooley
Quoted 60 lines · Manikandan Muralidharan

Add the 'sam9x75-mipi-dsi' compatible binding, which describes the Microchip's specific wrapper for the Synopsys DesignWare MIPI DSI HOST Controller for the sam9x75 series System-on-Chip (SoC) devices.

---
changes in v3:
- Describe the clocks used

changes in v2:
- List the clocks with description
- remove describing 'remove-endpoint' properties
- remove unused label, node and fix example DT indentation
- cosmetic fixes

---
   .../bridge/microchip,sam9x75-mipi-dsi.yaml    | 116 ++++++++++++++++++
   1 file changed, 116 insertions(+)

create mode 100644 Documentation/devicetree/bindings/display/bridge/microchip,sam9x75-mipi-dsi.yaml

Documentation/devicetree/bindings/display/bridge/microchip,sam9x75-mipi-dsi.yaml new file +35 -0
new file mode 100644
index 000000000000..3c86f0cd49e9
@@ -0,0 +1,116 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id:http://devicetree.org/schemas/display/bridge/microchip,sam9x75-mipi-dsi.yaml#
+$schema:http://devicetree.org/meta-schemas/core.yaml#
+
+title: Microchip SAM9X75 MIPI DSI Controller
+
+maintainers:
+  - Manikandan Muralidharan<[email protected]>
+
+description:
+  Microchip specific extensions or wrapper to the Synopsys Designware MIPI DSI.
+  The MIPI Display Serial Interface (DSI) Host Controller implements all
+  protocol functions defined in the MIPI DSI Specification.The DSI Host
+  provides an interface between the LCD Controller (LCDC) and the MIPI D-PHY,
+  allowing communication with a DSI-compliant display.
+
+allOf:
+  - $ref: /schemas/display/dsi-controller.yaml#
+
+properties:
+  compatible:
+    const: microchip,sam9x75-mipi-dsi
+
+  reg:
+    maxItems: 1
+
+  clocks:
+    items:
+      - description:
+          Peripheral Bus Clock between LCDC and MIPI DPHY
+      - description:
+          MIPI DPHY Interface reference clock for PLL block
+

Documentation/devicetree/bindings/display/bridge/microchip,sam9x75-mipi-dsi.yaml line 45

Quoted 10 lines
Documentation/devicetree/bindings/display/bridge/microchip,sam9x75-mipi-dsi.yaml new file +10 -0
+  clock-names:
+    items:
+      - const: pclk
+      - const: refclk
+
+  microchip,sfr:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description:
+      phandle to Special Function Register (SFR) node.To enable the DSI/CSI
+      selection bit in SFR's ISS Configuration Register.

I'm curious - why is this phandle required? How many SFR nodes are there on the platform?

Quoted 6 lines
Quoted 3 lines

This phandle is to map the memory region of SFR node and configure the DSI bit in the SFR's ISS configuration register.
currently there is only one SFR node in this platform.

What does "currently" mean? The platform either has one or it does not, currently makes it sound like it has more than one but the dts only has one.

Apologies, I would like to clarify the statement that this platform only has one 32-bit special function register implemented.

Signature · 2 lines
Thanks and Regards,
Manikandan M.
#6 lore raw

Re: [PATCH v3 1/4] dt-bindings: display: bridge: add sam9x75-mipi-dsi binding

Quoted 14 lines · On Wed, Sep 18, 2024 at 03:00:45AM +0000, [email protected] wrote:
Quoted 13 lines · Conor Dooley
Quoted 12 lines · On Tue, Sep 17, 2024 at 03:16:53AM +0000,[email protected] wrote:

Hi Conor,

Quoted 9 lines · Conor Dooley

Documentation/devicetree/bindings/display/bridge/microchip,sam9x75-mipi-dsi.yaml line 45

Quoted 5 lines · Manikandan Muralidharan
Documentation/devicetree/bindings/display/bridge/microchip,sam9x75-mipi-dsi.yaml new file +5 -0
+  microchip,sfr:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description:
+      phandle to Special Function Register (SFR) node.To enable the DSI/CSI
+      selection bit in SFR's ISS Configuration Register.

I'm curious - why is this phandle required? How many SFR nodes are there on the platform?

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

This phandle is to map the memory region of SFR node and configure the DSI bit in the SFR's ISS configuration register.
currently there is only one SFR node in this platform.

What does "currently" mean? The platform either has one or it does not, currently makes it sound like it has more than one but the dts only has one.

Apologies, I would like to clarify the statement that this platform only has one 32-bit special function register implemented.

In that case, you dont need a phandle at all, just look the sfr up by its compatible.

#7 lore raw

PATCH v3 2/4 drm/bridge: add Microchip DSI controller support for sam9x7 SoC series

In reply to Manikandan Muralidharan

Add the Microchip's DSI controller wrapper driver that uses the Synopsys DesignWare MIPI DSI host controller bridge.

---
changes in v3:
- make remove callback return void

changes in v2:
- use static const with global variables
- replace dev_err with dev_err_probe
- move clk_prepare_enable to simplify the error path
- use FIELD_PREP calls
- remove unused macros and unused functions
- rename function name with mchp_ suffix
- add suspend and resume pm calls to handle pllref_clk

---
 drivers/gpu/drm/bridge/Kconfig            |   8 +
 drivers/gpu/drm/bridge/Makefile           |   1 +
 drivers/gpu/drm/bridge/dw-mipi-dsi-mchp.c | 544 ++++++++++++++++++++++
 3 files changed, 553 insertions(+)
 create mode 100644 drivers/gpu/drm/bridge/dw-mipi-dsi-mchp.c
drivers/gpu/drm/bridge/Kconfig +8 -0
index c621be1a99a8..459ad9768234 100644
@@ -196,6 +196,14 @@ config DRM_MICROCHIP_LVDS_SERIALIZER
 	help
 	  Support for Microchip's LVDS serializer.
 
+config DRM_MICROCHIP_DW_MIPI_DSI
+	tristate "Microchip specific extensions for Synopsys DW MIPI DSI"
+	depends on DRM_ATMEL_HLCDC
+	select DRM_DW_MIPI_DSI
+	help
+	  This selects support for Microchip's SoC specific extensions
+	  for the Synopsys DesignWare dsi driver.
+
 config DRM_NWL_MIPI_DSI
 	tristate "Northwest Logic MIPI DSI Host controller"
 	depends on DRM
drivers/gpu/drm/bridge/Makefile +1 -0
index 7df87b582dca..aff5052100b9 100644
@@ -14,6 +14,7 @@ obj-$(CONFIG_DRM_LONTIUM_LT9611UXC) += lontium-lt9611uxc.o
 obj-$(CONFIG_DRM_LVDS_CODEC) += lvds-codec.o
 obj-$(CONFIG_DRM_MEGACHIPS_STDPXXXX_GE_B850V3_FW) += megachips-stdpxxxx-ge-b850v3-fw.o
 obj-$(CONFIG_DRM_MICROCHIP_LVDS_SERIALIZER) += microchip-lvds.o
+obj-$(CONFIG_DRM_MICROCHIP_DW_MIPI_DSI) += dw-mipi-dsi-mchp.o
 obj-$(CONFIG_DRM_NXP_PTN3460) += nxp-ptn3460.o
 obj-$(CONFIG_DRM_PARADE_PS8622) += parade-ps8622.o
 obj-$(CONFIG_DRM_PARADE_PS8640) += parade-ps8640.o
drivers/gpu/drm/bridge/dw-mipi-dsi-mchp.c new file +544 -0

544 lines not on this page · raw message

Signature · 1 line
2.25.1
#8 lore raw

Re: [PATCH v3 2/4] drm/bridge: add Microchip DSI controller support for sam9x7 SoC series

kernel test robot noticed the following build warnings:

Hi Manikandan,

kernel test robot noticed the following build warnings:

[auto build test WARNING on robh/for-next]
[also build test WARNING on drm-misc/drm-misc-next linus/master v6.11-rc3 next-20240816] [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/Manikandan-Muralidharan/dt-bindings-display-bridge-add-sam9x75-mipi-dsi-binding/20240814-234923
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
patch link:    https://lore.kernel.org/r/20240814105256.177319-3-manikandan.m%40microchip.com
patch subject: [PATCH v3 2/4] drm/bridge: add Microchip DSI controller support for sam9x7 SoC series
config: arm-randconfig-r071-20240816 (https://download.01.org/0day-ci/archive/20240816/[email protected]/config)
compiler: clang version 15.0.7 (https://github.com/llvm/llvm-project 8dfdcc7b7bf66834a761bd8de445840ef68e4d1a)

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/oe-kbuild-all/[email protected]/

smatch warnings:
drivers/gpu/drm/bridge/dw-mipi-dsi-mchp.c:293 dw_mipi_dsi_mchp_get_lane_mbps() warn: unsigned 'bpp' is never less than zero. drivers/gpu/drm/bridge/dw-mipi-dsi-mchp.c:293 dw_mipi_dsi_mchp_get_lane_mbps() warn: error code type promoted to positive: 'bpp' drivers/gpu/drm/bridge/dw-mipi-dsi-mchp.c:314 dw_mipi_dsi_mchp_get_lane_mbps() error: uninitialized symbol 'target_mbps'.

vim +/bpp +293 drivers/gpu/drm/bridge/dw-mipi-dsi-mchp.c

276
277 static int dw_mipi_dsi_mchp_get_lane_mbps(void *priv_data,

   278						  const struct drm_display_mode *mode,
   279						  unsigned long mode_flags, u32 lanes,
   280						  u32 format, unsigned int *lane_mbps)
   281	{
   282		struct dw_mipi_dsi_mchp *dsi = priv_data;
   283		unsigned long best_freq, fvco_min, fvco_max, fin, fout;
   284		unsigned long min_delta = ULONG_MAX, delta;
   285		unsigned int mpclk, target_mbps, desired_mbps;
   286		unsigned int max_mbps = dppa_map[ARRAY_SIZE(dppa_map) - 1].max_mbps;
   287		unsigned int bpp, min_prediv, max_prediv;
   288		unsigned int _fbdiv, best_fbdiv, _prediv, best_prediv;
   289		u64 freq_factor;
   290	
   291		dsi->format = format;
   292		bpp = mipi_dsi_pixel_format_to_bpp(dsi->format);
 > 293		if (bpp < 0) {
   294			dev_err(dsi->dev,
   295				"failed to get bpp for pixel format %d\n",
   296				dsi->format);
   297			return bpp;
   298		}
   299	
   300		mpclk = DIV_ROUND_UP(mode->clock, MSEC_PER_SEC);
   301		if (mpclk) {
   302			/* take 1/0.8, since mbps must be bigger than bandwidth of RGB */
   303			desired_mbps = mpclk * (bpp / lanes) * 10 / 8;
   304			if (desired_mbps < max_mbps) {
   305				target_mbps = desired_mbps;
   306			} else {
   307				dev_err(dsi->dev,
   308					"DPHY clock frequency is out of range\n");
   309				return -ERANGE;
   310			}
   311		}
   312	
   313		fin = clk_get_rate(dsi->pllref_clk);
 > 314		fout = target_mbps * USEC_PER_SEC;

315
316 /* constraint: 5Mhz <= Fref / N <= 40MHz */
317 min_prediv = DIV_ROUND_UP(fin, 40 * USEC_PER_SEC);
318 max_prediv = fin / (5 * USEC_PER_SEC);
319
320 /* constraint: 80MHz <= Fvco <= 1000Mhz */
321 fvco_min = 80 * USEC_PER_SEC;
322 fvco_max = 1000 * USEC_PER_SEC;
323
324 for (best_freq = 0, _prediv = min_prediv; _prediv <= max_prediv; _prediv++) {
325 /* Fvco = Fref * M / N */
326 freq_factor = fout * _prediv;
327 do_div(freq_factor, fin);
328 _fbdiv = freq_factor;
329 /*
330 * Due to the use of a "by 2 pre-scaler," the range of the
331 * feedback multiplication value M is limited to even division
332 * numbers, and m must be greater than 6, not bigger than 512.
333 */
334 if (_fbdiv < 6 || _fbdiv > 512)
335 continue;
336
337 _fbdiv += _fbdiv % 2;
338
339 freq_factor = _fbdiv * fin;
340 do_div(freq_factor, _prediv);
341 if (freq_factor < fvco_min || freq_factor > fvco_max)
342 continue;
343
344 delta = abs(fout - freq_factor);
345 if (delta < min_delta) {
346 best_prediv = _prediv;
347 best_fbdiv = _fbdiv;
348 min_delta = delta;
349 best_freq = freq_factor;
350 }
351 }
352
353 if (best_freq) {
354 dsi->lane_mbps = DIV_ROUND_UP(best_freq, USEC_PER_SEC);
355 *lane_mbps = dsi->lane_mbps;
356 dsi->input_div = best_prediv;
357 dsi->feedback_div = best_fbdiv;
358 } else {
359 dev_err(dsi->dev, "Can not find best_freq for DPHY\n");
360 return -EINVAL;
361 }
362
363 return 0;
364 }
365

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#9 lore raw

PATCH v3 3/4 MAINTAINERS: add SAM9X7 SoC's Microchip's MIPI DSI host wrapper driver

In reply to Manikandan Muralidharan

Add the Microchip's DSI controller wrapper driver that uses the Synopsys DesignWare MIPI DSI host controller bridge for the SAM9X7 SoC series to the MAINTAINERS entry.

---
changes in v3:
- Drop T: section

---
 MAINTAINERS | 7 +++++++
 1 file changed, 7 insertions(+)
MAINTAINERS +7 -0
index a1537a149e9a..270cbe5f0c6a 100644
@@ -15086,6 +15086,13 @@ S:	Supported
 F:	Documentation/devicetree/bindings/display/bridge/microchip,sam9x75-lvds.yaml
 F:	drivers/gpu/drm/bridge/microchip-lvds.c
 
+DRM DRIVER FOR MICROCHIP SAM9X7-COMPATIBLE MIPI DSI HOST CONTROLLER
+M:	Manikandan Muralidharan <[email protected]>
+L:	[email protected]
+S:	Supported
+F:	Documentation/devicetree/bindings/display/bridge/microchip,sam9x75-mipi-dsi.yaml
+F:	drivers/gpu/drm/bridge/dw-mipi-dsi-mchp.c
+
 MICROCHIP SAMA5D2-COMPATIBLE ADC DRIVER
 M:	Eugen Hristev <[email protected]>
 L:	[email protected]
Signature · 1 line
2.25.1
#10 lore raw

PATCH v3 4/4 ARM: configs: at91: Enable Microchip's MIPI DSI Host Controller support

In reply to Manikandan Muralidharan

Enable the Microchip's DSI controller wrapper driver that uses the Synopsys DesignWare MIPI DSI host controller bridge.

---
 arch/arm/configs/at91_dt_defconfig | 1 +
 1 file changed, 1 insertion(+)
arch/arm/configs/at91_dt_defconfig +1 -0
index 6eabe2313c9a..beb29c4832ce 100644
@@ -144,6 +144,7 @@ CONFIG_VIDEO_OV7740=m
 CONFIG_DRM=y
 CONFIG_DRM_ATMEL_HLCDC=y
 CONFIG_DRM_MICROCHIP_LVDS_SERIALIZER=y
+CONFIG_DRM_MICROCHIP_DW_MIPI_DSI=y
 CONFIG_DRM_PANEL_SIMPLE=y
 CONFIG_DRM_PANEL_EDP=y
 CONFIG_FB_ATMEL=y
Signature · 1 line
2.25.1