From: Hans de Goede <hdegoede@redhat.com>
To: Chanwoo Choi <cwchoi00@gmail.com>,
"Rafael J . Wysocki" <rjw@rjwysocki.net>,
Mika Westerberg <mika.westerberg@linux.intel.com>,
Mark Gross <markgross@kernel.org>,
Andy Shevchenko <andy@infradead.org>,
Wolfram Sang <wsa@the-dreams.de>,
Sebastian Reichel <sre@kernel.org>,
MyungJoo Ham <myungjoo.ham@samsung.com>,
Chanwoo Choi <cw00.choi@samsung.com>,
Ard Biesheuvel <ardb@kernel.org>
Cc: Len Brown <lenb@kernel.org>,
linux-acpi@vger.kernel.org, Yauhen Kharuzhy <jekhor@gmail.com>,
Tsuchiya Yuto <kitakar@gmail.com>,
platform-driver-x86@vger.kernel.org, linux-i2c@vger.kernel.org,
linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-efi@vger.kernel.org
Subject: Re: [PATCH v2 16/20] extcon: intel-cht-wc: Use new intel_cht_wc_get_model() helper
Date: Wed, 17 Nov 2021 23:28:32 +0100 [thread overview]
Message-ID: <380053ee-4a4a-963c-4f70-6b9dcfef1b98@redhat.com> (raw)
In-Reply-To: <5653c424-e12a-e889-1ae5-14a768dcf221@gmail.com>
Hi,
On 11/17/21 07:47, Chanwoo Choi wrote:
> On 21. 11. 15. 오전 2:03, Hans de Goede wrote:
>> The CHT_WC_VBUS_GPIO_CTLO GPIO actually driving an external 5V Vboost
>> converter for Vbus depends on the board on which the Cherry Trail -
>> Whiskey Cove PMIC is actually used.
>>
>> Since the information about the exact PMIC setup is necessary in other
>> places too, the drivers/mfd/intel_soc_pmic_chtwc.c code now has a new
>> intel_cht_wc_get_model() helper.
>>
>> Only poke the CHT_WC_VBUS_GPIO_CTLO GPIO if this new helper returns
>> INTEL_CHT_WC_GPD_WIN_POCKET, which indicates the Type-C (with PD and
>> DP-altmode) setup used on the GPD pocket and GPD win; and on which
>> this GPIO actually controls an external 5V Vboost converter.
>>
>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>> ---
>> drivers/extcon/extcon-intel-cht-wc.c | 35 +++++++++++++++++-----------
>> 1 file changed, 21 insertions(+), 14 deletions(-)
>>
>> diff --git a/drivers/extcon/extcon-intel-cht-wc.c b/drivers/extcon/extcon-intel-cht-wc.c
>> index 771f6f4cf92e..a5aeeecc44fb 100644
>> --- a/drivers/extcon/extcon-intel-cht-wc.c
>> +++ b/drivers/extcon/extcon-intel-cht-wc.c
>> @@ -14,6 +14,7 @@
>> #include <linux/module.h>
>> #include <linux/mod_devicetable.h>
>> #include <linux/platform_device.h>
>> +#include <linux/property.h>
>> #include <linux/regmap.h>
>> #include <linux/slab.h>
>> @@ -358,20 +359,26 @@ static int cht_wc_extcon_probe(struct platform_device *pdev)
>> if (IS_ERR(ext->edev))
>> return PTR_ERR(ext->edev);
>> - /*
>> - * When a host-cable is detected the BIOS enables an external 5v boost
>> - * converter to power connected devices there are 2 problems with this:
>> - * 1) This gets seen by the external battery charger as a valid Vbus
>> - * supply and it then tries to feed Vsys from this creating a
>> - * feedback loop which causes aprox. 300 mA extra battery drain
>> - * (and unless we drive the external-charger-disable pin high it
>> - * also tries to charge the battery causing even more feedback).
>> - * 2) This gets seen by the pwrsrc block as a SDP USB Vbus supply
>> - * Since the external battery charger has its own 5v boost converter
>> - * which does not have these issues, we simply turn the separate
>> - * external 5v boost converter off and leave it off entirely.
>> - */
>> - cht_wc_extcon_set_5v_boost(ext, false);
>> + switch (intel_cht_wc_get_model()) {
>
> intel_cht_wc_get_model() is defined in driver/mfd/intel_soc_pmic_chtwc.c
>
> Usually, mfd drivers share the data structure such as struct intel_soc_pmic. But, didn't call the exported function for only
> specific driver between linux kernel framework (extcon vs. mfd).
>
> So that I think that you better to update the mode information
> to 'struct intel_soc_pmic' data structure and then use it
> instead of using the exported function which may make the confusion.
That is a good idea, thanks.
I've implemented this suggestion for the upcoming v3 of the patch-set.
Regards,
Hans
>
>> + case INTEL_CHT_WC_GPD_WIN_POCKET:
>> + /*
>> + * When a host-cable is detected the BIOS enables an external 5v boost
>> + * converter to power connected devices there are 2 problems with this:
>> + * 1) This gets seen by the external battery charger as a valid Vbus
>> + * supply and it then tries to feed Vsys from this creating a
>> + * feedback loop which causes aprox. 300 mA extra battery drain
>> + * (and unless we drive the external-charger-disable pin high it
>> + * also tries to charge the battery causing even more feedback).
>> + * 2) This gets seen by the pwrsrc block as a SDP USB Vbus supply
>> + * Since the external battery charger has its own 5v boost converter
>> + * which does not have these issues, we simply turn the separate
>> + * external 5v boost converter off and leave it off entirely.
>> + */
>> + cht_wc_extcon_set_5v_boost(ext, false);
>> + break;
>> + default:
>> + break;
>> + }
>> /* Enable sw control */
>> ret = cht_wc_extcon_sw_control(ext, true);
>>
>
>
next prev parent reply other threads:[~2021-11-17 22:28 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-14 17:03 [PATCH v2 00/20] power-suppy/i2c/extcon: Fix charger setup on Xiaomi Mi Pad 2 and Lenovo Yogabook Hans de Goede
2021-11-14 17:03 ` [PATCH v2 01/20] power: supply: core: Refactor power_supply_set_input_current_limit_from_supplier() Hans de Goede
2021-11-14 17:03 ` [PATCH v2 02/20] power: supply: bq25890: Fix ADC continuous conversion setting when charging Hans de Goede
2021-11-14 17:03 ` [PATCH v2 03/20] power: supply: bq25890: Rename IILIM field to IINLIM Hans de Goede
2021-11-14 17:03 ` [PATCH v2 04/20] power: supply: bq25890: Reduce reported CONSTANT_CHARGE_CURRENT_MAX for low temperatures Hans de Goede
2021-11-16 9:43 ` Hans de Goede
2021-11-14 17:03 ` [PATCH v2 05/20] power: supply: bq25890: Add a bq25890_rw_init_data() helper Hans de Goede
2021-11-14 17:03 ` [PATCH v2 06/20] power: supply: bq25890: Add support to skip reset at probe() / remove() Hans de Goede
2021-11-14 17:03 ` [PATCH v2 07/20] power: supply: bq25890: Add support to read back the settings from the chip Hans de Goede
2021-11-14 17:03 ` [PATCH v2 08/20] power: supply: bq25890: Enable charging on boards where we skip reset Hans de Goede
2021-11-14 17:03 ` [PATCH v2 09/20] power: supply: bq25890: Drop dev->platform_data == NULL check Hans de Goede
2021-11-16 11:02 ` Andy Shevchenko
2021-11-14 17:03 ` [PATCH v2 10/20] power: supply: bq25890: Add bq25890_set_otg_cfg() helper Hans de Goede
2021-11-15 10:11 ` Yauhen Kharuzhy
2021-11-16 9:33 ` Hans de Goede
[not found] ` <CAKWEGV7WVsZK=890UG=t3dhqCuoD-6N44DPMzk-_8TSPBm4_Dg@mail.gmail.com>
2021-11-28 15:02 ` Hans de Goede
2021-11-28 19:46 ` Yauhen Kharuzhy
2021-11-14 17:03 ` [PATCH v2 11/20] power: supply: bq25890: Add support for registering the Vbus boost converter as a regulator Hans de Goede
2021-11-16 11:05 ` Andy Shevchenko
2021-11-14 17:03 ` [PATCH v2 12/20] power: supply: bq25890: On the bq25892 set the IINLIM based on external charger detection Hans de Goede
2021-11-14 17:03 ` [PATCH v2 13/20] power: supply: bq25890: Support higher charging voltages through Pump Express+ protocol Hans de Goede
2021-11-16 11:14 ` Andy Shevchenko
2021-11-16 11:40 ` Hans de Goede
2021-11-14 17:03 ` [PATCH v2 14/20] mfd: intel_soc_pmic_chtwc: Add intel_cht_wc_get_model() helper function Hans de Goede
2021-11-16 11:18 ` Andy Shevchenko
2021-11-16 11:43 ` Hans de Goede
2021-11-28 9:53 ` Hans de Goede
2021-11-14 17:03 ` [PATCH v2 15/20] i2c: cht-wc: Make charger i2c-client instantiation board/device-model specific Hans de Goede
2021-11-16 11:20 ` Andy Shevchenko
2021-11-16 11:44 ` Hans de Goede
2021-11-23 8:24 ` Wolfram Sang
2021-11-28 14:04 ` Hans de Goede
2021-11-14 17:03 ` [PATCH v2 16/20] extcon: intel-cht-wc: Use new intel_cht_wc_get_model() helper Hans de Goede
2021-11-17 6:47 ` Chanwoo Choi
2021-11-17 22:28 ` Hans de Goede [this message]
2021-11-14 17:03 ` [PATCH v2 17/20] extcon: intel-cht-wc: Support devs with Micro-B / USB-2 only Type-C connectors Hans de Goede
2021-11-16 11:28 ` Andy Shevchenko
2021-11-16 11:31 ` Andy Shevchenko
2021-11-16 11:32 ` Andy Shevchenko
2021-11-16 11:51 ` Hans de Goede
2021-11-14 17:03 ` [PATCH v2 18/20] extcon: intel-cht-wc: Refactor cht_wc_extcon_get_charger() Hans de Goede
2021-11-17 7:15 ` Chanwoo Choi
2021-11-17 22:30 ` Hans de Goede
2021-11-19 15:44 ` Chanwoo Choi
2021-11-28 14:17 ` Hans de Goede
2021-11-14 17:03 ` [PATCH v2 19/20] extcon: intel-cht-wc: Add support for registering a power_supply class-device Hans de Goede
2021-11-16 15:19 ` Andy Shevchenko
2021-11-14 17:03 ` [PATCH v2 20/20] extcon: intel-cht-wc: Report RID_A for ACA adapters Hans de Goede
2021-11-16 11:00 ` [PATCH v2 00/20] power-suppy/i2c/extcon: Fix charger setup on Xiaomi Mi Pad 2 and Lenovo Yogabook Andy Shevchenko
2021-11-16 11:05 ` Hans de Goede
2021-11-17 18:56 ` Sebastian Reichel
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=380053ee-4a4a-963c-4f70-6b9dcfef1b98@redhat.com \
--to=hdegoede@redhat.com \
--cc=andy@infradead.org \
--cc=ardb@kernel.org \
--cc=cw00.choi@samsung.com \
--cc=cwchoi00@gmail.com \
--cc=jekhor@gmail.com \
--cc=kitakar@gmail.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=markgross@kernel.org \
--cc=mika.westerberg@linux.intel.com \
--cc=myungjoo.ham@samsung.com \
--cc=platform-driver-x86@vger.kernel.org \
--cc=rjw@rjwysocki.net \
--cc=sre@kernel.org \
--cc=wsa@the-dreams.de \
/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).