From patchwork Sun Oct 31 11:25:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 12594989 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 31319C433EF for ; Sun, 31 Oct 2021 11:25:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 10D5261051 for ; Sun, 31 Oct 2021 11:25:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231145AbhJaL1i (ORCPT ); Sun, 31 Oct 2021 07:27:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:47130 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229697AbhJaL1i (ORCPT ); Sun, 31 Oct 2021 07:27:38 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4D18F60F58; Sun, 31 Oct 2021 11:25:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1635679506; bh=/ba630/yMxIG0G/HrfuOl0TTd12zVAhW+3p5jt4O1qg=; h=From:To:Cc:Subject:Date:From; b=oc2RO08dPHGJIm4glq6KAAnyX1wJ3BcD1+WsaqgNw7C5s7sWu6Qf4EUW2Vm6UsAsn QV2meBXVjguJoYt5SVMRQ1eoRT2pyC31iglV8D5F6Pkqg4/36ERdF7S/B6vdd8BsTg 1gO8Nn8NZsVCHFf6ZF/ii+64U7GyKjRUqsCbIMP/6erYsHzEfiSTT8CUDZcCekLiA3 /wDiP/+hf7Vq0OygRfpYk7Tke8GXHhvWOo7z4OkDjWm0D20Myxqsi3+Zns0U8bg9ST P1bOAn/Ircmq2S55sgWZNYpKDJfq45eyq/V/O7qUc8oRtZ3c5nY9z7fiplI4UsLq3v TKJh1orqxpkrw== Received: by mail.kernel.org with local (Exim 4.94.2) (envelope-from ) id 1mh8xT-003wZJ-Cp; Sun, 31 Oct 2021 11:25:03 +0000 From: Mauro Carvalho Chehab Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Arnd Bergmann , Dan Carpenter , Greg Kroah-Hartman , Kaixu Xia , Mauro Carvalho Chehab , Peter Zijlstra , Sakari Ailus , Thomas Gleixner , Tsuchiya Yuto , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-staging@lists.linux.dev Subject: [PATCH 1/3] media: atomisp: don't print errors for ignored MBUS formats Date: Sun, 31 Oct 2021 11:25:00 +0000 Message-Id: X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Sender: Mauro Carvalho Chehab To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The bayer formats aren't currently available for userspace to select: those are marked as IA_CSS_FRAME_FORMAT_RAW and trying to get them result on binary firmware load errors: [74625.258097] atomisp-isp2 0000:00:03.0: Using binary isp_preview_var_isp2 (id 22), type 0, mode 1, continuous true [74625.258146] atomisp-isp2 0000:00:03.0: Seeking for binary failed at: [74625.258161] CPU: 3 PID: 2792 Comm: v4l2grab Tainted: G C 5.15.0-rc4+ #77 [74625.258190] Hardware name: ASUSTeK COMPUTER INC. T101HA/T101HA, BIOS T101HA.306 04/23/2019 [74625.258208] Call Trace: [74625.258231] dump_stack_lvl+0x46/0x5a [74625.258272] ia_css_binary_find+0xa7d/0xcf0 [atomisp] [74625.258570] load_preview_binaries+0x323/0x3c0 [atomisp] ... [74625.265892] atomisp-isp2 0000:00:03.0: can't create streams [74625.265937] atomisp-isp2 0000:00:03.0: __get_frame_info 1604x1200 (padded to 0) returned -22 [74625.265962] atomisp-isp2 0000:00:03.0: Can't set format on ISP. Error -22 As those formats are ignored by purpose, it doesn't make any sense to print a message like: atomisp_enum_fmt_cap(): format for code 3007 not found. for those. Yet, some day it would be interesting to also report the bayer formats, letting userspace to decode them on a different way. Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/atomisp/pci/atomisp_ioctl.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c index f082d7a67875..8f0a9a69f075 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c +++ b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c @@ -829,8 +829,6 @@ static int atomisp_enum_fmt_cap(struct file *file, void *fh, f->pixelformat = format->pixelformat; return 0; } - dev_err(isp->dev, "%s(): format for code %x not found.\n", - __func__, code.code); return -EINVAL; } From patchwork Sun Oct 31 11:25:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 12594991 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 417F0C4332F for ; Sun, 31 Oct 2021 11:25:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 24716610A8 for ; Sun, 31 Oct 2021 11:25:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231284AbhJaL1j (ORCPT ); Sun, 31 Oct 2021 07:27:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:47148 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230388AbhJaL1i (ORCPT ); Sun, 31 Oct 2021 07:27:38 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 721AC60F9E; Sun, 31 Oct 2021 11:25:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1635679506; bh=yWrx6iv06r2GqFH4VQZjTHiT5ccrn4b5I9ePck+bYns=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rIT/1xHUV33yKbZdHVRcC5DI/obAHQdv3K3Ns3AQ38ka19ofrevwnDmgctC7QDeVU I0ZyynsCtqjYN+KLD/qtSxNF7VZJftjp9UDyjJBc/4E+Gzeoav5vOkNVbMRtfLd45q hOLQDCI8YFsoHidyyevq/dHJwWqIAOhMd9+KqqCfL6NEveD+ncIHIy9X+fXZuwV9bR o+me66FB6xiF2z5AYNvLNv/Q93Dha57DBFvB7E3uvKplKTOT5nBnTbzd9rLbOPE0zF w1oxZBzTvbXCTvjRPfl5SCJVeAqr4WDe6+PPWkzIcnSxvsK4zeQ4wHL1Ax+4jyLZly uq+phd7/vGaGg== Received: by mail.kernel.org with local (Exim 4.94.2) (envelope-from ) id 1mh8xT-003wZM-EC; Sun, 31 Oct 2021 11:25:03 +0000 From: Mauro Carvalho Chehab Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Arnd Bergmann , Dan Carpenter , Greg Kroah-Hartman , Ingo Molnar , Kaixu Xia , Mauro Carvalho Chehab , Peter Zijlstra , Sakari Ailus , Tsuchiya Yuto , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-staging@lists.linux.dev Subject: [PATCH 2/3] media: atomisp: report the visible resolution Date: Sun, 31 Oct 2021 11:25:01 +0000 Message-Id: <3a7f0de1edeca8d3e4d91f25f42339580d34a6e0.1635679495.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Sender: Mauro Carvalho Chehab To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The atomisp sensors and logic adds an extra pad lines/columns, called "dvs envelope". It also uses an extra 12 lines/columns at the sensor for BYT. As those are not visible to userspace, the V4L2 API should decrement such values when reporting the current resolution. Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/atomisp/pci/atomisp_ioctl.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c index 8f0a9a69f075..d92d41dd0ade 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c +++ b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c @@ -876,6 +876,20 @@ static int atomisp_g_fmt_cap(struct file *file, void *fh, v4l2_fill_pix_format(&f->fmt.pix, &fmt.format); f->fmt.pix.pixelformat = fmtdesc.pixelformat; + + /* + * HACK: The atomisp does something different here, as it + * seems to set the sensor to a slightly higher resolution than + * the visible ones. That seems to be needed by atomisp's ISP + * in order to properly handle the frames. So, s_fmt adds 16 + * extra columns/lines. See atomisp_subdev_set_selection(). + * + * Yet, the V4L2 userspace API doesn't expect those, so it + * needs to be decremented when reporting the visible + * resolution to userspace. + */ + f->fmt.pix.width -= pad_w; + f->fmt.pix.height -= pad_h; } depth = atomisp_get_pixel_depth(f->fmt.pix.pixelformat); From patchwork Sun Oct 31 11:25:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 12594987 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5345AC43219 for ; Sun, 31 Oct 2021 11:25:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4956B610A8 for ; Sun, 31 Oct 2021 11:25:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231352AbhJaL1j (ORCPT ); Sun, 31 Oct 2021 07:27:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:47128 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230209AbhJaL1i (ORCPT ); Sun, 31 Oct 2021 07:27:38 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4C39660F56; Sun, 31 Oct 2021 11:25:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1635679506; bh=5AQ4SFcPBrRu8r+f85REA1Qo7urIQufQynh/2GrVMLY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PminbNS/sScjp2Kr2IYaraoupgvxMecnhIyPC/YsRKar60GF/V2Hk+6IdS+hUFe4b ChDB+8uaoUzNsZfFKTpnzVjYR9hGs/G2ogqgC1tqN2tmhM5mVXJ1gT1qDstjA0JngV J9ykKaJCD/rhP965hzy1ES1o1UacHIoXlOOJCFHqBwdKyGkwhfDNfZhMJ9kHgb50os vdUlA7+7ldGvO9HPfoHLuAKxi9BxsOjoGXFxua9O92FJ041QCLKdzWzXdfRlChZ/2k Ww6EeP/ZNeAtv6Q/+Pr1sYPmGWzBPimR/3ERl1+2z7hylb4jT7GEyYrabpGkZW/kZl 3AmcZ3SHo50Hg== Received: by mail.kernel.org with local (Exim 4.94.2) (envelope-from ) id 1mh8xT-003wZP-Em; Sun, 31 Oct 2021 11:25:03 +0000 From: Mauro Carvalho Chehab Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Alex Dewar , Aline Santana Cordeiro , Andy Shevchenko , Arnd Bergmann , Dan Carpenter , Greg Kroah-Hartman , Hans Verkuil , Ingo Molnar , Kaixu Xia , Mauro Carvalho Chehab , Peter Zijlstra , Sakari Ailus , Tomi Valkeinen , Tsuchiya Yuto , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-staging@lists.linux.dev Subject: [PATCH 3/3] media: atomisp: comment-out JPEG format Date: Sun, 31 Oct 2021 11:25:02 +0000 Message-Id: X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Sender: Mauro Carvalho Chehab To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org This is already disabled on some parts of the code, and trying to use it with current firmware causes an error: [ 53.799946] atomisp-isp2 0000:00:03.0: can't create streams [ 53.799962] atomisp-isp2 0000:00:03.0: __get_frame_info 1600x900 (padded to 0) returned -22 So, completely disable reporting it. Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/atomisp/pci/atomisp_cmd.c | 2 ++ drivers/staging/media/atomisp/pci/atomisp_ioctl.c | 7 +++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp_cmd.c b/drivers/staging/media/atomisp/pci/atomisp_cmd.c index ff8640314f65..feb75491a273 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_cmd.c +++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.c @@ -1980,9 +1980,11 @@ v4l2_fmt_to_sh_fmt(u32 fmt) return IA_CSS_FRAME_FORMAT_RGBA888; case V4L2_PIX_FMT_RGB565: return IA_CSS_FRAME_FORMAT_RGB565; +#if 0 case V4L2_PIX_FMT_JPEG: case V4L2_PIX_FMT_CUSTOM_M10MO_RAW: return IA_CSS_FRAME_FORMAT_BINARY_8; +#endif case V4L2_PIX_FMT_SBGGR16: case V4L2_PIX_FMT_SBGGR10: case V4L2_PIX_FMT_SGBRG10: diff --git a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c index d92d41dd0ade..936516daec7d 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c +++ b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c @@ -492,23 +492,22 @@ const struct atomisp_format_bridge atomisp_output_fmts[] = { .mbus_code = MEDIA_BUS_FMT_BGR565_2X8_LE, .sh_fmt = IA_CSS_FRAME_FORMAT_RGB565, .description = "16 RGB 5-6-5" +#if 0 }, { .pixelformat = V4L2_PIX_FMT_JPEG, .depth = 8, .mbus_code = MEDIA_BUS_FMT_JPEG_1X8, .sh_fmt = IA_CSS_FRAME_FORMAT_BINARY_8, .description = "JPEG" - }, -#if 0 - { + }, { /* This is a custom format being used by M10MO to send the RAW data */ .pixelformat = V4L2_PIX_FMT_CUSTOM_M10MO_RAW, .depth = 8, .mbus_code = V4L2_MBUS_FMT_CUSTOM_M10MO_RAW, .sh_fmt = IA_CSS_FRAME_FORMAT_BINARY_8, .description = "Custom RAW for M10MO" - }, #endif + }, }; const struct atomisp_format_bridge *