/openbmc/linux/drivers/iio/adc/ |
H A D | qcom-spmi-adc5.c | 1 // SPDX-License-Identifier: GPL-2.0 10 #include <linux/iio/adc/qcom-vadc-common.h> 23 #include <dt-bindings/iio/qcom,spmi-vadc.h> 104 * struct adc5_channel_prop - ADC channel property. 113 * @avg_samples: ability to provide single result from the ADC 133 * struct adc5_chip - ADC private structure. 136 * @base: base address for the ADC peripheral. 137 * @nchannels: number of ADC channels. 138 * @chan_props: array of ADC channel properties. 141 * @complete: ADC result notification after interrupt is received. [all …]
|
H A D | mxs-lradc-adc.c | 1 // SPDX-License-Identifier: GPL-2.0-or-later 3 * Freescale MXS LRADC ADC driver 18 #include <linux/mfd/mxs-lradc.h> 43 "mxs-lradc-channel0", 44 "mxs-lradc-channel1", 45 "mxs-lradc-channel2", 46 "mxs-lradc-channel3", 47 "mxs-lradc-channel4", 48 "mxs-lradc-channel5", 52 "mxs-lradc-thresh0", [all …]
|
H A D | stm32-dfsdm-adc.c | 1 // SPDX-License-Identifier: GPL-2.0 3 * This file is the ADC part of the STM32 DFSDM driver 5 * Copyright (C) 2017, STMicroelectronics - All Rights Reserved 10 #include <linux/dma-mapping.h> 11 #include <linux/iio/adc/stm32-dfsdm-adc.h> 13 #include <linux/iio/hw-consumer.h> 15 #include <linux/iio/timer/stm32-lptim-trigger.h> 16 #include <linux/iio/timer/stm32-timer-trigger.h> 28 #include "stm32-dfsdm.h" 43 /* Limit filter output resolution to 31 bits. (i.e. sample range is +/-2^30) */ [all …]
|
H A D | ti_am335x_adc.c | 1 // SPDX-License-Identifier: GPL-2.0-only 3 * TI ADC MFD driver 5 * Copyright (C) 2012 Texas Instruments Incorporated - https://www.ti.com/ 26 #include <linux/dma-mapping.h> 32 struct dma_chan *chan; member 54 static unsigned int tiadc_readl(struct tiadc_device *adc, unsigned int reg) in tiadc_readl() argument 56 return readl(adc->mfd_tscadc->tscadc_base + reg); in tiadc_readl() 59 static void tiadc_writel(struct tiadc_device *adc, unsigned int reg, in tiadc_writel() argument 62 writel(val, adc->mfd_tscadc->tscadc_base + reg); in tiadc_writel() 69 step_en = ((1 << adc_dev->channels) - 1); in get_adc_step_mask() [all …]
|
H A D | palmas_gpadc.c | 1 // SPDX-License-Identifier: GPL-2.0-only 3 * palmas-adc.c -- TI PALMAS GPADC. 26 #define MOD_NAME "palmas-gpadc" 29 #define PALMAS_GPADC_TRIMINVALID -1 90 * struct palmas_gpadc - the palmas_gpadc structure 110 * This is the palmas_gpadc structure to store run-time information 131 static struct palmas_adc_event *palmas_gpadc_get_event(struct palmas_gpadc *adc, in palmas_gpadc_get_event() argument 135 if (adc_chan == adc->event0.channel && dir == adc->event0.direction) in palmas_gpadc_get_event() 136 return &adc->event0; in palmas_gpadc_get_event() 138 if (adc_chan == adc->event1.channel && dir == adc->event1.direction) in palmas_gpadc_get_event() [all …]
|
H A D | stm32-adc.c | 1 // SPDX-License-Identifier: GPL-2.0 3 * This file is part of STM32 ADC driver 5 * Copyright (C) 2016, STMicroelectronics - All Rights Reserved 12 #include <linux/dma-mapping.h> 16 #include <linux/iio/timer/stm32-lptim-trigger.h> 17 #include <linux/iio/timer/stm32-timer-trigger.h> 26 #include <linux/nvmem-consumer.h> 31 #include "stm32-adc-core.h" 36 /* BOOST bit must be set on STM32H7 when ADC clock is above 20MHz */ 58 /* extsel - trigger mux selection value */ [all …]
|
H A D | stmpe-adc.c | 1 // SPDX-License-Identifier: GPL-2.0 3 * STMicroelectronics STMPE811 IIO ADC Driver 5 * 4 channel, 10/12-bit ADC 7 * Copyright (C) 2013-2018 Toradex AG <stefan.agner@toradex.com> 62 struct iio_chan_spec const *chan, int *val) in stmpe_read_voltage() argument 66 mutex_lock(&info->lock); in stmpe_read_voltage() 68 reinit_completion(&info->completion); in stmpe_read_voltage() 70 info->channel = (u8)chan->channel; in stmpe_read_voltage() 72 if (info->channel > STMPE_ADC_LAST_NR) { in stmpe_read_voltage() 73 mutex_unlock(&info->lock); in stmpe_read_voltage() [all …]
|
H A D | rn5t618-adc.c | 1 // SPDX-License-Identifier: GPL-2.0+ 3 * ADC driver for the RICOH RN5T618 power management chip family 28 /* average 4-time conversion mode */ 72 ret = regmap_bulk_read(rn5t618->regmap, reg, data, sizeof(data)); in rn5t618_read_adc_reg() 83 struct rn5t618_adc_data *adc = data; in rn5t618_adc_irq() local 88 regmap_write(adc->rn5t618->regmap, RN5T618_IR_ADC1, 0); in rn5t618_adc_irq() 89 regmap_write(adc->rn5t618->regmap, RN5T618_IR_ADC2, 0); in rn5t618_adc_irq() 91 ret = regmap_read(adc->rn5t618->regmap, RN5T618_IR_ADC3, &r); in rn5t618_adc_irq() 93 dev_err(adc->dev, "failed to read IRQ status: %d\n", ret); in rn5t618_adc_irq() 95 regmap_write(adc->rn5t618->regmap, RN5T618_IR_ADC3, 0); in rn5t618_adc_irq() [all …]
|
H A D | cc10001_adc.c | 1 // SPDX-License-Identifier: GPL-2.0-only 3 * Copyright (c) 2014-2015 Imagination Technologies Ltd. 47 * As per device specification, wait six clock cycles after power-up to 69 writel(val, adc_dev->reg_base + reg); in cc10001_adc_write_reg() 75 return readl(adc_dev->reg_base + reg); in cc10001_adc_read_reg() 81 ndelay(adc_dev->start_delay_ns); in cc10001_adc_power_up() 146 indio_dev = pf->indio_dev; in cc10001_adc_trigger_h() 148 data = adc_dev->buf; in cc10001_adc_trigger_h() 150 mutex_lock(&adc_dev->lock); in cc10001_adc_trigger_h() 152 if (!adc_dev->shared) in cc10001_adc_trigger_h() [all …]
|
H A D | viperboard_adc.c | 1 // SPDX-License-Identifier: GPL-2.0-or-later 3 * Nano River Technologies viperboard IIO ADC driver 27 u8 chan; member 50 struct iio_chan_spec const *chan, in vprbrd_iio_read_raw() argument 56 struct vprbrd_adc *adc = iio_priv(iio_dev); in vprbrd_iio_read_raw() local 57 struct vprbrd *vb = adc->vb; in vprbrd_iio_read_raw() 58 struct vprbrd_adc_msg *admsg = (struct vprbrd_adc_msg *)vb->buf; in vprbrd_iio_read_raw() 62 mutex_lock(&vb->lock); in vprbrd_iio_read_raw() 64 admsg->cmd = VPRBRD_ADC_CMD_GET; in vprbrd_iio_read_raw() 65 admsg->chan = chan->channel; in vprbrd_iio_read_raw() [all …]
|
H A D | mt6370-adc.c | 1 // SPDX-License-Identifier: GPL-2.0-only 20 #include <dt-bindings/iio/adc/mediatek,mt6370_adc.h> 60 * This mutex lock is for preventing the different ADC channels 67 static int mt6370_adc_read_channel(struct mt6370_adc_data *priv, int chan, in mt6370_adc_read_channel() argument 74 mutex_lock(&priv->adc_lock); in mt6370_adc_read_channel() 78 ret = regmap_write(priv->regmap, MT6370_REG_CHG_ADC, reg_val); in mt6370_adc_read_channel() 84 ret = regmap_read_poll_timeout(priv->regmap, in mt6370_adc_read_channel() 90 dev_err(priv->dev, "Failed to read ADC register (%d)\n", ret); in mt6370_adc_read_channel() 94 ret = regmap_raw_read(priv->regmap, MT6370_REG_ADC_DATA_H, in mt6370_adc_read_channel() 103 mutex_unlock(&priv->adc_lock); in mt6370_adc_read_channel() [all …]
|
H A D | ingenic-adc.c | 1 // SPDX-License-Identifier: GPL-2.0 3 * ADC driver for the Ingenic JZ47xx SoCs 4 * Copyright (c) 2019 Artur Rojek <contact@artur-rojek.eu> 6 * based on drivers/mfd/jz4740-adc.c 9 #include <dt-bindings/iio/adc/ingenic,adc.h> 102 int (*init_clk_div)(struct device *dev, struct ingenic_adc *adc); 116 struct ingenic_adc *adc = iio_priv(iio_dev); in ingenic_adc_set_adcmd() local 118 mutex_lock(&adc->lock); in ingenic_adc_set_adcmd() 121 readl(adc->base + JZ_ADC_REG_ADCMD); in ingenic_adc_set_adcmd() 128 adc->base + JZ_ADC_REG_ADCMD); in ingenic_adc_set_adcmd() [all …]
|
H A D | intel_mrfld_adc.c | 1 // SPDX-License-Identifier: GPL-2.0 3 * ADC driver for Basin Cove PMIC 65 struct mrfld_adc *adc = iio_priv(indio_dev); in mrfld_adc_thread_isr() local 67 complete(&adc->completion); in mrfld_adc_thread_isr() 72 struct iio_chan_spec const *chan, in mrfld_adc_single_conv() argument 75 struct mrfld_adc *adc = iio_priv(indio_dev); in mrfld_adc_single_conv() local 76 struct regmap *regmap = adc->regmap; in mrfld_adc_single_conv() 82 reinit_completion(&adc->completion); in mrfld_adc_single_conv() 93 req = mrfld_adc_requests[chan->channel]; in mrfld_adc_single_conv() 98 timeout = wait_for_completion_interruptible_timeout(&adc->completion, in mrfld_adc_single_conv() [all …]
|
H A D | axp20x_adc.c | 1 // SPDX-License-Identifier: GPL-2.0-only 2 /* ADC driver for AXP20X and AXP22X PMICs 5 * Quentin Schulz <quentin.schulz@free-electrons.com> 109 .consumer_dev_name = "axp20x-usb-power-supply", 113 .consumer_dev_name = "axp20x-usb-power-supply", 117 .consumer_dev_name = "axp20x-ac-power-supply", 121 .consumer_dev_name = "axp20x-ac-power-supply", 125 .consumer_dev_name = "axp20x-battery-power-supply", 129 .consumer_dev_name = "axp20x-battery-power-supply", 133 .consumer_dev_name = "axp20x-battery-power-supply", [all …]
|
H A D | at91_adc.c | 1 // SPDX-License-Identifier: GPL-2.0-or-later 3 * Driver for the ADC present in the Atmel AT91 evaluation boards. 37 #define AT91_ADC_TSAMOD (3 << 0) /* ADC mode */ 38 #define AT91_ADC_TSAMOD_ADC_ONLY_MODE (0 << 0) /* ADC Mode */ 102 #define AT91_ADC_ACR_PENDETSENS (0x3 << 0) /* pull-up resistor */ 136 (st->registers->channel_base + (ch * 4)) 138 (readl_relaxed(st->reg_base + reg)) 140 (writel_relaxed(val, st->reg_base + reg)) 160 * struct at91_adc_trigger - description of triggers 162 * @value: value to set in the ADC's trigger setup register [all …]
|
H A D | max77541-adc.c | 1 // SPDX-License-Identifier: GPL-2.0-or-later 4 * ADI MAX77541 ADC Driver with IIO interface 30 struct iio_chan_spec const *chan, in max77541_adc_offset() argument 33 switch (chan->channel) { in max77541_adc_offset() 38 return -EINVAL; in max77541_adc_offset() 43 struct iio_chan_spec const *chan, in max77541_adc_scale() argument 50 switch (chan->channel) { in max77541_adc_scale() 74 return -EINVAL; in max77541_adc_scale() 82 return -EINVAL; in max77541_adc_scale() 87 struct iio_chan_spec const *chan, in max77541_adc_raw() argument [all …]
|
H A D | men_z188_adc.c | 1 // SPDX-License-Identifier: GPL-2.0-only 48 struct iio_chan_spec const *chan, in z188_iio_read_raw() argument 53 struct z188_adc *adc = iio_priv(iio_dev); in z188_iio_read_raw() local 59 tmp = readw(adc->base + chan->channel * 4); in z188_iio_read_raw() 62 dev_info(&iio_dev->dev, in z188_iio_read_raw() 63 "Oversampling error on ADC channel %d\n", in z188_iio_read_raw() 64 chan->channel); in z188_iio_read_raw() 65 return -EIO; in z188_iio_read_raw() 71 ret = -EINVAL; in z188_iio_read_raw() 103 struct z188_adc *adc; in men_z188_probe() local [all …]
|
H A D | mt6360-adc.c | 1 // SPDX-License-Identifier: GPL-2.0 61 /* Due to only one set of ADC control, this lock is used to prevent the race condition */ 74 mutex_lock(&mad->adc_lock); in mt6360_adc_read_channel() 76 /* Select the preferred ADC channel */ in mt6360_adc_read_channel() 77 ret = regmap_update_bits(mad->regmap, MT6360_REG_PMUADCRPT1, MT6360_PREFERCH_MASK, in mt6360_adc_read_channel() 83 ret = regmap_raw_write(mad->regmap, MT6360_REG_PMUADCCFG, &adc_enable, sizeof(adc_enable)); in mt6360_adc_read_channel() 87 predict_end_t = ktime_add_ms(mad->last_off_timestamps[channel], 2 * ADC_WAIT_TIME_MS); in mt6360_adc_read_channel() 95 ret = -ERESTARTSYS; in mt6360_adc_read_channel() 101 ret = regmap_raw_read(mad->regmap, MT6360_REG_PMUADCRPT1, rpt, sizeof(rpt)); in mt6360_adc_read_channel() 106 * There are two functions, ZCV and TypeC OTP, running ADC VBAT and TS in in mt6360_adc_read_channel() [all …]
|
H A D | adi-axi-adc.c | 1 // SPDX-License-Identifier: GPL-2.0-only 3 * Analog Devices Generic AXI ADC IP core 6 * Copyright 2012-2020 Analog Devices Inc. 21 #include <linux/fpga/adi-axi-common.h> 24 #include <linux/iio/buffer-dmaengine.h> 33 /* ADC controls */ 40 /* ADC Channel controls */ 69 ret = regmap_set_bits(st->regmap, ADI_AXI_REG_RSTN, in axi_adc_enable() 75 return regmap_set_bits(st->regmap, ADI_AXI_REG_RSTN, in axi_adc_enable() 83 regmap_write(st->regmap, ADI_AXI_REG_RSTN, 0); in axi_adc_disable() [all …]
|
H A D | nau7802.c | 1 // SPDX-License-Identifier: GPL-2.0-or-later 3 * Driver for the Nuvoton NAU7802 ADC 64 #define NAU7802_CHANNEL(chan) { \ argument 67 .channel = (chan), \ 68 .scan_index = (chan), \ 88 for (i = 0; i < ARRAY_SIZE(st->scale_avail); i++) in nau7802_show_scales() 89 len += scnprintf(buf + len, PAGE_SIZE - len, "0.%09d ", in nau7802_show_scales() 90 st->scale_avail[i]); in nau7802_show_scales() 92 buf[len-1] = '\n'; in nau7802_show_scales() 116 mutex_lock(&st->lock); in nau7802_set_gain() [all …]
|
/openbmc/linux/Documentation/devicetree/bindings/iio/adc/ |
H A D | ti,am3359-adc.yaml | 1 # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 3 --- 4 $id: http://devicetree.org/schemas/iio/adc/ti,am3359-adc.yaml# 5 $schema: http://devicetree.org/meta-schemas/core.yaml# 7 title: TI AM3359 ADC 10 - Miquel Raynal <miquel.raynal@bootlin.com> 15 - enum: 16 - ti,am3359-adc 17 - ti,am4372-adc 18 - items: [all …]
|
/openbmc/linux/drivers/comedi/drivers/ |
H A D | s626.c | 1 // SPDX-License-Identifier: GPL-2.0+ 6 * COMEDI - Linux Control and Measurement Device Interface 10 * Copyright (C) 2002-2004 Sensoray Co., Inc. 68 * struct s626_private - Working data for s626 driver. 69 * @ai_cmd_running: non-zero if ai_cmd is running. 74 * @adc_items: number of items in ADC poll list. 75 * @rps_buf: DMA buffer used to hold ADC (RPS1) program. 76 * @ana_buf: DMA buffer used to receive ADC data and hold DAC data. 98 #define S626_INDXMASK(C) (1 << (((C) > 2) ? ((C) * 2 - 1) : ((C) * 2 + 4))) 110 writel(val, dev->mmio + reg); in s626_mc_enable() [all …]
|
/openbmc/u-boot/cmd/ |
H A D | adc.c | 1 // SPDX-License-Identifier: GPL-2.0+ 9 #include <adc.h> 19 printf("No available ADC device\n"); in do_adc_list() 24 printf("- %s\n", dev->name); in do_adc_list() 46 printf("Unknown ADC device %s\n", argv[1]); in do_adc_info() 50 printf("ADC Device '%s' :\n", argv[1]); in do_adc_info() 104 int i, chan, ret, uV; in do_adc_scan() local 111 pr_err("Can't get the ADC %s: %d\n", argv[1], ret); in do_adc_scan() 123 pr_err("Can't get mask for %s: %d\n", dev->name, ret); in do_adc_scan() 129 ret = adc_channels_single_shot(dev->name, ch_mask, ch); in do_adc_scan() [all …]
|
/openbmc/linux/drivers/extcon/ |
H A D | extcon-adc-jack.c | 1 // SPDX-License-Identifier: GPL-2.0-only 3 * drivers/extcon/extcon-adc-jack.c 5 * Analog Jack extcon driver with ADC-based detection capability. 13 * Modified for calling to IIO to get adc by <anish.singh@samsung.com> 24 #include <linux/extcon/extcon-adc-jack.h> 25 #include <linux/extcon-provider.h> 28 * struct adc_jack_data - internal data for adc_jack device driver 31 * @adc_conditions: list of adc value conditions. 37 * @chan: iio channel being queried. 51 struct iio_channel *chan; member [all …]
|
/openbmc/linux/drivers/iio/addac/ |
H A D | stx104.c | 1 // SPDX-License-Identifier: GPL-2.0-only 22 #define STX104_OUT_CHAN(chan) { \ argument 24 .channel = chan, \ 29 #define STX104_IN_CHAN(chan, diff) { \ argument 31 .channel = chan, \ 32 .channel2 = chan, \ 62 /* ADC Channel */ 68 /* ADC Status */ 73 /* ADC Control */ 77 /* ADC Configuration */ [all …]
|