Hi!
On Fri, Feb 15, 2019 at 01:50:06PM +0200, Stefan Mavrodiev wrote:...
+static ssize_t control_store(struct device *dev, struct device_attribute *attr,
+ const char *buf, size_t size)
+{
+ struct led_classdev *cdev = dev_get_drvdata(dev);
+ struct axp20x_led *priv = to_axp20x_led(cdev);
+ unsigned long val;
+ int ret;
+
+ ret = kstrtoul(buf, 0, &val);
+ if (ret)
+ return ret;
+
+ /**
+ * Supported values are:
+ * - 0 : Manual control
+ * - 1 : Charger control
+ */
It is not. See "Add Intel Cherry Trail Whiskey Cove PMIC LEDs" thread+static struct attribute *axp20x_led_attrs[] = {I can't really say whether adding sysfs handles for this is the right
+ &dev_attr_control.attr,
+ &dev_attr_mode.attr,
+ NULL,
+};
+ATTRIBUTE_GROUPS(axp20x_led);
thing to do, but if it is you should document the interface.
in the last few days.
We want this to be configurable at run time. It can get default from+ if (!of_property_read_u8(np, "x-powers,charger-mode", &value)) {I'm not sure we want to make this a property of the device
+ priv->ctrl = AXP20X_CHGLED_CTRL_CHARGER;
+ priv->mode = (value < 2) ? value : 0;
+ } else {
+ priv->ctrl = AXP20X_CHGLED_CTRL_MANUAL;
+ }
tree. Changing the device tree isn't an option for some users, so we
need to make sure we can change it even if we can't change the device
tree.
the device tree.
If we go for the "hardware" trigger, you'll get it for free.
Best regards,
Pavel