Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp2344616ybv; Mon, 24 Feb 2020 03:39:46 -0800 (PST) X-Google-Smtp-Source: APXvYqypp5hxFaPnlB4DGFpZhI+x/R2osmjd6Qlq9kU5bUm9Rm+gqrXWnFMhFu/1lS0fNq/YUSdb X-Received: by 2002:a9d:6c58:: with SMTP id g24mr41831722otq.229.1582544386676; Mon, 24 Feb 2020 03:39:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582544386; cv=none; d=google.com; s=arc-20160816; b=UvDBa2BnHVs17wZ3CyNXYv/PGf87BDa0ZLgrrBwiaEDhsPM3TA7MZ5i2tZhYn2c/EY H8WcrrlcvBQnvJei8PCLbeIsha1bQJVmj8LuWfV/l0AjDZtNJIw11ySg2eQiTThJorXH u2zwW9ojfDWWAnyIZVGItsXhM1v3gma0oPEU7H7Av/dsscBy+dCKMSFVxOWebDNbFnbi 66bVehI/0Z2wzqihbCtPt36OvYLtjzBCJzmBH4icL3p2ZKtOaiL0jSlvF45GqFe3zc3K OciA5ZAcpUVac6qCwAGV01TaHu8umfCM4jHDaGwdOZk4qowYtdRcMRaDnmnWINgRpL6L yM9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=YaVwweN+aW1ZCvHJhQTdqSj28sX6FFGNSbihhchPVRg=; b=hSyPP1349zAgJcybSop9w4k75lvWh+qdqzlK6U3urLZDL/1pr8ybn5DJxjaF0WJg8j u0ikDzkt05AS+YHO1iqPILGo/eV3lSWUDbDNAFC8cdc/AoA4NM7eBeU9MopopFDxeur3 +/9zspNDukpydM2IG7qEaloDYHW+onnv+Pr+1d11Wh1uusQhDYRrasQQ5Dk21mYK0V44 pNauzw/M996g2ZUoXi4PRqTtw1/W3Wq01r8FAfHNYhrKqwamOcqZNnBZylKEq3LYpVQt +1/xiIt5eusdfCUxtYyP2NOz198J11EQ1uRHi+n4mwxSDrcwNxgd5qj5UyDBI3IGpuaj l3Ig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kYez6mqH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h128si4881995oif.258.2020.02.24.03.39.34; Mon, 24 Feb 2020 03:39:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kYez6mqH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727489AbgBXLi6 (ORCPT + 99 others); Mon, 24 Feb 2020 06:38:58 -0500 Received: from mail-wm1-f66.google.com ([209.85.128.66]:39030 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726778AbgBXLi5 (ORCPT ); Mon, 24 Feb 2020 06:38:57 -0500 Received: by mail-wm1-f66.google.com with SMTP id c84so9012338wme.4 for ; Mon, 24 Feb 2020 03:38:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=YaVwweN+aW1ZCvHJhQTdqSj28sX6FFGNSbihhchPVRg=; b=kYez6mqHDaN2QlJo5jP1V1uZimfHQ9jdJwXu4K4TW5lh4MWBrDGoyrsRW7NolG00gT HjOQ/tQlKcPQiAaxdiVteQgNTPNoqguqCxYivYk/wiMYPsz0Dw5lU2msyD+5n1C18MrU CHWeuUKRlT/KUT3wqn6xbgiJzl97ogAHL8ZUZmsTQfTaq4vC8AMJYugY9n4kW/XLeoNH I5GOHGSS5sbMPQazJI3ib8LBjFKHtQBF2MLyzRnjx9IoJL64VKHshjulyrKUjWmyN+UN eqpvq/nCyvK3lIQxuWgsfzoxgxZAMQTODMnrr21Eo2IbuZkSoHedFOebtZ8rlli0zzt3 KaDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=YaVwweN+aW1ZCvHJhQTdqSj28sX6FFGNSbihhchPVRg=; b=kvKOUAn0Xo2FTp2JuIKoqMgXPPqaIAahXtsAe5GLCUQpmfBhflS46jsGWMvrvFCFZh Bhj+nfxhyfm4w1/ZMky4r5tEGMdZuw7URKGzbKcFmeLPZhCqP/ger5vH503+DSwnnoxa +tJLXYvR2QVk7DZ1YHN3LH3nDNauWA88F1AWEdlEK0aoinmuc9YkzrUrQPSxTDpuGlwN ZuHGNQVqKccX7hXexDPDcPqa1d9Pg8j0KbS1fbtUT3ZHpeB8nSDgmkZ5hUl+ibFJTTqW yFWYgBBT1aYOPEAs11Z7jIqqC/aQ42eQJRDGoDPZLHoPKxPEbSkFQDREVudwjWfM4ioy zbuQ== X-Gm-Message-State: APjAAAXKwPcgkuqYKtVQAxAFxr6dHOrXvX9+zpXvmo7ANNgzdCzMHbX3 SsQDAplDNM/mQcKaudtYbq6lTw== X-Received: by 2002:a1c:7d8b:: with SMTP id y133mr22313770wmc.165.1582544336115; Mon, 24 Feb 2020 03:38:56 -0800 (PST) Received: from dell ([2.31.163.122]) by smtp.gmail.com with ESMTPSA id e11sm7572535wrm.80.2020.02.24.03.38.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Feb 2020 03:38:55 -0800 (PST) Date: Mon, 24 Feb 2020 11:39:26 +0000 From: Lee Jones To: Baolin Wang Cc: arnd@arndb.de, zhang.lyra@gmail.com, orsonzhai@gmail.com, linux-kernel@vger.kernel.org Subject: Re: [RESEND PATCH] mfd: sc27xx: Add USB charger type detection support Message-ID: <20200224113926.GU3494@dell> References: <049eb16cf995d3a2dd0de01f4c0ed09965e36f92.1581906151.git.baolin.wang7@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <049eb16cf995d3a2dd0de01f4c0ed09965e36f92.1581906151.git.baolin.wang7@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 17 Feb 2020, Baolin Wang wrote: > The Spreadtrum SC27XX series PMICs supply the USB charger type detection > function, and related registers are located on the PMIC global registers > region, thus we implement and export this function in the MFD driver for > users to get the USB charger type. > > Signed-off-by: Baolin Wang > --- > drivers/mfd/sprd-sc27xx-spi.c | 52 +++++++++++++++++++++++++++++++++++++++ > include/linux/mfd/sc27xx-pmic.h | 7 ++++++ > 2 files changed, 59 insertions(+) > create mode 100644 include/linux/mfd/sc27xx-pmic.h [...] > +enum usb_charger_type sprd_pmic_detect_charger_type(struct device *dev) > +{ > + struct spi_device *spi = to_spi_device(dev); > + struct sprd_pmic *ddata = spi_get_drvdata(spi); > + const struct sprd_pmic_data *pdata = ddata->pdata; > + enum usb_charger_type type; > + u32 val; > + int ret; > + > + ret = regmap_read_poll_timeout(ddata->regmap, pdata->charger_det, val, > + (val & SPRD_PMIC_CHG_DET_DONE), > + SPRD_PMIC_CHG_DET_DELAY_US, > + SPRD_PMIC_CHG_DET_TIMEOUT); > + if (ret) { > + dev_err(&spi->dev, "failed to detect charger type\n"); > + return UNKNOWN_TYPE; > + } > + > + switch (val & SPRD_PMIC_CHG_TYPE_MASK) { > + case SPRD_PMIC_CDP_TYPE: > + type = CDP_TYPE; > + break; > + case SPRD_PMIC_DCP_TYPE: > + type = DCP_TYPE; > + break; > + case SPRD_PMIC_SDP_TYPE: > + type = SDP_TYPE; > + break; > + default: > + type = UNKNOWN_TYPE; > + break; > + } > + > + return type; > +} > +EXPORT_SYMBOL_GPL(sprd_pmic_detect_charger_type); Where is this called from? Why isn't the charger type detected in the charger driver? -- Lee Jones [李琼斯] Linaro Services Technical Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog