From: Chanwoo Choi <cw00.choi@samsung.com>
To: Hans de Goede <hdegoede@redhat.com>,
Sebastian Reichel <sre@kernel.org>, Chen-Yu Tsai <wens@csie.org>,
MyungJoo Ham <myungjoo.ham@samsung.com>
Cc: "russianneuromancer @ ya . ru" <russianneuromancer@ya.ru>,
linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 08/14] power: supply: axp288_charger: Actually get and use the USB_HOST extcon device
Date: Mon, 19 Dec 2016 19:16:16 +0900 [thread overview]
Message-ID: <5857B370.4040303@samsung.com> (raw)
In-Reply-To: <20161219000731.10188-9-hdegoede@redhat.com>
Hi Hans,
On 2016년 12월 19일 09:07, Hans de Goede wrote:
> Nothing was setting info->otg.cable, so the extcon_get_cable_state_
> calls on it would always return -EINVAL.
>
> This commit fixes this by actually setting info->otg.cable using the new
> extcon_get_extcon_dev_by_cable_id function.
>
> This commit also makes failing to register the extcon notifier for the
> USB_HOST cable an error rather then a warning, because we MUST have this
> notfier to properly disable the VBUS path when in host mode so that we're
> not drawing current from the 5V boost converter which is supplying power
> to the otg port when in host mode.
>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
> drivers/power/supply/axp288_charger.c | 18 ++++++++++++------
> 1 file changed, 12 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/power/supply/axp288_charger.c b/drivers/power/supply/axp288_charger.c
> index 08a5dba..2b95db2 100644
> --- a/drivers/power/supply/axp288_charger.c
> +++ b/drivers/power/supply/axp288_charger.c
> @@ -833,6 +833,12 @@ static int axp288_charger_probe(struct platform_device *pdev)
> return -EPROBE_DEFER;
> }
>
> + info->otg.cable = extcon_get_extcon_dev_by_cable_id(EXTCON_USB_HOST);
> + if (info->otg.cable == NULL) {
> + dev_dbg(dev, "EXTCON_USB_HOST is not ready, probe deferred\n");
> + return -EPROBE_DEFER;
> + }
> +
I replied my opinion of extcon_get_extcon_dev_by_cable_id from patch1.
If you possible, I think that you better to use the id_table which
includes the correct name of extcon device which support the EXTCON_USB_HOST.
When changing the hardware design, I think you can add the new device_id
with new extcon device name.
> platform_set_drvdata(pdev, info);
> mutex_init(&info->lock);
>
> @@ -867,12 +873,12 @@ static int axp288_charger_probe(struct platform_device *pdev)
> info->otg.id_nb.notifier_call = axp288_charger_handle_otg_evt;
> ret = devm_extcon_register_notifier(dev, info->otg.cable,
> EXTCON_USB_HOST, &info->otg.id_nb);
> - if (ret)
> - dev_warn(&pdev->dev, "failed to register otg notifier\n");
> -
> - if (info->otg.cable)
> - info->otg.id_short = extcon_get_cable_state_(
> - info->otg.cable, EXTCON_USB_HOST);
> + if (ret) {
> + dev_err(dev, "failed to register EXTCON_USB_HOST notifier\n");
> + return ret;
> + }
> + info->otg.id_short = extcon_get_cable_state_(info->otg.cable,
> + EXTCON_USB_HOST);
>
> /* Register charger interrupts */
> for (i = 0; i < CHRG_INTR_END; i++) {
>
--
Regards,
Chanwoo Choi
next prev parent reply other threads:[~2016-12-19 10:16 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-19 0:07 [PATCH 00/14] extcon api extension + axp288_charger fixes Hans de Goede
2016-12-19 0:07 ` [PATCH 01/14] extcon: Add extcon_get_extcon_dev_by_cable_id function Hans de Goede
2016-12-19 10:12 ` Chanwoo Choi
2016-12-19 11:42 ` Hans de Goede
2016-12-19 11:57 ` Chanwoo Choi
2016-12-19 0:07 ` [PATCH 02/14] extcon: Make extcon_register_notifier use extcon_get_extcon_dev_by_cable_id Hans de Goede
2016-12-19 0:07 ` [PATCH 03/14] power: supply: axp288_charger: Make charger_init_hw_regs propagate i2c errors Hans de Goede
2016-12-19 0:07 ` [PATCH 04/14] power: supply: axp288_charger: Drop platform_data dependency Hans de Goede
2016-12-19 0:07 ` [PATCH 05/14] power: supply: axp288_charger: use devm extcon / supply register Hans de Goede
2016-12-19 8:03 ` Chanwoo Choi
2016-12-19 8:42 ` Hans de Goede
2016-12-19 0:07 ` [PATCH 06/14] power: supply: axp288_charger: Register extcon notifers after power_supply Hans de Goede
2016-12-19 0:07 ` [PATCH 07/14] power: supply: axp288_charger: Move init_hw_regs call before supply registration Hans de Goede
2016-12-19 0:07 ` [PATCH 08/14] power: supply: axp288_charger: Actually get and use the USB_HOST extcon device Hans de Goede
2016-12-19 10:16 ` Chanwoo Choi [this message]
2016-12-19 0:07 ` [PATCH 09/14] power: supply: axp288_charger: Handle charger type changing without disconnect Hans de Goede
2016-12-19 0:07 ` [PATCH 10/14] power: supply: axp288_charger: Some minor cleanups Hans de Goede
2016-12-19 0:07 ` [PATCH 11/14] power: supply: axp288_charger: Get and process initial hardware-state Hans de Goede
2016-12-19 0:07 ` [PATCH 12/14] power: supply: axp288_charger: Fix wrong regmap_update_bits Hans de Goede
2016-12-19 0:07 ` [PATCH 13/14] power: supply: axp288_charger: Remove unnecessary irq?_en register writes Hans de Goede
2016-12-19 0:07 ` [PATCH 14/14] power: supply: axp288_charger: Fix the module not auto-loading Hans de Goede
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=5857B370.4040303@samsung.com \
--to=cw00.choi@samsung.com \
--cc=hdegoede@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=myungjoo.ham@samsung.com \
--cc=russianneuromancer@ya.ru \
--cc=sre@kernel.org \
--cc=wens@csie.org \
/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;
as well as URLs for NNTP newsgroup(s).