devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@collabora.com>
To: Hans Verkuil <hverkuil@xs4all.nl>
Cc: Philipp Zabel <p.zabel@pengutronix.de>,
	linux-media@vger.kernel.org,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	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 v3 08/10] media: hantro: add initial i.MX8MQ support
Date: Mon, 3 Jun 2019 22:02:56 +0200	[thread overview]
Message-ID: <20190603220256.1922901a@collabora.com> (raw)
In-Reply-To: <cfabcdc7-baff-82d8-2b24-5a18a9c50441@xs4all.nl>

On Mon, 3 Jun 2019 14:45:37 +0200
Hans Verkuil <hverkuil@xs4all.nl> wrote:

> On 5/31/19 10:55 AM, Philipp Zabel wrote:
> > For now this just enables MPEG-2 decoding on the Hantro G1 on i.MX8MQ.
> > 
> > Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
> > ---
> > Changes since v2 [1]:
> >  - Adapted to changes in patches 4 and 5
> > 
> > [1] https://patchwork.linuxtv.org/patch/56420/
> > ---
> >  drivers/staging/media/hantro/Kconfig        |   8 +-
> >  drivers/staging/media/hantro/Makefile       |   1 +
> >  drivers/staging/media/hantro/hantro_drv.c   |   1 +
> >  drivers/staging/media/hantro/hantro_hw.h    |   1 +
> >  drivers/staging/media/hantro/imx8m_vpu_hw.c | 171 ++++++++++++++++++++
> >  5 files changed, 178 insertions(+), 4 deletions(-)
> >  create mode 100644 drivers/staging/media/hantro/imx8m_vpu_hw.c
> > 
> > diff --git a/drivers/staging/media/hantro/Kconfig b/drivers/staging/media/hantro/Kconfig
> > index 660cca358f04..6fdb72df7bd3 100644
> > --- a/drivers/staging/media/hantro/Kconfig
> > +++ b/drivers/staging/media/hantro/Kconfig
> > @@ -1,15 +1,15 @@
> >  # SPDX-License-Identifier: GPL-2.0
> >  config VIDEO_HANTRO
> >  	tristate "Hantro VPU driver"
> > -	depends on ARCH_ROCKCHIP || COMPILE_TEST
> > +	depends on ARCH_MXC || ARCH_ROCKCHIP || COMPILE_TEST
> >  	depends on VIDEO_DEV && VIDEO_V4L2 && MEDIA_CONTROLLER
> >  	depends on MEDIA_CONTROLLER_REQUEST_API
> >  	select VIDEOBUF2_DMA_CONTIG
> >  	select VIDEOBUF2_VMALLOC
> >  	select V4L2_MEM2MEM_DEV
> >  	help
> > -	  Support for the Hantro IP based Video Processing Unit present on
> > -	  Rockchip SoC, which accelerates video and image encoding and
> > -	  decoding.
> > +	  Support for the Hantro IP based Video Processing Units present on
> > +	  Rockchip and NXP i.MX8M SoCs, which accelerate video and image
> > +	  encoding and decoding.
> >  	  To compile this driver as a module, choose M here: the module
> >  	  will be called hantro-vpu.
> > diff --git a/drivers/staging/media/hantro/Makefile b/drivers/staging/media/hantro/Makefile
> > index 14f17a4e48cb..1dac16af451e 100644
> > --- a/drivers/staging/media/hantro/Makefile
> > +++ b/drivers/staging/media/hantro/Makefile
> > @@ -9,5 +9,6 @@ hantro-vpu-y += \
> >  		rk3399_vpu_hw.o \
> >  		rk3399_vpu_hw_jpeg_enc.o \
> >  		rk3399_vpu_hw_mpeg2_dec.o \
> > +		imx8m_vpu_hw.o \
> >  		hantro_jpeg.o \
> >  		hantro_mpeg2.o  
> 
> I'm a bit concerned about how this is organized. As far as I can tell,
> enabling this driver would compile both rockchip and imx8 code into the
> same driver. You would expect that only the code for the selected
> architectures would be compiled in (or all if COMPILE_TEST is set, of course).
> 
> Can you take a look at this?

Shouldn't be hard to do:

config VIDEO_HANTRO
	tristate "Hantro VPU driver"
	...

config VIDEO_HANTRO_ROCKCHIP
	bool "Rockchip Hantro VPU driver"
	depends on ARCH_ROCKCHIP || COMPILE_TEST
	depends on VIDEO_HANTRO
	...

config VIDEO_HANTRO_IMX8
	bool "IMX8 Hantro VPU driver"
	depends on ARCH_IMX || COMPILE_TEST
	depends on VIDEO_HANTRO
	...

hantro-vpu-$(VIDEO_HANTRO_RK3288)	+= rkxxxx...
hantro-vpu-$(VIDEO_HANTRO_IMX8)		+= imx8...

and a couple of #ifdef in rockchip_vpu_drv.c.

This being said, I think most of the code in the SoC specific files
could be shared if we find a way to abstract the reg layout (using
regmap/reg_field?), leaving a small amount of SoC-specific code, so I'm
not sure it's a big deal if have support for all SoCs compiled in. What
could be a problem though is if each SoC starts pulling its own set of
dependencies.

  reply	other threads:[~2019-06-03 20:03 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-31  8:55 [PATCH v3 00/10] Rename Rockchip VPU driver to Hantro, add initial i.MX8M support Philipp Zabel
2019-05-31  8:55 ` [PATCH v3 01/10] rockchip/vpu: rename from rockchip to hantro Philipp Zabel
2019-06-05 11:22   ` Boris Brezillon
2019-06-06 15:06     ` Boris Brezillon
2019-06-11 11:51       ` Philipp Zabel
2019-05-31  8:55 ` [PATCH v3 02/10] media: hantro: print video device name in addition to device node Philipp Zabel
2019-05-31  8:55 ` [PATCH v3 03/10] media: hantro: add PM runtime resume callback Philipp Zabel
2019-05-31  8:55 ` [PATCH v3 04/10] media: hantro: make irq names configurable Philipp Zabel
2019-06-01  9:07   ` Boris Brezillon
2019-05-31  8:55 ` [PATCH v3 05/10] media: hantro: add support for named register ranges Philipp Zabel
2019-06-01  9:14   ` Boris Brezillon
2019-05-31  8:55 ` [PATCH v3 06/10] media: hantro: add support for separate control block Philipp Zabel
2019-06-01  9:16   ` Boris Brezillon
2019-05-31  8:55 ` [PATCH v3 07/10] media: dt-bindings: Document i.MX8MQ and i.MX8MM VPU bindings Philipp Zabel
2019-06-01  9:18   ` Boris Brezillon
2019-06-11 12:44     ` Philipp Zabel
2019-05-31  8:55 ` [PATCH v3 08/10] media: hantro: add initial i.MX8MQ support Philipp Zabel
2019-06-03 12:45   ` Hans Verkuil
2019-06-03 20:02     ` Boris Brezillon [this message]
2019-06-04 10:42       ` Hans Verkuil
2019-06-11 11:55         ` Philipp Zabel
2019-12-01  2:16           ` Adam Ford
2019-05-31  8:55 ` [PATCH v3 09/10] media: hantro: add initial i.MX8MM support (untested) Philipp Zabel
2019-06-03 12:54   ` Hans Verkuil
2019-06-03 18:59     ` Nicolas Dufresne
2019-06-03 18:59       ` Nicolas Dufresne
2019-06-11 11:52     ` Philipp Zabel
2019-05-31  8:55 ` [PATCH v3 10/10] media: hantro: allow arbitrary number of clocks Philipp Zabel
2019-06-01  9:23   ` Boris Brezillon
2019-06-03 12:40   ` Hans Verkuil

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=20190603220256.1922901a@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).