From: Dmitry Osipenko <digetx@gmail.com>
To: Marcel Ziswiler <marcel.ziswiler@toradex.com>,
Mikko Perttunen <cyndis@kapsi.fi>,
Thierry Reding <thierry.reding@gmail.com>
Cc: linux-tegra@vger.kernel.org, dri-devel@lists.freedesktop.org
Subject: [RFC PATCH v1] drm/tegra: vic: Defer firmware loading until it is really needed
Date: Mon, 10 Dec 2018 15:03:38 +0300 [thread overview]
Message-ID: <20181210120338.29288-1-digetx@gmail.com> (raw)
DRM driver fails to load if VIC firmware is missing, let's defer the
firmware loading until it is really needed. This eliminates the need
to have initrd with the firmware if DRM driver is compiled as built-in.
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---
drivers/gpu/drm/tegra/vic.c | 43 +++++++++++++++++++++++++++----------
1 file changed, 32 insertions(+), 11 deletions(-)
diff --git a/drivers/gpu/drm/tegra/vic.c b/drivers/gpu/drm/tegra/vic.c
index d47983deb1cf..efb75f290ff0 100644
--- a/drivers/gpu/drm/tegra/vic.c
+++ b/drivers/gpu/drm/tegra/vic.c
@@ -96,6 +96,34 @@ static int vic_runtime_suspend(struct device *dev)
return 0;
}
+static int vic_load_firmware(struct vic *vic)
+{
+ struct host1x_client *client = &vic->client.base;
+ struct drm_device *dev = dev_get_drvdata(client->parent);
+ struct tegra_drm *tegra = dev->dev_private;
+ int err;
+
+ if (vic->falcon.data)
+ return 0;
+
+ vic->falcon.data = tegra;
+
+ err = falcon_read_firmware(&vic->falcon, vic->config->firmware);
+ if (err < 0)
+ goto err_cleanup;
+
+ err = falcon_load_firmware(&vic->falcon);
+ if (err < 0)
+ goto err_cleanup;
+
+ return 0;
+
+err_cleanup:
+ vic->falcon.data = NULL;
+
+ return err;
+}
+
static int vic_boot(struct vic *vic)
{
u32 fce_ucode_size, fce_bin_data_offset;
@@ -105,6 +133,10 @@ static int vic_boot(struct vic *vic)
if (vic->booted)
return 0;
+ err = vic_load_firmware(vic);
+ if (err < 0)
+ return err;
+
/* setup clockgating registers */
vic_writel(vic, CG_IDLE_CG_DLY_CNT(4) |
CG_IDLE_CG_EN |
@@ -181,13 +213,6 @@ static int vic_init(struct host1x_client *client)
vic->domain = tegra->domain;
}
- if (!vic->falcon.data) {
- vic->falcon.data = tegra;
- err = falcon_load_firmware(&vic->falcon);
- if (err < 0)
- goto detach;
- }
-
vic->channel = host1x_channel_request(client->dev);
if (!vic->channel) {
err = -ENOMEM;
@@ -372,10 +397,6 @@ static int vic_probe(struct platform_device *pdev)
if (err < 0)
return err;
- err = falcon_read_firmware(&vic->falcon, vic->config->firmware);
- if (err < 0)
- goto exit_falcon;
-
platform_set_drvdata(pdev, vic);
INIT_LIST_HEAD(&vic->client.base.list);
--
2.19.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
reply other threads:[~2018-12-10 12:05 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181210120338.29288-1-digetx@gmail.com \
--to=digetx@gmail.com \
--cc=cyndis@kapsi.fi \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-tegra@vger.kernel.org \
--cc=marcel.ziswiler@toradex.com \
--cc=thierry.reding@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox