Thread (30 messages) 30 messages, 7 authors, 2024-07-08

Re: [PATCH v3 4/5] wifi: brcmfmac: Add optional lpo clock enable support

From: Stefan Wahren <wahrenst@gmx.net>
Date: 2024-06-30 08:43:59
Also in: linux-arm-kernel, linux-devicetree, linux-rockchip, linux-wireless, lkml

Hi,

Am 30.06.24 um 09:36 schrieb Jacobe Zang:
WiFi modules often require 32kHz clock to function. Add support to
enable the clock to PCIe driver.
the low power clock is independent from the host interface like PCIe. So
the clock handling should move to the common code. Sorry, not i cannot
give a good suggestion, what's the best place for this.
quoted hunk ↗ jump to hunk
Co-developed-by: Ondrej Jirman <megi@xff.cz>
Signed-off-by: Ondrej Jirman <megi@xff.cz>
Signed-off-by: Jacobe Zang <redacted>
---
  .../net/wireless/broadcom/brcm80211/brcmfmac/pcie.c    | 10 ++++++++++
  1 file changed, 10 insertions(+)
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
index 06698a714b523..e84f562fc91b8 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
@@ -3,6 +3,7 @@
   * Copyright (c) 2014 Broadcom Corporation
   */

+#include <linux/clk.h>
  #include <linux/kernel.h>
  #include <linux/module.h>
  #include <linux/firmware.h>
@@ -2411,6 +2412,7 @@ brcmf_pcie_probe(struct pci_dev *pdev, const struct pci_device_id *id)
  	struct brcmf_pciedev *pcie_bus_dev;
  	struct brcmf_core *core;
  	struct brcmf_bus *bus;
+	struct clk *clk;

  	if (!id) {
  		id = pci_match_id(brcmf_pcie_devid_table, pdev);
@@ -2422,6 +2424,14 @@ brcmf_pcie_probe(struct pci_dev *pdev, const struct pci_device_id *id)

  	brcmf_dbg(PCIE, "Enter %x:%x\n", pdev->vendor, pdev->device);

+	clk = devm_clk_get_optional_enabled(&pdev->dev, "lpo");
+	if (IS_ERR(clk))
+		return PTR_ERR(clk);
+	if (clk) {
+		brcmf_dbg(PCIE, "enabling 32kHz clock\n", pdev->vendor, pdev->device);
+		clk_set_rate(clk, 32768);
+	}
+
  	ret = -ENOMEM;
  	devinfo = kzalloc(sizeof(*devinfo), GFP_KERNEL);
  	if (devinfo == NULL)
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help