From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.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 2E9E22FC004 for ; Fri, 14 Nov 2025 13:14:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763126064; cv=none; b=KWo4/+JqXTD6iTIKJ170GgyMgCok3o2tq3J72KUUI1hMoKRUeyG5oh7dKBqpUm5mxmPhFzd8tvb5zqL3vbVs4NS0DwhfH38MlHCyJYUHwW50+w7Qm/ID1m957vcWWb6wd4sMJUdOZraILuz8ttlQtwgeFeyKe46TQnv+pKkqiFM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763126064; c=relaxed/simple; bh=MkZ3kMIKj667Q6zlkFms+OxbDU158ERDyf3gzaKEAeo=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=S4WESh0Y4frN1n9n/69uqBPTjxJuXKgD0Ao6khNyuI3wo8U+mUqAVI9Izth5QEMHrohnbd9Epg5+mqbPr5ETImho2E9voqeL09Af9s2PzXZx636a0Aj8jTAoaKBJ/41QpVJtg8tosGHkTWZtdp1RS3f65IKhCAN82Ufa47JihSU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=TE3O3wtx; arc=none smtp.client-ip=209.85.221.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="TE3O3wtx" Received: by mail-wr1-f45.google.com with SMTP id ffacd0b85a97d-42b379cd896so1284791f8f.3 for ; Fri, 14 Nov 2025 05:14:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763126060; x=1763730860; darn=vger.kernel.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=iU0sX+BIcc5PHiUInIFp7NW8ySzf+LdobKT956HEe2s=; b=TE3O3wtxbtU988e/qgrUb8LBnjD9XIJlLYfOlnbpdfAMbp7tAn8xaDSqahTwEz8LDd QT/r3JT3O6laClSRGB6DR8Q/I/DFmetFYbFtSrb7yVJwptnfeW55OTV6g/GSlo0Z6z1h THKdIXSaw8d5cn3Dy+Hv6EWBqG2XF7KPo/fF0jqNJcHbTZ9JLLGDpEgxOlns0eMW8Syr W9TGvEZP9hiviBfrC7zXWIG+WiYlqlzbSJJs0Rxm2XyRDr6xvYkgpLoGLtjKH4YCVnOs 2vvSdPUPB3mm+Dtj7U4Rlbbf8/j279ciFMTVAStWf6pmkGq570JrhgRVbElUVOPF9BHZ rKzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763126060; x=1763730860; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=iU0sX+BIcc5PHiUInIFp7NW8ySzf+LdobKT956HEe2s=; b=gVcRgjB5Qd1bcS/kPqtPL1/RsTrEQiDDHvA9OyEfUnvjfwANEm8u6HYOMYYYVPTu4S IQ8AGNXmgZi8mtA1c+LTNtMyjuVoxHL1kXd+dzHhV3QLx23y4CE4+9NQxdAocYwgya3k fakWmPXDvu/OzUPYM9cJx7S0zh2j/2TPzsxblBcm2DccUnN+MKSSPfUG2+XhDRnqmKAz yHlZfrebH24R9H/PibB5q2qXM+ryuQsWBRDZDJs1GYSNl8EedZ1xYC9Rc1Znt7jwm7Ga l4UqThhXPRRinaKnDXypkWVD8wriMs6ExlqJaoDDfTAm1l9VJy9isNyeBo6lyyfqXD+R yOlQ== X-Forwarded-Encrypted: i=1; AJvYcCW0ViCClLohdXt8shKF8ROkXFZbRWjfaoZVrc1NzrQZ//jw92J1UvQdGb78bAMTmxJ1qStafUg7JNt1@vger.kernel.org X-Gm-Message-State: AOJu0YzgEb2W3gUhydGrPNcS8OnRBhs0H3nQHljGGNShXeCYQcf1PBqM aos6Tpbyp7Qr5/7c3Cx7KkYVvLYz+3LJ19hcO0B1UcZWHU+TeTH8cXaJ9MrX+0zGLaE= X-Gm-Gg: ASbGncu9U7nWnIcBh/3CPaoVXb1AILxU1nooyHqdHs8t031APPES02ghkcsNg7007Fh tLsQgoNxCPz8HNK5Xi15W8nkdSqytNEzyJkFHl9TL5H+tlLvh1zmUB9FWfzMqHM3zKqMjSTPRLq W5O9jsPJwEyunQeXTTh5giElWKGmkTA71ImSv9RiUj7atiqe7pF2qEblp17EWf+xt5euw2jdTaT O2h4+sRdrhOjM1brFl0X/rMFf0tKfj8T7TYvlqDq+iF9sklAOVQ2gPVMIwnBl9Bs9D1bJWuGMML 020pATs+sZHAG7/wpMYOHdzdRs8JoH8u5cTzkcCU3riH2NgReu/GDkmjT0Cl0TrSxvmzAtYC7gN 2MdLvXvd3I77ku3a7snDE6qNZt4xPnM+4sx7FjUMcnXQAmff+47YblnxMy9lYo8sijqywP/zvrs Y5ATCVHmrLmofSLvA1 X-Google-Smtp-Source: AGHT+IFlqbLqO9l0QT9dnRaBnBUSrcaFuapWFmH3KDcEb64+slQqRjevdDELlFMz7eG9w0S/wckC7Q== X-Received: by 2002:a05:6000:290b:b0:42b:3592:1bb9 with SMTP id ffacd0b85a97d-42b595a4856mr2451223f8f.35.1763126060406; Fri, 14 Nov 2025 05:14:20 -0800 (PST) Received: from draszik.lan ([212.129.74.29]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42b53f2084dsm10190727f8f.42.2025.11.14.05.14.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Nov 2025 05:14:20 -0800 (PST) Message-ID: <982158427bae79e15c92ad0198b398258e262ef6.camel@linaro.org> Subject: Re: [PATCH 08/13] mfd: sec: store hardware revision in sec_pmic_dev and add S2MU005 support From: =?ISO-8859-1?Q?Andr=E9?= Draszik To: Kaustabh Chakraborty , Lee Jones , Pavel Machek , Rob Herring , Krzysztof Kozlowski , Conor Dooley , MyungJoo Ham , Chanwoo Choi , Sebastian Reichel , Krzysztof Kozlowski , Alexandre Belloni , Jonathan Corbet Cc: linux-leds@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-rtc@vger.kernel.org, linux-doc@vger.kernel.org Date: Fri, 14 Nov 2025 13:14:19 +0000 In-Reply-To: <20251114-s2mu005-pmic-v1-8-9e3184d3a0c9@disroot.org> References: <20251114-s2mu005-pmic-v1-0-9e3184d3a0c9@disroot.org> <20251114-s2mu005-pmic-v1-8-9e3184d3a0c9@disroot.org> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.56.2-2+build3 Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 On Fri, 2025-11-14 at 00:35 +0530, Kaustabh Chakraborty wrote: > The device revision matters in cases when in some PMICs, the correct > register offsets very in different revisions. Instead of just debug > printing the value, store it in the driver data struct. >=20 > Unlike other devices, S2MU005 has its hardware revision ID in register > offset 0x73. Allow handling different devices and add support for S2MU005= . >=20 > Signed-off-by: Kaustabh Chakraborty > --- > =C2=A0drivers/mfd/sec-common.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 | 30 ++++++++++++++++++++++++------ > =C2=A0include/linux/mfd/samsung/core.h |=C2=A0 3 +++ > =C2=A02 files changed, 27 insertions(+), 6 deletions(-) >=20 > diff --git a/drivers/mfd/sec-common.c b/drivers/mfd/sec-common.c > index 4c5f4dc2905b..f51c53e7a164 100644 > --- a/drivers/mfd/sec-common.c > +++ b/drivers/mfd/sec-common.c > @@ -16,6 +16,7 @@ > =C2=A0#include > =C2=A0#include > =C2=A0#include > +#include > =C2=A0#include > =C2=A0#include > =C2=A0#include > @@ -86,17 +87,34 @@ static const struct mfd_cell s2mu005_devs[] =3D { > =C2=A0 MFD_CELL_OF("s2mu005-rgb", NULL, NULL, 0, 0, "samsung,s2mu005-rgb"= ), > =C2=A0}; > =C2=A0 > -static void sec_pmic_dump_rev(struct sec_pmic_dev *sec_pmic) > +static void sec_pmic_store_rev(struct sec_pmic_dev *sec_pmic) > =C2=A0{ > - unsigned int val; > + unsigned int reg, mask, shift; > =C2=A0 > =C2=A0 /* For s2mpg1x, the revision is in a different regmap */ > =C2=A0 if (sec_pmic->device_type =3D=3D S2MPG10) > =C2=A0 return; > =C2=A0 > - /* For each device type, the REG_ID is always the first register */ > - if (!regmap_read(sec_pmic->regmap_pmic, S2MPS11_REG_ID, &val)) > - dev_dbg(sec_pmic->dev, "Revision: 0x%x\n", val); > + switch (sec_pmic->device_type) { > + case S2MU005: > + reg =3D S2MU005_REG_ID; > + mask =3D S2MU005_ID_MASK; > + shift =3D S2MU005_ID_SHIFT; > + break; > + default: > + /* For other device types, the REG_ID is always the first register. */ > + reg =3D S2MPS11_REG_ID; > + mask =3D ~0; > + shift =3D 0; > + } > + > + if (!regmap_read(sec_pmic->regmap_pmic, reg, &sec_pmic->revision)) > + return; You should probably propagate the error up to the caller here. Cheers, Andre' > + > + sec_pmic->revision &=3D mask; > + sec_pmic->revision >>=3D shift; > + > + dev_dbg(sec_pmic->dev, "Revision: 0x%x\n", sec_pmic->revision); > =C2=A0} > =C2=A0 > =C2=A0static void sec_pmic_configure(struct sec_pmic_dev *sec_pmic) > @@ -236,7 +254,7 @@ int sec_pmic_probe(struct device *dev, int device_typ= e, unsigned int irq, > =C2=A0 return ret; > =C2=A0 > =C2=A0 sec_pmic_configure(sec_pmic); > - sec_pmic_dump_rev(sec_pmic); > + sec_pmic_store_rev(sec_pmic); > =C2=A0 > =C2=A0 return ret; > =C2=A0} > diff --git a/include/linux/mfd/samsung/core.h b/include/linux/mfd/samsung= /core.h > index fc07f7944dcd..ccd1bfa15b85 100644 > --- a/include/linux/mfd/samsung/core.h > +++ b/include/linux/mfd/samsung/core.h > @@ -63,6 +63,7 @@ enum sec_device_type { > =C2=A0 * @irq_base: Base IRQ number for device, required for IRQs > =C2=A0 * @irq: Generic IRQ number for device > =C2=A0 * @irq_data: Runtime data structure for IRQ controller > + * @revision: Revision number of the device > =C2=A0 * @wakeup: Whether or not this is a wakeup device > =C2=A0 */ > =C2=A0struct sec_pmic_dev { > @@ -74,6 +75,8 @@ struct sec_pmic_dev { > =C2=A0 int device_type; > =C2=A0 int irq; > =C2=A0 struct regmap_irq_chip_data *irq_data[MAX_IRQ_CHIPS]; > + > + unsigned int revision; > =C2=A0}; > =C2=A0 > =C2=A0struct sec_platform_data {