Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp2780314lqz; Wed, 3 Apr 2024 08:24:44 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWcN1cIFuFzgUve1V9YBa2lOtS2Ulhl1vjoQi7OhZii0dt4F0G/URSIqLOqfpayhTS2LbpZdeM3iZiqfhNEyPG4FgcdKKt/cBClRnLsaw== X-Google-Smtp-Source: AGHT+IEIefX5UH5/imBN8Nl09rFuPGlpuLVnKrzjM3EouNeA7uqAqvpmxCHap4R7jXZ+MRLyOYMF X-Received: by 2002:a05:620a:56c7:b0:78b:e8b2:adea with SMTP id wh7-20020a05620a56c700b0078be8b2adeamr7894932qkn.70.1712157884152; Wed, 03 Apr 2024 08:24:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712157884; cv=pass; d=google.com; s=arc-20160816; b=NpZoIX7a2N3hpnaWjU8igZ3wZRo2te/YuTaI3ix+OsfgzD23ybSbiLrRaNH9GmrxrC fpeX2GJaxEr60sUblag8qn5ZivoZNgvAOH+17cifW3cRcWKmiDXSU7IY9VOQzkG+bbH5 lnAmX/3OMZrYew6OrNq/cuyJw2wQsjSUo6Q2F1Qydjv3ZdyXxgAr3Z2xYgffzQkphKJt Z98TmP1VWUkdgw7RjtHf2icmM1H4iC5Gj4Co0rqGSVofbfC1lhjHTkP+x6nRiaBJLl2X MQd5k/pBmoDBlBzGi/facatyKnUiHutt9+dd3zTj7qMrqzy2PaxRiHrl/gk1Dx7UlqHd AfaA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=tn3xRU5mtzTvJZghODMqRw0ULnXG09wTsVZrMIwsFGY=; fh=ng0FUFwPgHHqIHtWcUlLUSBs0e7fHIUGeuUhfcQSRgA=; b=ktcdASAVjvw8e9c8/z9LoyCcm5kaP+0Zh2/poq342MyJ+OXjDsDAu95NYT+ewHb/Mc 3pgjowiU0DlBqb8CGLjaTeZ3QNWVI9H8Qydua9dX+A9XMFnhrzb9e7VMuYWenA2l05KK ogfKfI6zcy0KYKRCh6KtUfD0Fftb2hE3KPfm414QByb6wstK/YFbMYGK5TSbn8hYfYsb zm7G6cyooqlOLo2hTToQl6pfHeQRIkVxhQWiya+p8byYdQ0Dh0RFHLARgyXSh2Nhs5ZX DVYj7qVSZRyt572reLqVQwj8OhFj3Y/cFgj30YT2NyQ8WR6cw+JRJI2+fBv09E55WftF gbhA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=fail header.i=@luigi311.com header.s=x header.b=QvPdXUFu; arc=pass (i=1 spf=pass spfdomain=luigi311.com dkim=pass dkdomain=luigi311.com); spf=pass (google.com: domain of linux-kernel+bounces-130087-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-130087-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id a15-20020a05620a02ef00b0078a6aa28b00si14467828qko.61.2024.04.03.08.24.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 08:24:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-130087-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=fail header.i=@luigi311.com header.s=x header.b=QvPdXUFu; arc=pass (i=1 spf=pass spfdomain=luigi311.com dkim=pass dkdomain=luigi311.com); spf=pass (google.com: domain of linux-kernel+bounces-130087-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-130087-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 331DF1C24650 for ; Wed, 3 Apr 2024 15:24:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2F59E149C68; Wed, 3 Apr 2024 15:24:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=luigi311.com header.i=@luigi311.com header.b="QvPdXUFu" Received: from mail-108-mta230.mxroute.com (mail-108-mta230.mxroute.com [136.175.108.230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EEBF7200D4 for ; Wed, 3 Apr 2024 15:24:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=136.175.108.230 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712157858; cv=none; b=ZVdWSykYC7jjQkmEU2Jpop+uBedqq4p+/954vX9QYvusOpEqdwpXsEoU0p0zPdV89PwvKiP0RpKavzAXxD9bme+Nodnab8Ft+zVIp88MLd5ua80ZM5DaTbtv9gxbTHpbPOdTjYkO4VgGl1pwn1ZYPGISx7RC/j2CYbv/VhlupLA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712157858; c=relaxed/simple; bh=P6sFYE2RFyMP+jyTKPG/NPzsohsjE50jpPWJbVR2FnQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kEahYGJTgvpqWy+sLe4VYnN+GZdVNXIjFBzy6yTIxuHgjKdYfsvn8B/ulAVzmgH69k3lXRuZ4vUcYqJLccV3Vkrumgf6l6JtJkMQNV0qjQjd5Wm5mnWmtd1MpmGUzItEyaIg9z8Rg6lUd9nGnmQWOKbeVW02I50PacYK9n6/1cU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=luigi311.com; spf=pass smtp.mailfrom=luigi311.com; dkim=pass (2048-bit key) header.d=luigi311.com header.i=@luigi311.com header.b=QvPdXUFu; arc=none smtp.client-ip=136.175.108.230 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=luigi311.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=luigi311.com Received: from filter006.mxroute.com ([136.175.111.2] filter006.mxroute.com) (Authenticated sender: mN4UYu2MZsgR) by mail-108-mta230.mxroute.com (ZoneMTA) with ESMTPSA id 18ea48ace6d0003bea.010 for (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Wed, 03 Apr 2024 15:19:04 +0000 X-Zone-Loop: 145612d79a4fabd7a63fe255e4f0c927b99790ad46e2 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=luigi311.com; s=x; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=tn3xRU5mtzTvJZghODMqRw0ULnXG09wTsVZrMIwsFGY=; b=QvPdXUFuy1A7P9ydQKgHJhheqt WkdvfyKXwUD+FqZFlZUYxyspghJF4mEzHneCx7CQ6m4BnYfkMAOF8aZy6D9gArVw5WT09Bhsu8Hlu qrsgyHQrHFvHG20wAUvM88NEktefZ5yqJ8SUgXzlSzCIAaYAEiw0v2z8Lvayn8eNswCrf+7PxdxXp MXgwgvnct48JPZExsc1lGu/vywnnys5hasjdYaO8pXtzcUMya65yu0Yr+JDTuIbE8gKKqJysT6eOe 9zW9Amw9H0cCF8OGSzZaMRIYWRMEDTyUAPMcL+EAJ62tC87t+xl5ANGN5r9XDpxSDqpAAzKh4Uhps G0NUIlrA==; From: git@luigi311.com To: linux-media@vger.kernel.org Cc: dave.stevenson@raspberrypi.com, jacopo.mondi@ideasonboard.com, mchehab@kernel.org, robh@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, sakari.ailus@linux.intel.com, devicetree@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, pavel@ucw.cz, phone-devel@vger.kernel.org, Luis Garcia Subject: [PATCH v3 25/25] media:i2c: imx258: Use v4l2_link_freq_to_bitmap helper Date: Wed, 3 Apr 2024 09:03:54 -0600 Message-ID: <20240403150355.189229-26-git@luigi311.com> In-Reply-To: <20240403150355.189229-1-git@luigi311.com> References: <20240403150355.189229-1-git@luigi311.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Authenticated-Id: personal@luigi311.com From: Luis Garcia Use the v4l2_link_freq_to_bitmap() helper to figure out which driver-supported link freq can be used on a given system. Signed-off-by: Luis Garcia --- drivers/media/i2c/imx258.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/media/i2c/imx258.c b/drivers/media/i2c/imx258.c index 4c117c4829f1..038f40a1f800 100644 --- a/drivers/media/i2c/imx258.c +++ b/drivers/media/i2c/imx258.c @@ -674,6 +674,7 @@ struct imx258 { /* Current mode */ const struct imx258_mode *cur_mode; + unsigned long link_freq_bitmap; const struct imx258_link_freq_config *link_freq_configs; const s64 *link_freq_menu_items; unsigned int lane_mode_idx; @@ -1533,6 +1534,17 @@ static int imx258_probe(struct i2c_client *client) return ret; } + ret = v4l2_link_freq_to_bitmap(&client->dev, + ep.link_frequencies, + ep.nr_of_link_frequencies, + imx258->link_freq_menu_items, + ARRAY_SIZE(link_freq_menu_items_19_2), + &imx258->link_freq_bitmap); + if (ret) { + dev_err(&client->dev, "Link frequency not supported\n"); + goto error_endpoint_free; + } + /* Get number of data lanes */ switch (ep.bus.mipi_csi2.num_data_lanes) { case 2: -- 2.42.0