drivers: adc: adc_context: add optional context_on_complete
This optional function allows a driver to do operations after a complete sampling sequence is completed. Signed-off-by: Hein Wessels <heinwessels93@gmail.com>
This commit is contained in:
parent
10130d8e6d
commit
dce0eb7e8f
1 changed files with 13 additions and 0 deletions
|
@ -38,6 +38,15 @@ static void adc_context_update_buffer_pointer(struct adc_context *ctx,
|
||||||
static void adc_context_enable_timer(struct adc_context *ctx);
|
static void adc_context_enable_timer(struct adc_context *ctx);
|
||||||
static void adc_context_disable_timer(struct adc_context *ctx);
|
static void adc_context_disable_timer(struct adc_context *ctx);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If a driver needs to do something after a context complete then
|
||||||
|
* then this optional function can be overwritten. This will be called
|
||||||
|
* after a sequence has ended, and *not* when restarted with ADC_ACTION_REPEAT.
|
||||||
|
* To enable this function define ADC_CONTEXT_ENABLE_ON_COMPLETE.
|
||||||
|
*/
|
||||||
|
#ifdef ADC_CONTEXT_ENABLE_ON_COMPLETE
|
||||||
|
static void adc_context_on_complete(struct adc_context *ctx, int status);
|
||||||
|
#endif /* ADC_CONTEXT_ENABLE_ON_COMPLETE */
|
||||||
|
|
||||||
struct adc_context {
|
struct adc_context {
|
||||||
atomic_t sampling_requested;
|
atomic_t sampling_requested;
|
||||||
|
@ -165,6 +174,10 @@ static inline int adc_context_wait_for_completion(struct adc_context *ctx)
|
||||||
|
|
||||||
static inline void adc_context_complete(struct adc_context *ctx, int status)
|
static inline void adc_context_complete(struct adc_context *ctx, int status)
|
||||||
{
|
{
|
||||||
|
#ifdef ADC_CONTEXT_ENABLE_ON_COMPLETE
|
||||||
|
adc_context_on_complete(ctx, status);
|
||||||
|
#endif /* ADC_CONTEXT_ENABLE_ON_COMPLETE */
|
||||||
|
|
||||||
#ifdef CONFIG_ADC_ASYNC
|
#ifdef CONFIG_ADC_ASYNC
|
||||||
if (ctx->asynchronous) {
|
if (ctx->asynchronous) {
|
||||||
if (ctx->signal) {
|
if (ctx->signal) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue