Received: by 2002:a89:288:0:b0:1f7:eeee:6653 with SMTP id j8csp94395lqh; Mon, 6 May 2024 12:20:02 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUmIQttaMervkOvs5LGBha+A63u3vqrvGABz6b0cBBPL8OKxfJ/H9j/qHUs8qYtYkIxKWvwh0RlnVlxVvl6eINGFSKFOCryX1WIc11xgw== X-Google-Smtp-Source: AGHT+IHXRroFbkeunZfo0HJWYLM9xDYCa2ddsohRj2WFKmnlEUhxafmII1gSgN6SkCbERnZ7/99L X-Received: by 2002:a17:902:ef81:b0:1e0:119e:f935 with SMTP id iz1-20020a170902ef8100b001e0119ef935mr8204932plb.15.1715023201917; Mon, 06 May 2024 12:20:01 -0700 (PDT) Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id u10-20020a170902e5ca00b001e3e6ebf3cbsi9310321plf.374.2024.05.06.12.20.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 12:20:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-170330-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=fail (body hash mismatch); spf=pass (google.com: domain of linux-kernel+bounces-170330-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-170330-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 1B76E282760 for ; Mon, 6 May 2024 19:19:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1A9CF1591E0; Mon, 6 May 2024 19:19:04 +0000 (UTC) Received: from fgw21-7.mail.saunalahti.fi (fgw21-7.mail.saunalahti.fi [62.142.5.82]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 12A0A158DDF for ; Mon, 6 May 2024 19:19:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.142.5.82 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715023143; cv=none; b=CpmX5nM4oe48i1kZUmF+Je3jCwkFDFvyeaDtZ0ipQheoJjBSAHDnDtLtYsjB5EeYNvjPGJDsKG5Sxp7vWQJ4gdHMluEtg4ZUBMt3/Lfxo2qlypmGiL6309QcQXGLWj8YZtT/qO2YgMCsHrjCDRlDcdJICr6ubC121kHvWFKFQR4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715023143; c=relaxed/simple; bh=iLuv/RrdkCRleNf8Bzi0oI0hYiMT/yyTAH48drrVY34=; h=From:Date:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=bFhaI7vDPARxPwXq3LB5Ds62iqbHHOcSS1if9cWcPoh5DvFNydHI55BjDuMIOfqQ7h+RkYfuBCXXWajUhFlwQpoQQZITolCNxaZz4HnGZ6ASExUuTHAtefuXwRLJlm7NPhFb6J2r0uu2uwc9z2VVCUgPIDSiFB40ulLN9aVR6no= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com; spf=fail smtp.mailfrom=gmail.com; arc=none smtp.client-ip=62.142.5.82 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=gmail.com Received: from localhost (88-113-25-208.elisa-laajakaista.fi [88.113.25.208]) by fgw21.mail.saunalahti.fi (Halon) with ESMTP id 7d5a15ba-0bdd-11ef-abf4-005056bdd08f; Mon, 06 May 2024 22:18:59 +0300 (EEST) From: Andy Shevchenko Date: Mon, 6 May 2024 22:18:58 +0300 To: Johan Hovold Cc: Lee Jones , Mark Brown , Linus Walleij , Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Liam Girdwood , Das Srinagesh , Satya Priya , Stephen Boyd , linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org Subject: Re: [PATCH 11/13] mfd: pm8008: rework driver Message-ID: References: <20240506150830.23709-1-johan+linaro@kernel.org> <20240506150830.23709-12-johan+linaro@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240506150830.23709-12-johan+linaro@kernel.org> Mon, May 06, 2024 at 05:08:28PM +0200, Johan Hovold kirjoitti: > Rework the pm8008 driver to match the new binding which no longer > describes internal details like interrupts and register offsets > (including which of the two consecutive I2C addresses the registers > belong two). > > Instead make the interrupt controller implementation internal and pass > interrupts to the subdrivers using MFD cell resources. > > Note that subdrivers may either get their resources, like register block > offsets, from the parent MFD or this can be included in the subdrivers > directly. > > In the current implementation, the temperature alarm driver is generic > enough to just get its base address and alarm interrupt from the parent > driver, which already uses this information to implement the interrupt > controller. > > The regulator driver, however, needs additional information like parent > supplies and regulator characteristics so in that case it is easier to > just augment its table with the regulator register base addresses. > > Similarly, the current GPIO driver already holds the number of pins and > that lookup table can therefore also be extended with register offsets. > > Note that subdrivers can now access the two regmaps by name, even if the > primary regmap is registered last so that it's returned by default when > no name is provided in lookups. > > Finally, note that the current QPNP GPIO and temperature alarm > subdrivers need some minor rework before they can be used with non-SPMI > devices like the PM8008. The MFD cell names therefore use a "qpnp" > rather than "spmi" prefix to prevent binding until the drivers have been > updated. .. > +static void devm_irq_domain_fwnode_release(void *res) > +{ > + struct fwnode_handle *fwnode = res; Unneeded line, can be static void devm_irq_domain_fwnode_release(void *fwnode) > + irq_domain_free_fwnode(fwnode); > +} .. > + dummy = devm_i2c_new_dummy_device(dev, client->adapter, client->addr + 1); > + if (IS_ERR(dummy)) { > + rc = PTR_ERR(dummy); > + dev_err(&client->dev, "failed to claim second address: %d\n", rc); > + return rc; return dev_err_probe(...); > + } .. > + name = devm_kasprintf(dev, GFP_KERNEL, "%pOF-internal", dev->of_node); You are using fwnode for IRQ domain and IRQ domain core uses fwnode, why OF here? name = devm_kasprintf(dev, GFP_KERNEL, "%pfw-internal", dev_fwnode(dev)); > + if (!name) > + return -ENOMEM; > + > + name = strreplace(name, '/', ':'); > + fwnode = irq_domain_alloc_named_fwnode(name); > + if (!fwnode) > + return -ENOMEM; .. > + rc = devm_regmap_add_irq_chip_fwnode(dev, fwnode, regmap, client->irq, > IRQF_SHARED, 0, &pm8008_irq_chip, &irq_data); > - if (rc) > - dev_err(dev, "failed to add IRQ chip: %d\n", rc); > + if (rc) { > + dev_err(dev, "failed to add IRQ chip: %d\n", rc); > + return rc; return dev_err_probe(...); > } -- With Best Regards, Andy Shevchenko