Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F96099048
D30291.id89298.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D30291.id89298.diff
View Options
diff --git a/sys/dev/mmc/mmc_fdt_helpers.h b/sys/dev/mmc/mmc_fdt_helpers.h
--- a/sys/dev/mmc/mmc_fdt_helpers.h
+++ b/sys/dev/mmc/mmc_fdt_helpers.h
@@ -74,5 +74,6 @@
void mmc_fdt_gpio_teardown(struct mmc_fdt_helper *helper);
bool mmc_fdt_gpio_get_present(struct mmc_fdt_helper *helper);
bool mmc_fdt_gpio_get_readonly(struct mmc_fdt_helper *helper);
+void mmc_fdt_set_power(struct mmc_fdt_helper *helper, enum mmc_power_mode power_mode);
#endif
diff --git a/sys/dev/mmc/mmc_fdt_helpers.c b/sys/dev/mmc/mmc_fdt_helpers.c
--- a/sys/dev/mmc/mmc_fdt_helpers.c
+++ b/sys/dev/mmc/mmc_fdt_helpers.c
@@ -45,6 +45,8 @@
#include <dev/extres/regulator/regulator.h>
#endif
+#include "mmc_pwrseq_if.h"
+
static inline void
mmc_fdt_parse_sd_speed(phandle_t node, struct mmc_host *host)
{
@@ -423,3 +425,43 @@
return (pinstate ^ (helper->props & MMC_PROP_WP_INVERTED));
}
+
+void
+mmc_fdt_set_power(struct mmc_fdt_helper *helper, enum mmc_power_mode power_mode)
+{
+ int reg_status;
+ int rv;
+
+ switch (power_mode) {
+ case power_on:
+ break;
+ case power_off:
+ if (helper->vmmc_supply) {
+ rv = regulator_status(helper->vmmc_supply, ®_status);
+ if (rv == 0 && reg_status == REGULATOR_STATUS_ENABLED)
+ regulator_disable(helper->vmmc_supply);
+ }
+ if (helper->vqmmc_supply) {
+ rv = regulator_status(helper->vqmmc_supply, ®_status);
+ if (rv == 0 && reg_status == REGULATOR_STATUS_ENABLED)
+ regulator_disable(helper->vqmmc_supply);
+ }
+ if (helper->mmc_pwrseq)
+ MMC_PWRSEQ_SET_POWER(helper->mmc_pwrseq, false);
+ break;
+ case power_up:
+ if (helper->vmmc_supply) {
+ rv = regulator_status(helper->vmmc_supply, ®_status);
+ if (rv == 0 && reg_status != REGULATOR_STATUS_ENABLED)
+ regulator_enable(helper->vmmc_supply);
+ }
+ if (helper->vqmmc_supply) {
+ rv = regulator_status(helper->vqmmc_supply, ®_status);
+ if (rv == 0 && reg_status != REGULATOR_STATUS_ENABLED)
+ regulator_enable(helper->vqmmc_supply);
+ }
+ if (helper->mmc_pwrseq)
+ MMC_PWRSEQ_SET_POWER(helper->mmc_pwrseq, true);
+ break;
+ }
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Sep 24, 4:45 PM (18 h, 12 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
12679087
Default Alt Text
D30291.id89298.diff (2 KB)
Attached To
Mode
D30291: mmc_fdt_helper: Add mmc_fdt_set_power
Attached
Detach File
Event Timeline
Log In to Comment