[PATCH 4/7] drm/tegra: gr2d: Track interface version
Dmitry Osipenko
digetx at gmail.com
Fri May 18 16:05:23 UTC 2018
On 17.05.2018 18:41, Thierry Reding wrote:
> From: Thierry Reding <treding at nvidia.com>
>
> Set the interface version implemented by the gr2d module. This allows
> userspace to pass the correct command stream when programming the gr2d
> module.
>
> Signed-off-by: Thierry Reding <treding at nvidia.com>
> ---
> drivers/gpu/drm/tegra/gr2d.c | 22 ++++++++++++++++++++--
> 1 file changed, 20 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/tegra/gr2d.c b/drivers/gpu/drm/tegra/gr2d.c
> index 9a8ea93016a9..d13752b0d915 100644
> --- a/drivers/gpu/drm/tegra/gr2d.c
> +++ b/drivers/gpu/drm/tegra/gr2d.c
> @@ -7,16 +7,23 @@
> */
>
> #include <linux/clk.h>
> +#include <linux/of_device.h>
>
> #include "drm.h"
> #include "gem.h"
> #include "gr2d.h"
>
> +struct gr2d_soc {
> + unsigned int version;
> +};
> +
> struct gr2d {
> struct tegra_drm_client client;
> struct host1x_channel *channel;
> struct clk *clk;
>
> + const struct gr2d_soc *soc;
> +
> DECLARE_BITMAP(addr_regs, GR2D_NUM_REGS);
> };
>
> @@ -123,9 +130,17 @@ static const struct tegra_drm_client_ops gr2d_ops = {
> .submit = tegra_drm_submit,
> };
>
> +static const struct gr2d_soc tegra20_gr2d_soc = {
> + .version = 0x20,
> +};
> +
> +static const struct gr2d_soc tegra30_gr2d_soc = {
> + .version = 0x30,
> +};
> +
> static const struct of_device_id gr2d_match[] = {
> - { .compatible = "nvidia,tegra30-gr2d" },
> - { .compatible = "nvidia,tegra20-gr2d" },
> + { .compatible = "nvidia,tegra30-gr2d", .data = &tegra20_gr2d_soc },
> + { .compatible = "nvidia,tegra20-gr2d", .data = &tegra30_gr2d_soc },
Note: T114 also has GR2D according to the TRM, maybe it's worth add it here too
later.
> { },
> };
> MODULE_DEVICE_TABLE(of, gr2d_match);
> @@ -158,6 +173,8 @@ static int gr2d_probe(struct platform_device *pdev)
> if (!gr2d)
> return -ENOMEM;
>
> + gr2d->soc = of_device_get_match_data(dev);
> +
> syncpts = devm_kzalloc(dev, sizeof(*syncpts), GFP_KERNEL);
> if (!syncpts)
> return -ENOMEM;
> @@ -178,6 +195,7 @@ static int gr2d_probe(struct platform_device *pdev)
> gr2d->client.base.ops = &gr2d_client_ops;
> gr2d->client.base.dev = dev;
> gr2d->client.base.class = HOST1X_CLASS_GR2D;
> + gr2d->client.base.version = gr2d->soc->version;
> gr2d->client.base.syncpts = syncpts;
> gr2d->client.base.num_syncpts = 1;
>
>
Reviewed-by: Dmitry Osipenko <digetx at gmail.com>
Tested-by: Dmitry Osipenko <digetx at gmail.com>
More information about the dri-devel
mailing list