diff --git a/arch/arm/src/sama5/sam_adc.c b/arch/arm/src/sama5/sam_adc.c index b95b96bd34..07a190e703 100644 --- a/arch/arm/src/sama5/sam_adc.c +++ b/arch/arm/src/sama5/sam_adc.c @@ -500,11 +500,9 @@ static const struct adc_ops_s g_adcops = static struct sam_adc_s g_adcpriv; -#ifdef SAMA5_ADC_HAVE_CHANNELS /* ADC device instance */ static struct adc_dev_s g_adcdev; -#endif /**************************************************************************** * Private Functions @@ -677,7 +675,7 @@ static void sam_adc_dmadone(void *arg) ADC_LCDR_CHANB_SHIFT); sample = ((*buffer & ADC_LCDR_DATA_MASK) >> ADC_LCDR_DATA_SHIFT); - /* Verify that the upper-half driver has bound its callback functions */ + /* Verify the upper-half driver has bound its callback functions */ if (priv->cb != NULL) { @@ -884,7 +882,7 @@ static void sam_adc_endconversion(void *arg) regval = sam_adc_getreg(priv, SAM_ADC_CDR(chan)); - /* Verify that the upper-half driver has bound its callback functions */ + /* Verify the upper-half driver has bound its callback functions */ if (priv->cb != NULL) { @@ -2033,14 +2031,17 @@ struct adc_dev_s *sam_adc_initialize(void) /* Initialize the public ADC device data structure */ +#ifdef SAMA5_ADC_HAVE_CHANNELS g_adcdev.ad_ops = &g_adcops; + priv->dev = &g_adcdev; +#endif + g_adcdev.ad_priv = priv; /* Initialize the private ADC device data structure */ nxsem_init(&priv->exclsem, 0, 1); priv->cb = NULL; - priv->dev = &g_adcdev; #ifdef CONFIG_SAMA5_ADC_DMA /* Allocate a DMA channel from DMAC1 */ diff --git a/boards/arm/sama5/sama5d3x-ek/src/sam_touchscreen.c b/boards/arm/sama5/sama5d3x-ek/src/sam_touchscreen.c index d2b4f6d0cc..1f09227038 100644 --- a/boards/arm/sama5/sama5d3x-ek/src/sam_touchscreen.c +++ b/boards/arm/sama5/sama5d3x-ek/src/sam_touchscreen.c @@ -96,7 +96,7 @@ int sam_tsc_setup(int minor) /* Initialize the ADC driver */ - adc = sam_adc_initialize(); + adc = (struct sam_adc_s *)sam_adc_initialize(); if (!adc) { ierr("ERROR: Failed to initialize the ADC driver\n");