aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/device.h1
-rw-r--r--include/linux/of.h76
-rw-r--r--include/linux/regulator/driver.h8
3 files changed, 85 insertions, 0 deletions
diff --git a/include/linux/device.h b/include/linux/device.h
index 952b01033c32..ec1b6e21f0ef 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -626,6 +626,7 @@ static inline void *devm_kcalloc(struct device *dev,
626 return devm_kmalloc_array(dev, n, size, flags | __GFP_ZERO); 626 return devm_kmalloc_array(dev, n, size, flags | __GFP_ZERO);
627} 627}
628extern void devm_kfree(struct device *dev, void *p); 628extern void devm_kfree(struct device *dev, void *p);
629extern char *devm_kstrdup(struct device *dev, const char *s, gfp_t gfp);
629 630
630void __iomem *devm_ioremap_resource(struct device *dev, struct resource *res); 631void __iomem *devm_ioremap_resource(struct device *dev, struct resource *res);
631void __iomem *devm_request_and_ioremap(struct device *dev, 632void __iomem *devm_request_and_ioremap(struct device *dev,
diff --git a/include/linux/of.h b/include/linux/of.h
index 435cb995904d..83d1ac80c91e 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -198,6 +198,8 @@ extern struct device_node *of_find_node_with_property(
198extern struct property *of_find_property(const struct device_node *np, 198extern struct property *of_find_property(const struct device_node *np,
199 const char *name, 199 const char *name,
200 int *lenp); 200 int *lenp);
201extern int of_property_count_elems_of_size(const struct device_node *np,
202 const char *propname, int elem_size);
201extern int of_property_read_u32_index(const struct device_node *np, 203extern int of_property_read_u32_index(const struct device_node *np,
202 const char *propname, 204 const char *propname,
203 u32 index, u32 *out_value); 205 u32 index, u32 *out_value);
@@ -390,6 +392,12 @@ static inline struct device_node *of_find_compatible_node(
390 return NULL; 392 return NULL;
391} 393}
392 394
395static inline int of_property_count_elems_of_size(const struct device_node *np,
396 const char *propname, int elem_size)
397{
398 return -ENOSYS;
399}
400
393static inline int of_property_read_u32_index(const struct device_node *np, 401static inline int of_property_read_u32_index(const struct device_node *np,
394 const char *propname, u32 index, u32 *out_value) 402 const char *propname, u32 index, u32 *out_value)
395{ 403{
@@ -536,6 +544,74 @@ static inline struct device_node *of_find_matching_node(
536} 544}
537 545
538/** 546/**
547 * of_property_count_u8_elems - Count the number of u8 elements in a property
548 *
549 * @np: device node from which the property value is to be read.
550 * @propname: name of the property to be searched.
551 *
552 * Search for a property in a device node and count the number of u8 elements
553 * in it. Returns number of elements on sucess, -EINVAL if the property does
554 * not exist or its length does not match a multiple of u8 and -ENODATA if the
555 * property does not have a value.
556 */
557static inline int of_property_count_u8_elems(const struct device_node *np,
558 const char *propname)
559{
560 return of_property_count_elems_of_size(np, propname, sizeof(u8));
561}
562
563/**
564 * of_property_count_u16_elems - Count the number of u16 elements in a property
565 *
566 * @np: device node from which the property value is to be read.
567 * @propname: name of the property to be searched.
568 *
569 * Search for a property in a device node and count the number of u16 elements
570 * in it. Returns number of elements on sucess, -EINVAL if the property does
571 * not exist or its length does not match a multiple of u16 and -ENODATA if the
572 * property does not have a value.
573 */
574static inline int of_property_count_u16_elems(const struct device_node *np,
575 const char *propname)
576{
577 return of_property_count_elems_of_size(np, propname, sizeof(u16));
578}
579
580/**
581 * of_property_count_u32_elems - Count the number of u32 elements in a property
582 *
583 * @np: device node from which the property value is to be read.
584 * @propname: name of the property to be searched.
585 *
586 * Search for a property in a device node and count the number of u32 elements
587 * in it. Returns number of elements on sucess, -EINVAL if the property does
588 * not exist or its length does not match a multiple of u32 and -ENODATA if the
589 * property does not have a value.
590 */
591static inline int of_property_count_u32_elems(const struct device_node *np,
592 const char *propname)
593{
594 return of_property_count_elems_of_size(np, propname, sizeof(u32));
595}
596
597/**
598 * of_property_count_u64_elems - Count the number of u64 elements in a property
599 *
600 * @np: device node from which the property value is to be read.
601 * @propname: name of the property to be searched.
602 *
603 * Search for a property in a device node and count the number of u64 elements
604 * in it. Returns number of elements on sucess, -EINVAL if the property does
605 * not exist or its length does not match a multiple of u64 and -ENODATA if the
606 * property does not have a value.
607 */
608static inline int of_property_count_u64_elems(const struct device_node *np,
609 const char *propname)
610{
611 return of_property_count_elems_of_size(np, propname, sizeof(u64));
612}
613
614/**
539 * of_property_read_bool - Findfrom a property 615 * of_property_read_bool - Findfrom a property
540 * @np: device node from which the property value is to be read. 616 * @np: device node from which the property value is to be read.
541 * @propname: name of the property to be searched. 617 * @propname: name of the property to be searched.
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index 9370e65348a4..bbe03a1924c0 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -228,10 +228,14 @@ enum regulator_type {
228 * output when using regulator_set_voltage_sel_regmap 228 * output when using regulator_set_voltage_sel_regmap
229 * @enable_reg: Register for control when using regmap enable/disable ops 229 * @enable_reg: Register for control when using regmap enable/disable ops
230 * @enable_mask: Mask for control when using regmap enable/disable ops 230 * @enable_mask: Mask for control when using regmap enable/disable ops
231 * @enable_val: Enabling value for control when using regmap enable/disable ops
232 * @disable_val: Disabling value for control when using regmap enable/disable ops
231 * @enable_is_inverted: A flag to indicate set enable_mask bits to disable 233 * @enable_is_inverted: A flag to indicate set enable_mask bits to disable
232 * when using regulator_enable_regmap and friends APIs. 234 * when using regulator_enable_regmap and friends APIs.
233 * @bypass_reg: Register for control when using regmap set_bypass 235 * @bypass_reg: Register for control when using regmap set_bypass
234 * @bypass_mask: Mask for control when using regmap set_bypass 236 * @bypass_mask: Mask for control when using regmap set_bypass
237 * @bypass_val_on: Enabling value for control when using regmap set_bypass
238 * @bypass_val_off: Disabling value for control when using regmap set_bypass
235 * 239 *
236 * @enable_time: Time taken for initial enable of regulator (in uS). 240 * @enable_time: Time taken for initial enable of regulator (in uS).
237 */ 241 */
@@ -263,9 +267,13 @@ struct regulator_desc {
263 unsigned int apply_bit; 267 unsigned int apply_bit;
264 unsigned int enable_reg; 268 unsigned int enable_reg;
265 unsigned int enable_mask; 269 unsigned int enable_mask;
270 unsigned int enable_val;
271 unsigned int disable_val;
266 bool enable_is_inverted; 272 bool enable_is_inverted;
267 unsigned int bypass_reg; 273 unsigned int bypass_reg;
268 unsigned int bypass_mask; 274 unsigned int bypass_mask;
275 unsigned int bypass_val_on;
276 unsigned int bypass_val_off;
269 277
270 unsigned int enable_time; 278 unsigned int enable_time;
271}; 279};