hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/counter/104-quad-8.c
....@@ -62,10 +62,6 @@
6262 #define QUAD8_REG_CHAN_OP 0x11
6363 #define QUAD8_REG_INDEX_INPUT_LEVELS 0x16
6464 #define QUAD8_DIFF_ENCODER_CABLE_STATUS 0x17
65
-/* Borrow Toggle flip-flop */
66
-#define QUAD8_FLAG_BT BIT(0)
67
-/* Carry Toggle flip-flop */
68
-#define QUAD8_FLAG_CT BIT(1)
6965 /* Error flag */
7066 #define QUAD8_FLAG_E BIT(4)
7167 /* Up/Down flag */
....@@ -104,9 +100,6 @@
104100 {
105101 struct quad8_iio *const priv = iio_priv(indio_dev);
106102 const int base_offset = priv->base + 2 * chan->channel;
107
- unsigned int flags;
108
- unsigned int borrow;
109
- unsigned int carry;
110103 int i;
111104
112105 switch (mask) {
....@@ -117,12 +110,7 @@
117110 return IIO_VAL_INT;
118111 }
119112
120
- flags = inb(base_offset + 1);
121
- borrow = flags & QUAD8_FLAG_BT;
122
- carry = !!(flags & QUAD8_FLAG_CT);
123
-
124
- /* Borrow XOR Carry effectively doubles count range */
125
- *val = (borrow ^ carry) << 24;
113
+ *val = 0;
126114
127115 mutex_lock(&priv->lock);
128116
....@@ -643,17 +631,9 @@
643631 {
644632 struct quad8_iio *const priv = counter->priv;
645633 const int base_offset = priv->base + 2 * count->id;
646
- unsigned int flags;
647
- unsigned int borrow;
648
- unsigned int carry;
649634 int i;
650635
651
- flags = inb(base_offset + 1);
652
- borrow = flags & QUAD8_FLAG_BT;
653
- carry = !!(flags & QUAD8_FLAG_CT);
654
-
655
- /* Borrow XOR Carry effectively doubles count range */
656
- *val = (unsigned long)(borrow ^ carry) << 24;
636
+ *val = 0;
657637
658638 mutex_lock(&priv->lock);
659639
....@@ -1198,8 +1178,8 @@
11981178
11991179 mutex_unlock(&priv->lock);
12001180
1201
- /* By default 0x1FFFFFF (25 bits unsigned) is maximum count */
1202
- return sprintf(buf, "33554431\n");
1181
+ /* By default 0xFFFFFF (24 bits unsigned) is maximum count */
1182
+ return sprintf(buf, "16777215\n");
12031183 }
12041184
12051185 static ssize_t quad8_count_ceiling_write(struct counter_device *counter,