All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@kernel.org>
To: Tony Xie <tony.xie@rock-chips.com>, heiko@sntech.de
Cc: broonie@kernel.org, lee.jones@linaro.org, robh+dt@kernel.org,
	mark.rutland@arm.com, a.zummo@towertech.it,
	alexandre.belloni@bootlin.com, linux-clk@vger.kernel.org,
	linux-rtc@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, chenjh@rock-chips.com,
	xsf@rock-chips.com, zhangqing@rock-chips.com,
	huangtao@rock-chips.com, tony.xie@rock-chips.com
Subject: Re: [PATCH v3 5/5] clk: RK808: add RK809 and RK817 support.
Date: Fri, 31 Aug 2018 10:34:22 -0700	[thread overview]
Message-ID: <153573686206.93865.11806745452503167124@swboyd.mtv.corp.google.com> (raw)
In-Reply-To: <1535081762-20844-1-git-send-email-tony.xie@rock-chips.com>

Quoting Tony Xie (2018-08-23 20:36:02)
> diff --git a/drivers/clk/clk-rk808.c b/drivers/clk/clk-rk808.c
> index 6461f28..c5d3492 100644
> --- a/drivers/clk/clk-rk808.c
> +++ b/drivers/clk/clk-rk808.c
> @@ -96,6 +96,66 @@ static int rk808_clkout2_is_prepared(struct clk_hw *hw)
> +
> +static int rk817_clkout2_is_prepared(struct clk_hw *hw)
> +{
> +       struct rk808_clkout *rk808_clkout = container_of(hw,
> +                                                        struct rk808_clkout,
> +                                                        clkout2_hw);
> +       struct rk808 *rk808 = rk808_clkout->rk808;
> +       unsigned int val;
> +
> +       int ret = regmap_read(rk808->regmap, RK817_SYS_CFG(1), &val);
> +
> +       if (ret < 0)
> +               return ret;

The clk core handles the return value here as true or false. Probably
should return 0 here.

> +
> +       return (val & RK817_CLK32KOUT2_EN) ? 1 : 0;
> +}
> +
> +static const struct clk_ops rk817_clkout2_ops = {
> +       .prepare = rk817_clkout2_prepare,
> +       .unprepare = rk817_clkout2_unprepare,
> +       .is_prepared = rk817_clkout2_is_prepared,
> +       .recalc_rate = rk808_clkout_recalc_rate,
> +};
> +
> +static const struct clk_ops *rkpmic_get_ops(long variant)

Use the enum here for 'variant'? Then the case statement here will
complain loudly for unhandled cases.

> +{
> +       switch (variant) {
> +       case RK809_ID:
> +       case RK817_ID:
> +               return &rk817_clkout2_ops;
> +       case RK805_ID:
> +       case RK808_ID:
> +       case RK818_ID:
> +               return &rk808_clkout2_ops;
> +       }
> +
> +       return &rk808_clkout2_ops;
> +}
> +
>  static int rk808_clkout_probe(struct platform_device *pdev)
>  {
>         struct rk808 *rk808 = dev_get_drvdata(pdev->dev.parent);
> @@ -127,7 +187,7 @@ static int rk808_clkout_probe(struct platform_device *pdev)
>                 return ret;
>  
>         init.name = "rk808-clkout2";
> -       init.ops = &rk808_clkout2_ops;
> +       init.ops = rkpmic_get_ops(rk808->variant);
>         rk808_clkout->clkout2_hw.init = &init;
>  
>         /* optional override of the clockname */
> -- 
> 1.9.1
> 
> 

WARNING: multiple messages have this Message-ID (diff)
From: Stephen Boyd <sboyd@kernel.org>
To: Tony Xie <tony.xie@rock-chips.com>, heiko@sntech.de
Cc: broonie@kernel.org, lee.jones@linaro.org, robh+dt@kernel.org,
	mark.rutland@arm.com, a.zummo@towertech.it,
	alexandre.belloni@bootlin.com, linux-clk@vger.kernel.org,
	linux-rtc@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, chenjh@rock-chips.com,
	xsf@rock-chips.com, zhangqing@rock-chips.com,
	huangtao@rock-chips.com, tony.xie@rock-chips.com
Subject: Re: [PATCH v3 5/5] clk: RK808: add RK809 and RK817 support.
Date: Fri, 31 Aug 2018 10:34:22 -0700	[thread overview]
Message-ID: <153573686206.93865.11806745452503167124@swboyd.mtv.corp.google.com> (raw)
In-Reply-To: <1535081762-20844-1-git-send-email-tony.xie@rock-chips.com>

Quoting Tony Xie (2018-08-23 20:36:02)
> diff --git a/drivers/clk/clk-rk808.c b/drivers/clk/clk-rk808.c
> index 6461f28..c5d3492 100644
> --- a/drivers/clk/clk-rk808.c
> +++ b/drivers/clk/clk-rk808.c
> @@ -96,6 +96,66 @@ static int rk808_clkout2_is_prepared(struct clk_hw *hw)
> +
> +static int rk817_clkout2_is_prepared(struct clk_hw *hw)
> +{
> +       struct rk808_clkout *rk808_clkout =3D container_of(hw,
> +                                                        struct rk808_clk=
out,
> +                                                        clkout2_hw);
> +       struct rk808 *rk808 =3D rk808_clkout->rk808;
> +       unsigned int val;
> +
> +       int ret =3D regmap_read(rk808->regmap, RK817_SYS_CFG(1), &val);
> +
> +       if (ret < 0)
> +               return ret;

The clk core handles the return value here as true or false. Probably
should return 0 here.

> +
> +       return (val & RK817_CLK32KOUT2_EN) ? 1 : 0;
> +}
> +
> +static const struct clk_ops rk817_clkout2_ops =3D {
> +       .prepare =3D rk817_clkout2_prepare,
> +       .unprepare =3D rk817_clkout2_unprepare,
> +       .is_prepared =3D rk817_clkout2_is_prepared,
> +       .recalc_rate =3D rk808_clkout_recalc_rate,
> +};
> +
> +static const struct clk_ops *rkpmic_get_ops(long variant)

Use the enum here for 'variant'? Then the case statement here will
complain loudly for unhandled cases.

> +{
> +       switch (variant) {
> +       case RK809_ID:
> +       case RK817_ID:
> +               return &rk817_clkout2_ops;
> +       case RK805_ID:
> +       case RK808_ID:
> +       case RK818_ID:
> +               return &rk808_clkout2_ops;
> +       }
> +
> +       return &rk808_clkout2_ops;
> +}
> +
>  static int rk808_clkout_probe(struct platform_device *pdev)
>  {
>         struct rk808 *rk808 =3D dev_get_drvdata(pdev->dev.parent);
> @@ -127,7 +187,7 @@ static int rk808_clkout_probe(struct platform_device =
*pdev)
>                 return ret;
>  =

>         init.name =3D "rk808-clkout2";
> -       init.ops =3D &rk808_clkout2_ops;
> +       init.ops =3D rkpmic_get_ops(rk808->variant);
>         rk808_clkout->clkout2_hw.init =3D &init;
>  =

>         /* optional override of the clockname */
> -- =

> 1.9.1
> =

>=20

WARNING: multiple messages have this Message-ID (diff)
From: Stephen Boyd <sboyd@kernel.org>
To: heiko@sntech.de
Cc: broonie@kernel.org, lee.jones@linaro.org, robh+dt@kernel.org,
	mark.rutland@arm.com, a.zummo@towertech.it,
	alexandre.belloni@bootlin.com, linux-clk@vger.kernel.org,
	linux-rtc@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, chenjh@rock-chips.com,
	xsf@rock-chips.com, zhangqing@rock-chips.com,
	huangtao@rock-chips.com, tony.xie@rock-chips.com
Subject: Re: [PATCH v3 5/5] clk: RK808: add RK809 and RK817 support.
Date: Fri, 31 Aug 2018 10:34:22 -0700	[thread overview]
Message-ID: <153573686206.93865.11806745452503167124@swboyd.mtv.corp.google.com> (raw)
In-Reply-To: <1535081762-20844-1-git-send-email-tony.xie@rock-chips.com>

Quoting Tony Xie (2018-08-23 20:36:02)
> diff --git a/drivers/clk/clk-rk808.c b/drivers/clk/clk-rk808.c
> index 6461f28..c5d3492 100644
> --- a/drivers/clk/clk-rk808.c
> +++ b/drivers/clk/clk-rk808.c
> @@ -96,6 +96,66 @@ static int rk808_clkout2_is_prepared(struct clk_hw *hw)
> +
> +static int rk817_clkout2_is_prepared(struct clk_hw *hw)
> +{
> +       struct rk808_clkout *rk808_clkout = container_of(hw,
> +                                                        struct rk808_clkout,
> +                                                        clkout2_hw);
> +       struct rk808 *rk808 = rk808_clkout->rk808;
> +       unsigned int val;
> +
> +       int ret = regmap_read(rk808->regmap, RK817_SYS_CFG(1), &val);
> +
> +       if (ret < 0)
> +               return ret;

The clk core handles the return value here as true or false. Probably
should return 0 here.

> +
> +       return (val & RK817_CLK32KOUT2_EN) ? 1 : 0;
> +}
> +
> +static const struct clk_ops rk817_clkout2_ops = {
> +       .prepare = rk817_clkout2_prepare,
> +       .unprepare = rk817_clkout2_unprepare,
> +       .is_prepared = rk817_clkout2_is_prepared,
> +       .recalc_rate = rk808_clkout_recalc_rate,
> +};
> +
> +static const struct clk_ops *rkpmic_get_ops(long variant)

Use the enum here for 'variant'? Then the case statement here will
complain loudly for unhandled cases.

> +{
> +       switch (variant) {
> +       case RK809_ID:
> +       case RK817_ID:
> +               return &rk817_clkout2_ops;
> +       case RK805_ID:
> +       case RK808_ID:
> +       case RK818_ID:
> +               return &rk808_clkout2_ops;
> +       }
> +
> +       return &rk808_clkout2_ops;
> +}
> +
>  static int rk808_clkout_probe(struct platform_device *pdev)
>  {
>         struct rk808 *rk808 = dev_get_drvdata(pdev->dev.parent);
> @@ -127,7 +187,7 @@ static int rk808_clkout_probe(struct platform_device *pdev)
>                 return ret;
>  
>         init.name = "rk808-clkout2";
> -       init.ops = &rk808_clkout2_ops;
> +       init.ops = rkpmic_get_ops(rk808->variant);
>         rk808_clkout->clkout2_hw.init = &init;
>  
>         /* optional override of the clockname */
> -- 
> 1.9.1
> 
> 

WARNING: multiple messages have this Message-ID (diff)
From: sboyd@kernel.org (Stephen Boyd)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 5/5] clk: RK808: add RK809 and RK817 support.
Date: Fri, 31 Aug 2018 10:34:22 -0700	[thread overview]
Message-ID: <153573686206.93865.11806745452503167124@swboyd.mtv.corp.google.com> (raw)
In-Reply-To: <1535081762-20844-1-git-send-email-tony.xie@rock-chips.com>

Quoting Tony Xie (2018-08-23 20:36:02)
> diff --git a/drivers/clk/clk-rk808.c b/drivers/clk/clk-rk808.c
> index 6461f28..c5d3492 100644
> --- a/drivers/clk/clk-rk808.c
> +++ b/drivers/clk/clk-rk808.c
> @@ -96,6 +96,66 @@ static int rk808_clkout2_is_prepared(struct clk_hw *hw)
> +
> +static int rk817_clkout2_is_prepared(struct clk_hw *hw)
> +{
> +       struct rk808_clkout *rk808_clkout = container_of(hw,
> +                                                        struct rk808_clkout,
> +                                                        clkout2_hw);
> +       struct rk808 *rk808 = rk808_clkout->rk808;
> +       unsigned int val;
> +
> +       int ret = regmap_read(rk808->regmap, RK817_SYS_CFG(1), &val);
> +
> +       if (ret < 0)
> +               return ret;

The clk core handles the return value here as true or false. Probably
should return 0 here.

> +
> +       return (val & RK817_CLK32KOUT2_EN) ? 1 : 0;
> +}
> +
> +static const struct clk_ops rk817_clkout2_ops = {
> +       .prepare = rk817_clkout2_prepare,
> +       .unprepare = rk817_clkout2_unprepare,
> +       .is_prepared = rk817_clkout2_is_prepared,
> +       .recalc_rate = rk808_clkout_recalc_rate,
> +};
> +
> +static const struct clk_ops *rkpmic_get_ops(long variant)

Use the enum here for 'variant'? Then the case statement here will
complain loudly for unhandled cases.

> +{
> +       switch (variant) {
> +       case RK809_ID:
> +       case RK817_ID:
> +               return &rk817_clkout2_ops;
> +       case RK805_ID:
> +       case RK808_ID:
> +       case RK818_ID:
> +               return &rk808_clkout2_ops;
> +       }
> +
> +       return &rk808_clkout2_ops;
> +}
> +
>  static int rk808_clkout_probe(struct platform_device *pdev)
>  {
>         struct rk808 *rk808 = dev_get_drvdata(pdev->dev.parent);
> @@ -127,7 +187,7 @@ static int rk808_clkout_probe(struct platform_device *pdev)
>                 return ret;
>  
>         init.name = "rk808-clkout2";
> -       init.ops = &rk808_clkout2_ops;
> +       init.ops = rkpmic_get_ops(rk808->variant);
>         rk808_clkout->clkout2_hw.init = &init;
>  
>         /* optional override of the clockname */
> -- 
> 1.9.1
> 
> 

  reply	other threads:[~2018-08-31 17:34 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-24  3:30 [PATCH v3 0/5] support a new type of PMIC,including two chips(rk817 and rk809) Tony Xie
2018-08-24  3:30 ` [PATCH v3 0/5] support a new type of PMIC, including " Tony Xie
2018-08-24  3:30 ` [PATCH v3 1/5] mfd: rk808: Add RK817 and RK809 support Tony Xie
2018-08-24  3:30   ` Tony Xie
2018-09-11 11:47   ` Lee Jones
2018-09-11 11:47     ` Lee Jones
2018-10-23  3:12     ` tony
2018-10-23  3:12       ` tony
2018-10-23  3:12       ` tony
2018-10-23  6:26       ` Lee Jones
2018-10-23  6:26         ` Lee Jones
2018-10-23  7:21         ` tony
2018-10-23  7:21           ` tony
2018-08-24  3:30 ` [PATCH v3 2/5] regulator: rk808: add RK809 and RK817 support Tony Xie
2018-08-24  3:30   ` Tony Xie
2018-08-24 12:23   ` Wadim Egorov
2018-08-24 12:23     ` Wadim Egorov
2018-09-03  8:52     ` tony1
2018-08-24  3:30 ` [PATCH v3 3/5] dt-bindings: mfd: rk808: Add binding information for RK809 and RK817 Tony Xie
2018-08-24  3:30   ` Tony Xie
2018-08-28 22:40   ` Rob Herring
2018-08-28 22:40     ` Rob Herring
2018-08-28 22:40     ` Rob Herring
2018-09-11 12:37   ` Lee Jones
2018-09-11 12:37     ` Lee Jones
2018-08-24  3:30 ` [PATCH v3 4/5] rtc: rk808: add RK809 and RK817 support Tony Xie
2018-08-24  3:30   ` Tony Xie
2018-08-27 21:14   ` Alexandre Belloni
2018-08-27 21:14     ` Alexandre Belloni
2018-08-24  3:35 ` Tony Xie
2018-08-24  3:35   ` Tony Xie
2018-08-24  3:36 ` [PATCH v3 5/5] clk: RK808: " Tony Xie
2018-08-24  3:36   ` Tony Xie
2018-08-31 17:34   ` Stephen Boyd [this message]
2018-08-31 17:34     ` Stephen Boyd
2018-08-31 17:34     ` Stephen Boyd
2018-08-31 17:34     ` Stephen Boyd

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=153573686206.93865.11806745452503167124@swboyd.mtv.corp.google.com \
    --to=sboyd@kernel.org \
    --cc=a.zummo@towertech.it \
    --cc=alexandre.belloni@bootlin.com \
    --cc=broonie@kernel.org \
    --cc=chenjh@rock-chips.com \
    --cc=devicetree@vger.kernel.org \
    --cc=heiko@sntech.de \
    --cc=huangtao@rock-chips.com \
    --cc=lee.jones@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=tony.xie@rock-chips.com \
    --cc=xsf@rock-chips.com \
    --cc=zhangqing@rock-chips.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.