From nobody Mon Feb 9 08:56:30 2026 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (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 4C9D2326929 for ; Sun, 25 Jan 2026 13:43:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769348607; cv=none; b=QLyG1LwI6tGrv/uwq//DKYrMBSBrUVx4PiEyP/sjwxSZzaSMMFvIrm1wV4XTu2oQp6aUwJPlZi7XJndeUEv30DiBsulRInScSQ18UAl6GQrq5gD6sOK4ryhxkx+oqzO/PE6d4o9hghhgRnWIFZsJWlJhOk8634ONauFDm5MR75w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769348607; c=relaxed/simple; bh=/aEpFKjR+JV4pOYzDkZqOZgmIyIl0ijhVCjsZyzmokk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rB7XygHJiL5MMv+NRTooUZfgJOlR3+sPOEn2x5f2ofSG9mL+Rq7e7b50CW2FcoyfAFE5CSEZfsEuLrJGEwfJ5r0sFdEJbIoYsOzyfzp9dmYn/ZlWgjqNNLJqHWYwD3PJibUlSaegVUhQ/CkeMHnITmpSTOfreVFfisGzFwNw3Mc= 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=hJKZ6RPz; arc=none smtp.client-ip=209.85.128.45 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="hJKZ6RPz" Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-47fedb7c68dso36586445e9.2 for ; Sun, 25 Jan 2026 05:43:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1769348603; x=1769953403; 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=xRbIbMdeNel2KOGXl53uBpMxFpiNgiTsob/4xIgOxPM=; b=hJKZ6RPz2KF4dSi4muBoh04J8jp4n902LMDJU6Bm9LzmrfBn+Tgnpn4iXPextzPDaB VoVARJZQWu7lm1uc+82s+OiHJXG5H37tZlpj5zD8Zs3h3OJek/MnV4B7gCdU1fvrt++P YFI/h+3Jr1PmC3TzHfAqtGEeWVW1TSuyq2DGO8AleOvazzmc4h/4gQsrmaci9TUnUesZ UFMKx2mi8OPYF3oP1XyQVFWL0vkabqHVq91tgDURTCpuQ0C64eANCWJ2rzGGIzea8NHA E3V3TAeDS9r1OfHwab6dOQmDp2CrkgwmqlqlZZb83vaAVQo3Z+etUcPauKLP7+A52lmy rGyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769348603; x=1769953403; 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=xRbIbMdeNel2KOGXl53uBpMxFpiNgiTsob/4xIgOxPM=; b=NjJbGAb4g+y48l5D+nzUYTqBKcYK0YkzUzhnLAcTt+F7hHVcoCnmxNR59saR6lxpJF /W1Hh5uBrd2c4cTrn8jgdAcrw/U3oFZeporXL08LNKEKXz8iB3bUBMXFrmRxxcoTYmcZ jX3zwSI2aIw7yi3eDmlo0wtGdVOLlOcgwbG9NoeFGN06GTnOV7vYgsc6WL5FhlebzRIk 0V8r0fLQFiDzAPtvzAAu1xMNGFQxzTNPOWh+2lOGp8dqLZUkHKRKl50J2mWkUnYNf0i2 HgZ6BwAdFUHLxO8wqvEm/Ui8mZ+Q8P0XD7PLV2AdcRJzcwvGsui3fvdPqVuiZHzKhdgE gHIQ== X-Forwarded-Encrypted: i=1; AJvYcCUw+WV2At0muquWhSC3uwoZxPfIl++aj6vpxH3QkV2Ujf240ZGxAlDIVOE4OKc8qMJGss3T6GN0npR5HW4=@vger.kernel.org X-Gm-Message-State: AOJu0YwI91B+FKVDLwxeOAotzCJydZCvFw2yzJ+yPqYbBH3NFmb+7siH iQSmETTuEeVZolIF06pD0Tn2Nde2c0ne1Zi5T+EtOR8Yeq4DK4ULpFB0 X-Gm-Gg: AZuq6aK0kF86T7fCGDCfwgghRVUhDXHKk9KiENGCteZFKyP6Dli7GzxPChnRrhDO5Ob z/6VYrYEJ8YC4Mj5ISFYAmnEh07E8eBKfL3KwQKxzC3a+IV239gu5WdzH0eKvuexYfAiYGDBE6w lBrR2bb1F240B06UMG/WMa2AFywrGf7pz8g0HR8bIRg57DGVROTIiXLHaW/f7YcxICE9Cg+pbqL 4ZMqJEVIm5P4x6EWH1r5Hxp2O17Z4bFuOgUbRgdvJL3TI1NSzWIZEe3mW3qaGbQzIJYIkmFHJsw mk+2C5SyckUrOLACw6DtkdMKKiWtOEkqjNlF9+SUHwgfqLBV33dk4S0yIodmFIHzIehykL+9TuW +grwtvpVDETcOdUcB9iKj+pQaFzdQMfq37xgHRcDGP8i8x5oSyVNTeXg5MCmOBLstWp1l8eIo4f CI X-Received: by 2002:a05:6000:2512:b0:432:aa61:a06e with SMTP id ffacd0b85a97d-435ca1adefcmr2888121f8f.32.1769348602622; Sun, 25 Jan 2026 05:43:22 -0800 (PST) Received: from xeon ([188.163.112.49]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-435b1c246ecsm22459688f8f.10.2026.01.25.05.43.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Jan 2026 05:43:22 -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 , Alexandre Belloni , 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, linux-rtc@vger.kernel.org Subject: [PATCH v1 09/10] mfd: motorola-cpcap: diverge configuration per-board Date: Sun, 25 Jan 2026 15:43:01 +0200 Message-ID: <20260125134302.45958-10-clamor95@gmail.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260125134302.45958-1-clamor95@gmail.com> References: <20260125134302.45958-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..ebe525153c33 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 of_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