Commit 20029c8c authored by Iván Briano's avatar Iván Briano Committed by Andrew Boie
Browse files

pwm: Remove suspend and resume hooks from pwm_driver_api



Drivers that implement power management should use the preferred
device_pm_ops method instead.

Change-Id: Ice9e0469a1fcb50eb64dcb240dddea56755b6e84
Signed-off-by: default avatarIván Briano <ivan.briano@intel.com>
parent 6e367c4d
Loading
Loading
Loading
Loading
+0 −16
Original line number Diff line number Diff line
@@ -203,26 +203,10 @@ static int pwm_dw_set_duty_cycle(struct device *dev, int access_op,
	return -ENOTSUP;
}

static int pwm_dw_suspend(struct device *dev)
{
	ARG_UNUSED(dev);

	return -ENOTSUP;
}

static int pwm_dw_resume(struct device *dev)
{
	ARG_UNUSED(dev);

	return -ENOTSUP;
}

static struct pwm_driver_api pwm_dw_drv_api_funcs = {
	.config = pwm_dw_configure,
	.set_values = pwm_dw_set_values,
	.set_duty_cycle = pwm_dw_set_duty_cycle,
	.suspend = pwm_dw_suspend,
	.resume = pwm_dw_resume,
};

/**
+0 −7
Original line number Diff line number Diff line
@@ -704,18 +704,11 @@ static int pwm_ftm_resume(struct device *dev, int pm_policy)

DEFINE_DEVICE_PM_OPS(pwm, pwm_ftm_suspend, pwm_ftm_resume);

static int toberemoved(struct device *dev)
{
	return 0;
}

static struct pwm_driver_api pwm_ftm_drv_api_funcs = {
	.config = pwm_ftm_configure,
	.set_values = pwm_ftm_set_values,
	.set_duty_cycle = pwm_ftm_set_duty_cycle,
	.set_phase = pwm_ftm_set_phase,
	.suspend = toberemoved,
	.resume = toberemoved,
};

/**
+0 −20
Original line number Diff line number Diff line
@@ -156,30 +156,10 @@ static int pwm_pca9685_set_duty_cycle(struct device *dev, int access_op,
	return pwm_pca9685_set_values(dev, access_op, pwm, on, off);
}

static int pwm_pca9685_suspend(struct device *dev)
{
	if (!_has_i2c_master(dev)) {
		return -EINVAL;
	}

	return -ENOTSUP;
}

static int pwm_pca9685_resume(struct device *dev)
{
	if (!_has_i2c_master(dev)) {
		return -EINVAL;
	}

	return -ENOTSUP;
}

static struct pwm_driver_api pwm_pca9685_drv_api_funcs = {
	.config = pwm_pca9685_configure,
	.set_values = pwm_pca9685_set_values,
	.set_duty_cycle = pwm_pca9685_set_duty_cycle,
	.suspend = pwm_pca9685_suspend,
	.resume = pwm_pca9685_resume,
};

/**
+0 −31
Original line number Diff line number Diff line
@@ -294,43 +294,12 @@ static int pwm_qmsi_set_duty_cycle(struct device *dev, int access_op,
	return 0;
}

/*
 * Set the PWM IP block suspended/low power state
 * In this case, the PWN does not support power state handling
 *
 * Parameters
 * dev: Device struct
 * return -ENOTSUP
 */
static int pwm_qmsi_suspend(struct device *dev)
{
	ARG_UNUSED(dev);

	return -ENOTSUP;
}

/*
 * Bring back the PWM IP block from suspended/low power state
 * In this case, the PWN does not support power state handling
 *
 * Parameters
 * dev: Device struct
 * return -ENOTSUP
 */
static int pwm_qmsi_resume(struct device *dev)
{
	ARG_UNUSED(dev);

	return -ENOTSUP;
}

static struct pwm_driver_api pwm_qmsi_drv_api_funcs = {
	.config = pwm_qmsi_configure,
	.set_values = pwm_qmsi_set_values,
	.set_period = pwm_qmsi_set_period,
	.set_duty_cycle = pwm_qmsi_set_duty_cycle,
	.suspend = pwm_qmsi_suspend,
	.resume = pwm_qmsi_resume,
};

static int pwm_qmsi_init(struct device *dev)
+0 −49
Original line number Diff line number Diff line
@@ -73,20 +73,6 @@ typedef int (*pwm_set_duty_cycle_t)(struct device *dev, int access_op,
typedef int (*pwm_set_phase_t)(struct device *dev, int access_op,
			       uint32_t pwm, uint8_t phase);

/**
 * @typedef pwm_suspend_dev_t
 * @brief Callback API upon suspending
 * See @a pwm_suspend() for argument description
 */
typedef int (*pwm_suspend_dev_t)(struct device *dev);

/**
 * @typedef pwm_resume_dev_t
 * @brief Callback API upon resuming
 * See @a pwm_resume() for argument description
 */
typedef int (*pwm_resume_dev_t)(struct device *dev);

/**
 * @typedef pwm_set_period_t
 * @brief Callback API upon setting the period
@@ -102,8 +88,6 @@ struct pwm_driver_api {
	pwm_set_period_t set_period;
	pwm_set_duty_cycle_t set_duty_cycle;
	pwm_set_phase_t set_phase;
	pwm_suspend_dev_t suspend;
	pwm_resume_dev_t resume;
};

/**
@@ -315,39 +299,6 @@ static inline int pwm_all_set_phase(struct device *dev, uint8_t phase)
	return -ENOTSUP;
}

/**
 * @brief Save the state of the device and makes it go to the low power
 *	  state.
 *
 * @param dev Pointer to the device structure for the driver instance.
 *
 * @retval 0 If successful.
 * @retval Negative errno code if failure.
 */
static inline int pwm_suspend(struct device *dev)
{
	struct pwm_driver_api *api;

	api = (struct pwm_driver_api *)dev->driver_api;
	return api->suspend(dev);
}

/**
 * @brief Restore state stored during suspend and resumes operation.
 *
 * @param dev Pointer to the device structure for the driver instance.
 *
 * @retval 0 If successful.
 * @retval Negative errno code if failure.
 */
static inline int pwm_resume(struct device *dev)
{
	struct pwm_driver_api *api;

	api = (struct pwm_driver_api *)dev->driver_api;
	return api->resume(dev);
}

#ifdef __cplusplus
}
#endif