drm/lcdc: add TI LCD Controller DRM driver
Subsystems (2)
RFC 1/1 drm/lcdc: add TI LCD Controller DRM driver
A simple DRM/KMS driver for the TI LCD Controller found in various smaller TI parts (AM33xx, OMAPL138, etc). This driver uses the CMA helpers. Currently only the TFP410 DVI encoder is supported (tested with beaglebone + DVI cape). There are also various LCD displays, for which support can be added (as I get hw to test on), and an external i2c HDMI encoder found on some boards.
The display controller supports a single CRTC. And the encoder+ connector are split out into sub-devices. Depending on which LCD or external encoder is actually present, the appropriate output module(s) will be loaded.
--- drivers/gpu/drm/Kconfig | 2 + drivers/gpu/drm/Makefile | 1 + drivers/gpu/drm/lcdc/Kconfig | 11 + drivers/gpu/drm/lcdc/Makefile | 8 + drivers/gpu/drm/lcdc/lcdc_crtc.c | 544 +++++++++++++++++++++++++++++++++ drivers/gpu/drm/lcdc/lcdc_drv.c | 604 +++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/lcdc/lcdc_drv.h | 162 ++++++++++ drivers/gpu/drm/lcdc/lcdc_regs.h | 154 ++++++++++ drivers/gpu/drm/lcdc/lcdc_tfp410.c | 424 ++++++++++++++++++++++++++ drivers/gpu/drm/lcdc/lcdc_tfp410.h | 26 ++ 10 files changed, 1936 insertions(+) create mode 100644 drivers/gpu/drm/lcdc/Kconfig create mode 100644 drivers/gpu/drm/lcdc/Makefile create mode 100644 drivers/gpu/drm/lcdc/lcdc_crtc.c create mode 100644 drivers/gpu/drm/lcdc/lcdc_drv.c create mode 100644 drivers/gpu/drm/lcdc/lcdc_drv.h create mode 100644 drivers/gpu/drm/lcdc/lcdc_regs.h create mode 100644 drivers/gpu/drm/lcdc/lcdc_tfp410.c create mode 100644 drivers/gpu/drm/lcdc/lcdc_tfp410.h
drivers/gpu/drm/Kconfig +2 -0
@@ -212,3 +212,5 @@ source "drivers/gpu/drm/cirrus/Kconfig" source "drivers/gpu/drm/shmobile/Kconfig" source "drivers/gpu/drm/tegra/Kconfig" + +source "drivers/gpu/drm/lcdc/Kconfig"
drivers/gpu/drm/Makefile +1 -0
@@ -50,4 +50,5 @@ obj-$(CONFIG_DRM_UDL) += udl/ obj-$(CONFIG_DRM_AST) += ast/ obj-$(CONFIG_DRM_SHMOBILE) +=shmobile/ obj-$(CONFIG_DRM_TEGRA) += tegra/ +obj-$(CONFIG_DRM_LCDC) += lcdc/ obj-y += i2c/
drivers/gpu/drm/lcdc/Kconfig new file +11 -0
@@ -0,0 +1,11 @@ +config DRM_LCDC + tristate "DRM Support for TI LCDC Display Controller" + depends on DRM && OF + select DRM_KMS_HELPER + select DRM_KMS_CMA_HELPER + select DRM_GEM_CMA_HELPER + help + Choose this option if you have an TI SoC with LCDC display + controller, for example AM33xx in beagle-bone, DA8xx, or + OMAP-L1xx. This driver replaces the FB_DA8XX fbdev driver. +
drivers/gpu/drm/lcdc/Makefile new file +8 -0
@@ -0,0 +1,8 @@ +ccflags-y := -Iinclude/drm -Werror + +lcdc-y := \ + lcdc_crtc.o \ + lcdc_tfp410.o \ + lcdc_drv.o + +obj-$(CONFIG_DRM_LCDC) += lcdc.o
drivers/gpu/drm/lcdc/lcdc_crtc.c new file +537 -0
537 lines not on this page · raw message
drivers/gpu/drm/lcdc/lcdc_drv.c new file +603 -0
603 lines not on this page · raw message
drivers/gpu/drm/lcdc/lcdc_drv.h new file +162 -0
162 lines not on this page · raw message
drivers/gpu/drm/lcdc/lcdc_regs.h new file +154 -0
154 lines not on this page · raw message
drivers/gpu/drm/lcdc/lcdc_tfp410.c new file +424 -0
424 lines not on this page · raw message
drivers/gpu/drm/lcdc/lcdc_tfp410.h new file +26 -0
@@ -0,0 +1,26 @@ +/* +* Copyright (C) 2012 Texas Instruments +* Author: Rob Clark <[email protected]> +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License version 2 as published by +* the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +* more details. +* +* You should have received a copy of the GNU General Public License along with +* this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef __LCDC_TFP410_H__ +#define __LCDC_TFP410_H__ + +/* sub-module for tfp410 dvi adaptor */ + +int lcdc_tfp410_init (void ); +void lcdc_tfp410_fini (void ); + +#endif /* __LCDC_TFP410_H__ */
Signature · 1 line
1.8.0.2
drivers/gpu/drm/lcdc/lcdc_crtc.c line 133
Quoted 13 lines · Rob Clark
drivers/gpu/drm/lcdc/lcdc_crtc.c new file +13
-0+static int lcdc_crtc_page_flip (struct drm_crtc *crtc, +struct drm_framebuffer *fb, +struct drm_pending_vblank_event *event) +{ +struct lcdc_crtc *lcdc_crtc =to_lcdc_crtc (crtc); +struct drm_device *dev = crtc->dev; + +if (lcdc_crtc->event) { +dev_err (dev->dev,"already pending page flip!\n" ); +return -EBUSY ; + } + +// TODO we should hold a ref to the fb somewhere..
Note that with the current fb refcounting nothing prevents you from fixing this. The ugly problems I've had to solve for the locking rework are all due to the drm core (i.e. setcrtc/pageflip/...) ioctl functions assuming that an fb can't suddenly disappear while holding the mode_config lock. Since I wanted to remove that requirement I've had to changed the refcounting in the drm core functions.
But drivers can already extend the lifetime of an fb simply by grabbing a reference (as long as they grab that reference while holding the struct mutex all the time between fb lookup and grabbing the reference). And it will continue to work the same with the new locking scheme.
-Daniel
Quoted 7 lines
drivers/gpu/drm/lcdc/lcdc_crtc.c new file +7
-0+ crtc->fb = fb; + lcdc_crtc->event = event; +update_scanout (crtc); + +return 0 ; +} +
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Quoted 25 lines · Rob Clark
A simple DRM/KMS driver for the TI LCD Controller found in various smaller TI parts (AM33xx, OMAPL138, etc). This driver uses the CMA helpers. Currently only the TFP410 DVI encoder is supported (tested with beaglebone + DVI cape). There are also various LCD displays, for which support can be added (as I get hw to test on), and an external i2c HDMI encoder found on some boards.
The display controller supports a single CRTC. And the encoder+ connector are split out into sub-devices. Depending on which LCD or external encoder is actually present, the appropriate output module(s) will be loaded.
Signed-off-by Rob Clark <[email protected]>--- drivers/gpu/drm/Kconfig | 2 + drivers/gpu/drm/Makefile | 1 + drivers/gpu/drm/lcdc/Kconfig | 11 + drivers/gpu/drm/lcdc/Makefile | 8 + drivers/gpu/drm/lcdc/lcdc_crtc.c | 544 +++++++++++++++++++++++++++++++++ drivers/gpu/drm/lcdc/lcdc_drv.c | 604 +++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/lcdc/lcdc_drv.h | 162 ++++++++++ drivers/gpu/drm/lcdc/lcdc_regs.h | 154 ++++++++++ drivers/gpu/drm/lcdc/lcdc_tfp410.c | 424 ++++++++++++++++++++++++++ drivers/gpu/drm/lcdc/lcdc_tfp410.h | 26 ++ 10 files changed, 1936 insertions(+)
Quoted 8 lines
create mode 100644 drivers/gpu/drm/lcdc/Kconfig create mode 100644 drivers/gpu/drm/lcdc/Makefile create mode 100644 drivers/gpu/drm/lcdc/lcdc_crtc.c create mode 100644 drivers/gpu/drm/lcdc/lcdc_drv.c create mode 100644 drivers/gpu/drm/lcdc/lcdc_drv.h create mode 100644 drivers/gpu/drm/lcdc/lcdc_regs.h create mode 100644 drivers/gpu/drm/lcdc/lcdc_tfp410.c create mode 100644 drivers/gpu/drm/lcdc/lcdc_tfp410.h
"lcdc" is quite a common term. The directory should perhaps be something like ti-lcdc?
Probably not relevant, but I wonder if the same LCDC was used in omap1... It'd be nice to get rid of the omap1 fb driver.
I'm not very enthusiastic about adding ti-lcdc specific panel/chip drivers. It's not really a big deal if it's only kernel code, but you add device-tree bindings also, which is an external API that you need to support after adding it.
I'd rather see the energy put to common display framework, and get this whole panel/chip driver issue solved in a generic manner.
Tomi
Quoted 35 lines · Tomi Valkeinen
Quoted 25 lines · Rob Clark
A simple DRM/KMS driver for the TI LCD Controller found in various smaller TI parts (AM33xx, OMAPL138, etc). This driver uses the CMA helpers. Currently only the TFP410 DVI encoder is supported (tested with beaglebone + DVI cape). There are also various LCD displays, for which support can be added (as I get hw to test on), and an external i2c HDMI encoder found on some boards.
The display controller supports a single CRTC. And the encoder+ connector are split out into sub-devices. Depending on which LCD or external encoder is actually present, the appropriate output module(s) will be loaded.
Signed-off-by Rob Clark <[email protected]>--- drivers/gpu/drm/Kconfig | 2 + drivers/gpu/drm/Makefile | 1 + drivers/gpu/drm/lcdc/Kconfig | 11 + drivers/gpu/drm/lcdc/Makefile | 8 + drivers/gpu/drm/lcdc/lcdc_crtc.c | 544 +++++++++++++++++++++++++++++++++ drivers/gpu/drm/lcdc/lcdc_drv.c | 604 +++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/lcdc/lcdc_drv.h | 162 ++++++++++ drivers/gpu/drm/lcdc/lcdc_regs.h | 154 ++++++++++ drivers/gpu/drm/lcdc/lcdc_tfp410.c | 424 ++++++++++++++++++++++++++ drivers/gpu/drm/lcdc/lcdc_tfp410.h | 26 ++ 10 files changed, 1936 insertions(+)Quoted 8 lines
create mode 100644 drivers/gpu/drm/lcdc/Kconfig create mode 100644 drivers/gpu/drm/lcdc/Makefile create mode 100644 drivers/gpu/drm/lcdc/lcdc_crtc.c create mode 100644 drivers/gpu/drm/lcdc/lcdc_drv.c create mode 100644 drivers/gpu/drm/lcdc/lcdc_drv.h create mode 100644 drivers/gpu/drm/lcdc/lcdc_regs.h create mode 100644 drivers/gpu/drm/lcdc/lcdc_tfp410.c create mode 100644 drivers/gpu/drm/lcdc/lcdc_tfp410.h
Quoted 2 lines
"lcdc" is quite a common term. The directory should perhaps be something like ti-lcdc?
yeah.. but not one else was using it (other than internally to the driver).. I guess we could call it tilcdc or ti-lcdc
Quoted 2 lines
Probably not relevant, but I wonder if the same LCDC was used in omap1... It'd be nice to get rid of the omap1 fb driver.
would be interesting if you have any idea where to find hw to test with (museum?)
Quoted 7 lines
I'm not very enthusiastic about adding ti-lcdc specific panel/chip drivers. It's not really a big deal if it's only kernel code, but you add device-tree bindings also, which is an external API that you need to support after adding it.
I'd rather see the energy put to common display framework, and get this whole panel/chip driver issue solved in a generic manner.
yeah, I was expecting to migrate to CDF once it exists, but needed something for now. I'm using the exercise to get my thoughts straight on how CDF should fit into KMS. (One thing I plan to add support for is an i2c connected hdmi encoder.. which looks like it would fit well in drivers/gpu/drm/i2c.. so the drm encoder-slave stuff might be the way.)
If you have any suggestions on the DT bindings, I'd like to hear 'em.
BR,
-R
Quoted 3 lines
Tomi
Quoted 8 lines · Rob Clark
Quoted 7 lines
I'm not very enthusiastic about adding ti-lcdc specific panel/chip drivers. It's not really a big deal if it's only kernel code, but you add device-tree bindings also, which is an external API that you need to support after adding it.
I'd rather see the energy put to common display framework, and get this whole panel/chip driver issue solved in a generic manner.
Quoted 8 lines
yeah, I was expecting to migrate to CDF once it exists, but needed something for now. I'm using the exercise to get my thoughts straight on how CDF should fit into KMS. (One thing I plan to add support for is an i2c connected hdmi encoder.. which looks like it would fit well in
drivers/gpu/drm/i2c.. so the drm encoder-slave stuff might be the way.)If you have any suggestions on the DT bindings, I'd like to hear 'em.
btw, a little bit of-topic, but speaking of DT...
Anybody have any clue about how backlight devices are supposed to work in this brave new DT world? In the old days, the board file would stuff a fxn ptr to control backlight in pdata for the driver. But we don't have this any more. I think I need some way to retrieve the 'struct backlight_device' ptr associated with the panel driver, so that the appropriate dpms fxn ptrs can enable/disable the backlight.
I'm thinking the dt file should have something that looks roughly like:
/* Settings for CDTech_S035Q01 / LCD3 cape: */
panel {
compatible = "lcdc,panel";
pinctrl-names = "default";
pinctrl-0 = <&bone_lcd3_cape_lcd_pins>;
panel-info {
ac-bias = <255>;
ac-bias-intrpt = <0>;
dma-burst-sz = <16>;
bpp = <16>;
fdd = <0x80>;
tft-alt-mode = <0>;
stn-565-mode = <0>;
mono-8bit-mode = <0>;
invert-line-clock = <1>;
invert-frm-clock = <1>;
sync-edge = <0>;
sync-ctrl = <1>;
raster-order = <0>;
fifo-th = <0>;
};
display-timings {
native-mode = <&timing0>;
timing0: 320x240 {
hactive = <320>;
vactive = <240>;
hback-porch = <21>;
hfront-porch = <58>;
hsync-len = <47>;
vback-porch = <11>;
vfront-porch = <23>;
vsync-len = <2>;
clock-frequency = <8000000>;
};
};
backlight {
compatible = "tps65217-backlight";
isel = <1>;
fdim = <200>;
tps = <&tps>; /* link to the tps */
brightness = <100>;
};
};display-timings is based on the of-videomode helpers patch.. panel-info probably needs to be made to be something more generic, but we need something to know how to configure the crtc properly..
but I'm not quite sure what to do with the backlight..
BR,
-R
Hi Rob,
Quoted 17 lines · Rob Clark
Quoted 15 lines · On Mon, Dec 17, 2012 at 8:39 AM, Rob Clark <[email protected]<javascript:;>>…
Quoted 7 lines
I'm not very enthusiastic about adding ti-lcdc specific panel/chip drivers. It's not really a big deal if it's only kernel code, but you add device-tree bindings also, which is an external API that you need to support after adding it.
I'd rather see the energy put to common display framework, and get this whole panel/chip driver issue solved in a generic manner.
yeah, I was expecting to migrate to CDF once it exists, but needed something for now. I'm using the exercise to get my thoughts straight on how CDF should fit into KMS. (One thing I plan to add support for is an i2c connected hdmi encoder.. which looks like it would fit well in
drivers/gpu/drm/i2c.. so the drm encoder-slave stuff might be the way.)
Quoted 6 lines
Quoted 1 line
If you have any suggestions on the DT bindings, I'd like to hear 'em.
btw, a little bit of-topic, but speaking of DT...
Anybody have any clue about how backlight devices are supposed to work in this brave new DT world?
See Runtime interpreted power sequences here:
http://lkml.indiana.edu/hypermail/linux/kernel/1208.2/00029.html
It is an attempt to address this need.
Thanks,
Sekhar
In the old days, the board file would
Quoted 59 lines
stuff a fxn ptr to control backlight in pdata for the driver. But we don't have this any more. I think I need some way to retrieve the 'struct
backlight_device' ptr associated with the panel driver, so that the appropriate dpms fxn ptrs can enable/disable the backlight.I'm thinking the dt file should have something that looks roughly like:
/* Settings for CDTech_S035Q01 / LCD3 cape: */ panel { compatible = "lcdc,panel"; pinctrl-names = "default"; pinctrl-0 = <&bone_lcd3_cape_lcd_pins>; panel-info { ac-bias = <255>; ac-bias-intrpt = <0>; dma-burst-sz = <16>; bpp = <16>; fdd = <0x80>; tft-alt-mode = <0>; stn-565-mode = <0>; mono-8bit-mode = <0>; invert-line-clock = <1>; invert-frm-clock = <1>; sync-edge = <0>; sync-ctrl = <1>; raster-order = <0>; fifo-th = <0>; }; display-timings { native-mode = <&timing0>; timing0: 320x240 { hactive = <320>; vactive = <240>; hback-porch = <21>; hfront-porch = <58>; hsync-len = <47>; vback-porch = <11>; vfront-porch = <23>; vsync-len = <2>; clock-frequency = <8000000>; }; }; backlight { compatible = "tps65217-backlight"; isel = <1>; fdim = <200>; tps = <&tps>; /* link to the tps */ brightness = <100>; }; };display-timings is based on the of-videomode helpers patch.. panel-info probably needs to be made to be something more generic, but we need something to know how to configure the crtc properly..
but I'm not quite sure what to do with the backlight..
Quoted 8 lines
BR,
-R_______________________________________________
linux-arm-kernel mailing list linux-arm-kernel at lists.infradead.org <javascript:;>
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20121217/4154d6df/attachment-0001.html>
Quoted 26 lines · Sekhar Nori
Hi Rob,
Quoted 22 lines · Rob Clark
Quoted 9 lines · Rob Clark
Quoted 8 lines
I'm not very enthusiastic about adding ti-lcdc specific panel/chip drivers. It's not really a big deal if it's only kernel code, but you add device-tree bindings also, which is an external API that you need to
support after adding it.I'd rather see the energy put to common display framework, and get this whole panel/chip driver issue solved in a generic manner.
Quoted 8 lines
yeah, I was expecting to migrate to CDF once it exists, but needed something for now. I'm using the exercise to get my thoughts straight on how CDF should fit into KMS. (One thing I plan to add support for is an i2c connected hdmi encoder.. which looks like it would fit well in
drivers/gpu/drm/i2c.. so the drm encoder-slave stuff might be the way.)If you have any suggestions on the DT bindings, I'd like to hear 'em.
btw, a little bit of-topic, but speaking of DT...
Quoted 8 lines
Quoted 2 lines
Anybody have any clue about how backlight devices are supposed to work in this brave new DT world?
See Runtime interpreted power sequences here:
http://lkml.indiana.edu/hypermail/linux/kernel/1208.2/00029.htmlIt is an attempt to address this need.
hmm, I'm not really sure that is what is needed.. or rather, it might perhaps make sense to have a generic backlight driver implementation that could be used where appropriate, but I'm a bit suspicious about that trying to cover absolutely everything.
Quoted 1 line
From the drm/display driver we don't even want to care how the
backlight is implemented. You could have (just making something up hypothetically) a backlight controlled via a uart or some sort of other crazy magic.. and eventually the generic interpreter gets out of hand.
Really I think we just want a way to retrieve a 'struct backlight_device *' that is created somewhere else. We don't care how that backlight driver is implemented. I don't think we want an interpreter.. we want a way to lookup backlight device by name or phandle or something like that.
BR,
-R
Quoted 47 lines · Rob Clark
Quoted 26 lines · Sekhar Nori
Hi Rob,
Quoted 22 lines · Rob Clark
Quoted 9 lines · Rob Clark
Quoted 8 lines
I'm not very enthusiastic about adding ti-lcdc specific panel/chip drivers. It's not really a big deal if it's only kernel code, but you add device-tree bindings also, which is an external API that you need to
support after adding it.I'd rather see the energy put to common display framework, and get this whole panel/chip driver issue solved in a generic manner.
Quoted 8 lines
yeah, I was expecting to migrate to CDF once it exists, but needed something for now. I'm using the exercise to get my thoughts straight on how CDF should fit into KMS. (One thing I plan to add support for is an i2c connected hdmi encoder.. which looks like it would fit well in
drivers/gpu/drm/i2c.. so the drm encoder-slave stuff might be the way.)If you have any suggestions on the DT bindings, I'd like to hear 'em.
btw, a little bit of-topic, but speaking of DT...
Quoted 8 lines
Quoted 2 lines
Anybody have any clue about how backlight devices are supposed to work in this brave new DT world?
See Runtime interpreted power sequences here:
http://lkml.indiana.edu/hypermail/linux/kernel/1208.2/00029.htmlIt is an attempt to address this need.
hmm, I'm not really sure that is what is needed.. or rather, it might perhaps make sense to have a generic backlight driver implementation that could be used where appropriate, but I'm a bit suspicious about that trying to cover absolutely everything.
Quoted 1 line
From the drm/display driver we don't even want to care how the
backlight is implemented. You could have (just making something up hypothetically) a backlight controlled via a uart or some sort of other crazy magic.. and eventually the generic interpreter gets out of hand.
Quoted 5 lines
Really I think we just want a way to retrieve a 'struct
backlight_device*' that is created somewhere else. We don't care how that backlight driver is implemented. I don't think we want an interpreter.. we want a way to lookup backlight device by name or phandle or something like that.
I posted a patch for this a while back. It adds a new function called of_find_backlight_by_node() that does exactly that. The way it is supposed to be used is somewhat like this:
panel {
backlight = <&backlight>;
};
backlight: backlight {
...
};Then look up the phandle in the panel/DRM driver and call the new function on the corresponding struct device_node *.
The patch went into 3.8-rc1.
And by the way, the future of the power-sequences series isn't very clear. It was initially developed to allow the DT to contain power sequencing for panels as part of the pwm-backlight driver, but that idea was more or less killed by the CDF. The latest I know of is that they could still be used as part of CDF to implement the actual power sequences for drivers but not use their DT representation because several people were unhappy about it.
Thierry