All of lore.kernel.org
 help / color / mirror / Atom feed
From: Linus Walleij <linus.walleij@stericsson.com>
To: Nishanth Menon <nm@ti.com>
Cc: Kevin Hilman <khilman@deeprootsystems.com>,
	"linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH 1/4] OMAP: introduce OPP layer for device-specific OPPs
Date: Thu, 16 Sep 2010 15:24:42 +0200	[thread overview]
Message-ID: <4C921A9A.7070505@stericsson.com> (raw)
In-Reply-To: <4C92104A.5040901@ti.com>

Nishanth Menon wrote:
> Linus Walleij had written, on 09/16/2010 07:19 AM, the following:
>> 2010/9/15 Kevin Hilman <khilman@deeprootsystems.com>:
>>
>>> OMAP SOCs have a standard set of tuples consisting of frequency and
>>> voltage pairs that the device will support per voltage domain.  These
>>> are called Operating Performance Points or OPPs.
>>> (...)
>>> This introduces a common handling OPP mechanism accross all OMAPs.
>>> As a start this is used for OMAP3.
>> OPPs are a generic concept, it's in silicon construction textbooks and all.
>> Should this code not be made generic instead? You wouldn't make
>> regulators or even DMA platform-specific these days, so why should
>> OPPs be?
> As far as I see this patch :
> hwmod[1] which is omap specific which inturn depends on omap_device. - 
> this impacts opp_add function in the opp layer.

Then wrap your local OPP in some clever way:

struct omap_opp {
    struct hwmod foo;
    struct opp opp;
};

container_of() is your friend.

Alternatively and not as elegant is to provide an
void *private_data; in the generic opp struct.

And similar design patterns for code and other
platform-specific hooks. Overridable struct opp_ops
for example, the same way we just abstracted the
l2x0 operations for example.

It's not like there are no precedents in the linux kernel
on how to handle a superclass of some struct, so 
how hard can it be?

The fact that a single struct member is OMAP-specific doesn't
nix the fact that the major part of this OPP framework
is generic code.

Yours,
Linus Walleij

WARNING: multiple messages have this Message-ID (diff)
From: linus.walleij@stericsson.com (Linus Walleij)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/4] OMAP: introduce OPP layer for device-specific OPPs
Date: Thu, 16 Sep 2010 15:24:42 +0200	[thread overview]
Message-ID: <4C921A9A.7070505@stericsson.com> (raw)
In-Reply-To: <4C92104A.5040901@ti.com>

Nishanth Menon wrote:
> Linus Walleij had written, on 09/16/2010 07:19 AM, the following:
>> 2010/9/15 Kevin Hilman <khilman@deeprootsystems.com>:
>>
>>> OMAP SOCs have a standard set of tuples consisting of frequency and
>>> voltage pairs that the device will support per voltage domain.  These
>>> are called Operating Performance Points or OPPs.
>>> (...)
>>> This introduces a common handling OPP mechanism accross all OMAPs.
>>> As a start this is used for OMAP3.
>> OPPs are a generic concept, it's in silicon construction textbooks and all.
>> Should this code not be made generic instead? You wouldn't make
>> regulators or even DMA platform-specific these days, so why should
>> OPPs be?
> As far as I see this patch :
> hwmod[1] which is omap specific which inturn depends on omap_device. - 
> this impacts opp_add function in the opp layer.

Then wrap your local OPP in some clever way:

struct omap_opp {
    struct hwmod foo;
    struct opp opp;
};

container_of() is your friend.

Alternatively and not as elegant is to provide an
void *private_data; in the generic opp struct.

And similar design patterns for code and other
platform-specific hooks. Overridable struct opp_ops
for example, the same way we just abstracted the
l2x0 operations for example.

It's not like there are no precedents in the linux kernel
on how to handle a superclass of some struct, so 
how hard can it be?

The fact that a single struct member is OMAP-specific doesn't
nix the fact that the major part of this OPP framework
is generic code.

Yours,
Linus Walleij

  reply	other threads:[~2010-09-16 13:25 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-15 21:56 [PATCH 0/4] OMAP OPP layer for 2.6.37 Kevin Hilman
2010-09-15 21:56 ` Kevin Hilman
2010-09-15 21:56 ` [PATCH 1/4] OMAP: introduce OPP layer for device-specific OPPs Kevin Hilman
2010-09-15 21:56   ` Kevin Hilman
2010-09-16 10:25   ` Gopinath, Thara
2010-09-16 10:25     ` Gopinath, Thara
2010-09-16 10:32     ` Menon, Nishanth
2010-09-16 10:32       ` Menon, Nishanth
2010-09-16 10:33       ` Gopinath, Thara
2010-09-16 10:33         ` Gopinath, Thara
2010-09-16 12:19   ` Linus Walleij
2010-09-16 12:19     ` Linus Walleij
2010-09-16 12:40     ` Nishanth Menon
2010-09-16 12:40       ` Nishanth Menon
2010-09-16 13:24       ` Linus Walleij [this message]
2010-09-16 13:24         ` Linus Walleij
2010-09-16 15:08     ` Kevin Hilman
2010-09-16 15:08       ` Kevin Hilman
2010-09-16 15:31       ` Nishanth Menon
2010-09-16 15:31         ` Nishanth Menon
2010-09-16 15:48         ` Kevin Hilman
2010-09-16 15:48           ` Kevin Hilman
2010-09-16 17:07           ` Linus Walleij
2010-09-16 17:07             ` Linus Walleij
2010-09-16 17:10             ` Nishanth Menon
2010-09-16 17:10               ` Nishanth Menon
2010-09-16 17:13               ` Shilimkar, Santosh
2010-09-16 17:13                 ` Shilimkar, Santosh
2010-09-16 18:01                 ` Kevin Hilman
2010-09-16 18:01                   ` Kevin Hilman
2010-09-16 13:54   ` Roger Quadros
2010-09-16 13:54     ` Roger Quadros
2010-09-16 14:01     ` Nishanth Menon
2010-09-16 14:01       ` Nishanth Menon
2010-09-16 14:20       ` Roger Quadros
2010-09-16 14:20         ` Roger Quadros
2010-09-16 14:43         ` Nishanth Menon
2010-09-16 14:43           ` Nishanth Menon
2010-09-15 21:56 ` [PATCH 2/4] OMAP: OPP: twl/tps: Introduce TWL/TPS-specific code Kevin Hilman
2010-09-15 21:56   ` Kevin Hilman
2010-09-16 10:40   ` Gopinath, Thara
2010-09-16 10:40     ` Gopinath, Thara
2010-09-16 12:15     ` Nishanth Menon
2010-09-16 12:15       ` Nishanth Menon
2010-09-16 13:51       ` Gopinath, Thara
2010-09-16 13:51         ` Gopinath, Thara
2010-09-16 14:06         ` Nishanth Menon
2010-09-16 14:06           ` Nishanth Menon
2010-09-17 14:57           ` Gopinath, Thara
2010-09-17 14:57             ` Gopinath, Thara
2010-09-17 15:03             ` Nishanth Menon
2010-09-17 15:03               ` Nishanth Menon
2010-09-16 17:16     ` Kevin Hilman
2010-09-16 17:16       ` Kevin Hilman
2010-09-17 15:11       ` Gopinath, Thara
2010-09-17 15:11         ` Gopinath, Thara
2010-09-15 21:56 ` [PATCH 3/4] OMAP3: remove OPP interfaces from OMAP PM layer Kevin Hilman
2010-09-15 21:56   ` Kevin Hilman
2010-09-15 21:56 ` [PATCH 4/4] OMAP3: OPP: add OPP table data and initialization Kevin Hilman
2010-09-15 21:56   ` Kevin Hilman
  -- strict thread matches above, loose matches on Subject: below --
2010-08-11  0:09 [PATCH 0/4] OMAP OPP layer Kevin Hilman
2010-08-11  0:09 ` [PATCH 1/4] OMAP: introduce OPP layer for device-specific OPPs Kevin Hilman
2010-08-11  0:07 [PATCH 0/4] OMAP OPP layer Kevin Hilman
2010-08-11  0:07 ` [PATCH 1/4] OMAP: introduce OPP layer for device-specific OPPs 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=4C921A9A.7070505@stericsson.com \
    --to=linus.walleij@stericsson.com \
    --cc=khilman@deeprootsystems.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=nm@ti.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.