From: Paul Kocialkowski <paul.kocialkowski-LDxbnhwyfcJBDgjK7y7TUQ@public.gmane.org>
To: Maxime Ripard <maxime.ripard-LDxbnhwyfcJBDgjK7y7TUQ@public.gmane.org>
Cc: linux-media-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org,
Icenowy Zheng <icenowy-ymACFijhrKM@public.gmane.org>,
Florent Revest
<revestflo-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Alexandre Courbot
<acourbot-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>,
Hans Verkuil
<hans.verkuil-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org>,
Laurent Pinchart
<laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>,
Sakari Ailus
<sakari.ailus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>,
Thomas van Kleef <thomas-XCRq7eEM0/pmR6Xm/wNWPw@public.gmane.org>,
"Signed-off-by : Bob Ham"
<rah-2mWpNWY8JZLk1uMJSBkQmQ@public.gmane.org>,
Thomas Petazzoni
<thomas.petazzoni-LDxbnhwyfcJBDgjK7y7TUQ@public.gmane.org>,
Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
Subject: Re: [PATCH 5/9] media: platform: Add Sunxi Cedrus decoder driver
Date: Thu, 19 Apr 2018 16:58:18 +0200 [thread overview]
Message-ID: <d2df04bd29b040001577d3bb905c81b3aff8f594.camel@bootlin.com> (raw)
In-Reply-To: <20180309135702.pk4webt7xnj7lrza@flea>
[-- Attachment #1: Type: text/plain, Size: 3063 bytes --]
Hi and thanks for the review,
On Fri, 2018-03-09 at 14:57 +0100, Maxime Ripard wrote:
> On Fri, Mar 09, 2018 at 11:14:41AM +0100, Paul Kocialkowski wrote:
> > +/*
> > + * mem2mem callbacks
> > + */
> > +
> > +void job_abort(void *priv)
> > +{}
>
> Is that still needed?
v2 contains a proper implementation of job abortion, so yes :)
> > +/*
> > + * device_run() - prepares and starts processing
> > + */
> > +void device_run(void *priv)
> > +{
>
> This function (and the one above) should probably made static. Or at
> least if you can't, they should have a much more specific name in
> order not to conflict with anything from the core.
Agreed, will fix in v2.
> > + /*
> > + * The VPU is only able to handle bus addresses so we have
> > to subtract
> > + * the RAM offset to the physcal addresses
> > + */
> > + in_buf -= PHYS_OFFSET;
> > + out_luma -= PHYS_OFFSET;
> > + out_chroma -= PHYS_OFFSET;
>
> You should take care of that by putting it in the dma_pfn_offset field
> of the struct device (at least before we come up with something
> better).
>
> You'll then be able to use the dma_addr_t directly without modifying
> it.
Ditto.
> > + vpu->syscon = syscon_regmap_lookup_by_phandle(vpu->dev-
> > >of_node,
> > + "syscon");
> > + if (IS_ERR(vpu->syscon)) {
> > + vpu->syscon = NULL;
> > + } else {
> > + regmap_write_bits(vpu->syscon,
> > SYSCON_SRAM_CTRL_REG0,
> > + SYSCON_SRAM_C1_MAP_VE,
> > + SYSCON_SRAM_C1_MAP_VE);
> > + }
>
> This should be using our SRAM controller driver (and API), see
> Documentation/devicetree/bindings/sram/sunxi-sram.txt
> include/linux/soc/sunxi/sunxi_sram.h
This will require adding support for the VE (and the A33 along the way)
in the SRAM driver, so a dedicated patch series will be sent in this
direction eventually.
> > + ret = clk_prepare_enable(vpu->ahb_clk);
> > + if (ret) {
> > + dev_err(vpu->dev, "could not enable ahb clock\n");
> > + return -EFAULT;
> > + }
> > + ret = clk_prepare_enable(vpu->mod_clk);
> > + if (ret) {
> > + clk_disable_unprepare(vpu->ahb_clk);
> > + dev_err(vpu->dev, "could not enable mod clock\n");
> > + return -EFAULT;
> > + }
> > + ret = clk_prepare_enable(vpu->ram_clk);
> > + if (ret) {
> > + clk_disable_unprepare(vpu->mod_clk);
> > + clk_disable_unprepare(vpu->ahb_clk);
> > + dev_err(vpu->dev, "could not enable ram clock\n");
> > + return -EFAULT;
> > + }
>
> Ideally, this should be using runtime_pm to manage the device power
> state, and disable it when not used.
>
> > + reset_control_assert(vpu->rstc);
> > + reset_control_deassert(vpu->rstc);
>
> You can use reset_control_reset here
Will do in v2.
> > + return 0;
> > +}
> > +
> > +void sunxi_cedrus_hw_remove(struct sunxi_cedrus_dev *vpu)
> > +{
> > + clk_disable_unprepare(vpu->ram_clk);
> > + clk_disable_unprepare(vpu->mod_clk);
> > + clk_disable_unprepare(vpu->ahb_clk);
>
> The device is not put back into reset here
Good catch!
Cheers,
--
Paul Kocialkowski, Bootlin (formerly Free Electrons)
Embedded Linux and kernel engineering
https://bootlin.com
next prev parent reply other threads:[~2018-04-19 14:58 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-09 10:09 [PATCH 0/9] Sunxi-Cedrus driver for the Allwinner Video Engine, using the V4L2 request API Paul Kocialkowski
2018-03-09 10:09 ` [PATCH 1/9] media: vim2m: Try to schedule a m2m device run on request submission Paul Kocialkowski
2018-03-09 10:09 ` [PATCH 2/9] media: videobuf2-v4l2: Copy planes when needed in request qbuf Paul Kocialkowski
2018-03-09 10:14 ` [PATCH 3/9] v4l: Add sunxi Video Engine pixel format Paul Kocialkowski
2018-03-09 10:14 ` [PATCH 4/9] v4l: Add MPEG2 low-level decoder API control Paul Kocialkowski
2018-03-09 10:14 ` [PATCH 5/9] media: platform: Add Sunxi Cedrus decoder driver Paul Kocialkowski
2018-03-09 13:57 ` Maxime Ripard
2018-03-09 14:25 ` Paul Kocialkowski
2018-04-19 14:58 ` Paul Kocialkowski [this message]
[not found] ` <20180309101445.16190-3-paul.kocialkowski-LDxbnhwyfcJBDgjK7y7TUQ@public.gmane.org>
2018-03-12 17:15 ` Joonas Kylmälä
[not found] ` <a133f4f9-8b99-323f-5e57-c2c6966d3ecb-X3B1VOXEql0@public.gmane.org>
2018-04-19 14:56 ` Paul Kocialkowski
2018-03-12 20:29 ` Joonas Kylmälä
[not found] ` <a9cc2e3b-585a-b238-4187-e3c874013d2a-X3B1VOXEql0@public.gmane.org>
2018-04-19 14:56 ` Paul Kocialkowski
2018-03-09 10:14 ` [PATCH 6/9] sunxi-cedrus: Add device tree binding document Paul Kocialkowski
[not found] ` <20180309101445.16190-4-paul.kocialkowski-LDxbnhwyfcJBDgjK7y7TUQ@public.gmane.org>
2018-03-09 13:38 ` Priit Laes
2018-03-09 13:45 ` [linux-sunxi] " Paul Kocialkowski
2018-03-18 12:48 ` Rob Herring
2018-04-19 14:55 ` Paul Kocialkowski
2018-03-09 10:14 ` [PATCH 7/9] ARM: dts: sun5i: Use video-engine node Paul Kocialkowski
2018-03-09 10:14 ` [PATCH 8/9] ARM: dts: sun8i: add video engine support for A33 Paul Kocialkowski
2018-03-09 10:14 ` [PATCH 9/9] ARM: dts: sun7i: Add video engine support for the A20 Paul Kocialkowski
[not found] ` <20180309100933.15922-3-paul.kocialkowski-LDxbnhwyfcJBDgjK7y7TUQ@public.gmane.org>
2018-03-12 18:18 ` [PATCH 2/9] media: videobuf2-v4l2: Copy planes when needed in request qbuf Joonas Kylmälä
2018-03-09 10:18 ` [PATCH 0/9] Sunxi-Cedrus driver for the Allwinner Video Engine, using the V4L2 request API Paul Kocialkowski
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=d2df04bd29b040001577d3bb905c81b3aff8f594.camel@bootlin.com \
--to=paul.kocialkowski-ldxbnhwyfcjbdgjk7y7tuq@public.gmane.org \
--cc=acourbot-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=hans.verkuil-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org \
--cc=icenowy-ymACFijhrKM@public.gmane.org \
--cc=laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-media-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
--cc=maxime.ripard-LDxbnhwyfcJBDgjK7y7TUQ@public.gmane.org \
--cc=rah-2mWpNWY8JZLk1uMJSBkQmQ@public.gmane.org \
--cc=revestflo-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=sakari.ailus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
--cc=thomas-XCRq7eEM0/pmR6Xm/wNWPw@public.gmane.org \
--cc=thomas.petazzoni-LDxbnhwyfcJBDgjK7y7TUQ@public.gmane.org \
--cc=wens-jdAy2FN1RRM@public.gmane.org \
/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).