Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp3928449rdh; Fri, 29 Sep 2023 06:36:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEBxtQySSynMor7Yhbjp27oyDvngPc4okd0yvQoqBNcTpcbGvmADhCoMBXvmcHc1W8rWkiT X-Received: by 2002:a05:6a00:1817:b0:693:3851:bd98 with SMTP id y23-20020a056a00181700b006933851bd98mr4819651pfa.2.1695994560661; Fri, 29 Sep 2023 06:36:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695994560; cv=none; d=google.com; s=arc-20160816; b=t7BjrPJ1pz38+zI+DY5fYTKaFHtvlej6nUaxPm+cl4j+V3Znu8SPgoni8mK412EbaG KVM2NpOBkpt4LoOczux/Te20AOuQXP80UTwtlQYKdN19UfMNqXLEzOL6uKofCEvHEnN/ MTx5Za7GIv1UcUb2Qwz7XTx0r1sOitgtNQnwLCvvZXsLCGmUhjo3nlrGk6nJrMd3PTNF dsfNgkMjG71DTEEDq0dc4/mwRppOz+r5p+68JAbzd+OgH6f+POQr3qN2Q/8hFbwjRcO3 huZbAIm/ok/AyD2poU3Pcmwm1R0habWo9eCUsLbie/5QWm5B8rd919qcQwTZdKwsK0t0 hJ4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=A+xdIamtWar0MYfhb0rDcSmv8dCB5Xt4XPVLRYRJ3b4=; fh=iKxDVfqRBcibJ57X3hUVIEgZUVopvy2trRF+ih/+F+8=; b=OUVeN1wh3JeA0M6La8x+3B3GpWswGLgpPd2egqZ+Av5P9ZWIbSYggTzoWe2xNTNFWx Yu66sFrYGp9UtkIHGfsRkrnTpa4H+AEOrYAO87muOQgI960YKHFfjzdNT2Lj8ZuFoDsp sh9eotborimr/coEDn8u+MJL5tb9rP2sWrNvgcib8I7QTquzA6m1wk1laXpVk+D2LQhN XtXMomw2Q+EMuYlnsVig1l+oDsusx9oVjINWNNjmTKuHumAq85Af74trn60QHZ0w0GtH lKhkc4SjISEV2PfmKR2Z+E+egg+uSz+1bjuqHup82RsJMYaxI+OxMDQX+DGOQkEUxuMu OjvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@raspberrypi.com header.s=google header.b=DfKq+khy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=raspberrypi.com Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id ca10-20020a056a02068a00b0057800024a67si25617956pgb.257.2023.09.29.06.36.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 06:36:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@raspberrypi.com header.s=google header.b=DfKq+khy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=raspberrypi.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 9DA918347B74; Fri, 29 Sep 2023 06:34:24 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233390AbjI2NeF (ORCPT + 99 others); Fri, 29 Sep 2023 09:34:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233412AbjI2NeB (ORCPT ); Fri, 29 Sep 2023 09:34:01 -0400 Received: from mail-vk1-xa2f.google.com (mail-vk1-xa2f.google.com [IPv6:2607:f8b0:4864:20::a2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81B18CD4 for ; Fri, 29 Sep 2023 06:33:59 -0700 (PDT) Received: by mail-vk1-xa2f.google.com with SMTP id 71dfb90a1353d-49d0ae5eb7bso554840e0c.0 for ; Fri, 29 Sep 2023 06:33:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1695994438; x=1696599238; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=A+xdIamtWar0MYfhb0rDcSmv8dCB5Xt4XPVLRYRJ3b4=; b=DfKq+khyi68MO5POorqL+w7FLTVw7kpOAkyb9ENUlnq6VS8kKM0LYG5LtaTNSXguI3 JxYAPv8jl3jDKY5JGwecfL28x+40ORzrGuakykh1C5iaSUZ5YwUEWRAEKsVUWdrp/8un 7pobgqgt4LEWomqMgDIogohzC0zxVwyg3IDE+zIIIsDti/6/xjXqBdt9jCr/Bi3S4Px5 0fQPctMzlZv+OTdeLVw/bGWVl7UFl660dcPlpYdfiOYwwAGKgN7izR7wTktMr6AUVurw 78MyioCleHY4Cd9aG2gYgZSrgwJ/UmYA3hO8TG8fJK1xMrJd/tTQpZrwdfyjwy/Wt36g 8Y1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695994438; x=1696599238; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=A+xdIamtWar0MYfhb0rDcSmv8dCB5Xt4XPVLRYRJ3b4=; b=Qyb+BP8KIOI41/X3Dq7QInuyfxvIQuvalrBc5MyjWgpLt/MMl0mamLxPw0KSiC9dJ5 LbHylZVuhPS7FxR1LQqw+TC3VfhvfvzlX2dvoCCUQmHEgV02E+jmK/lkFKJqi0ycw5Sq K6a+VZ/cyrd9n15NWNfha+nol1aqwOvWGL+weaoUp5DO6F0MJQ/DK1ezAsmaYq8pFowk 1k4dBZdVgv7+I6udU0GRLDlSd33vQsn6gz4bLE+mxhHyo1YOQ8UaMAmG00z+heqaZ4hu 7FQloXwH+azua0KoJxUYp1H2mlAv1931Q2woCfbnhiWOGcHSBUHTjQcuOy+HjPk5KnWe 7PVQ== X-Gm-Message-State: AOJu0YxK427obqpgneJVwfUWQWgjEO4vNqx5tfwER214lG2xFjRYhWSV W7WxRWMniwnUC2mXDnDdD0T8b+wQ7uuChVhZLFOO2g== X-Received: by 2002:a1f:cc46:0:b0:48d:eaa:45c4 with SMTP id c67-20020a1fcc46000000b0048d0eaa45c4mr3791108vkg.7.1695994438460; Fri, 29 Sep 2023 06:33:58 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Dave Stevenson Date: Fri, 29 Sep 2023 14:33:42 +0100 Message-ID: Subject: Re: Sony IMX290/462 image sensors I2C xfer peculiarity To: =?UTF-8?Q?Krzysztof_Ha=C5=82asa?= Cc: linux-media , lkml Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Fri, 29 Sep 2023 06:34:24 -0700 (PDT) Hi Krzysztof On Fri, 29 Sept 2023 at 11:53, Krzysztof Ha=C5=82asa wrot= e: > > Hi, > > I am debugging certain IMX290 and IMX462 I2C failures on an NXP > i.MX6MP based board and there seem to be interesting "feature" here: > Sony IMX290 and IMX462 image sensors apparently terminate I2C transfers > after 2^18 of their master clock cycles. For example, with a typical > 37.125 MHz clock oscillator, this means about 7 ms. In practice, I'm > barely able to read a block of 128 registers (at I2C 400 kHz clock > rate). > > I think the sensors simply disconnect from the bus after 2^18 clock > cycles (starting from the first START condition, the repeated STARTs > don't reset the timeout). This means, in case of a READ operation, the > data read by the CPU after the timeout contains all bits set to 1. > i.MX8MP detects arbitration losses, so if the SDA change to 1 happens on > high clock value (but not on ACK bit), the whole transfer is aborted. > Otherwise, the ending bytes are simply set to FF (and the last non-FF > may be corrupted partially). > > The problem is 7 ms is a short time and on a non-real time system even > a simple non-DMA I2C register writes can take as much time. This causes > driver failures. What's your requirement to be able to read back so many registers at once? Whilst potentially useful during development, most sensor drivers write specific registers but never read anything other than potentially a model ID register during probe. Large block writes are generally not possible as at least the IMX290 datasheet does state "Do not perform communication to addresses not listed in the Register Map", and there are numerous reserved blocks throughout the map. As far as I know there's no OTP on these sensors which would be about the only reason I can think of for needing to read large blocks. I currently can't see a reason for a sensor driver to be needing to do these big reads, so how can it cause a driver failure? Scanning the IMX290 datasheet further, there is a slightly worrying paragraph in "Register Communication Timing (I2C)": "In I2C communication system, communication can be performed excluding during the period when communication is prohibited from the falling edge of XVS to 6H after (1H period)." and the diagram shows a 1 line period 6 lines after XVS which is marked "communication prohibited period". Ouch! I've never experienced issues with I2C comms to these modules, but is it possible that you're hitting this period with your longer I2C transactions? A logic analyser looking at XVS, XHS, and the I2C might give you some clues. Or are you not streaming when you're doing these transactions? IMX462 appears to list a similar restriction. Dave > Needless to say, the datasheets know nothing about the feature. > > Any thoughts? > -- > Krzysztof "Chris" Ha=C5=82asa > > Sie=C4=87 Badawcza =C5=81ukasiewicz > Przemys=C5=82owy Instytut Automatyki i Pomiar=C3=B3w PIAP > Al. Jerozolimskie 202, 02-486 Warszawa