linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 1/2] Bluetooth: hci_qca: Enable clocks required for BT SOC
@ 2020-02-03 10:40 Venkata Lakshmi Narayana Gubba
  2020-02-03 10:40 ` [PATCH v3 2/2] dt-bindings: net: bluetooth: Add device tree bindings for QTI chip WCN3991 Venkata Lakshmi Narayana Gubba
  2020-02-03 14:45 ` [PATCH v3 1/2] Bluetooth: hci_qca: Enable clocks required for BT SOC Marcel Holtmann
  0 siblings, 2 replies; 4+ messages in thread
From: Venkata Lakshmi Narayana Gubba @ 2020-02-03 10:40 UTC (permalink / raw)
  To: marcel, johan.hedberg
  Cc: mka, linux-kernel, linux-bluetooth, robh, hemantg, linux-arm-msm,
	bgodavar, tientzu, seanpaul, rjliao, yshavit, devicetree,
	Venkata Lakshmi Narayana Gubba

Instead of relying on other subsytem to turn ON clocks
required for BT SoC to operate, voting them from the driver.

Signed-off-by: Venkata Lakshmi Narayana Gubba <gubbaven@codeaurora.org>
---
v3:
  *Removed the function qca_setup_clock() 
  *For enabling and disabling clocks, directly called the functions 
   clk_prepare_enable and clk_disable_unprepare respectively. 

---
 drivers/bluetooth/hci_qca.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
index d6e0c99..eacc65b 100644
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -1755,6 +1755,13 @@ static int qca_regulator_enable(struct qca_serdev *qcadev)
 
 	power->vregs_on = true;
 
+	ret = clk_prepare_enable(qcadev->susclk);
+	if (ret) {
+		/* Turn off regulators to overcome power leakage */
+		qca_regulator_disable(qcadev);
+		return ret;
+	}
+
 	return 0;
 }
 
@@ -1773,6 +1780,9 @@ static void qca_regulator_disable(struct qca_serdev *qcadev)
 
 	regulator_bulk_disable(power->num_vregs, power->vreg_bulk);
 	power->vregs_on = false;
+
+	if (qcadev->susclk)
+		clk_disable_unprepare(qcadev->susclk);
 }
 
 static int qca_init_regulators(struct qca_power *qca,
@@ -1839,6 +1849,12 @@ static int qca_serdev_probe(struct serdev_device *serdev)
 
 		qcadev->bt_power->vregs_on = false;
 
+		qcadev->susclk = devm_clk_get_optional(&serdev->dev, NULL);
+		if (IS_ERR(qcadev->susclk)) {
+			dev_err(&serdev->dev, "failed to acquire clk\n");
+			return PTR_ERR(qcadev->susclk);
+		}
+
 		device_property_read_u32(&serdev->dev, "max-speed",
 					 &qcadev->oper_speed);
 		if (!qcadev->oper_speed)
-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member 
of Code Aurora Forum, hosted by The Linux Foundation


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v3 2/2] dt-bindings: net: bluetooth: Add device tree bindings for QTI chip WCN3991
  2020-02-03 10:40 [PATCH v3 1/2] Bluetooth: hci_qca: Enable clocks required for BT SOC Venkata Lakshmi Narayana Gubba
@ 2020-02-03 10:40 ` Venkata Lakshmi Narayana Gubba
  2020-02-03 14:45   ` Marcel Holtmann
  2020-02-03 14:45 ` [PATCH v3 1/2] Bluetooth: hci_qca: Enable clocks required for BT SOC Marcel Holtmann
  1 sibling, 1 reply; 4+ messages in thread
From: Venkata Lakshmi Narayana Gubba @ 2020-02-03 10:40 UTC (permalink / raw)
  To: marcel, johan.hedberg
  Cc: mka, linux-kernel, linux-bluetooth, robh, hemantg, linux-arm-msm,
	bgodavar, tientzu, seanpaul, rjliao, yshavit, devicetree,
	Venkata Lakshmi Narayana Gubba

Add compatible string for the Qualcomm WCN3991 Bluetooth controller

Signed-off-by: Venkata Lakshmi Narayana Gubba <gubbaven@codeaurora.org>
---
v3:
  *Updated clocks with <&rpmhcc RPMH_RF_CLK2>  
---
 Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt b/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
index 68b67d9..beca646 100644
--- a/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
+++ b/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
@@ -11,6 +11,7 @@ Required properties:
  - compatible: should contain one of the following:
    * "qcom,qca6174-bt"
    * "qcom,wcn3990-bt"
+   * "qcom,wcn3991-bt"
    * "qcom,wcn3998-bt"
 
 Optional properties for compatible string qcom,qca6174-bt:
@@ -30,6 +31,7 @@ Optional properties for compatible string qcom,wcn399x-bt:
 
  - max-speed: see Documentation/devicetree/bindings/serial/slave-device.txt
  - firmware-name: specify the name of nvm firmware to load
+ - clocks: clock provided to the controller
 
 Examples:
 
@@ -56,5 +58,6 @@ serial@898000 {
 		vddch0-supply = <&vreg_l25a_3p3>;
 		max-speed = <3200000>;
 		firmware-name = "crnv21.bin";
+		clocks = <&rpmhcc RPMH_RF_CLK2>;
 	};
 };
-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member 
of Code Aurora Forum, hosted by The Linux Foundation


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v3 1/2] Bluetooth: hci_qca: Enable clocks required for BT SOC
  2020-02-03 10:40 [PATCH v3 1/2] Bluetooth: hci_qca: Enable clocks required for BT SOC Venkata Lakshmi Narayana Gubba
  2020-02-03 10:40 ` [PATCH v3 2/2] dt-bindings: net: bluetooth: Add device tree bindings for QTI chip WCN3991 Venkata Lakshmi Narayana Gubba
@ 2020-02-03 14:45 ` Marcel Holtmann
  1 sibling, 0 replies; 4+ messages in thread
From: Marcel Holtmann @ 2020-02-03 14:45 UTC (permalink / raw)
  To: Venkata Lakshmi Narayana Gubba
  Cc: Johan Hedberg, Matthias Kaehlcke, linux-kernel, linux-bluetooth,
	robh, hemantg, linux-arm-msm, bgodavar, tientzu, seanpaul,
	rjliao, yshavit, devicetree

Hi Venkata,

> Instead of relying on other subsytem to turn ON clocks
> required for BT SoC to operate, voting them from the driver.
> 
> Signed-off-by: Venkata Lakshmi Narayana Gubba <gubbaven@codeaurora.org>
> ---
> v3:
>  *Removed the function qca_setup_clock() 
>  *For enabling and disabling clocks, directly called the functions 
>   clk_prepare_enable and clk_disable_unprepare respectively. 
> 
> ---
> drivers/bluetooth/hci_qca.c | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)

patch has been applied to bluetooth-next tree.

Regards

Marcel


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v3 2/2] dt-bindings: net: bluetooth: Add device tree bindings for QTI chip WCN3991
  2020-02-03 10:40 ` [PATCH v3 2/2] dt-bindings: net: bluetooth: Add device tree bindings for QTI chip WCN3991 Venkata Lakshmi Narayana Gubba
@ 2020-02-03 14:45   ` Marcel Holtmann
  0 siblings, 0 replies; 4+ messages in thread
From: Marcel Holtmann @ 2020-02-03 14:45 UTC (permalink / raw)
  To: Venkata Lakshmi Narayana Gubba
  Cc: Johan Hedberg, Matthias Kaehlcke, linux-kernel, linux-bluetooth,
	robh, hemantg, linux-arm-msm, bgodavar, tientzu, seanpaul,
	rjliao, yshavit, devicetree

Hi Venkata,

> Add compatible string for the Qualcomm WCN3991 Bluetooth controller
> 
> Signed-off-by: Venkata Lakshmi Narayana Gubba <gubbaven@codeaurora.org>
> ---
> v3:
>  *Updated clocks with <&rpmhcc RPMH_RF_CLK2>  
> ---
> Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt | 3 +++
> 1 file changed, 3 insertions(+)

patch has been applied to bluetooth-next tree.

Regards

Marcel


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-02-03 14:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-03 10:40 [PATCH v3 1/2] Bluetooth: hci_qca: Enable clocks required for BT SOC Venkata Lakshmi Narayana Gubba
2020-02-03 10:40 ` [PATCH v3 2/2] dt-bindings: net: bluetooth: Add device tree bindings for QTI chip WCN3991 Venkata Lakshmi Narayana Gubba
2020-02-03 14:45   ` Marcel Holtmann
2020-02-03 14:45 ` [PATCH v3 1/2] Bluetooth: hci_qca: Enable clocks required for BT SOC Marcel Holtmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).