From patchwork Fri May 31 08:55:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Zabel X-Patchwork-Id: 10969781 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8DBE1112C for ; Fri, 31 May 2019 08:55:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7EB8E28A11 for ; Fri, 31 May 2019 08:55:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 72D3328B4B; Fri, 31 May 2019 08:55:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 18E2028A63 for ; Fri, 31 May 2019 08:55:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727066AbfEaIz0 (ORCPT ); Fri, 31 May 2019 04:55:26 -0400 Received: from metis.ext.pengutronix.de ([85.220.165.71]:50609 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726843AbfEaIz0 (ORCPT ); Fri, 31 May 2019 04:55:26 -0400 Received: from dude02.hi.pengutronix.de ([2001:67c:670:100:1d::28] helo=dude02.pengutronix.de.) by metis.ext.pengutronix.de with esmtp (Exim 4.89) (envelope-from ) id 1hWdJt-0003zW-37; Fri, 31 May 2019 10:55:25 +0200 From: Philipp Zabel To: linux-media@vger.kernel.org Cc: Mauro Carvalho Chehab , Hans Verkuil , Boris Brezillon , Ezequiel Garcia , Nicolas Dufresne , Jonas Karlman , devicetree@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH v3 03/10] media: hantro: add PM runtime resume callback Date: Fri, 31 May 2019 10:55:16 +0200 Message-Id: <20190531085523.10892-4-p.zabel@pengutronix.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190531085523.10892-1-p.zabel@pengutronix.de> References: <20190531085523.10892-1-p.zabel@pengutronix.de> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::28 X-SA-Exim-Mail-From: p.zabel@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-media@vger.kernel.org Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP It seems that on i.MX8MQ the power domain controller does not propagate resets to the VPU cores on resume. Add a callback to allow implementing manual reset of the VPU cores after ungating the power domain. Signed-off-by: Philipp Zabel Reviewed-by: Boris Brezillon --- drivers/staging/media/hantro/hantro.h | 2 ++ drivers/staging/media/hantro/hantro_drv.c | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/drivers/staging/media/hantro/hantro.h b/drivers/staging/media/hantro/hantro.h index 14e685428203..296b9ffad547 100644 --- a/drivers/staging/media/hantro/hantro.h +++ b/drivers/staging/media/hantro/hantro.h @@ -56,6 +56,7 @@ struct hantro_codec_ops; * @codec: Supported codecs * @codec_ops: Codec ops. * @init: Initialize hardware. + * @runtime_resume: reenable hardware after power gating * @vepu_irq: encoder interrupt handler * @vdpu_irq: decoder interrupt handler * @clk_names: array of clock names @@ -71,6 +72,7 @@ struct hantro_variant { unsigned int codec; const struct hantro_codec_ops *codec_ops; int (*init)(struct hantro_dev *vpu); + int (*runtime_resume)(struct hantro_dev *vpu); irqreturn_t (*vepu_irq)(int irq, void *priv); irqreturn_t (*vdpu_irq)(int irq, void *priv); const char *clk_names[HANTRO_MAX_CLOCKS]; diff --git a/drivers/staging/media/hantro/hantro_drv.c b/drivers/staging/media/hantro/hantro_drv.c index e4390aa5c213..fb5f140dbaae 100644 --- a/drivers/staging/media/hantro/hantro_drv.c +++ b/drivers/staging/media/hantro/hantro_drv.c @@ -831,9 +831,22 @@ static int hantro_remove(struct platform_device *pdev) return 0; } +#ifdef CONFIG_PM +static int hantro_runtime_resume(struct device *dev) +{ + struct hantro_dev *vpu = dev_get_drvdata(dev); + + if (vpu->variant->runtime_resume) + return vpu->variant->runtime_resume(vpu); + + return 0; +} +#endif + static const struct dev_pm_ops hantro_pm_ops = { SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume) + SET_RUNTIME_PM_OPS(NULL, hantro_runtime_resume, NULL) }; static struct platform_driver hantro_driver = {