drm/tidss: New driver for TI Keystone platform Display SubSystem
This patch adds a new DRM driver for Texas Instruments DSS IPs used on
Texas Instruments Keystone K2G, AM65x, and J721e SoCs. The new DSS IP is
a major change to the older DSS IP versions, which are supported by
the omapdrm driver. While on higher level the Keystone DSS resembles
the older DSS versions, the registers are completely different and the
internal pipelines differ a lot.
DSS IP found on K2G is an "ultra-light" version, and has only a single
plane and a single output. The K3 DSS IPs are found on AM65x and J721E
SoCs. AM65x DSS has two video ports, one full video plane, and another
"lite" plane without scaling support. J721E has 4 video ports, 2 video
planes and 2 lite planes. AM65x DSS has also an integrated OLDI (LVDS)
output.
Version history:
v2: - rebased on top of drm-next-2019-11-27
- sort all include lines in all files
- remove all include <drm/drmP.h>
- remove select "select VIDEOMODE_HELPERS"
- call dispc_vp_setup() later in tidss_crtc_atomic_flush() (there is no
to call it in new modeset case as it is also called in vp_enable())
- change probe sequence and drm_device allocation (follow example in
drm_drv.c)
- use __maybe_unused instead of #ifdef for pm functions
- remove "struct drm_fbdev_cma *fbdev;" from driver data
- check panel connector type before connecting it
v3: no change
v4: no change
v5: - remove fifo underflow irq handling, it is not an error and
it should be used for debug purposes only
- memory tuning, prefetch plane fifo up to high-threshold value to
minimize possibility of underflows.
v6: - Check CTM and gamma support from dispc_features when creating crtc
- Implement CTM support for k2g and fix k3 CTM implementation
- Remove gamma property persistence and always write color properties
in a new modeset
v7: - Fix checkpatch.pl --strict issues
- Rebase on top of drm-misc-next-2020-01-10
v8: - Remove idle debug prints from dispc_init()
- Add Reviewed-by: Benoit Parrot <bparrot@ti.com>
v9: - Rename dispc_write_irqenable() to dispc_set_irqenable() to avoid
conflict exported omapfb function with same name
- Add Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Co-developed-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Signed-off-by: Jyri Sarha <jsarha@ti.com>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Reviewed-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Link: https://patchwork.freedesktop.org/patch/msgid/925fbfad58ff828e8e07fdff7073a0ee65750c3d.1580129724.git.jsarha@ti.com
2019-11-08 14:45:28 +07:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
/*
|
|
|
|
* Copyright (C) 2018 Texas Instruments Incorporated - http://www.ti.com/
|
|
|
|
* Author: Tomi Valkeinen <tomi.valkeinen@ti.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/export.h>
|
|
|
|
|
|
|
|
#include <drm/drm_crtc.h>
|
|
|
|
#include <drm/drm_crtc_helper.h>
|
|
|
|
#include <drm/drm_panel.h>
|
|
|
|
#include <drm/drm_of.h>
|
|
|
|
|
|
|
|
#include "tidss_crtc.h"
|
|
|
|
#include "tidss_drv.h"
|
|
|
|
#include "tidss_encoder.h"
|
|
|
|
|
|
|
|
static int tidss_encoder_atomic_check(struct drm_encoder *encoder,
|
|
|
|
struct drm_crtc_state *crtc_state,
|
|
|
|
struct drm_connector_state *conn_state)
|
|
|
|
{
|
|
|
|
struct drm_device *ddev = encoder->dev;
|
|
|
|
struct tidss_crtc_state *tcrtc_state = to_tidss_crtc_state(crtc_state);
|
|
|
|
struct drm_display_info *di = &conn_state->connector->display_info;
|
|
|
|
struct drm_bridge *bridge;
|
|
|
|
bool bus_flags_set = false;
|
|
|
|
|
|
|
|
dev_dbg(ddev->dev, "%s\n", __func__);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Take the bus_flags from the first bridge that defines
|
|
|
|
* bridge timings, or from the connector's display_info if no
|
|
|
|
* bridge defines the timings.
|
|
|
|
*/
|
2020-02-22 18:07:18 +07:00
|
|
|
drm_for_each_bridge_in_chain(encoder, bridge) {
|
drm/tidss: New driver for TI Keystone platform Display SubSystem
This patch adds a new DRM driver for Texas Instruments DSS IPs used on
Texas Instruments Keystone K2G, AM65x, and J721e SoCs. The new DSS IP is
a major change to the older DSS IP versions, which are supported by
the omapdrm driver. While on higher level the Keystone DSS resembles
the older DSS versions, the registers are completely different and the
internal pipelines differ a lot.
DSS IP found on K2G is an "ultra-light" version, and has only a single
plane and a single output. The K3 DSS IPs are found on AM65x and J721E
SoCs. AM65x DSS has two video ports, one full video plane, and another
"lite" plane without scaling support. J721E has 4 video ports, 2 video
planes and 2 lite planes. AM65x DSS has also an integrated OLDI (LVDS)
output.
Version history:
v2: - rebased on top of drm-next-2019-11-27
- sort all include lines in all files
- remove all include <drm/drmP.h>
- remove select "select VIDEOMODE_HELPERS"
- call dispc_vp_setup() later in tidss_crtc_atomic_flush() (there is no
to call it in new modeset case as it is also called in vp_enable())
- change probe sequence and drm_device allocation (follow example in
drm_drv.c)
- use __maybe_unused instead of #ifdef for pm functions
- remove "struct drm_fbdev_cma *fbdev;" from driver data
- check panel connector type before connecting it
v3: no change
v4: no change
v5: - remove fifo underflow irq handling, it is not an error and
it should be used for debug purposes only
- memory tuning, prefetch plane fifo up to high-threshold value to
minimize possibility of underflows.
v6: - Check CTM and gamma support from dispc_features when creating crtc
- Implement CTM support for k2g and fix k3 CTM implementation
- Remove gamma property persistence and always write color properties
in a new modeset
v7: - Fix checkpatch.pl --strict issues
- Rebase on top of drm-misc-next-2020-01-10
v8: - Remove idle debug prints from dispc_init()
- Add Reviewed-by: Benoit Parrot <bparrot@ti.com>
v9: - Rename dispc_write_irqenable() to dispc_set_irqenable() to avoid
conflict exported omapfb function with same name
- Add Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Co-developed-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Signed-off-by: Jyri Sarha <jsarha@ti.com>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Reviewed-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Link: https://patchwork.freedesktop.org/patch/msgid/925fbfad58ff828e8e07fdff7073a0ee65750c3d.1580129724.git.jsarha@ti.com
2019-11-08 14:45:28 +07:00
|
|
|
if (!bridge->timings)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
tcrtc_state->bus_flags = bridge->timings->input_bus_flags;
|
|
|
|
bus_flags_set = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!di->bus_formats || di->num_bus_formats == 0) {
|
|
|
|
dev_err(ddev->dev, "%s: No bus_formats in connected display\n",
|
|
|
|
__func__);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
// XXX any cleaner way to set bus format and flags?
|
|
|
|
tcrtc_state->bus_format = di->bus_formats[0];
|
|
|
|
if (!bus_flags_set)
|
|
|
|
tcrtc_state->bus_flags = di->bus_flags;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const struct drm_encoder_helper_funcs encoder_helper_funcs = {
|
|
|
|
.atomic_check = tidss_encoder_atomic_check,
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct drm_encoder_funcs encoder_funcs = {
|
|
|
|
.destroy = drm_encoder_cleanup,
|
|
|
|
};
|
|
|
|
|
|
|
|
struct drm_encoder *tidss_encoder_create(struct tidss_device *tidss,
|
|
|
|
u32 encoder_type, u32 possible_crtcs)
|
|
|
|
{
|
|
|
|
struct drm_encoder *enc;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
enc = devm_kzalloc(tidss->dev, sizeof(*enc), GFP_KERNEL);
|
|
|
|
if (!enc)
|
|
|
|
return ERR_PTR(-ENOMEM);
|
|
|
|
|
|
|
|
enc->possible_crtcs = possible_crtcs;
|
|
|
|
|
|
|
|
ret = drm_encoder_init(&tidss->ddev, enc, &encoder_funcs,
|
|
|
|
encoder_type, NULL);
|
|
|
|
if (ret < 0)
|
|
|
|
return ERR_PTR(ret);
|
|
|
|
|
|
|
|
drm_encoder_helper_add(enc, &encoder_helper_funcs);
|
|
|
|
|
|
|
|
dev_dbg(tidss->dev, "Encoder create done\n");
|
|
|
|
|
|
|
|
return enc;
|
|
|
|
}
|