Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp896464pxb; Tue, 1 Feb 2022 12:41:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJygFEwG2xMgUh8KUtdNSzKDlESFAm0LiM0GVcb5IcDcSuP6BL/ui7yYzZN51mN1oiXB5N67 X-Received: by 2002:a17:902:e812:: with SMTP id u18mr27571832plg.12.1643748065976; Tue, 01 Feb 2022 12:41:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643748065; cv=none; d=google.com; s=arc-20160816; b=k2YRvArZT7Neii6tlVTnevI6qZcyiYlbDu+Zrxex/Z+WPYlwIO6/xvktVewp+Qt9eQ SdXI1xYdP9Fsy+l0A+fysW+GxXv2Nd7jJuKXoo6AQEGNKHjKhHQtlXEqneLNwdaGE5rE nYNmexheMaXpsaj8vRftR2JKUEGwetsofk1JozDpvjJuOyYzlzRrN86We3zL22MrCvIE rkg7JGzmGgNZHkwoUW5EcNSNmYnXxR6GtsUpBANXxSr7MHOHztTEQ+cBp7EhMBrz0Nxo OtjvHlYVSOS3YhF5mwl2aaxzZogLWy86+L8mciJjbbJt/dz0SCJFddnydwyJAsBUK96V n/Ng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=NcqrZUIGllRvgj0z2bTIhpEKRXWwQz9TbvmqXzDoHzs=; b=y1ge7D4NGo3LUEf574qyeOT8qrqfUkXvqTLWz+PvDuolAlBd+rAnpaxTpmIp1XQzM6 DRDFV9P1eRUlgo/BGpaoomRsw5mfbbmCTDnHwXjgjPf4XBxuakziD3a4rjHGfNu3bez/ xi+UYv78B5ULFpBQ/O+UD9SZmIary1I1eXWJ/1DmFtfvy0MVz6QQIw1YFjb2JZQZ/MOL Bak9DYd49petog3rqzMsFpDAr2NzyjRJV45IuOHermR8u2GnPZ3ceFg66+mECubDL60d 2aYg+6UyEyHjU3S+AzlxvVK68GdOii3ulOIu9wmHEvABVZR0kXrhDLaWt6KFG3y0wy4X PtAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="DeFdaTz/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k20si15710056pll.387.2022.02.01.12.40.54; Tue, 01 Feb 2022 12:41:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="DeFdaTz/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379162AbiAaNtz (ORCPT + 99 others); Mon, 31 Jan 2022 08:49:55 -0500 Received: from mga14.intel.com ([192.55.52.115]:62889 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379143AbiAaNtv (ORCPT ); Mon, 31 Jan 2022 08:49:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1643636991; x=1675172991; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=CCvnVIfnnsg4Om7JyESlCrRRmCTTcyTfYzN4cwo7ytw=; b=DeFdaTz/knNxNi+CbMLscPuDPIF/G1uOhVFBngH1Z8QYIAC7vel14gl7 e3EJOsU0cElivTIfHeTWQ00BS2yqh3uI34HmabpH5q4x7ca/OW3CDFmx9 zlAEFaspslHC1lfmhFbt4c8pOjt/PjM8izGkNLe1TTz7TB479pQcceak5 o8DCbhh2fwsT/UADRfgFB+cATjsY5MjEfFlOgwdvtKMF8SAlvI4kdoSTb Nc8+IChA9KXVfSNFx5Ql+nYdxDVGAJtyWarHVraFZZ9NpPm8muNI1mZOg E3xjJ6XCwLjqtXW1IfTccqM3WlMLAtWxfli5YW5nh72884h3w8Irnfx4F w==; X-IronPort-AV: E=McAfee;i="6200,9189,10243"; a="247677792" X-IronPort-AV: E=Sophos;i="5.88,331,1635231600"; d="scan'208";a="247677792" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Jan 2022 05:49:49 -0800 X-IronPort-AV: E=Sophos;i="5.88,331,1635231600"; d="scan'208";a="481753169" Received: from smile.fi.intel.com ([10.237.72.61]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Jan 2022 05:49:44 -0800 Received: from andy by smile.fi.intel.com with local (Exim 4.95) (envelope-from ) id 1nEX2v-00Gt4F-Iy; Mon, 31 Jan 2022 15:48:41 +0200 Date: Mon, 31 Jan 2022 15:48:41 +0200 From: Andy Shevchenko To: Hans de Goede Cc: "Rafael J . Wysocki" , Mika Westerberg , Mark Gross , Andy Shevchenko , Wolfram Sang , Lee Jones , Sebastian Reichel , MyungJoo Ham , Chanwoo Choi , Ard Biesheuvel , Len Brown , linux-acpi@vger.kernel.org, Yauhen Kharuzhy , Tsuchiya Yuto , Fabio Aiuto , platform-driver-x86@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-efi@vger.kernel.org Subject: Re: [PATCH v4 12/20] power: supply: bq25890: Support higher charging voltages through Pump Express+ protocol Message-ID: References: <20220130204557.15662-1-hdegoede@redhat.com> <20220130204557.15662-13-hdegoede@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220130204557.15662-13-hdegoede@redhat.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jan 30, 2022 at 09:45:49PM +0100, 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 ... > +static void bq25890_pump_express_work(struct work_struct *data) > +{ > + struct bq25890_device *bq = > + container_of(data, struct bq25890_device, pump_express_work.work); > + int voltage, i, ret; > + > + dev_dbg(bq->dev, "Start to request input voltage increasing\n"); > + > + /* Enable current pulse voltage control protocol */ > + ret = bq25890_field_write(bq, F_PUMPX_EN, 1); > + if (ret < 0) > + goto error_print; > + > + for (i = 0; i < PUMP_EXPRESS_MAX_TRIES; i++) { > + voltage = bq25890_get_vbus_voltage(bq); > + if (voltage < 0) > + goto error_print; It also can be (at least in align with the rest error paths) ret = bq25890_get_vbus_voltage(bq); if (ret < 0) goto error_print; voltage = ret; followed up (but not necessarily)... > + dev_dbg(bq->dev, "input voltage = %d uV\n", voltage); > + > + if ((voltage + PUMP_EXPRESS_VBUS_MARGIN_uV) > > + bq->pump_express_vbus_max) > + break; > + > + ret = bq25890_field_write(bq, F_PUMPX_UP, 1); > + if (ret < 0) > + goto error_print; > + > + /* Note a single PUMPX up pulse-sequence takes 2.1s */ > + ret = regmap_field_read_poll_timeout(bq->rmap_fields[F_PUMPX_UP], > + ret, !ret, 100000, 3000000); > + if (ret < 0) > + goto error_print; > + > + /* Make sure ADC has sampled Vbus before checking again */ > + msleep(1000); > + } > + > + bq25890_field_write(bq, F_PUMPX_EN, 0); > + > + dev_info(bq->dev, "Hi-voltage charging requested, input voltage is %d mV\n", > + voltage); > + return; > +error_print: if (ret < 0) But it's up to you. > + dev_err(bq->dev, "Failed to request hi-voltage charging\n"); > +} -- With Best Regards, Andy Shevchenko