Logo Search packages:      
Sourcecode: linux-fsl-imx51 version File versions  Download package

pmic_convity.c File Reference


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

   

Definition in file pmic_convity.c.

#include <linux/interrupt.h>
#include <linux/platform_device.h>
#include <linux/spinlock.h>
#include <linux/pmic_adc.h>
#include <linux/pmic_status.h>
#include <mach/pmic_convity.h>

Go to the source code of this file.

Classes

struct  pmic_convity_cea936_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_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  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...

Defines

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

Enumerations

enum  HANDLE_STATE { HANDLE_FREE, HANDLE_IN_USE, HANDLE_FREE, HANDLE_IN_USE }
 Define the possible states for a device handle. More...
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
}
 Identifies the hardware interrupt source. More...

Functions

static DECLARE_MUTEX (mutex)
 This mutex is used to provide mutual exclusion.
 DECLARE_WORK (convityTasklet, pmic_convity_tasklet)
 Tasklet handler for the connectivity driver.
 EXPORT_SYMBOL (pmic_convity_cea936_exit_signal)
 EXPORT_SYMBOL (pmic_convity_rs232_get_config)
 EXPORT_SYMBOL (pmic_convity_rs232_set_config)
 EXPORT_SYMBOL (pmic_convity_set_output)
 EXPORT_SYMBOL (pmic_convity_usb_otg_get_config)
 EXPORT_SYMBOL (pmic_convity_usb_otg_clear_config)
 EXPORT_SYMBOL (pmic_convity_usb_otg_set_config)
 EXPORT_SYMBOL (pmic_convity_usb_otg_get_dlp_duration)
 EXPORT_SYMBOL (pmic_convity_usb_otg_set_dlp_duration)
 EXPORT_SYMBOL (pmic_convity_usb_get_xcvr)
 EXPORT_SYMBOL (pmic_convity_usb_set_xcvr)
 EXPORT_SYMBOL (pmic_convity_usb_get_power_source)
 EXPORT_SYMBOL (pmic_convity_usb_set_power_source)
 EXPORT_SYMBOL (pmic_convity_usb_get_speed)
 EXPORT_SYMBOL (pmic_convity_usb_set_speed)
 EXPORT_SYMBOL (pmic_convity_get_callback)
 EXPORT_SYMBOL (pmic_convity_clear_callback)
 EXPORT_SYMBOL (pmic_convity_set_callback)
 EXPORT_SYMBOL (pmic_convity_reset)
 EXPORT_SYMBOL (pmic_convity_get_mode)
 EXPORT_SYMBOL (pmic_convity_set_mode)
 EXPORT_SYMBOL (pmic_convity_close)
 EXPORT_SYMBOL (pmic_convity_open)
 MODULE_AUTHOR ("Freescale Semiconductor, Inc.")
 MODULE_DESCRIPTION ("mc13783 Connectivity device driver")
 module_exit (mc13783_pmic_convity_exit)
 module_init (mc13783_pmic_convity_init)
 MODULE_LICENSE ("GPL")
Connectivity Driver Loading/Unloading Functions
These non-exported internal functions are used to support the connectivity device driver initialization and de-initialization operations.

static void __exit mc13783_pmic_convity_exit (void)
 This is the Connectivity device driver de-initialization function.
static int __init mc13783_pmic_convity_init (void)
 This is the connectivity device driver initialization function.
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)
 Send a signal to exit CEA-936 mode.
General Setup and Configuration Connectivity APIs
Functions for setting up and configuring the connectivity hardware.

PMIC_STATUS pmic_convity_clear_callback (const PMIC_CONVITY_HANDLE handle)
 Deregisters the existing Connectivity callback function.
PMIC_STATUS pmic_convity_close (const PMIC_CONVITY_HANDLE handle)
 Terminate further access to the PMIC Connectivity hardware.
PMIC_STATUS pmic_convity_get_callback (const PMIC_CONVITY_HANDLE handle, PMIC_CONVITY_CALLBACK *const func, PMIC_CONVITY_EVENTS *const eventMask)
 Get the current Connectivity callback function settings.
PMIC_STATUS pmic_convity_get_mode (const PMIC_CONVITY_HANDLE handle, PMIC_CONVITY_MODE *const mode)
 Get the current PMIC Connectivity main operating mode.
PMIC_STATUS pmic_convity_open (PMIC_CONVITY_HANDLE *const handle, const PMIC_CONVITY_MODE mode)
 Request exclusive access to the PMIC Connectivity hardware.
PMIC_STATUS pmic_convity_reset (const PMIC_CONVITY_HANDLE handle)
 Reset the Connectivity hardware to it's power on state.
PMIC_STATUS pmic_convity_set_callback (const PMIC_CONVITY_HANDLE handle, const PMIC_CONVITY_CALLBACK func, const PMIC_CONVITY_EVENTS eventMask)
 Set the Connectivity callback function.
PMIC_STATUS pmic_convity_set_mode (const PMIC_CONVITY_HANDLE handle, const PMIC_CONVITY_MODE mode)
 Set the PMIC Connectivity main operating mode.
Connectivity Driver Internal Support Functions
These non-exported internal functions are used to support the functionality of the exported connectivity APIs.

static PMIC_STATUS pmic_convity_deregister_all (void)
static void pmic_convity_event_handler (void *param)
static PMIC_STATUS pmic_convity_set_mode_internal (const PMIC_CONVITY_MODE mode)
static void pmic_convity_tasklet (struct work_struct *work)
 This is the connectivity driver tasklet that handles interrupt events.
RS-232 Serial Connectivity APIs
Functions for controlling RS-232 serial connectivity.

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 current RS-232 operating configuration.
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 current RS-232 operating configuration.
USB and USB-OTG Connectivity APIs
Functions for controlling USB and USB-OTG connectivity.

PMIC_STATUS pmic_convity_set_output (const PMIC_CONVITY_HANDLE handle, bool out_type, bool out)
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 power supply configuration.
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's operating speed.
PMIC_STATUS pmic_convity_usb_get_xcvr (const PMIC_CONVITY_HANDLE handle, PMIC_CONVITY_USB_TRANSCEIVER_MODE *const mode)
 Get the current USB transceiver operating mode.
PMIC_STATUS pmic_convity_usb_otg_clear_config (const PMIC_CONVITY_HANDLE handle, const PMIC_CONVITY_USB_OTG_CONFIG cfg)
 Clear the current USB On-The-Go configuration.
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 configuration.
PMIC_STATUS pmic_convity_usb_otg_get_dlp_duration (const PMIC_CONVITY_HANDLE handle, unsigned int *const duration)
 Get the current USB On-The-Go data line pulse duration (ms).
PMIC_STATUS pmic_convity_usb_otg_set_config (const PMIC_CONVITY_HANDLE handle, const PMIC_CONVITY_USB_OTG_CONFIG cfg)
 Set the current USB On-The-Go configuration.
PMIC_STATUS pmic_convity_usb_otg_set_dlp_duration (const PMIC_CONVITY_HANDLE handle, const unsigned int duration)
 Set the current USB On-The-Go data line pulse duration (ms).
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.
PMIC_STATUS pmic_convity_usb_set_speed (const PMIC_CONVITY_HANDLE handle, const PMIC_CONVITY_USB_SPEED speed)
 Set the USB transceiver's operating speed.
PMIC_STATUS pmic_convity_usb_set_xcvr (const PMIC_CONVITY_HANDLE handle, const PMIC_CONVITY_USB_TRANSCEIVER_MODE mode)
 Set the current USB transceiver operating mode.

Variables

static pmic_convity_cea936_state cea_936
 This structure maintains the current state of the Connectivity driver.
static PMIC_CORE_EVENT eventID = 0
 Global variable to track currently active interrupt events.
static pmic_event_callback_t eventNotify
static spinlock_t lock = SPIN_LOCK_UNLOCKED
 This spinlock is used to provide mutual exclusion.
static const unsigned int REG_FULLMASK = 0xffffff
static const USBCNTRL_REG_0 regUSB0
 This variable is used to access the USBCNTRL_REG_0 hardware register.
static const USBCNTRL_REG_1 regUSB1
 This variable is used to access the USBCNTRL_REG_1 hardware register.
static const
pmic_convity_state_struct 
reset
 This structure defines the reset/power on state for the Connectivity driver.
static const unsigned int RESET_USBCNTRL_REG_0 = 0x080060
static const unsigned int RESET_USBCNTRL_REG_1 = 0x000006
static pmic_convity_rs232_state rs_232
 This structure maintains the current state of the Connectivity driver.
static pmic_convity_usb_state usb
 This structure maintains the current state of the Connectivity driver.


Generated by  Doxygen 1.6.0   Back to index