doc: board: Add Intel Cherry Hill board doc
[oweals/u-boot.git] / include / pwm.h
index 851915eb87a6e253868bcbda25a2a09710a8c0a2..54ae3e64c310f61026907905c3bd794a68dd48c7 100644 (file)
@@ -1,11 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
 /*
  * header file for pwm driver.
  *
  * Copyright 2016 Google Inc.
  * Copyright (c) 2011 samsung electronics
  * Donghwa Lee <dh09.lee@samsung.com>
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #ifndef _pwm_h_
@@ -34,6 +33,15 @@ struct pwm_ops {
         * @return 0 if OK, -ve on error
         */
        int (*set_enable)(struct udevice *dev, uint channel, bool enable);
+       /**
+        * set_invert() - Set the PWM invert
+        *
+        * @dev:        PWM device to update
+        * @channel:    PWM channel to update
+        * @polarity:   true to invert, false to keep normal polarity
+        * @return 0 if OK, -ve on error
+        */
+       int (*set_invert)(struct udevice *dev, uint channel, bool polarity);
 };
 
 #define pwm_get_ops(dev)       ((struct pwm_ops *)(dev)->driver->ops)
@@ -60,6 +68,16 @@ int pwm_set_config(struct udevice *dev, uint channel, uint period_ns,
  */
 int pwm_set_enable(struct udevice *dev, uint channel, bool enable);
 
+/**
+ * pwm_set_invert() - Set pwm default polarity
+ *
+ * @dev:       PWM device to update
+ * @channel:   PWM channel to update
+ * @polarity:  true to invert, false to keep normal polarity
+ * @return 0 if OK, -ve on error
+ */
+int pwm_set_invert(struct udevice *dev, uint channel, bool polarity);
+
 /* Legacy interface */
 #ifndef CONFIG_DM_PWM
 int    pwm_init                (int pwm_id, int div, int invert);