Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp863605rdg; Fri, 13 Oct 2023 03:39:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEUitYzKskM4oiYgf2d55aMm4jolNGw0efhOnClm7+X9ZMexUgnttTT+LaNGX5p8lMxzWQe X-Received: by 2002:a62:f20c:0:b0:6b1:bf32:4fb5 with SMTP id m12-20020a62f20c000000b006b1bf324fb5mr1702459pfh.28.1697193589389; Fri, 13 Oct 2023 03:39:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1697193589; cv=pass; d=google.com; s=arc-20160816; b=NAkZ2Kb5qDa0V9CaFvazmAouKIVENClhRp37s0qexZBdkdwfDv3d4FHg930eVHVRYk KyyrTBHqRsowj9nX8Ox8hR9DaZPMSeOJg12P8kDJT9tXR/ptrCOhdSPWMd2P6l2MN05v eAkfudy182nSP2XJDtzUodDWVeiJebuIDpXY76i1y9Fj+/r+dUvE7CBpylIKK4QgwXJ0 ruvb74GP6q6fYLLAm7I8wV8/Ekzp1HNza/FC3C1qOszR800ehDgPMktsAA2ickuxCLmo Jx7XnXOCNq65dYlm54hWEuPAhRmxDWIP4mEJ/WV6Qulhgww3yGD52ezVlEjsvmZidVi/ NTBg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :message-id:in-reply-to:date:references:subject:cc:to:from :dkim-signature; bh=/q/Q4y6ab/DuhdpLXSBA9//nauFzjd98lt9HvmG6hoE=; fh=ezbMmRkdvyO5jGsKf8rzQ5jI3w8d5wnWyIqhIbzUlJk=; b=PCwZmPZpqZ1ZD42S1493Kk4JK/XzMzbJLuFLMNOQ640rsiHU1S58paw0ud8mxPLr06 dwXX7xoSUxBS+Lg2cmBP1Ddw2gjIXg8S8T8rQzgqj9Vgoi/Zk3vy/sLgInfgSi8bKCB+ QLs4JKQ9aOWWxQtaKtiiYj4wy8WZVZp5oVYzNi/VYnrFTHGQd3xacPtMyN1M+4lyEivl KF4KmWkASvq4KfIBdEEhFyqUu3wIWS3R1J/Xj1UKxgX5hZAKGEfFq66O49CmeWkl6A4d 8TBpqKemXzKo/4cjMKn8aPqzGzlr/9XhOsUcppul1lRU4+02rbG6USZJ71xsj6cG9ymP vPSw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@lukasiewiczgov.onmicrosoft.com header.s=selector1-lukasiewiczgov-onmicrosoft-com header.b=sfmus0Up; arc=pass (i=1 spf=pass spfdomain=piap.lukasiewicz.gov.pl dkim=pass dkdomain=piap.pl dmarc=pass fromdomain=piap.pl); 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=fail (p=NONE sp=NONE dis=NONE) header.from=piap.pl Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id d22-20020a056a00199600b0068fcf6fe22esi111pfl.306.2023.10.13.03.39.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 03:39:49 -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=@lukasiewiczgov.onmicrosoft.com header.s=selector1-lukasiewiczgov-onmicrosoft-com header.b=sfmus0Up; arc=pass (i=1 spf=pass spfdomain=piap.lukasiewicz.gov.pl dkim=pass dkdomain=piap.pl dmarc=pass fromdomain=piap.pl); 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=fail (p=NONE sp=NONE dis=NONE) header.from=piap.pl Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id C811F80A73C3; Fri, 13 Oct 2023 03:39:46 -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 S230292AbjJMKjf (ORCPT + 99 others); Fri, 13 Oct 2023 06:39:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230429AbjJMKjb (ORCPT ); Fri, 13 Oct 2023 06:39:31 -0400 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2083.outbound.protection.outlook.com [40.107.6.83]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A5F7F10B; Fri, 13 Oct 2023 03:39:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aJIiPxcj/F0L/Vwlpdv1kKpoiyQtki06QGl8GI0MQk4MjOWlITRUvBqlPqwjeBCjNLeM+rxQyooubEMw2H1/t2XJnZB1V+9pbuYZmzS+ZwHHWZYSxUGai17tYZdsiNGPpm65na1aq951L9HP5dcD0UWxGmF6sirlcqPIQQj4fhUWDXSwqr377hAWbEJbPoUk5J1qa3+Z5JSHTwkMLPWFws9zA9gJhTZx1uo25prxLargo33jwiJDhfZMlqc1t2fIK0Of+hMcuYD69Lw7Tpr9aqJgYYTi6dNeOOnppeFvfPqlqAfaKIqCroJrNs+z0t+vDbEQXzFhivhVMEpSXE0Y4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=/q/Q4y6ab/DuhdpLXSBA9//nauFzjd98lt9HvmG6hoE=; b=eS/CspCCS17eaW/MdjwMan/K2W5usKla/nuMRbdllkbTdd3WQlHGGyXrfxLUxte2mWhr5q1/d4H0zm5X/sDisJporsWc0rnESbAseF5tmrMYAag8aaJ5u4lH9gS2/4evLqByOPPju4Qomu62h8tDbNp1KzWHwO7rDF6URK3oddUiZE9JVqb2WkvAFUunukhqMM3Y7E+dKMDnXReXOcXKyzKPN3Y6S0NuJJjWLhRlXycKqD67oqJEU6/wWqRf9CjExrblj4QkX6jBayQncSk1WCwhA7cxiz3AKGM2xAskSw43irI2bRUZ55qHyXPJQbOiN536q+/3PoL891Lff+X12A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=piap.lukasiewicz.gov.pl; dmarc=pass action=none header.from=piap.pl; dkim=pass header.d=piap.pl; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lukasiewiczgov.onmicrosoft.com; s=selector1-lukasiewiczgov-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/q/Q4y6ab/DuhdpLXSBA9//nauFzjd98lt9HvmG6hoE=; b=sfmus0UprdqtMnm3mdcTsjAtWTIDILOOVB9XREuY+hMzvr+5t+g4ADxMDn3XSr/oMdFRYNawqfXv2M15evHXQdiYgA5s6mE5uBZOFU79aoR4E2Zk5geaPUxYv6VNNjZlRjHMFS4fHXC/sBXKqv06ZA9x9WjTSAas9NgFidADZj0= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=piap.pl; Received: from VI1P193MB0685.EURP193.PROD.OUTLOOK.COM (2603:10a6:800:155::18) by AS8P193MB2302.EURP193.PROD.OUTLOOK.COM (2603:10a6:20b:44f::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.46; Fri, 13 Oct 2023 10:39:11 +0000 Received: from VI1P193MB0685.EURP193.PROD.OUTLOOK.COM ([fe80::bd36:39a7:40e3:c90e]) by VI1P193MB0685.EURP193.PROD.OUTLOOK.COM ([fe80::bd36:39a7:40e3:c90e%4]) with mapi id 15.20.6863.046; Fri, 13 Oct 2023 10:39:11 +0000 From: =?utf-8?Q?Krzysztof_Ha=C5=82asa?= To: Stefan Lengfeld Cc: linux-media , lkml , Dave Stevenson , Oleksij Rempel , Pengutronix Kernel Team , Shawn Guo , Sascha Hauer , Fabio Estevam , NXP Linux Team , linux-i2c@vger.kernel.org Subject: Re: Sony IMX290/462 image sensors I2C xfer peculiarity References: <20231011101553.we3r73xejvqdql5j@porty> <20231012220127.GB27838@stcim.de> Date: Fri, 13 Oct 2023 12:39:09 +0200 In-Reply-To: <20231012220127.GB27838@stcim.de> (Stefan Lengfeld's message of "Fri, 13 Oct 2023 00:01:27 +0200") Message-ID: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: WA2P291CA0010.POLP291.PROD.OUTLOOK.COM (2603:10a6:1d0:1e::16) To VI1P193MB0685.EURP193.PROD.OUTLOOK.COM (2603:10a6:800:155::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1P193MB0685:EE_|AS8P193MB2302:EE_ X-MS-Office365-Filtering-Correlation-Id: f212bc5f-a398-4047-a585-08dbcbd8a2c9 X-MS-Exchange-AtpMessageProperties: SA X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MbYYD/c0RG5gyd1TC7a6jm2RwmCeu6Wm613/oUd1j9F5jYgJLaBGOMJvLwdo9W62sXERC7euKTK0bZwTuZY9XcgS5eNHFQtTBVqFESh2Jj2sgL8Zq1TDYpzIYK6Kn99SN1yPCLK1+zEZoibY+YAgI1u86BtU9V1F58YE63J6M7rzosyFUAI8YN7SKbaSz++zdlsu0OoDxoKaYgftHOrTgegVSmIVZzreLr3We725Ut+OJUEPe4jHF/+EBKv4DIj43L9iQbsUNpwm6qjCayTPvhBiCSYT0SOZKOjQ1WlXsJHgAqyefRtHucw8Zsyp7n8Pl6/A8H2cU95oBh7MpUWUPt/yzGnq4ot7SUCzAHOxCz8fmuTdqagBUcO+VPZUA4ZIC0JH0g0WsyCwU2Bd00m/1OSOZC6wVnFv1kFTNmjc0HLLf5nHzvtzrEUFv5TSwAj3vJK5j+qH4AW6TeGQ0mp4ZWZGg8yAcyjNsyYcLf9XWnrE9OAJtSa1A4UgnG6AmdT4ElzqguKTtKW2elxAt/lRLaEH3yVN+JpffYNSrqPpGn0EIqVBPUVKGTSb7UyxCklZ3LePBPdE71NbQJbH3Cq/5YNbkUvxcUX39HAM+1pZei7tVTWKuXKbGllJJsFOvImj X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1P193MB0685.EURP193.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230031)(39860400002)(366004)(376002)(396003)(136003)(346002)(1800799009)(186009)(64100799003)(451199024)(6506007)(52116002)(6512007)(478600001)(6486002)(26005)(83380400001)(66574015)(316002)(42882007)(7416002)(2906002)(6916009)(54906003)(66476007)(66556008)(5660300002)(41300700001)(8676002)(66946007)(786003)(4326008)(8936002)(83170400001)(38100700002)(38350700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?eDlSNlBQNVZjSkZScXZMbnEvWFk3aDhUOHpnS1QwUGl5YWlUenFwakE4aEhH?= =?utf-8?B?ZnAyRjlHVWVUMEk3OWNLdHUvZDZhQ3dBbGgxQkdtcTdpYXZwZSs1aDZlOHNu?= =?utf-8?B?aVNHeUhJUDhFQ0trZitKc00rQVBOVGRBcThOb2l4elBMMWYyeWJLR2dDODV0?= =?utf-8?B?NkRJdWVkTit5OFlMTVp5ZTlCeDRGOUV4WVhSSE9TU05pQjlzem5MY1NYaHUv?= =?utf-8?B?SzNCQmcxMEV1SDd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ZEJQa0FtcWJJb1FsQ2tZSUNU?= =?utf-8?B?Zm1WaXFzZ2hseUJieVo1d3BuRURsM2NIS2lPSFdFK2F0dk1GWXhiQzE2TEtp?= =?utf-8?B?VXJwZmtHR2JzTUEwWXBRM1Nzdk8rTXYvUXBob05sS01JcjAvREdYbVF1TGJS?= =?utf-8?Q?WACJ3cNuFAlwE2jCIWYlzzWXd9hdfLyYNDphWvu3rHZj?= X-OriginatorOrg: piap.pl X-MS-Exchange-CrossTenant-Network-Message-Id: f212bc5f-a398-4047-a585-08dbcbd8a2c9 X-MS-Exchange-CrossTenant-AuthSource: VI1P193MB0685.EURP193.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Oct 2023 10:39:11.0252 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3e05b101-c6fe-47e5-82e1-c6a410bb95c0 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: p2Mx+LKWUrEtPlDH8DIClLugtcFyimSCZM5FdxMEgMCWctdbFiziAF21GpGMfGel69Uw4B/Fw1gh+mbzgtLzqs/evM/yhYDx0S2lmTfBPYIXuVKT+xTA5QTzyo8qAg6my7p3KZrMB5H9i2N5DvDHug== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8P193MB2302 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, 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, 13 Oct 2023 03:39:46 -0700 (PDT) Hi Stefan, > Maybe you just hit a corner case or a bug, that can be avoid, in the I2C > device. Maybe check with the manufacturer directly? I don't have direct contact at Sony, I guess I can try to escalate this through the part supplier, but I won't hold my breath. > Do you know the I2C repeated start feature [1]? This allows to batch toge= ther > multiple I2C read/writes in a single transfer. And in the best case, this > transfer is executed in one go without a delay in between. At least in th= e > kernel it's guaranteed that no other driver can go in between with anothe= r > transfer. Sure, imx290.c sensor driver use repeated STARTs. In fact, it only makes things worse. The timeout counter seems to start with the regular START (falling edge of SDA), repeated STARTs don't reset it. After 2^18 + 8 or + 9 MCLK cycles, the sensor simply disconnects from the bus, generating pseudo-STOP if it was in the middle of its 0 bit (0->1 SDA change while SCL high) or starting sending pseudo-1 bits otherwise (0xFF data on read or negative ACK on write). This way repeated START -> longer transfer -> higher probability of failure. Not that it really matters. I don't know about in-sensor race conditions, for example on WRITE to the chip, when the ACK it interrupted by the timeout (this can be detected by the CPU, but not reliably, depending on actual timings). OTOH with my "always use atomic xfers with these sensors" hack to the i.MX I2C driver, it seems to work correctly (at least as far as I2C is concerned). I wonder if we could/should add some special handling of these sensors in the mainline kernel. local_irq_save() and the atomic path do the trick, but it would have to be done in all I2C drivers (or at least in ones used with these sensors). If no other devices need such treatment, well... Everyone can (possibly) use a non-official hack. Thanks for your input, --=20 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