From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AE45EC48BF8 for ; Thu, 22 Feb 2024 08:43:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=CkQv+f9S9YeFWDZ5v7gPVfTOoBiJ+4yXQq9Jn+0kEGs=; b=hA413zX5kH/SgX YZWnovOFonrx4SuiGA96ZjOP+JESaPcqQh3NcC1JNl29y3xdB96gxNfJrhJ1rlTENHsRvuVrK3j4s 4Utfq52n2VJ0lrbzDepcglDRBCQhvrvGJBfYYTi34C7wNnSrgM+a2ypwhxNpzedp6RCKggi8GsZlN EKJ2+qnC611/xbaBtESu+oUeQqEI7BgBMqxXqYysr2ZXRpUK7g4T9gvKTbPMQM5FGe8yNw4Ho9gD0 2yDFSTgW8NxDATmW9PUVBHrQjS60feE/RfvQc1QHMmsdSjqH2B0BOXOBcEi2h3kPCCXx3vcUHxi+E BchLMgEsm1KyqIvB9t+Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rd4gD-000000045tm-0QN6; Thu, 22 Feb 2024 08:43:45 +0000 Received: from [118.185.121.105] (helo=esa1.ltts.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rd4g9-000000045pi-2OZ4 for linux-arm-kernel@lists.infradead.org; Thu, 22 Feb 2024 08:43:43 +0000 IronPort-SDR: xSdWhlzWQNfyCNiMvHcoX/EBWrRv49Ekw2KBJdYXwzUq61c2mhFMhdOSy0AV+QXomotupaWb7v LPe0QjzGuR8w== Received: from unknown (HELO localhost.localdomain) ([192.168.34.55]) by esa1.ltts.com with ESMTP; 22 Feb 2024 14:13:16 +0530 From: Bhargav Raviprakash To: khilman@kernel.org Cc: arnd@arndb.de, bhargav.r@ltts.com, broonie@kernel.org, conor+dt@kernel.org, devicetree@vger.kernel.org, gregkh@linuxfoundation.org, jpanis@baylibre.com, kristo@kernel.org, krzysztof.kozlowski+dt@linaro.org, lee@kernel.org, lgirdwood@gmail.com, linus.walleij@linaro.org, linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, m.nirmaladevi@ltts.com, nm@ti.com, robh+dt@kernel.org, vigneshr@ti.com Subject: Re: [RESEND PATCH v1 05/13] mfd: tps6594-spi: Add TI TPS65224 PMIC SPI Date: Thu, 22 Feb 2024 14:13:09 +0530 Message-Id: <20240222084309.6008-1-bhargav.r@ltts.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <7hcysy6ho6.fsf@baylibre.com> References: <7hcysy6ho6.fsf@baylibre.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240222_004342_149984_A899C52E X-CRM114-Status: GOOD ( 23.56 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hello Kevin, On Wed, 14 Feb 2024 10:10:17 -0800, Kevin wrote: > Bhargav Raviprakash writes: > > > Add support for TPS65224 PMIC in the TPS6594 driver as they share > > significant functional overlap. > > > > Signed-off-by: Bhargav Raviprakash > > --- > > drivers/mfd/tps6594-spi.c | 16 ++++++++++------ > > 1 file changed, 10 insertions(+), 6 deletions(-) > > > > diff --git a/drivers/mfd/tps6594-spi.c b/drivers/mfd/tps6594-spi.c > > index 5afb1736f..7ec66d31b 100644 > > --- a/drivers/mfd/tps6594-spi.c > > +++ b/drivers/mfd/tps6594-spi.c > > @@ -1,6 +1,6 @@ > > // SPDX-License-Identifier: GPL-2.0 > > /* > > - * SPI access driver for TI TPS6594/TPS6593/LP8764 PMICs > > + * SPI access driver for TI TPS65224/TPS6594/TPS6593/LP8764 PMICs > > * > > * Copyright (C) 2023 BayLibre Incorporated - https://www.baylibre.com/ > > */ > > @@ -66,7 +66,7 @@ static int tps6594_spi_reg_write(void *context, unsigned int reg, unsigned int v > > return spi_write(spi, buf, count); > > } > > > > -static const struct regmap_config tps6594_spi_regmap_config = { > > +static struct regmap_config tps6594_spi_regmap_config = { > > .reg_bits = 16, > > .val_bits = 8, > > .max_register = TPS6594_REG_DWD_FAIL_CNT_REG, > > @@ -81,6 +81,7 @@ static const struct of_device_id tps6594_spi_of_match_table[] = { > > { .compatible = "ti,tps6594-q1", .data = (void *)TPS6594, }, > > { .compatible = "ti,tps6593-q1", .data = (void *)TPS6593, }, > > { .compatible = "ti,lp8764-q1", .data = (void *)LP8764, }, > > + { .compatible = "ti,tps65224-q1", .data = (void *)TPS65224, }, > > {} > > }; > > MODULE_DEVICE_TABLE(of, tps6594_spi_of_match_table); > > @@ -101,15 +102,18 @@ static int tps6594_spi_probe(struct spi_device *spi) > > tps->reg = spi_get_chipselect(spi, 0); > > tps->irq = spi->irq; > > > > - tps->regmap = devm_regmap_init(dev, NULL, spi, &tps6594_spi_regmap_config); > > - if (IS_ERR(tps->regmap)) > > - return dev_err_probe(dev, PTR_ERR(tps->regmap), "Failed to init regmap\n"); > > - > > match = of_match_device(tps6594_spi_of_match_table, dev); > > if (!match) > > return dev_err_probe(dev, -EINVAL, "Failed to find matching chip ID\n"); > > tps->chip_id = (unsigned long)match->data; > > > > + if (tps->chip_id == TPS65224) > > + tps6594_spi_regmap_config.volatile_table = &tps65224_volatile_table; > > Similar to my comment on the i2c series, but to be more specific: > > Rather than use the .data pointer in the of_match_table as simply a > chip_id, instead make that into a struct that can contain chip-specific > values/pointers etc, and then each compatible can have a custom struct > (if needed.) > > This way, at probe/match time, all the chip-specific data is setup using > that struct, so that at runtime, there doesn't need to be any "if > (chip_id)" checking. > > Kevin Thanks for the feedback! We will implement the same in the next version. Regards, Bhargav _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel