devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Nuno Sá" <noname.nuno@gmail.com>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: nuno.sa@analog.com, linux-gpio@vger.kernel.org,
	linux-pwm@vger.kernel.org, devicetree@vger.kernel.org,
	linux-input@vger.kernel.org, "Lee Jones" <lee@kernel.org>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Uwe Kleine-König" <ukleinek@kernel.org>,
	"Linus Walleij" <linus.walleij@linaro.org>,
	"Bartosz Golaszewski" <brgl@bgdev.pl>,
	"Dmitry Torokhov" <dmitry.torokhov@gmail.com>,
	"Liu Ying" <victor.liu@nxp.com>
Subject: Re: [PATCH v2 06/17] mfd: adp5585: add support for adp5589
Date: Tue, 22 Apr 2025 08:51:48 +0100	[thread overview]
Message-ID: <3156ad917b95ea6e29be7151d841f0a63294f23b.camel@gmail.com> (raw)
In-Reply-To: <20250421220617.GV17813@pendragon.ideasonboard.com>

On Tue, 2025-04-22 at 01:06 +0300, Laurent Pinchart wrote:
> Hi Nuno,
> 
> On Mon, Apr 21, 2025 at 01:21:08PM +0100, Nuno Sá wrote:
> > On Mon, 2025-04-21 at 12:15 +0300, Laurent Pinchart wrote:
> > > On Tue, Apr 15, 2025 at 03:49:22PM +0100, Nuno Sá via B4 Relay wrote:
> > > > From: Nuno Sá <nuno.sa@analog.com>
> > > > 
> > > > The ADP5589 is a 19 I/O port expander with built-in keypad matrix
> > > > decoder,
> > > > programmable logic, reset generator, and PWM generator.
> > > > 
> > > > This patch adds the foundation to add support for the adp5589 gpio and
> > > > pwm
> > > > drivers. Most importantly, we need to differentiate between some
> > > > registers addresses. It also hints to future keymap support.
> > > 
> > > Please split this in two patches, one that reworks the driver to support
> > > different register addresses, and one that adds adp5589 support.
> > > 
> > > > Signed-off-by: Nuno Sá <nuno.sa@analog.com>
> > > > ---
> > > >  drivers/mfd/adp5585.c       | 223
> > > > +++++++++++++++++++++++++++++++++++++++++---
> > > >  include/linux/mfd/adp5585.h |  57 ++++++++++-
> > > >  2 files changed, 268 insertions(+), 12 deletions(-)
> > > > 
> > > > diff --git a/drivers/mfd/adp5585.c b/drivers/mfd/adp5585.c
> > > > index
> > > > fafe3ad93ea196e1eb8e79fecba58f36f12167eb..c3586c0d6aa2e7e7d9466799341061
> > > > 0be7fc3672 100644
> > > > --- a/drivers/mfd/adp5585.c
> > > > +++ b/drivers/mfd/adp5585.c
> > > > @@ -25,6 +25,13 @@ static const struct mfd_cell adp5585_devs[] = {
> > > >  
> > > >  };
> > > >  
> > > > +static const struct mfd_cell adp5589_devs[] = {
> > > > +	MFD_CELL_NAME("adp5589-keys"),
> > > > +	MFD_CELL_NAME("adp5589-gpio"),
> > > > +	MFD_CELL_NAME("adp5589-pwm"),
> > > > +
> > > > +};
> > > > +
> > > >  static const struct regmap_range adp5585_volatile_ranges[] = {
> > > >  	regmap_reg_range(ADP5585_ID, ADP5585_GPI_STATUS_B),
> > > >  };
> > > > @@ -34,6 +41,15 @@ static const struct regmap_access_table
> > > > adp5585_volatile_regs = {
> > > >  	.n_yes_ranges = ARRAY_SIZE(adp5585_volatile_ranges),
> > > >  };
> > > >  
> > > > +static const struct regmap_range adp5589_volatile_ranges[] = {
> > > > +	regmap_reg_range(ADP5585_ID, ADP5589_GPI_STATUS_C),
> > > > +};
> > > > +
> > > > +static const struct regmap_access_table adp5589_volatile_regs = {
> > > > +	.yes_ranges = adp5589_volatile_ranges,
> > > > +	.n_yes_ranges = ARRAY_SIZE(adp5589_volatile_ranges),
> > > > +};
> > > > +
> > > >  /*
> > > >   * Chip variants differ in the default configuration of pull-up and
> > > > pull-down
> > > >   * resistors, and therefore have different default register values:
> > > > @@ -77,10 +93,52 @@ static const u8
> > > > adp5585_regmap_defaults_04[ADP5585_MAX_REG + 1] = {
> > > >  	/* 0x38 */ 0x00, 0x00, 0x00, 0x00, 0x00,
> > > >  };
> > > >  
> > > > +static const u8 adp5589_regmap_defaults_00[ADP5589_MAX_REG + 1] = {
> > > > +	/* 0x00 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> > > > +	/* 0x08 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> > > > +	/* 0x10 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> > > > +	/* 0x18 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> > > > +	/* 0x20 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> > > > +	/* 0x28 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> > > > +	/* 0x30 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> > > > +	/* 0x38 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> > > > +	/* 0x40 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> > > > +	/* 0x48 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> > > > +};
> > > > +
> > > > +static const u8 adp5589_regmap_defaults_01[ADP5589_MAX_REG + 1] = {
> > > > +	/* 0x00 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> > > > +	/* 0x08 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> > > > +	/* 0x10 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> > > > +	/* 0x18 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> > > > +	/* 0x20 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> > > > +	/* 0x28 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> > > > +	/* 0x30 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> > > > +	/* 0x38 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00,
> > > > +	/* 0x40 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> > > > +	/* 0x48 */ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00,
> > > > +};
> > > > +
> > > > +static const u8 adp5589_regmap_defaults_02[ADP5589_MAX_REG + 1] = {
> > > > +	/* 0x00 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> > > > +	/* 0x08 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> > > > +	/* 0x10 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> > > > +	/* 0x18 */ 0x00, 0x41, 0x01, 0x00, 0x11, 0x04, 0x00, 0x00,
> > > > +	/* 0x20 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> > > > +	/* 0x28 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> > > > +	/* 0x30 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> > > > +	/* 0x38 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> > > > +	/* 0x40 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> > > > +	/* 0x48 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> > > > +};
> > > > +
> > > >  enum adp5585_regmap_type {
> > > >  	ADP5585_REGMAP_00,
> > > >  	ADP5585_REGMAP_02,
> > > >  	ADP5585_REGMAP_04,
> > > > +	ADP5589_REGMAP_00,
> > > > +	ADP5589_REGMAP_01,
> > > > +	ADP5589_REGMAP_02,
> > > >  };
> > > >  
> > > >  static const struct regmap_config adp5585_regmap_configs[] = {
> > > > @@ -111,6 +169,131 @@ static const struct regmap_config
> > > > adp5585_regmap_configs[] = {
> > > >  		.reg_defaults_raw = adp5585_regmap_defaults_04,
> > > >  		.num_reg_defaults_raw =
> > > > sizeof(adp5585_regmap_defaults_04),
> > > >  	},
> > > > +	[ADP5589_REGMAP_00] = {
> > > > +		.reg_bits = 8,
> > > > +		.val_bits = 8,
> > > > +		.max_register = ADP5589_MAX_REG,
> > > > +		.volatile_table = &adp5589_volatile_regs,
> > > > +		.cache_type = REGCACHE_MAPLE,
> > > > +		.reg_defaults_raw = adp5589_regmap_defaults_00,
> > > > +		.num_reg_defaults_raw =
> > > > sizeof(adp5589_regmap_defaults_00),
> > > > +	},
> > > > +	[ADP5589_REGMAP_01] = {
> > > > +		.reg_bits = 8,
> > > > +		.val_bits = 8,
> > > > +		.max_register = ADP5589_MAX_REG,
> > > > +		.volatile_table = &adp5589_volatile_regs,
> > > > +		.cache_type = REGCACHE_MAPLE,
> > > > +		.reg_defaults_raw = adp5589_regmap_defaults_01,
> > > > +		.num_reg_defaults_raw =
> > > > sizeof(adp5589_regmap_defaults_01),
> > > > +	},
> > > > +	[ADP5589_REGMAP_02] = {
> > > > +		.reg_bits = 8,
> > > > +		.val_bits = 8,
> > > > +		.max_register = ADP5589_MAX_REG,
> > > > +		.volatile_table = &adp5589_volatile_regs,
> > > > +		.cache_type = REGCACHE_MAPLE,
> > > > +		.reg_defaults_raw = adp5589_regmap_defaults_02,
> > > > +		.num_reg_defaults_raw =
> > > > sizeof(adp5589_regmap_defaults_02),
> > > > +	},
> > > > +};
> > > > +
> > > > +static const struct adp5585_regs adp5585_regs = {
> > > > +	.debounce_dis_a = ADP5585_DEBOUNCE_DIS_A,
> > > > +	.rpull_cfg_a = ADP5585_RPULL_CONFIG_A,
> > > > +	.gpo_data_a = ADP5585_GPO_DATA_OUT_A,
> > > > +	.gpo_out_a = ADP5585_GPO_OUT_MODE_A,
> > > > +	.gpio_dir_a = ADP5585_GPIO_DIRECTION_A,
> > > > +	.gpi_stat_a = ADP5585_GPI_STATUS_A,
> > > > +	.pwm_cfg = ADP5585_PWM_CFG,
> > > > +	.pwm_offt_low = ADP5585_PWM_OFFT_LOW,
> > > > +	.pwm_ont_low = ADP5585_PWM_ONT_LOW,
> > > > +	.gen_cfg = ADP5585_GENERAL_CFG,
> > > > +	.ext_cfg = ADP5585_PIN_CONFIG_C,
> > > > +};
> > > 
> > > Why does this need to be stored in this driver, and not in the drivers
> > > for the gpio and pwm cells ? If the kernel is compiled without e.g. the
> > > adp5585-pwm driver, we shouldn't waste memory here by adding data that
> > > only the adp5585-pwm driver needs.
> > 
> > I don't really think the memory we would save to be that relevant but I can
> > better separate things. I guess i went like this because there's some shared
> > variables that will have to be in the top level structs and I did not wanted
> > to
> > have a "global" and "local" regs thingy...
> 
> I understand, and I think it's at least partly a coding style
> preference. Personally, I find that having child-specific data in child
> drivers makes the code easier to read, as it increases locality.
> Otherwise, I have to look through multiple child drivers to see if and
> where each field is used.

No strong feelings on my side. So, I'll give this a shot in v3

> 
> > > > +
> > > > +static const struct adp5585_regs adp5589_regs = {
> > > > +	.debounce_dis_a = ADP5589_DEBOUNCE_DIS_A,
> > > > +	.rpull_cfg_a = ADP5589_RPULL_CONFIG_A,
> > > > +	.gpo_data_a = ADP5589_GPO_DATA_OUT_A,
> > > > +	.gpo_out_a = ADP5589_GPO_OUT_MODE_A,
> > > > +	.gpio_dir_a = ADP5589_GPIO_DIRECTION_A,
> > > > +	.gpi_stat_a = ADP5589_GPI_STATUS_A,
> > > > +	.pwm_cfg = ADP5589_PWM_CFG,
> > > > +	.pwm_offt_low = ADP5589_PWM_OFFT_LOW,
> > > > +	.pwm_ont_low = ADP5589_PWM_ONT_LOW,
> > > > +	.gen_cfg = ADP5589_GENERAL_CFG,
> > > > +	.ext_cfg = ADP5589_PIN_CONFIG_D,
> > > > +};
> > > > +
> > > > +static const struct adp5585_info adp5585_info = {
> > > > +	.adp5585_devs = adp5585_devs,
> > > > +	.regmap_config = &adp5585_regmap_configs[ADP5585_REGMAP_00],
> > > > +	.n_devs = ARRAY_SIZE(adp5585_devs),
> > > > +	.id = ADP5585_MAN_ID_VALUE,
> > > > +	.regs = &adp5585_regs,
> > > > +	.max_rows = ADP5585_MAX_ROW_NUM,
> > > > +	.max_cols = ADP5585_MAX_COL_NUM,
> > > 
> > > Same here, the max_rows and max_cols fields don't seem to belong to this
> > > driver.
> > > 
> > > > +};
> > > > +
> > > > +static const struct adp5585_info adp5585_01_info = {
> > > > +	.adp5585_devs = adp5585_devs,
> > > > +	.regmap_config = &adp5585_regmap_configs[ADP5585_REGMAP_00],
> > > > +	.n_devs = ARRAY_SIZE(adp5585_devs),
> > > > +	.id = ADP5585_MAN_ID_VALUE,
> > > > +	.regs = &adp5585_regs,
> > > > +	.max_rows = ADP5585_MAX_ROW_NUM,
> > > > +	.max_cols = ADP5585_MAX_COL_NUM,
> > > > +};
> > > > +
> > > > +static const struct adp5585_info adp5585_02_info = {
> > > > +	.adp5585_devs = adp5585_devs,
> > > > +	.regmap_config = &adp5585_regmap_configs[ADP5585_REGMAP_02],
> > > > +	.n_devs = ARRAY_SIZE(adp5585_devs),
> > > > +	.id = ADP5585_MAN_ID_VALUE,
> > > > +	.regs = &adp5585_regs,
> > > > +	.max_rows = ADP5585_MAX_ROW_NUM,
> > > > +	.max_cols = ADP5585_MAX_COL_NUM,
> > > > +};
> > > > +
> > > > +static const struct adp5585_info adp5585_04_info = {
> > > > +	.adp5585_devs = adp5585_devs,
> > > > +	.regmap_config = &adp5585_regmap_configs[ADP5585_REGMAP_04],
> > > > +	.n_devs = ARRAY_SIZE(adp5585_devs),
> > > > +	.id = ADP5585_MAN_ID_VALUE,
> > > > +	.regs = &adp5585_regs,
> > > > +	.max_rows = ADP5585_MAX_ROW_NUM,
> > > > +	.max_cols = ADP5585_MAX_COL_NUM,
> > > > +};
> > > > +
> > > > +static const struct adp5585_info adp5589_info = {
> > > > +	.adp5585_devs = adp5589_devs,
> > > > +	.regmap_config = &adp5585_regmap_configs[ADP5589_REGMAP_00],
> > > > +	.n_devs = ARRAY_SIZE(adp5589_devs),
> > > > +	.id = ADP5589_MAN_ID_VALUE,
> > > > +	.regs = &adp5589_regs,
> > > > +	.max_rows = ADP5589_MAX_ROW_NUM,
> > > > +	.max_cols = ADP5589_MAX_COL_NUM,
> > > > +};
> > > > +
> > > > +static const struct adp5585_info adp5589_01_info = {
> > > > +	.adp5585_devs = adp5589_devs,
> > > > +	.regmap_config = &adp5585_regmap_configs[ADP5589_REGMAP_01],
> > > > +	.n_devs = ARRAY_SIZE(adp5589_devs),
> > > > +	.id = ADP5589_MAN_ID_VALUE,
> > > > +	.regs = &adp5589_regs,
> > > > +	.max_rows = ADP5589_MAX_ROW_NUM,
> > > > +	.max_cols = ADP5589_MAX_COL_NUM,
> > > > +};
> > > > +
> > > > +static const struct adp5585_info adp5589_02_info = {
> > > > +	.adp5585_devs = adp5589_devs,
> > > > +	.regmap_config = &adp5585_regmap_configs[ADP5589_REGMAP_02],
> > > > +	.n_devs = ARRAY_SIZE(adp5589_devs),
> > > > +	.id = ADP5589_MAN_ID_VALUE,
> > > > +	.regs = &adp5589_regs,
> > > > +	.max_rows = ADP5589_MAX_ROW_NUM,
> > > > +	.max_cols = ADP5589_MAX_COL_NUM,
> > > >  };
> > > >  
> > > >  static void adp5585_osc_disable(void *data)
> > > > @@ -122,7 +305,7 @@ static void adp5585_osc_disable(void *data)
> > > >  
> > > >  static int adp5585_i2c_probe(struct i2c_client *i2c)
> > > >  {
> > > > -	const struct regmap_config *regmap_config;
> > > > +	const struct adp5585_info *info;
> > > >  	struct adp5585_dev *adp5585;
> > > >  	unsigned int id;
> > > >  	int ret;
> > > > @@ -133,8 +316,13 @@ static int adp5585_i2c_probe(struct i2c_client
> > > > *i2c)
> > > >  
> > > >  	i2c_set_clientdata(i2c, adp5585);
> > > >  
> > > > -	regmap_config = i2c_get_match_data(i2c);
> > > > -	adp5585->regmap = devm_regmap_init_i2c(i2c, regmap_config);
> > > > +	info = i2c_get_match_data(i2c);
> > > > +	if (!info)
> > > > +		return -ENODEV;
> > > 
> > > Can this happen ?
> > > 
> > > > +
> > > > +	adp5585->info = info;
> > > 
> > > Drop the local info variable and assign the value to adp5585->info
> > > directly.
> > > 
> > > > +
> > > > +	adp5585->regmap = devm_regmap_init_i2c(i2c, info-
> > > > >regmap_config);
> > > >  	if (IS_ERR(adp5585->regmap))
> > > >  		return dev_err_probe(&i2c->dev, PTR_ERR(adp5585-
> > > > >regmap),
> > > >  				     "Failed to initialize register
> > > > map\n");
> > > > @@ -144,7 +332,8 @@ static int adp5585_i2c_probe(struct i2c_client *i2c)
> > > >  		return dev_err_probe(&i2c->dev, ret,
> > > >  				     "Failed to read device ID\n");
> > > >  
> > > > -	if ((id & ADP5585_MAN_ID_MASK) != ADP5585_MAN_ID_VALUE)
> > > > +	id &= ADP5585_MAN_ID_MASK;
> > > > +	if (id != adp5585->info->id)
> > > >  		return dev_err_probe(&i2c->dev, -ENODEV,
> > > >  				     "Invalid device ID 0x%02x\n", id);
> > > >  
> > > > @@ -158,8 +347,8 @@ static int adp5585_i2c_probe(struct i2c_client *i2c)
> > > >  		return ret;
> > > >  
> > > >  	ret = devm_mfd_add_devices(&i2c->dev, PLATFORM_DEVID_AUTO,
> > > > -				   adp5585_devs,
> > > > ARRAY_SIZE(adp5585_devs),
> > > > -				   NULL, 0, NULL);
> > > > +				   adp5585->info->adp5585_devs,
> > > > +				   adp5585->info->n_devs, NULL, 0,
> > > > NULL);
> > > >  	if (ret)
> > > >  		return dev_err_probe(&i2c->dev, ret,
> > > >  				     "Failed to add child devices\n");
> > > > @@ -191,19 +380,31 @@ static DEFINE_SIMPLE_DEV_PM_OPS(adp5585_pm,
> > > > adp5585_suspend, adp5585_resume);
> > > >  static const struct of_device_id adp5585_of_match[] = {
> > > >  	{
> > > >  		.compatible = "adi,adp5585-00",
> > > > -		.data = &adp5585_regmap_configs[ADP5585_REGMAP_00],
> > > > +		.data = &adp5585_info,
> > > >  	}, {
> > > >  		.compatible = "adi,adp5585-01",
> > > > -		.data = &adp5585_regmap_configs[ADP5585_REGMAP_00],
> > > > +		.data = &adp5585_01_info,
> > > >  	}, {
> > > >  		.compatible = "adi,adp5585-02",
> > > > -		.data = &adp5585_regmap_configs[ADP5585_REGMAP_02],
> > > > +		.data = &adp5585_02_info,
> > > >  	}, {
> > > >  		.compatible = "adi,adp5585-03",
> > > > -		.data = &adp5585_regmap_configs[ADP5585_REGMAP_00],
> > > > +		.data = &adp5585_info,
> > > >  	}, {
> > > >  		.compatible = "adi,adp5585-04",
> > > > -		.data = &adp5585_regmap_configs[ADP5585_REGMAP_04],
> > > > +		.data = &adp5585_04_info,
> > > > +	}, {
> > > > +		.compatible = "adi,adp5589-00",
> > > > +		.data = &adp5589_info,
> > > > +	}, {
> > > > +		.compatible = "adi,adp5589-01",
> > > > +		.data = &adp5589_01_info,
> > > > +	}, {
> > > > +		.compatible = "adi,adp5589-02",
> > > > +		.data = &adp5589_02_info,
> > > > +	}, {
> > > > +		.compatible = "adi,adp5589",
> > > > +		.data = &adp5589_info,
> > > >  	},
> > > >  	{ /* sentinel */ }
> > > >  };
> > > > diff --git a/include/linux/mfd/adp5585.h b/include/linux/mfd/adp5585.h
> > > > index
> > > > 016033cd68e46757aca86d21dd37025fd354b801..dffe1449de01dacf8fe78cf0e87d1f
> > > > 176d
> > > > 11f620 100644
> > > > --- a/include/linux/mfd/adp5585.h
> > > > +++ b/include/linux/mfd/adp5585.h
> > > > @@ -104,9 +104,11 @@
> > > >  #define		ADP5585_INT_CFG			BIT(1)
> > > >  #define		ADP5585_RST_CFG			BIT(0)
> > > >  #define ADP5585_INT_EN			0x3c
> > > > -
> > > >  #define ADP5585_MAX_REG			ADP5585_INT_EN
> > > >  
> > > > +#define ADP5585_MAX_ROW_NUM		6
> > > > +#define ADP5585_MAX_COL_NUM		5
> > > > +
> > > >  /*
> > > >   * Bank 0 covers pins "GPIO 1/R0" to "GPIO 6/R5", numbered 0 to 5 by
> > > > the
> > > >   * driver, and bank 1 covers pins "GPIO 7/C0" to "GPIO 11/C4", numbered
> > > > 6
> > > > to
> > > > @@ -117,10 +119,63 @@
> > > >  #define ADP5585_BANK(n)			((n) >= 6 ? 1 : 0)
> > > >  #define ADP5585_BIT(n)			((n) >= 6 ? BIT((n) - 6) :
> > > > BIT(n))
> > > >  
> > > > +/* ADP5589 */
> > > > +#define		ADP5589_MAN_ID_VALUE		0x10
> > > > +#define ADP5589_GPI_STATUS_A		0x16
> > > > +#define ADP5589_GPI_STATUS_C		0x18
> > > > +#define ADP5589_RPULL_CONFIG_A		0x19
> > > > +#define ADP5589_DEBOUNCE_DIS_A		0x27
> > > > +#define ADP5589_GPO_DATA_OUT_A		0x2a
> > > > +#define ADP5589_GPO_OUT_MODE_A		0x2d
> > > > +#define	ADP5589_GPIO_DIRECTION_A	0x30
> > > 
> > > Indentation looks wrong.
> > > 
> > > > +#define ADP5589_PWM_OFFT_LOW		0x3e
> > > > +#define ADP5589_PWM_ONT_LOW		0x40
> > > > +#define ADP5589_PWM_CFG			0x42
> > > > +#define ADP5589_PIN_CONFIG_D		0x4C
> > > > +#define ADP5589_GENERAL_CFG		0x4d
> > > > +#define ADP5589_INT_EN			0x4e
> > > > +#define ADP5589_MAX_REG			ADP5589_INT_EN
> > > > +
> > > > +#define ADP5589_MAX_ROW_NUM		8
> > > > +#define ADP5589_MAX_COL_NUM		11
> > > > +
> > > > +/*
> > > > + * Bank 0 covers pins "GPIO 1/R0" to "GPIO 8/R7", numbered 0 to 7 by
> > > > the
> > > > + * driver, bank 1 covers pins "GPIO 9/C0" to "GPIO 16/C7", numbered 8
> > > > to
> > > > + * 15 and bank 3 covers pins "GPIO 17/C8" to "GPIO 19/C10", numbered 16
> > > > to
> > > > 18.
> > > > + */
> > > > +#define ADP5589_BANK(n)			((n) >> 3)
> > > > +#define ADP5589_BIT(n)			BIT((n) & 0x7)
> > > > +
> > > > +struct adp5585_regs {
> > > > +	unsigned int debounce_dis_a;
> > > > +	unsigned int rpull_cfg_a;
> > > > +	unsigned int gpo_data_a;
> > > > +	unsigned int gpo_out_a;
> > > > +	unsigned int gpio_dir_a;
> > > > +	unsigned int gpi_stat_a;
> > > > +	unsigned int pwm_cfg;
> > > > +	unsigned int pwm_offt_low;
> > > > +	unsigned int pwm_ont_low;
> > > > +	unsigned int gen_cfg;
> > > > +	unsigned int ext_cfg;
> > > > +};
> > > > +
> > > > +struct adp5585_info {
> > > > +	const struct mfd_cell *adp5585_devs;
> > > > +	const struct regmap_config *regmap_config;
> > > > +	const struct adp5585_regs *regs;
> > > > +	unsigned int n_devs;
> > > > +	unsigned int id;
> > > > +	u8 max_rows;
> > > > +	u8 max_cols;
> > > > +};
> > > > +
> > > >  struct regmap;
> > > >  
> > > >  struct adp5585_dev {
> > > >  	struct regmap *regmap;
> > > > +	const struct adp5585_info *info;
> > > >  };
> > > >  
> > > >  #endif

  reply	other threads:[~2025-04-22  7:51 UTC|newest]

Thread overview: 81+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-15 14:49 [PATCH v2 00/17] mfd: adp5585: support keymap events and drop legacy Input driver Nuno Sá via B4 Relay
2025-04-15 14:49 ` [PATCH v2 01/17] dt-bindings: mfd: adp5585: ease on the required properties Nuno Sá via B4 Relay
2025-04-21  8:56   ` Laurent Pinchart
2025-04-21 12:12     ` Nuno Sá
2025-04-21 12:29       ` Laurent Pinchart
2025-04-21 12:45         ` Nuno Sá
2025-04-21 18:57   ` Rob Herring (Arm)
2025-04-15 14:49 ` [PATCH v2 02/17] mfd: adp5585: enable oscilator during probe Nuno Sá via B4 Relay
2025-04-21  8:57   ` Laurent Pinchart
2025-04-21 12:14     ` Nuno Sá
2025-04-21 22:03       ` Laurent Pinchart
2025-04-22  7:50         ` Nuno Sá
2025-04-15 14:49 ` [PATCH v2 03/17] pwm: adp5585: don't control OSC_EN in the pwm driver Nuno Sá via B4 Relay
2025-04-15 14:49 ` [PATCH v2 04/17] mfd: adp5585: make use of MFD_CELL_NAME() Nuno Sá via B4 Relay
2025-04-21  9:03   ` Laurent Pinchart
2025-04-24 15:55   ` Lee Jones
2025-04-15 14:49 ` [PATCH v2 05/17] dt-bindings: mfd: adp5585: document adp5589 I/O expander Nuno Sá via B4 Relay
2025-04-21  9:07   ` Laurent Pinchart
2025-04-21 18:59   ` Rob Herring (Arm)
2025-04-15 14:49 ` [PATCH v2 06/17] mfd: adp5585: add support for adp5589 Nuno Sá via B4 Relay
2025-04-21  9:15   ` Laurent Pinchart
2025-04-21 12:21     ` Nuno Sá
2025-04-21 22:06       ` Laurent Pinchart
2025-04-22  7:51         ` Nuno Sá [this message]
2025-04-24 16:01         ` Lee Jones
2025-04-24 16:18   ` Lee Jones
2025-04-24 16:30     ` Laurent Pinchart
2025-04-24 16:38       ` Lee Jones
2025-04-24 19:39         ` Laurent Pinchart
2025-04-25  7:58           ` Lee Jones
2025-04-25  9:13             ` Laurent Pinchart
2025-04-25  9:23               ` Lee Jones
2025-04-28  9:24               ` Nuno Sá
2025-04-15 14:49 ` [PATCH v2 07/17] gpio: adp5585: add support for the ad5589 expander Nuno Sá via B4 Relay
2025-04-17 12:27   ` Bartosz Golaszewski
2025-04-21  9:23   ` Laurent Pinchart
2025-04-21 12:22     ` Nuno Sá
2025-04-15 14:49 ` [PATCH v2 08/17] pwm: adp5585: add support for adp5589 Nuno Sá via B4 Relay
2025-04-15 14:49 ` [PATCH v2 09/17] dt-bindings: mfd: adp5585: add properties for input events Nuno Sá via B4 Relay
2025-04-21  9:28   ` Laurent Pinchart
2025-04-21 12:24     ` Nuno Sá
2025-04-29 15:03   ` Rob Herring (Arm)
2025-04-15 14:49 ` [PATCH v2 10/17] mfd: adp5585: add support for key events Nuno Sá via B4 Relay
2025-04-21  9:33   ` Laurent Pinchart
2025-04-21 12:32     ` Nuno Sá
2025-04-21 22:13       ` Laurent Pinchart
2025-04-24 16:07     ` Lee Jones
2025-04-24 16:24       ` Laurent Pinchart
2025-04-24 16:28         ` Lee Jones
2025-04-15 14:49 ` [PATCH v2 11/17] gpio: adp5585: support gpi events Nuno Sá via B4 Relay
2025-04-17 12:28   ` Bartosz Golaszewski
2025-04-15 14:49 ` [PATCH v2 12/17] Input: adp5585: Add Analog Devices ADP5585/89 support Nuno Sá via B4 Relay
2025-04-19  2:44   ` Dmitry Torokhov
2025-04-21  9:35   ` Laurent Pinchart
2025-04-21 12:33     ` Nuno Sá
2025-04-15 14:49 ` [PATCH v2 13/17] Input: adp5589: remove the driver Nuno Sá via B4 Relay
2025-04-19  2:45   ` Dmitry Torokhov
2025-04-21  9:40   ` Laurent Pinchart
2025-04-21 12:34     ` Nuno Sá
2025-04-15 14:49 ` [PATCH v2 14/17] mfd: adp5585: support getting vdd regulator Nuno Sá via B4 Relay
2025-04-21  9:48   ` Laurent Pinchart
2025-04-21 12:38     ` Nuno Sá
2025-04-21 22:09       ` Laurent Pinchart
2025-04-22  8:12         ` Nuno Sá
2025-04-15 14:49 ` [PATCH v2 15/17] dt-bindings: mfd: adp5585: document reset gpio Nuno Sá via B4 Relay
2025-04-21  9:36   ` Laurent Pinchart
2025-04-15 14:49 ` [PATCH v2 16/17] mfd: adp5585: add support for a reset pin Nuno Sá via B4 Relay
2025-04-21  9:46   ` Laurent Pinchart
2025-04-21 12:42     ` Nuno Sá
2025-04-21 22:10       ` Laurent Pinchart
2025-04-15 14:49 ` [PATCH v2 17/17] pwm: adp5585: make sure to include mod_devicetable.h Nuno Sá via B4 Relay
2025-04-21  9:50   ` Laurent Pinchart
2025-04-15 15:56 ` [PATCH v2 00/17] mfd: adp5585: support keymap events and drop legacy Input driver Laurent Pinchart
2025-04-21 10:08   ` Laurent Pinchart
2025-04-16  9:02 ` Liu Ying
2025-04-16 10:03   ` Nuno Sá
2025-05-01 12:00 ` Lee Jones
2025-05-01 14:09   ` Laurent Pinchart
2025-05-02  7:13     ` Lee Jones
2025-05-02  7:35       ` Nuno Sá
2025-05-02  8:30         ` Lee Jones

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=3156ad917b95ea6e29be7151d841f0a63294f23b.camel@gmail.com \
    --to=noname.nuno@gmail.com \
    --cc=brgl@bgdev.pl \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=krzk+dt@kernel.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=lee@kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=robh@kernel.org \
    --cc=ukleinek@kernel.org \
    --cc=victor.liu@nxp.com \
    /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;
as well as URLs for NNTP newsgroup(s).