pwm: dwc: allow suspend/resume for 16 channels
PATCH v2 1/1 pwm: dwc: allow suspend/resume for 16 channels
With 16 channel pwm support, we're registering two instances of pwm_chip with 8 channels each. We need to update PM functions to use both instances of pwm_chip during power state transitions.
Introduce struct dwc_pwm_drvdata and use it as driver_data, which will maintain both instances of pwm_chip along with dwc_pwm_info and allow us to use them inside suspend/resume handles.
---
Changes since v1:
- Drop error message for -ENOMEM
- s/data/ddata/
drivers/pwm/pwm-dwc-core.c | 1 - drivers/pwm/pwm-dwc.c | 82 +++++++++++++++++++++++++------------- drivers/pwm/pwm-dwc.h | 6 +++ 3 files changed, 60 insertions(+), 29 deletions(-)
drivers/pwm/pwm-dwc-core.c +0 -1
@@ -172,7 +172,6 @@ struct pwm_chip *dwc_pwm_alloc(struct device *dev) dwc->clk_ns =10 ; chip->ops = &dwc_pwm_ops; -dev_set_drvdata (dev, chip);return chip; }EXPORT_SYMBOL_GPL (dwc_pwm_alloc);
drivers/pwm/pwm-dwc.c +54 -28
130 lines not on this page · raw message
drivers/pwm/pwm-dwc.h +6 -0
@@ -38,6 +38,12 @@ struct dwc_pwm_info {unsigned int size; }; +struct dwc_pwm_drvdata { +const struct dwc_pwm_info *info; +void __iomem *io_base; +struct pwm_chip *chips[]; +}; +struct dwc_pwm_ctx {u32 cnt;u32 cnt2;
Signature · 1 line
2.35.3
Quoted 7 lines · Raag Jadav
With 16 channel pwm support, we're registering two instances of
pwm_chipwith 8 channels each. We need to update PM functions to use both instances ofpwm_chipduring power state transitions.Introduce struct
dwc_pwm_drvdataand use it asdriver_data, which will maintain both instances ofpwm_chipalong withdwc_pwm_infoand allow us to use them inside suspend/resume handles.
FWIW,
Signature · 2 lines
With Best Regards, Andy Shevchenko
Hello,
Quoted 8 lines · Raag Jadav
With 16 channel pwm support, we're registering two instances of
pwm_chipwith 8 channels each. We need to update PM functions to use both instances ofpwm_chipduring power state transitions.Introduce struct
dwc_pwm_drvdataand use it asdriver_data, which will maintain both instances ofpwm_chipalong withdwc_pwm_infoand allow us to use them inside suspend/resume handles.
Quoted 6 lines
Fixes ebf2c89eb95e ("pwm: dwc: Add 16 channel support for Intel Elkhart Lake")Signed-off-by Raag Jadav <[email protected]>---
Changes since v1:
- Drop error message for-ENOMEM
- s/data/ddata/
Thanks for addressing these concerns. I applied this patch to
https://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux.git pwm/for-next now.
I consider sending this to Linus before v6.9, but I'd let it cook in next a few days before doing so.
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | https://www.pengutronix.de/ |