drm/tegra: Repatriation and DSI support
Subsystems (7)
v2 cover drm/tegra: Repatriation and DSI support
This series of patches moves the Tegra DRM driver back to drivers/gpu/drm where it belongs. While this is not entirely trivial, decoupling it from the host1x driver will make things easier in the long run.
Patches 1 to 14 are mostly cleanup and decoupling from host1x. After those patches, the DRM specific parts are back in drivers/gpu/drm/tegra in which they originated and all host1x support code that they use is exported by the host1x driver and exposed in the include/linux/host1x.h header file.
The larger part of patches 15 to 20 have been contributed by Mikko Perttunen and add support for HDMI on Tegra114.
Patches 21 to 23 are the panel support patches, addressing comments that I received on an earlier version.
Patch 24 fixes an issue with the DPMS mode tracking. Connectors default to off on Tegra, so the initial DPMS mode needs to reflect that.
Patches 25 and 27 add support for DSI and gr2d on Tegra114.
Thierry
Mikko Perttunen (4):
drm/tegra: Add Tegra114 display controller support drm/tegra: Add Tegra114 HDMI support drm/tegra: hdmi: Detect DVI-only displays
host1x: hdmi: Enable VDD earlier for hotplug/DDC
Thierry Reding (23):
drm/tegra: Remove unused fields
drm/tegra: Cleanup tegra_dc structure
drm/tegra: Rename host1x_drm structure to tegra_drm drm/tegra: Rename host1x_drm_file to tegra_drm_file drm/tegra: Rename host1x_drm_context to tegra_drm_context
gpu: host1x: Cleanup includes
gpu: host1x: Do not discard .remove()
drm/tegra: gr2d: Miscellaneous cleanups drm/tegra: gem: Miscellaneous cleanups
gpu: host1x: Make host1x header file public drm/tegra: Introduce tegra_drm_client structure
gpu: host1x: Expose syncpt and channel functionality drm/tegra: Move subdevice infrastructure to host1x drm/tegra: Move driver to DRM tree
gpu: host1x: Add support for Tegra114
drm/tegra: hdmi: Rename tegra{2,3} to tegra{20,30}
drm: Add panel support
drm/panel: Add simple panel support
drm/tegra: Implement panel support
drm/tegra: Start connectors with correct DPMS mode
gpu: host1x: Add MIPI pad calibration support drm/tegra: Add DSI support
drm/tegra: Add Tegra114 gr2d support
.../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 +
MAINTAINERS | 2 +
drivers/gpu/drm/Kconfig | 4 +
drivers/gpu/drm/Makefile | 3 +
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 | 339 +++++++
drivers/gpu/{host1x/drm => drm/tegra}/Kconfig | 11 +-
drivers/gpu/drm/tegra/Makefile | 16 +
drivers/gpu/drm/tegra/bus.c | 123 +++
drivers/gpu/{host1x/drm => drm/tegra}/dc.c | 34 +-
drivers/gpu/{host1x/drm => drm/tegra}/dc.h | 1 +
drivers/gpu/{host1x/drm => drm/tegra}/drm.c | 441 ++++-----
drivers/gpu/{host1x/drm => drm/tegra}/drm.h | 92 +-
drivers/gpu/drm/tegra/dsi.c | 1026 ++++++++++++++++++++
drivers/gpu/{host1x/drm => drm/tegra}/fb.c | 16 +-
drivers/gpu/{host1x/drm => drm/tegra}/gem.c | 30 +-
drivers/gpu/{host1x/drm => drm/tegra}/gem.h | 4 +-
drivers/gpu/{host1x/drm => drm/tegra}/gr2d.c | 176 ++--
drivers/gpu/{host1x/drm => drm/tegra}/hdmi.c | 177 +++-
drivers/gpu/{host1x/drm => drm/tegra}/hdmi.h | 152 +++
drivers/gpu/{host1x/drm => drm/tegra}/output.c | 40 +-
drivers/gpu/{host1x/drm => drm/tegra}/rgb.c | 3 -
drivers/gpu/host1x/Kconfig | 2 -
drivers/gpu/host1x/Makefile | 14 +-
drivers/gpu/host1x/bus.c | 309 ++++++
drivers/gpu/host1x/{host1x_client.h => bus.h} | 24 +-
drivers/gpu/host1x/cdma.c | 2 +-
drivers/gpu/host1x/channel.h | 6 -
drivers/gpu/host1x/dev.c | 73 +-
drivers/gpu/host1x/dev.h | 9 +-
drivers/gpu/host1x/host1x.h | 30 -
drivers/gpu/host1x/host1x_bo.h | 87 --
drivers/gpu/host1x/hw/channel_hw.c | 4 +-
drivers/gpu/host1x/hw/debug_hw.c | 8 -
drivers/gpu/host1x/hw/host1x02.c | 42 +
drivers/gpu/host1x/hw/host1x02.h | 26 +
drivers/gpu/host1x/hw/hw_host1x02_channel.h | 121 +++
drivers/gpu/host1x/hw/hw_host1x02_sync.h | 243 +++++
drivers/gpu/host1x/hw/hw_host1x02_uclass.h | 175 ++++
drivers/gpu/host1x/job.c | 2 +-
drivers/gpu/host1x/job.h | 108 ---
drivers/gpu/host1x/mipi.c | 230 +++++
drivers/gpu/host1x/syncpt.c | 19 +
drivers/gpu/host1x/syncpt.h | 40 +-
drivers/video/Kconfig | 4 +-
include/drm/drmP.h | 1 +
include/drm/drm_panel.h | 78 ++
include/linux/host1x.h | 278 ++++++
53 files changed, 3922 insertions(+), 859 deletions(-)
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_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
rename drivers/gpu/{host1x/drm => drm/tegra}/Kconfig (97%)
create mode 100644 drivers/gpu/drm/tegra/Makefile
create mode 100644 drivers/gpu/drm/tegra/bus.c
rename drivers/gpu/{host1x/drm => drm/tegra}/dc.c (97%)
rename drivers/gpu/{host1x/drm => drm/tegra}/dc.h (99%)
rename drivers/gpu/{host1x/drm => drm/tegra}/drm.c (56%)
rename drivers/gpu/{host1x/drm => drm/tegra}/drm.h (78%)
create mode 100644 drivers/gpu/drm/tegra/dsi.c
rename drivers/gpu/{host1x/drm => drm/tegra}/fb.c (96%)
rename drivers/gpu/{host1x/drm => drm/tegra}/gem.c (89%)
rename drivers/gpu/{host1x/drm => drm/tegra}/gem.h (98%)
rename drivers/gpu/{host1x/drm => drm/tegra}/gr2d.c (68%)
rename drivers/gpu/{host1x/drm => drm/tegra}/hdmi.c (86%)
rename drivers/gpu/{host1x/drm => drm/tegra}/hdmi.h (72%)
rename drivers/gpu/{host1x/drm => drm/tegra}/output.c (87%)
rename drivers/gpu/{host1x/drm => drm/tegra}/rgb.c (98%)
create mode 100644 drivers/gpu/host1x/bus.c
rename drivers/gpu/host1x/{host1x_client.h => bus.h} (60%)
delete mode 100644 drivers/gpu/host1x/host1x.h
delete mode 100644 drivers/gpu/host1x/host1x_bo.h
create mode 100644 drivers/gpu/host1x/hw/host1x02.c
create mode 100644 drivers/gpu/host1x/hw/host1x02.h
create mode 100644 drivers/gpu/host1x/hw/hw_host1x02_channel.h
create mode 100644 drivers/gpu/host1x/hw/hw_host1x02_sync.h
create mode 100644 drivers/gpu/host1x/hw/hw_host1x02_uclass.h
create mode 100644 drivers/gpu/host1x/mipi.c
create mode 100644 include/drm/drm_panel.h
create mode 100644 include/linux/host1x.hSignature · 1 line
1.8.4
A message that is not in the archive (sent off-list or not yet received): 1381134884-5816-1-git-send-email-treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org
PATCH v2 1/27 drm/tegra: Remove unused fields
Some of the fields in struct host1x_drm haven't been used for a while, so remove them.
--- drivers/gpu/host1x/drm/drm.h | 4 ---- 1 file changed, 4 deletions(-)
drivers/gpu/host1x/drm/drm.h +0 -4
@@ -33,10 +33,6 @@ struct tegra_fbdev {struct host1x_drm {struct drm_device *drm;struct device *dev; -void __iomem *regs; -struct clk *clk; -int syncpt; -int irq;struct mutex drm_clients_lock;struct list_head drm_clients;
Signature · 1 line
1.8.4
PATCH v2 2/27 drm/tegra: Cleanup tegra_dc structure
In reply to a message not in the archiveRemove the unused host1x field from the structure and group the fields more logically.
--- drivers/gpu/host1x/drm/drm.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/gpu/host1x/drm/drm.h +1 -4
@@ -94,16 +94,13 @@ struct tegra_output;struct tegra_dc {struct host1x_client client; -spinlock_t lock; - -struct host1x_drm *host1x;struct device *dev; +spinlock_t lock;struct drm_crtc base;int pipe;struct clk *clk; -void __iomem *regs;int irq;
Signature · 1 line
1.8.4
PATCH v2 3/27 drm/tegra: Rename host1x_drm structure to tegra_drm
In reply to a message not in the archiveThe host1x and Tegra DRM drivers are currently tightly coupled. Renaming the structure marks the boundary more clearly.
--- drivers/gpu/host1x/dev.c | 2 +- drivers/gpu/host1x/drm/dc.c | 8 +- drivers/gpu/host1x/drm/drm.c | 169 ++++++++++++++++++------------------- drivers/gpu/host1x/drm/drm.h | 18 ++-- drivers/gpu/host1x/drm/fb.c | 14 +-- drivers/gpu/host1x/drm/gr2d.c | 8 +- drivers/gpu/host1x/drm/hdmi.c | 8 +- drivers/gpu/host1x/host1x_client.h | 4 +- 8 files changed, 115 insertions(+), 116 deletions(-)
drivers/gpu/host1x/dev.c +1 -1
@@ -163,7 +163,7 @@ static int host1x_probe(struct platform_device *pdev)host1x_debug_init (host); -host1x_drm_alloc (pdev); +tegra_drm_alloc (pdev);return 0 ;
drivers/gpu/host1x/drm/dc.c +4 -4
@@ -1109,7 +1109,7 @@ static const struct host1x_client_ops dc_client_ops = {static int tegra_dc_probe (struct platform_device *pdev) { -struct host1x_drm *host1x =host1x_get_drm_data (pdev->dev.parent); +struct tegra_drm *tegra =host1x_get_drm_data (pdev->dev.parent);struct resource *regs;struct tegra_dc *dc;int err;
@@ -1153,7 +1153,7 @@ static int tegra_dc_probe(struct platform_device *pdev)return err; } - err =host1x_register_client (host1x, &dc->client); + err =host1x_register_client (tegra, &dc->client);if (err <0 ) {dev_err (&pdev->dev,"failed to register host1x client: %d\n" , err);
@@ -1167,11 +1167,11 @@ static int tegra_dc_probe(struct platform_device *pdev)static int tegra_dc_remove (struct platform_device *pdev) { -struct host1x_drm *host1x =host1x_get_drm_data (pdev->dev.parent); +struct tegra_drm *tegra =host1x_get_drm_data (pdev->dev.parent);struct tegra_dc *dc =platform_get_drvdata (pdev);int err; - err =host1x_unregister_client (host1x, &dc->client); + err =host1x_unregister_client (tegra, &dc->client);if (err <0 ) {dev_err (&pdev->dev,"failed to unregister host1x client: %d\n" , err);
drivers/gpu/host1x/drm/drm.c +84 -85
330 lines not on this page · raw message
drivers/gpu/host1x/drm/drm.h +9 -9
@@ -30,13 +30,13 @@ struct tegra_fbdev {struct tegra_fb *fb; }; -struct host1x_drm { +struct tegra_drm {struct drm_device *drm;struct device *dev; -struct mutex drm_clients_lock; -struct list_head drm_clients; -struct list_head drm_active; +struct mutex subdevs_lock; +struct list_head subdevs; +struct list_head active;struct mutex clients_lock;struct list_head clients;
@@ -68,7 +68,7 @@ struct host1x_drm_file { };struct host1x_client { -struct host1x_drm *host1x; +struct tegra_drm *tegra;struct device *dev;const struct host1x_client_ops *ops;
@@ -82,12 +82,12 @@ struct host1x_client {struct list_head list; }; -extern int host1x_drm_init (struct host1x_drm *host1x,struct drm_device *drm); -extern int host1x_drm_exit (struct host1x_drm *host1x); +extern int tegra_drm_init (struct tegra_drm *tegra,struct drm_device *drm); +extern int tegra_drm_exit (struct tegra_drm *tegra); -extern int host1x_register_client (struct host1x_drm *host1x, +extern int host1x_register_client (struct tegra_drm *tegra,struct host1x_client *client); -extern int host1x_unregister_client (struct host1x_drm *host1x, +extern int host1x_unregister_client (struct tegra_drm *tegra,struct host1x_client *client);struct tegra_output ;
drivers/gpu/host1x/drm/fb.c +7 -7
@@ -323,10 +323,10 @@ static void tegra_fbdev_free(struct tegra_fbdev *fbdev)static void tegra_fb_output_poll_changed (struct drm_device *drm) { -struct host1x_drm *host1x = drm->dev_private; +struct tegra_drm *tegra = drm->dev_private; -if (host1x->fbdev) -drm_fb_helper_hotplug_event (&host1x->fbdev->base); +if (tegra->fbdev) +drm_fb_helper_hotplug_event (&tegra->fbdev->base); }static const struct drm_mode_config_funcs tegra_drm_mode_funcs = {
@@ -336,7 +336,7 @@ static const struct drm_mode_config_funcs tegra_drm_mode_funcs = {int tegra_drm_fb_init (struct drm_device *drm) { -struct host1x_drm *host1x = drm->dev_private; +struct tegra_drm *tegra = drm->dev_private;struct tegra_fbdev *fbdev; drm->mode_config.min_width =0 ;
@@ -352,16 +352,16 @@ int tegra_drm_fb_init(struct drm_device *drm)if (IS_ERR (fbdev))return PTR_ERR (fbdev); - host1x->fbdev = fbdev; + tegra->fbdev = fbdev;return 0 ; }void tegra_drm_fb_exit (struct drm_device *drm) { -struct host1x_drm *host1x = drm->dev_private; +struct tegra_drm *tegra = drm->dev_private; -tegra_fbdev_free (host1x->fbdev); +tegra_fbdev_free (tegra->fbdev); }void tegra_fbdev_restore_mode (struct tegra_fbdev *fbdev)
drivers/gpu/host1x/drm/gr2d.c +4 -4
@@ -256,7 +256,7 @@ static const struct of_device_id gr2d_match[] = {static int gr2d_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev; -struct host1x_drm *host1x =host1x_get_drm_data (dev->parent); +struct tegra_drm *tegra =host1x_get_drm_data (dev->parent);int err;struct gr2d *gr2d =NULL ;struct host1x_syncpt **syncpts;
@@ -297,7 +297,7 @@ static int gr2d_probe(struct platform_device *pdev) gr2d->client.syncpts = syncpts; gr2d->client.num_syncpts =1 ; - err =host1x_register_client (host1x, &gr2d->client); + err =host1x_register_client (tegra, &gr2d->client);if (err <0 ) {dev_err (dev,"failed to register host1x client: %d\n" , err);return err;
@@ -312,12 +312,12 @@ static int gr2d_probe(struct platform_device *pdev) static int __exit gr2d_remove(struct platform_device *pdev) { -struct host1x_drm *host1x =host1x_get_drm_data (pdev->dev.parent); +struct tegra_drm *tegra =host1x_get_drm_data (pdev->dev.parent);struct gr2d *gr2d =platform_get_drvdata (pdev);unsigned int i;int err; - err =host1x_unregister_client (host1x, &gr2d->client); + err =host1x_unregister_client (tegra, &gr2d->client);if (err <0 ) {dev_err (&pdev->dev,"failed to unregister client: %d\n" , err);return err;
drivers/gpu/host1x/drm/hdmi.c +4 -4
@@ -1181,7 +1181,7 @@ static const struct host1x_client_ops hdmi_client_ops = {static int tegra_hdmi_probe (struct platform_device *pdev) { -struct host1x_drm *host1x =host1x_get_drm_data (pdev->dev.parent); +struct tegra_drm *tegra =host1x_get_drm_data (pdev->dev.parent);struct tegra_hdmi *hdmi;struct resource *regs;int err;
@@ -1256,7 +1256,7 @@ static int tegra_hdmi_probe(struct platform_device *pdev)INIT_LIST_HEAD (&hdmi->client.list); hdmi->client.dev = &pdev->dev; - err =host1x_register_client (host1x, &hdmi->client); + err =host1x_register_client (tegra, &hdmi->client);if (err <0 ) {dev_err (&pdev->dev,"failed to register host1x client: %d\n" , err);
@@ -1270,11 +1270,11 @@ static int tegra_hdmi_probe(struct platform_device *pdev)static int tegra_hdmi_remove (struct platform_device *pdev) { -struct host1x_drm *host1x =host1x_get_drm_data (pdev->dev.parent); +struct tegra_drm *tegra =host1x_get_drm_data (pdev->dev.parent);struct tegra_hdmi *hdmi =platform_get_drvdata (pdev);int err; - err =host1x_unregister_client (host1x, &hdmi->client); + err =host1x_unregister_client (tegra, &hdmi->client);if (err <0 ) {dev_err (&pdev->dev,"failed to unregister host1x client: %d\n" , err);
drivers/gpu/host1x/host1x_client.h +2 -2
@@ -21,9 +21,9 @@ struct device;struct platform_device ;#ifdef CONFIG_DRM_TEGRA -int host1x_drm_alloc (struct platform_device *pdev); +int tegra_drm_alloc (struct platform_device *pdev);#else -static inline int host1x_drm_alloc (struct platform_device *pdev) +static inline int tegra_drm_alloc (struct platform_device *pdev) {return 0 ; }
Signature · 6 lines
1.8.4 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v2 4/27 drm/tegra: Rename host1x_drm_file to tegra_drm_file
In reply to a message not in the archiveThis structure extends drm_file with Tegra DRM specific fields and has nothing to do with host1x. Rename the structure to more clearly mark the boundaries between host1x and Tegra DRM.
While at it, move the structure definition out of the header. It's never used outside of the drm.c source file, so it can be defined within that.
--- drivers/gpu/host1x/drm/drm.c | 26 +++++++++++++++----------- drivers/gpu/host1x/drm/drm.h | 4 ---- 2 files changed, 15 insertions(+), 15 deletions(-)
drivers/gpu/host1x/drm/drm.c +15 -11
@@ -30,6 +30,10 @@#define DRIVER_MINOR 0#define DRIVER_PATCHLEVEL 0 +struct tegra_drm_file { +struct list_head contexts; +}; +struct host1x_subdev {struct host1x_client *client;struct device_node *np;
@@ -290,7 +294,7 @@ static int tegra_drm_unload(struct drm_device *drm)static int tegra_drm_open (struct drm_device *drm,struct drm_file *filp) { -struct host1x_drm_file *fpriv; +struct tegra_drm_file *fpriv; fpriv =kzalloc (sizeof (*fpriv),GFP_KERNEL );if (!fpriv)
@@ -316,8 +320,8 @@ static void tegra_drm_lastclose(struct drm_device *drm) }#ifdef CONFIG_DRM_TEGRA_STAGING -static bool host1x_drm_file_owns_context (struct host1x_drm_file *file, -struct host1x_drm_context *context) +static bool tegra_drm_file_owns_context (struct tegra_drm_file *file, +struct host1x_drm_context *context) {struct host1x_drm_context *ctx;
@@ -406,7 +410,7 @@ static int tegra_syncpt_wait(struct drm_device *drm, void *data,static int tegra_open_channel (struct drm_device *drm,void *data,struct drm_file *file) { -struct host1x_drm_file *fpriv = file->driver_priv; +struct tegra_drm_file *fpriv = file->driver_priv;struct tegra_drm *tegra = drm->dev_private;struct drm_tegra_open_channel *args = data;struct host1x_drm_context *context;
@@ -437,11 +441,11 @@ static int tegra_close_channel(struct drm_device *drm, void *data, struct drm_file *file) {struct drm_tegra_close_channel *args = data; -struct host1x_drm_file *fpriv = file->driver_priv; +struct tegra_drm_file *fpriv = file->driver_priv;struct host1x_drm_context *context = (struct host1x_drm_context *)(uintptr_t )args->context; -if (!host1x_drm_file_owns_context (fpriv, context)) +if (!tegra_drm_file_owns_context (fpriv, context))return -EINVAL ;list_del (&context->list);
@@ -453,13 +457,13 @@ static int tegra_close_channel(struct drm_device *drm, void *data,static int tegra_get_syncpt (struct drm_device *drm,void *data,struct drm_file *file) { +struct tegra_drm_file *fpriv = file->driver_priv;struct drm_tegra_get_syncpt *args = data; -struct host1x_drm_file *fpriv = file->driver_priv;struct host1x_drm_context *context = (struct host1x_drm_context *)(uintptr_t )args->context;struct host1x_syncpt *syncpt; -if (!host1x_drm_file_owns_context (fpriv, context)) +if (!tegra_drm_file_owns_context (fpriv, context))return -ENODEV ;if (args->index >= context->client->num_syncpts)
@@ -474,12 +478,12 @@ static int tegra_get_syncpt(struct drm_device *drm, void *data,static int tegra_submit (struct drm_device *drm,void *data,struct drm_file *file) { +struct tegra_drm_file *fpriv = file->driver_priv;struct drm_tegra_submit *args = data; -struct host1x_drm_file *fpriv = file->driver_priv;struct host1x_drm_context *context = (struct host1x_drm_context *)(uintptr_t )args->context; -if (!host1x_drm_file_owns_context (fpriv, context)) +if (!tegra_drm_file_owns_context (fpriv, context))return -ENODEV ;return context->client->ops->submit (context, args, drm, file);
@@ -558,7 +562,7 @@ static void tegra_drm_disable_vblank(struct drm_device *drm, int pipe)static void tegra_drm_preclose (struct drm_device *drm,struct drm_file *file) { -struct host1x_drm_file *fpriv = file->driver_priv; +struct tegra_drm_file *fpriv = file->driver_priv;struct host1x_drm_context *context, *tmp;struct drm_crtc *crtc;
drivers/gpu/host1x/drm/drm.h +0 -4
@@ -63,10 +63,6 @@ struct host1x_client_ops { struct drm_file *file); }; -struct host1x_drm_file { -struct list_head contexts; -}; -struct host1x_client {struct tegra_drm *tegra;struct device *dev;
Signature · 1 line
1.8.4
PATCH v2 5/27 drm/tegra: Rename host1x_drm_context to tegra_drm_context
In reply to a message not in the archiveThe structure represents a context associated with a particular process that has opened the Tegra DRM device and requested a channel. This is a very DRM-specific notion and has nothing to do with host1x. Rename the structure to more clearly mark the boundaries between the two.
--- drivers/gpu/host1x/drm/drm.c | 34 +++++++++++++++++++++------------- drivers/gpu/host1x/drm/drm.h | 8 ++++---- drivers/gpu/host1x/drm/gr2d.c | 6 +++--- 3 files changed, 28 insertions(+), 20 deletions(-)
drivers/gpu/host1x/drm/drm.c +21 -13
@@ -306,7 +306,7 @@ static int tegra_drm_open(struct drm_device *drm, struct drm_file *filp)return 0 ; } -static void host1x_drm_context_free (struct host1x_drm_context *context) +static void tegra_drm_context_free (struct tegra_drm_context *context) { context->client->ops->close_channel (context);kfree (context);
@@ -320,10 +320,15 @@ static void tegra_drm_lastclose(struct drm_device *drm) }#ifdef CONFIG_DRM_TEGRA_STAGING +static struct tegra_drm_context *tegra_drm_get_context (__u64 context) +{ +return (struct tegra_drm_context *)(uintptr_t )context; +} +static bool tegra_drm_file_owns_context (struct tegra_drm_file *file, -struct host1x_drm_context *context) +struct tegra_drm_context *context) { -struct host1x_drm_context *ctx; +struct tegra_drm_context *ctx;list_for_each_entry (ctx, &file->contexts, list)if (ctx == context)
@@ -413,7 +418,7 @@ static int tegra_open_channel(struct drm_device *drm, void *data,struct tegra_drm_file *fpriv = file->driver_priv;struct tegra_drm *tegra = drm->dev_private;struct drm_tegra_open_channel *args = data; -struct host1x_drm_context *context; +struct tegra_drm_context *context;struct host1x_client *client;int err = -ENODEV ;
@@ -442,14 +447,15 @@ static int tegra_close_channel(struct drm_device *drm, void *data, {struct drm_tegra_close_channel *args = data;struct tegra_drm_file *fpriv = file->driver_priv; -struct host1x_drm_context *context = - (struct host1x_drm_context *)(uintptr_t )args->context; +struct tegra_drm_context *context; + + context =tegra_drm_get_context (args->context);if (!tegra_drm_file_owns_context (fpriv, context))return -EINVAL ;list_del (&context->list); -host1x_drm_context_free (context); +tegra_drm_context_free (context);return 0 ; }
@@ -459,10 +465,11 @@ static int tegra_get_syncpt(struct drm_device *drm, void *data, {struct tegra_drm_file *fpriv = file->driver_priv;struct drm_tegra_get_syncpt *args = data; -struct host1x_drm_context *context = - (struct host1x_drm_context *)(uintptr_t )args->context; +struct tegra_drm_context *context;struct host1x_syncpt *syncpt; + context =tegra_drm_get_context (args->context); +if (!tegra_drm_file_owns_context (fpriv, context))return -ENODEV ;
@@ -480,8 +487,9 @@ static int tegra_submit(struct drm_device *drm, void *data, {struct tegra_drm_file *fpriv = file->driver_priv;struct drm_tegra_submit *args = data; -struct host1x_drm_context *context = - (struct host1x_drm_context *)(uintptr_t )args->context; +struct tegra_drm_context *context; + + context =tegra_drm_get_context (args->context);if (!tegra_drm_file_owns_context (fpriv, context))return -ENODEV ;
@@ -563,14 +571,14 @@ static void tegra_drm_disable_vblank(struct drm_device *drm, int pipe)static void tegra_drm_preclose (struct drm_device *drm,struct drm_file *file) {struct tegra_drm_file *fpriv = file->driver_priv; -struct host1x_drm_context *context, *tmp; +struct tegra_drm_context *context, *tmp;struct drm_crtc *crtc;list_for_each_entry (crtc, &drm->mode_config.crtc_list, head)tegra_dc_cancel_page_flip (crtc, file);list_for_each_entry_safe (context, tmp, &fpriv->contexts, list) -host1x_drm_context_free (context); +tegra_drm_context_free (context);kfree (fpriv); }
drivers/gpu/host1x/drm/drm.h +4 -4
@@ -46,7 +46,7 @@ struct tegra_drm {struct host1x_client ; -struct host1x_drm_context { +struct tegra_drm_context {struct host1x_client *client;struct host1x_channel *channel;struct list_head list;
@@ -56,9 +56,9 @@ struct host1x_client_ops {int (*drm_init)(struct host1x_client *client,struct drm_device *drm);int (*drm_exit)(struct host1x_client *client);int (*open_channel)(struct host1x_client *client, -struct host1x_drm_context *context); -void (*close_channel)(struct host1x_drm_context *context); -int (*submit)(struct host1x_drm_context *context, +struct tegra_drm_context *context); +void (*close_channel)(struct tegra_drm_context *context); +int (*submit)(struct tegra_drm_context *context,struct drm_tegra_submit *args,struct drm_device *drm,struct drm_file *file); };
drivers/gpu/host1x/drm/gr2d.c +3 -3
@@ -58,7 +58,7 @@ static int gr2d_client_exit(struct host1x_client *client) }static int gr2d_open_channel (struct host1x_client *client, -struct host1x_drm_context *context) +struct tegra_drm_context *context) {struct gr2d *gr2d =to_gr2d (client);
@@ -70,7 +70,7 @@ static int gr2d_open_channel(struct host1x_client *client,return 0 ; } -static void gr2d_close_channel (struct host1x_drm_context *context) +static void gr2d_close_channel (struct tegra_drm_context *context) {host1x_channel_put (context->channel); }
@@ -94,7 +94,7 @@ static struct host1x_bo *host1x_bo_lookup(struct drm_device *drm,return &bo->base; } -static int gr2d_submit (struct host1x_drm_context *context, +static int gr2d_submit (struct tegra_drm_context *context,struct drm_tegra_submit *args,struct drm_device *drm,struct drm_file *file) {
Signature · 1 line
1.8.4
PATCH v2 6/27 gpu: host1x: Cleanup includes
In reply to a message not in the archiveMost of the included files are either not required or already included by some other header file.
--- drivers/gpu/host1x/drm/dc.c | 5 +---- drivers/gpu/host1x/drm/drm.c | 10 ---------- drivers/gpu/host1x/drm/fb.c | 2 -- drivers/gpu/host1x/drm/gem.c | 9 --------- drivers/gpu/host1x/drm/gr2d.c | 7 ------- drivers/gpu/host1x/drm/hdmi.c | 8 +------- drivers/gpu/host1x/drm/output.c | 2 -- drivers/gpu/host1x/drm/rgb.c | 3 --- drivers/gpu/host1x/hw/debug_hw.c | 7 ------- 9 files changed, 2 insertions(+), 51 deletions(-)
drivers/gpu/host1x/drm/dc.c +1 -4
@@ -8,11 +8,8 @@*/ #include <linux/clk.h> -#include <linux/debugfs.h> -#include <linux/module.h> -#include <linux/of.h> -#include <linux/platform_device.h> #include <linux/clk/tegra.h> +#include <linux/debugfs.h> #include "host1x_client.h" #include "dc.h"
drivers/gpu/host1x/drm/drm.c +0 -10
@@ -7,16 +7,6 @@* published by the Free Software Foundation. */ -#include <linux/module.h> -#include <linux/of_address.h> -#include <linux/of_platform.h> - -#include <linux/dma-mapping.h> -#include <asm/dma-iommu.h> - -#include <drm/drm.h> -#include <drm/drmP.h> -#include "host1x_client.h" #include "dev.h" #include "drm.h"
drivers/gpu/host1x/drm/fb.c +0 -2
@@ -10,8 +10,6 @@* published by the Free Software Foundation. */ -#include <linux/module.h> -#include "drm.h" #include "gem.h"
drivers/gpu/host1x/drm/gem.c +0 -9
@@ -18,15 +18,6 @@* GNU General Public License for more details. */ -#include <linux/mm.h> -#include <linux/slab.h> -#include <linux/mutex.h> -#include <linux/export.h> -#include <linux/dma-mapping.h> - -#include <drm/drmP.h> -#include <drm/drm.h> -#include "gem.h" static inline struct tegra_bo *host1x_to_drm_bo (struct host1x_bo *bo)
drivers/gpu/host1x/drm/gr2d.c +0 -7
@@ -1,8 +1,4 @@/* -* drivers/video/tegra/host/gr2d/gr2d.c -* -* Tegra Graphics 2D -* * Copyright (c) 2012-2013, NVIDIA Corporation. * * This program is free software; you can redistribute it and/or modify it
@@ -18,9 +14,6 @@* along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include <linux/export.h> -#include <linux/of.h> -#include <linux/of_device.h> #include <linux/clk.h> #include "channel.h"
drivers/gpu/host1x/drm/hdmi.c +1 -7
@@ -8,16 +8,10 @@*/ #include <linux/clk.h> +#include <linux/clk/tegra.h> #include <linux/debugfs.h> -#include <linux/gpio.h> #include <linux/hdmi.h> -#include <linux/module.h> -#include <linux/of.h> -#include <linux/platform_device.h> #include <linux/regulator/consumer.h> -#include <linux/clk/tegra.h> - -#include <drm/drm_edid.h> #include "hdmi.h" #include "drm.h"
drivers/gpu/host1x/drm/output.c +0 -2
@@ -7,9 +7,7 @@* published by the Free Software Foundation. */ -#include <linux/module.h> #include <linux/of_gpio.h> -#include <linux/i2c.h> #include "drm.h"
drivers/gpu/host1x/drm/rgb.c +0 -3
@@ -8,9 +8,6 @@*/ #include <linux/clk.h> -#include <linux/module.h> -#include <linux/of.h> -#include <linux/platform_device.h> #include "drm.h" #include "dc.h"
drivers/gpu/host1x/hw/debug_hw.c +0 -7
@@ -15,13 +15,6 @@* */ -#include <linux/debugfs.h> -#include <linux/seq_file.h> -#include <linux/mm.h> -#include <linux/scatterlist.h> - -#include <linux/io.h> -#include "dev.h" #include "debug.h" #include "cdma.h"
Signature · 1 line
1.8.4
A message that is not in the archive (sent off-list or not yet received): 1381134884-5816-7-git-send-email-treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org
Re: [PATCH v2 06/27] gpu: host1x: Cleanup includes
Quoted 2 lines · Thierry Reding
Most of the included files are either not required or already included by some other header file.
What's the general policy? I personally feel that each source file should #include all the header files it needs, and should not rely on header files #including other header files.
This way if header file A stops needing header file B, we don't need to go and fix all users of header file A that assume B is included.
I've been hit by this multiple times in Linux kernel - sometimes some header files just assume another header file is #included and refuses to compile it it isn't.
Terje
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH v2 06/27] gpu: host1x: Cleanup includes
Quoted 8 lines · Terje Bergström
Quoted 2 lines · Thierry Reding
Most of the included files are either not required or already included by some other header file.
What's the general policy? I personally feel that each source file should #include all the header files it needs, and should not rely on header files #including other header files.
Quoted 6 lines
This way if header file A stops needing header file B, we don't need to go and fix all users of header file A that assume B is included.
I've been hit by this multiple times in Linux kernel - sometimes some header files just assume another header file is #included and refuses to compile it it isn't.
Explicit includes are probably the safest route when dealing with headers from include/linux, which can be volatile. However, in this case any of the general header files are already included by driver private header files, which are not subject to the same volatility. Or when they change we'll see breakage immediately because pretty much everything about the driver will be rebuilt.
It even has the advantage that if a file in include/linux or include/drm changes in a way that breaks compilation, we only have to change one of the driver private headers instead of all source files.
Thierry
PATCH v2 7/27 gpu: host1x: Do not discard .remove()
In reply to a message not in the archiveThe device can be unbound from the driver via sysfs, so regardless of whether the driver is builtin or a module, its .remove() function needs to stick around.
--- drivers/gpu/host1x/dev.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/gpu/host1x/dev.c +3 -4
@@ -172,7 +172,7 @@ fail_deinit_syncpt:return err; } -static int __exit host1x_remove(struct platform_device *pdev) +static int host1x_remove (struct platform_device *pdev) {struct host1x *host =platform_get_drvdata (pdev);
@@ -184,13 +184,12 @@ static int __exit host1x_remove(struct platform_device *pdev) }static struct platform_driver tegra_host1x_driver = { - .probe = host1x_probe, - .remove =__exit_p (host1x_remove), .driver = { - .owner =THIS_MODULE , .name ="tegra-host1x" , .of_match_table = host1x_of_match, }, + .probe = host1x_probe, + .remove = host1x_remove, };static int __init tegra_host1x_init (void )
Signature · 1 line
1.8.4
PATCH v2 8/27 drm/tegra: gr2d: Miscellaneous cleanups
In reply to a message not in the archiveRework the address table code for the host1x firewall. The previous implementation allocated a bitfield but didn't check for a valid pointer so it could potentially crash. Furthermore setting up a bitfield makes the code more complex than it needs to be.
Don't annotate the driver's .remove() function __exit. Even if built in the driver can be unloaded via sysfs, so .remove() needs to stick around after initialization. Also remove the explicit initialization of the driver's .owner field to THIS_MODULE because that's now handled by the driver core.
Furthermore make an error message more consistent with other subdrivers, index the syncpts array for better readability, remove a gratuituous newline and reorder some variable declarations to make the code easier to read.
--- drivers/gpu/host1x/drm/gr2d.c | 95 +++++++++++++++++++------------------------ 1 file changed, 41 insertions(+), 54 deletions(-)
drivers/gpu/host1x/drm/gr2d.c +41 -54
@@ -27,9 +27,8 @@struct gr2d {struct host1x_client client; -struct clk *clk;struct host1x_channel *channel; -unsigned long *addr_regs; +struct clk *clk; };static inline struct gr2d *to_gr2d (struct host1x_client *client)
@@ -37,8 +36,6 @@ static inline struct gr2d *to_gr2d(struct host1x_client *client) return container_of(client, struct gr2d, client); } -static int gr2d_is_addr_reg (struct device *dev,u32 class,u32 reg); -static int gr2d_client_init (struct host1x_client *client,struct drm_device *drm) {
@@ -56,7 +53,6 @@ static int gr2d_open_channel(struct host1x_client *client,struct gr2d *gr2d =to_gr2d (client); context->channel =host1x_channel_get (gr2d->channel); -if (!context->channel)return -ENOMEM ;
@@ -87,11 +83,38 @@ static struct host1x_bo *host1x_bo_lookup(struct drm_device *drm,return &bo->base; } +static const u32 gr2d_addr_regs[] = { +0x1a ,0x1b ,0x26 ,0x2b ,0x2c ,0x2d ,0x31 ,0x32 , +0x48 ,0x49 ,0x4a ,0x4b ,0x4c +}; + +static int gr2d_is_addr_reg (struct device *dev,u32 class,u32 offset) +{ +unsigned int i; + +switch (class) { +case HOST1X_CLASS_HOST1X : +if (offset ==0x2b ) +return 1 ; + +break ; + +case HOST1X_CLASS_GR2D : +case HOST1X_CLASS_GR2D_SB : +for (i =0 ; i <ARRAY_SIZE (gr2d_addr_regs); i++) +if (offset == gr2d_addr_regs[i]) +return 1 ; + +break ; + } + +return 0 ; +} +static int gr2d_submit (struct tegra_drm_context *context,struct drm_tegra_submit *args,struct drm_device *drm,struct drm_file *file) { -struct host1x_job *job;unsigned int num_cmdbufs = args->num_cmdbufs;unsigned int num_relocs = args->num_relocs;unsigned int num_waitchks = args->num_waitchks;
@@ -102,6 +125,7 @@ static int gr2d_submit(struct tegra_drm_context *context,struct drm_tegra_waitchk __user *waitchks = (void *__user )(uintptr_t )args->waitchks;struct drm_tegra_syncpt syncpt; +struct host1x_job *job;int err;/* We don't yet support other than one syncpt_incr struct per submit */
@@ -205,41 +229,6 @@ static struct host1x_client_ops gr2d_client_ops = { .submit = gr2d_submit, }; -static void gr2d_init_addr_reg_map (struct device *dev,struct gr2d *gr2d) -{ -const u32 gr2d_addr_regs[] = {0x1a ,0x1b ,0x26 ,0x2b ,0x2c ,0x2d ,0x31 , -0x32 ,0x48 ,0x49 ,0x4a ,0x4b ,0x4c }; -unsigned long *bitmap; -int i; - - bitmap =devm_kzalloc (dev,DIV_ROUND_UP (256 ,BITS_PER_BYTE ), -GFP_KERNEL ); - -for (i =0 ; i <ARRAY_SIZE (gr2d_addr_regs); ++i) { -u32 reg = gr2d_addr_regs[i]; - bitmap[BIT_WORD (reg)] |=BIT_MASK (reg); - } - - gr2d->addr_regs = bitmap; -} - -static int gr2d_is_addr_reg (struct device *dev,u32 class,u32 reg) -{ -struct gr2d *gr2d =dev_get_drvdata (dev); - -switch (class) { -case HOST1X_CLASS_HOST1X : -return reg ==0x2b ; -case HOST1X_CLASS_GR2D : -case HOST1X_CLASS_GR2D_SB : - reg &=0xff ; -if (gr2d->addr_regs[BIT_WORD (reg)] &BIT_MASK (reg)) -return 1 ; -default : -return 0 ; - } -} -static const struct of_device_id gr2d_match[] = { { .compatible ="nvidia,tegra30-gr2d" }, { .compatible ="nvidia,tegra20-gr2d" },
@@ -248,11 +237,11 @@ static const struct of_device_id gr2d_match[] = {static int gr2d_probe (struct platform_device *pdev) { +struct tegra_drm *tegra =host1x_get_drm_data (pdev->dev.parent);struct device *dev = &pdev->dev; -struct tegra_drm *tegra =host1x_get_drm_data (dev->parent); -int err; -struct gr2d *gr2d =NULL ;struct host1x_syncpt **syncpts; +struct gr2d *gr2d; +int err; gr2d =devm_kzalloc (dev,sizeof (*gr2d),GFP_KERNEL );if (!gr2d)
@@ -278,8 +267,8 @@ static int gr2d_probe(struct platform_device *pdev)if (!gr2d->channel)return -ENOMEM ; - *syncpts =host1x_syncpt_request (dev, false); -if (!(*syncpts)) { + syncpts[0 ] =host1x_syncpt_request (dev, false); +if (!syncpts[0 ]) {host1x_channel_free (gr2d->channel);return -ENOMEM ; }
@@ -296,14 +285,12 @@ static int gr2d_probe(struct platform_device *pdev)return err; } -gr2d_init_addr_reg_map (dev, gr2d); -platform_set_drvdata (pdev, gr2d);return 0 ; } -static int __exit gr2d_remove(struct platform_device *pdev) +static int gr2d_remove (struct platform_device *pdev) {struct tegra_drm *tegra =host1x_get_drm_data (pdev->dev.parent);struct gr2d *gr2d =platform_get_drvdata (pdev);
@@ -312,7 +299,8 @@ static int __exit gr2d_remove(struct platform_device *pdev) err =host1x_unregister_client (tegra, &gr2d->client);if (err <0 ) { -dev_err (&pdev->dev,"failed to unregister client: %d\n" , err); +dev_err (&pdev->dev,"failed to unregister host1x client: %d\n" , + err);return err; }
@@ -326,11 +314,10 @@ static int __exit gr2d_remove(struct platform_device *pdev) }struct platform_driver tegra_gr2d_driver = { - .probe = gr2d_probe, - .remove =__exit_p (gr2d_remove), .driver = { - .owner =THIS_MODULE , .name ="gr2d" , .of_match_table = gr2d_match, - } + }, + .probe = gr2d_probe, + .remove = gr2d_remove, };
Signature · 6 lines
1.8.4 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1381134884-5816-9-git-send-email-treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org
Re: [PATCH v2 08/27] drm/tegra: gr2d: Miscellaneous cleanups
Quoted 3 lines · Thierry Reding
Rework the address table code for the host1x firewall. The previous implementation allocated a bitfield but didn't check for a valid pointer so it could potentially crash.
I don't think it could crash. The bitmaps was allocated as a 256-bit field, and the register offset gets AND'ed with 0xFF before being looked up. What am I missing?
Quoted 2 lines
Furthermore setting up a bitfield makes
the code more complex than it needs to be.
Doesn't this perform worse than the current implementation? Going from 1 to 13 checks per write sounds less than ideal to me...
A message that is not in the archive (sent off-list or not yet received): CABPQNSbkS40_jyGz14s08+x3e+-pxnfy90V7pzAOfiqUF2ma2g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Re: [PATCH v2 08/27] drm/tegra: gr2d: Miscellaneous cleanups
Quoted 9 lines · Erik Faye-Lund
Quoted 3 lines · Thierry Reding
Rework the address table code for the host1x firewall. The previous implementation allocated a bitfield but didn't check for a valid pointer so it could potentially crash.
I don't think it could crash. The bitmaps was allocated as a 256-bit field, and the register offset gets AND'ed with
0xFFbefore being looked up. What am I missing?
The pointer returned from the allocation is never checked, so it could theoretically be NULL and be used regardless.
Also I'm not sure that AND'ing with 0xff is the right thing to do here.
Quoted 5 lines
Quoted 2 lines
Furthermore setting up a bitfield makes
the code more complex than it needs to be.Doesn't this perform worse than the current implementation? Going from 1 to 13 checks per write sounds less than ideal to me...
I'm not so sure. Caching should alleviate the issue with the increased amount of data. Then there's the fact that previously we needed to divide and compute the remainder of the division for the BIT_MASK and BIT_WORD operations.
One other added benefit of this approach is that the address registers are stored in a const array and therefore could reside in a read-only memory region. With the previous approach, once somebody had access to the bitmap, it could easily be overwritten with zeros and effectively make the firewall useless. I'm not sure how likely that would be, but it could be done.
I guess one could actually go and run a benchmark against both versions and balance the performance impact against the possible security implications. But given that we don't really have any benchmarks that's pretty hard to do.
Thierry
A message that is not in the archive (sent off-list or not yet received): 20131007121452.GA8324-AwZRO8vwLAwmlAP/[email protected]
Re: [PATCH v2 08/27] drm/tegra: gr2d: Miscellaneous cleanups
Quoted 9 lines · Thierry Reding
* PGP Signed by an unknown key
Quoted 6 lines · Erik Faye-Lund
Quoted 3 lines · Thierry Reding
Rework the address table code for the host1x firewall. The previous implementation allocated a bitfield but didn't check for a valid pointer so it could potentially crash.
Quoted 8 lines
Quoted 3 lines
I don't think it could crash. The bitmaps was allocated as a 256-bit field, and the register offset gets AND'ed with
0xFFbefore being looked up. What am I missing?The pointer returned from the allocation is never checked, so it could theoretically be NULL and be used regardless.
Also I'm not sure that AND'ing with
0xffis the right thing to do here.
Oops, there's a check for NULL missing. If that allocation fails, probe should fail, so we just need to propagate the error condition. Otherwise we might just leave the firewall off, and let everything go in unchecked.
AND 0xff is necessary, because the same registers are mirrored in multiple contexts. AND removes the offset coming from context, and leaves just the plain register offset.
Quoted 4 lines
I'm not so sure. Caching should alleviate the issue with the increased amount of data. Then there's the fact that previously we needed to divide and compute the remainder of the division for the
BIT_MASKandBIT_WORDoperations.
Don't these get compiled into shifts and bitwise ands?
Quoted 6 lines
One other added benefit of this approach is that the address registers are stored in a const array and therefore could reside in a read-only memory region. With the previous approach, once somebody had access to the bitmap, it could easily be overwritten with zeros and effectively make the firewall useless. I'm not sure how likely that would be, but it could be done.
If somebody gets access to the bitmap, he has access to kernel data structures. GR2D firewall is the least of our worries in this case.
Terje
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH v2 08/27] drm/tegra: gr2d: Miscellaneous cleanups
Quoted 19 lines · Terje Bergström
Quoted 9 lines · Thierry Reding
* PGP Signed by an unknown key
Quoted 6 lines · Erik Faye-Lund
Quoted 3 lines · Thierry Reding
Rework the address table code for the host1x firewall. The previous implementation allocated a bitfield but didn't check for a valid pointer so it could potentially crash.
Quoted 8 lines
Quoted 3 lines
I don't think it could crash. The bitmaps was allocated as a 256-bit field, and the register offset gets AND'ed with
0xFFbefore being looked up. What am I missing?The pointer returned from the allocation is never checked, so it could theoretically be NULL and be used regardless.
Also I'm not sure that AND'ing with
0xffis the right thing to do here.
Quoted 8 lines
Oops, there's a check for NULL missing. If that allocation fails, probe should fail, so we just need to propagate the error condition. Otherwise we might just leave the firewall off, and let everything go in unchecked.
AND
0xffis necessary, because the same registers are mirrored in multiple contexts. AND removes the offset coming from context, and leaves just the plain register offset.
The offsets in the commands don't have enough bits to reach over to the next context. The contexts are repeated at multiples of 0x4000, and 0xFFF is the largest encodable offset. So I don't really thing the AND is needed for *that* purpose.
Quoted 2 lines
If somebody gets access to the bitmap, he has access to kernel data structures. GR2D firewall is the least of our worries in this case.
Indeed, that's only a problem if someone is already on the other side of the air-tight hatch.
A message that is not in the archive (sent off-list or not yet received): CABPQNSa59hBU__yjQMZsdEghpSwH1ayJYiD6HrBrhABicgzxuA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Re: [PATCH v2 08/27] drm/tegra: gr2d: Miscellaneous cleanups
Quoted 8 lines · Erik Faye-Lund
Quoted 3 lines · Terje Bergström
AND
0xffis necessary, because the same registers are mirrored in multiple contexts. AND removes the offset coming from context, and leaves just the plain register offset.The offsets in the commands don't have enough bits to reach over to the next context. The contexts are repeated at multiples of
0x4000, and0xFFFis the largest encodable offset. So I don't really thing the AND is needed for *that* purpose.
Well, that was embarrassing. Of course that is true. You can access all registers via MMIO or with SETCLASS to correct context. But that was still the reason I used when I wrote that 0xff, so it's bogus.
Real fix is to do what Thierry already did: limit the bitmap to max register number we're interested in, and have a if() to fail fast if register number falls outside that range.
Even better, get IOMMU up and running.
Terje
Re: [PATCH v2 08/27] drm/tegra: gr2d: Miscellaneous cleanups
In reply to a message not in the archiveQuoted 14 lines · Terje Bergström
Quoted 13 lines · Thierry Reding
* PGP Signed by an unknown key
Quoted 9 lines · Erik Faye-Lund
Quoted 3 lines · Thierry Reding
Rework the address table code for the host1x firewall. The previous implementation allocated a bitfield but didn't check for a valid pointer so it could potentially crash.
I don't think it could crash. The bitmaps was allocated as a 256-bit field, and the register offset gets AND'ed with
0xFFbefore being looked up. What am I missing?
Quoted 8 lines
Quoted 4 lines
The pointer returned from the allocation is never checked, so it could theoretically be NULL and be used regardless.
Also I'm not sure that AND'ing with
0xffis the right thing to do here.Oops, there's a check for NULL missing. If that allocation fails, probe should fail, so we just need to propagate the error condition. Otherwise we might just leave the firewall off, and let everything go in unchecked.
Yes, definitely.
Quoted 3 lines
AND
0xffis necessary, because the same registers are mirrored in multiple contexts. AND removes the offset coming from context, and leaves just the plain register offset.
That looks like something which should go into a comment.
Quoted 6 lines
Quoted 4 lines
I'm not so sure. Caching should alleviate the issue with the increased amount of data. Then there's the fact that previously we needed to divide and compute the remainder of the division for the
BIT_MASKandBIT_WORDoperations.Don't these get compiled into shifts and bitwise ands?
Yes, they are.
Quoted 9 lines
Quoted 6 lines
One other added benefit of this approach is that the address registers are stored in a const array and therefore could reside in a read-only memory region. With the previous approach, once somebody had access to the bitmap, it could easily be overwritten with zeros and effectively make the firewall useless. I'm not sure how likely that would be, but it could be done.
If somebody gets access to the bitmap, he has access to kernel data structures. GR2D firewall is the least of our worries in this case.
I see the point. Oh well, all my arguments are torn down. I'll drop this patch. Or at least the part that rewrites the gr2d_is_addr() and make it check for failed allocations properly.
For what it's worth, I still think the plain table lookup is much easier to understand.
Thierry
Re: [PATCH v2 08/27] drm/tegra: gr2d: Miscellaneous cleanups
In reply to a message not in the archiveQuoted 7 lines · Thierry Reding
Quoted 6 lines · Erik Faye-Lund
Quoted 3 lines · Thierry Reding
Rework the address table code for the host1x firewall. The previous implementation allocated a bitfield but didn't check for a valid pointer so it could potentially crash.
Quoted 7 lines
Quoted 3 lines
I don't think it could crash. The bitmaps was allocated as a 256-bit field, and the register offset gets AND'ed with
0xFFbefore being looked up. What am I missing?The pointer returned from the allocation is never checked, so it could theoretically be NULL and be used regardless.
Right. Thanks for clarifying.
Quoted 1 line
Also I'm not sure that AND'ing with
0xffis the right thing to do here.
Well, maybe not. I'm not entirely convinced it's *not*, though.
Quoted 10 lines
Quoted 5 lines
Quoted 2 lines
Furthermore setting up a bitfield makes
the code more complex than it needs to be.Doesn't this perform worse than the current implementation? Going from 1 to 13 checks per write sounds less than ideal to me...
I'm not so sure. Caching should alleviate the issue with the increased amount of data. Then there's the fact that previously we needed to divide and compute the remainder of the division for the
BIT_MASKandBIT_WORDoperations.
That's an AND and a shift, not division and modulo, both single-cycle instructions on ARM. I'm pretty sure that'd be a win.
Quoted 6 lines
One other added benefit of this approach is that the address registers are stored in a const array and therefore could reside in a read-only memory region. With the previous approach, once somebody had access to the bitmap, it could easily be overwritten with zeros and effectively make the firewall useless. I'm not sure how likely that would be, but it could be done.
Perhaps the bitmap could be generated compile-time and stuck in read-only memory?
Quoted 4 lines
I guess one could actually go and run a benchmark against both versions and balance the performance impact against the possible security implications. But given that we don't really have any benchmarks that's pretty hard to do.
Well, perhaps we could have both? :)
A message that is not in the archive (sent off-list or not yet received): CABPQNSb52HmS-2T=MUXteMFc1tndHdvtUnZqsVsPKjP1Dy6Esw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Re: [PATCH v2 08/27] drm/tegra: gr2d: Miscellaneous cleanups
Quoted 12 lines · Erik Faye-Lund
Quoted 11 lines · Thierry Reding
Quoted 9 lines · Erik Faye-Lund
Quoted 3 lines · Thierry Reding
Rework the address table code for the host1x firewall. The previous implementation allocated a bitfield but didn't check for a valid pointer so it could potentially crash.
I don't think it could crash. The bitmaps was allocated as a 256-bit field, and the register offset gets AND'ed with
0xFFbefore being looked up. What am I missing?
Quoted 7 lines
Quoted 4 lines
The pointer returned from the allocation is never checked, so it could theoretically be NULL and be used regardless.
Also I'm not sure that AND'ing with
0xffis the right thing to do here.Well, maybe not. I'm not entirely convinced it's *not*, though.
I'm sorry, I intended to fill out a bit more here before I hit send, and totally forgot.
Point is, it seems only 0x00..0x4c is used (and then repeated at multiples of 0x4000 for each context, but the offsets don't have enough bits to reach that far), from looking at the TRM.
So the question is really how the hardware treats writes to non-existent registers. My guess would be that they are simply not recorded, and if that's the case it doesn't matter what we do. And doing an unconditional AND is faster than doing a bit-test followed by a conditional branch.
Of course, if the hardware does *not* ignore writes to non-existent register, then we might be in trouble. But for that, we'd probably want a full map of valid registers, not just saying that they aren't pointers, no?
A message that is not in the archive (sent off-list or not yet received): CABPQNSZGyuS3wAvJ8fFj=LMXxFJz9x_sKqEWW7QbiqC1gneLKw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Re: [PATCH v2 08/27] drm/tegra: gr2d: Miscellaneous cleanups
Quoted 5 lines · Erik Faye-Lund
So the question is really how the hardware treats writes to non-existent registers. My guess would be that they are simply not recorded, and if that's the case it doesn't matter what we do. And doing an unconditional AND is faster than doing a bit-test followed by a conditional branch.
Hardware ignores writes to non-existent registers. Sometimes non-existent registers are taken into use in future versions, though.
Terje
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH v2 08/27] drm/tegra: gr2d: Miscellaneous cleanups
Quoted 9 lines · Terje Bergström
Quoted 5 lines · Erik Faye-Lund
So the question is really how the hardware treats writes to non-existent registers. My guess would be that they are simply not recorded, and if that's the case it doesn't matter what we do. And doing an unconditional AND is faster than doing a bit-test followed by a conditional branch.
Hardware ignores writes to non-existent registers. Sometimes non-existent registers are taken into use in future versions, though.
Right. That might be a motivation to treat non-existent registers as errors. But then I start to wonder about "holes" in the pointer address space should be treated differently. For instance, from the TRM it looks like registers 0x3 - 0x8, 0xe, 0x15 and 0x42 are undefined for T20. If writes to registers beyond 0x4c fails, shouldn't these also fail? Or are somehow guaranteed that these holes will never be plugged? Are they simply missing from the TRM?
I dunno...
PATCH v2 9/27 drm/tegra: gem: Miscellaneous cleanups
In reply to a message not in the archiveRename the host1x_to_drm_bo() macro to host1x_to_tegra_bo() for consistency and fixup various stylistic issues.
--- drivers/gpu/host1x/drm/gem.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-)
drivers/gpu/host1x/drm/gem.c +10 -11
@@ -20,14 +20,14 @@#include "gem.h" -static inline struct tegra_bo *host1x_to_drm_bo (struct host1x_bo *bo) +static inline struct tegra_bo *host1x_to_tegra_bo (struct host1x_bo *bo) { return container_of(bo, struct tegra_bo, base); }static void tegra_bo_put (struct host1x_bo *bo) { -struct tegra_bo *obj =host1x_to_drm_bo (bo); +struct tegra_bo *obj =host1x_to_tegra_bo (bo);struct drm_device *drm = obj->gem.dev;mutex_lock (&drm->struct_mutex);
@@ -37,7 +37,7 @@ static void tegra_bo_put(struct host1x_bo *bo)static dma_addr_t tegra_bo_pin (struct host1x_bo *bo,struct sg_table **sgt) { -struct tegra_bo *obj =host1x_to_drm_bo (bo); +struct tegra_bo *obj =host1x_to_tegra_bo (bo);return obj->paddr; }
@@ -48,7 +48,7 @@ static void tegra_bo_unpin(struct host1x_bo *bo, struct sg_table *sgt)static void *tegra_bo_mmap (struct host1x_bo *bo) { -struct tegra_bo *obj =host1x_to_drm_bo (bo); +struct tegra_bo *obj =host1x_to_tegra_bo (bo);return obj->vaddr; }
@@ -59,7 +59,7 @@ static void tegra_bo_munmap(struct host1x_bo *bo, void *addr)static void *tegra_bo_kmap (struct host1x_bo *bo,unsigned int page) { -struct tegra_bo *obj =host1x_to_drm_bo (bo); +struct tegra_bo *obj =host1x_to_tegra_bo (bo);return obj->vaddr + page *PAGE_SIZE ; }
@@ -71,7 +71,7 @@ static void tegra_bo_kunmap(struct host1x_bo *bo, unsigned int page,static struct host1x_bo *tegra_bo_get (struct host1x_bo *bo) { -struct tegra_bo *obj =host1x_to_drm_bo (bo); +struct tegra_bo *obj =host1x_to_tegra_bo (bo);struct drm_device *drm = obj->gem.dev;mutex_lock (&drm->struct_mutex);
@@ -140,9 +140,9 @@ err_dma: }struct tegra_bo *tegra_bo_create_with_handle (struct drm_file *file, -struct drm_device *drm, -unsigned int size, -unsigned int *handle) +struct drm_device *drm, +unsigned int size, +unsigned int *handle) {struct tegra_bo *bo;int ret;
@@ -169,7 +169,6 @@ void tegra_bo_free_object(struct drm_gem_object *gem)struct tegra_bo *bo =to_tegra_bo (gem);drm_gem_free_mmap_offset (gem); -drm_gem_object_release (gem);tegra_bo_destroy (gem->dev, bo);
@@ -189,7 +188,7 @@ int tegra_bo_dumb_create(struct drm_file *file, struct drm_device *drm, args->size = args->pitch * args->height; bo =tegra_bo_create_with_handle (file, drm, args->size, - &args->handle); + &args->handle);if (IS_ERR (bo))return PTR_ERR (bo);
Signature · 6 lines
1.8.4 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v2 10/27 gpu: host1x: Make host1x header file public
In reply to a message not in the archiveIn preparation to support host1x clients other than DRM, move this header into a public location.
---
MAINTAINERS | 1 +
drivers/gpu/host1x/drm/drm.h | 6 +++---
drivers/gpu/host1x/drm/gr2d.c | 1 -
drivers/gpu/host1x/hw/channel_hw.c | 3 ++-
{drivers/gpu/host1x => include/linux}/host1x.h | 8 +++-----
5 files changed, 9 insertions(+), 10 deletions(-)
rename {drivers/gpu/host1x => include/linux}/host1x.h (88%)MAINTAINERS +1 -0
@@ -2812,6 +2812,7 @@ L: [email protected] T: git git://anongit.freedesktop.org/tegra/linux.git S: Supported F: drivers/gpu/host1x/ +F: include/linux/host1x.h F: include/uapi/drm/tegra_drm.h F: Documentation/devicetree/bindings/gpu/nvidia,tegra20-host1x.txt
drivers/gpu/host1x/drm/drm.h +3 -3
@@ -10,14 +10,14 @@ #ifndef HOST1X_DRM_H #define HOST1X_DRM_H 1 +#include <uapi/drm/tegra_drm.h> +#include <linux/host1x.h> + #include <drm/drmP.h> #include <drm/drm_crtc_helper.h> #include <drm/drm_edid.h> #include <drm/drm_fb_helper.h> #include <drm/drm_fixed.h> -#include <uapi/drm/tegra_drm.h> - -#include "host1x.h" struct tegra_fb { struct drm_framebuffer base;
drivers/gpu/host1x/drm/gr2d.c +0 -1
@@ -20,7 +20,6 @@#include "drm.h" #include "gem.h" #include "job.h" -#include "host1x.h" #include "host1x_bo.h" #include "host1x_client.h" #include "syncpt.h"
drivers/gpu/host1x/hw/channel_hw.c +2 -1
@@ -16,10 +16,11 @@* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +#include <linux/host1x.h> #include <linux/slab.h> +#include <trace/events/host1x.h> -#include "host1x.h" #include "host1x_bo.h" #include "channel.h" #include "dev.h"
include/linux/host1x.h renamed from drivers/gpu/host1x/host1x.h +3 -5
@@ -1,6 +1,4 @@/* -* Tegra host1x driver -* * Copyright (c) 2009-2013, NVIDIA Corporation. All rights reserved. * * This program is free software; you can redistribute it and/or modify
@@ -22,9 +20,9 @@#define __LINUX_HOST1X_Henum host1x_class { -HOST1X_CLASS_HOST1X =0x1 , -HOST1X_CLASS_GR2D =0x51 , -HOST1X_CLASS_GR2D_SB =0x52 +HOST1X_CLASS_HOST1X =0x1 , +HOST1X_CLASS_GR2D =0x51 , +HOST1X_CLASS_GR2D_SB =0x52 , };#endif
Signature · 6 lines
1.8.4 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v2 11/27 drm/tegra: Introduce tegra_drm_client structure
In reply to a message not in the archiveThis structure derives from host1x_client. DRM-specific fields are moved from host1x_client to this structure, so that host1x_client can remain agnostic of DRM.
--- drivers/gpu/host1x/drm/dc.c | 35 ++++++++++++++++++----------------- drivers/gpu/host1x/drm/drm.c | 30 +++++++++++++++++++----------- drivers/gpu/host1x/drm/drm.h | 37 +++++++++++++++++-------------------- drivers/gpu/host1x/drm/gr2d.c | 42 +++++++++++++++++++++++------------------- drivers/gpu/host1x/drm/hdmi.c | 33 +++++++++++++++++---------------- include/linux/host1x.h | 20 ++++++++++++++++++++ 6 files changed, 114 insertions(+), 83 deletions(-)
drivers/gpu/host1x/drm/dc.c +18 -17
@@ -1038,30 +1038,30 @@ static int tegra_dc_debugfs_exit(struct tegra_dc *dc)return 0 ; } -static int tegra_dc_drm_init (struct host1x_client *client, -struct drm_device *drm) +static int tegra_dc_init (struct host1x_client *client) { -struct tegra_dc *dc =host1x_client_to_dc (client); +struct tegra_drm_client *drm =to_tegra_drm_client (client); +struct tegra_dc *dc =tegra_drm_client_to_dc (drm);int err; - dc->pipe = drm->mode_config.num_crtc; + dc->pipe = drm->drm->mode_config.num_crtc; -drm_crtc_init (drm, &dc->base, &tegra_crtc_funcs); +drm_crtc_init (drm->drm, &dc->base, &tegra_crtc_funcs);drm_mode_crtc_set_gamma_size (&dc->base,256 );drm_crtc_helper_add (&dc->base, &tegra_crtc_helper_funcs); - err =tegra_dc_rgb_init (drm, dc); + err =tegra_dc_rgb_init (drm->drm, dc);if (err <0 && err != -ENODEV ) {dev_err (dc->dev,"failed to initialize RGB output: %d\n" , err);return err; } - err =tegra_dc_add_planes (drm, dc); + err =tegra_dc_add_planes (drm->drm, dc);if (err <0 )return err;if (IS_ENABLED (CONFIG_DEBUG_FS )) { - err =tegra_dc_debugfs_init (dc, drm->primary); + err =tegra_dc_debugfs_init (dc, drm->drm->primary);if (err <0 )dev_err (dc->dev,"debugfs setup failed: %d\n" , err); }
@@ -1077,9 +1077,10 @@ static int tegra_dc_drm_init(struct host1x_client *client,return 0 ; } -static int tegra_dc_drm_exit (struct host1x_client *client) +static int tegra_dc_exit (struct host1x_client *client) { -struct tegra_dc *dc =host1x_client_to_dc (client); +struct tegra_drm_client *drm =to_tegra_drm_client (client); +struct tegra_dc *dc =tegra_drm_client_to_dc (drm);int err;devm_free_irq (dc->dev, dc->irq, dc);
@@ -1100,8 +1101,8 @@ static int tegra_dc_drm_exit(struct host1x_client *client) }static const struct host1x_client_ops dc_client_ops = { - .drm_init = tegra_dc_drm_init, - .drm_exit = tegra_dc_drm_exit, + .init = tegra_dc_init, + .exit = tegra_dc_exit, };static int tegra_dc_probe (struct platform_device *pdev)
@@ -1140,9 +1141,9 @@ static int tegra_dc_probe(struct platform_device *pdev)return -ENXIO ; } -INIT_LIST_HEAD (&dc->client.list); - dc->client.ops = &dc_client_ops; - dc->client.dev = &pdev->dev; +INIT_LIST_HEAD (&dc->client.base.list); + dc->client.base.ops = &dc_client_ops; + dc->client.base.dev = &pdev->dev; err =tegra_dc_rgb_probe (dc);if (err <0 && err != -ENODEV ) {
@@ -1150,7 +1151,7 @@ static int tegra_dc_probe(struct platform_device *pdev)return err; } - err =host1x_register_client (tegra, &dc->client); + err =host1x_register_client (tegra, &dc->client.base);if (err <0 ) {dev_err (&pdev->dev,"failed to register host1x client: %d\n" , err);
@@ -1168,7 +1169,7 @@ static int tegra_dc_remove(struct platform_device *pdev)struct tegra_dc *dc =platform_get_drvdata (pdev);int err; - err =host1x_unregister_client (tegra, &dc->client); + err =host1x_unregister_client (tegra, &dc->client.base);if (err <0 ) {dev_err (&pdev->dev,"failed to unregister host1x client: %d\n" , err);
drivers/gpu/host1x/drm/drm.c +19 -11
@@ -131,12 +131,18 @@ int tegra_drm_alloc(struct platform_device *pdev)int tegra_drm_init (struct tegra_drm *tegra,struct drm_device *drm) {struct host1x_client *client; +int err;mutex_lock (&tegra->clients_lock);list_for_each_entry (client, &tegra->clients, list) { -if (client->ops && client->ops->drm_init) { -int err = client->ops->drm_init (client, drm); +struct tegra_drm_client *tdc =to_tegra_drm_client (client); + +/* associate client with DRM device */ + tdc->drm = drm; + +if (client->ops && client->ops->init) { + err = client->ops->init (client);if (err <0 ) { dev_err(tegra->dev, "DRM setup failed for %s: %d\n",
@@ -154,8 +160,9 @@ int tegra_drm_init(struct tegra_drm *tegra, struct drm_device *drm)int tegra_drm_exit (struct tegra_drm *tegra) { -struct platform_device *pdev =to_platform_device (tegra->dev);struct host1x_client *client; +struct platform_device *pdev; +int err;if (!tegra->drm)return 0 ;
@@ -163,8 +170,8 @@ int tegra_drm_exit(struct tegra_drm *tegra)mutex_lock (&tegra->clients_lock);list_for_each_entry_reverse (client, &tegra->clients, list) { -if (client->ops && client->ops->drm_exit) { -int err = client->ops->drm_exit (client); +if (client->ops && client->ops->exit) { + err = client->ops->exit (client);if (err <0 ) { dev_err(tegra->dev, "DRM cleanup failed for %s: %d\n",
@@ -177,6 +184,7 @@ int tegra_drm_exit(struct tegra_drm *tegra)mutex_unlock (&tegra->clients_lock); + pdev =to_platform_device (tegra->dev);drm_platform_exit (&tegra_drm_driver, pdev); tegra->drm =NULL ;
@@ -409,22 +417,22 @@ static int tegra_open_channel(struct drm_device *drm, void *data,struct tegra_drm *tegra = drm->dev_private;struct drm_tegra_open_channel *args = data;struct tegra_drm_context *context; -struct host1x_client *client; +struct tegra_drm_client *client;int err = -ENODEV ; context =kzalloc (sizeof (*context),GFP_KERNEL );if (!context)return -ENOMEM ; -list_for_each_entry (client, &tegra->clients, list) -if (client->class == args->client) { +list_for_each_entry (client, &tegra->clients, base.list) +if (client->base.class == args->client) { err = client->ops->open_channel (client, context);if (err)break ; - context->client = client;list_add (&context->list, &fpriv->contexts); args->context = (uintptr_t )context; + context->client = client;return 0 ; }
@@ -463,10 +471,10 @@ static int tegra_get_syncpt(struct drm_device *drm, void *data,if (!tegra_drm_file_owns_context (fpriv, context))return -ENODEV ; -if (args->index >= context->client->num_syncpts) +if (args->index >= context->client->base.num_syncpts)return -EINVAL ; - syncpt = context->client->syncpts[args->index]; + syncpt = context->client->base.syncpts[args->index]; args->id =host1x_syncpt_id (syncpt);return 0 ;
drivers/gpu/host1x/drm/drm.h +17 -20
@@ -44,18 +44,16 @@ struct tegra_drm {struct tegra_fbdev *fbdev; }; -struct host1x_client ; +struct tegra_drm_client ;struct tegra_drm_context { -struct host1x_client *client; +struct tegra_drm_client *client;struct host1x_channel *channel;struct list_head list; }; -struct host1x_client_ops { -int (*drm_init)(struct host1x_client *client,struct drm_device *drm); -int (*drm_exit)(struct host1x_client *client); -int (*open_channel)(struct host1x_client *client, +struct tegra_drm_client_ops { +int (*open_channel)(struct tegra_drm_client *client,struct tegra_drm_context *context);void (*close_channel)(struct tegra_drm_context *context); int (*submit)(struct tegra_drm_context *context,
@@ -63,21 +61,19 @@ struct host1x_client_ops { struct drm_file *file); }; -struct host1x_client { -struct tegra_drm *tegra; -struct device *dev; - -const struct host1x_client_ops *ops; - -enum host1x_class class; -struct host1x_channel *channel; - -struct host1x_syncpt **syncpts; -unsigned int num_syncpts; +struct tegra_drm_client { +struct host1x_client base; +struct drm_device *drm; -struct list_head list; +const struct tegra_drm_client_ops *ops; }; +static inline struct tegra_drm_client * +to_tegra_drm_client (struct host1x_client *client) +{ + return container_of(client, struct tegra_drm_client, base); +} +extern int tegra_drm_init (struct tegra_drm *tegra,struct drm_device *drm);extern int tegra_drm_exit (struct tegra_drm *tegra);
@@ -89,7 +85,7 @@ extern int host1x_unregister_client(struct tegra_drm *tegra,struct tegra_output ;struct tegra_dc { -struct host1x_client client; +struct tegra_drm_client client;struct device *dev;spinlock_t lock;
@@ -112,7 +108,8 @@ struct tegra_dc {struct drm_pending_vblank_event *event; }; -static inline struct tegra_dc *host1x_client_to_dc (struct host1x_client *client) +static inline struct tegra_dc * +tegra_drm_client_to_dc (struct tegra_drm_client *client) { return container_of(client, struct tegra_dc, client); }
drivers/gpu/host1x/drm/gr2d.c +23 -19
99 lines not on this page · raw message
drivers/gpu/host1x/drm/hdmi.c +17 -16
@@ -19,7 +19,7 @@#include "host1x_client.h" struct tegra_hdmi { -struct host1x_client client; +struct tegra_drm_client client;struct tegra_output output;struct device *dev;
@@ -43,7 +43,7 @@ struct tegra_hdmi { };static inline struct tegra_hdmi * -host1x_client_to_hdmi (struct host1x_client *client) +tegra_drm_client_to_hdmi (struct tegra_drm_client *client) { return container_of(client, struct tegra_hdmi, client); }
@@ -1116,24 +1116,24 @@ static int tegra_hdmi_debugfs_exit(struct tegra_hdmi *hdmi)return 0 ; } -static int tegra_hdmi_drm_init (struct host1x_client *client, -struct drm_device *drm) +static int tegra_hdmi_init (struct host1x_client *client) { -struct tegra_hdmi *hdmi =host1x_client_to_hdmi (client); +struct tegra_drm_client *drm =to_tegra_drm_client (client); +struct tegra_hdmi *hdmi =tegra_drm_client_to_hdmi (drm);int err; hdmi->output.type =TEGRA_OUTPUT_HDMI ; hdmi->output.dev = client->dev; hdmi->output.ops = &hdmi_ops; - err =tegra_output_init (drm, &hdmi->output); + err =tegra_output_init (drm->drm, &hdmi->output);if (err <0 ) {dev_err (client->dev,"output setup failed: %d\n" , err);return err; }if (IS_ENABLED (CONFIG_DEBUG_FS )) { - err =tegra_hdmi_debugfs_init (hdmi, drm->primary); + err =tegra_hdmi_debugfs_init (hdmi, drm->drm->primary);if (err <0 )dev_err (client->dev,"debugfs setup failed: %d\n" , err); }
@@ -1141,9 +1141,10 @@ static int tegra_hdmi_drm_init(struct host1x_client *client,return 0 ; } -static int tegra_hdmi_drm_exit (struct host1x_client *client) +static int tegra_hdmi_exit (struct host1x_client *client) { -struct tegra_hdmi *hdmi =host1x_client_to_hdmi (client); +struct tegra_drm_client *drm =to_tegra_drm_client (client); +struct tegra_hdmi *hdmi =tegra_drm_client_to_hdmi (drm);int err;if (IS_ENABLED (CONFIG_DEBUG_FS )) {
@@ -1169,8 +1170,8 @@ static int tegra_hdmi_drm_exit(struct host1x_client *client) }static const struct host1x_client_ops hdmi_client_ops = { - .drm_init = tegra_hdmi_drm_init, - .drm_exit = tegra_hdmi_drm_exit, + .init = tegra_hdmi_init, + .exit = tegra_hdmi_exit, };static int tegra_hdmi_probe (struct platform_device *pdev)
@@ -1246,11 +1247,11 @@ static int tegra_hdmi_probe(struct platform_device *pdev) hdmi->irq = err; - hdmi->client.ops = &hdmi_client_ops; -INIT_LIST_HEAD (&hdmi->client.list); - hdmi->client.dev = &pdev->dev; +INIT_LIST_HEAD (&hdmi->client.base.list); + hdmi->client.base.ops = &hdmi_client_ops; + hdmi->client.base.dev = &pdev->dev; - err =host1x_register_client (tegra, &hdmi->client); + err =host1x_register_client (tegra, &hdmi->client.base);if (err <0 ) {dev_err (&pdev->dev,"failed to register host1x client: %d\n" , err);
@@ -1268,7 +1269,7 @@ static int tegra_hdmi_remove(struct platform_device *pdev)struct tegra_hdmi *hdmi =platform_get_drvdata (pdev);int err; - err =host1x_unregister_client (tegra, &hdmi->client); + err =host1x_unregister_client (tegra, &hdmi->client.base);if (err <0 ) {dev_err (&pdev->dev,"failed to unregister host1x client: %d\n" , err);
include/linux/host1x.h +20 -0
@@ -25,4 +25,24 @@ enum host1x_class { HOST1X_CLASS_GR2D_SB = 0x52, }; +struct host1x_client ; + +struct host1x_client_ops { +int (*init)(struct host1x_client *client); +int (*exit)(struct host1x_client *client); +}; + +struct host1x_client { +struct list_head list; +struct device *dev; + +const struct host1x_client_ops *ops; + +enum host1x_class class; +struct host1x_channel *channel; + +struct host1x_syncpt **syncpts; +unsigned int num_syncpts; +}; +#endif
Signature · 1 line
1.8.4
PATCH v2 12/27 gpu: host1x: Expose syncpt and channel functionality
In reply to a message not in the archiveExpose the buffer objects, syncpoint and channel functionality in the public public header so that drivers can use them.
--- drivers/gpu/host1x/Makefile | 2 - drivers/gpu/host1x/cdma.c | 2 +- drivers/gpu/host1x/channel.h | 6 -- drivers/gpu/host1x/drm/drm.c | 2 - drivers/gpu/host1x/drm/gem.h | 4 +- drivers/gpu/host1x/drm/gr2d.c | 6 +- drivers/gpu/host1x/drm/hdmi.c | 2 +- drivers/gpu/host1x/host1x_bo.h | 87 ----------------- drivers/gpu/host1x/hw/channel_hw.c | 1 - drivers/gpu/host1x/hw/debug_hw.c | 1 - drivers/gpu/host1x/job.c | 2 +- drivers/gpu/host1x/job.h | 108 ---------------------- drivers/gpu/host1x/syncpt.c | 19 ++++ drivers/gpu/host1x/syncpt.h | 40 +------- include/linux/host1x.h | 185 +++++++++++++++++++++++++++++++++++++ 15 files changed, 211 insertions(+), 256 deletions(-) delete mode 100644 drivers/gpu/host1x/host1x_bo.h
drivers/gpu/host1x/Makefile +0 -2
@@ -1,5 +1,3 @@ -ccflags-y = -Idrivers/gpu/host1x - host1x-y = \ syncpt.o \ dev.o \
drivers/gpu/host1x/cdma.c +1 -1
@@ -20,6 +20,7 @@#include <asm/cacheflush.h> #include <linux/device.h> #include <linux/dma-mapping.h> +#include <linux/host1x.h> #include <linux/interrupt.h> #include <linux/kernel.h> #include <linux/kfifo.h>
@@ -30,7 +31,6 @@#include "channel.h" #include "dev.h" #include "debug.h" -#include "host1x_bo.h" #include "job.h" /*
drivers/gpu/host1x/channel.h +0 -6
@@ -40,12 +40,6 @@ struct host1x_channel {/* channel list operations */ int host1x_channel_list_init (struct host1x *host); -struct host1x_channel *host1x_channel_request (struct device *dev); -void host1x_channel_free (struct host1x_channel *channel); -struct host1x_channel *host1x_channel_get (struct host1x_channel *channel); -void host1x_channel_put (struct host1x_channel *channel); -int host1x_job_submit (struct host1x_job *job); -#define host1x_for_each_channel (host, channel) \ list_for_each_entry(channel, &host->chlist.list, list)
drivers/gpu/host1x/drm/drm.c +0 -2
@@ -8,10 +8,8 @@*/ #include "host1x_client.h" -#include "dev.h" #include "drm.h" #include "gem.h" -#include "syncpt.h" #define DRIVER_NAME "tegra"#define DRIVER_DESC "NVIDIA Tegra graphics"
drivers/gpu/host1x/drm/gem.h +2 -2
@@ -19,11 +19,11 @@ #ifndef __HOST1X_GEM_H #define __HOST1X_GEM_H +#include <linux/host1x.h> + #include <drm/drm.h> #include <drm/drmP.h> -#include "host1x_bo.h" - struct tegra_bo { struct drm_gem_object gem; struct host1x_bo base;
drivers/gpu/host1x/drm/gr2d.c +1 -5
@@ -16,13 +16,9 @@#include <linux/clk.h> -#include "channel.h" +#include "host1x_client.h" #include "drm.h" #include "gem.h" -#include "job.h" -#include "host1x_bo.h" -#include "host1x_client.h" -#include "syncpt.h" struct gr2d {struct tegra_drm_client client;
drivers/gpu/host1x/drm/hdmi.c +1 -1
@@ -13,10 +13,10 @@#include <linux/hdmi.h> #include <linux/regulator/consumer.h> +#include "host1x_client.h" #include "hdmi.h" #include "drm.h" #include "dc.h" -#include "host1x_client.h" struct tegra_hdmi {struct tegra_drm_client client;
drivers/gpu/host1x/host1x_bo.h deleted +0 -87
87 lines not on this page · raw message
drivers/gpu/host1x/hw/channel_hw.c +0 -1
@@ -21,7 +21,6 @@#include <trace/events/host1x.h> -#include "host1x_bo.h" #include "channel.h" #include "dev.h" #include "intr.h"
drivers/gpu/host1x/hw/debug_hw.c +0 -1
@@ -19,7 +19,6 @@#include "debug.h" #include "cdma.h" #include "channel.h" -#include "host1x_bo.h" #define HOST1X_DEBUG_MAX_PAGE_OFFSET 102400
drivers/gpu/host1x/job.c +1 -1
@@ -18,6 +18,7 @@#include <linux/dma-mapping.h> #include <linux/err.h> +#include <linux/host1x.h> #include <linux/kref.h> #include <linux/module.h> #include <linux/scatterlist.h>
@@ -27,7 +28,6 @@#include "channel.h" #include "dev.h" -#include "host1x_bo.h" #include "job.h" #include "syncpt.h"
drivers/gpu/host1x/job.h +0 -108
120 lines not on this page · raw message
drivers/gpu/host1x/syncpt.c +19 -0
@@ -354,6 +354,25 @@ void host1x_syncpt_deinit(struct host1x *host)kfree (sp->name); } +/* +* Read max. It indicates how many operations there are in queue, either in +* channel or in a software thread. +* */ +u32 host1x_syncpt_read_max (struct host1x_syncpt *sp) +{ +smp_rmb (); +return (u32 )atomic_read (&sp->max_val); +} + +/* +* Read min, which is a shadow of the current sync point value in hardware. +*/ +u32 host1x_syncpt_read_min (struct host1x_syncpt *sp) +{ +smp_rmb (); +return (u32 )atomic_read (&sp->min_val); +} +int host1x_syncpt_nb_pts (struct host1x *host) {return host->info->nb_pts;
drivers/gpu/host1x/syncpt.h +1 -39
@@ -20,6 +20,7 @@#define __HOST1X_SYNCPT_H#include <linux/atomic.h> +#include <linux/host1x.h> #include <linux/kernel.h> #include <linux/sched.h>
@@ -50,25 +51,6 @@ int host1x_syncpt_init(struct host1x *host);/* Free sync point array */ void host1x_syncpt_deinit (struct host1x *host); -/* -* Read max. It indicates how many operations there are in queue, either in -* channel or in a software thread. -* */ -static inline u32 host1x_syncpt_read_max (struct host1x_syncpt *sp) -{ -smp_rmb (); -return (u32 )atomic_read (&sp->max_val); -} - -/* -* Read min, which is a shadow of the current sync point value in hardware. -*/ -static inline u32 host1x_syncpt_read_min (struct host1x_syncpt *sp) -{ -smp_rmb (); -return (u32 )atomic_read (&sp->min_val); -} -/* Return number of sync point supported. */ int host1x_syncpt_nb_pts (struct host1x *host);
@@ -112,9 +94,6 @@ static inline bool host1x_syncpt_idle(struct host1x_syncpt *sp)return (min == max); } -/* Return pointer to struct denoting sync point id. */ -struct host1x_syncpt *host1x_syncpt_get (struct host1x *host,u32 id); -/* Load current value from hardware to the shadow register. */ u32 host1x_syncpt_load (struct host1x_syncpt *sp);
@@ -130,16 +109,9 @@ void host1x_syncpt_restore(struct host1x *host);/* Read current wait base value into shadow register and return it. */ u32 host1x_syncpt_load_wait_base (struct host1x_syncpt *sp); -/* Request incrementing a sync point. */ -int host1x_syncpt_incr (struct host1x_syncpt *sp); -/* Indicate future operations by incrementing the sync point max. */ u32 host1x_syncpt_incr_max (struct host1x_syncpt *sp,u32 incrs); -/* Wait until sync point reaches a threshold value, or a timeout. */ -int host1x_syncpt_wait (struct host1x_syncpt *sp,u32 thresh, -long timeout,u32 *value); -/* Check if sync point id is valid. */ static inline int host1x_syncpt_is_valid (struct host1x_syncpt *sp) {
@@ -149,14 +121,4 @@ static inline int host1x_syncpt_is_valid(struct host1x_syncpt *sp)/* Patch a wait by replacing it with a wait for syncpt 0 value 0 */ int host1x_syncpt_patch_wait (struct host1x_syncpt *sp,void *patch_addr); -/* Return id of the sync point */ -u32 host1x_syncpt_id (struct host1x_syncpt *sp); - -/* Allocate a sync point for a device. */ -struct host1x_syncpt *host1x_syncpt_request (struct device *dev, -bool client_managed); - -/* Free a sync point. */ -void host1x_syncpt_free (struct host1x_syncpt *sp); -#endif
include/linux/host1x.h +185 -0
195 lines not on this page · raw message
Signature · 1 line
1.8.4
PATCH v2 13/27 drm/tegra: Move subdevice infrastructure to host1x
In reply to a message not in the archiveThe Tegra DRM driver currently uses some infrastructure to defer the DRM core initialization until all required devices have registered. The same infrastructure can potentially be used by any other driver that requires more than a single sub-device of the host1x module.
Make the infrastructure more generic and keep only the DRM specific code in the DRM part of the driver. Eventually this will make it easy to move the DRM driver part back to the DRM subsystem.
---
drivers/gpu/host1x/Makefile | 2 +
drivers/gpu/host1x/bus.c | 309 +++++++++++++++++++++++
drivers/gpu/host1x/{host1x_client.h => bus.h} | 24 +-
drivers/gpu/host1x/dev.c | 60 ++---
drivers/gpu/host1x/dev.h | 9 +-
drivers/gpu/host1x/drm/bus.c | 123 +++++++++
drivers/gpu/host1x/drm/dc.c | 35 +--
drivers/gpu/host1x/drm/drm.c | 347 +++++++++-----------------
drivers/gpu/host1x/drm/drm.h | 31 +--
drivers/gpu/host1x/drm/gr2d.c | 32 ++-
drivers/gpu/host1x/drm/hdmi.c | 33 +--
include/drm/drmP.h | 1 +
include/linux/host1x.h | 45 +++-
13 files changed, 700 insertions(+), 351 deletions(-)
create mode 100644 drivers/gpu/host1x/bus.c
rename drivers/gpu/host1x/{host1x_client.h => bus.h} (60%)
create mode 100644 drivers/gpu/host1x/drm/bus.cdrivers/gpu/host1x/Makefile +2 -0
@@ -1,4 +1,5 @@ host1x-y = \ + bus.o \ syncpt.o \ dev.o \ intr.o \
@@ -15,4 +16,5 @@ host1x-$(CONFIG_DRM_TEGRA) += drm/drm.o drm/fb.o drm/dc.o host1x-$(CONFIG_DRM_TEGRA) += drm/output.o drm/rgb.o drm/hdmi.o host1x-$(CONFIG_DRM_TEGRA) += drm/gem.o host1x-$(CONFIG_DRM_TEGRA) += drm/gr2d.o +host1x-$(CONFIG_DRM_TEGRA) += drm/bus.o obj-$(CONFIG_TEGRA_HOST1X) += host1x.o
drivers/gpu/host1x/bus.c new file +309 -0
309 lines not on this page · raw message
drivers/gpu/host1x/bus.h renamed from drivers/gpu/host1x/host1x_client.h +9 -15
@@ -1,5 +1,6 @@/* -* Copyright (c) 2013, NVIDIA Corporation. +* Copyright (C) 2012 Avionic Design GmbH +* Copyright (C) 2012-2013, NVIDIA Corporation * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License,
@@ -14,22 +15,15 @@* along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef HOST1X_CLIENT_H -#define HOST1X_CLIENT_H +#ifndef HOST1X_BUS_H +#define HOST1X_BUS_H -struct device ; -struct platform_device ; +struct host1x ; -#ifdef CONFIG_DRM_TEGRA -int tegra_drm_alloc (struct platform_device *pdev); -#else -static inline int tegra_drm_alloc (struct platform_device *pdev) -{ -return 0 ; -} -#endif +int host1x_bus_init (void ); +void host1x_bus_exit (void ); -void host1x_set_drm_data (struct device *dev,void *data); -void *host1x_get_drm_data (struct device *dev); +int host1x_register (struct host1x *host1x); +int host1x_unregister (struct host1x *host1x);#endif
drivers/gpu/host1x/dev.c +17 -43
109 lines not on this page · raw message
drivers/gpu/host1x/dev.h +4 -5
@@ -125,7 +125,10 @@ struct host1x {struct dentry *debugfs; -void *drm_data; +struct mutex devices_lock; +struct list_head devices; + +struct list_head list; };void host1x_sync_writel (struct host1x *host1x,u32 r,u32 v);
@@ -301,8 +304,4 @@ 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_dc_driver; -extern struct platform_driver tegra_hdmi_driver; -extern struct platform_driver tegra_gr2d_driver; -#endif
drivers/gpu/host1x/drm/bus.c new file +123 -0
123 lines not on this page · raw message
drivers/gpu/host1x/drm/dc.c +18 -17
@@ -11,7 +11,6 @@#include <linux/clk/tegra.h> #include <linux/debugfs.h> -#include "host1x_client.h" #include "dc.h" #include "drm.h" #include "gem.h"
@@ -1040,28 +1039,28 @@ static int tegra_dc_debugfs_exit(struct tegra_dc *dc)static int tegra_dc_init (struct host1x_client *client) { -struct tegra_drm_client *drm =to_tegra_drm_client (client); -struct tegra_dc *dc =tegra_drm_client_to_dc (drm); +struct tegra_drm *tegra =dev_get_drvdata (client->parent); +struct tegra_dc *dc =host1x_client_to_dc (client);int err; - dc->pipe = drm->drm->mode_config.num_crtc; + dc->pipe = tegra->drm->mode_config.num_crtc; -drm_crtc_init (drm->drm, &dc->base, &tegra_crtc_funcs); +drm_crtc_init (tegra->drm, &dc->base, &tegra_crtc_funcs);drm_mode_crtc_set_gamma_size (&dc->base,256 );drm_crtc_helper_add (&dc->base, &tegra_crtc_helper_funcs); - err =tegra_dc_rgb_init (drm->drm, dc); + err =tegra_dc_rgb_init (tegra->drm, dc);if (err <0 && err != -ENODEV ) {dev_err (dc->dev,"failed to initialize RGB output: %d\n" , err);return err; } - err =tegra_dc_add_planes (drm->drm, dc); + err =tegra_dc_add_planes (tegra->drm, dc);if (err <0 )return err;if (IS_ENABLED (CONFIG_DEBUG_FS )) { - err =tegra_dc_debugfs_init (dc, drm->drm->primary); + err =tegra_dc_debugfs_init (dc, tegra->drm->primary);if (err <0 )dev_err (dc->dev,"debugfs setup failed: %d\n" , err); }
@@ -1079,8 +1078,7 @@ static int tegra_dc_init(struct host1x_client *client)static int tegra_dc_exit (struct host1x_client *client) { -struct tegra_drm_client *drm =to_tegra_drm_client (client); -struct tegra_dc *dc =tegra_drm_client_to_dc (drm); +struct tegra_dc *dc =host1x_client_to_dc (client);int err;devm_free_irq (dc->dev, dc->irq, dc);
@@ -1107,11 +1105,14 @@ static const struct host1x_client_ops dc_client_ops = {static int tegra_dc_probe (struct platform_device *pdev) { -struct tegra_drm *tegra =host1x_get_drm_data (pdev->dev.parent); +struct host1x *host1x =dev_get_drvdata (pdev->dev.parent);struct resource *regs;struct tegra_dc *dc;int err; +if (!host1x) +return -EPROBE_DEFER ; + dc =devm_kzalloc (&pdev->dev,sizeof (*dc),GFP_KERNEL );if (!dc)return -ENOMEM ;
@@ -1141,9 +1142,9 @@ static int tegra_dc_probe(struct platform_device *pdev)return -ENXIO ; } -INIT_LIST_HEAD (&dc->client.base.list); - dc->client.base.ops = &dc_client_ops; - dc->client.base.dev = &pdev->dev; +INIT_LIST_HEAD (&dc->client.list); + dc->client.ops = &dc_client_ops; + dc->client.dev = &pdev->dev; err =tegra_dc_rgb_probe (dc);if (err <0 && err != -ENODEV ) {
@@ -1151,7 +1152,7 @@ static int tegra_dc_probe(struct platform_device *pdev)return err; } - err =host1x_register_client (tegra, &dc->client.base); + err =host1x_register_client (host1x, &dc->client);if (err <0 ) {dev_err (&pdev->dev,"failed to register host1x client: %d\n" , err);
@@ -1165,11 +1166,11 @@ static int tegra_dc_probe(struct platform_device *pdev)static int tegra_dc_remove (struct platform_device *pdev) { -struct tegra_drm *tegra =host1x_get_drm_data (pdev->dev.parent); +struct host1x *host1x =dev_get_drvdata (pdev->dev.parent);struct tegra_dc *dc =platform_get_drvdata (pdev);int err; - err =host1x_unregister_client (tegra, &dc->client.base); + err =host1x_unregister_client (host1x, &dc->client);if (err <0 ) {dev_err (&pdev->dev,"failed to unregister host1x client: %d\n" , err);
drivers/gpu/host1x/drm/drm.c +119 -228
422 lines not on this page · raw message
drivers/gpu/host1x/drm/drm.h +16 -15
@@ -32,11 +32,6 @@ struct tegra_fbdev {struct tegra_drm {struct drm_device *drm; -struct device *dev; - -struct mutex subdevs_lock; -struct list_head subdevs; -struct list_head active;struct mutex clients_lock;struct list_head clients;
@@ -63,29 +58,29 @@ struct tegra_drm_client_ops {struct tegra_drm_client {struct host1x_client base; -struct drm_device *drm; +struct list_head list;const struct tegra_drm_client_ops *ops; };static inline struct tegra_drm_client * -to_tegra_drm_client (struct host1x_client *client) +host1x_to_drm_client (struct host1x_client *client) { return container_of(client, struct tegra_drm_client, base); } +extern int tegra_drm_register_client (struct tegra_drm *tegra, +struct tegra_drm_client *client); +extern int tegra_drm_unregister_client (struct tegra_drm *tegra, +struct tegra_drm_client *client); +extern int tegra_drm_init (struct tegra_drm *tegra,struct drm_device *drm);extern int tegra_drm_exit (struct tegra_drm *tegra); -extern int host1x_register_client (struct tegra_drm *tegra, -struct host1x_client *client); -extern int host1x_unregister_client (struct tegra_drm *tegra, -struct host1x_client *client); -struct tegra_output ;struct tegra_dc { -struct tegra_drm_client client; +struct host1x_client client;struct device *dev;spinlock_t lock;
@@ -109,7 +104,7 @@ struct tegra_dc { };static inline struct tegra_dc * -tegra_drm_client_to_dc (struct tegra_drm_client *client) +host1x_client_to_dc (struct host1x_client *client) { return container_of(client, struct tegra_dc, client); }
@@ -235,6 +230,10 @@ static inline int tegra_output_check_mode(struct tegra_output *output,return output ? -ENOSYS : -EINVAL ; } +/* from bus.c */ +int drm_host1x_init (struct drm_driver *driver,struct host1x_device *device); +void drm_host1x_exit (struct drm_driver *driver,struct host1x_device *device); +/* from rgb.c */ extern int tegra_dc_rgb_probe (struct tegra_dc *dc);extern int tegra_dc_rgb_init (struct drm_device *drm,struct tegra_dc *dc);
@@ -252,6 +251,8 @@ extern int tegra_drm_fb_init(struct drm_device *drm);extern void tegra_drm_fb_exit (struct drm_device *drm);extern void tegra_fbdev_restore_mode (struct tegra_fbdev *fbdev); -extern struct drm_driver tegra_drm_driver; +extern struct platform_driver tegra_dc_driver; +extern struct platform_driver tegra_hdmi_driver; +extern struct platform_driver tegra_gr2d_driver;#endif /* HOST1X_DRM_H */
drivers/gpu/host1x/drm/gr2d.c +21 -11
@@ -16,7 +16,6 @@#include <linux/clk.h> -#include "host1x_client.h" #include "drm.h" #include "gem.h"
@@ -31,19 +30,25 @@ static inline struct gr2d *to_gr2d(struct tegra_drm_client *client) return container_of(client, struct gr2d, client); } -static int gr2d_client_init (struct host1x_client *client) +static int gr2d_init (struct host1x_client *client) { -return 0 ; +struct tegra_drm_client *drm =host1x_to_drm_client (client); +struct tegra_drm *tegra =dev_get_drvdata (client->parent); + +return tegra_drm_register_client (tegra, drm); } -static int gr2d_client_exit (struct host1x_client *client) +static int gr2d_exit (struct host1x_client *client) { -return 0 ; +struct tegra_drm_client *drm =host1x_to_drm_client (client); +struct tegra_drm *tegra =dev_get_drvdata (client->parent); + +return tegra_drm_unregister_client (tegra, drm); }static const struct host1x_client_ops gr2d_client_ops = { - .init = gr2d_client_init, - .exit = gr2d_client_exit, + .init = gr2d_init, + .exit = gr2d_exit, }; static int gr2d_open_channel(struct tegra_drm_client *client,
@@ -234,12 +239,15 @@ static const struct of_device_id gr2d_match[] = {static int gr2d_probe (struct platform_device *pdev) { -struct tegra_drm *tegra =host1x_get_drm_data (pdev->dev.parent); +struct host1x *host1x =dev_get_drvdata (pdev->dev.parent);struct device *dev = &pdev->dev;struct host1x_syncpt **syncpts;struct gr2d *gr2d;int err; +if (!host1x) +return -EPROBE_DEFER ; + gr2d =devm_kzalloc (dev,sizeof (*gr2d),GFP_KERNEL );if (!gr2d)return -ENOMEM ;
@@ -276,9 +284,11 @@ static int gr2d_probe(struct platform_device *pdev) gr2d->client.base.class =HOST1X_CLASS_GR2D ; gr2d->client.base.syncpts = syncpts; gr2d->client.base.num_syncpts =1 ; + +INIT_LIST_HEAD (&gr2d->client.list); gr2d->client.ops = &gr2d_ops; - err =host1x_register_client (tegra, &gr2d->client.base); + err =host1x_register_client (host1x, &gr2d->client.base);if (err <0 ) {dev_err (dev,"failed to register host1x client: %d\n" , err);return err;
@@ -291,12 +301,12 @@ static int gr2d_probe(struct platform_device *pdev)static int gr2d_remove (struct platform_device *pdev) { -struct tegra_drm *tegra =host1x_get_drm_data (pdev->dev.parent); +struct host1x *host1x =dev_get_drvdata (pdev->dev.parent);struct gr2d *gr2d =platform_get_drvdata (pdev);unsigned int i;int err; - err =host1x_unregister_client (tegra, &gr2d->client.base); + err =host1x_unregister_client (host1x, &gr2d->client.base);if (err <0 ) {dev_err (&pdev->dev,"failed to unregister host1x client: %d\n" , err);
drivers/gpu/host1x/drm/hdmi.c +17 -16
@@ -13,13 +13,12 @@#include <linux/hdmi.h> #include <linux/regulator/consumer.h> -#include "host1x_client.h" #include "hdmi.h" #include "drm.h" #include "dc.h" struct tegra_hdmi { -struct tegra_drm_client client; +struct host1x_client client;struct tegra_output output;struct device *dev;
@@ -43,7 +42,7 @@ struct tegra_hdmi { };static inline struct tegra_hdmi * -tegra_drm_client_to_hdmi (struct tegra_drm_client *client) +host1x_client_to_hdmi (struct host1x_client *client) { return container_of(client, struct tegra_hdmi, client); }
@@ -1118,22 +1117,22 @@ static int tegra_hdmi_debugfs_exit(struct tegra_hdmi *hdmi)static int tegra_hdmi_init (struct host1x_client *client) { -struct tegra_drm_client *drm =to_tegra_drm_client (client); -struct tegra_hdmi *hdmi =tegra_drm_client_to_hdmi (drm); +struct tegra_drm *tegra =dev_get_drvdata (client->parent); +struct tegra_hdmi *hdmi =host1x_client_to_hdmi (client);int err; hdmi->output.type =TEGRA_OUTPUT_HDMI ; hdmi->output.dev = client->dev; hdmi->output.ops = &hdmi_ops; - err =tegra_output_init (drm->drm, &hdmi->output); + err =tegra_output_init (tegra->drm, &hdmi->output);if (err <0 ) {dev_err (client->dev,"output setup failed: %d\n" , err);return err; }if (IS_ENABLED (CONFIG_DEBUG_FS )) { - err =tegra_hdmi_debugfs_init (hdmi, drm->drm->primary); + err =tegra_hdmi_debugfs_init (hdmi, tegra->drm->primary);if (err <0 )dev_err (client->dev,"debugfs setup failed: %d\n" , err); }
@@ -1143,8 +1142,7 @@ static int tegra_hdmi_init(struct host1x_client *client)static int tegra_hdmi_exit (struct host1x_client *client) { -struct tegra_drm_client *drm =to_tegra_drm_client (client); -struct tegra_hdmi *hdmi =tegra_drm_client_to_hdmi (drm); +struct tegra_hdmi *hdmi =host1x_client_to_hdmi (client);int err;if (IS_ENABLED (CONFIG_DEBUG_FS )) {
@@ -1176,11 +1174,14 @@ static const struct host1x_client_ops hdmi_client_ops = {static int tegra_hdmi_probe (struct platform_device *pdev) { -struct tegra_drm *tegra =host1x_get_drm_data (pdev->dev.parent); +struct host1x *host1x =dev_get_drvdata (pdev->dev.parent);struct tegra_hdmi *hdmi;struct resource *regs;int err; +if (!host1x) +return -EPROBE_DEFER ; + hdmi =devm_kzalloc (&pdev->dev,sizeof (*hdmi),GFP_KERNEL );if (!hdmi)return -ENOMEM ;
@@ -1247,11 +1248,11 @@ static int tegra_hdmi_probe(struct platform_device *pdev) hdmi->irq = err; -INIT_LIST_HEAD (&hdmi->client.base.list); - hdmi->client.base.ops = &hdmi_client_ops; - hdmi->client.base.dev = &pdev->dev; +INIT_LIST_HEAD (&hdmi->client.list); + hdmi->client.ops = &hdmi_client_ops; + hdmi->client.dev = &pdev->dev; - err =host1x_register_client (tegra, &hdmi->client.base); + err =host1x_register_client (host1x, &hdmi->client);if (err <0 ) {dev_err (&pdev->dev,"failed to register host1x client: %d\n" , err);
@@ -1265,11 +1266,11 @@ static int tegra_hdmi_probe(struct platform_device *pdev)static int tegra_hdmi_remove (struct platform_device *pdev) { -struct tegra_drm *tegra =host1x_get_drm_data (pdev->dev.parent); +struct host1x *host1x =dev_get_drvdata (pdev->dev.parent);struct tegra_hdmi *hdmi =platform_get_drvdata (pdev);int err; - err =host1x_unregister_client (tegra, &hdmi->client.base); + err =host1x_unregister_client (host1x, &hdmi->client);if (err <0 ) {dev_err (&pdev->dev,"failed to unregister host1x client: %d\n" , err);
include/drm/drmP.h +1 -0
@@ -150,6 +150,7 @@ int drm_err(const char *func, const char *format, ...);#define DRIVER_BUS_PCI 0x1#define DRIVER_BUS_PLATFORM 0x2#define DRIVER_BUS_USB 0x3 +#define DRIVER_BUS_HOST1X 0x4/***********************************************************************/ /** \name Begin the DRM... */
include/linux/host1x.h +44 -1
61 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): 1381134884-5816-14-git-send-email-treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org
Re: [PATCH v2 13/27] drm/tegra: Move subdevice infrastructure to host1x
Quoted 8 lines · Thierry Reding
The Tegra DRM driver currently uses some infrastructure to defer the DRM core initialization until all required devices have registered. The same infrastructure can potentially be used by any other driver that requires more than a single sub-device of the host1x module.
Make the infrastructure more generic and keep only the DRM specific code in the DRM part of the driver. Eventually this will make it easy to move the DRM driver part back to the DRM subsystem.
Do we need the host1x_client/tegra_drm_client concept outside DRM? You separated the two in an earlier patch, but the whole structure is there because of limitation in DRM. Shouldn't we keep management of drm clients entirely inside drm?
Second, do we need an own drm_bus for host1x clients? Does it bring something drm_platform doesn't? I couldn't see any immediate difference between the two.
Terje
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH v2 13/27] drm/tegra: Move subdevice infrastructure to host1x
Quoted 6 lines · Terje Bergström
Quoted 5 lines · Thierry Reding
The Tegra DRM driver currently uses some infrastructure to defer the DRM core initialization until all required devices have registered. The same infrastructure can potentially be used by any other driver that requires more than a single sub-device of the host1x module.
Quoted 8 lines
Quoted 3 lines
Make the infrastructure more generic and keep only the DRM specific code in the DRM part of the driver. Eventually this will make it easy to move the DRM driver part back to the DRM subsystem.
Do we need the host1x_client/tegra_drm_client concept outside DRM? You separated the two in an earlier patch, but the whole structure is there because of limitation in DRM. Shouldn't we keep management of drm clients entirely inside drm?
The DRM specific parts are still all managed within the DRM driver. However the host1x_client API, and specifically the method in which sub-devices can be registered (host1x_client to host1x_device) is completely subsystem agnostic.
That part can be used subsequently by things such as a V4L2 driver to achieve the same thing we've done with Tegra DRM, namely to use several sub-devices collectively to provide the functionality of a "composite" device (VI/CSI).
Quoted 3 lines
Second, do we need an own
drm_busfor host1x clients? Does it bring somethingdrm_platformdoesn't? I couldn't see any immediate difference between the two.
The difference is in that we pass in a host1x_device, which is not a platform device, but really just a wrapped struct device. That in turn provides the whole composite device infrastructure. So, no, it can't be done with drm_platform.
Thierry
Re: [PATCH v2 13/27] drm/tegra: Move subdevice infrastructure to host1x
In reply to a message not in the archivedrivers/gpu/host1x/drm/bus.c line 42
Quoted 4 lines · Thierry Reding
drivers/gpu/host1x/drm/bus.c new file +4
-0+static struct drm_bus drm_host1x_bus = { + .bus_type =DRIVER_BUS_HOST1X , + .set_busid = drm_host1x_set_busid, +};
Imo this needs to die asap, i.e. before it lands in drm-next. I've just spent a bit of time trying to rid ourselves of this midlayer brain-damange, and now new stuff crops up. See
http://cgit.freedesktop.org/~danvet/drm/log/?h=drm-init-cleanup
drm_bus is a terribly midlayer madness disaster and needs to just burn down. So what exactly is the reason here to not go with the drm_platform.c stuff until I've gotten around to completely rip it all out?
Adding Dave.
Cheers, Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
A message that is not in the archive (sent off-list or not yet received): 20131104102054.GD4167-dv86pmgwkMBes7Z6vYuT8azUEOm+Xw19@public.gmane.org
Re: [PATCH v2 13/27] drm/tegra: Move subdevice infrastructure to host1x
Quoted 10 lines · Daniel Vetter
drivers/gpu/host1x/drm/bus.c line 42
Quoted 4 lines · Thierry Reding
drivers/gpu/host1x/drm/bus.c new file +4
-0+static struct drm_bus drm_host1x_bus = { + .bus_type =DRIVER_BUS_HOST1X , + .set_busid = drm_host1x_set_busid, +};Imo this needs to die asap, i.e. before it lands in drm-next. I've just spent a bit of time trying to rid ourselves of this midlayer brain-damange, and now new stuff crops up. See
Quoted 5 lines
http://cgit.freedesktop.org/~danvet/drm/log/?h=drm-init-cleanup
drm_busis a terribly midlayer madness disaster and needs to just burn down. So what exactly is the reason here to not go with thedrm_platform.cstuff until I've gotten around to completely rip it all out?
Dave asked me whether it was possible to move the Tegra DRM driver back into drivers/gpu/drm (from drivers/gpu/host1x/drm) and introducing this new bus was the only solution I saw (besides perhaps using cross- subsystem global variables) to do that.
Now, I'm not a big fan at all of the whole drm_bus shebang myself, so whatever help you need in getting rid of it, please let me know. The drm_bus implementation that this adds is about 34 lines, so it shouldn't be difficult to get rid of. If you throw out drm_driver.bus completely, then it should be a matter of just deleting that code and the rest should be able to continue working as is. The only reason I added it is because the kernel crashes if its not there, depending on what userspace is run.
So I find myself in the middle of controversy again... I seem to have a knack for it.
Thierry
A message that is not in the archive (sent off-list or not yet received): 20131104110655.GN27445-AwZRO8vwLAwmlAP/[email protected]
Re: [PATCH v2 13/27] drm/tegra: Move subdevice infrastructure to host1x
Quoted 22 lines · Thierry Reding
Quoted 10 lines · Daniel Vetter
drivers/gpu/host1x/drm/bus.c line 42
Quoted 4 lines · Thierry Reding
drivers/gpu/host1x/drm/bus.c new file +4
-0+static struct drm_bus drm_host1x_bus = { + .bus_type =DRIVER_BUS_HOST1X , + .set_busid = drm_host1x_set_busid, +};Imo this needs to die asap, i.e. before it lands in drm-next. I've just spent a bit of time trying to rid ourselves of this midlayer brain-damange, and now new stuff crops up. See
Quoted 5 lines
http://cgit.freedesktop.org/~danvet/drm/log/?h=drm-init-cleanup
drm_busis a terribly midlayer madness disaster and needs to just burn down. So what exactly is the reason here to not go with thedrm_platform.cstuff until I've gotten around to completely rip it all out?Dave asked me whether it was possible to move the Tegra DRM driver back into
drivers/gpu/drm(fromdrivers/gpu/host1x/drm) and introducing this new bus was the only solution I saw (besides perhaps using cross- subsystem global variables) to do that.
Quoted 8 lines
Now, I'm not a big fan at all of the whole
drm_busshebang myself, so whatever help you need in getting rid of it, please let me know. Thedrm_busimplementation that this adds is about 34 lines, so it shouldn't be difficult to get rid of. If you throw out drm_driver.bus completely, then it should be a matter of just deleting that code and the rest should be able to continue working as is. The only reason I added it is because the kernel crashes if its not there, depending on what userspace is run.
Oh, so you actually need the bus->set_busid callback? Since that's one of those old ugly dragons from the ums days and really shouldn't be used by anything modern. E.g. rendernodes completely disallow it, and afaik the x86 systems I have here also don't use it. So you've copy&pasted a piece of lore that you _never_ should have used, and since I'm too late we now have userspace that depends upon it :(
Aside: The reason we have drm_platform.c is to make the shadow-attach possible that ums drm drivers needed. Luckily we've never merged an ARM shadow-attaching ums drm driver, but unfortunately everyone just kept on using the old crap without too much though.
If you just need to prevent the Oops (and please hunt down that piece of userspace calling the setversion ioctl and figure out where it is, link to sources highly appreciated) you can peek at drm_usb.c for the true noop implementation. Would be great if you can figure this out before -rc1 - I want to dump my current pile of patches onto Dave by then for 3.14.
Wrt the drm_put_dev in drm_host1x_exit I don't care one bit what you do in your driver, as long as you call drm_put_dev directly ;-) It looks like I'm lucky and can just drop the tegra patch as soon as your tree has landed.
Quoted 2 lines
So I find myself in the middle of controversy again... I seem to have a knack for it.
Looks like it's just a small one here ... you need to try harder.
Btw the longer-term plan is that you can embedd the struct drm_device into whatever driver private struct is suitable and completely control it's lifetime. That would allow us to ditch the drm_dev->usbdevice and ->platform_device pointers (killing dev->agp and dev->pdev is much harder due to the big pile of legacy drives, but in principal not impossible for someone with too much time).
-Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
PATCH v2 14/27 drm/tegra: Move driver to DRM tree
In reply to a message not in the archiveIn order to subsystem-wide changes easier, move the Tegra DRM driver back into the DRM tree.
---
MAINTAINERS | 1 +
drivers/gpu/drm/Kconfig | 2 ++
drivers/gpu/drm/Makefile | 1 +
drivers/gpu/{host1x/drm => drm/tegra}/Kconfig | 10 +++++-----
drivers/gpu/drm/tegra/Makefile | 15 +++++++++++++++
drivers/gpu/{host1x/drm => drm/tegra}/bus.c | 0
drivers/gpu/{host1x/drm => drm/tegra}/dc.c | 0
drivers/gpu/{host1x/drm => drm/tegra}/dc.h | 0
drivers/gpu/{host1x/drm => drm/tegra}/drm.c | 0
drivers/gpu/{host1x/drm => drm/tegra}/drm.h | 0
drivers/gpu/{host1x/drm => drm/tegra}/fb.c | 0
drivers/gpu/{host1x/drm => drm/tegra}/gem.c | 0
drivers/gpu/{host1x/drm => drm/tegra}/gem.h | 0
drivers/gpu/{host1x/drm => drm/tegra}/gr2d.c | 0
drivers/gpu/{host1x/drm => drm/tegra}/hdmi.c | 0
drivers/gpu/{host1x/drm => drm/tegra}/hdmi.h | 0
drivers/gpu/{host1x/drm => drm/tegra}/output.c | 0
drivers/gpu/{host1x/drm => drm/tegra}/rgb.c | 0
drivers/gpu/host1x/Kconfig | 2 --
drivers/gpu/host1x/Makefile | 8 --------
drivers/video/Kconfig | 4 ++--
21 files changed, 26 insertions(+), 17 deletions(-)
rename drivers/gpu/{host1x/drm => drm/tegra}/Kconfig (100%)
create mode 100644 drivers/gpu/drm/tegra/Makefile
rename drivers/gpu/{host1x/drm => drm/tegra}/bus.c (100%)
rename drivers/gpu/{host1x/drm => drm/tegra}/dc.c (100%)
rename drivers/gpu/{host1x/drm => drm/tegra}/dc.h (100%)
rename drivers/gpu/{host1x/drm => drm/tegra}/drm.c (100%)
rename drivers/gpu/{host1x/drm => drm/tegra}/drm.h (100%)
rename drivers/gpu/{host1x/drm => drm/tegra}/fb.c (100%)
rename drivers/gpu/{host1x/drm => drm/tegra}/gem.c (100%)
rename drivers/gpu/{host1x/drm => drm/tegra}/gem.h (100%)
rename drivers/gpu/{host1x/drm => drm/tegra}/gr2d.c (100%)
rename drivers/gpu/{host1x/drm => drm/tegra}/hdmi.c (100%)
rename drivers/gpu/{host1x/drm => drm/tegra}/hdmi.h (100%)
rename drivers/gpu/{host1x/drm => drm/tegra}/output.c (100%)
rename drivers/gpu/{host1x/drm => drm/tegra}/rgb.c (100%)MAINTAINERS +1 -0
@@ -2811,6 +2811,7 @@ L: [email protected] L: [email protected] T: git git://anongit.freedesktop.org/tegra/linux.git S: Supported +F: drivers/gpu/drm/tegra/ F: drivers/gpu/host1x/ F: include/linux/host1x.h F: include/uapi/drm/tegra_drm.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/tegra/Kconfig"
drivers/gpu/drm/Makefile +1 -0
@@ -55,4 +55,5 @@ obj-$(CONFIG_DRM_OMAP) += omapdrm/ obj-$(CONFIG_DRM_TILCDC) += tilcdc/ obj-$(CONFIG_DRM_QXL) += qxl/ obj-$(CONFIG_DRM_MSM) += msm/ +obj-$(CONFIG_DRM_TEGRA) += tegra/ obj-y += i2c/
drivers/gpu/drm/tegra/Kconfig renamed from drivers/gpu/host1x/drm/Kconfig +5 -5
@@ -13,6 +13,11 @@ config DRM_TEGRA if DRM_TEGRA +config DRM_TEGRA_DEBUG + bool "NVIDIA Tegra DRM debug support" + help + Say yes here to enable debugging support. + config DRM_TEGRA_STAGING bool "Enable HOST1X interface" depends on STAGING
@@ -21,9 +26,4 @@ config DRM_TEGRA_STAGING If unsure, choose N. -config DRM_TEGRA_DEBUG - bool "NVIDIA Tegra DRM debug support" - help - Say yes here to enable debugging support. - endif
drivers/gpu/drm/tegra/Makefile new file +15 -0
@@ -0,0 +1,15 @@ +ccflags-y += -Iinclude/drm +ccflags-$(CONFIG_DRM_TEGRA_DEBUG) += -DDEBUG + +tegra-drm-y := \ + bus.o \ + drm.o \ + gem.o \ + fb.o \ + dc.o \ + output.o \ + rgb.o \ + hdmi.o \ + gr2d.o + +obj-$(CONFIG_DRM_TEGRA) += tegra-drm.o
drivers/gpu/drm/tegra/bus.c renamed from drivers/gpu/host1x/drm/bus.c +0 -0
drivers/gpu/drm/tegra/dc.c renamed from drivers/gpu/host1x/drm/dc.c +0 -0
drivers/gpu/drm/tegra/dc.h renamed from drivers/gpu/host1x/drm/dc.h +0 -0
drivers/gpu/drm/tegra/drm.c renamed from drivers/gpu/host1x/drm/drm.c +0 -0
drivers/gpu/drm/tegra/drm.h renamed from drivers/gpu/host1x/drm/drm.h +0 -0
drivers/gpu/drm/tegra/fb.c renamed from drivers/gpu/host1x/drm/fb.c +0 -0
drivers/gpu/drm/tegra/gem.c renamed from drivers/gpu/host1x/drm/gem.c +0 -0
drivers/gpu/drm/tegra/gem.h renamed from drivers/gpu/host1x/drm/gem.h +0 -0
drivers/gpu/drm/tegra/gr2d.c renamed from drivers/gpu/host1x/drm/gr2d.c +0 -0
drivers/gpu/drm/tegra/hdmi.c renamed from drivers/gpu/host1x/drm/hdmi.c +0 -0
drivers/gpu/drm/tegra/hdmi.h renamed from drivers/gpu/host1x/drm/hdmi.h +0 -0
drivers/gpu/drm/tegra/output.c renamed from drivers/gpu/host1x/drm/output.c +0 -0
drivers/gpu/drm/tegra/rgb.c renamed from drivers/gpu/host1x/drm/rgb.c +0 -0
drivers/gpu/host1x/Kconfig +0 -2
@@ -19,6 +19,4 @@ config TEGRA_HOST1X_FIREWALL If unsure, choose Y. -source "drivers/gpu/host1x/drm/Kconfig" - endif
drivers/gpu/host1x/Makefile +0 -8
@@ -9,12 +9,4 @@ host1x-y = \ debug.o \ hw/host1x01.o -ccflags-y += -Iinclude/drm -ccflags-$(CONFIG_DRM_TEGRA_DEBUG) += -DDEBUG - -host1x-$(CONFIG_DRM_TEGRA) += drm/drm.o drm/fb.o drm/dc.o -host1x-$(CONFIG_DRM_TEGRA) += drm/output.o drm/rgb.o drm/hdmi.o -host1x-$(CONFIG_DRM_TEGRA) += drm/gem.o -host1x-$(CONFIG_DRM_TEGRA) += drm/gr2d.o -host1x-$(CONFIG_DRM_TEGRA) += drm/bus.o obj-$(CONFIG_TEGRA_HOST1X) += host1x.o
drivers/video/Kconfig +2 -2
@@ -19,10 +19,10 @@ source "drivers/char/agp/Kconfig" source "drivers/gpu/vga/Kconfig" -source "drivers/gpu/drm/Kconfig" - source "drivers/gpu/host1x/Kconfig" +source "drivers/gpu/drm/Kconfig" + config VGASTATE tristate default n
Signature · 1 line
1.8.4
A message that is not in the archive (sent off-list or not yet received): 1381134884-5816-15-git-send-email-treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org
Re: [PATCH v2 14/27] drm/tegra: Move driver to DRM tree
Quoted 1 line · Thierry Reding
In order to subsystem-wide changes easier, move the Tegra DRM driver
^^ make ?
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH v2 14/27] drm/tegra: Move driver to DRM tree
Quoted 3 lines · Stephen Warren
Quoted 1 line · Thierry Reding
In order to subsystem-wide changes easier, move the Tegra DRM driver
^^ make ?
I had noticed myself already and fixed it up.
Thanks,
Thierry
PATCH v2 15/27 gpu: host1x: Add support for Tegra114
In reply to a message not in the archiveTegra114 uses a slightly updated version of host1x with an additional syncpoint.
---
Changes in v2:
- fix register fields changed from host1x01
drivers/gpu/host1x/Makefile | 3 +- drivers/gpu/host1x/dev.c | 11 ++ drivers/gpu/host1x/hw/host1x02.c | 42 +++++ drivers/gpu/host1x/hw/host1x02.h | 26 +++ drivers/gpu/host1x/hw/hw_host1x02_channel.h | 121 ++++++++++++++ drivers/gpu/host1x/hw/hw_host1x02_sync.h | 243 ++++++++++++++++++++++++++++ drivers/gpu/host1x/hw/hw_host1x02_uclass.h | 175 ++++++++++++++++++++ 7 files changed, 620 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/host1x/hw/host1x02.c create mode 100644 drivers/gpu/host1x/hw/host1x02.h create mode 100644 drivers/gpu/host1x/hw/hw_host1x02_channel.h create mode 100644 drivers/gpu/host1x/hw/hw_host1x02_sync.h create mode 100644 drivers/gpu/host1x/hw/hw_host1x02_uclass.h
drivers/gpu/host1x/Makefile +2 -1
@@ -7,6 +7,7 @@ host1x-y = \ channel.o \ job.o \ debug.o \ - hw/host1x01.o + hw/host1x01.o \ + hw/host1x02.o obj-$(CONFIG_TEGRA_HOST1X) += host1x.o
drivers/gpu/host1x/dev.c +11 -0
@@ -33,6 +33,7 @@#include "channel.h" #include "debug.h" #include "hw/host1x01.h" +#include "hw/host1x02.h" void host1x_sync_writel (struct host1x *host1x,u32 v,u32 r) {
@@ -67,7 +68,17 @@ static const struct host1x_info host1x01_info = { .sync_offset = 0x3000, }; +static const struct host1x_info host1x02_info = { + .nb_channels =9 , + .nb_pts =32 , + .nb_mlocks =16 , + .nb_bases =12 , + .init = host1x02_init, + .sync_offset =0x3000 , +}; +static struct of_device_id host1x_of_match[] = { + { .compatible ="nvidia,tegra114-host1x" , .data = &host1x02_info, }, { .compatible ="nvidia,tegra30-host1x" , .data = &host1x01_info, }, { .compatible ="nvidia,tegra20-host1x" , .data = &host1x01_info, }, { },
drivers/gpu/host1x/hw/host1x02.c new file +42 -0
42 lines not on this page · raw message
drivers/gpu/host1x/hw/host1x02.h new file +26 -0
@@ -0,0 +1,26 @@ +/* +* Host1x init for Tegra114 SoCs +* +* Copyright (c) 2013 NVIDIA Corporation. +* +* This program is free software; you can redistribute it and/or modify it +* under the terms and conditions of the GNU General Public License, +* version 2, as published by the Free Software Foundation. +* +* This program is distributed in the hope 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 HOST1X_HOST1X02_H +#define HOST1X_HOST1X02_H + +struct host1x ; + +int host1x02_init (struct host1x *host); + +#endif
drivers/gpu/host1x/hw/hw_host1x02_channel.h new file +121 -0
121 lines not on this page · raw message
drivers/gpu/host1x/hw/hw_host1x02_sync.h new file +243 -0
243 lines not on this page · raw message
drivers/gpu/host1x/hw/hw_host1x02_uclass.h new file +175 -0
175 lines not on this page · raw message
Signature · 6 lines
1.8.4 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1381134884-5816-16-git-send-email-treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org
Re: [PATCH v2 15/27] gpu: host1x: Add support for Tegra114
Quoted 8 lines · Thierry Reding
Tegra114 uses a slightly updated version of host1x with an additional syncpoint.
drivers/gpu/host1x/hw/host1x02.c | 42 +++++ drivers/gpu/host1x/hw/host1x02.h | 26 +++ drivers/gpu/host1x/hw/hw_host1x02_channel.h | 121 ++++++++++++++ drivers/gpu/host1x/hw/hw_host1x02_sync.h | 243 ++++++++++++++++++++++++++++ drivers/gpu/host1x/hw/hw_host1x02_uclass.h | 175 ++++++++++++++++++++
That seems like an awful lot of extra lines to support just one extra syncpoint. Are there other changes? If not, can the code be shared/parameterized somehow?
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH v2 15/27] gpu: host1x: Add support for Tegra114
Quoted 10 lines · Stephen Warren
Quoted 8 lines · Thierry Reding
Tegra114 uses a slightly updated version of host1x with an additional syncpoint.
drivers/gpu/host1x/hw/host1x02.c | 42 +++++ drivers/gpu/host1x/hw/host1x02.h | 26 +++ drivers/gpu/host1x/hw/hw_host1x02_channel.h | 121 ++++++++++++++ drivers/gpu/host1x/hw/hw_host1x02_sync.h | 243 ++++++++++++++++++++++++++++ drivers/gpu/host1x/hw/hw_host1x02_uclass.h | 175 ++++++++++++++++++++
Quoted 3 lines
That seems like an awful lot of extra lines to support just one extra syncpoint. Are there other changes? If not, can the code be shared/parameterized somehow?
Yeah, I don't like very much how this is currently done. I mean about half of this is actually duplicate code because of the static inline functions used for register defines. As discussed elsewhere this was originally meant to be used for coverage testing, but nobody's done anything like that as far as I know. I'm also not convinced that these would be very useful in coverage testing, but adding Terje on Cc and unless he or anyone else has any (strong) objections I'll go and remove the duplicate definitions and while at it see if I can come up with a way to share more code/definitions between versions of host1x.
Do you see this as a blocker for 3.13 or can I do the cleanup after that? As far as I know Tegra124 has a more heavily modified version of host1x so implementing Tegra124 support might be a good opportunity to clean this up anyway.
Thierry
Re: [PATCH v2 15/27] gpu: host1x: Add support for Tegra114
Quoted 10 lines · Thierry Reding
Yeah, I don't like very much how this is currently done. I mean about half of this is actually duplicate code because of the static inline functions used for register defines. As discussed elsewhere this was originally meant to be used for coverage testing, but nobody's done anything like that as far as I know. I'm also not convinced that these would be very useful in coverage testing, but adding Terje on Cc and unless he or anyone else has any (strong) objections I'll go and remove the duplicate definitions and while at it see if I can come up with a way to share more code/definitions between versions of host1x.
Quoted 4 lines
Do you see this as a blocker for 3.13 or can I do the cleanup after that? As far as I know Tegra124 has a more heavily modified version of host1x so implementing Tegra124 support might be a good opportunity to clean this up anyway.
For Tegra114 the register level changes are small (one channel added, wait bases, expanded fifo, etc) but for Tegra124 they're bigger. So let's keep the long term in mind.
I'm ok with removing the inlines. Just the energy spent in discussing it over and over again is more than the benefits that a proper compiler gives over the preprocessor (type checking, real syntax checking, coverage, gdb breakpoints, etc). For some reason (which escapes me) preprocessor magic seems to be the norm in Linux kernel.
Parameterized code gets easily really ugly, difficult to debug and difficult to port to new chips. There's much less work and opportunity of mistake in maintaining data in a couple of files than subtle algorithms all over the driver. If we don't have inlines in hw headers, the headers become tiny and any benefits of parameterized code versus per-hw version headers vanish.
Terje
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH v2 15/27] gpu: host1x: Add support for Tegra114
Quoted 11 lines · Terje Bergström
Quoted 10 lines · Thierry Reding
Yeah, I don't like very much how this is currently done. I mean about half of this is actually duplicate code because of the static inline functions used for register defines. As discussed elsewhere this was originally meant to be used for coverage testing, but nobody's done anything like that as far as I know. I'm also not convinced that these would be very useful in coverage testing, but adding Terje on Cc and unless he or anyone else has any (strong) objections I'll go and remove the duplicate definitions and while at it see if I can come up with a way to share more code/definitions between versions of host1x.
Quoted 8 lines
Quoted 4 lines
Do you see this as a blocker for 3.13 or can I do the cleanup after that? As far as I know Tegra124 has a more heavily modified version of host1x so implementing Tegra124 support might be a good opportunity to clean this up anyway.
For Tegra114 the register level changes are small (one channel added, wait bases, expanded fifo, etc) but for Tegra124 they're bigger. So let's keep the long term in mind.
I agree with Stephen here. We should really be working together with HW to prevent as many incompatibilities as we can.
Quoted 6 lines
I'm ok with removing the inlines. Just the energy spent in discussing it over and over again is more than the benefits that a proper compiler gives over the preprocessor (type checking, real syntax checking, coverage, gdb breakpoints, etc). For some reason (which escapes me) preprocessor magic seems to be the norm in Linux kernel.
Quoted 6 lines
Parameterized code gets easily really ugly, difficult to debug and difficult to port to new chips. There's much less work and opportunity of mistake in maintaining data in a couple of files than subtle algorithms all over the driver. If we don't have inlines in hw headers, the headers become tiny and any benefits of parameterized code versus per-hw version headers vanish.
I'll keep that in mind when I revisit this.
Thierry
Re: [PATCH v2 15/27] gpu: host1x: Add support for Tegra114
In reply to Thierry RedingQuoted 28 lines · Thierry Reding
Quoted 12 lines · Stephen Warren
Quoted 10 lines · Thierry Reding
Tegra114 uses a slightly updated version of host1x with an additional syncpoint.
drivers/gpu/host1x/hw/host1x02.c | 42 +++++ drivers/gpu/host1x/hw/host1x02.h | 26 +++ drivers/gpu/host1x/hw/hw_host1x02_channel.h | 121++++++++++++++
drivers/gpu/host1x/hw/hw_host1x02_sync.h|
243 ++++++++++++++++++++++++++++drivers/gpu/host1x/hw/hw_host1x02_uclass.h| 175
++++++++++++++++++++Quoted 3 lines
That seems like an awful lot of extra lines to support just one extra syncpoint. Are there other changes? If not, can the code be shared/parameterized somehow?
Yeah, I don't like very much how this is currently done. I mean about half of this is actually duplicate code because of the static inline functions used for register defines. As discussed elsewhere this was originally meant to be used for coverage testing, but nobody's done anything like that as far as I know. I'm also not convinced that these would be very useful in coverage testing, but adding Terje on Cc and unless he or anyone else has any (strong) objections I'll go and remove the duplicate definitions and while at it see if I can come up with a way to share more code/definitions between versions of host1x.
Quoted 4 lines
Do you see this as a blocker for 3.13 or can I do the cleanup after that? As far as I know Tegra124 has a more heavily modified version of host1x so implementing Tegra124 support might be a good opportunity to clean this up anyway.
I guess I'm unsure re: whether it's a blocker. It's certainly not some kind of ABI issue, so it's not like it forces our hand later; we can easily refactor the code later. However, I'm slightly worried that if we do actually intend to do that, it'll be seen as code-churn. Still, I guess if the main DRM maintainers don't object to this, I'm OK with it.
Re: Terje's points, we (e.g. Terje) should work with the HW designers to stop moving things about, so we don't have incompatible HW.
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH v2 15/27] gpu: host1x: Add support for Tegra114
Quoted 34 lines · Stephen Warren
Quoted 28 lines · Thierry Reding
Quoted 12 lines · Stephen Warren
Quoted 10 lines · Thierry Reding
Tegra114 uses a slightly updated version of host1x with an additional syncpoint.
drivers/gpu/host1x/hw/host1x02.c | 42 +++++ drivers/gpu/host1x/hw/host1x02.h | 26 +++ drivers/gpu/host1x/hw/hw_host1x02_channel.h | 121++++++++++++++
drivers/gpu/host1x/hw/hw_host1x02_sync.h|
243 ++++++++++++++++++++++++++++drivers/gpu/host1x/hw/hw_host1x02_uclass.h| 175
++++++++++++++++++++Quoted 3 lines
That seems like an awful lot of extra lines to support just one extra syncpoint. Are there other changes? If not, can the code be shared/parameterized somehow?
Yeah, I don't like very much how this is currently done. I mean about half of this is actually duplicate code because of the static inline functions used for register defines. As discussed elsewhere this was originally meant to be used for coverage testing, but nobody's done anything like that as far as I know. I'm also not convinced that these would be very useful in coverage testing, but adding Terje on Cc and unless he or anyone else has any (strong) objections I'll go and remove the duplicate definitions and while at it see if I can come up with a way to share more code/definitions between versions of host1x.
Quoted 4 lines
Do you see this as a blocker for 3.13 or can I do the cleanup after that? As far as I know Tegra124 has a more heavily modified version of host1x so implementing Tegra124 support might be a good opportunity to clean this up anyway.
Quoted 5 lines
I guess I'm unsure re: whether it's a blocker. It's certainly not some kind of ABI issue, so it's not like it forces our hand later; we can easily refactor the code later. However, I'm slightly worried that if we do actually intend to do that, it'll be seen as code-churn. Still, I guess if the main DRM maintainers don't object to this, I'm OK with it.
Adding Dave. Dave, do you have any objections to cleaning this up after 3.13? I'd prefer not to have to do it this cycle because I'd like to focus on what patches I currently have. The plan is to upstream support for the next SoC (Tegra124) for 3.14 and I'd much rather do the cleanup along with that work.
Does that sound reasonable?
Thierry
PATCH v2 16/27 drm/tegra: Add Tegra114 display controller support
In reply to a message not in the archiveFrom: Mikko Perttunen <[email protected]>
The Tegra114 display controller is backwards-compatible with previous generations of the Tegra SoC. No code changes are required.
--- drivers/gpu/drm/tegra/dc.c | 1 + drivers/gpu/drm/tegra/drm.c | 1 + 2 files changed, 2 insertions(+)
drivers/gpu/drm/tegra/dc.c +1 -0
@@ -1183,6 +1183,7 @@ static int tegra_dc_remove(struct platform_device *pdev) }static struct of_device_id tegra_dc_of_match[] = { + { .compatible ="nvidia,tegra114-dc" , }, { .compatible ="nvidia,tegra30-dc" , }, { .compatible ="nvidia,tegra20-dc" , }, { },
drivers/gpu/drm/tegra/drm.c +1 -0
@@ -489,6 +489,7 @@ static const struct of_device_id host1x_drm_subdevs[] = { { .compatible = "nvidia,tegra30-dc", }, { .compatible = "nvidia,tegra30-hdmi", }, { .compatible = "nvidia,tegra30-gr2d", }, + { .compatible = "nvidia,tegra114-dc", }, { /* sentinel */ } };
Signature · 1 line
1.8.4
A message that is not in the archive (sent off-list or not yet received): 1381134884-5816-17-git-send-email-treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org
Re: [PATCH v2 16/27] drm/tegra: Add Tegra114 display controller support
Quoted 4 lines · Thierry Reding
From: Mikko Perttunen <[email protected]>
The Tegra114 display controller is backwards-compatible with previous generations of the Tegra SoC. No code changes are required.
If the HW is backwards-compatible, then there's no need to add extra compatible values to the driver; just write the following in the DT, and it'll just work:
compatible = "nvidia,tegra114-dc", "nvidia,tegra30-dc";
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH v2 16/27] drm/tegra: Add Tegra114 display controller support
Quoted 11 lines · Stephen Warren
Quoted 4 lines · Thierry Reding
From: Mikko Perttunen <[email protected]>
The Tegra114 display controller is backwards-compatible with previous generations of the Tegra SoC. No code changes are required.
If the HW is backwards-compatible, then there's no need to add extra compatible values to the driver; just write the following in the DT, and it'll just work:
compatible = "nvidia,tegra114-dc", "nvidia,tegra30-dc";
One reason why I thought it might be useful to still include this, even though unnecessary, was to match it to the host1x_drm_subdevs table. We can probably remove the entry from there as well, though.
As far as I can tell, the same holds for Tegra30, which is also backwards compatible with Tegra20 but the DTS doesn't contain the Tegra20 compatible. So to keep ABI compatibility we'll need to keep the nvidia,tegra30-dc in the driver's match tables, but I could still update the DTS to include the nvidia,tegra20-dc for correctness.
Does that make sense?
Thierry
Re: [PATCH v2 16/27] drm/tegra: Add Tegra114 display controller support
Quoted 19 lines · Thierry Reding
Quoted 7 lines · Stephen Warren
Quoted 5 lines · Thierry Reding
From: Mikko Perttunen <[email protected]>
The Tegra114 display controller is backwards-compatible with previous generations of the Tegra SoC. No code changes are required.
Quoted 5 lines
If the HW is backwards-compatible, then there's no need to add extra compatible values to the driver; just write the following in the DT, and it'll just work:
compatible = "nvidia,tegra114-dc", "nvidia,tegra30-dc";
One reason why I thought it might be useful to still include this, even though unnecessary, was to match it to the
host1x_drm_subdevstable. We can probably remove the entry from there as well, though.
Quoted 8 lines
As far as I can tell, the same holds for Tegra30, which is also backwards compatible with Tegra20 but the DTS doesn't contain the Tegra20 compatible. So to keep ABI compatibility we'll need to keep the nvidia,tegra30-dc in the driver's match tables, but I could still update the DTS to include the nvidia,tegra20-dc for correctness.
Does that make sense?
Yes, fixing the Tegra30 .dtsi file sounds like a good idea.
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH v2 16/27] drm/tegra: Add Tegra114 display controller support
Quoted 27 lines · Stephen Warren
Quoted 26 lines · Thierry Reding
Quoted 7 lines · Stephen Warren
Quoted 5 lines · Thierry Reding
From: Mikko Perttunen <[email protected]>
The Tegra114 display controller is backwards-compatible with previous generations of the Tegra SoC. No code changes are required.
Quoted 5 lines
If the HW is backwards-compatible, then there's no need to add extra compatible values to the driver; just write the following in the DT, and it'll just work:
compatible = "nvidia,tegra114-dc", "nvidia,tegra30-dc";
One reason why I thought it might be useful to still include this, even though unnecessary, was to match it to the
host1x_drm_subdevstable. We can probably remove the entry from there as well, though.As far as I can tell, the same holds for Tegra30, which is also backwards compatible with Tegra20 but the DTS doesn't contain the Tegra20 compatible. So to keep ABI compatibility we'll need to keep the nvidia,tegra30-dc in the driver's match tables, but I could still update the DTS to include the nvidia,tegra20-dc for correctness.
Quoted 3 lines
Quoted 1 line
Does that make sense?
Yes, fixing the Tegra30 .dtsi file sounds like a good idea.
Done.
Thierry
PATCH v2 17/27 drm/tegra: Add Tegra114 HDMI support
In reply to a message not in the archiveFrom: Mikko Perttunen <[email protected]>
Tegra114 TMDS configuration requires a new peak_current field and the driver current override bit has changed position.
--- drivers/gpu/drm/tegra/drm.c | 1 + drivers/gpu/drm/tegra/hdmi.c | 103 ++++++++++++++++++++++++++++- drivers/gpu/drm/tegra/hdmi.h | 152 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 253 insertions(+), 3 deletions(-)
drivers/gpu/drm/tegra/drm.c +1 -0
@@ -490,6 +490,7 @@ static const struct of_device_id host1x_drm_subdevs[] = { { .compatible = "nvidia,tegra30-hdmi", }, { .compatible = "nvidia,tegra30-gr2d", }, { .compatible = "nvidia,tegra114-dc", }, + { .compatible = "nvidia,tegra114-hdmi", }, { /* sentinel */ } };
drivers/gpu/drm/tegra/hdmi.c +100 -3
145 lines not on this page · raw message
drivers/gpu/drm/tegra/hdmi.h +152 -0
174 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): 1381134884-5816-18-git-send-email-treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org
Re: [PATCH v2 17/27] drm/tegra: Add Tegra114 HDMI support
drivers/gpu/drm/tegra/hdmi.c static const struct tmds_config tegra3_tmds_config[] = {
Quoted 9 lines · Thierry Reding
From: Mikko Perttunen <[email protected]>
Tegra114 TMDS configuration requires a new
peak_currentfield and the driver current override bit has changed position.drivers/gpu/drm/tegra/hdmi.c +0
-0static const struct tmds_config tegra2_tmds_config[] = {@@ -223,6 +224,85 @@ static const struct tmds_config tegra3_tmds_config[] = {
Not related to this patch, but those should have been named tegra20_tmds_config[] and tegra30_tmds_config[].
drivers/gpu/drm/tegra/hdmi.c static void tegra_hdmi_setup_stereo_infoframe(struct tegra_hdmi *hdmi) · line 654
Quoted 5 lines
drivers/gpu/drm/tegra/hdmi.c +1
-2static void tegra_hdmi_setup_tmds (struct tegra_hdmi *hdmi, - value = tmds->drive_current | DRIVE_CURRENT_FUSE_OVERRIDE; -tegra_hdmi_writel (hdmi, value,HDMI_NV_PDISP_SOR_LANE_DRIVE_CURRENT ); + if (of_device_is_compatible(np, "nvidia,tegra114-hdmi")) {
Let's not check this at run-time. Instead, host1x_drm_subdevs[]'s .data field should be used to contain either flags or a pointer to a configuration structure, either of which can be directly consulted to determine the properties of the HW in a feature-oriented/semantic way.
drivers/gpio/gpio-tegra.c's tegra20_gpio_config/tegra30_gpio_config/tegra_gpio_of_match provide a good example of this.
This means that if Tegra124 is identical to Tegra114, yet a hypothetical Tegra999 is different, you don't have to keep adjusting these if conditions throughout the code; they can simply refer to the same feature bit forever.
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH v2 17/27] drm/tegra: Add Tegra114 HDMI support
Quoted 6 lines · Stephen Warren
Quoted 4 lines · Thierry Reding
From: Mikko Perttunen <[email protected]>
Tegra114 TMDS configuration requires a new
peak_currentfield and the driver current override bit has changed position.
Quoted 7 lines
drivers/gpu/drm/tegra/hdmi.c static const struct tmds_config tegra3_tmds_config[] = {
Quoted 4 lines
drivers/gpu/drm/tegra/hdmi.c +0
-0static const struct tmds_config tegra2_tmds_config[] = {@@ -223,6 +224,85 @@ static const struct tmds_config tegra3_tmds_config[] = {Not related to this patch, but those should have been named tegra20_tmds_config[] and tegra30_tmds_config[].
I see that patch 20 fixes this:-)
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH v2 17/27] drm/tegra: Add Tegra114 HDMI support
Quoted 9 lines · Stephen Warren
Quoted 8 lines · Stephen Warren
Quoted 6 lines · Thierry Reding
From: Mikko Perttunen <[email protected]>
Tegra114 TMDS configuration requires a new
peak_currentfield and the driver current override bit has changed position.drivers/gpu/drm/tegra/hdmi.c +0
-0
Quoted 7 lines
Quoted 5 lines
drivers/gpu/drm/tegra/hdmi.c static const struct tmds_config tegra3_tmds_config[] = {
Quoted 2 lines
static const struct
tmds_configtegra2_tmds_config[] = {drivers/gpu/drm/tegra/hdmi.c +0
-0@@ -223,6 +224,85 @@ static const struct tmds_config tegra3_tmds_config[] = {Not related to this patch, but those should have been named tegra20_tmds_config[] and tegra30_tmds_config[].
I see that patch 20 fixes this:-)
I can probably move patch 20 to somewhere earlier in the patch series, so that these changes are there when Tegra114 support is added.
Thierry
Re: [PATCH v2 17/27] drm/tegra: Add Tegra114 HDMI support
In reply to a message not in the archiveQuoted 25 lines · Stephen Warren
drivers/gpu/drm/tegra/hdmi.c static const struct tmds_config tegra3_tmds_config[] = {
Quoted 9 lines · Thierry Reding
From: Mikko Perttunen <[email protected]>
Tegra114 TMDS configuration requires a new
peak_currentfield and the driver current override bit has changed position.drivers/gpu/drm/tegra/hdmi.c +0
-0static const struct tmds_config tegra2_tmds_config[] = {@@ -223,6 +224,85 @@ static const struct tmds_config tegra3_tmds_config[] = {Not related to this patch, but those should have been named tegra20_tmds_config[] and tegra30_tmds_config[].
drivers/gpu/drm/tegra/hdmi.c static void tegra_hdmi_setup_stereo_infoframe(struct tegra_hdmi *hdmi) · line 654
Quoted 5 lines
drivers/gpu/drm/tegra/hdmi.c +1
-2static void tegra_hdmi_setup_tmds (struct tegra_hdmi *hdmi, - value = tmds->drive_current | DRIVE_CURRENT_FUSE_OVERRIDE; -tegra_hdmi_writel (hdmi, value,HDMI_NV_PDISP_SOR_LANE_DRIVE_CURRENT ); + if (of_device_is_compatible(np, "nvidia,tegra114-hdmi")) {Let's not check this at run-time. Instead, host1x_drm_subdevs[]'s .data field should be used to contain either flags or a pointer to a configuration structure, either of which can be directly consulted to determine the properties of the HW in a feature-oriented/semantic way.
Quoted 8 lines
drivers/gpio/gpio-tegra.c's tegra20_gpio_config/tegra30_gpio_config/tegra_gpio_of_match provide a good example of this.
This means that if Tegra124 is identical to Tegra114, yet a hypothetical Tegra999 is different, you don't have to keep adjusting these if conditions throughout the code; they can simply refer to the same feature bit forever.
Okay, I'll see what I can come up with. It's unfortunately not as simple as the GPIO driver's parameterization, and who knows what other differences will be introduced in some later versions of this block.
What I mean is that at some point it becomes questionable whether it makes sense to parameterize at all if you have to encode the register offset and bit position within that register for a large number of bits.
Thierry
Re: [PATCH v2 17/27] drm/tegra: Add Tegra114 HDMI support
Quoted 44 lines · Thierry Reding
Quoted 29 lines · Stephen Warren
Quoted 11 lines · Thierry Reding
From: Mikko Perttunen <[email protected]>
Tegra114 TMDS configuration requires a new
peak_currentfield and the driver current override bit has changed position.drivers/gpu/drm/tegra/hdmi.c +0
-0static const struct
tmds_configtegra2_tmds_config[] = { @@ -223,6 +224,85 @@ static const structtmds_configtegra3_tmds_config[] = {Not related to this patch, but those should have been named tegra20_tmds_config[] and tegra30_tmds_config[].
Quoted 6 lines
static void tegra_hdmi_setup_tmds(struct
tegra_hdmi*hdmi,drivers/gpu/drm/tegra/hdmi.c +0
-1- value = tmds->drive_current | DRIVE_CURRENT_FUSE_OVERRIDE; -tegra_hdmi_writel(hdmi, value,
HDMI_NV_PDISP_SOR_LANE_DRIVE_CURRENT); + if
(of_device_is_compatible(np, "nvidia,tegra114-hdmi")) {Let's not check this at run-time. Instead, host1x_drm_subdevs[]'s .data field should be used to contain either flags or a pointer to a configuration structure, either of which can be directly consulted to determine the properties of the HW in a feature-oriented/semantic way.
Quoted 8 lines
drivers/gpio/gpio-tegra.c's tegra20_gpio_config/tegra30_gpio_config/tegra_gpio_of_match provide a good example of this.
This means that if Tegra124 is identical to Tegra114, yet a hypothetical Tegra999 is different, you don't have to keep adjusting these if conditions throughout the code; they can simply refer to the same feature bit forever.
Okay, I'll see what I can come up with. It's unfortunately not as simple as the GPIO driver's parameterization, and who knows what other differences will be introduced in some later versions of this block.
Quoted 4 lines
What I mean is that at some point it becomes questionable whether it makes sense to parameterize at all if you have to encode the register offset and bit position within that register for a large number of bits.
Well, I wasn't advocating that we shouldn't have an if statement at all. Simply that the if statement shouldn't be doing string compares of specific HW. Either of the following would be fine:
if (hdmi->soc_data->some_feature_flag)
// just represents some code; doesn't have to be a function call do_something();
else;
do_something_else();
or:
do_something(hdmi->soc_data->some_feature_value);
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH v2 17/27] drm/tegra: Add Tegra114 HDMI support
Quoted 60 lines · Stephen Warren
Quoted 44 lines · Thierry Reding
Quoted 29 lines · Stephen Warren
Quoted 11 lines · Thierry Reding
From: Mikko Perttunen <[email protected]>
Tegra114 TMDS configuration requires a new
peak_currentfield and the driver current override bit has changed position.drivers/gpu/drm/tegra/hdmi.c +0
-0static const struct
tmds_configtegra2_tmds_config[] = { @@ -223,6 +224,85 @@ static const structtmds_configtegra3_tmds_config[] = {Not related to this patch, but those should have been named tegra20_tmds_config[] and tegra30_tmds_config[].
Quoted 6 lines
static void tegra_hdmi_setup_tmds(struct
tegra_hdmi*hdmi,drivers/gpu/drm/tegra/hdmi.c +0
-1- value = tmds->drive_current | DRIVE_CURRENT_FUSE_OVERRIDE; -tegra_hdmi_writel(hdmi, value,
HDMI_NV_PDISP_SOR_LANE_DRIVE_CURRENT); + if
(of_device_is_compatible(np, "nvidia,tegra114-hdmi")) {Let's not check this at run-time. Instead, host1x_drm_subdevs[]'s .data field should be used to contain either flags or a pointer to a configuration structure, either of which can be directly consulted to determine the properties of the HW in a feature-oriented/semantic way.
Quoted 8 lines
drivers/gpio/gpio-tegra.c's tegra20_gpio_config/tegra30_gpio_config/tegra_gpio_of_match provide a good example of this.
This means that if Tegra124 is identical to Tegra114, yet a hypothetical Tegra999 is different, you don't have to keep adjusting these if conditions throughout the code; they can simply refer to the same feature bit forever.
Okay, I'll see what I can come up with. It's unfortunately not as simple as the GPIO driver's parameterization, and who knows what other differences will be introduced in some later versions of this block.
Quoted 4 lines
What I mean is that at some point it becomes questionable whether it makes sense to parameterize at all if you have to encode the register offset and bit position within that register for a large number of bits.
Well, I wasn't advocating that we shouldn't have an if statement at all. Simply that the if statement shouldn't be doing string compares of specific HW. Either of the following would be fine:
if (
hdmi->soc_data->some_feature_flag)
// just represents some code; doesn't have to be a function calldo_something();
else;
do_something_else();
Quoted 3 lines
or:
do_something(hdmi->soc_data->some_feature_value);
But the fact that a bit has moved from one register to another can hardly be defined as feature. At least I couldn't come up with any sensible name for one.
We could of course just add a version number into a per-SoC descriptor and use that, but that's not any better than checking for the compatible value, really.
Ideally of course the hardware wouldn't change in these ways from one generation to the next...
That said, I've opted to go with putting the register and bit position into a per-SoC descriptor and parameterize on that, along with a boolean flag for the existence of the IO peak current register.
Thierry
A message that is not in the archive (sent off-list or not yet received): 20131015081318.GG7856-AwZRO8vwLAwmlAP/[email protected]
Re: [PATCH v2 17/27] drm/tegra: Add Tegra114 HDMI support
Quoted 61 lines · Thierry Reding
Quoted 60 lines · Stephen Warren
Quoted 46 lines · Thierry Reding
Quoted 30 lines · Stephen Warren
drivers/gpu/drm/tegra/hdmi.c static const struct tmds_config · line 224
Quoted 12 lines · Thierry Reding
From: Mikko Perttunen <[email protected]>
Tegra114 TMDS configuration requires a new
peak_currentfield and the driver current override bit has changed position.drivers/gpu/drm/tegra/hdmi.c +0
-0static const struct
tmds_configtegra2_tmds_config[] = {drivers/gpu/drm/tegra/hdmi.c +0
-0@@ -223,6 +224,85 @@ static const struct tmds_config tegra3_tmds_config[] = {Not related to this patch, but those should have been named tegra20_tmds_config[] and tegra30_tmds_config[].
Quoted 6 lines
drivers/gpu/drm/tegra/hdmi.c +0
-1static void tegra_hdmi_setup_tmds (struct tegra_hdmi *hdmi, - value = tmds->drive_current | DRIVE_CURRENT_FUSE_OVERRIDE; - tegra_hdmi_writel(hdmi,value,
HDMI_NV_PDISP_SOR_LANE_DRIVE_CURRENT); + if
(of_device_is_compatible(np, "nvidia,tegra114-hdmi")) {Let's not check this at run-time. Instead, host1x_drm_subdevs[]'s .data field should be used to contain either flags or a pointer to a configuration structure, either of which can be directly consulted to determine the properties of the HW in a feature-oriented/semantic way.
Quoted 8 lines
drivers/gpio/gpio-tegra.c's tegra20_gpio_config/tegra30_gpio_config/tegra_gpio_of_match provide a good example of this.
This means that if Tegra124 is identical to Tegra114, yet a hypothetical Tegra999 is different, you don't have to keep adjusting these if conditions throughout the code; they can simply refer to the same feature bit forever.
Okay, I'll see what I can come up with. It's unfortunately not as simple as the GPIO driver's parameterization, and who knows what other differences will be introduced in some later versions of this block.
Quoted 4 lines
What I mean is that at some point it becomes questionable whether it makes sense to parameterize at all if you have to encode the register offset and bit position within that register for a large number of bits.
Well, I wasn't advocating that we shouldn't have an if statement at all. Simply that the if statement shouldn't be doing string compares of specific HW. Either of the following would be fine:
if (
hdmi->soc_data->some_feature_flag) // just represents some code; doesn't have to be a function calldo_something(); else;do_something_else();
Quoted 7 lines
Quoted 3 lines
or:
do_something(hdmi->soc_data->some_feature_value);But the fact that a bit has moved from one register to another can hardly be defined as feature. At least I couldn't come up with any sensible name for one.
The feature is the name/identification of the register the field is in. For example, foo_field_in_bar_reg. Admittedly this isn't "feature" in the typical sense, but more a "facet of the SW-visible interface".
Quoted 3 lines
We could of course just add a version number into a per-SoC descriptor and use that, but that's not any better than checking for the compatible value, really.
Even that would be better; it'd avoid a strcmp() every time the code ran, and also allow the of_match table's data to map from compatible value to register layout ID. It's quite possible that we have 4 SoCs:
SoC / Register location of field X / Other features, etc.
100 A P 200 B Q 300 B Q 400 B R
Where P, Q, R need different compatible values, but the location of the register field we're talking about isn't 1:1 with the compatible values, but rather many:1.
Quoted 7 lines
Ideally of course the hardware wouldn't change in these ways from one generation to the next...
That said, I've opted to go with putting the register and bit position into a per-SoC descriptor and parameterize on that, along with a boolean flag for the existence of the IO peak current register.
Sounds good.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v2 18/27 drm/tegra: hdmi: Detect DVI-only displays
In reply to a message not in the archiveFrom: Mikko Perttunen <[email protected]>
Use EDID data to determine whether the display supports HDMI or DVI only. The HDMI output used to assume to be connected to HDMI displays, but that broke support for DVI displays that don't understand the interspersed audio/other data.
To be on the safe side, default to DVI if no EDID data is available.
--- drivers/gpu/drm/tegra/hdmi.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/gpu/drm/tegra/hdmi.c +14 -0
@@ -666,6 +666,18 @@ static void tegra_hdmi_setup_tmds(struct tegra_hdmi *hdmi, } } +static bool tegra_output_is_hdmi (struct tegra_output *output) +{ +struct edid *edid; + +if (!output->connector.edid_blob_ptr) +return false; + + edid = (struct edid *)output->connector.edid_blob_ptr->data; + +return drm_detect_hdmi_monitor (edid); +} +static int tegra_output_hdmi_enable (struct tegra_output *output) {unsigned int h_sync_width, h_front_porch, h_back_porch, i, rekey;
@@ -680,6 +692,8 @@ static int tegra_output_hdmi_enable(struct tegra_output *output)int retries =1000 ;int err; + hdmi->dvi = !tegra_output_is_hdmi (output); + pclk = mode->clock *1000 ; h_sync_width = mode->hsync_end - mode->hsync_start; h_back_porch = mode->htotal - mode->hsync_end;
Signature · 6 lines
1.8.4 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v2 19/27 host1x: hdmi: Enable VDD earlier for hotplug/DDC
In reply to a message not in the archiveFrom: Mikko Perttunen <[email protected]>
The VDD regulator used to be enabled only at tegra_output_hdmi_enable, which is called after a sink is detected. However, the HDMI hotplug pin works by returning the voltage supplied by the VDD pin, so this meant that the hotplug pin was never asserted and the sink was not detected unless the VDD regulator was set to be always on.
This patch moves the enable to the tegra_hdmi_init() function to make sure the regulator will get enabled and therefore ensure proper hotplug detection.
--- drivers/gpu/drm/tegra/hdmi.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
drivers/gpu/drm/tegra/hdmi.c +9 -7
@@ -699,12 +699,6 @@ static int tegra_output_hdmi_enable(struct tegra_output *output) h_back_porch = mode->htotal - mode->hsync_end; h_front_porch = mode->hsync_start - mode->hdisplay; - err =regulator_enable (hdmi->vdd); -if (err <0 ) { -dev_err (hdmi->dev,"failed to enable VDD regulator: %d\n" , err); -return err; - } - err =regulator_enable (hdmi->pll);if (err <0 ) {dev_err (hdmi->dev,"failed to enable PLL regulator: %d\n" , err);
@@ -926,7 +920,6 @@ static int tegra_output_hdmi_disable(struct tegra_output *output)tegra_periph_reset_assert (hdmi->clk);clk_disable (hdmi->clk);regulator_disable (hdmi->pll); -regulator_disable (hdmi->vdd);return 0 ; }
@@ -1231,6 +1224,13 @@ static int tegra_hdmi_init(struct host1x_client *client)struct tegra_hdmi *hdmi =host1x_client_to_hdmi (client);int err; + err =regulator_enable (hdmi->vdd); +if (err <0 ) { +dev_err (client->dev,"failed to enable VDD regulator: %d\n" , + err); +return err; + } + hdmi->output.type =TEGRA_OUTPUT_HDMI ; hdmi->output.dev = client->dev; hdmi->output.ops = &hdmi_ops;
@@ -1274,6 +1274,8 @@ static int tegra_hdmi_exit(struct host1x_client *client)return err; } +regulator_disable (hdmi->vdd); +return 0 ; }
Signature · 1 line
1.8.4
PATCH v2 20/27 drm/tegra: hdmi: Rename tegra{2,3} to tegra{20,30}
In reply to a message not in the archiveEverything related to Tegra uses Tegra20 and Tegra30 instead of Tegra2 and Tegra3, respectively. Rename the TMDS arrays in the HDMI driver for consistency.
--- drivers/gpu/drm/tegra/hdmi.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/tegra/hdmi.c +6 -6
@@ -145,7 +145,7 @@ struct tmds_config {u32 peak_current; }; -static const struct tmds_config tegra2_tmds_config[] = { +static const struct tmds_config tegra20_tmds_config[] = { {/* slow pixel clock modes */ .pclk =27000000 , .pll0 = SOR_PLL_BG_V17_S(3) | SOR_PLL_ICHPMP(1) |
@@ -178,7 +178,7 @@ static const struct tmds_config tegra2_tmds_config[] = { }, }; -static const struct tmds_config tegra3_tmds_config[] = { +static const struct tmds_config tegra30_tmds_config[] = { {/* 480p modes */ .pclk =27000000 , .pll0 = SOR_PLL_BG_V17_S(3) | SOR_PLL_ICHPMP(1) |
@@ -807,11 +807,11 @@ static int tegra_output_hdmi_enable(struct tegra_output *output) num_tmds =ARRAY_SIZE (tegra114_tmds_config); tmds = tegra114_tmds_config; }else if (of_device_is_compatible (node,"nvidia,tegra30-hdmi" )) { - num_tmds =ARRAY_SIZE (tegra3_tmds_config); - tmds = tegra3_tmds_config; + num_tmds =ARRAY_SIZE (tegra30_tmds_config); + tmds = tegra30_tmds_config; }else { - num_tmds =ARRAY_SIZE (tegra2_tmds_config); - tmds = tegra2_tmds_config; + num_tmds =ARRAY_SIZE (tegra20_tmds_config); + tmds = tegra20_tmds_config; }for (i =0 ; i < num_tmds; i++) {
Signature · 1 line
1.8.4
PATCH v2 21/27 drm: Add panel support
In reply to a message not in the archiveAdd 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 v2:
- split .dpms() into separate .disable() and .enable()
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 | 78 +++++++++++++++++++++++++++++++++++ 5 files changed, 181 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
@@ -238,3 +238,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-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 +78 -0
78 lines not on this page · raw message
Signature · 1 line
1.8.4
PATCH v2 22/27 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.
---
Changes in v2:
- update vendor prefixes (cptt -> chunghwa, pc -> panasonic)
- split up panel binding documents per-panel
- make regulator mandatory
- add flag to keep track of enabled status
.../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 | 13 + drivers/gpu/drm/panel/Makefile | 1 + drivers/gpu/drm/panel/panel-simple.c | 339 +++++++++++++++++++++ 8 files changed, 396 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
@@ -58,3 +58,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 +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 +339 -0
339 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): 1381134884-5816-23-git-send-email-treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org
Re: [PATCH v2 22/27] drm/panel: Add simple panel support
Quoted 6 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.
Quoted 8 lines
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/auo,b101aw03.txt | 7 + .../bindings/panel/chunghwa,claa101wb03.txt | 7 + .../bindings/panel/panasonic,vvx10f004b00.txt | 7 + .../devicetree/bindings/panel/simple-panel.txt | 21 ++
Since this patch defines new DT bindings, it should also be sent to the DT binding maintainers and DT mailing list.
Quoted 6 lines
drivers/gpu/drm/panel/panel-simple.c +4
-0+static int panel_simple_remove (struct platform_device *pdev) +{ +struct panel_simple *panel =platform_get_drvdata (pdev); +
drivers/gpu/drm/panel/panel-simple.c line 315
Quoted 10 lines
drivers/gpu/drm/panel/panel-simple.c +10
-0+if (gpio_is_valid (panel->enable_gpio)) { +if (panel->enable_gpio_flags &GPIO_ACTIVE_LOW ) +gpio_set_value (panel->enable_gpio,1 ); +else +gpio_set_value (panel->enable_gpio,0 ); + +gpio_free (panel->enable_gpio); + } + +regulator_disable (panel->supply);
Can you just call panel_simple_disable() to do the HW cleanup, and just do resource cleanup here?
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH v2 22/27] drm/panel: Add simple panel support
Quoted 11 lines · Stephen Warren
Quoted 9 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.
Quoted 7 lines
Quoted 4 lines
.../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 ++Since this patch defines new DT bindings, it should also be sent to the DT binding maintainers and DT mailing list.
I Cc'ed at least the DT mailing list. The get_maintainer.pl generated list was pretty large, and I keep getting different feedback about whether it's a good idea to Cc individual people or just the relevant mailing lists. In this case I assumed that all DT binding maintainers would be reading the DT mailing list and therefore see the patches. I can change my habit though if you prefer to get an extra copy.
One slight inconvenience with large series like this is that a lot of work is required to handcraft an appropriate list of people and lists to send the patches to. Furthermore I personally like receiving whole patch series because it gives me full context, but other people seem to want only the patches that they need to worry about. So what I usually do is handcraft a list of people I want to send patches to and use it for the whole series. If that list grows too large, I'll usually trim it down to include only lists. Having to handcraft lists for each individual patch doesn't sound that useful to me.
Quoted 11 lines
Quoted 11 lines
drivers/gpu/drm/panel/panel-simple.c +9
-0+static int panel_simple_remove (struct platform_device *pdev) +{ +struct panel_simple *panel =platform_get_drvdata (pdev); + +if (gpio_is_valid (panel->enable_gpio)) { +if (panel->enable_gpio_flags &GPIO_ACTIVE_LOW ) +gpio_set_value (panel->enable_gpio,1 ); +else +gpio_set_value (panel->enable_gpio,0 );
Quoted 8 lines
drivers/gpu/drm/panel/panel-simple.c line 315
Quoted 5 lines
drivers/gpu/drm/panel/panel-simple.c +5
-0+ +gpio_free (panel->enable_gpio); + } + +regulator_disable (panel->supply);Can you just call
panel_simple_disable()to do the HW cleanup, and just do resource cleanup here?
Yes, I can.
Thanks,
Thierry
PATCH v2 23/27 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/drm/tegra/Kconfig | 1 + drivers/gpu/drm/tegra/drm.h | 1 + drivers/gpu/drm/tegra/output.c | 32 ++++++++++++++++++++++++++++++-- 3 files changed, 32 insertions(+), 2 deletions(-)
drivers/gpu/drm/tegra/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/drm/tegra/drm.h +1 -0
@@ -176,6 +176,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/drm/tegra/output.c +30 -2
@@ -9,6 +9,7 @@#include <linux/of_gpio.h> +#include <drm/drm_panel.h> #include "drm.h" static int tegra_connector_get_modes (struct drm_connector *connector)
@@ -17,6 +18,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)
@@ -72,6 +76,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; }
@@ -103,6 +110,15 @@ 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) { +if (mode !=DRM_MODE_DPMS_ON ) +drm_panel_disable (panel); +else +drm_panel_enable (panel); + } } static bool tegra_encoder_mode_fixup(struct drm_encoder *encoder,
@@ -151,14 +167,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 );
@@ -173,7 +198,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,
@@ -240,6 +265,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
PATCH v2 24/27 drm/tegra: Start connectors with correct DPMS mode
In reply to a message not in the archiveA connector's DPMS mode isn't initialized by default, therefore using a default of 0 (DRM_MODE_DPMS_ON). This can cause problems in that the DRM core won't explicitly turn on a connector because it thinks that it is already on.
---
Note that it would probably make sense to do this in the core, but after some discussion on IRC it became clear that other drivers (specifically i915) use similar workarounds and moving this to the core may cause them to regress.
drivers/gpu/drm/tegra/output.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/tegra/output.c +1 -0
@@ -264,6 +264,7 @@ int tegra_output_init(struct drm_device *drm, struct tegra_output *output)drm_connector_init (drm, &output->connector, &connector_funcs, connector);drm_connector_helper_add (&output->connector, &connector_helper_funcs); + output->connector.dpms =DRM_MODE_DPMS_OFF ;if (output->panel)drm_panel_attach (output->panel, &output->connector);
Signature · 1 line
1.8.4
PATCH v2 25/27 gpu: host1x: Add MIPI pad calibration support
In reply to a message not in the archiveThis driver adds support to perform calibration of the MIPI pads for CSI and DSI.
---
Changes in v2:
- rename fields to mirror the names in the TRM
- remove unused fields
drivers/gpu/host1x/Makefile | 1 + drivers/gpu/host1x/dev.c | 17 +++- drivers/gpu/host1x/dev.h | 2 + drivers/gpu/host1x/mipi.c | 230 ++++++++++++++++++++++++++++++++++++++++++++ include/linux/host1x.h | 2 + 5 files changed, 248 insertions(+), 4 deletions(-) create mode 100644 drivers/gpu/host1x/mipi.c
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
@@ -208,17 +208,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
@@ -304,4 +304,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 +230 -0
230 lines not on this page · raw message
include/linux/host1x.h +2 -0
@@ -273,4 +273,6 @@ int host1x_register_client(struct host1x *host1x, struct host1x_client *client);int host1x_unregister_client (struct host1x *host1x,struct host1x_client *client); +int tegra_mipi_calibrate (struct device *device); +#endif
Signature · 6 lines
1.8.4 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1381134884-5816-26-git-send-email-treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org
Re: [PATCH v2 25/27] gpu: host1x: Add MIPI pad calibration support
Quoted 6 lines · Thierry Reding
This driver adds support to perform calibration of the MIPI pads for CSI and DSI.
drivers/gpu/host1x/mipi.c +1
-0+int tegra_mipi_calibrate (struct device *device)
...
Quoted 2 lines
drivers/gpu/host1x/mipi.c +2
-0+ err =of_parse_phandle_with_args (device->of_node,"calibrate" , +"#calibrate-cells" ,0 , &args);
...
drivers/gpu/host1x/mipi.c line 219
Quoted 2 lines
drivers/gpu/host1x/mipi.c +2
-0+static struct of_device_id tegra_mipi_of_match[] = { + { .compatible ="nvidia,tegra114-mipi" , },
Is the DT binding for that compatible value documented anywhere? I'm not sure what #calibrate-cells means; it doesn't seem to be used...
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH v2 25/27] gpu: host1x: Add MIPI pad calibration support
Quoted 8 lines · Stephen Warren
Quoted 6 lines · Thierry Reding
This driver adds support to perform calibration of the MIPI pads for CSI and DSI.
drivers/gpu/host1x/mipi.c +1
-0+int tegra_mipi_calibrate (struct device *device)...
Quoted 8 lines
Quoted 2 lines
drivers/gpu/host1x/mipi.c +2
-0+ err =of_parse_phandle_with_args (device->of_node,"calibrate" , +"#calibrate-cells" ,0 , &args);...
drivers/gpu/host1x/mipi.c line 219
Quoted 2 lines
drivers/gpu/host1x/mipi.c +2
-0+static struct of_device_id tegra_mipi_of_match[] = { + { .compatible ="nvidia,tegra114-mipi" , },Is the DT binding for that compatible value documented anywhere? I'm not sure what #calibrate-cells means; it doesn't seem to be used...
I forgot to add a binding document, but I've complemented my local patch series with one. The #calibrate-cells defines the number of cells used for the specifier and should be 1. I suspect that we'll never get to have more than 32 pads that can be calibrated, but perhaps at some point data other than a bitmask of the pads will be needed.
Thierry
PATCH v2 26/27 drm/tegra: Add DSI support
In reply to a message not in the archiveThis 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.
--- drivers/gpu/drm/tegra/Makefile | 1 + drivers/gpu/drm/tegra/dc.h | 1 + drivers/gpu/drm/tegra/drm.c | 10 +- drivers/gpu/drm/tegra/drm.h | 2 + drivers/gpu/drm/tegra/dsi.c | 1026 ++++++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/tegra/output.c | 5 + 6 files changed, 1044 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/tegra/dsi.c
drivers/gpu/drm/tegra/Makefile +1 -0
@@ -10,6 +10,7 @@ tegra-drm-y := \ output.o \ rgb.o \ hdmi.o \ + dsi.o \ gr2d.o obj-$(CONFIG_DRM_TEGRA) += tegra-drm.o
drivers/gpu/drm/tegra/dc.h +1 -0
@@ -116,6 +116,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
@@ -490,6 +490,7 @@ static const struct of_device_id host1x_drm_subdevs[] = { { .compatible = "nvidia,tegra30-hdmi", }, { .compatible = "nvidia,tegra30-gr2d", }, { .compatible = "nvidia,tegra114-dc", }, + { .compatible = "nvidia,tegra114-dsi", }, { .compatible = "nvidia,tegra114-hdmi", }, { /* sentinel */ } };
@@ -513,10 +514,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;
@@ -525,6 +530,8 @@ static int __init host1x_drm_init(void) 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:
@@ -537,6 +544,7 @@ static void __exit host1x_drm_exit(void) {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
@@ -167,6 +167,7 @@ struct tegra_output_ops {enum tegra_output_type {TEGRA_OUTPUT_RGB ,TEGRA_OUTPUT_HDMI , +TEGRA_OUTPUT_DSI , };struct tegra_output {
@@ -253,6 +254,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;
drivers/gpu/drm/tegra/dsi.c new file +1026 -0
1,026 lines not on this page · raw message
drivers/gpu/drm/tegra/output.c +5 -0
@@ -255,6 +255,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
A message that is not in the archive (sent off-list or not yet received): 1381134884-5816-27-git-send-email-treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org
Re: [PATCH v2 26/27] drm/tegra: Add DSI support
Quoted 9 lines · Thierry Reding
This 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.
drivers/gpu/drm/tegra/dsi.c +0
-0
drivers/gpu/drm/tegra/dsi.c line 343
Quoted 10 lines
drivers/gpu/drm/tegra/dsi.c +10
-0+static int tegra_dsi_show_regs (struct seq_file *s,void *data) +{ +struct drm_info_node *node = s->private; +struct tegra_dsi *dsi = node->info_ent->data; + +#define DUMP_REG (name) \ + seq_printf(s, "%-32s %#05x %08lx\n", #name, name, \ + tegra_dsi_readl(dsi, name)) + +DUMP_REG (DSI_INCR_SYNCPT );
Does it make sense to use an MMIO regmap instead? That way, you get all the debugfs files for free...
Quoted 5 lines
drivers/gpu/drm/tegra/dsi.c +4
-0+static int tegra_dsi_probe (struct platform_device *pdev) + dsi->clk_parent = devm_clk_get(&pdev->dev, "parent"); +if (IS_ERR (dsi->clk_parent)) +return PTR_ERR (dsi->clk_parent);
...
drivers/gpu/drm/tegra/dsi.c line 1015
Quoted 2 lines
drivers/gpu/drm/tegra/dsi.c +2
-0+static const struct of_device_id tegra_dsi_of_match[] = { + { .compatible ="nvidia,tegra114-dsi" , },
Is this DT binding documented? The clk_get() call above in particular imposes the requirement that DT contain a clock with that name, which should be part of the binding documentation.
Hopefully the values that this driver hard-codes won't be an issue for the DT binding; we can simply make those values the default if properties are missing. I assume it's likely that such a strategy will work here?
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH v2 26/27] drm/tegra: Add DSI support
Quoted 10 lines · Stephen Warren
Quoted 8 lines · Thierry Reding
This 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.
drivers/gpu/drm/tegra/dsi.c +0
-0
Quoted 13 lines
drivers/gpu/drm/tegra/dsi.c line 343
Quoted 10 lines
drivers/gpu/drm/tegra/dsi.c +10
-0+static int tegra_dsi_show_regs (struct seq_file *s,void *data) +{ +struct drm_info_node *node = s->private; +struct tegra_dsi *dsi = node->info_ent->data; + +#define DUMP_REG (name) \ + seq_printf(s, "%-32s %#05x %08lx\n", #name, name, \ + tegra_dsi_readl(dsi, name)) + +DUMP_REG (DSI_INCR_SYNCPT );Does it make sense to use an MMIO regmap instead? That way, you get all the debugfs files for free...
As far as I know, regmap doesn't give you the symbolic names for the registers. I find that a rather useful feature because it allows to easily compare the registers to the ones in our downstream kernels.
Quoted 6 lines
Quoted 5 lines
drivers/gpu/drm/tegra/dsi.c +4
-0+static int tegra_dsi_probe (struct platform_device *pdev) + dsi->clk_parent = devm_clk_get(&pdev->dev, "parent"); +if (IS_ERR (dsi->clk_parent)) +return PTR_ERR (dsi->clk_parent);...
Quoted 6 lines
drivers/gpu/drm/tegra/dsi.c line 1015
Quoted 2 lines
drivers/gpu/drm/tegra/dsi.c +2
-0+static const struct of_device_id tegra_dsi_of_match[] = { + { .compatible ="nvidia,tegra114-dsi" , },Is this DT binding documented? The
clk_get()call above in particular imposes the requirement that DT contain a clock with that name, which should be part of the binding documentation.
I've documented the requirement for both the regular "dsi" as well as the "parent" clock in the binding documentation, which I forgot to update in the previous series.
Documentation/devicetree/bindings/gpu/nvidia,tegra20-host1x.txt is where this is documented. The DSI node has a compatible property of nvidia,tegra<chip>-dsi, which I think is a common way to write the binding at least for Tegra.
Quoted 4 lines
Hopefully the values that this driver hard-codes won't be an issue for the DT binding; we can simply make those values the default if properties are missing. I assume it's likely that such a strategy will work here?
They shouldn't. In fact I think it should be possible to probe them either using mechanisms built into DSI, or by querying the attached panel (as matched by the corresponding device tree node).
I haven't done the latter yet because I plan to investigate whether builtin DSI functionality can be used to probe for the information.
Thierry
A message that is not in the archive (sent off-list or not yet received): 20131014135548.GB16302-AwZRO8vwLAwmlAP/[email protected]
Re: [PATCH v2 26/27] drm/tegra: Add DSI support
Quoted 25 lines · Thierry Reding
Quoted 10 lines · Stephen Warren
Quoted 8 lines · Thierry Reding
This 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.
drivers/gpu/drm/tegra/dsi.c +0
-0Quoted 13 lines
drivers/gpu/drm/tegra/dsi.c line 343
Quoted 10 lines
drivers/gpu/drm/tegra/dsi.c +10
-0+static int tegra_dsi_show_regs (struct seq_file *s,void *data) +{ +struct drm_info_node *node = s->private; +struct tegra_dsi *dsi = node->info_ent->data; + +#define DUMP_REG (name) \ + seq_printf(s, "%-32s %#05x %08lx\n", #name, name, \ + tegra_dsi_readl(dsi, name)) + +DUMP_REG (DSI_INCR_SYNCPT );Does it make sense to use an MMIO regmap instead? That way, you get all the debugfs files for free...
Quoted 3 lines
As far as I know, regmap doesn't give you the symbolic names for the registers. I find that a rather useful feature because it allows to easily compare the registers to the ones in our downstream kernels.
True. However, we should really be writing user-space scripts to encode that information. Such a script could be useful e.g. if reading the information directly from /dev/mem or JTAG too, and bloating the kernel with debug strings doesn't seem like a great idea.
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH v2 26/27] drm/tegra: Add DSI support
Quoted 26 lines · Stephen Warren
Quoted 25 lines · Thierry Reding
Quoted 23 lines · Stephen Warren
Quoted 9 lines · Thierry Reding
This 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.
drivers/gpu/drm/tegra/dsi.c +0
-0drivers/gpu/drm/tegra/dsi.c
Quoted 10 lines
drivers/gpu/drm/tegra/dsi.c +10
-0+static int tegra_dsi_show_regs (struct seq_file *s,void *data) +{ +struct drm_info_node *node = s->private; +struct tegra_dsi *dsi = node->info_ent->data; + +#define DUMP_REG (name) \ + seq_printf(s, "%-32s %#05x %08lx\n", #name, name, \ + tegra_dsi_readl(dsi, name)) + +DUMP_REG (DSI_INCR_SYNCPT );Does it make sense to use an MMIO regmap instead? That way, you get all the debugfs files for free...
Quoted 8 lines
Quoted 3 lines
As far as I know, regmap doesn't give you the symbolic names for the registers. I find that a rather useful feature because it allows to easily compare the registers to the ones in our downstream kernels.
True. However, we should really be writing user-space scripts to encode that information. Such a script could be useful e.g. if reading the information directly from
/dev/memor JTAG too, and bloating the kernel with debug strings doesn't seem like a great idea.
I don't agree. While I see some value in having such userspace scripts, having the symbolic names in debugfs allows anyone to look at a readable form of the data without having to have access to those scripts. Besides it's called *debug*fs for a purpose, isn't it? There's plenty of edited data that's not just a plain dump of data.
Thierry
A message that is not in the archive (sent off-list or not yet received): 20131015083342.GH7856-AwZRO8vwLAwmlAP/[email protected]
Re: [PATCH v2 26/27] drm/tegra: Add DSI support
Quoted 36 lines · Thierry Reding
Quoted 29 lines · Stephen Warren
Quoted 20 lines · Thierry Reding
Quoted 18 lines · Stephen Warren
Quoted 16 lines · Thierry Reding
This 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.
drivers/gpu/drm/tegra/dsi.c +1
-0+static int tegra_dsi_show_regs(struct seq_file *s, void*data) +{ + struct
drm_info_node*node =s->private; +
structtegra_dsi*dsi =node->info_ent->data; + +#defineDUMP_REG(name)\ + seq_printf(s, "%-32s %#05x
%08lx\n", #name, name, \ +tegra_dsi_readl(dsi, name))
+ +DUMP_REG(DSI_INCR_SYNCPT);Quoted 7 lines
Quoted 2 lines
Does it make sense to use an MMIO regmap instead? That way, you get all the debugfs files for free...
As far as I know, regmap doesn't give you the symbolic names for the registers. I find that a rather useful feature because it allows to easily compare the registers to the ones in our downstream kernels.
Quoted 5 lines
True. However, we should really be writing user-space scripts to encode that information. Such a script could be useful e.g. if reading the information directly from
/dev/memor JTAG too, and bloating the kernel with debug strings doesn't seem like a great idea.
Quoted 6 lines
I don't agree. While I see some value in having such userspace scripts, having the symbolic names in debugfs allows anyone to look at a readable form of the data without having to have access to those scripts. Besides it's called *debug*fs for a purpose, isn't it? There's plenty of edited data that's not just a plain dump of data.
Perhaps you should work to enhance regmap's debugfs files to support optionally naming registers?
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH v2 26/27] drm/tegra: Add DSI support
Quoted 44 lines · Stephen Warren
Quoted 36 lines · Thierry Reding
Quoted 29 lines · Stephen Warren
Quoted 20 lines · Thierry Reding
Quoted 18 lines · Stephen Warren
Quoted 16 lines · Thierry Reding
This 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.
drivers/gpu/drm/tegra/dsi.c +1
-0+static int tegra_dsi_show_regs(struct seq_file *s, void*data) +{ + struct
drm_info_node*node =s->private; +
structtegra_dsi*dsi =node->info_ent->data; + +#defineDUMP_REG(name)\ + seq_printf(s, "%-32s %#05x
%08lx\n", #name, name, \ +tegra_dsi_readl(dsi, name))
+ +DUMP_REG(DSI_INCR_SYNCPT);Quoted 7 lines
Quoted 2 lines
Does it make sense to use an MMIO regmap instead? That way, you get all the debugfs files for free...
As far as I know, regmap doesn't give you the symbolic names for the registers. I find that a rather useful feature because it allows to easily compare the registers to the ones in our downstream kernels.
Quoted 5 lines
True. However, we should really be writing user-space scripts to encode that information. Such a script could be useful e.g. if reading the information directly from
/dev/memor JTAG too, and bloating the kernel with debug strings doesn't seem like a great idea.Quoted 6 lines
I don't agree. While I see some value in having such userspace scripts, having the symbolic names in debugfs allows anyone to look at a readable form of the data without having to have access to those scripts. Besides it's called *debug*fs for a purpose, isn't it? There's plenty of edited data that's not just a plain dump of data.
Quoted 2 lines
Perhaps you should work to enhance regmap's debugfs files to support optionally naming registers?
Just to follow up with what we've discussed on IRC: I'll take a stab at refactoring the debugfs file output into something more generic that can possibly be leveraged by regmap as well. That should provide a somewhat more lightweight alternative to regmap for implementations that don't need regmap for anything else while at the same time providing something so not every driver has to come up with something custom.
Does that sum it up correctly?
Thierry
A message that is not in the archive (sent off-list or not yet received): 20131016084031.GB21963-AwZRO8vwLAwmlAP/[email protected]
Re: [PATCH v2 26/27] drm/tegra: Add DSI support
On 10/16/2013 02:40 AM, Thierry Reding wrote:
...
Quoted 9 lines
Just to follow up with what we've discussed on IRC: I'll take a stab at refactoring the debugfs file output into something more generic that can possibly be leveraged by regmap as well. That should provide a somewhat more lightweight alternative to regmap for implementations that don't need regmap for anything else while at the same time providing something so not every driver has to come up with something custom.
Does that sum it up correctly?
Yes.
PATCH v2 27/27 drm/tegra: Add Tegra114 gr2d support
In reply to a message not in the archiveThe gr2d hardware in Tegra114 is compatible with that of Tegra20 and Tegra30. No functionaly changes are required.
--- drivers/gpu/drm/tegra/drm.c | 1 + drivers/gpu/drm/tegra/gr2d.c | 1 + 2 files changed, 2 insertions(+)
drivers/gpu/drm/tegra/drm.c +1 -0
@@ -492,6 +492,7 @@ static const struct of_device_id host1x_drm_subdevs[] = { { .compatible = "nvidia,tegra114-dc", }, { .compatible = "nvidia,tegra114-dsi", }, { .compatible = "nvidia,tegra114-hdmi", }, + { .compatible = "nvidia,tegra114-gr2d", }, { /* sentinel */ } };
drivers/gpu/drm/tegra/gr2d.c +1 -0
@@ -232,6 +232,7 @@ static const struct tegra_drm_client_ops gr2d_ops = { };static const struct of_device_id gr2d_match[] = { + { .compatible ="nvidia,tegra114-gr2d" }, { .compatible ="nvidia,tegra30-gr2d" }, { .compatible ="nvidia,tegra20-gr2d" }, { },
Signature · 1 line
1.8.4
A message that is not in the archive (sent off-list or not yet received): 1381134884-5816-28-git-send-email-treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org
Re: [PATCH v2 27/27] drm/tegra: Add Tegra114 gr2d support
Quoted 2 lines · Thierry Reding
The gr2d hardware in Tegra114 is compatible with that of Tegra20 and Tegra30. No functionaly changes are required.
Similarly here, if the HW is 100% backwards-compatible, there's no need to add compatible values to the driver.
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH v2 27/27] drm/tegra: Add Tegra114 gr2d support
Quoted 5 lines · Stephen Warren
Quoted 2 lines · Thierry Reding
The gr2d hardware in Tegra114 is compatible with that of Tegra20 and Tegra30. No functionaly changes are required.
Similarly here, if the HW is 100% backwards-compatible, there's no need to add compatible values to the driver.
We've used this mechanism for attaching a per-hw-version data structure in match table to accomodate differences in how the hardware is power gated, reset, booted, some per-soc performance related changes etc. It's also used in staging features for new chips, such as disabling power features when they're not working/verified yet.
Upstream driver is not yet in a state where that is relevant.
With this, would we still be able to do that with match table? It sounds like we could, because we can still (even with multiple compatible properties) add separate entries in match table and I guess the compatible properties matched in order.
Terje
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH v2 27/27] drm/tegra: Add Tegra114 gr2d support
Quoted 13 lines · Terje Bergström
Quoted 5 lines · Stephen Warren
Quoted 2 lines · Thierry Reding
The gr2d hardware in Tegra114 is compatible with that of Tegra20 and Tegra30. No functionaly changes are required.
Similarly here, if the HW is 100% backwards-compatible, there's no need to add compatible values to the driver.
We've used this mechanism for attaching a per-hw-version data structure in match table to accomodate differences in how the hardware is power gated, reset, booted, some per-soc performance related changes etc. It's also used in staging features for new chips, such as disabling power features when they're not working/verified yet.
Quoted 6 lines
Upstream driver is not yet in a state where that is relevant.
With this, would we still be able to do that with match table? It sounds like we could, because we can still (even with multiple compatible properties) add separate entries in match table and I guess the compatible properties matched in order.
Yes, as long as the device tree files includes the most specific value in the compatible this should still be possible. So we'd have this:
gr2d@54140000 {
compatible = "nvida,tegra114-gr2d", "nvidia,tegra20-gr2d";
...
};and the driver will match on "nvidia,tegra20-gr2d" if the more specific "nvidia,tegra114-gr2d" is not there. When the driver is updated to support Tegra114 specific functionality, then a more specific entry can be added to the compatible table to handle it.
Thierry
A message that is not in the archive (sent off-list or not yet received): 20131014140010.GC16302-AwZRO8vwLAwmlAP/[email protected]
Re: [PATCH v2 27/27] drm/tegra: Add Tegra114 gr2d support
Quoted 26 lines · Thierry Reding
Quoted 14 lines · Terje Bergström
Quoted 5 lines · Stephen Warren
Quoted 2 lines · Thierry Reding
The gr2d hardware in Tegra114 is compatible with that of Tegra20 and Tegra30. No functionaly changes are required.
Similarly here, if the HW is 100% backwards-compatible, there's no need to add compatible values to the driver.
We've used this mechanism for attaching a per-hw-version data structure in match table to accomodate differences in how the hardware is power gated, reset, booted, some per-soc performance related changes etc. It's also used in staging features for new chips, such as disabling power features when they're not working/verified yet.
Quoted 6 lines
Upstream driver is not yet in a state where that is relevant.
With this, would we still be able to do that with match table? It sounds like we could, because we can still (even with multiple compatible properties) add separate entries in match table and I guess the compatible properties matched in order.
Yes, as long as the device tree files includes the most specific value in the compatible this should still be possible. So we'd have this:
Quoted 7 lines
gr2d@54140000 { compatible = "nvida,tegra114-gr2d", "nvidia,tegra20-gr2d"; ... };
and the driver will match on "nvidia,tegra20-gr2d" if the more specific "nvidia,tegra114-gr2d" is not there. When the driver is updated to support Tegra114 specific functionality, then a more specific entry can be added to the compatible table to handle it.
True, but the DT fragment above is also only accurate /if/ a driver that only knows about "nvidia,tegra20-gr2d" can operate 100% of the features in Tegra20 HW on Tegra114 HW forever.
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH v2 27/27] drm/tegra: Add Tegra114 gr2d support
Quoted 8 lines · Stephen Warren
Quoted 7 lines · Thierry Reding
Yes, as long as the device tree files includes the most specific value in the compatible this should still be possible. So we'd have this:
gr2d@54140000 { compatible = "nvida,tegra114-gr2d", "nvidia,tegra20-gr2d"; ... };
Quoted 8 lines
Quoted 4 lines
and the driver will match on "nvidia,tegra20-gr2d" if the more specific "nvidia,tegra114-gr2d" is not there. When the driver is updated to support Tegra114 specific functionality, then a more specific entry can be added to the compatible table to handle it.
True, but the DT fragment above is also only accurate /if/ a driver that only knows about "nvidia,tegra20-gr2d" can operate 100% of the features in Tegra20 HW on Tegra114 HW forever.
I don't know of any hardware incompatibility. The only difference is related to something not directly to 2D. We moved host1x away from the power domain, so in Tegra114 we're able to power gate 2D and EPP. The DVFS tables are also different.
I'd say say adding the compatible property "nvidia,tegra20-gr2d" for Tegra114's 2D is accurate and we're able to use the match table to drive any SW policy differences.
Terje
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH v2 27/27] drm/tegra: Add Tegra114 gr2d support
Quoted 18 lines · Terje Bergström
Quoted 8 lines · Stephen Warren
Quoted 7 lines · Thierry Reding
Yes, as long as the device tree files includes the most specific value in the compatible this should still be possible. So we'd have this:
gr2d@54140000 { compatible = "nvida,tegra114-gr2d", "nvidia,tegra20-gr2d"; ... };
Quoted 8 lines
Quoted 4 lines
and the driver will match on "nvidia,tegra20-gr2d" if the more specific "nvidia,tegra114-gr2d" is not there. When the driver is updated to support Tegra114 specific functionality, then a more specific entry can be added to the compatible table to handle it.
True, but the DT fragment above is also only accurate /if/ a driver that only knows about "nvidia,tegra20-gr2d" can operate 100% of the features in Tegra20 HW on Tegra114 HW forever.
Quoted 8 lines
I don't know of any hardware incompatibility. The only difference is related to something not directly to 2D. We moved host1x away from the power domain, so in Tegra114 we're able to power gate 2D and EPP. The DVFS tables are also different.
I'd say say adding the compatible property "nvidia,tegra20-gr2d" for Tegra114's 2D is accurate and we're able to use the match table to drive any SW policy differences.
The compatible value shouldn't be used for SW policy differences. DT is about HW, not SW policy. You have to decide: either the HW is 100% backwards-compatible, or it's not. You can't decide that the HW is compatible, but then require different compatible values.
Re: [PATCH v2 27/27] drm/tegra: Add Tegra114 gr2d support
In reply to a message not in the archiveQuoted 30 lines · Stephen Warren
Quoted 29 lines · Thierry Reding
Quoted 14 lines · Terje Bergström
Quoted 5 lines · Stephen Warren
Quoted 2 lines · Thierry Reding
The gr2d hardware in Tegra114 is compatible with that of Tegra20 and Tegra30. No functionaly changes are required.
Similarly here, if the HW is 100% backwards-compatible, there's no need to add compatible values to the driver.
We've used this mechanism for attaching a per-hw-version data structure in match table to accomodate differences in how the hardware is power gated, reset, booted, some per-soc performance related changes etc. It's also used in staging features for new chips, such as disabling power features when they're not working/verified yet.
Quoted 6 lines
Upstream driver is not yet in a state where that is relevant.
With this, would we still be able to do that with match table? It sounds like we could, because we can still (even with multiple compatible properties) add separate entries in match table and I guess the compatible properties matched in order.
Yes, as long as the device tree files includes the most specific value in the compatible this should still be possible. So we'd have this:
gr2d@54140000 { compatible = "nvida,tegra114-gr2d", "nvidia,tegra20-gr2d"; ... };
Quoted 8 lines
Quoted 4 lines
and the driver will match on "nvidia,tegra20-gr2d" if the more specific "nvidia,tegra114-gr2d" is not there. When the driver is updated to support Tegra114 specific functionality, then a more specific entry can be added to the compatible table to handle it.
True, but the DT fragment above is also only accurate /if/ a driver that only knows about "nvidia,tegra20-gr2d" can operate 100% of the features in Tegra20 HW on Tegra114 HW forever.
Yes, but given that we also list "nvidia,tegra114-gr2d" in the property it will be possible to add that to the driver when new functionality is implemented and immediately take advantage of it on Tegra114 hardware with an old device tree file which has both compatible values.
Thierry
A message that is not in the archive (sent off-list or not yet received): 20131015083731.GI7856-AwZRO8vwLAwmlAP/[email protected]
Re: [PATCH v2 27/27] drm/tegra: Add Tegra114 gr2d support
Quoted 45 lines · Thierry Reding
Quoted 40 lines · Stephen Warren
Quoted 30 lines · Thierry Reding
Quoted 15 lines · Terje Bergström
Quoted 6 lines · Stephen Warren
Quoted 3 lines · Thierry Reding
The gr2d hardware in Tegra114 is compatible with that of Tegra20 and Tegra30. No functionaly changes are required.
Similarly here, if the HW is 100% backwards-compatible, there's no need to add compatible values to the driver.
We've used this mechanism for attaching a per-hw-version data structure in match table to accomodate differences in how the hardware is power gated, reset, booted, some per-soc performance related changes etc. It's also used in staging features for new chips, such as disabling power features when they're not working/verified yet.
Quoted 8 lines
Upstream driver is not yet in a state where that is relevant.
With this, would we still be able to do that with match table? It sounds like we could, because we can still (even with multiple compatible properties) add separate entries in match table and I guess the compatible properties matched in order.
Yes, as long as the device tree files includes the most specific value in the compatible this should still be possible. So we'd have this:
Quoted 8 lines
gr2d@54140000 { compatible = "nvida,tegra114-gr2d", "nvidia,tegra20-gr2d"; ... };
and the driver will match on "nvidia,tegra20-gr2d" if the more specific "nvidia,tegra114-gr2d" is not there. When the driver is updated to support Tegra114 specific functionality, then a more specific entry can be added to the compatible table to handle it.
Quoted 3 lines
True, but the DT fragment above is also only accurate /if/ a driver that only knows about "nvidia,tegra20-gr2d" can operate 100% of the features in Tegra20 HW on Tegra114 HW forever.
Quoted 5 lines
Yes, but given that we also list "nvidia,tegra114-gr2d" in the property it will be possible to add that to the driver when new functionality is implemented and immediately take advantage of it on Tegra114 hardware with an old device tree file which has both compatible values.
Taking advantage of new functionality isn't the issue. The issue is whether a driver that was written purely to the spec of Tegra20 can successfully operate on the HW. If it can't, then the HW is not compatible with Tegra20. Terje's previous comments sounded like the HW is not backwards-compatible, although his more recent comments make it sound like only SW policy differences, which shouldn't be part of DT anyway.
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH v2 27/27] drm/tegra: Add Tegra114 gr2d support
Quoted 52 lines · Stephen Warren
Quoted 45 lines · Thierry Reding
Quoted 40 lines · Stephen Warren
Quoted 30 lines · Thierry Reding
Quoted 15 lines · Terje Bergström
Quoted 6 lines · Stephen Warren
Quoted 3 lines · Thierry Reding
The gr2d hardware in Tegra114 is compatible with that of Tegra20 and Tegra30. No functionaly changes are required.
Similarly here, if the HW is 100% backwards-compatible, there's no need to add compatible values to the driver.
We've used this mechanism for attaching a per-hw-version data structure in match table to accomodate differences in how the hardware is power gated, reset, booted, some per-soc performance related changes etc. It's also used in staging features for new chips, such as disabling power features when they're not working/verified yet.
Quoted 8 lines
Upstream driver is not yet in a state where that is relevant.
With this, would we still be able to do that with match table? It sounds like we could, because we can still (even with multiple compatible properties) add separate entries in match table and I guess the compatible properties matched in order.
Yes, as long as the device tree files includes the most specific value in the compatible this should still be possible. So we'd have this:
Quoted 8 lines
gr2d@54140000 { compatible = "nvida,tegra114-gr2d", "nvidia,tegra20-gr2d"; ... };
and the driver will match on "nvidia,tegra20-gr2d" if the more specific "nvidia,tegra114-gr2d" is not there. When the driver is updated to support Tegra114 specific functionality, then a more specific entry can be added to the compatible table to handle it.
Quoted 3 lines
True, but the DT fragment above is also only accurate /if/ a driver that only knows about "nvidia,tegra20-gr2d" can operate 100% of the features in Tegra20 HW on Tegra114 HW forever.
Quoted 5 lines
Yes, but given that we also list "nvidia,tegra114-gr2d" in the property it will be possible to add that to the driver when new functionality is implemented and immediately take advantage of it on Tegra114 hardware with an old device tree file which has both compatible values.
Quoted 7 lines
Taking advantage of new functionality isn't the issue. The issue is whether a driver that was written purely to the spec of Tegra20 can successfully operate on the HW. If it can't, then the HW is not compatible with Tegra20. Terje's previous comments sounded like the HW is not backwards-compatible, although his more recent comments make it sound like only SW policy differences, which shouldn't be part of DT anyway.
Well, as good as I can tell it is backwards-compatible. I've been testing the code included in this series with the same simple test program that clears a rectangle on Tegra20, Tegra30 and Tegra114.
Furthermore our internal register specification files are identical, with the exception of some whitespace changes for all three generations. I think that qualifies as backwards-compatible?
Thierry
A message that is not in the archive (sent off-list or not yet received): 20131016084804.GC21963-AwZRO8vwLAwmlAP/[email protected]
Re: [PATCH v2 27/27] drm/tegra: Add Tegra114 gr2d support
Quoted 9 lines · Thierry Reding
Quoted 7 lines · Stephen Warren
Taking advantage of new functionality isn't the issue. The issue is whether a driver that was written purely to the spec of Tegra20 can successfully operate on the HW. If it can't, then the HW is not compatible with Tegra20. Terje's previous comments sounded like the HW is not backwards-compatible, although his more recent comments make it sound like only SW policy differences, which shouldn't be part of DT anyway.
Quoted 7 lines
Well, as good as I can tell it is backwards-compatible. I've been testing the code included in this series with the same simple test program that clears a rectangle on Tegra20, Tegra30 and Tegra114.
Furthermore our internal register specification files are identical, with the exception of some whitespace changes for all three generations. I think that qualifies as backwards-compatible?
A driver written for Tegra20 2D works with Tegra114 2D. Not necessarily vice versa, because Tegra114's driver can ask for higher clocks, or it might want to power gate 2D.
I mentioned earlier bringup activities. Perhaps Stephen took that in a way I didn't intend.
Terje
Re: [PATCH v2 27/27] drm/tegra: Add Tegra114 gr2d support
In reply to a message not in the archiveQuoted 64 lines · Thierry Reding
Quoted 55 lines · Stephen Warren
Quoted 48 lines · Thierry Reding
Quoted 41 lines · Stephen Warren
Quoted 31 lines · Thierry Reding
Quoted 16 lines · Terje Bergström
Quoted 7 lines · Stephen Warren
Quoted 3 lines · Thierry Reding
The gr2d hardware in Tegra114 is compatible with that of Tegra20 and Tegra30. No functionaly changes are required.
Similarly here, if the HW is 100% backwards-compatible, there's no need to add compatible values to the driver.
We've used this mechanism for attaching a per-hw-version data structure in match table to accomodate differences in how the hardware is power gated, reset, booted, some per-soc performance related changes etc. It's also used in staging features for new chips, such as disabling power features when they're not working/verified yet.
Quoted 8 lines
Upstream driver is not yet in a state where that is relevant.
With this, would we still be able to do that with match table? It sounds like we could, because we can still (even with multiple compatible properties) add separate entries in match table and I guess the compatible properties matched in order.
Yes, as long as the device tree files includes the most specific value in the compatible this should still be possible. So we'd have this:
Quoted 8 lines
gr2d@54140000 { compatible = "nvida,tegra114-gr2d", "nvidia,tegra20-gr2d"; ... };
and the driver will match on "nvidia,tegra20-gr2d" if the more specific "nvidia,tegra114-gr2d" is not there. When the driver is updated to support Tegra114 specific functionality, then a more specific entry can be added to the compatible table to handle it.
Quoted 4 lines
True, but the DT fragment above is also only accurate /if/ a driver that only knows about "nvidia,tegra20-gr2d" can operate 100% of the features in Tegra20 HW on Tegra114 HW forever.
Quoted 5 lines
Yes, but given that we also list "nvidia,tegra114-gr2d" in the property it will be possible to add that to the driver when new functionality is implemented and immediately take advantage of it on Tegra114 hardware with an old device tree file which has both compatible values.
Quoted 7 lines
Taking advantage of new functionality isn't the issue. The issue is whether a driver that was written purely to the spec of Tegra20 can successfully operate on the HW. If it can't, then the HW is not compatible with Tegra20. Terje's previous comments sounded like the HW is not backwards-compatible, although his more recent comments make it sound like only SW policy differences, which shouldn't be part of DT anyway.
Quoted 3 lines
Well, as good as I can tell it is backwards-compatible. I've been testing the code included in this series with the same simple test program that clears a rectangle on Tegra20, Tegra30 and Tegra114.
All that means is that the subset of features we use so far is compatible.
Quoted 3 lines
Furthermore our internal register specification files are identical, with the exception of some whitespace changes for all three generations. I think that qualifies as backwards-compatible?
On the other hand, that sounds like an almost perfect definition of backwards-compatible. Can you also validate that any module clock/power/reset inputs are identical? If so, the case is closed:-)
Re: [PATCH v2 27/27] drm/tegra: Add Tegra114 gr2d support
In reply to a message not in the archiveQuoted 11 lines · Terje Bergström
Quoted 6 lines · Stephen Warren
Quoted 2 lines · Thierry Reding
The gr2d hardware in Tegra114 is compatible with that of Tegra20 and Tegra30. No functionaly changes are required.
Similarly here, if the HW is 100% backwards-compatible, there's no need to add compatible values to the driver.
We've used this mechanism for attaching a per-hw-version data structure in match table to accomodate differences in how the hardware is power gated, reset, booted, some per-soc performance related changes etc.
If there are differences in those aspects of the HW, such that a driver written only to the full specification of e.g. Tegra30 would not work on Tegra114, then the HW is not actually compatible, and hence we do need multiple compatible values in DT, and entries in the of_match table.
It sounds like the statement in the commit description:
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
The gr2d hardware in Tegra114 is compatible with that of Tegra20 and Tegra30. No functionaly changes are required.
Might not be absolutely accurate in terms of HW, but only in terms of the features that the driver uses so far. It'd be good to explicitly qualify this in the commit description.
...
Quoted 1 line
Upstream driver is not yet in a state where that is relevant.
The compatible values should be picked based on the full feature-set of the HW, not based on the subset of features supported by a particular driver.