0x3, /* IRQ out, active high, CMOS */
},
.ldo = {
- { .init_data = &wm8994_ldo1, },
- { .init_data = &wm8994_ldo2, },
+ { .enable = S3C64XX_GPN(6), .init_data = &wm8994_ldo1, },
+ { .enable = S3C64XX_GPN(4), .init_data = &wm8994_ldo2, },
},
};
{ I2C_BOARD_INFO("wm8958", 0x1a), /* WM8958 is the superset */
.platform_data = &wm8994_pdata,
.irq = GLENFARCLAS_PMIC_IRQ_BASE + WM831X_IRQ_GPIO_2,
- .dev_name = "wm8958",
- },
-};
-
-static struct gpiod_lookup_table wm8994_gpiod_table = {
- .dev_id = "i2c-wm8958", /* I2C device name */
- .table = {
- GPIO_LOOKUP("GPION", 6,
- "wlf,ldo1ena", GPIO_ACTIVE_HIGH),
- GPIO_LOOKUP("GPION", 4,
- "wlf,ldo2ena", GPIO_ACTIVE_HIGH),
- { },
},
};
gpiod_add_lookup_table(&wm5102_reva_gpiod_table);
gpiod_add_lookup_table(&wm5102_gpiod_table);
- gpiod_add_lookup_table(&wm8994_gpiod_table);
if (i < ARRAY_SIZE(gf_mods)) {
dev_info(&i2c->dev, "%s revision %d\n",
#include <linux/mfd/core.h>
#include <linux/of.h>
#include <linux/of_device.h>
+#include <linux/of_gpio.h>
#include <linux/pm_runtime.h>
#include <linux/regmap.h>
#include <linux/regulator/consumer.h>
if (of_find_property(np, "wlf,ldoena-always-driven", NULL))
pdata->lineout2fb = true;
+ pdata->ldo[0].enable = of_get_named_gpio(np, "wlf,ldo1ena", 0);
+ if (pdata->ldo[0].enable < 0)
+ pdata->ldo[0].enable = 0;
+
+ pdata->ldo[1].enable = of_get_named_gpio(np, "wlf,ldo2ena", 0);
+ if (pdata->ldo[1].enable < 0)
+ pdata->ldo[1].enable = 0;
+
return 0;
}
#else
#include <linux/platform_device.h>
#include <linux/regulator/driver.h>
#include <linux/regulator/machine.h>
-#include <linux/gpio/consumer.h>
+#include <linux/gpio.h>
#include <linux/slab.h>
#include <linux/mfd/wm8994/core.h>
int id = pdev->id % ARRAY_SIZE(pdata->ldo);
struct regulator_config config = { };
struct wm8994_ldo *ldo;
- struct gpio_desc *gpiod;
int ret;
dev_dbg(&pdev->dev, "Probing LDO%d\n", id + 1);
config.driver_data = ldo;
config.regmap = wm8994->regmap;
config.init_data = &ldo->init_data;
-
- /* Look up LDO enable GPIO from the parent device node */
- gpiod = devm_gpiod_get_optional(pdev->dev.parent,
- id ? "wlf,ldo2ena" : "wlf,ldo1ena",
- GPIOD_OUT_LOW);
- if (IS_ERR(gpiod))
- return PTR_ERR(gpiod);
- config.ena_gpiod = gpiod;
+ if (pdata) {
+ config.ena_gpio = pdata->ldo[id].enable;
+ } else if (wm8994->dev->of_node) {
+ config.ena_gpio = wm8994->pdata.ldo[id].enable;
+ config.ena_gpio_initialized = true;
+ }
/* Use default constraints if none set up */
if (!pdata || !pdata->ldo[id].init_data || wm8994->dev->of_node) {
ldo->init_data = wm8994_ldo_default[id];
ldo->init_data.consumer_supplies = &ldo->supply;
- if (!gpiod)
+ if (!config.ena_gpio)
ldo->init_data.constraints.valid_ops_mask = 0;
} else {
ldo->init_data = *pdata->ldo[id].init_data;
#define WM8994_NUM_AIF 3
struct wm8994_ldo_pdata {
+ /** GPIOs to enable regulator, 0 or less if not available */
+ int enable;
+
const struct regulator_init_data *init_data;
};