From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: stable@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
patches@lists.linux.dev, Heiner Kallweit <hkallweit1@gmail.com>,
Martin Blumenstingl <martin.blumenstingl@googlemail.com>,
Ulf Hansson <ulf.hansson@linaro.org>,
Sasha Levin <sashal@kernel.org>
Subject: [PATCH 6.1 096/107] mmc: core: add helpers mmc_regulator_enable/disable_vqmmc
Date: Tue, 5 Dec 2023 12:17:11 +0900 [thread overview]
Message-ID: <20231205031537.731316037@linuxfoundation.org> (raw)
In-Reply-To: <20231205031531.426872356@linuxfoundation.org>
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiner Kallweit <hkallweit1@gmail.com>
[ Upstream commit 8d91f3f8ae57e6292142ca89f322e90fa0d6ac02 ]
There's a number of drivers (e.g. dw_mmc, meson-gx, mmci, sunxi) using
the same mechanism and a private flag vqmmc_enabled to deal with
enabling/disabling the vqmmc regulator.
Move this to the core and create new helpers mmc_regulator_enable_vqmmc
and mmc_regulator_disable_vqmmc.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Link: https://lore.kernel.org/r/71586432-360f-9b92-17f6-b05a8a971bc2@gmail.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Stable-dep-of: 477865af60b2 ("mmc: sdhci-sprd: Fix vqmmc not shutting down after the card was pulled")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/mmc/core/regulator.c | 41 ++++++++++++++++++++++++++++++++++++
include/linux/mmc/host.h | 3 +++
2 files changed, 44 insertions(+)
diff --git a/drivers/mmc/core/regulator.c b/drivers/mmc/core/regulator.c
index 609201a467ef9..4dcbc2281d2b5 100644
--- a/drivers/mmc/core/regulator.c
+++ b/drivers/mmc/core/regulator.c
@@ -271,3 +271,44 @@ int mmc_regulator_get_supply(struct mmc_host *mmc)
return 0;
}
EXPORT_SYMBOL_GPL(mmc_regulator_get_supply);
+
+/**
+ * mmc_regulator_enable_vqmmc - enable VQMMC regulator for a host
+ * @mmc: the host to regulate
+ *
+ * Returns 0 or errno. Enables the regulator for vqmmc.
+ * Keeps track of the enable status for ensuring that calls to
+ * regulator_enable/disable are balanced.
+ */
+int mmc_regulator_enable_vqmmc(struct mmc_host *mmc)
+{
+ int ret = 0;
+
+ if (!IS_ERR(mmc->supply.vqmmc) && !mmc->vqmmc_enabled) {
+ ret = regulator_enable(mmc->supply.vqmmc);
+ if (ret < 0)
+ dev_err(mmc_dev(mmc), "enabling vqmmc regulator failed\n");
+ else
+ mmc->vqmmc_enabled = true;
+ }
+
+ return ret;
+}
+EXPORT_SYMBOL_GPL(mmc_regulator_enable_vqmmc);
+
+/**
+ * mmc_regulator_disable_vqmmc - disable VQMMC regulator for a host
+ * @mmc: the host to regulate
+ *
+ * Returns 0 or errno. Disables the regulator for vqmmc.
+ * Keeps track of the enable status for ensuring that calls to
+ * regulator_enable/disable are balanced.
+ */
+void mmc_regulator_disable_vqmmc(struct mmc_host *mmc)
+{
+ if (!IS_ERR(mmc->supply.vqmmc) && mmc->vqmmc_enabled) {
+ regulator_disable(mmc->supply.vqmmc);
+ mmc->vqmmc_enabled = false;
+ }
+}
+EXPORT_SYMBOL_GPL(mmc_regulator_disable_vqmmc);
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 8fdd3cf971a30..8f918f9a1228d 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -450,6 +450,7 @@ struct mmc_host {
unsigned int retune_paused:1; /* re-tuning is temporarily disabled */
unsigned int retune_crc_disable:1; /* don't trigger retune upon crc */
unsigned int can_dma_map_merge:1; /* merging can be used */
+ unsigned int vqmmc_enabled:1; /* vqmmc regulator is enabled */
int rescan_disable; /* disable card detection */
int rescan_entered; /* used with nonremovable devices */
@@ -597,6 +598,8 @@ static inline int mmc_regulator_set_vqmmc(struct mmc_host *mmc,
#endif
int mmc_regulator_get_supply(struct mmc_host *mmc);
+int mmc_regulator_enable_vqmmc(struct mmc_host *mmc);
+void mmc_regulator_disable_vqmmc(struct mmc_host *mmc);
static inline int mmc_card_is_removable(struct mmc_host *host)
{
--
2.42.0
next prev parent reply other threads:[~2023-12-05 3:34 UTC|newest]
Thread overview: 120+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-05 3:15 [PATCH 6.1 000/107] 6.1.66-rc1 review Greg Kroah-Hartman
2023-12-05 3:15 ` [PATCH 6.1 001/107] cifs: Fix FALLOC_FL_ZERO_RANGE by setting i_size if EOF moved Greg Kroah-Hartman
2023-12-05 3:15 ` [PATCH 6.1 002/107] cifs: Fix FALLOC_FL_INSERT_RANGE by setting i_size after " Greg Kroah-Hartman
2023-12-05 3:15 ` [PATCH 6.1 003/107] smb: client: report correct st_size for SMB and NFS symlinks Greg Kroah-Hartman
2023-12-05 3:15 ` [PATCH 6.1 004/107] pinctrl: avoid reload of p state in list iteration Greg Kroah-Hartman
2023-12-05 3:15 ` [PATCH 6.1 005/107] firewire: core: fix possible memory leak in create_units() Greg Kroah-Hartman
2023-12-05 3:15 ` [PATCH 6.1 006/107] mmc: sdhci-pci-gli: Disable LPM during initialization Greg Kroah-Hartman
2023-12-05 3:15 ` [PATCH 6.1 007/107] mmc: cqhci: Increase recovery halt timeout Greg Kroah-Hartman
2023-12-05 3:15 ` [PATCH 6.1 008/107] mmc: cqhci: Warn of halt or task clear failure Greg Kroah-Hartman
2023-12-05 3:15 ` [PATCH 6.1 009/107] mmc: cqhci: Fix task clearing in CQE error recovery Greg Kroah-Hartman
2023-12-05 3:15 ` [PATCH 6.1 010/107] mmc: block: Retry commands " Greg Kroah-Hartman
2023-12-05 3:15 ` [PATCH 6.1 011/107] mmc: block: Do not lose cache flush during " Greg Kroah-Hartman
2023-12-05 3:15 ` [PATCH 6.1 012/107] mmc: block: Be sure to wait while busy in " Greg Kroah-Hartman
2023-12-05 3:15 ` [PATCH 6.1 013/107] ALSA: hda: Disable power-save on KONTRON SinglePC Greg Kroah-Hartman
2023-12-05 3:15 ` [PATCH 6.1 014/107] ALSA: hda/realtek: Headset Mic VREF to 100% Greg Kroah-Hartman
2023-12-05 3:15 ` [PATCH 6.1 015/107] ALSA: hda/realtek: Add supported ALC257 for ChromeOS Greg Kroah-Hartman
2023-12-05 3:15 ` [PATCH 6.1 016/107] dm-verity: align struct dm_verity_fec_io properly Greg Kroah-Hartman
2023-12-05 3:15 ` [PATCH 6.1 017/107] scsi: Change SCSI device boolean fields to single bit flags Greg Kroah-Hartman
2023-12-05 3:15 ` [PATCH 6.1 018/107] scsi: sd: Fix system start for ATA devices Greg Kroah-Hartman
2023-12-05 3:15 ` [PATCH 6.1 019/107] drm/amd: Enable PCIe PME from D3 Greg Kroah-Hartman
2023-12-05 3:15 ` [PATCH 6.1 020/107] drm/amdgpu: Force order between a read and write to the same address Greg Kroah-Hartman
2023-12-05 3:15 ` [PATCH 6.1 021/107] drm/amd/display: Include udelay when waiting for INBOX0 ACK Greg Kroah-Hartman
2023-12-05 3:15 ` [PATCH 6.1 022/107] drm/amd/display: Remove min_dst_y_next_start check for Z8 Greg Kroah-Hartman
2023-12-05 3:15 ` [PATCH 6.1 023/107] drm/amd/display: Use DRAM speed from validation for dummy p-state Greg Kroah-Hartman
2023-12-05 3:15 ` [PATCH 6.1 024/107] drm/amd/display: Update min Z8 residency time to 2100 for DCN314 Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 025/107] drm/amd/display: fix ABM disablement Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 026/107] dm verity: initialize fec io before freeing it Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 027/107] dm verity: dont perform FEC for failed readahead IO Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 028/107] nvme: check for valid nvme_identify_ns() before using it Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 029/107] powercap: DTPM: Fix unneeded conversions to micro-Watts Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 030/107] cpufreq/amd-pstate: Fix the return value of amd_pstate_fast_switch() Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 031/107] dma-buf: fix check in dma_resv_add_fence Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 032/107] bcache: revert replacing IS_ERR_OR_NULL with IS_ERR Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 033/107] iommu/vt-d: Add MTL to quirk list to skip TE disabling Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 034/107] KVM: PPC: Book3S HV: Fix KVM_RUN clobbering FP/VEC user registers Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 035/107] powerpc: Dont clobber f0/vs0 during fp|altivec register save Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 036/107] parisc: Mark ex_table entries 32-bit aligned in assembly.h Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 037/107] parisc: Mark ex_table entries 32-bit aligned in uaccess.h Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 038/107] parisc: Use natural CPU alignment for bug_table Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 039/107] parisc: Mark lock_aligned variables 16-byte aligned on SMP Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 040/107] parisc: Drop the HP-UX ENOSYM and EREMOTERELEASE error codes Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 041/107] parisc: Mark jump_table naturally aligned Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 042/107] parisc: Ensure 32-bit alignment on parisc unwind section Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 043/107] parisc: Mark altinstructions read-only and 32-bit aligned Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 044/107] btrfs: add dmesg output for first mount and last unmount of a filesystem Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 045/107] btrfs: ref-verify: fix memory leaks in btrfs_ref_tree_mod() Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 046/107] btrfs: fix off-by-one when checking chunk map includes logical address Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 047/107] btrfs: send: ensure send_fd is writable Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 048/107] btrfs: make error messages more clear when getting a chunk map Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 049/107] btrfs: fix 64bit compat send ioctl arguments not initializing version member Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 050/107] Input: xpad - add HyperX Clutch Gladiate Support Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 051/107] auxdisplay: hd44780: move cursor home after clear display command Greg Kroah-Hartman
2023-12-06 0:33 ` Miguel Ojeda
2023-12-05 3:16 ` [PATCH 6.1 052/107] serial: sc16is7xx: Put IOControl register into regmap_volatile Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 053/107] serial: sc16is7xx: add missing support for rs485 devicetree properties Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 054/107] wifi: cfg80211: fix CQM for non-range use Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 055/107] USB: xhci-plat: fix legacy PHY double init Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 056/107] USB: core: Change configuration warnings to notices Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 057/107] usb: config: fix iteration issue in usb_get_bos_descriptor() Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 058/107] ipv4: igmp: fix refcnt uaf issue when receiving igmp query packet Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 059/107] dpaa2-eth: increase the needed headroom to account for alignment Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 060/107] uapi: propagate __struct_group() attributes to the container union Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 061/107] selftests/net: ipsec: fix constant out of range Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 062/107] selftests/net: fix a char signedness issue Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 063/107] selftests/net: unix: fix unused variable compiler warning Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 064/107] selftests/net: mptcp: fix uninitialized variable warnings Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 065/107] octeontx2-af: Fix possible buffer overflow Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 066/107] net: stmmac: xgmac: Disable FPE MMC interrupts Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 067/107] octeontx2-pf: Fix adding mbox work queue entry when num_vfs > 64 Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 068/107] octeontx2-af: Install TC filter rules in hardware based on priority Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 069/107] octeontx2-pf: Restore TC ingress police rules when interface is up Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 070/107] r8169: prevent potential deadlock in rtl8169_close Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 071/107] ravb: Fix races between ravb_tx_timeout_work() and net related ops Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 072/107] net: ravb: Check return value of reset_control_deassert() Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 073/107] net: ravb: Use pm_runtime_resume_and_get() Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 074/107] net: ravb: Make write access to CXR35 first before accessing other EMAC registers Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 075/107] net: ravb: Start TX queues after HW initialization succeeded Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 076/107] net: ravb: Stop DMA in case of failures on ravb_open() Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 077/107] net: ravb: Keep reverse order of operations in ravb_remove() Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 078/107] KVM: x86: Fix lapic timer interrupt lost after loading a snapshot Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 079/107] PCI: Lengthen reset delay for VideoPropulsion Torrent QN16e card Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 080/107] powerpc/pseries/iommu: enable_ddw incorrectly returns direct mapping for SR-IOV device Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 081/107] s390/cmma: fix handling of swapper_pg_dir and invalid_pg_dir Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 082/107] PCI: qcom-ep: Add dedicated callback for writing to DBI2 registers Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 083/107] fbdev: stifb: Make the STI next font pointer a 32-bit signed offset Greg Kroah-Hartman
2023-12-05 3:16 ` [PATCH 6.1 084/107] drivers: perf: Check find_first_bit() return value Greg Kroah-Hartman
2023-12-05 10:46 ` Conor Dooley
2023-12-05 18:25 ` Greg Kroah-Hartman
2023-12-05 3:17 ` [PATCH 6.1 085/107] spi: Fix null dereference on suspend Greg Kroah-Hartman
2023-12-05 3:17 ` [PATCH 6.1 086/107] drm/amd/display: Restore rptr/wptr for DMCUB as workaround Greg Kroah-Hartman
2023-12-05 3:17 ` [PATCH 6.1 087/107] drm/amd/display: Guard against invalid RPTR/WPTR being set Greg Kroah-Hartman
2023-12-05 3:17 ` [PATCH 6.1 088/107] cpufreq: imx6q: dont warn for disabling a non-existing frequency Greg Kroah-Hartman
2023-12-05 3:17 ` [PATCH 6.1 089/107] cpufreq: imx6q: Dont disable 792 Mhz OPP unnecessarily Greg Kroah-Hartman
2023-12-05 3:17 ` [PATCH 6.1 090/107] iommu/vt-d: Omit devTLB invalidation requests when TES=0 Greg Kroah-Hartman
2023-12-05 3:17 ` [PATCH 6.1 091/107] iommu/vt-d: Allocate pasid table in device probe path Greg Kroah-Hartman
2023-12-05 3:17 ` [PATCH 6.1 092/107] iommu/vt-d: Add device_block_translation() helper Greg Kroah-Hartman
2023-12-05 3:17 ` [PATCH 6.1 093/107] iommu/vt-d: Disable PCI ATS in legacy passthrough mode Greg Kroah-Hartman
2023-12-05 3:17 ` [PATCH 6.1 094/107] iommu/vt-d: Make context clearing consistent with context mapping Greg Kroah-Hartman
2023-12-05 3:17 ` [PATCH 6.1 095/107] drm/amd/pm: fix a memleak in aldebaran_tables_init Greg Kroah-Hartman
2023-12-05 3:17 ` Greg Kroah-Hartman [this message]
2023-12-05 3:17 ` [PATCH 6.1 097/107] mmc: sdhci-sprd: Fix vqmmc not shutting down after the card was pulled Greg Kroah-Hartman
2023-12-05 3:17 ` [PATCH 6.1 098/107] drm/amd/display: Expand kernel doc for DC Greg Kroah-Hartman
2023-12-05 3:17 ` [PATCH 6.1 099/107] drm/amd/display: clean code-style issues in dcn30_set_mpc_shaper_3dlut Greg Kroah-Hartman
2023-12-05 3:17 ` [PATCH 6.1 100/107] drm/amd/display: Fix the delta clamping for shaper LUT Greg Kroah-Hartman
2023-12-05 3:17 ` [PATCH 6.1 101/107] drm/amd/display: Fix MPCC 1DLUT programming Greg Kroah-Hartman
2023-12-05 3:17 ` [PATCH 6.1 102/107] r8169: disable ASPM in case of tx timeout Greg Kroah-Hartman
2023-12-05 3:17 ` [PATCH 6.1 103/107] r8169: fix deadlock on RTL8125 in jumbo mtu mode Greg Kroah-Hartman
2023-12-05 3:17 ` [PATCH 6.1 104/107] xen: Allow platform PCI interrupt to be shared Greg Kroah-Hartman
2023-12-05 3:17 ` [PATCH 6.1 105/107] xen: simplify evtchn_do_upcall() call maze Greg Kroah-Hartman
2023-12-05 3:17 ` [PATCH 6.1 106/107] x86/xen: fix percpu vcpu_info allocation Greg Kroah-Hartman
2023-12-05 3:17 ` [PATCH 6.1 107/107] x86/apic/msi: Fix misconfigured non-maskable MSI quirk Greg Kroah-Hartman
2023-12-05 10:35 ` [PATCH 6.1 000/107] 6.1.66-rc1 review Pavel Machek
2023-12-05 10:47 ` Conor Dooley
2023-12-05 11:10 ` Jon Hunter
2023-12-05 16:21 ` Naresh Kamboju
2023-12-05 18:26 ` Greg Kroah-Hartman
2023-12-05 16:55 ` Guenter Roeck
2023-12-05 17:09 ` SeongJae Park
2023-12-05 18:35 ` Florian Fainelli
2023-12-06 1:42 ` Shuah Khan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231205031537.731316037@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=hkallweit1@gmail.com \
--cc=martin.blumenstingl@googlemail.com \
--cc=patches@lists.linux.dev \
--cc=sashal@kernel.org \
--cc=stable@vger.kernel.org \
--cc=ulf.hansson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.