From patchwork Wed Mar 3 17:42:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 392633 Delivered-To: patch@linaro.org Received: by 2002:a02:290e:0:0:0:0:0 with SMTP id p14csp5611903jap; Wed, 3 Mar 2021 17:52:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJwEoc1v0O5RUAJmYS6gI0rIfmaVwuUHwBB62MC8H1jr6t1Oqkgpoxghs3jN2+FYInQbzPiH X-Received: by 2002:a17:906:6095:: with SMTP id t21mr1636460ejj.384.1614822768761; Wed, 03 Mar 2021 17:52:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614822768; cv=none; d=google.com; s=arc-20160816; b=xO9MNFrtVWNRF5MT8NbFtkWuueG+Uwdr7y/nMQ7Tnir99hiIl/iAUzos/AQSkJZg9G 9LWuIpxGwOjrgioyTsKCcAt3Pd2kv35BWwsH7GnX4teFqb7SkEQOWdWktzgsTyZb+y8z SKl0jTYAbWtGBcM4sKCJduMeEdpWoNkjbAjzmMbZv/eWBbjVZYJ8upmIy+CGaVCc2RHI MH60BnSBDaFjWtZTWDE7k5fYtjuJF/dYFuon5nL0/b2KFNM8L131gQJ4iQJUkLLeOJk+ ty5ghkaOY5HF6OLTJ7NIYJtgFOV9hCjHh+oLi86qfa8rXzrmBL+sziZrbnFfp7flx8tQ NrYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :dkim-signature; bh=+dhB3YrJVlTSxFCA6Z/e42UCJspJWfH2abZXmJ1XC4M=; b=c2FK42M5c7ZCC7N3GK8dFsU6oIbID65yBkF7DJCTVsC0E3wOz2lJGz80YsF7hI2PHh MyZtrekEu0hPlXmamKEyT4JqNId1Znns6saLXvBO/Qc36zYnWim+uzxzwcZmwzQCUUkM j5Jwlx0SOurKqCp/wj8PXW4kJdd+NNQKbwvgPmcL/0YlFAzF9FJ564QEH26cLrvy6IPw WZzCtp2tXEH2Ox6naZBuAbT9vFPTGw/3zCksSbsjB9RLkIwJbFtqVPUlD4bZ2a+thdzD nqpZJ29Go1dlr+Ydku+8wTfAXRknNN8xmljR0wnfzrDTZoSo+3VQGtU24pbzc5g0bFKA mIpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=i7iOOBQr; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p17si16189393ejd.307.2021.03.03.17.52.48; Wed, 03 Mar 2021 17:52:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=i7iOOBQr; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1389807AbhCCVrP (ORCPT + 16 others); Wed, 3 Mar 2021 16:47:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243072AbhCCRoX (ORCPT ); Wed, 3 Mar 2021 12:44:23 -0500 Received: from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com [IPv6:2a00:1450:4864:20::22f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C957C061760 for ; Wed, 3 Mar 2021 09:43:15 -0800 (PST) Received: by mail-lj1-x22f.google.com with SMTP id u4so29780859ljh.6 for ; Wed, 03 Mar 2021 09:43:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=+dhB3YrJVlTSxFCA6Z/e42UCJspJWfH2abZXmJ1XC4M=; b=i7iOOBQrYR1nHjFHl9efeWLvpEwwqWdbDME3Hb1qx60ZFDs24dYf79cH5Dh7sQgXx3 i2djTXa+lgkuwyUjYXCCfpehzZO5T5Hsc6n42jFgT2iZwXDO5DUaxBuE3LerIEPGnUIN rprCzy8t4HugYBS5SeJoK4TuGQS7mcciQh3spAy0rAv/rGOiQylsDqM0xhgT7iX4ScyN hbbFtDROXGZC9mLCWtPfEUEh/srEC+WnKIxms9E+udmlNtcl9uwdQENHAOYNogEpfZVu G9mgyRF1tn0XH1GG64WSYaZJz0woNEhbBmVokhLvmP8rJlUg69N3BTfthYXW97klvqub GBcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=+dhB3YrJVlTSxFCA6Z/e42UCJspJWfH2abZXmJ1XC4M=; b=bpYPXZHLSVOu7bomX4dKQoniFuiziGAFaN3iKMaWShBtOZk4qZz9FsDY1ru6MIpkPd NlW903Tyr/JtYekS13S/97TjaZ2kukNbvvlF90d97AzQl6kkSZDMOsVtPonLKsSlmN5L 5YR5otOygaHfDqhbZtFHejWlEzh4bx0rDBfgHSHyKfPx6dCj5zU8jw/LhDP5F9oN8aB2 IZO4fQk/OtzQ21fAW0ErDP+wpvkSGmUv0kXo6Kn6LZcNCv0GGjnIdy3rWyvH67JLR2aJ /OS+inFRbV64o/R+0zHZokrWApFLRk0L5qajhiEbw8fNf5V/5u+lYE/WJslg83IExmLr mH+w== X-Gm-Message-State: AOAM530s/rSBenywHfUhGq26PQPnmm7CrC3KSC+cJwot+XRmf719BBFz sIpi763Y5Jk9GwqO3tYLDNLNvQ== X-Received: by 2002:a2e:9047:: with SMTP id n7mr15373ljg.291.1614793393677; Wed, 03 Mar 2021 09:43:13 -0800 (PST) Received: from localhost.localdomain ([85.249.43.69]) by smtp.googlemail.com with ESMTPSA id s7sm2101441lfi.140.2021.03.03.09.43.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Mar 2021 09:43:12 -0800 (PST) From: Andrey Konovalov To: junak.pub@gmail.com, robert.foss@linaro.org, sakari.ailus@linux.intel.com Cc: todor.too@gmail.com, agross@kernel.org, bjorn.andersson@linaro.org, mchehab@kernel.org, laurent.pinchart@ideasonboard.com, jacopo@jmondi.org, linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 0/3] media: qcom: camss: V4L2_CID_PIXEL_RATE/LINK_FREQ fixes Date: Wed, 3 Mar 2021 20:42:47 +0300 Message-Id: <20210303174250.11405-1-andrey.konovalov@linaro.org> X-Mailer: git-send-email 2.17.1 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The first patch adds printing a warning in v4l2_get_link_freq() if V4L2_CID_LINK_FREQ isn't implemented (this is a mandatory control for CSI-2 transmitter drivers [1], but many sensor drivers don't have it currently). The second patch is the start of the work discussed in the "[RFC] Repurpose V4L2_CID_PIXEL_RATE for the sampling rate in the pixel array" thread [2]. I'll send the similar patches for the rest of CSI receiver drivers which use V4L2_CID_PIXEL_RATE to calculate the link frequency as a separate patchset following this one: I don't have the hardware to test the changes to these drivers, so the second patchset will be build tested only. The third patch in this series is the patch by Vladimir Lypak [3] rebased onto the changes done by the second patch. By replacing getting the pixel clock with v4l2_get_link_freq() the second patch also fixes the integer overflow which Vladimir's patch addresses. So the third patch only needs to fix drivers/media/platform/qcom/camss/camss-vfe.c which the second patch doesn't touch. The resulting patchset is free from the "undefined reference to `__udivdi3'" issue [4] as the u64 value is only divided by a power of 2, which doesn't need do_div(). This patchset has been tested on db410c board with imx219 and ov5647 sensors (RPi camera modules v2 and v1) attached to AISTARVISION MIPI Adapter V2.0. [1] https://linuxtv.org/downloads/v4l-dvb-apis-new/driver-api/csi2.html [2] https://www.spinics.net/lists/linux-media/msg183183.html [3] https://www.spinics.net/lists/linux-media/msg186875.html [4] https://www.spinics.net/lists/linux-media/msg186918.html Changes in v2: * Added [PATCH 1/3] v4l: common: v4l2_get_link_freq: add printing a warning * camss_get_link_freq() changed to take the actual number of lanes as the third arg vs the number of lanes multiplied by 2 in the first version * Fixed checkpatch warnings and bad indentation Changes in v3: * The warning message in v4l2_get_link_freq() improved as suggested by Jacopo Mondi