drm: Add panel support
Subsystems (6)
cover drm: Add panel support
Hi,
This patch series adds support for panels to DRM. The current implementation is very basic and only provides hooks for a panel to handle DPMS changes and return a list of supported modes. That should be enough to support a rather large number of panels. It should also be easy to extend the framework for more sophisticated panels such as DSI.
I'm aware of the existing efforts to create such a framework, called CDF. My impression was that a lot of people thought it overengineered and that it doesn't fit well into the existing DRM infrastructure. This alternative proposal is an attempt to start with something simpler (yet extensible) that fits into DRM more nicely.
Patch 1 adds the "framework" if one can call it that. At the moment it isn't anything more than a global registry that panel drivers can register panels with and display drivers can retrieve them. All of this is very device tree centric right now, but it shouldn't be difficult to add support for platform data.
Patch 2 implements a simple driver for dumb panels that can have a regulator for the supply voltage of the panel and a separate GPIO to enable the panel. Three simple panels are currently supported by that driver.
Finally patch 3 hooks up the panel framework with the Tegra DRM driver. Note that the framework isn't tied to the core at the moment. That can easily be changed if we want to, but I didn't see a need so far. Instead the driver calls the .dpms() and .get_modes() hooks in it's encoder/connector implementation.
Thierry
Thierry Reding (3):
drm: Add panel support
drm/panel: Add simple panel support
drm/tegra: Implement panel support
.../devicetree/bindings/panel/panel-simple.txt | 25 ++ drivers/gpu/drm/Kconfig | 2 + drivers/gpu/drm/Makefile | 2 + drivers/gpu/drm/drm_panel.c | 96 ++++++ drivers/gpu/drm/panel/Kconfig | 17 ++ drivers/gpu/drm/panel/Makefile | 1 + drivers/gpu/drm/panel/panel-simple.c | 335 +++++++++++++++++++++ drivers/gpu/host1x/drm/Kconfig | 1 + drivers/gpu/host1x/drm/drm.h | 1 + drivers/gpu/host1x/drm/output.c | 28 +- include/drm/drm_panel.h | 65 ++++ 11 files changed, 571 insertions(+), 2 deletions(-) create mode 100644 Documentation/devicetree/bindings/panel/panel-simple.txt create mode 100644 drivers/gpu/drm/drm_panel.c create mode 100644 drivers/gpu/drm/panel/Kconfig create mode 100644 drivers/gpu/drm/panel/Makefile create mode 100644 drivers/gpu/drm/panel/panel-simple.c create mode 100644 include/drm/drm_panel.h
Signature · 1 line
1.8.4
A message that is not in the archive (sent off-list or not yet received): 1377876321-26835-1-git-send-email-treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org
RFC 1/3 drm: Add panel support
Add a very simple framework to register and lookup panels. Panel drivers can initialize a DRM panel and register it with the framework, allowing them to be retrieved and used by display drivers. Currently only support for DPMS and obtaining panel modes is provided. However it should be sufficient to enable a large number of panels. The framework should also be easily extensible to support more sophisticated kinds of panels such as DSI.
The framework hasn't been tied into the DRM core, even though it should be easily possible to do so if that's what we want. In the current implementation, display drivers can simple make use of it to retrieve a panel, obtain its modes and control its DPMS mode.
Note that this is currently only tested on systems that boot from a device tree. No glue code has been written yet for systems that use platform data, but it should be easy to add.
--- drivers/gpu/drm/Kconfig | 2 + drivers/gpu/drm/Makefile | 1 + drivers/gpu/drm/drm_panel.c | 96 +++++++++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/panel/Kconfig | 4 ++ include/drm/drm_panel.h | 65 +++++++++++++++++++++++++++++ 5 files changed, 168 insertions(+) create mode 100644 drivers/gpu/drm/drm_panel.c create mode 100644 drivers/gpu/drm/panel/Kconfig create mode 100644 include/drm/drm_panel.h
drivers/gpu/drm/Kconfig +2 -0
@@ -236,3 +236,5 @@ source "drivers/gpu/drm/tilcdc/Kconfig" source "drivers/gpu/drm/qxl/Kconfig" source "drivers/gpu/drm/msm/Kconfig" + +source "drivers/gpu/drm/panel/Kconfig"
drivers/gpu/drm/Makefile +1 -0
@@ -18,6 +18,7 @@ drm-y := drm_auth.o drm_buffer.o drm_bufs.o drm_cache.o \ drm-$(CONFIG_COMPAT) += drm_ioc32.o drm-$(CONFIG_DRM_GEM_CMA_HELPER) += drm_gem_cma_helper.o drm-$(CONFIG_PCI) += ati_pcigart.o +drm-$(CONFIG_DRM_PANEL) += drm_panel.o drm-usb-y := drm_usb.o
drivers/gpu/drm/drm_panel.c new file +96 -0
96 lines not on this page · raw message
drivers/gpu/drm/panel/Kconfig new file +4 -0
@@ -0,0 +1,4 @@ +menuconfig DRM_PANEL + bool "DRM panel support" + help + Panel registration and lookup framework.
include/drm/drm_panel.h new file +65 -0
65 lines not on this page · raw message
Signature · 1 line
1.8.4
A message that is not in the archive (sent off-list or not yet received): 1377876321-26835-2-git-send-email-treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org
Hi Thierry,
Quoted 8 lines · Thierry Reding
Add a very simple framework to register and lookup panels. Panel drivers can initialize a DRM panel and register it with the framework, allowing them to be retrieved and used by display drivers. Currently only support for DPMS and obtaining panel modes is provided. However it should be sufficient to enable a large number of panels. The framework should also be easily extensible to support more sophisticated kinds of panels such as DSI.
Quoted 8 lines
The framework hasn't been tied into the DRM core, even though it should be easily possible to do so if that's what we want. In the current implementation, display drivers can simple make use of it to retrieve a panel, obtain its modes and control its DPMS mode.
Note that this is currently only tested on systems that boot from a device tree. No glue code has been written yet for systems that use platform data, but it should be easy to add.
Really like this. It's simple and to the point, and much needed since I guess many vendors have come with their own custom solution to handle panels. Do you know if it would be possible to convert these implementations to use your framework instead and consolidate the code around it?
Eventually this might be superseeded by the CDF, but if this happens it should not be too hard to convert the code, and we need something to use panels conveniently in the meantime.
Quoted 93 lines
Signed-off-by Thierry Reding <[email protected]>--- drivers/gpu/drm/Kconfig | 2 + drivers/gpu/drm/Makefile | 1 + drivers/gpu/drm/drm_panel.c | 96 +++++++++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/panel/Kconfig | 4 ++ include/drm/drm_panel.h | 65 +++++++++++++++++++++++++++++ 5 files changed, 168 insertions(+)create mode 100644
drivers/gpu/drm/drm_panel.ccreate mode 100644drivers/gpu/drm/panel/Kconfigcreate mode 100644include/drm/drm_panel.hdrivers/gpu/drm/Kconfig +2
-0@@ -236,3 +236,5 @@ source "drivers/gpu/drm/tilcdc/Kconfig" source "drivers/gpu/drm/qxl/Kconfig" source "drivers/gpu/drm/msm/Kconfig" + +source "drivers/gpu/drm/panel/Kconfig"drivers/gpu/drm/Makefile +1
-0@@ -18,6 +18,7 @@ drm-y := drm_auth.o drm_buffer.o drm_bufs.o drm_cache.o \ drm-$(CONFIG_COMPAT) += drm_ioc32.o drm-$(CONFIG_DRM_GEM_CMA_HELPER) += drm_gem_cma_helper.o drm-$(CONFIG_PCI) += ati_pcigart.o +drm-$(CONFIG_DRM_PANEL) += drm_panel.o drm-usb-y := drm_usb.odrivers/gpu/drm/drm_panel.c new file +53
-0@@ -0,0 +1,96 @@ +/* +* Copyright (C) 2013, NVIDIA Corporation. All rights reserved. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sub license, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice (including the +* next paragraph) shall be included in all copies or substantial portions +* of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL +* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +* DEALINGS IN THE SOFTWARE. +*/ + +#include <linux/err.h> +#include <linux/export.h> + +#include <drm/drm_crtc.h> +#include <drm/drm_panel.h> + +static DEFINE_MUTEX (panel_lock); +static LIST_HEAD (panel_list); + +void drm_panel_init (struct drm_panel *panel) +{ +INIT_LIST_HEAD (&panel->list); +} +EXPORT_SYMBOL (drm_panel_init); + +int drm_panel_add (struct drm_panel *panel) +{ +mutex_lock (&panel_lock); +list_add_tail (&panel->list, &panel_list); +mutex_unlock (&panel_lock); + +return 0 ; +} +EXPORT_SYMBOL (drm_panel_add); + +void drm_panel_remove (struct drm_panel *panel) +{ +mutex_lock (&panel_lock); +list_del_init (&panel->list); +mutex_unlock (&panel_lock);
drivers/gpu/drm/drm_panel.c line 63
Quoted 10 lines
drivers/gpu/drm/drm_panel.c new file +10
-0+} +EXPORT_SYMBOL (drm_panel_remove); + +int drm_panel_attach (struct drm_panel *panel,struct drm_connector *connector) +{ +if (panel->connector) +return -EBUSY ; + + panel->connector = connector; + panel->drm = connector->dev;
Since connector and drm both seem to only be set here, and drm can easily be derived from connector (connector->dev), do you need the drm member at all?
Quoted 122 lines
drivers/gpu/drm/drm_panel.c new file +33
-0+ +return 0 ; +} +EXPORT_SYMBOL (drm_panel_attach); + +int drm_panel_detach (struct drm_panel *panel) +{ + panel->connector =NULL ; + panel->drm =NULL ; + +return 0 ; +} +EXPORT_SYMBOL (drm_panel_detach); + +#ifdef CONFIG_OF +struct drm_panel *of_drm_find_panel (struct device_node *np) +{ +struct drm_panel *panel; + +mutex_lock (&panel_lock); + +list_for_each_entry (panel, &panel_list, list) { +if (panel->dev->of_node == np) { +mutex_unlock (&panel_lock); +return panel; + } + } + +mutex_unlock (&panel_lock); +return NULL ; +} +EXPORT_SYMBOL (of_drm_find_panel); +#endif drivers/gpu/drm/panel/Kconfig new file +4
-0@@ -0,0 +1,4 @@ +menuconfig DRM_PANEL + bool "DRM panel support" + help + Panel registration and lookup framework.include/drm/drm_panel.h new file +65
-1@@ -0,0 +1,65 @@ +/* +* Copyright (C) 2013, NVIDIA Corporation. All rights reserved. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sub license, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice (including the +* next paragraph) shall be included in all copies or substantial portions +* of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL +* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +* DEALINGS IN THE SOFTWARE. +*/ + +#ifndef __DRM_PANEL_H__ +#define __DRM_PANEL_H__ + +#include <linux/list.h> + +struct drm_connector ; +struct drm_device ; +struct drm_panel ; + +struct drm_panel_funcs { +void (*dpms)(struct drm_panel *panel,int mode); +int (*get_modes)(struct drm_panel *panel); +}; + +struct drm_panel { +struct drm_device *drm; +struct drm_connector *connector; +struct device *dev; + +const struct drm_panel_funcs *funcs; + +struct list_head list; +}; + +void drm_panel_init (struct drm_panel *panel); + +int drm_panel_add (struct drm_panel *panel); +void drm_panel_remove (struct drm_panel *panel); + +int drm_panel_attach (struct drm_panel *panel,struct drm_connector *connector); +int drm_panel_detach (struct drm_panel *panel); + +#ifdef CONFIG_OF +struct drm_panel *of_drm_find_panel (struct device_node *np); +#else +static inline struct drm_panel *of_drm_find_panel (struct device_node *np) +{ +return NULL ; +} +#endif + +#endif --1.8.4
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
RFC 2/3 drm/panel: Add simple panel support
In reply to a message not in the archiveAdd a driver for simple panels. Such panels can have a regulator that provides the supply voltage and a separate GPIO to enable the panel. Optionally the panels can have a backlight associated with them so it can be enabled or disabled according to the panel's power management mode.
Support is added for three panels: An AU Optronics 10.1" WSVGA, a Chunghwa Picture Tubes 10.1" WXGA and a Panasonic 10.1 WUXGA TFT LCD panel.
--- .../devicetree/bindings/panel/panel-simple.txt | 25 ++ drivers/gpu/drm/Makefile | 1 + drivers/gpu/drm/panel/Kconfig | 13 + drivers/gpu/drm/panel/Makefile | 1 + drivers/gpu/drm/panel/panel-simple.c | 335 +++++++++++++++++++++ 5 files changed, 375 insertions(+) create mode 100644 Documentation/devicetree/bindings/panel/panel-simple.txt create mode 100644 drivers/gpu/drm/panel/Makefile create mode 100644 drivers/gpu/drm/panel/panel-simple.c
Documentation/devicetree/bindings/panel/panel-simple.txt new file +25 -0
@@ -0,0 +1,25 @@ +Simple display panel + +Required properties: +- compatible: should be one of: + - "auo,b101aw03": AU Optronics Corporation 10.1" WSVGA TFT LCD panel + - "cptt,claa101wb03": Chunghwa Picture Tubes Ltd. 10.1" WXGA TFT LCD panel + - "pc,vvx10f004b00": Panasonic Corporation 10.1" WUXGA TFT LCD panel + +Optional properties: +- ddc-i2c-bus: phandle of an I2C controller used for DDC EDID probing +- power-supply: regulator to provide the supply voltage +- enable-gpios: GPIO pin to enable or disable the panel +- backlight: phandle of the backlight device attached to the panel + +Example: + + panel: panel { + compatible = "cptt,claa101wb01"; + ddc-i2c-bus = <&panelddc>; + + power-supply = <&vdd_pnl_reg>; + enable-gpios = <&gpio 90 0>; + + backlight = <&backlight>; + };
drivers/gpu/drm/Makefile +1 -0
@@ -57,3 +57,4 @@ obj-$(CONFIG_DRM_TILCDC) += tilcdc/ obj-$(CONFIG_DRM_QXL) += qxl/ obj-$(CONFIG_DRM_MSM) += msm/ obj-y += i2c/ +obj-y += panel/
drivers/gpu/drm/panel/Kconfig +13 -0
@@ -2,3 +2,16 @@ menuconfig DRM_PANEL bool "DRM panel support" help Panel registration and lookup framework. + +if DRM_PANEL + +config DRM_PANEL_SIMPLE + bool "support for simple panels" + depends on OF + help + DRM panel driver for dumb panels that need at most a regulator and + a GPIO to be powered up. Optionally a backlight can be attached so + that it can be automatically turned off when the panel goes into a + low power state. + +endif
drivers/gpu/drm/panel/Makefile new file +1 -0
@@ -0,0 +1 @@ +obj-$(CONFIG_DRM_PANEL_SIMPLE) += panel-simple.o
drivers/gpu/drm/panel/panel-simple.c new file +335 -0
335 lines not on this page · raw message
Signature · 1 line
1.8.4
A message that is not in the archive (sent off-list or not yet received): 1377876321-26835-3-git-send-email-treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org
Re: [RFC 2/3] drm/panel: Add simple panel support
Quoted 28 lines · Thierry Reding
Add a driver for simple panels. Such panels can have a regulator that provides the supply voltage and a separate GPIO to enable the panel. Optionally the panels can have a backlight associated with them so it can be enabled or disabled according to the panel's power management mode.
Support is added for three panels: An AU Optronics 10.1" WSVGA, a Chunghwa Picture Tubes 10.1" WXGA and a Panasonic 10.1 WUXGA TFT LCD panel.
Signed-off-by Thierry Reding <[email protected]>---
.../devicetree/bindings/panel/panel-simple.txt | 25 ++ drivers/gpu/drm/Makefile | 1 + drivers/gpu/drm/panel/Kconfig | 13 + drivers/gpu/drm/panel/Makefile | 1 + drivers/gpu/drm/panel/panel-simple.c | 335 +++++++++++++++++++++ 5 files changed, 375 insertions(+)create mode 100644
Documentation/devicetree/bindings/panel/panel-simple.txtcreate mode 100644drivers/gpu/drm/panel/Makefile
create mode 100644drivers/gpu/drm/panel/panel-simple.cDocumentation/devicetree/bindings/panel/panel-simple.txt new file +0
-0
Documentation/devicetree/bindings/panel/panel-simple.txt line 8
Quoted 8 lines
Documentation/devicetree/bindings/panel/panel-simple.txt new file +8
-0@@ -0,0 +1,25 @@ +Simple display panel + +Required properties: +- compatible: should be one of: + - "auo,b101aw03": AU Optronics Corporation 10.1" WSVGA TFT LCD panel + - "cptt,claa101wb03": Chunghwa Picture Tubes Ltd. 10.1" WXGA TFT LCD panel + - "pc,vvx10f004b00": Panasonic Corporation 10.1" WUXGA TFT LCD panel +
It would seem there should be a more generic compatible to cover the basic "panel-simple" case.
Documentation/devicetree/bindings/panel/panel-simple.txt line 14
Quoted 6 lines
Documentation/devicetree/bindings/panel/panel-simple.txt new file +6
-0+Optional properties: +- ddc-i2c-bus: phandle of an I2C controller used for DDC EDID probing +- power-supply: regulator to provide the supply voltage +- enable-gpios: GPIO pin to enable or disable the panel +- backlight: phandle of the backlight device attached to the panel +
If these are all optional, what does it mean to be a "panel-simple"?
Documentation/devicetree/bindings/panel/panel-simple.txt line 25
Quoted 11 lines
Documentation/devicetree/bindings/panel/panel-simple.txt new file +11
-0+Example: + + panel: panel { + compatible = "cptt,claa101wb01"; + ddc-i2c-bus = <&panelddc>; + + power-supply = <&vdd_pnl_reg>; + enable-gpios = <&gpio 90 0>; + + backlight = <&backlight>; + };
We'd normally do this as unique binding specs for the specific devices and a generic one to cover the concepts of a simple panel. Who know if in the future a 'auo,b101aw03' might want some other unique properties.
[snip]
- k
Signature · 2 lines
Employee of Qualcomm Innovation Center, Inc. Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
A message that is not in the archive (sent off-list or not yet received): 60046BAF-42E8-40FB-A45D-045B7C92513E-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org
Re: [RFC 2/3] drm/panel: Add simple panel support
Quoted 15 lines · Kumar Gala
Quoted 11 lines · Thierry Reding
Add a driver for simple panels. Such panels can have a regulator that provides the supply voltage and a separate GPIO to enable the panel. Optionally the panels can have a backlight associated with them so it can be enabled or disabled according to the panel's power management mode.
Support is added for three panels: An AU Optronics 10.1" WSVGA, a Chunghwa Picture Tubes 10.1" WXGA and a Panasonic 10.1 WUXGA TFT LCD panel.
Documentation/devicetree/bindings/panel/panel-simple.txt +0
-0
Quoted 8 lines
Documentation/devicetree/bindings/panel/panel-simple.txt line 8
Quoted 6 lines
Documentation/devicetree/bindings/panel/panel-simple.txt +6
-0+Required properties: +- compatible: should be one of: + - "auo,b101aw03": AU Optronics Corporation 10.1" WSVGA TFT LCD panel + - "cptt,claa101wb03": Chunghwa Picture Tubes Ltd. 10.1" WXGA TFT LCD panel + - "pc,vvx10f004b00": Panasonic Corporation 10.1" WUXGA TFT LCD panel +It would seem there should be a more generic compatible to cover the basic "panel-simple" case.
I would suggest only documenting "simple-panel" here, and not documenting the specific panels at all; the panel-specific compatible values would show up simply due to the rule that all compatible values in *.dts should contain the exact HW model (e.g. "auo,b101aw03"), plus any HW they're compatible with (i.e. "simple-panel").
I'd suggest "simple-panel" rather than "panel-simple" since IIRC other simple bindings are "simple-xxx" rather than "xxx-simple".
Quoted 8 lines
Documentation/devicetree/bindings/panel/panel-simple.txt line 14
Quoted 6 lines
Documentation/devicetree/bindings/panel/panel-simple.txt +6
-0+Optional properties: +- ddc-i2c-bus: phandle of an I2C controller used for DDC EDID probing +- power-supply: regulator to provide the supply voltage +- enable-gpios: GPIO pin to enable or disable the panel +- backlight: phandle of the backlight device attached to the panel +If these are all optional, what does it mean to be a "panel-simple"?
I think at least ddc-i2c-bus and backlight should be required properties. I suppose it might be possible for the panel to be always-on, and hence enable-gpios/power-supply could be optional?
Re: [RFC 2/3] drm/panel: Add simple panel support
In reply to a message not in the archiveQuoted 11 lines · Thierry Reding
Add a driver for simple panels. Such panels can have a regulator that provides the supply voltage and a separate GPIO to enable the panel. Optionally the panels can have a backlight associated with them so it can be enabled or disabled according to the panel's power management mode.
Documentation/devicetree/bindings/panel/panel-simple.txt +3
-0+Simple display panel + +Required properties:
Documentation/devicetree/bindings/panel/panel-simple.txt line 13
Quoted 10 lines
Documentation/devicetree/bindings/panel/panel-simple.txt +10
-0+- compatible: should be one of: + - "auo,b101aw03": AU Optronics Corporation 10.1" WSVGA TFT LCD panel + - "cptt,claa101wb03": Chunghwa Picture Tubes Ltd. 10.1" WXGA TFT LCD panel + - "pc,vvx10f004b00": Panasonic Corporation 10.1" WUXGA TFT LCD panel + +Optional properties: +- ddc-i2c-bus: phandle of an I2C controller used for DDC EDID probing +- power-supply: regulator to provide the supply voltage +- enable-gpios: GPIO pin to enable or disable the panel +- backlight: phandle of the backlight device attached to the panel
Do we need to represent the timing requirements e.g. between panel enable and backlight enable, or do you expect the driver to hard-code this based on the compatible value?
Looking at the driver code, it seems that it has direct knowledge of the video mode that each panel supports, so DDC is actually optional unlike what I asserted/assumed in my previous response. As such, I guess we should have a separate DT binding document for each of the three panels (compatible values) listed above that pretty much just says "go look at simple-panel.txt".
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [RFC 2/3] drm/panel: Add simple panel support
Quoted 18 lines · Stephen Warren
Quoted 17 lines · Thierry Reding
Add a driver for simple panels. Such panels can have a regulator that provides the supply voltage and a separate GPIO to enable the panel. Optionally the panels can have a backlight associated with them so it can be enabled or disabled according to the panel's power management mode.
Documentation/devicetree/bindings/panel/panel-simple.txt +9
-0+Simple display panel + +Required properties: +- compatible: should be one of: + - "auo,b101aw03": AU Optronics Corporation 10.1" WSVGA TFT LCD panel + - "cptt,claa101wb03": Chunghwa Picture Tubes Ltd. 10.1" WXGA TFT LCD panel + - "pc,vvx10f004b00": Panasonic Corporation 10.1" WUXGA TFT LCD panel + +Optional properties:
Quoted 8 lines
Quoted 4 lines
+- ddc-i2c-bus: phandle of an I2C controller used for DDC EDID probing +- power-supply: regulator to provide the supply voltage +- enable-gpios: GPIO pin to enable or disable the panel +- backlight: phandle of the backlight device attached to the panelDo we need to represent the timing requirements e.g. between panel enable and backlight enable, or do you expect the driver to hard-code this based on the compatible value?
Yes, I'd expect the driver to hard-code that, similar to how the video mode is hardcoded. ddc-i2c-bus support hasn't even been implemented yet. I was planning to do that because one of the panels (the Chunghwa I think) actually is connected via DDC. What I was going to do was prefer a hardcoded mode over EDID to allow a driver to override a faulty EDID.
Quoted 6 lines
Looking at the driver code, it seems that it has direct knowledge of the video mode that each panel supports, so DDC is actually optional unlike what I asserted/assumed in my previous response. As such, I guess we should have a separate DT binding document for each of the three panels (compatible values) listed above that pretty much just says "go look at simple-panel.txt".
Okay, I suppose that makes sense.
Thierry
RFC 3/3 drm/tegra: Implement panel support
In reply to a message not in the archiveUse the DRM panel framework to attach a panel to an output.
--- drivers/gpu/host1x/drm/Kconfig | 1 + drivers/gpu/host1x/drm/drm.h | 1 + drivers/gpu/host1x/drm/output.c | 28 ++++++++++++++++++++++++++-- 3 files changed, 28 insertions(+), 2 deletions(-)
drivers/gpu/host1x/drm/Kconfig +1 -0
@@ -2,6 +2,7 @@ config DRM_TEGRA bool "NVIDIA Tegra DRM" depends on DRM select DRM_KMS_HELPER + select DRM_PANEL select FB_SYS_FILLRECT select FB_SYS_COPYAREA select FB_SYS_IMAGEBLIT
drivers/gpu/host1x/drm/drm.h +1 -0
@@ -195,6 +195,7 @@ struct tegra_output {const struct tegra_output_ops *ops;enum tegra_output_type type; +struct drm_panel *panel;struct i2c_adapter *ddc;const struct edid *edid;unsigned int hpd_irq;
drivers/gpu/host1x/drm/output.c +26 -2
@@ -11,6 +11,7 @@#include <linux/of_gpio.h> #include <linux/i2c.h> +#include <drm/drm_panel.h> #include "drm.h" static int tegra_connector_get_modes (struct drm_connector *connector)
@@ -19,6 +20,9 @@ static int tegra_connector_get_modes(struct drm_connector *connector)struct edid *edid =NULL ;int err =0 ; +if (output->panel) +return output->panel->funcs->get_modes (output->panel); +if (output->edid) edid =kmemdup (output->edid,sizeof (*edid),GFP_KERNEL );else if (output->ddc)
@@ -74,6 +78,9 @@ tegra_connector_detect(struct drm_connector *connector, bool force)else status = connector_status_connected; }else { +if (output->panel) + status = connector_status_connected; +if (connector->connector_type ==DRM_MODE_CONNECTOR_LVDS ) status = connector_status_connected; }
@@ -105,6 +112,11 @@ static const struct drm_encoder_funcs encoder_funcs = {static void tegra_encoder_dpms (struct drm_encoder *encoder,int mode) { +struct tegra_output *output =encoder_to_output (encoder); +struct drm_panel *panel = output->panel; + +if (panel && panel->funcs && panel->funcs->dpms) + panel->funcs->dpms (panel, mode); } static bool tegra_encoder_mode_fixup(struct drm_encoder *encoder,
@@ -153,14 +165,23 @@ static irqreturn_t hpd_irq(int irq, void *data)int tegra_output_parse_dt (struct tegra_output *output) { +struct device_node *ddc, *panel;enum of_gpio_flags flags; -struct device_node *ddc;size_t size;int err;if (!output->of_node) output->of_node = output->dev->of_node; + panel =of_parse_phandle (output->of_node,"nvidia,panel" ,0 ); +if (panel) { + output->panel =of_drm_find_panel (panel); +if (!output->panel) +return -EPROBE_DEFER ; + +of_node_put (panel); + } + output->edid =of_get_property (output->of_node,"nvidia,edid" , &size); ddc =of_parse_phandle (output->of_node,"nvidia,ddc-i2c-bus" ,0 );
@@ -175,7 +196,7 @@ int tegra_output_parse_dt(struct tegra_output *output)of_node_put (ddc); } -if (!output->edid && !output->ddc) +if (!output->panel && !output->edid && !output->ddc)return -ENODEV ; output->hpd_gpio = of_get_named_gpio_flags(output->of_node,
@@ -242,6 +263,9 @@ int tegra_output_init(struct drm_device *drm, struct tegra_output *output) connector);drm_connector_helper_add (&output->connector, &connector_helper_funcs); +if (output->panel) +drm_panel_attach (output->panel, &output->connector); +drm_encoder_init (drm, &output->encoder, &encoder_funcs, encoder);drm_encoder_helper_add (&output->encoder, &encoder_helper_funcs);
Signature · 1 line
1.8.4