lkml.org 
[lkml]   [2021]   [Sep]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFT PATCH 8/9] usb: typec: tipd: Switch power state to S0 for Apple variant


On Tue, Sep 21, 2021, at 15:46, Heikki Krogerus wrote:
> On Sat, Sep 18, 2021 at 02:09:33PM +0200, Sven Peter wrote:
>> The Apple CD321x comes up in a low-power state after boot. Usually, the
>> bootloader will already power it up to S0 but let's do it here as well
>> in case that didn't happen.
>>
>> Suggested-by: Stan Skowronek <stan@corellium.com>
>> Signed-off-by: Sven Peter <sven@svenpeter.dev>
>> ---
>> drivers/usb/typec/tipd/core.c | 44 +++++++++++++++++++++++++++++++
>> drivers/usb/typec/tipd/tps6598x.h | 6 +++++
>> 2 files changed, 50 insertions(+)
>>
>> diff --git a/drivers/usb/typec/tipd/core.c b/drivers/usb/typec/tipd/core.c
>> index e96b17fe6af6..26807c050662 100644
>> --- a/drivers/usb/typec/tipd/core.c
>> +++ b/drivers/usb/typec/tipd/core.c
>> @@ -30,6 +30,7 @@
>> #define TPS_REG_INT_MASK2 0x17
>> #define TPS_REG_INT_CLEAR1 0x18
>> #define TPS_REG_INT_CLEAR2 0x19
>> +#define TPS_REG_SYSTEM_POWER_STATE 0x20
>> #define TPS_REG_STATUS 0x1a
>> #define TPS_REG_SYSTEM_CONF 0x28
>> #define TPS_REG_CTRL_CONF 0x29
>> @@ -84,6 +85,8 @@ struct tps6598x_hw {
>> unsigned int irq_data_status_update;
>> unsigned int irq_plug_event;
>> void (*irq_trace)(u64 event1, u64 event2);
>> +
>> + bool supports_spss;
>> };
[...]
>> static int devm_tps6598_psy_register(struct tps6598x *tps)
>> {
>> struct power_supply_config psy_cfg = {};
>> @@ -648,6 +685,11 @@ static int tps6598x_probe(struct i2c_client *client)
>> if (ret)
>> return ret;
>>
>> + /* Switch Apple chips to the correct system power state */
>> + ret = cd321x_switch_power_state(tps, TPS_SYSTEM_POWER_STATE_S0);
>> + if (ret)
>> + return ret;
>
> If you call this from the same quirk where you set the mask for your
> board, you don't need that supports_spss flag at all, right?

Yup, that one will also disappear then.

Thanks,

Sven

\
 
 \ /
  Last update: 2021-09-22 17:01    [W:0.080 / U:0.172 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site