From: Frank Li <Frank.li@oss.nxp.com>
To: Atanas Filipov <atanas.filipov@oss.qualcomm.com>
Cc: linux-media@vger.kernel.org, mchehab@kernel.org, bod@kernel.org,
robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org,
andersson@kernel.org, konradybcio@kernel.org,
linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 4/4] media: qcom: jpeg: Add Qualcomm JPEG V4L2 encoder
Date: Fri, 12 Jun 2026 16:53:51 -0400 [thread overview]
Message-ID: <aixx35f-1yp03-c2@lizhi-Precision-Tower-5810> (raw)
In-Reply-To: <20260612194417.1737009-5-atanas.filipov@oss.qualcomm.com>
On Fri, Jun 12, 2026 at 10:44:17PM +0300, Atanas Filipov wrote:
> Add a Qualcomm JPEG encoder driver implemented on top of the
> V4L2 mem2mem framework.
>
> The driver wires vb2 queue handling, format negotiation, JPEG header
> handling, interrupt-driven job completion, and runtime PM/clock/ICC
> integration for the standalone JPEG encode hardware block.
>
> Initial support in this series targets SM8250, QCM6490, and SM8550
> class platforms.
>
> Signed-off-by: Atanas Filipov <atanas.filipov@oss.qualcomm.com>
> ---
...
> +
> +static __maybe_unused int qcom_jpeg_pm_suspend(struct device *dev)
new API needn't __maybe_unused, check below
> +{
> + struct qcom_jenc_dev *jenc = dev_get_drvdata(dev);
> +
> + qcom_jpeg_clk_off(jenc);
> +
> + qcom_jpeg_icc_off(jenc);
> +
> + return 0;
> +}
> +
...
> +static const struct dev_pm_ops qcom_jpeg_pm_ops = {
> + SET_SYSTEM_SLEEP_PM_OPS(qcom_jpeg_suspend, qcom_jpeg_resume)
> + SET_RUNTIME_PM_OPS(qcom_jpeg_pm_suspend, qcom_jpeg_pm_resume, NULL)
use new macro RUNTIME_PM_OPS
> +};
> +
> +static int qcom_jpeg_probe(struct platform_device *pdev)
> +{
> + const struct qcom_dev_resources *res;
> + struct qcom_jenc_dev *jenc;
> + int rc;
> +
> + jenc = devm_kzalloc(&pdev->dev, sizeof(*jenc), GFP_KERNEL);
> + if (!jenc)
> + return -ENOMEM;
> +
> + jenc->dev = &pdev->dev;
> + mutex_init(&jenc->dev_mutex);
devm_mutex_init();
> + spin_lock_init(&jenc->hw_lock);
> + init_completion(&jenc->reset_complete);
> + init_completion(&jenc->stop_complete);
> +
> + res = device_get_match_data(jenc->dev);
> + if (!res)
> + return dev_err_probe(jenc->dev, -ENODEV, "unsupported SoC\n");
> + jenc->res = res;
> +
> + if (!jenc->res->hw_offs || !jenc->res->hw_ops)
> + return dev_err_probe(jenc->dev, -EINVAL, "missing hw resources\n");
> +
> + rc = dma_set_mask_and_coherent(jenc->dev, DMA_BIT_MASK(32));
when mask >= 32, needn't check return value.
> + if (rc)
> + return dev_err_probe(jenc->dev, rc, "failed to set DMA mask\n");
> +
> + jenc->jpeg_base = devm_platform_ioremap_resource_byname(pdev, "jpeg");
> + if (IS_ERR(jenc->jpeg_base))
> + return dev_err_probe(jenc->dev, PTR_ERR(jenc->jpeg_base),
> + "failed to map JPEG resource\n");
> +
> + rc = qcom_jpeg_clk_init(jenc);
> + if (rc)
> + return rc;
> +
> + jenc->irq = platform_get_irq(pdev, 0);
> + if (jenc->irq < 0)
> + return dev_err_probe(jenc->dev, jenc->irq, "failed to get IRQ\n");
> +
> + rc = devm_request_threaded_irq(jenc->dev, jenc->irq,
> + jenc->res->hw_ops->hw_irq_top,
> + jenc->res->hw_ops->hw_irq_bot,
> + IRQF_ONESHOT, dev_name(jenc->dev), jenc);
> + if (rc)
> + return dev_err_probe(jenc->dev, rc, "failed to request IRQ\n");
> +
> + rc = qcom_jpeg_icc_init(jenc);
> + if (rc)
> + return rc;
> +
> + rc = v4l2_device_register(jenc->dev, &jenc->v4l2_dev);
> + if (rc) {
> + dev_err(jenc->dev, "failed to register V4L2 device\n");
> + return rc;
> + }
> +
> + jenc->perf = QCOM_SOC_PERF_NOMINAL;
> +
> + rc = qcom_jpeg_v4l2_register(jenc);
> + if (rc) {
> + dev_err(jenc->dev, "failed to register video device\n");
> + goto err_v4l2_device_unregister;
> + }
> +
> + rc = devm_pm_runtime_enable(jenc->dev);
> + if (rc)
> + goto err_v4l2_unregister;
> +
> + dev_dbg(jenc->dev, "Qualcomm JPEG encoder registered\n");
> +
> + platform_set_drvdata(pdev, jenc);
It's better set at early phrase, include some async function use it.
> +
> + return 0;
> +
> +err_v4l2_unregister:
> + qcom_jpeg_v4l2_unregister(jenc);
> +err_v4l2_device_unregister:
> + v4l2_device_unregister(&jenc->v4l2_dev);
> + return rc;
> +}
> +
> +static void qcom_jpeg_remove(struct platform_device *pdev)
> +{
> + struct qcom_jenc_dev *jenc = platform_get_drvdata(pdev);
> +
> + qcom_jpeg_v4l2_unregister(jenc);
> +
> + v4l2_device_unregister(&jenc->v4l2_dev);
> +
> + dev_dbg(jenc->dev, "Qualcomm JPEG encoder deregistered\n");
> +}
> +
> +static const struct of_device_id qcom_jpeg_of_match[] = {
> + {
> + .compatible = "qcom,sm8250-jenc",
> + .data = &qcom_t165_t480_jpeg_drvdata
> + },
> + {
> + .compatible = "qcom,qcm6490-jenc",
> + .data = &qcom_t680_jpeg_drvdata
> + },
> + {
> + .compatible = "qcom,sm8550-jenc",
> + .data = &qcom_t780_jpeg_drvdata
> + },
> + { }
> +};
> +MODULE_DEVICE_TABLE(of, qcom_jpeg_of_match);
> +
> +static struct platform_driver qcom_jpeg_platform_driver = {
> + .probe = qcom_jpeg_probe,
> + .remove = qcom_jpeg_remove,
> + .driver = {
> + .name = QCOM_JPEG_ENC_NAME,
> + .of_match_table = qcom_jpeg_of_match,
> + .pm = &qcom_jpeg_pm_ops,
pm_ptr(&qcom_jpeg_pm_ops)
Frank
> + },
> +};
> +
next prev parent reply other threads:[~2026-06-12 20:54 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-12 19:44 [PATCH v1 0/4] This series adds support for the Qualcomm JPEG V4L2 mem2mem encoder Atanas Filipov
2026-06-12 19:44 ` [PATCH v1 1/4] dt-bindings: media: qcom: Add JPEG encoder binding Atanas Filipov
2026-06-12 20:42 ` Frank Li
2026-06-12 23:17 ` Bryan O'Donoghue
2026-06-12 23:38 ` Bryan O'Donoghue
2026-06-13 18:42 ` Krzysztof Kozlowski
2026-07-13 7:43 ` Atanas Filipov
2026-06-23 6:41 ` Luca Weiss
2026-06-12 19:44 ` [PATCH v1 2/4] arm64: dts: qcom: sm8550: Add JPEG encoder node Atanas Filipov
2026-06-12 23:14 ` Bryan O'Donoghue
2026-06-13 9:24 ` Atanas Filipov
2026-06-13 9:52 ` Bryan O'Donoghue
2026-06-13 11:16 ` Atanas Filipov
2026-06-14 1:13 ` Bryan O'Donoghue
2026-06-19 14:38 ` Konrad Dybcio
2026-06-19 14:57 ` Vladimir Zapolskiy
2026-06-12 23:52 ` Bryan O'Donoghue
2026-06-13 16:05 ` Atanas Filipov
2026-06-14 0:53 ` Bryan O'Donoghue
2026-06-14 21:28 ` Dmitry Baryshkov
2026-06-12 19:44 ` [PATCH v1 3/4] arm64: dts: qcom: sm8250: " Atanas Filipov
2026-06-12 19:44 ` [PATCH v1 4/4] media: qcom: jpeg: Add Qualcomm JPEG V4L2 encoder Atanas Filipov
2026-06-12 20:53 ` Frank Li [this message]
2026-06-13 18:43 ` Krzysztof Kozlowski
2026-07-13 7:50 ` Atanas Filipov
2026-06-25 13:43 ` [PATCH v1 0/4] This series adds support for the Qualcomm JPEG V4L2 mem2mem encoder Atanas Filipov
2026-06-25 13:53 ` Krzysztof Kozlowski
2026-07-13 7:52 ` Atanas Filipov
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=aixx35f-1yp03-c2@lizhi-Precision-Tower-5810 \
--to=frank.li@oss.nxp.com \
--cc=andersson@kernel.org \
--cc=atanas.filipov@oss.qualcomm.com \
--cc=bod@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=konradybcio@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=robh@kernel.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
all inboxes | Powered by JetHome®