From: Dawid Łukwiński <dawid.lukwinski@intel.com>
Provide an API to allow reading LED blink setting.
Signed-off-by: Dawid Łukwiński <dawid.lukwinski@intel.com>
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
drivers/net/i40e/base/i40e_common.c | 29 ++++++++++++++++++++++++++
drivers/net/i40e/base/i40e_prototype.h | 1 +
2 files changed, 30 insertions(+)
@@ -1568,6 +1568,35 @@ u32 i40e_led_get(struct i40e_hw *hw)
return mode;
}
+/**
+ * i40e_led_get_blink - return current LED blink setting
+ * @hw: pointer to the hw struct
+ *
+ * The value returned is the LED_BLINK bit as defined in the
+ * GPIO register definitions (0 = no blink, 1 = do blink).
+ **/
+bool i40e_led_get_blink(struct i40e_hw *hw)
+{
+ bool blink = 0;
+ int i;
+
+ /* as per the documentation GPIO 22-29 are the LED
+ * GPIO pins named LED0..LED7
+ */
+ for (i = I40E_LED0; i <= I40E_GLGEN_GPIO_CTL_MAX_INDEX; i++) {
+ u32 gpio_val = i40e_led_is_mine(hw, i);
+
+ if (!gpio_val)
+ continue;
+
+ blink = (gpio_val & I40E_GLGEN_GPIO_CTL_LED_BLINK_MASK) >>
+ I40E_GLGEN_GPIO_CTL_LED_BLINK_SHIFT;
+ break;
+ }
+
+ return blink;
+}
+
/**
* i40e_led_set - set new on/off mode
* @hw: pointer to the hw struct
@@ -69,6 +69,7 @@ const char *i40e_aq_str(struct i40e_hw *hw, enum i40e_admin_queue_err aq_err);
const char *i40e_stat_str(struct i40e_hw *hw, enum i40e_status_code stat_err);
u32 i40e_led_get(struct i40e_hw *hw);
+bool i40e_led_get_blink(struct i40e_hw *hw);
void i40e_led_set(struct i40e_hw *hw, u32 mode, bool blink);
enum i40e_status_code i40e_led_set_phy(struct i40e_hw *hw, bool on,
u16 led_addr, u32 mode);