diff mbox

mfd: Add power control platform data to SDHI driver

Message ID 20091127043127.13567.23641.sendpatchset@rxone.opensource.se (mailing list archive)
State Accepted
Headers show

Commit Message

Magnus Damm Nov. 27, 2009, 4:31 a.m. UTC
None
diff mbox

Patch

--- 0001/drivers/mfd/sh_mobile_sdhi.c
+++ work/drivers/mfd/sh_mobile_sdhi.c	2009-11-27 13:14:24.000000000 +0900
@@ -24,6 +24,7 @@ 
 
 #include <linux/mfd/core.h>
 #include <linux/mfd/tmio.h>
+#include <linux/mfd/sh_mobile_sdhi.h>
 
 struct sh_mobile_sdhi {
 	struct clk *clk;
@@ -50,6 +51,15 @@  static struct mfd_cell sh_mobile_sdhi_ce
 	.resources     = sh_mobile_sdhi_resources,
 };
 
+static void sh_mobile_sdhi_set_pwr(struct platform_device *tmio, int state)
+{
+	struct platform_device *pdev = to_platform_device(tmio->dev.parent);
+	struct sh_mobile_sdhi_info *p = pdev->dev.platform_data;
+
+	if (p && p->set_pwr)
+		p->set_pwr(pdev, state);
+}
+
 static int __init sh_mobile_sdhi_probe(struct platform_device *pdev)
 {
 	struct sh_mobile_sdhi *priv;
@@ -87,6 +97,7 @@  static int __init sh_mobile_sdhi_probe(s
 
 	/* FIXME: silly const unsigned int hclk */
 	*(unsigned int *)&priv->mmc_data.hclk = clk_get_rate(priv->clk);
+	priv->mmc_data.set_pwr = sh_mobile_sdhi_set_pwr;
 
 	memcpy(&priv->cell_mmc, &sh_mobile_sdhi_cell, sizeof(priv->cell_mmc));
 	priv->cell_mmc.driver_data = &priv->mmc_data;
--- /dev/null
+++ work/include/linux/mfd/sh_mobile_sdhi.h	2009-11-27 13:10:34.000000000 +0900
@@ -0,0 +1,8 @@ 
+#ifndef __SH_MOBILE_SDHI_H__
+#define __SH_MOBILE_SDHI_H__
+
+struct sh_mobile_sdhi_info {
+	void (*set_pwr)(struct platform_device *pdev, int state);
+};
+
+#endif /* __SH_MOBILE_SDHI_H__ */