From patchwork Sat Mar 1 11:48:29 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 13997483 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 5344823F37D for ; Sat, 1 Mar 2025 11:48:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740829720; cv=none; b=X/hsAVugFIaTOVOqVZKHbwjzpOGR744wBurQ/1wC8GPAmmuUaI5/wYhvCVEjL7rgI28tmyqbGn3tZ7AkQ8mGj5ngFmNugv6X5BgFDdJEkJKa9A2DzVSmCU+9NtiFLUwW9ppAlgG+uSr6TN6DHOj7XGpxc5SMb0PQcE/wob8dU14= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740829720; c=relaxed/simple; bh=78fCvBFXnyWcLO2awmbYh1GvgaaeSV76wAe5nOAWM7Q=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=XqZMYAnpBPMiX/KrCKB5jGsS1aWuAjuH6oLyuqJolsVKxVs9Chj6rptvfVvRpUll7FpIab8x7L2mXM2iJ65VR+6mfP3Ya4Q0rP2uBouazJjRBnvIjFv0hJpihawTty7Pm6a2DNuO9Zl1/LJvKLZuQsr/YhYHHpiOZHYIhpDumjY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=JGZFztft; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="JGZFztft" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1740829717; 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; bh=8bTTssIo/QD3yZHkz9RzXMFjTRQE6SuMFwZxUMZS53I=; b=JGZFztftkn8Vwr5d989j8QVYvGly9wcGFGd87CjGAR507+iCdwB7eGKtL1th9mx0kf9AZY OHFdp99hRyDC8PyVbIo3KOqgB7FIKbS3aXkK0190W/XexziwI1/4tsi9odvrSeuVCFWLCC qDMZCoIscug4QzsdEPSECu9G1QfzK50= Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-679-XHec2s40NOek9B2WkX6rGQ-1; Sat, 01 Mar 2025 06:48:35 -0500 X-MC-Unique: XHec2s40NOek9B2WkX6rGQ-1 X-Mimecast-MFC-AGG-ID: XHec2s40NOek9B2WkX6rGQ_1740829714 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 73FA21800268; Sat, 1 Mar 2025 11:48:34 +0000 (UTC) Received: from shalem.redhat.com (unknown [10.45.224.9]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 2E9BF19560AE; Sat, 1 Mar 2025 11:48:31 +0000 (UTC) From: Hans de Goede To: Sakari Ailus , Jason Chen Cc: Hans de Goede , Bryan O'Donoghue , Mauro Carvalho Chehab , linux-media@vger.kernel.org Subject: [PATCH 1/2] media: ov08x40: Fix value of reset GPIO when requesting it Date: Sat, 1 Mar 2025 12:48:29 +0100 Message-ID: <20250301114830.22668-1-hdegoede@redhat.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 We should put/leave the sensor in reset when requesting the GPIO, after requesting it there are 2 possible scenarios and having the GPIO driven low is no good in either scenario: 1. The sensor was in ACPI D0 before probe() runs, in this case ov08x40_power_on() + ov08x40_identify_module() will run immediately after requesting the GPIO and ov08x40_power_on() starts with driving the GPIO high. So if the GPIO was already high it will very shortly be driven low, more of a spike to low then actually properly be driven low. Which may leave the sensor in a confused state. If we request the GPIO to be high at request time then power_on() will driver it high again (no-op) and then sleep for 1-2 ms, so no spike. 2. The sensor was in ACPI D3 / off before probe(), in this case probe() leaves the sensor alone. But when the sensor is off its reset line should be driven high not low. Signed-off-by: Hans de Goede Reviewed-by: Bryan O'Donoghue --- drivers/media/i2c/ov08x40.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/i2c/ov08x40.c b/drivers/media/i2c/ov08x40.c index c2a399e3bb41..a4790e68f523 100644 --- a/drivers/media/i2c/ov08x40.c +++ b/drivers/media/i2c/ov08x40.c @@ -2167,7 +2167,7 @@ static int ov08x40_check_hwcfg(struct ov08x40 *ov08x, struct device *dev) return dev_err_probe(dev, ret, "parsing endpoint failed\n"); ov08x->reset_gpio = devm_gpiod_get_optional(dev, "reset", - GPIOD_OUT_LOW); + GPIOD_OUT_HIGH); if (IS_ERR(ov08x->reset_gpio)) { ret = dev_err_probe(dev, PTR_ERR(ov08x->reset_gpio), "getting reset GPIO\n"); From patchwork Sat Mar 1 11:48:30 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 13997484 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 EFF1423F37D for ; Sat, 1 Mar 2025 11:48:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740829724; cv=none; b=VrpYzjYOhpQ9XcsKEu99X5SLGnSmiYda779U5N8kVU+CRWEfQLI/57brBlty7pZka3PkFAy88miAV2o7wK5tXYHM3UmblPxaJ9JHXe/e/U5XUca3sQTL3xKSlnuEWmN7kzQZcrHhGcr/8CrBEK6ETg3S/crBGj61tcmj+VE+W+o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740829724; c=relaxed/simple; bh=aol893qkUmPrauzREroIY+LDFqyd0jeW5Tl9jaNpqDI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DNdB0O6EVJ7MTQbOsBnavqzIU11AHB5HDgm/4L6RcOuun0mLpYNOmBKcHzs/JFwoY+EIV3uLwTbHY1GHIQDSo12zO6hLM20zRHMZywXX56xsQCSr7xPrbKbi5m/gxoSyP/oDZluMnGah7KZVWJ2S1c++/4lg9DihBVSy3V+2OQU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=AzUJjcof; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="AzUJjcof" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1740829721; 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=sUvkoXI5ipBqJ2Ds4PzpHKcnXxDpcZHwBkzH7246wt0=; b=AzUJjcof44SqNHI1/yKOpDjVk0HFCUvLVrCZq9tlAtFhNbj3exW0OhZmFwYKl/aGhB3GB8 yg1o1JX7hI6+y5weud75MWMr7LtMuJaFxUv0vU/yzyTKjEUna+Q0smPUSRG0xwR211K84d IDZ+AvwO3MpWu1E/aUpRq5JhBugzhxk= Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-661-5PPqol31MhSj5PdBTo1S2w-1; Sat, 01 Mar 2025 06:48:38 -0500 X-MC-Unique: 5PPqol31MhSj5PdBTo1S2w-1 X-Mimecast-MFC-AGG-ID: 5PPqol31MhSj5PdBTo1S2w_1740829717 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 521391800268; Sat, 1 Mar 2025 11:48:37 +0000 (UTC) Received: from shalem.redhat.com (unknown [10.45.224.9]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 119C619560AE; Sat, 1 Mar 2025 11:48:34 +0000 (UTC) From: Hans de Goede To: Sakari Ailus , Jason Chen Cc: Hans de Goede , Bryan O'Donoghue , Mauro Carvalho Chehab , linux-media@vger.kernel.org Subject: [PATCH 2/2] media: ov08x40: Log chip ID when identifying the chip Date: Sat, 1 Mar 2025 12:48:30 +0100 Message-ID: <20250301114830.22668-2-hdegoede@redhat.com> In-Reply-To: <20250301114830.22668-1-hdegoede@redhat.com> References: <20250301114830.22668-1-hdegoede@redhat.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 Debug log the chip ID after successfully identifying the chip, this is useful to see if the identification is done on probe() time or if it is delayed till the first stream on. Signed-off-by: Hans de Goede Reviewed-by: Bryan O'Donoghue --- drivers/media/i2c/ov08x40.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/media/i2c/ov08x40.c b/drivers/media/i2c/ov08x40.c index a4790e68f523..cf0e41fc3071 100644 --- a/drivers/media/i2c/ov08x40.c +++ b/drivers/media/i2c/ov08x40.c @@ -1955,6 +1955,7 @@ static int ov08x40_identify_module(struct ov08x40 *ov08x) return -ENXIO; } + dev_dbg(&client->dev, "chip id 0x%x\n", val); ov08x->identified = true; return 0;