drm/tegra: Add DSI and panel support
Subsystems (6)
v3 cover drm/tegra: Add DSI and panel support
Hi,
This third version of the series reworks some aspects of DSI and panel support. There is now a DSI bus type, which can be used to instantiate devices that represent DSI peripherals and register controllers as DSI hosts. This is currently somewhat DT-centric, but all hardware that I have access to boots from DT, so I couldn't test any other code anyway and decided to leave that up until someone actually needs it.
Patch 1 adds the DSI bus type, which provides functions to instantiate DSI peripherals as devices that can be tied into Linux' driver model. Similarly a DSI host can be created (or embedded within the private structure of a DSI controller driver), which DSI peripherals can talk to. It also exposes a DSI driver, which is essentially a very think wrapper around the standard struct device_driver and allows to easily match DSI drivers to DSI devices (again, only DT-style matching is supported so far).
Patch 2 adds the DRM panel framework. Not much has changed since the previous version. Mostly smaller fixes and a way to control the panel brightness, which would usually be tied to a struct backlight_device but doesn't necessarily have to be, so I provided separate accessors that can be used by drivers as they see fit.
Patch 3 implements the simple panel driver. The most notable changes since v2 are that the brightness accessors are now implemented if a backlight device is associated with the panel. Furthermore the driver now supports DSI devices using the new DSI infrastructure, which at the same time sharing most of the code with the platform driver for panels not connected via a bus, such as dumb RGB/LVDS panels.
An implementation of the panel support for Tegra is provided in patch 4. Due to how DSI devices are instantiated (namely as children of the DSI controller after it has been probed), panels are now hotpluggable at runtime. This sounds less scary than it actually is. It merely means that the code can deal with a panel not being present at probe time (which will never be the case for DSI). Depending on load order the panel might become available only until rather late, and there is code to deal with that as well (by leveraging the hotplug detection mechanism in DRM). I haven't been able to produce this case yet, so that that code path is currently untested, but it should work...
Furthermore this patch exposes a "brightness" property to userspace that can be used to control the backlight associated with a panel. The aim is to provide a standard way for userspace to access the correct backlight and not rely on some heuristic to determine the correct sysfs path to use for backlight control.
Patch 5 implements a driver for the MIPI pad calibration hardware found on Tegra SoCs. It isn't very relevant to the DSI patches but is included here for the sake of completeness.
The DSI host implementation for Tegra SoCs is provided in patch 6. That contains some code to configure the MIPI D-PHY which might be useful in other drivers, but I've kept it in the Tegra driver for now. It is nicely split into separate files so would be easy to move out if needed.
Patch 7 contains a work-in-progress implementation of DSI command mode for Tegra. This isn't cleaned up yet and contains various hacks to make it work. Also when run while the controller is in video mode and sending image data, the switch back to video mode after the message has been transferred doesn't work properly and causes the display to no longer work. When run before switching to video mode, however, this seems to work properly. Things like short writes respond with the proper trigger message and such. The goal for this was to be able to identify panels using their device descriptor block (DDB). Unfortunately the display panel that I have reads back only zeros (the framing of the messages looks correct, though), so I somewhat lost interest in making this work correctly.
Eventually I could envision turning this into something much bigger. If for instance somebody has access to a panel from which a proper DDB can be read, generic helpers could be written around this and panels probed not via DT but also directly by matching against the supplier and other data found in the DDB. In the meantime I'll try to find out if I can get access to such hardware so that I can finish this up properly.
Thierry
Thierry Reding (7):
drm: Add DSI bus infrastructure
drm: Add panel support
drm/panel: Add simple panel support
drm/tegra: Implement panel support
gpu: host1x: Add MIPI pad calibration support
drm/tegra: Add DSI support
WIP: drm/tegra: Implement DSI transfers
.../bindings/gpu/nvidia,tegra20-host1x.txt | 16 + .../bindings/misc/nvidia,tegra114-mipi.txt | 37 + .../devicetree/bindings/panel/auo,b101aw03.txt | 7 + .../bindings/panel/chunghwa,claa101wb03.txt | 7 + .../bindings/panel/panasonic,vvx10f004b00.txt | 7 + .../devicetree/bindings/panel/simple-panel.txt | 21 + drivers/gpu/drm/Kconfig | 6 + drivers/gpu/drm/Makefile | 4 + drivers/gpu/drm/drm_dsi.c | 306 ++++++ drivers/gpu/drm/drm_panel.c | 100 ++ drivers/gpu/drm/panel/Kconfig | 20 + drivers/gpu/drm/panel/Makefile | 1 + drivers/gpu/drm/panel/panel-simple.c | 467 +++++++++ drivers/gpu/drm/tegra/Kconfig | 2 + drivers/gpu/drm/tegra/Makefile | 2 + drivers/gpu/drm/tegra/dc.h | 2 + drivers/gpu/drm/tegra/drm.c | 10 +- drivers/gpu/drm/tegra/drm.h | 5 + drivers/gpu/drm/tegra/dsi.c | 1087 ++++++++++++++++++++ drivers/gpu/drm/tegra/dsi.h | 134 +++ drivers/gpu/drm/tegra/mipi-phy.c | 137 +++ drivers/gpu/drm/tegra/mipi-phy.h | 65 ++ drivers/gpu/drm/tegra/output.c | 95 +- drivers/gpu/host1x/Makefile | 1 + drivers/gpu/host1x/dev.c | 17 +- drivers/gpu/host1x/dev.h | 2 + drivers/gpu/host1x/mipi.c | 272 +++++ include/drm/drm_dsi.h | 206 ++++ include/drm/drm_panel.h | 114 ++ include/linux/host1x.h | 6 + 30 files changed, 3147 insertions(+), 9 deletions(-) create mode 100644 Documentation/devicetree/bindings/misc/nvidia,tegra114-mipi.txt create mode 100644 Documentation/devicetree/bindings/panel/auo,b101aw03.txt create mode 100644 Documentation/devicetree/bindings/panel/chunghwa,claa101wb03.txt create mode 100644 Documentation/devicetree/bindings/panel/panasonic,vvx10f004b00.txt create mode 100644 Documentation/devicetree/bindings/panel/simple-panel.txt create mode 100644 drivers/gpu/drm/drm_dsi.c 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 drivers/gpu/drm/tegra/dsi.c create mode 100644 drivers/gpu/drm/tegra/dsi.h create mode 100644 drivers/gpu/drm/tegra/mipi-phy.c create mode 100644 drivers/gpu/drm/tegra/mipi-phy.h create mode 100644 drivers/gpu/host1x/mipi.c create mode 100644 include/drm/drm_dsi.h create mode 100644 include/drm/drm_panel.h
Signature · 1 line
1.8.4.2
PATCH v3 1/7 drm: Add DSI bus infrastructure
In order to support DSI peripherals, add a DSI bus type that devices and drivers can be registered with.
--- drivers/gpu/drm/Kconfig | 4 + drivers/gpu/drm/Makefile | 2 + drivers/gpu/drm/drm_dsi.c | 306 ++++++++++++++++++++++++++++++++++++++++++++++ include/drm/drm_dsi.h | 206 +++++++++++++++++++++++++++++++ 4 files changed, 518 insertions(+) create mode 100644 drivers/gpu/drm/drm_dsi.c create mode 100644 include/drm/drm_dsi.h
drivers/gpu/drm/Kconfig +4 -0
@@ -20,6 +20,10 @@ menuconfig DRM details. You should also select and configure AGP (/dev/agpgart) support if it is available for your platform. +config DRM_DSI + bool + depends on DRM + config DRM_USB tristate depends on DRM
drivers/gpu/drm/Makefile +2 -0
@@ -19,6 +19,7 @@ drm-$(CONFIG_COMPAT) += drm_ioc32.o drm-$(CONFIG_DRM_GEM_CMA_HELPER) += drm_gem_cma_helper.o drm-$(CONFIG_PCI) += ati_pcigart.o +drm-dsi-y := drm_dsi.o drm-usb-y := drm_usb.o drm_kms_helper-y := drm_crtc_helper.o drm_dp_helper.o
@@ -31,6 +32,7 @@ obj-$(CONFIG_DRM_KMS_HELPER) += drm_kms_helper.o CFLAGS_drm_trace_points.o := -I$(src) obj-$(CONFIG_DRM) += drm.o +obj-$(CONFIG_DRM_DSI) += drm_dsi.o obj-$(CONFIG_DRM_USB) += drm_usb.o obj-$(CONFIG_DRM_TTM) += ttm/ obj-$(CONFIG_DRM_TDFX) += tdfx/
drivers/gpu/drm/drm_dsi.c new file +306 -0
306 lines not on this page · raw message
include/drm/drm_dsi.h new file +206 -0
206 lines not on this page · raw message
Signature · 1 line
1.8.4.2
Re: [PATCH v3 1/7] drm: Add DSI bus infrastructure
Hi Thierry,
I have already sent patch with DSI bus implementation [1]. It was posted as the first step of CDF implementation attempt, but in fact it do not depend on CDF.
[1]
http://www.mail-archive.com/[email protected]/msg45252.html
One comment below.
Quoted 5 lines · Thierry Reding
In order to support DSI peripherals, add a DSI bus type that devices and drivers can be registered with.
Signed-off-by Thierry Reding <[email protected]>---
[snip]
Quoted 40 lines
include/drm/drm_dsi.h new file +40
-0+ +/* +* DSI packet data types +*/ + +/* processor-sourced packets */ +#define DSI_CMD_VSYNC_START 0x01 +#define DSI_CMD_VSYNC_END 0x11 +#define DSI_CMD_HSYNC_START 0x21 +#define DSI_CMD_HSYNC_END 0x31 +#define DSI_CMD_EOT 0x08 +#define DSI_CMD_COLOR_MODE_OFF 0x02 +#define DSI_CMD_COLOR_MODE_ON 0x12 +#define DSI_CMD_SHUT_DOWN 0x22 +#define DSI_CMD_TURN_ON 0x32 +#define DSI_CMD_GEN_SHORT_WRITE_0 0x03 +#define DSI_CMD_GEN_SHORT_WRITE_1 0x13 +#define DSI_CMD_GEN_SHORT_WRITE_2 0x23 +#define DSI_CMD_GEN_SHORT_READ_0 0x04 +#define DSI_CMD_GEN_SHORT_READ_1 0x14 +#define DSI_CMD_GEN_SHORT_READ_2 0x24 +#define DSI_CMD_DCS_SHORT_WRITE_0 0x05 +#define DSI_CMD_DCS_SHORT_WRITE_1 0x15 +#define DSI_CMD_DCS_SHORT_READ 0x06 +#define DSI_CMD_SET_MAX_RETURN_PACKET_SIZE 0x37 +#define DSI_CMD_NULL 0x09 +#define DSI_CMD_BLANK 0x19 +#define DSI_CMD_GEN_LONG_WRITE 0x29 +#define DSI_CMD_DCS_LONG_WRITE 0x39 +#define DSI_CMD_YCbCr422_20 0x0c +#define DSI_CMD_YCbCr422_24 0x1c +#define DSI_CMD_YCbCr422_16 0x2c +#define DSI_CMD_RGB30 0x0d +#define DSI_CMD_RGB36 0x1d +#define DSI_CMD_YCbCr420 0x3d +#define DSI_CMD_RGB16 0x0e +#define DSI_CMD_RGB18 0x1e +#define DSI_CMD_RGB18NP 0x2e +#define DSI_CMD_RGB24 0x3e +
include/drm/drm_dsi.h line 79
Quoted 10 lines
include/drm/drm_dsi.h new file +10
-0+/* peripheral-sourced */ +#define DSI_RSP_ACK_ERR 0x02 +#define DSI_RSP_EOT 0x08 +#define DSI_RSP_GEN_SHORT_READ_1 0x11 +#define DSI_RSP_GEN_SHORT_READ_2 0x12 +#define DSI_RSP_GEN_LONG_READ 0x1a +#define DSI_RSP_DCS_LONG_READ 0x1c +#define DSI_RSP_DCS_SHORT_READ_1 0x21 +#define DSI_RSP_DCS_SHORT_READ_2 0x22 +
Those macros are already defined in include/video/mipi_display.h
Regards
Andrzej
Re: [PATCH v3 1/7] drm: Add DSI bus infrastructure
Quoted 8 lines · Andrzej Hajda
Hi Thierry,
I have already sent patch with DSI bus implementation [1]. It was posted as the first step of CDF implementation attempt, but in fact it do not depend on CDF.
[1]
http://www.mail-archive.com/[email protected]/msg45252.html
Seems like that patchset was never merged. I guess probably because it was posted as part of CDF work.
Do you have any plans on continuing work on that? If not I could extract the DSI bus patch from the series, it's largely similar to the patch I proposed here, and rework it somewhat. I'd very much like to avoid putting the code in drivers/video, though, since that's considered obsolete. Furthermore I think if we kept the transfer function proposed in my patch should make it easier to address Bert's comments from your posting.
Quoted 54 lines
One comment below.
Quoted 5 lines · Thierry Reding
In order to support DSI peripherals, add a DSI bus type that devices and drivers can be registered with.
Signed-off-by Thierry Reding <[email protected]>---
[snip]
Quoted 44 lines
include/drm/drm_dsi.h new file +44
-0+ +/* +* DSI packet data types +*/ + +/* processor-sourced packets */ +#define DSI_CMD_VSYNC_START 0x01 +#define DSI_CMD_VSYNC_END 0x11 +#define DSI_CMD_HSYNC_START 0x21 +#define DSI_CMD_HSYNC_END 0x31 +#define DSI_CMD_EOT 0x08 +#define DSI_CMD_COLOR_MODE_OFF 0x02 +#define DSI_CMD_COLOR_MODE_ON 0x12 +#define DSI_CMD_SHUT_DOWN 0x22 +#define DSI_CMD_TURN_ON 0x32 +#define DSI_CMD_GEN_SHORT_WRITE_0 0x03 +#define DSI_CMD_GEN_SHORT_WRITE_1 0x13 +#define DSI_CMD_GEN_SHORT_WRITE_2 0x23 +#define DSI_CMD_GEN_SHORT_READ_0 0x04 +#define DSI_CMD_GEN_SHORT_READ_1 0x14 +#define DSI_CMD_GEN_SHORT_READ_2 0x24 +#define DSI_CMD_DCS_SHORT_WRITE_0 0x05 +#define DSI_CMD_DCS_SHORT_WRITE_1 0x15 +#define DSI_CMD_DCS_SHORT_READ 0x06 +#define DSI_CMD_SET_MAX_RETURN_PACKET_SIZE 0x37 +#define DSI_CMD_NULL 0x09 +#define DSI_CMD_BLANK 0x19 +#define DSI_CMD_GEN_LONG_WRITE 0x29 +#define DSI_CMD_DCS_LONG_WRITE 0x39 +#define DSI_CMD_YCbCr422_20 0x0c +#define DSI_CMD_YCbCr422_24 0x1c +#define DSI_CMD_YCbCr422_16 0x2c +#define DSI_CMD_RGB30 0x0d +#define DSI_CMD_RGB36 0x1d +#define DSI_CMD_YCbCr420 0x3d +#define DSI_CMD_RGB16 0x0e +#define DSI_CMD_RGB18 0x1e +#define DSI_CMD_RGB18NP 0x2e +#define DSI_CMD_RGB24 0x3e + +/* peripheral-sourced */ +#define DSI_RSP_ACK_ERR 0x02 +#define DSI_RSP_EOT 0x08 +#define DSI_RSP_GEN_SHORT_READ_1 0x11
Quoted 8 lines
include/drm/drm_dsi.h line 79
Quoted 6 lines
include/drm/drm_dsi.h new file +6
-0+#define DSI_RSP_GEN_SHORT_READ_2 0x12 +#define DSI_RSP_GEN_LONG_READ 0x1a +#define DSI_RSP_DCS_LONG_READ 0x1c +#define DSI_RSP_DCS_SHORT_READ_1 0x21 +#define DSI_RSP_DCS_SHORT_READ_2 0x22 +Those macros are already defined in
include/video/mipi_display.h
I wasn't aware, thanks for the pointer. It's somewhat unfortunate that that's in include/video, but judging by the git log, it has been there for quite a while.
Thierry
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v3 1/7] drm: Add DSI bus infrastructure
Hi Thierry,
Quoted 7 lines · Thierry Reding
Quoted 6 lines · Andrzej Hajda
Hi Thierry,
I have already sent patch with DSI bus implementation [1]. It was posted as the first step of CDF implementation attempt, but in fact it do not depend on CDF.
Quoted 8 lines
Quoted 2 lines
[1]
http://www.mail-archive.com/[email protected]/msg45252.htmlSeems like that patchset was never merged. I guess probably because it was posted as part of CDF work.
Do you have any plans on continuing work on that?If not I could extract the DSI bus patch from the series, it's largely similar to the patch I proposed here, and rework it somewhat.
I will soon sent new patch with the current version of the bus. It could be a better base to your rework.
Quoted 3 lines
I'd very much like to avoid
putting the code indrivers/video, though, since that's considered obsolete.
I have followed convention proposed by Laurent in his DBI bus. It seems to me OK - DSI bus is more related to video than to drm. I know that drivers/video is mostly occupied by FB drivers, but according to Kconfig it is not only for FB.
Of course this is only my suggestion.
Quoted 3 lines
Furthermore I think if we kept the transfer function proposed
in my patch should make it easier to address Bert's comments from your posting.
I am not sure which part of Barts comment you are addressing. Anyway I also prefer passing struct and returning ssize_t. I am not sure about splitting type and channel but this seems to be a minor detail.
Regards
Andrzej
RE: [PATCH v3 1/7] drm: Add DSI bus infrastructure
Quoted 8 lines · Andrzej Hajda
Quoted 3 lines · Thierry Reding
Furthermore I think if we kept the transfer function proposed
in my patch should make it easier to address Bert's comments from your posting.I am not sure which part of Barts comment you are addressing. Anyway I also prefer passing struct and returning
ssize_t. I am not sure about splitting type and channel but this seems to be a minor detail.
Most of the comments I made about Andrzej's patch from last month apply here, and would result in extensions to struct dsi_msg. Some means of choosing whether the transfer should be in HS or LP mode is necessary. For video mode panels some means of specifying a period (VFP, VBP, etc) for sending the transfer is needed. Perhaps struct dsi_msg should include:
#define DSI_WINDOW_VFP (1 << 0) #define DSI_WINDOW_ACT (1 << 1) #define DSI_WINDOW_VBP (1 << 2) #define DSI_WINDOW_VSY (1 << 3)
/**
* struct dsi_msg - DSI command message
* @channel: virtual channel to send the message to
* @type: data ID of the message
* @lp_mode: send in LP mode if non-zero
* @window: video period when transfer is allowed - bitmask of DSI_WINDOW_*
* @tx_len: length of transmission buffer
* @tx: transmission buffer
* @rx_len: length of reception buffer
* @rx: reception buffer
*/
struct dsi_msg {
u8 channel;
u8 type;
u8 lp_mode;
u8 window;
size_t tx_len;
void *tx;
size_t rx_len;
void *rx;
};The ability to specify synchronisation with a tearing effect control signal for a command mode panel is obviously important. It's somewhat analogous to the "window" option for video mode.
They're little used, but a mechanism for sending triggers should be included. They're probably sufficiently different that it should be a different op.
All the best,
Bert.
Signature · 4 lines
Bert Kenward Software Engineer Broadcom Mobile Platform Solutions Cambridge, UK
Re: [PATCH v3 1/7] drm: Add DSI bus infrastructure
Quoted 22 lines · Bert Kenward
Quoted 8 lines · Andrzej Hajda
Quoted 3 lines · Thierry Reding
Furthermore I think if we kept the transfer function proposed
in my patch should make it easier to address Bert's comments from your posting.I am not sure which part of Barts comment you are addressing. Anyway I also prefer passing struct and returning
ssize_t. I am not sure about splitting type and channel but this seems to be a minor detail.Most of the comments I made about Andrzej's patch from last month apply here, and would result in extensions to struct
dsi_msg. Some means of choosing whether the transfer should be in HS or LP mode is necessary. For video mode panels some means of specifying a period (VFP, VBP, etc) for sending the transfer is needed. Perhaps structdsi_msgshould include:#define DSI_WINDOW_VFP (1 << 0) #define DSI_WINDOW_ACT (1 << 1) #define DSI_WINDOW_VBP (1 << 2) #define DSI_WINDOW_VSY (1 << 3)
Quoted 5 lines
/**
* structdsi_msg- DSI command message
* @channel: virtual channel to send the message to
* @type: data ID of the message
* @lp_mode: send in LP mode if non-zero
Perhaps a flags field would be more flexible here. I can easily imagine other I can imagine that other flags may be needed eventually.
Quoted 1 line
* @window: video period when transfer is allowed - bitmask of DSI_WINDOW_*
I'm not sure if this is the right interface. What will happen for instance if the hardware doesn't support any of the bits in that mask? Perhaps a slightly better approach might be to expose the capabilities of the DSI host, so that the DSI core knows up front which windows can be used.
Quoted 18 lines
* @tx_len: length of transmission buffer
* @tx: transmission buffer
* @rx_len: length of reception buffer
* @rx: reception buffer
*/struct dsi_msg { u8 channel; u8 type; u8 lp_mode; u8 window; size_t tx_len; void *tx; size_t rx_len; void *rx; };
Quoted 7 lines
The ability to specify synchronisation with a tearing effect control signal for a command mode panel is obviously important. It's somewhat analogous to the "window" option for video mode.
They're little used, but a mechanism for sending triggers should be included. They're probably sufficiently different that it should be a different op.
I agree. While I currently have no use-case where this is required, I think having a struct dsi_msg makes it easier to extend the featureset on an as-needed basis.
Thierry
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
RE: [PATCH v3 1/7] drm: Add DSI bus infrastructure
Quoted 6 lines · Thierry Reding
Quoted 5 lines · Bert Kenward
#define DSI_WINDOW_VFP (1 << 0) #define DSI_WINDOW_ACT (1 << 1) #define DSI_WINDOW_VBP (1 << 2) #define DSI_WINDOW_VSY (1 << 3)
Quoted 8 lines
Quoted 5 lines
/**
* structdsi_msg- DSI command message
* @channel: virtual channel to send the message to
* @type: data ID of the message
* @lp_mode: send in LP mode if non-zeroPerhaps a flags field would be more flexible here. I can easily imagine other I can imagine that other flags may be needed eventually.
Agreed. "TE synchronised" would be one such extra flag, for supporting command mode updates.
Quoted 8 lines
Quoted 1 line
* @window: video period when transfer is allowed - bitmask of
DSI_WINDOW_*
I'm not sure if this is the right interface. What will happen for instance if the hardware doesn't support any of the bits in that mask? Perhaps a slightly better approach might be to expose the capabilities of the DSI host, so that the DSI core knows up front which windows can be used.
Exposing the capabilities seems like the smart thing to do, certainly - but you'd still need a way to specify which of those capabilities you want to use for each transfer.
I'd suggest that hardware would ignore bits that it couldn't support - in the limit, hardware that has no way to choose when to send a command during video would ignore this completely. I realise that could well cause confusion when trying to work out why a particularly display is misbehaving when you think you're sending commands at the right time.
Bert.
Signature · 4 lines
Bert Kenward Software Engineer Broadcom Mobile Platform Solutions Cambridge, UK
Re: [PATCH v3 1/7] drm: Add DSI bus infrastructure
Quoted 27 lines · Bert Kenward
Quoted 6 lines · Thierry Reding
Quoted 5 lines · Bert Kenward
#define DSI_WINDOW_VFP (1 << 0) #define DSI_WINDOW_ACT (1 << 1) #define DSI_WINDOW_VBP (1 << 2) #define DSI_WINDOW_VSY (1 << 3)Quoted 8 lines
Quoted 5 lines
/**
* structdsi_msg- DSI command message
* @channel: virtual channel to send the message to
* @type: data ID of the message
* @lp_mode: send in LP mode if non-zeroPerhaps a flags field would be more flexible here. I can easily imagine other I can imagine that other flags may be needed eventually.
Agreed. "TE synchronised" would be one such extra flag, for supporting command mode updates.
Quoted 8 lines
Quoted 1 line
* @window: video period when transfer is allowed - bitmask of
DSI_WINDOW_*
I'm not sure if this is the right interface. What will happen for instance if the hardware doesn't support any of the bits in that mask? Perhaps a slightly better approach might be to expose the capabilities of the DSI host, so that the DSI core knows up front which windows can be used.
Quoted 3 lines
Exposing the capabilities seems like the smart thing to do, certainly
- but you'd still need a way to specify which of those capabilities you want to use for each transfer.
Yes. I think we'll still need to have that. It's just that for some transfers it doesn't matter during which window they are executed. Although I guess in those cases the caller could just specify all bits to signal that it doesn't care.
Quoted 6 lines
I'd suggest that hardware would ignore bits that it couldn't support - in the limit, hardware that has no way to choose when to send a command during video would ignore this completely. I realise that could well cause confusion when trying to work out why a particularly display is misbehaving when you think you're sending commands at the right time.
I think at the very least if there's no match between the requested set of windows and the ones that a particular DSI host supports, then the driver should report an error.
The reason why I thought that exposing the capabilities might be useful is that the caller could be smart about how to transfer a message, or perhaps use different messages to the same effect. But perhaps that's not even possible and maybe not worth considering.
A smart thing to do in my opinion will be to not try to overengineer this from the beginning. That's why I'm thinking of splitting out the whose dsi_msg support in a first step, so that the bus infrastructure can be merged without having discussed all possible cases. And even so dsi_msg doesn't have to be perfect from the start. It's an in-kernel API, therefore can change easily if needed. The less we require of it now the easier it will be to extend when the need arises.
Thierry
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v3 1/7] drm: Add DSI bus infrastructure
In reply to Andrzej HajdaQuoted 12 lines · Andrzej Hajda
Hi Thierry,
Quoted 9 lines · Thierry Reding
Quoted 8 lines · Andrzej Hajda
Hi Thierry,
I have already sent patch with DSI bus implementation [1]. It was posted as the first step of CDF implementation attempt, but in fact it do not depend on CDF.
[1]
http://www.mail-archive.com/[email protected]/msg45252.html
Quoted 8 lines
Quoted 6 lines
Seems like that patchset was never merged. I guess probably because it was posted as part of CDF work.
Do you have any plans on continuing work on that?If not I could extract the DSI bus patch from the series, it's largely similar to the patch I proposed here, and rework it somewhat.
I will soon sent new patch with the current version of the bus. It could be a better base to your rework.
Any estimate on when this will be? I want to get started on this as soon as possible so we can get this in good shape for 3.14. I suspect that if I start based on the current patch, I won't have to redo everything when updating for the next version. Quite a bit should remain similar, right?
Quoted 8 lines
Quoted 3 lines
I'd very much like to avoid
putting the code indrivers/video, though, since that's considered obsolete.I have followed convention proposed by Laurent in his DBI bus. It seems to me OK - DSI bus is more related to video than to drm. I know that
drivers/videois mostly occupied by FB drivers, but according toKconfigit is not only for FB.
Of course this is only my suggestion.
I've had an IRC discussion with Dave and Rob (added on Cc), and they both agreed that implementing it as part of DRM would be preferred.
The reason, as I've said before, is primarily that drivers/video is considered obsolete and new drivers and features should be implemented within the context of DRM/KMS. Additionally this has the benefit of being able to reuse the native DRM data structures and types, as well as helper functions, without having to go through an extra layer of compatibility.
Quoted 7 lines
Quoted 3 lines
Furthermore I think if we kept the transfer function proposed
in my patch should make it easier to address Bert's comments from your posting.I am not sure which part of Barts comment you are addressing. Anyway I also prefer passing struct and returning
ssize_t. I am not sure about splitting type and channel but this seems to be a minor detail.
I find that to be a perfectly natural split. A DSI peripheral will have an associated virtual channel number anyway, and having a separate field will allow drivers to just copy that field into the dsi_msg's equivalent.
The alternative would be to require each driver to properly encode the channel and data type.
Thierry
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v3 1/7] drm: Add DSI bus infrastructure
Quoted 19 lines · Thierry Reding
Quoted 18 lines · Andrzej Hajda
Hi Thierry,
Quoted 15 lines · Thierry Reding
Quoted 8 lines · Andrzej Hajda
Hi Thierry,
I have already sent patch with DSI bus implementation [1]. It was posted as the first step of CDF implementation attempt, but in fact it do not depend on CDF.
[1]
http://www.mail-archive.com/[email protected]/msg45252.htmlSeems like that patchset was never merged. I guess probably because it was posted as part of CDF work.
Do you have any plans on continuing work on that?If not I could extract the DSI bus patch from the series, it's largely similar to the patch I proposed here, and rework it somewhat.
Quoted 6 lines
Quoted 2 lines
I will soon sent new patch with the current version of the bus. It could be a better base to your rework.
Any estimate on when this will be? I want to get started on this as soon as possible so we can get this in good shape for 3.14. I suspect that if I start based on the current patch, I won't have to redo everything when updating for the next version. Quite a bit should remain similar, right?
Patch sent.
Quoted 26 lines
Quoted 9 lines
Quoted 4 lines
I'd very much like to avoid
putting the code indrivers/video, though, since that's considered obsolete.I have followed convention proposed by Laurent in his DBI bus. It seems to me OK - DSI bus is more related to video than to drm. I know that
drivers/videois mostly occupied by FB drivers, but according toKconfigit is not only for FB.
Of course this is only my suggestion.I've had an IRC discussion with Dave and Rob (added on Cc), and they both agreed that implementing it as part of DRM would be preferred.
The reason, as I've said before, is primarily that
drivers/videois considered obsolete and new drivers and features should be implemented within the context of DRM/KMS. Additionally this has the benefit of being able to reuse the native DRM data structures and types, as well as helper functions, without having to go through an extra layer of compatibility.Quoted 7 lines
Quoted 3 lines
Furthermore I think if we kept the transfer function proposed
in my patch should make it easier to address Bert's comments from your posting.I am not sure which part of Barts comment you are addressing. Anyway I also prefer passing struct and returning
ssize_t. I am not sure about splitting type and channel but this seems to be a minor detail.
Quoted 7 lines
I find that to be a perfectly natural split. A DSI peripheral will have an associated virtual channel number anyway, and having a separate field will allow drivers to just copy that field into the dsi_msg's equivalent.
The alternative would be to require each driver to properly encode the channel and data type.
Other alternatives:
- use helpers functions to call transfer op, encoding could be done by them,
- fill channel by DSI master, based on DSI slave(seems to be little over-engineering)
But I see no big difference between them.
Regards
Andrzej
Quoted 2 lines
Thierry
PATCH v3 2/7 drm: Add panel support
In reply to Thierry RedingAdd 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.
---
Changes in v3:
- depend on DRM (reported by Randy Dunlap)
- propagate errors from .enable() and .disable()
- add backlight brightness accessors
- hide DRM_PANEL Kconfig symbol
drivers/gpu/drm/Kconfig | 2 + drivers/gpu/drm/Makefile | 1 + drivers/gpu/drm/drm_panel.c | 100 ++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/panel/Kconfig | 5 ++ include/drm/drm_panel.h | 114 ++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 222 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
@@ -195,3 +195,5 @@ source "drivers/gpu/drm/qxl/Kconfig" source "drivers/gpu/drm/msm/Kconfig" source "drivers/gpu/drm/tegra/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-dsi-y := drm_dsi.o drm-usb-y := drm_usb.o
drivers/gpu/drm/drm_panel.c new file +100 -0
100 lines not on this page · raw message
drivers/gpu/drm/panel/Kconfig new file +5 -0
@@ -0,0 +1,5 @@ +config DRM_PANEL + bool + depends on DRM + help + Panel registration and lookup framework.
include/drm/drm_panel.h new file +114 -0
114 lines not on this page · raw message
Signature · 1 line
1.8.4.2
PATCH v3 3/7 drm/panel: Add simple panel support
In reply to Thierry RedingAdd 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.
---
Changes in v3:
- propagate errors from .enable() and .disable()
- implement backlight brightness accessors
- allow building as a module
- add DSI device support
- fixup license string
Changes in v2:
- fixup pixel clock for Panasonic VVX10F004B00
.../devicetree/bindings/panel/auo,b101aw03.txt | 7 + .../bindings/panel/chunghwa,claa101wb03.txt | 7 + .../bindings/panel/panasonic,vvx10f004b00.txt | 7 + .../devicetree/bindings/panel/simple-panel.txt | 21 + drivers/gpu/drm/Makefile | 1 + drivers/gpu/drm/panel/Kconfig | 15 + drivers/gpu/drm/panel/Makefile | 1 + drivers/gpu/drm/panel/panel-simple.c | 467 +++++++++++++++++++++ 8 files changed, 526 insertions(+) create mode 100644 Documentation/devicetree/bindings/panel/auo,b101aw03.txt create mode 100644 Documentation/devicetree/bindings/panel/chunghwa,claa101wb03.txt create mode 100644 Documentation/devicetree/bindings/panel/panasonic,vvx10f004b00.txt create mode 100644 Documentation/devicetree/bindings/panel/simple-panel.txt create mode 100644 drivers/gpu/drm/panel/Makefile create mode 100644 drivers/gpu/drm/panel/panel-simple.c
Documentation/devicetree/bindings/panel/auo,b101aw03.txt new file +7 -0
@@ -0,0 +1,7 @@ +AU Optronics Corporation 10.1" WSVGA TFT LCD panel + +Required properties: +- compatible: should be "auo,b101aw03" + +This binding is compatible with the simple-panel binding, which is specified +in simple-panel.txt in this directory.
Documentation/devicetree/bindings/panel/chunghwa,claa101wb03.txt new file +7 -0
@@ -0,0 +1,7 @@ +Chunghwa Picture Tubes Ltd. 10.1" WXGA TFT LCD panel + +Required properties: +- compatible: should be "chunghwa,claa101wb03" + +This binding is compatible with the simple-panel binding, which is specified +in simple-panel.txt in this directory.
Documentation/devicetree/bindings/panel/panasonic,vvx10f004b00.txt new file +7 -0
@@ -0,0 +1,7 @@ +Panasonic Corporation 10.1" WUXGA TFT LCD panel + +Required properties: +- compatible: should be "panasonic,vvx10f004b00" + +This binding is compatible with the simple-panel binding, which is specified +in simple-panel.txt in this directory.
Documentation/devicetree/bindings/panel/simple-panel.txt new file +21 -0
@@ -0,0 +1,21 @@ +Simple display panel + +Required properties: +- power-supply: regulator to provide the supply voltage + +Optional properties: +- ddc-i2c-bus: phandle of an I2C controller used for DDC EDID probing +- 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
@@ -62,3 +62,4 @@ obj-$(CONFIG_DRM_QXL) += qxl/ obj-$(CONFIG_DRM_MSM) += msm/ obj-$(CONFIG_DRM_TEGRA) += tegra/ obj-y += i2c/ +obj-y += panel/
drivers/gpu/drm/panel/Kconfig +15 -0
@@ -3,3 +3,18 @@ config DRM_PANEL depends on DRM help Panel registration and lookup framework. + +menu "Display Panels" + depends on DRM_PANEL + +config DRM_PANEL_SIMPLE + tristate "support for simple panels" + depends on DRM && DRM_PANEL + 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. + +endmenu
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 +467 -0
467 lines not on this page · raw message
Signature · 1 line
1.8.4.2
PATCH v3 4/7 drm/tegra: Implement panel support
In reply to Thierry RedingUse the DRM panel framework to attach a panel to an output. If the panel attached to a connector supports supports the backlight brightness accessors, a property will be available to allow the brightness to be modified from userspace.
---
Changes in v3:
- allow panels to be hotplugged
- add brightness property
.../bindings/gpu/nvidia,tegra20-host1x.txt | 2 + drivers/gpu/drm/tegra/Kconfig | 1 + drivers/gpu/drm/tegra/drm.h | 3 + drivers/gpu/drm/tegra/output.c | 90 +++++++++++++++++++++- 4 files changed, 92 insertions(+), 4 deletions(-)
Documentation/devicetree/bindings/gpu/nvidia,tegra20-host1x.txt +2 -0
@@ -67,6 +67,7 @@ of the following host1x client modules: - nvidia,ddc-i2c-bus: phandle of an I2C controller used for DDC EDID probing - nvidia,hpd-gpio: specifies a GPIO used for hotplug detection - nvidia,edid: supplies a binary EDID blob + - nvidia,panel: phandle of a display panel - hdmi: High Definition Multimedia Interface
@@ -81,6 +82,7 @@ of the following host1x client modules: - nvidia,ddc-i2c-bus: phandle of an I2C controller used for DDC EDID probing - nvidia,hpd-gpio: specifies a GPIO used for hotplug detection - nvidia,edid: supplies a binary EDID blob + - nvidia,panel: phandle of a display panel - tvo: TV encoder output
drivers/gpu/drm/tegra/Kconfig +1 -0
@@ -5,6 +5,7 @@ config DRM_TEGRA select TEGRA_HOST1X select DRM_KMS_HELPER select DRM_KMS_FB_HELPER + select DRM_PANEL select FB_SYS_FILLRECT select FB_SYS_COPYAREA select FB_SYS_IMAGEBLIT
drivers/gpu/drm/tegra/drm.h +3 -0
@@ -183,6 +183,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;
@@ -190,6 +191,8 @@ struct tegra_output {struct drm_encoder encoder;struct drm_connector connector; + +struct drm_property *brightness; };static inline struct tegra_output *encoder_to_output (struct drm_encoder *e)
drivers/gpu/drm/tegra/output.c +86 -4
157 lines not on this page · raw message
Signature · 1 line
1.8.4.2
PATCH v3 5/7 gpu: host1x: Add MIPI pad calibration support
In reply to Thierry RedingThis driver adds support to perform calibration of the MIPI pads for CSI and DSI.
---
Changes in v3:
- rename calibrate and #calibrate-cells properties to nvidia,mipi-calibrate and #nvidia,mipi-calibrate-cells, respectively
- split API into tegra_mipi_{request,free,calibrate}() to allow DT to be parsed only once and to better support deferred probing
.../bindings/misc/nvidia,tegra114-mipi.txt | 37 +++ drivers/gpu/host1x/Makefile | 1 + drivers/gpu/host1x/dev.c | 17 +- drivers/gpu/host1x/dev.h | 2 + drivers/gpu/host1x/mipi.c | 272 +++++++++++++++++++++ include/linux/host1x.h | 6 + 6 files changed, 331 insertions(+), 4 deletions(-) create mode 100644 Documentation/devicetree/bindings/misc/nvidia,tegra114-mipi.txt create mode 100644 drivers/gpu/host1x/mipi.c
Documentation/devicetree/bindings/misc/nvidia,tegra114-mipi.txt new file +37 -0
@@ -0,0 +1,37 @@ +NVIDIA Tegra MIPI pad calibration controller + +Required properties: +- compatible: "nvidia,tegra<chip>-mipi" +- reg: Physical base address and length of the controller's registers. +- clocks: The clock consumed by the controller. +- #nvidia,mipi-calibrate-cells: Should be 1. The cell is a bitmask of the pads + that need to be calibrated for a given device. + +User nodes need to contain an nvidia,mipi-calibrate property that has a +phandle to refer to the calibration controller node and a bitmask of the pads +that need to be calibrated. + +Example: + + mipi: mipi@700e3000 { + compatible = "nvidia,tegra114-mipi"; + reg = <0x700e3000 0x100>; + clocks = <&tegra_car TEGRA114_CLK_MIPI_CAL>; + #nvidia,mipi-calibrate-cells = <1>; + }; + + ... + + host1x@50000000 { + ... + + dsi@54300000 { + ... + + nvidia,mipi-calibrate = <&mipi 0x060>; + + ... + }; + + ... + };
drivers/gpu/host1x/Makefile +1 -0
@@ -7,6 +7,7 @@ host1x-y = \ channel.o \ job.o \ debug.o \ + mipi.o \ hw/host1x01.o \ hw/host1x02.o
drivers/gpu/host1x/dev.c +13 -4
@@ -210,17 +210,26 @@ static int __init tegra_host1x_init(void)return err; err =platform_driver_register (&tegra_host1x_driver); -if (err <0 ) { -host1x_bus_exit (); -return err; - } +if (err <0 ) + goto unregister_bus; + + err =platform_driver_register (&tegra_mipi_driver); +if (err <0 ) + goto unregister_host1x;return 0 ; + +unregister_host1x: +platform_driver_unregister (&tegra_host1x_driver); +unregister_bus: +host1x_bus_exit (); +return err; }module_init (tegra_host1x_init); static void __exit tegra_host1x_exit(void) { +platform_driver_unregister (&tegra_mipi_driver);platform_driver_unregister (&tegra_host1x_driver);host1x_bus_exit (); }
drivers/gpu/host1x/dev.h +2 -0
@@ -306,4 +306,6 @@ static inline void host1x_hw_show_mlocks(struct host1x *host, struct output *o) host->debug_op->show_mlocks(host, o); } +extern struct platform_driver tegra_mipi_driver; +#endif
drivers/gpu/host1x/mipi.c new file +272 -0
272 lines not on this page · raw message
include/linux/host1x.h +6 -0
@@ -281,4 +281,10 @@ int host1x_device_exit(struct host1x_device *device);int host1x_client_register (struct host1x_client *client);int host1x_client_unregister (struct host1x_client *client); +struct tegra_mipi_device ; + +struct tegra_mipi_device *tegra_mipi_request (struct device *device); +void tegra_mipi_free (struct tegra_mipi_device *device); +int tegra_mipi_calibrate (struct tegra_mipi_device *device); +#endif
Signature · 1 line
1.8.4.2
PATCH v3 6/7 drm/tegra: Add DSI support
In reply to Thierry RedingThis commit adds support for both DSI outputs found on Tegra. Only very minimal functionality is implemented, so advanced features like ganged mode won't work.
Due to the lack of other test hardware, some sections of the driver are hardcoded to work with Dalmore.
---
Changes in v3:
- select DRM_DSI symbol to pull in DSI bus infrastructure
- implement DSI host .attach() and .detach() callbacks
- move register definitions to separate file
- move MIPI D-PHY code to separate file
- add support for low-power clocks
Changes in v2:
- cope with modes that have a 0 Hz refresh rate
.../bindings/gpu/nvidia,tegra20-host1x.txt | 14 + drivers/gpu/drm/tegra/Kconfig | 1 + drivers/gpu/drm/tegra/Makefile | 2 + drivers/gpu/drm/tegra/dc.h | 2 + drivers/gpu/drm/tegra/drm.c | 10 +- drivers/gpu/drm/tegra/drm.h | 2 + drivers/gpu/drm/tegra/dsi.c | 940 +++++++++++++++++++++ drivers/gpu/drm/tegra/dsi.h | 134 +++ drivers/gpu/drm/tegra/mipi-phy.c | 137 +++ drivers/gpu/drm/tegra/mipi-phy.h | 65 ++ drivers/gpu/drm/tegra/output.c | 5 + 11 files changed, 1311 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/tegra/dsi.c create mode 100644 drivers/gpu/drm/tegra/dsi.h create mode 100644 drivers/gpu/drm/tegra/mipi-phy.c create mode 100644 drivers/gpu/drm/tegra/mipi-phy.h
Documentation/devicetree/bindings/gpu/nvidia,tegra20-host1x.txt +14 -0
@@ -96,6 +96,20 @@ of the following host1x client modules: Required properties: - compatible: "nvidia,tegra<chip>-dsi" - reg: Physical base address and length of the controller's registers. + - clocks: Should contain phandle and clock specifiers for two clocks: + the DSI controller clock and the parent clock of the controller. + - clock-names: A list of strings containing the name for each clock in + the clocks property. Must contain the following two entries: + - "dsi": the DSI controller clock + - "parent": parent of the DSI controller clock + - calibrate: Should contain a phandle and a specifier specifying which + pads are used by this DSI output and need to be calibrated. + + Optional properties: + - nvidia,ddc-i2c-bus: phandle of an I2C controller used for DDC EDID probing + - nvidia,hpd-gpio: specifies a GPIO used for hotplug detection + - nvidia,edid: supplies a binary EDID blob + - nvidia,panel: phandle of a display panel Example:
drivers/gpu/drm/tegra/Kconfig +1 -0
@@ -3,6 +3,7 @@ config DRM_TEGRA depends on ARCH_TEGRA || ARCH_MULTIPLATFORM depends on DRM select TEGRA_HOST1X + select DRM_DSI select DRM_KMS_HELPER select DRM_KMS_FB_HELPER select DRM_PANEL
drivers/gpu/drm/tegra/Makefile +2 -0
@@ -9,6 +9,8 @@ tegra-drm-y := \ output.o \ rgb.o \ hdmi.o \ + mipi-phy.o \ + dsi.o \ gr2d.o \ gr3d.o
drivers/gpu/drm/tegra/dc.h +2 -0
@@ -28,6 +28,7 @@#define DISP_CTRL_MODE_STOP (0 << 5)#define DISP_CTRL_MODE_C_DISPLAY (1 << 5)#define DISP_CTRL_MODE_NC_DISPLAY (2 << 5) +#define DISP_CTRL_MODE_MASK (3 << 5)#define DC_CMD_SIGNAL_RAISE 0x033#define DC_CMD_DISPLAY_POWER_CONTROL 0x036#define PW0_ENABLE (1 << 0)
@@ -116,6 +117,7 @@#define DC_DISP_DISP_WIN_OPTIONS 0x402#define HDMI_ENABLE (1 << 30) +#define DSI_ENABLE (1 << 29)#define DC_DISP_DISP_MEM_HIGH_PRIORITY 0x403#define CURSOR_THRESHOLD (x) (((x) & 0x03) << 24)
drivers/gpu/drm/tegra/drm.c +9 -1
@@ -649,6 +649,7 @@ static const struct of_device_id host1x_drm_subdevs[] = { { .compatible = "nvidia,tegra30-hdmi", }, { .compatible = "nvidia,tegra30-gr2d", }, { .compatible = "nvidia,tegra30-gr3d", }, + { .compatible = "nvidia,tegra114-dsi", }, { .compatible = "nvidia,tegra114-hdmi", }, { .compatible = "nvidia,tegra114-gr3d", }, { /* sentinel */ }
@@ -673,10 +674,14 @@ static int __init host1x_drm_init(void)if (err <0 ) goto unregister_host1x; - err =platform_driver_register (&tegra_hdmi_driver); + err =platform_driver_register (&tegra_dsi_driver);if (err <0 ) goto unregister_dc; + err =platform_driver_register (&tegra_hdmi_driver); +if (err <0 ) + goto unregister_dsi; + err =platform_driver_register (&tegra_gr2d_driver);if (err <0 ) goto unregister_hdmi;
@@ -691,6 +696,8 @@ unregister_gr2d:platform_driver_unregister (&tegra_gr2d_driver); unregister_hdmi:platform_driver_unregister (&tegra_hdmi_driver); +unregister_dsi: +platform_driver_unregister (&tegra_dsi_driver); unregister_dc:platform_driver_unregister (&tegra_dc_driver); unregister_host1x:
@@ -704,6 +711,7 @@ static void __exit host1x_drm_exit(void)platform_driver_unregister (&tegra_gr3d_driver);platform_driver_unregister (&tegra_gr2d_driver);platform_driver_unregister (&tegra_hdmi_driver); +platform_driver_unregister (&tegra_dsi_driver);platform_driver_unregister (&tegra_dc_driver);host1x_driver_unregister (&host1x_drm_driver); }
drivers/gpu/drm/tegra/drm.h +2 -0
@@ -174,6 +174,7 @@ struct tegra_output_ops {enum tegra_output_type {TEGRA_OUTPUT_RGB ,TEGRA_OUTPUT_HDMI , +TEGRA_OUTPUT_DSI , };struct tegra_output {
@@ -266,6 +267,7 @@ extern void tegra_drm_fb_exit(struct drm_device *drm);extern void tegra_fbdev_restore_mode (struct tegra_fbdev *fbdev);extern struct platform_driver tegra_dc_driver; +extern struct platform_driver tegra_dsi_driver;extern struct platform_driver tegra_hdmi_driver;extern struct platform_driver tegra_gr2d_driver;extern struct platform_driver tegra_gr3d_driver;
drivers/gpu/drm/tegra/dsi.c new file +940 -0
940 lines not on this page · raw message
drivers/gpu/drm/tegra/dsi.h new file +134 -0
134 lines not on this page · raw message
drivers/gpu/drm/tegra/mipi-phy.c new file +137 -0
137 lines not on this page · raw message
drivers/gpu/drm/tegra/mipi-phy.h new file +65 -0
65 lines not on this page · raw message
drivers/gpu/drm/tegra/output.c +5 -0
@@ -335,6 +335,11 @@ int tegra_output_init(struct drm_device *drm, struct tegra_output *output) encoder =DRM_MODE_ENCODER_TMDS ;break ; +case TEGRA_OUTPUT_DSI : + connector =DRM_MODE_CONNECTOR_DSI ; + encoder =DRM_MODE_ENCODER_DSI ; +break ; +default : connector = DRM_MODE_CONNECTOR_Unknown; encoder =DRM_MODE_ENCODER_NONE ;
Signature · 1 line
1.8.4.2
PATCH v3 7/7 WIP: drm/tegra: Implement DSI transfers
In reply to Thierry Reding--- drivers/gpu/drm/tegra/dsi.c | 147 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 147 insertions(+)
drivers/gpu/drm/tegra/dsi.c +147 -0
@@ -774,6 +774,131 @@ static void tegra_dsi_initialize(struct tegra_dsi *dsi)tegra_dsi_writel (dsi,0 ,DSI_GANGED_MODE_SIZE ); } +static int tegra_dsi_set_lp_clk (struct tegra_dsi *dsi,unsigned long pclk) +{ +unsigned long bclk, timeout, value; +struct clk *clk, *parent, *base; +unsigned int mul, div; +int err; + + err =tegra_dsi_get_muldiv (dsi->format, &mul, &div); +if (err <0 ) +return err; + + bclk = pclk *8 ; + + clk =clk_get_parent (dsi->clk); + parent =clk_get_parent (clk); + base =clk_get_parent (parent); + + err =clk_set_rate (base, pclk *2 ); +if (err <0 ) +return err; + +/* one frame high-speed transmission timeout */ + timeout = bclk /512 ; + value =DSI_TIMEOUT_LRX (0x2000 ) |DSI_TIMEOUT_HTX (timeout); +tegra_dsi_writel (dsi, value,DSI_TIMEOUT_0 ); + +/* 2 ms peripheral timeout for panel */ + timeout =2 * bclk /512 *1000 ; + value =DSI_TIMEOUT_PR (timeout) |DSI_TIMEOUT_TA (0x2000 ); +tegra_dsi_writel (dsi, value,DSI_TIMEOUT_1 ); + + value =DSI_TALLY_TA (0 ) |DSI_TALLY_LRX (0 ) |DSI_TALLY_HTX (0 ); +tegra_dsi_writel (dsi, value,DSI_TO_TALLY ); + +return 0 ; +} + +static ssize_t tegra_dsi_host_transfer (struct dsi_host *host, +struct dsi_msg *msg) +{ +struct tegra_dsi *dsi =dsi_host_to_tegra (host); +unsigned long value, timeout; +unsigned int count =0 , i; +const u8 *tx = msg->tx; +int err; + +dev_info (dsi->dev,"> %s(host=%p, msg=%p)\n" , __func__, host, msg); + +/* XXX */ +drm_panel_enable (dsi->output.panel); + + value =tegra_dsi_readl (dsi,DSI_POWER_CONTROL ); + value |=DSI_POWER_CONTROL_ENABLE ; +tegra_dsi_writel (dsi, value,DSI_POWER_CONTROL ); +usleep_range (300 ,1000 ); + + err =tegra_dsi_set_lp_clk (dsi,10000000 ); +if (err <0 ) { +dev_err (dsi->dev,"failed to setup low-power clock: %d\n" , err); +return err; + } + +tegra_dsi_writel (dsi,DSI_HOST_FIFO_DEPTH ,DSI_MAX_THRESHOLD ); + + value =tegra_dsi_readl (dsi,DSI_CONTROL ); + value =0x00003031 ; +tegra_dsi_writel (dsi, value,DSI_CONTROL ); + + value =tegra_dsi_readl (dsi,DSI_HOST_CONTROL ); + value =0x00102003 ; +tegra_dsi_writel (dsi, value,DSI_HOST_CONTROL ); + +if (msg->rx && msg->rx_len >0 ) { + value =tegra_dsi_readl (dsi,DSI_HOST_CONTROL ); + value |=DSI_HOST_CONTROL_BTA ; +tegra_dsi_writel (dsi, value,DSI_HOST_CONTROL ); + } + + value = ((msg->channel &0x3 ) <<6 ) | (msg->type &0x3f ); + + value |= tx[0 ] <<8 ; + value |= tx[1 ] <<16 ; + +tegra_dsi_writel (dsi, value,DSI_WR_DATA ); + +tegra_dsi_writel (dsi,0x00000002 ,DSI_TRIGGER ); + + timeout = jiffies +msecs_to_jiffies (250 ); + +while (true) { + value =tegra_dsi_readl (dsi,DSI_TRIGGER ); +if ((value &0x00000002 ) ==0 ) +break ; + +if (time_after (jiffies, timeout)) +return -ETIMEDOUT ; + +usleep_range (25 ,100 ); + } + + timeout = jiffies +msecs_to_jiffies (250 ); + +while (true) { +usleep_range (1000 ,2000 ); + + value =tegra_dsi_readl (dsi,DSI_STATUS ); + count = value &0x1f ; + +if (count >0 ) +break ; + +if (time_after (jiffies, timeout)) +return -ETIMEDOUT ; + } + +for (i =0 ; i < count; i++) +tegra_dsi_readl (dsi,DSI_RD_DATA ); + +/* XXX */ +drm_panel_disable (dsi->output.panel); + +dev_info (dsi->dev,"< %s()\n" , __func__); +return 0 ; +} +static int tegra_dsi_host_attach (struct dsi_host *host,struct dsi_device *device) {
@@ -784,6 +909,27 @@ static int tegra_dsi_host_attach(struct dsi_host *host,if (output->panel) {if (output->connector.dev)drm_helper_hpd_irq_event (output->connector.dev); + +if (0 ) { +struct dsi_msg msg; +u8 tx[2 ], rx[2 ]; +ssize_t err; + + rx[0 ] = rx[1 ] =0 ; + tx[0 ] = tx[1 ] =0 ; + +memset (&msg,0 ,sizeof (msg)); + msg.channel =0 ; + msg.type =0x05 ; + msg.tx_len =2 ; + msg.tx = tx; + msg.rx_len =2 ; + msg.rx = rx; + + err =dsi_host_transfer (&dsi->host, &msg); +if (err <0 ) +dev_err (dsi->dev,"dsi_host_transfer() failed: %zd\n" , err); + } }return 0 ;
@@ -808,6 +954,7 @@ static int tegra_dsi_host_detach(struct dsi_host *host,static const struct dsi_host_ops tegra_dsi_host_ops = { .attach = tegra_dsi_host_attach, .detach = tegra_dsi_host_detach, + .transfer = tegra_dsi_host_transfer, };static int tegra_dsi_probe (struct platform_device *pdev)
Signature · 1 line
1.8.4.2