From patchwork Thu Aug 3 09:33:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 709856 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CC4D3C0015E for ; Thu, 3 Aug 2023 09:37:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235180AbjHCJhT (ORCPT ); Thu, 3 Aug 2023 05:37:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235142AbjHCJgS (ORCPT ); Thu, 3 Aug 2023 05:36:18 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02F523A80 for ; Thu, 3 Aug 2023 02:34:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1691055279; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9UcsjB5rRPcjxgnzDxzmeaRvxgVPxqS4oDq/b3K3X2k=; b=e39QAVj7R5k+QQ3enxh7Q+noQMYaC4q2jcXvfQD/0/0G3kiEjcSjdaCMdydB/9FDQlD3Zx m3MhcOKp3BPgjR4YcWD4dUQbTcXB83lWvPaNrfGM2M2MP+20T+nwtpF1MP5V5De4VBy+R8 caLfMewkDYcBa6GaxwzHuzHyp5rOwNk= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-530-uC17vZzQPPGpVI4ThMGEVA-1; Thu, 03 Aug 2023 05:34:36 -0400 X-MC-Unique: uC17vZzQPPGpVI4ThMGEVA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8BE4F810BB2; Thu, 3 Aug 2023 09:34:35 +0000 (UTC) Received: from shalem.redhat.com (unknown [10.39.193.2]) by smtp.corp.redhat.com (Postfix) with ESMTP id 254592166B25; Thu, 3 Aug 2023 09:34:34 +0000 (UTC) From: Hans de Goede To: Sakari Ailus , Laurent Pinchart , Rui Miguel Silva , Daniel Scally Cc: Hans de Goede , Mauro Carvalho Chehab , Andy Shevchenko , Kate Hsuan , Dave Stevenson , Tommaso Merciai , linux-media@vger.kernel.org Subject: [PATCH v5 27/32] media: ov2680: Read and log sensor revision during probe Date: Thu, 3 Aug 2023 11:33:42 +0200 Message-ID: <20230803093348.15679-28-hdegoede@redhat.com> In-Reply-To: <20230803093348.15679-1-hdegoede@redhat.com> References: <20230803093348.15679-1-hdegoede@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Read and log sensor revision during probe. Since this means that the driver will now already log a message on successful probe drop the "ov2680 init correctly" log message. Acked-by: Rui Miguel Silva Reviewed-by: Daniel Scally Signed-off-by: Hans de Goede --- drivers/media/i2c/ov2680.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/media/i2c/ov2680.c b/drivers/media/i2c/ov2680.c index c09a0e7f7787..1f59013e440c 100644 --- a/drivers/media/i2c/ov2680.c +++ b/drivers/media/i2c/ov2680.c @@ -33,6 +33,7 @@ #define OV2680_REG_SOFT_RESET CCI_REG8(0x0103) #define OV2680_REG_CHIP_ID CCI_REG16(0x300a) +#define OV2680_REG_SC_CMMN_SUB_ID CCI_REG8(0x302a) #define OV2680_REG_PLL_MULTIPLIER CCI_REG16(0x3081) #define OV2680_REG_EXPOSURE_PK CCI_REG24(0x3500) @@ -966,13 +967,14 @@ static int ov2680_get_regulators(struct ov2680_dev *sensor) static int ov2680_check_id(struct ov2680_dev *sensor) { - u64 chip_id; - int ret; + u64 chip_id, rev; + int ret = 0; - ret = cci_read(sensor->regmap, OV2680_REG_CHIP_ID, &chip_id, NULL); + cci_read(sensor->regmap, OV2680_REG_CHIP_ID, &chip_id, &ret); + cci_read(sensor->regmap, OV2680_REG_SC_CMMN_SUB_ID, &rev, &ret); if (ret < 0) { dev_err(sensor->dev, "failed to read chip id\n"); - return -ENODEV; + return ret; } if (chip_id != OV2680_CHIP_ID) { @@ -981,6 +983,9 @@ static int ov2680_check_id(struct ov2680_dev *sensor) return -ENODEV; } + dev_info(sensor->dev, "sensor_revision id = 0x%llx, rev= %lld\n", + chip_id, rev & 0x0f); + return 0; } @@ -1121,8 +1126,6 @@ static int ov2680_probe(struct i2c_client *client) pm_runtime_use_autosuspend(&client->dev); pm_runtime_put_autosuspend(&client->dev); - dev_info(dev, "ov2680 init correctly\n"); - return 0; err_pm_runtime: