From nobody Mon Feb 9 08:55:57 2026 Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6DF4B426EA3 for ; Fri, 6 Feb 2026 17:29:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770398965; cv=none; b=X+bf4RAAWQFgSCiyJpJhbEQoOslO7KtXxcRshRuNKKrnYMfjYM4PMpRXUwNW/lve+B63zJGwiXox5rxffJHY7DC5vZeaT/lMlmJDd+Ndao5bVZQx3BbSXLtdDTehc9tJTory+2zftUOgrJub3G14xsgRwlXjy9u5x5o0E7lmgKY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770398965; c=relaxed/simple; bh=8nK7uVl6v+pSmrvFya7GHw/59U+WVNcg+DflWmg+eco=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PEN+aNhBdMQx4vqsJ9CIVIyM6Y/L4NLIv7mjV2oi/vjFA9bPEkTWPpqxCmOH3Xx7bRkRFpCijKtidhfoPzUnTDp6TkFz2DQ/U976SQIrZRw6ZUFcnYC1b8QmtZ/bo0gEXbcbqr4kNwzMxdZXDjHmumJdGZghfY7QKWFPuqZW2k4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=X7zx6xc9; arc=none smtp.client-ip=209.85.221.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="X7zx6xc9" Received: by mail-wr1-f44.google.com with SMTP id ffacd0b85a97d-4362d18bb65so562795f8f.2 for ; Fri, 06 Feb 2026 09:29:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1770398964; x=1771003764; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5ScHHa9sLB0EQxzl6BiuNkW2/FL+7zrYJQ/WJF4R+IU=; b=X7zx6xc9O7rzlZ9m0CQEKBgUYeuXWvRK3C5HgLT/s7eiSp8NUm/mJ4CQ1IgVMQ6VuR 15yF41RjNRwdRyPvm0Z0fsjQrD3ypRnpSA2UTBWdWmxUw4nueWmcuC7TXBPUsLy9Ix5n dRO6oQTMcFLJ1ILlRZ8p//izANEovb/0RzPnm3CvNmPYLnztS8+UivYdeYMVHjKatN/r NscAg1/ciyUd4bR/Zd/bQVIWlKbHeAhispSpsT3j5QljZuoItgdWoQZR4HlTZTK6RLzr GNj05LcmYCjVek3Iy7pD4YWZ4hJ3ZqEb2XTxSwsWDxWNGxHkzn7xx+G6cpthn571whC6 5prQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770398964; x=1771003764; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=5ScHHa9sLB0EQxzl6BiuNkW2/FL+7zrYJQ/WJF4R+IU=; b=eNC5ILrfFeqlvtxKRwzMYD0KXV/HvO0w5h1GevctThNMYGe9jwHviPy6FPyyRgHWdo RvHLfWL12iU0ugiJTkmcBa4JKq7luztbeLOAgsNsOblfIjHSA0hP6BitpDfxUw3MnmaQ wdWpZUN5gQ29mY41s8USg4V9RLTo2SMkQaZHw6r0Ox/hLNesttoUMZgrLQPXl5dGFGum Qdviri2eLhwLET6tCN+Ze+R1QMXSPZqErQUovup3qmtETvAEEGule7/ZfU0SLcCGM1CN WMeK842Ff5jonDM4m34fxatkwna33pJO1R9zb5eHkRdUONQF/FjOYRjO6zp2vYG5bhyx 08dQ== X-Forwarded-Encrypted: i=1; AJvYcCWRUJKSOJDRNrxTN94MvE0etvMLTVQHedWltDyPACSeOD9VWcfaXiIxvP3WirZUSeE27+b7r2kLOj3DURs=@vger.kernel.org X-Gm-Message-State: AOJu0YzfrkIcMj/Jjpghazvptj//Zm1h5Tq7imEyiJtI48nPLxwt5d5w sLjRiw6ia7D36MzEnGYJgoEbIB70qeetxJbVnLWRhKHs++JlWYmAuv7l X-Gm-Gg: AZuq6aLq9AC3HrhdKG3EdplfEQ42S9GRv40R+6aeqgAG7x0rjIo9uObnfkBY37HyqfQ 5r413OOmyhGzXdz6m3O/TSTjMpXADQgpe6KNyY1Tt2YJ5FCyTq7WTSwOhxo2A9qrU4y+hHfHv6X V/HzoPfRhL90cN0xaHJKVXRYOByv3pnfRHhPh4SS/7hXwi2ZkFWSH0YI2udBftzhYUBfG0wzbd5 N/4S8HVsceTHCO4E2V9XJJ1YqPLtq76fEt6BD9no+iLp9ZhfTP/0qoz/YDBPgOvMBAcIBCm5J9c CrUInqDeTbxgsLGt/cWII3DkUGw8GTpWElVruzTTnGjJ6KHFIlso0xF5q9vgM6x0sfXba0yBlOk kmNZMwugKyOm16UThEXDhkaGSZRIMTXDuZJ9ftHxx1jVkQ+ENYbBW2hw/G2k82FoVU+BYxqkem+ nj X-Received: by 2002:a05:6000:18a6:b0:435:e47b:e746 with SMTP id ffacd0b85a97d-43629378231mr5523391f8f.36.1770398963681; Fri, 06 Feb 2026 09:29:23 -0800 (PST) Received: from xeon ([188.163.112.49]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43629734268sm6846033f8f.24.2026.02.06.09.29.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Feb 2026 09:29:23 -0800 (PST) From: Svyatoslav Ryhel To: Jonathan Cameron , David Lechner , =?UTF-8?q?Nuno=20S=C3=A1?= , Andy Shevchenko , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Dmitry Torokhov , Lee Jones , Pavel Machek , Liam Girdwood , Mark Brown , Svyatoslav Ryhel , Dixit Parmar , Tony Lindgren Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, linux-leds@vger.kernel.org Subject: [PATCH v2 10/11] mfd: motorola-cpcap: diverge configuration per-board Date: Fri, 6 Feb 2026 19:28:44 +0200 Message-ID: <20260206172845.145407-11-clamor95@gmail.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260206172845.145407-1-clamor95@gmail.com> References: <20260206172845.145407-1-clamor95@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" MFD have rigid subdevice structure which does not allow flexible dynamic subdevice linking. Address this by diverging CPCAP subdevice composition to take into account board specific configuration. Create a common default subdevice composition, rename existing subdevice composition into cpcap_mapphone_mfd_devices since it targets mainly Mapphone board. Signed-off-by: Svyatoslav Ryhel --- drivers/mfd/motorola-cpcap.c | 89 +++++++++++++++++++++++++++++++----- 1 file changed, 78 insertions(+), 11 deletions(-) diff --git a/drivers/mfd/motorola-cpcap.c b/drivers/mfd/motorola-cpcap.c index d8243b956f87..bea11868e823 100644 --- a/drivers/mfd/motorola-cpcap.c +++ b/drivers/mfd/motorola-cpcap.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include =20 @@ -24,10 +25,16 @@ #define CPCAP_REGISTER_SIZE 4 #define CPCAP_REGISTER_BITS 16 =20 +struct cpcap_chip_data { + const struct mfd_cell *mfd_devices; + unsigned int num_devices; +}; + struct cpcap_ddata { struct spi_device *spi; struct regmap_irq *irqs; struct regmap_irq_chip_data *irqdata[CPCAP_NR_IRQ_CHIPS]; + const struct cpcap_chip_data *cdata; const struct regmap_config *regmap_conf; struct regmap *regmap; }; @@ -195,16 +202,10 @@ static int cpcap_init_irq(struct cpcap_ddata *cpcap) return 0; } =20 -static const struct of_device_id cpcap_of_match[] =3D { - { .compatible =3D "motorola,cpcap", }, - { .compatible =3D "st,6556002", }, - {}, -}; -MODULE_DEVICE_TABLE(of, cpcap_of_match); - static const struct spi_device_id cpcap_spi_ids[] =3D { { .name =3D "cpcap", }, { .name =3D "6556002", }, + { .name =3D "mapphone-cpcap", }, {}, }; MODULE_DEVICE_TABLE(spi, cpcap_spi_ids); @@ -241,7 +242,56 @@ static int cpcap_resume(struct device *dev) =20 static DEFINE_SIMPLE_DEV_PM_OPS(cpcap_pm, cpcap_suspend, cpcap_resume); =20 -static const struct mfd_cell cpcap_mfd_devices[] =3D { +static const struct mfd_cell cpcap_default_mfd_devices[] =3D { + { + .name =3D "cpcap_adc", + .of_compatible =3D "motorola,cpcap-adc", + }, { + .name =3D "cpcap_battery", + .of_compatible =3D "motorola,cpcap-battery", + }, { + .name =3D "cpcap-regulator", + .of_compatible =3D "motorola,cpcap-regulator", + }, { + .name =3D "cpcap-rtc", + .of_compatible =3D "motorola,cpcap-rtc", + }, { + .name =3D "cpcap-pwrbutton", + .of_compatible =3D "motorola,cpcap-pwrbutton", + }, { + .name =3D "cpcap-usb-phy", + .of_compatible =3D "motorola,cpcap-usb-phy", + }, { + .name =3D "cpcap-led", + .id =3D 0, + .of_compatible =3D "motorola,cpcap-led-red", + }, { + .name =3D "cpcap-led", + .id =3D 1, + .of_compatible =3D "motorola,cpcap-led-green", + }, { + .name =3D "cpcap-led", + .id =3D 2, + .of_compatible =3D "motorola,cpcap-led-blue", + }, { + .name =3D "cpcap-led", + .id =3D 3, + .of_compatible =3D "motorola,cpcap-led-adl", + }, { + .name =3D "cpcap-led", + .id =3D 4, + .of_compatible =3D "motorola,cpcap-led-cp", + }, { + .name =3D "cpcap-codec", + }, +}; + +static const struct cpcap_chip_data cpcap_default_data =3D { + .mfd_devices =3D cpcap_default_mfd_devices, + .num_devices =3D ARRAY_SIZE(cpcap_default_mfd_devices), +}; + +static const struct mfd_cell cpcap_mapphone_mfd_devices[] =3D { { .name =3D "cpcap_adc", .of_compatible =3D "motorola,mapphone-cpcap-adc", @@ -285,7 +335,12 @@ static const struct mfd_cell cpcap_mfd_devices[] =3D { .of_compatible =3D "motorola,cpcap-led-cp", }, { .name =3D "cpcap-codec", - } + }, +}; + +static const struct cpcap_chip_data cpcap_mapphone_data =3D { + .mfd_devices =3D cpcap_mapphone_mfd_devices, + .num_devices =3D ARRAY_SIZE(cpcap_mapphone_mfd_devices), }; =20 static int cpcap_probe(struct spi_device *spi) @@ -297,6 +352,10 @@ static int cpcap_probe(struct spi_device *spi) if (!cpcap) return -ENOMEM; =20 + cpcap->cdata =3D device_get_match_data(&spi->dev); + if (!cpcap->cdata) + return -ENODEV; + cpcap->spi =3D spi; spi_set_drvdata(spi, cpcap); =20 @@ -331,10 +390,18 @@ static int cpcap_probe(struct spi_device *spi) spi->dev.coherent_dma_mask =3D 0; spi->dev.dma_mask =3D &spi->dev.coherent_dma_mask; =20 - return devm_mfd_add_devices(&spi->dev, 0, cpcap_mfd_devices, - ARRAY_SIZE(cpcap_mfd_devices), NULL, 0, NULL); + return devm_mfd_add_devices(&spi->dev, 0, cpcap->cdata->mfd_devices, + cpcap->cdata->num_devices, NULL, 0, NULL); } =20 +static const struct of_device_id cpcap_of_match[] =3D { + { .compatible =3D "motorola,cpcap", .data =3D &cpcap_default_data }, + { .compatible =3D "st,6556002", .data =3D &cpcap_default_data }, + { .compatible =3D "motorola,mapphone-cpcap", .data =3D &cpcap_mapphone_da= ta }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, cpcap_of_match); + static struct spi_driver cpcap_driver =3D { .driver =3D { .name =3D "cpcap-core", --=20 2.51.0