From de486385f2f0b8191ac9019334433df7dc61e006 Mon Sep 17 00:00:00 2001 From: kfx Date: Fri, 16 Nov 2012 11:32:25 +0800 Subject: [PATCH] adc: get_def_ref_volt/get_curr_ref_volt --> adc_get_def_ref_volt/adc_get_curr_volt --- arch/arm/mach-rk2928/devices.c | 2 ++ drivers/adc/core.c | 13 +++++++++---- drivers/adc/plat/rk30_adc.c | 3 ++- include/linux/adc.h | 8 ++++---- 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/arch/arm/mach-rk2928/devices.c b/arch/arm/mach-rk2928/devices.c index 7858914bd954..fabd582cc4fa 100755 --- a/arch/arm/mach-rk2928/devices.c +++ b/arch/arm/mach-rk2928/devices.c @@ -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, diff --git a/drivers/adc/core.c b/drivers/adc/core.c index 35ba255d8bd3..c13c15d3879e 100755 --- a/drivers/adc/core.c +++ b/drivers/adc/core.c @@ -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) { diff --git a/drivers/adc/plat/rk30_adc.c b/drivers/adc/plat/rk30_adc.c index 48d9ca6155cc..afe6923931a4 100755 --- a/drivers/adc/plat/rk30_adc.c +++ b/drivers/adc/plat/rk30_adc.c @@ -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 diff --git a/include/linux/adc.h b/include/linux/adc.h index 3cda18c687f4..178545e7e2ff 100755 --- a/include/linux/adc.h +++ b/include/linux/adc.h @@ -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 -- 2.34.1