From: Lee Jones <lee.jones@linaro.org>
To: Baolin Wang <baolin.wang7@gmail.com>
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
Date: Mon, 24 Feb 2020 11:39:26 +0000 [thread overview]
Message-ID: <20200224113926.GU3494@dell> (raw)
In-Reply-To: <049eb16cf995d3a2dd0de01f4c0ed09965e36f92.1581906151.git.baolin.wang7@gmail.com>
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 <baolin.wang7@gmail.com>
> ---
> 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
next prev parent reply other threads:[~2020-02-24 11:38 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-17 2:26 [RESEND PATCH] mfd: sc27xx: Add USB charger type detection support Baolin Wang
2020-02-24 11:39 ` Lee Jones [this message]
2020-02-25 2:52 ` Baolin Wang
2020-02-25 8:50 ` Lee Jones
2020-02-25 9:27 ` Baolin Wang
2020-02-27 5:41 ` Baolin Wang
2020-02-27 9:35 ` Lee Jones
2020-02-27 9:34 ` Lee Jones
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200224113926.GU3494@dell \
--to=lee.jones@linaro.org \
--cc=arnd@arndb.de \
--cc=baolin.wang7@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=orsonzhai@gmail.com \
--cc=zhang.lyra@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox