From patchwork Fri Apr 26 14:55:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 792797 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.14]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E9F3D1487C3 for ; Fri, 26 Apr 2024 14:55:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.14 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714143356; cv=none; b=LjIeV1TJR3i8A8HKjulmZt70ONnkhk7+id9dsl7HrPz1dp+CFEfIDuXIHJW7qIp9VHpz2LzSQboeqnE5j4xhIsAmkYwrIntpFDRccp7g4mnfWNCTSjQoSbZ4aMLlxvYIP4BybipZBrdzQTaH8ZWqWmgwPBG9S7R+qEGIVELjyXY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714143356; c=relaxed/simple; bh=KCU1k9cjxUtzLj6jkWOczakDjmB8QgGPifWZJuswmfI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=UUtcZDU8BtFoDrn++DmXg1bBmL88imRF3KmbqD9iYKX5FB7N05kQ7CHz4olH9EkPqZpdylzyu0gUqab/xwphJwdbQFEQ9mAaHLwRqXyEFrnywSw14t9SSO5oc171Ixy9cXLhDPudXws2qOvhxCmXzxy+YSEq76u1jEDauNHnXkY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=EfYJczSa; arc=none smtp.client-ip=192.198.163.14 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="EfYJczSa" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1714143355; x=1745679355; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=KCU1k9cjxUtzLj6jkWOczakDjmB8QgGPifWZJuswmfI=; b=EfYJczSa5K2zNO3ThrF1xSTlsYSzrh1p7bh/+wNB9set2vanW6JEUugy AqHOoHhlYL1WBEHCiyHOsfJnlIuBz1Yp24OXb1JTrw0hh38YGRP+WYl9v rgRKnjAY1vtTLR7HZheh93DOCngFPw+NvhaOIQspY4vCScIFsnXYwOcjd mu7K/tuip/CPcw1j+SsEF5+WmiggM18G7WXYG2z9VjorwA2vRzaBkmtjP 7FAhU6qFHPpDNP/bwDCgRsEGYXpIIA5/IZzR7q/lU18g/TBvMQMu+E5Kd wIiftEOgqFelsUHwtlqM3gIhzJg2v1Du5QqvnbPQrAPL+iIV+uS70rvq2 g==; X-CSE-ConnectionGUID: O7GehDoXTlm3kMVFJmnA3Q== X-CSE-MsgGUID: mGHgBps5Szme1wfAv1Akhg== X-IronPort-AV: E=McAfee;i="6600,9927,11056"; a="10095280" X-IronPort-AV: E=Sophos;i="6.07,232,1708416000"; d="scan'208";a="10095280" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by fmvoesa108.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2024 07:55:52 -0700 X-CSE-ConnectionGUID: 8NKK24Z4SuClW31demMGIw== X-CSE-MsgGUID: q/AM8OEySs+3bBaV4IJoJw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,232,1708416000"; d="scan'208";a="25514718" Received: from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com) ([10.237.72.44]) by fmviesa010-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2024 07:55:51 -0700 Received: from punajuuri.localdomain (punajuuri.localdomain [192.168.240.130]) by kekkonen.fi.intel.com (Postfix) with ESMTP id B066311FC19; Fri, 26 Apr 2024 17:55:48 +0300 (EEST) Received: from sailus by punajuuri.localdomain with local (Exim 4.96) (envelope-from ) id 1s0MzM-002kC9-2C; Fri, 26 Apr 2024 17:55:48 +0300 From: Sakari Ailus To: linux-media@vger.kernel.org Cc: hverkuil@xs4all.nl, laurent.pinchart@ideasonboard.com, Wentong Wu Subject: [PATCH v2 1/3] media: Documentation: v4l: Add CUR_LINK_FREQ control Date: Fri, 26 Apr 2024 17:55:36 +0300 Message-Id: <20240426145538.654212-2-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240426145538.654212-1-sakari.ailus@linux.intel.com> References: <20240426145538.654212-1-sakari.ailus@linux.intel.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Add a 64-bit integer control for devices that are passing through CSI-2 (or other) data, to signal the link frequency used by also the upstream sub-device. The control is volatile and read-only. Signed-off-by: Sakari Ailus --- .../userspace-api/media/v4l/ext-ctrls-image-process.rst | 4 ++++ drivers/media/v4l2-core/v4l2-ctrls-defs.c | 5 +++++ include/uapi/linux/v4l2-controls.h | 1 + 3 files changed, 10 insertions(+) diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-image-process.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-image-process.rst index b1c2ab2854af..31d5045f32e7 100644 --- a/Documentation/userspace-api/media/v4l/ext-ctrls-image-process.rst +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-image-process.rst @@ -55,3 +55,7 @@ Image Process Control IDs control value divided by e.g. 0x100, meaning that to get no digital gain the control value needs to be 0x100. The no-gain configuration is also typically the default. + +``V4L2_CID_CUR_LINK_FREQ (64-bit integer)`` + The current link frequency on a data interface (e.g. parallel or + CSI-2). This control is read-only. diff --git a/drivers/media/v4l2-core/v4l2-ctrls-defs.c b/drivers/media/v4l2-core/v4l2-ctrls-defs.c index 8696eb1cdd61..1e8e02818f9f 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls-defs.c +++ b/drivers/media/v4l2-core/v4l2-ctrls-defs.c @@ -1163,6 +1163,7 @@ const char *v4l2_ctrl_get_name(u32 id) case V4L2_CID_TEST_PATTERN: return "Test Pattern"; case V4L2_CID_DEINTERLACING_MODE: return "Deinterlacing Mode"; case V4L2_CID_DIGITAL_GAIN: return "Digital Gain"; + case V4L2_CID_CUR_LINK_FREQ: return "Link Frequency"; /* DV controls */ /* Keep the order of the 'case's the same as in v4l2-controls.h! */ @@ -1425,6 +1426,10 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, case V4L2_CID_LINK_FREQ: *type = V4L2_CTRL_TYPE_INTEGER_MENU; break; + case V4L2_CID_CUR_LINK_FREQ: + *flags |= V4L2_CTRL_FLAG_VOLATILE | V4L2_CTRL_FLAG_READ_ONLY; + *type = V4L2_CTRL_TYPE_INTEGER64; + break; case V4L2_CID_RDS_TX_PS_NAME: case V4L2_CID_RDS_TX_RADIO_TEXT: case V4L2_CID_RDS_RX_PS_NAME: diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h index 99c3f5e99da7..1c63d2e51e8d 100644 --- a/include/uapi/linux/v4l2-controls.h +++ b/include/uapi/linux/v4l2-controls.h @@ -1223,6 +1223,7 @@ enum v4l2_jpeg_chroma_subsampling { #define V4L2_CID_TEST_PATTERN (V4L2_CID_IMAGE_PROC_CLASS_BASE + 3) #define V4L2_CID_DEINTERLACING_MODE (V4L2_CID_IMAGE_PROC_CLASS_BASE + 4) #define V4L2_CID_DIGITAL_GAIN (V4L2_CID_IMAGE_PROC_CLASS_BASE + 5) +#define V4L2_CID_CUR_LINK_FREQ (V4L2_CID_IMAGE_PROC_CLASS_BASE + 6) /* DV-class control IDs defined by V4L2 */ #define V4L2_CID_DV_CLASS_BASE (V4L2_CTRL_CLASS_DV | 0x900) From patchwork Fri Apr 26 14:55:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 792796 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.14]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6F976148836 for ; Fri, 26 Apr 2024 14:55:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.14 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714143358; cv=none; b=MNb+TfswlWt7qRKdxe5kjIo2Ra5FvoRoENmoo8uq5pJSA93oVHVEAX0dOkIRCaqszrImCzu3JArbdE/FB8qivycuf4Ua/PDV0j+mGyP/nwWmz9KAALygJj/c9qXihdTyLuHrrxq1yyrf3katv/J1/Sefc7KybWuxkVk5q6nw9kU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714143358; c=relaxed/simple; bh=nIgOxxJ7GEApbaALBIkmKlN+UJUxUMGnaqgFIo1Am/c=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=o/USdSv4qQQBKYk7bMig0jeXk+07sOfKSMm3sAmQZqSh8khLCFnFgvBZv1o0sYz+AiCxTWmHU3NDymrYb4SvYvV3y8syQuvVQoP82+eYABqY9n3VI7hTpDrGP2oA7Xd4mBFWRNFTxbu+rTvmDapF6XlMcJ71IhS27tKMnj+Vy8o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=YQXbFf7o; arc=none smtp.client-ip=192.198.163.14 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="YQXbFf7o" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1714143356; x=1745679356; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=nIgOxxJ7GEApbaALBIkmKlN+UJUxUMGnaqgFIo1Am/c=; b=YQXbFf7oRCTHAN8VEGeGkXJrV3iwXfg205xDIG2pvCjm0Nfd+FbUjQXV aNxZSCAOiMiknmTwRKBnOzYbJA3U1F2NSB2hdA2xTan0YtxJzhcAy78pe cThPieV2ZlY7Wu7uS8KN0J9Nz7RzR6k5GHzeDfHsUSZsiZJTJ2Um36aUe +PUJrnvhITbvDlG+yorfargN2d81aHrupGrqhKF4TFcbRmV0U4w0BBexD IAgB9ZMBJeSYY/ZxfSTjh0tO6/l8CYpdpxt2xnvvZ+PlBVShNYHlCCPd+ B5589EHqTrPIsGF+KharJnpMWpdzyYTJQpKCdEnXv/rP/XKBnj/CgC8Uo g==; X-CSE-ConnectionGUID: K/fPZXh4SZ6041UnH6WNzQ== X-CSE-MsgGUID: VUN8Ao20Tu2MMMHR3fm0CQ== X-IronPort-AV: E=McAfee;i="6600,9927,11056"; a="10095285" X-IronPort-AV: E=Sophos;i="6.07,232,1708416000"; d="scan'208";a="10095285" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by fmvoesa108.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2024 07:55:52 -0700 X-CSE-ConnectionGUID: GjY+2fjaSYuDBTSmwunvLw== X-CSE-MsgGUID: OoG1Pa4AQIOWa0qdTAYUvA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,232,1708416000"; d="scan'208";a="25514722" Received: from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com) ([10.237.72.44]) by fmviesa010-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2024 07:55:51 -0700 Received: from punajuuri.localdomain (punajuuri.localdomain [192.168.240.130]) by kekkonen.fi.intel.com (Postfix) with ESMTP id B3106120358; Fri, 26 Apr 2024 17:55:48 +0300 (EEST) Received: from sailus by punajuuri.localdomain with local (Exim 4.96) (envelope-from ) id 1s0MzM-002kCD-2G; Fri, 26 Apr 2024 17:55:48 +0300 From: Sakari Ailus To: linux-media@vger.kernel.org Cc: hverkuil@xs4all.nl, laurent.pinchart@ideasonboard.com, Wentong Wu Subject: [PATCH v2 2/3] media: v4l: Support obtaining link frequency from CUR_LINK_FREQ control Date: Fri, 26 Apr 2024 17:55:37 +0300 Message-Id: <20240426145538.654212-3-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240426145538.654212-1-sakari.ailus@linux.intel.com> References: <20240426145538.654212-1-sakari.ailus@linux.intel.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Support V4L2_CID_CUR_LINK_FREQ INTEGER64 control in v4l2_get_link_freq(). Signed-off-by: Sakari Ailus --- drivers/media/v4l2-core/v4l2-common.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-core/v4l2-common.c index 4165c815faef..bf1923314d15 100644 --- a/drivers/media/v4l2-core/v4l2-common.c +++ b/drivers/media/v4l2-core/v4l2-common.c @@ -483,6 +483,10 @@ s64 v4l2_get_link_freq(struct v4l2_ctrl_handler *handler, unsigned int mul, freq = qm.value; } else { + ctrl = v4l2_ctrl_find(handler, V4L2_CID_CUR_LINK_FREQ); + if (ctrl) + return v4l2_ctrl_g_ctrl_int64(ctrl); + if (!mul || !div) return -ENOENT; @@ -494,7 +498,7 @@ s64 v4l2_get_link_freq(struct v4l2_ctrl_handler *handler, unsigned int mul, pr_warn("%s: Link frequency estimated using pixel rate: result might be inaccurate\n", __func__); - pr_warn("%s: Consider implementing support for V4L2_CID_LINK_FREQ in the transmitter driver\n", + pr_warn("%s: Consider implementing support for V4L2_CID_LINK_FREQ or V4L2_CID_CUR_LINK_FREQ in the transmitter driver\n", __func__); } From patchwork Fri Apr 26 14:55:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 792495 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.14]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7E40514882F for ; Fri, 26 Apr 2024 14:55:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.14 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714143356; cv=none; b=TEiRWjF86nP56aMLNaPqTMWx/pqCIPnArY+obOhv3zwkKVCnMZbMZhhElNGSQPJQDU0vUBNHn4K1b+ECV/V8ReLP1PQIjmpY1s20MIWdw0z9DdLUDn6r1S8wuXewwXaQuJp6cAnQ6U4p8zjC7AinY5Ks5w5Bnt0Htij4ZkO2AeY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714143356; c=relaxed/simple; bh=YWYuh/AzryDgZMdNjbpVnsayhUqySvnOTMpZ/xyBSfs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=NjqTJ3j22IUSPmCqLBNuiP8N4A4PFwW7lvfEVVeXl2Yc5vI6fQSNwTZ7Y7w+UZ22Wl/3ybBChiOsaCH9U9o83vxkI3JAUDr7R6Ds7eij4gBkkzOLXlWbMKLODQiQDjivvpvQPcoqkFOef2c/69lpdTqqeMhijzNVGmtqrdT5rYc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=X4BIdgS5; arc=none smtp.client-ip=192.198.163.14 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="X4BIdgS5" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1714143355; x=1745679355; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=YWYuh/AzryDgZMdNjbpVnsayhUqySvnOTMpZ/xyBSfs=; b=X4BIdgS5qGrb5SIPxjVzc5YmQLMxYMxtQa1ffx2KHDwimuXtZpEmmZyK /umd3NToy0htG/gxgNv6E0SZEHOR5ZxbBO7Q1DnReO/5GcDMSGsc5BZKN VPMlpmE3x1xSZF6DmpYt7X4OFF9hGf6zN9R8JgfEHmXa6h9FRFR3WOKV/ qUqoC4ZQqnUiWA/uHTyhn+NkIE3bV2GF3epWKo0P1Tszd2Rc5+SG0CQIa YG8BbEBJWLBHLAZqtAPsa1zKe7p/OyH9kClaXv8Xzf7bWlNF2n6/Z0+wK wKAj5d9y2LZDrSEQAo/VqGBhY6DBqm7RI+Yd3h0Dl5mg4OZ1WbJBgmbm/ g==; X-CSE-ConnectionGUID: 5h2npbN7T2i65nzuPb3VBQ== X-CSE-MsgGUID: TR84cNi7QeengQNXTMWMvA== X-IronPort-AV: E=McAfee;i="6600,9927,11056"; a="10095282" X-IronPort-AV: E=Sophos;i="6.07,232,1708416000"; d="scan'208";a="10095282" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by fmvoesa108.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2024 07:55:52 -0700 X-CSE-ConnectionGUID: 9DCslBtmQkumCJp/OVof1A== X-CSE-MsgGUID: lA9GIIcERiSU5k6PdB1fDg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,232,1708416000"; d="scan'208";a="25514720" Received: from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com) ([10.237.72.44]) by fmviesa010-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2024 07:55:51 -0700 Received: from punajuuri.localdomain (punajuuri.localdomain [192.168.240.130]) by kekkonen.fi.intel.com (Postfix) with ESMTP id B6B451203ED; Fri, 26 Apr 2024 17:55:48 +0300 (EEST) Received: from sailus by punajuuri.localdomain with local (Exim 4.96) (envelope-from ) id 1s0MzM-002kCH-2M; Fri, 26 Apr 2024 17:55:48 +0300 From: Sakari Ailus To: linux-media@vger.kernel.org Cc: hverkuil@xs4all.nl, laurent.pinchart@ideasonboard.com, Wentong Wu Subject: [PATCH v2 3/3] media: ivsc: csi: Fix link frequency control behaviour Date: Fri, 26 Apr 2024 17:55:38 +0300 Message-Id: <20240426145538.654212-4-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240426145538.654212-1-sakari.ailus@linux.intel.com> References: <20240426145538.654212-1-sakari.ailus@linux.intel.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The link frequency control was an integer menu control the value of which was hard-coded in the MEI CSI driver itself. Instead obtain the control value from the upstream sub-device and use the CUR_LINK_FREQ INTEGER64 control type for the purpose. Fixes: 29006e196a56 ("media: pci: intel: ivsc: Add CSI submodule") Signed-off-by: Sakari Ailus Acked-by: Wentong Wu --- drivers/media/pci/intel/ivsc/mei_csi.c | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/drivers/media/pci/intel/ivsc/mei_csi.c b/drivers/media/pci/intel/ivsc/mei_csi.c index 55e0c60c420c..4a35932f1cd3 100644 --- a/drivers/media/pci/intel/ivsc/mei_csi.c +++ b/drivers/media/pci/intel/ivsc/mei_csi.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -32,8 +33,6 @@ #define MEI_CSI_ENTITY_NAME "Intel IVSC CSI" -#define MEI_CSI_LINK_FREQ_400MHZ 400000000ULL - /* the 5s used here is based on experiment */ #define CSI_CMD_TIMEOUT (5 * HZ) /* to setup CSI-2 link an extra delay needed and determined experimentally */ @@ -145,10 +144,6 @@ static const struct v4l2_mbus_framefmt mei_csi_format_mbus_default = { .field = V4L2_FIELD_NONE, }; -static s64 link_freq_menu_items[] = { - MEI_CSI_LINK_FREQ_400MHZ -}; - static inline struct mei_csi *notifier_to_csi(struct v4l2_async_notifier *n) { return container_of(n, struct mei_csi, notifier); @@ -470,7 +465,7 @@ static int mei_csi_g_volatile_ctrl(struct v4l2_ctrl *ctrl) struct mei_csi *csi = ctrl_to_csi(ctrl); s64 freq; - if (ctrl->id == V4L2_CID_LINK_FREQ) { + if (ctrl->id == V4L2_CID_CUR_LINK_FREQ) { if (!csi->remote) return -EINVAL; @@ -481,8 +476,7 @@ static int mei_csi_g_volatile_ctrl(struct v4l2_ctrl *ctrl) return -EINVAL; } - link_freq_menu_items[0] = freq; - ctrl->val = 0; + ctrl->p_new.p_s64[0] = csi->link_freq = freq; return 0; } @@ -553,7 +547,6 @@ static const struct v4l2_async_notifier_operations mei_csi_notify_ops = { static int mei_csi_init_controls(struct mei_csi *csi) { - u32 max; int ret; ret = v4l2_ctrl_handler_init(&csi->ctrl_handler, 2); @@ -562,13 +555,10 @@ static int mei_csi_init_controls(struct mei_csi *csi) csi->ctrl_handler.lock = &csi->lock; - max = ARRAY_SIZE(link_freq_menu_items) - 1; - csi->freq_ctrl = v4l2_ctrl_new_int_menu(&csi->ctrl_handler, - &mei_csi_ctrl_ops, - V4L2_CID_LINK_FREQ, - max, - 0, - link_freq_menu_items); + csi->freq_ctrl = v4l2_ctrl_new_std(&csi->ctrl_handler, + &mei_csi_ctrl_ops, + V4L2_CID_CUR_LINK_FREQ, 1, S64_MAX, + 1, 1); if (csi->freq_ctrl) csi->freq_ctrl->flags |= V4L2_CTRL_FLAG_READ_ONLY | V4L2_CTRL_FLAG_VOLATILE;