Commit d7636117 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Lee Jones

mfd: lm3533: Move to new GPIO descriptor-based APIs

Legacy GPIO APIs are subject to remove. Convert the driver to new APIs.
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20240605191458.2536819-1-andriy.shevchenko@linux.intel.comSigned-off-by: default avatarLee Jones <lee@kernel.org>
parent 13c151a9
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/err.h> #include <linux/err.h>
#include <linux/gpio.h> #include <linux/gpio/consumer.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/mfd/core.h> #include <linux/mfd/core.h>
#include <linux/regmap.h> #include <linux/regmap.h>
...@@ -225,14 +225,12 @@ static int lm3533_set_lvled_config(struct lm3533 *lm3533, u8 lvled, u8 led) ...@@ -225,14 +225,12 @@ static int lm3533_set_lvled_config(struct lm3533 *lm3533, u8 lvled, u8 led)
static void lm3533_enable(struct lm3533 *lm3533) static void lm3533_enable(struct lm3533 *lm3533)
{ {
if (gpio_is_valid(lm3533->gpio_hwen)) gpiod_set_value(lm3533->hwen, 1);
gpio_set_value(lm3533->gpio_hwen, 1);
} }
static void lm3533_disable(struct lm3533 *lm3533) static void lm3533_disable(struct lm3533 *lm3533)
{ {
if (gpio_is_valid(lm3533->gpio_hwen)) gpiod_set_value(lm3533->hwen, 0);
gpio_set_value(lm3533->gpio_hwen, 0);
} }
enum lm3533_attribute_type { enum lm3533_attribute_type {
...@@ -483,18 +481,10 @@ static int lm3533_device_init(struct lm3533 *lm3533) ...@@ -483,18 +481,10 @@ static int lm3533_device_init(struct lm3533 *lm3533)
return -EINVAL; return -EINVAL;
} }
lm3533->gpio_hwen = pdata->gpio_hwen; lm3533->hwen = devm_gpiod_get(lm3533->dev, NULL, GPIOD_OUT_LOW);
if (IS_ERR(lm3533->hwen))
if (gpio_is_valid(lm3533->gpio_hwen)) { return dev_err_probe(lm3533->dev, PTR_ERR(lm3533->hwen), "failed to request HWEN GPIO\n");
ret = devm_gpio_request_one(lm3533->dev, lm3533->gpio_hwen, gpiod_set_consumer_name(lm3533->hwen, "lm3533-hwen");
GPIOF_OUT_INIT_LOW, "lm3533-hwen");
if (ret < 0) {
dev_err(lm3533->dev,
"failed to request HWEN GPIO %d\n",
lm3533->gpio_hwen);
return ret;
}
}
lm3533_enable(lm3533); lm3533_enable(lm3533);
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
DEVICE_ATTR(_name, S_IRUGO | S_IWUSR , show_##_name, store_##_name) DEVICE_ATTR(_name, S_IRUGO | S_IWUSR , show_##_name, store_##_name)
struct device; struct device;
struct gpio_desc;
struct regmap; struct regmap;
struct lm3533 { struct lm3533 {
...@@ -23,7 +24,7 @@ struct lm3533 { ...@@ -23,7 +24,7 @@ struct lm3533 {
struct regmap *regmap; struct regmap *regmap;
int gpio_hwen; struct gpio_desc *hwen;
int irq; int irq;
unsigned have_als:1; unsigned have_als:1;
...@@ -69,8 +70,6 @@ enum lm3533_boost_ovp { ...@@ -69,8 +70,6 @@ enum lm3533_boost_ovp {
}; };
struct lm3533_platform_data { struct lm3533_platform_data {
int gpio_hwen;
enum lm3533_boost_ovp boost_ovp; enum lm3533_boost_ovp boost_ovp;
enum lm3533_boost_freq boost_freq; enum lm3533_boost_freq boost_freq;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment