Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1108236rwl; Fri, 31 Mar 2023 06:53:49 -0700 (PDT) X-Google-Smtp-Source: AKy350aeuW65950TQTDBfubyj/3aBPrhZzN0Zm7HPzHGS5H0mBS7wUN4YPNBL5ulEXKqaq8wbJgb X-Received: by 2002:a17:906:2098:b0:8d2:78c5:1d4e with SMTP id 24-20020a170906209800b008d278c51d4emr4985361ejq.5.1680270829430; Fri, 31 Mar 2023 06:53:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680270829; cv=none; d=google.com; s=arc-20160816; b=IPNHaFpbKl3AsSiL1KeE/kvuym8GBQG2CW/D/FxhneXYikCRi1IPPM3AYtNgwp3nC8 6UArp8UWB1/S3Z9x3unDsuB1Nu4VMMCKyRsmUUF99WcidTN4ULbw7yYJoU6esAaYkt9J 8tGQh9Jvfw8poX3HaDiu/XDCQ7xYiM5k4IeIOvurC2V+QujNcef1yxW4O/6kJLc3Ud2j TS9JdG6XNKcT/xSeSPaLqqTgFSiygH3ufDjWV2qITnGZupU99ijdGseom7DdTWLlB3oY Irg/1k9EoZ+SRXIOiA3t23QteACpiv5yZ51wkf75QMh9LJnfBUh5I7Gf1I4/uBhkdkOu bHYg== 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:dkim-signature; bh=IheJlONFtPM7ki6UXfuwGq3nIRoSOV5Cdp2p/ZTSFZo=; b=NXRkz5GjWPZb5FTM0ESXtlU4vKqFM7V4Mku5otfya4NzQPJgfC/f7w3AZ2Uq6It4qI A2QbYCXKwVNFZ1fY5URV3gt/3SXIOkqRc6XCe845tDvWGDRZJsbi76itsIMARVPVwJqF gNZUa635px09fdIeBTowgbOBPuRTe7CcGHdcX7gXInOXBh1S7wGjkyZcd06yGZu22U6i xkV1kiiSzQihtNpgdakGWwo1ZYUZzsNihqN3AFXd4v38hyQkb3XW2+lD3hX2NvGOQLXd fN/M6vAQbMiKcWXt2miEDKx97oe1QbvCu7OYO07HFG/I9pa+VhmZMpmIt7TchvY+0gZA OM1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yuV7kREd; 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=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id vr4-20020a170907a50400b00947c6b4a29asi870887ejc.1037.2023.03.31.06.53.25; Fri, 31 Mar 2023 06:53:49 -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=@linaro.org header.s=google header.b=yuV7kREd; 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=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232430AbjCaNo0 (ORCPT + 99 others); Fri, 31 Mar 2023 09:44:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232294AbjCaNoY (ORCPT ); Fri, 31 Mar 2023 09:44:24 -0400 Received: from mail-lj1-x230.google.com (mail-lj1-x230.google.com [IPv6:2a00:1450:4864:20::230]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B191F5B88 for ; Fri, 31 Mar 2023 06:44:22 -0700 (PDT) Received: by mail-lj1-x230.google.com with SMTP id s20so2753207ljp.7 for ; Fri, 31 Mar 2023 06:44:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680270261; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=IheJlONFtPM7ki6UXfuwGq3nIRoSOV5Cdp2p/ZTSFZo=; b=yuV7kREdfx12xlHlYMiKVwLBvhg9ce9BHX/pm1IYHQ7flFlOituOxMiiwEgvKXv5Gi uIQIZSyKQwJe9LJc6mDvuPa1cDJq4e/PRPDA5LdGzB58rKGgaqIJPw7labdgwzN/4sQN ujmI/7mRkneoxZcpP7Mzm3gvRYMpxqajsMLT98KeA4RPgs+lvqvSUyb5fQpxYPhW7dBG 6A5DluTaNY5WCEfKPO+71ISjx5Q/CCsEc+bziiPn5SYxoePG/FtSdmuv5BquUbtfnXEm gl8CDSC6tBNbsPomzgOyR6CLHAWX7CrMWMYmuwtL1EHl9Lm+AV6JxvFyr2BiglUF890k c6yA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680270261; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=IheJlONFtPM7ki6UXfuwGq3nIRoSOV5Cdp2p/ZTSFZo=; b=dDafUGZ3QwFeQsy0quvIMjHkPrmLuM9k0KKPub6J5fzPiKCqWZi+fSJEEMv1sh8atk MyS+coyB60RqUDKIIXWa+nwXopPOyJS1yPymK0PXEHD0dZAAXcrVUZoKJxQnkAhSIejJ VkiUIu6lRFsxPSUhVPUprM7IMPRZEk/3ESAmhoNLa1sLe0Ovie1SvoiQgavj39w2GN7I jSvNCEOLyZ6IOePer9OG4KVWaqaPZ7jk7jUlCCVLVkiI4X/p4sEylXvQqNKzKXIrH6/g u7pAzXFcHd/j2qFzO9DCHtaGjTATHvpCyxKh2aLHGLhZ8qIfvC/pJXyAZUf7Ap6QYvhP WB7Q== X-Gm-Message-State: AAQBX9csRSX6K7fEnJw7vG+JHZwNOrUOSNDLdnfGb5XuYbtLsOzhd1Do OAxczDWpyAPEUO4QMcZ1ZK/Orw== X-Received: by 2002:a2e:6a0f:0:b0:295:a458:e2ce with SMTP id f15-20020a2e6a0f000000b00295a458e2cemr2810764ljc.6.1680270260918; Fri, 31 Mar 2023 06:44:20 -0700 (PDT) Received: from [192.168.0.21] (78-11-189-27.static.ip.netia.com.pl. [78.11.189.27]) by smtp.gmail.com with ESMTPSA id j15-20020a2e3c0f000000b0029d45b15338sm365817lja.42.2023.03.31.06.44.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 31 Mar 2023 06:44:20 -0700 (PDT) Message-ID: Date: Fri, 31 Mar 2023 15:44:19 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: Re: [PATCH v5 2/5] mfd: Add support for the Lantiq PEF2256 framer Content-Language: en-US To: Herve Codina Cc: Lee Jones , Rob Herring , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, alsa-devel@alsa-project.org, Christophe Leroy , Thomas Petazzoni References: <20230328092645.634375-1-herve.codina@bootlin.com> <20230328092645.634375-3-herve.codina@bootlin.com> <20230330160510.GB489249@google.com> <20230331094208.41ab4420@bootlin.com> <6d39e9c3-fb6a-4b2a-9889-8fe8d86716d5@linaro.org> <20230331141104.42445da9@bootlin.com> From: Krzysztof Kozlowski In-Reply-To: <20230331141104.42445da9@bootlin.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, 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 lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 31/03/2023 14:11, Herve Codina wrote: > Hi Krzysztof, Lee > > On Fri, 31 Mar 2023 11:13:30 +0200 > Krzysztof Kozlowski wrote: > >> On 31/03/2023 09:42, Herve Codina wrote: >>> Hi Lee, >>> >>> On Thu, 30 Mar 2023 17:05:10 +0100 >>> Lee Jones wrote: >>> >>>> On Tue, 28 Mar 2023, Herve Codina wrote: >>>> >>>>> The Lantiq PEF2256 is a framer and line interface component designed to >>>>> fulfill all required interfacing between an analog E1/T1/J1 line and the >>>>> digital PCM system highway/H.100 bus. >>>> >>>> My goodness! >>>> >>>> It's been a long time since I've seen anything quite like this. >>> >>> Yes, old things but working on recent kernel. >>> >>>> >>>> My suggestion to you: >>>> >>>> * Split this up into components that fit functional subsystems >>> >>> It is done. The audio part is present in ASoC subsystem (path 5 in this >>> series). pinctrl function is implemented in this driver and, as I don't >>> want to share registers, I would prefer to keep this function inside this >>> driver. >> >> The amount of defines and huge functions like pef2256_setup_e1() >> contradict it. >> >> Even the pef2256_setup_e1() really does not follow Linux coding style - >> you know the size requirement, right? > > I know that pef2256_setup_e1() is quite big and I will look at a way > to split it in a consistent way. > >> >> pef2256_get_groups_count, struct pinmux_ops and others - this is >> pinctrl, not MFD! They cannot be in MFD driver. > > Maybe the issue is that MFD was not a good choice. > The "function" provided are not independent of each other. > The "main" driver (pef2256.c) needs to do the setup and handle the interrupt. Just like all PMICs... > The "function" provided are some glues in order to be used in some sub-systems > such as audio. Indeed, ASoC needs a codec DAI to be connected to a CPU DAI. Just like in all other cases... > These "functions" need to be started (ie probe()) after the pef2256 setup was > done. So a start (probe()) order relationship is needed. Just like in all other cases, so I really do not see here anything special. > > If a MFD driver needs independent children to handle independent functions, > the pef2256 does not fit well as a MFD driver. Why? So far everything is exactly the same. > > I switched from misc to MFD just to handle child DT nodes instead of having > phandles. Using child DT nodes instead of phandles is really a good thing and > need to be kept. Your DT bindings and nodes are not related to driver design. It does not matter for Devicetree if you put it to misc or MFD. It does not matter for driver whether you call it in Devicetree foo or bar. > The switch to MFD was probably not the best thing to do. Maybe, but your existing arguments are not really related... > > What do you think if I switched back the pef2256 "main" driver (pef2256.c) to > misc ? Why? What would it solve? You want to stuff pinctrl driver to misc, to avoid Lee's review? No. Pinctrl goes to pinctrl. Not to misc. Not to MFD. > > >> >>> >>> Also, I sent a RFC related to HDLC and PHY. In this RFC, the pef2256 is >>> considered as a PHY and handled in the PHY subsystem. >>> https://lore.kernel.org/linux-kernel/20230323103154.264546-1-herve.codina@bootlin.com/ >>> >>>> * Run checkpatch.pl >>> >>> I did. >> >> There are tons of weird indentation,e.g.: >> +#define PEF2256_2X_PC_XPC_XLT (0x8 << 0) >> ^^^^ there is only one space after #define > > I ran checkpatch.pl, not checkpatch.pl --strict. > > The spaces related the #define can be seen on many other drivers. > > #define FOO_REG_BAR 0x10 > #define FOO_REG_BAR_BIT0 BIT(0) > #define FOO_REG_BAR_BIT4 BIT(4) > > The first line is the register offset and the other lines (indented) are > the bits description related to this register. I don't think we have such convention in general and argument that some drivers do it in some subsystems is never a good argument. If they also misspell things or use Hungarian notation, shall we do the same? Although maybe it is fine for Lee. I find it unreadable. git grep '#define \+[A-Z]' | wc -l 73889 git grep '#define [A-Z]' | wc -l 3996054 In MFD there is only one driver doing this. Most of other cases are net and gpu. Best regards, Krzysztof