Thread (1 message) 1 message, 1 author, 2014-07-29

[PATCH RFC 2/2] regulator: twl: Re-add clk32kg to get wifi working

From: Mike Turquette <hidden>
Date: 2014-07-29 01:27:53
Also in: linux-devicetree

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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help