Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3594907imm; Mon, 4 Jun 2018 06:20:08 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJp+d+cG+ViE/WMYWky+ufE4XlPRSMVBGccDnTZ/ygZBIQqTOvAy8hUx7j9KdqY6pN2te8N X-Received: by 2002:a63:85c8:: with SMTP id u191-v6mr16473315pgd.300.1528118407990; Mon, 04 Jun 2018 06:20:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528118407; cv=none; d=google.com; s=arc-20160816; b=vWcNcngHR+JpStq/clRrVAGSi32U3bYzeLs8pfaZBq+6cAd/pTyDC5luCef1L0XpV9 2xRjrHIYgx4KVA0youPFEAVTdJWps6slXg+03+dqC1l16IjxxDCZEs8XGgoTudac2CmQ xkkxrUBS7JFeVaD+tTTKYIw3LqcFl+01f1E2+jlF2UvvRvVilyBxZjTp0rygcwsv/1nI PdptRQOk1ghme2RK0/eh/RvSxZr5kJ/GSXGI7UD4wXfZs64JzhCKziGERMeQIn0i4i++ 7pMFAACgIqCU/xlU2Gx1yJAi85j09N9TDU6D9glF8NeT1qfYiEao7r5NN0cYoPbIu63d s1Cw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature :arc-authentication-results; bh=Svj52f9N3aYZ9VQTOXnCsQeE193I9i6SjTd445SQvWw=; b=CJW1DDknLUVwqpGD5S+R6uqq+Y+e81wUMndm6s+nfI18r7HaJXMsCNmZV4AZhVACE4 FE3IxjeG5kp0DZWzGuLd8/s9R2Vf202gU7E4OXAmxyhl0w0gqSCQBtAw9zK8ezVDGLX2 Xe4CIaMQeAyWVHBFrVlTWZUuvtNeU34uZz9lbZvrMnUY6tFoDaTi9s+wl4pbCb2uQxWI Ti0SHwNGI9vWRB2yWJ/d5AcW0QUSTO47090V/heeFFpgPmRA2hWCmws2j5r03QAlpgQ3 /D8FJfwVZREEyoXbzMedhPYsKJJ+xKrme7GzgZTNqCeQdsW+jRdR2WH4LfoomIiCqV2A 1ukQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=FDdGJp9I; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bb5-v6si44465237plb.80.2018.06.04.06.19.53; Mon, 04 Jun 2018 06:20:07 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=FDdGJp9I; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753304AbeFDNSv (ORCPT + 99 others); Mon, 4 Jun 2018 09:18:51 -0400 Received: from mail-vk0-f67.google.com ([209.85.213.67]:41621 "EHLO mail-vk0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753280AbeFDNSs (ORCPT ); Mon, 4 Jun 2018 09:18:48 -0400 Received: by mail-vk0-f67.google.com with SMTP id 128-v6so14608116vkf.8 for ; Mon, 04 Jun 2018 06:18:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Svj52f9N3aYZ9VQTOXnCsQeE193I9i6SjTd445SQvWw=; b=FDdGJp9IwQgXxj9wMmIx9PWBcUbFgbuCySfWeRbJvdOTn02UYM/9aYOeFLqSSgMDHl gFIh3w19ajX2y0+eZVpbIJXcfSMcfgq7wxrq0FymHzx2QyQEpo7AZwXnrn7cZyi4Z5QT zLbEsU7DHD048gFA52r5fxdgq89UnCbry8MnA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Svj52f9N3aYZ9VQTOXnCsQeE193I9i6SjTd445SQvWw=; b=L/4f6GpQTAoNwTfgt6EBO16Vo9j6427IACmP9APXYeZcPZTsBwe0UDwcTE4uiLq593 T3PptIwouVsppwfZAZkFcmV+cAbtogUSgYKpgOWhM8PlCfFxhc+mgqReMnNLG3vSM6OF y6WBKFkdiDYGlYs7e8nS2Faz/ZwkwulRk0dA4DSWLsTXBkRES8TSoIMZfHPFOXb19bB5 NIwjrCM7nUSdABNXn8EdWjliIGf7XNvafryhm+zAQnQtCHNfeosK/FebkyK/FqCdeiU/ rcgzaYFG8VUAfs6J3qEKNgrYXCENmWmmWuQBvzrDN8tJwLEtt3DBK93zJQcKWwzjlaDF jGrQ== X-Gm-Message-State: APt69E1yFjNOA2ImGawMSDZ42ueDFpV99Y0GLvcJT8g4kd75qFFxOE2Z 9ccClG3orYAF+fjmAmC9Tu/CnND5O08= X-Received: by 2002:a1f:4dc2:: with SMTP id a185-v6mr4704719vkb.12.1528118327280; Mon, 04 Jun 2018 06:18:47 -0700 (PDT) Received: from mail-ua0-f175.google.com (mail-ua0-f175.google.com. [209.85.217.175]) by smtp.gmail.com with ESMTPSA id w5-v6sm1026065uaw.7.2018.06.04.06.18.46 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Jun 2018 06:18:46 -0700 (PDT) Received: by mail-ua0-f175.google.com with SMTP id i3-v6so22087115uad.4 for ; Mon, 04 Jun 2018 06:18:46 -0700 (PDT) X-Received: by 2002:a9f:3dc2:: with SMTP id e2-v6mr13848569uaj.132.1528118325621; Mon, 04 Jun 2018 06:18:45 -0700 (PDT) MIME-Version: 1.0 References: <1527884768-22392-1-git-send-email-vgarodia@codeaurora.org> <1527884768-22392-6-git-send-email-vgarodia@codeaurora.org> In-Reply-To: <1527884768-22392-6-git-send-email-vgarodia@codeaurora.org> From: Tomasz Figa Date: Mon, 4 Jun 2018 22:18:34 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 5/5] venus: register separate driver for firmware device To: vgarodia@codeaurora.org Cc: Hans Verkuil , Mauro Carvalho Chehab , Rob Herring , Mark Rutland , andy.gross@linaro.org, bjorn.andersson@linaro.org, Stanimir Varbanov , Linux Media Mailing List , Linux Kernel Mailing List , linux-arm-msm , linux-soc@vger.kernel.org, devicetree@vger.kernel.org, Alexandre Courbot Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Vikash, On Sat, Jun 2, 2018 at 5:27 AM Vikash Garodia wrote: > > A separate child device is added for video firmware. > This is needed to > [1] configure the firmware context bank with the desired SID. > [2] ensure that the iova for firmware region is from 0x0. > > Signed-off-by: Vikash Garodia > --- > .../devicetree/bindings/media/qcom,venus.txt | 8 +++- > drivers/media/platform/qcom/venus/core.c | 48 +++++++++++++++++++--- > drivers/media/platform/qcom/venus/firmware.c | 20 ++++++++- > drivers/media/platform/qcom/venus/firmware.h | 2 + > 4 files changed, 71 insertions(+), 7 deletions(-) > > diff --git a/Documentation/devicetree/bindings/media/qcom,venus.txt b/Documentation/devicetree/bindings/media/qcom,venus.txt > index 00d0d1b..701cbe8 100644 > --- a/Documentation/devicetree/bindings/media/qcom,venus.txt > +++ b/Documentation/devicetree/bindings/media/qcom,venus.txt > @@ -53,7 +53,7 @@ > > * Subnodes > The Venus video-codec node must contain two subnodes representing > -video-decoder and video-encoder. > +video-decoder and video-encoder, one optional firmware subnode. > > Every of video-encoder or video-decoder subnode should have: > > @@ -79,6 +79,8 @@ Every of video-encoder or video-decoder subnode should have: > power domain which is responsible for collapsing > and restoring power to the subcore. > > +The firmware sub node must contain the iommus specifiers for ARM9. Please document the compatible string here as well. > + > * An Example > video-codec@1d00000 { > compatible = "qcom,msm8916-venus"; > @@ -105,4 +107,8 @@ Every of video-encoder or video-decoder subnode should have: > clock-names = "core"; > power-domains = <&mmcc VENUS_CORE1_GDSC>; > }; > + venus-firmware { > + compatible = "qcom,venus-firmware-no-tz"; I don't think "-no-tz" should be mentioned here in DT, since it's a firmware/software detail. > + iommus = <&apps_smmu 0x10b2 0x0>; > + } > }; > diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c > index 101612b..5cfb3c2 100644 > --- a/drivers/media/platform/qcom/venus/core.c > +++ b/drivers/media/platform/qcom/venus/core.c > @@ -179,6 +179,19 @@ static u32 to_v4l2_codec_type(u32 codec) > } > } > > +static int store_firmware_dev(struct device *dev, void *data) > +{ > + struct venus_core *core = data; > + > + if (!core) > + return -EINVAL; > + No need to check this AFAICT. > + if (of_device_is_compatible(dev->of_node, "qcom,venus-firmware-no-tz")) > + core->fw.dev = dev; > + > + return 0; > +} > + > static int venus_enumerate_codecs(struct venus_core *core, u32 type) > { > const struct hfi_inst_ops dummy_ops = {}; > @@ -279,6 +292,13 @@ static int venus_probe(struct platform_device *pdev) > if (ret < 0) > goto err_runtime_disable; > > + ret = of_platform_populate(dev->of_node, NULL, NULL, dev); > + if (ret) > + goto err_runtime_disable; > + > + /* Attempt to store firmware device */ > + device_for_each_child(dev, core, store_firmware_dev); > + > ret = venus_boot(core); > if (ret) > goto err_runtime_disable; > @@ -303,10 +323,6 @@ static int venus_probe(struct platform_device *pdev) > if (ret) > goto err_core_deinit; > > - ret = of_platform_populate(dev->of_node, NULL, NULL, dev); > - if (ret) > - goto err_dev_unregister; > - > ret = pm_runtime_put_sync(dev); > if (ret) > goto err_dev_unregister; > @@ -483,7 +499,29 @@ static __maybe_unused int venus_runtime_resume(struct device *dev) > .pm = &venus_pm_ops, > }, > }; > -module_platform_driver(qcom_venus_driver); > + > +static int __init venus_init(void) > +{ > + int ret; > + > + ret = platform_driver_register(&qcom_video_firmware_driver); > + if (ret) > + return ret; Do we really need this firmware driver? As far as I can see, the approach used here should work even without any driver bound to the firmware device. Best regards, Tomasz