Commit b76f64ca authored by Uwe Kleine-König's avatar Uwe Kleine-König Committed by Dmitry Torokhov

Input: max8997 - convert to modern way to get a reference to a PWM

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 5a4412d4 ("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: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: default avatarLee Jones <lee@kernel.org>
Link: https://lore.kernel.org/r/20221117073543.3790449-1-u.kleine-koenig@pengutronix.deSigned-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent a85fbd64
...@@ -278,8 +278,7 @@ static int max8997_haptic_probe(struct platform_device *pdev) ...@@ -278,8 +278,7 @@ static int max8997_haptic_probe(struct platform_device *pdev)
break; break;
case MAX8997_EXTERNAL_MODE: case MAX8997_EXTERNAL_MODE:
chip->pwm = pwm_request(haptic_pdata->pwm_channel_id, chip->pwm = pwm_get(&pdev->dev, NULL);
"max8997-haptic");
if (IS_ERR(chip->pwm)) { if (IS_ERR(chip->pwm)) {
error = PTR_ERR(chip->pwm); error = PTR_ERR(chip->pwm);
dev_err(&pdev->dev, dev_err(&pdev->dev,
...@@ -344,7 +343,7 @@ static int max8997_haptic_probe(struct platform_device *pdev) ...@@ -344,7 +343,7 @@ static int max8997_haptic_probe(struct platform_device *pdev)
regulator_put(chip->regulator); regulator_put(chip->regulator);
err_free_pwm: err_free_pwm:
if (chip->mode == MAX8997_EXTERNAL_MODE) if (chip->mode == MAX8997_EXTERNAL_MODE)
pwm_free(chip->pwm); pwm_put(chip->pwm);
err_free_mem: err_free_mem:
input_free_device(input_dev); input_free_device(input_dev);
kfree(chip); kfree(chip);
...@@ -360,7 +359,7 @@ static int max8997_haptic_remove(struct platform_device *pdev) ...@@ -360,7 +359,7 @@ static int max8997_haptic_remove(struct platform_device *pdev)
regulator_put(chip->regulator); regulator_put(chip->regulator);
if (chip->mode == MAX8997_EXTERNAL_MODE) if (chip->mode == MAX8997_EXTERNAL_MODE)
pwm_free(chip->pwm); pwm_put(chip->pwm);
kfree(chip); kfree(chip);
......
...@@ -110,8 +110,6 @@ enum max8997_haptic_pwm_divisor { ...@@ -110,8 +110,6 @@ enum max8997_haptic_pwm_divisor {
/** /**
* max8997_haptic_platform_data * 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 * @pwm_period: period in nano second for PWM device
* valid for MAX8997_EXTERNAL_MODE * valid for MAX8997_EXTERNAL_MODE
* @type: motor type * @type: motor type
...@@ -128,7 +126,6 @@ enum max8997_haptic_pwm_divisor { ...@@ -128,7 +126,6 @@ enum max8997_haptic_pwm_divisor {
* [0 - 255]: available period * [0 - 255]: available period
*/ */
struct max8997_haptic_platform_data { struct max8997_haptic_platform_data {
unsigned int pwm_channel_id;
unsigned int pwm_period; unsigned int pwm_period;
enum max8997_haptic_motor_type type; enum max8997_haptic_motor_type type;
......
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