Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp942851ioo; Thu, 26 May 2022 19:57:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyJWQUuwcntp64YcsBi1y29emzTK9nqau8rsnK7Dr4+cjunxcoDSTT1TeLUZJVDfN9JxrqZ X-Received: by 2002:a17:907:7b9b:b0:6fe:dedf:6414 with SMTP id ne27-20020a1709077b9b00b006fededf6414mr21164875ejc.88.1653620251471; Thu, 26 May 2022 19:57:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653620251; cv=none; d=google.com; s=arc-20160816; b=rO1aSIHmje+iMsLR3DJI8aNrMqilH0voiv+f0IPjonoZLYO/z8QC90uCX1GnVp+I2m PHjJdWsusH6LCdkxXBCHxLgMx1gULlJt/IMalzUo0e9C1zeqjJxgMtwG9pj6hGCGcbt5 rvgyT7n17Td5mw3gluHQukNbfSVIr4pjyec6QlPqXsEfk9t307mxHpd+kf7y15Ug9AT3 0vfNvyVFUjN1TEjPXM+bpAq10l+DLsl2f54qFoLdFID6TeW6o0IGHJxZezyvMC5NWHK5 78df8RJxcrFtOOEzw7jjm9DJpl+UDGk7dZYfQyiKOXbHgWy8lGVtfSc2yPtreuVjIi/X 3oZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=E6g5Lb+lud3z6IBBuIB+xMLxh9m0MkwWAWdE3o4ayS0=; b=FU2Bk8kqSC7taFYY2coEcvFCl74uHwhJdqD7iAA3VZ1sc/Qm2oB+mB+e3e97qSw/7d RIZ+ShRzwEutZfaHD6N7CfYjxsgJHsELxN/tkVc5BhaFSfxy0B8DoGKaJMqPBRVaWCPF FA0NKO4f8wttAeWZLmSzfdp+6Awu267K2gzZnCiGwl5EhUOyaPQ5xjekROE+NQLjzJ37 ol2fp9cCmgBeALjuX6NGehyiX/+V2wDOhSd3XT6KdnvsifNPjx+fVfDGUKeCqaXnfvz/ DOF1CwiC6JVs2s3/vxMvwPlZ0NArNfxVdi+RbIR1REltGlpb/dRdNfxvZISHE5tLf6+W /rBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=qfD44tES; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sh35-20020a1709076ea300b006fea1e6ead8si1695049ejc.190.2022.05.26.19.57.05; Thu, 26 May 2022 19:57:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=qfD44tES; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235153AbiEYIoc (ORCPT + 99 others); Wed, 25 May 2022 04:44:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229812AbiEYIo1 (ORCPT ); Wed, 25 May 2022 04:44:27 -0400 Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A5D44B1C5; Wed, 25 May 2022 01:44:26 -0700 (PDT) Received: by mail-ej1-x62d.google.com with SMTP id gi33so31733743ejc.3; Wed, 25 May 2022 01:44:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=E6g5Lb+lud3z6IBBuIB+xMLxh9m0MkwWAWdE3o4ayS0=; b=qfD44tESSCw7bOee8sbiWWI6sjo2GgzH6a0M1B/+nMRqn+KWLIw//KM7sP54cr77ln cgnD2R7x3arzrr8UGqBp+PlXFAxebwGM9IBdDDyobSVVryzyoqvFIL2IcCpiJ63KaFQF UI1sacv2EzpzU1J4ZfYQa8j/HJk7/4mbkjVJ3Xy6MeAwfZpcP+1FsUTQjNn+XXytrnHA tV3gq5tS2/BCs15rPkDhUXe3/PAjYvuSwx2nZCbk/trjIIhFiKbnkoajhodllMO2Iqd+ J6kg6Yu8ZA5KSl0vPoKK8OyjYznlPoDN/azt4s0IWJRjIG5Y8rvqb2jA/X0Uem5koMBq +WpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=E6g5Lb+lud3z6IBBuIB+xMLxh9m0MkwWAWdE3o4ayS0=; b=RY/U08lwAPABLCIn5AmFEd1tebUeW2PqCjahGP+4LYcDVCLZYdF+7m9U6j+i1CMRmq anDuo+VgIrRUPJfiGDktW18mJGIi9I908p1+dPkPArd5+RWWhDGeRjgvoGW3Jqp0mX0J 8dKsDeBlLhRXZiE4NXIKpPB5uQjDAkDXuibJmbzQx/OZrWWIxWyEi8/uAO4MxVdnOvgd eD1l9jRYFfpxlU9DgMKnP14abmXyKvT5vi75q/1iNMRhIRbH1GMPcsR5rtNVWHECd+hG 0FIGI/eY8Rq18tqWitcVqM7/xGtcENvcdxP6SGsf/nKoZ1wsaKNBIgOQLPG+agkhC7bR kuMQ== X-Gm-Message-State: AOAM533MRFFw9ttNwSjwWxD5poHqkyELoaQAIWXKL/PUnq9beIOWuS2u lXa7BFuq8J9daGtngpvu/bY= X-Received: by 2002:a17:906:6a0d:b0:6ff:15a8:acbf with SMTP id qw13-20020a1709066a0d00b006ff15a8acbfmr919474ejc.143.1653468264674; Wed, 25 May 2022 01:44:24 -0700 (PDT) Received: from michael-VirtualBox (109-186-136-71.bb.netvision.net.il. [109.186.136.71]) by smtp.gmail.com with ESMTPSA id hy16-20020a1709068a7000b006f3ef214e27sm7934893ejc.141.2022.05.25.01.44.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 May 2022 01:44:24 -0700 (PDT) Date: Wed, 25 May 2022 11:44:21 +0300 From: Michael Zaidman To: Guillaume Champagne Cc: jikos@kernel.org, benjamin.tissoires@redhat.com, linux-i2c@vger.kernel.org, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Mathieu Gallichand Subject: Re: [PATCH] HID: ft260: fix multi packet i2c transactions Message-ID: <20220525084421.GA7899@michael-VirtualBox> References: <20220524192422.13967-1-champagne.guillaume.c@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220524192422.13967-1-champagne.guillaume.c@gmail.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 24, 2022 at 03:24:22PM -0400, Guillaume Champagne wrote: > Only trigger START and STOP conditions for the first and last HID > packets when i2c writes are split in multiple packets. Otherwise, slave > i2c devices receive each packet as standalone i2c transactions. Since > i2c slave devices clear their internal state on STOP, this breaks auto > increment of the register address written to. > > Concretely, SCL is now held low between processing of HID packets so i2c > slave devices know to keep increment the same register address when the > next bytes arrive. > > Co-developed-by: Mathieu Gallichand > Signed-off-by: Mathieu Gallichand > Signed-off-by: Guillaume Champagne > --- > drivers/hid/hid-ft260.c | 10 +++++++++- > 1 file changed, 9 insertions(+), 1 deletion(-) > > diff --git a/drivers/hid/hid-ft260.c b/drivers/hid/hid-ft260.c > index 79505c64dbfe..9c5912a21ccb 100644 > --- a/drivers/hid/hid-ft260.c > +++ b/drivers/hid/hid-ft260.c > @@ -390,6 +390,8 @@ static int ft260_i2c_write(struct ft260_device *dev, u8 addr, u8 *data, > struct hid_device *hdev = dev->hdev; > struct ft260_i2c_write_request_report *rep = > (struct ft260_i2c_write_request_report *)dev->write_buf; > + bool multi_packet = data_len > FT260_WR_DATA_MAX; > + u8 packet_flag = multi_packet ? flag & FT260_FLAG_START_REPEATED : flag; Please take a look at the https://patchwork.kernel.org/project/linux-input/patch/20220525074757.7519-4-michael.zaidman@gmail.com/ that addresses the same issue but does it more efficiently by adding one conditional statement per ft260_i2c_write call in the main path vs. three in this commit. It comes in the patch set with other performance improvements published on my GitHub https://github.com/MichaelZaidman/hid-ft260 several months ago. I would greatly appreciate it if you could test and feedback on the patch set content. Thanks, Michael