mirror of
https://github.com/torvalds/linux.git
synced 2026-05-23 06:31:58 +02:00
2nd set of IIO fixes for the 6.6 cycle.
Note, given timing my expectation is these will be queued for the
6.7 merge window but they could go quicker if the 6.6 cycle ends up
being extended.
afe:
* Allow for channels with offset but no scale. In this case the scale
can be assumed to be 1.
adi,ad74115:
* Add missing dt-binding constraint on number of reset-gpios.
samsung,exynos:
* Don't request touchscreen interrupt if it is not going to be used,
getting rid of an incorrect resulting warning message.
xilinx,xadc:
* Avoid changing preset voltage and themperature thresholds as they
are typicaly set as part of FPGA image building so should be left
alone.
* Fix wrong temperature offset and scale for some devices.
-----BEGIN PGP SIGNATURE-----
iQJFBAABCAAvFiEEbilms4eEBlKRJoGxVIU0mcT0FogFAmUz5IMRHGppYzIzQGtl
cm5lbC5vcmcACgkQVIU0mcT0Foi/UQ//fCpvrlTKQ7d28WD8qLov3M1k/pYrElaa
6lULRXHOYryyQpjT92SpVcCinV5K65l1pc7hSwqrKu2Q+HZkoWFgrDU9FrvBecfG
FEvzZzv0CsbZ5HRe5n/8qHC7+fjWK08WxIwwknnIgbeMrl5nOyIM9mvJisLSTCW4
jksX+X8qrIep26ik16jNOSAddRrYLfV6U3gtlHyScnhWHHwS994YcwHusJQkkzm+
CnBV5Fos4N+d8QncFhh5SfZi9UFNal5SAeXS3NekqSHVS2zt22Pw5G7VQvFsQMLe
CLLSNarUfCWqNMdnFYIeHva7ueLcITQQpX0du6f6q2vHPIPb1zUL9Ty+Xv2KtYEa
C7qctA1aWnGJpnIluWeJiNfI/l3AOGUlsxwOH8Qq1Jqo3RNr8JKIbLTkllPsgO7R
wCIW7KZCC4hTiUfYlCvsqCWhoYqafmo2YRIZcrem3SB+xMg1P9WP2PxmAg5AA2JS
TZDkd/ISyWtfo/VXfPj1krFnrAJSAgzNIQlX4UpFaJVxP8C+0OuHV3o10rSdSpEJ
QwJ6GvJj7PBX7y1qw+HMR5omYYnrAGsH8Y9EGNlts145fFhM/+ztY5uljca733qh
F3LcS8wh2oJU4UXLllAgzeC2Yw13dAIzxme1stMvZMRa9LttoNCrWHUPb2bEEHE9
sWP1qdxLfXg=
=plX5
-----END PGP SIGNATURE-----
Merge tag 'iio-fixes-for-6.6b' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into char-misc-linus
Jonathan writes:
2nd set of IIO fixes for the 6.6 cycle.
Note, given timing my expectation is these will be queued for the
6.7 merge window but they could go quicker if the 6.6 cycle ends up
being extended.
afe:
* Allow for channels with offset but no scale. In this case the scale
can be assumed to be 1.
adi,ad74115:
* Add missing dt-binding constraint on number of reset-gpios.
samsung,exynos:
* Don't request touchscreen interrupt if it is not going to be used,
getting rid of an incorrect resulting warning message.
xilinx,xadc:
* Avoid changing preset voltage and themperature thresholds as they
are typicaly set as part of FPGA image building so should be left
alone.
* Fix wrong temperature offset and scale for some devices.
* tag 'iio-fixes-for-6.6b' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio:
iio: afe: rescale: Accept only offset channels
iio: exynos-adc: request second interupt only when touchscreen mode is used
iio: adc: xilinx-xadc: Correct temperature offset/scale for UltraScale
iio: adc: xilinx-xadc: Don't clobber preset voltage/temperature thresholds
dt-bindings: iio: add missing reset-gpios constrain
This commit is contained in:
commit
3e4a7afde4
|
|
@ -32,7 +32,8 @@ properties:
|
|||
|
||||
spi-cpol: true
|
||||
|
||||
reset-gpios: true
|
||||
reset-gpios:
|
||||
maxItems: 1
|
||||
|
||||
interrupts:
|
||||
minItems: 1
|
||||
|
|
|
|||
|
|
@ -78,7 +78,8 @@ properties:
|
|||
- const: -1000
|
||||
- const: 22000
|
||||
|
||||
reset-gpios: true
|
||||
reset-gpios:
|
||||
maxItems: 1
|
||||
|
||||
adi,dc-dc-ilim-microamp:
|
||||
enum: [150000, 200000, 250000, 300000, 350000, 400000]
|
||||
|
|
|
|||
|
|
@ -23,7 +23,8 @@ properties:
|
|||
maxItems: 1
|
||||
description: Connected to ADC_RDY pin.
|
||||
|
||||
reset-gpios: true
|
||||
reset-gpios:
|
||||
maxItems: 1
|
||||
|
||||
required:
|
||||
- compatible
|
||||
|
|
|
|||
|
|
@ -23,7 +23,8 @@ properties:
|
|||
maxItems: 1
|
||||
description: Connected to ADC_RDY pin.
|
||||
|
||||
reset-gpios: true
|
||||
reset-gpios:
|
||||
maxItems: 1
|
||||
|
||||
additionalProperties: false
|
||||
|
||||
|
|
|
|||
|
|
@ -826,16 +826,26 @@ static int exynos_adc_probe(struct platform_device *pdev)
|
|||
}
|
||||
}
|
||||
|
||||
/* leave out any TS related code if unreachable */
|
||||
if (IS_REACHABLE(CONFIG_INPUT)) {
|
||||
has_ts = of_property_read_bool(pdev->dev.of_node,
|
||||
"has-touchscreen") || pdata;
|
||||
}
|
||||
|
||||
irq = platform_get_irq(pdev, 0);
|
||||
if (irq < 0)
|
||||
return irq;
|
||||
info->irq = irq;
|
||||
|
||||
irq = platform_get_irq(pdev, 1);
|
||||
if (irq == -EPROBE_DEFER)
|
||||
return irq;
|
||||
if (has_ts) {
|
||||
irq = platform_get_irq(pdev, 1);
|
||||
if (irq == -EPROBE_DEFER)
|
||||
return irq;
|
||||
|
||||
info->tsirq = irq;
|
||||
info->tsirq = irq;
|
||||
} else {
|
||||
info->tsirq = -1;
|
||||
}
|
||||
|
||||
info->dev = &pdev->dev;
|
||||
|
||||
|
|
@ -900,12 +910,6 @@ static int exynos_adc_probe(struct platform_device *pdev)
|
|||
if (info->data->init_hw)
|
||||
info->data->init_hw(info);
|
||||
|
||||
/* leave out any TS related code if unreachable */
|
||||
if (IS_REACHABLE(CONFIG_INPUT)) {
|
||||
has_ts = of_property_read_bool(pdev->dev.of_node,
|
||||
"has-touchscreen") || pdata;
|
||||
}
|
||||
|
||||
if (pdata)
|
||||
info->delay = pdata->delay;
|
||||
else
|
||||
|
|
|
|||
|
|
@ -456,6 +456,9 @@ static const struct xadc_ops xadc_zynq_ops = {
|
|||
.interrupt_handler = xadc_zynq_interrupt_handler,
|
||||
.update_alarm = xadc_zynq_update_alarm,
|
||||
.type = XADC_TYPE_S7,
|
||||
/* Temp in C = (val * 503.975) / 2**bits - 273.15 */
|
||||
.temp_scale = 503975,
|
||||
.temp_offset = 273150,
|
||||
};
|
||||
|
||||
static const unsigned int xadc_axi_reg_offsets[] = {
|
||||
|
|
@ -566,6 +569,9 @@ static const struct xadc_ops xadc_7s_axi_ops = {
|
|||
.interrupt_handler = xadc_axi_interrupt_handler,
|
||||
.flags = XADC_FLAGS_BUFFERED | XADC_FLAGS_IRQ_OPTIONAL,
|
||||
.type = XADC_TYPE_S7,
|
||||
/* Temp in C = (val * 503.975) / 2**bits - 273.15 */
|
||||
.temp_scale = 503975,
|
||||
.temp_offset = 273150,
|
||||
};
|
||||
|
||||
static const struct xadc_ops xadc_us_axi_ops = {
|
||||
|
|
@ -577,6 +583,12 @@ static const struct xadc_ops xadc_us_axi_ops = {
|
|||
.interrupt_handler = xadc_axi_interrupt_handler,
|
||||
.flags = XADC_FLAGS_BUFFERED | XADC_FLAGS_IRQ_OPTIONAL,
|
||||
.type = XADC_TYPE_US,
|
||||
/**
|
||||
* Values below are for UltraScale+ (SYSMONE4) using internal reference.
|
||||
* See https://docs.xilinx.com/v/u/en-US/ug580-ultrascale-sysmon
|
||||
*/
|
||||
.temp_scale = 509314,
|
||||
.temp_offset = 280231,
|
||||
};
|
||||
|
||||
static int _xadc_update_adc_reg(struct xadc *xadc, unsigned int reg,
|
||||
|
|
@ -945,8 +957,7 @@ static int xadc_read_raw(struct iio_dev *indio_dev,
|
|||
*val2 = bits;
|
||||
return IIO_VAL_FRACTIONAL_LOG2;
|
||||
case IIO_TEMP:
|
||||
/* Temp in C = (val * 503.975) / 2**bits - 273.15 */
|
||||
*val = 503975;
|
||||
*val = xadc->ops->temp_scale;
|
||||
*val2 = bits;
|
||||
return IIO_VAL_FRACTIONAL_LOG2;
|
||||
default:
|
||||
|
|
@ -954,7 +965,7 @@ static int xadc_read_raw(struct iio_dev *indio_dev,
|
|||
}
|
||||
case IIO_CHAN_INFO_OFFSET:
|
||||
/* Only the temperature channel has an offset */
|
||||
*val = -((273150 << bits) / 503975);
|
||||
*val = -((xadc->ops->temp_offset << bits) / xadc->ops->temp_scale);
|
||||
return IIO_VAL_INT;
|
||||
case IIO_CHAN_INFO_SAMP_FREQ:
|
||||
ret = xadc_read_samplerate(xadc);
|
||||
|
|
@ -1423,28 +1434,6 @@ static int xadc_probe(struct platform_device *pdev)
|
|||
if (ret)
|
||||
return ret;
|
||||
|
||||
/* Disable all alarms */
|
||||
ret = xadc_update_adc_reg(xadc, XADC_REG_CONF1, XADC_CONF1_ALARM_MASK,
|
||||
XADC_CONF1_ALARM_MASK);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
/* Set thresholds to min/max */
|
||||
for (i = 0; i < 16; i++) {
|
||||
/*
|
||||
* Set max voltage threshold and both temperature thresholds to
|
||||
* 0xffff, min voltage threshold to 0.
|
||||
*/
|
||||
if (i % 8 < 4 || i == 7)
|
||||
xadc->threshold[i] = 0xffff;
|
||||
else
|
||||
xadc->threshold[i] = 0;
|
||||
ret = xadc_write_adc_reg(xadc, XADC_REG_THRESHOLD(i),
|
||||
xadc->threshold[i]);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Go to non-buffered mode */
|
||||
xadc_postdisable(indio_dev);
|
||||
|
||||
|
|
|
|||
|
|
@ -85,6 +85,8 @@ struct xadc_ops {
|
|||
|
||||
unsigned int flags;
|
||||
enum xadc_type type;
|
||||
int temp_scale;
|
||||
int temp_offset;
|
||||
};
|
||||
|
||||
static inline int _xadc_read_adc_reg(struct xadc *xadc, unsigned int reg,
|
||||
|
|
|
|||
|
|
@ -214,8 +214,18 @@ static int rescale_read_raw(struct iio_dev *indio_dev,
|
|||
return ret < 0 ? ret : -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
ret = iio_read_channel_scale(rescale->source, &scale, &scale2);
|
||||
return rescale_process_offset(rescale, ret, scale, scale2,
|
||||
if (iio_channel_has_info(rescale->source->channel,
|
||||
IIO_CHAN_INFO_SCALE)) {
|
||||
ret = iio_read_channel_scale(rescale->source, &scale, &scale2);
|
||||
return rescale_process_offset(rescale, ret, scale, scale2,
|
||||
schan_off, val, val2);
|
||||
}
|
||||
|
||||
/*
|
||||
* If we get here we have no scale so scale 1:1 but apply
|
||||
* rescaler and offset, if any.
|
||||
*/
|
||||
return rescale_process_offset(rescale, IIO_VAL_FRACTIONAL, 1, 1,
|
||||
schan_off, val, val2);
|
||||
default:
|
||||
return -EINVAL;
|
||||
|
|
@ -280,8 +290,9 @@ static int rescale_configure_channel(struct device *dev,
|
|||
chan->type = rescale->cfg->type;
|
||||
|
||||
if (iio_channel_has_info(schan, IIO_CHAN_INFO_RAW) &&
|
||||
iio_channel_has_info(schan, IIO_CHAN_INFO_SCALE)) {
|
||||
dev_info(dev, "using raw+scale source channel\n");
|
||||
(iio_channel_has_info(schan, IIO_CHAN_INFO_SCALE) ||
|
||||
iio_channel_has_info(schan, IIO_CHAN_INFO_OFFSET))) {
|
||||
dev_info(dev, "using raw+scale/offset source channel\n");
|
||||
} else if (iio_channel_has_info(schan, IIO_CHAN_INFO_PROCESSED)) {
|
||||
dev_info(dev, "using processed channel\n");
|
||||
rescale->chan_processed = true;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user