linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hugues FRUCHET <hugues.fruchet@foss.st.com>
To: Sebastian Fricke <sebastian.fricke@collabora.com>
Cc: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	Andrzej Pietrasiewicz <andrzej.p@collabora.com>,
	Nicolas Dufresne <nicolas.dufresne@collabora.com>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	Benjamin Gaignard <benjamin.gaignard@collabora.com>,
	Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>,
	Daniel Almeida <daniel.almeida@collabora.com>,
	Benjamin Mugnier <benjamin.mugnier@foss.st.com>,
	Heiko Stuebner <heiko@sntech.de>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Hans Verkuil <hverkuil@xs4all.nl>, <linux-media@vger.kernel.org>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Alexandre Torgue <alexandre.torgue@foss.st.com>,
	<linux-stm32@st-md-mailman.stormreply.com>,
	Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Conor Dooley <conor+dt@kernel.org>, <devicetree@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>,
	<linux-rockchip@lists.infradead.org>,
	Marco Felsch <m.felsch@pengutronix.de>,
	Adam Ford <aford173@gmail.com>
Subject: Re: [PATCH v5 3/5] media: hantro: add support for STM32MP25 VENC
Date: Thu, 21 Dec 2023 14:05:01 +0100	[thread overview]
Message-ID: <70ed583e-af57-43e5-91a4-daa0568e83ab@foss.st.com> (raw)
In-Reply-To: <20231221111837.4u22pmba7jd3hinj@basti-XPS-13-9310>

Hi Sebastian,

Yes, feel free to fix the two comments !

BR,
Hugues.

On 12/21/23 12:18, Sebastian Fricke wrote:
> Hey Hugues,
> 
> one small comment below, if it should turn out to be the only problem I
> can fix it myself for the pull request.
> 
> On 21.12.2023 09:47, Hugues Fruchet wrote:
>> Add support for STM32MP25 VENC video hardware encoder.
>> Support of JPEG encoding.
>> VENC has its own reset/clock/irq.
>>
>> Signed-off-by: Hugues Fruchet <hugues.fruchet@foss.st.com>
>> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
>> ---
>> drivers/media/platform/verisilicon/Makefile   |   3 +-
>> .../media/platform/verisilicon/hantro_drv.c   |   1 +
>> .../media/platform/verisilicon/hantro_hw.h    |   1 +
>> .../platform/verisilicon/stm32mp25_venc_hw.c  | 115 ++++++++++++++++++
>> 4 files changed, 119 insertions(+), 1 deletion(-)
>> create mode 100644 drivers/media/platform/verisilicon/stm32mp25_venc_hw.c
>>
>> diff --git a/drivers/media/platform/verisilicon/Makefile 
>> b/drivers/media/platform/verisilicon/Makefile
>> index 5854e0f0dd32..3bf43fdbedc1 100644
>> --- a/drivers/media/platform/verisilicon/Makefile
>> +++ b/drivers/media/platform/verisilicon/Makefile
>> @@ -41,4 +41,5 @@ hantro-vpu-$(CONFIG_VIDEO_HANTRO_SUNXI) += \
>>         sunxi_vpu_hw.o
>>
>> hantro-vpu-$(CONFIG_VIDEO_HANTRO_STM32MP25) += \
>> -        stm32mp25_vdec_hw.o
>> +        stm32mp25_vdec_hw.o \
>> +        stm32mp25_venc_hw.o
>> diff --git a/drivers/media/platform/verisilicon/hantro_drv.c 
>> b/drivers/media/platform/verisilicon/hantro_drv.c
>> index 2db27c333924..4d97a8ac03de 100644
>> --- a/drivers/media/platform/verisilicon/hantro_drv.c
>> +++ b/drivers/media/platform/verisilicon/hantro_drv.c
>> @@ -736,6 +736,7 @@ static const struct of_device_id of_hantro_match[] 
>> = {
>> #endif
>> #ifdef CONFIG_VIDEO_HANTRO_STM32MP25
>>     { .compatible = "st,stm32mp25-vdec", .data = 
>> &stm32mp25_vdec_variant, },
>> +    { .compatible = "st,stm32mp25-venc", .data = 
>> &stm32mp25_venc_variant, },
>> #endif
>>     { /* sentinel */ }
>> };
>> diff --git a/drivers/media/platform/verisilicon/hantro_hw.h 
>> b/drivers/media/platform/verisilicon/hantro_hw.h
>> index b7eccc1a96fc..70c72e9d11d5 100644
>> --- a/drivers/media/platform/verisilicon/hantro_hw.h
>> +++ b/drivers/media/platform/verisilicon/hantro_hw.h
>> @@ -407,6 +407,7 @@ extern const struct hantro_variant 
>> rk3588_vpu981_variant;
>> extern const struct hantro_variant sama5d4_vdec_variant;
>> extern const struct hantro_variant sunxi_vpu_variant;
>> extern const struct hantro_variant stm32mp25_vdec_variant;
>> +extern const struct hantro_variant stm32mp25_venc_variant;
>>
>> extern const struct hantro_postproc_ops hantro_g1_postproc_ops;
>> extern const struct hantro_postproc_ops hantro_g2_postproc_ops;
>> diff --git a/drivers/media/platform/verisilicon/stm32mp25_venc_hw.c 
>> b/drivers/media/platform/verisilicon/stm32mp25_venc_hw.c
>> new file mode 100644
>> index 000000000000..0ff0f073b922
>> --- /dev/null
>> +++ b/drivers/media/platform/verisilicon/stm32mp25_venc_hw.c
>> @@ -0,0 +1,115 @@
>> +// SPDX-License-Identifier: GPL-2.0
>> +/*
>> + * STM32MP25 VENC video encoder driver
>> + *
>> + * Copyright (C) STMicroelectronics SA 2022
>> + * Authors: Hugues Fruchet <hugues.fruchet@foss.st.com>
>> + *          for STMicroelectronics.
>> + *
>> + */
>> +
>> +#include <linux/clk.h>
>> +#include <linux/delay.h>
>> +#include <linux/reset.h>
>> +
>> +#include "hantro.h"
>> +#include "hantro_jpeg.h"
>> +#include "hantro_h1_regs.h"
>> +
>> +/*
>> + * Supported formats.
>> + */
>> +
>> +static const struct hantro_fmt stm32mp25_venc_fmts[] = {
>> +    {
>> +        .fourcc = V4L2_PIX_FMT_YUV420M,
>> +        .codec_mode = HANTRO_MODE_NONE,
>> +        .enc_fmt = ROCKCHIP_VPU_ENC_FMT_YUV420P,
>> +    },
>> +    {
>> +        .fourcc = V4L2_PIX_FMT_NV12M,
>> +        .codec_mode = HANTRO_MODE_NONE,
>> +        .enc_fmt = ROCKCHIP_VPU_ENC_FMT_YUV420SP,
>> +    },
>> +    {
>> +        .fourcc = V4L2_PIX_FMT_YUYV,
>> +        .codec_mode = HANTRO_MODE_NONE,
>> +        .enc_fmt = ROCKCHIP_VPU_ENC_FMT_YUYV422,
>> +    },
>> +    {
>> +        .fourcc = V4L2_PIX_FMT_UYVY,
>> +        .codec_mode = HANTRO_MODE_NONE,
>> +        .enc_fmt = ROCKCHIP_VPU_ENC_FMT_UYVY422,
>> +    },
>> +    {
>> +        .fourcc = V4L2_PIX_FMT_JPEG,
>> +        .codec_mode = HANTRO_MODE_JPEG_ENC,
>> +        .max_depth = 2,
>> +        .header_size = JPEG_HEADER_SIZE,
>> +        .frmsize = {
>> +            .min_width = 96,
>> +            .max_width = FMT_4K_WIDTH,
>> +            .step_width = MB_DIM,
>> +            .min_height = 96,
>> +            .max_height = FMT_4K_HEIGHT,
>> +            .step_height = MB_DIM,
>> +        },
>> +    },
>> +};
>> +
>> +static irqreturn_t stm32mp25_venc_irq(int irq, void *dev_id)
>> +{
>> +    struct hantro_dev *vpu = dev_id;
>> +    enum vb2_buffer_state state;
>> +    u32 status;
>> +
>> +    status = vepu_read(vpu, H1_REG_INTERRUPT);
>> +    state = (status & H1_REG_INTERRUPT_FRAME_RDY) ?
>> +        VB2_BUF_STATE_DONE : VB2_BUF_STATE_ERROR;
>> +
>> +    vepu_write(vpu, H1_REG_INTERRUPT_BIT, H1_REG_INTERRUPT);
>> +
>> +    hantro_irq_done(vpu, state);
>> +
>> +    return IRQ_HANDLED;
>> +}
>> +
>> +static void stm32mp25_venc_reset(struct hantro_ctx *ctx)
>> +{
>> +}
>> +
>> +/*
>> + * Supported codec ops.
>> + */
>> +
>> +static const struct hantro_codec_ops stm32mp25_venc_codec_ops[] = {
>> +    [HANTRO_MODE_JPEG_ENC] = {
>> +        .run = hantro_h1_jpeg_enc_run,
>> +        .reset = stm32mp25_venc_reset,
>> +        .done = hantro_h1_jpeg_enc_done,
>> +    },
>> +};
>> +
>> +/*
>> + * Variants.
>> + */
>> +
>> +static const struct hantro_irq stm32mp25_venc_irqs[] = {
>> +    { "venc", stm32mp25_venc_irq },
>> +};
>> +
>> +static const char * const stm32mp25_venc_clk_names[] = {
>> +    "venc-clk"
>> +};
>> +
>> +const struct hantro_variant stm32mp25_venc_variant = {
>> +    .enc_fmts = stm32mp25_venc_fmts,
>> +    .num_enc_fmts = ARRAY_SIZE(stm32mp25_venc_fmts),
>> +    .codec = HANTRO_JPEG_ENCODER,
>> +    .codec_ops = stm32mp25_venc_codec_ops,
>> +    .irqs = stm32mp25_venc_irqs,
>> +    .num_irqs = ARRAY_SIZE(stm32mp25_venc_irqs),
>> +    .clk_names = stm32mp25_venc_clk_names,
>> +    .num_clocks = ARRAY_SIZE(stm32mp25_venc_clk_names)
>> +};
>> +
> 
> There is an superfluous new line here.
> 
> Greetings,
> Sebastian
> 
>> -- 
>> 2.25.1
>>
>>

  reply	other threads:[~2023-12-21 13:05 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-21  8:47 [PATCH v5 0/5] Add support for video hardware codec of STMicroelectronics STM32 SoC series Hugues Fruchet
2023-12-21  8:47 ` [PATCH v5 1/5] dt-bindings: media: Document STM32MP25 VDEC & VENC video codecs Hugues Fruchet
2023-12-21  9:08   ` Krzysztof Kozlowski
2023-12-21  8:47 ` [PATCH v5 2/5] media: hantro: add support for STM32MP25 VDEC Hugues Fruchet
2023-12-21 11:18   ` Sebastian Fricke
2023-12-21  8:47 ` [PATCH v5 3/5] media: hantro: add support for STM32MP25 VENC Hugues Fruchet
2023-12-21 11:18   ` Sebastian Fricke
2023-12-21 13:05     ` Hugues FRUCHET [this message]
2023-12-21  8:47 ` [PATCH v5 4/5] arm64: dts: st: add video decoder support to stm32mp255 Hugues Fruchet
2023-12-21  8:47 ` [PATCH v5 5/5] arm64: dts: st: add video encoder " Hugues Fruchet
2023-12-21 12:40 ` [PATCH v5 0/5] Add support for video hardware codec of STMicroelectronics STM32 SoC series Alex Bee
2023-12-21 13:08   ` Hugues FRUCHET
2023-12-21 13:31     ` Alex Bee
2023-12-21 13:38       ` Adam Ford
2023-12-21 13:46         ` Alex Bee
2023-12-21 13:55           ` Hugues FRUCHET
2023-12-21 14:18             ` Alex Bee
2024-01-09  9:24       ` Hugues FRUCHET

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=70ed583e-af57-43e5-91a4-daa0568e83ab@foss.st.com \
    --to=hugues.fruchet@foss.st.com \
    --cc=aford173@gmail.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=andrzej.p@collabora.com \
    --cc=benjamin.gaignard@collabora.com \
    --cc=benjamin.mugnier@foss.st.com \
    --cc=conor+dt@kernel.org \
    --cc=daniel.almeida@collabora.com \
    --cc=devicetree@vger.kernel.org \
    --cc=ezequiel@vanguardiasur.com.ar \
    --cc=heiko@sntech.de \
    --cc=hverkuil@xs4all.nl \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=laurent.pinchart+renesas@ideasonboard.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=m.felsch@pengutronix.de \
    --cc=mchehab@kernel.org \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=nicolas.dufresne@collabora.com \
    --cc=p.zabel@pengutronix.de \
    --cc=robh+dt@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=sebastian.fricke@collabora.com \
    /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).