linux/drivers/mxc/pmic/mc13783/pmic_convity.c File Reference

Implementation of the PMIC Connectivity driver APIs. More...

Data Structures

struct  REGFIELD
 This structure is used to define a specific hardware register field. More...
struct  USBCNTRL_REG_0
 This structure is used to identify the fields in the USBCNTRL_REG_0 hardware register. More...
struct  USBCNTRL_REG_1
 This structure is used to identify the fields in the USBCNTRL_REG_1 hardware register. More...
struct  pmic_convity_state_struct
 This structure is used to maintain the current device driver state. More...
struct  pmic_convity_usb_state
 This structure is used to maintain the current device driver state. More...
struct  pmic_convity_rs232_state
 This structure is used to maintain the current device driver state. More...
struct  pmic_convity_cea936_state
 This structure is used to maintain the current device driver state. More...

Defines

#define SET_BITS(reg, field, value)
#define GET_BITS(reg, value)

Enumerations

enum  HANDLE_STATE {
  HANDLE_FREE,
  HANDLE_IN_USE,
  HANDLE_FREE,
  HANDLE_IN_USE
}
enum  PMIC_CORE_EVENT {
  CORE_EVENT_MC2BI,
  CORE_EVENT_HSDETI,
  CORE_EVENT_HSLI,
  CORE_EVENT_ALSPTHI,
  CORE_EVENT_AHSSHORTI,
  CORE_EVENT_4V4 = 1,
  CORE_EVENT_2V0 = 2,
  CORE_EVENT_0V8 = 4,
  CORE_EVENT_ABDET = 8
}

Functions

static DEFINE_SPINLOCK (lock)
static DECLARE_MUTEX (mutex)
 DECLARE_WORK (convityTasklet, pmic_convity_tasklet)
Connectivity Driver Internal Support Functions

These non-exported internal functions are used to support the functionality of the exported connectivity APIs.

static void pmic_convity_tasklet (struct work_struct *work)
static PMIC_STATUS pmic_convity_set_mode_internal (const PMIC_CONVITY_MODE mode)
static PMIC_STATUS pmic_convity_deregister_all (void)
static void pmic_convity_event_handler (void *param)
General Setup and Configuration Connectivity APIs

Functions for setting up and configuring the connectivity hardware.

PMIC_STATUS pmic_convity_open (PMIC_CONVITY_HANDLE *const handle, const PMIC_CONVITY_MODE mode)
PMIC_STATUS pmic_convity_close (const PMIC_CONVITY_HANDLE handle)
PMIC_STATUS pmic_convity_set_mode (const PMIC_CONVITY_HANDLE handle, const PMIC_CONVITY_MODE mode)
PMIC_STATUS pmic_convity_get_mode (const PMIC_CONVITY_HANDLE handle, PMIC_CONVITY_MODE *const mode)
PMIC_STATUS pmic_convity_reset (const PMIC_CONVITY_HANDLE handle)
PMIC_STATUS pmic_convity_set_callback (const PMIC_CONVITY_HANDLE handle, const PMIC_CONVITY_CALLBACK func, const PMIC_CONVITY_EVENTS eventMask)
PMIC_STATUS pmic_convity_clear_callback (const PMIC_CONVITY_HANDLE handle)
PMIC_STATUS pmic_convity_get_callback (const PMIC_CONVITY_HANDLE handle, PMIC_CONVITY_CALLBACK *const func, PMIC_CONVITY_EVENTS *const eventMask)
USB and USB-OTG Connectivity APIs

Functions for controlling USB and USB-OTG connectivity.

PMIC_STATUS pmic_convity_usb_set_speed (const PMIC_CONVITY_HANDLE handle, const PMIC_CONVITY_USB_SPEED speed)
PMIC_STATUS pmic_convity_usb_get_speed (const PMIC_CONVITY_HANDLE handle, PMIC_CONVITY_USB_SPEED *const speed, PMIC_CONVITY_USB_MODE *const mode)
PMIC_STATUS pmic_convity_set_output (const PMIC_CONVITY_HANDLE handle, bool out_type, bool out)
PMIC_STATUS pmic_convity_usb_set_power_source (const PMIC_CONVITY_HANDLE handle, const PMIC_CONVITY_USB_POWER_IN pwrin, const PMIC_CONVITY_USB_POWER_OUT pwrout)
PMIC_STATUS pmic_convity_usb_get_power_source (const PMIC_CONVITY_HANDLE handle, PMIC_CONVITY_USB_POWER_IN *const pwrin, PMIC_CONVITY_USB_POWER_OUT *const pwrout)
PMIC_STATUS pmic_convity_usb_set_xcvr (const PMIC_CONVITY_HANDLE handle, const PMIC_CONVITY_USB_TRANSCEIVER_MODE mode)
PMIC_STATUS pmic_convity_usb_get_xcvr (const PMIC_CONVITY_HANDLE handle, PMIC_CONVITY_USB_TRANSCEIVER_MODE *const mode)
PMIC_STATUS pmic_convity_usb_otg_set_dlp_duration (const PMIC_CONVITY_HANDLE handle, const unsigned int duration)
PMIC_STATUS pmic_convity_usb_otg_get_dlp_duration (const PMIC_CONVITY_HANDLE handle, unsigned int *const duration)
PMIC_STATUS pmic_convity_usb_otg_set_config (const PMIC_CONVITY_HANDLE handle, const PMIC_CONVITY_USB_OTG_CONFIG cfg)
PMIC_STATUS pmic_convity_usb_otg_clear_config (const PMIC_CONVITY_HANDLE handle, const PMIC_CONVITY_USB_OTG_CONFIG cfg)
PMIC_STATUS pmic_convity_usb_otg_get_config (const PMIC_CONVITY_HANDLE handle, PMIC_CONVITY_USB_OTG_CONFIG *const cfg)
RS-232 Serial Connectivity APIs

Functions for controlling RS-232 serial connectivity.

PMIC_STATUS pmic_convity_rs232_set_config (const PMIC_CONVITY_HANDLE handle, const PMIC_CONVITY_RS232_INTERNAL cfgInternal, const PMIC_CONVITY_RS232_EXTERNAL cfgExternal)
PMIC_STATUS pmic_convity_rs232_get_config (const PMIC_CONVITY_HANDLE handle, PMIC_CONVITY_RS232_INTERNAL *const cfgInternal, PMIC_CONVITY_RS232_EXTERNAL *const cfgExternal)
CEA-936 Connectivity APIs

Functions for controlling CEA-936 connectivity.

PMIC_STATUS pmic_convity_cea936_exit_signal (const PMIC_CONVITY_HANDLE handle, const PMIC_CONVITY_CEA936_EXIT_SIGNAL signal)
Connectivity Driver Loading/Unloading Functions

These non-exported internal functions are used to support the connectivity device driver initialization and de-initialization operations.

static int __init mc13783_pmic_convity_init (void)
static void __exit mc13783_pmic_convity_exit (void)

Variables

static const USBCNTRL_REG_0 regUSB0
static const USBCNTRL_REG_1 regUSB1
static const unsigned int REG_FULLMASK = 0xffffff
static const unsigned int RESET_USBCNTRL_REG_0 = 0x080060
static const unsigned int RESET_USBCNTRL_REG_1 = 0x000006
static const
pmic_convity_state_struct 
reset
static pmic_convity_usb_state usb
static pmic_convity_rs232_state rs_232
static pmic_convity_cea936_state cea_936
static PMIC_CORE_EVENT eventID

Detailed Description

Implementation of the PMIC Connectivity driver APIs.

The PMIC connectivity device driver and this API were developed to support the external connectivity capabilities of several power management ICs that are available from Freescale Semiconductor, Inc.

The following operating modes, in terms of external connectivity, are supported:

       Operating Mode     mc13783
       ---------------    -------
       USB (incl. OTG)     Yes
       RS-232              Yes
       CEA-936             Yes

   

Define Documentation

#define GET_BITS ( reg,
value   ) 
Value:
(((value) & reg.mask) >> \
                reg.offset)

Get the current value of a given register field.

#define SET_BITS ( reg,
field,
value   ) 
Value:
(((value) << reg.field.offset) & \
                reg.field.mask)

Set a register field to a given value.


Enumeration Type Documentation

Define the possible states for a device handle.

This enumeration is used to track the current state of each device handle.

Enumerator:
HANDLE_FREE 

Handle is available for use.

HANDLE_IN_USE 

Handle is currently in use.

HANDLE_FREE 

Handle is available for use.

HANDLE_IN_USE 

Handle is currently in use.

Identifies the hardware interrupt source.

This enumeration identifies which of the possible hardware interrupt sources actually caused the current interrupt handler to be called.

Enumerator:
CORE_EVENT_MC2BI 

Microphone Bias 2 detect.

CORE_EVENT_HSDETI 

Detect Headset attach

CORE_EVENT_HSLI 

Detect Stereo Headset

CORE_EVENT_ALSPTHI 

Detect Thermal shutdown of ALSP

CORE_EVENT_AHSSHORTI 

Detect Short circuit on AHS outputs

CORE_EVENT_4V4 

Detected USB 4.4 V event.

CORE_EVENT_2V0 

Detected USB 2.0 V event.

CORE_EVENT_0V8 

Detected USB 0.8 V event.

CORE_EVENT_ABDET 

Detected USB mini A-B connector event.


Function Documentation

static DECLARE_MUTEX ( mutex   )  [static]

This mutex is used to provide mutual exclusion.

Create a mutex that can be used to provide mutually exclusive read/write access to the globally accessible data structures that were defined above. Mutually exclusive access is required to ensure that the Connectivity data structures are consistent at all times when possibly accessed by multiple threads of execution.

Note that we use a mutex instead of the spinlock whenever disabling interrupts while in the critical section is not required. This helps to minimize kernel interrupt handling latency.

DECLARE_WORK ( convityTasklet  ,
pmic_convity_tasklet   
)

Tasklet handler for the connectivity driver.

Declare a tasklet that will do most of the processing for all of the connectivity-related interrupt events (USB4.4VI, USB2.0VI, USB0.8VI, and AB_DETI). Note that we cannot do all of the required processing within the interrupt handler itself because we may need to call the ADC driver to measure voltages as well as calling any user-registered callback functions.

static DEFINE_SPINLOCK ( lock   )  [static]

This spinlock is used to provide mutual exclusion.

Create a spinlock that can be used to provide mutually exclusive read/write access to the globally accessible "convity" data structure that was defined above. Mutually exclusive access is required to ensure that the convity data structure is consistent at all times when possibly accessed by multiple threads of execution (for example, while simultaneously handling a user request and an interrupt event).

We need to use a spinlock sometimes because we need to provide mutual exclusion while handling a hardware interrupt.

static void __exit mc13783_pmic_convity_exit ( void   )  [static]

This is the Connectivity device driver de-initialization function.

This function is called by the kernel when this device driver is about to be unloaded.

References pmic_convity_cea936_state::handle, pmic_convity_rs232_state::handle, pmic_convity_usb_state::handle, HANDLE_IN_USE, pmic_convity_usb_state::handle_state, pmic_convity_close(), pmic_write_reg(), REG_FULLMASK, RESET_USBCNTRL_REG_0, and RESET_USBCNTRL_REG_1.

static int __init mc13783_pmic_convity_init ( void   )  [static]

This is the connectivity device driver initialization function.

This function is called by the kernel when this device driver is first loaded.

PMIC_STATUS pmic_convity_cea936_exit_signal ( const PMIC_CONVITY_HANDLE  handle,
const PMIC_CONVITY_CEA936_EXIT_SIGNAL  signal 
)

Signal the attached device to exit the current CEA-936 operating mode. Returns an error if the current operating mode is not CEA-936.

Parameters:
handle device handle from open() call
signal type of exit signal to be sent
Returns:
PMIC_SUCCESS if exit signal was sent

References pmic_convity_cea936_state::handle, HANDLE_IN_USE, pmic_convity_cea936_state::handle_state, pmic_write_reg(), and SET_BITS.

PMIC_STATUS pmic_convity_clear_callback ( const PMIC_CONVITY_HANDLE  handle  ) 

Clears the current callback function. If this function returns successfully then all future Connectivity events will only be handled by the default handler within the Connectivity driver.

Parameters:
handle device handle from open() call
Returns:
PMIC_SUCCESS if the callback was successful cleared

References pmic_convity_cea936_state::handle, pmic_convity_rs232_state::handle, pmic_convity_usb_state::handle, HANDLE_IN_USE, pmic_convity_cea936_state::handle_state, pmic_convity_rs232_state::handle_state, pmic_convity_usb_state::handle_state, and pmic_convity_deregister_all().

PMIC_STATUS pmic_convity_close ( const PMIC_CONVITY_HANDLE  handle  ) 
static PMIC_STATUS pmic_convity_deregister_all ( void   )  [static]

This internal helper function deregisters all of the currently registered callback events. It must be called with the mutual exclusion spinlock already acquired.

We've defined the event and callback deregistration code here as a separate function because it can be called by either the pmic_convity_close() or the pmic_convity_clear_callback() APIs. We also wanted to avoid any possible issues with having the same thread calling spin_lock_irq() twice.

Note that the mutex must have already been acquired. We will also acquire the spinlock here to avoid any possible race conditions with the interrupt handler.

Returns:
PMIC_SUCCESS if all of the callback events were cleared

References pmic_convity_state_struct::callback, pmic_convity_usb_state::callback, CORE_EVENT_0V8, CORE_EVENT_2V0, CORE_EVENT_4V4, CORE_EVENT_ABDET, pmic_convity_state_struct::eventMask, pmic_convity_usb_state::eventMask, pmic_event_callback_t::func, pmic_event_callback_t::param, pmic_convity_event_handler(), and pmic_event_unsubscribe().

Referenced by pmic_convity_clear_callback(), and pmic_convity_close().

static void pmic_convity_event_handler ( void *  param  )  [static]

This is the default event handler for all connectivity-related events and hardware interrupts.

Parameters:
param event ID

References eventID.

Referenced by pmic_convity_deregister_all(), and pmic_convity_set_callback().

PMIC_STATUS pmic_convity_get_callback ( const PMIC_CONVITY_HANDLE  handle,
PMIC_CONVITY_CALLBACK *const   func,
PMIC_CONVITY_EVENTS *const   eventMask 
)

Get the current callback function and event mask.

Parameters:
handle device handle from open() call
func the current callback function
eventMask the current event selection mask
Returns:
PMIC_SUCCESS if the callback information was successful retrieved

References pmic_convity_usb_state::callback, pmic_convity_usb_state::eventMask, pmic_convity_cea936_state::handle, pmic_convity_rs232_state::handle, pmic_convity_usb_state::handle, HANDLE_IN_USE, pmic_convity_cea936_state::handle_state, and pmic_convity_usb_state::handle_state.

PMIC_STATUS pmic_convity_get_mode ( const PMIC_CONVITY_HANDLE  handle,
PMIC_CONVITY_MODE *const   mode 
)

Get the current operating mode for the PMIC connectivity hardware.

Parameters:
handle device handle from open() call
mode the current PMIC connectivity operating mode
Returns:
PMIC_SUCCESS if the requested mode was successfully set

References pmic_convity_cea936_state::handle, pmic_convity_rs232_state::handle, pmic_convity_usb_state::handle, HANDLE_IN_USE, pmic_convity_cea936_state::handle_state, pmic_convity_usb_state::handle_state, and pmic_convity_usb_state::mode.

PMIC_STATUS pmic_convity_open ( PMIC_CONVITY_HANDLE *const   handle,
const PMIC_CONVITY_MODE  mode 
)

Attempt to open and gain exclusive access to the PMIC connectivity hardware. An initial operating mode must also be specified.

If the open request is successful, then a numeric handle is returned and this handle must be used in all subsequent function calls. The same handle must also be used in the pmic_convity_close() call when use of the PMIC connectivity hardware is no longer required.

Parameters:
handle device handle from open() call
mode initial connectivity operating mode
Returns:
PMIC_SUCCESS if the open request was successful

References pmic_convity_cea936_state::handle, pmic_convity_rs232_state::handle, pmic_convity_usb_state::handle, pmic_convity_state_struct::handle, HANDLE_FREE, HANDLE_IN_USE, pmic_convity_state_struct::handle_state, pmic_convity_cea936_state::handle_state, pmic_convity_rs232_state::handle_state, pmic_convity_usb_state::handle_state, and pmic_convity_set_mode_internal().

PMIC_STATUS pmic_convity_reset ( const PMIC_CONVITY_HANDLE  handle  ) 

Restore all registers to the initial power-on/reset state.

Parameters:
handle device handle from open() call
Returns:
PMIC_SUCCESS if the reset was successful

References pmic_convity_cea936_state::handle, pmic_convity_rs232_state::handle, pmic_convity_usb_state::handle, HANDLE_IN_USE, pmic_convity_cea936_state::handle_state, pmic_convity_rs232_state::handle_state, pmic_convity_usb_state::handle_state, pmic_write_reg(), REG_FULLMASK, RESET_USBCNTRL_REG_0, and RESET_USBCNTRL_REG_1.

PMIC_STATUS pmic_convity_rs232_get_config ( const PMIC_CONVITY_HANDLE  handle,
PMIC_CONVITY_RS232_INTERNAL *const   cfgInternal,
PMIC_CONVITY_RS232_EXTERNAL *const   cfgExternal 
)

Get the connectivity interface's current RS-232 operating configuration.

Parameters:
handle device handle from open() call
cfgInternal RS-232 transceiver internal connections
cfgExternal RS-232 transceiver external connections
Returns:
PMIC_SUCCESS if the requested mode was retrieved

References pmic_convity_rs232_state::handle, HANDLE_IN_USE, pmic_convity_rs232_state::handle_state, pmic_convity_rs232_state::rs232CfgExternal, and pmic_convity_rs232_state::rs232CfgInternal.

PMIC_STATUS pmic_convity_rs232_set_config ( const PMIC_CONVITY_HANDLE  handle,
const PMIC_CONVITY_RS232_INTERNAL  cfgInternal,
const PMIC_CONVITY_RS232_EXTERNAL  cfgExternal 
)

Set the connectivity interface to the selected RS-232 operating configuration. Note that the RS-232 operating mode will be automatically overridden if the USB_EN is asserted at any time (e.g., when a USB device is attached). However, we will also automatically return to the RS-232 mode once the USB device is detached.

Parameters:
handle device handle from open() call
cfgInternal RS-232 transceiver internal connections
cfgExternal RS-232 transceiver external connections
Returns:
PMIC_SUCCESS if the requested mode was set

References pmic_convity_rs232_state::handle, HANDLE_IN_USE, pmic_convity_rs232_state::handle_state, pmic_write_reg(), pmic_convity_rs232_state::rs232CfgExternal, pmic_convity_rs232_state::rs232CfgInternal, and SET_BITS.

PMIC_STATUS pmic_convity_set_callback ( const PMIC_CONVITY_HANDLE  handle,
const PMIC_CONVITY_CALLBACK  func,
const PMIC_CONVITY_EVENTS  eventMask 
)

Register a callback function that will be used to signal PMIC connectivity events. For example, the USB subsystem should register a callback function in order to be notified of device connect/disconnect events. Note, however, that non-USB events may also be signalled depending upon the PMIC hardware capabilities. Therefore, the callback function must be able to properly handle all of the possible events if support for non-USB peripherals is also to be included.

Parameters:
handle device handle from open() call
func a pointer to the callback function
eventMask a mask selecting events to be notified
Returns:
PMIC_SUCCESS if the callback was successful registered

References pmic_convity_usb_state::callback, CORE_EVENT_0V8, CORE_EVENT_2V0, CORE_EVENT_4V4, CORE_EVENT_ABDET, pmic_convity_usb_state::eventMask, pmic_event_callback_t::func, pmic_convity_usb_state::handle, HANDLE_IN_USE, pmic_convity_usb_state::handle_state, pmic_event_callback_t::param, pmic_convity_event_handler(), pmic_event_subscribe(), and pmic_event_unsubscribe().

PMIC_STATUS pmic_convity_set_mode ( const PMIC_CONVITY_HANDLE  handle,
const PMIC_CONVITY_MODE  mode 
)

Change the current operating mode of the PMIC connectivity hardware. The available connectivity operating modes is hardware dependent and consists of one or more of the following: USB (including USB On-the-Go), RS-232, and CEA-936. Requesting an operating mode that is not supported by the PMIC hardware will return PMIC_NOT_SUPPORTED.

Parameters:
handle device handle from open() call
mode desired operating mode
Returns:
PMIC_SUCCESS if the requested mode was successfully set

References pmic_convity_cea936_state::handle, pmic_convity_rs232_state::handle, pmic_convity_usb_state::handle, HANDLE_IN_USE, pmic_convity_cea936_state::handle_state, pmic_convity_rs232_state::handle_state, pmic_convity_usb_state::handle_state, and pmic_convity_set_mode_internal().

static PMIC_STATUS pmic_convity_set_mode_internal ( const PMIC_CONVITY_MODE  mode  )  [static]

This internal helper function sets the desired operating mode (either USB OTG or RS-232). It must be called with the mutex already acquired.

Parameters:
mode the desired operating mode (USB or RS232)
Returns:
PMIC_SUCCESS if the desired operating mode was set
PMIC_NOT_SUPPORTED if the desired operating mode is invalid

References pmic_convity_cea936_state::mode, pmic_convity_rs232_state::mode, pmic_convity_usb_state::mode, pmic_write_reg(), and SET_BITS.

Referenced by pmic_convity_open(), and pmic_convity_set_mode().

PMIC_STATUS pmic_convity_set_output ( const PMIC_CONVITY_HANDLE  handle,
bool  out_type,
bool  out 
)

This function enables/disables VUSB and VBUS output. This API configures the VUSBEN and VBUSEN bits of USB register

Parameters:
handle device handle from open() call
out_type true, for VBUS false, for VUSB
out if true, output is enabled if false, output is disabled
Returns:
This function returns PMIC_SUCCESS if successful.

References pmic_convity_usb_state::handle, HANDLE_IN_USE, pmic_convity_usb_state::handle_state, pmic_write_reg(), and SET_BITS.

static void pmic_convity_tasklet ( struct work_struct *  work  )  [static]

This is the connectivity driver tasklet that handles interrupt events.

This function is scheduled by the connectivity driver interrupt handler pmic_convity_event_handler() to complete the processing of all of the connectivity-related interrupt events.

Since this tasklet runs with interrupts enabled, we can safely call the ADC driver, if necessary, to properly detect the type of USB connection that is being made and to call any user-registered callback functions.

Parameters:
arg The parameter that was provided above in the DECLARE_TASKLET() macro (unused).

References pmic_convity_usb_state::callback, CORE_EVENT_0V8, CORE_EVENT_2V0, CORE_EVENT_4V4, CORE_EVENT_ABDET, eventID, pmic_convity_usb_state::eventMask, HANDLE_IN_USE, pmic_convity_usb_state::handle_state, and pmic_check_sensor().

PMIC_STATUS pmic_convity_usb_get_power_source ( const PMIC_CONVITY_HANDLE  handle,
PMIC_CONVITY_USB_POWER_IN *const   pwrin,
PMIC_CONVITY_USB_POWER_OUT *const   pwrout 
)

Get the USB transceiver's current power supply configuration.

Parameters:
handle device handle from open() call
pwrin USB transceiver regulator input power source
pwrout USB transceiver regulator output power level
Returns:
PMIC_SUCCESS if the USB transceiver's power supply configuration was successfully retrieved

References pmic_convity_usb_state::handle, HANDLE_IN_USE, pmic_convity_usb_state::handle_state, pmic_convity_usb_state::usbPowerIn, and pmic_convity_usb_state::usbPowerOut.

PMIC_STATUS pmic_convity_usb_get_speed ( const PMIC_CONVITY_HANDLE  handle,
PMIC_CONVITY_USB_SPEED *const   speed,
PMIC_CONVITY_USB_MODE *const   mode 
)

Get the USB transceiver speed.

Parameters:
handle device handle from open() call
speed the current USB transceiver speed
mode the current USB transceiver mode
Returns:
PMIC_SUCCESS if the transceiver speed was successfully obtained

References pmic_convity_usb_state::handle, HANDLE_IN_USE, pmic_convity_usb_state::handle_state, pmic_convity_usb_state::usbMode, and pmic_convity_usb_state::usbSpeed.

PMIC_STATUS pmic_convity_usb_get_xcvr ( const PMIC_CONVITY_HANDLE  handle,
PMIC_CONVITY_USB_TRANSCEIVER_MODE *const   mode 
)

Get the USB transceiver's current operating mode.

Parameters:
handle device handle from open() call
mode current operating mode
Returns:
PMIC_SUCCESS if the USB transceiver's operating mode was successfully retrieved

References pmic_convity_usb_state::handle, HANDLE_IN_USE, pmic_convity_usb_state::handle_state, and pmic_convity_usb_state::usbXcvrMode.

PMIC_STATUS pmic_convity_usb_otg_clear_config ( const PMIC_CONVITY_HANDLE  handle,
const PMIC_CONVITY_USB_OTG_CONFIG  cfg 
)

Clears the USB On-The-Go (OTG) configuration. Multiple configuration settings may be OR'd together in a single call. However, selecting conflicting settings (e.g., multiple VBUS current limits) will result in undefined behavior.

Parameters:
handle Device handle from open() call.
cfg USB OTG configuration settings to be cleared.
Return values:
PMIC_SUCCESS If the OTG configuration was successfully cleared.
PMIC_PARAMETER_ERROR If the handle is invalid.
PMIC_NOT_SUPPORTED If the desired USB OTG configuration is not supported by the PMIC hardware.

References pmic_convity_usb_state::handle, HANDLE_IN_USE, pmic_convity_usb_state::handle_state, pmic_write_reg(), SET_BITS, and pmic_convity_usb_state::usbOtgCfg.

PMIC_STATUS pmic_convity_usb_otg_get_config ( const PMIC_CONVITY_HANDLE  handle,
PMIC_CONVITY_USB_OTG_CONFIG *const   cfg 
)

Get the current USB On-The-Go (OTG) configuration.

Parameters:
handle device handle from open() call
cfg the current USB OTG configuration
Returns:
PMIC_SUCCESS if the OTG configuration was successfully retrieved

References pmic_convity_usb_state::handle, HANDLE_IN_USE, pmic_convity_usb_state::handle_state, and pmic_convity_usb_state::usbOtgCfg.

PMIC_STATUS pmic_convity_usb_otg_get_dlp_duration ( const PMIC_CONVITY_HANDLE  handle,
unsigned int *const   duration 
)

Get the current Data Line Pulse duration (in milliseconds) for the USB OTG Session Request Protocol.

Parameters:
handle device handle from open() call
duration the data line pulse duration (ms)
Returns:
PMIC_SUCCESS if the pulse duration was successfully obtained

References pmic_convity_usb_state::handle, HANDLE_IN_USE, and pmic_convity_usb_state::handle_state.

PMIC_STATUS pmic_convity_usb_otg_set_config ( const PMIC_CONVITY_HANDLE  handle,
const PMIC_CONVITY_USB_OTG_CONFIG  cfg 
)

Set the USB On-The-Go (OTG) configuration.

Parameters:
handle device handle from open() call
cfg desired USB OTG configuration
Returns:
PMIC_SUCCESS if the OTG configuration was successfully set

References pmic_convity_usb_state::handle, HANDLE_IN_USE, pmic_convity_usb_state::handle_state, pmic_write_reg(), SET_BITS, and pmic_convity_usb_state::usbOtgCfg.

PMIC_STATUS pmic_convity_usb_otg_set_dlp_duration ( const PMIC_CONVITY_HANDLE  handle,
const unsigned int  duration 
)

Set the Data Line Pulse duration (in milliseconds) for the USB OTG Session Request Protocol.

For mc13783, this feature is not supported.So return PMIC_NOT_SUPPORTED

Parameters:
handle device handle from open() call
duration the data line pulse duration (ms)
Returns:
PMIC_SUCCESS if the pulse duration was successfully set

References pmic_convity_usb_state::handle, HANDLE_IN_USE, and pmic_convity_usb_state::handle_state.

PMIC_STATUS pmic_convity_usb_set_power_source ( const PMIC_CONVITY_HANDLE  handle,
const PMIC_CONVITY_USB_POWER_IN  pwrin,
const PMIC_CONVITY_USB_POWER_OUT  pwrout 
)

Set the USB transceiver's power supply configuration.

Parameters:
handle device handle from open() call
pwrin USB transceiver regulator input power source
pwrout USB transceiver regulator output power level
Returns:
PMIC_SUCCESS if the USB transceiver's power supply configuration was successfully set

References pmic_convity_usb_state::handle, HANDLE_IN_USE, pmic_convity_usb_state::handle_state, pmic_write_reg(), SET_BITS, pmic_convity_usb_state::usbPowerIn, and pmic_convity_usb_state::usbPowerOut.

PMIC_STATUS pmic_convity_usb_set_speed ( const PMIC_CONVITY_HANDLE  handle,
const PMIC_CONVITY_USB_SPEED  speed 
)

Set the USB transceiver speed.

Parameters:
handle device handle from open() call
speed the desired USB transceiver speed
Returns:
PMIC_SUCCESS if the transceiver speed was successfully set

References pmic_convity_usb_state::handle, pmic_convity_cea936_state::handle, pmic_convity_rs232_state::handle, HANDLE_IN_USE, pmic_convity_usb_state::handle_state, pmic_write_reg(), SET_BITS, and pmic_convity_usb_state::usbSpeed.

PMIC_STATUS pmic_convity_usb_set_xcvr ( const PMIC_CONVITY_HANDLE  handle,
const PMIC_CONVITY_USB_TRANSCEIVER_MODE  mode 
)

Set the USB transceiver's operating mode.

Parameters:
handle device handle from open() call
mode desired operating mode
Returns:
PMIC_SUCCESS if the USB transceiver's operating mode was successfully configured

References pmic_convity_usb_state::handle, HANDLE_IN_USE, pmic_convity_usb_state::handle_state, pmic_write_reg(), SET_BITS, and pmic_convity_usb_state::usbXcvrMode.


Variable Documentation

Initial value:
 {
        0,
        HANDLE_FREE,
        CEA936_MONO,
        NULL,
        0,
}

This structure maintains the current state of the Connectivity driver.

The initial values must be identical to the reset state defined by the reset variable.

Global variable to track currently active interrupt events.

This global variable is used to keep track of all of the currently active interrupt events for the connectivity driver. Note that access to this variable may occur while within an interrupt context and, therefore, must be guarded by using a spinlock.

Referenced by pmic_convity_event_handler(), and pmic_convity_tasklet().

const unsigned int REG_FULLMASK = 0xffffff [static]

Define a mask to access the entire hardware register.

Referenced by mc13783_pmic_convity_exit(), and pmic_convity_reset().

const USBCNTRL_REG_0 regUSB0 [static]
Initial value:
 {
        {0, 0x000001},          
        {1, 0x000002},          
        {2, 0x000004},          
        {3, 0x000008},          
        {4, 0x000010},          
        {5, 0x000020},          
        {6, 0x000040},          
        {7, 0x000380},          
        {10, 0x000400},         
        {11, 0x000800},         
        {12, 0x001000},         
        {13, 0x002000},         
        {14, 0x01c000},         
        {17, 0x020000},         
        {18, 0x040000},         
        {19, 0x080000},         
        {20, 0x100000},         
        {21, 0x200000},         
        {22, 0x400000},         
        {23, 0x800000}          

}

This variable is used to access the USBCNTRL_REG_0 hardware register.

This variable defines how to access all of the fields within the USBCNTRL_REG_0 hardware register. The initial values consist of the offset and mask values needed to access each of the register fields.

const USBCNTRL_REG_1 regUSB1 [static]
Initial value:
 {
        {0, 0x000003},          
        {2, 0x000004},          
        {3, 0x000008},          
        
        {5, 0x000020},          
        {6, 0x000040},          
        {7, 0x000080},          
        {8, 0x000100}           
        
}

This variable is used to access the USBCNTRL_REG_1 hardware register.

This variable defines how to access all of the fields within the USBCNTRL_REG_1 hardware register. The initial values consist of the offset and mask values needed to access each of the register fields.

Initial value:
 {
        0,
        HANDLE_FREE,
        USB,
        NULL,
        0,
        USB_FULL_SPEED,
        USB_PERIPHERAL,
        USB_POWER_INTERNAL,
        USB_POWER_3V3,
        USB_TRANSCEIVER_OFF,
        0,
        USB_PULL_OVERRIDE | USB_VBUS_CURRENT_LIMIT_HIGH,
        RS232_TX_USE0VM_RX_UDATVP,
        RS232_TX_UDM_RX_UDP
}

This structure defines the reset/power on state for the Connectivity driver.

const unsigned int RESET_USBCNTRL_REG_0 = 0x080060 [static]

Define the mc13783 USBCNTRL_REG_0 register power on reset state.

Referenced by mc13783_pmic_convity_exit(), and pmic_convity_reset().

const unsigned int RESET_USBCNTRL_REG_1 = 0x000006 [static]

Define the mc13783 USBCNTRL_REG_1 register power on reset state.

Referenced by mc13783_pmic_convity_exit(), and pmic_convity_reset().

Initial value:
 {
        0,
        HANDLE_FREE,
        RS232_1,
        NULL,
        0,
        RS232_TX_USE0VM_RX_UDATVP,
        RS232_TX_UDM_RX_UDP
}

This structure maintains the current state of the Connectivity driver.

The initial values must be identical to the reset state defined by the reset variable.

Initial value:
 {
        0,
        HANDLE_FREE,
        USB,
        NULL,
        0,
        USB_FULL_SPEED,
        USB_PERIPHERAL,
        USB_POWER_INTERNAL,
        USB_POWER_3V3,
        USB_TRANSCEIVER_OFF,
        0,
        USB_PULL_OVERRIDE | USB_VBUS_CURRENT_LIMIT_HIGH,
}

This structure maintains the current state of the Connectivity driver.

The initial values must be identical to the reset state defined by the reset variable.

footer
©  Freescale Semiconductor, Inc., 2007.  All rights reserved.
Freescale Confidential Proprietary
NDA Required
doxygen