adc: get_def_ref_volt/get_curr_ref_volt --> adc_get_def_ref_volt/adc_get_curr_volt

This commit is contained in:
kfx 2012-11-16 11:32:25 +08:00
parent 171f2967e1
commit de486385f2
4 changed files with 17 additions and 9 deletions

View File

@ -45,11 +45,13 @@ static int rk30_get_base_volt(void)
return volt;
}
static struct adc_platform_data rk30_adc_pdata = {
.ref_volt = 3300, //3300mV
.base_chn = 3,
.get_base_volt = &rk30_get_base_volt,
};
static struct resource rk30_adc_resource[] = {
{
.start = IRQ_SARADC,

View File

@ -118,6 +118,7 @@ adc_sync_read_callback(struct adc_client *client, void *param, int result)
{
client->result = result;
}
static void adc_callback(struct adc_host *adc)
{
struct adc_request *req = NULL, *n = NULL;
@ -136,6 +137,7 @@ static void adc_callback(struct adc_host *adc)
kfree(req);
}
}
void adc_finished(struct adc_host *adc, int result)
{
unsigned long flags;
@ -157,6 +159,7 @@ void adc_finished(struct adc_host *adc, int result)
adc_callback(adc);
}
void adc_core_irq_handle(struct adc_host *adc)
{
int result = 0;
@ -240,12 +243,14 @@ int adc_async_read(struct adc_client *client)
}
EXPORT_SYMBOL(adc_async_read);
int get_def_ref_volt(void)
int adc_get_def_ref_volt(void)
{
return g_adc->pdata->ref_volt;
}
EXPORT_SYMBOL(get_def_ref_volt);
int get_curr_ref_volt(void)
EXPORT_SYMBOL(adc_get_def_ref_volt);
int adc_get_curr_ref_volt(void)
{
int v = 0, volt = 0;
@ -264,7 +269,7 @@ int get_curr_ref_volt(void)
return volt * 1024 / v;
}
EXPORT_SYMBOL(get_curr_ref_volt);
EXPORT_SYMBOL(adc_get_curr_ref_volt);
static int __init adc_core_init(void)
{

View File

@ -311,10 +311,11 @@ module_exit(rk30_adc_exit);
MODULE_DESCRIPTION("Driver for ADC");
MODULE_AUTHOR("kfx, kfx@rock-chips.com");
MODULE_LICENSE("GPL");
static int __init adc_test_init(void)
{
printk("def_ref_volt: %dmV, curr_ref_volt: %dmV\n",
get_def_ref_volt(), get_curr_ref_volt());
adc_get_def_ref_volt(), adc_get_curr_ref_volt());
#ifdef ADC_TEST
rk30_adc_test();
#endif

View File

@ -58,11 +58,11 @@ int adc_async_read(struct adc_client *client);
/*
* function: return current reference voltage, unit: mV
*/
int get_curr_ref_volt(void);
int adc_get_curr_ref_volt(void);
/*
* function: return default reference voltage, unit: mV
*/
int get_def_ref_volt(void);
int adc_get_def_ref_volt(void);
#else
static inline struct adc_client *adc_register(int chn,
void (*callback)(struct adc_client *, void *, int),
@ -73,8 +73,8 @@ static inline struct adc_client *adc_register(int chn,
static inline void adc_unregister(struct adc_client *client) {}
static inline int adc_sync_read(struct adc_client *client) { return -1; }
static inline int adc_async_read(struct adc_client *client) { return -1; }
static inline int get_curr_ref_volt(void) { return -1; }
static inline int get_def_ref_volt(void) { return -1; }
static inline int adc_get_curr_ref_volt(void) { return -1; }
static inline int adc_get_def_ref_volt(void) { return -1; }
#endif
#endif