Re: [PATCH v2 2/3] dt-bindings: net: bluetooth: Convert to DT schema

2021-04-20 Thread Matthias Kaehlcke
On Tue, Apr 20, 2021 at 09:56:49PM +0530, Venkata Lakshmi Narayana Gubba wrote:

> Subject: dt-bindings: net: bluetooth: Convert to DT schema

This doesn't convert the generic binding or all bindings to DT schema
as the subject suggests, but the Qualcomm BT binding.

>
> Converted Qualcomm Bluetooth binidings to DT schema.
> 
> Signed-off-by: Venkata Lakshmi Narayana Gubba 
> ---
>  .../devicetree/bindings/net/qualcomm-bluetooth.txt | 69 -
>  .../bindings/net/qualcomm-bluetooth.yaml   | 87 
> ++
>  2 files changed, 87 insertions(+), 69 deletions(-)
>  delete mode 100644 
> Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
>  create mode 100644 
> Documentation/devicetree/bindings/net/qualcomm-bluetooth.yaml
> 
> diff --git a/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt 
> b/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
> deleted file mode 100644
> index 709ca6d..000
> --- a/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
> +++ /dev/null
> @@ -1,69 +0,0 @@
> -Qualcomm Bluetooth Chips
> --
> -
> -This documents the binding structure and common properties for serial
> -attached Qualcomm devices.
> -
> -Serial attached Qualcomm devices shall be a child node of the host UART
> -device the slave device is attached to.
> -
> -Required properties:
> - - compatible: should contain one of the following:
> -   * "qcom,qca6174-bt"
> -   * "qcom,qca9377-bt"
> -   * "qcom,wcn3990-bt"
> -   * "qcom,wcn3991-bt"
> -   * "qcom,wcn3998-bt"
> -   * "qcom,qca6390-bt"
> -
> -Optional properties for compatible string qcom,qca6174-bt:
> -
> - - enable-gpios: gpio specifier used to enable chip
> - - clocks: clock provided to the controller (SUSCLK_32KHZ)
> - - firmware-name: specify the name of nvm firmware to load
> -
> -Optional properties for compatible string qcom,qca9377-bt:
> -
> - - max-speed: see Documentation/devicetree/bindings/serial/serial.yaml
> -
> -Required properties for compatible string qcom,wcn399x-bt:
> -
> - - vddio-supply: VDD_IO supply regulator handle.
> - - vddxo-supply: VDD_XO supply regulator handle.
> - - vddrf-supply: VDD_RF supply regulator handle.
> - - vddch0-supply: VDD_CH0 supply regulator handle.
> -
> -Optional properties for compatible string qcom,wcn399x-bt:
> -
> - - max-speed: see Documentation/devicetree/bindings/serial/serial.yaml
> - - firmware-name: specify the name of nvm firmware to load
> - - clocks: clock provided to the controller
> -
> -Examples:
> -
> -serial@757 {
> - label = "BT-UART";
> - status = "okay";
> -
> - bluetooth {
> - compatible = "qcom,qca6174-bt";
> -
> - enable-gpios = <_gpios 19 GPIO_ACTIVE_HIGH>;
> - clocks = <>;
> - firmware-name = "nvm_00440302.bin";
> - };
> -};
> -
> -serial@898000 {
> - bluetooth {
> - compatible = "qcom,wcn3990-bt";
> -
> - vddio-supply = <_s4a_1p8>;
> - vddxo-supply = <_l7a_1p8>;
> - vddrf-supply = <_l17a_1p3>;
> - vddch0-supply = <_l25a_3p3>;
> - max-speed = <320>;
> - firmware-name = "crnv21.bin";
> - clocks = < RPMH_RF_CLK2>;
> - };
> -};
> diff --git a/Documentation/devicetree/bindings/net/qualcomm-bluetooth.yaml 
> b/Documentation/devicetree/bindings/net/qualcomm-bluetooth.yaml
> new file mode 100644
> index 000..55cd995
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/net/qualcomm-bluetooth.yaml
> @@ -0,0 +1,87 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/net/qualcomm-bluetooth.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Qualcomm Bluetooth Chips
> +
> +maintainers:
> +  - Rob Herring 
> +  - Marcel Holtmann 
> +
> +description:
> +  This binding describes Qualcomm UART-attached bluetooth chips.
> +
> +properties:
> +  compatible:
> +enum:
> +  - qcom,qca6174-bt
> +  - qcom,qca9377-bt
> +  - qcom,wcn3990-bt
> +  - qcom,wcn3991-bt
> +  - qcom,wcn3998-bt
> +  - qcom,qca6390-bt  

delete trailing blanks

> +
> +  enable-gpios:
> +maxItems: 1
> +description: gpio specifier used to enable chip
> +   

delete blanks

> +  clocks:
> +maxItems: 1
> +description: clock provided to the controller (SUSCLK_32KHZ)
> +
> +  vddio-supply:
> +description: VDD_IO supply regulator handle
> +
> +  vddxo-supply:
> +description: VDD_XO supply regulator handle
> +
> +  vddrf-supply:
> +description: VDD_RF supply regulator handle
> +
> +  vddch0-supply:
> +description: VDD_CH0 supply regulator handle
> +
> +  max-speed: 

delete trailing blank

> +description: see Documentation/devicetree/bindings/serial/serial.yaml
> +
> +  firmware-name:
> +description: specify the name of nvm firmware to load
> +
> +  local-bd-address:
> +description: see 

Re: [PATCH v1 1/2] arm64: dts: qcom: sc7280: Add cpufreq hw node

2021-04-20 Thread Matthias Kaehlcke
On Sat, Apr 10, 2021 at 07:34:39AM +0530, Taniya Das wrote:
> Add cpufreq HW device node to scale 4-Silver/3-Gold/1-Gold+
> cores on SC7280 SoCs.
> 
> Signed-off-by: Taniya Das 

Reviewed-by: Matthias Kaehlcke 


Re: [PATCH v2 1/3] Bluetooth: hci_qca: Add support for QTI Bluetooth chip wcn6750

2021-04-20 Thread Matthias Kaehlcke
On Tue, Apr 20, 2021 at 09:56:48PM +0530, Venkata Lakshmi Narayana Gubba wrote:
> Added regulators,GPIOs and changes required to power on/off wcn6750.
> Added support for firmware download for wcn6750.
> 
> Changes done in detail:
> 1. Added regulators and corresponding current values.
> 2. Added sw_ctrl GPIO pin which is output from BT SoC and indicates
>status of clock supply to BT SoC.
> 3. Added inline function to check if the SoC type is wcn399x or wcn6750.
> 4. Modified the function qca_wcn3990_init() to support wcn6750 and
>renamed it to qca_regulator_init().
> 5. Added BT_ON and BT_OFF macros.
> 6. Added support to download mbn type firmware image as wcn6750 supports
>mbn type image.
> 7. If mbn type image is not present then we will check for tlv type image.
> 8. Moved extracting rom version info to common place as this code is
>common in all if else ladder in qca_uart_setup.
> 
> Signed-off-by: Venkata Lakshmi Narayana Gubba 
> ---
>  drivers/bluetooth/btqca.c   |  88 ++--
>  drivers/bluetooth/btqca.h   |  15 ++-
>  drivers/bluetooth/hci_qca.c | 106 
> ++--
>  3 files changed, 161 insertions(+), 48 deletions(-)
> 
> diff --git a/drivers/bluetooth/btqca.c b/drivers/bluetooth/btqca.c
> index 25114f0..eec391a 100644
> --- a/drivers/bluetooth/btqca.c
> +++ b/drivers/bluetooth/btqca.c
> @@ -182,7 +182,8 @@ int qca_send_pre_shutdown_cmd(struct hci_dev *hdev)
>  }
>  EXPORT_SYMBOL_GPL(qca_send_pre_shutdown_cmd);
>  
> -static void qca_tlv_check_data(struct qca_fw_config *config,
> +static void qca_tlv_check_data(struct hci_dev *hdev,
> +struct qca_fw_config *config,
>   const struct firmware *fw, enum qca_btsoc_type soc_type)
>  {
>   const u8 *data;
> @@ -194,19 +195,21 @@ static void qca_tlv_check_data(struct qca_fw_config 
> *config,
>   struct tlv_type_nvm *tlv_nvm;
>   uint8_t nvm_baud_rate = config->user_baud_rate;
>  
> - tlv = (struct tlv_type_hdr *)fw->data;
> -
> - type_len = le32_to_cpu(tlv->type_len);
> - length = (type_len >> 8) & 0x00ff;
> -
> - BT_DBG("TLV Type\t\t : 0x%x", type_len & 0x00ff);
> - BT_DBG("Length\t\t : %d bytes", length);
> -
>   config->dnld_mode = QCA_SKIP_EVT_NONE;
>   config->dnld_type = QCA_SKIP_EVT_NONE;
>  
>   switch (config->type) {
> + case ELF_TYPE_PATCH:
> + config->dnld_mode = QCA_SKIP_EVT_VSE_CC;
> + config->dnld_type = QCA_SKIP_EVT_VSE_CC;
> +
> + bt_dev_dbg(hdev, "File Class: 0x%x", fw->data[4]);
> + bt_dev_dbg(hdev, "Data Encoding : 0x%x", fw->data[5]);
> + bt_dev_dbg(hdev, "File version  : 0x%x", fw->data[6]);
> + break;
>   case TLV_TYPE_PATCH:
> + tlv = (struct tlv_type_hdr *)fw->data;
> + type_len = le32_to_cpu(tlv->type_len);
>   tlv_patch = (struct tlv_type_patch *)tlv->data;
>  
>   /* For Rome version 1.1 to 3.1, all segment commands
> @@ -218,6 +221,7 @@ static void qca_tlv_check_data(struct qca_fw_config 
> *config,
>   config->dnld_mode = tlv_patch->download_mode;
>   config->dnld_type = config->dnld_mode;
>  
> + BT_DBG("TLV Type\t\t : 0x%x", type_len & 0x00ff);
>   BT_DBG("Total Length   : %d bytes",
>  le32_to_cpu(tlv_patch->total_size));
>   BT_DBG("Patch Data Length  : %d bytes",
> @@ -243,6 +247,14 @@ static void qca_tlv_check_data(struct qca_fw_config 
> *config,
>   break;
>  
>   case TLV_TYPE_NVM:
> + tlv = (struct tlv_type_hdr *)fw->data;
> +
> + type_len = le32_to_cpu(tlv->type_len);
> + length = (type_len >> 8) & 0x00ff;
> +
> + BT_DBG("TLV Type\t\t : 0x%x", type_len & 0x00ff);
> + BT_DBG("Length\t\t : %d bytes", length);
> +

To keep the wcn6750 shorther you could consider to have a separate patch
for the ELF type and the additional logging.

>   idx = 0;
>   data = tlv->data;
>   while (idx < length) {
> @@ -387,7 +399,8 @@ static int qca_inject_cmd_complete_event(struct hci_dev 
> *hdev)
>  
>  static int qca_download_firmware(struct hci_dev *hdev,
>struct qca_fw_config *config,
> -  enum qca_btsoc_type soc_type)
> +  enum qca_btsoc_type soc_type,
> +  u8 rom_ver)
>  {
>   const struct firmware *fw;
>   const u8 *segment;
> @@ -397,12 +410,29 @@ static int qca_download_firmware(struct hci_dev *hdev,
>  
>   ret = request_firmware(, config->fwname, >dev);
>   if (ret) {
> - bt_dev_err(hdev, "QCA Failed to request file: %s (%d)",
> -config->fwname, ret);
> - return ret;
> + /* For WCN6750, if mbn file is not 

Re: [RESEND PATCH V3 5/5] arm64: dts: qcom: sc7280: Include PMIC DT files for sc7280

2021-04-20 Thread Matthias Kaehlcke
On Wed, Apr 14, 2021 at 04:43:03PM +0530, satya priya wrote:

> Subject: arm64: dts: qcom: sc7280: Include PMIC DT files for sc7280

Please make sure to distinguish between the SoC (sc7280) and the
board (sc7280-idp), this patch primarily adds stuff to the board not
the SoC, this should be clear from the subject.

> Include pm7325, pm8350c, pmk8350 and pmr735a DT files.

How about something like 'The sc7280-idp has four PMICs, include their
.dtsi files'?

> Add channel nodes for pmk8350_vadc.

It's not super important, but I don't like it when things like this get
sneaked in with a commit message saying 'Include PMIC DT files for
sc7280'. I would suggest a separate patch. And please mention that
the channels are for the on die temperatures of the PMICs.

> Also, add the thermal_zones node in dtsi.

This is not the right patch to add it. This patch is about the sc7280-board
and doesn't do anything (directly) with thermal zones. However other
patches further down in the stack of in this series require the
'thermal-zones' to exist, hence the node should exist before these patches
reference it. A dedicated patch adding the node seems like the best option
to me.



Re: [RESEND PATCH V3 4/5] arm64: dts: qcom: pmk8350: Add PMIC peripherals for pmk8350

2021-04-20 Thread Matthias Kaehlcke
On Wed, Apr 14, 2021 at 04:43:00PM +0530, satya priya wrote:

> Subject: arm64: dts: qcom: pmk8350: Add PMIC peripherals for pmk8350

nit: why 'PMIC peripherals', are these peripherals somehow specific
to PMICs?

> Add PON, RTC and other PMIC infra modules support for PMK8350.

nit: it seems somewhat arbitrary to specifically mention PON and RTC,
and then treat the ADC and the thermal monitor as 'others'. You could
just spell them out too.

> 
> Signed-off-by: satya priya 
> ---
>  arch/arm64/boot/dts/qcom/pmk8350.dtsi | 55 
> ++-
>  1 file changed, 54 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm64/boot/dts/qcom/pmk8350.dtsi 
> b/arch/arm64/boot/dts/qcom/pmk8350.dtsi
> index 1530b8f..bbd9fa7 100644
> --- a/arch/arm64/boot/dts/qcom/pmk8350.dtsi
> +++ b/arch/arm64/boot/dts/qcom/pmk8350.dtsi
> @@ -3,6 +3,12 @@
>   * Copyright (c) 2021, Linaro Limited
>   */
>  
> +#include 
> +#include 
> +#include 
> +#include 

the includes of the constants for the other PMICs seems to be an
remainder from older vesions, which included nodes for the on die
temperatures of these PMICs.


Re: [RESEND PATCH V3 3/5] arm64: dts: qcom: pmr735a: Add temp-alarm support

2021-04-20 Thread Matthias Kaehlcke
On Wed, Apr 14, 2021 at 04:43:01PM +0530, satya priya wrote:
> Add temp-alarm node for PMR735A pmic and also modify gpio
> node to add gpio ranges and "qcom,spmi-gpio" compatible.
> 
> Signed-off-by: satya priya 

Reviewed-by: Matthias Kaehlcke 


Re: [PATCH V3 2/5] arm64: dts: qcom: pm8350c: Add temp-alarm support

2021-04-20 Thread Matthias Kaehlcke
On Wed, Apr 14, 2021 at 02:04:23PM +0530, satya priya wrote:
> Add temp-alarm node for PM8350C pmic and also modify gpio
> node to add gpio ranges and "qcom,spmi-gpio" compatible.
> 
> Signed-off-by: satya priya 
> ---
>  arch/arm64/boot/dts/qcom/pm8350c.dtsi | 32 +++-
>  1 file changed, 31 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm64/boot/dts/qcom/pm8350c.dtsi 
> b/arch/arm64/boot/dts/qcom/pm8350c.dtsi
> index 2b9b75e..e1b75ae 100644
> --- a/arch/arm64/boot/dts/qcom/pm8350c.dtsi
> +++ b/arch/arm64/boot/dts/qcom/pm8350c.dtsi
> @@ -13,13 +13,43 @@
>   #address-cells = <1>;
>   #size-cells = <0>;
>  
> + pm8350c_temp_alarm: temp-alarm@a00 {
> + compatible = "qcom,spmi-temp-alarm";
> + reg = <0xa00>;
> + interrupts = <0x2 0xa 0x0 IRQ_TYPE_EDGE_BOTH>;
> + #thermal-sensor-cells = <0>;
> + };
> +
>   pm8350c_gpios: gpio@8800 {
> - compatible = "qcom,pm8350c-gpio";
> + compatible = "qcom,pm8350c-gpio", "qcom,spmi-gpio";
>   reg = <0x8800>;
>   gpio-controller;
> + gpio-ranges = <_gpios 0 0 9>;

a separate patch for this would probably be preferable, but I guess it's ok

Reviewed-by: Matthias Kaehlcke 


Re: [PATCH V3 1/5] arm64: dts: qcom: pm7325: Add pm7325 base dts file

2021-04-20 Thread Matthias Kaehlcke
On Wed, Apr 14, 2021 at 02:04:22PM +0530, satya priya wrote:
> Add base DTS file for pm7325 along with GPIOs and temp-alarm nodes.
> 
> Signed-off-by: satya priya 

Reviewed-by: Matthias Kaehlcke 


Re: [PATCH v6 5/5] usb: dwc3: qcom: Set genpd active wakeup flag for usb gdsc

2021-04-19 Thread Matthias Kaehlcke
On Fri, Apr 16, 2021 at 03:31:53PM +0530, Sandeep Maheswaram wrote:

> Subject: usb: dwc3: qcom: Set genpd active wakeup flag for usb gdsc
>
> Set genpd active wakeup flag for usb gdsc if wakeup capable devices
> are connected so that wake up happens without reenumeration.

Better describe things are a higher level, rather than getting into
the details of how you achieve it. That's what the code is for.

e.g.:

Subject: usb: dwc3: qcom: Keep power domain on to support wakeup

If wakeup capable devices are connected to the controller (directly
or through hubs) at suspend time keep the power domain on in order
to support wakeup from these devices.


Re: [PATCH v6 4/5] usb: dwc3: qcom: Configure wakeup interrupts during suspend

2021-04-19 Thread Matthias Kaehlcke
On Fri, Apr 16, 2021 at 03:31:52PM +0530, Sandeep Maheswaram wrote:
> Configure interrupts based on hs_phy_mode to avoid triggering of
> interrupts during system suspend and suspend the device successfully.
> 
> Signed-off-by: Sandeep Maheswaram 
> ---
>  drivers/usb/dwc3/dwc3-qcom.c | 26 --
>  1 file changed, 20 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c
> index 66183c6..b1e9061 100644
> --- a/drivers/usb/dwc3/dwc3-qcom.c
> +++ b/drivers/usb/dwc3/dwc3-qcom.c
> @@ -316,22 +316,36 @@ static void dwc3_qcom_disable_wakeup_irq(int irq)
>  
>  static void dwc3_qcom_disable_interrupts(struct dwc3_qcom *qcom)
>  {
> - dwc3_qcom_disable_wakeup_irq(qcom->hs_phy_irq);
> + struct dwc3 *dwc = platform_get_drvdata(qcom->dwc3);
>  
> - dwc3_qcom_disable_wakeup_irq(qcom->dp_hs_phy_irq);
> + dwc3_qcom_disable_wakeup_irq(qcom->hs_phy_irq);
>  
> - dwc3_qcom_disable_wakeup_irq(qcom->dm_hs_phy_irq);
> + if (dwc->hs_phy_mode & PHY_MODE_USB_HOST_LS)
> + dwc3_qcom_disable_wakeup_irq(qcom->dp_hs_phy_irq);
> + else if (dwc->hs_phy_mode & PHY_MODE_USB_HOST_HS)
> + dwc3_qcom_disable_wakeup_irq(qcom->dm_hs_phy_irq);
> + else {
> + dwc3_qcom_disable_wakeup_irq(qcom->dp_hs_phy_irq);
> + dwc3_qcom_disable_wakeup_irq(qcom->dm_hs_phy_irq);
> + }

nit: 'if' and 'else if' branches should also have curly braces since
'else' has them.

>   dwc3_qcom_disable_wakeup_irq(qcom->ss_phy_irq);
>  }
>  
>  static void dwc3_qcom_enable_interrupts(struct dwc3_qcom *qcom)
>  {
> - dwc3_qcom_enable_wakeup_irq(qcom->hs_phy_irq);
> + struct dwc3 *dwc = platform_get_drvdata(qcom->dwc3);
>  
> - dwc3_qcom_enable_wakeup_irq(qcom->dp_hs_phy_irq);
> + dwc3_qcom_enable_wakeup_irq(qcom->hs_phy_irq);
>  
> - dwc3_qcom_enable_wakeup_irq(qcom->dm_hs_phy_irq);
> + if (dwc->hs_phy_mode & PHY_MODE_USB_HOST_LS)
> + dwc3_qcom_enable_wakeup_irq(qcom->dp_hs_phy_irq);
> + else if (dwc->hs_phy_mode & PHY_MODE_USB_HOST_HS)
> + dwc3_qcom_enable_wakeup_irq(qcom->dm_hs_phy_irq);
> + else {
> + dwc3_qcom_enable_wakeup_irq(qcom->dp_hs_phy_irq);
> + dwc3_qcom_enable_wakeup_irq(qcom->dm_hs_phy_irq);
> + }

ditto

>   dwc3_qcom_enable_wakeup_irq(qcom->ss_phy_irq);
>  }

Other than the nits:

Reviewed-by: Matthias Kaehlcke 


Re: [PATCH v6 2/5] usb: dwc3: core: Host wake up support from system suspend

2021-04-19 Thread Matthias Kaehlcke
On Fri, Apr 16, 2021 at 03:31:50PM +0530, Sandeep Maheswaram wrote:
> Avoiding phy powerdown when wakeup capable devices are connected
> by checking phy_power_off flag.
> Phy should be on to wake up the device from suspend using wakeup capable
> devices such as keyboard and mouse.
> 
> Signed-off-by: Sandeep Maheswaram 

Reviewed-by: Matthias Kaehlcke 


Re: [PATCH v6 1/5] usb: dwc3: host: Add suspend_quirk for dwc3 host

2021-04-19 Thread Matthias Kaehlcke
On Fri, Apr 16, 2021 at 03:31:49PM +0530, Sandeep Maheswaram wrote:

> Subject: usb: dwc3: host: Add suspend_quirk for dwc3 host
>
> Adding suspend quirk function for dwc3 host which will be called
> during xhci suspend.
> Setting hs_phy_mode, ss_phy_mode , phy_power_off flags and phy mode
> during host suspend.

This describes in other words what the code already tells us, but
doesn't really explain why this change is needed.

An attempt to be a bit clearer:

  Subject: usb: dwc3: host: Set PHY mode during suspend

  During suspend read the status of all port and make sure the PHYs
  are in the correct mode (mka@: why is it necessary to call
  phy_set_mode(), shouldn't the PHYs already be in the correct mode
  if they are operational?). Keep track of the mode of the HS PHY to
  be able to configure wakeup properly.

  Also check during suspend if any wakeup capable devices are
  connected to the controller (directly or through hubs), if there
  are none set a flag to indicate that the PHY should be powered
  down during suspend.

Just a starting point, I'm sure it has room for improvement.

> 
> Signed-off-by: Sandeep Maheswaram 
> ---
>  drivers/usb/dwc3/core.h |  3 +++
>  drivers/usb/dwc3/host.c | 59 
> +
>  2 files changed, 62 insertions(+)
> 
> diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
> index 6e9abfb..f409dc1 100644
> --- a/drivers/usb/dwc3/core.h
> +++ b/drivers/usb/dwc3/core.h
> @@ -,6 +,9 @@ struct dwc3 {
>  
>   boolphys_ready;
>  
> + unsigned inths_phy_mode;
> + boolphy_power_off;
> +
>   struct ulpi *ulpi;
>   boolulpi_ready;
>  
> diff --git a/drivers/usb/dwc3/host.c b/drivers/usb/dwc3/host.c
> index f29a264..527f04c 100644
> --- a/drivers/usb/dwc3/host.c
> +++ b/drivers/usb/dwc3/host.c
> @@ -11,6 +11,14 @@
>  #include 
>  
>  #include "core.h"
> +#include "../host/xhci.h"
> +#include "../host/xhci-plat.h"
> +
> +static int xhci_dwc3_suspend_quirk(struct usb_hcd *hcd);
> +
> +static const struct xhci_plat_priv xhci_plat_dwc3_xhci = {
> + .suspend_quirk = xhci_dwc3_suspend_quirk,
> +};
>  
>  static int dwc3_host_get_irq(struct dwc3 *dwc)
>  {
> @@ -115,6 +123,13 @@ int dwc3_host_init(struct dwc3 *dwc)
>   }
>   }
>  
> + ret = platform_device_add_data(xhci, _plat_dwc3_xhci,
> + sizeof(struct xhci_plat_priv));
> + if (ret) {
> + dev_err(dwc->dev, "failed to add data to xHCI\n");
> + goto err;
> + }
> +
>   ret = platform_device_add(xhci);
>   if (ret) {
>   dev_err(dwc->dev, "failed to register xHCI device\n");
> @@ -127,6 +142,50 @@ int dwc3_host_init(struct dwc3 *dwc)
>   return ret;
>  }
>  
> +static void dwc3_set_phy_mode(struct usb_hcd *hcd)
> +{
> +
> + int i, num_ports;
> + u32 reg;
> + unsigned int ss_phy_mode = 0;
> + struct dwc3 *dwc = dev_get_drvdata(hcd->self.controller->parent);
> + struct xhci_hcd *xhci_hcd = hcd_to_xhci(hcd);
> +
> + dwc->hs_phy_mode = 0;
> +
> + reg = readl(_hcd->cap_regs->hcs_params1);
> + num_ports = HCS_MAX_PORTS(reg);
> +
> + for (i = 0; i < num_ports; i++) {
> + reg = readl(_hcd->op_regs->port_status_base + i * 0x04);
> + if (reg & PORT_PE) {
> + if (DEV_HIGHSPEED(reg) || DEV_FULLSPEED(reg))
> + dwc->hs_phy_mode |= PHY_MODE_USB_HOST_HS;
> + else if (DEV_LOWSPEED(reg))
> + dwc->hs_phy_mode |= PHY_MODE_USB_HOST_LS;
> +
> + if (DEV_SUPERSPEED(reg))
> + ss_phy_mode |= PHY_MODE_USB_HOST_SS;
> + }
> + }
> + phy_set_mode(dwc->usb2_generic_phy, dwc->hs_phy_mode);
> + phy_set_mode(dwc->usb3_generic_phy, ss_phy_mode);
> +}
> +
> +int xhci_dwc3_suspend_quirk(struct usb_hcd *hcd)
> +{
> + struct dwc3 *dwc = dev_get_drvdata(hcd->self.controller->parent);
> +
> + dwc3_set_phy_mode(hcd);
> +
> + if (usb_wakeup_enabled_descendants(hcd->self.root_hub))
> + dwc->phy_power_off = false;
> + else
> + dwc->phy_power_off = true;
> +
> + return 0;
> +}
> +
>  void dwc3_host_exit(struct dwc3 *dwc)
>  {
>   platform_device_unregister(dwc->xhci);
> -- 
> QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
> of Code Aurora Forum, hosted by The Linux Foundation
> 


Re: [PATCH v6 3/5] usb: dwc3: qcom: Add helper functions to enable,disable wake irqs

2021-04-19 Thread Matthias Kaehlcke
On Fri, Apr 16, 2021 at 03:31:51PM +0530, Sandeep Maheswaram wrote:
> Adding helper functions to enable,disable wake irqs to make
> the code simple and readable.
> 
> Signed-off-by: Sandeep Maheswaram 

Reviewed-by: Matthias Kaehlcke 


[PATCH v1] arm64: dts: qcom: sc7180: coachz: Add thermal config for skin temperature

2021-04-14 Thread Matthias Kaehlcke
Add ADC and thermal monitor configuration for skin temperature,
plus a thermal zone that monitors the skin temperature and uses
the big cores as cooling devices.

CoachZ rev1 is stuffed with an incompatible thermistor for the
skin temperature, disable the thermal zone for rev1 to avoid
the use of bogus temperature values.

Signed-off-by: Matthias Kaehlcke 
---

 .../dts/qcom/sc7180-trogdor-coachz-r1.dts |  9 +++
 .../boot/dts/qcom/sc7180-trogdor-coachz.dtsi  | 63 +++
 2 files changed, 72 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r1.dts 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r1.dts
index 86619f6c1134..80bdc4d5b523 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r1.dts
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r1.dts
@@ -14,6 +14,15 @@ / {
compatible = "google,coachz-rev1", "qcom,sc7180";
 };
 
+/*
+ * CoachZ rev1 is stuffed with a 47k NTC as thermistor for skin temperature,
+ * which currently is not supported by the PM6150 ADC driver. Disable the
+ * skin temperature thermal zone to avoid using bogus temperature values.
+ */
+_temp_thermal {
+   status = "disabled";
+};
+
  {
gpio-line-names = "HUB_RST_L",
  "AP_RAM_ID0",
diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi
index e2ffe71c2d52..cabe5d6b981b 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi
@@ -25,6 +25,50 @@ adau7002: audio-codec-1 {
IOVDD-supply = <_l15a>;
#sound-dai-cells = <0>;
};
+
+   thermal-zones {
+   skin_temp_thermal: skin-temp-thermal {
+   polling-delay-passive = <250>;
+   polling-delay = <0>;
+
+   thermal-sensors = <_adc_tm 1>;
+   sustainable-power = <814>;
+
+   trips {
+   skin_temp_alert0: trip-point0 {
+   temperature = <42000>;
+   hysteresis = <1000>;
+   type = "passive";
+   };
+
+   skin_temp_alert1: trip-point1 {
+   temperature = <45000>;
+   hysteresis = <1000>;
+   type = "passive";
+   };
+
+   skin-temp-crit {
+   temperature = <6>;
+   hysteresis = <1000>;
+   type = "critical";
+   };
+   };
+
+   cooling-maps {
+   map0 {
+   trip = <_temp_alert0>;
+   cooling-device = < 
THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+< 
THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+   };
+
+   map1 {
+   trip = <_temp_alert1>;
+   cooling-device = < 
THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+< 
THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+   };
+   };
+   };
+   };
 };
 
 _spi_fp {
@@ -77,6 +121,25 @@  {
compatible = "boe,nv110wtm-n61";
 };
 
+_adc {
+   skin-temp-thermistor@4e {
+   reg = ;
+   qcom,ratiometric;
+   qcom,hw-settle-time = <200>;
+   };
+};
+
+_adc_tm {
+   status = "okay";
+
+   skin-temp-thermistor@1 {
+   reg = <1>;
+   io-channels = <_adc ADC5_AMUX_THM2_100K_PU>;
+   qcom,ratiometric;
+   qcom,hw-settle-time-us = <200>;
+   };
+};
+
 _dx_edp {
gpio = < 67 GPIO_ACTIVE_HIGH>;
 };
-- 
2.31.1.295.g9ea45b61b8-goog



Re: [PATCH v6 3/5] of/platform: Add stubs for of_platform_device_create/destroy()

2021-04-08 Thread Matthias Kaehlcke
On Thu, Apr 08, 2021 at 10:21:12AM -0500, Rob Herring wrote:
> On Mon, Apr 05, 2021 at 01:18:15PM -0700, Matthias Kaehlcke wrote:
> > Code for platform_device_create() and of_platform_device_create() is
> 
> platform_device_create()?

ack, should be of_platform_device_destroy()

> > only generated if CONFIG_OF_ADDRESS=y. Add stubs to avoid unresolved
> > symbols when CONFIG_OF_ADDRESS is not set.
> > 
> > Signed-off-by: Matthias Kaehlcke 
> > ---
> > 
> > Changes in v7:
> > - none
> > 
> > Changes in v6:
> > - patch added to the series
> > 
> >  include/linux/of_platform.h | 22 ++
> >  1 file changed, 18 insertions(+), 4 deletions(-)
> > 
> > diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h
> > index 84a966623e78..d15b6cd5e1c3 100644
> > --- a/include/linux/of_platform.h
> > +++ b/include/linux/of_platform.h
> > @@ -61,16 +61,18 @@ static inline struct platform_device 
> > *of_find_device_by_node(struct device_node
> >  }
> >  #endif
> >  
> > +extern int of_platform_bus_probe(struct device_node *root,
> > +const struct of_device_id *matches,
> > +struct device *parent);
> 
> This is also only built for CONFIG_OF_ADDRESS. But there's no need for 
> an empty function as it is powerpc only and should never have a new 
> user.

ok


Re: [PATCH v6 1/5] dt-bindings: usb: Add binding for Realtek RTS5411 hub controller

2021-04-08 Thread Matthias Kaehlcke
On Tue, Apr 06, 2021 at 11:30:01AM -0500, Rob Herring wrote:
> On Mon, Apr 05, 2021 at 01:18:13PM -0700, Matthias Kaehlcke wrote:
> > The Realtek RTS5411 is a USB 3.0 hub controller with 4 ports.
> > 
> > This initial version of the binding only describes USB related
> > aspects of the RTS5411, it does not cover the option of
> > connecting the controller as an i2c slave.
> > 
> > Signed-off-by: Matthias Kaehlcke 
> > ---
> > 
> > Changes in v7:
> > - added type ref for 'companion-hub' property
> > 
> > Changes in v6:
> > - Realtek binding instead of generic onboard_usb_hub
> > - added 'companion-hub' property
> > - added reference to 'usb-device.yaml'
> > - 'fixed' indentation of compatible entries to keep yamllint happy
> > - added 'additionalProperties' entry
> > - updated commit message
> > 
> > Changes in v5:
> > - updated 'title'
> > - only use standard USB compatible strings
> > - deleted 'usb_hub' node
> > - renamed 'usb_controller' node to 'usb-controller'
> > - removed labels from USB nodes
> > - added 'vdd-supply' to USB nodes
> > 
> > Changes in v4:
> > - none
> > 
> > Changes in v3:
> > - updated commit message
> > - removed recursive reference to $self
> > - adjusted 'compatible' definition to support multiple entries
> > - changed USB controller phandle to be a node
> > 
> > Changes in v2:
> > - removed 'wakeup-source' and 'power-off-in-suspend' properties
> > - consistently use spaces for indentation in example
> > 
> >  .../bindings/usb/realtek,rts5411.yaml | 59 +++
> >  1 file changed, 59 insertions(+)
> >  create mode 100644 
> > Documentation/devicetree/bindings/usb/realtek,rts5411.yaml
> > 
> > diff --git a/Documentation/devicetree/bindings/usb/realtek,rts5411.yaml 
> > b/Documentation/devicetree/bindings/usb/realtek,rts5411.yaml
> > new file mode 100644
> > index ..b59001972749
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/usb/realtek,rts5411.yaml
> > @@ -0,0 +1,59 @@
> > +# SPDX-License-Identifier: GPL-2.0-only or BSD-2-Clause
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/usb/realtek,rts5411.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: Binding for the Realtek RTS5411 USB 3.0 hub controller
> > +
> > +maintainers:
> > +  - Matthias Kaehlcke 
> > +
> > +allOf:
> > +  - $ref: usb-device.yaml#
> > +
> > +properties:
> > +  compatible:
> > +items:
> > +  - enum:
> > +  - usbbda,5411
> > +  - usbbda,411
> > +
> 
> reg: true
> 
> to fix the error.

Will fix in v8 (this is v7, even though the subject says otherwise,
I forgot to increment the version number when sending).

> > +  vdd-supply:
> > +description:
> > +  phandle to the regulator that provides power to the hub.
> > +
> > +  companion-hub:
> > +$ref: '/schemas/types.yaml#/definitions/phandle'
> > +description:
> > +  phandle to the companion hub on the controller.
> 
> This should be required I think. I suppose you could only hook up 2.0
> ports, but why. And 3.0 only wouldn't be USB compliant, would it?

Agreed, that makes sense now that this is a specific binding for the
RTS5411. It seems unlikely that a system would use a USB 3.0 capable
hub on a USB 2.0 controller, and as you said 3.0 only wouldn't be USB
compliant.

I made the attribute initially optional because the binding was
intended to be generic (bad idea), and for certain hubs a required
'companion-hub' wouldn't make sense (e.g. USB 2.0 only).

> > +
> > +required:
> > +  - compatible
> > +  - reg
> > +
> > +additionalProperties: false
> > +
> > +examples:
> > +  - |
> > +usb-controller {
> 
> 'usb' is the standard name.

ack

Thanks for your comments!

m.


Re: [PATCH v6 0/5] USB: misc: Add onboard_usb_hub driver

2021-04-05 Thread Matthias Kaehlcke
> Subject: [PATCH v6 0/5] USB: misc: Add onboard_usb_hub driver

Argh, that should have been v7 :/ Not sure if it's worth/required to
resend.

On Mon, Apr 05, 2021 at 01:18:12PM -0700, Matthias Kaehlcke wrote:
> This series adds:
> - the onboard_usb_hub_driver
> - glue in the xhci-plat driver to create the onboard_usb_hub
>   platform device if needed
> - a device tree binding for the Realtek RTS5411 USB hub controller
> - device tree changes that add RTS5411 entries for the QCA SC7180
>   based boards trogdor and lazor
> - a couple of stubs for platform device functions to avoid
>   unresolved symbols with certain kernel configs
> 
> The main issue the driver addresses is that a USB hub needs to be
> powered before it can be discovered. For discrete onboard hubs (an
> example for such a hub is the Realtek RTS5411) this is often solved
> by supplying the hub with an 'always-on' regulator, which is kind
> of a hack. Some onboard hubs may require further initialization
> steps, like changing the state of a GPIO or enabling a clock, which
> requires even more hacks. This driver creates a platform device
> representing the hub which performs the necessary initialization.
> Currently it only supports switching on a single regulator, support
> for multiple regulators or other actions can be added as needed.
> Different initialization sequences can be supported based on the
> compatible string.
> 
> Besides performing the initialization the driver can be configured
> to power the hub off during system suspend. This can help to extend
> battery life on battery powered devices which have no requirements
> to keep the hub powered during suspend. The driver can also be
> configured to leave the hub powered when a wakeup capable USB device
> is connected when suspending, and power it off otherwise.
> 
> Changes in v7:
> - series rebased on qcom/arm64-for-5.13
> 
> Changes in v6:
> - updated summary
> 
> Changes in v5:
> - cover letter added
> 
> Matthias Kaehlcke (5):
>   dt-bindings: usb: Add binding for Realtek RTS5411 hub controller
>   USB: misc: Add onboard_usb_hub driver
>   of/platform: Add stubs for of_platform_device_create/destroy()
>   usb: host: xhci-plat: Create platform device for onboard hubs in
> probe()
>   arm64: dts: qcom: sc7180-trogdor: Add nodes for onboard USB hub
> 
>  .../sysfs-bus-platform-onboard-usb-hub|   8 +
>  .../bindings/usb/realtek,rts5411.yaml |  59 +++
>  MAINTAINERS   |   7 +
>  .../boot/dts/qcom/sc7180-trogdor-lazor-r0.dts |  19 +-
>  .../boot/dts/qcom/sc7180-trogdor-lazor-r1.dts |  11 +-
>  .../arm64/boot/dts/qcom/sc7180-trogdor-r1.dts |  19 +-
>  arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi  |  21 +-
>  drivers/usb/host/xhci-plat.c  |  16 +
>  drivers/usb/misc/Kconfig  |  17 +
>  drivers/usb/misc/Makefile |   1 +
>  drivers/usb/misc/onboard_usb_hub.c| 415 ++
>  include/linux/of_platform.h   |  22 +-
>  include/linux/usb/hcd.h   |   2 +
>  include/linux/usb/onboard_hub.h   |  15 +
>  14 files changed, 596 insertions(+), 36 deletions(-)
>  create mode 100644 
> Documentation/ABI/testing/sysfs-bus-platform-onboard-usb-hub
>  create mode 100644 Documentation/devicetree/bindings/usb/realtek,rts5411.yaml
>  create mode 100644 drivers/usb/misc/onboard_usb_hub.c
>  create mode 100644 include/linux/usb/onboard_hub.h
> 
> -- 
> 2.31.0.208.g409f899ff0-goog
> 


[PATCH v6 5/5] arm64: dts: qcom: sc7180-trogdor: Add nodes for onboard USB hub

2021-04-05 Thread Matthias Kaehlcke
Add nodes for the onboard USB hub on trogdor devices. Remove the
'always-on' and 'boot-on' properties from the hub regulator, since
the regulator is now managed by the onboard_usb_hub driver.

Signed-off-by: Matthias Kaehlcke 
---

Changes in v7:
- rebased on qcom/arm64-for-5.13 (with the rest of the series)

Changes in v6:
- added 'companion-hub' entry to both USB devices
- added 'vdd-supply' also to hub@2

Changes in v5:
- patch added to the series

 .../boot/dts/qcom/sc7180-trogdor-lazor-r0.dts | 19 +++--
 .../boot/dts/qcom/sc7180-trogdor-lazor-r1.dts | 11 --
 .../arm64/boot/dts/qcom/sc7180-trogdor-r1.dts | 19 +++--
 arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi  | 21 ---
 4 files changed, 38 insertions(+), 32 deletions(-)

diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r0.dts 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r0.dts
index 5c997cd90069..bae85f6b2bfa 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r0.dts
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r0.dts
@@ -23,17 +23,6 @@ _thermal {
status = "disabled";
 };
 
-_hub {
-   /* pp3300_l7c is used to power the USB hub */
-   /delete-property/regulator-always-on;
-   /delete-property/regulator-boot-on;
-};
-
-_l7c {
-   regulator-always-on;
-   regulator-boot-on;
-};
-
 _out {
/*
 * Lane 0 was incorrectly mapped on the cable, but we've now decided
@@ -42,3 +31,11 @@ _out {
 */
lane-polarities = <1 0>;
 };
+
+_hub_2_0 {
+vdd-supply = <_l7c>;
+};
+
+_hub_3_0 {
+vdd-supply = <_l7c>;
+};
diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dts 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dts
index d9fbcc7bc5bd..45f014c3539d 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dts
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dts
@@ -23,13 +23,10 @@ _thermal {
status = "disabled";
 };
 
-_hub {
-   /* pp3300_l7c is used to power the USB hub */
-   /delete-property/regulator-always-on;
-   /delete-property/regulator-boot-on;
+_hub_2_0 {
+vdd-supply = <_l7c>;
 };
 
-_l7c {
-   regulator-always-on;
-   regulator-boot-on;
+_hub_3_0 {
+vdd-supply = <_l7c>;
 };
diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-r1.dts 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor-r1.dts
index 2b522f9e0d8f..2f5263e3d1b9 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-r1.dts
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-r1.dts
@@ -42,17 +42,6 @@  {
compatible = "auo,b116xa01";
 };
 
-_hub {
-   /* pp3300_l7c is used to power the USB hub */
-   /delete-property/regulator-always-on;
-   /delete-property/regulator-boot-on;
-};
-
-_l7c {
-   regulator-always-on;
-   regulator-boot-on;
-};
-
 _2 {
status = "okay";
 };
@@ -61,6 +50,14 @@  {
interrupts = <58 IRQ_TYPE_EDGE_FALLING>;
 };
 
+_hub_2_0 {
+vdd-supply = <_l7c>;
+};
+
+_hub_3_0 {
+vdd-supply = <_l7c>;
+};
+
 /* PINCTRL - modifications to sc7180-trogdor.dtsi */
 
 _int_1v8_odl {
diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi
index 192e2e424fde..54f9da9af376 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi
@@ -206,9 +206,6 @@ pp3300_hub: pp3300-hub {
pinctrl-names = "default";
pinctrl-0 = <_pp3300_hub>;
 
-   regulator-always-on;
-   regulator-boot-on;
-
vin-supply = <_a>;
};
 
@@ -848,6 +845,24 @@ _1 {
 
 _1_dwc3 {
dr_mode = "host";
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   /* 2.0 hub on port 1 */
+   usb_hub_2_0: hub@1 {
+   compatible = "usbbda,5411";
+   reg = <1>;
+   vdd-supply = <_hub>;
+   companion-hub = <_hub_3_0>;
+   };
+
+   /* 3.0 hub on port 2 */
+   usb_hub_3_0: hub@2 {
+   compatible = "usbbda,411";
+   reg = <2>;
+   vdd-supply = <_hub>;
+   companion-hub = <_hub_2_0>;
+   };
 };
 
 _1_hsphy {
-- 
2.31.0.208.g409f899ff0-goog



[PATCH v6 4/5] usb: host: xhci-plat: Create platform device for onboard hubs in probe()

2021-04-05 Thread Matthias Kaehlcke
Check during probe() if a hub supported by the onboard_usb_hub
driver is connected to the controller. If such a hub is found
create the corresponding platform device. This requires the
device tree to have a node for the hub with its vendor and
product id (which is not common for USB devices). Further the
platform device is only created when CONFIG_USB_ONBOARD_HUB=y/m.

Signed-off-by: Matthias Kaehlcke 
---

Changes in v7:
- none

Changes in v6:
- none

Changes in v5:
- patch added to the series

 drivers/usb/host/xhci-plat.c | 16 
 include/linux/usb/hcd.h  |  2 ++
 2 files changed, 18 insertions(+)

diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index c1edcc9b13ce..9c0fb7e8df1f 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -15,6 +15,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -195,6 +196,7 @@ static int xhci_plat_probe(struct platform_device *pdev)
int ret;
int irq;
struct xhci_plat_priv   *priv = NULL;
+   struct device_node  *np;
 
 
if (usb_disabled())
@@ -374,6 +376,17 @@ static int xhci_plat_probe(struct platform_device *pdev)
 */
pm_runtime_forbid(>dev);
 
+   np = usb_of_get_device_node(hcd->self.root_hub, hcd->self.busnum);
+   if (np && of_is_onboard_usb_hub(np)) {
+   struct platform_device *pdev;
+
+   pdev = of_platform_device_create(np, NULL, NULL);
+   if (pdev)
+   hcd->onboard_hub_dev = >dev;
+   else
+   xhci_warn(xhci, "failed to create onboard hub platform 
device\n");
+   }
+
return 0;
 
 
@@ -420,6 +433,9 @@ static int xhci_plat_remove(struct platform_device *dev)
usb_remove_hcd(hcd);
usb_put_hcd(shared_hcd);
 
+   if (hcd->onboard_hub_dev)
+   of_platform_device_destroy(hcd->onboard_hub_dev, NULL);
+
clk_disable_unprepare(clk);
clk_disable_unprepare(reg_clk);
usb_put_hcd(hcd);
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
index 96281cd50ff6..d02a508e19b0 100644
--- a/include/linux/usb/hcd.h
+++ b/include/linux/usb/hcd.h
@@ -225,6 +225,8 @@ struct usb_hcd {
 * (ohci 32, uhci 1024, ehci 256/512/1024).
 */
 
+   struct device *onboard_hub_dev;
+
/* The HC driver's private data is stored at the end of
 * this structure.
 */
-- 
2.31.0.208.g409f899ff0-goog



[PATCH v6 3/5] of/platform: Add stubs for of_platform_device_create/destroy()

2021-04-05 Thread Matthias Kaehlcke
Code for platform_device_create() and of_platform_device_create() is
only generated if CONFIG_OF_ADDRESS=y. Add stubs to avoid unresolved
symbols when CONFIG_OF_ADDRESS is not set.

Signed-off-by: Matthias Kaehlcke 
---

Changes in v7:
- none

Changes in v6:
- patch added to the series

 include/linux/of_platform.h | 22 ++
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h
index 84a966623e78..d15b6cd5e1c3 100644
--- a/include/linux/of_platform.h
+++ b/include/linux/of_platform.h
@@ -61,16 +61,18 @@ static inline struct platform_device 
*of_find_device_by_node(struct device_node
 }
 #endif
 
+extern int of_platform_bus_probe(struct device_node *root,
+const struct of_device_id *matches,
+struct device *parent);
+
+#ifdef CONFIG_OF_ADDRESS
 /* Platform devices and busses creation */
 extern struct platform_device *of_platform_device_create(struct device_node 
*np,
   const char *bus_id,
   struct device *parent);
 
 extern int of_platform_device_destroy(struct device *dev, void *data);
-extern int of_platform_bus_probe(struct device_node *root,
-const struct of_device_id *matches,
-struct device *parent);
-#ifdef CONFIG_OF_ADDRESS
+
 extern int of_platform_populate(struct device_node *root,
const struct of_device_id *matches,
const struct of_dev_auxdata *lookup,
@@ -84,6 +86,18 @@ extern int devm_of_platform_populate(struct device *dev);
 
 extern void devm_of_platform_depopulate(struct device *dev);
 #else
+/* Platform devices and busses creation */
+static inline struct platform_device *of_platform_device_create(struct 
device_node *np,
+   const char 
*bus_id,
+   struct device 
*parent)
+{
+   return NULL;
+}
+static inline int of_platform_device_destroy(struct device *dev, void *data)
+{
+   return -ENODEV;
+}
+
 static inline int of_platform_populate(struct device_node *root,
const struct of_device_id *matches,
const struct of_dev_auxdata *lookup,
-- 
2.31.0.208.g409f899ff0-goog



[PATCH v6 2/5] USB: misc: Add onboard_usb_hub driver

2021-04-05 Thread Matthias Kaehlcke
The main issue this driver addresses is that a USB hub needs to be
powered before it can be discovered. For discrete onboard hubs (an
example for such a hub is the Realtek RTS5411) this is often solved
by supplying the hub with an 'always-on' regulator, which is kind
of a hack. Some onboard hubs may require further initialization
steps, like changing the state of a GPIO or enabling a clock, which
requires even more hacks. This driver creates a platform device
representing the hub which performs the necessary initialization.
Currently it only supports switching on a single regulator, support
for multiple regulators or other actions can be added as needed.
Different initialization sequences can be supported based on the
compatible string.

Besides performing the initialization the driver can be configured
to power the hub off during system suspend. This can help to extend
battery life on battery powered devices which have no requirements
to keep the hub powered during suspend. The driver can also be
configured to leave the hub powered when a wakeup capable USB device
is connected when suspending, and power it off otherwise.

Technically the driver consists of two drivers, the platform driver
described above and a very thin USB driver that subclasses the
generic driver. The purpose of this driver is to provide the platform
driver with the USB devices corresponding to the hub(s) (a hub
controller may provide multiple 'logical' hubs, e.g. one to support
USB 2.0 and another for USB 3.x).

Note: the driver currently only works with hubs connected directly
to a root hub, but it could be extended to support other
configurations if needed.

Co-developed-by: Ravi Chandra Sadineni 
Signed-off-by: Ravi Chandra Sadineni 
Signed-off-by: Matthias Kaehlcke 
---
Open question:

  It seems to me there should be more options to configure the behavior
  during system suspend. Currently we have 'keep the hub always powered'
  and 'power the hub down unless a wakeup capable device is connected'.
  The configuration is done through the boolean sysfs attribute
  'always_powered_in_suspend'. Maybe this should be changed to

powered_in_suspend: yes/no/wakeup

  or similar, with some flexibility when writing the boolean values.

Changes in v7:
- don't declare stub for of_is_onboard_usb_hub() when
  CONFIG_COMPILE_TEST is defined

Changes in v6:
- use 'companion-hub' to locate the platform device, instead of
  scanning through the nodes of the parent
- added ABI documentation for 'always_powered_in_suspend'
- sysfs_emit() instead of sprintf() in always_powered_in_suspend_show()
- register sysfs attribute through driver.dev_groups
- evaluate return value of driver_attach() in _probe()
- use dev_warn() instead of WARN_ON() in _probe()
- include 'onboard_hub.h'

Changes in v5:
- the platform device is now instantiated from the same DT node
  as the 'primary' USB hub device
  - use the USB compatible strings for the platform device
  - refactored _find_onboard_hub() to search the parents child
nodes for a platform device with a matching compatible string
  - added exported function of_is_onboard_usb_hub() to allow other
drivers (like xhci_plat) to check if one of their child DT nodes
is a supported hub
- use late suspend to make sure info about wakeup enabled descendants
  is updated
- call driver_attach() for the USB driver in onboard_hub_probe() to
  make sure the driver is re-attached after the device_release_driver()
  calls in onboard_hub_remove()
- renamed sysfs attribute 'power_off_in_suspend' to
  'always_powered_in_suspend'
- added sysfs symlinks between platform device and USB devices
- marked 'onboard_hub_pm_ops' as __maybe_unused
- removed 'realtek' compatible string which is not needed at this
  point
- fix log for regulator_disable() failure

Changes in v4:
- updated Kconfig documentation
- changed the loop in onboard_hub_remove() to release the hub lock
  before unbinding the USB device and make self deadlock prevention
  less clunky
- fixed return value in onboard_hub_usbdev_probe()
- added entry to MAINTAINERS file

Changes in v3:
- updated the commit message
- updated description in Kconfig
- remove include of 'core/usb.h'
- use 'is_powered_on' flag instead of 'has_wakeup_capable_descendants'
- added 'going_away' flag to struct onboard_hub
  - don't allow adding new USB devices when the platform device is going away
  - don't bother with deleting the list item in onboard_hub_remove_usbdev()
when the platform device is going away
- don't assume in onboard_hub_suspend() that all USB hub devices are
  connected to the same controller
- removed unnecessary devm_kfree() from onboard_hub_remove_usbdev()
- fixed error handling in onboard_hub_remove_usbdev()
- use kstrtobool() instead of strtobool() in power_off_in_suspend_store()
- unbind USB devices in onboard_hub_remove() to avoid dangling references
  to the platform device
- moved put_device() for platform device to _find_onboard_hub()
- changed return

[PATCH v6 1/5] dt-bindings: usb: Add binding for Realtek RTS5411 hub controller

2021-04-05 Thread Matthias Kaehlcke
The Realtek RTS5411 is a USB 3.0 hub controller with 4 ports.

This initial version of the binding only describes USB related
aspects of the RTS5411, it does not cover the option of
connecting the controller as an i2c slave.

Signed-off-by: Matthias Kaehlcke 
---

Changes in v7:
- added type ref for 'companion-hub' property

Changes in v6:
- Realtek binding instead of generic onboard_usb_hub
- added 'companion-hub' property
- added reference to 'usb-device.yaml'
- 'fixed' indentation of compatible entries to keep yamllint happy
- added 'additionalProperties' entry
- updated commit message

Changes in v5:
- updated 'title'
- only use standard USB compatible strings
- deleted 'usb_hub' node
- renamed 'usb_controller' node to 'usb-controller'
- removed labels from USB nodes
- added 'vdd-supply' to USB nodes

Changes in v4:
- none

Changes in v3:
- updated commit message
- removed recursive reference to $self
- adjusted 'compatible' definition to support multiple entries
- changed USB controller phandle to be a node

Changes in v2:
- removed 'wakeup-source' and 'power-off-in-suspend' properties
- consistently use spaces for indentation in example

 .../bindings/usb/realtek,rts5411.yaml | 59 +++
 1 file changed, 59 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/realtek,rts5411.yaml

diff --git a/Documentation/devicetree/bindings/usb/realtek,rts5411.yaml 
b/Documentation/devicetree/bindings/usb/realtek,rts5411.yaml
new file mode 100644
index ..b59001972749
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/realtek,rts5411.yaml
@@ -0,0 +1,59 @@
+# SPDX-License-Identifier: GPL-2.0-only or BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/usb/realtek,rts5411.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Binding for the Realtek RTS5411 USB 3.0 hub controller
+
+maintainers:
+  - Matthias Kaehlcke 
+
+allOf:
+  - $ref: usb-device.yaml#
+
+properties:
+  compatible:
+items:
+  - enum:
+  - usbbda,5411
+  - usbbda,411
+
+  vdd-supply:
+description:
+  phandle to the regulator that provides power to the hub.
+
+  companion-hub:
+$ref: '/schemas/types.yaml#/definitions/phandle'
+description:
+  phandle to the companion hub on the controller.
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+usb-controller {
+dr_mode = "host";
+#address-cells = <1>;
+#size-cells = <0>;
+
+/* 2.0 hub on port 1 */
+hub_2_0: hub@1 {
+compatible = "usbbda,5411";
+reg = <1>;
+vdd-supply = <_hub>;
+companion-hub = <_3_0>;
+};
+
+/* 3.0 hub on port 2 */
+hub_3_0: hub@2 {
+compatible = "usbbda,411";
+reg = <2>;
+vdd-supply = <_hub>;
+companion-hub = <_2_0>;
+};
+};
-- 
2.31.0.208.g409f899ff0-goog



[PATCH v6 0/5] USB: misc: Add onboard_usb_hub driver

2021-04-05 Thread Matthias Kaehlcke
This series adds:
- the onboard_usb_hub_driver
- glue in the xhci-plat driver to create the onboard_usb_hub
  platform device if needed
- a device tree binding for the Realtek RTS5411 USB hub controller
- device tree changes that add RTS5411 entries for the QCA SC7180
  based boards trogdor and lazor
- a couple of stubs for platform device functions to avoid
  unresolved symbols with certain kernel configs

The main issue the driver addresses is that a USB hub needs to be
powered before it can be discovered. For discrete onboard hubs (an
example for such a hub is the Realtek RTS5411) this is often solved
by supplying the hub with an 'always-on' regulator, which is kind
of a hack. Some onboard hubs may require further initialization
steps, like changing the state of a GPIO or enabling a clock, which
requires even more hacks. This driver creates a platform device
representing the hub which performs the necessary initialization.
Currently it only supports switching on a single regulator, support
for multiple regulators or other actions can be added as needed.
Different initialization sequences can be supported based on the
compatible string.

Besides performing the initialization the driver can be configured
to power the hub off during system suspend. This can help to extend
battery life on battery powered devices which have no requirements
to keep the hub powered during suspend. The driver can also be
configured to leave the hub powered when a wakeup capable USB device
is connected when suspending, and power it off otherwise.

Changes in v7:
- series rebased on qcom/arm64-for-5.13

Changes in v6:
- updated summary

Changes in v5:
- cover letter added

Matthias Kaehlcke (5):
  dt-bindings: usb: Add binding for Realtek RTS5411 hub controller
  USB: misc: Add onboard_usb_hub driver
  of/platform: Add stubs for of_platform_device_create/destroy()
  usb: host: xhci-plat: Create platform device for onboard hubs in
probe()
  arm64: dts: qcom: sc7180-trogdor: Add nodes for onboard USB hub

 .../sysfs-bus-platform-onboard-usb-hub|   8 +
 .../bindings/usb/realtek,rts5411.yaml |  59 +++
 MAINTAINERS   |   7 +
 .../boot/dts/qcom/sc7180-trogdor-lazor-r0.dts |  19 +-
 .../boot/dts/qcom/sc7180-trogdor-lazor-r1.dts |  11 +-
 .../arm64/boot/dts/qcom/sc7180-trogdor-r1.dts |  19 +-
 arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi  |  21 +-
 drivers/usb/host/xhci-plat.c  |  16 +
 drivers/usb/misc/Kconfig  |  17 +
 drivers/usb/misc/Makefile |   1 +
 drivers/usb/misc/onboard_usb_hub.c| 415 ++
 include/linux/of_platform.h   |  22 +-
 include/linux/usb/hcd.h   |   2 +
 include/linux/usb/onboard_hub.h   |  15 +
 14 files changed, 596 insertions(+), 36 deletions(-)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-platform-onboard-usb-hub
 create mode 100644 Documentation/devicetree/bindings/usb/realtek,rts5411.yaml
 create mode 100644 drivers/usb/misc/onboard_usb_hub.c
 create mode 100644 include/linux/usb/onboard_hub.h

-- 
2.31.0.208.g409f899ff0-goog



Re: [PATCH V2 1/5] arm64: dts: qcom: pm7325: Add PMIC peripherals for pm7325

2021-04-02 Thread Matthias Kaehlcke
On Fri, Apr 02, 2021 at 10:35:54AM -0700, Matthias Kaehlcke wrote:
> On Thu, Apr 01, 2021 at 02:43:12PM +0530, satya priya wrote:
> 
> > subject: arm64: dts: qcom: pm7325: Add PMIC peripherals for pm7325
> 
> nit: maybe just 'arm64: dts: qcom: Add pm7325 support/.dtsi' or similar?
> 
> > Add temp-alarm and GPIO support for pm7325.
> 
> nit: it's more than that, you are adding the .dtsi for the PMIC itself.
> 
> > Signed-off-by: satya priya 
> > ---
> >  arch/arm64/boot/dts/qcom/pm7325.dtsi | 53 
> > 
> >  1 file changed, 53 insertions(+)
> >  create mode 100644 arch/arm64/boot/dts/qcom/pm7325.dtsi
> > 
> > diff --git a/arch/arm64/boot/dts/qcom/pm7325.dtsi 
> > b/arch/arm64/boot/dts/qcom/pm7325.dtsi
> > new file mode 100644
> > index 000..1e0848a
> > --- /dev/null
> > +++ b/arch/arm64/boot/dts/qcom/pm7325.dtsi
> > @@ -0,0 +1,53 @@
> > +// SPDX-License-Identifier: BSD-3-Clause
> > +// Copyright (c) 2021, The Linux Foundation. All rights reserved.
> > +
> > +#include 
> > +#include 
> > +
> > +_bus {
> > +   pm7325: pmic@1 {
> > +   compatible = "qcom,pm7325", "qcom,spmi-pmic";
> 
> I saw the patches that add the compatible strings for the GPIOs, but
> can't find those that add the strings for the PMICs themselves. Could
> you provide a link if they have been sent already?
> 
> > +   reg = <0x1 SPMI_USID>;
> > +   #address-cells = <1>;
> > +   #size-cells = <0>;
> > +
> > +   pm7325_temp_alarm: temp-alarm@a00 {
> > +   compatible = "qcom,spmi-temp-alarm";
> > +   reg = <0xa00>;
> > +   interrupts = <0x1 0xa 0x0 IRQ_TYPE_EDGE_BOTH>;
> > +   #thermal-sensor-cells = <0>;
> > +   };
> > +
> > +   pm7325_gpios: gpios@8800 {
> > +   compatible = "qcom,pm7325-gpio", "qcom,spmi-gpio";
> > +   reg = <0x8800>;
> > +   gpio-controller;
> > +   gpio-ranges = <_gpios 0 0 10>;

The GPIO enumeration is a bit confusing. The pm7325 has GPIO_01 to
GPIO_10, however IIUC they are mapped such that under Linux
enumeration starts with 0. I guess it makes sense to start with 0 and
it's done consistently for 'qcom,spmi-gpio', but it's something that must
be taken into account when using/configuring those GPIOs.


Re: [PATCH V2 4/5] arm64: dts: qcom: pmr735a: Add PMIC peripherals for pmr735a

2021-04-02 Thread Matthias Kaehlcke
Same comments as '[1/5] arm64: dts: qcom: pm7325: Add PMIC peripherals
for pm7325', plus another nit:

'[3/5] arm64: dts: qcom: pmk8350: Add PMIC peripherals for pmk8350' has
an ADC config for the die temperature of the pmr735a, hence it seems this
patch should be before the 'pmk8350' one in this series.

On Thu, Apr 01, 2021 at 02:43:15PM +0530, satya priya wrote:
> Add temp-alarm and GPIO support for pmr735a.
> 
> Signed-off-by: satya priya 
> ---
>  arch/arm64/boot/dts/qcom/pmr735a.dtsi | 53 
> +++
>  1 file changed, 53 insertions(+)
>  create mode 100644 arch/arm64/boot/dts/qcom/pmr735a.dtsi
> 
> diff --git a/arch/arm64/boot/dts/qcom/pmr735a.dtsi 
> b/arch/arm64/boot/dts/qcom/pmr735a.dtsi
> new file mode 100644
> index 000..07077fb
> --- /dev/null
> +++ b/arch/arm64/boot/dts/qcom/pmr735a.dtsi
> @@ -0,0 +1,53 @@
> +// SPDX-License-Identifier: BSD-3-Clause
> +// Copyright (c) 2021, The Linux Foundation. All rights reserved.
> +
> +#include 
> +#include 
> +
> +_bus {
> + pmr735a: pmic@4 {
> + compatible = "qcom,pmr735a", "qcom,spmi-pmic";
> + reg = <0x4 SPMI_USID>;
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + pmr735a_temp_alarm: temp-alarm@a00 {
> + compatible = "qcom,spmi-temp-alarm";
> + reg = <0xa00>;
> + interrupts = <0x4 0xa 0x0 IRQ_TYPE_EDGE_BOTH>;
> + #thermal-sensor-cells = <0>;
> + };
> +
> + pmr735a_gpios: gpios@8800 {
> + compatible = "qcom,pmr735a-gpio", "qcom,spmi-gpio";
> + reg = <0x8800>;
> + gpio-controller;
> + gpio-ranges = <_gpios 0 0 4>;
> + #gpio-cells = <2>;
> + interrupt-controller;
> + #interrupt-cells = <2>;
> + };
> + };
> +};
> +
> +_zones {
> + pmr735a_thermal: pmr735a-thermal {
> + polling-delay-passive = <100>;
> + polling-delay = <0>;
> + thermal-sensors = <_temp_alarm>;
> +
> + trips {
> + pmr735a_trip0: trip0 {
> + temperature = <95000>;
> + hysteresis = <0>;
> + type = "passive";
> + };
> +
> + pmr735a_trip1: trip1 {
> + temperature = <115000>;
> + hysteresis = <0>;
> + type = "critical";
> + };
> + };
> + };
> +};
> -- 
> QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member 
> of Code Aurora Forum, hosted by The Linux Foundation
> 


Re: [PATCH V2 3/5] arm64: dts: qcom: pmk8350: Add PMIC peripherals for pmk8350

2021-04-02 Thread Matthias Kaehlcke
On Thu, Apr 01, 2021 at 02:43:14PM +0530, satya priya wrote:
> subject: arm64: dts: qcom: pmk8350: Add PMIC peripherals for pmk8350

same nit as for 1/5: maybe just 'arm64: dts: qcom: Add pml7350 support/.dtsi'
or similar since this adds the initial .dtsi for the pmk8350?

> Add PON, GPIO, RTC and other PMIC infra modules support for pmk8350.

nit: also mention that it adds the pmk8350 .dtsi in the first place.

> Signed-off-by: satya priya 
> ---
>  arch/arm64/boot/dts/qcom/pmk8350.dtsi | 100 
> ++
>  1 file changed, 100 insertions(+)
>  create mode 100644 arch/arm64/boot/dts/qcom/pmk8350.dtsi
> 
> diff --git a/arch/arm64/boot/dts/qcom/pmk8350.dtsi 
> b/arch/arm64/boot/dts/qcom/pmk8350.dtsi
> new file mode 100644
> index 000..13631f2
> --- /dev/null
> +++ b/arch/arm64/boot/dts/qcom/pmk8350.dtsi
> @@ -0,0 +1,100 @@
> +// SPDX-License-Identifier: BSD-3-Clause
> +// Copyright (c) 2021, The Linux Foundation. All rights reserved.
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +_bus {
> + pmk8350: pmic@0 {
> + compatible = "qcom,pmk8350", "qcom,spmi-pmic";

Please provide a link to the binding if it has been sent.

> + reg = <0x0 SPMI_USID>;
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + pmk8350_pon: pon@1300 {
> + compatible = "qcom,pm8998-pon";
> + reg = <0x1300>;
> +
> + pwrkey {
> + compatible = "qcom,pmk8350-pwrkey";
> + interrupts = <0x0 0x13 0x7 IRQ_TYPE_EDGE_BOTH>;
> + linux,code = ;
> + };
> +
> + resin {
> + compatible = "qcom,pmk8350-resin";
> + interrupts = <0x0 0x13 0x6 IRQ_TYPE_EDGE_BOTH>;
> + linux,code = ;
> + };

Is the usage of this keys really universal across different boards?

At least for the volume down key for most PMICs the config is in the
board file, which seems to make more sense.

> + };
> +
> + pmk8350_vadc: adc@3100 {
> + compatible = "qcom,spmi-adc7";
> + reg = <0x3100>;
> + #address-cells = <1>;
> + #size-cells = <0>;
> + interrupts = <0x0 0x31 0x0 IRQ_TYPE_EDGE_RISING>;
> + interrupt-names = "eoc-int-en-set";
> + #io-channel-cells = <1>;
> + io-channel-ranges;
> +
> + pmk8350_die_temp {
> + reg = ;
> + label = "pmk8350_die_temp";
> + qcom,pre-scaling = <1 1>;
> + };
> +
> + pm8350_die_temp {
> + reg = ;
> + label = "pm8350_die_temp";
> + qcom,pre-scaling = <1 1>;
> + };

nit: I think this should be 'alphabetical' order, so 'pm8350_die_temp' should
be before 'pmk8350_die_temp'.

> +
> + pmr735a_die_temp {
> + reg = ;
> + label = "pmr735a_die_temp";
> + qcom,pre-scaling = <1 1>;
> + };
> +
> + pmr735b_die_temp {
> + reg = ;
> + label = "pmr735b_die_temp";
> + qcom,pre-scaling = <1 1>;
> + };

Is it guaranteed that a board with the pmk8350 will always have the
other 3 PMICs?

> + };
> +
> + pmk8350_adc_tm: adc-tm@3400 {
> + compatible = "qcom,adc-tm7";
> + reg = <0x3400>;
> + interrupts = <0x0 0x34 0x0 IRQ_TYPE_EDGE_RISING>;
> + interrupt-names = "threshold";
> + #address-cells = <1>;
> + #size-cells = <0>;
> + #thermal-sensor-cells = <1>;
> + status = "disabled";
> + };
> +
> + pmk8350_gpios: gpios@b000 {
> + compatible = "qcom,pmk8350-gpio", "qcom,spmi-gpio";
> + reg = <0xb000>;
> + gpio-controller;
> + gpio-ranges = <_gpios 0 0 4>;
> + #gpio-cells = <2>;
> + interrupt-controller;
> + #interrupt-cells = <2>;
> + };
> +
> + pmk8350_rtc: rtc@6100 {

nit: nodes should be ordered by address, hence 'rtc@6100' should be before
'gpios@b000'.

> + compatible = "qcom,pmk8350-rtc";
> + reg = <0x6100>, <0x6200>;
> + reg-names = "rtc", 

Re: [PATCH V2 1/5] arm64: dts: qcom: pm7325: Add PMIC peripherals for pm7325

2021-04-02 Thread Matthias Kaehlcke
On Thu, Apr 01, 2021 at 02:43:12PM +0530, satya priya wrote:

> subject: arm64: dts: qcom: pm7325: Add PMIC peripherals for pm7325

nit: maybe just 'arm64: dts: qcom: Add pm7325 support/.dtsi' or similar?

> Add temp-alarm and GPIO support for pm7325.

nit: it's more than that, you are adding the .dtsi for the PMIC itself.

> Signed-off-by: satya priya 
> ---
>  arch/arm64/boot/dts/qcom/pm7325.dtsi | 53 
> 
>  1 file changed, 53 insertions(+)
>  create mode 100644 arch/arm64/boot/dts/qcom/pm7325.dtsi
> 
> diff --git a/arch/arm64/boot/dts/qcom/pm7325.dtsi 
> b/arch/arm64/boot/dts/qcom/pm7325.dtsi
> new file mode 100644
> index 000..1e0848a
> --- /dev/null
> +++ b/arch/arm64/boot/dts/qcom/pm7325.dtsi
> @@ -0,0 +1,53 @@
> +// SPDX-License-Identifier: BSD-3-Clause
> +// Copyright (c) 2021, The Linux Foundation. All rights reserved.
> +
> +#include 
> +#include 
> +
> +_bus {
> + pm7325: pmic@1 {
> + compatible = "qcom,pm7325", "qcom,spmi-pmic";

I saw the patches that add the compatible strings for the GPIOs, but
can't find those that add the strings for the PMICs themselves. Could
you provide a link if they have been sent already?

> + reg = <0x1 SPMI_USID>;
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + pm7325_temp_alarm: temp-alarm@a00 {
> + compatible = "qcom,spmi-temp-alarm";
> + reg = <0xa00>;
> + interrupts = <0x1 0xa 0x0 IRQ_TYPE_EDGE_BOTH>;
> + #thermal-sensor-cells = <0>;
> + };
> +
> + pm7325_gpios: gpios@8800 {
> + compatible = "qcom,pm7325-gpio", "qcom,spmi-gpio";
> + reg = <0x8800>;
> + gpio-controller;
> + gpio-ranges = <_gpios 0 0 10>;
> + #gpio-cells = <2>;
> + interrupt-controller;
> + #interrupt-cells = <2>;
> + };
> + };
> +};
> +
> +_zones {
> + pm7325_thermal: pm7325-thermal {
> + polling-delay-passive = <100>;
> + polling-delay = <0>;
> + thermal-sensors = <_temp_alarm>;
> +
> + trips {
> + pm7325_trip0: trip0 {
> + temperature = <95000>;
> + hysteresis = <0>;
> + type = "passive";
> + };
> +
> + pm7325_trip1: trip1 {

nit: the critical trip point is often named -crit. One reason for
this could be that it allows to add other non-critical trip points (in
the .dtsi itself or the .dts), without messing up the
enumeration scheme.

> + temperature = <115000>;
> + hysteresis = <0>;
> + type = "critical";
> + };
> + };
> + };
> +};


Re: [PATCH V3 3/5] arm64: dts: qcom: sc7280: Add RPMh regulators for sc7280-idp

2021-03-31 Thread Matthias Kaehlcke
On Wed, Mar 31, 2021 at 05:35:37PM +0530, satya priya wrote:
> Add regulator devices for SC7280 as RPMh regulators. This ensures
> that consumers are able to modify the physical state of PMIC
> regulators.
> 
> Signed-off-by: satya priya 

Reviewed-by: Matthias Kaehlcke 

I did not verify the voltage ranges. The datasheet specifies some
ranges, but apparently the settings in the AOP are what really
matters [1].

[1] 
https://patchwork.kernel.org/project/linux-arm-msm/patch/1615816454-1733-4-git-send-email-ska...@codeaurora.org/#24051523


Re: [PATCH V3 2/5] regulator: qcom-rpmh: Add PM7325/PMR735A regulator support

2021-03-31 Thread Matthias Kaehlcke
On Wed, Mar 31, 2021 at 05:35:36PM +0530, satya priya wrote:
> Add support for PM7325/PMR735A regulators. This ensures
> that consumers are able to modify the physical state of PMIC
> regulators.
> 
> Signed-off-by: satya priya 

Reviewed-by: Matthias Kaehlcke 


Re: [PATCH] arm64: dts: qcom: sc7280: Add PMIC peripherals for SC7280

2021-03-30 Thread Matthias Kaehlcke
On Thu, Mar 25, 2021 at 10:50:57AM +0530, ska...@codeaurora.org wrote:
> Hi Matthias,
> 
> On 2021-03-22 23:04, Matthias Kaehlcke wrote:
> > Hi Satya,
> > 
> > On Mon, Mar 22, 2021 at 06:50:47PM +0530, ska...@codeaurora.org wrote:
> > > Hi Matthias,
> > > 
> > > On 2021-03-13 02:10, Matthias Kaehlcke wrote:
> > > > Hi Satya,
> > > >
> > > > On Thu, Mar 11, 2021 at 04:10:29PM +0530, satya priya wrote:
> > > > > Add PM7325/PM8350C/PMK8350/PMR735A peripherals such as PON,
> > > > > GPIOs, RTC and other PMIC infra modules for SC7280.
> > > > >
> > > > > Signed-off-by: satya priya 
> > > > > ---
> > > > > This patch depends on base DT and board files for SC7280 to merge
> > > > > first
> > > > > https://lore.kernel.org/patchwork/project/lkml/list/?series=487403
> > > > >
> > > > >  arch/arm64/boot/dts/qcom/pm7325.dtsi  |  60 
> > > > >  arch/arm64/boot/dts/qcom/pm8350c.dtsi |  60 
> > > > >  arch/arm64/boot/dts/qcom/pmk8350.dtsi | 104
> > > > > ++
> > > > >  arch/arm64/boot/dts/qcom/pmr735a.dtsi |  60 
> > > > >  arch/arm64/boot/dts/qcom/sc7280.dtsi  |   8 +++
> > > > >  5 files changed, 292 insertions(+)
> > > > >  create mode 100644 arch/arm64/boot/dts/qcom/pm7325.dtsi
> > > > >  create mode 100644 arch/arm64/boot/dts/qcom/pm8350c.dtsi
> > > > >  create mode 100644 arch/arm64/boot/dts/qcom/pmk8350.dtsi
> > > > >  create mode 100644 arch/arm64/boot/dts/qcom/pmr735a.dtsi
> > > > >
> > > > > diff --git a/arch/arm64/boot/dts/qcom/pm7325.dtsi
> > > > > b/arch/arm64/boot/dts/qcom/pm7325.dtsi
> > > > > new file mode 100644
> > > > > index 000..393b256
> > > > > --- /dev/null
> > > > > +++ b/arch/arm64/boot/dts/qcom/pm7325.dtsi
> > > > > @@ -0,0 +1,60 @@
> > > >
> > > > ...
> > > >
> > > > > + polling-delay-passive = <100>;
> > > > > + polling-delay = <0>;
> > > >
> > > > Are you sure that no polling delay is needed? How does the thermal
> > > > framework
> > > > detect that the temperatures is >= the passive trip point and that it
> > > > should
> > > > start polling at 'polling-delay-passive' rate?
> > > >
> > > 
> > > As the temp-alarm has interrupt support, whenever preconfigured
> > > threshold
> > > violates it notifies thermal framework, so I think the polling delay
> > > is not
> > > needed here.
> > 
> > From the documentation I found it's not clear to me how exactly these
> > interrupts work. Is a single interrupt triggered when the threshold is
> > violated or are there periodic (?) interrupts as long as the temperature
> > is above the stage 0 threshold?
> > 
> > Why is 'polling-delay-passive' passive needed if there are interrupts?
> > Maybe
> > to detect that the zone should transition from passive to no cooling
> > when the
> > temperature drops below the stage 0 threshold?
> 
> The PMIC TEMP_ALARM peripheral maintains an internal over-temperature stage:
> 0, 1, 2, or 3.  Stage 0 is normal operation below the lowest (stage 1)
> threshold [usually 95 C].  When in stage 1, the temperature is between the
> stage 1 and 2 thresholds [stage 2 threshold is usually 115 C].  Upon hitting
> the stage 3 threshold [usually 145 C], the PMIC hardware will automatically
> shut down the system.
> 
> The TEMP_ALARM IRQ fires on stage 0 -> 1 and 1 -> 0 transitions.  We
> therefore set polling-delay = <0> since there is no need for software to
> monitor the temperature periodically when operating in stage 0.  Upon
> crossing the stage 1 threshold, SW receives the IRQ and the thermal
> framework hits its first trip changing the thermal zone to passive mode.
> This then engages the 100 ms polling enabled via polling-delay-passive =
> <100>.  If the temperate keeps climbing and passes the stage 2 threshold,
> the thermal framework hits the second trip (which is critical) and it
> initiates an orderly shutdown.  If the temperature drops below the stage 1
> threshold, then the thermal framework exits passive mode and stops polling.
> This approach reduces/eliminates the software overhead when not at an
> elevated temperature.

Thanks for the clarification. With the interrupt only firing on stage 0 -> 1
and stage 1 -> 0 it makes sense. I was expecting interrupts on the other
transitions too.


Re: [RESEND PATCH V3 1/2] soc: qcom-geni-se: Cleanup the code to remove proxy votes

2021-03-24 Thread Matthias Kaehlcke
On Wed, Mar 24, 2021 at 03:48:35PM +0530, Roja Rani Yarubandi wrote:
> This reverts commit 048eb908a1f2 ("soc: qcom-geni-se: Add interconnect
> support to fix earlycon crash")
> 
> ICC core and platforms drivers supports sync_state feature, which
> ensures that the default ICC BW votes from the bootloader is not
> removed until all it's consumers are probes.
> 
> The proxy votes were needed in case other QUP child drivers
> I2C, SPI probes before UART, they can turn off the QUP-CORE clock
> which is shared resources for all QUP driver, this causes unclocked
> access to HW from earlycon.
> 
> Given above support from ICC there is no longer need to maintain
> proxy votes on QUP-CORE ICC node from QUP wrapper driver for early
> console usecase, the default votes won't be removed until real
> console is probed.
> 
> Cc: sta...@vger.kernel.org
> Fixes: 266cd33b5913 ("interconnect: qcom: Ensure that the floor bandwidth 
> value is enforced")
> Fixes: 7d3b0b0d8184 ("interconnect: qcom: Use icc_sync_state")

Neither of these commits introduced an issue that is fixed by this
patch, rather this patch relies on these commits to not (re-)introduce
an issue.

I don't think a 'Fixes' tag is needed for this patch. If anything it
fixes the same issue as commit 048eb908a1f2 ("soc: qcom-geni-se:
Add interconnect support to fix earlycon crash"), which doesn't
have such a tag.


Re: [PATCH v5 3/4] usb: dwc3: qcom: Configure wakeup interrupts and set genpd active wakeup flag

2021-03-23 Thread Matthias Kaehlcke
On Tue, Mar 23, 2021 at 05:49:14PM -0700, Matthias Kaehlcke wrote:
> On Tue, Mar 23, 2021 at 01:11:18PM +0100, Greg Kroah-Hartman wrote:
> > On Mon, Mar 22, 2021 at 11:01:19PM +0530, Sandeep Maheswaram wrote:
> > > Configure interrupts based on hs_phy_mode to avoid triggering of
> > > interrupts during system suspend and suspends successfully.
> > > Set genpd active wakeup flag for usb gdsc if wakeup capable devices
> > > are connected so that wake up happens without reenumeration.
> > > Add helper functions to enable,disable wake irqs.
> > 
> > That feels like a lot of different things all in one patch.
> 
> Sandeep: one thing you could do to reduce the churn is to add
> dwc3_qcom_enable/disable_wakeup_irq() in a separate patch, without
> any functional changes. Then this patch would only add the different
> branches based on the PHY mode.
> 
> The handling of the power domain could probably also be done in a
> separate patch, if I recall correctly it is only an optimization.

Actually another thing that could be in a separate patch is enabling
wakeup support based on 'wakeup-source'. That's not even directly
related with this series.

With all that you'd have fairly atomic patches and it should be easy to
write meaningful commit messages.


Re: [PATCH v5 3/4] usb: dwc3: qcom: Configure wakeup interrupts and set genpd active wakeup flag

2021-03-23 Thread Matthias Kaehlcke
On Tue, Mar 23, 2021 at 01:11:18PM +0100, Greg Kroah-Hartman wrote:
> On Mon, Mar 22, 2021 at 11:01:19PM +0530, Sandeep Maheswaram wrote:
> > Configure interrupts based on hs_phy_mode to avoid triggering of
> > interrupts during system suspend and suspends successfully.
> > Set genpd active wakeup flag for usb gdsc if wakeup capable devices
> > are connected so that wake up happens without reenumeration.
> > Add helper functions to enable,disable wake irqs.
> 
> That feels like a lot of different things all in one patch.

Sandeep: one thing you could do to reduce the churn is to add
dwc3_qcom_enable/disable_wakeup_irq() in a separate patch, without
any functional changes. Then this patch would only add the different
branches based on the PHY mode.

The handling of the power domain could probably also be done in a
separate patch, if I recall correctly it is only an optimization.


Re: [PATCH v5 2/4] usb: dwc3: host: Add suspend_quirk for dwc3 host

2021-03-23 Thread Matthias Kaehlcke
On Mon, Mar 22, 2021 at 11:01:18PM +0530, Sandeep Maheswaram wrote:
> Adding suspend quirk function for dwc3 host which will be called
> during xhci suspend.
> Setting hs_phy_mode, ss_phy_mode , phy_power_off flags and phy mode
> during host suspend.
> 
> Signed-off-by: Sandeep Maheswaram 
> ---
>  drivers/usb/dwc3/core.h |  3 +++
>  drivers/usb/dwc3/host.c | 58 
> +
>  2 files changed, 61 insertions(+)
> 
> diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
> index ce6bd84..f05546c 100644
> --- a/drivers/usb/dwc3/core.h
> +++ b/drivers/usb/dwc3/core.h
> @@ -1113,6 +1113,9 @@ struct dwc3 {
>  
>   boolphys_ready;
>  
> + unsigned inths_phy_mode;
> + boolphy_power_off;
> +
>   struct ulpi *ulpi;
>   boolulpi_ready;
>  
> diff --git a/drivers/usb/dwc3/host.c b/drivers/usb/dwc3/host.c
> index f29a264..3db042c 100644
> --- a/drivers/usb/dwc3/host.c
> +++ b/drivers/usb/dwc3/host.c
> @@ -11,6 +11,13 @@
>  #include 
>  
>  #include "core.h"
> +#include "../host/xhci.h"
> +#include "../host/xhci-plat.h"
> +int xhci_dwc3_suspend_quirk(struct usb_hcd *hcd);
> +
> +static const struct xhci_plat_priv xhci_plat_dwc3_xhci = {
> + .suspend_quirk = xhci_dwc3_suspend_quirk,
> +};
>  
>  static int dwc3_host_get_irq(struct dwc3 *dwc)
>  {
> @@ -115,6 +122,13 @@ int dwc3_host_init(struct dwc3 *dwc)
>   }
>   }
>  
> + ret = platform_device_add_data(xhci, _plat_dwc3_xhci,
> + sizeof(struct xhci_plat_priv));
> + if (ret) {
> + dev_err(dwc->dev, "failed to add data to xHCI\n");
> + goto err;
> + }
> +
>   ret = platform_device_add(xhci);
>   if (ret) {
>   dev_err(dwc->dev, "failed to register xHCI device\n");
> @@ -127,6 +141,50 @@ int dwc3_host_init(struct dwc3 *dwc)
>   return ret;
>  }
>  
> +static void dwc3_set_phy_mode(struct usb_hcd *hcd)
> +{
> +
> + int i, num_ports;
> + u32 reg;
> + unsigned int ss_phy_mode = 0;
> + struct dwc3 *dwc = dev_get_drvdata(hcd->self.controller->parent);
> + struct xhci_hcd *xhci_hcd = hcd_to_xhci(hcd);
> +
> + dwc->hs_phy_mode = 0;
> +
> + reg = readl(_hcd->cap_regs->hcs_params1);
> +
> + num_ports = HCS_MAX_PORTS(reg);

nit: remove empty line between the two lines above. 'reg' is read to
determine the number of ports and discarded afterwards, so it makes
sense to establish that relationship visually. You could (optionally)
add an empty line after assigning 'num_ports'.

> + for (i = 0; i < num_ports; i++) {
> + reg = readl(_hcd->op_regs->port_status_base + i * 0x04);
> + if (reg & PORT_PE) {
> + if (DEV_HIGHSPEED(reg) || DEV_FULLSPEED(reg))
> + dwc->hs_phy_mode |= PHY_MODE_USB_HOST_HS;
> + else if (DEV_LOWSPEED(reg))
> + dwc->hs_phy_mode |= PHY_MODE_USB_HOST_LS;
> +
> + if (DEV_SUPERSPEED(reg))
> + ss_phy_mode |= PHY_MODE_USB_HOST_SS;
> + }
> + }
> + phy_set_mode(dwc->usb2_generic_phy, dwc->hs_phy_mode);
> + phy_set_mode(dwc->usb3_generic_phy, ss_phy_mode);
> +}
> +
> +int xhci_dwc3_suspend_quirk(struct usb_hcd *hcd)
> +{
> + struct dwc3 *dwc = dev_get_drvdata(hcd->self.controller->parent);
> +
> + dwc3_set_phy_mode(hcd);
> +
> + dwc->phy_power_off = true;

it seems silly to assign this field only to overwrite it two lines later
if wakeup capable descendants are connected. Making the assignment in an
'else' branch would be clearer IMO.

> +
> + if (usb_wakeup_enabled_descendants(hcd->self.root_hub))
> + dwc->phy_power_off = false;
> +
> + return 0;
> +}
> +
>  void dwc3_host_exit(struct dwc3 *dwc)
>  {
>   platform_device_unregister(dwc->xhci);


Re: [PATCH v5 1/4] usb: dwc3: core: Host wake up support from system suspend

2021-03-23 Thread Matthias Kaehlcke
On Mon, Mar 22, 2021 at 11:01:17PM +0530, Sandeep Maheswaram wrote:
> Avoiding phy powerdown when wakeup capable devices are connected.
> 
> Signed-off-by: Sandeep Maheswaram 
> ---
>  drivers/usb/dwc3/core.c | 8 +---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
> index 94fdbe5..9ecd7ac 100644
> --- a/drivers/usb/dwc3/core.c
> +++ b/drivers/usb/dwc3/core.c
> @@ -1702,7 +1702,7 @@ static int dwc3_suspend_common(struct dwc3 *dwc, 
> pm_message_t msg)
>   dwc3_core_exit(dwc);
>   break;
>   case DWC3_GCTL_PRTCAP_HOST:
> - if (!PMSG_IS_AUTO(msg)) {
> + if (!PMSG_IS_AUTO(msg) && dwc->phy_power_off) {

This is the first patch of the series, but the 'phy_power_off' flag is
only added by '[2/4] usb: dwc3: host: Add suspend_quirk for dwc3 host'.
Patches should not rely on later patches in the series in order to build
error/warning free. It seems you need to swap the order of patch 1 and 2.

>   dwc3_core_exit(dwc);
>   break;
>   }
> @@ -1763,13 +1763,15 @@ static int dwc3_resume_common(struct dwc3 *dwc, 
> pm_message_t msg)
>   spin_unlock_irqrestore(>lock, flags);
>   break;
>   case DWC3_GCTL_PRTCAP_HOST:
> - if (!PMSG_IS_AUTO(msg)) {
> + if (!PMSG_IS_AUTO(msg) && dwc->phy_power_off) {
>   ret = dwc3_core_init_for_resume(dwc);
>   if (ret)
>   return ret;
>   dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_HOST);
>   break;
> - }
> + } else
> + dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_HOST);
> +

nit: use curly braces since the 'if' block has them.


Re: [v1] drm/msm/disp/dpu1: icc path needs to be set before dpu runtime resume

2021-03-22 Thread Matthias Kaehlcke
On Mon, Mar 22, 2021 at 02:17:12AM -0700, Kalyan Thota wrote:
> From: Kalyan Thota 
> 
> DPU runtime resume will request for a min vote on the AXI bus as
> it is a necessary step before turning ON the AXI clock.
> 
> The change does below
> 1) Move the icc path set before requesting runtime get_sync.
> 2) remove the dependency of hw catalog for min ib vote
> as it is initialized at a later point.
> 
> Signed-off-by: Kalyan Thota 

Confirmed that this fixes a bunch of warnings at boot on SC7180 when
(out-of-tree) camera support is enabled:

  [1.832228] gcc_disp_hf_axi_clk status stuck at 'off'
  [2.118292] gcc_disp_hf_axi_clk status stuck at 'off'
  [2.442383] gcc_disp_hf_axi_clk already disabled
  [2.750054] gcc_disp_hf_axi_clk already unprepared
  [3.154835] gcc_disp_hf_axi_clk already disabled
  [3.421835] gcc_disp_hf_axi_clk already unprepared

Tested-by: Matthias Kaehlcke 


Re: [PATCH] arm64: dts: qcom: sc7280: Add PMIC peripherals for SC7280

2021-03-22 Thread Matthias Kaehlcke
Hi Satya,

On Mon, Mar 22, 2021 at 06:50:47PM +0530, ska...@codeaurora.org wrote:
> Hi Matthias,
> 
> On 2021-03-13 02:10, Matthias Kaehlcke wrote:
> > Hi Satya,
> > 
> > On Thu, Mar 11, 2021 at 04:10:29PM +0530, satya priya wrote:
> > > Add PM7325/PM8350C/PMK8350/PMR735A peripherals such as PON,
> > > GPIOs, RTC and other PMIC infra modules for SC7280.
> > > 
> > > Signed-off-by: satya priya 
> > > ---
> > > This patch depends on base DT and board files for SC7280 to merge
> > > first
> > > https://lore.kernel.org/patchwork/project/lkml/list/?series=487403
> > > 
> > >  arch/arm64/boot/dts/qcom/pm7325.dtsi  |  60 
> > >  arch/arm64/boot/dts/qcom/pm8350c.dtsi |  60 
> > >  arch/arm64/boot/dts/qcom/pmk8350.dtsi | 104
> > > ++
> > >  arch/arm64/boot/dts/qcom/pmr735a.dtsi |  60 
> > >  arch/arm64/boot/dts/qcom/sc7280.dtsi  |   8 +++
> > >  5 files changed, 292 insertions(+)
> > >  create mode 100644 arch/arm64/boot/dts/qcom/pm7325.dtsi
> > >  create mode 100644 arch/arm64/boot/dts/qcom/pm8350c.dtsi
> > >  create mode 100644 arch/arm64/boot/dts/qcom/pmk8350.dtsi
> > >  create mode 100644 arch/arm64/boot/dts/qcom/pmr735a.dtsi
> > > 
> > > diff --git a/arch/arm64/boot/dts/qcom/pm7325.dtsi
> > > b/arch/arm64/boot/dts/qcom/pm7325.dtsi
> > > new file mode 100644
> > > index 000..393b256
> > > --- /dev/null
> > > +++ b/arch/arm64/boot/dts/qcom/pm7325.dtsi
> > > @@ -0,0 +1,60 @@
> > 
> > ...
> > 
> > > + polling-delay-passive = <100>;
> > > + polling-delay = <0>;
> > 
> > Are you sure that no polling delay is needed? How does the thermal
> > framework
> > detect that the temperatures is >= the passive trip point and that it
> > should
> > start polling at 'polling-delay-passive' rate?
> > 
> 
> As the temp-alarm has interrupt support, whenever preconfigured threshold
> violates it notifies thermal framework, so I think the polling delay is not
> needed here.

>From the documentation I found it's not clear to me how exactly these
interrupts work. Is a single interrupt triggered when the threshold is
violated or are there periodic (?) interrupts as long as the temperature
is above the stage 0 threshold?

Why is 'polling-delay-passive' passive needed if there are interrupts? Maybe
to detect that the zone should transition from passive to no cooling when the
temperature drops below the stage 0 threshold?


[PATCH v4 0/3] arm64: dts: qcom: sc7180: Disable the charger thermal zone on more trogdor boards

2021-03-22 Thread Matthias Kaehlcke
We already disabled the charger thermal zone for lazor to avoid
bogus temperature readings from an unsupported thermistor. Some
revisions of other trogdor boards that are added by Doug's
'arm64: dts: qcom: Update sc7180-trogdor variants from downstream'
series have the same problem. Disable the charger thermal zone for
them too.

This series is based on v2 of the 'arm64: dts: qcom: Update
sc7180-trogdor variants from downstream' series
(https://patchwork.kernel.org/project/linux-arm-msm/list/?series=440315)

(no changes since v1)

Matthias Kaehlcke (3):
  arm64: dts: qcom: sc7180: lazor: Simplify disabling of charger thermal
zone
  arm64: dts: qcom: sc7180: Add pompom rev3
  arm64: dts: qcom: sc7180: Add CoachZ rev3

 arch/arm64/boot/dts/qcom/Makefile |  6 ++-
 .../dts/qcom/sc7180-trogdor-coachz-r1-lte.dts |  4 +-
 .../dts/qcom/sc7180-trogdor-coachz-r1.dts | 13 ++-
 ...e.dts => sc7180-trogdor-coachz-r3-lte.dts} |  6 +--
 ...hz-r2.dts => sc7180-trogdor-coachz-r3.dts} |  4 +-
 .../boot/dts/qcom/sc7180-trogdor-lazor-r0.dts |  9 -
 .../boot/dts/qcom/sc7180-trogdor-lazor-r1.dts |  9 -
 .../boot/dts/qcom/sc7180-trogdor-lazor-r3.dts |  9 -
 .../boot/dts/qcom/sc7180-trogdor-lazor.dtsi   |  9 +
 .../dts/qcom/sc7180-trogdor-pompom-r1.dts | 12 ++
 .../dts/qcom/sc7180-trogdor-pompom-r2-lte.dts |  4 +-
 .../dts/qcom/sc7180-trogdor-pompom-r2.dts | 38 +--
 .../dts/qcom/sc7180-trogdor-pompom-r3-lte.dts | 14 +++
 .../dts/qcom/sc7180-trogdor-pompom-r3.dts | 15 
 .../boot/dts/qcom/sc7180-trogdor-pompom.dtsi  | 29 ++
 15 files changed, 112 insertions(+), 69 deletions(-)
 rename arch/arm64/boot/dts/qcom/{sc7180-trogdor-coachz-r2-lte.dts => 
sc7180-trogdor-coachz-r3-lte.dts} (69%)
 rename arch/arm64/boot/dts/qcom/{sc7180-trogdor-coachz-r2.dts => 
sc7180-trogdor-coachz-r3.dts} (75%)
 create mode 100644 arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r3-lte.dts
 create mode 100644 arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r3.dts

-- 
2.31.0.rc2.261.g7f71774620-goog



[PATCH v4 2/3] arm64: dts: qcom: sc7180: Add pompom rev3

2021-03-22 Thread Matthias Kaehlcke
The only kernel visible change with respect to rev2 is that pompom
rev3 changed the charger thermistor from a 47k to a 100k NTC to use
a thermistor which is supported by the PM6150 ADC driver.

Disable the charger thermal zone for pompom rev1 and rev2 to avoid
the use of bogus temperature values from the unsupported thermistor.

Signed-off-by: Matthias Kaehlcke 
Reviewed-by: Douglas Anderson 
---

Changes in v4:
- added missing '&' to phandle in rev1
- added Reviewed-by tag from Doug

Changes in v3:
- don't add LOCK key

Changes in v2:
- moved keyboard definition to sc7180-trogdor-pompom.dtsi instead
  of duplicating it, use cros-ec keyboard for rev1
- squashed with 'arm64: dts: qcom: sc7180: pompom: Disable charger
  thermal zone for rev1 and rev2'

 arch/arm64/boot/dts/qcom/Makefile |  2 +
 .../dts/qcom/sc7180-trogdor-pompom-r1.dts | 12 ++
 .../dts/qcom/sc7180-trogdor-pompom-r2-lte.dts |  4 +-
 .../dts/qcom/sc7180-trogdor-pompom-r2.dts | 38 +--
 .../dts/qcom/sc7180-trogdor-pompom-r3-lte.dts | 14 +++
 .../dts/qcom/sc7180-trogdor-pompom-r3.dts | 15 
 .../boot/dts/qcom/sc7180-trogdor-pompom.dtsi  | 29 ++
 7 files changed, 83 insertions(+), 31 deletions(-)
 create mode 100644 arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r3-lte.dts
 create mode 100644 arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r3.dts

diff --git a/arch/arm64/boot/dts/qcom/Makefile 
b/arch/arm64/boot/dts/qcom/Makefile
index a81966d59cf7..11aa83ca798f 100644
--- a/arch/arm64/boot/dts/qcom/Makefile
+++ b/arch/arm64/boot/dts/qcom/Makefile
@@ -49,6 +49,8 @@ dtb-$(CONFIG_ARCH_QCOM)   += sc7180-trogdor-pompom-r1.dtb
 dtb-$(CONFIG_ARCH_QCOM)+= sc7180-trogdor-pompom-r1-lte.dtb
 dtb-$(CONFIG_ARCH_QCOM)+= sc7180-trogdor-pompom-r2.dtb
 dtb-$(CONFIG_ARCH_QCOM)+= sc7180-trogdor-pompom-r2-lte.dtb
+dtb-$(CONFIG_ARCH_QCOM)+= sc7180-trogdor-pompom-r3.dtb
+dtb-$(CONFIG_ARCH_QCOM)+= sc7180-trogdor-pompom-r3-lte.dtb
 dtb-$(CONFIG_ARCH_QCOM)+= sc7180-trogdor-r1.dtb
 dtb-$(CONFIG_ARCH_QCOM)+= sc7180-trogdor-r1-lte.dtb
 dtb-$(CONFIG_ARCH_QCOM)+= sdm630-sony-xperia-ganges-kirin.dtb
diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r1.dts 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r1.dts
index e720e7bd0d70..e122a6b481ff 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r1.dts
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r1.dts
@@ -9,11 +9,23 @@
 
 #include "sc7180-trogdor-pompom.dtsi"
 
+/delete-node/ _controller;
+#include 
+
 / {
model = "Google Pompom (rev1)";
compatible = "google,pompom-rev1", "qcom,sc7180";
 };
 
+/*
+ * Pompom rev1 is stuffed with a 47k NTC as charger thermistor which currently
+ * is not supported by the PM6150 ADC driver. Disable the charger thermal zone
+ * to avoid using bogus temperature values.
+ */
+_thermal {
+   status = "disabled";
+};
+
 _hub {
/* pp3300_l7c is used to power the USB hub */
/delete-property/regulator-always-on;
diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r2-lte.dts 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r2-lte.dts
index 791d496ad046..00e187c08eb9 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r2-lte.dts
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r2-lte.dts
@@ -9,6 +9,6 @@
 #include "sc7180-trogdor-lte-sku.dtsi"
 
 / {
-   model = "Google Pompom (rev2+) with LTE";
-   compatible = "google,pompom-sku0", "qcom,sc7180";
+   model = "Google Pompom (rev2) with LTE";
+   compatible = "google,pompom-rev2-sku0", "qcom,sc7180";
 };
diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r2.dts 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r2.dts
index 984d7337da78..4f32e6733f4c 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r2.dts
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r2.dts
@@ -10,35 +10,15 @@
 #include "sc7180-trogdor-pompom.dtsi"
 
 / {
-   model = "Google Pompom (rev2+)";
-   compatible = "google,pompom", "qcom,sc7180";
+   model = "Google Pompom (rev2)";
+   compatible = "google,pompom-rev2", "qcom,sc7180";
 };
 
-_controller {
-   function-row-physmap = <
-   MATRIX_KEY(0x00, 0x02, 0)   /* T1 */
-   MATRIX_KEY(0x03, 0x02, 0)   /* T2 */
-   MATRIX_KEY(0x02, 0x02, 0)   /* T3 */
-   MATRIX_KEY(0x01, 0x02, 0)   /* T4 */
-   MATRIX_KEY(0x03, 0x04, 0)   /* T5 */
-   MATRIX_KEY(0x02, 0x04, 0)   /* T6 */
-   MATRIX_KEY(0x01, 0x04, 0)   /* T7 */
-   MATRIX_KEY(0x02, 0x09, 0)   /* T8 */
-   MATRIX_KEY(0x01, 0x09, 0)   /* T9 */
-   MATRIX_KEY(0x00, 0x

[PATCH v4 3/3] arm64: dts: qcom: sc7180: Add CoachZ rev3

2021-03-22 Thread Matthias Kaehlcke
CoachZ rev3 uses a 100k NTC thermistor for the charger temperatures,
instead of the 47k NTC that is stuffed in earlier revisions. Add .dts
files for rev3.

The 47k NTC currently isn't supported by the PM6150 ADC driver.
Disable the charger thermal zone for rev1 and rev2 to avoid the use
of bogus temperature values.

This also gets rid of the explicit DT files for rev2 and handles
rev2 in the rev1 .dts instead. There was some back and forth
downstream involving the 'dmic_clk_en' pin, after that was sorted
out the DT for rev1 and rev2 is the same.

Signed-off-by: Matthias Kaehlcke 
Reviewed-by: Douglas Anderson 
---

Changes in v4:
- added Reviewed-by tag from Doug

Changes in v3:
- get rid of separate .dts for rev2

Changes in v2:
- added CoachZ rev3
- updated subject and commit message

 arch/arm64/boot/dts/qcom/Makefile   |  4 ++--
 .../boot/dts/qcom/sc7180-trogdor-coachz-r1-lte.dts  |  4 ++--
 .../boot/dts/qcom/sc7180-trogdor-coachz-r1.dts  | 13 +++--
 ...-r2-lte.dts => sc7180-trogdor-coachz-r3-lte.dts} |  6 +++---
 ...r-coachz-r2.dts => sc7180-trogdor-coachz-r3.dts} |  4 ++--
 5 files changed, 20 insertions(+), 11 deletions(-)
 rename arch/arm64/boot/dts/qcom/{sc7180-trogdor-coachz-r2-lte.dts => 
sc7180-trogdor-coachz-r3-lte.dts} (69%)
 rename arch/arm64/boot/dts/qcom/{sc7180-trogdor-coachz-r2.dts => 
sc7180-trogdor-coachz-r3.dts} (75%)

diff --git a/arch/arm64/boot/dts/qcom/Makefile 
b/arch/arm64/boot/dts/qcom/Makefile
index 11aa83ca798f..39db370cf1a4 100644
--- a/arch/arm64/boot/dts/qcom/Makefile
+++ b/arch/arm64/boot/dts/qcom/Makefile
@@ -33,8 +33,8 @@ dtb-$(CONFIG_ARCH_QCOM)   += qrb5165-rb5.dtb
 dtb-$(CONFIG_ARCH_QCOM)+= sc7180-idp.dtb
 dtb-$(CONFIG_ARCH_QCOM)+= sc7180-trogdor-coachz-r1.dtb
 dtb-$(CONFIG_ARCH_QCOM)+= sc7180-trogdor-coachz-r1-lte.dtb
-dtb-$(CONFIG_ARCH_QCOM)+= sc7180-trogdor-coachz-r2.dtb
-dtb-$(CONFIG_ARCH_QCOM)+= sc7180-trogdor-coachz-r2-lte.dtb
+dtb-$(CONFIG_ARCH_QCOM)+= sc7180-trogdor-coachz-r3.dtb
+dtb-$(CONFIG_ARCH_QCOM)+= sc7180-trogdor-coachz-r3-lte.dtb
 dtb-$(CONFIG_ARCH_QCOM)+= sc7180-trogdor-lazor-r0.dtb
 dtb-$(CONFIG_ARCH_QCOM)+= sc7180-trogdor-lazor-r1.dtb
 dtb-$(CONFIG_ARCH_QCOM)+= sc7180-trogdor-lazor-r1-kb.dtb
diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r1-lte.dts 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r1-lte.dts
index 533c048903ea..82dc00cc7fb9 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r1-lte.dts
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r1-lte.dts
@@ -9,8 +9,8 @@
 #include "sc7180-trogdor-lte-sku.dtsi"
 
 / {
-   model = "Google CoachZ (rev1) with LTE";
-   compatible = "google,coachz-rev1-sku0", "qcom,sc7180";
+   model = "Google CoachZ (rev1 - 2) with LTE";
+   compatible = "google,coachz-rev1-sku0", "google,coachz-rev2-sku0", 
"qcom,sc7180";
 };
 
 _ec_proximity {
diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r1.dts 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r1.dts
index 86619f6c1134..b9c252df9fa1 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r1.dts
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r1.dts
@@ -10,8 +10,17 @@
 #include "sc7180-trogdor-coachz.dtsi"
 
 / {
-   model = "Google CoachZ (rev1)";
-   compatible = "google,coachz-rev1", "qcom,sc7180";
+   model = "Google CoachZ (rev1 - 2)";
+   compatible = "google,coachz-rev1", "google,coachz-rev2", "qcom,sc7180";
+};
+
+/*
+ * CoachZ rev1 is stuffed with a 47k NTC as charger thermistor which currently
+ * is not supported by the PM6150 ADC driver. Disable the charger thermal zone
+ * to avoid using bogus temperature values.
+ */
+_thermal {
+   status = "disabled";
 };
 
  {
diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r2-lte.dts 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r3-lte.dts
similarity index 69%
rename from arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r2-lte.dts
rename to arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r3-lte.dts
index 6e7745801fae..d23409034e8c 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r2-lte.dts
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r3-lte.dts
@@ -2,14 +2,14 @@
 /*
  * Google CoachZ board device tree source
  *
- * Copyright 2020 Google LLC.
+ * Copyright 2021 Google LLC.
  */
 
-#include "sc7180-trogdor-coachz-r2.dts"
+#include "sc7180-trogdor-coachz-r3.dts"
 #include "sc7180-trogdor-lte-sku.dtsi"
 
 / {
-   model = "Google CoachZ (rev2+) with LTE";
+   model = "Google CoachZ (rev3+) with LTE";
compatible = "google,coachz-sku0", "qcom,sc7180";
 };
 
diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r2

[PATCH v4 1/3] arm64: dts: qcom: sc7180: lazor: Simplify disabling of charger thermal zone

2021-03-22 Thread Matthias Kaehlcke
Commit f73558cc83d1 ("arm64: dts: qcom: sc7180: Disable charger
thermal zone for lazor") disables the charger thermal zone for
specific lazor revisions due to an unsupported thermistor type.
The initial idea was to disable the thermal zone for older
revisions and leave it enabled for newer ones that use a
supported thermistor. Finally the thermistor won't be changed
on newer revisions, hence the thermal zone should be disabled
for all lazor (and limozeen) revisions. Instead of disabling
it per revision do it once in the shared .dtsi for lazor.

Signed-off-by: Matthias Kaehlcke 
Reviewed-by: Douglas Anderson 
---

Changes in v4:
- none

Changes in v3:
- fixed order of nodes in sc7180-trogdor-lazor.dtsi

Changes in v2:
- none

 arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r0.dts | 9 -
 arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dts | 9 -
 arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r3.dts | 9 -
 arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor.dtsi   | 9 +
 4 files changed, 9 insertions(+), 27 deletions(-)

diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r0.dts 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r0.dts
index 5c997cd90069..30e3e769d2b4 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r0.dts
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r0.dts
@@ -14,15 +14,6 @@ / {
compatible = "google,lazor-rev0", "qcom,sc7180";
 };
 
-/*
- * Lazor is stuffed with a 47k NTC as charger thermistor which currently is
- * not supported by the PM6150 ADC driver. Disable the charger thermal zone
- * to avoid using bogus temperature values.
- */
-_thermal {
-   status = "disabled";
-};
-
 _hub {
/* pp3300_l7c is used to power the USB hub */
/delete-property/regulator-always-on;
diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dts 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dts
index d9fbcc7bc5bd..c2ef06367baf 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dts
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dts
@@ -14,15 +14,6 @@ / {
compatible = "google,lazor-rev1", "google,lazor-rev2", "qcom,sc7180";
 };
 
-/*
- * Lazor is stuffed with a 47k NTC as charger thermistor which currently is
- * not supported by the PM6150 ADC driver. Disable the charger thermal zone
- * to avoid using bogus temperature values.
- */
-_thermal {
-   status = "disabled";
-};
-
 _hub {
/* pp3300_l7c is used to power the USB hub */
/delete-property/regulator-always-on;
diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r3.dts 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r3.dts
index ea8c2ee09741..b474df47cd70 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r3.dts
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r3.dts
@@ -14,12 +14,3 @@ / {
model = "Google Lazor (rev3+)";
compatible = "google,lazor", "qcom,sc7180";
 };
-
-/*
- * Lazor is stuffed with a 47k NTC as charger thermistor which currently is
- * not supported by the PM6150 ADC driver. Disable the charger thermal zone
- * to avoid using bogus temperature values.
- */
-_thermal {
-   status = "disabled";
-};
diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor.dtsi 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor.dtsi
index 6b10b96173e8..00535aaa43c9 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor.dtsi
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor.dtsi
@@ -21,6 +21,15 @@ _sar_sensor {
semtech,avg-pos-strength = <64>;
 };
 
+/*
+ * Lazor is stuffed with a 47k NTC as charger thermistor which currently is
+ * not supported by the PM6150 ADC driver. Disable the charger thermal zone
+ * to avoid using bogus temperature values.
+ */
+_thermal {
+   status = "disabled";
+};
+
 ap_ts_pen_1v8:  {
status = "okay";
clock-frequency = <40>;
-- 
2.31.0.rc2.261.g7f71774620-goog



Re: [PATCH v3 2/3] arm64: dts: qcom: sc7180: Add pompom rev3

2021-03-22 Thread Matthias Kaehlcke
On Fri, Mar 19, 2021 at 08:12:40AM -0700, Doug Anderson wrote:
> Hi,
> 
> On Mon, Mar 15, 2021 at 6:15 PM Matthias Kaehlcke  wrote:
> >
> > The only kernel visible change with respect to rev2 is that pompom
> > rev3 changed the charger thermistor from a 47k to a 100k NTC to use
> > a thermistor which is supported by the PM6150 ADC driver.
> >
> > Disable the charger thermal zone for pompom rev1 and rev2 to avoid
> > the use of bogus temperature values from the unsupported thermistor.
> >
> > Signed-off-by: Matthias Kaehlcke 
> > ---
> >
> > Changes in v3:
> > - don't add LOCK key
> >
> > Changes in v2:
> > - moved keyboard definition to sc7180-trogdor-pompom.dtsi instead
> >   of duplicating it, use cros-ec keyboard for rev1
> > - squashed with 'arm64: dts: qcom: sc7180: pompom: Disable charger
> >   thermal zone for rev1 and rev2'
> >
> >  arch/arm64/boot/dts/qcom/Makefile |  2 +
> >  .../dts/qcom/sc7180-trogdor-pompom-r1.dts | 12 ++
> >  .../dts/qcom/sc7180-trogdor-pompom-r2-lte.dts |  4 +-
> >  .../dts/qcom/sc7180-trogdor-pompom-r2.dts | 38 +--
> >  .../dts/qcom/sc7180-trogdor-pompom-r3-lte.dts | 14 +++
> >  .../dts/qcom/sc7180-trogdor-pompom-r3.dts | 15 
> >  .../boot/dts/qcom/sc7180-trogdor-pompom.dtsi  | 29 ++
> >  7 files changed, 83 insertions(+), 31 deletions(-)
> >  create mode 100644 
> > arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r3-lte.dts
> >  create mode 100644 arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r3.dts
> >
> > diff --git a/arch/arm64/boot/dts/qcom/Makefile 
> > b/arch/arm64/boot/dts/qcom/Makefile
> > index a81966d59cf7..11aa83ca798f 100644
> > --- a/arch/arm64/boot/dts/qcom/Makefile
> > +++ b/arch/arm64/boot/dts/qcom/Makefile
> > @@ -49,6 +49,8 @@ dtb-$(CONFIG_ARCH_QCOM)   += 
> > sc7180-trogdor-pompom-r1.dtb
> >  dtb-$(CONFIG_ARCH_QCOM)+= sc7180-trogdor-pompom-r1-lte.dtb
> >  dtb-$(CONFIG_ARCH_QCOM)+= sc7180-trogdor-pompom-r2.dtb
> >  dtb-$(CONFIG_ARCH_QCOM)+= sc7180-trogdor-pompom-r2-lte.dtb
> > +dtb-$(CONFIG_ARCH_QCOM)+= sc7180-trogdor-pompom-r3.dtb
> > +dtb-$(CONFIG_ARCH_QCOM)+= sc7180-trogdor-pompom-r3-lte.dtb
> >  dtb-$(CONFIG_ARCH_QCOM)+= sc7180-trogdor-r1.dtb
> >  dtb-$(CONFIG_ARCH_QCOM)+= sc7180-trogdor-r1-lte.dtb
> >  dtb-$(CONFIG_ARCH_QCOM)+= sdm630-sony-xperia-ganges-kirin.dtb
> > diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r1.dts 
> > b/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r1.dts
> > index e720e7bd0d70..7f87877408c5 100644
> > --- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r1.dts
> > +++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r1.dts
> > @@ -9,11 +9,23 @@
> >
> >  #include "sc7180-trogdor-pompom.dtsi"
> >
> > +/delete-node/ keyboard_controller;
> 
> So I just tried to compile your patch and I found that it doesn't
> compile. :( The above needs to be:
> 
> /delete-node/ _controller;

I swear I did a test build, it seems I did that build in another
kernel tree :/


Re: [PATCH 3/3] arm64: dts: qcom: sc7280: Add USB related nodes

2021-03-18 Thread Matthias Kaehlcke
On Wed, Mar 17, 2021 at 04:31:41PM +0530, Sandeep Maheswaram wrote:
> Add nodes for DWC3 USB controller, QMP and HS USB PHYs.
> 
> Signed-off-by: Sandeep Maheswaram 
> ---
>  arch/arm64/boot/dts/qcom/sc7280-idp.dts |  39 +
>  arch/arm64/boot/dts/qcom/sc7280.dtsi| 149 
> 
>  2 files changed, 188 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/qcom/sc7280-idp.dts 
> b/arch/arm64/boot/dts/qcom/sc7280-idp.dts
> index 54d2cb3..251a5b5 100644
> --- a/arch/arm64/boot/dts/qcom/sc7280-idp.dts
> +++ b/arch/arm64/boot/dts/qcom/sc7280-idp.dts
> @@ -257,3 +257,42 @@
>   bias-pull-up;
>   };
>  };
> +
> +_1 {
> + status = "okay";
> +};
> +
> +_1_dwc3 {
> + dr_mode = "host";
> +};
> +
> +_1_hsphy {
> + status = "okay";
> +
> + vdda-pll-supply = <_l10c_0p8>;
> + vdda33-supply = <_l2b_3p0>;
> + vdda18-supply = <_l1c_1p8>;
> +};
> +
> +_1_qmpphy {
> + status = "okay";
> +
> + vdda-phy-supply = <_l6b_1p2>;
> + vdda-pll-supply = <_l1b_0p8>;
> +};
> +
> +_2 {
> + status = "okay";
> +};
> +
> +_2_dwc3 {
> + dr_mode = "peripheral";
> +};
> +
> +_2_hsphy {
> + status = "okay";
> +
> + vdda-pll-supply = <_l10c_0p8>;
> + vdda33-supply = <_l2b_3p0>;
> + vdda18-supply = <_l1c_1p8>;
> +};
> diff --git a/arch/arm64/boot/dts/qcom/sc7280.dtsi 
> b/arch/arm64/boot/dts/qcom/sc7280.dtsi
> index 39cf0be..a785f65 100644
> --- a/arch/arm64/boot/dts/qcom/sc7280.dtsi
> +++ b/arch/arm64/boot/dts/qcom/sc7280.dtsi
> @@ -305,6 +305,155 @@
>   };
>   };
>  
> + usb_1_hsphy: phy@88e3000 {
> + compatible = "qcom,sc7280-usb-hs-phy",
> +  "qcom,usb-snps-hs-7nm-phy";
> + reg = <0 0x088e3000 0 0x400>;
> + status = "disabled";
> + #phy-cells = <0>;
> +
> + clocks = < RPMH_CXO_CLK>;
> + clock-names = "ref";
> +
> + resets = < GCC_QUSB2PHY_PRIM_BCR>;
> + };
> +
> + usb_2_hsphy: phy@88e4000 {
> + compatible = "qcom,sc7280-usb-hs-phy",
> +  "qcom,usb-snps-hs-7nm-phy";
> + reg = <0 0x088e4000 0 0x400>;
> + status = "disabled";
> + #phy-cells = <0>;
> +
> + clocks = < RPMH_CXO_CLK>;
> + clock-names = "ref";
> +
> + resets = < GCC_QUSB2PHY_SEC_BCR>;
> + };
> +
> + usb_1_qmpphy: phy@88e9000 {
> + compatible = "qcom,sm8250-qmp-usb3-phy";
> + reg = <0 0x088e9000 0 0x200>,
> +   <0 0x088e8000 0 0x20>;
> + reg-names = "reg-base", "dp_com";
> + status = "disabled";
> + #clock-cells = <1>;

IIUC this means that the PHY is a clock provider. Which clocks does it
provide? How would a possible consumer specify the clock it wants to
use? I couldn't find the corresponding definitions in the header of the
binding

> + #address-cells = <2>;
> + #size-cells = <2>;
> + ranges;
> +
> + clocks = < GCC_USB3_PRIM_PHY_AUX_CLK>,
> +  < RPMH_CXO_CLK>,
> +  < GCC_USB3_PRIM_PHY_COM_AUX_CLK>;
> + clock-names = "aux", "ref_clk_src", "com_aux";
> +
> + resets = < GCC_USB3_DP_PHY_PRIM_BCR>,
> +  < GCC_USB3_PHY_PRIM_BCR>;
> + reset-names = "phy", "common";
> +
> + usb_1_ssphy: lanes@88e9200 {
> + reg = <0 0x088e9200 0 0x200>,
> +   <0 0x088e9400 0 0x200>,
> +   <0 0x088e9c00 0 0x400>,
> +   <0 0x088e9600 0 0x200>,
> +   <0 0x088e9800 0 0x200>,
> +   <0 0x088e9a00 0 0x100>;
> + #phy-cells = <0>;
> + clocks = < GCC_USB3_PRIM_PHY_PIPE_CLK>;
> + clock-names = "pipe0";
> + clock-output-names = "usb3_phy_pipe_clk_src";
> + };
> + };
> +
> + usb_2: usb@8cf8800 {
> + compatible = "qcom,sc7280-dwc3", "qcom,dwc3";
> + reg = <0 0x08cf8800 0 0x400>;
> + status = "disabled";
> + #address-cells = <2>;
> + #size-cells = <2>;
> + ranges;
> + dma-ranges;
> +
> + clocks = < GCC_CFG_NOC_USB3_SEC_AXI_CLK>,
> +  < GCC_USB30_SEC_MASTER_CLK>,
> +  < 

Re: [PATCH V2 2/2] arm64: dts: qcom: sc7180: Remove QUP-CORE ICC path

2021-03-18 Thread Matthias Kaehlcke
On Thu, Mar 18, 2021 at 04:40:09PM +0530, Roja Rani Yarubandi wrote:
> We had introduced the QUP-CORE ICC path to put proxy votes from
> QUP wrapper on behalf of earlycon, if other users of QUP-CORE turn
> off this clock before the real console is probed, unclocked access
> to HW was seen from earlycon.
> 
> With ICC sync state support proxy votes are no longer need as ICC
> will ensure that the default bootloader votes are not removed until
> all it's consumer are probed.
> 
> We can safely remove ICC path for QUP-CORE clock from QUP wrapper
> device.
> 
> Signed-off-by: Roja Rani Yarubandi 
> Signed-off-by: Akash Asthana 

Reviewed-by: Matthias Kaehlcke 


Re: [PATCH V2 1/2] soc: qcom-geni-se: Cleanup the code to remove proxy votes

2021-03-18 Thread Matthias Kaehlcke
On Thu, Mar 18, 2021 at 04:40:08PM +0530, Roja Rani Yarubandi wrote:
> ICC core and platforms drivers supports sync_state feature, which
> ensures that the default ICC BW votes from the bootloader is not
> removed until all it's consumers are probes.
> 
> The proxy votes were needed in case other QUP child drivers
> I2C, SPI probes before UART, they can turn off the QUP-CORE clock
> which is shared resources for all QUP driver, this causes unclocked
> access to HW from earlycon.
> 
> Given above support from ICC there is no longer need to maintain
> proxy votes on QUP-CORE ICC node from QUP wrapper driver for early
> console usecase, the default votes won't be removed until real
> console is probed.
> 
> Signed-off-by: Roja Rani Yarubandi 
> Signed-off-by: Akash Asthana 

I suggest to mention that this is essentially a revert of commit
048eb908a1f2 ("soc: qcom-geni-se: Add interconnect support to fix
earlycon crash"). This makes the life of reviewers easier and it's
also good to have the reference in the git history.

You could also mention commit 7d3b0b0d8184 ("interconnect: qcom:
Use icc_sync_state") in the intro.

I tried to test by first reproducing the original issue without
'sync_state' in the ICC, but wasn't successful, probably something
changed in the boot/ICC timing in the meantime ¯\_(ツ)_/¯.

Reviewed-by: Matthias Kaehlcke 


Re: [RFC PATCH 1/3] dt-bindings: display: simple: Add the panel on sc7180-trogdor-pompom

2021-03-17 Thread Matthias Kaehlcke
On Tue, Mar 16, 2021 at 02:08:19PM -0700, Douglas Anderson wrote:
> The sc7180-trogdor-pompom board might be attached to any number of a
> pile of eDP panels. At the moment I'm told that the list might include:
> - KD KD116N21-30NV-A010
> - KD KD116N09-30NH-A016
> - Starry 2081116HHD028001-51D
> - Sharp LQ116M1JW10
> 
> It should be noted that while the EDID programmed in the first 3
> panels indicates that they should run with exactly the same timing (to
> keep things simple), the 4th panel not only needs different timing but
> has a different resolution.
> 
> As is true in general with eDP panels, we can figure out which panel
> we have and all the info needed to drive its pixel clock by reading
> the EDID. However, we can do this only after we've powered the panel
> on. Powering on the panels requires following the timing diagram in
> each panel's datasheet which specifies delays between certain
> actions. This means that, while we can be quite dynamic about handling
> things we can't just totally skip out on describing the panel like we
> could do if it was connected to an external-facing DP port.
> 
> While the different panels have slightly different delays, it's
> possible to come up with a set of unified delays that will work on all
> the panels. From reading the datasheets:
> * KD KD116N21-30NV-A010 and KD KD116N09-30NH-A016
>   - HPD absent delay: 200 ms
>   - Unprepare delay: 150 ms (datasheet is confusing, might be 500 ms)
> * Starry 2081116HHD028001-51D
>   - HPD absent delay: 100 ms
>   - Enable delay: (link training done till enable BL): 200 ms
>   - Unprepare delay: 500 ms
> * Sharp LQ116M1JW10
>   - HPD absent delay: 200 ms
>   - Unprepare delay: 500 ms
>   - Prepare to enable delay (power on till backlight): 100 ms
> 
> Unified:
> - HPD absent delay: 200 ms
> - Unprepare delay: 500 ms
> - Enable delay: 200 ms
> 
> NOTE: in theory the only thing that we _really_ need unity on is the
> "HPD absent delay" since once the panel asserts HPD we can read the
> EDID and could make per-panel decisions if we wanted.
> 
> Let's create a definition of "a panel that can be attached to pompom"
> as a panel that provides a valid EDID and can work with the standard
> pompom power sequencing. If more panels are later attached to pompom
> then it's fine as long as they work in a compatible way.
> 
> One might ask why we can't just use a generic string here and provide
> the timings directly in the device tree file. As I understand it,
> trying to describe generic power sequencing in the device tree is
> frowned upon and the one instance (SD/MMC) is regarded as a mistake
> that shouldn't be repeated. Specifying a power sequence per board (or
> per board class) feels like a reasonable compromise. We're not trying
> to define fully generic power sequence bindings but we can also take
> advantage of the semi-probable properties of the attached device.
> 
> NOTE: I believe that past instances of supporting this type of thing
> have used the "white lie" approach. One representative panel was
> listed in the device tree. The power sequencings of this
> representative panel were OK to use across all panels that might be
> attached and other differences were handled by EDID. This patch
> attempts to set a new precedent and avoid the need for the white lie.
> 
> Signed-off-by: Douglas Anderson 
> ---

Sounds reasonable to me if DT maintainers can live with this abstract
hardware definition. It's clearer than the 'white lie' approach.

It's then up to the vendor/manufacturer to ensure to only ship devices
with panels that have compatible timings.

>  .../devicetree/bindings/display/panel/panel-simple.yaml   | 4 
>  1 file changed, 4 insertions(+)
> 
> diff --git 
> a/Documentation/devicetree/bindings/display/panel/panel-simple.yaml 
> b/Documentation/devicetree/bindings/display/panel/panel-simple.yaml
> index 62b0d54d87b7..9807dbc1cceb 100644
> --- a/Documentation/devicetree/bindings/display/panel/panel-simple.yaml
> +++ b/Documentation/devicetree/bindings/display/panel/panel-simple.yaml
> @@ -140,6 +140,10 @@ properties:
>- giantplus,gpg48273qs5
>  # GiantPlus GPM940B0 3.0" QVGA TFT LCD panel
>- giantplus,gpm940b0
> +# A panel connected to a google,pompom board. Panel is guaranteed to
> +# confirm to google,pompom-panel power sequencing requirements and 
> then

s/confirm/conform/ ?

> +    # the specific panel will be probed via EDID.
> +  - google,pompom-panel
>  # HannStar Display Corp. HSD070PWW1 7.0" WXGA TFT LCD panel
>- hannstar,hsd070pww1
>  # HannStar Display Corp. HSD100PXN1 10.1" XGA LVDS panel

FWIW:

Reviewed-by: Matthias Kaehlcke 


Re: [PATCH 2/3] dt-bindings: phy: qcom,usb-snps-femto-v2: Add bindings for SC7280

2021-03-17 Thread Matthias Kaehlcke
On Wed, Mar 17, 2021 at 04:31:40PM +0530, Sandeep Maheswaram wrote:
> Add the compatible string for sc7280 SoC from Qualcomm
> 
> Signed-off-by: Sandeep Maheswaram 
> ---
>  Documentation/devicetree/bindings/phy/qcom,usb-snps-femto-v2.yaml | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git 
> a/Documentation/devicetree/bindings/phy/qcom,usb-snps-femto-v2.yaml 
> b/Documentation/devicetree/bindings/phy/qcom,usb-snps-femto-v2.yaml
> index ee77c64..20203a8 100644
> --- a/Documentation/devicetree/bindings/phy/qcom,usb-snps-femto-v2.yaml
> +++ b/Documentation/devicetree/bindings/phy/qcom,usb-snps-femto-v2.yaml
> @@ -16,6 +16,7 @@ properties:
>compatible:
>  enum:
>- qcom,usb-snps-hs-7nm-phy
> +  - qcom,sc7280-usb-hs-phy
>- qcom,sm8150-usb-hs-phy
>- qcom,sm8250-usb-hs-phy
>    - qcom,sm8350-usb-hs-phy

Reviewed-by: Matthias Kaehlcke 


Re: [PATCH 1/3] dt-bindings: usb: qcom,dwc3: Add bindings for SC7280

2021-03-17 Thread Matthias Kaehlcke
On Wed, Mar 17, 2021 at 04:31:39PM +0530, Sandeep Maheswaram wrote:
> Add the compatible string for sc7280 SoC from Qualcomm.
> 
> Signed-off-by: Sandeep Maheswaram 
> ---
>  Documentation/devicetree/bindings/usb/qcom,dwc3.yaml | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/Documentation/devicetree/bindings/usb/qcom,dwc3.yaml 
> b/Documentation/devicetree/bindings/usb/qcom,dwc3.yaml
> index c3cbd1f..413299b 100644
> --- a/Documentation/devicetree/bindings/usb/qcom,dwc3.yaml
> +++ b/Documentation/devicetree/bindings/usb/qcom,dwc3.yaml
> @@ -16,6 +16,7 @@ properties:
>- qcom,msm8996-dwc3
>- qcom,msm8998-dwc3
>- qcom,sc7180-dwc3
> +  - qcom,sc7280-dwc3
>- qcom,sdm845-dwc3
>- qcom,sdx55-dwc3
>    - qcom,sm8150-dwc3

Reviewed-by: Matthias Kaehlcke 


Re: [PATCH V2 5/5] dt-bindings: regulator: Add compatibles for PM7325/PMR735A

2021-03-16 Thread Matthias Kaehlcke
On Mon, Mar 15, 2021 at 07:24:14PM +0530, satya priya wrote:
> Add PM7325/PMR735A compatibles for Qualcomm SC7280 platform.
> 
> Signed-off-by: satya priya 
> Acked-by: Rob Herring 

Reviewed-by: Matthias Kaehlcke 


Re: [PATCH V2 3/5] arm64: dts: qcom: sc7280: Add RPMh regulators for sc7280-idp

2021-03-16 Thread Matthias Kaehlcke
On Mon, Mar 15, 2021 at 07:24:12PM +0530, satya priya wrote:
> Add regulator devices for SC7280 as RPMh regulators. This ensures
> that consumers are able to modify the physical state of PMIC
> regulators.
> 
> Signed-off-by: satya priya 
> ---
> Changes in V2:
>  - Corrected the indentation for "compatible" and "qcom,pmic-id" under
>pm8350c-regulators as per Konrad's comment.
> 
>  arch/arm64/boot/dts/qcom/sc7280-idp.dts | 212 
> 
>  1 file changed, 212 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/qcom/sc7280-idp.dts 
> b/arch/arm64/boot/dts/qcom/sc7280-idp.dts
> index 428f863..78effe5 100644
> --- a/arch/arm64/boot/dts/qcom/sc7280-idp.dts
> +++ b/arch/arm64/boot/dts/qcom/sc7280-idp.dts
> @@ -22,6 +22,218 @@
>   };
>  };
>  
> +_rsc {
> + pm7325-regulators {
> + compatible = "qcom,pm7325-rpmh-regulators";
> + qcom,pmic-id = "b";
> +
> + vreg_s1b_1p8: smps1 {
> + regulator-min-microvolt = <1856000>;

For most LDOs their 'Active minimum voltage' is specified as their
minimum, however for S1B and S8B it's the 'Nominal voltage. Is that
intentional?

There might be a misunderstanding on my side what the values in the
datasheet actually mean, see my comment at the end.

> + regulator-max-microvolt = <204>;
> + };
> +
> + vreg_s7b_0p9: smps7 {
> + regulator-min-microvolt = <535000>;

According to the datasheet the minimum voltage of the S7B regulator
is 904 mV.

> + regulator-max-microvolt = <112>;
> + };
> +
> + vreg_s8b_1p2: smps8 {
> + regulator-min-microvolt = <1256000>;
> + regulator-max-microvolt = <150>;
> + };
> +
> + vreg_l1b_0p8: ldo1 {
> + regulator-min-microvolt = <825000>;
> + regulator-max-microvolt = <925000>;
> + };
> +
> + vreg_l2b_3p0: ldo2 {
> + regulator-min-microvolt = <270>;
> + regulator-max-microvolt = <3544000>;
> + };

Another question that came up for sc7180-trogdor regulators,
whose core regulator config was derived from sc7180-idp: the
label suggests that this regulator is supposed to supply 3V,
however the range spans from 2.7 to 3.54V. Shouldn't it be
narrower around 3V? Same for other some regulators.

> +
> + vreg_l6b_1p2: ldo6 {
> + regulator-min-microvolt = <114>;

The datasheet says the minimum for L6B is 1.2V.

> + regulator-max-microvolt = <126>;
> + };
> +
> + vreg_l7b_2p9: ldo7 {
> + regulator-min-microvolt = <296>;
> + regulator-max-microvolt = <296>;
> + };

This regulator has a fixed voltage in difference to the others, why
is that?

> +
> + vreg_l8b_0p9: ldo8 {
> + regulator-min-microvolt = <87>;
> + regulator-max-microvolt = <97>;
> + };
> +
> + vreg_l9b_1p2: ldo9 {
> + regulator-min-microvolt = <108>;
> + regulator-max-microvolt = <1304000>;
> + };
> +
> + vreg_l11b_1p7: ldo11 {
> + regulator-min-microvolt = <1504000>;

The datasheet says the mininum voltage for L11B is 1.776V.

> + regulator-max-microvolt = <200>;
> + };
> +
> + vreg_l12b_0p8: ldo12 {
> + regulator-min-microvolt = <751000>;
> + regulator-max-microvolt = <824000>;
> + };
> +
> + vreg_l13b_0p8: ldo13 {
> + regulator-min-microvolt = <53>;
> + regulator-max-microvolt = <824000>;

The max for L13B is 880mV, is this a copy and paste from L12B?

> + };
> +
> + vreg_l14b_1p2: ldo14 {
> + regulator-min-microvolt = <108>;

The datasheet says the mininum voltage for L14B is 1.2V.

> + regulator-max-microvolt = <1304000>;
> + };
> +
> + vreg_l15b_0p8: ldo15 {
> + regulator-min-microvolt = <765000>;
> + regulator-max-microvolt = <102>;
> + };
> +
> + vreg_l16b_1p2: ldo16 {
> + regulator-min-microvolt = <110>;

The datasheet says the mininum voltage for L16B is 1.2V.

> + regulator-max-microvolt = <130>;
> + };
> +
> + vreg_l17b_1p8: ldo17 {
> + regulator-min-microvolt = <170>;

The datasheet says the mininum voltage for L17B is 1.8V.

> + regulator-max-microvolt = <190>;
> + };
> +
> + vreg_l18b_1p8: ldo18 {
> + 

Re: [PATCH V2 2/5] regulator: qcom-rpmh: Add PM7325/PMR735A regulator support

2021-03-16 Thread Matthias Kaehlcke
On Mon, Mar 15, 2021 at 07:24:11PM +0530, satya priya wrote:
> Add support for PM7325/PMR735A regulators. This ensures
> that consumers are able to modify the physical state of PMIC
> regulators.
> 
> Signed-off-by: satya priya 
> ---
> Changes in V2:
>  - No change.
> 
>  drivers/regulator/qcom-rpmh-regulator.c | 53 
> -
>  1 file changed, 52 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/regulator/qcom-rpmh-regulator.c 
> b/drivers/regulator/qcom-rpmh-regulator.c
> index 9471890..3509523 100644
> --- a/drivers/regulator/qcom-rpmh-regulator.c
> +++ b/drivers/regulator/qcom-rpmh-regulator.c
> @@ -1,5 +1,5 @@
>  // SPDX-License-Identifier: GPL-2.0
> -// Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
> +// Copyright (c) 2018-2021, The Linux Foundation. All rights reserved.
>  
>  #define pr_fmt(fmt) "%s: " fmt, __func__
>  
> @@ -1042,6 +1042,49 @@ static const struct rpmh_vreg_init_data 
> pmx55_vreg_data[] = {
>   {},
>  };
>  
> +static const struct rpmh_vreg_init_data pm7325_vreg_data[] = {
> + RPMH_VREG("smps1",  "smp%s1",  _hfsmps510, "vdd-s1"),
> + RPMH_VREG("smps2",  "smp%s2",  _ftsmps520, "vdd-s2"),
> + RPMH_VREG("smps3",  "smp%s3",  _ftsmps520, "vdd-s3"),
> + RPMH_VREG("smps4",  "smp%s4",  _ftsmps520, "vdd-s4"),
> + RPMH_VREG("smps5",  "smp%s5",  _ftsmps520, "vdd-s5"),
> + RPMH_VREG("smps6",  "smp%s6",  _ftsmps520, "vdd-s6"),
> + RPMH_VREG("smps7",  "smp%s7",  _ftsmps520, "vdd-s7"),
> + RPMH_VREG("smps8",  "smp%s8",  _hfsmps510, "vdd-s8"),
> + RPMH_VREG("ldo1",   "ldo%s1",  _nldo,  "vdd-l1-l4-l12-l15"),
> + RPMH_VREG("ldo2",   "ldo%s2",  _pldo,  "vdd-l2-l7"),
> + RPMH_VREG("ldo3",   "ldo%s3",  _nldo,  "vdd-l3"),
> + RPMH_VREG("ldo4",   "ldo%s4",  _nldo,  "vdd-l1-l4-l12-l15"),
> + RPMH_VREG("ldo5",   "ldo%s5",  _nldo,  "vdd-l5"),
> + RPMH_VREG("ldo6",   "ldo%s6",  _nldo,  "vdd-l6-l9-l10"),
> + RPMH_VREG("ldo7",   "ldo%s7",  _pldo,  "vdd-l2-l7"),
> + RPMH_VREG("ldo8",   "ldo%s8",  _nldo,  "vdd-l8"),
> + RPMH_VREG("ldo9",   "ldo%s9",  _nldo,  "vdd-l6-l9-l10"),
> + RPMH_VREG("ldo10",  "ldo%s10", _nldo,  "vdd-l6-l9-l10"),
> + RPMH_VREG("ldo11",  "ldo%s11", _pldo_lv,   "vdd-l11-l17-l18-l19"),
> + RPMH_VREG("ldo12",  "ldo%s12", _nldo,  "vdd-l1-l4-l12-l15"),
> + RPMH_VREG("ldo13",  "ldo%s13", _nldo,  "vdd-l13"),
> + RPMH_VREG("ldo14",  "ldo%s14", _nldo,  "vdd-l14-l16"),
> + RPMH_VREG("ldo15",  "ldo%s15", _nldo,  "vdd-l1-l4-l12-l15"),
> + RPMH_VREG("ldo16",  "ldo%s16", _nldo,  "vdd-l14-l16"),
> + RPMH_VREG("ldo17",  "ldo%s17", _pldo_lv,   "vdd-l11-l17-l18-l19"),
> + RPMH_VREG("ldo18",  "ldo%s18", _pldo_lv,   "vdd-l11-l17-l18-l19"),
> + RPMH_VREG("ldo19",  "ldo%s19", _pldo_lv,   "vdd-l11-l17-l18-l19"),
> +};

Could you help me understand these funky supply names? I see other RPMh
regulators also have them, so they are probably totally fine, but it
isn't clear to me what exactly the names represent. Apparently the LDO
itself is in the supply name, but many LDOs also list others.


Re: [PATCH V2 1/5] regulator: qcom-rpmh: Add pmic5_ftsmps520 buck

2021-03-16 Thread Matthias Kaehlcke
On Mon, Mar 15, 2021 at 07:24:10PM +0530, satya priya wrote:
> Add pmic5_ftsmps520 buck as this is required for PM7325
> and PMR735A PMICs.
> 
> Signed-off-by: satya priya 

Reviewed-by: Matthias Kaehlcke 


Re: [PATCH V2 4/5] dt-bindings: regulator: Convert regulator bindings to YAML format

2021-03-16 Thread Matthias Kaehlcke
Subject: dt-bindings: regulator: Convert regulator bindings to YAML format

Make sure to mention that this is about the RPMh regulators, not the
general regulator binding which was already converted.

On Mon, Mar 15, 2021 at 07:24:13PM +0530, satya priya wrote:
> Convert regulator bindings from .txt to .yaml format.
> 
> Signed-off-by: satya priya 
> ---
> Changes in V2:
>  - As per Mark's comment moved this patch to the end of series.
>  - As per Rob's comments,  added flash and rgb bindings, dropped allOf and
>unused labels and fixed few other things.
> 
>  .../bindings/regulator/qcom,rpmh-regulator.txt | 180 
> -
>  .../bindings/regulator/qcom,rpmh-regulator.yaml| 158 ++
>  2 files changed, 158 insertions(+), 180 deletions(-)
>  delete mode 100644 
> Documentation/devicetree/bindings/regulator/qcom,rpmh-regulator.txt
>  create mode 100644 
> Documentation/devicetree/bindings/regulator/qcom,rpmh-regulator.yaml
> 
> diff --git 
> a/Documentation/devicetree/bindings/regulator/qcom,rpmh-regulator.txt 
> b/Documentation/devicetree/bindings/regulator/qcom,rpmh-regulator.txt
> deleted file mode 100644
> index ce1e043..000
> --- a/Documentation/devicetree/bindings/regulator/qcom,rpmh-regulator.txt
> +++ /dev/null
> @@ -1,180 +0,0 @@
> -Qualcomm Technologies, Inc. RPMh Regulators
> -
> -rpmh-regulator devices support PMIC regulator management via the Voltage
> -Regulator Manager (VRM) and Oscillator Buffer (XOB) RPMh accelerators.  The 
> APPS
> -processor communicates with these hardware blocks via a Resource State
> -Coordinator (RSC) using command packets.  The VRM allows changing three
> -parameters for a given regulator: enable state, output voltage, and operating
> -mode.  The XOB allows changing only a single parameter for a given regulator:
> -its enable state.  Despite its name, the XOB is capable of controlling the
> -enable state of any PMIC peripheral.  It is used for clock buffers, 
> low-voltage
> -switches, and LDO/SMPS regulators which have a fixed voltage and mode.
> -
> -===
> -Required Node Structure
> -===
> -
> -RPMh regulators must be described in two levels of device nodes.  The first
> -level describes the PMIC containing the regulators and must reside within an
> -RPMh device node.  The second level describes each regulator within the PMIC
> -which is to be used on the board.  Each of these regulators maps to a single
> -RPMh resource.
> -
> -The names used for regulator nodes must match those supported by a given 
> PMIC.
> -Supported regulator node names:
> - PM8005: smps1 - smps4
> - PM8009: smps1 - smps2, ldo1 - ldo7
> - PM8150: smps1 - smps10, ldo1 - ldo18
> - PM8150L:smps1 - smps8, ldo1 - ldo11, bob, flash, rgb
> - PM8350: smps1 - smps12, ldo1 - ldo10,
> - PM8350C:smps1 - smps10, ldo1 - ldo13, bob
> - PM8998: smps1 - smps13, ldo1 - ldo28, lvs1 - lvs2
> - PMI8998:bob
> - PM6150: smps1 - smps5, ldo1 - ldo19
> - PM6150L:smps1 - smps8, ldo1 - ldo11, bob
> - PMX55:  smps1 - smps7, ldo1 - ldo16
> -
> -
> -First Level Nodes - PMIC
> -
> -
> -- compatible
> - Usage:  required
> - Value type: 
> - Definition: Must be one of below:
> - "qcom,pm8005-rpmh-regulators"
> - "qcom,pm8009-rpmh-regulators"
> - "qcom,pm8009-1-rpmh-regulators"
> - "qcom,pm8150-rpmh-regulators"
> - "qcom,pm8150l-rpmh-regulators"
> - "qcom,pm8350-rpmh-regulators"
> - "qcom,pm8350c-rpmh-regulators"
> - "qcom,pm8998-rpmh-regulators"
> - "qcom,pmc8180-rpmh-regulators"
> - "qcom,pmc8180c-rpmh-regulators"
> - "qcom,pmi8998-rpmh-regulators"
> - "qcom,pm6150-rpmh-regulators"
> - "qcom,pm6150l-rpmh-regulators"
> - "qcom,pmx55-rpmh-regulators"
> -
> -- qcom,pmic-id
> - Usage:  required
> - Value type: 
> - Definition: RPMh resource name suffix used for the regulators found on
> - this PMIC.  Typical values: "a", "b", "c", "d", "e", "f".
> -
> -- vdd-s1-supply
> -- vdd-s2-supply
> -- vdd-s3-supply
> -- vdd-s4-supply
> - Usage:  optional (PM8998 and PM8005 only)
> - Value type: 
> - Definition: phandle of the parent supply regulator of one or more of the
> - regulators for this PMIC.
> -
> -- vdd-s5-supply
> -- vdd-s6-supply
> -- vdd-s7-supply
> -- vdd-s8-supply
> -- vdd-s9-supply
> -- vdd-s10-supply
> -- vdd-s11-supply
> -- vdd-s12-supply
> -- vdd-s13-supply
> -- vdd-l1-l27-supply
> -- vdd-l2-l8-l17-supply
> -- vdd-l3-l11-supply
> -- vdd-l4-l5-supply
> -- vdd-l6-supply
> -- vdd-l7-l12-l14-l15-supply
> -- vdd-l9-supply
> -- vdd-l10-l23-l25-supply
> -- 

[PATCH v3 3/3] arm64: dts: qcom: sc7180: Add CoachZ rev3

2021-03-15 Thread Matthias Kaehlcke
CoachZ rev3 uses a 100k NTC thermistor for the charger temperatures,
instead of the 47k NTC that is stuffed in earlier revisions. Add .dts
files for rev3.

The 47k NTC currently isn't supported by the PM6150 ADC driver.
Disable the charger thermal zone for rev1 and rev2 to avoid the use
of bogus temperature values.

This also gets rid of the explicit DT files for rev2 and handles
rev2 in the rev1 .dts instead. There was some back and forth
downstream involving the 'dmic_clk_en' pin, after that was sorted
out the DT for rev1 and rev2 is the same.

Signed-off-by: Matthias Kaehlcke 
---

Changes in v3:
- get rid of separate .dts for rev2

Changes in v2:
- added CoachZ rev3
- updated subject and commit message

 arch/arm64/boot/dts/qcom/Makefile   |  4 ++--
 .../boot/dts/qcom/sc7180-trogdor-coachz-r1-lte.dts  |  4 ++--
 .../boot/dts/qcom/sc7180-trogdor-coachz-r1.dts  | 13 +++--
 ...-r2-lte.dts => sc7180-trogdor-coachz-r3-lte.dts} |  6 +++---
 ...r-coachz-r2.dts => sc7180-trogdor-coachz-r3.dts} |  4 ++--
 5 files changed, 20 insertions(+), 11 deletions(-)
 rename arch/arm64/boot/dts/qcom/{sc7180-trogdor-coachz-r2-lte.dts => 
sc7180-trogdor-coachz-r3-lte.dts} (69%)
 rename arch/arm64/boot/dts/qcom/{sc7180-trogdor-coachz-r2.dts => 
sc7180-trogdor-coachz-r3.dts} (75%)

diff --git a/arch/arm64/boot/dts/qcom/Makefile 
b/arch/arm64/boot/dts/qcom/Makefile
index 11aa83ca798f..39db370cf1a4 100644
--- a/arch/arm64/boot/dts/qcom/Makefile
+++ b/arch/arm64/boot/dts/qcom/Makefile
@@ -33,8 +33,8 @@ dtb-$(CONFIG_ARCH_QCOM)   += qrb5165-rb5.dtb
 dtb-$(CONFIG_ARCH_QCOM)+= sc7180-idp.dtb
 dtb-$(CONFIG_ARCH_QCOM)+= sc7180-trogdor-coachz-r1.dtb
 dtb-$(CONFIG_ARCH_QCOM)+= sc7180-trogdor-coachz-r1-lte.dtb
-dtb-$(CONFIG_ARCH_QCOM)+= sc7180-trogdor-coachz-r2.dtb
-dtb-$(CONFIG_ARCH_QCOM)+= sc7180-trogdor-coachz-r2-lte.dtb
+dtb-$(CONFIG_ARCH_QCOM)+= sc7180-trogdor-coachz-r3.dtb
+dtb-$(CONFIG_ARCH_QCOM)+= sc7180-trogdor-coachz-r3-lte.dtb
 dtb-$(CONFIG_ARCH_QCOM)+= sc7180-trogdor-lazor-r0.dtb
 dtb-$(CONFIG_ARCH_QCOM)+= sc7180-trogdor-lazor-r1.dtb
 dtb-$(CONFIG_ARCH_QCOM)+= sc7180-trogdor-lazor-r1-kb.dtb
diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r1-lte.dts 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r1-lte.dts
index 533c048903ea..82dc00cc7fb9 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r1-lte.dts
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r1-lte.dts
@@ -9,8 +9,8 @@
 #include "sc7180-trogdor-lte-sku.dtsi"
 
 / {
-   model = "Google CoachZ (rev1) with LTE";
-   compatible = "google,coachz-rev1-sku0", "qcom,sc7180";
+   model = "Google CoachZ (rev1 - 2) with LTE";
+   compatible = "google,coachz-rev1-sku0", "google,coachz-rev2-sku0", 
"qcom,sc7180";
 };
 
 _ec_proximity {
diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r1.dts 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r1.dts
index 86619f6c1134..b9c252df9fa1 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r1.dts
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r1.dts
@@ -10,8 +10,17 @@
 #include "sc7180-trogdor-coachz.dtsi"
 
 / {
-   model = "Google CoachZ (rev1)";
-   compatible = "google,coachz-rev1", "qcom,sc7180";
+   model = "Google CoachZ (rev1 - 2)";
+   compatible = "google,coachz-rev1", "google,coachz-rev2", "qcom,sc7180";
+};
+
+/*
+ * CoachZ rev1 is stuffed with a 47k NTC as charger thermistor which currently
+ * is not supported by the PM6150 ADC driver. Disable the charger thermal zone
+ * to avoid using bogus temperature values.
+ */
+_thermal {
+   status = "disabled";
 };
 
  {
diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r2-lte.dts 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r3-lte.dts
similarity index 69%
rename from arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r2-lte.dts
rename to arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r3-lte.dts
index 6e7745801fae..d23409034e8c 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r2-lte.dts
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r3-lte.dts
@@ -2,14 +2,14 @@
 /*
  * Google CoachZ board device tree source
  *
- * Copyright 2020 Google LLC.
+ * Copyright 2021 Google LLC.
  */
 
-#include "sc7180-trogdor-coachz-r2.dts"
+#include "sc7180-trogdor-coachz-r3.dts"
 #include "sc7180-trogdor-lte-sku.dtsi"
 
 / {
-   model = "Google CoachZ (rev2+) with LTE";
+   model = "Google CoachZ (rev3+) with LTE";
compatible = "google,coachz-sku0", "qcom,sc7180";
 };
 
diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r2.dts 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r3.dts
similarity index 75%
rename f

[PATCH v3 1/3] arm64: dts: qcom: sc7180: lazor: Simplify disabling of charger thermal zone

2021-03-15 Thread Matthias Kaehlcke
Commit f73558cc83d1 ("arm64: dts: qcom: sc7180: Disable charger
thermal zone for lazor") disables the charger thermal zone for
specific lazor revisions due to an unsupported thermistor type.
The initial idea was to disable the thermal zone for older
revisions and leave it enabled for newer ones that use a
supported thermistor. Finally the thermistor won't be changed
on newer revisions, hence the thermal zone should be disabled
for all lazor (and limozeen) revisions. Instead of disabling
it per revision do it once in the shared .dtsi for lazor.

Signed-off-by: Matthias Kaehlcke 
Reviewed-by: Douglas Anderson 
---

Changes in v3:
- fixed order of nodes in sc7180-trogdor-lazor.dtsi

Changes in v2:
- none

 arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r0.dts | 9 -
 arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dts | 9 -
 arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r3.dts | 9 -
 arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor.dtsi   | 9 +
 4 files changed, 9 insertions(+), 27 deletions(-)

diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r0.dts 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r0.dts
index 5c997cd90069..30e3e769d2b4 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r0.dts
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r0.dts
@@ -14,15 +14,6 @@ / {
compatible = "google,lazor-rev0", "qcom,sc7180";
 };
 
-/*
- * Lazor is stuffed with a 47k NTC as charger thermistor which currently is
- * not supported by the PM6150 ADC driver. Disable the charger thermal zone
- * to avoid using bogus temperature values.
- */
-_thermal {
-   status = "disabled";
-};
-
 _hub {
/* pp3300_l7c is used to power the USB hub */
/delete-property/regulator-always-on;
diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dts 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dts
index d9fbcc7bc5bd..c2ef06367baf 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dts
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dts
@@ -14,15 +14,6 @@ / {
compatible = "google,lazor-rev1", "google,lazor-rev2", "qcom,sc7180";
 };
 
-/*
- * Lazor is stuffed with a 47k NTC as charger thermistor which currently is
- * not supported by the PM6150 ADC driver. Disable the charger thermal zone
- * to avoid using bogus temperature values.
- */
-_thermal {
-   status = "disabled";
-};
-
 _hub {
/* pp3300_l7c is used to power the USB hub */
/delete-property/regulator-always-on;
diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r3.dts 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r3.dts
index ea8c2ee09741..b474df47cd70 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r3.dts
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r3.dts
@@ -14,12 +14,3 @@ / {
model = "Google Lazor (rev3+)";
compatible = "google,lazor", "qcom,sc7180";
 };
-
-/*
- * Lazor is stuffed with a 47k NTC as charger thermistor which currently is
- * not supported by the PM6150 ADC driver. Disable the charger thermal zone
- * to avoid using bogus temperature values.
- */
-_thermal {
-   status = "disabled";
-};
diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor.dtsi 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor.dtsi
index 6b10b96173e8..00535aaa43c9 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor.dtsi
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor.dtsi
@@ -21,6 +21,15 @@ _sar_sensor {
semtech,avg-pos-strength = <64>;
 };
 
+/*
+ * Lazor is stuffed with a 47k NTC as charger thermistor which currently is
+ * not supported by the PM6150 ADC driver. Disable the charger thermal zone
+ * to avoid using bogus temperature values.
+ */
+_thermal {
+   status = "disabled";
+};
+
 ap_ts_pen_1v8:  {
status = "okay";
clock-frequency = <40>;
-- 
2.31.0.rc2.261.g7f71774620-goog



[PATCH v3 2/3] arm64: dts: qcom: sc7180: Add pompom rev3

2021-03-15 Thread Matthias Kaehlcke
The only kernel visible change with respect to rev2 is that pompom
rev3 changed the charger thermistor from a 47k to a 100k NTC to use
a thermistor which is supported by the PM6150 ADC driver.

Disable the charger thermal zone for pompom rev1 and rev2 to avoid
the use of bogus temperature values from the unsupported thermistor.

Signed-off-by: Matthias Kaehlcke 
---

Changes in v3:
- don't add LOCK key

Changes in v2:
- moved keyboard definition to sc7180-trogdor-pompom.dtsi instead
  of duplicating it, use cros-ec keyboard for rev1
- squashed with 'arm64: dts: qcom: sc7180: pompom: Disable charger
  thermal zone for rev1 and rev2'

 arch/arm64/boot/dts/qcom/Makefile |  2 +
 .../dts/qcom/sc7180-trogdor-pompom-r1.dts | 12 ++
 .../dts/qcom/sc7180-trogdor-pompom-r2-lte.dts |  4 +-
 .../dts/qcom/sc7180-trogdor-pompom-r2.dts | 38 +--
 .../dts/qcom/sc7180-trogdor-pompom-r3-lte.dts | 14 +++
 .../dts/qcom/sc7180-trogdor-pompom-r3.dts | 15 
 .../boot/dts/qcom/sc7180-trogdor-pompom.dtsi  | 29 ++
 7 files changed, 83 insertions(+), 31 deletions(-)
 create mode 100644 arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r3-lte.dts
 create mode 100644 arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r3.dts

diff --git a/arch/arm64/boot/dts/qcom/Makefile 
b/arch/arm64/boot/dts/qcom/Makefile
index a81966d59cf7..11aa83ca798f 100644
--- a/arch/arm64/boot/dts/qcom/Makefile
+++ b/arch/arm64/boot/dts/qcom/Makefile
@@ -49,6 +49,8 @@ dtb-$(CONFIG_ARCH_QCOM)   += sc7180-trogdor-pompom-r1.dtb
 dtb-$(CONFIG_ARCH_QCOM)+= sc7180-trogdor-pompom-r1-lte.dtb
 dtb-$(CONFIG_ARCH_QCOM)+= sc7180-trogdor-pompom-r2.dtb
 dtb-$(CONFIG_ARCH_QCOM)+= sc7180-trogdor-pompom-r2-lte.dtb
+dtb-$(CONFIG_ARCH_QCOM)+= sc7180-trogdor-pompom-r3.dtb
+dtb-$(CONFIG_ARCH_QCOM)+= sc7180-trogdor-pompom-r3-lte.dtb
 dtb-$(CONFIG_ARCH_QCOM)+= sc7180-trogdor-r1.dtb
 dtb-$(CONFIG_ARCH_QCOM)+= sc7180-trogdor-r1-lte.dtb
 dtb-$(CONFIG_ARCH_QCOM)+= sdm630-sony-xperia-ganges-kirin.dtb
diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r1.dts 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r1.dts
index e720e7bd0d70..7f87877408c5 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r1.dts
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r1.dts
@@ -9,11 +9,23 @@
 
 #include "sc7180-trogdor-pompom.dtsi"
 
+/delete-node/ keyboard_controller;
+#include 
+
 / {
model = "Google Pompom (rev1)";
compatible = "google,pompom-rev1", "qcom,sc7180";
 };
 
+/*
+ * Pompom rev1 is stuffed with a 47k NTC as charger thermistor which currently
+ * is not supported by the PM6150 ADC driver. Disable the charger thermal zone
+ * to avoid using bogus temperature values.
+ */
+_thermal {
+   status = "disabled";
+};
+
 _hub {
/* pp3300_l7c is used to power the USB hub */
/delete-property/regulator-always-on;
diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r2-lte.dts 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r2-lte.dts
index 791d496ad046..00e187c08eb9 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r2-lte.dts
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r2-lte.dts
@@ -9,6 +9,6 @@
 #include "sc7180-trogdor-lte-sku.dtsi"
 
 / {
-   model = "Google Pompom (rev2+) with LTE";
-   compatible = "google,pompom-sku0", "qcom,sc7180";
+   model = "Google Pompom (rev2) with LTE";
+   compatible = "google,pompom-rev2-sku0", "qcom,sc7180";
 };
diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r2.dts 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r2.dts
index 984d7337da78..4f32e6733f4c 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r2.dts
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r2.dts
@@ -10,35 +10,15 @@
 #include "sc7180-trogdor-pompom.dtsi"
 
 / {
-   model = "Google Pompom (rev2+)";
-   compatible = "google,pompom", "qcom,sc7180";
+   model = "Google Pompom (rev2)";
+   compatible = "google,pompom-rev2", "qcom,sc7180";
 };
 
-_controller {
-   function-row-physmap = <
-   MATRIX_KEY(0x00, 0x02, 0)   /* T1 */
-   MATRIX_KEY(0x03, 0x02, 0)   /* T2 */
-   MATRIX_KEY(0x02, 0x02, 0)   /* T3 */
-   MATRIX_KEY(0x01, 0x02, 0)   /* T4 */
-   MATRIX_KEY(0x03, 0x04, 0)   /* T5 */
-   MATRIX_KEY(0x02, 0x04, 0)   /* T6 */
-   MATRIX_KEY(0x01, 0x04, 0)   /* T7 */
-   MATRIX_KEY(0x02, 0x09, 0)   /* T8 */
-   MATRIX_KEY(0x01, 0x09, 0)   /* T9 */
-   MATRIX_KEY(0x00, 0x04, 0)   /* T10 */
-   >;
-   linux,keymap = <
-   MATRIX_KEY(0x00, 0x02, KEY_BACK)

[PATCH v3 0/3] arm64: dts: qcom: sc7180: Disable the charger thermal zone on more trogdor boards

2021-03-15 Thread Matthias Kaehlcke
We already disabled the charger thermal zone for lazor to avoid
bogus temperature readings from an unsupported thermistor. Some
revisions of other trogdor boards that are added by Doug's
'arm64: dts: qcom: Update sc7180-trogdor variants from downstream'
series have the same problem. Disable the charger thermal zone for
them too.

This series is based on v2 of the 'arm64: dts: qcom: Update
sc7180-trogdor variants from downstream' series
(https://patchwork.kernel.org/project/linux-arm-msm/list/?series=440315)

(no changes since v1)

Matthias Kaehlcke (3):
  arm64: dts: qcom: sc7180: lazor: Simplify disabling of charger thermal
zone
  arm64: dts: qcom: sc7180: Add pompom rev3
  arm64: dts: qcom: sc7180: Add CoachZ rev3

 arch/arm64/boot/dts/qcom/Makefile |  6 ++-
 .../dts/qcom/sc7180-trogdor-coachz-r1-lte.dts |  4 +-
 .../dts/qcom/sc7180-trogdor-coachz-r1.dts | 13 ++-
 ...e.dts => sc7180-trogdor-coachz-r3-lte.dts} |  6 +--
 ...hz-r2.dts => sc7180-trogdor-coachz-r3.dts} |  4 +-
 .../boot/dts/qcom/sc7180-trogdor-lazor-r0.dts |  9 -
 .../boot/dts/qcom/sc7180-trogdor-lazor-r1.dts |  9 -
 .../boot/dts/qcom/sc7180-trogdor-lazor-r3.dts |  9 -
 .../boot/dts/qcom/sc7180-trogdor-lazor.dtsi   |  9 +
 .../dts/qcom/sc7180-trogdor-pompom-r1.dts | 12 ++
 .../dts/qcom/sc7180-trogdor-pompom-r2-lte.dts |  4 +-
 .../dts/qcom/sc7180-trogdor-pompom-r2.dts | 38 +--
 .../dts/qcom/sc7180-trogdor-pompom-r3-lte.dts | 14 +++
 .../dts/qcom/sc7180-trogdor-pompom-r3.dts | 15 
 .../boot/dts/qcom/sc7180-trogdor-pompom.dtsi  | 29 ++
 15 files changed, 112 insertions(+), 69 deletions(-)
 rename arch/arm64/boot/dts/qcom/{sc7180-trogdor-coachz-r2-lte.dts => 
sc7180-trogdor-coachz-r3-lte.dts} (69%)
 rename arch/arm64/boot/dts/qcom/{sc7180-trogdor-coachz-r2.dts => 
sc7180-trogdor-coachz-r3.dts} (75%)
 create mode 100644 arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r3-lte.dts
 create mode 100644 arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r3.dts

-- 
2.31.0.rc2.261.g7f71774620-goog



Re: [PATCH v2 3/3] arm64: dts: qcom: sc7180: Add CoachZ rev3

2021-03-15 Thread Matthias Kaehlcke
On Mon, Mar 15, 2021 at 02:49:04PM -0700, Doug Anderson wrote:
> Hi,
> 
> On Fri, Mar 12, 2021 at 10:32 AM Matthias Kaehlcke  wrote:
> >
> > CoachZ rev3 uses a 100k NTC thermistor for the charger temperatures,
> > instead of the 47k NTC that is stuffed in earlier revisions. Add .dts
> > files for rev3.
> >
> > The 47k NTC currently isn't supported by the PM6150 ADC driver.
> > Disable the charger thermal zone for rev1 and rev2 to avoid the use
> > of bogus temperature values.
> >
> > Signed-off-by: Matthias Kaehlcke 
> > ---
> >
> > Changes in v2:
> > - added CoachZ rev3
> > - updated subject and commit message
> >
> >  arch/arm64/boot/dts/qcom/Makefile  |  2 ++
> >  .../boot/dts/qcom/sc7180-trogdor-coachz-r1.dts |  9 +
> >  .../dts/qcom/sc7180-trogdor-coachz-r2-lte.dts  |  4 ++--
> >  .../boot/dts/qcom/sc7180-trogdor-coachz-r2.dts | 13 +++--
> >  .../dts/qcom/sc7180-trogdor-coachz-r3-lte.dts  | 18 ++
> >  .../boot/dts/qcom/sc7180-trogdor-coachz-r3.dts | 15 +++
> >  6 files changed, 57 insertions(+), 4 deletions(-)
> 
> So what you have here is good and we could land it. Feel free to add
> my Reviewed-by tag if you want.
> 
> ...but I want to propose an alternative. It turns out that these days
> coachz-r1 and coachz-r2 are actually the same. The only reason both
> exist is because <https://crrev.com/c/2733863> ("CHROMIUM: arm64: dts:
> qcom: sc7180: add dmic_clk_en back") wasn't the proper inverse of
> <https://crrev.com/c/2596726> ("CHROMIUM: arm64: dts: qcom: sc7180:
> remove dmic_clk_en").
> 
> It sorta squashes two changes into one, but if you combined your
> change with one that folded "-r1" into "-r2" it would actually make a
> smaller / easier to understand change, essentially, it would be:
> - just a rename of the "-r2" file to be "-r3"
> - add "-rev2" into the list of compatibles in "-r1" file.
> - add the "disable" into the "-r1" file.

I agree, if rev1 and rev2 are the same in terms of the DT they
should use the same file(s).


Re: [PATCH v2 2/3] arm64: dts: qcom: sc7180: Add pompom rev3

2021-03-15 Thread Matthias Kaehlcke
On Mon, Mar 15, 2021 at 02:48:55PM -0700, Doug Anderson wrote:
> Hi,
> 
> On Fri, Mar 12, 2021 at 10:32 AM Matthias Kaehlcke  wrote:
> >
> > +   linux,keymap = <
> > +   MATRIX_KEY(0x00, 0x02, KEY_BACK)
> > +   MATRIX_KEY(0x03, 0x02, KEY_REFRESH)
> > +   MATRIX_KEY(0x02, 0x02, KEY_ZOOM)
> > +   MATRIX_KEY(0x01, 0x02, KEY_SCALE)
> > +   MATRIX_KEY(0x03, 0x04, KEY_SYSRQ)
> > +   MATRIX_KEY(0x02, 0x04, KEY_BRIGHTNESSDOWN)
> > +   MATRIX_KEY(0x01, 0x04, KEY_BRIGHTNESSUP)
> > +   MATRIX_KEY(0x02, 0x09, KEY_MUTE)
> > +   MATRIX_KEY(0x01, 0x09, KEY_VOLUMEDOWN)
> > +   MATRIX_KEY(0x00, 0x04, KEY_VOLUMEUP)
> > +
> > +   MATRIX_KEY(0x03, 0x09, KEY_SLEEP)   /* LOCK key */
> 
> I don't think you want the LOCK key. See <https://crrev.com/c/2719075>

ack, thanks!


Re: [PATCH v2 1/3] arm64: dts: qcom: sc7180: lazor: Simplify disabling of charger thermal zone

2021-03-15 Thread Matthias Kaehlcke
On Mon, Mar 15, 2021 at 02:48:46PM -0700, Doug Anderson wrote:
> Hi,
> 
> On Fri, Mar 12, 2021 at 10:32 AM Matthias Kaehlcke  wrote:
> >
> > Commit f73558cc83d1 ("arm64: dts: qcom: sc7180: Disable charger
> > thermal zone for lazor") disables the charger thermal zone for
> > specific lazor revisions due to an unsupported thermistor type.
> > The initial idea was to disable the thermal zone for older
> > revisions and leave it enabled for newer ones that use a
> > supported thermistor. Finally the thermistor won't be changed
> > on newer revisions, hence the thermal zone should be disabled
> > for all lazor (and limozeen) revisions. Instead of disabling
> > it per revision do it once in the shared .dtsi for lazor.
> >
> > Signed-off-by: Matthias Kaehlcke 
> > ---
> >
> > Changes in v2:
> > - none
> >
> >  arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r0.dts | 9 -
> >  arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dts | 9 -
> >  arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r3.dts | 9 -
> >  arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor.dtsi   | 9 +
> >  4 files changed, 9 insertions(+), 27 deletions(-)
> >
> > diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r0.dts 
> > b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r0.dts
> > index 5c997cd90069..30e3e769d2b4 100644
> > --- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r0.dts
> > +++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r0.dts
> > @@ -14,15 +14,6 @@ / {
> > compatible = "google,lazor-rev0", "qcom,sc7180";
> >  };
> >
> > -/*
> > - * Lazor is stuffed with a 47k NTC as charger thermistor which currently is
> > - * not supported by the PM6150 ADC driver. Disable the charger thermal zone
> > - * to avoid using bogus temperature values.
> > - */
> > -_thermal {
> > -   status = "disabled";
> > -};
> > -
> >  _hub {
> > /* pp3300_l7c is used to power the USB hub */
> > /delete-property/regulator-always-on;
> > diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dts 
> > b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dts
> > index d9fbcc7bc5bd..c2ef06367baf 100644
> > --- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dts
> > +++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dts
> > @@ -14,15 +14,6 @@ / {
> > compatible = "google,lazor-rev1", "google,lazor-rev2", 
> > "qcom,sc7180";
> >  };
> >
> > -/*
> > - * Lazor is stuffed with a 47k NTC as charger thermistor which currently is
> > - * not supported by the PM6150 ADC driver. Disable the charger thermal zone
> > - * to avoid using bogus temperature values.
> > - */
> > -_thermal {
> > -   status = "disabled";
> > -};
> > -
> >  _hub {
> > /* pp3300_l7c is used to power the USB hub */
> > /delete-property/regulator-always-on;
> > diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r3.dts 
> > b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r3.dts
> > index ea8c2ee09741..b474df47cd70 100644
> > --- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r3.dts
> > +++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r3.dts
> > @@ -14,12 +14,3 @@ / {
> > model = "Google Lazor (rev3+)";
> > compatible = "google,lazor", "qcom,sc7180";
> >  };
> > -
> > -/*
> > - * Lazor is stuffed with a 47k NTC as charger thermistor which currently is
> > - * not supported by the PM6150 ADC driver. Disable the charger thermal zone
> > - * to avoid using bogus temperature values.
> > - */
> > -_thermal {
> > -   status = "disabled";
> > -};
> > diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor.dtsi 
> > b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor.dtsi
> > index 6b10b96173e8..6d540321b4a5 100644
> > --- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor.dtsi
> > +++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor.dtsi
> > @@ -41,6 +41,15 @@ ap_ts: touchscreen@10 {
> > };
> >  };
> >
> > +/*
> > + * Lazor is stuffed with a 47k NTC as charger thermistor which currently is
> > + * not supported by the PM6150 ADC driver. Disable the charger thermal zone
> > + * to avoid using bogus temperature values.
> > + */
> > +_thermal {
> > +   status = "disabled";
> > +};
> 
> So this always confuses me too, but the sort order is wron

Re: [PATCH v2 2/2] arm64: dts: qcom: Add "dmic_clk_en" + sound model for sc7180-trogdor-pompom

2021-03-15 Thread Matthias Kaehlcke
On Mon, Mar 15, 2021 at 01:39:31PM -0700, Douglas Anderson wrote:
> Match what's downstream for this board.
> 
> Cc: Srinivasa Rao Mandadapu 
> Cc: Ajit Pandey 
> Cc: Judy Hsiao 
> Cc: Cheng-Yi Chiang 
> Cc: Stephen Boyd 
> Cc: Matthias Kaehlcke 
> Signed-off-by: Douglas Anderson 

Reviewed-by: Matthias Kaehlcke 


Re: [PATCH v2 1/2] arm64: dts: qcom: Add "dmic_clk_en" for sc7180-trogdor-coachz

2021-03-15 Thread Matthias Kaehlcke
On Mon, Mar 15, 2021 at 01:39:30PM -0700, Douglas Anderson wrote:
> This was present downstream. Add upstream too. NOTE: upstream I
> managed to get some sort of halfway state and got one pinctrl entry in
> the coachz-r1 device tree. Remove that as part of this since it's now
> in the dtsi.
> 
> Cc: Srinivasa Rao Mandadapu 
> Cc: Ajit Pandey 
> Cc: Judy Hsiao 
> Cc: Cheng-Yi Chiang 
> Cc: Stephen Boyd 
> Cc: Matthias Kaehlcke 
> Signed-off-by: Douglas Anderson 

Reviewed-by: Matthias Kaehlcke 


Re: [PATCH] arm64: dts: qcom: sc7280: Add PMIC peripherals for SC7280

2021-03-12 Thread Matthias Kaehlcke
On Thu, Mar 11, 2021 at 04:10:29PM +0530, satya priya wrote:
> Add PM7325/PM8350C/PMK8350/PMR735A peripherals such as PON,
> GPIOs, RTC and other PMIC infra modules for SC7280.
> 
> Signed-off-by: satya priya 
> ---
> This patch depends on base DT and board files for SC7280 to merge first
> https://lore.kernel.org/patchwork/project/lkml/list/?series=487403
> 
>  arch/arm64/boot/dts/qcom/pm7325.dtsi  |  60 
>  arch/arm64/boot/dts/qcom/pm8350c.dtsi |  60 
>  arch/arm64/boot/dts/qcom/pmk8350.dtsi | 104 
> ++
>  arch/arm64/boot/dts/qcom/pmr735a.dtsi |  60 
>  arch/arm64/boot/dts/qcom/sc7280.dtsi  |   8 +++
>  5 files changed, 292 insertions(+)
>  create mode 100644 arch/arm64/boot/dts/qcom/pm7325.dtsi
>  create mode 100644 arch/arm64/boot/dts/qcom/pm8350c.dtsi
>  create mode 100644 arch/arm64/boot/dts/qcom/pmk8350.dtsi
>  create mode 100644 arch/arm64/boot/dts/qcom/pmr735a.dtsi

The subject 'arm64: dts: qcom: sc7280: Add PMIC peripherals for SC7280'
is a bit misleading, at least for the git history it would be clearer to
to split this into per-PMIC patches and one SC7280 patch.


Re: [PATCH] arm64: dts: qcom: sc7280: Add PMIC peripherals for SC7280

2021-03-12 Thread Matthias Kaehlcke
Hi Satya,

On Thu, Mar 11, 2021 at 04:10:29PM +0530, satya priya wrote:
> Add PM7325/PM8350C/PMK8350/PMR735A peripherals such as PON,
> GPIOs, RTC and other PMIC infra modules for SC7280.
> 
> Signed-off-by: satya priya 
> ---
> This patch depends on base DT and board files for SC7280 to merge first
> https://lore.kernel.org/patchwork/project/lkml/list/?series=487403
> 
>  arch/arm64/boot/dts/qcom/pm7325.dtsi  |  60 
>  arch/arm64/boot/dts/qcom/pm8350c.dtsi |  60 
>  arch/arm64/boot/dts/qcom/pmk8350.dtsi | 104 
> ++
>  arch/arm64/boot/dts/qcom/pmr735a.dtsi |  60 
>  arch/arm64/boot/dts/qcom/sc7280.dtsi  |   8 +++
>  5 files changed, 292 insertions(+)
>  create mode 100644 arch/arm64/boot/dts/qcom/pm7325.dtsi
>  create mode 100644 arch/arm64/boot/dts/qcom/pm8350c.dtsi
>  create mode 100644 arch/arm64/boot/dts/qcom/pmk8350.dtsi
>  create mode 100644 arch/arm64/boot/dts/qcom/pmr735a.dtsi
> 
> diff --git a/arch/arm64/boot/dts/qcom/pm7325.dtsi 
> b/arch/arm64/boot/dts/qcom/pm7325.dtsi
> new file mode 100644
> index 000..393b256
> --- /dev/null
> +++ b/arch/arm64/boot/dts/qcom/pm7325.dtsi
> @@ -0,0 +1,60 @@
> +// SPDX-License-Identifier: BSD-3-Clause
> +// Copyright (c) 2021, The Linux Foundation. All rights reserved.
> +
> +#include 
> +#include 
> +
> +_bus {
> + pm7325: pmic@1 {
> + compatible = "qcom,pm7325", "qcom,spmi-pmic";
> + reg = <0x1 SPMI_USID>;
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + pm7325_tz: temp-alarm@a00 {

The _tz suffix suggests this is a thermal zone, which isn't the case.
Call it 'pm7325_temp_alarm' or similar.

> + compatible = "qcom,spmi-temp-alarm";
> + reg = <0xa00>;
> + interrupts = <0x1 0xa 0x0 IRQ_TYPE_EDGE_BOTH>;
> + #thermal-sensor-cells = <0>;
> + };
> +
> + pm7325_gpios: gpios@8800 {
> + compatible = "qcom,pm7325-gpio", "qcom,spmi-gpio";
> + reg = <0x8800>;
> + gpio-controller;
> + gpio-ranges = <_gpios 0 0 10>;
> + #gpio-cells = <2>;
> + interrupt-controller;
> + #interrupt-cells = <2>;
> + };
> + };
> +};
> +
> +_zones {
> + pm7325_temp_alarm: pm7325_tz {

The temperature corresponds to the PM7325 on-die temperature, the temp alarm
is a feature to monitor it. Also many QCA SoCs name the thermal zones
-thermal, so it seems good to follow this convention. My suggestion
is:
pm7325_thermal: pm7325-thermal {


> + polling-delay-passive = <100>;
> + polling-delay = <0>;

Are you sure that no polling delay is needed? How does the thermal framework
detect that the temperatures is >= the passive trip point and that it should
start polling at 'polling-delay-passive' rate?

> + thermal-governor = "step_wise";

This property is not supported upstream.

In any case, this thermal zone doesn't have cooling devices, what is
any thermal governor supposed to do with this thermal zone?

I understand that the zone is generally useful to configure the
over-temperature protection of the PMIC and to allow the kernel
to shut down (or reboot) when a critical trip point is reached,
but the specific governor is irrelevant as far as I understand.

> + thermal-sensors = <_tz>;
> +
> + trips {
> + pm7325_trip0: trip0 {
> + temperature = <95000>;
> + hysteresis = <0>;
> + type = "passive";
> + };
> +
> + pm7325_trip1: trip1 {
> + temperature = <115000>;
> + hysteresis = <0>;
> + type = "critical";
> + };
> +
> + pm7325_trip2: trip2 {
> + temperature = <145000>;
> + hysteresis = <0>;
> + type = "critical";
> + };

Why are there two critical trip points? The system should shut down
when the first trip point is reached, the second one is irrelevant.
As far as I recall from implementing f1599f9e4cd6 ("thermal:
qcom-spmi: Use PMIC thermal stage 2 for critical trip points")
earlier PMIC versions have 3 stages for the over-temperature
protection. When the stage 3 threshold (trip2) is hit the PMIC
performs and automated shutdown. Unless this has changed for the
PM7325 the second critical trip point should not be needed. The
second critical trip point could even lead to a misconfiguration
of the PMIC threshold, since the driver interprets the temperature
of a critical trip point as the stage3 temperature.

> + };
> + };
> +};
> diff 

[PATCH v2 2/3] arm64: dts: qcom: sc7180: Add pompom rev3

2021-03-12 Thread Matthias Kaehlcke
The only kernel visible change with respect to rev2 is that pompom
rev3 changed the charger thermistor from a 47k to a 100k NTC to use
a thermistor which is supported by the PM6150 ADC driver.

Disable the charger thermal zone for pompom rev1 and rev2 to avoid
the use of bogus temperature values from the unsupported thermistor.

Signed-off-by: Matthias Kaehlcke 
---

Changes in v2:
- moved keyboard definition to sc7180-trogdor-pompom.dtsi instead
  of duplicating it, use cros-ec keyboard for rev1
- squashed with 'arm64: dts: qcom: sc7180: pompom: Disable charger
  thermal zone for rev1 and rev2'

 arch/arm64/boot/dts/qcom/Makefile |  2 +
 .../dts/qcom/sc7180-trogdor-pompom-r1.dts | 12 ++
 .../dts/qcom/sc7180-trogdor-pompom-r2-lte.dts |  4 +-
 .../dts/qcom/sc7180-trogdor-pompom-r2.dts | 38 +--
 .../dts/qcom/sc7180-trogdor-pompom-r3-lte.dts | 14 +++
 .../dts/qcom/sc7180-trogdor-pompom-r3.dts | 15 
 .../boot/dts/qcom/sc7180-trogdor-pompom.dtsi  | 31 +++
 7 files changed, 85 insertions(+), 31 deletions(-)
 create mode 100644 arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r3-lte.dts
 create mode 100644 arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r3.dts

diff --git a/arch/arm64/boot/dts/qcom/Makefile 
b/arch/arm64/boot/dts/qcom/Makefile
index a81966d59cf7..11aa83ca798f 100644
--- a/arch/arm64/boot/dts/qcom/Makefile
+++ b/arch/arm64/boot/dts/qcom/Makefile
@@ -49,6 +49,8 @@ dtb-$(CONFIG_ARCH_QCOM)   += sc7180-trogdor-pompom-r1.dtb
 dtb-$(CONFIG_ARCH_QCOM)+= sc7180-trogdor-pompom-r1-lte.dtb
 dtb-$(CONFIG_ARCH_QCOM)+= sc7180-trogdor-pompom-r2.dtb
 dtb-$(CONFIG_ARCH_QCOM)+= sc7180-trogdor-pompom-r2-lte.dtb
+dtb-$(CONFIG_ARCH_QCOM)+= sc7180-trogdor-pompom-r3.dtb
+dtb-$(CONFIG_ARCH_QCOM)+= sc7180-trogdor-pompom-r3-lte.dtb
 dtb-$(CONFIG_ARCH_QCOM)+= sc7180-trogdor-r1.dtb
 dtb-$(CONFIG_ARCH_QCOM)+= sc7180-trogdor-r1-lte.dtb
 dtb-$(CONFIG_ARCH_QCOM)+= sdm630-sony-xperia-ganges-kirin.dtb
diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r1.dts 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r1.dts
index e720e7bd0d70..7f87877408c5 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r1.dts
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r1.dts
@@ -9,11 +9,23 @@
 
 #include "sc7180-trogdor-pompom.dtsi"
 
+/delete-node/ keyboard_controller;
+#include 
+
 / {
model = "Google Pompom (rev1)";
compatible = "google,pompom-rev1", "qcom,sc7180";
 };
 
+/*
+ * Pompom rev1 is stuffed with a 47k NTC as charger thermistor which currently
+ * is not supported by the PM6150 ADC driver. Disable the charger thermal zone
+ * to avoid using bogus temperature values.
+ */
+_thermal {
+   status = "disabled";
+};
+
 _hub {
/* pp3300_l7c is used to power the USB hub */
/delete-property/regulator-always-on;
diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r2-lte.dts 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r2-lte.dts
index 791d496ad046..00e187c08eb9 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r2-lte.dts
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r2-lte.dts
@@ -9,6 +9,6 @@
 #include "sc7180-trogdor-lte-sku.dtsi"
 
 / {
-   model = "Google Pompom (rev2+) with LTE";
-   compatible = "google,pompom-sku0", "qcom,sc7180";
+   model = "Google Pompom (rev2) with LTE";
+   compatible = "google,pompom-rev2-sku0", "qcom,sc7180";
 };
diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r2.dts 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r2.dts
index 984d7337da78..4f32e6733f4c 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r2.dts
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r2.dts
@@ -10,35 +10,15 @@
 #include "sc7180-trogdor-pompom.dtsi"
 
 / {
-   model = "Google Pompom (rev2+)";
-   compatible = "google,pompom", "qcom,sc7180";
+   model = "Google Pompom (rev2)";
+   compatible = "google,pompom-rev2", "qcom,sc7180";
 };
 
-_controller {
-   function-row-physmap = <
-   MATRIX_KEY(0x00, 0x02, 0)   /* T1 */
-   MATRIX_KEY(0x03, 0x02, 0)   /* T2 */
-   MATRIX_KEY(0x02, 0x02, 0)   /* T3 */
-   MATRIX_KEY(0x01, 0x02, 0)   /* T4 */
-   MATRIX_KEY(0x03, 0x04, 0)   /* T5 */
-   MATRIX_KEY(0x02, 0x04, 0)   /* T6 */
-   MATRIX_KEY(0x01, 0x04, 0)   /* T7 */
-   MATRIX_KEY(0x02, 0x09, 0)   /* T8 */
-   MATRIX_KEY(0x01, 0x09, 0)   /* T9 */
-   MATRIX_KEY(0x00, 0x04, 0)   /* T10 */
-   >;
-   linux,keymap = <
-   MATRIX_KEY(0x00, 0x02, KEY_BACK)
-   MATRIX_KEY(0x03, 0x02, 

[PATCH v2 3/3] arm64: dts: qcom: sc7180: Add CoachZ rev3

2021-03-12 Thread Matthias Kaehlcke
CoachZ rev3 uses a 100k NTC thermistor for the charger temperatures,
instead of the 47k NTC that is stuffed in earlier revisions. Add .dts
files for rev3.

The 47k NTC currently isn't supported by the PM6150 ADC driver.
Disable the charger thermal zone for rev1 and rev2 to avoid the use
of bogus temperature values.

Signed-off-by: Matthias Kaehlcke 
---

Changes in v2:
- added CoachZ rev3
- updated subject and commit message

 arch/arm64/boot/dts/qcom/Makefile  |  2 ++
 .../boot/dts/qcom/sc7180-trogdor-coachz-r1.dts |  9 +
 .../dts/qcom/sc7180-trogdor-coachz-r2-lte.dts  |  4 ++--
 .../boot/dts/qcom/sc7180-trogdor-coachz-r2.dts | 13 +++--
 .../dts/qcom/sc7180-trogdor-coachz-r3-lte.dts  | 18 ++
 .../boot/dts/qcom/sc7180-trogdor-coachz-r3.dts | 15 +++
 6 files changed, 57 insertions(+), 4 deletions(-)
 create mode 100644 arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r3-lte.dts
 create mode 100644 arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r3.dts

diff --git a/arch/arm64/boot/dts/qcom/Makefile 
b/arch/arm64/boot/dts/qcom/Makefile
index 11aa83ca798f..ffb6d662754a 100644
--- a/arch/arm64/boot/dts/qcom/Makefile
+++ b/arch/arm64/boot/dts/qcom/Makefile
@@ -35,6 +35,8 @@ dtb-$(CONFIG_ARCH_QCOM)   += sc7180-trogdor-coachz-r1.dtb
 dtb-$(CONFIG_ARCH_QCOM)+= sc7180-trogdor-coachz-r1-lte.dtb
 dtb-$(CONFIG_ARCH_QCOM)+= sc7180-trogdor-coachz-r2.dtb
 dtb-$(CONFIG_ARCH_QCOM)+= sc7180-trogdor-coachz-r2-lte.dtb
+dtb-$(CONFIG_ARCH_QCOM)+= sc7180-trogdor-coachz-r3.dtb
+dtb-$(CONFIG_ARCH_QCOM)+= sc7180-trogdor-coachz-r3-lte.dtb
 dtb-$(CONFIG_ARCH_QCOM)+= sc7180-trogdor-lazor-r0.dtb
 dtb-$(CONFIG_ARCH_QCOM)+= sc7180-trogdor-lazor-r1.dtb
 dtb-$(CONFIG_ARCH_QCOM)+= sc7180-trogdor-lazor-r1-kb.dtb
diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r1.dts 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r1.dts
index 86619f6c1134..c6b078e70d31 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r1.dts
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r1.dts
@@ -14,6 +14,15 @@ / {
compatible = "google,coachz-rev1", "qcom,sc7180";
 };
 
+/*
+ * CoachZ rev1 is stuffed with a 47k NTC as charger thermistor which currently
+ * is not supported by the PM6150 ADC driver. Disable the charger thermal zone
+ * to avoid using bogus temperature values.
+ */
+_thermal {
+   status = "disabled";
+};
+
  {
gpio-line-names = "HUB_RST_L",
  "AP_RAM_ID0",
diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r2-lte.dts 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r2-lte.dts
index 6e7745801fae..5d92309af091 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r2-lte.dts
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r2-lte.dts
@@ -9,8 +9,8 @@
 #include "sc7180-trogdor-lte-sku.dtsi"
 
 / {
-   model = "Google CoachZ (rev2+) with LTE";
-   compatible = "google,coachz-sku0", "qcom,sc7180";
+   model = "Google CoachZ (rev2) with LTE";
+   compatible = "google,coachz-rev2-sku0", "qcom,sc7180";
 };
 
 _ec_proximity {
diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r2.dts 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r2.dts
index 4f69b6ba299f..6ce2b1534a68 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r2.dts
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r2.dts
@@ -10,6 +10,15 @@
 #include "sc7180-trogdor-coachz.dtsi"
 
 / {
-   model = "Google CoachZ (rev2+)";
-   compatible = "google,coachz", "qcom,sc7180";
+   model = "Google CoachZ (rev2)";
+   compatible = "google,coachz-rev2", "qcom,sc7180";
+};
+
+/*
+ * CoachZ rev2 is stuffed with a 47k NTC as charger thermistor which currently
+ * is not supported by the PM6150 ADC driver. Disable the charger thermal zone
+ * to avoid using bogus temperature values.
+ */
+_thermal {
+   status = "disabled";
 };
diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r3-lte.dts 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r3-lte.dts
new file mode 100644
index ..d23409034e8c
--- /dev/null
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r3-lte.dts
@@ -0,0 +1,18 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Google CoachZ board device tree source
+ *
+ * Copyright 2021 Google LLC.
+ */
+
+#include "sc7180-trogdor-coachz-r3.dts"
+#include "sc7180-trogdor-lte-sku.dtsi"
+
+/ {
+   model = "Google CoachZ (rev3+) with LTE";
+   compatible = "google,coachz-sku0", "qcom,sc7180";
+};
+
+_ec_proximity {
+   label = "proximity-wifi-lte";
+};
diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r3.dts 
b/arch/arm64/boot/dts/qcom/sc7180-

[PATCH v2 1/3] arm64: dts: qcom: sc7180: lazor: Simplify disabling of charger thermal zone

2021-03-12 Thread Matthias Kaehlcke
Commit f73558cc83d1 ("arm64: dts: qcom: sc7180: Disable charger
thermal zone for lazor") disables the charger thermal zone for
specific lazor revisions due to an unsupported thermistor type.
The initial idea was to disable the thermal zone for older
revisions and leave it enabled for newer ones that use a
supported thermistor. Finally the thermistor won't be changed
on newer revisions, hence the thermal zone should be disabled
for all lazor (and limozeen) revisions. Instead of disabling
it per revision do it once in the shared .dtsi for lazor.

Signed-off-by: Matthias Kaehlcke 
---

Changes in v2:
- none

 arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r0.dts | 9 -
 arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dts | 9 -
 arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r3.dts | 9 -
 arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor.dtsi   | 9 +
 4 files changed, 9 insertions(+), 27 deletions(-)

diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r0.dts 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r0.dts
index 5c997cd90069..30e3e769d2b4 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r0.dts
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r0.dts
@@ -14,15 +14,6 @@ / {
compatible = "google,lazor-rev0", "qcom,sc7180";
 };
 
-/*
- * Lazor is stuffed with a 47k NTC as charger thermistor which currently is
- * not supported by the PM6150 ADC driver. Disable the charger thermal zone
- * to avoid using bogus temperature values.
- */
-_thermal {
-   status = "disabled";
-};
-
 _hub {
/* pp3300_l7c is used to power the USB hub */
/delete-property/regulator-always-on;
diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dts 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dts
index d9fbcc7bc5bd..c2ef06367baf 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dts
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dts
@@ -14,15 +14,6 @@ / {
compatible = "google,lazor-rev1", "google,lazor-rev2", "qcom,sc7180";
 };
 
-/*
- * Lazor is stuffed with a 47k NTC as charger thermistor which currently is
- * not supported by the PM6150 ADC driver. Disable the charger thermal zone
- * to avoid using bogus temperature values.
- */
-_thermal {
-   status = "disabled";
-};
-
 _hub {
/* pp3300_l7c is used to power the USB hub */
/delete-property/regulator-always-on;
diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r3.dts 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r3.dts
index ea8c2ee09741..b474df47cd70 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r3.dts
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r3.dts
@@ -14,12 +14,3 @@ / {
model = "Google Lazor (rev3+)";
compatible = "google,lazor", "qcom,sc7180";
 };
-
-/*
- * Lazor is stuffed with a 47k NTC as charger thermistor which currently is
- * not supported by the PM6150 ADC driver. Disable the charger thermal zone
- * to avoid using bogus temperature values.
- */
-_thermal {
-   status = "disabled";
-};
diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor.dtsi 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor.dtsi
index 6b10b96173e8..6d540321b4a5 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor.dtsi
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor.dtsi
@@ -41,6 +41,15 @@ ap_ts: touchscreen@10 {
};
 };
 
+/*
+ * Lazor is stuffed with a 47k NTC as charger thermistor which currently is
+ * not supported by the PM6150 ADC driver. Disable the charger thermal zone
+ * to avoid using bogus temperature values.
+ */
+_thermal {
+   status = "disabled";
+};
+
  {
compatible = "boe,nv133fhm-n62";
 };
-- 
2.31.0.rc2.261.g7f71774620-goog



[PATCH v2 0/3] arm64: dts: qcom: sc7180: Disable the charger thermal zone on more trogdor boards

2021-03-12 Thread Matthias Kaehlcke
We already disabled the charger thermal zone for lazor to avoid
bogus temperature readings from an unsupported thermistor. Some
revisions of other trogdor boards that are added by Doug's
'arm64: dts: qcom: Update sc7180-trogdor variants from downstream'
series have the same problem. Disable the charger thermal zone for
them too.

This series is based on v2 of the 'arm64: dts: qcom: Update
sc7180-trogdor variants from downstream' series
(https://patchwork.kernel.org/project/linux-arm-msm/list/?series=440315)

(no changes since v1)

Matthias Kaehlcke (3):
  arm64: dts: qcom: sc7180: lazor: Simplify disabling of charger thermal
zone
  arm64: dts: qcom: sc7180: Add pompom rev3
  arm64: dts: qcom: sc7180: Add CoachZ rev3

 arch/arm64/boot/dts/qcom/Makefile |  4 ++
 .../dts/qcom/sc7180-trogdor-coachz-r1.dts |  9 +
 .../dts/qcom/sc7180-trogdor-coachz-r2-lte.dts |  4 +-
 .../dts/qcom/sc7180-trogdor-coachz-r2.dts | 13 ++-
 .../dts/qcom/sc7180-trogdor-coachz-r3-lte.dts | 18 +
 .../dts/qcom/sc7180-trogdor-coachz-r3.dts | 15 
 .../boot/dts/qcom/sc7180-trogdor-lazor-r0.dts |  9 -
 .../boot/dts/qcom/sc7180-trogdor-lazor-r1.dts |  9 -
 .../boot/dts/qcom/sc7180-trogdor-lazor-r3.dts |  9 -
 .../boot/dts/qcom/sc7180-trogdor-lazor.dtsi   |  9 +
 .../dts/qcom/sc7180-trogdor-pompom-r1.dts | 12 ++
 .../dts/qcom/sc7180-trogdor-pompom-r2-lte.dts |  4 +-
 .../dts/qcom/sc7180-trogdor-pompom-r2.dts | 38 +--
 .../dts/qcom/sc7180-trogdor-pompom-r3-lte.dts | 14 +++
 .../dts/qcom/sc7180-trogdor-pompom-r3.dts | 15 
 .../boot/dts/qcom/sc7180-trogdor-pompom.dtsi  | 31 +++
 16 files changed, 151 insertions(+), 62 deletions(-)
 create mode 100644 arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r3-lte.dts
 create mode 100644 arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r3.dts
 create mode 100644 arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r3-lte.dts
 create mode 100644 arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r3.dts

-- 
2.31.0.rc2.261.g7f71774620-goog



Re: [PATCH v6 3/5] of/platform: Add stubs for of_platform_device_create/destroy()

2021-03-09 Thread Matthias Kaehlcke
On Mon, Mar 08, 2021 at 03:32:51PM -0700, Rob Herring wrote:
> On Fri, Mar 05, 2021 at 11:38:51AM -0800, Matthias Kaehlcke wrote:
> > Code for platform_device_create() and of_platform_device_create() is
> 
> You mean of_platform_device_create and of_platform_device_destroy?
> 
> Does of_platform_populate not work in your usecase?

of_platform_populate() would create a platform device for every node
under the USB controller or hub. While this could be restricted with
the 'matches' parameter it would still create two platform devices for
a hub controller that provides separate USB 2 and USB 3 hubs.

When of_platform_device_create() is used the onboard hub driver can
help to decide for which node the platform device should be created.

> > only generated if CONFIG_OF_ADDRESS=y. Add stubs to avoid unresolved
> > symbols when CONFIG_OF_ADDRESS is not set.
> > 
> > Signed-off-by: Matthias Kaehlcke 
> > ---
> > 
> > Changes in v6:
> > - patch added to the series
> > 
> >  include/linux/of_platform.h | 22 ++
> >  1 file changed, 18 insertions(+), 4 deletions(-)
> > 
> > diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h
> > index 84a966623e78..d15b6cd5e1c3 100644
> > --- a/include/linux/of_platform.h
> > +++ b/include/linux/of_platform.h
> > @@ -61,16 +61,18 @@ static inline struct platform_device 
> > *of_find_device_by_node(struct device_node
> >  }
> >  #endif
> >  
> > +extern int of_platform_bus_probe(struct device_node *root,
> > +const struct of_device_id *matches,
> > +struct device *parent);
> > +
> > +#ifdef CONFIG_OF_ADDRESS
> >  /* Platform devices and busses creation */
> >  extern struct platform_device *of_platform_device_create(struct 
> > device_node *np,
> >const char *bus_id,
> >struct device *parent);
> >  
> >  extern int of_platform_device_destroy(struct device *dev, void *data);
> > -extern int of_platform_bus_probe(struct device_node *root,
> > -const struct of_device_id *matches,
> > -struct device *parent);
> > -#ifdef CONFIG_OF_ADDRESS
> > +
> >  extern int of_platform_populate(struct device_node *root,
> > const struct of_device_id *matches,
> > const struct of_dev_auxdata *lookup,
> > @@ -84,6 +86,18 @@ extern int devm_of_platform_populate(struct device *dev);
> >  
> >  extern void devm_of_platform_depopulate(struct device *dev);
> >  #else
> > +/* Platform devices and busses creation */
> > +static inline struct platform_device *of_platform_device_create(struct 
> > device_node *np,
> > +   const char 
> > *bus_id,
> > +   struct device 
> > *parent)
> > +{
> > +   return NULL;
> > +}
> > +static inline int of_platform_device_destroy(struct device *dev, void 
> > *data)
> > +{
> > +   return -ENODEV;
> > +}
> > +
> >  static inline int of_platform_populate(struct device_node *root,
> > const struct of_device_id *matches,
> > const struct of_dev_auxdata *lookup,
> > -- 
> > 2.30.1.766.gb4fecdf3b7-goog
> > 


Re: [PATCH 4/4] arm64: dts: qcom: sc7180: Disable charger thermal zone for coachz rev1 and rev2

2021-03-05 Thread Matthias Kaehlcke
On Fri, Mar 05, 2021 at 10:50:12AM -0800, Doug Anderson wrote:
> Hi,
> 
> On Thu, Mar 4, 2021 at 10:04 AM Matthias Kaehlcke  wrote:
> >
> > CoachZ rev1 and rev2 are stuffed with a 47k NTC as thermistor for the
> > charger temperature which currently isn't supported by the PM6150 ADC
> > driver. Disable the charger thermal zone to avoid the use of bogus
> > temperature values.
> >
> > Signed-off-by: Matthias Kaehlcke 
> > ---
> >
> >  arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r1.dts | 9 +
> >  arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r2.dts | 9 +
> >  2 files changed, 18 insertions(+)
> 
> I guess this patch is written with the assumption that eventually
> we'll create a "-r3" or "-r4" that has a proper thermistor stuffed but
> maybe we're not sure which one?  Right now you're disabling it for
> both -r1 and -r2+ which is all revisions, so this could go in the
> coachz.dtsi file...

The proper thermistor should be stuffed in rev3.

For some reason there was already a -r3 .dts in my mental model,
probably I created one when I started with a downstream version of
this series just before you posted your's to bring upstream (mostly)
in sync with downstream. I'll add it in v2.


Re: [PATCH 2/4] arm64: dts: qcom: sc7180: Add pompom rev3

2021-03-05 Thread Matthias Kaehlcke
On Fri, Mar 05, 2021 at 10:48:16AM -0800, Doug Anderson wrote:
> Hi,
> 
> On Thu, Mar 4, 2021 at 10:04 AM Matthias Kaehlcke  wrote:
> >
> > The only kernel visible change with respect to rev2 is that pompom
> > rev3 changed the charger thermistor from a 47k to a 100k NTC to use
> > a thermistor which is supported by the PM6150 ADC driver.
> >
> > Signed-off-by: Matthias Kaehlcke 
> > ---
> >
> >  .../dts/qcom/sc7180-trogdor-pompom-r2-lte.dts |  4 +-
> >  .../dts/qcom/sc7180-trogdor-pompom-r2.dts |  4 +-
> >  .../dts/qcom/sc7180-trogdor-pompom-r3-lte.dts | 14 ++
> >  .../dts/qcom/sc7180-trogdor-pompom-r3.dts | 46 +++
> >  4 files changed, 64 insertions(+), 4 deletions(-)
> >  create mode 100644 
> > arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r3-lte.dts
> >  create mode 100644 arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r3.dts
> >
> > diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r2-lte.dts 
> > b/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r2-lte.dts
> > index 791d496ad046..00e187c08eb9 100644
> > --- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r2-lte.dts
> > +++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r2-lte.dts
> > @@ -9,6 +9,6 @@
> >  #include "sc7180-trogdor-lte-sku.dtsi"
> >
> >  / {
> > -   model = "Google Pompom (rev2+) with LTE";
> > -   compatible = "google,pompom-sku0", "qcom,sc7180";
> > +   model = "Google Pompom (rev2) with LTE";
> > +   compatible = "google,pompom-rev2-sku0", "qcom,sc7180";
> >  };
> > diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r2.dts 
> > b/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r2.dts
> > index 984d7337da78..2b2bd906321d 100644
> > --- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r2.dts
> > +++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r2.dts
> > @@ -10,8 +10,8 @@
> >  #include "sc7180-trogdor-pompom.dtsi"
> >
> >  / {
> > -   model = "Google Pompom (rev2+)";
> > -   compatible = "google,pompom", "qcom,sc7180";
> > +   model = "Google Pompom (rev2)";
> > +   compatible = "google,pompom-rev2", "qcom,sc7180";
> >  };
> >
> >  _controller {
> > diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r3-lte.dts 
> > b/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r3-lte.dts
> > new file mode 100644
> > index ..067cb75a011e
> > --- /dev/null
> > +++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r3-lte.dts
> > @@ -0,0 +1,14 @@
> > +// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
> > +/*
> > + * Google Pompom board device tree source
> > + *
> > + * Copyright 2020 Google LLC.
> > + */
> > +
> > +#include "sc7180-trogdor-pompom-r3.dts"
> > +#include "sc7180-trogdor-lte-sku.dtsi"
> > +
> > +/ {
> > +   model = "Google Pompom (rev3+) with LTE";
> > +   compatible = "google,pompom-sku0", "qcom,sc7180";
> > +};
> > diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r3.dts 
> > b/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r3.dts
> > new file mode 100644
> > index ..12d2d1e8e9e1
> > --- /dev/null
> > +++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r3.dts
> > @@ -0,0 +1,46 @@
> > +// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
> > +/*
> > + * Google Pompom board device tree source
> > + *
> > + * Copyright 2021 Google LLC.
> > + */
> > +
> > +/dts-v1/;
> > +
> > +#include "sc7180-trogdor-pompom.dtsi"
> > +
> > +/ {
> > +   model = "Google Pompom (rev3+)";
> > +   compatible = "google,pompom", "qcom,sc7180";
> > +};
> > +
> > +_controller {
> > +   function-row-physmap = <
> > +   MATRIX_KEY(0x00, 0x02, 0)   /* T1 */
> > +   MATRIX_KEY(0x03, 0x02, 0)   /* T2 */
> > +   MATRIX_KEY(0x02, 0x02, 0)   /* T3 */
> > +   MATRIX_KEY(0x01, 0x02, 0)   /* T4 */
> > +   MATRIX_KEY(0x03, 0x04, 0)   /* T5 */
> > +   MATRIX_KEY(0x02, 0x04, 0)   /* T6 */
> > +   MATRIX_KEY(0x01, 0x04, 0)   /* T7 */
> > +   MATRIX_KEY(0x02, 0x09, 0)   /* T8 */
> > +   MATRIX_KEY(0x01, 0x09, 0)   /* T9 */
> > +   MATRIX_KE

Re: [PATCH 1/4] arm64: dts: qcom: sc7180: lazor: Simplify disabling of charger thermal zone

2021-03-05 Thread Matthias Kaehlcke
On Fri, Mar 05, 2021 at 10:36:49AM -0800, Doug Anderson wrote:
> Hi,
> 
> On Thu, Mar 4, 2021 at 10:04 AM Matthias Kaehlcke  wrote:
> >
> > Commit f73558cc83d1 ("arm64: dts: qcom: sc7180: Disable charger
> > thermal zone for lazor") disables the charger thermal zone for
> > specific lazor revisions due to an unsupported thermistor type.
> > The initial idea was to disable the thermal zone for older
> > revisions and leave it enabled for newer ones that use a
> > supported thermistor. Finally the thermistor won't be changed
> > on newer revisions, hence the thermal zone should be disabled
> > for all lazor (and limozeen) revisions. Instead of disabling
> > it per revision do it once in the shared .dtsi for lazor.
> >
> > Signed-off-by: Matthias Kaehlcke 
> > ---
> >
> >  arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r0.dts | 9 -
> >  arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dts | 9 -
> >  arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r3.dts | 9 -
> >  arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor.dtsi   | 9 +
> >  4 files changed, 9 insertions(+), 27 deletions(-)
> >
> > diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r0.dts 
> > b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r0.dts
> > index 5c997cd90069..30e3e769d2b4 100644
> > --- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r0.dts
> > +++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r0.dts
> > @@ -14,15 +14,6 @@ / {
> > compatible = "google,lazor-rev0", "qcom,sc7180";
> >  };
> >
> > -/*
> > - * Lazor is stuffed with a 47k NTC as charger thermistor which currently is
> > - * not supported by the PM6150 ADC driver. Disable the charger thermal zone
> > - * to avoid using bogus temperature values.
> > - */
> > -_thermal {
> > -   status = "disabled";
> > -};
> > -
> >  _hub {
> > /* pp3300_l7c is used to power the USB hub */
> > /delete-property/regulator-always-on;
> > diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dts 
> > b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dts
> > index d9fbcc7bc5bd..c2ef06367baf 100644
> > --- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dts
> > +++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dts
> > @@ -14,15 +14,6 @@ / {
> > compatible = "google,lazor-rev1", "google,lazor-rev2", 
> > "qcom,sc7180";
> >  };
> >
> > -/*
> > - * Lazor is stuffed with a 47k NTC as charger thermistor which currently is
> > - * not supported by the PM6150 ADC driver. Disable the charger thermal zone
> > - * to avoid using bogus temperature values.
> > - */
> > -_thermal {
> > -   status = "disabled";
> > -};
> > -
> >  _hub {
> > /* pp3300_l7c is used to power the USB hub */
> > /delete-property/regulator-always-on;
> > diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r3.dts 
> > b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r3.dts
> > index 19e69adb9e04..1b9d2f46359e 100644
> > --- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r3.dts
> > +++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r3.dts
> > @@ -13,12 +13,3 @@ / {
> > model = "Google Lazor (rev3+)";
> > compatible = "google,lazor", "qcom,sc7180";
> >  };
> > -
> > -/*
> > - * Lazor is stuffed with a 47k NTC as charger thermistor which currently is
> > - * not supported by the PM6150 ADC driver. Disable the charger thermal zone
> > - * to avoid using bogus temperature values.
> > - */
> > -_thermal {
> > -   status = "disabled";
> > -};
> > diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor.dtsi 
> > b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor.dtsi
> > index 89e5cd29ec09..aa2c4a9098db 100644
> > --- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor.dtsi
> > +++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor.dtsi
> > @@ -58,6 +58,15 @@ ap_ts: touchscreen@10 {
> > };
> >  };
> >
> > +/*
> > + * Lazor is stuffed with a 47k NTC as charger thermistor which currently is
> > + * not supported by the PM6150 ADC driver. Disable the charger thermal zone
> > + * to avoid using bogus temperature values.
> > + */
> > +_thermal {
> > +   status = "disabled";
> > +};
> > +
> >  /* PINCTRL - modifications to sc7180-trogdor.dtsi */
> >
> >  _reset_l {
> 
> The 

[PATCH v6 5/5] arm64: dts: qcom: sc7180-trogdor: Add nodes for onboard USB hub

2021-03-05 Thread Matthias Kaehlcke
Add nodes for the onboard USB hub on trogdor devices. Remove the
'always-on' and 'boot-on' properties from the hub regulator, since
the regulator is now managed by the onboard_usb_hub driver.

Signed-off-by: Matthias Kaehlcke 
---

Changes in v6:
- added 'companion-hub' entry to both USB devices
- added 'vdd-supply' also to hub@2

Changes in v5:
- patch added to the series

 .../boot/dts/qcom/sc7180-trogdor-lazor-r0.dts | 19 +++--
 .../boot/dts/qcom/sc7180-trogdor-lazor-r1.dts | 11 --
 .../arm64/boot/dts/qcom/sc7180-trogdor-r1.dts | 15 ++---
 arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi  | 21 ---
 4 files changed, 36 insertions(+), 30 deletions(-)

diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r0.dts 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r0.dts
index 30e3e769d2b4..5fb8e12af1a0 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r0.dts
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r0.dts
@@ -14,17 +14,6 @@ / {
compatible = "google,lazor-rev0", "qcom,sc7180";
 };
 
-_hub {
-   /* pp3300_l7c is used to power the USB hub */
-   /delete-property/regulator-always-on;
-   /delete-property/regulator-boot-on;
-};
-
-_l7c {
-   regulator-always-on;
-   regulator-boot-on;
-};
-
 _out {
/*
 * Lane 0 was incorrectly mapped on the cable, but we've now decided
@@ -33,3 +22,11 @@ _out {
 */
lane-polarities = <1 0>;
 };
+
+_hub_2_0 {
+vdd-supply = <_l7c>;
+};
+
+_hub_3_0 {
+vdd-supply = <_l7c>;
+};
diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dts 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dts
index c2ef06367baf..a8c23dddf25b 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dts
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dts
@@ -14,13 +14,10 @@ / {
compatible = "google,lazor-rev1", "google,lazor-rev2", "qcom,sc7180";
 };
 
-_hub {
-   /* pp3300_l7c is used to power the USB hub */
-   /delete-property/regulator-always-on;
-   /delete-property/regulator-boot-on;
+_hub_2_0 {
+vdd-supply = <_l7c>;
 };
 
-_l7c {
-   regulator-always-on;
-   regulator-boot-on;
+_hub_3_0 {
+vdd-supply = <_l7c>;
 };
diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-r1.dts 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor-r1.dts
index 2cb522d6962e..689c569872f1 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-r1.dts
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-r1.dts
@@ -53,19 +53,16 @@ ap_ts: touchscreen@10 {
};
 };
 
-_hub {
-   /* pp3300_l7c is used to power the USB hub */
-   /delete-property/regulator-always-on;
-   /delete-property/regulator-boot-on;
+_2 {
+   status = "okay";
 };
 
-_l7c {
-   regulator-always-on;
-   regulator-boot-on;
+_hub_2_0 {
+vdd-supply = <_l7c>;
 };
 
-_2 {
-   status = "okay";
+_hub_3_0 {
+vdd-supply = <_l7c>;
 };
 
 /* PINCTRL - board-specific pinctrl */
diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi
index 07c8b2c926c0..ebff7aca4f51 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi
@@ -203,9 +203,6 @@ pp3300_hub: pp3300-hub {
pinctrl-names = "default";
pinctrl-0 = <_pp3300_hub>;
 
-   regulator-always-on;
-   regulator-boot-on;
-
vin-supply = <_a>;
};
 
@@ -826,6 +823,24 @@ _1 {
 
 _1_dwc3 {
dr_mode = "host";
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   /* 2.0 hub on port 1 */
+   usb_hub_2_0: hub@1 {
+   compatible = "usbbda,5411";
+   reg = <1>;
+   vdd-supply = <_hub>;
+   companion-hub = <_hub_3_0>;
+   };
+
+   /* 3.0 hub on port 2 */
+   usb_hub_3_0: hub@2 {
+   compatible = "usbbda,411";
+   reg = <2>;
+   vdd-supply = <_hub>;
+   companion-hub = <_hub_2_0>;
+   };
 };
 
 _1_hsphy {
-- 
2.30.1.766.gb4fecdf3b7-goog



[PATCH v6 1/5] dt-bindings: usb: Add binding for Realtek RTS5411 hub controller

2021-03-05 Thread Matthias Kaehlcke
The Realtek RTS5411 is a USB 3.0 hub controller with 4 ports.

This initial version of the binding only describes USB related
aspects of the RTS5411, it does not cover the option of
connecting the controller as an i2c slave.

Signed-off-by: Matthias Kaehlcke 
---

Changes in v6:
- Realtek binding instead of generic onboard_usb_hub
- added 'companion-hub' property
- added reference to 'usb-device.yaml'
- 'fixed' indentation of compatible entries to keep yamllint happy
- added 'additionalProperties' entry
- updated commit message

Changes in v5:
- updated 'title'
- only use standard USB compatible strings
- deleted 'usb_hub' node
- renamed 'usb_controller' node to 'usb-controller'
- removed labels from USB nodes
- added 'vdd-supply' to USB nodes

Changes in v4:
- none

Changes in v3:
- updated commit message
- removed recursive reference to $self
- adjusted 'compatible' definition to support multiple entries
- changed USB controller phandle to be a node

Changes in v2:
- removed 'wakeup-source' and 'power-off-in-suspend' properties
- consistently use spaces for indentation in example

 .../bindings/usb/realtek,rts5411.yaml | 58 +++
 1 file changed, 58 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/realtek,rts5411.yaml

diff --git a/Documentation/devicetree/bindings/usb/realtek,rts5411.yaml 
b/Documentation/devicetree/bindings/usb/realtek,rts5411.yaml
new file mode 100644
index ..00e9b3d44583
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/realtek,rts5411.yaml
@@ -0,0 +1,58 @@
+# SPDX-License-Identifier: GPL-2.0-only or BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/usb/realtek,rts5411.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Binding for the Realtek RTS5411 USB 3.0 hub controller
+
+maintainers:
+  - Matthias Kaehlcke 
+
+allOf:
+  - $ref: usb-device.yaml#
+
+properties:
+  compatible:
+items:
+  - enum:
+  - usbbda,5411
+  - usbbda,411
+
+  vdd-supply:
+description:
+  phandle to the regulator that provides power to the hub.
+
+  companion-hub:
+description:
+  phandle to the companion hub on the controller.
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+usb-controller {
+dr_mode = "host";
+#address-cells = <1>;
+#size-cells = <0>;
+
+/* 2.0 hub on port 1 */
+hub_2_0: hub@1 {
+compatible = "usbbda,5411";
+reg = <1>;
+vdd-supply = <_hub>;
+companion-hub = <_3_0>;
+};
+
+/* 3.0 hub on port 2 */
+hub_3_0: hub@2 {
+compatible = "usbbda,411";
+reg = <2>;
+vdd-supply = <_hub>;
+companion-hub = <_2_0>;
+};
+};
-- 
2.30.1.766.gb4fecdf3b7-goog



[PATCH v6 4/5] usb: host: xhci-plat: Create platform device for onboard hubs in probe()

2021-03-05 Thread Matthias Kaehlcke
Check during probe() if a hub supported by the onboard_usb_hub
driver is connected to the controller. If such a hub is found
create the corresponding platform device. This requires the
device tree to have a node for the hub with its vendor and
product id (which is not common for USB devices). Further the
platform device is only created when CONFIG_USB_ONBOARD_HUB=y/m.

Signed-off-by: Matthias Kaehlcke 
---

Changes in v6:
- none

Changes in v5:
- patch added to the series

 drivers/usb/host/xhci-plat.c | 16 
 include/linux/usb/hcd.h  |  2 ++
 2 files changed, 18 insertions(+)

diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index c1edcc9b13ce..9c0fb7e8df1f 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -15,6 +15,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -195,6 +196,7 @@ static int xhci_plat_probe(struct platform_device *pdev)
int ret;
int irq;
struct xhci_plat_priv   *priv = NULL;
+   struct device_node  *np;
 
 
if (usb_disabled())
@@ -374,6 +376,17 @@ static int xhci_plat_probe(struct platform_device *pdev)
 */
pm_runtime_forbid(>dev);
 
+   np = usb_of_get_device_node(hcd->self.root_hub, hcd->self.busnum);
+   if (np && of_is_onboard_usb_hub(np)) {
+   struct platform_device *pdev;
+
+   pdev = of_platform_device_create(np, NULL, NULL);
+   if (pdev)
+   hcd->onboard_hub_dev = >dev;
+   else
+   xhci_warn(xhci, "failed to create onboard hub platform 
device\n");
+   }
+
return 0;
 
 
@@ -420,6 +433,9 @@ static int xhci_plat_remove(struct platform_device *dev)
usb_remove_hcd(hcd);
usb_put_hcd(shared_hcd);
 
+   if (hcd->onboard_hub_dev)
+   of_platform_device_destroy(hcd->onboard_hub_dev, NULL);
+
clk_disable_unprepare(clk);
clk_disable_unprepare(reg_clk);
usb_put_hcd(hcd);
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
index 96281cd50ff6..d02a508e19b0 100644
--- a/include/linux/usb/hcd.h
+++ b/include/linux/usb/hcd.h
@@ -225,6 +225,8 @@ struct usb_hcd {
 * (ohci 32, uhci 1024, ehci 256/512/1024).
 */
 
+   struct device *onboard_hub_dev;
+
/* The HC driver's private data is stored at the end of
 * this structure.
 */
-- 
2.30.1.766.gb4fecdf3b7-goog



[PATCH v6 2/5] USB: misc: Add onboard_usb_hub driver

2021-03-05 Thread Matthias Kaehlcke
The main issue this driver addresses is that a USB hub needs to be
powered before it can be discovered. For discrete onboard hubs (an
example for such a hub is the Realtek RTS5411) this is often solved
by supplying the hub with an 'always-on' regulator, which is kind
of a hack. Some onboard hubs may require further initialization
steps, like changing the state of a GPIO or enabling a clock, which
requires even more hacks. This driver creates a platform device
representing the hub which performs the necessary initialization.
Currently it only supports switching on a single regulator, support
for multiple regulators or other actions can be added as needed.
Different initialization sequences can be supported based on the
compatible string.

Besides performing the initialization the driver can be configured
to power the hub off during system suspend. This can help to extend
battery life on battery powered devices which have no requirements
to keep the hub powered during suspend. The driver can also be
configured to leave the hub powered when a wakeup capable USB device
is connected when suspending, and power it off otherwise.

Technically the driver consists of two drivers, the platform driver
described above and a very thin USB driver that subclasses the
generic driver. The purpose of this driver is to provide the platform
driver with the USB devices corresponding to the hub(s) (a hub
controller may provide multiple 'logical' hubs, e.g. one to support
USB 2.0 and another for USB 3.x).

Note: the driver currently only works with hubs connected directly
to a root hub, but it could be extended to support other
configurations if needed.

Co-developed-by: Ravi Chandra Sadineni 
Signed-off-by: Ravi Chandra Sadineni 
Signed-off-by: Matthias Kaehlcke 
---
Open questions:
- limit to USB hubs or extend to other USB devices (usb_pwrseq?) as
  suggested by Krzysztof in the v5 review? I'm open to explore the
  latter option, but would want maintainer buy-in before spending
  time on this.

- it seems to me there should be more options to configure the behavior
  during system suspend. Currently we have 'keep the hub always powered'
  and 'power the hub down unless a wakeup capable device is connected'.
  The configuration is done through the boolean sysfs attribute
  'always_powered_in_suspend'. Maybe this should be changed to

powered_in_suspend: yes/no/wakeup

  or similar, with some flexibility when writing boolean values.

Changes in v6:
- use 'companion-hub' to locate the platform device, instead of
  scanning through the nodes of the parent
- added ABI documentation for 'always_powered_in_suspend'
- sysfs_emit() instead of sprintf() in always_powered_in_suspend_show()
- register sysfs attribute through driver.dev_groups
- evaluate return value of driver_attach() in _probe()
- use dev_warn() instead of WARN_ON() in _probe()
- include 'onboard_hub.h'

Changes in v5:
- the platform device is now instantiated from the same DT node
  as the 'primary' USB hub device
  - use the USB compatible strings for the platform device
  - refactored _find_onboard_hub() to search the parents child
nodes for a platform device with a matching compatible string
  - added exported function of_is_onboard_usb_hub() to allow other
drivers (like xhci_plat) to check if one of their child DT nodes
is a supported hub
- use late suspend to make sure info about wakeup enabled descendants
  is updated
- call driver_attach() for the USB driver in onboard_hub_probe() to
  make sure the driver is re-attached after the device_release_driver()
  calls in onboard_hub_remove()
- renamed sysfs attribute 'power_off_in_suspend' to
  'always_powered_in_suspend'
- added sysfs symlinks between platform device and USB devices
- marked 'onboard_hub_pm_ops' as __maybe_unused
- removed 'realtek' compatible string which is not needed at this
  point
- fix log for regulator_disable() failure

Changes in v4:
- updated Kconfig documentation
- changed the loop in onboard_hub_remove() to release the hub lock
  before unbinding the USB device and make self deadlock prevention
  less clunky
- fixed return value in onboard_hub_usbdev_probe()
- added entry to MAINTAINERS file

Changes in v3:
- updated the commit message
- updated description in Kconfig
- remove include of 'core/usb.h'
- use 'is_powered_on' flag instead of 'has_wakeup_capable_descendants'
- added 'going_away' flag to struct onboard_hub
  - don't allow adding new USB devices when the platform device is going away
  - don't bother with deleting the list item in onboard_hub_remove_usbdev()
when the platform device is going away
- don't assume in onboard_hub_suspend() that all USB hub devices are
  connected to the same controller
- removed unnecessary devm_kfree() from onboard_hub_remove_usbdev()
- fixed error handling in onboard_hub_remove_usbdev()
- use kstrtobool() instead of strtobool() in power_off_in_suspend_store()
- unbind USB devices in onboard_hub_remove() to avoid dangling

[PATCH v6 3/5] of/platform: Add stubs for of_platform_device_create/destroy()

2021-03-05 Thread Matthias Kaehlcke
Code for platform_device_create() and of_platform_device_create() is
only generated if CONFIG_OF_ADDRESS=y. Add stubs to avoid unresolved
symbols when CONFIG_OF_ADDRESS is not set.

Signed-off-by: Matthias Kaehlcke 
---

Changes in v6:
- patch added to the series

 include/linux/of_platform.h | 22 ++
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h
index 84a966623e78..d15b6cd5e1c3 100644
--- a/include/linux/of_platform.h
+++ b/include/linux/of_platform.h
@@ -61,16 +61,18 @@ static inline struct platform_device 
*of_find_device_by_node(struct device_node
 }
 #endif
 
+extern int of_platform_bus_probe(struct device_node *root,
+const struct of_device_id *matches,
+struct device *parent);
+
+#ifdef CONFIG_OF_ADDRESS
 /* Platform devices and busses creation */
 extern struct platform_device *of_platform_device_create(struct device_node 
*np,
   const char *bus_id,
   struct device *parent);
 
 extern int of_platform_device_destroy(struct device *dev, void *data);
-extern int of_platform_bus_probe(struct device_node *root,
-const struct of_device_id *matches,
-struct device *parent);
-#ifdef CONFIG_OF_ADDRESS
+
 extern int of_platform_populate(struct device_node *root,
const struct of_device_id *matches,
const struct of_dev_auxdata *lookup,
@@ -84,6 +86,18 @@ extern int devm_of_platform_populate(struct device *dev);
 
 extern void devm_of_platform_depopulate(struct device *dev);
 #else
+/* Platform devices and busses creation */
+static inline struct platform_device *of_platform_device_create(struct 
device_node *np,
+   const char 
*bus_id,
+   struct device 
*parent)
+{
+   return NULL;
+}
+static inline int of_platform_device_destroy(struct device *dev, void *data)
+{
+   return -ENODEV;
+}
+
 static inline int of_platform_populate(struct device_node *root,
const struct of_device_id *matches,
const struct of_dev_auxdata *lookup,
-- 
2.30.1.766.gb4fecdf3b7-goog



[PATCH v6 0/5] USB: misc: Add onboard_usb_hub driver

2021-03-05 Thread Matthias Kaehlcke
This series adds:
- the onboard_usb_hub_driver
- glue in the xhci-plat driver to create the onboard_usb_hub
  platform device if needed
- a device tree binding for the Realtek RTS5411 USB hub controller
- device tree changes that add RTS5411 entries for the QCA SC7180
  based boards trogdor and lazor
- a couple of stubs for platform device functions to avoid
  unresolved symbols with certain kernel configs

The main issue the driver addresses is that a USB hub needs to be
powered before it can be discovered. For discrete onboard hubs (an
example for such a hub is the Realtek RTS5411) this is often solved
by supplying the hub with an 'always-on' regulator, which is kind
of a hack. Some onboard hubs may require further initialization
steps, like changing the state of a GPIO or enabling a clock, which
requires even more hacks. This driver creates a platform device
representing the hub which performs the necessary initialization.
Currently it only supports switching on a single regulator, support
for multiple regulators or other actions can be added as needed.
Different initialization sequences can be supported based on the
compatible string.

Besides performing the initialization the driver can be configured
to power the hub off during system suspend. This can help to extend
battery life on battery powered devices which have no requirements
to keep the hub powered during suspend. The driver can also be
configured to leave the hub powered when a wakeup capable USB device
is connected when suspending, and power it off otherwise.

Changes in v6:
- updated summary

Changes in v5:
- cover letter added

Matthias Kaehlcke (5):
  dt-bindings: usb: Add binding for Realtek RTS5411 hub controller
  USB: misc: Add onboard_usb_hub driver
  of/platform: Add stubs for of_platform_device_create/destroy()
  usb: host: xhci-plat: Create platform device for onboard hubs in
probe()
  arm64: dts: qcom: sc7180-trogdor: Add nodes for onboard USB hub

 .../sysfs-bus-platform-onboard-usb-hub|   8 +
 .../bindings/usb/realtek,rts5411.yaml |  58 +++
 MAINTAINERS   |   7 +
 .../boot/dts/qcom/sc7180-trogdor-lazor-r0.dts |  19 +-
 .../boot/dts/qcom/sc7180-trogdor-lazor-r1.dts |  11 +-
 .../arm64/boot/dts/qcom/sc7180-trogdor-r1.dts |  15 +-
 arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi  |  21 +-
 drivers/usb/host/xhci-plat.c  |  16 +
 drivers/usb/misc/Kconfig  |  17 +
 drivers/usb/misc/Makefile |   1 +
 drivers/usb/misc/onboard_usb_hub.c| 415 ++
 include/linux/of_platform.h   |  22 +-
 include/linux/usb/hcd.h   |   2 +
 include/linux/usb/onboard_hub.h   |  15 +
 14 files changed, 593 insertions(+), 34 deletions(-)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-platform-onboard-usb-hub
 create mode 100644 Documentation/devicetree/bindings/usb/realtek,rts5411.yaml
 create mode 100644 drivers/usb/misc/onboard_usb_hub.c
 create mode 100644 include/linux/usb/onboard_hub.h

-- 
2.30.1.766.gb4fecdf3b7-goog



[PATCH 2/4] arm64: dts: qcom: sc7180: Add pompom rev3

2021-03-04 Thread Matthias Kaehlcke
The only kernel visible change with respect to rev2 is that pompom
rev3 changed the charger thermistor from a 47k to a 100k NTC to use
a thermistor which is supported by the PM6150 ADC driver.

Signed-off-by: Matthias Kaehlcke 
---

 .../dts/qcom/sc7180-trogdor-pompom-r2-lte.dts |  4 +-
 .../dts/qcom/sc7180-trogdor-pompom-r2.dts |  4 +-
 .../dts/qcom/sc7180-trogdor-pompom-r3-lte.dts | 14 ++
 .../dts/qcom/sc7180-trogdor-pompom-r3.dts | 46 +++
 4 files changed, 64 insertions(+), 4 deletions(-)
 create mode 100644 arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r3-lte.dts
 create mode 100644 arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r3.dts

diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r2-lte.dts 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r2-lte.dts
index 791d496ad046..00e187c08eb9 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r2-lte.dts
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r2-lte.dts
@@ -9,6 +9,6 @@
 #include "sc7180-trogdor-lte-sku.dtsi"
 
 / {
-   model = "Google Pompom (rev2+) with LTE";
-   compatible = "google,pompom-sku0", "qcom,sc7180";
+   model = "Google Pompom (rev2) with LTE";
+   compatible = "google,pompom-rev2-sku0", "qcom,sc7180";
 };
diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r2.dts 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r2.dts
index 984d7337da78..2b2bd906321d 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r2.dts
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r2.dts
@@ -10,8 +10,8 @@
 #include "sc7180-trogdor-pompom.dtsi"
 
 / {
-   model = "Google Pompom (rev2+)";
-   compatible = "google,pompom", "qcom,sc7180";
+   model = "Google Pompom (rev2)";
+   compatible = "google,pompom-rev2", "qcom,sc7180";
 };
 
 _controller {
diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r3-lte.dts 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r3-lte.dts
new file mode 100644
index ..067cb75a011e
--- /dev/null
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r3-lte.dts
@@ -0,0 +1,14 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Google Pompom board device tree source
+ *
+ * Copyright 2020 Google LLC.
+ */
+
+#include "sc7180-trogdor-pompom-r3.dts"
+#include "sc7180-trogdor-lte-sku.dtsi"
+
+/ {
+   model = "Google Pompom (rev3+) with LTE";
+   compatible = "google,pompom-sku0", "qcom,sc7180";
+};
diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r3.dts 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r3.dts
new file mode 100644
index ..12d2d1e8e9e1
--- /dev/null
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r3.dts
@@ -0,0 +1,46 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Google Pompom board device tree source
+ *
+ * Copyright 2021 Google LLC.
+ */
+
+/dts-v1/;
+
+#include "sc7180-trogdor-pompom.dtsi"
+
+/ {
+   model = "Google Pompom (rev3+)";
+   compatible = "google,pompom", "qcom,sc7180";
+};
+
+_controller {
+   function-row-physmap = <
+   MATRIX_KEY(0x00, 0x02, 0)   /* T1 */
+   MATRIX_KEY(0x03, 0x02, 0)   /* T2 */
+   MATRIX_KEY(0x02, 0x02, 0)   /* T3 */
+   MATRIX_KEY(0x01, 0x02, 0)   /* T4 */
+   MATRIX_KEY(0x03, 0x04, 0)   /* T5 */
+   MATRIX_KEY(0x02, 0x04, 0)   /* T6 */
+   MATRIX_KEY(0x01, 0x04, 0)   /* T7 */
+   MATRIX_KEY(0x02, 0x09, 0)   /* T8 */
+   MATRIX_KEY(0x01, 0x09, 0)   /* T9 */
+   MATRIX_KEY(0x00, 0x04, 0)   /* T10 */
+   >;
+   linux,keymap = <
+   MATRIX_KEY(0x00, 0x02, KEY_BACK)
+   MATRIX_KEY(0x03, 0x02, KEY_REFRESH)
+   MATRIX_KEY(0x02, 0x02, KEY_ZOOM)
+   MATRIX_KEY(0x01, 0x02, KEY_SCALE)
+   MATRIX_KEY(0x03, 0x04, KEY_SYSRQ)
+   MATRIX_KEY(0x02, 0x04, KEY_BRIGHTNESSDOWN)
+   MATRIX_KEY(0x01, 0x04, KEY_BRIGHTNESSUP)
+   MATRIX_KEY(0x02, 0x09, KEY_MUTE)
+   MATRIX_KEY(0x01, 0x09, KEY_VOLUMEDOWN)
+   MATRIX_KEY(0x00, 0x04, KEY_VOLUMEUP)
+
+   MATRIX_KEY(0x03, 0x09, KEY_SLEEP)   /* LOCK key */
+
+   CROS_STD_MAIN_KEYMAP
+   >;
+};
-- 
2.30.1.766.gb4fecdf3b7-goog



[PATCH 4/4] arm64: dts: qcom: sc7180: Disable charger thermal zone for coachz rev1 and rev2

2021-03-04 Thread Matthias Kaehlcke
CoachZ rev1 and rev2 are stuffed with a 47k NTC as thermistor for the
charger temperature which currently isn't supported by the PM6150 ADC
driver. Disable the charger thermal zone to avoid the use of bogus
temperature values.

Signed-off-by: Matthias Kaehlcke 
---

 arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r1.dts | 9 +
 arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r2.dts | 9 +
 2 files changed, 18 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r1.dts 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r1.dts
index 86619f6c1134..c6b078e70d31 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r1.dts
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r1.dts
@@ -14,6 +14,15 @@ / {
compatible = "google,coachz-rev1", "qcom,sc7180";
 };
 
+/*
+ * CoachZ rev1 is stuffed with a 47k NTC as charger thermistor which currently
+ * is not supported by the PM6150 ADC driver. Disable the charger thermal zone
+ * to avoid using bogus temperature values.
+ */
+_thermal {
+   status = "disabled";
+};
+
  {
gpio-line-names = "HUB_RST_L",
  "AP_RAM_ID0",
diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r2.dts 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r2.dts
index 4f69b6ba299f..67c31795a566 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r2.dts
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r2.dts
@@ -13,3 +13,12 @@ / {
model = "Google CoachZ (rev2+)";
compatible = "google,coachz", "qcom,sc7180";
 };
+
+/*
+ * CoachZ rev2 is stuffed with a 47k NTC as charger thermistor which currently
+ * is not supported by the PM6150 ADC driver. Disable the charger thermal zone
+ * to avoid using bogus temperature values.
+ */
+_thermal {
+   status = "disabled";
+};
-- 
2.30.1.766.gb4fecdf3b7-goog



[PATCH 3/4] arm64: dts: qcom: sc7180: pompom: Disable charger thermal zone for rev1 and rev2

2021-03-04 Thread Matthias Kaehlcke
Pompom rev1 and rev2 are stuffed with a 47k NTC as thermistor for the
charger temperature which currently isn't supported by the PM6150 ADC
driver. Disable the charger thermal zone to avoid the use of bogus
temperature values.

Signed-off-by: Matthias Kaehlcke 
---

 arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r1.dts | 9 +
 arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r2.dts | 9 +
 2 files changed, 18 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r1.dts 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r1.dts
index e720e7bd0d70..bc6574e446a9 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r1.dts
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r1.dts
@@ -14,6 +14,15 @@ / {
compatible = "google,pompom-rev1", "qcom,sc7180";
 };
 
+/*
+ * Pompom rev1 is stuffed with a 47k NTC as charger thermistor which currently
+ * is not supported by the PM6150 ADC driver. Disable the charger thermal zone
+ * to avoid using bogus temperature values.
+ */
+_thermal {
+   status = "disabled";
+};
+
 _hub {
/* pp3300_l7c is used to power the USB hub */
/delete-property/regulator-always-on;
diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r2.dts 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r2.dts
index 2b2bd906321d..779c90ed35e4 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r2.dts
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r2.dts
@@ -14,6 +14,15 @@ / {
compatible = "google,pompom-rev2", "qcom,sc7180";
 };
 
+/*
+ * Pompom rev2 is stuffed with a 47k NTC as charger thermistor which currently
+ * is not supported by the PM6150 ADC driver. Disable the charger thermal zone
+ * to avoid using bogus temperature values.
+ */
+_thermal {
+   status = "disabled";
+};
+
 _controller {
function-row-physmap = <
MATRIX_KEY(0x00, 0x02, 0)   /* T1 */
-- 
2.30.1.766.gb4fecdf3b7-goog



[PATCH 1/4] arm64: dts: qcom: sc7180: lazor: Simplify disabling of charger thermal zone

2021-03-04 Thread Matthias Kaehlcke
Commit f73558cc83d1 ("arm64: dts: qcom: sc7180: Disable charger
thermal zone for lazor") disables the charger thermal zone for
specific lazor revisions due to an unsupported thermistor type.
The initial idea was to disable the thermal zone for older
revisions and leave it enabled for newer ones that use a
supported thermistor. Finally the thermistor won't be changed
on newer revisions, hence the thermal zone should be disabled
for all lazor (and limozeen) revisions. Instead of disabling
it per revision do it once in the shared .dtsi for lazor.

Signed-off-by: Matthias Kaehlcke 
---

 arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r0.dts | 9 -
 arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dts | 9 -
 arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r3.dts | 9 -
 arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor.dtsi   | 9 +
 4 files changed, 9 insertions(+), 27 deletions(-)

diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r0.dts 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r0.dts
index 5c997cd90069..30e3e769d2b4 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r0.dts
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r0.dts
@@ -14,15 +14,6 @@ / {
compatible = "google,lazor-rev0", "qcom,sc7180";
 };
 
-/*
- * Lazor is stuffed with a 47k NTC as charger thermistor which currently is
- * not supported by the PM6150 ADC driver. Disable the charger thermal zone
- * to avoid using bogus temperature values.
- */
-_thermal {
-   status = "disabled";
-};
-
 _hub {
/* pp3300_l7c is used to power the USB hub */
/delete-property/regulator-always-on;
diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dts 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dts
index d9fbcc7bc5bd..c2ef06367baf 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dts
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dts
@@ -14,15 +14,6 @@ / {
compatible = "google,lazor-rev1", "google,lazor-rev2", "qcom,sc7180";
 };
 
-/*
- * Lazor is stuffed with a 47k NTC as charger thermistor which currently is
- * not supported by the PM6150 ADC driver. Disable the charger thermal zone
- * to avoid using bogus temperature values.
- */
-_thermal {
-   status = "disabled";
-};
-
 _hub {
/* pp3300_l7c is used to power the USB hub */
/delete-property/regulator-always-on;
diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r3.dts 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r3.dts
index 19e69adb9e04..1b9d2f46359e 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r3.dts
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r3.dts
@@ -13,12 +13,3 @@ / {
model = "Google Lazor (rev3+)";
compatible = "google,lazor", "qcom,sc7180";
 };
-
-/*
- * Lazor is stuffed with a 47k NTC as charger thermistor which currently is
- * not supported by the PM6150 ADC driver. Disable the charger thermal zone
- * to avoid using bogus temperature values.
- */
-_thermal {
-   status = "disabled";
-};
diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor.dtsi 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor.dtsi
index 89e5cd29ec09..aa2c4a9098db 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor.dtsi
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor.dtsi
@@ -58,6 +58,15 @@ ap_ts: touchscreen@10 {
};
 };
 
+/*
+ * Lazor is stuffed with a 47k NTC as charger thermistor which currently is
+ * not supported by the PM6150 ADC driver. Disable the charger thermal zone
+ * to avoid using bogus temperature values.
+ */
+_thermal {
+   status = "disabled";
+};
+
 /* PINCTRL - modifications to sc7180-trogdor.dtsi */
 
 _reset_l {
-- 
2.30.1.766.gb4fecdf3b7-goog



[PATCH 0/4] arm64: dts: qcom: sc7180: Disable the charger thermal zone on more trogdor boards

2021-03-04 Thread Matthias Kaehlcke
We already disabled the charger thermal zone for lazor to avoid
bogus temperature readings from an unsupported thermistor. Some
revisions of other trogdor boards that are added by Doug's
'arm64: dts: qcom: Update sc7180-trogdor variants from downstream'
series have the same problem. Disable the charger thermal zone for
them too.

This series is based on v2 of the 'arm64: dts: qcom: Update
sc7180-trogdor variants from downstream' series
(https://patchwork.kernel.org/project/linux-arm-msm/list/?series=440315)


Matthias Kaehlcke (4):
  arm64: dts: qcom: sc7180: lazor: Simplify disabling of charger thermal
zone
  arm64: dts: qcom: sc7180: Add pompom rev3
  arm64: dts: qcom: sc7180: pompom: Disable charger thermal zone for
rev1 and rev2
  arm64: dts: qcom: sc7180: Disable charger thermal zone for coachz rev1
and rev2

 .../dts/qcom/sc7180-trogdor-coachz-r1.dts |  9 
 .../dts/qcom/sc7180-trogdor-coachz-r2.dts |  9 
 .../boot/dts/qcom/sc7180-trogdor-lazor-r0.dts |  9 
 .../boot/dts/qcom/sc7180-trogdor-lazor-r1.dts |  9 
 .../boot/dts/qcom/sc7180-trogdor-lazor-r3.dts |  9 
 .../boot/dts/qcom/sc7180-trogdor-lazor.dtsi   |  9 
 .../dts/qcom/sc7180-trogdor-pompom-r1.dts |  9 
 .../dts/qcom/sc7180-trogdor-pompom-r2-lte.dts |  4 +-
 .../dts/qcom/sc7180-trogdor-pompom-r2.dts | 13 +-
 .../dts/qcom/sc7180-trogdor-pompom-r3-lte.dts | 14 ++
 .../dts/qcom/sc7180-trogdor-pompom-r3.dts | 46 +++
 11 files changed, 109 insertions(+), 31 deletions(-)
 create mode 100644 arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r3-lte.dts
 create mode 100644 arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r3.dts

-- 
2.30.1.766.gb4fecdf3b7-goog



[PATCH v2] usb: dwc3: qcom: Honor wakeup enabled/disabled state

2021-03-02 Thread Matthias Kaehlcke
The dwc3-qcom currently enables wakeup interrupts unconditionally
when suspending, however this should not be done when wakeup is
disabled (e.g. through the sysfs attribute power/wakeup). Only
enable wakeup interrupts when device_may_wakeup() returns true.

Fixes: a4333c3a6ba9 ("usb: dwc3: Add Qualcomm DWC3 glue driver")
Signed-off-by: Matthias Kaehlcke 
Reviewed-by: Bjorn Andersson 
---

Changes in v2:
- rebased on top of v5.12-rc1

 drivers/usb/dwc3/dwc3-qcom.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c
index 846a47be6df7..a8ae5cf46f1e 100644
--- a/drivers/usb/dwc3/dwc3-qcom.c
+++ b/drivers/usb/dwc3/dwc3-qcom.c
@@ -358,8 +358,10 @@ static int dwc3_qcom_suspend(struct dwc3_qcom *qcom)
if (ret)
dev_warn(qcom->dev, "failed to disable interconnect: %d\n", 
ret);
 
+   if (device_may_wakeup(qcom->dev))
+   dwc3_qcom_enable_interrupts(qcom);
+
qcom->is_suspended = true;
-   dwc3_qcom_enable_interrupts(qcom);
 
return 0;
 }
@@ -372,7 +374,8 @@ static int dwc3_qcom_resume(struct dwc3_qcom *qcom)
if (!qcom->is_suspended)
return 0;
 
-   dwc3_qcom_disable_interrupts(qcom);
+   if (device_may_wakeup(qcom->dev))
+   dwc3_qcom_disable_interrupts(qcom);
 
for (i = 0; i < qcom->num_clocks; i++) {
ret = clk_prepare_enable(qcom->clks[i]);
-- 
2.30.1.766.gb4fecdf3b7-goog



Re: [PATCH 13/13] arm64: dts: qcom: Add sc7180-lazor-coachz skus

2021-02-26 Thread Matthias Kaehlcke
On Thu, Feb 25, 2021 at 02:13:10PM -0800, Douglas Anderson wrote:
> This is a trogdor variant.  This is mostly a grab from the downstream
> tree with notable exceptions:
> - I skip -rev0.  This was a super early build and there's no advantage
>   of long term support.
> - I remove sound node since sound hasn't landed upstream yet.
> 
> Cc: Gwendal Grignou 
> Cc: Matthias Kaehlcke 
> Cc: Stephen Boyd 
> Cc: Tzung-Bi Shih 
> Cc: Judy Hsiao 
> Signed-off-by: Douglas Anderson 
> ---

Matches downstream except for the sound node and -rev0, which are
mentioned in the commit message. Also looks sane to me otherwise
from a high level inspection.

Reviewed-by: Matthias Kaehlcke 


Re: [PATCH 12/13] arm64: dts: qcom: Add sc7180-lazor-pompom skus

2021-02-25 Thread Matthias Kaehlcke
On Thu, Feb 25, 2021 at 02:13:09PM -0800, Douglas Anderson wrote:
> This is a trogdor variant.  This is mostly a grab from the downstream
> tree with notable exceptions:
> - I skip -rev0.  This was a super early build and there's no advantage
>   of long term support.
> - In -rev1 I translate the handling of the USB hub like is done for
>   similar boards.  See the difference between the downstream and
>   upstream 'sc7180-trogdor-lazor-r0.dts' for an example.  This will
>   need to be resolved when proper support for the USB hub is figured
>   out upstream.
> - I remove sound node since sound hasn't landed upstream yet.
> - In incorporate the pending <https://crrev.com/c/2719075> for the
>   keyboard.
> 
> Cc: Philip Chen 
> Cc: Matthias Kaehlcke 
> Cc: Stephen Boyd 
> Cc: Tzung-Bi Shih 
> Cc: Judy Hsiao 
> Signed-off-by: Douglas Anderson 



> diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom.dtsi 
> b/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom.dtsi
> new file mode 100644
> index ..8f1596b8e90a
> --- /dev/null
> +++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom.dtsi
> @@ -0,0 +1,288 @@
> +// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
> +/*
> + * Google Pompom board device tree source
> + *
> + * Copyright 2020 Google LLC.
> + */
> +
> +#include "sc7180.dtsi"
> +
> +ap_ec_spi:  {};
> +ap_h1_spi:  {};
> +
> +#include "sc7180-trogdor.dtsi"
> +
> +/ {
> + thermal-zones {
> + 5v-choke-thermal {
> + polling-delay-passive = <0>;
> + polling-delay = <250>;
> +
> + thermal-sensors = <_adc_tm 0>;

This is fine with how things are currently configured for trogdor, however be
aware that in the ADC thermal monitor config your patch is racing with 'arm64:
dts: qcom: sc7180: trogdor: Use ADC TM channel 0 instead of 1 for charger
temperature' (https://lore.kernel.org/patchwork/patch/1384514/). That patch
changes the charger thermistor for all trogdor boards to ADC TM channel 0,
so the 5v-choke thermistor would have to move to another channel (most
likely 1).



> +_adc_tm {
> + status = "okay";
> +
> + 5v-choke-thermistor@0 {
> + reg = <0>;

s/0/1/ in the two lines above if 'arm64: dts: qcom: sc7180: trogdor: Use ADC
TM channel 0 instead of 1 for charger temperature' lands before this patch.

The other deltas with downstream are mentioned in the commit message, as long
as we keep the change of the ADC TM channel in mind this looks good to me.

Reviewed-by: Matthias Kaehlcke 


Re: [PATCH 11/13] arm64: dts: qcom: Add sc7180-lazor-limozeen skus

2021-02-25 Thread Matthias Kaehlcke
On Thu, Feb 25, 2021 at 02:13:08PM -0800, Douglas Anderson wrote:
> This is a SKU variant of lazor.  Add it.  This squashes the downstream
> patches to support this hardware.
> 
> NOTES:
> - The non-touch SKU actually has "innolux,n116bca" but that driver is
>   still pending in simple-panel.  The bindings have been Acked though.
>   Things work well enough with the "innolux,n116bge" timings for now,
>   though.
> - The wonky special dts just for "-rev4" arguably doesn't need to go
>   upstream since they weren't widely distributed, but since a few
>   people have them we might as well.  If it ever causes problems we
>   can delete it.
> 
> Cc: Stephen Boyd 
> Signed-off-by: Douglas Anderson 
Reviewed-by: Matthias Kaehlcke 


Re: [PATCH 09/13] arm64: dts: qcom: sc7180: add GO_LAZOR variant property for lazor

2021-02-25 Thread Matthias Kaehlcke
On Thu, Feb 25, 2021 at 02:13:06PM -0800, Douglas Anderson wrote:
> From: Abhishek Kumar 
> 
> For trogdor, in the latest board-2.bin file, new BDF with variant
> name GO_LAZOR has been introduced, so we need this property set, for
> GO_LAZOR BDF to be picked.
> 
> Cc: Philip Chen 
> Signed-off-by: Abhishek Kumar 
> [dianders: adjusted subject line and sort order]
> Signed-off-by: Douglas Anderson 

I don't claim to be familiar with this part, but the same is done
downstream and the corresponding downstream commit references a bug
that talks about a 'GO_LAZOR' BDF variant, so this must be awesome!

Reviewed-by: Matthias Kaehlcke 


Re: [PATCH 08/13] arm64: dts: qcom: sc7180: Remove clock for bluetooth on Trogdor

2021-02-25 Thread Matthias Kaehlcke
On Thu, Feb 25, 2021 at 02:13:05PM -0800, Douglas Anderson wrote:
> From: Venkata Lakshmi Narayana Gubba 
> 
> Removed voting for RPMH_RF_CLK2 which is not required as it is
> getting managed by BT SoC through SW_CTRL line.
> 
> Cc: Matthias Kaehlcke 
> Signed-off-by: Venkata Lakshmi Narayana Gubba 
> Signed-off-by: Douglas Anderson 

Reviewed-by: Matthias Kaehlcke 


Re: [PATCH 07/13] arm64: dts: qcom: sc7180-trogdor: Remove fp control pins in prep for coachz

2021-02-25 Thread Matthias Kaehlcke
On Thu, Feb 25, 2021 at 02:13:04PM -0800, Douglas Anderson wrote:
> From: Alexandru M Stan 
> 
> Removed the pinctrl and pin{mux,conf} for the control pins because:
> 1. The only need for them is for userspace control via flash_fp_mcu
> 2. cros-ec doesn't know what to do with them, and even if it did,
>it would interfere with flash_fp_mcu at the most inopportune times
> 
> Since we're not using hogs, we rely on AP firmware to set all the
> control pins correctly.
> 
> Cc: Stephen Boyd 
> Cc: Craig Hesling 
> Signed-off-by: Alexandru M Stan 
> [dianders: adjusted since coachz isn't upstream yet]
> Signed-off-by: Douglas Anderson 

We have essentially the same patch downstream, so I suppose the AP FW
indeed takes care of configuring the FP pins as needed :)

Reviewed-by; Matthias Kaehlcke 


Re: [PATCH 06/13] arm64: dts: qcom: Disable camera clk on sc7180-trogdor devices by default

2021-02-25 Thread Matthias Kaehlcke
On Thu, Feb 25, 2021 at 02:13:03PM -0800, Douglas Anderson wrote:
> From: Stephen Boyd 
> 
> We only want to use this clk driver on CoachZ devices. Disable it for
> all other Trogdor boards.  NOTE: CoachZ devices aren't yet supported
> upstream so until it is this is just disabled for all trogdor.
> 
> Cc: Tomasz Figa 
> Signed-off-by: Stephen Boyd 
> [dianders:adjusted since no coachz upstream yet]
> Signed-off-by: Douglas Anderson 

Reviewed-by: Matthias Kaehlcke 


Re: [PATCH 05/13] arm64: dts: qcom: trogdor: Only wakeup from pen eject

2021-02-25 Thread Matthias Kaehlcke
On Thu, Feb 25, 2021 at 02:13:02PM -0800, Douglas Anderson wrote:
> From: Stephen Boyd 
> 
> Configure the pen to be a wakeup source only when the pen is ejected
> instead of both when the pen is ejected and inserted. This corresponds
> to wake source requirements.
> 
> Signed-off-by: Stephen Boyd 
> Signed-off-by: Douglas Anderson 

Reviewed-by: Matthias Kaehlcke 


Re: [PATCH 04/13] arm64: dts: qcom: Unify the sc7180-trogdor panel nodes

2021-02-25 Thread Matthias Kaehlcke
On Thu, Feb 25, 2021 at 02:13:01PM -0800, Douglas Anderson wrote:
> Let's avoid a bit of duplication by pushing this up to the trogdor.dtsi
> file.
> 
> Signed-off-by: Douglas Anderson 

Reviewed-by: Matthias Kaehlcke 


Re: [PATCH 03/13] arm64: dts: qcom: Prep sc7180-trogdor trackpad IRQ for new boards

2021-02-25 Thread Matthias Kaehlcke
On Thu, Feb 25, 2021 at 02:13:00PM -0800, Douglas Anderson wrote:
> The trackpad interrupt got renamed and also moved to a new GPIO on
> newer boards.  Let's do the move in the "trogdor.dtsi" file and then
> undo it in the two old boards.
> 
> NOTE: since none of the new boards have device trees yet, this change
> looks silly on its own but it will make sense after more boards are
> supported.
> 
> Signed-off-by: Douglas Anderson 

Reviewed-by: Matthias Kaehlcke 


Re: [PATCH 02/13] arm64: dts: qcom: Move sc7180 MI2S config to board files and make pulldown

2021-02-25 Thread Matthias Kaehlcke
On Thu, Feb 25, 2021 at 02:12:59PM -0800, Douglas Anderson wrote:
> In general pinconf belongs in board files, not SoC files.  Move it to
> the only current user (trogdor).  Also adjust the drive strengths and
> pulls.
> 
> Cc: V Sujith Kumar Reddy 
> Cc: Srinivasa Rao Mandadapu 
> Cc: Tzung-Bi Shih 
> Cc: Judy Hsiao 
> Signed-off-by: Douglas Anderson 
> ---
> This should replace the patch ("Asoc: qcom: dts: Change MI2S GPIO
> configuration to pulldown") [1].
> 
> [1] 
> https://lore.kernel.org/r/1605526408-15671-1-git-send-email-sriva...@codeaurora.org
> 
>  arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi | 24 
>  arch/arm64/boot/dts/qcom/sc7180.dtsi | 18 ---
>  2 files changed, 24 insertions(+), 18 deletions(-)

Reviewed-by: Matthias Kaehlcke 


Re: [PATCH v2 2/4] arm64: dts: qcom: sc7180: Disable charger thermal for lazor

2021-02-25 Thread Matthias Kaehlcke
> Subject: [PATCH v2 2/4] arm64: dts: qcom: sc7180: Disable charger thermal for 
> lazor

Should be 'Disable charger thermal *zone* for lazor'

Maybe Bjorn can fix this when applying if no respin is needed.

On Thu, Feb 25, 2021 at 10:33:35AM -0800, Matthias Kaehlcke wrote:
> Lazor is stuffed with a 47k NTC as thermistor for the charger
> temperature which currently isn't supported by the PM6150 ADC
> driver. Disable the charger thermal zone to avoid the use of
> bogus temperature values.
> 
> Signed-off-by: Matthias Kaehlcke 
> ---
> 
> Changes in v2:
> - disable the thermal zone instead of deleting the zone and ADC nodes
> - updated subject and commit message
> 
>  arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r0.dts | 9 +
>  arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dts | 9 +
>  arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r3.dts | 9 +
>  3 files changed, 27 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r0.dts 
> b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r0.dts
> index 30e3e769d2b4..5c997cd90069 100644
> --- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r0.dts
> +++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r0.dts
> @@ -14,6 +14,15 @@ / {
>   compatible = "google,lazor-rev0", "qcom,sc7180";
>  };
>  
> +/*
> + * Lazor is stuffed with a 47k NTC as charger thermistor which currently is
> + * not supported by the PM6150 ADC driver. Disable the charger thermal zone
> + * to avoid using bogus temperature values.
> + */
> +_thermal {
> + status = "disabled";
> +};
> +
>  _hub {
>   /* pp3300_l7c is used to power the USB hub */
>   /delete-property/regulator-always-on;
> diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dts 
> b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dts
> index c2ef06367baf..d9fbcc7bc5bd 100644
> --- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dts
> +++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dts
> @@ -14,6 +14,15 @@ / {
>   compatible = "google,lazor-rev1", "google,lazor-rev2", "qcom,sc7180";
>  };
>  
> +/*
> + * Lazor is stuffed with a 47k NTC as charger thermistor which currently is
> + * not supported by the PM6150 ADC driver. Disable the charger thermal zone
> + * to avoid using bogus temperature values.
> + */
> +_thermal {
> + status = "disabled";
> +};
> +
>  _hub {
>   /* pp3300_l7c is used to power the USB hub */
>   /delete-property/regulator-always-on;
> diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r3.dts 
> b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r3.dts
> index 1b9d2f46359e..19e69adb9e04 100644
> --- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r3.dts
> +++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r3.dts
> @@ -13,3 +13,12 @@ / {
>   model = "Google Lazor (rev3+)";
>   compatible = "google,lazor", "qcom,sc7180";
>  };
> +
> +/*
> + * Lazor is stuffed with a 47k NTC as charger thermistor which currently is
> + * not supported by the PM6150 ADC driver. Disable the charger thermal zone
> + * to avoid using bogus temperature values.
> + */
> +_thermal {
> + status = "disabled";
> +};
> -- 
> 2.30.0.617.g56c4b15f3c-goog
> 


[PATCH v2 4/4] arm64: dts: qcom: sc7180: trogdor: Use ADC TM channel 0 instead of 1 for charger temperature

2021-02-25 Thread Matthias Kaehlcke
On trogdor the ADC thermal monitor is used for monitoring certain
device temperatures. All trogdor boards have at least a thermistor
for the charger temperature, optionally they may have others.

Currently the ADC thermal monitor is configured to use channel 1
for the charger temperature. Given that all trogdor boards have
the charger thermistor it makes more sense to use channel 0,
and then let boards with other thermistors use channels 1, 2, 3,
rather than 0, 2, 3.

Signed-off-by: Matthias Kaehlcke 
---

Changes in v2:
- patch added to the series

 arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi
index ab4efaece5cb..58e127b6ba1e 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi
@@ -19,7 +19,7 @@ charger_thermal: charger-thermal {
polling-delay-passive = <0>;
polling-delay = <0>;
 
-   thermal-sensors = <_adc_tm 1>;
+   thermal-sensors = <_adc_tm 0>;
 
trips {
charger-crit {
@@ -718,8 +718,8 @@ charger-thermistor@4f {
 _adc_tm {
status = "okay";
 
-   charger-thermistor@1 {
-   reg = <1>;
+   charger-thermistor@0 {
+   reg = <0>;
io-channels = <_adc ADC5_AMUX_THM3_100K_PU>;
qcom,ratiometric;
qcom,hw-settle-time-us = <200>;
-- 
2.30.0.617.g56c4b15f3c-goog



[PATCH v2 1/4] arm64: dts: qcom: sc7180: trogdor: Add label to charger thermal zone

2021-02-25 Thread Matthias Kaehlcke
Some revisions of trogdor boards use a thermistor for the charger
temperature which currently isn't supported by the PM6150 ADC
driver. This results in bogus temperature readings. Add a label
to the charger thermal zone to facilitate disabling of the thermal
zone on affected boards.

Signed-off-by: Matthias Kaehlcke 
Reviewed-by: Douglas Anderson 
---

Changes in v2:
- only add a label to the thermal zone
- updated subject and commit message

 arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi
index 07c8b2c926c0..bda983da4eaf 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi
@@ -15,7 +15,7 @@
 
 / {
thermal-zones {
-   charger-thermal {
+   charger_thermal: charger-thermal {
polling-delay-passive = <0>;
polling-delay = <0>;
 
-- 
2.30.0.617.g56c4b15f3c-goog



[PATCH v2 2/4] arm64: dts: qcom: sc7180: Disable charger thermal for lazor

2021-02-25 Thread Matthias Kaehlcke
Lazor is stuffed with a 47k NTC as thermistor for the charger
temperature which currently isn't supported by the PM6150 ADC
driver. Disable the charger thermal zone to avoid the use of
bogus temperature values.

Signed-off-by: Matthias Kaehlcke 
---

Changes in v2:
- disable the thermal zone instead of deleting the zone and ADC nodes
- updated subject and commit message

 arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r0.dts | 9 +
 arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dts | 9 +
 arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r3.dts | 9 +
 3 files changed, 27 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r0.dts 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r0.dts
index 30e3e769d2b4..5c997cd90069 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r0.dts
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r0.dts
@@ -14,6 +14,15 @@ / {
compatible = "google,lazor-rev0", "qcom,sc7180";
 };
 
+/*
+ * Lazor is stuffed with a 47k NTC as charger thermistor which currently is
+ * not supported by the PM6150 ADC driver. Disable the charger thermal zone
+ * to avoid using bogus temperature values.
+ */
+_thermal {
+   status = "disabled";
+};
+
 _hub {
/* pp3300_l7c is used to power the USB hub */
/delete-property/regulator-always-on;
diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dts 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dts
index c2ef06367baf..d9fbcc7bc5bd 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dts
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dts
@@ -14,6 +14,15 @@ / {
compatible = "google,lazor-rev1", "google,lazor-rev2", "qcom,sc7180";
 };
 
+/*
+ * Lazor is stuffed with a 47k NTC as charger thermistor which currently is
+ * not supported by the PM6150 ADC driver. Disable the charger thermal zone
+ * to avoid using bogus temperature values.
+ */
+_thermal {
+   status = "disabled";
+};
+
 _hub {
/* pp3300_l7c is used to power the USB hub */
/delete-property/regulator-always-on;
diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r3.dts 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r3.dts
index 1b9d2f46359e..19e69adb9e04 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r3.dts
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r3.dts
@@ -13,3 +13,12 @@ / {
model = "Google Lazor (rev3+)";
compatible = "google,lazor", "qcom,sc7180";
 };
+
+/*
+ * Lazor is stuffed with a 47k NTC as charger thermistor which currently is
+ * not supported by the PM6150 ADC driver. Disable the charger thermal zone
+ * to avoid using bogus temperature values.
+ */
+_thermal {
+   status = "disabled";
+};
-- 
2.30.0.617.g56c4b15f3c-goog



[PATCH v2 3/4] arm64: dts: qcom: sc7180: trogdor: Fix trip point config of charger thermal zone

2021-02-25 Thread Matthias Kaehlcke
The trip point configuration of the charger thermal zone for trogdor
is missing a node for the critical trip point. Add the missing node.

Fixes: bb06eb3607e9 ("arm64: qcom: sc7180: trogdor: Add ADC nodes and thermal 
zone for charger thermistor")
Signed-off-by: Matthias Kaehlcke 
---

Changes in v2:
- patch added to the series

 arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi
index bda983da4eaf..ab4efaece5cb 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi
@@ -22,9 +22,11 @@ charger_thermal: charger-thermal {
thermal-sensors = <_adc_tm 1>;
 
trips {
-   temperature = <125000>;
-   hysteresis = <1000>;
-   type = "critical";
+   charger-crit {
+   temperature = <125000>;
+   hysteresis = <1000>;
+   type = "critical";
+   };
};
};
};
-- 
2.30.0.617.g56c4b15f3c-goog



  1   2   3   4   5   6   7   8   9   10   >