From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4854FC433F5 for ; Tue, 16 Nov 2021 11:41:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 33CB76337F for ; Tue, 16 Nov 2021 11:41:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234721AbhKPLnx (ORCPT ); Tue, 16 Nov 2021 06:43:53 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:49585 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235607AbhKPLn1 (ORCPT ); Tue, 16 Nov 2021 06:43:27 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1637062830; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=q2yhddqwOIyYZPL3FhXeGjYy0DQgznm+v+3hij7ERdE=; b=B0xO1tPDDcKgCvxvNfy3kbBBukXITbn22WiAF6kdIZ5C9MRD6ZfRNZMGfoGiG9OfX/DVPz eH4htPBykWl0v/oiDELRLuRJ7Mkm7avVbZzOrfrWveqn8ob2FlTquc2QLnt3GEkaw5jggP imntTXDDVVOH/wSpX/7detOcl/r/6xM= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-360-20b8l-a2OwmwS4swa1tgIg-1; Tue, 16 Nov 2021 06:40:29 -0500 X-MC-Unique: 20b8l-a2OwmwS4swa1tgIg-1 Received: by mail-ed1-f69.google.com with SMTP id v10-20020aa7d9ca000000b003e7bed57968so5686506eds.23 for ; Tue, 16 Nov 2021 03:40:28 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=q2yhddqwOIyYZPL3FhXeGjYy0DQgznm+v+3hij7ERdE=; b=ShkwR0cg5I6n326NgTl0bPOqjsvLP3o16XOwP1jUBMxatQV2tasQPkAvs99Z91EYB4 dD2suz9/U7gH83ubW284kT2cbWZnjgR2QRPQPTuMLOaaxZzQQF8Cskusqc7sJgn4cP95 mZhnx3oEZw3rdpkXjRwMHS+anNrcPuxE/dBgWZ0i/2DEqF90RRZZ1FUXs2Fx3VrQEC5w 7ZWpuWTCW+1iNRJj/I4DiW0g+gqLN/AJU0yzjI8H4eTKzV/L5SFcNGLAP4RH0cA/AehF zjiniO9BBeHJM1tXmLVG/tgfh7zQeFcif3CFcBZYuOdyQ7h7UH+a6+NH2tPLk1CpfmlH uNWQ== X-Gm-Message-State: AOAM532xnRLuKbZoCF1OYgFeBQ7vZl30Z35ddnDmELWVRu1uWSGtSyiE wKYbobamTSZ8You+pU9fjTqlmahW384nrNgw/SqTjWahy/vDvzihVzp54O8V/ZQArGQgEpjTsBr b+a1V7Q3ucBAcKyg/cWo5kQ== X-Received: by 2002:a50:bf01:: with SMTP id f1mr9257997edk.102.1637062827601; Tue, 16 Nov 2021 03:40:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJymU6yKouEKafBLdercgexA8Y6Lq4DD1sfYwW1qjfS7Zl1Y82tULN5DbCIDyJTLShnlIyoCVQ== X-Received: by 2002:a50:bf01:: with SMTP id f1mr9257958edk.102.1637062827380; Tue, 16 Nov 2021 03:40:27 -0800 (PST) Received: from ?IPV6:2001:1c00:c1e:bf00:1054:9d19:e0f0:8214? (2001-1c00-0c1e-bf00-1054-9d19-e0f0-8214.cable.dynamic.v6.ziggo.nl. [2001:1c00:c1e:bf00:1054:9d19:e0f0:8214]) by smtp.gmail.com with ESMTPSA id gs17sm8188492ejc.28.2021.11.16.03.40.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 16 Nov 2021 03:40:26 -0800 (PST) Message-ID: Date: Tue, 16 Nov 2021 12:40:26 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 Subject: Re: [PATCH v2 13/20] power: supply: bq25890: Support higher charging voltages through Pump Express+ protocol Content-Language: en-US To: Andy Shevchenko Cc: "Rafael J . Wysocki" , Mika Westerberg , Mark Gross , Andy Shevchenko , Wolfram Sang , Sebastian Reichel , MyungJoo Ham , Chanwoo Choi , Ard Biesheuvel , Len Brown , ACPI Devel Maling List , Yauhen Kharuzhy , Tsuchiya Yuto , Platform Driver , linux-i2c , Linux PM , Linux Kernel Mailing List , linux-efi References: <20211114170335.66994-1-hdegoede@redhat.com> <20211114170335.66994-14-hdegoede@redhat.com> From: Hans de Goede In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Hi, On 11/16/21 12:14, Andy Shevchenko wrote: > On Sun, Nov 14, 2021 at 7:04 PM Hans de Goede wrote: >> >> From: Yauhen Kharuzhy >> >> Add a "linux,pump-express-vbus-max" property which indicates if the Pump >> Express+ protocol should be used to increase the charging protocol. >> >> If this new property is set and a DCP charger is detected then request >> a higher charging voltage through the Pump Express+ protocol. >> >> So far this new property is only used on X86/ACPI (non devicetree) devs, >> IOW it is not used in actual devicetree files. The devicetree-bindings >> maintainers have requested properties like these to not be added to the >> devicetree-bindings, so the new property is deliberately not added >> to the existing devicetree-bindings. >> >> Changes by Hans de Goede: >> - Port to my bq25890 patch-series + various cleanups >> - Make behavior configurable through a new "linux,pump-express-vbus-max" >> device-property >> - Sleep 1 second before re-checking the Vbus voltage after requesting >> it to be raised, to ensure that the ADC has time to sampled the new Vbus >> - Add VBUSV bq25890_tables[] entry and use it in bq25890_get_vbus_voltage() >> - Tweak commit message > > ... > >> +#define PUMP_EXPRESS_START_DELAY (5 * HZ) >> +#define PUMP_EXPRESS_MAX_TRIES 6 >> +#define PUMP_EXPRESS_VBUS_MARGIN 1000000 > > Units? Perhaps "_uV"? > > ... > >> + dev_dbg(bq->dev, "input voltage = %d mV\n", voltage); > > Just to be sure, is it indeed "mV" and not "uV"? It is uV, will fix for the next version. > > ... > >> + while (bq25890_field_read(bq, F_PUMPX_UP) == 1) >> + msleep(100); > > Infinite loop? > > Sounds like a good candidate to switch to read_poll_timeout() // note> it accepts any type of (op) with a variadic number of args. Good catch, will fix. > > ... > >> +error: > > error_print: ? > >> + dev_err(bq->dev, "Failed to request hi-voltage charging\n"); > > ... > >> + ret = device_property_read_u32(bq->dev, "linux,pump-express-vbus-max", >> + &bq->pump_express_vbus_max); >> + if (ret < 0) >> + bq->pump_express_vbus_max = 0; > > Isn't it 0 by default? > > Anyway, for all optional properties one may use > > bq->...property... = $default; > device_property_read_u32(bq->dev, "linux,...property...", &bq->...property...); > > I.e. no conditional needed. Ack, will fix. Regards, Hans