Re: [PATCH v4] pwm: renesas-tpu: Add suspend/resume function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dear Morimoto-san,

Thank for your feedback!

On 2019/05/27 10:24, Kuninori Morimoto wrote:
Hi

This patch adds suspend/resume function support for Renesas the 16-Bit Timer
Pulse Unit (TPU) driver. This has been tested on the Salvator-XS board
with R-Car M3-N and H3 at renesas-drivers-2019-05-21-v5.2-rc1 tag.
I expect this to work on other SoCs.
(snip)
+#ifdef CONFIG_PM_SLEEP
+static int tpu_pwm_suspend(struct device *dev)
+{
+	struct tpu_device *tpu = dev_get_drvdata(dev);
+	struct pwm_chip *chip = &tpu->chip;
+	struct pwm_device *pwm;
+	int i;
+
+	for (i = 0; i < TPU_CHANNEL_MAX; i++) {
+		pwm = &chip->pwms[i];
+		if (pwm_is_enabled(pwm)) {
+			if (!test_bit(PWMF_REQUESTED, &pwm->flags))
+				return 0;
+			tpu_pwm_disable(pwm->chip,pwm);
+		}
+	}
I'm not familiar with pwm driver, but pwm_is_enabled() and
if (!test_bit(PWMF_REQUESTED, &pwm->flags)) can be happen in the same time ?
In other words, can we enable pwm without PWMF_REQUESTED ?

Thank for your help!
Can. Perhaps the PWMF_REQUESTED check is not necessary. I will remove it.

+static int tpu_pwm_resume(struct device *dev)
+{
+	struct tpu_device *tpu = dev_get_drvdata(dev);
+	struct pwm_chip *chip = &tpu->chip;
+	struct pwm_device *pwm;
+	int i;
+
+	for (i = 0; i < TPU_CHANNEL_MAX; i++) {
+		pwm = &chip->pwms[i];
+		if (pwm_is_enabled(pwm)) {
+			if (!test_bit(PWMF_REQUESTED, &pwm->flags))
+				return 0;
+			tpu_pwm_enable(pwm->chip,pwm);
+		}
+	}
Please use ${LINUX}/scripts/checkpatch.pl

Thanks for the prompt!

Thank you,
Dong

Thank you for your help !!
Best regards
---
Kuninori Morimoto



[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux