Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp2085223rdf; Mon, 6 Nov 2023 04:31:02 -0800 (PST) X-Google-Smtp-Source: AGHT+IE8lOoM8uwWlSplPL8E1TdhuLd8pEM2O+vlCaKcw5MpR+f2/94oSwscv1wabzWQiOkaovqh X-Received: by 2002:a05:6a00:93a5:b0:6c3:703a:c394 with SMTP id ka37-20020a056a0093a500b006c3703ac394mr7510830pfb.27.1699273862305; Mon, 06 Nov 2023 04:31:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699273862; cv=none; d=google.com; s=arc-20160816; b=L1NeqqDrYcX4BG8lsvUy4ELbDIaSClhkZN1+TMl4L7d8/sSyd9kdSPJDGRKcZu5fn5 7anFPS5WhFiQ/KzM8POu+uOYN8t/vxyjLDYz1vkTETntU3FJNBLTW6/TOrCHorXFe7yJ PcKVvBJdwanwMvzFnnh0kJUNHixEaOu/8lbudHceMwGEGXhdEUBaLgEtTMFyB+3eAH0V xa+eBn0FBbcZ/KDeheLmJlvQ/ASvJj3Fl2E2sgXSFKa++BN4Nvl7tirLzbruqZE6tP2D cG7OwS6Z3/z7ELSYwWTrLHvg0bLoniz8/Vy565upXP4sQ2A+JnRNJSlTJB4S2hZikUij 9O6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=RyoWAwMg+Z2vExhtSjkgwiTVyerEHqh7OZclZDfiJdQ=; fh=l/wJkRX0CrLQonrPfMLKj27uZi3aLr1MguqrG2CwT48=; b=PnwwzOVBHNdvpm+rf/dUmtX6jYD9XvQHIV/h1dIyA4tJlcJv+TAIJpbxXuOLYwCD0A pOu75S6CS9yXMPyBbynMjNpHRMGI0CAVNXdt+S2S6/+MPAaQkKeCybB98pHW2JZRhaDA NGmmS8gjbee4xKSUw9ojC45ebx1Ul6fdv62zvEqoK5wckmk5VOLo4/Piw8+ooq+//3dz 8kuhL/PNmJb30b5esDgY3UmnWmHxALiYSrJx5XiAs6HJWUqeNCAv5VmMxFk0XzMIEbux 9TRXXE506Yc/X6BuQAUJLs5l0u49kvRv/UfhL9OdceSrZrSL6tUpMS70oi7TbFPh5aI8 EEWw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id by20-20020a056a02059400b005b99bfe3301si8762012pgb.462.2023.11.06.04.31.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 04:31:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 52741807E51F; Mon, 6 Nov 2023 04:30:16 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231566AbjKFMaE (ORCPT + 99 others); Mon, 6 Nov 2023 07:30:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52468 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229583AbjKFMaE (ORCPT ); Mon, 6 Nov 2023 07:30:04 -0500 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [IPv6:2a0a:edc0:2:b01:1d::104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1016DF for ; Mon, 6 Nov 2023 04:29:57 -0800 (PST) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qzyjm-0008I6-80; Mon, 06 Nov 2023 13:29:50 +0100 Received: from [2a0a:edc0:2:b01:1d::c0] (helo=ptx.whiteo.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qzyjk-0071dX-Jx; Mon, 06 Nov 2023 13:29:48 +0100 Received: from mfe by ptx.whiteo.stw.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1qzyjk-000fiX-HD; Mon, 06 Nov 2023 13:29:48 +0100 Date: Mon, 6 Nov 2023 13:29:48 +0100 From: Marco Felsch To: Dmitry Torokhov Cc: Kamel Bouhara , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Henrik Rydberg , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, mark.satterthwaite@touchnetix.com, bartp@baasheep.co.uk, hannah.rossiter@touchnetix.com, Thomas Petazzoni , Gregory Clement , bsp-development.geo@leica-geosystems.com Subject: Re: [PATCH v3 3/3] Input: Add TouchNetix axiom i2c touchscreen driver Message-ID: <20231106122948.le7y4xdwabnjkhgn@pengutronix.de> References: <20231012074034.1090436-1-kamel.bouhara@bootlin.com> <20231012074034.1090436-4-kamel.bouhara@bootlin.com> <20231020120310.vrn6ew3fcg5e545w@pengutronix.de> <20231022193529.GC3072@kb-xps> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180716 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: mfe@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.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 (agentk.vger.email [0.0.0.0]); Mon, 06 Nov 2023 04:30:16 -0800 (PST) Hi Dimitry, On 23-10-30, Dmitry Torokhov wrote: > On Sun, Oct 22, 2023 at 09:35:29PM +0200, Kamel Bouhara wrote: > > On Fri, Oct 20, 2023 at 02:03:10PM +0200, Marco Felsch wrote: > > > > + > > > > +static int > > > > +axiom_i2c_write(struct i2c_client *client, u8 usage, u8 page, u8 *buf, u16 len) > > > > +{ > > > > + struct axiom_data *ts = i2c_get_clientdata(client); > > > > + struct axiom_cmd_header cmd_header; > > > > + struct i2c_msg msg[2]; > > > > + int ret; > > > > + > > > > + cmd_header.target_address = cpu_to_le16(usage_to_target_address(ts, usage, page, 0)); > > > > + cmd_header.length = cpu_to_le16(len); > > > > + cmd_header.read = 0; > > > > + > > > > + msg[0].addr = client->addr; > > > > + msg[0].flags = 0; > > > > + msg[0].len = sizeof(cmd_header); > > > > + msg[0].buf = (u8 *)&cmd_header; > > > > + > > > > + msg[1].addr = client->addr; > > > > + msg[1].flags = 0; > > > > + msg[1].len = len; > > > > + msg[1].buf = (char *)buf; > > > > > > Please check the "comms protocol app note", for write it is not allowed > > > to send a stop, so the whole data must be send in one i2c_msg. > > > > > > > Well I only have the "Programmer's Guide", I'll have to check that as it > > really seems to works as it yet. > > As far as I know we only send "stop" on the last message in a sequence > of messages in i2c_transfer() unless it is explicitly requested with > I2C_M_STOP flag. You're right, I re-checked this again but this approach is still wrong since the protocol does not allow sending the payload as separate message. The payload must be send as one message starting with the i2c-address of the touchconroller followed by the target register address and how many bytes should be written followed by the payload. > ... > > > > + > > > > +static void axiom_i2c_remove(struct i2c_client *client) > > > > +{ > > > > + struct axiom_data *ts = i2c_get_clientdata(client); > > > > + > > > > + input_unregister_device(ts->input_dev); > > > > > > This can be part of devm_add_action_or_reset() and we could remove the > > > .remove() callback for this driver. > > > > > > > Sure, thanks for the tips :)! > > Actually input devices allocated with devm do not need to be explicitly > inregistered, so you do not need to bother with > devm_add_action_or_reset() and simply delete axiom_i2c_remove(). Ah I see.. so all devm_alloced...() device don't need that explicite unregister. Thanks. Regards, Marco > > Thanks. > > -- > Dmitry >