* [PATCH 2/5] mfd: madera: include correct gpio API
2022-09-26 5:44 [PATCH 1/5] mfd: mc13xxx: stop including of_gpio.h Dmitry Torokhov
@ 2022-09-26 5:44 ` Dmitry Torokhov
2022-10-24 7:32 ` Lee Jones
2022-09-26 5:44 ` [PATCH 3/5] mfd: palmas: stop including of_gpio.h Dmitry Torokhov
` (3 subsequent siblings)
4 siblings, 1 reply; 10+ messages in thread
From: Dmitry Torokhov @ 2022-09-26 5:44 UTC (permalink / raw)
To: Lee Jones
Cc: Tony Lindgren, Charles Keepax, Richard Fitzgerald, patches,
linux-kernel, linux-omap
The driver is using gpiod API and therefore should include
linux/gpio/consumer.h, not linux/gpio.h. Also, the driver does not use
any of the APIs from of_gpio.h, so we should not be including it.
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
drivers/mfd/madera-core.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/mfd/madera-core.c b/drivers/mfd/madera-core.c
index a2abc0094def..bdbd5bfc9714 100644
--- a/drivers/mfd/madera-core.c
+++ b/drivers/mfd/madera-core.c
@@ -8,13 +8,12 @@
#include <linux/device.h>
#include <linux/delay.h>
#include <linux/err.h>
-#include <linux/gpio.h>
+#include <linux/gpio/consumer.h>
#include <linux/mfd/core.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/notifier.h>
#include <linux/of.h>
-#include <linux/of_gpio.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/regmap.h>
--
2.37.3.998.g577e59143f-goog
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 2/5] mfd: madera: include correct gpio API
2022-09-26 5:44 ` [PATCH 2/5] mfd: madera: include correct gpio API Dmitry Torokhov
@ 2022-10-24 7:32 ` Lee Jones
0 siblings, 0 replies; 10+ messages in thread
From: Lee Jones @ 2022-10-24 7:32 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Tony Lindgren, Charles Keepax, Richard Fitzgerald, patches,
linux-kernel, linux-omap
On Sun, 25 Sep 2022, Dmitry Torokhov wrote:
> The driver is using gpiod API and therefore should include
> linux/gpio/consumer.h, not linux/gpio.h. Also, the driver does not use
> any of the APIs from of_gpio.h, so we should not be including it.
>
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> ---
> drivers/mfd/madera-core.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
Applied, thanks.
--
Lee Jones [李琼斯]
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 3/5] mfd: palmas: stop including of_gpio.h
2022-09-26 5:44 [PATCH 1/5] mfd: mc13xxx: stop including of_gpio.h Dmitry Torokhov
2022-09-26 5:44 ` [PATCH 2/5] mfd: madera: include correct gpio API Dmitry Torokhov
@ 2022-09-26 5:44 ` Dmitry Torokhov
2022-10-24 7:33 ` Lee Jones
2022-09-26 5:44 ` [PATCH 4/5] mfd: twl6040: switch to using gpiod API Dmitry Torokhov
` (2 subsequent siblings)
4 siblings, 1 reply; 10+ messages in thread
From: Dmitry Torokhov @ 2022-09-26 5:44 UTC (permalink / raw)
To: Lee Jones
Cc: Tony Lindgren, Charles Keepax, Richard Fitzgerald, patches,
linux-kernel, linux-omap
It does not appear that any of palmas sub-drivers are using OF-based
gpio APIs, so let's stop including this header.
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
include/linux/mfd/palmas.h | 1 -
1 file changed, 1 deletion(-)
diff --git a/include/linux/mfd/palmas.h b/include/linux/mfd/palmas.h
index 1e61c7e9f50d..117d02708439 100644
--- a/include/linux/mfd/palmas.h
+++ b/include/linux/mfd/palmas.h
@@ -16,7 +16,6 @@
#include <linux/regmap.h>
#include <linux/regulator/driver.h>
#include <linux/extcon-provider.h>
-#include <linux/of_gpio.h>
#include <linux/usb/phy_companion.h>
#define PALMAS_NUM_CLIENTS 3
--
2.37.3.998.g577e59143f-goog
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 3/5] mfd: palmas: stop including of_gpio.h
2022-09-26 5:44 ` [PATCH 3/5] mfd: palmas: stop including of_gpio.h Dmitry Torokhov
@ 2022-10-24 7:33 ` Lee Jones
0 siblings, 0 replies; 10+ messages in thread
From: Lee Jones @ 2022-10-24 7:33 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Tony Lindgren, Charles Keepax, Richard Fitzgerald, patches,
linux-kernel, linux-omap
On Sun, 25 Sep 2022, Dmitry Torokhov wrote:
> It does not appear that any of palmas sub-drivers are using OF-based
> gpio APIs, so let's stop including this header.
>
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> ---
> include/linux/mfd/palmas.h | 1 -
> 1 file changed, 1 deletion(-)
Applied, thanks.
--
Lee Jones [李琼斯]
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 4/5] mfd: twl6040: switch to using gpiod API
2022-09-26 5:44 [PATCH 1/5] mfd: mc13xxx: stop including of_gpio.h Dmitry Torokhov
2022-09-26 5:44 ` [PATCH 2/5] mfd: madera: include correct gpio API Dmitry Torokhov
2022-09-26 5:44 ` [PATCH 3/5] mfd: palmas: stop including of_gpio.h Dmitry Torokhov
@ 2022-09-26 5:44 ` Dmitry Torokhov
2022-10-24 7:33 ` Lee Jones
2022-09-26 5:44 ` [PATCH 5/5] mfd: twl6040: drop twl6040_platform_data and associated definitions Dmitry Torokhov
2022-10-24 7:32 ` [PATCH 1/5] mfd: mc13xxx: stop including of_gpio.h Lee Jones
4 siblings, 1 reply; 10+ messages in thread
From: Dmitry Torokhov @ 2022-09-26 5:44 UTC (permalink / raw)
To: Lee Jones
Cc: Tony Lindgren, Charles Keepax, Richard Fitzgerald, patches,
linux-kernel, linux-omap
This patch switches the dirver from legacy gpio API to a newer gpiod
API so that we can eventually drop the former.
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
drivers/mfd/twl6040.c | 29 +++++++++++++----------------
include/linux/mfd/twl6040.h | 5 +++--
2 files changed, 16 insertions(+), 18 deletions(-)
diff --git a/drivers/mfd/twl6040.c b/drivers/mfd/twl6040.c
index f429b8f00db6..4a7cdac5e10d 100644
--- a/drivers/mfd/twl6040.c
+++ b/drivers/mfd/twl6040.c
@@ -17,9 +17,8 @@
#include <linux/platform_device.h>
#include <linux/of.h>
#include <linux/of_irq.h>
-#include <linux/of_gpio.h>
#include <linux/of_platform.h>
-#include <linux/gpio.h>
+#include <linux/gpio/consumer.h>
#include <linux/delay.h>
#include <linux/i2c.h>
#include <linux/regmap.h>
@@ -251,7 +250,7 @@ static int twl6040_power_up_automatic(struct twl6040 *twl6040)
{
int time_left;
- gpio_set_value(twl6040->audpwron, 1);
+ gpiod_set_value_cansleep(twl6040->audpwron, 1);
time_left = wait_for_completion_timeout(&twl6040->ready,
msecs_to_jiffies(144));
@@ -262,7 +261,7 @@ static int twl6040_power_up_automatic(struct twl6040 *twl6040)
intid = twl6040_reg_read(twl6040, TWL6040_REG_INTID);
if (!(intid & TWL6040_READYINT)) {
dev_err(twl6040->dev, "automatic power-up failed\n");
- gpio_set_value(twl6040->audpwron, 0);
+ gpiod_set_value_cansleep(twl6040->audpwron, 0);
return -ETIMEDOUT;
}
}
@@ -290,7 +289,7 @@ int twl6040_power(struct twl6040 *twl6040, int on)
/* Allow writes to the chip */
regcache_cache_only(twl6040->regmap, false);
- if (gpio_is_valid(twl6040->audpwron)) {
+ if (twl6040->audpwron) {
/* use automatic power-up sequence */
ret = twl6040_power_up_automatic(twl6040);
if (ret) {
@@ -337,9 +336,9 @@ int twl6040_power(struct twl6040 *twl6040, int on)
if (--twl6040->power_count)
goto out;
- if (gpio_is_valid(twl6040->audpwron)) {
+ if (twl6040->audpwron) {
/* use AUDPWRON line */
- gpio_set_value(twl6040->audpwron, 0);
+ gpiod_set_value_cansleep(twl6040->audpwron, 0);
/* power-down sequence latency */
usleep_range(500, 700);
@@ -712,18 +711,16 @@ static int twl6040_probe(struct i2c_client *client,
}
/* ERRATA: Automatic power-up is not possible in ES1.0 */
- if (twl6040_get_revid(twl6040) > TWL6040_REV_ES1_0)
- twl6040->audpwron = of_get_named_gpio(node,
- "ti,audpwron-gpio", 0);
- else
- twl6040->audpwron = -EINVAL;
-
- if (gpio_is_valid(twl6040->audpwron)) {
- ret = devm_gpio_request_one(&client->dev, twl6040->audpwron,
- GPIOF_OUT_INIT_LOW, "audpwron");
+ if (twl6040_get_revid(twl6040) > TWL6040_REV_ES1_0) {
+ twl6040->audpwron = devm_gpiod_get_optional(&client->dev,
+ "ti,audpwron",
+ GPIOD_OUT_LOW);
+ ret = PTR_ERR_OR_ZERO(twl6040->audpwron);
if (ret)
goto gpio_err;
+ gpiod_set_consumer_name(twl6040->audpwron, "audpwron");
+
/* Clear any pending interrupt */
twl6040_reg_read(twl6040, TWL6040_REG_INTID);
}
diff --git a/include/linux/mfd/twl6040.h b/include/linux/mfd/twl6040.h
index 1fc7450bd8ab..cb1e7a9ce317 100644
--- a/include/linux/mfd/twl6040.h
+++ b/include/linux/mfd/twl6040.h
@@ -196,13 +196,14 @@ struct twl6040_gpo_data {
};
struct twl6040_platform_data {
- int audpwron_gpio; /* audio power-on gpio */
+ struct gpio_desc *audpwron_gpio; /* audio power-on gpio */
struct twl6040_codec_data *codec;
struct twl6040_vibra_data *vibra;
struct twl6040_gpo_data *gpo;
};
+struct gpio_desc;
struct regmap;
struct regmap_irq_chips_data;
@@ -218,7 +219,7 @@ struct twl6040 {
struct mfd_cell cells[TWL6040_CELLS];
struct completion ready;
- int audpwron;
+ struct gpio_desc *audpwron;
int power_count;
int rev;
--
2.37.3.998.g577e59143f-goog
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 4/5] mfd: twl6040: switch to using gpiod API
2022-09-26 5:44 ` [PATCH 4/5] mfd: twl6040: switch to using gpiod API Dmitry Torokhov
@ 2022-10-24 7:33 ` Lee Jones
0 siblings, 0 replies; 10+ messages in thread
From: Lee Jones @ 2022-10-24 7:33 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Tony Lindgren, Charles Keepax, Richard Fitzgerald, patches,
linux-kernel, linux-omap
On Sun, 25 Sep 2022, Dmitry Torokhov wrote:
> This patch switches the dirver from legacy gpio API to a newer gpiod
> API so that we can eventually drop the former.
>
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> ---
> drivers/mfd/twl6040.c | 29 +++++++++++++----------------
> include/linux/mfd/twl6040.h | 5 +++--
> 2 files changed, 16 insertions(+), 18 deletions(-)
Applied, thanks.
--
Lee Jones [李琼斯]
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 5/5] mfd: twl6040: drop twl6040_platform_data and associated definitions
2022-09-26 5:44 [PATCH 1/5] mfd: mc13xxx: stop including of_gpio.h Dmitry Torokhov
` (2 preceding siblings ...)
2022-09-26 5:44 ` [PATCH 4/5] mfd: twl6040: switch to using gpiod API Dmitry Torokhov
@ 2022-09-26 5:44 ` Dmitry Torokhov
2022-10-24 7:34 ` Lee Jones
2022-10-24 7:32 ` [PATCH 1/5] mfd: mc13xxx: stop including of_gpio.h Lee Jones
4 siblings, 1 reply; 10+ messages in thread
From: Dmitry Torokhov @ 2022-09-26 5:44 UTC (permalink / raw)
To: Lee Jones
Cc: Tony Lindgren, Charles Keepax, Richard Fitzgerald, patches,
linux-kernel, linux-omap
As of df04b6242a58 ("mfd: twl6040: Remove support for legacy (pdata)
mode") the driver no longer references the platform data, so we can drop
its definition, as well as definitions of related structures.
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
include/linux/mfd/twl6040.h | 29 -----------------------------
1 file changed, 29 deletions(-)
diff --git a/include/linux/mfd/twl6040.h b/include/linux/mfd/twl6040.h
index cb1e7a9ce317..286a724e379a 100644
--- a/include/linux/mfd/twl6040.h
+++ b/include/linux/mfd/twl6040.h
@@ -174,35 +174,6 @@
#define TWL6040_GPO_MAX 3
-/* TODO: All platform data struct can be removed */
-struct twl6040_codec_data {
- u16 hs_left_step;
- u16 hs_right_step;
- u16 hf_left_step;
- u16 hf_right_step;
-};
-
-struct twl6040_vibra_data {
- unsigned int vibldrv_res; /* left driver resistance */
- unsigned int vibrdrv_res; /* right driver resistance */
- unsigned int viblmotor_res; /* left motor resistance */
- unsigned int vibrmotor_res; /* right motor resistance */
- int vddvibl_uV; /* VDDVIBL volt, set 0 for fixed reg */
- int vddvibr_uV; /* VDDVIBR volt, set 0 for fixed reg */
-};
-
-struct twl6040_gpo_data {
- int gpio_base;
-};
-
-struct twl6040_platform_data {
- struct gpio_desc *audpwron_gpio; /* audio power-on gpio */
-
- struct twl6040_codec_data *codec;
- struct twl6040_vibra_data *vibra;
- struct twl6040_gpo_data *gpo;
-};
-
struct gpio_desc;
struct regmap;
struct regmap_irq_chips_data;
--
2.37.3.998.g577e59143f-goog
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 5/5] mfd: twl6040: drop twl6040_platform_data and associated definitions
2022-09-26 5:44 ` [PATCH 5/5] mfd: twl6040: drop twl6040_platform_data and associated definitions Dmitry Torokhov
@ 2022-10-24 7:34 ` Lee Jones
0 siblings, 0 replies; 10+ messages in thread
From: Lee Jones @ 2022-10-24 7:34 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Tony Lindgren, Charles Keepax, Richard Fitzgerald, patches,
linux-kernel, linux-omap
On Sun, 25 Sep 2022, Dmitry Torokhov wrote:
> As of df04b6242a58 ("mfd: twl6040: Remove support for legacy (pdata)
> mode") the driver no longer references the platform data, so we can drop
> its definition, as well as definitions of related structures.
>
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> ---
> include/linux/mfd/twl6040.h | 29 -----------------------------
> 1 file changed, 29 deletions(-)
Applied, thanks.
--
Lee Jones [李琼斯]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/5] mfd: mc13xxx: stop including of_gpio.h
2022-09-26 5:44 [PATCH 1/5] mfd: mc13xxx: stop including of_gpio.h Dmitry Torokhov
` (3 preceding siblings ...)
2022-09-26 5:44 ` [PATCH 5/5] mfd: twl6040: drop twl6040_platform_data and associated definitions Dmitry Torokhov
@ 2022-10-24 7:32 ` Lee Jones
4 siblings, 0 replies; 10+ messages in thread
From: Lee Jones @ 2022-10-24 7:32 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Tony Lindgren, Charles Keepax, Richard Fitzgerald, patches,
linux-kernel, linux-omap
On Sun, 25 Sep 2022, Dmitry Torokhov wrote:
> Neither SPI nor I2C variant uses any APIs from of_gpio.h so let's stop
> including it.
>
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> ---
> drivers/mfd/mc13xxx-i2c.c | 1 -
> drivers/mfd/mc13xxx-spi.c | 1 -
> 2 files changed, 2 deletions(-)
Applied, thanks.
--
Lee Jones [李琼斯]
^ permalink raw reply [flat|nested] 10+ messages in thread