/openbmc/linux/drivers/iio/adc/ |
H A D | imx93_adc.c | 1 // SPDX-License-Identifier: GPL-2.0+ 3 * NXP i.MX93 ADC driver 22 #define IMX93_ADC_DRIVER_NAME "imx93-adc" 42 /* ADC bit shift */ 61 /* ADC status */ 72 struct device *dev; member 102 static void imx93_adc_power_down(struct imx93_adc *adc) in imx93_adc_power_down() argument 107 mcr = readl(adc->regs + IMX93_ADC_MCR); in imx93_adc_power_down() 109 writel(mcr, adc->regs + IMX93_ADC_MCR); in imx93_adc_power_down() 111 ret = readl_poll_timeout(adc->regs + IMX93_ADC_MSR, msr, in imx93_adc_power_down() [all …]
|
H A D | imx8qxp-adc.c | 1 // SPDX-License-Identifier: GPL-2.0+ 3 * NXP i.MX8QXP ADC driver 30 #define ADC_DRIVER_NAME "imx8qxp-adc" 46 /* ADC bit shift */ 75 /* ADC PARAMETER*/ 92 struct device *dev; member 97 /* Serialise ADC channel reads */ 123 static void imx8qxp_adc_reset(struct imx8qxp_adc *adc) in imx8qxp_adc_reset() argument 128 ctrl = readl(adc->regs + IMX8QXP_ADR_ADC_CTRL); in imx8qxp_adc_reset() 130 writel(ctrl, adc->regs + IMX8QXP_ADR_ADC_CTRL); in imx8qxp_adc_reset() [all …]
|
H A D | rzg2l_adc.c | 1 // SPDX-License-Identifier: GPL-2.0 7 * Author: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> 24 #define DRIVER_NAME "rzg2l-adc" 93 static unsigned int rzg2l_adc_readl(struct rzg2l_adc *adc, u32 reg) in rzg2l_adc_readl() argument 95 return readl(adc->base + reg); in rzg2l_adc_readl() 98 static void rzg2l_adc_writel(struct rzg2l_adc *adc, unsigned int reg, u32 val) in rzg2l_adc_writel() argument 100 writel(val, adc->base + reg); in rzg2l_adc_writel() 103 static void rzg2l_adc_pwr(struct rzg2l_adc *adc, bool on) in rzg2l_adc_pwr() argument 107 reg = rzg2l_adc_readl(adc, RZG2L_ADM(0)); in rzg2l_adc_pwr() 112 rzg2l_adc_writel(adc, RZG2L_ADM(0), reg); in rzg2l_adc_pwr() [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 | 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 114 struct device *dev; member 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() [all …]
|
H A D | max1241.c | 1 // SPDX-License-Identifier: GPL-2.0-only 3 * MAX1241 low-power, 12-bit serial ADC 5 * Datasheet: https://datasheets.maximintegrated.com/en/ds/MAX1240-MAX1241.pdf 41 static int max1241_read(struct max1241 *adc) in max1241_read() argument 57 .rx_buf = &adc->data, in max1241_read() 62 return spi_sync_transfer(adc->spi, xfers, ARRAY_SIZE(xfers)); in max1241_read() 70 struct max1241 *adc = iio_priv(indio_dev); in max1241_read_raw() local 74 mutex_lock(&adc->lock); in max1241_read_raw() 76 if (adc->shutdown) { in max1241_read_raw() 77 gpiod_set_value(adc->shutdown, 0); in max1241_read_raw() [all …]
|
H A D | lpc18xx_adc.c | 1 // SPDX-License-Identifier: GPL-2.0-only 3 * IIO ADC driver for NXP LPC18xx ADC 8 * - Hardware triggers 9 * - Burst mode 10 * - Interrupts 11 * - DMA 26 /* LPC18XX ADC registers and bits */ 44 struct device *dev; member 69 static int lpc18xx_adc_read_chan(struct lpc18xx_adc *adc, unsigned int ch) in lpc18xx_adc_read_chan() argument 74 reg = adc->cr_reg | BIT(ch) | LPC18XX_ADC_CR_START_NOW; in lpc18xx_adc_read_chan() [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 | mcp3911.c | 1 // SPDX-License-Identifier: GPL-2.0 3 * Driver for Microchip MCP3911, Two-channel Analog Front End 87 static int mcp3911_read(struct mcp3911 *adc, u8 reg, u32 *val, u8 len) in mcp3911_read() argument 91 reg = MCP3911_REG_READ(reg, adc->dev_addr); in mcp3911_read() 92 ret = spi_write_then_read(adc->spi, ®, 1, val, len); in mcp3911_read() 97 *val >>= ((4 - len) * 8); in mcp3911_read() 98 dev_dbg(&adc->spi->dev, "reading 0x%x from register 0x%lx\n", *val, in mcp3911_read() 103 static int mcp3911_write(struct mcp3911 *adc, u8 reg, u32 val, u8 len) in mcp3911_write() argument 105 dev_dbg(&adc->spi->dev, "writing 0x%x to register 0x%x\n", val, reg); in mcp3911_write() 107 val <<= (3 - len) * 8; in mcp3911_write() [all …]
|
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. 135 * @dev: SPMI ADC5 device. 136 * @base: base address for the ADC peripheral. 137 * @nchannels: number of ADC channels. 138 * @chan_props: array of ADC channel properties. [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 */ 39 struct device *dev; member 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() [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 | qcom-pm8xxx-xoadc.c | 1 // SPDX-License-Identifier: GPL-2.0-only 7 * specific-purpose and general purpose ADC converters and channels. 13 #include <linux/iio/adc/qcom-vadc-common.h> 27 * Qualcomm tree. Their kernel has two out-of-tree drivers for the ADC: 28 * drivers/misc/pmic8058-xoadc.c 29 * drivers/hwmon/pm8xxx-adc.c 57 /* Proper ADC registers */ 99 * On a later ADC the decimation factors are defined as 155 * struct xoadc_channel - encodes channel properties and defaults 162 * @prescale: the channels have hard-coded prescale ratios defined [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-adc-core.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 8 * Inspired from: fsl-imx25-tsadc 29 #include "stm32-adc-core.h" 45 * struct stm32_adc_common_regs - stm32 common registers 50 * @ier: interrupt enable register offset for each adc 65 * struct stm32_adc_priv_cfg - stm32 core compatible configuration data 69 * @ipid: adc identification number 72 * @num_adcs: maximum number of ADC instances in the common registers [all …]
|
H A D | ti-adc12138.c | 1 // SPDX-License-Identifier: GPL-2.0-only 3 * ADC12130/ADC12132/ADC12138 12-bit plus sign ADC driver 52 * Maximum size needed: 16x 2 bytes ADC data + 8 bytes timestamp. 128 static int adc12138_mode_programming(struct adc12138 *adc, u8 mode, in adc12138_mode_programming() argument 132 .tx_buf = adc->tx_buf, in adc12138_mode_programming() 133 .rx_buf = adc->rx_buf, in adc12138_mode_programming() 139 if (adc->id != adc12138) in adc12138_mode_programming() 142 adc->tx_buf[0] = mode; in adc12138_mode_programming() 144 ret = spi_sync_transfer(adc->spi, &xfer, 1); in adc12138_mode_programming() 148 memcpy(rx_buf, adc->rx_buf, len); in adc12138_mode_programming() [all …]
|
H A D | ti-adc084s021.c | 1 // SPDX-License-Identifier: GPL-2.0-only 5 * Driver for Texas Instruments' ADC084S021 ADC chip. 39 __be16 rx_buf[5]; /* First 16-bits are trash */ 68 * adc084s021_adc_conversion() - Read an ADC channel and return its value. 70 * @adc: The ADC SPI data. 73 static int adc084s021_adc_conversion(struct adc084s021 *adc, __be16 *data) in adc084s021_adc_conversion() argument 75 int n_words = (adc->spi_trans.len >> 1) - 1; /* Discard first word */ in adc084s021_adc_conversion() 79 ret = spi_sync(adc->spi, &adc->message); in adc084s021_adc_conversion() 84 *(data + i) = adc->rx_buf[i + 1]; in adc084s021_adc_conversion() 93 struct adc084s021 *adc = iio_priv(indio_dev); in adc084s021_read_raw() local [all …]
|
H A D | men_z188_adc.c | 1 // SPDX-License-Identifier: GPL-2.0-only 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() 100 static int men_z188_probe(struct mcb_device *dev, in men_z188_probe() argument 103 struct z188_adc *adc; in men_z188_probe() local [all …]
|
/openbmc/u-boot/drivers/adc/ |
H A D | stm32-adc.c | 1 // SPDX-License-Identifier: GPL-2.0 3 * Copyright (C) 2018, STMicroelectronics - All Rights Reserved 6 * Originally based on the Linux kernel v4.18 drivers/iio/adc/stm32-adc.c. 10 #include <adc.h> 13 #include "stm32-adc-core.h" 15 /* STM32H7 - Registers for each ADC instance */ 26 /* STM32H7_ADC_ISR - bit fields */ 31 /* STM32H7_ADC_CR - bit fields */ 43 /* STM32H7_ADC_SQR1 - bit fields */ 46 /* BOOST bit must be set on STM32H7 when ADC clock is above 20MHz */ [all …]
|
/openbmc/linux/drivers/hwmon/ |
H A D | adcxx.c | 1 // SPDX-License-Identifier: GPL-2.0-or-later 11 * ADC<bb><c>S<sss>, where 18 * http://www.national.com/ds/DC/ADC<bb><c>S<sss>.pdf 32 #include <linux/hwmon-sysfs.h> 47 static ssize_t adcxx_show(struct device *dev, in adcxx_show() argument 50 struct spi_device *spi = to_spi_device(dev); in adcxx_show() 52 struct adcxx *adc = spi_get_drvdata(spi); in adcxx_show() local 58 if (mutex_lock_interruptible(&adc->lock)) in adcxx_show() 59 return -ERESTARTSYS; in adcxx_show() 61 if (adc->channels == 1) { in adcxx_show() [all …]
|
/openbmc/u-boot/include/ |
H A D | adc.h | 1 /* SPDX-License-Identifier: GPL-2.0+ */ 10 /* ADC_CHANNEL() - ADC channel bit mask, to select only required channels */ 13 /* The last possible selected channel with 32-bit mask */ 17 * adc_data_format: define the ADC output data format, can be useful when 19 * - ADC_DATA_FORMAT_BIN - binary offset 20 * - ADC_DATA_FORMAT_2S - two's complement 31 * struct adc_channel - structure to hold channel conversion data. 32 * Useful to keep the result of a multi-channel conversion output. 34 * @id - channel id 35 * @data - channel conversion data [all …]
|
/openbmc/u-boot/test/dm/ |
H A D | adc.c | 1 // SPDX-License-Identifier: GPL-2.0+ 3 * Tests for the driver model ADC API 10 #include <adc.h> 19 #include <sandbox-adc.h> 24 struct udevice *dev; in dm_test_adc_bind() local 27 ut_assertok(uclass_get_device_by_name(UCLASS_ADC, "adc", &dev)); in dm_test_adc_bind() 28 ut_asserteq_str(SANDBOX_ADC_DEVNAME, dev->name); in dm_test_adc_bind() 30 ut_assertok(adc_channel_mask(dev, &channel_mask)); in dm_test_adc_bind() 31 ut_asserteq((1 << SANDBOX_ADC_CHANNELS) - 1, channel_mask); in dm_test_adc_bind() 39 struct udevice *dev; in dm_test_adc_wrong_channel_selection() local [all …]
|
/openbmc/u-boot/cmd/ |
H A D | adc.c | 1 // SPDX-License-Identifier: GPL-2.0+ 9 #include <adc.h> 14 struct udevice *dev; in do_adc_list() local 17 ret = uclass_first_device_err(UCLASS_ADC, &dev); in do_adc_list() 19 printf("No available ADC device\n"); in do_adc_list() 24 printf("- %s\n", dev->name); in do_adc_list() 26 ret = uclass_next_device(&dev); in do_adc_list() 29 } while (dev); in do_adc_list() 37 struct udevice *dev; in do_adc_info() local 44 ret = uclass_get_device_by_name(UCLASS_ADC, argv[1], &dev); in do_adc_info() [all …]
|
/openbmc/linux/drivers/mfd/ |
H A D | pcf50633-adc.c | 1 // SPDX-License-Identifier: GPL-2.0-or-later 2 /* NXP PCF50633 ADC Driver 4 * (C) 2006-2008 by Openmoko, Inc. 11 * NOTE: This driver does not yet support subtractive ADC mode, which means 23 #include <linux/mfd/pcf50633/adc.h> 51 return platform_get_drvdata(pcf->adc_pdev); in __to_adc() 62 /* start ADC conversion on selected channel */ in adc_setup() 69 struct pcf50633_adc *adc = __to_adc(pcf); in trigger_next_adc_job_if_any() local 72 head = adc->queue_head; in trigger_next_adc_job_if_any() 74 if (!adc->queue[head]) in trigger_next_adc_job_if_any() [all …]
|
/openbmc/linux/sound/soc/codecs/ |
H A D | rt5514.c | 1 // SPDX-License-Identifier: GPL-2.0-only 3 * rt5514.c -- RT5514 ALSA SoC audio codec driver 24 #include <sound/soc-dapm.h> 31 #include "rt5514-spi.h" 120 regmap_write(rt5514->i2c_regmap, 0x18002000, 0x000010ec); in rt5514_enable_dsp_prepare() 122 regmap_write(rt5514->i2c_regmap, 0x18002200, 0x00028604); in rt5514_enable_dsp_prepare() 124 regmap_write(rt5514->i2c_regmap, 0xfafafafa, 0x00000001); in rt5514_enable_dsp_prepare() 125 /* mini-core reset */ in rt5514_enable_dsp_prepare() 126 regmap_write(rt5514->i2c_regmap, 0x18002f00, 0x0005514b); in rt5514_enable_dsp_prepare() 127 regmap_write(rt5514->i2c_regmap, 0x18002f00, 0x00055149); in rt5514_enable_dsp_prepare() [all …]
|