X-Git-Url: https://git.openpandora.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=drivers%2Fleds%2Fleds-lp55xx-common.h;h=cceab483edd04a14174224a0d8b253a738376e66;hb=606185b20caf4c57d7e41e5a5ea4aff460aef2ab;hp=dbbf86df0f1fcdbe4d14de589b7fc90ef85f1a24;hpb=4ba25a496f62129a2ad8c2436ab2b402752dc66c;p=pandora-kernel.git diff --git a/drivers/leds/leds-lp55xx-common.h b/drivers/leds/leds-lp55xx-common.h index dbbf86df0f1f..cceab483edd0 100644 --- a/drivers/leds/leds-lp55xx-common.h +++ b/drivers/leds/leds-lp55xx-common.h @@ -20,8 +20,62 @@ enum lp55xx_engine_index { LP55XX_ENGINE_1, LP55XX_ENGINE_2, LP55XX_ENGINE_3, + LP55XX_ENGINE_MAX = LP55XX_ENGINE_3, }; +enum lp55xx_engine_mode { + LP55XX_ENGINE_DISABLED, + LP55XX_ENGINE_LOAD, + LP55XX_ENGINE_RUN, +}; + +#define LP55XX_DEV_ATTR_RW(name, show, store) \ + DEVICE_ATTR(name, S_IRUGO | S_IWUSR, show, store) +#define LP55XX_DEV_ATTR_RO(name, show) \ + DEVICE_ATTR(name, S_IRUGO, show, NULL) +#define LP55XX_DEV_ATTR_WO(name, store) \ + DEVICE_ATTR(name, S_IWUSR, NULL, store) + +#define show_mode(nr) \ +static ssize_t show_engine##nr##_mode(struct device *dev, \ + struct device_attribute *attr, \ + char *buf) \ +{ \ + return show_engine_mode(dev, attr, buf, nr); \ +} + +#define store_mode(nr) \ +static ssize_t store_engine##nr##_mode(struct device *dev, \ + struct device_attribute *attr, \ + const char *buf, size_t len) \ +{ \ + return store_engine_mode(dev, attr, buf, len, nr); \ +} + +#define show_leds(nr) \ +static ssize_t show_engine##nr##_leds(struct device *dev, \ + struct device_attribute *attr, \ + char *buf) \ +{ \ + return show_engine_leds(dev, attr, buf, nr); \ +} + +#define store_leds(nr) \ +static ssize_t store_engine##nr##_leds(struct device *dev, \ + struct device_attribute *attr, \ + const char *buf, size_t len) \ +{ \ + return store_engine_leds(dev, attr, buf, len, nr); \ +} + +#define store_load(nr) \ +static ssize_t store_engine##nr##_load(struct device *dev, \ + struct device_attribute *attr, \ + const char *buf, size_t len) \ +{ \ + return store_engine_load(dev, attr, buf, len, nr); \ +} + struct lp55xx_led; struct lp55xx_chip; @@ -71,6 +125,16 @@ struct lp55xx_device_config { const struct attribute_group *dev_attr_group; }; +/* + * struct lp55xx_engine + * @mode : Engine mode + * @led_mux : Mux bits for LED selection. Only used in LP5523 + */ +struct lp55xx_engine { + enum lp55xx_engine_mode mode; + u16 led_mux; +}; + /* * struct lp55xx_chip * @cl : I2C communication for access registers @@ -79,6 +143,7 @@ struct lp55xx_device_config { * @num_leds : Number of registered LEDs * @cfg : Device specific configuration data * @engine_idx : Selected engine number + * @engines : Engine structure for the device attribute R/W interface * @fw : Firmware data for running a LED pattern */ struct lp55xx_chip { @@ -89,6 +154,7 @@ struct lp55xx_chip { int num_leds; struct lp55xx_device_config *cfg; enum lp55xx_engine_index engine_idx; + struct lp55xx_engine engines[LP55XX_ENGINE_MAX]; const struct firmware *fw; };