Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1498339pxb; Sat, 30 Oct 2021 15:16:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzcjiAth+RUJFgG9IVIfV7jGC0foI8TVqJe+GJY69Tyc/7n+hdnm415a+pzeLPjOLBFk7KL X-Received: by 2002:a05:6638:d11:: with SMTP id q17mr14247335jaj.62.1635632200626; Sat, 30 Oct 2021 15:16:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635632200; cv=none; d=google.com; s=arc-20160816; b=AAJ6OkmHfNqFNHTae5IWmlWrKriV0AE+hfYhIMuIyTDCSFwFfNaugFhNvBDFVa4H8V qmYWPw53QkqPN8p1dXcZYrhK5hEKPZ3iVfzmbJGUqSTACGKWpttpHXDKn/HgJxCh+evx Gnnb+29jQzu2A05m/xDQHKSweC1/d8NbBlh1ofzuI+NXUl3jhnVbAEjAGji1D4vt8cQ2 EB+NEowMAYkyksFX8ff4+0ho1pDI5m08miIRAQ36/keXtdvnAimZl16PUaJ2tW8TzptM kyWyHlouibliXRNr+a1nXE39ehspan+q76FDUrFL0ucrKSDmPs+zknZDm/dR9IVLBzkO bNaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=rZW96vbK8Teu6OjvSzaXi6oYccLSbo4NeNB+PnxDYjs=; b=gfPlsutiiwcFdPTBKpPQNvEnDaa0OPEfkyoNJ+BarqviWYO7bzQh8QmbPoYCS6Pq8o VDZPg503i46We1jXxh81/fi52IFZeo2zdnmat7ui5WK+R6tizPVO8m4LsXDE9nTyOA3U BIyaDXZE/Ijo/0Y5NwioJ66qyE3jKTBqJIMl4NA4yppNzCQuW/ADtR5TiEynEvDr39Nq zIf1CZbBRjBO8oag8LiexZdY+1n51P6obA1fmroXE9qeRt3DWctIU7xPiccYhQpmSOkr cJrjaccREIOasZi+2xgMeBMgg45dVaAPF9tw/K+hmNv42J4m1CoTLvQo8TxZuok59vN2 /YGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=DHOAo1pp; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k26si10732768ioc.28.2021.10.30.15.16.29; Sat, 30 Oct 2021 15:16:40 -0700 (PDT) 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=@gmail.com header.s=20210112 header.b=DHOAo1pp; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231960AbhJ3WRI (ORCPT + 99 others); Sat, 30 Oct 2021 18:17:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230323AbhJ3WRH (ORCPT ); Sat, 30 Oct 2021 18:17:07 -0400 Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [IPv6:2a00:1450:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 088D4C061570; Sat, 30 Oct 2021 15:14:37 -0700 (PDT) Received: by mail-ed1-x52e.google.com with SMTP id ee16so37889152edb.10; Sat, 30 Oct 2021 15:14:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=rZW96vbK8Teu6OjvSzaXi6oYccLSbo4NeNB+PnxDYjs=; b=DHOAo1ppJJP8d81/gQ3MXN4x6pffoigju7/27smlLAyMH7XC+hnC6Es2UGVZFkyKp0 BWh1ANbfYlGei6kjYwjBWNqA6IXv4+hWNVInl3YtUerR95UgdEl7Lcgb11XwQsfSqixr wR9AcZF2uBqAFvTtAJ6u6R/kxebeS49Ln32Usig5kPmyNyW0fyS2n7s48I2y/rK+2Sjb vnyLBPJW1u7nVgsNw1gCAxcPNefDhZbh5yB/ZkC0wMf1ERDaMkg05ZaVtRsJRY4nxfpz JxQ1vQknx4gnmQePosJtL1cWaCRqk8s3ZQHaIzj6+UO7A9dHBmk0lPDN1TJBdEVPudbS gIsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=rZW96vbK8Teu6OjvSzaXi6oYccLSbo4NeNB+PnxDYjs=; b=bzFBU+Qhj0Z5eNibEh6LHprMWXMFOSwITzd0ZHZXTWf4ZWx0k3QpymP119bl99M61v TawgNd9LSo6yeuTDRm9KmqSBGEmluPJL0w0AzQVeS36C85eqyuL1iiLJyB882WFFwDIo zRk0GPTSHXyC9tu9VDoebVIPgglOWpdlEpzGpt6r2AHv9J4dziWPUPTEt4gFL/5zTGA+ gX7NSLDlRd97YQIh1fyGY2V+tp/OknGGr9sUkRyI+6Tr6y4Dyh2mNAqD6IOs5VFGgytb s3hd2mUeIRAt2hJOlohD/hVKTQKqr9WdtqZZipwJFLeJp+CMOFmE/kynL/e72tDgTz+Z vMaw== X-Gm-Message-State: AOAM531rS/Rn/CcOFgXQaegqL5OdjGzyJV04HhyUwEuGz62zLLRjoncH rhMvtvmTQ4R/xUnaJCuQlmmheWoSQngPwHa4xFQ= X-Received: by 2002:a17:907:1c9e:: with SMTP id nb30mr24504525ejc.141.1635632075516; Sat, 30 Oct 2021 15:14:35 -0700 (PDT) MIME-Version: 1.0 References: <20211030182813.116672-1-hdegoede@redhat.com> <20211030182813.116672-11-hdegoede@redhat.com> In-Reply-To: <20211030182813.116672-11-hdegoede@redhat.com> From: Andy Shevchenko Date: Sun, 31 Oct 2021 01:13:59 +0300 Message-ID: Subject: Re: [PATCH 10/13] power: supply: bq25890: Add support for registering the Vbus boost converter as a regulator To: Hans de Goede Cc: Mark Gross , Andy Shevchenko , Wolfram Sang , Sebastian Reichel , MyungJoo Ham , Chanwoo Choi , Ard Biesheuvel , Yauhen Kharuzhy , Tsuchiya Yuto , Platform Driver , linux-i2c , Linux PM , Linux Kernel Mailing List , linux-efi Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Oct 30, 2021 at 9:28 PM Hans de Goede wrote: > > The bq25890_charger code supports enabling/disabling the boost converter > based on usb-phy notifications. But the usb-phy framework is not used on > all boards/platforms. At support for registering the Vbus boost converter > as a standard regulator when there is no usb-phy on the board. > > Also add support for providing regulator_init_data through platform_data > for use on boards where device-tree is not used and the platform code must > thus provide the regulator_init_data. ... > @@ -1018,6 +1059,21 @@ static int bq25890_probe(struct i2c_client *client, > INIT_WORK(&bq->usb_work, bq25890_usb_work); > bq->usb_nb.notifier_call = bq25890_usb_notifier; > usb_register_notifier(bq->usb_phy, &bq->usb_nb); > +#ifdef CONFIG_REGULATOR > + } else { > + struct bq25890_platform_data *pdata = dev_get_platdata(dev); > + struct regulator_config cfg = { }; > + struct regulator_dev *reg; > + > + cfg.dev = dev; > + cfg.driver_data = bq; > + if (pdata) > + cfg.init_data = pdata->regulator_init_data; > + > + reg = devm_regulator_register(dev, &bq25890_vbus_desc, &cfg); > + if (IS_ERR(reg)) > + return dev_err_probe(dev, PTR_ERR(reg), "registering regulator"); > +#endif > } } #ifdef else { ... } #endif is a bit better to maintain (less error prone in case of new code). ... > +#ifndef _BQ25890_CHARGER_H_ > +#define _BQ25890_CHARGER_H_ > +#include struct regulator_init_data; should be sufficient, no header is needed. > +struct bq25890_platform_data { > + const struct regulator_init_data *regulator_init_data; > +}; > + > +#endif -- With Best Regards, Andy Shevchenko