Skip to content

Commit 040bf7d

Browse files
committed
Merge tag 'iio-for-3.17d' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next
Jonathan writes: Fourth round of IIO new drivers, functionality and cleanups for the 3.17 cycle New functionality * A new modifier to indicate that a rotation is relative to either true or magnetic north. This is to be used by some magnetometers that provide data in this way. * hid magnetometer now supports output rotations from various variants on North * HMC5843 driver converted to regmap and reworked to allow easy support of other similar devices. Support for HMC5983 added via both i2c and SPI. * Rework of Exynos driver to simplify extension to support more devices. * Addition of support for the Exynos3250 ADC (which requires an additional clock) Support for quite a few more devices on its way. Cleanups * ad7997 - a number of cleanups and tweaks to how the events are controlled to make it more intuitive. * kxcjk - cleanups and minor fixes for this new driver.
2 parents 16fae05 + e6ca2d8 commit 040bf7d

16 files changed

Lines changed: 1262 additions & 503 deletions

File tree

‎Documentation/ABI/testing/sysfs-bus-iio‎

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,10 @@ What: /sys/bus/iio/devices/iio:deviceX/in_magn_scale
260260
What: /sys/bus/iio/devices/iio:deviceX/in_magn_x_scale
261261
What: /sys/bus/iio/devices/iio:deviceX/in_magn_y_scale
262262
What: /sys/bus/iio/devices/iio:deviceX/in_magn_z_scale
263+
What: /sys/bus/iio/devices/iio:deviceX/in_rot_from_north_magnetic_scale
264+
What: /sys/bus/iio/devices/iio:deviceX/in_rot_from_north_true_scale
265+
What: /sys/bus/iio/devices/iio:deviceX/in_rot_from_north_magnetic_tilt_comp_scale
266+
What: /sys/bus/iio/devices/iio:deviceX/in_rot_from_north_true_tilt_comp_scale
263267
What: /sys/bus/iio/devices/iio:deviceX/in_pressureY_scale
264268
What: /sys/bus/iio/devices/iio:deviceX/in_pressure_scale
265269
KernelVersion: 2.6.35
@@ -447,6 +451,14 @@ What: /sys/.../iio:deviceX/events/in_magn_y_thresh_rising_en
447451
What: /sys/.../iio:deviceX/events/in_magn_y_thresh_falling_en
448452
What: /sys/.../iio:deviceX/events/in_magn_z_thresh_rising_en
449453
What: /sys/.../iio:deviceX/events/in_magn_z_thresh_falling_en
454+
What: /sys/.../iio:deviceX/events/in_rot_from_north_magnetic_thresh_rising_en
455+
What: /sys/.../iio:deviceX/events/in_rot_from_north_magnetic_thresh_falling_en
456+
What: /sys/.../iio:deviceX/events/in_rot_from_north_true_thresh_rising_en
457+
What: /sys/.../iio:deviceX/events/in_rot_from_north_true_thresh_falling_en
458+
What: /sys/.../iio:deviceX/events/in_rot_from_north_magnetic_tilt_comp_thresh_rising_en
459+
What: /sys/.../iio:deviceX/events/in_rot_from_north_magnetic_tilt_comp_thresh_falling_en
460+
What: /sys/.../iio:deviceX/events/in_rot_from_north_true_tilt_comp_thresh_rising_en
461+
What: /sys/.../iio:deviceX/events/in_rot_from_north_true_tilt_comp_thresh_falling_en
450462
What: /sys/.../iio:deviceX/events/in_voltageY_supply_thresh_rising_en
451463
What: /sys/.../iio:deviceX/events/in_voltageY_supply_thresh_falling_en
452464
What: /sys/.../iio:deviceX/events/in_voltageY_thresh_rising_en
@@ -492,6 +504,14 @@ What: /sys/.../iio:deviceX/events/in_magn_y_roc_rising_en
492504
What: /sys/.../iio:deviceX/events/in_magn_y_roc_falling_en
493505
What: /sys/.../iio:deviceX/events/in_magn_z_roc_rising_en
494506
What: /sys/.../iio:deviceX/events/in_magn_z_roc_falling_en
507+
What: /sys/.../iio:deviceX/events/in_rot_from_north_magnetic_roc_rising_en
508+
What: /sys/.../iio:deviceX/events/in_rot_from_north_magnetic_roc_falling_en
509+
What: /sys/.../iio:deviceX/events/in_rot_from_north_true_roc_rising_en
510+
What: /sys/.../iio:deviceX/events/in_rot_from_north_true_roc_falling_en
511+
What: /sys/.../iio:deviceX/events/in_rot_from_north_magnetic_tilt_comp_roc_rising_en
512+
What: /sys/.../iio:deviceX/events/in_rot_from_north_magnetic_tilt_comp_roc_falling_en
513+
What: /sys/.../iio:deviceX/events/in_rot_from_north_true_tilt_comp_roc_rising_en
514+
What: /sys/.../iio:deviceX/events/in_rot_from_north_true_tilt_comp_roc_falling_en
495515
What: /sys/.../iio:deviceX/events/in_voltageY_supply_roc_rising_en
496516
What: /sys/.../iio:deviceX/events/in_voltageY_supply_roc_falling_en
497517
What: /sys/.../iio:deviceX/events/in_voltageY_roc_rising_en
@@ -538,6 +558,14 @@ What: /sys/.../events/in_magn_y_raw_thresh_rising_value
538558
What: /sys/.../events/in_magn_y_raw_thresh_falling_value
539559
What: /sys/.../events/in_magn_z_raw_thresh_rising_value
540560
What: /sys/.../events/in_magn_z_raw_thresh_falling_value
561+
What: /sys/.../events/in_rot_from_north_magnetic_raw_thresh_rising_value
562+
What: /sys/.../events/in_rot_from_north_magnetic_raw_thresh_falling_value
563+
What: /sys/.../events/in_rot_from_north_true_raw_thresh_rising_value
564+
What: /sys/.../events/in_rot_from_north_true_raw_thresh_falling_value
565+
What: /sys/.../events/in_rot_from_north_magnetic_tilt_comp_raw_thresh_rising_value
566+
What: /sys/.../events/in_rot_from_north_magnetic_tilt_comp_raw_thresh_falling_value
567+
What: /sys/.../events/in_rot_from_north_true_tilt_comp_raw_thresh_rising_value
568+
What: /sys/.../events/in_rot_from_north_true_tilt_comp_raw_thresh_falling_value
541569
What: /sys/.../events/in_voltageY_supply_raw_thresh_rising_value
542570
What: /sys/.../events/in_voltageY_supply_raw_thresh_falling_value
543571
What: /sys/.../events/in_voltageY_raw_thresh_rising_value
@@ -588,6 +616,18 @@ What: /sys/.../events/in_magn_y_thresh_either_hysteresis
588616
What: /sys/.../events/in_magn_z_thresh_rising_hysteresis
589617
What: /sys/.../events/in_magn_z_thresh_falling_hysteresis
590618
What: /sys/.../events/in_magn_z_thresh_either_hysteresis
619+
What: /sys/.../events/in_rot_from_north_magnetic_thresh_rising_hysteresis
620+
What: /sys/.../events/in_rot_from_north_magnetic_thresh_falling_hysteresis
621+
What: /sys/.../events/in_rot_from_north_magnetic_thresh_either_hysteresis
622+
What: /sys/.../events/in_rot_from_north_true_thresh_rising_hysteresis
623+
What: /sys/.../events/in_rot_from_north_true_thresh_falling_hysteresis
624+
What: /sys/.../events/in_rot_from_north_true_thresh_either_hysteresis
625+
What: /sys/.../events/in_rot_from_north_magnetic_tilt_comp_thresh_rising_hysteresis
626+
What: /sys/.../events/in_rot_from_north_magnetic_tilt_comp_thresh_falling_hysteresis
627+
What: /sys/.../events/in_rot_from_north_magnetic_tilt_comp_thresh_either_hysteresis
628+
What: /sys/.../events/in_rot_from_north_true_tilt_comp_thresh_rising_hysteresis
629+
What: /sys/.../events/in_rot_from_north_true_tilt_comp_thresh_falling_hysteresis
630+
What: /sys/.../events/in_rot_from_north_true_tilt_comp_thresh_either_hysteresis
591631
What: /sys/.../events/in_voltageY_thresh_rising_hysteresis
592632
What: /sys/.../events/in_voltageY_thresh_falling_hysteresis
593633
What: /sys/.../events/in_voltageY_thresh_either_hysteresis
@@ -635,6 +675,14 @@ What: /sys/.../events/in_magn_y_raw_roc_rising_value
635675
What: /sys/.../events/in_magn_y_raw_roc_falling_value
636676
What: /sys/.../events/in_magn_z_raw_roc_rising_value
637677
What: /sys/.../events/in_magn_z_raw_roc_falling_value
678+
What: /sys/.../events/in_rot_from_north_magnetic_raw_roc_rising_value
679+
What: /sys/.../events/in_rot_from_north_magnetic_raw_roc_falling_value
680+
What: /sys/.../events/in_rot_from_north_true_raw_roc_rising_value
681+
What: /sys/.../events/in_rot_from_north_true_raw_roc_falling_value
682+
What: /sys/.../events/in_rot_from_north_magnetic_tilt_comp_raw_roc_rising_value
683+
What: /sys/.../events/in_rot_from_north_magnetic_tilt_comp_raw_roc_falling_value
684+
What: /sys/.../events/in_rot_from_north_true_tilt_comp_raw_roc_rising_value
685+
What: /sys/.../events/in_rot_from_north_true_tilt_comp_raw_roc_falling_value
638686
What: /sys/.../events/in_voltageY_supply_raw_roc_rising_value
639687
What: /sys/.../events/in_voltageY_supply_raw_roc_falling_value
640688
What: /sys/.../events/in_voltageY_raw_roc_rising_value
@@ -690,6 +738,22 @@ What: /sys/.../events/in_magn_z_thresh_rising_period
690738
What: /sys/.../events/in_magn_z_thresh_falling_period
691739
What: /sys/.../events/in_magn_z_roc_rising_period
692740
What: /sys/.../events/in_magn_z_roc_falling_period
741+
What: /sys/.../events/in_rot_from_north_magnetic_thresh_rising_period
742+
What: /sys/.../events/in_rot_from_north_magnetic_thresh_falling_period
743+
What: /sys/.../events/in_rot_from_north_magnetic_roc_rising_period
744+
What: /sys/.../events/in_rot_from_north_magnetic_roc_falling_period
745+
What: /sys/.../events/in_rot_from_north_true_thresh_rising_period
746+
What: /sys/.../events/in_rot_from_north_true_thresh_falling_period
747+
What: /sys/.../events/in_rot_from_north_true_roc_rising_period
748+
What: /sys/.../events/in_rot_from_north_true_roc_falling_period
749+
What: /sys/.../events/in_rot_from_north_magnetic_tilt_comp_thresh_rising_period
750+
What: /sys/.../events/in_rot_from_north_magnetic_tilt_comp_thresh_falling_period
751+
What: /sys/.../events/in_rot_from_north_magnetic_tilt_comp_roc_rising_period
752+
What: /sys/.../events/in_rot_from_north_magnetic_tilt_comp_roc_falling_period
753+
What: /sys/.../events/in_rot_from_north_true_tilt_comp_thresh_rising_period
754+
What: /sys/.../events/in_rot_from_north_true_tilt_comp_thresh_falling_period
755+
What: /sys/.../events/in_rot_from_north_true_tilt_comp_roc_rising_period
756+
What: /sys/.../events/in_rot_from_north_true_tilt_comp_roc_falling_period
693757
What: /sys/.../events/in_voltageY_supply_thresh_rising_period
694758
What: /sys/.../events/in_voltageY_supply_thresh_falling_period
695759
What: /sys/.../events/in_voltageY_supply_roc_rising_period
@@ -787,6 +851,10 @@ What: /sys/.../iio:deviceX/scan_elements/in_anglvel_z_en
787851
What: /sys/.../iio:deviceX/scan_elements/in_magn_x_en
788852
What: /sys/.../iio:deviceX/scan_elements/in_magn_y_en
789853
What: /sys/.../iio:deviceX/scan_elements/in_magn_z_en
854+
What: /sys/.../iio:deviceX/scan_elements/in_rot_from_north_magnetic_en
855+
What: /sys/.../iio:deviceX/scan_elements/in_rot_from_north_true_en
856+
What: /sys/.../iio:deviceX/scan_elements/in_rot_from_north_magnetic_tilt_comp_en
857+
What: /sys/.../iio:deviceX/scan_elements/in_rot_from_north_true_tilt_comp_en
790858
What: /sys/.../iio:deviceX/scan_elements/in_timestamp_en
791859
What: /sys/.../iio:deviceX/scan_elements/in_voltageY_supply_en
792860
What: /sys/.../iio:deviceX/scan_elements/in_voltageY_en
@@ -853,6 +921,10 @@ What: /sys/.../iio:deviceX/scan_elements/in_anglvel_z_index
853921
What: /sys/.../iio:deviceX/scan_elements/in_magn_x_index
854922
What: /sys/.../iio:deviceX/scan_elements/in_magn_y_index
855923
What: /sys/.../iio:deviceX/scan_elements/in_magn_z_index
924+
What: /sys/.../iio:deviceX/scan_elements/in_rot_from_north_magnetic_index
925+
What: /sys/.../iio:deviceX/scan_elements/in_rot_from_north_true_index
926+
What: /sys/.../iio:deviceX/scan_elements/in_rot_from_north_magnetic_tilt_comp_index
927+
What: /sys/.../iio:deviceX/scan_elements/in_rot_from_north_true_tilt_comp_index
856928
What: /sys/.../iio:deviceX/scan_elements/in_incli_x_index
857929
What: /sys/.../iio:deviceX/scan_elements/in_incli_y_index
858930
What: /sys/.../iio:deviceX/scan_elements/in_timestamp_index
@@ -946,3 +1018,13 @@ Description:
9461018
x y z w. Here x, y, and z component represents the axis about
9471019
which a rotation will occur and w component represents the
9481020
amount of rotation.
1021+
1022+
What: /sys/bus/iio/devices/iio:deviceX/in_rot_from_north_magnetic_tilt_comp_raw
1023+
What: /sys/bus/iio/devices/iio:deviceX/in_rot_from_north_true_tilt_comp_raw
1024+
What: /sys/bus/iio/devices/iio:deviceX/in_rot_from_north_magnetic_raw
1025+
What: /sys/bus/iio/devices/iio:deviceX/in_rot_from_north_true_raw
1026+
KernelVersion: 3.15
1027+
Contact: linux-iio@vger.kernel.org
1028+
Description:
1029+
Raw value of rotation from true/magnetic north measured with
1030+
or without compensation from tilt sensors.

‎Documentation/devicetree/bindings/arm/samsung/exynos-adc.txt‎

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,21 @@ Required properties:
1414
for exynos4412/5250 controllers.
1515
Must be "samsung,exynos-adc-v2" for
1616
future controllers.
17+
Must be "samsung,exynos3250-adc" for
18+
controllers compatible with ADC of Exynos3250.
1719
- reg: Contains ADC register address range (base address and
1820
length) and the address of the phy enable register.
1921
- interrupts: Contains the interrupt information for the timer. The
2022
format is being dependent on which interrupt controller
2123
the Samsung device uses.
2224
- #io-channel-cells = <1>; As ADC has multiple outputs
23-
- clocks From common clock binding: handle to adc clock.
24-
- clock-names From common clock binding: Shall be "adc".
25+
- clocks From common clock bindings: handles to clocks specified
26+
in "clock-names" property, in the same order.
27+
- clock-names From common clock bindings: list of clock input names
28+
used by ADC block:
29+
- "adc" : ADC bus clock
30+
- "sclk" : ADC special clock (only for Exynos3250 and
31+
compatible ADC block)
2532
- vdd-supply VDD input supply.
2633

2734
Note: child nodes can be added for auto probing from device tree.
@@ -41,6 +48,20 @@ adc: adc@12D10000 {
4148
vdd-supply = <&buck5_reg>;
4249
};
4350

51+
Example: adding device info in dtsi file for Exynos3250 with additional sclk
52+
53+
adc: adc@126C0000 {
54+
compatible = "samsung,exynos3250-adc", "samsung,exynos-adc-v2;
55+
reg = <0x126C0000 0x100>, <0x10020718 0x4>;
56+
interrupts = <0 137 0>;
57+
#io-channel-cells = <1>;
58+
io-channel-ranges;
59+
60+
clocks = <&cmu CLK_TSADC>, <&cmu CLK_SCLK_TSADC>;
61+
clock-names = "adc", "sclk";
62+
63+
vdd-supply = <&buck5_reg>;
64+
};
4465

4566
Example: Adding child nodes in dts file
4667

‎Documentation/devicetree/bindings/iio/magnetometer/hmc5843.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Required properties:
66
Other models which are supported with driver are:
77
"honeywell,hmc5883"
88
"honeywell,hmc5883l"
9+
"honeywell,hmc5983"
910
- reg : the I2C address of the magnetometer - typically 0x1e
1011

1112
Optional properties:

‎arch/arm/boot/dts/exynos3250.dtsi‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,10 +261,11 @@
261261
};
262262

263263
adc: adc@126C0000 {
264-
compatible = "samsung,exynos-adc-v3";
264+
compatible = "samsung,exynos3250-adc",
265+
"samsung,exynos-adc-v2";
265266
reg = <0x126C0000 0x100>, <0x10020718 0x4>;
266267
interrupts = <0 137 0>;
267-
clock-names = "adc", "sclk_tsadc";
268+
clock-names = "adc", "sclk";
268269
clocks = <&cmu CLK_TSADC>, <&cmu CLK_SCLK_TSADC>;
269270
#io-channel-cells = <1>;
270271
io-channel-ranges;

‎drivers/iio/accel/kxcjk-1013.c‎

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ static const struct {
9898
int val2;
9999
int odr_bits;
100100
} samp_freq_table[] = { {0, 781000, 0x08}, {1, 563000, 0x09},
101-
{3, 125000, 0x0A}, {6, 25000, 0x0B}, {12, 5000, 0},
101+
{3, 125000, 0x0A}, {6, 250000, 0x0B}, {12, 500000, 0},
102102
{25, 0, 0x01}, {50, 0, 0x02}, {100, 0, 0x03},
103103
{200, 0, 0x04}, {400, 0, 0x05}, {800, 0, 0x06},
104104
{1600, 0, 0x07} };
@@ -138,19 +138,6 @@ static int kxcjk1013_set_mode(struct kxcjk1013_data *data,
138138
return 0;
139139
}
140140

141-
static int kxcjk1013_chip_ack_intr(struct kxcjk1013_data *data)
142-
{
143-
int ret;
144-
145-
ret = i2c_smbus_read_byte_data(data->client, KXCJK1013_REG_INT_REL);
146-
if (ret < 0) {
147-
dev_err(&data->client->dev, "Error writing reg_int_rel\n");
148-
return ret;
149-
}
150-
151-
return ret;
152-
}
153-
154141
static int kxcjk1013_chip_init(struct kxcjk1013_data *data)
155142
{
156143
int ret;
@@ -466,7 +453,7 @@ static const struct attribute_group kxcjk1013_attrs_group = {
466453
.realbits = 12, \
467454
.storagebits = 16, \
468455
.shift = 4, \
469-
.endianness = IIO_LE, \
456+
.endianness = IIO_CPU, \
470457
}, \
471458
}
472459

@@ -498,15 +485,11 @@ static irqreturn_t kxcjk1013_trigger_handler(int irq, void *p)
498485
indio_dev->masklength) {
499486
ret = kxcjk1013_get_acc_reg(data, bit);
500487
if (ret < 0) {
501-
kxcjk1013_chip_ack_intr(data);
502488
mutex_unlock(&data->mutex);
503489
goto err;
504490
}
505491
data->buffer[i++] = ret;
506492
}
507-
508-
kxcjk1013_chip_ack_intr(data);
509-
510493
mutex_unlock(&data->mutex);
511494

512495
iio_push_to_buffers_with_timestamp(indio_dev, data->buffer,
@@ -517,6 +500,21 @@ static irqreturn_t kxcjk1013_trigger_handler(int irq, void *p)
517500
return IRQ_HANDLED;
518501
}
519502

503+
static int kxcjk1013_trig_try_reen(struct iio_trigger *trig)
504+
{
505+
struct iio_dev *indio_dev = iio_trigger_get_drvdata(trig);
506+
struct kxcjk1013_data *data = iio_priv(indio_dev);
507+
int ret;
508+
509+
ret = i2c_smbus_read_byte_data(data->client, KXCJK1013_REG_INT_REL);
510+
if (ret < 0) {
511+
dev_err(&data->client->dev, "Error reading reg_int_rel\n");
512+
return ret;
513+
}
514+
515+
return 0;
516+
}
517+
520518
static int kxcjk1013_data_rdy_trigger_set_state(struct iio_trigger *trig,
521519
bool state)
522520
{
@@ -543,6 +541,7 @@ static int kxcjk1013_data_rdy_trigger_set_state(struct iio_trigger *trig,
543541

544542
static const struct iio_trigger_ops kxcjk1013_trigger_ops = {
545543
.set_trigger_state = kxcjk1013_data_rdy_trigger_set_state,
544+
.try_reenable = kxcjk1013_trig_try_reen,
546545
.owner = THIS_MODULE,
547546
};
548547

@@ -645,6 +644,7 @@ static int kxcjk1013_probe(struct i2c_client *client,
645644
iio_trigger_set_drvdata(trig, indio_dev);
646645
data->trig = trig;
647646
indio_dev->trig = trig;
647+
iio_trigger_get(indio_dev->trig);
648648

649649
ret = iio_trigger_register(trig);
650650
if (ret)

0 commit comments

Comments
 (0)