mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
To: Lee Jones <lee@kernel.org>
Cc: linux@ew.tq-group.com, linux-kernel@vger.kernel.org,
	Gregor Herburger <gregor.herburger@tq-group.com>
Subject: Re: [PATCH v5 5/5] mfd: tqmx86: add I2C IRQ support
Date: Mon, 21 Oct 2024 16:44:26 +0200	[thread overview]
Message-ID: <da174fe9af56d5c0f77ee140456c9d07cc968136.camel@ew.tq-group.com> (raw)
In-Reply-To: <1d2477439ec2bb7f5145648da4be5dcd8cfb6847.1729509613.git.matthias.schiffer@ew.tq-group.com>

On Mon, 2024-10-21 at 13:34 +0200, Matthias Schiffer wrote:
> From: Gregor Herburger <gregor.herburger@tq-group.com>
> 
> The i2c-ocores controller can run in interrupt mode on tqmx86 modules.
> Add module parameter to allow configuring the IRQ number, similar to the
> handling of the GPIO IRQ.
> 
> Signed-off-by: Gregor Herburger <gregor.herburger@tq-group.com>
> Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
> ---
> 
> v2: improve module parameter description (was patch 4/4)
> v3: replace IRQ 0 resource with an empty placeholder to simplify error handling
> v4: no changes
> v5: move placeholder to the end of the resource array, use define for index

Ugh... I just realized that I forgot to update a comment for v5. Will send a new version some time
this week.




> 
>  drivers/mfd/tqmx86.c | 18 +++++++++++++++++-
>  1 file changed, 17 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mfd/tqmx86.c b/drivers/mfd/tqmx86.c
> index 1fd2212bf492c..94126a484c412 100644
> --- a/drivers/mfd/tqmx86.c
> +++ b/drivers/mfd/tqmx86.c
> @@ -50,6 +50,7 @@
>  #define TQMX86_REG_IO_EXT_INT_9			2
>  #define TQMX86_REG_IO_EXT_INT_12		3
>  #define TQMX86_REG_IO_EXT_INT_MASK		0x3
> +#define TQMX86_REG_IO_EXT_INT_I2C_SHIFT		0
>  #define TQMX86_REG_IO_EXT_INT_GPIO_SHIFT	4
>  #define TQMX86_REG_SAUC		0x17
>  
> @@ -60,11 +61,18 @@ static uint gpio_irq;
>  module_param(gpio_irq, uint, 0);
>  MODULE_PARM_DESC(gpio_irq, "GPIO IRQ number (valid parameters: 7, 9, 12)");
>  
> +static uint i2c_irq;
> +module_param(i2c_irq, uint, 0);
> +MODULE_PARM_DESC(i2c_irq, "I2C IRQ number (valid parameters: 7, 9, 12)");
> +
>  /* Index of IRQ placeholder in resource list */
>  #define TQMX86_IRQ_GPIO 1
> +#define TQMX86_IRQ_I2C 1
>  
> -static const struct resource tqmx_i2c_soft_resources[] = {
> +static struct resource tqmx_i2c_soft_resources[] = {
>  	DEFINE_RES_IO(TQMX86_IOBASE_I2C, TQMX86_IOSIZE_I2C),
> +	/* Placeholder for IRQ resource - filled in by the probe function */
> +	[TQMX86_IRQ_I2C] = {},
>  };
>  
>  static const struct resource tqmx_watchdog_resources[] = {
> @@ -262,6 +270,14 @@ static int tqmx86_probe(struct platform_device *pdev)
>  	ocores_platform_data.clock_khz = tqmx86_board_id_to_clk_rate(dev, board_id);
>  
>  	if (i2c_det == TQMX86_REG_I2C_DETECT_SOFT) {
> +		if (i2c_irq) {
> +			err = tqmx86_setup_irq(dev, "I2C", i2c_irq, io_base,
> +					       TQMX86_REG_IO_EXT_INT_I2C_SHIFT);
> +			if (!err)
> +				/* Assumes the IRQ resource placeholder is first */
> +				tqmx_i2c_soft_resources[TQMX86_IRQ_I2C] = DEFINE_RES_IRQ(i2c_irq);
> +		}
> +
>  		err = devm_mfd_add_devices(dev, PLATFORM_DEVID_NONE,
>  					   tqmx86_i2c_soft_dev,
>  					   ARRAY_SIZE(tqmx86_i2c_soft_dev),

-- 
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany
Amtsgericht München, HRB 105018
Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
https://www.tq-group.com/

      reply	other threads:[~2024-10-21 14:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-21 11:34 [PATCH v5 0/5] mfd: tqmx86: new hardware and GPIO/I2C IRQ improvements/additions Matthias Schiffer
2024-10-21 11:34 ` [PATCH v5 1/5] mfd: tqmx86: add board definitions for TQMx120UC, TQMx130UC and TQMxE41S Matthias Schiffer
2024-10-21 11:34 ` [PATCH v5 2/5] mfd: tqmx86: improve gpio_irq module parameter description Matthias Schiffer
2024-10-21 11:34 ` [PATCH v5 3/5] mfd: tqmx86: refactor GPIO IRQ setup Matthias Schiffer
2024-10-21 11:34 ` [PATCH v5 4/5] mfd: tqmx86: make IRQ setup errors non-fatal Matthias Schiffer
2024-10-21 11:34 ` [PATCH v5 5/5] mfd: tqmx86: add I2C IRQ support Matthias Schiffer
2024-10-21 14:44   ` Matthias Schiffer [this message]

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=da174fe9af56d5c0f77ee140456c9d07cc968136.camel@ew.tq-group.com \
    --to=matthias.schiffer@ew.tq-group.com \
    --cc=gregor.herburger@tq-group.com \
    --cc=lee@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@ew.tq-group.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

all inboxes | Powered by JetHome®