lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPtXDt1hMrgJ_9Zs6Zmkzf4b1-QfEcZPp7dKG26G6ZEqBxCgBw@mail.gmail.com>
Date:   Tue, 4 Aug 2020 10:11:19 +0800
From:   ivan <yanziily@...il.com>
To:     Greg KH <gregkh@...uxfoundation.org>
Cc:     Sebastian Reichel <sre@...nel.org>, Pavel Machek <pavel@...x.de>,
        linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org,
        jiangfei1@...omi.com, Qiwu Huang <huangqiwu@...omi.com>
Subject: Re: [PATCH v4 1/4] power: supply: core: add quick charge type property

On Mon, Aug 3, 2020 at 7:57 PM Greg KH <gregkh@...uxfoundation.org> wrote:
>
> On Mon, Aug 03, 2020 at 01:49:50PM +0200, Sebastian Reichel wrote:
> > More importantely I prefer not to merge new APIs without any users
> > (i.e. a driver making use of those values). Having a reference
> > driver means, that there is an example how to use the values
> > correctly and proves it is actually needed upstream. Right now
> > this looks like "let's modify the upstream kernel, so that we can
> > easily maintain our out of tree driver".
>
> Agreed.  Qiwu, can you also submit your driver so we can see these
> values be used?

Our driver is based on qualcomm's driver secondary development.

The driver code is for mi 10.

https://github.com/MiCode/Xiaomi_Kernel_OpenSource/blob/umi-q-oss/drivers/power/supply/qcom/qpnp-smb5.c#L1434

+ case POWER_SUPPLY_PROP_QUICK_CHARGE_TYPE:
+     val->intval = smblib_get_quick_charge_type(chg);
+     break;

https://github.com/MiCode/Xiaomi_Kernel_OpenSource/blob/umi-q-oss/drivers/power/supply/qcom/smb5-lib.c#L7713

+struct quick_charge adapter_cap[10] = {
+       { POWER_SUPPLY_TYPE_USB,        QUICK_CHARGE_NORMAL },
+       { POWER_SUPPLY_TYPE_USB_DCP,    QUICK_CHARGE_NORMAL },
+       { POWER_SUPPLY_TYPE_USB_CDP,    QUICK_CHARGE_NORMAL },
+       { POWER_SUPPLY_TYPE_USB_ACA,    QUICK_CHARGE_NORMAL },
+       { POWER_SUPPLY_TYPE_USB_FLOAT,  QUICK_CHARGE_NORMAL },
+       { POWER_SUPPLY_TYPE_USB_PD,       QUICK_CHARGE_FAST },
+       { POWER_SUPPLY_TYPE_USB_HVDCP,    QUICK_CHARGE_FAST },
+       { POWER_SUPPLY_TYPE_USB_HVDCP_3,  QUICK_CHARGE_FAST },
+       { POWER_SUPPLY_TYPE_WIRELESS,     QUICK_CHARGE_FAST },
+       {0, 0},
+};
+
+int smblib_get_quick_charge_type(struct smb_charger *chg)
+{
+       int i = 0, rc;
+       union power_supply_propval pval = {0, };
+
+       if (!chg) {
+               dev_err(chg->dev, "get quick charge type faied\n");
+               return -EINVAL;
+       }
+
+       rc = smblib_get_prop_batt_health(chg, &pval);
+       if (rc < 0)
+               smblib_err(chg, "Couldn't get batt health rc=%d\n", rc);
+
+       if ((pval.intval == POWER_SUPPLY_HEALTH_COLD) || (pval.intval
== POWER_SUPPLY_HEALTH_HOT))
+               return 0;
+
+       if ((chg->real_charger_type == POWER_SUPPLY_TYPE_USB_PD) &&
chg->pd_verifed) {
+               return QUICK_CHARGE_TURBE;
+       }
+
+       if (chg->is_qc_class_b)
+               return QUICK_CHARGE_FLASH;
+
+       if ((chg->real_charger_type == POWER_SUPPLY_TYPE_USB_DCP) &&
+                      (chg->hvdcp_recheck_status ||
chg->fake_plug_out == true))
+               return QUICK_CHARGE_FLASH;
+
+       while (adapter_cap[i].adap_type != 0) {
+               if (chg->real_charger_type == adapter_cap[i].adap_type) {
+                       return adapter_cap[i].adap_cap;
+               }
+               i++;
+       }
+
+       return 0;
+}



>
> thanks,
>
> greg k-h



-- 
Thanks

Qiwu

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ