diff --git a/0001-pwm-lpss-Fix-get_state-runtime-pm-reference-handling.patch b/0001-pwm-lpss-Fix-get_state-runtime-pm-reference-handling.patch new file mode 100644 index 000000000..1e07d8e45 --- /dev/null +++ b/0001-pwm-lpss-Fix-get_state-runtime-pm-reference-handling.patch @@ -0,0 +1,100 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Tue, 12 May 2020 00:39:24 +0200 +Subject: [PATCH] pwm: lpss: Fix get_state runtime-pm reference handling + +Before commit cfc4c189bc70 ("pwm: Read initial hardware state at request +time"), a driver's get_state callback would get called once per PWM from +pwmchip_add(). + +pwm-lpss' runtime-pm code was relying on this, getting a runtime-pm ref for +PWMs which are enabled at probe time from within its get_state callback, +before enabling runtime-pm. + +The change to calling get_state at request time causes a number of +problems: + +1. PWMs enabled at probe time may get runtime suspended before they are +requested, causing e.g. a LCD backlight controlled by the PWM to turn off. + +2. When the request happens when the PWM has been runtime suspended, the +ctrl register will read all 1 / 0xffffffff, causing get_state to store +bogus values in the pwm_state. + +3. get_state was using an async pm_runtime_get() call, because it assumed +that runtime-pm has not been enabled yet. If shortly after the request an +apply call is made, then the pwm_lpss_is_updating() check may trigger +because the resume triggered by the pm_runtime_get() call is not complete +yet, so the ctrl register still reads all 1 / 0xffffffff. + +This commit fixes these issues by moving the initial pm_runtime_get() call +for PWMs which are enabled at probe time to the pwm_lpss_probe() function; +and by making get_state take a runtime-pm ref before reading the ctrl reg. + +BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1828927 +Fixes: cfc4c189bc70 ("pwm: Read initial hardware state at request time") +Cc: stable@vger.kernel.org +Reviewed-by: Andy Shevchenko +Signed-off-by: Hans de Goede +Upstream Status: https://lore.kernel.org/linux-acpi/5f15f6bc-8650-d86e-893f-0d41557c57c7@redhat.com/ +--- + drivers/pwm/pwm-lpss.c | 15 +++++++++++---- + 1 file changed, 11 insertions(+), 4 deletions(-) + +diff --git a/drivers/pwm/pwm-lpss.c b/drivers/pwm/pwm-lpss.c +index 75bbfe5f3bc2..9d965ffe66d1 100644 +--- a/drivers/pwm/pwm-lpss.c ++++ b/drivers/pwm/pwm-lpss.c +@@ -158,7 +158,6 @@ static int pwm_lpss_apply(struct pwm_chip *chip, struct pwm_device *pwm, + return 0; + } + +-/* This function gets called once from pwmchip_add to get the initial state */ + static void pwm_lpss_get_state(struct pwm_chip *chip, struct pwm_device *pwm, + struct pwm_state *state) + { +@@ -167,6 +166,8 @@ static void pwm_lpss_get_state(struct pwm_chip *chip, struct pwm_device *pwm, + unsigned long long base_unit, freq, on_time_div; + u32 ctrl; + ++ pm_runtime_get_sync(chip->dev); ++ + base_unit_range = BIT(lpwm->info->base_unit_bits); + + ctrl = pwm_lpss_read(pwm); +@@ -187,8 +188,7 @@ static void pwm_lpss_get_state(struct pwm_chip *chip, struct pwm_device *pwm, + state->polarity = PWM_POLARITY_NORMAL; + state->enabled = !!(ctrl & PWM_ENABLE); + +- if (state->enabled) +- pm_runtime_get(chip->dev); ++ pm_runtime_put(chip->dev); + } + + static const struct pwm_ops pwm_lpss_ops = { +@@ -202,7 +202,8 @@ struct pwm_lpss_chip *pwm_lpss_probe(struct device *dev, struct resource *r, + { + struct pwm_lpss_chip *lpwm; + unsigned long c; +- int ret; ++ int i, ret; ++ u32 ctrl; + + if (WARN_ON(info->npwm > MAX_PWMS)) + return ERR_PTR(-ENODEV); +@@ -232,6 +233,12 @@ struct pwm_lpss_chip *pwm_lpss_probe(struct device *dev, struct resource *r, + return ERR_PTR(ret); + } + ++ for (i = 0; i < lpwm->info->npwm; i++) { ++ ctrl = pwm_lpss_read(&lpwm->chip.pwms[i]); ++ if (ctrl & PWM_ENABLE) ++ pm_runtime_get(dev); ++ } ++ + return lpwm; + } + EXPORT_SYMBOL_GPL(pwm_lpss_probe); +-- +2.26.2 + diff --git a/Patchlist b/Patchlist index 0d8731577..dce4d5125 100644 --- a/Patchlist +++ b/Patchlist @@ -73,3 +73,4 @@ 0001-arm64-allwinner-dts-a64-add-LCD-related-device-nodes.patch 0001-e1000e-bump-up-timeout-to-wait-when-ME-un-configure-.patch 0001-perf-cs-etm-Move-defined-of-traceid_list.patch +0001-pwm-lpss-Fix-get_state-runtime-pm-reference-handling.patch diff --git a/kernel.spec b/kernel.spec index a257ee745..f6c56398f 100644 --- a/kernel.spec +++ b/kernel.spec @@ -30,7 +30,7 @@ Summary: The Linux kernel # For a stable, released kernel, released_kernel should be 1. %global released_kernel 0 -%global distro_build 0.rc6.1 +%global distro_build 0.rc6.20200519git642b151f45dd.1 %if 0%{?fedora} %define secure_boot_arch x86_64 @@ -69,10 +69,10 @@ Summary: The Linux kernel %endif %define rpmversion 5.7.0 -%define pkgrelease 0.rc6.1 +%define pkgrelease 0.rc6.20200519git642b151f45dd.1 # allow pkg_release to have configurable %%{?dist} tag -%define specrelease 0.rc6.1%{?buildid}%{?dist} +%define specrelease 0.rc6.20200519git642b151f45dd.1%{?buildid}%{?dist} %define pkg_release %{specrelease} @@ -163,7 +163,7 @@ Summary: The Linux kernel # Set debugbuildsenabled to 1 for production (build separate debug kernels) # and 0 for rawhide (all kernels are debug kernels). # See also 'make debug' and 'make release'. -%define debugbuildsenabled 1 +%define debugbuildsenabled 0 # The kernel tarball/base version %define kversion 5.7 @@ -564,7 +564,7 @@ BuildRequires: asciidoc # exact git commit you can run # # xzcat -qq ${TARBALL} | git get-tar-commit-id -Source0: linux-5.7-rc6.tar.xz +Source0: linux-20200519git642b151f45dd.tar.xz Source1: Makefile.rhelver @@ -778,6 +778,7 @@ Patch73: 0001-drm-sun4i-sun6i_mipi_dsi-fix-horizontal-timing-calcu.patch Patch74: 0001-arm64-allwinner-dts-a64-add-LCD-related-device-nodes.patch Patch75: 0001-e1000e-bump-up-timeout-to-wait-when-ME-un-configure-.patch Patch76: 0001-perf-cs-etm-Move-defined-of-traceid_list.patch +Patch77: 0001-pwm-lpss-Fix-get_state-runtime-pm-reference-handling.patch %endif @@ -1273,8 +1274,8 @@ ApplyOptionalPatch() fi } -%setup -q -n kernel-5.7-rc6 -c -mv linux-5.7-rc6 linux-%{KVERREL} +%setup -q -n kernel-20200519git642b151f45dd -c +mv linux-20200519git642b151f45dd linux-%{KVERREL} cd linux-%{KVERREL} cp -a %{SOURCE1} . @@ -1356,6 +1357,7 @@ ApplyOptionalPatch 0001-drm-sun4i-sun6i_mipi_dsi-fix-horizontal-timing-calcu.pat ApplyOptionalPatch 0001-arm64-allwinner-dts-a64-add-LCD-related-device-nodes.patch ApplyOptionalPatch 0001-e1000e-bump-up-timeout-to-wait-when-ME-un-configure-.patch ApplyOptionalPatch 0001-perf-cs-etm-Move-defined-of-traceid_list.patch +ApplyOptionalPatch 0001-pwm-lpss-Fix-get_state-runtime-pm-reference-handling.patch %endif @@ -2764,6 +2766,11 @@ fi # # %changelog +* Tue May 19 2020 CKI@GitLab [5.7.0-0.rc6.20200519git642b151f45dd.1] +- 642b151f45dd rebase +- pwm: lpss: Fix get_state runtime-pm reference handling (Hans de Goede) +- Updated changelog for the release based on v5.7-rc6 ("CKI@GitLab") + * Mon May 18 2020 CKI@GitLab [5.7.0-0.rc6.1] - v5.7-rc6 rebase - Updated changelog for the release based on 3d1c1e5931ce ("CKI@GitLab") diff --git a/sources b/sources index 381368672..098b68f51 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ -SHA512 (linux-5.7-rc6.tar.xz) = d21840e703ddbabd3ceda552c04808fc0239a850135b18400e1c5f46d1d92109028ce191df9927f21cb660e97ee5c7026cc6b3813d793eb856a81738b9376af7 -SHA512 (kernel-abi-whitelists-5.7.0-0.rc6.1.tar.bz2) = 7ca35d40b774ebb45b297085c8ddf00651ee6d02b08e32ac3e159562fc8fdb1e04b600e1743f7a6f976d7f739f223b8c4a48f3850e4e2ea8260cb77a0da37dac -SHA512 (kernel-kabi-dw-5.7.0-0.rc6.1.tar.bz2) = 1ba26e33a7cee13ba8cd5967fcce2aea07da0cc213d587ddba10c558fcc6a7de4972efe6f32e3d2b3e3a949db8b425eb7aad0ba4d5db32da965d79b0029ed528 +SHA512 (linux-20200519git642b151f45dd.tar.xz) = e4710e40f931d6ca21e7f8f77c091df48c008d67b0a39a03d074edcbce72014ffc592da799d91a3e1b878c00167a3cbb9b9331223ab1b3405e63ddc5708a30a1 +SHA512 (kernel-abi-whitelists-5.7.0-0.rc6.20200519git642b151f45dd.1.tar.bz2) = 78633c9dfaff23aad3bc36056b4d20e9e797583107ab6a5670fede003656ed4f0fc53031ffe05ae79a493508db7c04946f2495451f6e363609332eba75ed56f6 +SHA512 (kernel-kabi-dw-5.7.0-0.rc6.20200519git642b151f45dd.1.tar.bz2) = 7cc0a9b5c1240b95a25b634f43878360655e7aa92bd80c576c0d2df598ad8fe352f01c7318eb1b0be3749378417207e808f509a4fe77bcd9152d6261621801b3