Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp508271rwr; Wed, 3 May 2023 01:52:06 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7BC/pxfTnK87YHcURz43woLDA/VQGOfPDRFh/xLgCe5r7Ey/qNZzRxGmGABnrEVr8j6ezH X-Received: by 2002:a05:6a00:1796:b0:640:defd:a6d5 with SMTP id s22-20020a056a00179600b00640defda6d5mr30603207pfg.12.1683103926635; Wed, 03 May 2023 01:52:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683103926; cv=none; d=google.com; s=arc-20160816; b=DH/lgpCkbeU9hNoco36hKwcLVhI5ORt/U4RB9dbFV3DPuAQfY9oCcGCh7TZsfbX286 tOQPvECdntUAxjO20XzH4+Eev9UfqUKzWkS0yOEFAzdgCPqIcmL82MiScofoILVAOfPb vLSXZYwxVSFB4jCg3tCznCvAqgvroH5hFNfdfyfAV6zCRb9TYYUvSWQLO4pJy7VN9pMb YHbUyPy6X0UnZbKVSFu/5U//sBI+fdSC8O8PUD4iP63DRQFf/YADtK2UGAtpWJwmQURK 8hpxlLDDE3dSGQEMxo/H+NNbe5hSYpnEx6sgEuV9Y/CcLUrCQAfGQ7Cs8Mpr/VJ9bjIa ZOkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=l2m+ibKvHZHrIZPQTYOh3Vp4LUK60yCUuLaBheU4Nyo=; b=werUi96yLyWZomQvKDMoR6fWgXF2HcAR90+wI/svvXmFdyCxhWiXmap2+ZAI8SUmVe RQV8KHYOMN52n1EoOqZTPI2BVXS2fWm+j8b9JBw8luB/5Kejc0jusc6PoPYzurfjpdof MCIrn7IBawlmfl2MgvnXpDaKs3HRwBuOPEwUfeYGwmhX71+xMLXknLo1wCFusrHE4dcw FEAm3qxlQ9Fk+/OjI+1hzImZSk+RPqYD2s5RiCUp4C2QeLZL0nIuDFnIQWijimhz8dUM pZgh0Lwe4+vuAbb9CvdwOUMao8BPTHek3WFTE+fE41JVAfwp+nquplL1YDRs0lsmJ/B2 z1Kw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k143-20020a628495000000b0063d30adb70esi33089400pfd.265.2023.05.03.01.51.52; Wed, 03 May 2023 01:52:06 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229929AbjECIkP (ORCPT + 99 others); Wed, 3 May 2023 04:40:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230058AbjECIjd (ORCPT ); Wed, 3 May 2023 04:39:33 -0400 Received: from mx1.emlix.com (mx1.emlix.com [136.243.223.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 138E04EF6; Wed, 3 May 2023 01:39:11 -0700 (PDT) Received: from mailer.emlix.com (unknown [81.20.119.6]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.emlix.com (Postfix) with ESMTPS id 62D0C5F901; Wed, 3 May 2023 10:38:20 +0200 (CEST) Message-ID: Date: Wed, 3 May 2023 10:37:45 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [PATCH v2 2/2] gpio: max7317: Add gpio expander driver Content-Language: de-DE, en-US To: Linus Walleij , Michael Walle Cc: Lukasz Zemla , Bartosz Golaszewski , Rob Herring , Krzysztof Kozlowski , linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org References: <20230403114033.8336-1-edmund.berenson@emlix.com> <20230403114033.8336-2-edmund.berenson@emlix.com> From: Edmund Berenson In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.2 required=5.0 tests=BAYES_00,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 4/4/23 16:05, Linus Walleij wrote: > On Mon, Apr 3, 2023 at 1:41 PM Edmund Berenson > wrote: > >> Add driver for maxim MAX7317 SPI-Interfaced 10 Port >> GPIO Expander. >> >> v2: adjust driver to use regmap >> >> Co-developed-by: Lukasz Zemla >> Signed-off-by: Lukasz Zemla >> Signed-off-by: Edmund Berenson > > Notwithstanding the other comments from Bartosz, this seems like > a driver that should be using the regmap GPIO helper library. > git grep GPIO_REGMAP will show you examples of other drivers > that use this and how it is used. > > Yours, > Linus Walleij Hi, thanks for the review and suggestion. I tried following your suggestion and use GPIO_REGMAP to implement the driver. Unfortunately I ran into two issues 1. reg_set_base == 0: for the devcie reg_set base is 0x0. In gpio-regmap there are several tests for !reg_set_base. There doesn't seem a way to distinguish between is set to 0 and is not set. :) 2. input/output direction: to set a gpio pin to input one has to write 0x1 to the corresponding output register. The issue starts when I configure a port to be an output, set output to 0x1, check the direction of the pin, doing so trough sysfs the system will now assume the pin is an input and I can't set its values anymore. Avoiding this I would like to track the direction of the pin separately from the device register, which is atm done in the corresponding bespoke in/out functions. I could probably solve both of these issues trough the reg_mask_xlate function but I believe this would introduce unneeded obscurity in the driver. I do not believe there are any other easy obvious/better fixes for this. (or maybe you prove me wrong :)) Would you be okay for this driver to stick with direct regmap usage? (obviously fixing the review suggestions) BR Edmund -- Edmund Berenson, emlix GmbH, http://www.emlix.com Fon +49 551 30664-0, Fax +49 551 30664-11 Gothaer Platz 3, 37083 Göttingen, Germany Sitz der Gesellschaft: Göttingen, Amtsgericht Göttingen HR B 3160 Geschäftsführung: Heike Jordan, Dr. Uwe Kracke – Ust-IdNr.: DE 205 198 055 emlix - smart embedded open source