Linux-RTC Archive on lore.kernel.org
 help / color / Atom feed
From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: Andreas Kemnade <andreas@kemnade.info>
Cc: lee.jones@linaro.org, a.zummo@towertech.it,
	linux-kernel@vger.kernel.org, linux-rtc@vger.kernel.org,
	phh@phh.me, b.galvani@gmail.com, stefan@agner.ch,
	letux-kernel@openphoenux.org
Subject: Re: [PATCH 2/5] mfd: rn5t618: add irq support
Date: Mon, 21 Oct 2019 11:07:10 +0200
Message-ID: <20191021090710.GT3125@piout.net> (raw)
In-Reply-To: <20191021054104.26155-3-andreas@kemnade.info>

Hi,

On 21/10/2019 07:41:01+0200, Andreas Kemnade wrote:
> +#if 0
> +/*
> + * REVISIT when implementing charger:
> + * according to some other implementation it needs special treatment,
> + * inverted but experiments seem not to confirm that.
> + */
> +	[RN5T618_IRQ_CHG] = {
> +		.reg_offset = 0,
> +		.mask = (1 << 6),
> +	}
> +#endif

Please avoid submitting dead code.

> +};
> +
> +static const struct regmap_irq_chip rc5t619_irq_chip = {
> +	.name = "rc5t619",
> +	.irqs = rc5t619_irqs,
> +	.num_irqs = ARRAY_SIZE(rc5t619_irqs),
> +	.num_regs = 1,
> +	.status_base = RN5T618_INTMON,
> +	.mask_base = RN5T618_INTEN,
> +	.mask_invert = true,
> +};
> +
> +int rn5t618_irq_init(struct rn5t618 *rn5t618)
> +{
> +	const struct regmap_irq_chip *irq_chip;
> +	int ret;
> +
> +	if (!rn5t618->chip_irq)
> +		return 0;
> +
> +	switch (rn5t618->variant) {
> +	case RC5T619:
> +		irq_chip = &rc5t619_irq_chip;
> +		break;
> +
> +		/* TODO: check irq definitions for other variants */
> +
> +	default:
> +		irq_chip = NULL;
> +		break;
> +	}
> +
> +	if (!irq_chip) {
> +		dev_err(rn5t618->dev, "no IRQ definition known for variant\n");
> +		return -ENOENT;
> +	}
> +
> +	ret = devm_regmap_add_irq_chip(rn5t618->dev, rn5t618->regmap,
> +				rn5t618->chip_irq,
> +				IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
> +				0, irq_chip, &rn5t618->irq_data);
> +	if (ret != 0) {
> +		dev_err(rn5t618->dev, "Failed to register IRQ chip\n");
> +		return ret;
> +	}
> +
> +	return 0;
> +}
> diff --git a/include/linux/mfd/rn5t618.h b/include/linux/mfd/rn5t618.h
> index d62ef48060b5..4d680f34ad2f 100644
> --- a/include/linux/mfd/rn5t618.h
> +++ b/include/linux/mfd/rn5t618.h
> @@ -242,9 +242,27 @@ enum {
>  	RC5T619,
>  };
>  
> +
> +/* RN5T618 IRQ definitions */
> +enum {
> +	RN5T618_IRQ_SYS,
> +	RN5T618_IRQ_DCDC,
> +	RN5T618_IRQ_RTC,
> +	RN5T618_IRQ_ADC,
> +	RN5T618_IRQ_GPIO,
> +	RN5T618_IRQ_CHG,
> +	RN5T618_NR_IRQS,
> +};
> +
> +

Spurious blank line.

>  struct rn5t618 {
>  	struct regmap *regmap;
> +	struct device *dev;
>  	long variant;
> +
> +	int chip_irq;
> +	struct regmap_irq_chip_data *irq_data;
>  };
>  
> +extern int rn5t618_irq_init(struct rn5t618 *rn5t618);
>  #endif /* __LINUX_MFD_RN5T618_H */
> -- 
> 2.11.0
> 

-- 
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

  reply index

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-21  5:40 [PATCH 0/5] Add rtc support for rn5t618 mfd Andreas Kemnade
2019-10-21  5:41 ` [PATCH 1/5] mfd: rn5t618: prepare for irq handling Andreas Kemnade
2019-10-21  5:41 ` [PATCH 2/5] mfd: rn5t618: add irq support Andreas Kemnade
2019-10-21  9:07   ` Alexandre Belloni [this message]
2019-10-21 15:06     ` Andreas Kemnade
2019-10-21  5:41 ` [PATCH 3/5] mfd: rn5t618: add rtc related registers Andreas Kemnade
2019-10-21  5:41 ` [PATCH 4/5] mfd: rn5t618: add more subdevices Andreas Kemnade
2019-10-21  5:41 ` [PATCH 5/5] rtc: rtc-rc5t583: add ricoh rc5t619 RTC driver Andreas Kemnade
2019-10-21 10:15   ` Alexandre Belloni
2019-10-21 10:31     ` [Letux-kernel] " H. Nikolaus Schaller
2019-10-21 15:09       ` Alexandre Belloni
2019-10-21 21:13     ` Andreas Kemnade
2019-10-23 23:17       ` Alexandre Belloni
2019-10-24 20:25         ` Andreas Kemnade
2019-10-24 22:06           ` Alexandre Belloni
2019-10-29  6:46         ` Andreas Kemnade
2019-10-21 13:19   ` Stefan Agner
2019-10-21 13:50     ` Alexandre Belloni
2019-10-21 15:20       ` Andreas Kemnade

Reply instructions:

You may reply publically 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=20191021090710.GT3125@piout.net \
    --to=alexandre.belloni@bootlin.com \
    --cc=a.zummo@towertech.it \
    --cc=andreas@kemnade.info \
    --cc=b.galvani@gmail.com \
    --cc=lee.jones@linaro.org \
    --cc=letux-kernel@openphoenux.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=phh@phh.me \
    --cc=stefan@agner.ch \
    /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

Linux-RTC Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-rtc/0 linux-rtc/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-rtc linux-rtc/ https://lore.kernel.org/linux-rtc \
		linux-rtc@vger.kernel.org
	public-inbox-index linux-rtc

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-rtc


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git