Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp349601rdg; Tue, 10 Oct 2023 12:04:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGJwjdVQ4rHOaLlA76xblLoJDBHeat5gs3KjRQTdhaNt0A6wQL+mPP2Y++DgOjc2ZsXLZTV X-Received: by 2002:a05:6a20:3212:b0:16b:8a00:643f with SMTP id hl18-20020a056a20321200b0016b8a00643fmr12776822pzc.29.1696964669823; Tue, 10 Oct 2023 12:04:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696964669; cv=none; d=google.com; s=arc-20160816; b=SAbYEOLBtu+QTh81xJGmIZPQzY7C3ZnGJqq/KI0k93vS9Macmq6CzBKWG9vQqdrabU q7JQqSGTLPvmoJGTOEB6S5IzZsGc2J3xm4OSidzLynGfCZHWLWU5s1Omb5inNKm2HEST PMRYsiTMWs3bYBpXjrVcW+gNnezYWTpkcNjkpDuROAhWe2ZsADtlUJNIFhzc3Motbr5B D45J4lnuRVOQQzR0T/K15IR2Px2zVMbW9WLN/m+PfwmE5a0RTZ0m47VDV6KdfEN1qFhk KCQKlGkqAUHYUSfj1DM5JDWYCoDJNGOfyz7Alnx4h+/XSEXo0zF88LW7PlIZw6vTUtzC eUXA== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=dBohDOxaH9+qViPWPKvFLogthXOakOs2XDelleIpxVI=; fh=QexkFP0503ZycDw0Vb8OeWG5JTeLPungVi+A4+aDZV4=; b=AdCHVuaCCHHIlq+KSuSND86QTuonILny85z0yM8Fnz+V1yW9n/nuBM8FQ9srG2RIqC 8f8c/zLYlxt4uSQMFOGkoC5n4vFtspKYrk/zj/vX/rIXA47uaCcz3XE621Cyuvk6Gzi7 rxh088lZ7oAPwkj6YJQPDRI8j7/otP+DrQPwADxxou/Ku6PeXgTqax+4IjBintafiFuD ZfgTHDvHNtuocoDOyW/SES2yT3cawe//itAQAx30StsPXrzyK/MTxZco+IpbtyVn/lmd DWHxPbRgSFqElI5JUYI+IbxrU4GmYaiDn3XxrQYGQI7LiN5s8QKRPd+eBGjMMQgT8RJX UbFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@t-8ch.de header.s=mail header.b=kSiUyrrs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id c23-20020a631c17000000b0057776b67494si12205213pgc.887.2023.10.10.12.04.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 12:04:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@t-8ch.de header.s=mail header.b=kSiUyrrs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (Postfix) with ESMTP id 3EBBB81BFAA8; Tue, 10 Oct 2023 12:04:27 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343677AbjJJTEQ (ORCPT + 99 others); Tue, 10 Oct 2023 15:04:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233674AbjJJTEP (ORCPT ); Tue, 10 Oct 2023 15:04:15 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5098393; Tue, 10 Oct 2023 12:04:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=t-8ch.de; s=mail; t=1696964646; bh=3MpUfcVd0SIAi956WNWhjBSMQfD+4nqTDl8IQsMjp04=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=kSiUyrrssGx4J7Y/Djzrr+iFdAHLnoTbeh1F2XcHUrVKwS2VH6SEoVG6C9aSAkUDH 2GCrqhnW6G0dV+45uHauRzSAZz/F1sbdn4SWgSX5YTAgVoC7gRwDIXAWHuqqMyljtu uRRKo5c7nYUokZ5FjTd1rU7vy6pBEAecGrVUDWYs= Date: Tue, 10 Oct 2023 21:04:05 +0200 From: Thomas =?utf-8?Q?Wei=C3=9Fschuh?= To: Anshul Dalal Cc: linux-input@vger.kernel.org, devicetree@vger.kernel.org, Dmitry Torokhov , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Shuah Khan , linux-kernel-mentees@lists.linuxfoundation.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 2/2] input: joystick: driver for Adafruit Seesaw Gamepad Message-ID: <8fbd4f6c-b1cf-4924-9e4b-2b9455b42e41@t-8ch.de> References: <20231010184827.1213507-1-anshulusr@gmail.com> <20231010184827.1213507-2-anshulusr@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20231010184827.1213507-2-anshulusr@gmail.com> X-Spam-Status: No, score=2.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.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 (lipwig.vger.email [0.0.0.0]); Tue, 10 Oct 2023 12:04:27 -0700 (PDT) X-Spam-Level: ** On 2023-10-11 00:18:24+0530, Anshul Dalal wrote: > Adds a driver for a mini gamepad that communicates over i2c, the gamepad > has bidirectional thumb stick input and six buttons. > > The gamepad chip utilizes the open framework from Adafruit called 'Seesaw' > to transmit the ADC data for the joystick and digital pin state for the > buttons. I have only implemented the functionality required to receive the > thumb stick and button state. > > Steps in reading the gamepad state over i2c: > 1. Reset the registers > 2. Set the pin mode of the pins specified by the `BUTTON_MASK` to input > `BUTTON_MASK`: A bit-map for the six digital pins internally > connected to the joystick buttons. > 3. Enable internal pullup resistors for the `BUTTON_MASK` > 4. Bulk set the pin state HIGH for `BUTTON_MASK` > 5. Poll the device for button and joystick state done by: > `seesaw_read_data(struct i2c_client *client, struct seesaw_data *data)` > > Product page: > https://www.adafruit.com/product/5743 > Arduino driver: > https://github.com/adafruit/Adafruit_Seesaw > > Driver tested on RPi Zero 2W > > Signed-off-by: Anshul Dalal In general: Reviewed-by: Thomas Weißschuh But one more nitpick below: > [..] > +static void seesaw_poll(struct input_dev *input) > +{ > + struct seesaw_gamepad *private = input_get_drvdata(input); > + struct seesaw_data data; > + int err; > + > + err = seesaw_read_data(private->i2c_client, &data); > + if (err != 0) > + return; This should be logged at debug level, so the user has some sort of chance to figure out if something is broken. > + > + input_report_abs(input, ABS_X, data.x); > + input_report_abs(input, ABS_Y, data.y); > + input_report_key(input, BTN_EAST, data.button_a); > + input_report_key(input, BTN_SOUTH, data.button_b); > + input_report_key(input, BTN_NORTH, data.button_x); > + input_report_key(input, BTN_WEST, data.button_y); > + input_report_key(input, BTN_START, data.button_start); > + input_report_key(input, BTN_SELECT, data.button_select); > + input_sync(input); > +} > [..]