Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp717735rwl; Wed, 5 Apr 2023 06:56:12 -0700 (PDT) X-Google-Smtp-Source: AKy350acoJH2n3Bl6e4SaLai+N4W6jEqQUIyXOh/0f4O4ZUSrtuovPECErAQYNc5CsmKL09FvCh2 X-Received: by 2002:a17:902:ced2:b0:1a1:aa28:e67a with SMTP id d18-20020a170902ced200b001a1aa28e67amr7607116plg.48.1680702972112; Wed, 05 Apr 2023 06:56:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680702972; cv=none; d=google.com; s=arc-20160816; b=ON9mXPOEK8xf62wfx+kquUUQaTpiq6Ri1ffhE/3cx/IxT3RtzWZoNJqBDNqRYl3Sa6 IgFEqFcpymRY51qlA1lU2+F2FXLkIT4qjco6SFtL3VNdSZPdV8pBWGczYBoLft7L1+9i xA769xKIG6Dr0MR3dobZV1OCYcGVppJmP1o+DAWmCqHrVlQoyLwV1HI84viZne8MeHyC mwKDbBx5Bj3aNwrcrKXN0KmkKP2omonbup1guDPJCa+QLZ4wgkPiI913Xz90NQ2tblt8 Qj8Wmt0umUqjihGoD2XbVtXO1rIO/Ju10k+KmtIH4ci6D8mS+7Y6BJqHDfkpMNd0KWh9 kK8g== 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=VBNIC3+XM/Zz5a+oU6OVMPNDjYYbzPF8h5IB/9LizMk=; b=X3dx0QA9At5Wn1NaD0z8v1oAEH0J9EXfbJ10pP5od2a+mzK+reUL48udGGEsYatN/J mOcvDdalQA3Ttj46m/cMVtrQDa1VK69BmNkS8/rl5yRF5EuGKeZS+CBYj2mPJyZGlhiM 0tl3h9+Xy5HkUSsxkleW4zVFShV+t0cgrJ8jFXgmNG6jbw1cvflhaY7cI5FfwE8pZALq 8gJXFx9L3Af1JfpIq+m9PqU6qFc4YOWWJceigfyKuX7Yag8N2jAxpu1IkSPhFwDjnn6A J+9oC75PH+q7woWtPkHl46P3MHCJM8juFT3vKaCEyVR9PsYMq11tUA2oDx0lif1aJXwa KO2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BJzRUELO; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n5-20020a63f805000000b004faf341b31asi12524769pgh.196.2023.04.05.06.56.00; Wed, 05 Apr 2023 06:56:12 -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=@kernel.org header.s=k20201202 header.b=BJzRUELO; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238084AbjDENzA (ORCPT + 99 others); Wed, 5 Apr 2023 09:55:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35292 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237446AbjDENy7 (ORCPT ); Wed, 5 Apr 2023 09:54:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2BF813E; Wed, 5 Apr 2023 06:54:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 519DC6286F; Wed, 5 Apr 2023 13:54:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 14212C433D2; Wed, 5 Apr 2023 13:54:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1680702896; bh=afQp0pzn0/QeQA2yZuPiGA1HfkQUMzgZArsWN6F3gP8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=BJzRUELOzZFM4zemOrIWywg+3ZyP3masCyIl5+zZlAB09XTI6j0Nki00evmuKOTJY 1PckAHEU9PDXJ+7sUqjZBOo7K8vEYAKQsSHYxvoWGq42pTvxAdIi4OEX3fvUN3LyzD cWhFN9VprMBARPc3xovQJAWqPiFoXA9QyncVskUC/HCxqx0YLUjfYH1BD+rb0tyPXk 6yHuY5PPh+Ng6icedCWO7f1PXkcLxW7gyC3lxLEB81vMOAwXPGmlFGCDk5zAwuO3mB l8rL+Up4CnppD4DdNEtADRAbDQwZ4h/eBb+avX0sB3v3khVzpyyq2aGF4JG/p7Z9T6 sA9i588CorxQg== Date: Wed, 5 Apr 2023 14:54:50 +0100 From: Lee Jones To: Krzysztof Kozlowski Cc: Herve Codina , 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 Subject: Re: [PATCH v5 2/5] mfd: Add support for the Lantiq PEF2256 framer Message-ID: <20230405135450.GF8371@google.com> References: <20230331094208.41ab4420@bootlin.com> <6d39e9c3-fb6a-4b2a-9889-8fe8d86716d5@linaro.org> <20230331141104.42445da9@bootlin.com> <20230331165904.4e7f46a1@bootlin.com> <20230403142822.GA8371@google.com> <20230404092036.2d1cd5d9@bootlin.com> <20230404100759.5bc9cd20@bootlin.com> <143754c2-9e37-4386-af92-174c0df2eb0a@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <143754c2-9e37-4386-af92-174c0df2eb0a@linaro.org> X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,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 Tue, 04 Apr 2023, Krzysztof Kozlowski wrote: > On 04/04/2023 10:07, Herve Codina wrote: > > >>> So, the structure I have in mind: > >>> - pef2256.c (MFD) > >>> implement and do the setup at probe() > >>> Add the children at probe(): > >>> - pef2256-pinctrl (pinctrl) added using mfd_add_devices() > >>> - pef2256-codec (ASoC codec) added using devm_of_platform_populate() > >>> > >>> Lee, with this in mind, can the core pef2256.c be a MFD driver ? > >> > >> You do not use MFD here, so why do you want to keep it in MFD? If you > >> disagree, please tell me where is the MFD code in your patch? > > > > I don't want to absolutely use MFD. > > I just want to put my driver somewhere and I don't know the right location > > between MFD and Misc. > > > > Basically, the driver needs to do (little simplified and error path removed): > > > > static const struct mfd_cell pef2256_devs[] = { > > { .name = "lantiq-pef2256-pinctrl", }, > > }; > > > > static int pef2256_probe(struct platform_device *pdev) > > { > > struct pef2256 *pef2256; > > void __iomem *iomem; > > int ret; > > int irq; > > > > pef2256 = devm_kzalloc(&pdev->dev, sizeof(*pef2256), GFP_KERNEL); > > if (!pef2256) > > return -ENOMEM; > > > > pef2256->dev = &pdev->dev; > > > > iomem = devm_platform_ioremap_resource(pdev, 0); > > > > pef2256->regmap = devm_regmap_init_mmio(&pdev->dev, iomem, > > &pef2256_regmap_config); > > > > pef2256->mclk = devm_clk_get_enabled(&pdev->dev, "mclk"); > > pef2256->sclkr = devm_clk_get_enabled(&pdev->dev, "sclkr"); > > pef2256->sclkx = devm_clk_get_enabled(&pdev->dev, "sclkx"); > > > > pef2256->reset_gpio = devm_gpiod_get_optional(&pdev->dev, "reset", GPIOD_OUT_LOW); > > if (pef2256->reset_gpio) { > > gpiod_set_value_cansleep(pef2256->reset_gpio, 1); > > udelay(10); > > gpiod_set_value_cansleep(pef2256->reset_gpio, 0); > > udelay(10); > > } > > > > pef2556_of_parse(pef2256, np); > > > > irq = platform_get_irq(pdev, 0); > > ret = devm_request_irq(pef2256->dev, irq, pef2256_irq_handler, 0, "pef2256", pef2256); > > > > platform_set_drvdata(pdev, pef2256); > > > > mfd_add_devices(pef2256->dev, PLATFORM_DEVID_NONE, pef2256_devs, > > ARRAY_SIZE(pef2256_devs), NULL, 0, NULL); > > Wait, now you use MFD framework, so the driver is suitable for MFD. > Before there was nothing like that in your code. Agree, the above is suitable for MFD, since it does all the things I said your last one did not. You *can* also use of_platform_populate() here, since you are *also* requesting and initialising shared resources. You cannot do *both* however. -- Lee Jones [李琼斯]