/linux-4.19.296/drivers/iio/adc/ |
D | palmas_gpadc.c | 143 static int palmas_disable_auto_conversion(struct palmas_gpadc *adc) in palmas_disable_auto_conversion() argument 147 ret = palmas_update_bits(adc->palmas, PALMAS_GPADC_BASE, in palmas_disable_auto_conversion() 152 dev_err(adc->dev, "GPADC_CTRL1 update failed: %d\n", ret); in palmas_disable_auto_conversion() 156 ret = palmas_update_bits(adc->palmas, PALMAS_GPADC_BASE, in palmas_disable_auto_conversion() 162 dev_err(adc->dev, "AUTO_CTRL update failed: %d\n", ret); in palmas_disable_auto_conversion() 168 ret = palmas_update_bits(adc->palmas, PALMAS_GPADC_BASE, in palmas_disable_auto_conversion() 172 dev_err(adc->dev, "GPADC_CTRL1 update failed: %d\n", ret); in palmas_disable_auto_conversion() 179 struct palmas_gpadc *adc = data; in palmas_gpadc_irq() local 181 complete(&adc->conv_completion); in palmas_gpadc_irq() 188 struct palmas_gpadc *adc = data; in palmas_gpadc_irq_auto() local [all …]
|
D | stm32-adc.c | 448 static u32 stm32_adc_readl(struct stm32_adc *adc, u32 reg) in stm32_adc_readl() argument 450 return readl_relaxed(adc->common->base + adc->offset + reg); in stm32_adc_readl() 453 #define stm32_adc_readl_addr(addr) stm32_adc_readl(adc, addr) 459 static u16 stm32_adc_readw(struct stm32_adc *adc, u32 reg) in stm32_adc_readw() argument 461 return readw_relaxed(adc->common->base + adc->offset + reg); in stm32_adc_readw() 464 static void stm32_adc_writel(struct stm32_adc *adc, u32 reg, u32 val) in stm32_adc_writel() argument 466 writel_relaxed(val, adc->common->base + adc->offset + reg); in stm32_adc_writel() 469 static void stm32_adc_set_bits(struct stm32_adc *adc, u32 reg, u32 bits) in stm32_adc_set_bits() argument 473 spin_lock_irqsave(&adc->lock, flags); in stm32_adc_set_bits() 474 stm32_adc_writel(adc, reg, stm32_adc_readl(adc, reg) | bits); in stm32_adc_set_bits() [all …]
|
D | ti-adc12138.c | 130 static int adc12138_mode_programming(struct adc12138 *adc, u8 mode, in adc12138_mode_programming() argument 134 .tx_buf = adc->tx_buf, in adc12138_mode_programming() 135 .rx_buf = adc->rx_buf, in adc12138_mode_programming() 141 if (adc->id != adc12138) in adc12138_mode_programming() 144 adc->tx_buf[0] = mode; in adc12138_mode_programming() 146 ret = spi_sync_transfer(adc->spi, &xfer, 1); in adc12138_mode_programming() 150 memcpy(rx_buf, adc->rx_buf, len); in adc12138_mode_programming() 155 static int adc12138_read_status(struct adc12138 *adc) in adc12138_read_status() argument 160 ret = adc12138_mode_programming(adc, ADC12138_MODE_READ_STATUS, in adc12138_read_status() 168 static int __adc12138_start_conv(struct adc12138 *adc, in __adc12138_start_conv() argument [all …]
|
D | stm32-dfsdm-adc.c | 376 struct stm32_dfsdm_adc *adc = iio_priv(indio_dev); in dfsdm_adc_audio_get_spiclk() local 378 return snprintf(buf, PAGE_SIZE, "%d\n", adc->spi_freq); in dfsdm_adc_audio_get_spiclk() 386 struct stm32_dfsdm_adc *adc = iio_priv(indio_dev); in dfsdm_adc_audio_set_spiclk() local 387 struct stm32_dfsdm_filter *fl = &adc->dfsdm->fl_list[adc->fl_id]; in dfsdm_adc_audio_set_spiclk() 388 struct stm32_dfsdm_channel *ch = &adc->dfsdm->ch_list[chan->channel]; in dfsdm_adc_audio_set_spiclk() 389 unsigned int sample_freq = adc->sample_freq; in dfsdm_adc_audio_set_spiclk() 418 adc->spi_freq = spi_freq; in dfsdm_adc_audio_set_spiclk() 423 static int stm32_dfsdm_start_conv(struct stm32_dfsdm_adc *adc, in stm32_dfsdm_start_conv() argument 427 struct regmap *regmap = adc->dfsdm->regmap; in stm32_dfsdm_start_conv() 431 ret = stm32_dfsdm_start_channel(adc->dfsdm, chan->channel); in stm32_dfsdm_start_conv() [all …]
|
D | mcp320x.c | 122 static int mcp320x_adc_conversion(struct mcp320x *adc, u8 channel, in mcp320x_adc_conversion() argument 127 if (adc->chip_info->conv_time) { in mcp320x_adc_conversion() 128 ret = spi_sync(adc->spi, &adc->start_conv_msg); in mcp320x_adc_conversion() 132 usleep_range(adc->chip_info->conv_time, in mcp320x_adc_conversion() 133 adc->chip_info->conv_time + 100); in mcp320x_adc_conversion() 136 memset(&adc->rx_buf, 0, sizeof(adc->rx_buf)); in mcp320x_adc_conversion() 137 if (adc->chip_info->num_channels > 1) in mcp320x_adc_conversion() 138 adc->tx_buf = mcp320x_channel_to_tx_data(device_index, channel, in mcp320x_adc_conversion() 141 ret = spi_sync(adc->spi, &adc->msg); in mcp320x_adc_conversion() 147 *val = (adc->rx_buf[0] << 5 | adc->rx_buf[1] >> 3); in mcp320x_adc_conversion() [all …]
|
D | ti-adc0832.c | 122 static int adc0831_adc_conversion(struct adc0832 *adc) in adc0831_adc_conversion() argument 124 struct spi_device *spi = adc->spi; in adc0831_adc_conversion() 127 ret = spi_read(spi, &adc->rx_buf, 2); in adc0831_adc_conversion() 134 return (adc->rx_buf[0] << 2 & 0xff) | (adc->rx_buf[1] >> 6); in adc0831_adc_conversion() 137 static int adc0832_adc_conversion(struct adc0832 *adc, int channel, in adc0832_adc_conversion() argument 140 struct spi_device *spi = adc->spi; in adc0832_adc_conversion() 142 .tx_buf = adc->tx_buf, in adc0832_adc_conversion() 143 .rx_buf = adc->rx_buf, in adc0832_adc_conversion() 148 if (!adc->mux_bits) in adc0832_adc_conversion() 149 return adc0831_adc_conversion(adc); in adc0832_adc_conversion() [all …]
|
D | ti-adc084s021.c | 75 static int adc084s021_adc_conversion(struct adc084s021 *adc, void *data) in adc084s021_adc_conversion() argument 77 int n_words = (adc->spi_trans.len >> 1) - 1; /* Discard first word */ in adc084s021_adc_conversion() 82 ret = spi_sync(adc->spi, &adc->message); in adc084s021_adc_conversion() 87 *(p + i) = adc->rx_buf[i + 1]; in adc084s021_adc_conversion() 96 struct adc084s021 *adc = iio_priv(indio_dev); in adc084s021_read_raw() local 105 ret = regulator_enable(adc->reg); in adc084s021_read_raw() 111 adc->tx_buf[0] = channel->channel << 3; in adc084s021_read_raw() 112 ret = adc084s021_adc_conversion(adc, val); in adc084s021_read_raw() 114 regulator_disable(adc->reg); in adc084s021_read_raw() 123 ret = regulator_enable(adc->reg); in adc084s021_read_raw() [all …]
|
D | lpc18xx_adc.c | 73 static int lpc18xx_adc_read_chan(struct lpc18xx_adc *adc, unsigned int ch) in lpc18xx_adc_read_chan() argument 78 reg = adc->cr_reg | BIT(ch) | LPC18XX_ADC_CR_START_NOW; in lpc18xx_adc_read_chan() 79 writel(reg, adc->base + LPC18XX_ADC_CR); in lpc18xx_adc_read_chan() 81 ret = readl_poll_timeout(adc->base + LPC18XX_ADC_GDR, reg, in lpc18xx_adc_read_chan() 84 dev_warn(adc->dev, "adc read timed out\n"); in lpc18xx_adc_read_chan() 95 struct lpc18xx_adc *adc = iio_priv(indio_dev); in lpc18xx_adc_read_raw() local 99 mutex_lock(&adc->lock); in lpc18xx_adc_read_raw() 100 *val = lpc18xx_adc_read_chan(adc, chan->channel); in lpc18xx_adc_read_raw() 101 mutex_unlock(&adc->lock); in lpc18xx_adc_read_raw() 108 *val = regulator_get_voltage(adc->vref) / 1000; in lpc18xx_adc_read_raw() [all …]
|
D | mxs-lradc-adc.c | 143 struct mxs_lradc_adc *adc = iio_priv(iio_dev); in mxs_lradc_adc_read_single() local 144 struct mxs_lradc *lradc = adc->lradc; in mxs_lradc_adc_read_single() 157 reinit_completion(&adc->completion); in mxs_lradc_adc_read_single() 166 adc->base + LRADC_CTRL1 + STMP_OFFSET_REG_CLR); in mxs_lradc_adc_read_single() 167 writel(0x1, adc->base + LRADC_CTRL0 + STMP_OFFSET_REG_CLR); in mxs_lradc_adc_read_single() 170 if (test_bit(chan, &adc->is_divided)) in mxs_lradc_adc_read_single() 172 adc->base + LRADC_CTRL2 + STMP_OFFSET_REG_SET); in mxs_lradc_adc_read_single() 175 adc->base + LRADC_CTRL2 + STMP_OFFSET_REG_CLR); in mxs_lradc_adc_read_single() 179 adc->base + LRADC_CTRL4 + STMP_OFFSET_REG_CLR); in mxs_lradc_adc_read_single() 180 writel(chan, adc->base + LRADC_CTRL4 + STMP_OFFSET_REG_SET); in mxs_lradc_adc_read_single() [all …]
|
D | qcom-pm8xxx-xoadc.c | 416 struct pm8xxx_xoadc *adc = iio_priv(indio_dev); in pm8xxx_eoc_irq() local 418 complete(&adc->complete); in pm8xxx_eoc_irq() 424 pm8xxx_get_channel(struct pm8xxx_xoadc *adc, u8 chan) in pm8xxx_get_channel() argument 428 for (i = 0; i < adc->nchans; i++) { in pm8xxx_get_channel() 429 struct pm8xxx_chan_info *ch = &adc->chans[i]; in pm8xxx_get_channel() 436 static int pm8xxx_read_channel_rsv(struct pm8xxx_xoadc *adc, in pm8xxx_read_channel_rsv() argument 446 dev_dbg(adc->dev, "read channel \"%s\", amux %d, prescale/mux: %d, rsv %d\n", in pm8xxx_read_channel_rsv() 449 mutex_lock(&adc->lock); in pm8xxx_read_channel_rsv() 454 ret = regmap_write(adc->map, ADC_ARB_USRP_AMUX_CNTRL, val); in pm8xxx_read_channel_rsv() 461 if (adc->variant->broken_ratiometric && !force_ratiometric) { in pm8xxx_read_channel_rsv() [all …]
|
D | ti-adc128s052.c | 35 static int adc128_adc_conversion(struct adc128 *adc, u8 channel) in adc128_adc_conversion() argument 39 mutex_lock(&adc->lock); in adc128_adc_conversion() 41 adc->buffer[0] = channel << 3; in adc128_adc_conversion() 42 adc->buffer[1] = 0; in adc128_adc_conversion() 44 ret = spi_write(adc->spi, &adc->buffer, 2); in adc128_adc_conversion() 46 mutex_unlock(&adc->lock); in adc128_adc_conversion() 50 ret = spi_read(adc->spi, &adc->buffer, 2); in adc128_adc_conversion() 52 mutex_unlock(&adc->lock); in adc128_adc_conversion() 57 return ((adc->buffer[0] << 8 | adc->buffer[1]) & 0xFFF); in adc128_adc_conversion() 64 struct adc128 *adc = iio_priv(indio_dev); in adc128_read_raw() local [all …]
|
D | mcp3422.c | 98 static int mcp3422_update_config(struct mcp3422 *adc, u8 newconfig) in mcp3422_update_config() argument 102 ret = i2c_master_send(adc->i2c, &newconfig, 1); in mcp3422_update_config() 104 adc->config = newconfig; in mcp3422_update_config() 111 static int mcp3422_read(struct mcp3422 *adc, int *value, u8 *config) in mcp3422_read() argument 114 u8 sample_rate = MCP3422_SAMPLE_RATE(adc->config); in mcp3422_read() 119 ret = i2c_master_recv(adc->i2c, buf, 4); in mcp3422_read() 123 ret = i2c_master_recv(adc->i2c, buf, 3); in mcp3422_read() 133 static int mcp3422_read_channel(struct mcp3422 *adc, in mcp3422_read_channel() argument 140 mutex_lock(&adc->lock); in mcp3422_read_channel() 142 if (req_channel != MCP3422_CHANNEL(adc->config)) { in mcp3422_read_channel() [all …]
|
D | max1118.c | 74 struct max1118 *adc = iio_priv(indio_dev); in max1118_read() local 95 .rx_buf = &adc->data, in max1118_read() 109 return adc->data; in max1118_read() 115 struct max1118 *adc = iio_priv(indio_dev); in max1118_get_vref_mV() local 125 vref_uV = regulator_get_voltage(adc->reg); in max1118_get_vref_mV() 138 struct max1118 *adc = iio_priv(indio_dev); in max1118_read_raw() local 142 mutex_lock(&adc->lock); in max1118_read_raw() 143 *val = max1118_read(adc->spi, chan->channel); in max1118_read_raw() 144 mutex_unlock(&adc->lock); in max1118_read_raw() 150 *val = max1118_get_vref_mV(adc->spi); in max1118_read_raw() [all …]
|
D | ti-adc081c.c | 53 struct adc081c *adc = iio_priv(iio); in adc081c_read_raw() local 58 err = i2c_smbus_read_word_swapped(adc->i2c, REG_CONV_RES); in adc081c_read_raw() 62 *value = (err & 0xFFF) >> (12 - adc->bits); in adc081c_read_raw() 66 err = regulator_get_voltage(adc->ref); in adc081c_read_raw() 71 *shift = adc->bits; in adc081c_read_raw() 157 struct adc081c *adc; in adc081c_probe() local 176 iio = devm_iio_device_alloc(&client->dev, sizeof(*adc)); in adc081c_probe() 180 adc = iio_priv(iio); in adc081c_probe() 181 adc->i2c = client; in adc081c_probe() 182 adc->bits = model->bits; in adc081c_probe() [all …]
|
D | lp8788_adc.c | 51 static int lp8788_get_adc_result(struct lp8788_adc *adc, enum lp8788_adc_id id, in lp8788_get_adc_result() argument 64 ret = lp8788_write_byte(adc->lp, LP8788_ADC_CONF, data); in lp8788_get_adc_result() 73 ret = lp8788_read_byte(adc->lp, LP8788_ADC_DONE, &data); in lp8788_get_adc_result() 82 ret = lp8788_read_multi_bytes(adc->lp, LP8788_ADC_RAW, rawdata, size); in lp8788_get_adc_result() 101 struct lp8788_adc *adc = iio_priv(indio_dev); in lp8788_adc_read_raw() local 105 mutex_lock(&adc->lock); in lp8788_adc_read_raw() 109 ret = lp8788_get_adc_result(adc, id, val) ? -EIO : IIO_VAL_INT; in lp8788_adc_read_raw() 121 mutex_unlock(&adc->lock); in lp8788_adc_read_raw() 171 struct lp8788_adc *adc) in lp8788_iio_map_register() argument 185 adc->map = map; in lp8788_iio_map_register() [all …]
|
D | men_z188_adc.c | 56 struct z188_adc *adc = iio_priv(iio_dev); in z188_iio_read_raw() local 62 tmp = readw(adc->base + chan->channel * 4); in z188_iio_read_raw() 106 struct z188_adc *adc; in men_z188_probe() local 115 adc = iio_priv(indio_dev); in men_z188_probe() 127 adc->base = ioremap(mem->start, resource_size(mem)); in men_z188_probe() 128 if (adc->base == NULL) in men_z188_probe() 131 men_z188_config_channels(adc->base); in men_z188_probe() 133 adc->mem = mem; in men_z188_probe() 143 iounmap(adc->base); in men_z188_probe() 152 struct z188_adc *adc = iio_priv(indio_dev); in men_z188_remove() local [all …]
|
D | viperboard_adc.c | 61 struct vprbrd_adc *adc = iio_priv(iio_dev); in vprbrd_iio_read_raw() local 62 struct vprbrd *vb = adc->vb; in vprbrd_iio_read_raw() 115 struct vprbrd_adc *adc; in vprbrd_adc_probe() local 120 indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*adc)); in vprbrd_adc_probe() 126 adc = iio_priv(indio_dev); in vprbrd_adc_probe() 127 adc->vb = vb; in vprbrd_adc_probe()
|
D | Makefile | 24 obj-$(CONFIG_BERLIN2_ADC) += berlin2-adc.o 26 obj-$(CONFIG_CPCAP_ADC) += cpcap-adc.o 28 obj-$(CONFIG_DLN2_ADC) += dln2-adc.o 36 obj-$(CONFIG_INA2XX_ADC) += ina2xx-adc.o 53 obj-$(CONFIG_MXS_LRADC_ADC) += mxs-lradc-adc.o 66 obj-$(CONFIG_STM32_ADC_CORE) += stm32-adc-core.o 67 obj-$(CONFIG_STM32_ADC) += stm32-adc.o 69 obj-$(CONFIG_STM32_DFSDM_ADC) += stm32-dfsdm-adc.o
|
/linux-4.19.296/drivers/iio/common/ms_sensors/ |
D | ms_sensors_i2c.c | 106 unsigned int delay, u32 *adc) in ms_sensors_convert_and_read() argument 127 *adc = be32_to_cpu(buf) >> 8; in ms_sensors_convert_and_read() 422 u32 adc; in ms_sensors_ht_read_temperature() local 430 delay, &adc); in ms_sensors_ht_read_temperature() 435 if (!ms_sensors_crc_valid(adc)) { in ms_sensors_ht_read_temperature() 442 *temperature = (((s64)(adc >> 8) * 175720) >> 16) - 46850; in ms_sensors_ht_read_temperature() 463 u32 adc; in ms_sensors_ht_read_humidity() local 471 delay, &adc); in ms_sensors_ht_read_humidity() 476 if (!ms_sensors_crc_valid(adc)) { in ms_sensors_ht_read_humidity() 483 *humidity = (((s32)(adc >> 8) * 12500) >> 16) * 10 - 6000; in ms_sensors_ht_read_humidity()
|
/linux-4.19.296/drivers/extcon/ |
D | extcon-max8997.c | 257 int adc; in max8997_muic_get_cable_type() local 266 adc = info->status[0] & STATUS1_ADC_MASK; in max8997_muic_get_cable_type() 267 adc >>= STATUS1_ADC_SHIFT; in max8997_muic_get_cable_type() 274 if (adc == MAX8997_MUIC_ADC_OPEN) { in max8997_muic_get_cable_type() 282 cable_type = info->prev_cable_type = adc; in max8997_muic_get_cable_type() 472 int adc; in max8997_muic_chg_handler() local 481 adc = info->status[0] & STATUS1_ADC_MASK; in max8997_muic_chg_handler() 482 adc >>= STATUS1_ADC_SHIFT; in max8997_muic_chg_handler() 484 if ((adc & STATUS1_ADC_MASK) == MAX8997_MUIC_ADC_OPEN) { in max8997_muic_chg_handler() 584 int adc; in max8997_muic_detect_dev() local [all …]
|
D | extcon-max77693.c | 322 int adc; in max77693_muic_get_cable_type() local 334 adc = info->status[0] & MAX77693_STATUS1_ADC_MASK; in max77693_muic_get_cable_type() 335 adc >>= MAX77693_STATUS1_ADC_SHIFT; in max77693_muic_get_cable_type() 342 if (adc == MAX77693_MUIC_ADC_OPEN) { in max77693_muic_get_cable_type() 350 cable_type = info->prev_cable_type = adc; in max77693_muic_get_cable_type() 358 adc = info->status[0] & MAX77693_STATUS1_ADC_MASK; in max77693_muic_get_cable_type() 359 adc >>= MAX77693_STATUS1_ADC_SHIFT; in max77693_muic_get_cable_type() 366 if (adc == MAX77693_MUIC_ADC_OPEN) { in max77693_muic_get_cable_type() 395 info->prev_cable_type = adc; in max77693_muic_get_cable_type() 430 adc = info->status[0] & MAX77693_STATUS1_ADC_MASK; in max77693_muic_get_cable_type() [all …]
|
D | extcon-max14577.c | 267 int adc; in max14577_muic_get_cable_type() local 276 adc = info->status[MAX14577_MUIC_STATUS1] & STATUS1_ADC_MASK; in max14577_muic_get_cable_type() 277 adc >>= STATUS1_ADC_SHIFT; in max14577_muic_get_cable_type() 284 if (adc == MAX14577_MUIC_ADC_OPEN) { in max14577_muic_get_cable_type() 292 cable_type = info->prev_cable_type = adc; in max14577_muic_get_cable_type() 615 int adc; in max14577_muic_detect_accessory() local 630 adc = max14577_muic_get_cable_type(info, MAX14577_CABLE_GROUP_ADC, in max14577_muic_detect_accessory() 632 if (attached && adc != MAX14577_MUIC_ADC_OPEN) { in max14577_muic_detect_accessory()
|
D | extcon-max77843.c | 269 int adc, chg_type, cable_type, gnd_type; in max77843_muic_get_cable_type() local 271 adc = info->status[MAX77843_MUIC_STATUS1] & in max77843_muic_get_cable_type() 273 adc >>= MAX77843_MUIC_STATUS1_ADC_SHIFT; in max77843_muic_get_cable_type() 277 if (adc == MAX77843_MUIC_ADC_OPEN) { in max77843_muic_get_cable_type() 283 cable_type = info->prev_cable_type = adc; in max77843_muic_get_cable_type() 291 if (adc == MAX77843_MUIC_ADC_GROUND) { in max77843_muic_get_cable_type() 314 if (adc == MAX77843_MUIC_ADC_RESERVED_ACC_3) { /* SmartDock */ in max77843_muic_get_cable_type() 337 if (adc == MAX77843_MUIC_ADC_OPEN) { in max77843_muic_get_cable_type() 713 int chg_type, adc, ret; in max77843_muic_detect_cable_wq() local 726 adc = max77843_muic_get_cable_type(info, in max77843_muic_detect_cable_wq() [all …]
|
/linux-4.19.296/drivers/iio/light/ |
D | si1133.c | 530 static int si1133_set_integration_time(struct si1133_data *data, u8 adc, in si1133_set_integration_time() argument 539 data->adc_sens[adc] &= 0xF0; in si1133_set_integration_time() 540 data->adc_sens[adc] |= index; in si1133_set_integration_time() 543 data->adc_sens[adc]); in si1133_set_integration_time() 557 static int si1133_chan_set_adcconfig(struct si1133_data *data, u8 adc, in si1133_chan_set_adcconfig() argument 562 err = si1133_param_set(data, SI1133_PARAM_REG_ADCCONFIG(adc), in si1133_chan_set_adcconfig() 567 data->adc_config[adc] = adc_config; in si1133_chan_set_adcconfig() 572 static int si1133_update_adcconfig(struct si1133_data *data, uint8_t adc, in si1133_update_adcconfig() argument 578 err = si1133_param_query(data, SI1133_PARAM_REG_ADCCONFIG(adc), in si1133_update_adcconfig() 586 return si1133_chan_set_adcconfig(data, adc, adc_config); in si1133_update_adcconfig() [all …]
|
/linux-4.19.296/drivers/iio/temperature/ |
D | tsys01.c | 36 unsigned int delay, u32 *adc); 50 u32 adc; in tsys01_read_temperature() local 57 TSYS01_ADC_READ, 9000, &adc); in tsys01_read_temperature() 62 adc >>= 8; in tsys01_read_temperature() 68 temp *= (s64)adc; in tsys01_read_temperature()
|