root/include/linux/usb/pd_ado.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. usb_pd_ado_type
  2. usb_pd_ado_fixed_batt
  3. usb_pd_ado_hot_swap_batt

   1 // SPDX-License-Identifier: GPL-2.0+
   2 /*
   3  * Copyright (c) 2017 Dialog Semiconductor
   4  *
   5  * Author: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
   6  */
   7 
   8 #ifndef __LINUX_USB_PD_ADO_H
   9 #define __LINUX_USB_PD_ADO_H
  10 
  11 /* ADO : Alert Data Object */
  12 #define USB_PD_ADO_TYPE_SHIFT                   24
  13 #define USB_PD_ADO_TYPE_MASK                    0xff
  14 #define USB_PD_ADO_FIXED_BATT_SHIFT             20
  15 #define USB_PD_ADO_FIXED_BATT_MASK              0xf
  16 #define USB_PD_ADO_HOT_SWAP_BATT_SHIFT          16
  17 #define USB_PD_ADO_HOT_SWAP_BATT_MASK           0xf
  18 
  19 #define USB_PD_ADO_TYPE_BATT_STATUS_CHANGE      BIT(1)
  20 #define USB_PD_ADO_TYPE_OCP                     BIT(2)
  21 #define USB_PD_ADO_TYPE_OTP                     BIT(3)
  22 #define USB_PD_ADO_TYPE_OP_COND_CHANGE          BIT(4)
  23 #define USB_PD_ADO_TYPE_SRC_INPUT_CHANGE        BIT(5)
  24 #define USB_PD_ADO_TYPE_OVP                     BIT(6)
  25 
  26 static inline unsigned int usb_pd_ado_type(u32 ado)
  27 {
  28         return (ado >> USB_PD_ADO_TYPE_SHIFT) & USB_PD_ADO_TYPE_MASK;
  29 }
  30 
  31 static inline unsigned int usb_pd_ado_fixed_batt(u32 ado)
  32 {
  33         return (ado >> USB_PD_ADO_FIXED_BATT_SHIFT) &
  34                USB_PD_ADO_FIXED_BATT_MASK;
  35 }
  36 
  37 static inline unsigned int usb_pd_ado_hot_swap_batt(u32 ado)
  38 {
  39         return (ado >> USB_PD_ADO_HOT_SWAP_BATT_SHIFT) &
  40                USB_PD_ADO_HOT_SWAP_BATT_MASK;
  41 }
  42 #endif /* __LINUX_USB_PD_ADO_H */

/* [<][>][^][v][top][bottom][index][help] */