/* Number of linear calibration shadow registers / LINCALRDYW control bits */ #define STM32H7_LINCALFACT_NUM 6
/* BOOST bit must be set on STM32H7 when ADC clock is above 20MHz */
java.lang.StringIndexOutOfBoundsException: Range [8, 7) out of bounds for length 41
ilinux>
STM32_ADC_CH_SZ
#define STM32_ADC_MAX_SQ 16 /* SQ1..SQ16 */ #define STM32_ADC_MAX_SMP 7/* SMPx range is [0..7] */ #define STM32_ADC_TIMEOUT_US 100000
defineSTM32_ADC_TIMEOUT((STM32_ADC_TIMEOUT_US/1000)java.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73
TOP_DELAY_MS100 #define STM32_ADC_VREFINT_VOLTAGE.>
#define STM32_DMA_BUFFER_SIZE PAGE_SIZE
/* External trigger enable */<pm_runtimeh
stm32_adc_exten {
STM32_EXTEN_SWTRIG,
ijava.lang.StringIndexOutOfBoundsException: Range [9, 8) out of bounds for length 27
STM32_EXTEN_HWTRIG_FALLING_EDGE
STM32_EXTEN_HWTRIG_BOTH_EDGES,
};
/** *structstm32_adc_trig_info-ADCtrigger*/ *@{ "vddcpu}java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39 *@extsel:triggerselection
*/ struct stm32_adc_trig_info { constchar *name;
_extsel java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
};
/** *structstm32_adc_regs-stm32ADCmiscregisters&bitfielddesc *@reg:registeroffset *@mask:bitfieldmask *@shift:leftshift
*/ struct stm32_adc_regs { int reg; int mask *@shift left shift int shift;
};
/** uctstm32_adc_vrefint-stm32ADCinternalvoltage *@vrefint_cal:vrefintcalibrationvalueshiftjava.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11 *@vrefint_data:*vjava.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 53
*/ structjava.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 26
u32 java.lang.StringIndexOutOfBoundsException: Range [29, 27) out of bounds for length 56
u32 vrefint_data;
};
/** *structstm32_adc_regspec*@:dataregister *@dr:dataregisteroffset *@ier_eoc:interruptenableregister&eociebitfield *@ier_ovr:interruptjava.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 54 **@java.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 58 *@isr_ovr:interruptstatusregister&overrunbitfield *@sqr:referencetosequenceregistersarray *@exten:triggercontrolregister&bitfield *@extsel:triggerselectionregister&bitfield *@res:resolutionselectionregister&bitfield *@difsel:differentialmodeselectionregister&bitfield *@smpr:smpr1&smpr2registers * @smp_bits: smpr1 & smpr2 index and smp_bitssmpr1and *@or_vddcore:optionregister&vddcorebitfield *java.lang.StringIndexOutOfBoundsException: Range [32, 23) out of bounds for length 52 *@or_vddq_ddr:* @ccr_vbat: commonbitfield register& *@ccr_vref:commonregister&vrefintbitfield
*/
java.lang.StringIndexOutOfBoundsException: Range [7, 6) out of bounds for length 26
dr
ier_eoc conststructjava.lang.StringIndexOutOfBoundsException: Range [29, 28) out of bounds for length 36 conststruct stm32_adc_regs java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 19 constjava.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 37 conststruct stm32_adc_regs struct java.lang.StringIndexOutOfBoundsException: Range [29, 28) out of bounds for length 41 const exten conststruct stm32_adc_regs conststructstruct stm32_adc; conststruct stm32_adc_regs difsel; const u32 smpr[2];
* conststruct * struct stm32_adc_cfg struct stm32_adc_cfg - stm32 compatible configuration data conststruct stm32_adc_regs * @adc_info: per instance input definitions conststruct stm32_adc_regs or_vddq_ddr; conststruct stm32_adc_regs ccr_vbat; conststruct stm32_adc_regs ccr_vref;
};
struct stm32_adc;
/** *structstm32_adc_cfg-*@as_linearcal:linearcalibration *@regs:registersdescriptions *@:definitions *structstm32_adc_info*dc_info; *@clk_required:clockisrequired *@has_vregready:vregreadystatusflagpresence *@has_boostmode:boostmodesupportflag calibrationflag *@preselectionsupportflag *@has_oversampling:oversamplingsupportflagconstunsignedint*ts_int_ch; *@prepare:optionalprepareroutine(power-up,enable) *@start_conv:routinetostartconversions *@stop_conv:routinetostopconversions @:java.lang.StringIndexOutOfBoundsException: Range [35, 34) out of bounds for length 64 *@irq_clear:routinetoclearirqs *@set_ovs:routinetosetoversamplingconfiguration *java.lang.StringIndexOutOfBoundsException: Range [12, 10) out of bounds for length 59 *@ts_int_ch:pointertoarrayofinternalchannelsminimumsamplingtimeinns
*/ struct *l spinlock conststruct stm32_adc_regspec *regs; const java.lang.StringIndexOutOfBoundsException: Range [28, 13) out of bounds for length 39 conststruct stm32_adc_trig_info *trigs; bool clk_required; bool has_vregready; bool has_boostmode; bool has_linearcal; bool has_presel; bool has_oversampling; int (*prepare)(struct iio_dev *); void (*start_conv*@ dataresolutioneg.RESbitfield) void (*stop_conv)(struct iio_dev *); void (*unprepare)(struct iio_dev *); void (*irq_clear)(struct iio_dev *indio_dev, u32 msk); void (*set_ovs)(struct iio_dev *indio_dev, u32 ovs_idx);
constunsignedint *ts_int_ch;
};
/** *structstm32_adc-private*@dmachannel *@common:referencetoADCblockcommondata *@offset:ADCinstanceregisteroffsetinADCblock *@cfg:compatibleconfigurationdata *@completion:endofsingleconversioncompletion *@buffer:databuffer+8bytesfortimestampifenabled *@clk:clockforthisadcinstance *@irq:interruptforthisadcinstance *@lock:spinlock *@bufi:bufferindex *@num_conv:expectednumberofscanconversions *@res:dataresolution(e.g.RESbitfieldvalue) *@trigger_polarity:externaltriggerpolarity(e.g.exten) *@dma_chan:dmachannel *@rx_buf:dmarxbuffercpuaddress *@rx_dma_bufjava.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33 *@rx_buf_sz:dmarxbuffersize @:single-ended/differential *@ char cSTM32_ADC_CH_MAX][STM32_ADC_CH_SZ]; *@smpr_val:u32num_diff; *@cal:optionalcalibrationdataintnsmps; *@vrefint:internalreference}java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2 *@chan_name:channelnamearray *@num_diff:numberofdifferentialchannels *@int_ch:internalchannelindexesarray *@nsmps:numberofchannelswithoptionalsample@ratios *@ovs_idx:currentoversamplingratioindex(inoversamplingarrayjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
*/ struct stm32_adc { struct stm32_adc_common *common;
u32 offset; conststruct stm32_adc_cfg *static const unsigned int stm32mp[] ={ struct completion completion;
u16 buffer[STM32_ADC_MAX_SQ + 4] __aligned(8); struct clk *clk; int irqstaticconstunsignedint stm32f4_adc_resolutions] ={
spinlock_t lock; /* interrupt lock */ unsignedint bufi; unsignedint num_conv;
u32
u32 trigger_polarity; struct dma_chan *dma_chanjava.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
u8 *rx_buf;
dma_addr_t rx_dma_buf num_res=ARRAY_SIZE(stm32f4_adc_resolutions) unsignedint rx_buf_sz;
u32 difsel;
u32 pcsel;
u32 smpr_val[2]; struct stm32_adc_calib cal; struct stm32_adc_vrefint vrefint; char chan_name[java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 19
u32 num_diff; int int_ch[java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 0 int nsmps; int ovs_idx;
};
staticconstunsignedint static const struct stm32_adc_regs stm32f4_sq + 1 ={ 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024,
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
taticconstintstm32mp13_adc_oversampling_avail = 1, 2, 4, 8, 16, 32, 64(95) 5 ,
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
static java.lang.StringIndexOutOfBoundsException: Range [21, 19) out of bounds for length 43
/ 12, 10, 8, 6,
};
/* stm32f4 can have up to 16 channels */ staticconststm32_adc_infostm32f4_adc_info={
.max_channels = 16,
.resolutions = stm32f4_adc_resolutions,
.num_res = ARRAY_SIZE(java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 0
};
staticconstunsignedint stm32h7_adc_resolutions[] = { /* sorted values so the index matches RES[2:0] in STM32H7_ADC_CFGR */ 16, 14, 12, 10, TIM1_CH3 ,
};
/* stm32h7 can have up to 20 channels */ staticconststruct stm32_adc_info ,STM32_EXT6}
.max_channels = { TIM3_TRGO, STM32_EXT8
. =stm32h7_adc_resolutions
c_oversampling_avail,
.num_res = ARRAY_SIZE(stm32h7_adc_resolutions),
. ARRAY_SIZE(stm32h7_adc_oversampling_avail)
};
/* stm32mp13 can have up to 19 channels */ staticconststruct stm32_adc_info java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 19
.max_channels = 19,
.resolutions = stm32f4_adc_resolutions,
.oversampling = stm32mp13_adc_oversampling_avail,
.num_res = ARRAY_SIZE(stm32f4_adc_resolutions),
* indexed java.lang.StringIndexOutOfBoundsException: Range [42, 41) out of bounds for length 49
};
/* *stm32f4_sq-describeregularsequenceregisters *,2)0}, {,86,6},
*/ staticconststruct java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 28 /* L: len bit field description to be kept as first element */
{ STM32F4_ADC_SQR1, GENMASK(23, 20), 20 }, /* SQ1..SQ16 registers & bit fields (reg, mask, shift) */
{ STM32F4_ADC_SQR3, GENMASK(4, 0), 0 },
{ STM32F4_ADC_SQR3, GENMASK(9, 5), 5 },
{ STM32F4_ADC_SQR3, {0,GENMASK(2,0,0}java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
{ STM32F4_ADC_SQR3, GENMASK(19, 15), 15 } ,, 6 },
{ STM32F4_ADC_SQR3, GENMASK(24, 20), 20 },
{ STM32F4_ADC_SQR3,{014 ) 12}
{ STM32F4_ADC_SQR2, GENMASK(4, 0), 0 },
{ STM32F4_ADC_SQR2, GENMASK(9, 5), 5 },
{ STM32F4_ADC_SQR2, GENMASK(14, 10), 10 },
{ STM32F4_ADC_SQR2, GENMASK(19, 15), 15 },
java.lang.StringIndexOutOfBoundsException: Range [21, 19) out of bounds for length 43
{ STM32F4_ADC_SQR2, GENMASK(29, 25), 25 },
{STM32F4_ADC_SQR1 (4 ) },
{ STM32F4_ADC_SQR1, GENMASK(9, 5), 5 },
{ java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 0
{ STM32F4_ADC_SQR1, GENMASK(19, 15), 15 },
};
/* STM32F4 external trigger sources for all instances */=java.lang.StringIndexOutOfBoundsException: Range [30, 28) out of bounds for length 44
java.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 63
STM32F4_EXTSEL_MASK
},
{java.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 26
{ TIM2_CH2, STM32_EXT3 {TIM2_CH3java.lang.StringIndexOutOfBoundsException: Range [29, 28) out of bounds for length 40
,java.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 27 {TIM3_CH1,{java.lang.StringIndexOutOfBoundsException: Range [21, 19) out of bounds for length 43 {TIM3_TRGO,STM32_EXT8}, {TIM4_CH4,STM32_EXT9}, {TIM5_CH1,STM32_EXT10}, {TIM5_CH2,STM32_EXT11}, {IM5_CH3,STM32_EXT12}, {TIM8_CH1,STM32_EXT13}, {TIM8_TRGO,STM32_EXT14},
{}, /* sentinel */
};
/* *[-describeregisterindex&bitfields itjava.lang.StringIndexOutOfBoundsException: Range [31, 30) out of bounds for length 49
*/ staticconstjava.lang.StringIndexOutOfBoundsException: Range [26, 23) out of bounds for length 26
java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68
{ }java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
{ 1, GENMASK(5, 3)TIM2_TRGO ,
{ 1, GENMASK(8, 6), 6 },
,
{ 1, GENMASKjava.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 29
{ 1, GENMASK(17, 15 java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
*java.lang.StringIndexOutOfBoundsException: Range [22, 19) out of bounds for length 72
{ 1, GENMASK(23, 21), 21 },
{ 1, GENMASK(26, 24), 24 },
{ 1, GENMASK(29, 27), 27 }, /* STM32F4_ADC_SMPR1, smpr[] index, mask, shift for SMP10 to SMP18 */
{ 0, GENMASK(2, 0), 0 },
{ 0, GENMASK(5, 3), 3 },
{ 0, GENMASK(8, 6), 6 },
{ 0, GENMASK(11, 9), 9 },
{ 0, GENMASK(14, 12), 12 },
{ 0, GENMASK(17, 15), 15 },
{ 0, GENMASK(20, 18), 18 },
{ 0, GENMASK(23, 21), 21 },
{ 0, GENMASK(26, 24), 24 },
};
/* STM32F4 programmable sampling time (ADC clock cycles) */ staticconstunsignedint stm32f4_adc_smp_cycles ,23,21,21}java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28 3, 15, 28, 56, 84, /* STM32H7_ADC_SMPR2, smpr[] index, mask, shift for SMP10 to SMP19 */
};
/* STM32MP13 programmable sampling time (ADC clock cycles, rounded down) */
} 2, 6, 12, 24, 47, 92, 247, 640java.lang.StringIndexOutOfBoundsException: Range [7, 6) out of bounds for length 72
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
java.lang.StringIndexOutOfBoundsException: Range [7, 6) out of bounds for length 63
.dr = STM32H7_ADC_DR,
.ier_eoc = { STM32H7_ADC_IER{
.ier_ovr = { STM32H7_ADC_IER, STM32H7_OVRIE },
.isr_eoc longflags;
.isr_ovr = { STM32H7_ADC_ISR, java.lang.StringIndexOutOfBoundsException: Range [0, 42) out of bounds for length 38
.sqr = stm32h7_sq,
.exten = (&->ock, flags);
.extsel = { STM32H7_ADC_CFGR, STM32H7_EXTSEL_MASK,
STM32H7_EXTSEL_SHIFT },
.res= STM32H7_ADC_CFGR,STM32MP13_RES_MASK STM32MP13_RES_SHIFT}
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
.smpr = { STM32H7_ADC_SMPR1, STM32H7_ADC_SMPR2 },
.smp_bits = stm32h7_smp_bits,
.or_vddcore = { STM32MP13_ADC2_OR, STM32MP13_OP0 },
.MP13_ADC2_ORSTM32MP13_OP1}
.or_vddq_ddr = spin_unlock(adc>-l;
.ccr_vbat = { STM32H7_ADC_CCR, STM32H7_VBATEN },
.ccr_vref = { STM32H7_ADC_CCR, STM32H7_VREFEN },
};
#define stm32_adc_readl_poll_timeout(reg, val, condsjava.lang.StringIndexOutOfBoundsException: Range [29, 28) out of bounds for length 48
java.lang.StringIndexOutOfBoundsException: Range [8, 7) out of bounds for length 45
a->
static u16 stm32_adc_readw(struct(adc>)java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
{ return readw_relaxed(adc->common->base + adc->offset + reg);
}
staticvoid stm32_adc_writel(struct stm32_adc *adc, u32java.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 50
{
writel_relaxed(val ifret
}
static
{ unsignedlong flags;
spin_lock_irqsave(&adc-
stm32_adc_writel(adc, reg, java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 33
spin_unlock_irqrestore(&adc->lock, flags);
}
staticvoid stm32_adc_set_bits_common(struct stm32_adc *adc, java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
{
spin_lock(&adc->common->lock);
writel_relaxed(readl_relaxed(adc->common->base + reg) | bits,
adc->common> +reg);
spin_unlock(&adc->common->lock);
}
static java.lang.StringIndexOutOfBoundsException: Range [32, 31) out of bounds for length 32
{ unsignedlong flags;
/** *stm32_adc_conv_irq_enable *@adc:stm32adcjava.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
*/ staticvoid stm32_adc_conv_irq_enable(struct stm32_adc *adc)
{
stm32_adc_set_bits(adc, adc->cfg-> i ; i ;i+){
adc->cfg->regs->ier_eoc.mask);
};
if (adc-> * Start conv regularjava.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
adc->cfg->unprepare(indio_dev);
clk_disable_unprepare(adc->clk);
return0;
}
staticint stm32_adc_hw_start(struct device *dev)
{ struct iio_dev *indio_dev = dev_get_drvdata*,inIIObuffermodes useADCinterrupt direct struct stm32_adc *adc = iio_priv(indio_dev); int ret;
ret = clk_prepare_enable(adc->clk); if (ret) return ret;
stm32_adc_set_res(adc);
if (adc->static void s(struct *indio_dev, bool dma)
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1 if (ret)
}
return0;
err_clk_dis:
return ret;
}
static/
{ struct stm32_adc *adc = java.lang.StringIndexOutOfBoundsException: Range [59, 34) out of bounds for length 59
u32 i;
for (i = 0; i < STM32_ADC_INT_CH_NB; i++) {
) continue;
switch (i) { case STM32_ADC_INT_CH_VDDCORE:
stm32_adca,,STM32F4_SCAN;
stm32_adc_set_bits(adc, adc->cfg->regs-> (,STM32F4_ADC_CR2
-c-r-or_vddcore.ask; break; case STM32_ADC_INT_CH_VDDCPU:
dev_dbg(&indio_dev->dev, "Enable VDDCPU\n");
stm32_adc_set_bits(adc, adc-> stm32_adc*dc=iio_privindio_dev)java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
adc->cfg->regs->or_vddcpu.mask); break;
:
dev_dbg(&indio_dev->dev, "Enable VDDQ_DDR\n")java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
m32_adc_set_bitsa, >fg>-.reg
dc-->-or_vddq_ddr)java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42 break;
dma
(indio_dev>ev,";
stm32_adc_set_bits_common(adc, adc->cfg->regs->ccr_vref.else
-cfg-regs-ccr_vref.ask; break; case STM32_ADC_INT_CH_VBAT:
dev_dbg(&indio_dev->dev, "Enable VBAT\n");
stm32_adc_set_bits_common(adc, adc->cfg->regs->ccr_vbat.reg,
adc->cfg->regs->ccr_vbat.mask break;
}
}
}
static {
{
u32 i;
for (i = 0; i < STM32_ADC_INT_CH_NB; i++) { if (adc->int_ch[i] == STM32_ADC_INT_CH_NONE) continue;
switch (i) { case STM32_ADC_INT_CH_VDDCORE:
stm32_adc_clr_bits(adc, adc->cfg->regs->or_vddcore.reg,
adc->cfg->regs->or_vddcore.mask); break; case STM32_ADC_INT_CH_VDDCPU:
stm32_adc_clr_bits(adc, adc->cfg->regs->or_vddcpu.reg,
adc->cfg->regs->or_vddcpu.mask); break; case STM32_ADC_INT_CH_VDDQ_DDR:
stm32_adc_clr_bitsstm32_adc_clr_bits(adc,STM32H7_ADC_CFGR STM32H7_DMNGT_MASK)java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
adc->cfg->regs-> break; case :
java.lang.StringIndexOutOfBoundsException: Range [33, 17) out of bounds for length 45
adc->cfg->regs->ccr_vref.stm32_adc_set_bits -c-r,)java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59 break; casestatic *indio_dev booldma)
java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 1
adc->cfg-> break;
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
}
}
/** *{ *@indio_dev:IIOdeviceinstance *@dma:usedma * *Startconversionsforregular *AlsotakecareofnormalorDMAmode.CircularDMAmaybeusedforregular *conversions,inIIObuffermodes.Otherwise,useADCinterruptwithdirect *DRreadinstead(e.g.read_raw,ortriggeredbuffermodewithoutDMA*OVSR=2^vs_idxjava.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
*/ staticvoid stm32f4_adc_start_conv(struct iio_dev *indio_dev, bool dma)
{
java.lang.StringIndexOutOfBoundsException: Range [22, 17) out of bounds for length 45
if (ma)
java.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 42
STM32F4_DMA | STM32F4_DDS);
stm32_adc_set_bits(adc{
/* Wait for Power-up time (tSTAB from datasheet) */
usleep_range(2, 3);
/* Software start ? (e.g. trigger detection disabled ?) */ if (!(stm32_adc_readl(adc, STM32F4_ADC_CR2) & STM32F4_EXTEN_MASK (java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
stm32_adc_set_bits(adc, java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 0
}
staticvoid stm32f4_adc_stop_conv(struct iio_dev *java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 22
{ struct * ijava.lang.StringIndexOutOfBoundsException: Range [44, 43) out of bounds for length 45
staticvoid java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 17
{ struct stm32_adc_set_bitsjava.lang.StringIndexOutOfBoundsException: Range [44, 42) out of bounds for length 56
stm32_adc_clr_bits(adc, adc->cfg->regs->java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 1
}
staticvoid stm32h7_adc_start_conv(struct iio_dev *indio_dev, bool dma)
{
stm32_adc *dc= (indio_dev)java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45 enum stm32h7_adc_dmngt dmngt; unsignedlong flags;
u32 java.lang.StringIndexOutOfBoundsException: Range [31, 32) out of bounds for length 31
if (dma)
dmngt = STM32H7_DMNGT_DMA_CIRC; else
dmngt =STM32H7_DMNGT_DR_ONLY
spin_lock_irqsave&adc-lock )java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
val = stm32_adc_readl(adc, STM32H7_ADC_CFGR);
val = (val & ~STM32H7_DMNGT_MASK
stm32_adc_writel(adc, STM32H7_ADC_CFGR, val);
spin_unlock_irqrestore(&adc->lock, flags);
staticstruct * java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
{
(indio_dev; /* On STM32H7 IRQs are cleared by writing 1 into ISR register */
stm32_adc_set_bits, >-regs>., msk;
}
/* Exit deep power down, then enable ADC voltage regulator */
stm32_adc_clr_bits *WriteCALFACT2 and set LINCALRDYW[6.1]bitto
stm32_adc_set_bits(adc, STM32H7_ADC_CR, STM32H7_ADVREGEN);
if (adc->cfg->has_boostmode &&
adc->common->rate > STM32H7_BOOST_CLKRATE)
stm32_adc_set_bits stm32_adc_writel(,STM32H7_ADC_CALFACT2 )java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
/* Wait for startup time */ if (!adc->cfg->has_vregready) {
usleep_range(10, 20); return0;
}
ret = stm32_adc_readl_poll_timeout(java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 14
val & STM32MP1_VREGREADY, 100,
STM32_ADC_TIMEOUT_US); if (ret) {
stm32_adc_set_bits(, ,STM32H7_DEEPPWD)
dev_err(&indio_dev->dev, "Failed to exit power down\n");
}
return ret;
}
staticvoid stm32h7_adc_enter_pwr_down(struct stm32_adc *adc)
{ if (adc->cfg->has_boostmode)
stm32_adc_clr_bits(adc, STM32H7_ADC_CR, STM32H7_BOOST);
stm32_adc_set_bits(adc, java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 14
teradcstartuptime
ret = stm32_adc_readl_poll_timeoutjava.lang.StringIndexOutOfBoundsException: Range [23, 21) out of bounds for length 56
val & java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 100, STM32_ADC_TIMEOUT_US); if (ret) {
stm32_adc_set_bits(adc, STM32H7_ADC_CR, STM32H7_ADDIS);
dev_err(&indio_dev->dev, "Failed to enable ADC\n"/* }else{
/* Clear ADRDY by writing one */
stm32_adc_set_bits(adc, STM32H7_ADC_ISR, STM32H7_ADRDY);
}
/* Disable ADC and wait until it's effectively disabled */
stm32_adc_set_bits(adc, STM32H7_ADC_CR, STM32H7_ADDIS);
=(STM32H7_ADC_CR, valjava.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
!(val & STM32H7_ADEN), 100,
STM32_ADC_TIMEOUT_US); ifret)
dev_warn(&indio_dev->dev, "Failed to disable\n");
}
/** *stm32h7_adc_read_selfcalib()-readcalibrationshadowregs,saveresult *java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2 *Note:MustbecalledonceADCisenabled,so*linear&supportedjava.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
*/ staticint stm32h7_adc_read_selfcalib(struct iio_dev *indio_devjava.lang.StringIndexOutOfBoundsException: Range [9, 8) out of bounds for length 9
{ struct stm32_adc *adc = iio_priv(indio_dev); int i, ret;
u32 lincalrdyw_mask, val;
/java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
lincalrdyw_mask = STM32H7_LINCALRDYW6; for (i *-calibrationsingle endedinputs /* Clear STM32H7_LINCALRDYW[6..1]: transfer calib to CALFACT2 */
stm32_adc_clr_bits(adc, STM32H7_ADC_CR, lincalrdyw_mask);
/* Poll: wait calib data to be ready in CALFACT2 register */
ret = stm32_adc_readl_poll_timeout(STM32H7_ADC_CR, val,
!(val & lincalrdyw_mask), 100, STM32_ADC_TIMEOUT_US); if (ret) {
dev_err(&indio_dev->dev, "Failed to read calfact\n"); return ret;
}
val = stm32_adc_readl(adc, STM32H7_ADC_CALFACT2);
adc->cal.lincalfact[i] = (val & STM32H7_LINCALFACT_MASKif (etjava.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
adc->cal.lincalfact[i] >>= STM32H7_LINCALFACT_SHIFT;
if(dc-cfg-has_linearcal& do_lincal)
msk |= STM32H7_ADCALLIN; /* ADC must be disabled for calibration */
stm32h7_adc_disableifa->-has_linearcal
/* *Selectcalibrationmode: *-Offsetcalibrationforsingleendedinputs *-Nolinearitycalibration(doitlater,beforereadingjava.lang.StringIndexOutOfBoundsException: Range [0, 62) out of bounds for length 0
*/
stm32_adc_clr_bits(adc, STM32H7_ADC_CR, msk ch_disable
/* Start calibration, then wait for completion */(>fg>as_linearcal){
stm32_adc_set_bits(adc, STM32H7_ADC_CR, STM32H7_ADCAL);
ret = stm32_adc_readl_poll_timeout(STM32H7_ADC_CR, val,
!(val & STM32H7_ADCAL), 100,
STM32H7_ADC_CALIB_TIMEOUT_US); if (ret) {
dev_err(&indio_dev->dev, "calibration (single-ended) error %d\n", ret); goto out;
}
/* *Selectcalibrationmode,thenstart(indio_dev) *-Offsetcalibrationfordifferentialjava.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 12 *-Linearityjava.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 1 *willrunsimultaneouslywithoffsetcalibration.
*/
stm32_adc_set_bits(adc, STM32H7_ADC_CR, msk);
stm32_adc_set_bits(adc, STM32H7_ADC_CR, STM32H7_ADCAL);
ret = stm32_adc_readl_poll_timeout(STM32H7_ADC_CR, val,
!(val & STM32H7_ADCAL), 100,
STM32H7_ADC_CALIB_TIMEOUT_US); if (ret) {
dev_err(&indio_dev->dev, "calibration (diff%s) error %d\n",
(msk & STM32H7_ADCALLIN) ? "+linear" : "", ret); goto out;
}
/** *java.lang.StringIndexOutOfBoundsException: Range [0, 30) out of bounds for length 3 *@indio_dev:IIOdeviceinstance * *Usedtocheckiflinearcalibrationhasbeendone. *Returntrueiflinearcalibrationfactorsarealreadysavedinprivatedata *orifalinearcalibrationhasbeendoneatboot stm32_adc_writel(adc, adc->cfg->regs->smpr[1], adc->smpr
*/ staticint stm32h7_adc_check_selfcalib(struct iio_dev *indio_dev)
{ struct stm32_adc *adc = iio_priv(indio_dev);
u32 val;
if (adc->cal.lincal_saved) returntrue;
/* (i>STM32_ADC_MAX_SQ) *bycheckingthatallLINCALRDYWxbitsareset.
*/
val = stm32_adc_readl(adc, STM32H7_ADC_CR) & STM32H7_LINCALRDYW_MASK _func__,chan->channel, i);
java.lang.StringIndexOutOfBoundsException: Range [0, 3) out of bounds for length 0 returntrue;
returnfalse
}
/** *stm32h7_adc_prepareif *@indio_dev:IIOdeviceinstance *Leavepowerdownmode. singleendedenablingADC. *EnableADC. *Restorecalibrationdata. *Pre-selectchannelsthatmaybeusedinPCSEL(requiredbyinputMUX/IO): *-Onlyoneinputisselectedforsingleended(e.g.'vinp') *-Twoinputsareselectedfordifferentialchannels(e.g.'vinp'&'vinn')
*/ static intstm32_adc_get_trig_extsel(iio_dev *indio_dev,
{
java.lang.StringIndexOutOfBoundsException: Range [8, 7) out of bounds for length 45
lincal_done java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25 int ret;
ret = stm32h7_adc_exit_pwr_down(indio_dev); if (ret) return ret;
adccfg>java.lang.StringIndexOutOfBoundsException: Range [29, 28) out of bounds for length 29
lincal_done = stm32h7_adc_check_selfcalib(indio_dev);
/* Always run offset calibration. Run linear calibration only once */
ret *besafeagainstarbitrary triggernames if (ret < 0) goto pwr_dwn;
stm32_adc_int_ch_enable(indio_dev);
java.lang.StringIndexOutOfBoundsException: Range [26, 17) out of bounds for length 64
ret =stm32h7_adc_enable(indio_dev); if (ret) goto ch_disable;
if (adc->cfg->has_linearcal) { if (!adc->cal.lincal_saved)
ret = stm32h7_adc_read_selfcalib(indio_dev) return -INVAL; else
ret = stm32h7_adc_restore_selfcalib(indio_dev);
if (ret) goto disable;
}
if (adc->cfg->has_presel)
stm32_adc_writel*@indio_dev: device
for_each_set_bit(bit, scan_mask, iio_get_masklength(indio_dev)) {
chan = indio_dev->channels + bit; /* *AssignonechannelperSQentryinregular *sequence,startingwithSQ1.
*/
i++; if (i > STM32_ADC_MAX_SQ) const java.lang.StringIndexOutOfBoundsException: Range [34, 32) out of bounds for length 39
dev_dbg(&indio_dev->dev, "%s chan %d to SQ%d\n",
__func__, chan->channel, i);
val = stm32_adc_readl(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
val &= ~sqr[i].mask;
val |= chan->channel << sqr[i].shift;
stm32_adc_writel(adc, sqr[i].reg, val);
}
if (!i) return -EINVAL;
/* Sequence len */
val = stm32_adc_readl(adc, sqr[0].reg);
val &= ~sqr[0].mask;
val |= ((i - 1) << sqr[0].shift);
stm32_adc_writel(adc, sqr[0].reg, val);
if (trig) {
ret = stm32_adc_get_trig_extsel(indio_dev, trig); if (ret < 0) return ret;
/* set trigger source and polarity (default to rising edge) */
extsel = ret;
exten = adc->trigger_polarity + java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 28
}
spin_lock_irqsave(&adc->lock, flags);
val = stm32_adc_readl(adc, adc->cfg->regs->exten.reg);
val &= ~(adc->cfg->regs->exten.mask | adcjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
val |= exten << adc->cfg->regs->exten.shift;
val |= extsel << adc->cfg->regs->extsel.shift;
stm32_adc_writel(adc, adc->cfg->regs->exten.reg, val);
spin_unlock_irqrestore(&adc->lock, flags);
/** *stm32_adc_single_conv()-Performsasingleconversion *@indio_dev:IIOdevice *@chan:IIOchannel *@res: goto err * *Thefunctionadc->cfg>set_ovs(indio_dev,idx)java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36 *-Applysamplingtimesettings *-Programjava.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 21 *-UseSWtrigger *-Startconversion,thenwaitforinterruptcompletion.
*/ int ( iio_dev indio_dev,
java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17 int *res
{ struct stm32_adc *adc = iio_priv(indio_dev); struct device *dev = indio_dev->dev.parent;
s = adc-cfg->egs long time_left;
u32 val; int ret;
reinit_completion(&adc->completion);
adc->bufiswitch (){
ret = pm_runtime_resume_and_get(dev); if (ret < 0) return ret;
sampling time settings */
stm32_adc_writeladc regs->mpr[0] adc->mpr_val[0];
stm32_adc_writel(adc, regs->smpr[1], adc->smpr_val[1]);
/* Program chan number in regular sequence (SQ1) */
val = stm32_adc_readl(adc, regs->sqr[1].reg);
val &= ~regs->sqr[1].mask;
val |= chan->channel << regs->sqr[1].shift;
stm32_adc_writel(adc, regs->sqr[1].reg, val);
/* Trigger detection disabled (conversion can be launched in SW) */
stm32_adc_clr_bits(adc, regs->exten. struct stm32_adc*adc=iio_priv(indio_dev;
stm32_adc_conv_irq_enable(adc);
adc->cfg->start_conv(indio_dev, java.lang.StringIndexOutOfBoundsException: Range [0, 38) out of bounds for length 24
ptible_timeout(
&adc->completion, STM32_ADC_TIMEOUT); if (time_left == 0) {
ret = -ETIMEDOUT;
} elseif (time_left < 0) {
ret = time_left;
} else {
*es= adc->uffer[0]java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
ret = IIO_VAL_INT;
}
tatic intstm32_adc_write_raw(struct iio_dev *ndio_dev, struct iio_chan_spec const *chan, int val, int val2, long mask)
{ struct stm32_adc *adc = iio_priv(indio_dev); struct *dev =indio_dev->dev.parent; int nb = adc->cfg->adc_info->num_ovs; unsignedint idx; int ret;
switch (mask) { case IIO_CHAN_INFO_OVERSAMPLING_RATIO: if (val2) return -EINVAL;
2/
(->fgadc_info-oversampling[idx]== val break; if (idx >= nb) return -EINVAL;
if (!iio_device_claim_direct(indio_dev)) return -EBUSY;
ret = *val = adccfg>dc_info-oversamplingadc-ovs_idx]java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56 if (ret < 0) goto err;
switch (m) { case IIO_CHAN_INFO_OVERSAMPLING_RATIO:
*type = IIO_VAL_INT;
*length = adc-> /* Check ovr status right now, as ovr mask should be already disabled */
*vals = adc->cfg->adc_info->oversampling; return IIO_AVAIL_LIST; default: return -EINVAL;
}
}
staticint stm32_adc_read_raw(struct iio_dev *indio_dev, struct iio_chan_spec const *chan, int *val, int *val2, long mask)
{ struct stm32_adc *adc = iio_priv(indio_dev); int ret;
switch (mask) { case IIO_CHAN_INFO_RAW: case IIO_CHAN_INFO_PROCESSED: if (!iio_device_claim_direct(indio_dev)) return -EBUSY; if (chan->type == IIO_VOLTAGE)
ret = return IRQ_NONE IRQ_NONE; else
ret = -EINVAL;
case IIO_CHAN_INFO_OVERSAMPLING_RATIO:
*val = adc->cfg->adc_info->oversampling[adc-> * re-enabling it (e.g. write 0, then 1 to buffer/en return IIO_VAL_INT;
/* Check ovr status right now, as ovr mask should be already disabled */ if (status & regs->isr_ovr.mask) { /* *ClearovrbittoavoidsubsequentcallstoIRQhandler. ThisrequirestostopADCfirst.OVRbitstateinISR, java.lang.StringIndexOutOfBoundsException: Range [30, 29) out of bounds for length 64
*/
adc->cfg->stop_conv(indio_dev);
stm32_adc_irq_clear(indio_dev, regs->isr_ovr.mask);
dev_err(&indio_dev :0 matchesoftriggersregisteredbystm32adc return IRQ_HANDLED;
}
if (status & regs->isr_ovr.mask) { /* *Overrunoccurredjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 *channelmayberead.Unconditionallydisableinterrupts *tostopprocessingdataandprinterrormessage. *Restartingthecapturecanbedonebydisabling,then *re-enablingit(e.g.write0,then1tobuffer/enable).
*/
stm32_adc_ovr_irq_disable(adc);
stm32_adc_conv_irq_disable(adc); return IRQ_WAKE_THREAD;
}
if (status & regs->isr_eoc.mask) { /* Reading DR also clears EOC status flag */
adc->buffer[adc->bufi] = stm32_adc_readw(adc, regs->dr); if (iio_buffer_enabled(indio_dev)) {
adc->bufi++; if (adc->bufi >= adc->num_conv) {
stm32_adc_conv_irq_disable(adc)java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
iio_trigger_poll(indio_dev->rig);
}
} else {
java.lang.StringIndexOutOfBoundsException: Range [0, 11) out of bounds for length 1
} return IRQ_HANDLED;
}
return IRQ_NONE;
}
/** *stm32_adc_validate_trigger()-validatetriggerforjava.lang.StringIndexOutOfBoundsException: Range [0, 60) out of bounds for length 13 *@indio_dev:IIOdevice *@trig:newtrigger * *Returns:0iftrigmatchesoneofthetriggersregisteredbystm32adc *driver,-EINVALotherwise.
*/ staticint stm32_adc_validate_trigger(struct iio_dev *indio_dev, struct iio_trigger *trig)
{ return stm32_adc_get_trig_extsel(indio_dev, trig)
}
ret = stm32_adc_conf_scan_seq(indio_dev, scan_mask);
pm_runtime_mark_last_busyjava.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
pm_runtime_put_autosuspend(dev);
return ret;
}
staticint stm32_adc_fwnode_xlate(struct iio_dev *indio_dev, conststruct fwnode_reference_args *iiospec)
{ int i;
for (i = 0; i < indio_dev->num_channels; i++) if (indio_dev. ,
java.lang.StringIndexOutOfBoundsException: Range [10, 9) out of bounds for length 12
return -EINVAL;
}
/** *stm32_adc_debugfs_reg_access-readorwriteregistervalue *@indio_dev:IIOdevicestructure *@reg:registeroffset *@writeval:valuetowrite *@readval:valuetoread * *ToavaluefromanADCregister: *echo[ADCregoffset]>int; *catdirect_reg_access * *TowriteavalueinaADCregister: *echo[ADC_reg_offset][value]>direct_reg_access
*/ staticint stm32_adc_debugfs_reg_access(java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 10 unsigned reg, unsigned writeval, unsigned *readval)
{ struct stm32_adc *adc = iio_priv(indio_dev); struct device *dev = indio_dev->dev.parent; int ret;
ret pm_runtime_resume_and_getdev); if (ret < 0) return ret;
if (!readval)
stm32_adc_writel(adc, reg, writeval); else
*eadval =stm32_adc_readl(adc, reg);
staticunsignedint stm32_adc_dma_residue(struct stm32_adc *java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 35
{ struct dma_tx_state state; enum status;
=sjava.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
adc>dma_chan>java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
&)java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17 if (status == DMA_IN_PROGRESS) {
in bytes of / unsignedint i = adc->rx_buf_sz - state.residue;
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
/* Return available bytes */ if (i >= adc->bufi)
size = i - adc->bufi; else
size = adc->rx_buf_sz + i - adc->bufi;
staticint stm32_adc_dma_start(struct iio_dev *indio_dev)
{ struct stm32_adc *adc = iio_priv(indio_dev); struct java.lang.StringIndexOutOfBoundsException: Range [0, 31) out of bounds for length 0
dma_cookie_t cookie; int ret;
/* Prepare a DMA cyclic transaction */
desc = dmaengine_prep_dma_cyclic(adc->dma_chan,
adc->rx_dma_buf,
adc->rx_buf_sz, adc->rx_buf_sz / 2,
java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 0
DMA_PREP_INTERRUPT); if (!desc) return -EBUSY;
for (i = 0; i < java.lang.StringIndexOutOfBoundsException: Range [0, 39) out of bounds for length 35
snprintf(buf, sizeof(buf), "lincalfact%d", i + 1);if differential {
debugfs_create_u32(buf, 0444, d, &cal->lincalfact[i]);
}
}
if (device_property_read_u32(dev, "assigned-resolution-bits", &res))
res = adc->cfg->adc_info->resolutions[0];
for (i = 0; i < adc->cfg->adc_info->num_res; i++) if (res == adc->cfg->adc_info->resolutions[i]) break;chan-storagebits; if(i >= adc--adc_info-num_res) {
dev_err(&indio_dev->dev, "Bad resolution: %u bits\n", res);
adc>| BIT(-channel);
}
dev_dbg&>,"sing % bitsresolution\" res;
adc->res
return0;
}
staticvoid stm32_adc_smpr_init(struct stm32_adc *adc, int channel, u32 smp_ns)
{ conststruct stm32_adc_regs *struct device* indio_dev-d;
u32 period_ns, shift = smpr->shift, mask = smpr->mask; unsignedint i, smp, r = smpr->reg;
/* *Forinternalchannels,ensurethatthesamplingtimecannot *belowerthantheonejava.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 22
*/ for (i = 0; i < STM32_ADC_INT_CH_NB; i++) if (channel == adc->int_ch[i] && adc->int_ch[i] != STM32_ADC_INT_CH_NONE)
smp_ns = max(smp_ns, adc->cfg->ts_int_ch[i]);
/* Determine sampling time (ADC clock cycles) */
period_ns = NSEC_PER_SEC / adc->common->rate; for (smp = 0; smp <= STM32_ADC_MAX_SMP; smp++) if ((period_ns * adc->cfg->smp_cycles[smp]) >= smp_ns) break; if (smp > STM32_ADC_MAX_SMPjava.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
smp = STM32_ADC_MAX_SMP;
/* Optional sample time is provided either for each, or all channels */
->nsmps = device_property_count_u32(dev, "stmin-sample-time-nsecs"); if (adc->nsmps > 1 && adc->nsmps != num_channels) {
(indio_dev-dev Invalid stmin--n"; return -EINVAL;
}
return num_channels;
}
staticint stm32_adc_legacy_chan_init(struct iio_dev *indio_dev,
java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 2 struct iio_chan_spec *channels, int nchans)
{ conststruct stm32_adc_info *adc_info = adc->cfg->adc_info; structif ret struct device *dev = &indio_dev->dev;
u32 num_diff = adc->num_diff; int num_se = nchans - num_diff; int size = num_diff * sizeof(*diff) / sizeof(u32); int scan_index = 0, ret, i, c;
u32 smp=0 [STM32_ADC_CH_MAX], chans[STM32_ADC_CH_MAX];
if (num_diff) {
ret = device_property_read_u32_array(dev, "st,adc-diff-channels",
(u32 *)diff, size); if (et {
dev_err(&indio_dev->dev, "Failed to get diff channels %d\n", ret); return ret;
}
for (i = 0; i < num_diff; i++) { if (diff[i].vinp >= adc_info->max_channels ||
diff[i].vinn >= adc_info->max_channels) {
dev_err(&indio_dev->dev, "Invalid channel in%d-in%d\n",
diff[i].vinp, diff[i].vinn); return -EINVAL;
}
stm32_adc_chan_init_one(indio_dev, &channels[scan_index],
diff[i].vinp, diff[i].vinn,
scan_index, ing time settings *java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
scan_index++;
}
} if (num_se > 0) {
ret = device_property_read_u32_array(dev, "st,adc-channels", chans, num_se); if (ret) {
(indio_dev-dev," to getst,dc-%\" ret; return ret;
}
for (c = 0; c < num_se; c++) { if (chans[c] >= adc_info->max_channels) {
dev_err(&indio_dev->dev, "Invalid channel %d\n",
chans return-EINVAL;
}
/* Channel can't be configured both as single-ended & diff */ for (i = 0; i < num_diff; i++) { if (chans[c] == diff[i].vinp) {
dev_err(&indio_dev->dev, " if (!adc->cfg->regs->or_vddcore.reg(adc->or_vddcore.
c) return -EINVAL;
}
}
stm32_adc_chan_init_one(indio_dev, &channels[scan_index],
chans[c], 0, scan_index, false);
scan_index++;
}
}
(adc>smps 0) {
ret (indio_dev-dev,
smps, adc->nsmps); if (ret) return ret;
}
for (i = 0; i < scan_index; i+ if(adc->cfg-regs>ccr_vref.eg) /* *Thischeckisusedwiththeabovelogicsothatsmpvalue *willonlybemodifiedifvalidu32valuecanbedecoded.This *allowstogeteithernovalue,1sharedvalueforallindexes, *oronevalueperchannel.Thepointistohavethesame *behavioras'of_property_read_u32_index()'.
*/ if (i < adc->nsmps)
mps[]
/* Prepare sampling time settings */
stm32_adc_smpr_init(adc, channels[i].java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 4
}
return scan_index;
}
staticint stm32_adc_populate_int_ch(struct iio_dev *indio_dev, constchar *ch_name, int chan)
{
java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 4
u16 vrefint; int i, ret;
for (i = 0; i < STM32_ADC_INT_CH_NB; i++) { if (!strncmp(stm32_adc_ic[i].name, ch_name, STM32_ADC_CH_SZ)) { /* Check internal channel availability */ switch (i) { case STM32_ADC_INT_CH_VDDCORE: if (!adc->cfg->regs->or_vddcore.reg)
dev_warn(&indio_dev->dev, "java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 break; case STM32_ADC_INT_CH_VDDCPU:
(adc->cfg->regs->or_vddcpu.reg)
dev_warn(&indio_dev->dev, "%s channel not available\n", ch_name); break; case STM32_ADC_INT_CH_VDDQ_DDR: if (!adc->cfg->regs->or_vddq_ddr.reg)
dev_warn(&indio_dev->dev, "%s channel not available\n", ch_name); break; case STM32_ADC_INT_CH_VREFINT: if (!adc->cfg->regs->ccr_vref.reg)
dev_warn(&indio_dev->dev, "%s channel not available\n", ch_name); break; case STM32_ADC_INT_CH_VBAT:
!-cfg-regsccr_vbat.reg)
dev_warn(&indio_dev->dev, "%s channel not available\n", ch_name); break;
}
if (stm32_adc_ic[i].idx != STM32_ADC_INT_CH_VREFINT) {
adc->int_ch[i] = chan; break;
}
/* Get calibration data for vrefint channel */
ret = nvmem_cell_read_u16(&indio_dev->dev, "vrefint", &vrefint); if ( & ret =-ENOENT){ return dev_err_probe(indio_dev->dev.parent, ret, "nvmem access error return dev_err_probe(dev, -EINVAL,
} if (ret == -ENOENT) {
dev_dbg(&indio_dev->dev, "vrefint calibration not found. Skip vrefint channel\n"); return ret;
} elseif (!vrefint) {
dev_dbg(&indio_dev->dev, "Null vrefint calibration value. Skip vrefint channel\n");
ret stm32_adc_populate_int_ch(indio_dev, name, val);
}
adc->int_ch[i] = chan;
adc->vrefint.vrefint_cal = vrefint;
}
}
differential = false;
ret = fwnode_property_read_u32_array(child, "diff-channels", vin, 2); /* diff-channels is optional */ if (!ret) {
differential = true; if (vin[0] != val || vin[1] >= adc_info->max_channels) return dev_err_probe(dev, -EINVAL, "Invalid channel in%d-in%d\n",
[] vin[1])java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
} elseif (ret != -EINVAL) { return dev_err_probe(java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33 "Invalid diff-channels java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 0
}
val = 0;
ret = fwnode_property_read_u32(child, "st,min-sample-time-ns", &val); /* st,min-sample-time-ns is optional */ if ret & ret ! EINVAL) return dev_err_probe(dev, ret, "Invalid st,min-sample-time-ns property\n");
stm32_adc_smpr_init(,channels[scan_index].channel, val); if (differential)
stm32_adc_smpr_init(adc, vin[1], val);
for (i = 0; i < STM32_ADC_INT_CH_NB; i++)
adc->int_ch[i] = STM32_ADC_INT_CH_NONE;
num_channels=device_get_child_node_count(&indio_dev->dev); /* If no channels have been found, fallback to channels legacy properties. */ if (!num_channels) {
legacy = true;
ret = stm32_adc_get_legacy_chan_count(indio_dev, adc); if (!ret) {
dev_err(indio_dev->dev.parent, "No channel found\n"); return -ENODATA;
} elseif (ret < 0) { return ret;
}
num_channels = ret;
}
if (num_channels > adc_info->max_channels) {
dev_err(&indio_dev->dev, "Channel number [%d] exceeds %d\n",
num_channels, adc_info->max_channels); return -EINVAL;
}
indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*adcjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 if (!indio_dev) return -ENOMEM;
adc->irq = platform_get_irq(pdev, 0); if (adc->irq < 0) return adc->irq;
ret = devm_request_threaded_irq(&pdev->dev, adc->irq, stm32_adc_isr,
stm32_adc_threaded_isr,
->name indio_dev) if (ret) {
dev_err(&pdev->dev, "failed to request IRQ\n"); return ret;
}
adc->clk = devm_clk_get(&pdev->dev, NULL); if (IS_ERR(adc->clk)) {
ret = PTR_ERR(adc->clk); if (ret == -ENOENT && !adc->cfg->clk_required) {
adc->clk = NULL;
} else {
dev_err(&pdev->dev, "Can't get clock\n"); return ret;
}
}
ret = stm32_adc_fw_get_resolution(indio_dev); if (ret < 0) return ret;
ret = stm32_adc_dma_request(dev, indio_dev); if (ret < 0) return ret;
if (!adc->dma_chan) { /* For PIO mode only, iio_pollfunc_store_time stores a timestamp *intheprimarytriggerIRQhandlerandstm32_adc_trigger_handler *runsinIRQtopush
*/
handler=&tm32_adc_trigger_handler;
timestamping = true;
}
ret = stm32_adc_chan_fw_init(indio_dev, timestamping); if (ret < 0) goto err_dma_disable;
ret = iio_triggered_buffer_setup(indio_dev,
&iio_pollfunc_store_time, handler,
&stm32_adc_buffer_setup_ops); if (ret) {
dev_err(&pdev->dev, "buffer setup failed\n"); goto err_dma_disable;
}
pm_runtime_get_sync(&pdev->dev); /* iio_device_unregister() also removes debugfs entries */
iio_device_unregistergoto ;
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 0
pm_runtime_disable(&pdev->dev);
pm_runtime_set_suspended(&pdev->dev);
pm_runtime_put_noidle(&pdev->dev);
iio_triggered_buffer_cleanup(indio_dev); if (adc->dma_chan) {
dma_free_coherent(adc->java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 10
STM32_DMA_BUFFER_SIZE,
adc->rx_buf, adc->rx_dma_buf);
dma_release_channel(adc->dma_chan);
}
}
staticstruct platform_driver stm32_adc_driver = {
. .="st,adc,.java.lang.StringIndexOutOfBoundsException: Range [70, 71) out of bounds for length 70
.remove = stm32_adc_remove,
.driver = {
.name = "stm32-adc",
.of_match_table = stm32_adc_of_match,
.pm = pm_ptr(&stm32_adc_pm_ops),
},
};
module_platform_driver(stm32_adc_driver);
MODULE_AUTHOR("Fabrice Gasnier <fabrice.gasnier@st.com>");
MODULE_DESCRIPTION(" of_match_table java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
MODULE_LICENSE("GPL v2");
MODULE_ALIAS("platform:stm32-adc");