Thread (12 messages) 12 messages, 4 authors, 2012-08-14

Re: [PATCH 2/4] fsl_pmc: Add API to enable device as wakeup event source

flat view

From: Tabi Timur-B04825 <hidden>
Date: 2012-08-11 13:19:48
Also in: lkml

On Tue, Aug 7, 2012 at 3:43 AM, Zhao Chenhui [off-list ref] w=
rote:
quoted hunk ↗ jump to hunk
+int mpc85xx_pmc_set_wake(struct device *dev, bool enable)
+{
+       int ret =3D 0;
+       struct device_node *clk_np;
+       const u32 *prop;
+       u32 pmcdr_mask;
+
+       if (!pmc_regs) {
+               pr_err("%s: PMC is unavailable\n", __func__);
You have a 'struct device', so please use dev_err instead.
quoted hunk ↗ jump to hunk
+               return -ENODEV;
+       }
+
+       if (enable && !device_may_wakeup(dev))
+               return -EINVAL;
+
+       clk_np =3D of_parse_phandle(dev->of_node, "fsl,pmc-handle", 0);
+       if (!clk_np)
+               return -EINVAL;
+
+       prop =3D of_get_property(clk_np, "fsl,pmcdr-mask", NULL);
+       if (!prop) {
+               ret =3D -EINVAL;
+               goto out;
+       }
+       pmcdr_mask =3D be32_to_cpup(prop);
+
+       if (enable)
+               /* clear to enable clock in low power mode */
+               clrbits32(&pmc_regs->pmcdr, pmcdr_mask);
+       else
+               setbits32(&pmc_regs->pmcdr, pmcdr_mask);
+
+out:
+       of_node_put(clk_np);
+       return ret;
+}
+EXPORT_SYMBOL_GPL(mpc85xx_pmc_set_wake);
Use EXPORT_SYMBOL, not EXPORT_SYMBOL_GPL.
quoted hunk ↗ jump to hunk
+
+/**
+ * mpc85xx_pmc_set_lossless_ethernet - enable lossless ethernet
+ * in (deep) sleep mode
+ * @enable: True to enable event generation; false to disable
+ */
+void mpc85xx_pmc_set_lossless_ethernet(int enable)
Should this be 'bool enable'?
quoted hunk ↗ jump to hunk
@@ -21,6 +22,17 @@ struct device_node;

 extern void fsl_rstcr_restart(char *cmd);

+#ifdef CONFIG_FSL_PMC
+extern int mpc85xx_pmc_set_wake(struct device *dev, bool enable);
+extern void mpc85xx_pmc_set_lossless_ethernet(int enable);
Don't use 'extern' for functions.

--=20
Timur Tabi
Linux kernel developer at Freescale=
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help