drivers: adc: mcux_lpadc: support IP instances without side B channel
Updating the LPADC driver to support IP without a side B channel. The MCXA156 is an example with this instantiation of the IP. Signed-off-by: Neil Chen <cheng.chen_1@nxp.com>
This commit is contained in:
parent
3f60489fae
commit
0436801cf9
1 changed files with 6 additions and 0 deletions
|
@ -157,6 +157,8 @@ static int mcux_lpadc_channel_setup(const struct device *dev,
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !(defined(FSL_FEATURE_LPADC_HAS_B_SIDE_CHANNELS) && \
|
||||||
|
(FSL_FEATURE_LPADC_HAS_B_SIDE_CHANNELS == 0U))
|
||||||
if (channel_cfg->differential) {
|
if (channel_cfg->differential) {
|
||||||
/* Channel pairs must match in differential mode */
|
/* Channel pairs must match in differential mode */
|
||||||
if ((ADC_CMDL_ADCH(channel_cfg->input_positive)) !=
|
if ((ADC_CMDL_ADCH(channel_cfg->input_positive)) !=
|
||||||
|
@ -183,6 +185,7 @@ static int mcux_lpadc_channel_setup(const struct device *dev,
|
||||||
} else {
|
} else {
|
||||||
/* Default value for sampleChannelMode is SideA */
|
/* Default value for sampleChannelMode is SideA */
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#if defined(FSL_FEATURE_LPADC_HAS_CMDL_CSCALE) && FSL_FEATURE_LPADC_HAS_CMDL_CSCALE
|
#if defined(FSL_FEATURE_LPADC_HAS_CMDL_CSCALE) && FSL_FEATURE_LPADC_HAS_CMDL_CSCALE
|
||||||
/*
|
/*
|
||||||
* The true scaling factor used by the LPADC is 30/64, instead of
|
* The true scaling factor used by the LPADC is 30/64, instead of
|
||||||
|
@ -435,6 +438,8 @@ static void mcux_lpadc_isr(const struct device *dev)
|
||||||
conv_mode = data->cmd_config[channel].sampleChannelMode;
|
conv_mode = data->cmd_config[channel].sampleChannelMode;
|
||||||
if (data->ctx.sequence.resolution < 15) {
|
if (data->ctx.sequence.resolution < 15) {
|
||||||
result = ((conv_result.convValue >> 3) & 0xFFF);
|
result = ((conv_result.convValue >> 3) & 0xFFF);
|
||||||
|
#if !(defined(FSL_FEATURE_LPADC_HAS_B_SIDE_CHANNELS) && \
|
||||||
|
(FSL_FEATURE_LPADC_HAS_B_SIDE_CHANNELS == 0U))
|
||||||
#if defined(FSL_FEATURE_LPADC_HAS_CMDL_DIFF) && FSL_FEATURE_LPADC_HAS_CMDL_DIFF
|
#if defined(FSL_FEATURE_LPADC_HAS_CMDL_DIFF) && FSL_FEATURE_LPADC_HAS_CMDL_DIFF
|
||||||
if (conv_mode == kLPADC_SampleChannelDiffBothSideAB ||
|
if (conv_mode == kLPADC_SampleChannelDiffBothSideAB ||
|
||||||
conv_mode == kLPADC_SampleChannelDiffBothSideBA) {
|
conv_mode == kLPADC_SampleChannelDiffBothSideBA) {
|
||||||
|
@ -447,6 +452,7 @@ static void mcux_lpadc_isr(const struct device *dev)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*data->buffer++ = result;
|
*data->buffer++ = result;
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
*data->buffer++ = conv_result.convValue;
|
*data->buffer++ = conv_result.convValue;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue