Re: [RFC PATCH v3 1/2] usb: typec: USB Type-C Port Manager (tcpm)

From: Guenter Roeck
Date: Fri Sep 30 2016 - 15:06:54 EST


On Thu, Sep 29, 2016 at 11:37 PM, Jun Li <jun.li@xxxxxxx> wrote:
> Hi Guenter,
>> -----Original Message-----
>> From: linux-usb-owner@xxxxxxxxxxxxxxx [mailto:linux-usb-
>> owner@xxxxxxxxxxxxxxx] On Behalf Of Guenter Roeck
>> Sent: Wednesday, August 24, 2016 5:11 AM
>> To: Felipe Balbi <felipe.balbi@xxxxxxxxxxxxxxx>
>> Cc: Chandra Sekhar Anagani <chandra.sekhar.anagani@xxxxxxxxx>; Bruce
>> Ashfield <bruce.ashfield@xxxxxxxxxxxxx>; Bin Gao <bin.gao@xxxxxxxxx>;
>> Pranav Tipnis <pranav.tipnis@xxxxxxxxx>; Heikki Krogerus
>> <heikki.krogerus@xxxxxxxxxxxxxxx>; linux-kernel@xxxxxxxxxxxxxxx; linux-
>> usb@xxxxxxxxxxxxxxx; Guenter Roeck <groeck@xxxxxxxxxxxx>
>> Subject: [RFC PATCH v3 1/2] usb: typec: USB Type-C Port Manager (tcpm)
>>
> ...
>> diff --git a/include/linux/usb/pd.h b/include/linux/usb/pd.h
>> new file mode 100644
>> index 000000000000..6b1679af7a25
>> --- /dev/null
>> +++ b/include/linux/usb/pd.h
>
> ...
>
>> +#define PDO_VAR(min_mv, max_mv, max_ma) \
>> + ((PDO_TYPE_VAR << PDO_TYPE_SHIFT) | \
>> + ((((min_mv) / 50) & PDO_VAR_MIN_VOLT_MASK) << \
>> + PDO_VAR_MIN_VOLT_SHIFT) | \
>> + ((((max_mv) / 50) & PDO_VAR_MAX_VOLT_MASK) << \
>> + PDO_VAR_MAX_VOLT_SHIFT) | \
>> + ((((max_ma) / 50) & PDO_VAR_MAX_CURR_MASK) << \
>
> ((((max_ma) / 10) & PDO_VAR_MAX_CURR_MASK) << \
>

Thanks, fixed. PDO_BATT has a similar problem, which I noticed while
fixing the above.

Guenter