linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: mturquette@linaro.org (Mike Turquette)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH RFC 2/2] regulator: twl: Re-add clk32kg to get wifi working
Date: Mon, 28 Jul 2014 18:27:53 -0700	[thread overview]
Message-ID: <20140729012753.4906.94396@quantum> (raw)
In-Reply-To: <53D12044.1060500@kpanic.de>

Quoting Stefan Assmann (2014-07-24 08:03:32)
> +#define to_twl6030_desc(_hw) container_of(_hw, struct twl6030_desc, hw)
> +
> +static int twl6030_clk32kg_enable(struct clk_hw *hw)
> +{
> +       struct twl6030_desc *desc = to_twl6030_desc(hw);
> +       int ret;
> +
> +       ret = twl_i2c_write_u8(TWL_MODULE_PM_RECEIVER,
> +                              TWL6030_GRP_CON << TWL6030_CFG_STATE_GRP_SHIFT |
> +                              TWL6030_CFG_STATE_ON,
> +                              TWL6030_PM_RECEIVER_CLK32KG_CFG_STATE);
> +       if (ret == 0)
> +               desc->enabled = true;
> +
> +       return ret;
> +}
> +void twl6030_clk32kg_disable(struct clk_hw *hw)
> +{
> +       struct twl6030_desc *desc = to_twl6030_desc(hw);
> +
> +       twl_i2c_write_u8(TWL_MODULE_PM_RECEIVER,
> +                        TWL6030_GRP_CON << TWL6030_CFG_STATE_GRP_SHIFT |
> +                        TWL6030_CFG_STATE_OFF,
> +                        TWL6030_PM_RECEIVER_CLK32KG_CFG_STATE);
> +       desc->enabled = false;
> +}
> +
> +static int twl6030_clk32kg_is_enabled(struct clk_hw *hw)
> +{
> +       struct twl6030_desc *desc = to_twl6030_desc(hw);
> +
> +       return desc->enabled;
> +}
> +
> +static const struct clk_ops twl6030_clk32kg_ops = {
> +       .enable         = twl6030_clk32kg_enable,
> +       .disable        = twl6030_clk32kg_disable,
> +       .is_enabled     = twl6030_clk32kg_is_enabled,
> +};

All three above need to be converted from {en|dis}able to {un}prepare.
The reason is that clk_enable/clk_disable must not sleep and of course
i2c transactions might do just that.

Please Cc me on the next version :-)

Regards,
Mike

      parent reply	other threads:[~2014-07-29  1:27 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-14 11:50 [PATCH RFC 0/2] Enable wifi on pandaboard Stefan Assmann
2014-07-14 11:50 ` [PATCH RFC 1/2] dts: regulator-clk32kg should always be enabled Stefan Assmann
2014-07-14 11:50 ` [PATCH RFC 2/2] regulator: twl: Re-add clk32kg to get wifi working Stefan Assmann
2014-07-14 12:00   ` Mark Brown
2014-07-14 12:05     ` Stefan Assmann
2014-07-14 18:13       ` Mark Brown
2014-07-15 12:59         ` Stefan Assmann
2014-07-16 21:23           ` Mark Brown
2014-07-17  8:36             ` Stefan Assmann
2014-07-17  9:58               ` Mark Brown
2014-07-24 15:03             ` Stefan Assmann
2014-07-24 17:39               ` Mark Brown
2014-07-29  1:27               ` Mike Turquette [this message]

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=20140729012753.4906.94396@quantum \
    --to=mturquette@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.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 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).