From patchwork Tue Apr 16 19:33:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 13632492 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.15]) (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 4B591139D19 for ; Tue, 16 Apr 2024 19:34:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.15 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713296068; cv=none; b=rAS/EwxyniLl8ZFI/mGd5BfCB9KoLS3yWaoltzkG3k2sASgX4Hh8DTc05zu8PA7OeS4UeFGY8tFAuP+ZdA7XdN54z8Z/HPd21zL6Rl1qjUXWfAUg3yEhGsZn0x1OwdLfJlI4RM1U4fV3zYL0S5rX+Yqo97XvEWsMIDkERqB4D0w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713296068; c=relaxed/simple; bh=AlD2csMLI217TCppbDyg023f1jQwntjFBxAMr4Nxm5k=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=eJ7dbvFptN7x7MuV/hhRQgzGwwJwwk8UfrAa4BXD+RuB7YxxmHAfYqzxOMa5sH9aBtr13drr87rR3I/yvbVWOpq7QsQhTsdEALCmhHQT3pzgoW75ISmPghCq69OKxAwIg2JWAybKIRt+kAEdxkakK5K6vXMyMFM/hpN2ROAz8oM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=CkBiu0IS; arc=none smtp.client-ip=192.198.163.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="CkBiu0IS" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1713296067; x=1744832067; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=AlD2csMLI217TCppbDyg023f1jQwntjFBxAMr4Nxm5k=; b=CkBiu0ISXEG+J11X7ZauQWSx1KQlDqQnTV22BtRyh1R1gUHdOKnLPf6A JeVNksXsIf1S1F5Lj7vOr3ghqkmI7YFRB9DlmN0/VkKoe6LJ2Lz9eSHeb itsTcSS1L3ypFO6yDe4X/JatgTWP+GwrM39nvLIKkS61WyhFPWQ7cHgbf gk/Ss4UttYNenlg2Txy0x3oosgK4Pc6Utm55woVFLdw5h8JTrHDI7aCg1 QuKz3qFuMgAM2giE09h6wUYeyrCQCcIeyvJkInPXW98pc/HjFQFjwcdeZ VsFLLvVg09ZHsbbcSQJQHRhnV/+4Bw+no7eF/c59vcEJ61crMJ7l4VGy1 A==; X-CSE-ConnectionGUID: cRGhaVzeSdSXB5d1eHJO2w== X-CSE-MsgGUID: ZG1n5nn1Qo2qQOoaVfrz5Q== X-IronPort-AV: E=McAfee;i="6600,9927,11046"; a="8929917" X-IronPort-AV: E=Sophos;i="6.07,206,1708416000"; d="scan'208";a="8929917" Received: from orviesa010.jf.intel.com ([10.64.159.150]) by fmvoesa109.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Apr 2024 12:34:27 -0700 X-CSE-ConnectionGUID: elgiOPVHQEOjP4iUZBioVA== X-CSE-MsgGUID: uIGFwab6TNW/ZfGwichXvw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,206,1708416000"; d="scan'208";a="22244785" Received: from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com) ([10.237.72.44]) by orviesa010-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Apr 2024 12:34:24 -0700 Received: from svinhufvud.ger.corp.intel.com (localhost [IPv6:::1]) by kekkonen.fi.intel.com (Postfix) with ESMTP id A795B11F879; Tue, 16 Apr 2024 22:34:20 +0300 (EEST) From: Sakari Ailus To: linux-media@vger.kernel.org Cc: Laurent Pinchart , tomi.valkeinen@ideasonboard.com, bingbu.cao@intel.com, hongju.wang@intel.com, hverkuil@xs4all.nl, Andrey Konovalov , Jacopo Mondi , Dmitry Perchanov , "Ng, Khai Wen" , Alain Volmat Subject: [PATCH v9 42/46] media: ov2740: Add generic sensor fwnode properties as controls Date: Tue, 16 Apr 2024 22:33:15 +0300 Message-Id: <20240416193319.778192-43-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240416193319.778192-1-sakari.ailus@linux.intel.com> References: <20240416193319.778192-1-sakari.ailus@linux.intel.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Add generic sensor property information as controĺs by using v4l2_fwnode_device_parse() and v4l2_ctrl_new_fwnode_properties(). Signed-off-by: Sakari Ailus Reviewed-by: Laurent Pinchart --- drivers/media/i2c/ov2740.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/media/i2c/ov2740.c b/drivers/media/i2c/ov2740.c index dc0931308053..e37d824291fe 100644 --- a/drivers/media/i2c/ov2740.c +++ b/drivers/media/i2c/ov2740.c @@ -779,6 +779,8 @@ static const struct v4l2_ctrl_ops ov2740_ctrl_ops = { static int ov2740_init_controls(struct ov2740 *ov2740) { + struct i2c_client *client = v4l2_get_subdevdata(&ov2740->sd); + struct v4l2_fwnode_device_properties props; struct v4l2_ctrl_handler *ctrl_hdlr; s64 exposure_max, h_blank, pixel_rate; u32 vblank_min, vblank_max, vblank_default; @@ -789,6 +791,10 @@ static int ov2740_init_controls(struct ov2740 *ov2740) if (ret) return ret; + if (!v4l2_fwnode_device_parse(&client->dev, &props)) + v4l2_ctrl_new_fwnode_properties(ctrl_hdlr, &ov2740_ctrl_ops, + &props); + ov2740->link_freq = v4l2_ctrl_new_int_menu(ctrl_hdlr, &ov2740_ctrl_ops, V4L2_CID_LINK_FREQ,