From patchwork Thu Jul 18 03:28:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Changhuang Liang X-Patchwork-Id: 13736026 Received: from CHN02-SH0-obe.outbound.protection.partner.outlook.cn (mail-sh0chn02on2108.outbound.protection.partner.outlook.cn [139.219.146.108]) (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 E949939FE4; Thu, 18 Jul 2024 05:02:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=139.219.146.108 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721278974; cv=fail; b=P5wEQer5pxi0Oeia/EFVlHBHY4dEw/jG4G6n+/tZhxeS9SXA1+FbXK5wEXF0T6Jy4xNlLrPEjekAcfmOveCaljZtwRi7Xu03aNN/YxCkaxfUMvVZ6FQGiqb+wp61niigSKc6c+AjM58xsq5GyKqUVF54qjYkltSEo9GiACP2RKA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721278974; c=relaxed/simple; bh=2s1F7eZ8Q9lQopQGZP8ofOFFunuU+GbKf6rfeagap6c=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=cTRCqdAgQh0iWpS/fhbxKazAH+iUMKyMCZyx/+33mbW6Mp5cUNXd8k4Nqwvf8B8kfMZlMwByFGIabkqAU1VVLjgKNAJrjS+IQat/xSz9EhnL2jB+4dJ9axj9FtpdCCcbSfhbEyI1QsZFxxw46xcObA+egvvjZRaCVv5WPPR4U1I= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=starfivetech.com; spf=pass smtp.mailfrom=starfivetech.com; arc=fail smtp.client-ip=139.219.146.108 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=starfivetech.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=starfivetech.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GODVCWjsyzJ66m4zhr5X0Fd3tARoai66g/Sr0eNIII6D9GBSpO/Zydf2iNT1s4JTeDYF1XdxwKn6WapXnVMkvdgCJX7zO4zxZ7oGpPdEJhqzdrBnkmw+5FHERCIX85YdMw5RPDDXDHsMdhVgq0vWB7V9dyYbi3L6/RFtwUXaq7hxlRJbFcFWHtB7kdouEFDb4XfEqhMjHOfFNSVSKh/07DkbK+ik+7IElE3u4gxW7mWeJUEdERQ/7YleLLytmZCw5wYniYTebgfF/bcp+mVvorxQuvHQTJ0E8ro9wB3XyDWGDv6o0xlnXwcFmZbqZiX1Prq2OxxOhoa99hdaKsPJNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Rx1XDLmsNv+KjI1/LhlUqD/tXJ4Z7DH5SC9QgQ6CVRQ=; b=L+xsNg+Q8y/8in7YGd0XBXq0SW7NMkgQEtGGckoZzI/HlvghX40BoVuibhwSQvw33WO/nv89TB0xxDdGVDhzwxDv/WU2PXg7M/Ky9dtxw5O+kC+Gk3Q6euCYlqYVEkZxrFhy8hvgERAY+9l7fPJuUPtwb2GY9+W5T6KCWF1T96x/lMiuGNy7li46KCgM4t7B8oMV/5N2TUWVIqfDjULrZ6dvZfqHal/NFH3pJB1XNkGgxdzlFVqjge6ZLviAiLT2PWhC0PsJmp/cp13rcU4oygSjAGoQrqTQ269opr/XOX027XyEADzyVt7+5qblrUcDECu3sX1J3DOxPBNZtneWBQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=starfivetech.com; dmarc=pass action=none header.from=starfivetech.com; dkim=pass header.d=starfivetech.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=starfivetech.com; Received: from ZQ0PR01MB1302.CHNPR01.prod.partner.outlook.cn (2406:e500:c550:1b::9) by ZQ0PR01MB1046.CHNPR01.prod.partner.outlook.cn (2406:e500:c550:e::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.36; Thu, 18 Jul 2024 03:28:45 +0000 Received: from ZQ0PR01MB1302.CHNPR01.prod.partner.outlook.cn ([fe80::64c5:50d8:4f2c:59aa]) by ZQ0PR01MB1302.CHNPR01.prod.partner.outlook.cn ([fe80::64c5:50d8:4f2c:59aa%6]) with mapi id 15.20.7741.044; Thu, 18 Jul 2024 03:28:45 +0000 From: Changhuang Liang To: Mauro Carvalho Chehab , Maxime Ripard , Greg Kroah-Hartman , Hans Verkuil Cc: Jacopo Mondi , Laurent Pinchart , Tomi Valkeinen , Jack Zhu , Keith Zhao , Changhuang Liang , Jayshri Pawar , Jai Luthra , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-staging@lists.linux.dev Subject: [PATCH v2 3/5] staging: media: starfive: Extract the ISP stream on as a helper function Date: Wed, 17 Jul 2024 20:28:32 -0700 Message-Id: <20240718032834.53876-4-changhuang.liang@starfivetech.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240718032834.53876-1-changhuang.liang@starfivetech.com> References: <20240718032834.53876-1-changhuang.liang@starfivetech.com> X-ClientProxiedBy: NT0PR01CA0031.CHNPR01.prod.partner.outlook.cn (2406:e500:c510:c::14) To ZQ0PR01MB1302.CHNPR01.prod.partner.outlook.cn (2406:e500:c550:1b::9) Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: ZQ0PR01MB1302:EE_|ZQ0PR01MB1046:EE_ X-MS-Office365-Filtering-Correlation-Id: 0d944c08-60ed-4d3f-433f-08dca6d9baa7 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|7416014|52116014|41320700013|366016|38350700014; X-Microsoft-Antispam-Message-Info: Fw84wif0y3Iny0kibhuiY3CYkBzRzP8rdGDKu4rezGcaZh9OZjXKbLMhs77LqIkwEhrPYmHnTWWhjYgcV7YuBpg1F0k9Ta6GPH8f71rN9znScHGv5OD7GPoi2IHJAPYtGY+OwqaEyHvBsc+VB2BMq9lfYV36QRA/2red5+2HkJgYaNsaBBXX/DaNANamV+hAlnh5RR+TwdqiEOqXJteeM8HYnS2b9Ty2kPZNDhkclrmFPeL/kPLAS3F5nTE9emqIUTLMSCqADek0rsvaLy1vH8bSFUGXyaYkBLo1BnTgIN4M6n8bffZ32jScPDlPYo5HQ2L9QiU7FfAdo5bGZiwTN5MnnCNBqm60BEvT8ZV/CyQFG1cgGBAzd89CEyGgJx8OX7ElHZrGQB8566Mbjhj+q8gg/nHTPHB+JM2cuNprBD+OaUfg0L3q5y8yjpKSk/xvOaBw8J1J4y6AewstJRpUT2V4FC9SVndgehzjieaYMGTGB9WYhg7g2aQ72TRtIqqN5fLkRLuqxQ55YnlXYkmb3NTFfs+L0vnfsizk+JaCsdIBU+tPi6prTmKqYA+sgRImBJnzlmBVQqB+UCHsijJFcQHvvw1EaH4gLdlOc9lWDiOm6FLwPybOJSPL9ebro+cV X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:ZQ0PR01MB1302.CHNPR01.prod.partner.outlook.cn;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(7416014)(52116014)(41320700013)(366016)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: uygQNIOuFZ86SaRqpFwPiCOD/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NIGrAV43mA1YRcCNsgDf4P4UQNWAUdYS0OqCxK7UhwIgYpvDTEwgdpzTO2xzHPL8euL7VEJXwd4hib9pWgRbzYayZcak86dbjs/YTY6q8KfbnnxLWklRLBaJwdiKAVSBEyn8mjS1ut7geiPIozL5NfNSArEqSPxvxLpf13zNr1Z3dTG3RzeG123/ewvTs2gTNzDiT1CPzVN29AIzUctL8BoQQD5NBefhTJS84dlyX4r3uhhLDGVdKf2BLMlhIYvsnvhCP7GSs0YuhhwkbaZBkyq1FjirNOy1SdFEWwk0J2xdN7sv9P7end2t+BSAeQRlt0+S5YDj0VJ1e6cOwQC/6s20qYlIbl6bgQBB4c8B9tE1oD3qEzLCv2fhXaPfPPfIQhS+zGR9OwiXGEGHtYn0ugpiVUDX1iq6o7RdogRgKQou+yTG0sk2e6g4fODCtMmBZ3ZgSHBhKTdDGQx3OL4IW87diwoy4oVEsknn1edffnAvvnpP2zwWxHrTTmQOtACkWZqejUGvSI6z2RWMivR+7SoczeZ8VfI= X-OriginatorOrg: starfivetech.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0d944c08-60ed-4d3f-433f-08dca6d9baa7 X-MS-Exchange-CrossTenant-AuthSource: ZQ0PR01MB1302.CHNPR01.prod.partner.outlook.cn X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jul 2024 03:28:45.0350 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 06fe3fa3-1221-43d3-861b-5a4ee687a85c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: fFkDnph6ZOVO+pEUzRQ3ARs1n5Ep0GPVNR7njxGHU5bGbr5biC1zW6+b/oUWPSY4LH57g3eLjJxwQUzcylDU0KVdVepenFNZcBFIwXeuBoejpX4U8mP888C7wmwjgIs/ X-MS-Exchange-Transport-CrossTenantHeadersStamped: ZQ0PR01MB1046 Extract the ISP stream on as a helper function and open it, Let the other files can use it. Signed-off-by: Changhuang Liang --- .../staging/media/starfive/camss/stf-isp.c | 27 ++++++++++++------- .../staging/media/starfive/camss/stf-isp.h | 2 ++ 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/drivers/staging/media/starfive/camss/stf-isp.c b/drivers/staging/media/starfive/camss/stf-isp.c index 4e6e26736852..8c6388edf049 100644 --- a/drivers/staging/media/starfive/camss/stf-isp.c +++ b/drivers/staging/media/starfive/camss/stf-isp.c @@ -55,23 +55,30 @@ int stf_isp_init(struct stfcamss *stfcamss) return 0; } -static int isp_set_stream(struct v4l2_subdev *sd, int enable) +void stf_isp_stream_on(struct stf_isp_dev *isp_dev, + struct v4l2_subdev_state *sd_state) { - struct stf_isp_dev *isp_dev = v4l2_get_subdevdata(sd); - struct v4l2_subdev_state *sd_state; struct v4l2_mbus_framefmt *fmt; struct v4l2_rect *crop; - sd_state = v4l2_subdev_lock_and_get_active_state(sd); fmt = v4l2_subdev_state_get_format(sd_state, STF_ISP_PAD_SINK); crop = v4l2_subdev_state_get_crop(sd_state, STF_ISP_PAD_SRC); - if (enable) { - stf_isp_reset(isp_dev); - stf_isp_init_cfg(isp_dev); - stf_isp_settings(isp_dev, crop, fmt->code); - stf_isp_stream_set(isp_dev); - } + stf_isp_reset(isp_dev); + stf_isp_init_cfg(isp_dev); + stf_isp_settings(isp_dev, crop, fmt->code); + stf_isp_stream_set(isp_dev); +} + +static int isp_set_stream(struct v4l2_subdev *sd, int enable) +{ + struct stf_isp_dev *isp_dev = v4l2_get_subdevdata(sd); + struct v4l2_subdev_state *sd_state; + + sd_state = v4l2_subdev_lock_and_get_active_state(sd); + + if (enable) + stf_isp_stream_on(isp_dev, sd_state); v4l2_subdev_call(isp_dev->source_subdev, video, s_stream, enable); diff --git a/drivers/staging/media/starfive/camss/stf-isp.h b/drivers/staging/media/starfive/camss/stf-isp.h index 955cbb048363..1a3e8cf7859c 100644 --- a/drivers/staging/media/starfive/camss/stf-isp.h +++ b/drivers/staging/media/starfive/camss/stf-isp.h @@ -421,6 +421,8 @@ void stf_isp_init_cfg(struct stf_isp_dev *isp_dev); void stf_isp_settings(struct stf_isp_dev *isp_dev, struct v4l2_rect *crop, u32 mcode); void stf_isp_stream_set(struct stf_isp_dev *isp_dev); +void stf_isp_stream_on(struct stf_isp_dev *isp_dev, + struct v4l2_subdev_state *sd_state); int stf_isp_init(struct stfcamss *stfcamss); int stf_isp_register(struct stf_isp_dev *isp_dev, struct v4l2_device *v4l2_dev); int stf_isp_unregister(struct stf_isp_dev *isp_dev);