mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Karel Balej" <balejk@matfyz.cz>
To: "Duje Mihanović" <duje@dujemihanovic.xyz>,
	"Jonathan Cameron" <jic23@kernel.org>,
	"David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>, "Lee Jones" <lee@kernel.org>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>
Cc: "David Wronek" <david@mainlining.org>,
	<phone-devel@vger.kernel.org>,
	<~postmarketos/upstreaming@lists.sr.ht>,
	<linux-kernel@vger.kernel.org>, <linux-iio@vger.kernel.org>,
	<devicetree@vger.kernel.org>
Subject: Re: [PATCH v3 2/3] iio: adc: Add driver for Marvell 88PM886 PMIC ADC
Date: Sat, 06 Sep 2025 14:41:17 +0200	[thread overview]
Message-ID: <DCLQ427JYUS9.3EKILJ8O80RU1@matfyz.cz> (raw)
In-Reply-To: <20250905-88pm886-gpadc-v3-2-4601ad9ccb51@dujemihanovic.xyz>

Duje Mihanović, 2025-09-05T13:00:55+02:00:
> diff --git a/include/linux/mfd/88pm886.h b/include/linux/mfd/88pm886.h
> index 85eca44f39ab58ba4cb9ec4216118ee9604d021f..38892ba7b8a42bbecb53621a891a52a2fd70fd43 100644
> --- a/include/linux/mfd/88pm886.h
> +++ b/include/linux/mfd/88pm886.h
> @@ -10,6 +10,7 @@
>  #define PM886_IRQ_ONKEY			0
>  
>  #define PM886_PAGE_OFFSET_REGULATORS	1
> +#define PM886_PAGE_OFFSET_GPADC		2
>  
>  #define PM886_REG_ID			0x00
>  
> @@ -70,6 +71,63 @@
>  #define PM886_LDO_VSEL_MASK		0x0f
>  #define PM886_BUCK_VSEL_MASK		0x7f
>  
> +/* GPADC enable/disable registers */
> +#define PM886_REG_GPADC_CONFIG(n)	(n)
> +
> +#define PM886_GPADC_VSC_EN		BIT(0)
> +#define PM886_GPADC_VBAT_EN		BIT(1)
> +#define PM886_GPADC_GNDDET1_EN		BIT(3)
> +#define PM886_GPADC_VBUS_EN		BIT(4)
> +#define PM886_GPADC_VCHG_PWR_EN		BIT(5)
> +#define PM886_GPADC_VCF_OUT_EN		BIT(6)
> +#define PM886_GPADC_CONFIG1_EN_ALL	\
> +	(PM886_GPADC_VSC_EN |		\
> +	 PM886_GPADC_VBAT_EN |		\
> +	 PM886_GPADC_GNDDET1_EN |	\
> +	 PM886_GPADC_VBUS_EN |		\
> +	 PM886_GPADC_VCHG_PWR_EN |	\
> +	 PM886_GPADC_VCF_OUT_EN)
> +
> +#define PM886_GPADC_TINT_EN		BIT(0)
> +#define PM886_GPADC_PMODE_EN		BIT(1)
> +#define PM886_GPADC_GPADC0_EN		BIT(2)
> +#define PM886_GPADC_GPADC1_EN		BIT(3)
> +#define PM886_GPADC_GPADC2_EN		BIT(4)
> +#define PM886_GPADC_GPADC3_EN		BIT(5)
> +#define PM886_GPADC_MIC_DET_EN		BIT(6)
> +#define PM886_GPADC_CONFIG2_EN_ALL	\
> +	(PM886_GPADC_TINT_EN |		\
> +	 PM886_GPADC_GPADC0_EN |	\
> +	 PM886_GPADC_GPADC1_EN |	\
> +	 PM886_GPADC_GPADC2_EN |	\
> +	 PM886_GPADC_GPADC3_EN |	\
> +	 PM886_GPADC_MIC_DET_EN)
> +
> +/* No CONFIG3_EN_ALL because this is the only bit there. */
> +#define PM886_GPADC_GND_DET2_EN		BIT(0)
> +
> +/* GPADC channel registers */
> +#define PM886_REG_GPADC_VSC		0x40
> +#define PM886_REG_GPADC_VCHG_PWR	0x4c
> +#define PM886_REG_GPADC_VCF_OUT		0x4e
> +#define PM886_REG_GPADC_TINT		0x50
> +#define PM886_REG_GPADC_GPADC0		0x54
> +#define PM886_REG_GPADC_GPADC1		0x56
> +#define PM886_REG_GPADC_GPADC2		0x58
> +#define PM886_REG_GPADC_VBAT		0xa0
> +#define PM886_REG_GPADC_GND_DET1	0xa4
> +#define PM886_REG_GPADC_GND_DET2	0xa6
> +#define PM886_REG_GPADC_VBUS		0xa8
> +#define PM886_REG_GPADC_GPADC3		0xaa
> +#define PM886_REG_GPADC_MIC_DET		0xac
> +#define PM886_REG_GPADC_VBAT_SLP	0xb0
> +
> +/* VBAT_SLP is the last register and is 2 bytes wide like other channels. */
> +#define PM886_GPADC_MAX_REGISTER	(PM886_REG_GPADC_VBAT_SLP + 1)
> +
> +#define PM886_GPADC_BIAS_LEVELS		16
> +#define PM886_GPADC_INDEX_TO_BIAS_uA(i)	(1 + (i) * 5)
> +
>  struct pm886_chip {
>  	struct i2c_client *client;
>  	unsigned int chip_id;

Acked-by: Karel Balej <balejk@matfyz.cz> # for the PMIC

  parent reply	other threads:[~2025-09-06 12:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-05 11:00 [PATCH v3 0/3] Marvell 88PM886 PMIC GPADC driver Duje Mihanović
2025-09-05 11:00 ` [PATCH v3 1/3] dt-bindings: mfd: 88pm886: Add #io-channel-cells Duje Mihanović
2025-09-05 11:00 ` [PATCH v3 2/3] iio: adc: Add driver for Marvell 88PM886 PMIC ADC Duje Mihanović
2025-09-05 13:39   ` Andy Shevchenko
2025-09-07 10:36     ` Jonathan Cameron
2025-09-07 10:40     ` Jonathan Cameron
2025-09-06 12:41   ` Karel Balej [this message]
2025-09-05 11:00 ` [PATCH v3 3/3] mfd: 88pm886: Add GPADC cell Duje Mihanović

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DCLQ427JYUS9.3EKILJ8O80RU1@matfyz.cz \
    --to=balejk@matfyz.cz \
    --cc=andy@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=david@mainlining.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=duje@dujemihanovic.xyz \
    --cc=jic23@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=lee@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=phone-devel@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=~postmarketos/upstreaming@lists.sr.ht \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®