Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp612812lqj; Sun, 2 Jun 2024 13:46:23 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVZ652WTGEoHy8i4irVs+a98Fp4q486qyqhPRl8532uvLv7hD3kIDd2BSdh1RSmhI7Qmo8tnsheKPYRX4xi0ZHjuCBirTqNszfBYeyHJQ== X-Google-Smtp-Source: AGHT+IEblPlpVpbjzyAjhkCjGDm5M4dAFaSLidWecaLTncvlgSDwt6iTOClTj740LzwELJsyZQTQ X-Received: by 2002:a05:6a20:8406:b0:1af:cfca:e515 with SMTP id adf61e73a8af0-1b26f0ec30bmr10189527637.12.1717361183030; Sun, 02 Jun 2024 13:46:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717361183; cv=pass; d=google.com; s=arc-20160816; b=qUaRfYxDcZJ0SoQoqfGGysv+4iyHG3hRI3pe4Uv6Rs3heYflVHkf/0zBH2/5TwpeU8 VWHPsw5pd3h97M7t8axh98kF7DcTm/bN9NC44C1uIMO3z4avfN0OUeq35LjGFfSWXvkw 4yyepSAsFaTtZ2HB4wcJzG4qe1vMqq5oeQGAFS8BMzZ1mHSDV0xFmWuBnJNB5iI7BqDA /ym6sb6kx62baCgGKKetoBvYext+irQpnYt/ZlOt0DoGOlBfBcghk86a8o5If5mxn7VZ GnVnnMEdlHLym5fnPuh0puyYhCcT8lirZ0MJUaniH9WrItCqB9kmSw0JSyDjeZNhUTOP 9ANw== 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=7NXcrc70rKMeNobbsr89/2dWktagLdq0/zNwjdJVzYE=; fh=WWiirLTE+nF4pa1MKZv1HOmdyfgZwCXiyd5qM0nL9ns=; b=1AVEK4HmDM50YxL5WHIfwginb97YuTNlyLMfaGs2BOFY9lKbu97Oj3V4tLEfuI2UV7 YD6jpD9OhoYo1o8BloI4ERo+VIK+kh8c/x0MjWnRWrh9euRKuxZagQXAPg2pDnJA+/pM TavN1lGgU1PDQ+13AdptzcIFymczTiaVyYonJQ3f3VChLUaPDu5Bs7zIHHMNNZRDICZy cuXPE+W0lD64qetRx/tca2K/D13Bkj2Q8FQorAQa6iOhoZgz91k9ETMG/A9ASXKgPhpj 2YC+ZCuuIfEAh+vYhvlPBQCtWvMk8fFta2HucxD6KnzfZcKxta1gsib53fTE/g5Ncr7F MD+A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=fail header.i=@luigi311.com header.s=x header.b=KLoThVaU; arc=pass (i=1 spf=pass spfdomain=luigi311.com dkim=pass dkdomain=luigi311.com); spf=pass (google.com: domain of linux-kernel+bounces-198425-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-198425-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id d2e1a72fcca58-70261d654b0si2024338b3a.96.2024.06.02.13.46.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Jun 2024 13:46:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-198425-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=fail header.i=@luigi311.com header.s=x header.b=KLoThVaU; arc=pass (i=1 spf=pass spfdomain=luigi311.com dkim=pass dkdomain=luigi311.com); spf=pass (google.com: domain of linux-kernel+bounces-198425-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-198425-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 48E58B2206B for ; Sun, 2 Jun 2024 20:25:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C5DAF86278; Sun, 2 Jun 2024 20:21:01 +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="KLoThVaU" Received: from mail-108-mta161.mxroute.com (mail-108-mta161.mxroute.com [136.175.108.161]) (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 81B8886250 for ; Sun, 2 Jun 2024 20:20:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=136.175.108.161 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717359661; cv=none; b=nY/Iqgco0l9M1TAHVni5flITqmGNJDnXF5N8KfhCQH/bwP+rQx+Ctns9jNGzY+KcVWkVmUUJlkEwi9zAOtKsFFIWFOAVZEaNt/OXy2P+pcJ/uDn5xu62cS4SKGS2i8cvx/i/zWGyQs+XQxSaDWLX5SsK8ugwiGLxHrrSOVCiuF0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717359661; c=relaxed/simple; bh=JYMoAdAi23Rqjp24EgQA29VoTvbC/LV/zcwHywbUEuA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FUbDeBCzdYcy2b2g5dZEdsb6b07Kj0EFZGVYb6/lBnho8eQwO7ILFyQxKiz7RN0sYZQvZf11tIw1vrFXVJEMTaatYQkEDl0iFjoejMxcqAT+mpM8nj/3UWASucYz5kougz4OoK6Fh9CW5AUFV0dhc4UU20It84d040IIkWGV/64= 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=KLoThVaU; arc=none smtp.client-ip=136.175.108.161 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.3] filter006.mxroute.com) (Authenticated sender: mN4UYu2MZsgR) by mail-108-mta161.mxroute.com (ZoneMTA) with ESMTPSA id 18fda970331000e2b6.011 for (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Sun, 02 Jun 2024 20:14:40 +0000 X-Zone-Loop: b1d007cc0c9b689e49ea4edc444d878d3298f0f84f11 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=7NXcrc70rKMeNobbsr89/2dWktagLdq0/zNwjdJVzYE=; b=KLoThVaUbxr6nNb4nYxZrXrGIN QFiuDvHA3jeHhzLf3YUxW24U3fuaXHIyeHWYp+PduEMjWs13tn1R6fS/kaNfxTDYrIuZTP6YCWWRE M2mdOLiins20TuRdipId6Bmx7TvDecW/dXLOYN3m5Y1Jjhxe2OhrNOdhAbkI+DG75At03a1Q+4IcH IRX/IHNAxBV3a6k17ptKaC57V2F4o0BPecPQRPZICdjPZj5BKrnHQ4OSXQ7QX1ZwKfvo5SiN68yv6 KTngAakph8sy/B/2OY4kmlqn10jNz3gcNAeZK9lIBVKbDeIFeqpXQDKZzeYk9hlw/foVOr4U13CHY 3e+KGmJg==; 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 , Tommaso Merciai Subject: [PATCH v6 22/23] media: i2c: imx258: Use v4l2_link_freq_to_bitmap helper Date: Sun, 2 Jun 2024 14:13:44 -0600 Message-ID: <20240602201345.328737-23-git@luigi311.com> In-Reply-To: <20240602201345.328737-1-git@luigi311.com> References: <20240602201345.328737-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 Reviewed-by: Pavel Machek Reviewed-by: Tommaso Merciai --- 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 671fe176c64c..e9abf6b96aec 100644 --- a/drivers/media/i2c/imx258.c +++ b/drivers/media/i2c/imx258.c @@ -693,6 +693,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; @@ -1546,6 +1547,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.44.0