* [PATCH] Input: max8997 - Convert to modern way to get a reference to a PWM
@ 2022-11-17 7:35 Uwe Kleine-König
2022-11-17 10:13 ` Lee Jones
2022-11-18 6:18 ` Dmitry Torokhov
0 siblings, 2 replies; 3+ messages in thread
From: Uwe Kleine-König @ 2022-11-17 7:35 UTC (permalink / raw)
To: Dmitry Torokhov, Lee Jones
Cc: linux-input, linux-kernel, Thierry Reding, linux-pwm, kernel
pwm_request() isn't recommended to be used any more because it relies on
global IDs for the PWM which comes with different difficulties.
The new way to do things is to find the right PWM using a reference from
the platform device. (This can be created either using a device-tree
or a platform lookup table, see e.g. commit 5a4412d4a82f ("ARM: pxa:
tavorevb: Use PWM lookup table") how to do this.)
There are no in-tree users, so there are no other code locations that need
adaption.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/input/misc/max8997_haptic.c | 7 +++----
include/linux/mfd/max8997.h | 3 ---
2 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/drivers/input/misc/max8997_haptic.c b/drivers/input/misc/max8997_haptic.c
index cd5e99ec1d3c..99cbc5ee89d1 100644
--- a/drivers/input/misc/max8997_haptic.c
+++ b/drivers/input/misc/max8997_haptic.c
@@ -278,8 +278,7 @@ static int max8997_haptic_probe(struct platform_device *pdev)
break;
case MAX8997_EXTERNAL_MODE:
- chip->pwm = pwm_request(haptic_pdata->pwm_channel_id,
- "max8997-haptic");
+ chip->pwm = pwm_get(&pdev->dev, NULL);
if (IS_ERR(chip->pwm)) {
error = PTR_ERR(chip->pwm);
dev_err(&pdev->dev,
@@ -344,7 +343,7 @@ static int max8997_haptic_probe(struct platform_device *pdev)
regulator_put(chip->regulator);
err_free_pwm:
if (chip->mode == MAX8997_EXTERNAL_MODE)
- pwm_free(chip->pwm);
+ pwm_put(chip->pwm);
err_free_mem:
input_free_device(input_dev);
kfree(chip);
@@ -360,7 +359,7 @@ static int max8997_haptic_remove(struct platform_device *pdev)
regulator_put(chip->regulator);
if (chip->mode == MAX8997_EXTERNAL_MODE)
- pwm_free(chip->pwm);
+ pwm_put(chip->pwm);
kfree(chip);
diff --git a/include/linux/mfd/max8997.h b/include/linux/mfd/max8997.h
index 6c98edcf4b0b..6193905abbb5 100644
--- a/include/linux/mfd/max8997.h
+++ b/include/linux/mfd/max8997.h
@@ -110,8 +110,6 @@ enum max8997_haptic_pwm_divisor {
/**
* max8997_haptic_platform_data
- * @pwm_channel_id: channel number of PWM device
- * valid for MAX8997_EXTERNAL_MODE
* @pwm_period: period in nano second for PWM device
* valid for MAX8997_EXTERNAL_MODE
* @type: motor type
@@ -128,7 +126,6 @@ enum max8997_haptic_pwm_divisor {
* [0 - 255]: available period
*/
struct max8997_haptic_platform_data {
- unsigned int pwm_channel_id;
unsigned int pwm_period;
enum max8997_haptic_motor_type type;
base-commit: 9abf2313adc1ca1b6180c508c25f22f9395cc780
--
2.38.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] Input: max8997 - Convert to modern way to get a reference to a PWM
2022-11-17 7:35 [PATCH] Input: max8997 - Convert to modern way to get a reference to a PWM Uwe Kleine-König
@ 2022-11-17 10:13 ` Lee Jones
2022-11-18 6:18 ` Dmitry Torokhov
1 sibling, 0 replies; 3+ messages in thread
From: Lee Jones @ 2022-11-17 10:13 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Dmitry Torokhov, linux-input, linux-kernel, Thierry Reding,
linux-pwm, kernel
On Thu, 17 Nov 2022, Uwe Kleine-König wrote:
> pwm_request() isn't recommended to be used any more because it relies on
> global IDs for the PWM which comes with different difficulties.
>
> The new way to do things is to find the right PWM using a reference from
> the platform device. (This can be created either using a device-tree
> or a platform lookup table, see e.g. commit 5a4412d4a82f ("ARM: pxa:
> tavorevb: Use PWM lookup table") how to do this.)
>
> There are no in-tree users, so there are no other code locations that need
> adaption.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
> drivers/input/misc/max8997_haptic.c | 7 +++----
> include/linux/mfd/max8997.h | 3 ---
Acked-by: Lee Jones <lee@kernel.org>
> 2 files changed, 3 insertions(+), 7 deletions(-)
--
Lee Jones [李琼斯]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Input: max8997 - Convert to modern way to get a reference to a PWM
2022-11-17 7:35 [PATCH] Input: max8997 - Convert to modern way to get a reference to a PWM Uwe Kleine-König
2022-11-17 10:13 ` Lee Jones
@ 2022-11-18 6:18 ` Dmitry Torokhov
1 sibling, 0 replies; 3+ messages in thread
From: Dmitry Torokhov @ 2022-11-18 6:18 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Lee Jones, linux-input, linux-kernel, Thierry Reding, linux-pwm,
kernel
On Thu, Nov 17, 2022 at 08:35:43AM +0100, Uwe Kleine-König wrote:
> pwm_request() isn't recommended to be used any more because it relies on
> global IDs for the PWM which comes with different difficulties.
>
> The new way to do things is to find the right PWM using a reference from
> the platform device. (This can be created either using a device-tree
> or a platform lookup table, see e.g. commit 5a4412d4a82f ("ARM: pxa:
> tavorevb: Use PWM lookup table") how to do this.)
>
> There are no in-tree users, so there are no other code locations that need
> adaption.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Applied, thank you.
--
Dmitry
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-11-18 6:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-17 7:35 [PATCH] Input: max8997 - Convert to modern way to get a reference to a PWM Uwe Kleine-König
2022-11-17 10:13 ` Lee Jones
2022-11-18 6:18 ` Dmitry Torokhov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).