From patchwork Sat Nov 25 18:20:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alain Volmat X-Patchwork-Id: 169764 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce62:0:b0:403:3b70:6f57 with SMTP id o2csp2093164vqx; Sat, 25 Nov 2023 10:22:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IFi1azDzNprIVca+KjhCVA7+Vszk0QiVi+BB4e1zNmZhaz8F1XCHwjL7d3yfrIFDY13mmTz X-Received: by 2002:a17:90b:1d09:b0:280:c98f:2090 with SMTP id on9-20020a17090b1d0900b00280c98f2090mr8711817pjb.32.1700936578188; Sat, 25 Nov 2023 10:22:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700936578; cv=none; d=google.com; s=arc-20160816; b=mOS9S/LcXxhiEgd1FYwxlT6ruyzdG2DmbTaiPoEKNU0Y/jQp5vua4NXdadV3hpRieT gC/o14NWAItuzZoZQO/EobLUKTrOoy+MWdFC/q/8597l9Cm380ZR/I2kP7Rqy6bpr2hg iD8jQyV0y4EDc6RKmrxO+8M+i3FyJWuciKxJoaqokyhmE8awP2C10jnZGJdspO3qcxAN Dv/CGgu67ByHCwZdY/g3vJXlQgXKP8N8GbIg7L9Ti0MwAQ11AShXw2MntdYTEKeYB5U7 JchcjgI5f6lvo7tf43PaLdn9IsD/OoNnyJe9W/mPq/Od6gb+kSHs2G2MHSym4zzSjwxE GUMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=HOBURhp8B0dbJzUA2B/3kWV5TC4bgsvCrRl8HPobFgo=; fh=aATIuJQBPIMUXucEnWXDVLrPAQTYMg8TXITJvQquOpU=; b=JFR97N8h/aMfXBm+PRRn7B0jZhmgiEl6PD/j/uCo6aDm1JQIuuXzsZUkyIbZ4cydKs OHEep9MuoSRy9CzLdqNq/MeTFgaQzuTGuhIbJRh/NARDzbTQyebsdtzHDKOqXc2pYjg9 z6AqR+5WVTh922fSIAhanS1hISv1wQA6kB0Whk6sL5EoRq9kz5tE0sSqBV/xVU6al8uQ 1W0/TwmwOK5Zffj3GVE6Y1ek9SIuXf4dELYjENQkzI5gNQTRKReyv+jcobbdbj4/VyaE BZ6c7B7cyplFI+KIjNaAYhBWIQDrsu79rPqUQ1R4qJaOmQMh2s0FbLyx0/NYZ1PFNxIt lsRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=QmIRdHp7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id fz4-20020a17090b024400b00285923a2797si3693098pjb.106.2023.11.25.10.22.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Nov 2023 10:22:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=QmIRdHp7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id A571880966E8; Sat, 25 Nov 2023 10:22:52 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232333AbjKYSWh (ORCPT + 99 others); Sat, 25 Nov 2023 13:22:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229746AbjKYSW2 (ORCPT ); Sat, 25 Nov 2023 13:22:28 -0500 Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 063AB119; Sat, 25 Nov 2023 10:22:33 -0800 (PST) Received: from pps.filterd (m0369458.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.22/8.17.1.22) with ESMTP id 3APGHDXE019482; Sat, 25 Nov 2023 19:21:48 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= selector1; bh=HOBURhp8B0dbJzUA2B/3kWV5TC4bgsvCrRl8HPobFgo=; b=Qm IRdHp7bvWmEGwWkl8j9Fkh36WiWP2HkuXbZqZpfua5QOpkERoe387jVCAq0+BX2L cG9WfETDaxKP3evd9SnAwK2ZVPYnrzEBNM8sc/dDqw4AonuwGlM89Fo2XCpYB5Qh FD4Hwk8gEr7YzwbzdPxQC3Z0qpNxV9PdoZ/9kVMCPbhlMWVnH91O1AR1Kgh6JjZd CrlXmPPerIOZGRbqIeAPMJNbx/Za/D+IyqWnXU0jR7LSyxQB7wqBjs+UsBmgh1a6 RvE8aRQHDnhLARdb4HE+mwYUpzaBHw1MuSWxiZesEckO1ezWaIwKOzVmk6EQquSu GVsxgOXRdaIIzskD04LA== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3uhr8amwd0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 25 Nov 2023 19:21:48 +0100 (CET) Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 9995510002A; Sat, 25 Nov 2023 19:21:47 +0100 (CET) Received: from Webmail-eu.st.com (shfdag1node1.st.com [10.75.129.69]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 92DF223C6AC; Sat, 25 Nov 2023 19:21:47 +0100 (CET) Received: from localhost (10.129.178.213) by SHFDAG1NODE1.st.com (10.75.129.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Sat, 25 Nov 2023 19:21:48 +0100 From: Alain Volmat To: Mauro Carvalho Chehab , Benjamin Mugnier , Sylvain Petinot CC: Sakari Ailus , Alain Volmat , , Subject: [PATCH 1/7] media: i2c: st-mipid02: add usage of v4l2_get_link_freq Date: Sat, 25 Nov 2023 19:20:49 +0100 Message-ID: <20231125182057.1379357-2-alain.volmat@foss.st.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231125182057.1379357-1-alain.volmat@foss.st.com> References: <20231125182057.1379357-1-alain.volmat@foss.st.com> MIME-Version: 1.0 X-Originating-IP: [10.129.178.213] X-ClientProxiedBy: SHFCAS1NODE2.st.com (10.75.129.73) To SHFDAG1NODE1.st.com (10.75.129.69) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-25_17,2023-11-22_01,2023-05-22_02 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Sat, 25 Nov 2023 10:22:52 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783561273339431825 X-GMAIL-MSGID: 1783561273339431825 Use the helper v4l2_get_link_freq instead of performing manually check of the LINK_FREQ or PIXELRATE ctrls. Signed-off-by: Alain Volmat --- drivers/media/i2c/st-mipid02.c | 66 ++++++++++------------------------ 1 file changed, 18 insertions(+), 48 deletions(-) diff --git a/drivers/media/i2c/st-mipid02.c b/drivers/media/i2c/st-mipid02.c index 914f915749a8..b699f0b4efe7 100644 --- a/drivers/media/i2c/st-mipid02.c +++ b/drivers/media/i2c/st-mipid02.c @@ -367,64 +367,34 @@ static int mipid02_detect(struct mipid02_dev *bridge) return mipid02_read_reg(bridge, MIPID02_CLK_LANE_WR_REG1, ®); } -static u32 mipid02_get_link_freq_from_cid_link_freq(struct mipid02_dev *bridge, - struct v4l2_subdev *subdev) -{ - struct v4l2_querymenu qm = {.id = V4L2_CID_LINK_FREQ, }; - struct v4l2_ctrl *ctrl; - int ret; - - ctrl = v4l2_ctrl_find(subdev->ctrl_handler, V4L2_CID_LINK_FREQ); - if (!ctrl) - return 0; - qm.index = v4l2_ctrl_g_ctrl(ctrl); - - ret = v4l2_querymenu(subdev->ctrl_handler, &qm); - if (ret) - return 0; - - return qm.value; -} - -static u32 mipid02_get_link_freq_from_cid_pixel_rate(struct mipid02_dev *bridge, - struct v4l2_subdev *subdev) -{ - struct v4l2_fwnode_endpoint *ep = &bridge->rx; - struct v4l2_ctrl *ctrl; - u32 pixel_clock; - u32 bpp = bpp_from_code(bridge->fmt.code); - - ctrl = v4l2_ctrl_find(subdev->ctrl_handler, V4L2_CID_PIXEL_RATE); - if (!ctrl) - return 0; - pixel_clock = v4l2_ctrl_g_ctrl_int64(ctrl); - - return pixel_clock * bpp / (2 * ep->bus.mipi_csi2.num_data_lanes); -} - /* * We need to know link frequency to setup clk_lane_reg1 timings. Link frequency - * will be computed using connected device V4L2_CID_PIXEL_RATE, bit per pixel + * will be retrieve from connected device via v4l2_get_link_freq, bit per pixel * and number of lanes. */ static int mipid02_configure_from_rx_speed(struct mipid02_dev *bridge) { struct i2c_client *client = bridge->i2c_client; struct v4l2_subdev *subdev = bridge->s_subdev; - u32 link_freq; - - link_freq = mipid02_get_link_freq_from_cid_link_freq(bridge, subdev); - if (!link_freq) { - link_freq = mipid02_get_link_freq_from_cid_pixel_rate(bridge, - subdev); - if (!link_freq) { - dev_err(&client->dev, "Failed to get link frequency"); - return -EINVAL; - } + struct v4l2_fwnode_endpoint *ep = &bridge->rx; + u32 bpp = bpp_from_code(bridge->fmt.code); + /* + * clk_lane_reg1 requires 4 times the unit interval time, and bitrate + * is twice the link frequency, hence ui_4 = 1000000000 * 4 / 2 + */ + u64 ui_4 = 2000000000; + s64 link_freq; + + link_freq = v4l2_get_link_freq(subdev->ctrl_handler, bpp, + 2 * ep->bus.mipi_csi2.num_data_lanes); + if (link_freq < 0) { + dev_err(&client->dev, "Failed to get link frequency"); + return -EINVAL; } - dev_dbg(&client->dev, "detect link_freq = %d Hz", link_freq); - bridge->r.clk_lane_reg1 |= (2000000000 / link_freq) << 2; + dev_dbg(&client->dev, "detect link_freq = %lld Hz", link_freq); + do_div(ui_4, link_freq); + bridge->r.clk_lane_reg1 |= ui_4 << 2; return 0; } From patchwork Sat Nov 25 18:20:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alain Volmat X-Patchwork-Id: 169762 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce62:0:b0:403:3b70:6f57 with SMTP id o2csp2093071vqx; Sat, 25 Nov 2023 10:22:46 -0800 (PST) X-Google-Smtp-Source: AGHT+IEm7ZnB6fo/nBa7bx2ErpoX5o4I93q7XH7Bd6lT+bRVflaSlcvSbMtYvVcSkSf70dsgXtNj X-Received: by 2002:a17:902:be14:b0:1cf:b55d:a0fd with SMTP id r20-20020a170902be1400b001cfb55da0fdmr2480976pls.33.1700936566246; Sat, 25 Nov 2023 10:22:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700936566; cv=none; d=google.com; s=arc-20160816; b=CZC4DBWVx5TaEh6Odtfj9mcOMYQ02pWIRVPlljPhtgC0TIyTzS/GJfXan+wVRWPKC3 393nxXFwBYWKNLrIX+hi8tgUwgkrDfndndcsT03ZZsqNdxoclMFPozQIDfDp/yjvKcwe jr+mkBinhetaaJsu1ZQtCKPSYnhAWt5YtSQka85ng/QnyiK3akMTMC8daJ8IKAFtKROg JjM6PL6Q2nZMdyGCVrGga+l7Rmym1n7c+6xj3j79T/8CDRORz45KSfaKnaVOiwoqgINs eISCRrkltYhqlu9gnzTWMWrSPdECCM2QGxuD5Jpqy0qGt0PDxCrcQvZC/1BJS53rcla6 lggw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=/goBROYTeH/F32rKxIN/0DnppG1ZihAuto8o1t5kprE=; fh=aATIuJQBPIMUXucEnWXDVLrPAQTYMg8TXITJvQquOpU=; b=s4Aa4flnjIwqcK0fWfvCDKFxHaY4MPlgXhwpFZtwg/58PkobJmgCEVae/0zYMhT4N1 reIrPvYtlhIQje2ezl5uTvvht9xoObr7jwy0ojWgY0/6zjZQhWhpiVOYb1jLyhsuqlEe OSyo7FthMm0DRtGxKD917l8sihxwWKE2c/VQSQr1Qn5iQ+QFh7mCuRzszgeZQr+z669v rNBF67TMH5bx3TmNfVj8jNR8ZYlyJsEHh3I2cK7JDah3KQRxHqvwSqYazmoV5YqkFjHG 0yjGgix7aYXrI4n6jyIukmHNp+1/18++P6ybsAE5nlov+Ojx3jA+iocpvVEq3cD6mW7I s3EA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=aS38ssEe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id mm20-20020a17090b359400b002800f26bfdasi6647729pjb.12.2023.11.25.10.22.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Nov 2023 10:22:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=aS38ssEe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 213B38062911; Sat, 25 Nov 2023 10:22:38 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231352AbjKYSW2 (ORCPT + 99 others); Sat, 25 Nov 2023 13:22:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229511AbjKYSW1 (ORCPT ); Sat, 25 Nov 2023 13:22:27 -0500 Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6946C5; Sat, 25 Nov 2023 10:22:33 -0800 (PST) Received: from pps.filterd (m0241204.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.22/8.17.1.22) with ESMTP id 3APCHQIm014841; Sat, 25 Nov 2023 19:21:57 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= selector1; bh=/goBROYTeH/F32rKxIN/0DnppG1ZihAuto8o1t5kprE=; b=aS 38ssEeprTn0MvTM/CvCVJc+dFdKvppmM1tqn5BKxm8yWFK0Vi3U2rBulkbTxZvPX uGsGEDUYL9Vu86fBMaM4cbM3pb5EkGcbZ6z/V+YTsvC9+cHcbKL0ijzjZejk3R5U 28+Bd7mPl59PX3Zw4uzahmXBTfAF0QGk7G7s2ljvqkQUWWvLYDzlRW6x/z6VUh2o /eL3WjHFq6tx20rHoT4AqhW9llHtXnQvNdM8/d5wcG94EDt8aQg6l8y9UBSYHTUW 4+ul+5KTZtpL0lWAExwlm9keF8LJBqVLukonyPrzi8gGWEr94JXNB9wYx9uj3QSz 0YqMLqxBgz7ugnJvij3Q== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3uk951hvn7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 25 Nov 2023 19:21:57 +0100 (CET) Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 42D0510002A; Sat, 25 Nov 2023 19:21:57 +0100 (CET) Received: from Webmail-eu.st.com (shfdag1node1.st.com [10.75.129.69]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 3972823C6A4; Sat, 25 Nov 2023 19:21:57 +0100 (CET) Received: from localhost (10.129.178.213) by SHFDAG1NODE1.st.com (10.75.129.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Sat, 25 Nov 2023 19:21:58 +0100 From: Alain Volmat To: Mauro Carvalho Chehab , Benjamin Mugnier , Sylvain Petinot CC: Sakari Ailus , Alain Volmat , , Subject: [PATCH 2/7] media: i2c: st-mipid02: don't keep track of streaming status Date: Sat, 25 Nov 2023 19:20:50 +0100 Message-ID: <20231125182057.1379357-3-alain.volmat@foss.st.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231125182057.1379357-1-alain.volmat@foss.st.com> References: <20231125182057.1379357-1-alain.volmat@foss.st.com> MIME-Version: 1.0 X-Originating-IP: [10.129.178.213] X-ClientProxiedBy: SHFCAS1NODE2.st.com (10.75.129.73) To SHFDAG1NODE1.st.com (10.75.129.69) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-25_17,2023-11-22_01,2023-05-22_02 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Sat, 25 Nov 2023 10:22:38 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783561260898526076 X-GMAIL-MSGID: 1783561260898526076 As explained in the following series, subdev do not have to keep track of their streaming status: https://lore.kernel.org/linux-media/20230914181704.4811-1-laurent.pinchart@ideasonboard.com/ Signed-off-by: Alain Volmat --- drivers/media/i2c/st-mipid02.c | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/drivers/media/i2c/st-mipid02.c b/drivers/media/i2c/st-mipid02.c index b699f0b4efe7..1efaa54866a8 100644 --- a/drivers/media/i2c/st-mipid02.c +++ b/drivers/media/i2c/st-mipid02.c @@ -112,7 +112,6 @@ struct mipid02_dev { } r; /* lock to protect all members below */ struct mutex lock; - bool streaming; struct v4l2_mbus_framefmt fmt; }; @@ -629,22 +628,13 @@ static int mipid02_s_stream(struct v4l2_subdev *sd, int enable) struct i2c_client *client = bridge->i2c_client; int ret = 0; - dev_dbg(&client->dev, "%s : requested %d / current = %d", __func__, - enable, bridge->streaming); - mutex_lock(&bridge->lock); - - if (bridge->streaming == enable) - goto out; + dev_dbg(&client->dev, "%s : requested %d\n", __func__, enable); ret = enable ? mipid02_stream_enable(bridge) : mipid02_stream_disable(bridge); - if (!ret) - bridge->streaming = enable; - -out: - dev_dbg(&client->dev, "%s current now = %d / %d", __func__, - bridge->streaming, ret); - mutex_unlock(&bridge->lock); + if (ret) + dev_err(&client->dev, "failed to stream %s (%d)\n", + enable ? "enable" : "disable", ret); return ret; } @@ -777,20 +767,14 @@ static int mipid02_set_fmt(struct v4l2_subdev *sd, mutex_lock(&bridge->lock); - if (bridge->streaming) { - ret = -EBUSY; - goto error; - } - if (format->pad == MIPID02_SOURCE) mipid02_set_fmt_source(sd, sd_state, format); else mipid02_set_fmt_sink(sd, sd_state, format); -error: mutex_unlock(&bridge->lock); - return ret; + return 0; } static const struct v4l2_subdev_video_ops mipid02_video_ops = { From patchwork Sat Nov 25 18:20:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alain Volmat X-Patchwork-Id: 169763 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce62:0:b0:403:3b70:6f57 with SMTP id o2csp2093094vqx; Sat, 25 Nov 2023 10:22:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IEqMLfUFz91RcmxyhwN1cTweTxvpAGKYYdv9b6aUCwn4rPYZUzCD0lZAchS5+tUSpAgvPhu X-Received: by 2002:a05:6a20:d704:b0:18b:3297:3e1a with SMTP id iz4-20020a056a20d70400b0018b32973e1amr8096808pzb.47.1700936569207; Sat, 25 Nov 2023 10:22:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700936569; cv=none; d=google.com; s=arc-20160816; b=HIWoaA8MacUm4QTrdaGLhiEW7sabiw2XrOfys8M2UHiPaaBhOIjajHAuInRaoGOcZV 4JIFGz+GChycFC/JEcDkgAN5jwSLxzeYXVRXYYLXFN9auhulCTIsyEYCskO2Ldkkwgeu TNbK6YuwZiX7UblCf1n9RPG7skV3ThXrsbA98tnd0XwDMPPIQ8JQXCM2gDU3tNGaJjsX 5n05I6OSkDpPjXQtq4E+Mu1l7BhRyAZw0y9vJRANToMHUB4NBfQjnHd/+bi0hC9h0+hB Lz+ns6swUSPgriiOExkTmgrhlF2a0ApwC6ktOSQXF0YSr2OBsdxa99zHm2jATG53otGi 7gRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=gkm0I1oG8oLv8E35BJU9COk/VzlDRgAl0VXDkgVpWVw=; fh=aATIuJQBPIMUXucEnWXDVLrPAQTYMg8TXITJvQquOpU=; b=hBskEU8vVgn6VBJwb1SDGnw54apxMRLF6ywe+i+6G88V/IvGn3OE+Svc3NH+ooLYVI WZpc0hVa/dKo3ArKOxM/Vmq9FcdY2R5/NqQLAX10g/vSeB9ROs0WuXGld0pphAt4OWEZ 4muavA1YWE19nVMyuRC3UThFqtA/edUdwiT2A7agIH0OzFCqKboJnUizgaJRvjj9/RCJ IbTvaUiNrSicKUcm5IDQAGRScyXesQ56ruVCSRrvKyXZLZ6+QkvdQtnupWwblAPQoIRS hxbSk+G/AbFxKj10+CNviYLYJiNO8c4btTGtQB4EXk6/+TW8+tiI0O3cJGGBkho7O2yC MRWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=RRNdDkwT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id b2-20020a056a000a8200b006cb4d47cfa9si6325559pfl.270.2023.11.25.10.22.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Nov 2023 10:22:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=RRNdDkwT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 58CE88061B64; Sat, 25 Nov 2023 10:22:45 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232148AbjKYSWe (ORCPT + 99 others); Sat, 25 Nov 2023 13:22:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43558 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229697AbjKYSW2 (ORCPT ); Sat, 25 Nov 2023 13:22:28 -0500 Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E93F4DB; Sat, 25 Nov 2023 10:22:33 -0800 (PST) Received: from pps.filterd (m0241204.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.22/8.17.1.22) with ESMTP id 3APDTRpj020744; Sat, 25 Nov 2023 19:22:06 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= selector1; bh=gkm0I1oG8oLv8E35BJU9COk/VzlDRgAl0VXDkgVpWVw=; b=RR NdDkwTsT5T9ZLOG2E4STcei6kFaX59Nelo++Bmy48aPf3XLgJ3bLAoFvSKc1lnG+ 0Q6MKAPFCo2AfxtkJ5qbhGhrGAzPJW2imHvT37ZkmzYPKL4We4XVuQpljkvO0EtM Vu8UyHN6xl7qVMQqom6saBkHFx9kZgh0DGm8XSltobzN47gFCVEat0zLwB6LQRI1 tMljnyfmU6JRKKZiWFMI+ET9HFJKFCnNB2G31m+TO6DXQL96unKdjJkLBaK3H0Ac QKQOQfAzyujtT/dek1HGcnOwWgJuaxfXMXFmbJqZ+qY0yL+QiTGhe+PunytCWms+ QPd1CMG0CCMuXQEEG2tA== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3uk951hvng-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 25 Nov 2023 19:22:06 +0100 (CET) Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 209B510004A; Sat, 25 Nov 2023 19:22:05 +0100 (CET) Received: from Webmail-eu.st.com (shfdag1node1.st.com [10.75.129.69]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id DBF2823C6A6; Sat, 25 Nov 2023 19:22:05 +0100 (CET) Received: from localhost (10.129.178.213) by SHFDAG1NODE1.st.com (10.75.129.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Sat, 25 Nov 2023 19:22:06 +0100 From: Alain Volmat To: Mauro Carvalho Chehab , Benjamin Mugnier , Sylvain Petinot CC: Sakari Ailus , Alain Volmat , , Subject: [PATCH 3/7] media: i2c: st-mipid02: use cci_* helpers for register access. Date: Sat, 25 Nov 2023 19:20:51 +0100 Message-ID: <20231125182057.1379357-4-alain.volmat@foss.st.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231125182057.1379357-1-alain.volmat@foss.st.com> References: <20231125182057.1379357-1-alain.volmat@foss.st.com> MIME-Version: 1.0 X-Originating-IP: [10.129.178.213] X-ClientProxiedBy: SHFCAS1NODE2.st.com (10.75.129.73) To SHFDAG1NODE1.st.com (10.75.129.69) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-25_17,2023-11-22_01,2023-05-22_02 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Sat, 25 Nov 2023 10:22:46 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783561263773381620 X-GMAIL-MSGID: 1783561263773381620 Use cci_read & cci_write functions for accessing registers. Signed-off-by: Alain Volmat --- drivers/media/i2c/Kconfig | 1 + drivers/media/i2c/st-mipid02.c | 169 +++++++++------------------------ 2 files changed, 47 insertions(+), 123 deletions(-) diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig index 59ee0ca2c978..68f84a47f307 100644 --- a/drivers/media/i2c/Kconfig +++ b/drivers/media/i2c/Kconfig @@ -1432,6 +1432,7 @@ config VIDEO_ST_MIPID02 depends on I2C && VIDEO_DEV select MEDIA_CONTROLLER select VIDEO_V4L2_SUBDEV_API + select V4L2_CCI_I2C select V4L2_FWNODE help Support for STMicroelectronics MIPID02 CSI-2 to PARALLEL bridge. diff --git a/drivers/media/i2c/st-mipid02.c b/drivers/media/i2c/st-mipid02.c index 1efaa54866a8..15f6c9e8b7f1 100644 --- a/drivers/media/i2c/st-mipid02.c +++ b/drivers/media/i2c/st-mipid02.c @@ -17,24 +17,25 @@ #include #include #include +#include #include #include #include #include -#define MIPID02_CLK_LANE_WR_REG1 0x01 -#define MIPID02_CLK_LANE_REG1 0x02 -#define MIPID02_CLK_LANE_REG3 0x04 -#define MIPID02_DATA_LANE0_REG1 0x05 -#define MIPID02_DATA_LANE0_REG2 0x06 -#define MIPID02_DATA_LANE1_REG1 0x09 -#define MIPID02_DATA_LANE1_REG2 0x0a -#define MIPID02_MODE_REG1 0x14 -#define MIPID02_MODE_REG2 0x15 -#define MIPID02_DATA_ID_RREG 0x17 -#define MIPID02_DATA_SELECTION_CTRL 0x19 -#define MIPID02_PIX_WIDTH_CTRL 0x1e -#define MIPID02_PIX_WIDTH_CTRL_EMB 0x1f +#define MIPID02_CLK_LANE_WR_REG1 CCI_REG8(0x01) +#define MIPID02_CLK_LANE_REG1 CCI_REG8(0x02) +#define MIPID02_CLK_LANE_REG3 CCI_REG8(0x04) +#define MIPID02_DATA_LANE0_REG1 CCI_REG8(0x05) +#define MIPID02_DATA_LANE0_REG2 CCI_REG8(0x06) +#define MIPID02_DATA_LANE1_REG1 CCI_REG8(0x09) +#define MIPID02_DATA_LANE1_REG2 CCI_REG8(0x0a) +#define MIPID02_MODE_REG1 CCI_REG8(0x14) +#define MIPID02_MODE_REG2 CCI_REG8(0x15) +#define MIPID02_DATA_ID_RREG CCI_REG8(0x17) +#define MIPID02_DATA_SELECTION_CTRL CCI_REG8(0x19) +#define MIPID02_PIX_WIDTH_CTRL CCI_REG8(0x1e) +#define MIPID02_PIX_WIDTH_CTRL_EMB CCI_REG8(0x1f) /* Bits definition for MIPID02_CLK_LANE_REG1 */ #define CLK_ENABLE BIT(0) @@ -88,6 +89,7 @@ struct mipid02_dev { struct i2c_client *i2c_client; struct regulator_bulk_data supplies[MIPID02_NUM_SUPPLIES]; struct v4l2_subdev sd; + struct regmap *regmap; struct media_pad pad[MIPID02_PAD_NB]; struct clk *xclk; struct gpio_desc *reset_gpio; @@ -237,62 +239,6 @@ static inline struct mipid02_dev *to_mipid02_dev(struct v4l2_subdev *sd) return container_of(sd, struct mipid02_dev, sd); } -static int mipid02_read_reg(struct mipid02_dev *bridge, u16 reg, u8 *val) -{ - struct i2c_client *client = bridge->i2c_client; - struct i2c_msg msg[2]; - u8 buf[2]; - int ret; - - buf[0] = reg >> 8; - buf[1] = reg & 0xff; - - msg[0].addr = client->addr; - msg[0].flags = client->flags; - msg[0].buf = buf; - msg[0].len = sizeof(buf); - - msg[1].addr = client->addr; - msg[1].flags = client->flags | I2C_M_RD; - msg[1].buf = val; - msg[1].len = 1; - - ret = i2c_transfer(client->adapter, msg, 2); - if (ret < 0) { - dev_dbg(&client->dev, "%s: %x i2c_transfer, reg: %x => %d\n", - __func__, client->addr, reg, ret); - return ret; - } - - return 0; -} - -static int mipid02_write_reg(struct mipid02_dev *bridge, u16 reg, u8 val) -{ - struct i2c_client *client = bridge->i2c_client; - struct i2c_msg msg; - u8 buf[3]; - int ret; - - buf[0] = reg >> 8; - buf[1] = reg & 0xff; - buf[2] = val; - - msg.addr = client->addr; - msg.flags = client->flags; - msg.buf = buf; - msg.len = sizeof(buf); - - ret = i2c_transfer(client->adapter, &msg, 1); - if (ret < 0) { - dev_dbg(&client->dev, "%s: i2c_transfer, reg: %x => %d\n", - __func__, reg, ret); - return ret; - } - - return 0; -} - static int mipid02_get_regulators(struct mipid02_dev *bridge) { unsigned int i; @@ -357,13 +303,13 @@ static void mipid02_set_power_off(struct mipid02_dev *bridge) static int mipid02_detect(struct mipid02_dev *bridge) { - u8 reg; + u64 reg; /* * There is no version registers. Just try to read register * MIPID02_CLK_LANE_WR_REG1. */ - return mipid02_read_reg(bridge, MIPID02_CLK_LANE_WR_REG1, ®); + return cci_read(bridge->regmap, MIPID02_CLK_LANE_WR_REG1, ®, NULL); } /* @@ -524,13 +470,9 @@ static int mipid02_stream_disable(struct mipid02_dev *bridge) goto error; /* Disable all lanes */ - ret = mipid02_write_reg(bridge, MIPID02_CLK_LANE_REG1, 0); - if (ret) - goto error; - ret = mipid02_write_reg(bridge, MIPID02_DATA_LANE0_REG1, 0); - if (ret) - goto error; - ret = mipid02_write_reg(bridge, MIPID02_DATA_LANE1_REG1, 0); + cci_write(bridge->regmap, MIPID02_CLK_LANE_REG1, 0, &ret); + cci_write(bridge->regmap, MIPID02_DATA_LANE0_REG1, 0, &ret); + cci_write(bridge->regmap, MIPID02_DATA_LANE1_REG1, 0, &ret); if (ret) goto error; error: @@ -561,51 +503,26 @@ static int mipid02_stream_enable(struct mipid02_dev *bridge) goto error; /* write mipi registers */ - ret = mipid02_write_reg(bridge, MIPID02_CLK_LANE_REG1, - bridge->r.clk_lane_reg1); - if (ret) - goto error; - ret = mipid02_write_reg(bridge, MIPID02_CLK_LANE_REG3, CLK_MIPI_CSI); - if (ret) - goto error; - ret = mipid02_write_reg(bridge, MIPID02_DATA_LANE0_REG1, - bridge->r.data_lane0_reg1); - if (ret) - goto error; - ret = mipid02_write_reg(bridge, MIPID02_DATA_LANE0_REG2, - DATA_MIPI_CSI); - if (ret) - goto error; - ret = mipid02_write_reg(bridge, MIPID02_DATA_LANE1_REG1, - bridge->r.data_lane1_reg1); - if (ret) - goto error; - ret = mipid02_write_reg(bridge, MIPID02_DATA_LANE1_REG2, - DATA_MIPI_CSI); - if (ret) - goto error; - ret = mipid02_write_reg(bridge, MIPID02_MODE_REG1, - MODE_NO_BYPASS | bridge->r.mode_reg1); - if (ret) - goto error; - ret = mipid02_write_reg(bridge, MIPID02_MODE_REG2, - bridge->r.mode_reg2); - if (ret) - goto error; - ret = mipid02_write_reg(bridge, MIPID02_DATA_ID_RREG, - bridge->r.data_id_rreg); - if (ret) - goto error; - ret = mipid02_write_reg(bridge, MIPID02_DATA_SELECTION_CTRL, - bridge->r.data_selection_ctrl); - if (ret) - goto error; - ret = mipid02_write_reg(bridge, MIPID02_PIX_WIDTH_CTRL, - bridge->r.pix_width_ctrl); - if (ret) - goto error; - ret = mipid02_write_reg(bridge, MIPID02_PIX_WIDTH_CTRL_EMB, - bridge->r.pix_width_ctrl_emb); + cci_write(bridge->regmap, MIPID02_CLK_LANE_REG1, + bridge->r.clk_lane_reg1, &ret); + cci_write(bridge->regmap, MIPID02_CLK_LANE_REG3, CLK_MIPI_CSI, &ret); + cci_write(bridge->regmap, MIPID02_DATA_LANE0_REG1, + bridge->r.data_lane0_reg1, &ret); + cci_write(bridge->regmap, MIPID02_DATA_LANE0_REG2, DATA_MIPI_CSI, &ret); + cci_write(bridge->regmap, MIPID02_DATA_LANE1_REG1, + bridge->r.data_lane1_reg1, &ret); + cci_write(bridge->regmap, MIPID02_DATA_LANE1_REG2, DATA_MIPI_CSI, &ret); + cci_write(bridge->regmap, MIPID02_MODE_REG1, + MODE_NO_BYPASS | bridge->r.mode_reg1, &ret); + cci_write(bridge->regmap, MIPID02_MODE_REG2, bridge->r.mode_reg2, &ret); + cci_write(bridge->regmap, MIPID02_DATA_ID_RREG, bridge->r.data_id_rreg, + &ret); + cci_write(bridge->regmap, MIPID02_DATA_SELECTION_CTRL, + bridge->r.data_selection_ctrl, &ret); + cci_write(bridge->regmap, MIPID02_PIX_WIDTH_CTRL, + bridge->r.pix_width_ctrl, &ret); + cci_write(bridge->regmap, MIPID02_PIX_WIDTH_CTRL_EMB, + bridge->r.pix_width_ctrl_emb, &ret); if (ret) goto error; @@ -984,6 +901,12 @@ static int mipid02_probe(struct i2c_client *client) return ret; } + /* Initialise the regmap for further cci access */ + bridge->regmap = devm_cci_regmap_init_i2c(client, 16); + if (IS_ERR(bridge->regmap)) + return dev_err_probe(dev, PTR_ERR(bridge->regmap), + "failed to get cci regmap\n"); + mutex_init(&bridge->lock); bridge->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; bridge->sd.entity.function = MEDIA_ENT_F_VID_IF_BRIDGE; From patchwork Sat Nov 25 18:20:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alain Volmat X-Patchwork-Id: 169765 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce62:0:b0:403:3b70:6f57 with SMTP id o2csp2093470vqx; Sat, 25 Nov 2023 10:23:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IFTlss8yEEj4+80+S4xCkuNW7yaLvGmZKrGOGubAzqwbBLtM8oyzlL4I/Vc0uq5KDjRxx9H X-Received: by 2002:a05:6808:319a:b0:3ad:ae62:8253 with SMTP id cd26-20020a056808319a00b003adae628253mr9132903oib.15.1700936622156; Sat, 25 Nov 2023 10:23:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700936622; cv=none; d=google.com; s=arc-20160816; b=QGe48mBYxzfyENEWf/UdAhioTSIQKuim6N5zsoTCgKZtV8Vtmuz5PS+DiRlkVnkEJx 6aalCSamEihdbNWOpoXDK4850ax8QXQsBVN1PNcSHuMVsICoejT8bHRrFa8Q8sQoUiSW yqU5O0Qh6+kQ9EPfOcka0Gv6gvK/2gIV5R9nJ1QrtsHVe1uaVSDMbGiVIXy/Ey36C6SL frhIxDPAj4ZV5iI07gKkg2wSt6k191rYMh4O8A3FZzDph8nK1k7kVvP3TgWJF2JJH2y5 5a6eHlctq8tBbxfdJjtdbJF0rjTS5CvxjJXnfdAPCZ70pK8NeuemtJ85HyGDCS7FXd0f MQ5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=c9CbByJ4q7lI396RIfpc5M725lJvNGjFgx6JOsUCteQ=; fh=aATIuJQBPIMUXucEnWXDVLrPAQTYMg8TXITJvQquOpU=; b=i62zF9sXDIB+w3IrUEi02PRVaqAYH9fAgOmrEy4aHcOVft01Uf0c8LSnNdhCBaT7H0 VmOzAYLsDHSo402/6HTtgqE9d05vTSmdHFE1PmMkfDMFaR6lIcGcuadKl2y27skNHZGq HxO0e/8hceP1pH4sVxRZASpc09Bd/0tLNaV43wEDD0cud2zto611390hirFOwS9kHj79 CtUgFOzPoldc1Uo4cT0bEkp0Rz6LTW2a2e5u01edxnXqv/N5YRnk/OS+3k8GRGovKW0e XacAGNle+77XpQTxyAXnVDllB34X2CTXLhRIaS7pNzzh+628XLpjp4pUrOeAhVssBiAQ n+xA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=o5yZWac1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id c4-20020a631c44000000b005789f552066si6545609pgm.335.2023.11.25.10.23.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Nov 2023 10:23:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=o5yZWac1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 50EB6809647D; Sat, 25 Nov 2023 10:23:37 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231352AbjKYSX1 (ORCPT + 99 others); Sat, 25 Nov 2023 13:23:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229746AbjKYSX0 (ORCPT ); Sat, 25 Nov 2023 13:23:26 -0500 Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF3FBD3; Sat, 25 Nov 2023 10:23:31 -0800 (PST) Received: from pps.filterd (m0288072.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.22/8.17.1.22) with ESMTP id 3AP1NcLd017784; Sat, 25 Nov 2023 19:23:15 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= selector1; bh=c9CbByJ4q7lI396RIfpc5M725lJvNGjFgx6JOsUCteQ=; b=o5 yZWac1+X0fb7sBFt9jWUkoQRhcsCMd400gt7qM1q8unVZcGHsWlw4iXh2qK1qPkI 7zntRjJ3+sHC8MDt/lqaHS/1wjvW0Pu/F2h60UgH1zZ2yZTUKEQPiKDUvMkip6Mo IwovnQghzsFr0hryptFWcMc/BymCoqyhSmuwc/mqtntvZ8IMWKLlC1gQYsPnCWWj WUSEUhv9V550gvx5JSCt25K46McoCPy+tTjolf0r8HzATopmHDeYf/IbeV0SswYg uLUbzKnl9PQqR4ucROC7HA1a5rce9VgYox8NsVBceXXJnTkxGcn1OaDLRvPUne7v y46zu6cS4xZTp41z4zng== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3uk77kj4ry-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 25 Nov 2023 19:23:14 +0100 (CET) Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id DB99E10002A; Sat, 25 Nov 2023 19:23:13 +0100 (CET) Received: from Webmail-eu.st.com (shfdag1node1.st.com [10.75.129.69]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id D06CC23C6A4; Sat, 25 Nov 2023 19:23:13 +0100 (CET) Received: from localhost (10.129.178.213) by SHFDAG1NODE1.st.com (10.75.129.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Sat, 25 Nov 2023 19:23:14 +0100 From: Alain Volmat To: Mauro Carvalho Chehab , Benjamin Mugnier , Sylvain Petinot CC: Sakari Ailus , Alain Volmat , , Subject: [PATCH 4/7] media: i2c: st-mipid02: use active state to store pad formats Date: Sat, 25 Nov 2023 19:20:52 +0100 Message-ID: <20231125182057.1379357-5-alain.volmat@foss.st.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231125182057.1379357-1-alain.volmat@foss.st.com> References: <20231125182057.1379357-1-alain.volmat@foss.st.com> MIME-Version: 1.0 X-Originating-IP: [10.129.178.213] X-ClientProxiedBy: SHFCAS1NODE2.st.com (10.75.129.73) To SHFDAG1NODE1.st.com (10.75.129.69) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-25_17,2023-11-22_01,2023-05-22_02 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Sat, 25 Nov 2023 10:23:37 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783561319442363089 X-GMAIL-MSGID: 1783561319442363089 Store formats information within pad allowing to simplify further more the driver (mutex / format store within the driver structure no more necessary). Signed-off-by: Alain Volmat --- drivers/media/i2c/st-mipid02.c | 206 ++++++++++++--------------------- 1 file changed, 75 insertions(+), 131 deletions(-) diff --git a/drivers/media/i2c/st-mipid02.c b/drivers/media/i2c/st-mipid02.c index 15f6c9e8b7f1..7af209905d7b 100644 --- a/drivers/media/i2c/st-mipid02.c +++ b/drivers/media/i2c/st-mipid02.c @@ -112,9 +112,6 @@ struct mipid02_dev { u8 pix_width_ctrl; u8 pix_width_ctrl_emb; } r; - /* lock to protect all members below */ - struct mutex lock; - struct v4l2_mbus_framefmt fmt; }; static int bpp_from_code(__u32 code) @@ -192,18 +189,6 @@ static u8 data_type_from_code(__u32 code) } } -static void init_format(struct v4l2_mbus_framefmt *fmt) -{ - fmt->code = MEDIA_BUS_FMT_SBGGR8_1X8; - fmt->field = V4L2_FIELD_NONE; - fmt->colorspace = V4L2_COLORSPACE_SRGB; - fmt->ycbcr_enc = V4L2_MAP_YCBCR_ENC_DEFAULT(V4L2_COLORSPACE_SRGB); - fmt->quantization = V4L2_QUANTIZATION_FULL_RANGE; - fmt->xfer_func = V4L2_MAP_XFER_FUNC_DEFAULT(V4L2_COLORSPACE_SRGB); - fmt->width = 640; - fmt->height = 480; -} - static __u32 get_fmt_code(__u32 code) { unsigned int i; @@ -317,12 +302,13 @@ static int mipid02_detect(struct mipid02_dev *bridge) * will be retrieve from connected device via v4l2_get_link_freq, bit per pixel * and number of lanes. */ -static int mipid02_configure_from_rx_speed(struct mipid02_dev *bridge) +static int mipid02_configure_from_rx_speed(struct mipid02_dev *bridge, + struct v4l2_mbus_framefmt *fmt) { struct i2c_client *client = bridge->i2c_client; struct v4l2_subdev *subdev = bridge->s_subdev; struct v4l2_fwnode_endpoint *ep = &bridge->rx; - u32 bpp = bpp_from_code(bridge->fmt.code); + u32 bpp = bpp_from_code(fmt->code); /* * clk_lane_reg1 requires 4 times the unit interval time, and bitrate * is twice the link frequency, hence ui_4 = 1000000000 * 4 / 2 @@ -394,7 +380,8 @@ static int mipid02_configure_data1_lane(struct mipid02_dev *bridge, int nb, return 0; } -static int mipid02_configure_from_rx(struct mipid02_dev *bridge) +static int mipid02_configure_from_rx(struct mipid02_dev *bridge, + struct v4l2_mbus_framefmt *fmt) { struct v4l2_fwnode_endpoint *ep = &bridge->rx; bool are_lanes_swap = ep->bus.mipi_csi2.data_lanes[0] == 2; @@ -419,7 +406,7 @@ static int mipid02_configure_from_rx(struct mipid02_dev *bridge) bridge->r.mode_reg1 |= are_lanes_swap ? MODE_DATA_SWAP : 0; bridge->r.mode_reg1 |= (nb - 1) << 1; - return mipid02_configure_from_rx_speed(bridge); + return mipid02_configure_from_rx_speed(bridge, fmt); } static int mipid02_configure_from_tx(struct mipid02_dev *bridge) @@ -439,16 +426,17 @@ static int mipid02_configure_from_tx(struct mipid02_dev *bridge) return 0; } -static int mipid02_configure_from_code(struct mipid02_dev *bridge) +static int mipid02_configure_from_code(struct mipid02_dev *bridge, + struct v4l2_mbus_framefmt *fmt) { u8 data_type; bridge->r.data_id_rreg = 0; - if (bridge->fmt.code != MEDIA_BUS_FMT_JPEG_1X8) { + if (fmt->code != MEDIA_BUS_FMT_JPEG_1X8) { bridge->r.data_selection_ctrl |= SELECTION_MANUAL_DATA; - data_type = data_type_from_code(bridge->fmt.code); + data_type = data_type_from_code(fmt->code); if (!data_type) return -EINVAL; bridge->r.data_id_rreg = data_type; @@ -485,23 +473,31 @@ static int mipid02_stream_disable(struct mipid02_dev *bridge) static int mipid02_stream_enable(struct mipid02_dev *bridge) { struct i2c_client *client = bridge->i2c_client; + struct v4l2_subdev_state *state; + struct v4l2_mbus_framefmt *fmt; int ret = -EINVAL; if (!bridge->s_subdev) goto error; memset(&bridge->r, 0, sizeof(bridge->r)); + + state = v4l2_subdev_lock_and_get_active_state(&bridge->sd); + fmt = v4l2_subdev_state_get_format(state, MIPID02_SINK_0); + /* build registers content */ - ret = mipid02_configure_from_rx(bridge); + ret = mipid02_configure_from_rx(bridge, fmt); if (ret) goto error; ret = mipid02_configure_from_tx(bridge); if (ret) goto error; - ret = mipid02_configure_from_code(bridge); + ret = mipid02_configure_from_code(bridge, fmt); if (ret) goto error; + v4l2_subdev_unlock_state(state); + /* write mipi registers */ cci_write(bridge->regmap, MIPID02_CLK_LANE_REG1, bridge->r.clk_lane_reg1, &ret); @@ -556,11 +552,32 @@ static int mipid02_s_stream(struct v4l2_subdev *sd, int enable) return ret; } +static const struct v4l2_mbus_framefmt default_fmt = { + .code = MEDIA_BUS_FMT_SBGGR8_1X8, + .field = V4L2_FIELD_NONE, + .colorspace = V4L2_COLORSPACE_SRGB, + .ycbcr_enc = V4L2_YCBCR_ENC_DEFAULT, + .quantization = V4L2_QUANTIZATION_FULL_RANGE, + .xfer_func = V4L2_XFER_FUNC_DEFAULT, + .width = 640, + .height = 480, +}; + +static int mipid02_init_cfg(struct v4l2_subdev *sd, + struct v4l2_subdev_state *state) +{ + *v4l2_subdev_state_get_format(state, MIPID02_SINK_0) = default_fmt; + /* MIPID02_SINK_1 isn't supported yet */ + *v4l2_subdev_state_get_format(state, MIPID02_SOURCE) = default_fmt; + + return 0; +} + static int mipid02_enum_mbus_code(struct v4l2_subdev *sd, struct v4l2_subdev_state *sd_state, struct v4l2_subdev_mbus_code_enum *code) { - struct mipid02_dev *bridge = to_mipid02_dev(sd); + struct v4l2_mbus_framefmt *sink_fmt; int ret = 0; switch (code->pad) { @@ -571,10 +588,13 @@ static int mipid02_enum_mbus_code(struct v4l2_subdev *sd, code->code = mipid02_supported_fmt_codes[code->index]; break; case MIPID02_SOURCE: - if (code->index == 0) - code->code = serial_to_parallel_code(bridge->fmt.code); - else + if (code->index == 0) { + sink_fmt = v4l2_subdev_state_get_format(sd_state, + MIPID02_SINK_0); + code->code = serial_to_parallel_code(sink_fmt->code); + } else { ret = -EINVAL; + } break; default: ret = -EINVAL; @@ -583,113 +603,36 @@ static int mipid02_enum_mbus_code(struct v4l2_subdev *sd, return ret; } -static int mipid02_get_fmt(struct v4l2_subdev *sd, - struct v4l2_subdev_state *sd_state, - struct v4l2_subdev_format *format) -{ - struct v4l2_mbus_framefmt *mbus_fmt = &format->format; - struct mipid02_dev *bridge = to_mipid02_dev(sd); - struct i2c_client *client = bridge->i2c_client; - struct v4l2_mbus_framefmt *fmt; - - dev_dbg(&client->dev, "%s probe %d", __func__, format->pad); - - if (format->pad >= MIPID02_PAD_NB) - return -EINVAL; - /* second CSI-2 pad not yet supported */ - if (format->pad == MIPID02_SINK_1) - return -EINVAL; - - if (format->which == V4L2_SUBDEV_FORMAT_TRY) - fmt = v4l2_subdev_state_get_format(sd_state, format->pad); - else - fmt = &bridge->fmt; - - mutex_lock(&bridge->lock); - - *mbus_fmt = *fmt; - /* code may need to be converted for source */ - if (format->pad == MIPID02_SOURCE) - mbus_fmt->code = serial_to_parallel_code(mbus_fmt->code); - - mutex_unlock(&bridge->lock); - - return 0; -} - -static void mipid02_set_fmt_source(struct v4l2_subdev *sd, - struct v4l2_subdev_state *sd_state, - struct v4l2_subdev_format *format) -{ - struct mipid02_dev *bridge = to_mipid02_dev(sd); - - /* source pad mirror sink pad */ - if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE) - format->format = bridge->fmt; - else - format->format = *v4l2_subdev_state_get_format(sd_state, - MIPID02_SINK_0); - - /* but code may need to be converted */ - format->format.code = serial_to_parallel_code(format->format.code); - - /* only apply format for V4L2_SUBDEV_FORMAT_TRY case */ - if (format->which != V4L2_SUBDEV_FORMAT_TRY) - return; - - *v4l2_subdev_state_get_format(sd_state, MIPID02_SOURCE) = - format->format; -} - -static void mipid02_set_fmt_sink(struct v4l2_subdev *sd, - struct v4l2_subdev_state *sd_state, - struct v4l2_subdev_format *format) -{ - struct mipid02_dev *bridge = to_mipid02_dev(sd); - struct v4l2_subdev_format source_fmt; - struct v4l2_mbus_framefmt *fmt; - - format->format.code = get_fmt_code(format->format.code); - - if (format->which == V4L2_SUBDEV_FORMAT_TRY) - fmt = v4l2_subdev_state_get_format(sd_state, format->pad); - else - fmt = &bridge->fmt; - - *fmt = format->format; - - /* - * Propagate the format change to the source pad, taking - * care not to update the format pointer given back to user - */ - source_fmt = *format; - mipid02_set_fmt_source(sd, sd_state, &source_fmt); -} - static int mipid02_set_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_state *sd_state, - struct v4l2_subdev_format *format) + struct v4l2_subdev_format *fmt) { struct mipid02_dev *bridge = to_mipid02_dev(sd); struct i2c_client *client = bridge->i2c_client; - int ret = 0; + struct v4l2_mbus_framefmt *pad_fmt; - dev_dbg(&client->dev, "%s for %d", __func__, format->pad); + dev_dbg(&client->dev, "%s for %d", __func__, fmt->pad); - if (format->pad >= MIPID02_PAD_NB) - return -EINVAL; /* second CSI-2 pad not yet supported */ - if (format->pad == MIPID02_SINK_1) + if (fmt->pad == MIPID02_SINK_1) return -EINVAL; - mutex_lock(&bridge->lock); + pad_fmt = v4l2_subdev_state_get_format(sd_state, fmt->pad); + fmt->format.code = get_fmt_code(fmt->format.code); - if (format->pad == MIPID02_SOURCE) - mipid02_set_fmt_source(sd, sd_state, format); - else - mipid02_set_fmt_sink(sd, sd_state, format); + /* code may need to be converted */ + if (fmt->pad == MIPID02_SOURCE) + fmt->format.code = serial_to_parallel_code(fmt->format.code); - mutex_unlock(&bridge->lock); + *pad_fmt = fmt->format; + + /* Propagate the format to the source pad in case of sink pad update */ + if (fmt->pad == MIPID02_SINK_0) { + pad_fmt = v4l2_subdev_state_get_format(sd_state, + MIPID02_SOURCE); + *pad_fmt = fmt->format; + pad_fmt->code = serial_to_parallel_code(fmt->format.code); + } return 0; } @@ -699,8 +642,9 @@ static const struct v4l2_subdev_video_ops mipid02_video_ops = { }; static const struct v4l2_subdev_pad_ops mipid02_pad_ops = { + .init_cfg = mipid02_init_cfg, .enum_mbus_code = mipid02_enum_mbus_code, - .get_fmt = mipid02_get_fmt, + .get_fmt = v4l2_subdev_get_fmt, .set_fmt = mipid02_set_fmt, }; @@ -868,8 +812,6 @@ static int mipid02_probe(struct i2c_client *client) if (!bridge) return -ENOMEM; - init_format(&bridge->fmt); - bridge->i2c_client = client; v4l2_i2c_subdev_init(&bridge->sd, client, &mipid02_subdev_ops); @@ -907,7 +849,6 @@ static int mipid02_probe(struct i2c_client *client) return dev_err_probe(dev, PTR_ERR(bridge->regmap), "failed to get cci regmap\n"); - mutex_init(&bridge->lock); bridge->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; bridge->sd.entity.function = MEDIA_ENT_F_VID_IF_BRIDGE; bridge->sd.entity.ops = &mipid02_subdev_entity_ops; @@ -918,7 +859,13 @@ static int mipid02_probe(struct i2c_client *client) bridge->pad); if (ret) { dev_err(&client->dev, "pads init failed %d", ret); - goto mutex_cleanup; + return ret; + } + + ret = v4l2_subdev_init_finalize(&bridge->sd); + if (ret < 0) { + dev_err(dev, "subdev init error: %d\n", ret); + goto entity_cleanup; } /* enable clock, power and reset device if available */ @@ -962,8 +909,6 @@ static int mipid02_probe(struct i2c_client *client) mipid02_set_power_off(bridge); entity_cleanup: media_entity_cleanup(&bridge->sd.entity); -mutex_cleanup: - mutex_destroy(&bridge->lock); return ret; } @@ -978,7 +923,6 @@ static void mipid02_remove(struct i2c_client *client) v4l2_async_unregister_subdev(&bridge->sd); mipid02_set_power_off(bridge); media_entity_cleanup(&bridge->sd.entity); - mutex_destroy(&bridge->lock); } static const struct of_device_id mipid02_dt_ids[] = { From patchwork Sat Nov 25 18:20:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alain Volmat X-Patchwork-Id: 169766 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce62:0:b0:403:3b70:6f57 with SMTP id o2csp2093835vqx; Sat, 25 Nov 2023 10:24:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IHSOndgqJDzQh3R2s4aw9tHTBBh/XM23Myqb0aRvhzAPDUoTTOhD0z+JYMx2YnnwaFvl9VR X-Received: by 2002:a05:6a00:cc3:b0:6cb:db73:a6db with SMTP id b3-20020a056a000cc300b006cbdb73a6dbmr7766382pfv.21.1700936675319; Sat, 25 Nov 2023 10:24:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700936675; cv=none; d=google.com; s=arc-20160816; b=dyjhVLI1sr7aWb8cG5f8DpNfyUysVfA1TtxVtiPLYH6uzeI3iKfo2Ng6m8vrFBjPjW p1kUI0Ysu3HM+BZgnFysP08Uu1x6mxwVoOM0SdppdcRGYDNoGmLFLXFkkL41K5Dpg3ph SzV2gChrUwoGPSPFHNP+mIyYqEXJblGjEwu5VNoxh/1sCxDGhuha7ufA7WgYS9io3F+U KIq5zn7Trgab89DoC6GbYRInmsZNJ2JF/bsJPAcMMOesP2bbKJ49JL/5eDDHQfOtowkR i/oyyRAE3sD0rfXHxJVGgEHMDwY4AMCOdvBRkbYKEZfewPuZ7fODdiNL/2Nr68No+kIh Ef0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=2W7wCmX+NW6hmQI+fefcnZEdAolQngt0ItXz/a69y6s=; fh=aATIuJQBPIMUXucEnWXDVLrPAQTYMg8TXITJvQquOpU=; b=vq/2IRzM7xdh9xkqZvaGlllkQERT/DGv+Hg7afXrnSBqK0o22Pg0bHEHcpledhFhbk kquRjpAZZKFj/zotcAx2q+HaQ8ArG3dZEOqbGqIHw72WjEG58nPwk/SytZeACa0+J9Sd sgXIgZgVSznNUV0yRWRReIHhEW15msZKN/Z7VDZ7ztGd9TrR4YYfp/OaYSH3g9HcgYnK cYM7yxJe9sNdJq68HEoQh5iJlPMEA3C7m/u5RSulvt+HjHmSODqOZZU008cemo8/K4jL FzfXDA5AyLjXX9Wd2glqSNt4iPAGWrE+Sgnln9dibZRmqBL23+LtiCV8K1HFOxc/oaZI LQ/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=YVc8fFc+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id t22-20020a056a0021d600b006b69f056508si6394266pfj.149.2023.11.25.10.24.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Nov 2023 10:24:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=YVc8fFc+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 5298E806293C; Sat, 25 Nov 2023 10:24:34 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232315AbjKYSYZ (ORCPT + 99 others); Sat, 25 Nov 2023 13:24:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232305AbjKYSYY (ORCPT ); Sat, 25 Nov 2023 13:24:24 -0500 Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 655AFDB; Sat, 25 Nov 2023 10:24:30 -0800 (PST) Received: from pps.filterd (m0288072.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.22/8.17.1.22) with ESMTP id 3AP1NcLf017784; Sat, 25 Nov 2023 19:24:22 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= selector1; bh=2W7wCmX+NW6hmQI+fefcnZEdAolQngt0ItXz/a69y6s=; b=YV c8fFc+3++JkPvpRgNz0MlPsd2w76b3oGtor4ZTLK3rT50VrM1Z83p0F6Rm4W2/rO kc4JGd6jXgyHJQpb4ZvEmNOBn4nJH+ehbaU4qtApxd/VZhsKMnXoJFiin/fBn4gj vKt1iWhHPKDXhl4gaORTowhb9p6rby/fHbQf4rzN8bVAtek31HjaXT8KSSdFXj6w +3Z+ozl7P9ruuOXrLIL8O9Awj7/rRQvWhcFWbHlVlhzVZZ/Enktk6za42h78HvNF SYoFgIhfnbzr8JiYLAHA3XOGe72ZpeUYvgOA6oDZIhT+lVtsvYdA2CS/nF1W0qSq jAQrBmJiKMvOUZTWFChw== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3uk77kj4t8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 25 Nov 2023 19:24:22 +0100 (CET) Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id C40BF10002A; Sat, 25 Nov 2023 19:24:07 +0100 (CET) Received: from Webmail-eu.st.com (shfdag1node1.st.com [10.75.129.69]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id BABCD23C6AF; Sat, 25 Nov 2023 19:24:07 +0100 (CET) Received: from localhost (10.129.178.213) by SHFDAG1NODE1.st.com (10.75.129.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Sat, 25 Nov 2023 19:24:08 +0100 From: Alain Volmat To: Mauro Carvalho Chehab , Benjamin Mugnier , Sylvain Petinot CC: Sakari Ailus , Alain Volmat , , Subject: [PATCH 5/7] media: i2c: st-mipid02: use mipi-csi macro for data-type Date: Sat, 25 Nov 2023 19:20:53 +0100 Message-ID: <20231125182057.1379357-6-alain.volmat@foss.st.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231125182057.1379357-1-alain.volmat@foss.st.com> References: <20231125182057.1379357-1-alain.volmat@foss.st.com> MIME-Version: 1.0 X-Originating-IP: [10.129.178.213] X-ClientProxiedBy: SHFCAS1NODE2.st.com (10.75.129.73) To SHFDAG1NODE1.st.com (10.75.129.69) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-25_18,2023-11-22_01,2023-05-22_02 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Sat, 25 Nov 2023 10:24:34 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783561374770777049 X-GMAIL-MSGID: 1783561374770777049 Use MIPI data-type macros. Signed-off-by: Alain Volmat --- drivers/media/i2c/st-mipid02.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/media/i2c/st-mipid02.c b/drivers/media/i2c/st-mipid02.c index 7af209905d7b..783c2848c584 100644 --- a/drivers/media/i2c/st-mipid02.c +++ b/drivers/media/i2c/st-mipid02.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -158,17 +159,17 @@ static u8 data_type_from_code(__u32 code) case MEDIA_BUS_FMT_SGBRG8_1X8: case MEDIA_BUS_FMT_SGRBG8_1X8: case MEDIA_BUS_FMT_SRGGB8_1X8: - return 0x2a; + return MIPI_CSI2_DT_RAW8; case MEDIA_BUS_FMT_SBGGR10_1X10: case MEDIA_BUS_FMT_SGBRG10_1X10: case MEDIA_BUS_FMT_SGRBG10_1X10: case MEDIA_BUS_FMT_SRGGB10_1X10: - return 0x2b; + return MIPI_CSI2_DT_RAW10; case MEDIA_BUS_FMT_SBGGR12_1X12: case MEDIA_BUS_FMT_SGBRG12_1X12: case MEDIA_BUS_FMT_SGRBG12_1X12: case MEDIA_BUS_FMT_SRGGB12_1X12: - return 0x2c; + return MIPI_CSI2_DT_RAW12; case MEDIA_BUS_FMT_YUYV8_1X16: case MEDIA_BUS_FMT_YVYU8_1X16: case MEDIA_BUS_FMT_UYVY8_1X16: @@ -177,13 +178,13 @@ static u8 data_type_from_code(__u32 code) case MEDIA_BUS_FMT_YVYU8_2X8: case MEDIA_BUS_FMT_UYVY8_2X8: case MEDIA_BUS_FMT_VYUY8_2X8: - return 0x1e; + return MIPI_CSI2_DT_YUV422_8B; case MEDIA_BUS_FMT_BGR888_1X24: - return 0x24; + return MIPI_CSI2_DT_RGB888; case MEDIA_BUS_FMT_RGB565_1X16: case MEDIA_BUS_FMT_RGB565_2X8_LE: case MEDIA_BUS_FMT_RGB565_2X8_BE: - return 0x22; + return MIPI_CSI2_DT_RGB565; default: return 0; } From patchwork Sat Nov 25 18:20:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alain Volmat X-Patchwork-Id: 169767 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce62:0:b0:403:3b70:6f57 with SMTP id o2csp2094305vqx; Sat, 25 Nov 2023 10:25:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IGm4R6mVu93BnYAGV5tJS86mht7yI/UHHg5Ce/Y7oTjf7NVPLtGjpJ1BC/XHWPihIKPNSO5 X-Received: by 2002:a05:6a00:2d0e:b0:6c6:58ae:b39f with SMTP id fa14-20020a056a002d0e00b006c658aeb39fmr7641496pfb.6.1700936739543; Sat, 25 Nov 2023 10:25:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700936739; cv=none; d=google.com; s=arc-20160816; b=0VuOr9+HoZT/Jdlyq9XeA1R13HrklcP4QPLMErIQahatwpau85OA7TeMQEkZegJ00w j7Xo84sEakw5+LtgvTu1vZPx7TH7sZofzj2QeRTVRmlveRnSkChyJaCYhwu+xzFYeWYG OsSKkL7XJ0k7geg5nUc0uS15+2lAA0+9EeLqK/TdoNNFajouITIKT+BuCtzJmB4MBBGy J2z/DufIpT5Tqobr3iOulRfJYje1hI/wYKXl9pNV8tRUi68S4QrFherxsXk62A/l57aP 80ByR5QTcoLKVYCqCp3xyekN/gXqVq5FOP6ekLlileI9XP6h2+r7rfLfEmFA7I9Qftfa YYNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=V3Tv5qFFk5ZxQeDUxNUTAAu3mduf0PktUnlTC3Lmm5k=; fh=aATIuJQBPIMUXucEnWXDVLrPAQTYMg8TXITJvQquOpU=; b=pj/uVcAx9mu30FuDKkv5nXsFOCUEITJaczUCuorajCRJ3TBwbJgaeQo9AnjjIQtLQ1 7sgf/jCLXXW+cJ87V45iMD74zapBgbZv/vkg+BfSgAxBXBoP+D+plOhOmGqb3/ykWxCf AeBBmZAgGrtUVvQgjBGjMJX0CgDV1ED6mS2cIBqs9ie9+p9Z0S4U4xaZ7oCOmB0YlQMZ YAYkrd2CS4yAsC7X5I9Bx5TYAFUx6KdLLOC1ASBbuv6upZidS8a4hzm1bvQKY4PKAtxK yN3kLeVDNf57Ukkfs0JLgknDIjPVXRncmC85GZRF8HBQ6qCSpnwBsJ9Muhbj6RPCvTja HbqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=3szK15e0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id o66-20020a634145000000b005be03f0da7esi6767089pga.174.2023.11.25.10.25.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Nov 2023 10:25:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=3szK15e0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 8BD318096798; Sat, 25 Nov 2023 10:25:34 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229999AbjKYSZZ (ORCPT + 99 others); Sat, 25 Nov 2023 13:25:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229653AbjKYSZY (ORCPT ); Sat, 25 Nov 2023 13:25:24 -0500 Received: from mx07-00178001.pphosted.com (mx08-00178001.pphosted.com [91.207.212.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 467BFD3; Sat, 25 Nov 2023 10:25:31 -0800 (PST) Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.22/8.17.1.22) with ESMTP id 3AP4pIvT029338; Sat, 25 Nov 2023 19:24:52 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= selector1; bh=V3Tv5qFFk5ZxQeDUxNUTAAu3mduf0PktUnlTC3Lmm5k=; b=3s zK15e0pA/ua5IMLkmESOskXzI7bY6AugncnVL/lxzRJVYmr+HJWEsow6/Jxfeaxk Vf1i1oEnGKsbJaMlVSks05cQ2qmBCvz043C1P1OxG7MqZ3sFoDv0gTg0OyLBrzpa 83qHk40t2qbh+OpwyFvnthrKA9FlINPrEPV8IOnmlAoksnB9KHLCVsHi5Ndlld8/ GCD21nlyDAZHtc53Nzpw/0SC59MxfgdczGPLTjOEanCaYeIL3sLQqqVCmHVyqUuT meWgs3zX+WzB5aIFJDQP7ZpLZlPzzlLzREJeX5uXjTtXgkmsz2zjA6WTUwAESVGo 8JGb9nqNcKRp5kXnAwIQ== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3uk8pjhw1b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 25 Nov 2023 19:24:52 +0100 (CET) Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id D093510002A; Sat, 25 Nov 2023 19:24:51 +0100 (CET) Received: from Webmail-eu.st.com (shfdag1node1.st.com [10.75.129.69]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id C8CAB23C6B5; Sat, 25 Nov 2023 19:24:51 +0100 (CET) Received: from localhost (10.129.178.213) by SHFDAG1NODE1.st.com (10.75.129.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Sat, 25 Nov 2023 19:24:52 +0100 From: Alain Volmat To: Mauro Carvalho Chehab , Benjamin Mugnier , Sylvain Petinot CC: Sakari Ailus , Alain Volmat , , Subject: [PATCH 6/7] media: i2c: st-mipid02: removal of unused link_frequency variable Date: Sat, 25 Nov 2023 19:20:54 +0100 Message-ID: <20231125182057.1379357-7-alain.volmat@foss.st.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231125182057.1379357-1-alain.volmat@foss.st.com> References: <20231125182057.1379357-1-alain.volmat@foss.st.com> MIME-Version: 1.0 X-Originating-IP: [10.129.178.213] X-ClientProxiedBy: SHFCAS1NODE2.st.com (10.75.129.73) To SHFDAG1NODE1.st.com (10.75.129.69) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-25_18,2023-11-22_01,2023-05-22_02 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Sat, 25 Nov 2023 10:25:34 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783561442550510252 X-GMAIL-MSGID: 1783561442550510252 link_frequency variable within struct mipid02_dev seems to have never been used hence remove it. Signed-off-by: Alain Volmat --- drivers/media/i2c/st-mipid02.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/media/i2c/st-mipid02.c b/drivers/media/i2c/st-mipid02.c index 783c2848c584..ef0d7f8ba17d 100644 --- a/drivers/media/i2c/st-mipid02.c +++ b/drivers/media/i2c/st-mipid02.c @@ -96,7 +96,6 @@ struct mipid02_dev { struct gpio_desc *reset_gpio; /* endpoints info */ struct v4l2_fwnode_endpoint rx; - u64 link_frequency; struct v4l2_fwnode_endpoint tx; /* remote source */ struct v4l2_async_notifier notifier; From patchwork Sat Nov 25 18:20:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alain Volmat X-Patchwork-Id: 169768 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce62:0:b0:403:3b70:6f57 with SMTP id o2csp2094435vqx; Sat, 25 Nov 2023 10:25:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IGS3Kjjp8PerzsUsmrfr7KPBm/DZ00lPJ45lds6yF2Y8aBazQvb8GNdYpgY0P96rCdOR3+w X-Received: by 2002:a05:6a00:3988:b0:6be:25c5:4f74 with SMTP id fi8-20020a056a00398800b006be25c54f74mr8812662pfb.13.1700936759248; Sat, 25 Nov 2023 10:25:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700936759; cv=none; d=google.com; s=arc-20160816; b=jWUBXtEKxhQMzrkvteX2FLTA9JrhKe42O84dBVInH2clsH5a5dwJaDOdRXkwoadm4C ImXWpkklOLujRu6M7MX9OigWAGM74B+wZKKQ2W5TeDKyGKIZBfY8TDL4PWWFftgxDVtG HRbiCFONQva6s18depssw2hVdv8kMApDq4/ts9d728KduRyiwojD3OVfCLM0ZEiVx03o mPVGa/meeQAeBHnoy+6JqYnrmztgLVJQNX/F/M7JVxtIqjic/ipvepqfLuaK0HomBEOj sDBS9veBih76lSQ4wVGieTngHz604GYaHE3439SEBBFfQ5VU7uBn2uNtTki7cK2+MpXm N9Vw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=A8F7B7cE8kCF1aRSP01KDKaAlSolwScYTQsjr31vGjs=; fh=aATIuJQBPIMUXucEnWXDVLrPAQTYMg8TXITJvQquOpU=; b=mWsPDk4ADDKs6cYgQ8oXYIc/xn/6Bb4/KrURzwawbnUWCsdgpRCRm46WWkg7Uikt60 iv5gg3KeeaOwMSo/aunef38vWXVmlRjNIHZrBfOQNRYdTGWWKAqgXfmAQwU7tSbeATiH upX0+ds1VfBzhCwSngLDCm0MzzCrQi7k1xvkEMNlz89CRexpdbvjCReE8TWoyDXpmK6l 6wAVu+albiNxhBawnIbtVargeEFvhpr9KuxIfssNh0XMoKH6KTXGih+Jv9kMvpeXY+Jp AscaqSFKQGDRz4W97V7ohPT7mXbDLzvCu19ekEYBtgRtK77yN83EQE0ZgQaAE5BukVaC GWTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=yC6lZiSk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id l12-20020a056a00140c00b006cbd2cd3efasi6106368pfu.313.2023.11.25.10.25.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Nov 2023 10:25:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=yC6lZiSk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id DFC5680967AD; Sat, 25 Nov 2023 10:25:56 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232278AbjKYSZe (ORCPT + 99 others); Sat, 25 Nov 2023 13:25:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232226AbjKYSZd (ORCPT ); Sat, 25 Nov 2023 13:25:33 -0500 Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 630DB18C; Sat, 25 Nov 2023 10:25:39 -0800 (PST) Received: from pps.filterd (m0369458.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.22/8.17.1.22) with ESMTP id 3AP1kUfn029211; Sat, 25 Nov 2023 19:25:31 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= selector1; bh=A8F7B7cE8kCF1aRSP01KDKaAlSolwScYTQsjr31vGjs=; b=yC 6lZiSkddfTveFmKSYHrlQw7zfKow7CKBO36ok5bZTu6rdhqwrm4mFK0vRpZnes2x vL7/+Y+OlnI7CNVZr0XSkByhUobDrP/6m6oez8VDUj2vDSdx51o4MIVxl6vhUekb bvVLCQibHrrVDCmH1EtYXdtGCawp8P6EtM9r8HWAxXr0AhSRL2vbu0TFHC3smJ5N sqisCgkpVJKlzlS3ZOSt4/HLGt3PonogzPT69IPm7nJbgMA/tykgaZZWHvw2AMZI SNJTIDmLxPYaYLlD6a2d4TUOCXjeCYLKEt9rZuiYTQD+acyeLMYnnjzkRBrlumKr fnNHapQi2DpbE/9YrkCw== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3uhr8amwm3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 25 Nov 2023 19:25:31 +0100 (CET) Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 10F4910002A; Sat, 25 Nov 2023 19:25:30 +0100 (CET) Received: from Webmail-eu.st.com (shfdag1node1.st.com [10.75.129.69]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 0536523C6B9; Sat, 25 Nov 2023 19:25:30 +0100 (CET) Received: from localhost (10.129.178.213) by SHFDAG1NODE1.st.com (10.75.129.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Sat, 25 Nov 2023 19:25:30 +0100 From: Alain Volmat To: Mauro Carvalho Chehab , Benjamin Mugnier , Sylvain Petinot CC: Sakari Ailus , Alain Volmat , , Subject: [PATCH 7/7] media: i2c: st-mipid02: add Y8 format support Date: Sat, 25 Nov 2023 19:20:55 +0100 Message-ID: <20231125182057.1379357-8-alain.volmat@foss.st.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231125182057.1379357-1-alain.volmat@foss.st.com> References: <20231125182057.1379357-1-alain.volmat@foss.st.com> MIME-Version: 1.0 X-Originating-IP: [10.129.178.213] X-ClientProxiedBy: SHFCAS1NODE2.st.com (10.75.129.73) To SHFDAG1NODE1.st.com (10.75.129.69) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-25_18,2023-11-22_01,2023-05-22_02 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Sat, 25 Nov 2023 10:25:57 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783561462997811192 X-GMAIL-MSGID: 1783561462997811192 Add support of MEDIA_BUS_FMT_Y8_1X8. Signed-off-by: Alain Volmat --- drivers/media/i2c/st-mipid02.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/media/i2c/st-mipid02.c b/drivers/media/i2c/st-mipid02.c index ef0d7f8ba17d..366e840c8858 100644 --- a/drivers/media/i2c/st-mipid02.c +++ b/drivers/media/i2c/st-mipid02.c @@ -70,7 +70,7 @@ static const u32 mipid02_supported_fmt_codes[] = { MEDIA_BUS_FMT_RGB565_2X8_LE, MEDIA_BUS_FMT_RGB565_2X8_BE, MEDIA_BUS_FMT_YUYV8_2X8, MEDIA_BUS_FMT_YVYU8_2X8, MEDIA_BUS_FMT_UYVY8_2X8, MEDIA_BUS_FMT_VYUY8_2X8, - MEDIA_BUS_FMT_JPEG_1X8 + MEDIA_BUS_FMT_Y8_1X8, MEDIA_BUS_FMT_JPEG_1X8 }; /* regulator supplies */ @@ -121,6 +121,7 @@ static int bpp_from_code(__u32 code) case MEDIA_BUS_FMT_SGBRG8_1X8: case MEDIA_BUS_FMT_SGRBG8_1X8: case MEDIA_BUS_FMT_SRGGB8_1X8: + case MEDIA_BUS_FMT_Y8_1X8: return 8; case MEDIA_BUS_FMT_SBGGR10_1X10: case MEDIA_BUS_FMT_SGBRG10_1X10: @@ -158,6 +159,7 @@ static u8 data_type_from_code(__u32 code) case MEDIA_BUS_FMT_SGBRG8_1X8: case MEDIA_BUS_FMT_SGRBG8_1X8: case MEDIA_BUS_FMT_SRGGB8_1X8: + case MEDIA_BUS_FMT_Y8_1X8: return MIPI_CSI2_DT_RAW8; case MEDIA_BUS_FMT_SBGGR10_1X10: case MEDIA_BUS_FMT_SGBRG10_1X10: