Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions
ucb1x00-core.c File Reference
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/init.h>
#include <linux/errno.h>
#include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/device.h>
#include <linux/mutex.h>
#include <linux/mfd/ucb1x00.h>
#include <linux/pm.h>
#include <linux/gpio.h>

Go to the source code of this file.

Functions

void ucb1x00_io_set_dir (struct ucb1x00 *ucb, unsigned int in, unsigned int out)
 
void ucb1x00_io_write (struct ucb1x00 *ucb, unsigned int set, unsigned int clear)
 
unsigned int ucb1x00_io_read (struct ucb1x00 *ucb)
 
void ucb1x00_adc_enable (struct ucb1x00 *ucb)
 
unsigned int ucb1x00_adc_read (struct ucb1x00 *ucb, int adc_channel, int sync)
 
void ucb1x00_adc_disable (struct ucb1x00 *ucb)
 
int ucb1x00_register_driver (struct ucb1x00_driver *drv)
 
void ucb1x00_unregister_driver (struct ucb1x00_driver *drv)
 
 module_init (ucb1x00_init)
 
 module_exit (ucb1x00_exit)
 
 EXPORT_SYMBOL (ucb1x00_io_set_dir)
 
 EXPORT_SYMBOL (ucb1x00_io_write)
 
 EXPORT_SYMBOL (ucb1x00_io_read)
 
 EXPORT_SYMBOL (ucb1x00_adc_enable)
 
 EXPORT_SYMBOL (ucb1x00_adc_read)
 
 EXPORT_SYMBOL (ucb1x00_adc_disable)
 
 EXPORT_SYMBOL (ucb1x00_register_driver)
 
 EXPORT_SYMBOL (ucb1x00_unregister_driver)
 
 MODULE_ALIAS ("mcp:ucb1x00")
 
 MODULE_AUTHOR ("Russell King <[email protected]>")
 
 MODULE_DESCRIPTION ("UCB1x00 core driver")
 
 MODULE_LICENSE ("GPL")
 

Function Documentation

EXPORT_SYMBOL ( ucb1x00_io_set_dir  )
EXPORT_SYMBOL ( ucb1x00_io_write  )
EXPORT_SYMBOL ( ucb1x00_io_read  )
EXPORT_SYMBOL ( ucb1x00_adc_enable  )
EXPORT_SYMBOL ( ucb1x00_adc_read  )
EXPORT_SYMBOL ( ucb1x00_adc_disable  )
EXPORT_SYMBOL ( ucb1x00_register_driver  )
EXPORT_SYMBOL ( ucb1x00_unregister_driver  )
MODULE_ALIAS ( "mcp:ucb1x00"  )
MODULE_AUTHOR ( "Russell King <[email protected]>"  )
MODULE_DESCRIPTION ( "UCB1x00 core driver )
module_exit ( ucb1x00_exit  )
module_init ( ucb1x00_init  )
MODULE_LICENSE ( "GPL"  )
void ucb1x00_adc_disable ( struct ucb1x00 ucb)

ucb1x00_adc_disable - disable the ADC converter : UCB1x00 structure describing chip

Disable the ADC converter and release the ADC mutex.

Definition at line 268 of file ucb1x00-core.c.

void ucb1x00_adc_enable ( struct ucb1x00 ucb)

ucb1x00_adc_enable - enable the ADC converter : UCB1x00 structure describing chip

Enable the ucb1x00 and ADC converter on the UCB1x00 for use. Any code wishing to use the ADC converter must call this function prior to using it.

This function takes the ADC mutex to prevent two or more concurrent uses, and therefore may sleep. As a result, it can only be called from process context, not interrupt context.

You should release the ADC as soon as possible using ucb1x00_adc_disable.

Definition at line 214 of file ucb1x00-core.c.

unsigned int ucb1x00_adc_read ( struct ucb1x00 ucb,
int  adc_channel,
int  sync 
)

ucb1x00_adc_read - read the specified ADC channel : UCB1x00 structure describing chip : ADC channel mask : wait for syncronisation pulse.

Start an ADC conversion and wait for the result. Note that synchronised ADC conversions (via the ADCSYNC pin) must wait until the trigger is asserted and the conversion is finished.

This function currently spins waiting for the conversion to complete (2 frames max without sync).

If called for a synchronised ADC conversion, it may sleep with the ADC mutex held.

Definition at line 240 of file ucb1x00-core.c.

unsigned int ucb1x00_io_read ( struct ucb1x00 ucb)

ucb1x00_io_read - read the current state of the IO pins : UCB1x00 structure describing chip

Return a bitfield describing the logic state of the ten general purpose IO pins.

ucb1x00_enable must have been called to enable the comms before using this function.

This function does not take any mutexes or spinlocks.

Definition at line 105 of file ucb1x00-core.c.

void ucb1x00_io_set_dir ( struct ucb1x00 ucb,
unsigned int  in,
unsigned int  out 
)

ucb1x00_io_set_dir - set IO direction : UCB1x00 structure describing chip : bitfield of IO pins to be set as inputs : bitfield of IO pins to be set as outputs

Set the IO direction of the ten general purpose IO pins on the UCB1x00 chip. The bitfield has priority over the bitfield, in that if you specify a pin as both input and output, it will end up as an input.

ucb1x00_enable must have been called to enable the comms before using this function.

This function takes a spinlock, disabling interrupts.

Definition at line 53 of file ucb1x00-core.c.

void ucb1x00_io_write ( struct ucb1x00 ucb,
unsigned int  set,
unsigned int  clear 
)

ucb1x00_io_write - set or clear IO outputs : UCB1x00 structure describing chip : bitfield of IO pins to set to logic '1' : bitfield of IO pins to set to logic '0'

Set the IO output state of the specified IO pins. The value is retained if the pins are subsequently configured as inputs. The bitfield has priority over the bitfield - outputs will be cleared.

ucb1x00_enable must have been called to enable the comms before using this function.

This function takes a spinlock, disabling interrupts.

Definition at line 81 of file ucb1x00-core.c.

int ucb1x00_register_driver ( struct ucb1x00_driver drv)

Definition at line 645 of file ucb1x00-core.c.

void ucb1x00_unregister_driver ( struct ucb1x00_driver drv)

Definition at line 659 of file ucb1x00-core.c.