All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Chen <hzpeterchen@gmail.com>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: Peter Chen <peter.chen@nxp.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Heiko Stuebner <heiko@sntech.de>,
	Stephen Boyd <stephen.boyd@linaro.org>,
	frank.li@nxp.com,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Gary Bisson <gary.bisson@boundarydevices.com>,
	Fabio Estevam <festevam@gmail.com>,
	Joshua Clayton <stillcompiling@gmail.com>,
	Arnd Bergmann <arnd@arndb.de>,
	Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>,
	Vaibhav Hiremath <vaibhav.hiremath@linaro.org>,
	Krzysztof Kozlowski <krzk@kernel.org>,
	mka@chromium.org, Alan Stern <stern@rowland.harvard.edu>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"Maciej S. Szmigiero" <mail@maciej.szmigiero.name>,
	Pawel Moll <pawel.moll@arm.com>,
	"linux-pm@vger.kernel.org" <linux-pm@vger.ker>
Subject: Re: [PATCH v15 2/7] power: add power sequence library
Date: Tue, 20 Jun 2017 10:37:46 +0800	[thread overview]
Message-ID: <20170620023746.GB23731@b29397-desktop> (raw)
In-Reply-To: <CAPDyKFo0d2FD1U-MgWTExz_cKC8BjB6QQFu1StTyPN1TGBG9eA@mail.gmail.com>

On Mon, Jun 19, 2017 at 11:48:05AM +0200, Ulf Hansson wrote:
> [...]
> 
> >> >
> >> > Unlike the MMC design, there is no dts entry to indicate whether this
> >> > device needs pwrseq or not at this design, it will only carry out power
> >> > on sequence after matching. So, return -EPROBE_DEFER may not work since
> >> > this device may never need pwrseq.
> >>
> >> Then, how will you really be able to fetch the correct pwrseq library
> >> instance for the device node?
> >>
> >> Suppose their is a *list* of pwrseq library instances available. In
> >> pwrseq_find_available_instance() you call of_match_node(table, np).
> >> The "table" there corresponds to the compatible for the pwrseq library
> >> and the np is the device node provided by the caller of
> >> of_pwrseq_on().
> >>
> >> Why is this match done?
> >
> > The compatible in table is from the source code, and the compatible in
> > np is from the dts. This is the current match way, I comment your
> > suggestion below.
> >
> >>
> >> Why can't the match be done before trying to fetch a library instance
> >
> > How? If there is no pwrseq instance, how can we do match?
> >
> >> and then in a second step, really try to fetch the instance? If only
> >> the second step fails, returning -EPROBE_DEFER can be done, no?
> >>
> >> BTW, I didn't compatible for the generic pwrseq library being
> >> documented in this series.
> 
> Seems like you need to update the DT documentation for the below
> compatible, which is used for the generic pwrseq library. Perhaps this
> is what puzzles me a bit on *why* the match is done.
> 
> +static const struct of_device_id generic_id_table[] = {
> +       { .compatible = "generic",},
> +       { /* sentinel */ }
> +};

Sorry, I should update this "generic" compatible at 1st binding-doc
patch.

> 
> [...]
> 
> >> >
> >> > This additional instance is used to store compatible information for
> >> > this pwrseq library, it is used for the next matching between device
> >> > and pwrseq library, it just likes we need the first pwrseq instance
> >> > registered at boot stage.
> >>
> >> Why can't the compatible information be a static table, known by the
> >> pwrseq core library?
> >>
> >> Then when of_pwrseq_on() is called, that static table is parsed and
> >> matched, then a corresponding pwrseq library instance tries to be
> >> fetched.
> >>
> >
> > So, you suggest allocating and registering pwrseq instance on the
> > demand? Eg, we maintain a power sequence static table, including
> > compatible and allocate function.
> 
> Yes, something like that.
> 
> >
> > static const struct pwrseq_match_table pwrseq_match_table_list[] = {
> >         { PWRSEQ_DEV(0x0204, 0x6025), .alloc_instance = pwrseq_AA_alloc_instance },
> >         { PWRSEQ_DEV(0x0204, 0x6026), .alloc_instance = pwrseq_BB_alloc_instance },
> >         { PWRSEQ_DEV(0xffff, 0xffff), .alloc_instance = pwrseq_generic_alloc_instance },
> 
> What does the  PWRSEQ_DEV() macro do?

In fact, this should be compatible string, I exampled it as USB vid,pid
wrongly.

> > Since the pwrseq_match_table_list is static, we can always do match, and
> > will not return -EPROBE_DEFER anymore, one problem for this is we need
> > always compile all pwrseq libraries. Any good suggestions?
> 
> You never returned -EPROBE_DEFER in the first case. That's why I complained. :-)
> 
> So, in case the OF match doesn't succeed, there are no reason to
> propagate an error, but instead just bail out and returning 0 to the
> caller.
> 
> If the OF match succeeds, it means the device requires a pwrseq
> library to be used. Then, pwrseq_XX_alloc_instance() will be called,
> on demand and which tries to fetch the resources (clocks, gpios etc).
> If any of those attempts fetching a resource fails, its corresponding
> error code should be propagated to the caller - including
> -EPROBE_DEFER.
> 
> Regarding the "always compile all pwrseq libraries"; no we don't need
> to do that. Instead we only need a to have a stub function for
> pwrseq_XX_alloc_instance, in case its corresponding Kconfig option is
> unset. That stub, should of course return an error code.
> 

I will have a updated version for your suggestion, thanks.

-- 

Best Regards,
Peter Chen

WARNING: multiple messages have this Message-ID (diff)
From: hzpeterchen@gmail.com (Peter Chen)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v15 2/7] power: add power sequence library
Date: Tue, 20 Jun 2017 10:37:46 +0800	[thread overview]
Message-ID: <20170620023746.GB23731@b29397-desktop> (raw)
In-Reply-To: <CAPDyKFo0d2FD1U-MgWTExz_cKC8BjB6QQFu1StTyPN1TGBG9eA@mail.gmail.com>

On Mon, Jun 19, 2017 at 11:48:05AM +0200, Ulf Hansson wrote:
> [...]
> 
> >> >
> >> > Unlike the MMC design, there is no dts entry to indicate whether this
> >> > device needs pwrseq or not at this design, it will only carry out power
> >> > on sequence after matching. So, return -EPROBE_DEFER may not work since
> >> > this device may never need pwrseq.
> >>
> >> Then, how will you really be able to fetch the correct pwrseq library
> >> instance for the device node?
> >>
> >> Suppose their is a *list* of pwrseq library instances available. In
> >> pwrseq_find_available_instance() you call of_match_node(table, np).
> >> The "table" there corresponds to the compatible for the pwrseq library
> >> and the np is the device node provided by the caller of
> >> of_pwrseq_on().
> >>
> >> Why is this match done?
> >
> > The compatible in table is from the source code, and the compatible in
> > np is from the dts. This is the current match way, I comment your
> > suggestion below.
> >
> >>
> >> Why can't the match be done before trying to fetch a library instance
> >
> > How? If there is no pwrseq instance, how can we do match?
> >
> >> and then in a second step, really try to fetch the instance? If only
> >> the second step fails, returning -EPROBE_DEFER can be done, no?
> >>
> >> BTW, I didn't compatible for the generic pwrseq library being
> >> documented in this series.
> 
> Seems like you need to update the DT documentation for the below
> compatible, which is used for the generic pwrseq library. Perhaps this
> is what puzzles me a bit on *why* the match is done.
> 
> +static const struct of_device_id generic_id_table[] = {
> +       { .compatible = "generic",},
> +       { /* sentinel */ }
> +};

Sorry, I should update this "generic" compatible at 1st binding-doc
patch.

> 
> [...]
> 
> >> >
> >> > This additional instance is used to store compatible information for
> >> > this pwrseq library, it is used for the next matching between device
> >> > and pwrseq library, it just likes we need the first pwrseq instance
> >> > registered at boot stage.
> >>
> >> Why can't the compatible information be a static table, known by the
> >> pwrseq core library?
> >>
> >> Then when of_pwrseq_on() is called, that static table is parsed and
> >> matched, then a corresponding pwrseq library instance tries to be
> >> fetched.
> >>
> >
> > So, you suggest allocating and registering pwrseq instance on the
> > demand? Eg, we maintain a power sequence static table, including
> > compatible and allocate function.
> 
> Yes, something like that.
> 
> >
> > static const struct pwrseq_match_table pwrseq_match_table_list[] = {
> >         { PWRSEQ_DEV(0x0204, 0x6025), .alloc_instance = pwrseq_AA_alloc_instance },
> >         { PWRSEQ_DEV(0x0204, 0x6026), .alloc_instance = pwrseq_BB_alloc_instance },
> >         { PWRSEQ_DEV(0xffff, 0xffff), .alloc_instance = pwrseq_generic_alloc_instance },
> 
> What does the  PWRSEQ_DEV() macro do?

In fact, this should be compatible string, I exampled it as USB vid,pid
wrongly.

> > Since the pwrseq_match_table_list is static, we can always do match, and
> > will not return -EPROBE_DEFER anymore, one problem for this is we need
> > always compile all pwrseq libraries. Any good suggestions?
> 
> You never returned -EPROBE_DEFER in the first case. That's why I complained. :-)
> 
> So, in case the OF match doesn't succeed, there are no reason to
> propagate an error, but instead just bail out and returning 0 to the
> caller.
> 
> If the OF match succeeds, it means the device requires a pwrseq
> library to be used. Then, pwrseq_XX_alloc_instance() will be called,
> on demand and which tries to fetch the resources (clocks, gpios etc).
> If any of those attempts fetching a resource fails, its corresponding
> error code should be propagated to the caller - including
> -EPROBE_DEFER.
> 
> Regarding the "always compile all pwrseq libraries"; no we don't need
> to do that. Instead we only need a to have a stub function for
> pwrseq_XX_alloc_instance, in case its corresponding Kconfig option is
> unset. That stub, should of course return an error code.
> 

I will have a updated version for your suggestion, thanks.

-- 

Best Regards,
Peter Chen

WARNING: multiple messages have this Message-ID (diff)
From: Peter Chen <hzpeterchen@gmail.com>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: Peter Chen <peter.chen@nxp.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Heiko Stuebner <heiko@sntech.de>,
	Stephen Boyd <stephen.boyd@linaro.org>, <frank.li@nxp.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Gary Bisson <gary.bisson@boundarydevices.com>,
	Fabio Estevam <festevam@gmail.com>,
	Joshua Clayton <stillcompiling@gmail.com>,
	Arnd Bergmann <arnd@arndb.de>,
	Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>,
	Vaibhav Hiremath <vaibhav.hiremath@linaro.org>,
	Krzysztof Kozlowski <krzk@kernel.org>, <mka@chromium.org>,
	Alan Stern <stern@rowland.harvard.edu>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"Maciej S. Szmigiero" <mail@maciej.szmigiero.name>,
	Pawel Moll <pawel.moll@arm.com>,
	"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	<troy.kisky@boundarydevices.com>,
	Rob Herring <robh+dt@kernel.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>, <hverkuil@xs4all.nl>,
	<oscar@naiandei.net>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Linux USB List <linux-usb@vger.kernel.org>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Sebastian Reichel <sre@kernel.org>,
	Mark Brown <broonie@kernel.org>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	Shawn Guo <shawnguo@kernel.org>, <jun.li@nxp.com>
Subject: Re: [PATCH v15 2/7] power: add power sequence library
Date: Tue, 20 Jun 2017 10:37:46 +0800	[thread overview]
Message-ID: <20170620023746.GB23731@b29397-desktop> (raw)
In-Reply-To: <CAPDyKFo0d2FD1U-MgWTExz_cKC8BjB6QQFu1StTyPN1TGBG9eA@mail.gmail.com>

On Mon, Jun 19, 2017 at 11:48:05AM +0200, Ulf Hansson wrote:
> [...]
> 
> >> >
> >> > Unlike the MMC design, there is no dts entry to indicate whether this
> >> > device needs pwrseq or not at this design, it will only carry out power
> >> > on sequence after matching. So, return -EPROBE_DEFER may not work since
> >> > this device may never need pwrseq.
> >>
> >> Then, how will you really be able to fetch the correct pwrseq library
> >> instance for the device node?
> >>
> >> Suppose their is a *list* of pwrseq library instances available. In
> >> pwrseq_find_available_instance() you call of_match_node(table, np).
> >> The "table" there corresponds to the compatible for the pwrseq library
> >> and the np is the device node provided by the caller of
> >> of_pwrseq_on().
> >>
> >> Why is this match done?
> >
> > The compatible in table is from the source code, and the compatible in
> > np is from the dts. This is the current match way, I comment your
> > suggestion below.
> >
> >>
> >> Why can't the match be done before trying to fetch a library instance
> >
> > How? If there is no pwrseq instance, how can we do match?
> >
> >> and then in a second step, really try to fetch the instance? If only
> >> the second step fails, returning -EPROBE_DEFER can be done, no?
> >>
> >> BTW, I didn't compatible for the generic pwrseq library being
> >> documented in this series.
> 
> Seems like you need to update the DT documentation for the below
> compatible, which is used for the generic pwrseq library. Perhaps this
> is what puzzles me a bit on *why* the match is done.
> 
> +static const struct of_device_id generic_id_table[] = {
> +       { .compatible = "generic",},
> +       { /* sentinel */ }
> +};

Sorry, I should update this "generic" compatible at 1st binding-doc
patch.

> 
> [...]
> 
> >> >
> >> > This additional instance is used to store compatible information for
> >> > this pwrseq library, it is used for the next matching between device
> >> > and pwrseq library, it just likes we need the first pwrseq instance
> >> > registered at boot stage.
> >>
> >> Why can't the compatible information be a static table, known by the
> >> pwrseq core library?
> >>
> >> Then when of_pwrseq_on() is called, that static table is parsed and
> >> matched, then a corresponding pwrseq library instance tries to be
> >> fetched.
> >>
> >
> > So, you suggest allocating and registering pwrseq instance on the
> > demand? Eg, we maintain a power sequence static table, including
> > compatible and allocate function.
> 
> Yes, something like that.
> 
> >
> > static const struct pwrseq_match_table pwrseq_match_table_list[] = {
> >         { PWRSEQ_DEV(0x0204, 0x6025), .alloc_instance = pwrseq_AA_alloc_instance },
> >         { PWRSEQ_DEV(0x0204, 0x6026), .alloc_instance = pwrseq_BB_alloc_instance },
> >         { PWRSEQ_DEV(0xffff, 0xffff), .alloc_instance = pwrseq_generic_alloc_instance },
> 
> What does the  PWRSEQ_DEV() macro do?

In fact, this should be compatible string, I exampled it as USB vid,pid
wrongly.

> > Since the pwrseq_match_table_list is static, we can always do match, and
> > will not return -EPROBE_DEFER anymore, one problem for this is we need
> > always compile all pwrseq libraries. Any good suggestions?
> 
> You never returned -EPROBE_DEFER in the first case. That's why I complained. :-)
> 
> So, in case the OF match doesn't succeed, there are no reason to
> propagate an error, but instead just bail out and returning 0 to the
> caller.
> 
> If the OF match succeeds, it means the device requires a pwrseq
> library to be used. Then, pwrseq_XX_alloc_instance() will be called,
> on demand and which tries to fetch the resources (clocks, gpios etc).
> If any of those attempts fetching a resource fails, its corresponding
> error code should be propagated to the caller - including
> -EPROBE_DEFER.
> 
> Regarding the "always compile all pwrseq libraries"; no we don't need
> to do that. Instead we only need a to have a stub function for
> pwrseq_XX_alloc_instance, in case its corresponding Kconfig option is
> unset. That stub, should of course return an error code.
> 

I will have a updated version for your suggestion, thanks.

-- 

Best Regards,
Peter Chen

  reply	other threads:[~2017-06-20  2:37 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-13  1:59 [PATCH v15 0/7] power: add power sequence library Peter Chen
2017-06-13  1:59 ` Peter Chen
2017-06-13  1:59 ` Peter Chen
2017-06-13  1:59 ` [PATCH v15 1/7] binding-doc: power: pwrseq-generic: add binding doc for generic " Peter Chen
2017-06-13  1:59   ` Peter Chen
2017-06-13  1:59   ` Peter Chen
2017-06-13  1:59 ` [PATCH v15 2/7] power: add " Peter Chen
2017-06-13  1:59   ` Peter Chen
2017-06-13  1:59   ` Peter Chen
2017-06-13 10:24   ` Ulf Hansson
2017-06-13 10:24     ` Ulf Hansson
2017-06-13 10:24     ` Ulf Hansson
     [not found]     ` <CAPDyKFpOQWTPpdd__OBP1DcW58CbqnygGAOxiEFq5kqqvCm0QA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-06-14  1:53       ` Peter Chen
2017-06-14  1:53         ` Peter Chen
2017-06-14  1:53         ` Peter Chen
2017-06-14  8:53         ` Ulf Hansson
2017-06-14  8:53           ` Ulf Hansson
2017-06-14  8:53           ` Ulf Hansson
2017-06-15  6:58           ` Peter Chen
2017-06-15  6:58             ` Peter Chen
2017-06-15  6:58             ` Peter Chen
2017-06-15  8:11             ` Ulf Hansson
2017-06-15  8:11               ` Ulf Hansson
2017-06-15  8:11               ` Ulf Hansson
     [not found]               ` <CAPDyKFpc8GRKK8bafMU_HPaqWNrger3grPSd5rWWCTYhUGHZLA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-06-15  9:11                 ` Peter Chen
2017-06-15  9:11                   ` Peter Chen
2017-06-15  9:11                   ` Peter Chen
2017-06-15  9:35                   ` Ulf Hansson
2017-06-15  9:35                     ` Ulf Hansson
2017-06-15  9:35                     ` Ulf Hansson
2017-06-15 10:06                     ` Peter Chen
2017-06-15 10:06                       ` Peter Chen
2017-06-15 10:06                       ` Peter Chen
2017-06-19  0:59                       ` Peter Chen
2017-06-19  0:59                         ` Peter Chen
2017-06-19  0:59                         ` Peter Chen
2017-06-19  8:09                       ` Ulf Hansson
2017-06-19  8:09                         ` Ulf Hansson
2017-06-19  8:09                         ` Ulf Hansson
2017-06-19  9:02                         ` Peter Chen
2017-06-19  9:02                           ` Peter Chen
2017-06-19  9:02                           ` Peter Chen
2017-06-19  9:48                           ` Ulf Hansson
2017-06-19  9:48                             ` Ulf Hansson
2017-06-19  9:48                             ` Ulf Hansson
2017-06-20  2:37                             ` Peter Chen [this message]
2017-06-20  2:37                               ` Peter Chen
2017-06-20  2:37                               ` Peter Chen
2017-06-13  1:59 ` [PATCH v15 3/7] binding-doc: usb: usb-device: add optional properties for power sequence Peter Chen
2017-06-13  1:59   ` Peter Chen
2017-06-13  1:59   ` Peter Chen
2017-06-13  1:59 ` [PATCH v15 4/7] usb: core: add power sequence handling for USB devices Peter Chen
2017-06-13  1:59   ` Peter Chen
2017-06-13  1:59   ` Peter Chen
2017-06-13  1:59 ` [PATCH v15 5/7] ARM: dts: imx6qdl: Enable usb node children with <reg> Peter Chen
2017-06-13  1:59   ` Peter Chen
2017-06-13  1:59   ` Peter Chen
2017-06-13  1:59 ` [PATCH v15 6/7] ARM: dts: imx6qdl-udoo.dtsi: fix onboard USB HUB property Peter Chen
2017-06-13  1:59   ` Peter Chen
2017-06-13  1:59   ` Peter Chen
     [not found] ` <1497319166-17287-1-git-send-email-peter.chen-3arQi8VN3Tc@public.gmane.org>
2017-06-13  1:59   ` [PATCH v15 7/7] ARM: dts: imx6q-evi: Fix onboard hub reset line Peter Chen
2017-06-13  1:59     ` Peter Chen
2017-06-13  1:59     ` Peter Chen

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=20170620023746.GB23731@b29397-desktop \
    --to=hzpeterchen@gmail.com \
    --cc=arnd@arndb.de \
    --cc=dbaryshkov@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=festevam@gmail.com \
    --cc=frank.li@nxp.com \
    --cc=gary.bisson@boundarydevices.com \
    --cc=heiko@sntech.de \
    --cc=krzk@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.ker \
    --cc=mail@maciej.szmigiero.name \
    --cc=mark.rutland@arm.com \
    --cc=mka@chromium.org \
    --cc=pawel.moll@arm.com \
    --cc=peter.chen@nxp.com \
    --cc=stephen.boyd@linaro.org \
    --cc=stern@rowland.harvard.edu \
    --cc=stillcompiling@gmail.com \
    --cc=ulf.hansson@linaro.org \
    --cc=vaibhav.hiremath@linaro.org \
    /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.