From patchwork Mon May 2 12:03:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 12834152 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CE186C433EF for ; Mon, 2 May 2022 12:05:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=3+q7zFSVgUmLDLufa+wZLKVecZpUniGtfMGJuknZDe8=; b=cbwZjzkQpGmNUJ rm3lBOiBtqXUczoVbKg8qzZrXFPucx3kQc/BeiPRKfVuerybYXraVzAZZR7yjNUsjagLlxL+hCIeR OKhcrEEZNRLhUU9Y36Ucf6tGJH/902gF0uXXB4K+oZXDPB0jnBbY4h2H7buHm/ymkYNS7mr3n0kV0 PwyHoj3i/eO5v8E2XMXgARwLkhe1ZRwINk2DTum7YvBo+2L0nHab4LlT63gWyzVHMs6gcuCbp+qWR ggXhzYj0ZJY3w++IddE7V8N75Wwpc3TCD0P2eQOHXPvVyY0Lvh7zA2Mm1bum0kKUQmZaBxPAAMrZK ArKRhSY9B8NAw+F44LKw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nlUn6-0013VW-K2; Mon, 02 May 2022 12:04:36 +0000 Received: from mga02.intel.com ([134.134.136.20]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nlUn1-0013Tf-4o; Mon, 02 May 2022 12:04:34 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1651493071; x=1683029071; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=IjZ/C+7/ISySe9jtHQJBuhtEda5Hxd+KTWubLo1DgSU=; b=buiu9WldEX9Q0YFnNP74qr1MbhSCLjAFpmkuoVDk4+4aI4PIWvwvssGJ UMNfSMW+pp2EB6KnsIn6GclbsWHkIk32RlhTgAMJFTZISEho/IKY+/x0H tMy47YNsvO3OGDhf0I7DJCql3UkoMJGVizX+UtxBrHMMhWdxkXa+2is+8 Md3DKA9VrZKt9ovMSNwaEy+5HAml7n0UHBbbk6RFkCdUQaj0UlJ7qsDnB jfex03fdS00bcDGCy823EIbNRlCg8rQTmHRK7cRyYL5+lTHiuRZ2jM3zi mR6gcOQDVFvJGdqueo+wgHbloP9HQfTyU4CXsWAt7nas+G9pwUyWnMnjX g==; X-IronPort-AV: E=McAfee;i="6400,9594,10334"; a="254641897" X-IronPort-AV: E=Sophos;i="5.91,190,1647327600"; d="scan'208";a="254641897" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 May 2022 05:04:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,190,1647327600"; d="scan'208";a="516043060" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga003.jf.intel.com with ESMTP; 02 May 2022 05:04:13 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 3B901179; Mon, 2 May 2022 15:04:13 +0300 (EEST) From: Andy Shevchenko To: Greg Kroah-Hartman , Gaston Gonzalez , Andy Shevchenko , linux-staging@lists.linux.dev, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Florian Fainelli , Ray Jui , Scott Branden , Broadcom Kernel Team , Nicolas Saenz Julienne Subject: [PATCH v1 1/1] staging: vc04_services: Re-use generic struct s32_fract Date: Mon, 2 May 2022 15:03:55 +0300 Message-Id: <20220502120355.84334-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220502_050431_268184_F01373C0 X-CRM114-Status: GOOD ( 21.19 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Instead of custom data type re-use generic struct s32_fract. No changes intended. Signed-off-by: Andy Shevchenko Reported-by: kernel test robot Reported-by: kernel test robot --- .../bcm2835-camera/bcm2835-camera.c | 24 +++++++------- .../vc04_services/bcm2835-camera/controls.c | 33 ++++++++++--------- .../vchiq-mmal/mmal-msg-common.h | 7 ++-- .../vchiq-mmal/mmal-msg-format.h | 6 ++-- .../vchiq-mmal/mmal-parameters.h | 15 ++++----- .../vc04_services/vchiq-mmal/mmal-vchiq.c | 10 +++--- 6 files changed, 46 insertions(+), 49 deletions(-) diff --git a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c index 88b1878854e0..fd456d1f7061 100644 --- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c +++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c @@ -1033,9 +1033,9 @@ static int mmal_setup_video_component(struct bcm2835_mmal_dev *dev, preview_port->es.video.crop.y = 0; preview_port->es.video.crop.width = f->fmt.pix.width; preview_port->es.video.crop.height = f->fmt.pix.height; - preview_port->es.video.frame_rate.num = + preview_port->es.video.frame_rate.numerator = dev->capture.timeperframe.denominator; - preview_port->es.video.frame_rate.den = + preview_port->es.video.frame_rate.denominator = dev->capture.timeperframe.numerator; ret = vchiq_mmal_port_set_format(dev->instance, preview_port); @@ -1084,9 +1084,9 @@ static int mmal_setup_encode_component(struct bcm2835_mmal_dev *dev, port->es.video.crop.y = 0; port->es.video.crop.width = f->fmt.pix.width; port->es.video.crop.height = f->fmt.pix.height; - port->es.video.frame_rate.num = + port->es.video.frame_rate.numerator = dev->capture.timeperframe.denominator; - port->es.video.frame_rate.den = + port->es.video.frame_rate.denominator = dev->capture.timeperframe.numerator; port->format.encoding = mfmt->mmal; @@ -1225,8 +1225,8 @@ static int mmal_setup_components(struct bcm2835_mmal_dev *dev, camera_port->es.video.crop.y = 0; camera_port->es.video.crop.width = f->fmt.pix.width; camera_port->es.video.crop.height = f->fmt.pix.height; - camera_port->es.video.frame_rate.num = 0; - camera_port->es.video.frame_rate.den = 1; + camera_port->es.video.frame_rate.numerator = 0; + camera_port->es.video.frame_rate.denominator = 1; camera_port->es.video.color_space = MMAL_COLOR_SPACE_JPEG_JFIF; ret = vchiq_mmal_port_set_format(dev->instance, camera_port); @@ -1629,8 +1629,8 @@ static int mmal_init(struct bcm2835_mmal_dev *dev) format->es->video.crop.y = 0; format->es->video.crop.width = 1024; format->es->video.crop.height = 768; - format->es->video.frame_rate.num = 0; /* Rely on fps_range */ - format->es->video.frame_rate.den = 1; + format->es->video.frame_rate.numerator = 0; /* Rely on fps_range */ + format->es->video.frame_rate.denominator = 1; format = &camera->output[CAM_PORT_VIDEO].format; @@ -1643,8 +1643,8 @@ static int mmal_init(struct bcm2835_mmal_dev *dev) format->es->video.crop.y = 0; format->es->video.crop.width = 1024; format->es->video.crop.height = 768; - format->es->video.frame_rate.num = 0; /* Rely on fps_range */ - format->es->video.frame_rate.den = 1; + format->es->video.frame_rate.numerator = 0; /* Rely on fps_range */ + format->es->video.frame_rate.denominator = 1; format = &camera->output[CAM_PORT_CAPTURE].format; @@ -1656,8 +1656,8 @@ static int mmal_init(struct bcm2835_mmal_dev *dev) format->es->video.crop.y = 0; format->es->video.crop.width = 2592; format->es->video.crop.height = 1944; - format->es->video.frame_rate.num = 0; /* Rely on fps_range */ - format->es->video.frame_rate.den = 1; + format->es->video.frame_rate.numerator = 0; /* Rely on fps_range */ + format->es->video.frame_rate.denominator = 1; dev->capture.width = format->es->video.width; dev->capture.height = format->es->video.height; diff --git a/drivers/staging/vc04_services/bcm2835-camera/controls.c b/drivers/staging/vc04_services/bcm2835-camera/controls.c index eb722f16fb91..a663d34868f8 100644 --- a/drivers/staging/vc04_services/bcm2835-camera/controls.c +++ b/drivers/staging/vc04_services/bcm2835-camera/controls.c @@ -154,13 +154,13 @@ static int ctrl_set_rational(struct bcm2835_mmal_dev *dev, struct v4l2_ctrl *ctrl, const struct bcm2835_mmal_v4l2_ctrl *mmal_ctrl) { - struct mmal_parameter_rational rational_value; + struct s32_fract rational_value; struct vchiq_mmal_port *control; control = &dev->component[COMP_CAMERA]->control; - rational_value.num = ctrl->val; - rational_value.den = 100; + rational_value.numumerator = ctrl->val; + rational_value.denominator = 100; return vchiq_mmal_port_parameter_set(dev->instance, control, mmal_ctrl->mmal_id, @@ -489,9 +489,10 @@ static int ctrl_set_awb_gains(struct bcm2835_mmal_dev *dev, else if (ctrl->id == V4L2_CID_BLUE_BALANCE) dev->blue_gain = ctrl->val; - gains.r_gain.num = dev->red_gain; - gains.b_gain.num = dev->blue_gain; - gains.r_gain.den = gains.b_gain.den = 1000; + gains.r_gain.numerator = dev->red_gain; + gains.r_gain.denominator = 1000; + gains.b_gain.numerator = dev->blue_gain; + gains.b_gain.denominator = 1000; return vchiq_mmal_port_parameter_set(dev->instance, control, mmal_ctrl->mmal_id, @@ -1271,26 +1272,26 @@ int set_framerate_params(struct bcm2835_mmal_dev *dev) struct mmal_parameter_fps_range fps_range; int ret; - fps_range.fps_high.num = dev->capture.timeperframe.denominator; - fps_range.fps_high.den = dev->capture.timeperframe.numerator; + fps_range.fps_high.numerator = dev->capture.timeperframe.denominator; + fps_range.fps_high.denominator = dev->capture.timeperframe.numerator; if ((dev->exposure_mode_active != MMAL_PARAM_EXPOSUREMODE_OFF) && (dev->exp_auto_priority)) { /* Variable FPS. Define min FPS as 1fps. */ - fps_range.fps_low.num = 1; - fps_range.fps_low.den = 1; + fps_range.fps_low.numerator = 1; + fps_range.fps_low.denominator = 1; } else { /* Fixed FPS - set min and max to be the same */ - fps_range.fps_low.num = fps_range.fps_high.num; - fps_range.fps_low.den = fps_range.fps_high.den; + fps_range.fps_low.numerator = fps_range.fps_high.numerator; + fps_range.fps_low.denominator = fps_range.fps_high.denominator; } v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, "Set fps range to %d/%d to %d/%d\n", - fps_range.fps_low.num, - fps_range.fps_low.den, - fps_range.fps_high.num, - fps_range.fps_high.den); + fps_range.fps_low.numerator, + fps_range.fps_low.denominator, + fps_range.fps_high.numerator, + fps_range.fps_high.denominator); ret = vchiq_mmal_port_parameter_set(dev->instance, &dev->component[COMP_CAMERA]->output[CAM_PORT_PREVIEW], diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-msg-common.h b/drivers/staging/vc04_services/vchiq-mmal/mmal-msg-common.h index d77e15f25dda..492d4c5dca08 100644 --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-msg-common.h +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-msg-common.h @@ -14,6 +14,8 @@ #ifndef MMAL_MSG_COMMON_H #define MMAL_MSG_COMMON_H +#include + enum mmal_msg_status { MMAL_MSG_STATUS_SUCCESS = 0, /**< Success */ MMAL_MSG_STATUS_ENOMEM, /**< Out of memory */ @@ -40,9 +42,4 @@ struct mmal_rect { s32 height; /**< height */ }; -struct mmal_rational { - s32 num; /**< Numerator */ - s32 den; /**< Denominator */ -}; - #endif /* MMAL_MSG_COMMON_H */ diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-msg-format.h b/drivers/staging/vc04_services/vchiq-mmal/mmal-msg-format.h index 1e996d8cd283..5569876d8c7d 100644 --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-msg-format.h +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-msg-format.h @@ -14,6 +14,8 @@ #ifndef MMAL_MSG_FORMAT_H #define MMAL_MSG_FORMAT_H +#include + #include "mmal-msg-common.h" /* MMAL_ES_FORMAT_T */ @@ -30,8 +32,8 @@ struct mmal_video_format { u32 width; /* Width of frame in pixels */ u32 height; /* Height of frame in rows of pixels */ struct mmal_rect crop; /* Visible region of the frame */ - struct mmal_rational frame_rate; /* Frame rate */ - struct mmal_rational par; /* Pixel aspect ratio */ + struct s32_fract frame_rate; /* Frame rate */ + struct s32_fract par; /* Pixel aspect ratio */ /* * FourCC specifying the color space of the video stream. See the diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-parameters.h b/drivers/staging/vc04_services/vchiq-mmal/mmal-parameters.h index 2277e05b1e31..a0cdd28101f2 100644 --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-parameters.h +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-parameters.h @@ -22,6 +22,8 @@ #ifndef MMAL_PARAMETERS_H #define MMAL_PARAMETERS_H +#include + /** Common parameter ID group, used with many types of component. */ #define MMAL_PARAMETER_GROUP_COMMON (0 << 16) /** Camera-specific parameter ID group. */ @@ -223,11 +225,6 @@ enum mmal_parameter_camera_type { MMAL_PARAMETER_CUSTOM_AWB_GAINS, }; -struct mmal_parameter_rational { - s32 num; /**< Numerator */ - s32 den; /**< Denominator */ -}; - enum mmal_parameter_camera_config_timestamp_mode { MMAL_PARAM_TIMESTAMP_MODE_ZERO = 0, /* Always timestamp frames as 0 */ MMAL_PARAM_TIMESTAMP_MODE_RAW_STC, /* Use the raw STC value @@ -243,9 +240,9 @@ enum mmal_parameter_camera_config_timestamp_mode { struct mmal_parameter_fps_range { /**< Low end of the permitted framerate range */ - struct mmal_parameter_rational fps_low; + struct s32_fract fps_low; /**< High end of the permitted framerate range */ - struct mmal_parameter_rational fps_high; + struct s32_fract fps_high; }; /* camera configuration parameter */ @@ -350,8 +347,8 @@ enum MMAL_PARAM_FLICKERAVOID { }; struct mmal_parameter_awbgains { - struct mmal_parameter_rational r_gain; /**< Red gain */ - struct mmal_parameter_rational b_gain; /**< Blue gain */ + struct s32_fract r_gain; /**< Red gain */ + struct s32_fract b_gain; /**< Blue gain */ }; /** Manner of video rate control */ diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c index 249dd3e30c2f..845b20e4d05a 100644 --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c @@ -744,9 +744,9 @@ static void dump_port_info(struct vchiq_mmal_port *port) port->es.video.crop.y, port->es.video.crop.width, port->es.video.crop.height); pr_debug(" : framerate %d/%d aspect %d/%d\n", - port->es.video.frame_rate.num, - port->es.video.frame_rate.den, - port->es.video.par.num, port->es.video.par.den); + port->es.video.frame_rate.numerator, + port->es.video.frame_rate.denominator, + port->es.video.par.numerator, port->es.video.par.denominator); } } @@ -1549,8 +1549,8 @@ int vchiq_mmal_port_connect_tunnel(struct vchiq_mmal_instance *instance, dst->es.video.crop.y = src->es.video.crop.y; dst->es.video.crop.width = src->es.video.crop.width; dst->es.video.crop.height = src->es.video.crop.height; - dst->es.video.frame_rate.num = src->es.video.frame_rate.num; - dst->es.video.frame_rate.den = src->es.video.frame_rate.den; + dst->es.video.frame_rate.numerator = src->es.video.frame_rate.numerator; + dst->es.video.frame_rate.denominator = src->es.video.frame_rate.denominator; /* set new format */ ret = port_info_set(instance, dst);