All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: linux-media@vger.kernel.org
Cc: hverkuil@xs4all.nl, mchehab@kernel.org
Subject: [PATCH v2 13/29] smiapp: Use CCS limits in reading binning capabilities
Date: Fri, 27 Nov 2020 12:33:09 +0200	[thread overview]
Message-ID: <20201127103325.29814-14-sakari.ailus@linux.intel.com> (raw)
In-Reply-To: <20201127103325.29814-1-sakari.ailus@linux.intel.com>

Use CCS limits for obtaining binning capabilities and subtypes.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
 drivers/media/i2c/smiapp/smiapp-core.c | 27 +++++++++-----------------
 1 file changed, 9 insertions(+), 18 deletions(-)

diff --git a/drivers/media/i2c/smiapp/smiapp-core.c b/drivers/media/i2c/smiapp/smiapp-core.c
index c332b6ecf0bd..d786f91c1eae 100644
--- a/drivers/media/i2c/smiapp/smiapp-core.c
+++ b/drivers/media/i2c/smiapp/smiapp-core.c
@@ -3105,26 +3105,17 @@ static int smiapp_probe(struct i2c_client *client)
 	}
 
 	if (CCS_LIM(sensor, BINNING_CAPABILITY)) {
-		u32 val;
-
-		rval = smiapp_read(sensor,
-				   SMIAPP_REG_U8_BINNING_SUBTYPES, &val);
-		if (rval < 0) {
-			rval = -ENODEV;
-			goto out_free_ccs_limits;
-		}
-		sensor->nbinning_subtypes = min_t(u8, val,
-						  SMIAPP_BINNING_SUBTYPES);
+		sensor->nbinning_subtypes =
+			min_t(u8, CCS_LIM(sensor, BINNING_SUB_TYPES),
+			      CCS_LIM_BINNING_SUB_TYPE_MAX_N);
 
 		for (i = 0; i < sensor->nbinning_subtypes; i++) {
-			rval = smiapp_read(
-				sensor, SMIAPP_REG_U8_BINNING_TYPE_n(i), &val);
-			if (rval < 0) {
-				rval = -ENODEV;
-				goto out_free_ccs_limits;
-			}
-			sensor->binning_subtypes[i] =
-				*(struct smiapp_binning_subtype *)&val;
+			sensor->binning_subtypes[i].horizontal =
+				CCS_LIM_AT(sensor, BINNING_SUB_TYPE, i) >>
+				CCS_BINNING_SUB_TYPE_COLUMN_SHIFT;
+			sensor->binning_subtypes[i].vertical =
+				CCS_LIM_AT(sensor, BINNING_SUB_TYPE, i) &
+				CCS_BINNING_SUB_TYPE_ROW_MASK;
 
 			dev_dbg(&client->dev, "binning %xx%x\n",
 				sensor->binning_subtypes[i].horizontal,
-- 
2.27.0


  parent reply	other threads:[~2020-11-27 10:38 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-27 10:32 [PATCH v2 00/29] Linux CCS driver preparation Sakari Ailus
2020-11-27 10:32 ` [PATCH v2 01/29] ccs: Add the generator for CCS register definitions and limits Sakari Ailus
2020-12-02 14:17   ` Mauro Carvalho Chehab
2020-12-02 14:46     ` Sakari Ailus
2020-11-27 10:32 ` [PATCH v2 02/29] Documentation: ccs: Add CCS driver documentation Sakari Ailus
2020-11-27 10:32 ` [PATCH v2 03/29] smiapp: Import CCS definitions Sakari Ailus
2020-11-27 10:33 ` [PATCH v2 04/29] smiapp: Use CCS register flags Sakari Ailus
2020-11-27 10:33 ` [PATCH v2 05/29] smiapp: Calculate CCS limit offsets and limit buffer size Sakari Ailus
2020-11-27 10:33 ` [PATCH v2 06/29] smiapp: Remove macros for defining registers, merge definitions Sakari Ailus
2020-11-27 10:33 ` [PATCH v2 07/29] smiapp: Add macros for accessing CCS registers Sakari Ailus
2020-11-27 10:33 ` [PATCH v2 08/29] smiapp: Use MIPI CCS version and manufacturer ID information Sakari Ailus
2020-11-27 10:33 ` [PATCH v2 09/29] smiapp: Read CCS limit values Sakari Ailus
2020-11-27 10:33 ` [PATCH v2 10/29] smiapp: Switch to CCS limits Sakari Ailus
2020-11-27 10:33 ` [PATCH v2 11/29] smiapp: Obtain frame descriptor from " Sakari Ailus
2020-11-27 10:33 ` [PATCH v2 12/29] smiapp: Use CCS limits in reading data format descriptors Sakari Ailus
2020-11-27 10:33 ` Sakari Ailus [this message]
2020-11-27 10:33 ` [PATCH v2 14/29] smiapp: Use CCS registers Sakari Ailus
2020-11-27 10:33 ` [PATCH v2 15/29] smiapp: Remove quirk function for writing a single 8-bit register Sakari Ailus
2020-11-27 10:33 ` [PATCH v2 16/29] smiapp: Rename register access functions Sakari Ailus
2020-11-27 10:33 ` [PATCH v2 17/29] smiapp: Internal rename to CCS Sakari Ailus
2020-11-27 10:33 ` [PATCH v2 18/29] smiapp: Differentiate CCS sensors from SMIA in subdev naming Sakari Ailus
2020-11-27 10:33 ` [PATCH v2 19/29] smiapp: Rename as "ccs" Sakari Ailus
2020-11-27 10:33 ` [PATCH v2 20/29] ccs: Remove profile concept Sakari Ailus
2020-11-27 10:33 ` [PATCH v2 21/29] ccs: Give all subdevs a function Sakari Ailus
2020-11-27 10:33 ` [PATCH v2 22/29] dt-bindings: nokia,smia: Fix link-frequencies documentation Sakari Ailus
2020-11-27 10:33 ` [PATCH v2 23/29] dt-bindings: nokia,smia: Make vana-supply optional Sakari Ailus
2020-11-27 10:33 ` [PATCH v2 24/29] dt-bindings: nokia,smia: Remove nokia,nvm-size property Sakari Ailus
2020-11-27 10:33 ` [PATCH v2 25/29] dt-bindings: nokia,smia: Convert to YAML Sakari Ailus
2020-11-27 10:33 ` [PATCH v2 26/29] dt-bindings: nokia,smia: Use better active polarity for reset Sakari Ailus
2020-11-27 10:33 ` [PATCH v2 27/29] dt-bindings: nokia,smia: Amend SMIA bindings with MIPI CCS support Sakari Ailus
2020-11-27 10:33 ` [PATCH v2 28/29] dt-bindings: mipi-ccs: Add bus-type for C-PHY support Sakari Ailus
2020-11-27 10:33 ` [PATCH v2 29/29] ccs: Request for "reset" GPIO Sakari Ailus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201127103325.29814-14-sakari.ailus@linux.intel.com \
    --to=sakari.ailus@linux.intel.com \
    --cc=hverkuil@xs4all.nl \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.