History

Merge remote-tracking branch 'regmap/for-5.8' into regmap-next

Mark Brown committed 6 years ago

Commit 9b98f922 parents 4bcc6a0 93b92994 files · +222 −55Browse files

Showing the changes to include/linux (1 of 4 files). Show all

Unified · Split

include/linux/regmap.h+70−39
@@ -17,10 +17,12 @@ · 16 unmodified lines
1717 #include <linux/err.h>
1818 #include <linux/bug.h>
1919 #include <linux/lockdep.h>
20+#include <linux/iopoll.h>
2021
2122 struct module;
2223 struct clk;
2324 struct device;
25+struct device_node;
2426 struct i2c_client;
2527 struct i3c_device;
2628 struct irq_domain;
@@ -71,6 +73,13 @@ struct reg_sequence { · 44 unmodified lines
7173 unsigned int delay_us;
7274 };
7375
76+#define REG_SEQ(_reg, _def, _delay_us) { \
77+ .reg = _reg, \
78+ .def = _def, \
79+ .delay_us = _delay_us, \
80+ }
81+#define REG_SEQ0(_reg, _def) REG_SEQ(_reg, _def, 0)
82+
7483 #define regmap_update_bits(map, reg, mask, val) \
7584 regmap_update_bits_base(map, reg, mask, val, NULL, false, false)
7685 #define regmap_update_bits_async(map, reg, mask, val)\
@@ -122,26 +131,10 @@ struct reg_sequence { · 45 unmodified lines
122131 */
123132 #define regmap_read_poll_timeout(map, addr, val, cond, sleep_us, timeout_us) \
124133 ({ \
125− u64 __timeout_us = (timeout_us); \
126− unsigned long __sleep_us = (sleep_us); \
127− ktime_t __timeout = ktime_add_us(ktime_get(), __timeout_us); \
128− int __ret; \
129− might_sleep_if(__sleep_us); \
130− for (;;) { \
131− __ret = regmap_read((map), (addr), &(val)); \
132− if (__ret) \
133− break; \
134− if (cond) \
135− break; \
136− if ((__timeout_us) && \
137− ktime_compare(ktime_get(), __timeout) > 0) { \
138− __ret = regmap_read((map), (addr), &(val)); \
139− break; \
140− } \
141− if (__sleep_us) \
142− usleep_range((__sleep_us >> 2) + 1, __sleep_us); \
143− } \
144− __ret ?: ((cond) ? 0 : -ETIMEDOUT); \
134+ int __ret, __tmp; \
135+ __tmp = read_poll_timeout(regmap_read, __ret, __ret || (cond), \
136+ sleep_us, timeout_us, false, (map), (addr), &(val)); \
137+ __ret ?: __tmp; \
145138 })
146139
147140 /**
@@ -209,25 +202,10 @@ struct reg_sequence { · 61 unmodified lines
209202 */
210203 #define regmap_field_read_poll_timeout(field, val, cond, sleep_us, timeout_us) \
211204 ({ \
212− u64 __timeout_us = (timeout_us); \
213− unsigned long __sleep_us = (sleep_us); \
214− ktime_t timeout = ktime_add_us(ktime_get(), __timeout_us); \
215− int pollret; \
216− might_sleep_if(__sleep_us); \
217− for (;;) { \
218− pollret = regmap_field_read((field), &(val)); \
219− if (pollret) \
220− break; \
221− if (cond) \
222− break; \
223− if (__timeout_us && ktime_compare(ktime_get(), timeout) > 0) { \
224− pollret = regmap_field_read((field), &(val)); \
225− break; \
226− } \
227− if (__sleep_us) \
228− usleep_range((__sleep_us >> 2) + 1, __sleep_us); \
229− } \
230− pollret ?: ((cond) ? 0 : -ETIMEDOUT); \
205+ int __ret, __tmp; \
206+ __tmp = read_poll_timeout(regmap_field_read, __ret, __ret || (cond), \
207+ sleep_us, timeout_us, false, (field), &(val)); \
208+ __ret ?: __tmp; \
231209 })
232210
233211 #ifdef CONFIG_REGMAP
@@ -1111,6 +1089,21 @@ bool regmap_reg_in_ranges(unsigned int reg, · 877 unmodified lines
11111089 const struct regmap_range *ranges,
11121090 unsigned int nranges);
11131091
1092+static inline int regmap_set_bits(struct regmap *map,
1093+ unsigned int reg, unsigned int bits)
1094+{
1095+ return regmap_update_bits_base(map, reg, bits, bits,
1096+ NULL, false, false);
1097+}
1098+
1099+static inline int regmap_clear_bits(struct regmap *map,
1100+ unsigned int reg, unsigned int bits)
1101+{
1102+ return regmap_update_bits_base(map, reg, bits, 0, NULL, false, false);
1103+}
1104+
1105+int regmap_test_bits(struct regmap *map, unsigned int reg, unsigned int bits);
1106+
11141107 /**
11151108 * struct reg_field - Description of an register field
11161109 *
@@ -1134,6 +1127,14 @@ struct reg_field { · 17 unmodified lines
11341127 .msb = _msb, \
11351128 }
11361129
1130+#define REG_FIELD_ID(_reg, _lsb, _msb, _size, _offset) { \
1131+ .reg = _reg, \
1132+ .lsb = _lsb, \
1133+ .msb = _msb, \
1134+ .id_size = _size, \
1135+ .id_offset = _offset, \
1136+ }
1137+
11371138 struct regmap_field *regmap_field_alloc(struct regmap *regmap,
11381139 struct reg_field reg_field);
11391140 void regmap_field_free(struct regmap_field *field);
@@ -1310,12 +1311,21 @@ struct regmap_irq_chip_data; · 170 unmodified lines
13101311 int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags,
13111312 int irq_base, const struct regmap_irq_chip *chip,
13121313 struct regmap_irq_chip_data **data);
1314+int regmap_add_irq_chip_np(struct device_node *np, struct regmap *map, int irq,
1315+ int irq_flags, int irq_base,
1316+ const struct regmap_irq_chip *chip,
1317+ struct regmap_irq_chip_data **data);
13131318 void regmap_del_irq_chip(int irq, struct regmap_irq_chip_data *data);
13141319
13151320 int devm_regmap_add_irq_chip(struct device *dev, struct regmap *map, int irq,
13161321 int irq_flags, int irq_base,
13171322 const struct regmap_irq_chip *chip,
13181323 struct regmap_irq_chip_data **data);
1324+int devm_regmap_add_irq_chip_np(struct device *dev, struct device_node *np,
1325+ struct regmap *map, int irq, int irq_flags,
1326+ int irq_base,
1327+ const struct regmap_irq_chip *chip,
1328+ struct regmap_irq_chip_data **data);
13191329 void devm_regmap_del_irq_chip(struct device *dev, int irq,
13201330 struct regmap_irq_chip_data *data);
13211331
@@ -1410,6 +1420,27 @@ static inline int regmap_update_bits_base(struct regmap *map, unsigned int reg, · 88 unmodified lines
14101420 return -EINVAL;
14111421 }
14121422
1423+static inline int regmap_set_bits(struct regmap *map,
1424+ unsigned int reg, unsigned int bits)
1425+{
1426+ WARN_ONCE(1, "regmap API is disabled");
1427+ return -EINVAL;
1428+}
1429+
1430+static inline int regmap_clear_bits(struct regmap *map,
1431+ unsigned int reg, unsigned int bits)
1432+{
1433+ WARN_ONCE(1, "regmap API is disabled");
1434+ return -EINVAL;
1435+}
1436+
1437+static inline int regmap_test_bits(struct regmap *map,
1438+ unsigned int reg, unsigned int bits)
1439+{
1440+ WARN_ONCE(1, "regmap API is disabled");
1441+ return -EINVAL;
1442+}
1443+
14131444 static inline int regmap_field_update_bits_base(struct regmap_field *field,
14141445 unsigned int mask, unsigned int val,
14151446 bool *change, bool async, bool force)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t