Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp4235846imm; Mon, 25 Jun 2018 12:02:00 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLqJFls+bxI+TevlBdNxHgmKCSfsOEeSmn+ZxvEkokSfpVmDEWybzSHCE1GJ/XJduWsKDga X-Received: by 2002:a62:8995:: with SMTP id n21-v6mr14104403pfk.83.1529953320509; Mon, 25 Jun 2018 12:02:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529953320; cv=none; d=google.com; s=arc-20160816; b=T1xsH5GGDFth8hWF81TA8ZuQcuR+wXiTevFTIyRdAO3uCD561ZwfLyEWHrtduyihbU /5H9EYc08ZEvPZSHNFjQ9ciwTKKdN/atju7rheqO72Br3iZUZGV3ag5rkI6/W8qENzdq j4WQiShrIkbuESoIearRDFPpLkN4EoT4ZfkosJzeG+lb9re0FMXdfcWt6+eHQ+QPCVfw A+H/URxFakUZ1fPCRUWISqmA9wuUT7mA05o5lZbDyAfJxF/drmZ21hZ1o1O0vnLCkW6s QLqXMC997FU2GyuubwMCcDAh3oQrBEdPBdPz2ZNDwe/NQcp+BM44itRXLGTcqt/KuRqE /6Yg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=D1Bo5MncEY4mcRjr7gcwPlQtQQy3hrE+N1QBYtgSHHM=; b=T7hrmtKNbPsPLBFp1aQbeSf357VYQq1HOs3xDERxqTs5T22X540yXOvyvWHuPxTKsB UPajBLDEtv768I1ghYAawqsuV/javF9hh+LcKu31eDFvDenK4cNpT88D1bZLe+a1YPGb wXze5WXzz+zZD2rSEi1tv7hVKsw0DGZle2+zuX76iywNjB9EtDvOoBUdWMauS3qL4xRO c9zfATNYhbDOsVw8Ju1bBHjhCtB91Q2/tIXE18A4ZzUhReTA2VYT4N1anvOyXsCVZisk v7dM6teRgcEEu44D1Fyyg6x2LybXKQ+6lnkC8wpB1nUic5nsI000psNyMdThqXFFO7u3 eLdA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k62-v6si4926059pgd.501.2018.06.25.12.01.44; Mon, 25 Jun 2018 12:02:00 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965001AbeFYTBE (ORCPT + 99 others); Mon, 25 Jun 2018 15:01:04 -0400 Received: from mail.bootlin.com ([62.4.15.54]:38916 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964908AbeFYTBD (ORCPT ); Mon, 25 Jun 2018 15:01:03 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id 6C925206D8; Mon, 25 Jun 2018 21:01:01 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from localhost (unknown [88.128.82.118]) by mail.bootlin.com (Postfix) with ESMTPSA id 1F4C8203B4; Mon, 25 Jun 2018 21:01:01 +0200 (CEST) Date: Mon, 25 Jun 2018 21:01:00 +0200 From: Maxime Ripard To: Paul Kocialkowski Cc: hans.verkuil@cisco.com, acourbot@chromium.org, sakari.ailus@linux.intel.com, Laurent Pinchart , tfiga@chromium.org, posciak@chromium.org, Chen-Yu Tsai , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org, nicolas.dufresne@collabora.com, jenskuske@gmail.com, linux-sunxi@googlegroups.com, Thomas Petazzoni Subject: Re: [PATCH 7/9] media: cedrus: Move IRQ maintainance to cedrus_dec_ops Message-ID: <20180625190100.rlqbcafhktypotgj@flea> References: <20180613140714.1686-1-maxime.ripard@bootlin.com> <20180613140714.1686-8-maxime.ripard@bootlin.com> <03f66b80b1a60c4fe62822b08eb5d97c0539aac0.camel@bootlin.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="korxkvl2ni3lg3ka" Content-Disposition: inline In-Reply-To: <03f66b80b1a60c4fe62822b08eb5d97c0539aac0.camel@bootlin.com> User-Agent: NeoMutt/20180512 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --korxkvl2ni3lg3ka Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jun 25, 2018 at 05:49:58PM +0200, Paul Kocialkowski wrote: > On Mon, 2018-06-25 at 17:38 +0200, Paul Kocialkowski wrote: > > Hi, > >=20 > > On Wed, 2018-06-13 at 16:07 +0200, Maxime Ripard wrote: > > > The IRQ handler up until now was hardcoding the use of the MPEG engin= e to > > > read the interrupt status, clear it and disable the interrupts. > > >=20 > > > Obviously, that won't work really well with the introduction of new c= odecs > > > that use a separate engine with a separate register set. > > >=20 > > > In order to make this more future proof, introduce new decodec operat= ions > > > to deal with the interrupt management. The only one missing is the on= e to > > > enable the interrupts in the first place, but that's taken care of by= the > > > trigger hook for now. > >=20 > > Here's another comment about an issue I just figured out. > >=20 > > > Signed-off-by: Maxime Ripard > > > --- > > > .../sunxi/cedrus/sunxi_cedrus_common.h | 9 +++++ > > > .../platform/sunxi/cedrus/sunxi_cedrus_hw.c | 21 ++++++------ > > > .../sunxi/cedrus/sunxi_cedrus_mpeg2.c | 33 +++++++++++++++++= ++ > > > 3 files changed, 53 insertions(+), 10 deletions(-) > > >=20 > > > diff --git a/drivers/media/platform/sunxi/cedrus/sunxi_cedrus_common.= h b/drivers/media/platform/sunxi/cedrus/sunxi_cedrus_common.h > > > index c2e2c92d103b..a2a507eb9fc9 100644 > > > --- a/drivers/media/platform/sunxi/cedrus/sunxi_cedrus_common.h > > > +++ b/drivers/media/platform/sunxi/cedrus/sunxi_cedrus_common.h > > > @@ -108,7 +108,16 @@ struct sunxi_cedrus_buffer *vb2_to_cedrus_buffer= (const struct vb2_buffer *p) > > > return vb2_v4l2_to_cedrus_buffer(to_vb2_v4l2_buffer(p)); > > > } > > > =20 > > > +enum sunxi_cedrus_irq_status { > > > + SUNXI_CEDRUS_IRQ_NONE, > > > + SUNXI_CEDRUS_IRQ_ERROR, > > > + SUNXI_CEDRUS_IRQ_OK, > > > +}; > > > + > > > struct sunxi_cedrus_dec_ops { > > > + void (*irq_clear)(struct sunxi_cedrus_ctx *ctx); > > > + void (*irq_disable)(struct sunxi_cedrus_ctx *ctx); > > > + enum sunxi_cedrus_irq_status (*irq_status)(struct sunxi_cedrus_ctx = *ctx); > > > void (*setup)(struct sunxi_cedrus_ctx *ctx, > > > struct sunxi_cedrus_run *run); > > > void (*trigger)(struct sunxi_cedrus_ctx *ctx); > > > diff --git a/drivers/media/platform/sunxi/cedrus/sunxi_cedrus_hw.c b/= drivers/media/platform/sunxi/cedrus/sunxi_cedrus_hw.c > > > index bb46a01214e0..6b97cbd2834e 100644 > > > --- a/drivers/media/platform/sunxi/cedrus/sunxi_cedrus_hw.c > > > +++ b/drivers/media/platform/sunxi/cedrus/sunxi_cedrus_hw.c > > > @@ -77,27 +77,28 @@ static irqreturn_t sunxi_cedrus_ve_irq(int irq, v= oid *dev_id) > > > struct sunxi_cedrus_ctx *ctx; > > > struct sunxi_cedrus_buffer *src_buffer, *dst_buffer; > > > struct vb2_v4l2_buffer *src_vb, *dst_vb; > > > + enum sunxi_cedrus_irq_status status; > > > unsigned long flags; > > > - unsigned int value, status; > > > =20 > > > spin_lock_irqsave(&dev->irq_lock, flags); > > > =20 > > > - /* Disable MPEG interrupts and stop the MPEG engine */ > > > - value =3D sunxi_cedrus_read(dev, VE_MPEG_CTRL); > > > - sunxi_cedrus_write(dev, value & (~0xf), VE_MPEG_CTRL); > > > - > > > - status =3D sunxi_cedrus_read(dev, VE_MPEG_STATUS); > > > - sunxi_cedrus_write(dev, 0x0000c00f, VE_MPEG_STATUS); > > > - sunxi_cedrus_engine_disable(dev); > >=20 > > This call was dropped from the code reorganization. What it intentional? > >=20 > > IMO, it should be brought back to the irq_disable ops for MPEG2 (and the > > same probably applies to H264). >=20 > Actually, this doesn't seem like the right place to put it. >=20 > Looking at the sunxi_engine_enable function, explicitly passing the > codec as an argument and calling that function from each codec's code > feels strange. >=20 > We should probably break down these functions > (sunxi_engine_enable/sunxi_engine_disable) into codec ops. The > start/stop couple seems like a good fit, but it brings up the following > question: do we want to disable the engine between each frame or not? >=20 > I really don't know how significant the power saving benefits are and > what downsides there might be. >=20 > What do you think? If we don't need to disable it between each frames, then let's keep it enabled. Without any number, and considering the current state of power management (which is inexistent on this driver, and close to for the whole platform), wasting a bit of power if we do isn't really a big deal. Maxime --=20 Maxime Ripard, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com --korxkvl2ni3lg3ka Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEE0VqZU19dR2zEVaqr0rTAlCFNr3QFAlsxO+sACgkQ0rTAlCFN r3Qg1w/+N913dfkZ13U/wsthm2EbOh2cvc6XHCyyBuXu9tXGFs/dGBD+ZfBAkqFJ U0xqV3+b8QM/CDSessCouy7A3vDJOX1mTk6/KuygmppUpZ+MSzOVie9izTaZm1Hb qgdMWsYO7F6j6HjS9E8cz0Cf+IE324a0//23kx9QycUyKEAKGGzQWjIfuHf/WsMc 10EFXGRE5WXHrPxvwDyFxRgFveG2aFoVa8aS2w4CrhQrUn+cvpIcBmQgFcrw+fbO YPV90ZOK95U24htjliwalwB/OhNu7lfAjz6HbFbbv9uF6NAaFzhP0VolpvAhgCOu CiXJ9SUHIJCp5FIPHbBO5OTkbo65O09gBKGndT5wZbm2YzPYKrpsmlyuORoejhMY zvwGFmB0/4noFQYN22yJrLql+fDXxFLjXtxgiAqLguYXciY8rc6QV/c6NAWQCotH 9TcYCW1mGEz3th6VNZt2sYRxMpWhZmNkNbjdPRAqDgAWYkfxfHG0sn4rmQPRVuyQ LdZRiw2Mhkt2PBCOL57pEufY62KbSS879UOfcrI/MzAryU239JoxfP8pPBEq9S0W RGkNxVECK4pJDRamM0FhLgZSkCRKaNbZbwbBjjtRs96uyjoiqFWk5qZy7VrT6oYF BewN1Ww/TLl9mbrENOWhf6DO2H3MqkO22WVwaAb+4yzzNaK/3Ak= =0Y6Z -----END PGP SIGNATURE----- --korxkvl2ni3lg3ka--