linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@collabora.com>
To: Philipp Zabel <p.zabel@pengutronix.de>
Cc: linux-media@vger.kernel.org,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Hans Verkuil <hverkuil@xs4all.nl>,
	Ezequiel Garcia <ezequiel@collabora.com>,
	Nicolas Dufresne <nicolas@ndufresne.ca>,
	Jonas Karlman <jonas@kwiboo.se>,
	devicetree@vger.kernel.org, kernel@pengutronix.de
Subject: Re: [PATCH v2 4/9] media: hantro: make irq names configurable
Date: Wed, 29 May 2019 13:34:56 +0200	[thread overview]
Message-ID: <20190529133456.0096a6a4@collabora.com> (raw)
In-Reply-To: <20190529095424.23614-5-p.zabel@pengutronix.de>

On Wed, 29 May 2019 11:54:19 +0200
Philipp Zabel <p.zabel@pengutronix.de> wrote:

> The i.MX8MQ bindings will use different IRQ names ("g1" instead of
> "vdpu", and "g2"), so make them configurable. This also allows to
> register more than two IRQs, which will be required for i.MX8MM support
> later (it will add "h1" instead of "vepu").
> 
> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
> ---
> Changes since v1 [1]:
>  - Rebased onto "[PATCH v6] Add MPEG-2 decoding to Rockchip VPU" series.
> 
> [1] https://patchwork.linuxtv.org/patch/56285/
> ---
>  drivers/staging/media/hantro/hantro.h        | 11 ++++---
>  drivers/staging/media/hantro/hantro_drv.c    | 31 +++++++-------------
>  drivers/staging/media/hantro/rk3288_vpu_hw.c |  5 ++--
>  drivers/staging/media/hantro/rk3399_vpu_hw.c |  9 ++++--
>  4 files changed, 26 insertions(+), 30 deletions(-)
> 
> diff --git a/drivers/staging/media/hantro/hantro.h b/drivers/staging/media/hantro/hantro.h
> index 296b9ffad547..6b90fe48bcdf 100644
> --- a/drivers/staging/media/hantro/hantro.h
> +++ b/drivers/staging/media/hantro/hantro.h
> @@ -26,6 +26,7 @@
>  #include "hantro_hw.h"
>  
>  #define HANTRO_MAX_CLOCKS		4
> +#define HANTRO_MAX_IRQS			3
>  
>  #define MPEG2_MB_DIM			16
>  #define MPEG2_MB_WIDTH(w)		DIV_ROUND_UP(w, MPEG2_MB_DIM)
> @@ -57,8 +58,9 @@ struct hantro_codec_ops;
>   * @codec_ops:			Codec ops.
>   * @init:			Initialize hardware.
>   * @runtime_resume:		reenable hardware after power gating
> - * @vepu_irq:			encoder interrupt handler
> - * @vdpu_irq:			decoder interrupt handler
> + * @irq_handlers:		interrupt handlers, same order as irq names
> + * @irq_names:			array of irq names
> + * @num_irqs:			number of irqs in the arrays
>   * @clk_names:			array of clock names
>   * @num_clocks:			number of clocks in the array
>   */
> @@ -73,8 +75,9 @@ struct hantro_variant {
>  	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);
> +	irqreturn_t (*irq_handlers[HANTRO_MAX_IRQS])(int irq, void *priv);
> +	const char *irq_names[HANTRO_MAX_IRQS];

Can we have a struct instead of an array for all handlers and another
array for irq names:

	struct {
		const char *name;
		irqreturn_t (*handler)(int irq, void *priv);
	} irqs[HANTRO_MAX_IRQS];

> +	int num_irqs;

Or we could have the struct defined outside of hantro_variant and get
rid of HANTRO_MAX_IRQS (I find it annoying to have to update the MAX
value every time a new variant needs more than what was previously
defined as MAX):

struct hantro_irq {
	const char *name;
	irqreturn_t (*handler)(int irq, void *priv);
};

struct hantro_variant {
	...
	unsigned int num_irqs;
	const struct hantro_irq *irqs;
};

static const struct hantro_irq xxxx_irqs[] = {
	{ ... },
	{ ... },

};

static const struct hantro_variant xxxx_variant = {
	.num_irqs = ARRAY_SIZE(xxxx_irqs),
	.irqs = xxxx_irqs,
};

  reply	other threads:[~2019-05-29 11:35 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-29  9:54 [PATCH v2 0/9] Rename Rockchip VPU driver to Hantro, add initial i.MX8M support Philipp Zabel
2019-05-29  9:54 ` [PATCH v2 1/9] rockchip/vpu: rename from rockchip to hantro Philipp Zabel
2019-05-29 11:16   ` Boris Brezillon
2019-05-29  9:54 ` [PATCH v2 2/9] media: hantro: print video device name in addition to device node Philipp Zabel
2019-05-29 11:16   ` Boris Brezillon
2019-05-29  9:54 ` [PATCH v2 3/9] media: hantro: add PM runtime resume callback Philipp Zabel
2019-05-29 11:18   ` Boris Brezillon
2019-05-29  9:54 ` [PATCH v2 4/9] media: hantro: make irq names configurable Philipp Zabel
2019-05-29 11:34   ` Boris Brezillon [this message]
2019-05-29 12:24     ` Philipp Zabel
2019-05-29  9:54 ` [PATCH v2 5/9] media: hantro: add support for named register ranges Philipp Zabel
2019-05-29 11:46   ` Boris Brezillon
2019-05-29 13:20     ` Philipp Zabel
2019-05-29 13:46       ` Boris Brezillon
2019-05-29  9:54 ` [PATCH v2 6/9] media: hantro: add support for separate control block Philipp Zabel
2019-05-29  9:54 ` [PATCH v2 7/9] media: dt-bindings: Document i.MX8MQ and i.MX8MM VPU bindings Philipp Zabel
2019-05-29  9:54 ` [PATCH v2 8/9] media: hantro: add initial i.MX8MQ support Philipp Zabel
2019-05-29  9:54 ` [PATCH v2 9/9] media: hantro: add initial i.MX8MM support (untested) Philipp Zabel

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=20190529133456.0096a6a4@collabora.com \
    --to=boris.brezillon@collabora.com \
    --cc=devicetree@vger.kernel.org \
    --cc=ezequiel@collabora.com \
    --cc=hverkuil@xs4all.nl \
    --cc=jonas@kwiboo.se \
    --cc=kernel@pengutronix.de \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=nicolas@ndufresne.ca \
    --cc=p.zabel@pengutronix.de \
    /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;
as well as URLs for NNTP newsgroup(s).