From: Kevin Hilman <khilman@ti.com>
To: Nishanth Menon <nm@ti.com>
Cc: linux-omap <linux-omap@vger.kernel.org>,
linux-arm <linux-arm-kernel@lists.infradead.org>,
Tony <tony@atomide.com>, Paul <paul@pwsan.com>
Subject: Re: [PATCH V3 15/19] OMAP3+: SR: introduce notifier_control
Date: Thu, 17 Mar 2011 10:35:13 -0700 [thread overview]
Message-ID: <878vwd7ir2.fsf@ti.com> (raw)
In-Reply-To: <1299338962-5602-16-git-send-email-nm@ti.com> (Nishanth Menon's message of "Sat, 5 Mar 2011 20:59:18 +0530")
Nishanth Menon <nm@ti.com> writes:
> We need some mechanism from class drivers to control when notifiers
> should be triggered and when not, currently we have none, which makes
> Class driver usage of the interrupt events almost impossible.
>
> Introduce an SmartReflex driver API for doing the same. This is useful
> for SmartReflex AVS class 1.5 or 2 drivers.
>
> Signed-off-by: Nishanth Menon <nm@ti.com>
> ---
> arch/arm/mach-omap2/smartreflex.c | 57 +++++++++++++++++++++++++++++++++++++
> arch/arm/mach-omap2/smartreflex.h | 8 +++++
> 2 files changed, 65 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/smartreflex.c b/arch/arm/mach-omap2/smartreflex.c
> index 21944e2..f6e44a1 100644
> --- a/arch/arm/mach-omap2/smartreflex.c
> +++ b/arch/arm/mach-omap2/smartreflex.c
> @@ -712,6 +712,63 @@ void sr_disable(struct voltagedomain *voltdm)
> }
>
> /**
> + * sr_notifier_control() - control the notifier mechanism
> + * @voltdm: VDD pointer to which the SR module to be configured belongs to.
> + * @enable: true to enable notifiers and false to disable the same
> + *
> + * SR modules allow an MCU interrupt mechanism that vary based on the IP
> + * revision, we allow the system to generate interrupt if the class driver
> + * has capability to handle the same. it is upto the class driver to ensure
> + * the proper sequencing and handling for a clean implementation. returns
> + * 0 if all goes fine, else returns failure results
> + */
> +int sr_notifier_control(struct voltagedomain *voltdm, bool enable)
> +{
> + struct omap_sr *sr = _sr_lookup(voltdm);
> + u32 value = 0;
insert blank line
> + if (IS_ERR_OR_NULL(sr)) {
checking for NULL should suffice
> + pr_warning("%s: sr corresponding to domain not found\n",
> + __func__);
> + return -EINVAL;
> + }
> + if (!sr->autocomp_active)
> + return -EINVAL;
> +
> + /* if I could never register an isr, why bother?? */
s/isr/ISR/
> + if (!(sr_class && sr_class->notify && sr_class->notify_flags &&
> + sr->irq)) {
> + dev_warn(&sr->pdev->dev,
> + "%s: unable to setup irq without handling mechanism\n",
> + __func__);
s/irq/IRQ/
> + return -EINVAL;
> + }
> +
> + switch (sr->ip_type) {
> + case SR_TYPE_V1:
> + value = notifier_to_irqen_v1(sr_class->notify_flags);
> + sr_modify_reg(sr, ERRCONFIG_V1, value,
> + (enable) ? value : 0);
> + break;
> + case SR_TYPE_V2:
> + value = notifier_to_irqen_v2(sr_class->notify_flags);
> + sr_write_reg(sr, (enable) ? IRQENABLE_SET : IRQENABLE_CLR,
> + value);
> + break;
> + default:
> + dev_warn(&sr->pdev->dev, "%s: unknown type of sr??\n",
> + __func__);
> + return -EINVAL;
> + }
> +
> + if (enable)
> + enable_irq(sr->irq);
> + else
> + disable_irq_nosync(sr->irq);
> +
> + return 0;
> +}
I'm not all that familiar with the SR IRQs, but why do you need to
disable them at the IP an at the INTC? It seems like one of the two
should suffice, and it seems like the INTC would be the most efficient.
Kevin
> +/**
> * sr_register_class() - API to register a smartreflex class parameters.
> * @class_data: The structure containing various sr class specific data.
> *
> diff --git a/arch/arm/mach-omap2/smartreflex.h b/arch/arm/mach-omap2/smartreflex.h
> index 2976bf6..4a1ada4 100644
> --- a/arch/arm/mach-omap2/smartreflex.h
> +++ b/arch/arm/mach-omap2/smartreflex.h
> @@ -242,6 +242,7 @@ void omap_sr_register_pmic(struct omap_sr_pmic_data *pmic_data);
> /* Smartreflex driver hooks to be called from Smartreflex class driver */
> int sr_enable(struct voltagedomain *voltdm, unsigned long volt);
> void sr_disable(struct voltagedomain *voltdm);
> +int sr_notifier_control(struct voltagedomain *voltdm, bool enable);
> int sr_configure_errgen(struct voltagedomain *voltdm);
> int sr_configure_minmax(struct voltagedomain *voltdm);
>
> @@ -250,6 +251,13 @@ int sr_register_class(struct omap_sr_class_data *class_data);
> #else
> static inline void omap_sr_enable(struct voltagedomain *voltdm) {}
> static inline void omap_sr_disable(struct voltagedomain *voltdm) {}
> +
> +static inline int sr_notifier_control(struct voltagedomain *voltdm,
> + bool enable)
> +{
> + return -EINVAL;
> +}
> +
> static inline void omap_sr_disable_reset_volt(
> struct voltagedomain *voltdm) {}
> static inline void omap_sr_register_pmic(
WARNING: multiple messages have this Message-ID (diff)
From: khilman@ti.com (Kevin Hilman)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH V3 15/19] OMAP3+: SR: introduce notifier_control
Date: Thu, 17 Mar 2011 10:35:13 -0700 [thread overview]
Message-ID: <878vwd7ir2.fsf@ti.com> (raw)
In-Reply-To: <1299338962-5602-16-git-send-email-nm@ti.com> (Nishanth Menon's message of "Sat, 5 Mar 2011 20:59:18 +0530")
Nishanth Menon <nm@ti.com> writes:
> We need some mechanism from class drivers to control when notifiers
> should be triggered and when not, currently we have none, which makes
> Class driver usage of the interrupt events almost impossible.
>
> Introduce an SmartReflex driver API for doing the same. This is useful
> for SmartReflex AVS class 1.5 or 2 drivers.
>
> Signed-off-by: Nishanth Menon <nm@ti.com>
> ---
> arch/arm/mach-omap2/smartreflex.c | 57 +++++++++++++++++++++++++++++++++++++
> arch/arm/mach-omap2/smartreflex.h | 8 +++++
> 2 files changed, 65 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/smartreflex.c b/arch/arm/mach-omap2/smartreflex.c
> index 21944e2..f6e44a1 100644
> --- a/arch/arm/mach-omap2/smartreflex.c
> +++ b/arch/arm/mach-omap2/smartreflex.c
> @@ -712,6 +712,63 @@ void sr_disable(struct voltagedomain *voltdm)
> }
>
> /**
> + * sr_notifier_control() - control the notifier mechanism
> + * @voltdm: VDD pointer to which the SR module to be configured belongs to.
> + * @enable: true to enable notifiers and false to disable the same
> + *
> + * SR modules allow an MCU interrupt mechanism that vary based on the IP
> + * revision, we allow the system to generate interrupt if the class driver
> + * has capability to handle the same. it is upto the class driver to ensure
> + * the proper sequencing and handling for a clean implementation. returns
> + * 0 if all goes fine, else returns failure results
> + */
> +int sr_notifier_control(struct voltagedomain *voltdm, bool enable)
> +{
> + struct omap_sr *sr = _sr_lookup(voltdm);
> + u32 value = 0;
insert blank line
> + if (IS_ERR_OR_NULL(sr)) {
checking for NULL should suffice
> + pr_warning("%s: sr corresponding to domain not found\n",
> + __func__);
> + return -EINVAL;
> + }
> + if (!sr->autocomp_active)
> + return -EINVAL;
> +
> + /* if I could never register an isr, why bother?? */
s/isr/ISR/
> + if (!(sr_class && sr_class->notify && sr_class->notify_flags &&
> + sr->irq)) {
> + dev_warn(&sr->pdev->dev,
> + "%s: unable to setup irq without handling mechanism\n",
> + __func__);
s/irq/IRQ/
> + return -EINVAL;
> + }
> +
> + switch (sr->ip_type) {
> + case SR_TYPE_V1:
> + value = notifier_to_irqen_v1(sr_class->notify_flags);
> + sr_modify_reg(sr, ERRCONFIG_V1, value,
> + (enable) ? value : 0);
> + break;
> + case SR_TYPE_V2:
> + value = notifier_to_irqen_v2(sr_class->notify_flags);
> + sr_write_reg(sr, (enable) ? IRQENABLE_SET : IRQENABLE_CLR,
> + value);
> + break;
> + default:
> + dev_warn(&sr->pdev->dev, "%s: unknown type of sr??\n",
> + __func__);
> + return -EINVAL;
> + }
> +
> + if (enable)
> + enable_irq(sr->irq);
> + else
> + disable_irq_nosync(sr->irq);
> +
> + return 0;
> +}
I'm not all that familiar with the SR IRQs, but why do you need to
disable them at the IP an at the INTC? It seems like one of the two
should suffice, and it seems like the INTC would be the most efficient.
Kevin
> +/**
> * sr_register_class() - API to register a smartreflex class parameters.
> * @class_data: The structure containing various sr class specific data.
> *
> diff --git a/arch/arm/mach-omap2/smartreflex.h b/arch/arm/mach-omap2/smartreflex.h
> index 2976bf6..4a1ada4 100644
> --- a/arch/arm/mach-omap2/smartreflex.h
> +++ b/arch/arm/mach-omap2/smartreflex.h
> @@ -242,6 +242,7 @@ void omap_sr_register_pmic(struct omap_sr_pmic_data *pmic_data);
> /* Smartreflex driver hooks to be called from Smartreflex class driver */
> int sr_enable(struct voltagedomain *voltdm, unsigned long volt);
> void sr_disable(struct voltagedomain *voltdm);
> +int sr_notifier_control(struct voltagedomain *voltdm, bool enable);
> int sr_configure_errgen(struct voltagedomain *voltdm);
> int sr_configure_minmax(struct voltagedomain *voltdm);
>
> @@ -250,6 +251,13 @@ int sr_register_class(struct omap_sr_class_data *class_data);
> #else
> static inline void omap_sr_enable(struct voltagedomain *voltdm) {}
> static inline void omap_sr_disable(struct voltagedomain *voltdm) {}
> +
> +static inline int sr_notifier_control(struct voltagedomain *voltdm,
> + bool enable)
> +{
> + return -EINVAL;
> +}
> +
> static inline void omap_sr_disable_reset_volt(
> struct voltagedomain *voltdm) {}
> static inline void omap_sr_register_pmic(
next prev parent reply other threads:[~2011-03-17 17:35 UTC|newest]
Thread overview: 106+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-05 15:29 [PATCH V3 00/19] OMAP3+: PM: introduce SR class 1.5 Nishanth Menon
2011-03-05 15:29 ` Nishanth Menon
2011-03-05 15:29 ` [PATCH V3 01/19] OMAP3: hwmod: add SmartReflex IRQs Nishanth Menon
2011-03-05 15:29 ` Nishanth Menon
2011-03-17 14:41 ` Kevin Hilman
2011-03-17 14:41 ` Kevin Hilman
2011-07-26 13:11 ` Felipe Balbi
2011-07-26 13:11 ` Felipe Balbi
2011-03-05 15:29 ` [PATCH V3 02/19] OMAP3+: voltage: fix build warning Nishanth Menon
2011-03-05 15:29 ` Nishanth Menon
2011-03-17 14:49 ` Kevin Hilman
2011-03-17 14:49 ` Kevin Hilman
2011-07-26 13:12 ` Felipe Balbi
2011-07-26 13:12 ` Felipe Balbi
2011-03-05 15:29 ` [PATCH V3 03/19] OMAP3+: voltage: remove initial voltage Nishanth Menon
2011-03-05 15:29 ` Nishanth Menon
2011-03-06 13:37 ` Sergei Shtylyov
2011-03-06 13:37 ` Sergei Shtylyov
2011-03-07 2:52 ` Nishanth Menon
2011-03-07 2:52 ` Nishanth Menon
2011-03-07 16:23 ` Sergei Shtylyov
2011-03-07 16:23 ` Sergei Shtylyov
2011-03-08 1:52 ` Nishanth Menon
2011-03-08 1:52 ` Nishanth Menon
2011-07-26 13:17 ` Felipe Balbi
2011-07-26 13:17 ` Felipe Balbi
2011-03-17 14:53 ` Kevin Hilman
2011-03-17 14:53 ` Kevin Hilman
2011-03-05 15:29 ` [PATCH V3 04/19] OMAP3+: voltage: remove spurious pr_notice for debugfs Nishanth Menon
2011-03-05 15:29 ` Nishanth Menon
2011-03-17 14:55 ` Kevin Hilman
2011-03-17 14:55 ` Kevin Hilman
2011-07-26 13:18 ` Felipe Balbi
2011-07-26 13:18 ` Felipe Balbi
2011-03-05 15:29 ` [PATCH V3 05/19] OMAP3+: voltage: use IS_ERR_OR_NULL Nishanth Menon
2011-03-05 15:29 ` Nishanth Menon
2011-03-05 17:36 ` David Cohen
2011-03-05 17:36 ` David Cohen
2011-03-06 2:45 ` Nishanth Menon
2011-03-06 2:45 ` Nishanth Menon
2011-03-06 8:18 ` Russell King - ARM Linux
2011-03-06 8:18 ` Russell King - ARM Linux
2011-03-07 2:56 ` Nishanth Menon
2011-03-07 2:56 ` Nishanth Menon
2011-07-26 13:19 ` Felipe Balbi
2011-07-26 13:19 ` Felipe Balbi
2011-03-05 15:29 ` [PATCH V3 06/19] OMAP3+: voltage: use volt_data pointer instead values Nishanth Menon
2011-03-05 15:29 ` Nishanth Menon
2011-03-17 17:09 ` Kevin Hilman
2011-03-17 17:09 ` Kevin Hilman
2011-03-05 15:29 ` [PATCH V3 07/19] OMAP3+: voltage: add transdone APIs Nishanth Menon
2011-03-05 15:29 ` Nishanth Menon
2011-03-17 17:14 ` Kevin Hilman
2011-03-17 17:14 ` Kevin Hilman
2011-03-05 15:29 ` [PATCH V3 08/19] OMAP3+: SR: make notify independent of class Nishanth Menon
2011-03-05 15:29 ` Nishanth Menon
2011-03-17 17:18 ` Kevin Hilman
2011-03-17 17:18 ` Kevin Hilman
2011-03-05 15:29 ` [PATCH V3 09/19] OMAP3+: SR: disable interrupt by default Nishanth Menon
2011-03-05 15:29 ` Nishanth Menon
2011-03-17 17:19 ` Kevin Hilman
2011-03-17 17:19 ` Kevin Hilman
2011-03-05 15:29 ` [PATCH V3 10/19] OMAP3+: SR: enable/disable SR only on need Nishanth Menon
2011-03-05 15:29 ` Nishanth Menon
2011-03-17 17:20 ` Kevin Hilman
2011-03-17 17:20 ` Kevin Hilman
2011-03-05 15:29 ` [PATCH V3 11/19] OMAP3+: SR: fix cosmetic indentation Nishanth Menon
2011-03-05 15:29 ` Nishanth Menon
2011-03-17 17:21 ` Kevin Hilman
2011-03-17 17:21 ` Kevin Hilman
2011-03-17 17:43 ` Aaro Koskinen
2011-03-17 17:43 ` Aaro Koskinen
2011-03-17 20:02 ` Kevin Hilman
2011-03-17 20:02 ` Kevin Hilman
2011-03-05 15:29 ` [PATCH V3 12/19] OMAP3+: SR: introduce class start,stop and priv data Nishanth Menon
2011-03-05 15:29 ` [PATCH V3 12/19] OMAP3+: SR: introduce class start, stop " Nishanth Menon
2011-03-17 17:23 ` [PATCH V3 12/19] OMAP3+: SR: introduce class start,stop " Kevin Hilman
2011-03-17 17:23 ` [PATCH V3 12/19] OMAP3+: SR: introduce class start, stop " Kevin Hilman
2011-03-05 15:29 ` [PATCH V3 13/19] OMAP3+: SR: Reuse sr_[start|stop]_vddautocomp functions Nishanth Menon
2011-03-05 15:29 ` Nishanth Menon
2011-03-07 14:40 ` Jarkko Nikula
2011-03-07 14:40 ` Jarkko Nikula
2011-03-17 17:25 ` Kevin Hilman
2011-03-17 17:25 ` Kevin Hilman
2011-03-05 15:29 ` [PATCH V3 14/19] OMAP3+: SR: introduce notifiers flags Nishanth Menon
2011-03-05 15:29 ` Nishanth Menon
2011-03-17 17:28 ` Kevin Hilman
2011-03-17 17:28 ` Kevin Hilman
2011-03-05 15:29 ` [PATCH V3 15/19] OMAP3+: SR: introduce notifier_control Nishanth Menon
2011-03-05 15:29 ` Nishanth Menon
2011-03-17 17:35 ` Kevin Hilman [this message]
2011-03-17 17:35 ` Kevin Hilman
2011-03-05 15:29 ` [PATCH V3 16/19] OMAP3+: SR: disable spamming interrupts Nishanth Menon
2011-03-05 15:29 ` Nishanth Menon
2011-03-05 15:29 ` [PATCH V3 17/19] OMAP3+: SR: make enable path use volt_data pointer Nishanth Menon
2011-03-05 15:29 ` Nishanth Menon
2011-03-17 17:41 ` Kevin Hilman
2011-03-17 17:41 ` Kevin Hilman
2011-03-05 15:29 ` [PATCH V3 18/19] OMAP3630+: SR: add support for class 1.5 Nishanth Menon
2011-03-05 15:29 ` Nishanth Menon
2011-03-17 19:57 ` Kevin Hilman
2011-03-17 19:57 ` Kevin Hilman
2011-03-05 15:29 ` [PATCH V3 19/19] OMAP3430: SR: class3: restrict CPU to run on Nishanth Menon
2011-03-05 15:29 ` Nishanth Menon
2011-03-17 19:58 ` Kevin Hilman
2011-03-17 19:58 ` Kevin Hilman
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=878vwd7ir2.fsf@ti.com \
--to=khilman@ti.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-omap@vger.kernel.org \
--cc=nm@ti.com \
--cc=paul@pwsan.com \
--cc=tony@atomide.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.