From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Yauhen Kharuzhy <jekhor@gmail.com>
Cc: linux-kernel@vger.kernel.org,
MyungJoo Ham <myungjoo.ham@samsung.com>,
Chanwoo Choi <cw00.choi@samsung.com>,
Hans de Goede <hdegoede@redhat.com>
Subject: Re: [PATCH v2 2/2] extcon intel-cht-wc: Enable external charger
Date: Wed, 20 Feb 2019 15:08:53 +0200 [thread overview]
Message-ID: <20190220130853.GQ9224@smile.fi.intel.com> (raw)
In-Reply-To: <20190219212441.19391-3-jekhor@gmail.com>
On Wed, Feb 20, 2019 at 12:24:41AM +0300, Yauhen Kharuzhy wrote:
> In some configuration external charger "#charge enable" signal is
> connected to PMIC. Enable it at device probing to allow charging.
>
> Save CHGRCTRL0 and CHGDISCTR registers at driver probing and restore
> them at driver unbind to re-enable hardware charging control if it was
> enabled before.
>
> Tested at Lenovo Yoga Book (YB1-X91L).
My comments below.
After addressing them,
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> +#define CHT_WC_CHGDISCTRL_OUTPUT BIT(0)
Simple _OUT as per documentation.
> +/* 0 - open drain, 1 - regular output */
Regular means push-pull.
> +#define CHT_WC_CHGDISCTRL_DRV_OD_DIS BIT(4)
_DRV as per documentation.
> +#define CHT_WC_CHGDISCTRL_MODE_HW BIT(6)
_FN as per documentation.
> +static void cht_wc_extcon_enable_charging(struct cht_wc_extcon_data *ext,
> + bool enable)
> +{
> + unsigned int val;
> + int ret;
> +
> + val = enable ? 0 : CHT_WC_CHGDISCTRL_OUTPUT;
Can be assigned in definition block.
> + ret = regmap_update_bits(ext->regmap, CHT_WC_CHGDISCTRL,
> + CHT_WC_CHGDISCTRL_OUTPUT, val);
> + if (ret)
> + dev_err(ext->dev, "Error updating CHGDISCTRL reg: %d\n", ret);
> +}
> + val = enable ? 0 : CHT_WC_CHGDISCTRL_MODE_HW;
> + ret = regmap_update_bits(ext->regmap, CHT_WC_CHGDISCTRL,
> + CHT_WC_CHGDISCTRL_MODE_HW, val);
Indentation.
> + if (ret)
> + dev_err(ext->dev,
> + "Error setting sw control for charger enable: %d\n",
> + ret);
> +static int cht_wc_save_initial_state(struct cht_wc_extcon_data *ext)
> +{
> + int ret;
> +
> + /*
> + * Save the external charger control output state for restoring it at
> + * driver unbinding
You may move "at" to the next line and add a period at the end.
> + */
> + ret = regmap_read(ext->regmap, CHT_WC_CHGDISCTRL,
> + &ext->chgdisctrl_saved);
> + if (ret) {
> + dev_err(ext->dev, "Error reading CHGDISCTRL: %d\n",
> + ret);
> + return ret;
> + }
> +
> + ret = regmap_read(ext->regmap, CHT_WC_CHGRCTRL0,
> + &ext->chgrctrl0_saved);
> + if (ret) {
> + dev_err(ext->dev, "Error reading CHGRCTRL0: %d\n",
> + ret);
> + return ret;
> + }
> +
> + return 0;
> +}
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2019-02-20 13:08 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-19 21:24 [PATCH v2 0/2] extcon: Intel Cherry Trail Whiskey Cove PMIC and external charger tweaks Yauhen Kharuzhy
2019-02-19 21:24 ` [PATCH v2 1/2] extcon-intel-cht-wc: Make charger detection co-existed with OTG host mode Yauhen Kharuzhy
2019-02-20 12:42 ` Andy Shevchenko
2019-02-20 20:46 ` Yauhen Kharuzhy
2019-02-19 21:24 ` [PATCH v2 2/2] extcon intel-cht-wc: Enable external charger Yauhen Kharuzhy
2019-02-20 13:08 ` Andy Shevchenko [this message]
2019-02-20 15:53 ` Hans de Goede
2019-02-20 21:24 ` Yauhen Kharuzhy
2019-02-22 9:18 ` 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=20190220130853.GQ9224@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=cw00.choi@samsung.com \
--cc=hdegoede@redhat.com \
--cc=jekhor@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=myungjoo.ham@samsung.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.