linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Richard Fitzgerald <rf@opensource.cirrus.com>
Cc: jason@lakedaemon.net, marc.zyngier@arm.com, lee.jones@linaro.org,
	patches@opensource.cirrus.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v10 2/2] irqchip: Add driver for Cirrus Logic Madera codecs
Date: Thu, 30 Aug 2018 12:31:04 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.21.1808301154040.1210@nanos.tec.linutronix.de> (raw)
In-Reply-To: <20180828130934.18135-2-rf@opensource.cirrus.com>

On Tue, 28 Aug 2018, Richard Fitzgerald wrote:
> @@ -0,0 +1,244 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Interrupt support for Cirrus Logic Madera codecs
> + *
> + * Copyright (C) 2015-2018 Cirrus Logic
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by the
> + * Free Software Foundation; version 2.

You have the SPDX identifier above, which makes this boilerplate
superfluous. 

> +#ifdef CONFIG_PM_SLEEP
> +static int madera_suspend_noirq(struct device *dev)
> +{
> +	struct madera *madera = dev_get_drvdata(dev->parent);
> +
> +	dev_dbg(madera->irq_dev, "No IRQ suspend, reenabling IRQ\n");
> +
> +	enable_irq(madera->irq);
> +
> +	return 0;
> +}
> +
> +static int madera_suspend(struct device *dev)
> +{
> +	struct madera *madera = dev_get_drvdata(dev->parent);
> +
> +	dev_dbg(madera->irq_dev, "Suspend, disabling IRQ\n");
> +
> +	disable_irq(madera->irq);
> +
> +	return 0;
> +}

This really wants a comment why you are disabling it first and reenabling
it afterwards. I have no idea why you are doing this and it doesn't make
much sense from the S/R perspective either.

> +	/*
> +	 * Read the flags from the interrupt controller if not specified
> +	 * by pdata
> +	 */
> +	irq_flags = madera->pdata.irq_flags;
> +	if (!irq_flags) {
> +		irq_data = irq_get_irq_data(madera->irq);
> +		if (!irq_data) {
> +			dev_err(&pdev->dev, "Invalid IRQ: %d\n", madera->irq);
> +			return -EINVAL;
> +		}
> +
> +		irq_flags = irqd_get_trigger_type(irq_data);
> +
> +		/* Codec defaults to trigger low, use this if no flags given */
> +		if (irq_flags == IRQ_TYPE_NONE)
> +			irq_flags = IRQF_TRIGGER_LOW;
> +	}
> +
> +	if (irq_flags & (IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING)) {
> +		dev_err(&pdev->dev, "Host interrupt not level-triggered\n");
> +		return -EINVAL;
> +	}
> +
> +	if (irq_flags & IRQF_TRIGGER_HIGH) {
> +		ret = regmap_update_bits(madera->regmap, MADERA_IRQ1_CTRL,
> +					 MADERA_IRQ_POL_MASK, 0);
> +		if (ret) {
> +			dev_err(&pdev->dev,
> +				"Failed to set IRQ polarity: %d\n", ret);
> +			return ret;
> +		}
> +	}

This looks wrong. Why are you only updating the polarity for trigger HIGH?

> diff --git a/include/linux/irqchip/irq-madera.h b/include/linux/irqchip/irq-madera.h
> new file mode 100644
> index 000000000000..5aeb7e6adc82
> --- /dev/null
> +++ b/include/linux/irqchip/irq-madera.h
> @@ -0,0 +1,135 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +/*
> + * Interrupt support for Cirrus Logic Madera codecs
> + *
> + * Copyright 2016-2018 Cirrus Logic
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by the
> + * Free Software Foundation; version 2.

See above.

Thanks,

	tglx

  reply	other threads:[~2018-08-30 10:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-28 13:09 [PATCH v10 1/2] mfd: madera: Add irqchip data pointer into struct madera Richard Fitzgerald
2018-08-28 13:09 ` [PATCH v10 2/2] irqchip: Add driver for Cirrus Logic Madera codecs Richard Fitzgerald
2018-08-30 10:31   ` Thomas Gleixner [this message]
2018-08-30 11:44     ` Richard Fitzgerald
2018-08-30 11:51       ` Thomas Gleixner
2018-09-10 11:33         ` Lee Jones
2018-09-10 12:08           ` Richard Fitzgerald
2018-09-10 12:17             ` Richard Fitzgerald

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=alpine.DEB.2.21.1808301154040.1210@nanos.tec.linutronix.de \
    --to=tglx@linutronix.de \
    --cc=jason@lakedaemon.net \
    --cc=lee.jones@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marc.zyngier@arm.com \
    --cc=patches@opensource.cirrus.com \
    --cc=rf@opensource.cirrus.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).