From patchwork Wed Aug 2 17:30:41 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: 709455 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 A141EC001E0 for ; Wed, 2 Aug 2023 17:35:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233665AbjHBRfg (ORCPT ); Wed, 2 Aug 2023 13:35:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233329AbjHBRfV (ORCPT ); Wed, 2 Aug 2023 13:35:21 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 948214221 for ; Wed, 2 Aug 2023 10:33:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690997518; 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=fqTYZvHGsxfLE0oQHcabbVAPvXiwnq0DxDQqV7H/tbAwdcBgRUHUGRsFPkgWFyI8CghEPw S6Ash40+gTXeR4Ol/QtmY97SIa2jqT606/Ufk5/a5FClXTRRWg5kbLpcmaKywF17oRV7v0 W/le9gosWB8jLVbma4xAoP6wtN7rE4w= Received: from mimecast-mx02.redhat.com (66.187.233.73 [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-669-IV8PXQEJPrCXM4_A7SoSpg-1; Wed, 02 Aug 2023 13:31:55 -0400 X-MC-Unique: IV8PXQEJPrCXM4_A7SoSpg-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 458FE1C29AFB; Wed, 2 Aug 2023 17:31:54 +0000 (UTC) Received: from shalem.redhat.com (unknown [10.39.192.110]) by smtp.corp.redhat.com (Postfix) with ESMTP id DFEAD1454143; Wed, 2 Aug 2023 17:31:52 +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 v4 27/32] media: ov2680: Read and log sensor revision during probe Date: Wed, 2 Aug 2023 19:30:41 +0200 Message-ID: <20230802173046.368434-28-hdegoede@redhat.com> In-Reply-To: <20230802173046.368434-1-hdegoede@redhat.com> References: <20230802173046.368434-1-hdegoede@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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: