Loading Documentation/devicetree/bindings/power/supply/qcom/qpnp-qnovo5.txt +15 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,18 @@ Properties: Definition: Specifies the interrupt name for Qnovo5. There is only one interrupt named as "ptrain-done". - pinctrl-N: Usage: optional Value type: <phandle> Definition: Specifies the pinctrl configuration that needs to be applied when the charger is removed for controlling external FET. - pinctrl-names: Usage: optional Value type: <string> Definition: Specifies the names for pinctrl configurations defined above. Allowed names are "q_state1" and "q_state2". Example: qcom,qpnp-qnovo@b000 { Loading @@ -37,4 +49,7 @@ qcom,qpnp-qnovo@b000 { reg = <0xb000 0x100>; interrupts = <0x2 0xb0 0x0 IRQ_TYPE_NONE>; interrupt-names = "ptrain-done"; pinctrl-names = "q_state1", "q_state2"; pinctrl-0 = <&qnovo_fet_ctrl_state1>; pinctrl-1 = <&qnovo_fet_ctrl_state2>; }; arch/arm64/boot/dts/qcom/sm8150-pmic-overlay.dtsi +27 −1 Original line number Diff line number Diff line /* * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved. * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -88,6 +88,12 @@ }; }; &pm8150b_qnovo { pinctrl-names = "q_state1", "q_state2"; pinctrl-0 = <&qnovo_fet_ctrl_state1>; pinctrl-1 = <&qnovo_fet_ctrl_state2>; }; &pm8150b_gpios { smb_stat { smb_stat_default: smb_stat_default { Loading @@ -99,6 +105,26 @@ power-source = <0>; }; }; qnovo_fet_ctrl { qnovo_fet_ctrl_state1: qnovo_fet_ctrl_state1 { pins = "gpio8"; function = "normal"; input-enable; output-disable; bias-disable; power-source = <0>; }; qnovo_fet_ctrl_state2: qnovo_fet_ctrl_state2 { pins = "gpio8"; function = "normal"; input-enable; output-disable; bias-pull-down; power-source = <0>; }; }; }; &usb0 { Loading drivers/power/supply/qcom/qpnp-qnovo5.c +39 −1 Original line number Diff line number Diff line /* Copyright (c) 2016-2018 The Linux Foundation. All rights reserved. /* Copyright (c) 2016-2019 The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -115,6 +115,9 @@ struct qnovo { struct class qnovo_class; struct power_supply *batt_psy; struct power_supply *usb_psy; struct pinctrl *pinctrl; struct pinctrl_state *pinctrl_state1; struct pinctrl_state *pinctrl_state2; struct notifier_block nb; struct votable *disable_votable; struct votable *pt_dis_votable; Loading Loading @@ -304,6 +307,30 @@ static int qnovo5_parse_dt(struct qnovo *chip) return rc; } chip->pinctrl = devm_pinctrl_get(chip->dev); if (IS_ERR(chip->pinctrl)) { pr_err("Couldn't get pinctrl rc=%d\n", PTR_ERR(chip->pinctrl)); chip->pinctrl = NULL; } if (chip->pinctrl) { chip->pinctrl_state1 = pinctrl_lookup_state(chip->pinctrl, "q_state1"); if (IS_ERR(chip->pinctrl_state1)) { rc = PTR_ERR(chip->pinctrl_state1); pr_err("Couldn't get pinctrl state1 rc=%d\n", rc); return rc; } chip->pinctrl_state2 = pinctrl_lookup_state(chip->pinctrl, "q_state2"); if (IS_ERR(chip->pinctrl_state2)) { rc = PTR_ERR(chip->pinctrl_state2); pr_err("Couldn't get pinctrl state2 rc=%d\n", rc); return rc; } } return 0; } Loading Loading @@ -1120,6 +1147,17 @@ static void status_change_work(struct work_struct *work) cancel_delayed_work_sync(&chip->usb_debounce_work); vote(chip->awake_votable, USB_READY_VOTER, false, 0); vote(chip->chg_ready_votable, USB_READY_VOTER, false, 0); if (chip->pinctrl) { rc = pinctrl_select_state(chip->pinctrl, chip->pinctrl_state1); if (rc < 0) pr_err("Couldn't select state 1 rc=%d\n", rc); rc = pinctrl_select_state(chip->pinctrl, chip->pinctrl_state2); if (rc < 0) pr_err("Couldn't select state 2 rc=%d\n", rc); } } else if (!chip->usb_present && usb_present) { /* insertion */ chip->usb_present = 1; Loading Loading
Documentation/devicetree/bindings/power/supply/qcom/qpnp-qnovo5.txt +15 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,18 @@ Properties: Definition: Specifies the interrupt name for Qnovo5. There is only one interrupt named as "ptrain-done". - pinctrl-N: Usage: optional Value type: <phandle> Definition: Specifies the pinctrl configuration that needs to be applied when the charger is removed for controlling external FET. - pinctrl-names: Usage: optional Value type: <string> Definition: Specifies the names for pinctrl configurations defined above. Allowed names are "q_state1" and "q_state2". Example: qcom,qpnp-qnovo@b000 { Loading @@ -37,4 +49,7 @@ qcom,qpnp-qnovo@b000 { reg = <0xb000 0x100>; interrupts = <0x2 0xb0 0x0 IRQ_TYPE_NONE>; interrupt-names = "ptrain-done"; pinctrl-names = "q_state1", "q_state2"; pinctrl-0 = <&qnovo_fet_ctrl_state1>; pinctrl-1 = <&qnovo_fet_ctrl_state2>; };
arch/arm64/boot/dts/qcom/sm8150-pmic-overlay.dtsi +27 −1 Original line number Diff line number Diff line /* * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved. * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -88,6 +88,12 @@ }; }; &pm8150b_qnovo { pinctrl-names = "q_state1", "q_state2"; pinctrl-0 = <&qnovo_fet_ctrl_state1>; pinctrl-1 = <&qnovo_fet_ctrl_state2>; }; &pm8150b_gpios { smb_stat { smb_stat_default: smb_stat_default { Loading @@ -99,6 +105,26 @@ power-source = <0>; }; }; qnovo_fet_ctrl { qnovo_fet_ctrl_state1: qnovo_fet_ctrl_state1 { pins = "gpio8"; function = "normal"; input-enable; output-disable; bias-disable; power-source = <0>; }; qnovo_fet_ctrl_state2: qnovo_fet_ctrl_state2 { pins = "gpio8"; function = "normal"; input-enable; output-disable; bias-pull-down; power-source = <0>; }; }; }; &usb0 { Loading
drivers/power/supply/qcom/qpnp-qnovo5.c +39 −1 Original line number Diff line number Diff line /* Copyright (c) 2016-2018 The Linux Foundation. All rights reserved. /* Copyright (c) 2016-2019 The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -115,6 +115,9 @@ struct qnovo { struct class qnovo_class; struct power_supply *batt_psy; struct power_supply *usb_psy; struct pinctrl *pinctrl; struct pinctrl_state *pinctrl_state1; struct pinctrl_state *pinctrl_state2; struct notifier_block nb; struct votable *disable_votable; struct votable *pt_dis_votable; Loading Loading @@ -304,6 +307,30 @@ static int qnovo5_parse_dt(struct qnovo *chip) return rc; } chip->pinctrl = devm_pinctrl_get(chip->dev); if (IS_ERR(chip->pinctrl)) { pr_err("Couldn't get pinctrl rc=%d\n", PTR_ERR(chip->pinctrl)); chip->pinctrl = NULL; } if (chip->pinctrl) { chip->pinctrl_state1 = pinctrl_lookup_state(chip->pinctrl, "q_state1"); if (IS_ERR(chip->pinctrl_state1)) { rc = PTR_ERR(chip->pinctrl_state1); pr_err("Couldn't get pinctrl state1 rc=%d\n", rc); return rc; } chip->pinctrl_state2 = pinctrl_lookup_state(chip->pinctrl, "q_state2"); if (IS_ERR(chip->pinctrl_state2)) { rc = PTR_ERR(chip->pinctrl_state2); pr_err("Couldn't get pinctrl state2 rc=%d\n", rc); return rc; } } return 0; } Loading Loading @@ -1120,6 +1147,17 @@ static void status_change_work(struct work_struct *work) cancel_delayed_work_sync(&chip->usb_debounce_work); vote(chip->awake_votable, USB_READY_VOTER, false, 0); vote(chip->chg_ready_votable, USB_READY_VOTER, false, 0); if (chip->pinctrl) { rc = pinctrl_select_state(chip->pinctrl, chip->pinctrl_state1); if (rc < 0) pr_err("Couldn't select state 1 rc=%d\n", rc); rc = pinctrl_select_state(chip->pinctrl, chip->pinctrl_state2); if (rc < 0) pr_err("Couldn't select state 2 rc=%d\n", rc); } } else if (!chip->usb_present && usb_present) { /* insertion */ chip->usb_present = 1; Loading