linux/drivers/mxc/adc/imx_adc.c File Reference

This is the main file of i.MX ADC driver. More...

Functions

enum IMX_ADC_STATUS imx_adc_read_ts (struct t_touch_screen *touch_sample, int wait_tsi)
static int imx_adc_filter (struct t_touch_screen *ts_curr)
enum IMX_ADC_STATUS imx_adc_get_touch_sample (struct t_touch_screen *touch_sample, int wait_tsi)
static int imx_adc_suspend (struct platform_device *pdev, pm_message_t state)
static int imx_adc_resume (struct platform_device *pdev)
static int imx_adc_open (struct inode *inode, struct file *file)
static int imx_adc_free (struct inode *inode, struct file *file)
int imx_adc_init (void)
enum IMX_ADC_STATUS imx_adc_deinit (void)
enum IMX_ADC_STATUS imx_adc_convert (enum t_channel channel, unsigned short *result)
enum IMX_ADC_STATUS imx_adc_convert_multichnnel (enum t_channel channels, unsigned short *result)
static int imx_adc_ioctl (struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)

Variables

static int swait
static int suspend_flag
static wait_queue_head_t suspendq

Detailed Description

This is the main file of i.MX ADC driver.


Function Documentation

enum IMX_ADC_STATUS imx_adc_convert ( enum t_channel  channel,
unsigned short *  result 
)

This function triggers a conversion and returns one sampling result of one channel.

Parameters:
channel The channel to be sampled
result The pointer to the conversion result. The memory should be allocated by the caller of this function.
Returns:
This function returns IMX_ADC_SUCCESS if successful.

References t_touch_screen::contact_resistance, imx_adc_get_touch_sample(), t_touch_screen::x_position, and t_touch_screen::y_position.

Referenced by imx_adc_convert_multichnnel(), and imx_adc_ioctl().

enum IMX_ADC_STATUS imx_adc_convert_multichnnel ( enum t_channel  channels,
unsigned short *  result 
)

This function triggers a conversion and returns sampling results of each specified channel.

Parameters:
channels This input parameter is bitmap to specify channels to be sampled.
result The pointer to array to store sampling results. The memory should be allocated by the caller of this function.
Returns:
This function returns IMX_ADC_SUCCESS if successful.

References imx_adc_convert().

Referenced by imx_adc_ioctl().

enum IMX_ADC_STATUS imx_adc_deinit ( void   ) 

This function disables the ADC, de-registers the interrupt events.

Returns:
This function returns IMX_ADC_SUCCESS if successful.

Referenced by imx_adc_ioctl().

static int imx_adc_filter ( struct t_touch_screen ts_curr  )  [static]

This function performs filtering and rejection of excessive noise prone sampl.

Parameters:
ts_curr Touch screen value
Returns:
This function returns 0 on success, -1 otherwise.

References t_touch_screen::contact_resistance, t_touch_screen::x_position, t_touch_screen::x_position1, t_touch_screen::x_position2, t_touch_screen::x_position3, t_touch_screen::y_position, t_touch_screen::y_position1, t_touch_screen::y_position2, and t_touch_screen::y_position3.

Referenced by imx_adc_get_touch_sample().

static int imx_adc_free ( struct inode *  inode,
struct file *  file 
) [static]

This function implements the release method on an i.MX ADC device.

Parameters:
inode pointer on the node
file pointer on the file
Returns:
This function returns 0.
enum IMX_ADC_STATUS imx_adc_get_touch_sample ( struct t_touch_screen touch_sample,
int  wait_tsi 
)

This function retrieves the current touch screen (X,Y) coordinates.

Parameters:
touch_sample Pointer to touch sample.
Returns:
This function returns IMX_ADC_SUCCESS if successful.

References imx_adc_filter(), and imx_adc_read_ts().

Referenced by imx_adc_convert().

int imx_adc_init ( void   ) 

This function initializes all ADC registers with default values. This function also registers the interrupt events.

Returns:
This function returns IMX_ADC_SUCCESS if successful.

References suspend_flag.

Referenced by imx_adc_ioctl().

static int imx_adc_ioctl ( struct inode *  inode,
struct file *  file,
unsigned int  cmd,
unsigned long  arg 
) [static]

This function implements IOCTL controls on an i.MX ADC device.

Parameters:
inode pointer on the node
file pointer on the file
cmd the command
arg the parameter
Returns:
This function returns 0 if successful.

References imx_adc_convert(), imx_adc_convert_multichnnel(), imx_adc_deinit(), imx_adc_init(), t_adc_convert_param::result, suspend_flag, suspendq, and swait.

static int imx_adc_open ( struct inode *  inode,
struct file *  file 
) [static]

This function implements the open method on an i.MX ADC device.

Parameters:
inode pointer on the node
file pointer on the file
Returns:
This function returns 0.

References suspend_flag, suspendq, and swait.

enum IMX_ADC_STATUS imx_adc_read_ts ( struct t_touch_screen touch_sample,
int  wait_tsi 
)

This function will get raw (X,Y) value by converting the voltage

Parameters:
touch_sample Pointer to touch sample

return This funciton returns 0 if successful.

References t_touch_screen::contact_resistance, t_touch_screen::x_position1, t_touch_screen::x_position2, t_touch_screen::x_position3, t_touch_screen::y_position1, t_touch_screen::y_position2, and t_touch_screen::y_position3.

Referenced by imx_adc_get_touch_sample().

static int imx_adc_resume ( struct platform_device *  pdev  )  [static]

This is the resume of power management for the i.MX adc API. It supports RESTORE state.

Parameters:
pdev the device
Returns:
This function returns 0 if successful.

References suspend_flag, suspendq, and swait.

static int imx_adc_suspend ( struct platform_device *  pdev,
pm_message_t  state 
) [static]

This is the suspend of power management for the i.MX ADC API. It supports SAVE and POWER_DOWN state.

Parameters:
pdev the device
state the state
Returns:
This function returns 0 if successful.

References suspend_flag.


Variable Documentation

int suspend_flag [static]

To indicate whether any of the adc devices are suspending

Referenced by imx_adc_init(), imx_adc_ioctl(), imx_adc_open(), imx_adc_resume(), and imx_adc_suspend().

wait_queue_head_t suspendq [static]

The suspendq is used by blocking application calls

Referenced by imx_adc_ioctl(), imx_adc_open(), and imx_adc_resume().

int swait [static]

Number of users waiting in suspendq

Referenced by imx_adc_ioctl(), imx_adc_open(), and imx_adc_resume().

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