History log of /linux-master/drivers/staging/greybus/light.c
Revision Date Author Comments
# 34164202 04-Mar-2024 Dan Carpenter <dan.carpenter@linaro.org>

staging: greybus: fix get_channel_from_mode() failure path

The get_channel_from_mode() function is supposed to return the channel
which matches the mode. But it has a bug where if it doesn't find a
matching channel then it returns the last channel. It should return
NULL instead.

Also remove an unnecessary NULL check on "channel".

Fixes: 2870b52bae4c ("greybus: lights: add lights implementation")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com>
Reviewed-by: Alex Elder <elder@linaro.org>
Link: https://lore.kernel.org/r/379c0cb4-39e0-4293-8a18-c7b1298e5420@moroto.mountain
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 09e3f324 09-Jan-2024 Arnd Bergmann <arnd@arndb.de>

leds: Make flash and multicolor dependencies unconditional

Along the same lines as making devm_led_classdev_register() declared
extern unconditional, do the same thing for the two sub-classes
that have similar stubs.

The users of these interfaces go to great lengths to allow building
with both the generic leds API and the extended version, but realistically
there is not much use in this, so just simplify it to always rely
on it and remove the confusing fallback logic.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20240109090715.982332-2-arnd@kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>


# 6500966d 29-Dec-2020 Zheng Yongjun <zhengyongjun3@huawei.com>

staging: greybus: light: Use kzalloc for allocating only one thing

Use kzalloc rather than kcalloc(1,...)

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
@@

- kcalloc(1,
+ kzalloc(
...)
// </smpl>

Reviewed-by: Alex Elder <elder@linaro.org>
Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com>
Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
Link: https://lore.kernel.org/r/20201230013706.28698-1-zhengyongjun3@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 9bb086e5 31-Mar-2020 Chen Zhou <chenzhou10@huawei.com>

staging: greybus: fix a missing-check bug in gb_lights_light_config()

In gb_lights_light_config(), 'light->name' is allocated by kstrndup().
It returns NULL when fails, add check for it.

Signed-off-by: Chen Zhou <chenzhou10@huawei.com>
Acked-by: Rui Miguel Silva <rmfrfs@gmail.com>
Link: https://lore.kernel.org/r/20200401030017.100274-1-chenzhou10@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 32910124 29-Aug-2019 Dan Carpenter <dan.carpenter@oracle.com>

staging: greybus: light: fix a couple double frees

The problem is in gb_lights_request_handler(). If we get a request to
change the config then we release the light with gb_lights_light_release()
and re-allocated it. However, if the allocation fails part way through
then we call gb_lights_light_release() again. This can lead to a couple
different double frees where we haven't cleared out the original values:

gb_lights_light_v4l2_unregister(light);
...
kfree(light->channels);
kfree(light->name);

I also made a small change to how we set "light->channels_count = 0;".
The original code handled this part fine and did not cause a use after
free but it was sort of complicated to read.

Fixes: 2870b52bae4c ("greybus: lights: add lights implementation")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Rui Miguel Silva <rmfrfs@gmail.com>
Link: https://lore.kernel.org/r/20190829122839.GA20116@mwanda
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# ec0ad868 24-Aug-2019 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

staging: greybus: move core include files to include/linux/greybus/

With the goal of moving the core of the greybus code out of staging, the
include files need to be moved to include/linux/greybus.h and
include/linux/greybus/

Cc: Vaibhav Hiremath <hvaibhav.linux@gmail.com>
Cc: Johan Hovold <johan@kernel.org>
Cc: Vaibhav Agarwal <vaibhav.sr@gmail.com>
Cc: Rui Miguel Silva <rmfrfs@gmail.com>
Cc: David Lin <dtwlin@gmail.com>
Cc: "Bryan O'Donoghue" <pure.logic@nexus-software.ie>
Cc: greybus-dev@lists.linaro.org
Cc: devel@driverdev.osuosl.org
Acked-by: Mark Greer <mgreer@animalcreek.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Acked-by: Alex Elder <elder@kernel.org>
Link: https://lore.kernel.org/r/20190825055429.18547-8-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 863dbc52 07-Nov-2017 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

staging: greybus: Remove redundant license text

Now that the SPDX tag is in all greybus files, that identifies the
license in a specific and legally-defined manner. So the extra GPL text
wording can be removed as it is no longer needed at all.

This is done on a quest to remove the 700+ different ways that files in
the kernel describe the GPL license text. And there's unneeded stuff
like the address (sometimes incorrect) for the FSF which is never
needed.

No copyright headers or other non-license-description text was removed.

Cc: Vaibhav Hiremath <hvaibhav.linux@gmail.com>
Reviewed-by: Alex Elder <elder@linaro.org>
Acked-by: Vaibhav Agarwal <vaibhav.sr@gmail.com>
Acked-by: David Lin <dtwlin@gmail.com>
Acked-by: Johan Hovold <johan@kernel.org>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Acked-by: Mark Greer <mgreer@animalcreek.com>
Acked-by: Rui Miguel Silva <rmfrfs@gmail.com>
Acked-by: "Bryan O'Donoghue" <pure.logic@nexus-software.ie>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# eb50fd3a 07-Nov-2017 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

staging: greybus: add SPDX identifiers to all greybus driver files

It's good to have SPDX identifiers in all files to make it easier to
audit the kernel tree for correct licenses.

Update the drivers/staging/greybus files files with the correct SPDX
license identifier based on the license text in the file itself. The
SPDX identifier is a legally binding shorthand, which can be used
instead of the full boiler plate text.

This work is based on a script and data from Thomas Gleixner, Philippe
Ombredanne, and Kate Stewart.

Cc: Vaibhav Hiremath <hvaibhav.linux@gmail.com>
Cc: "Bryan O'Donoghue" <pure.logic@nexus-software.ie>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Kate Stewart <kstewart@linuxfoundation.org>
Cc: Philippe Ombredanne <pombredanne@nexb.com>
Acked-by: Vaibhav Agarwal <vaibhav.sr@gmail.com>
Acked-by: David Lin <dtwlin@gmail.com>
Reviewed-by: Alex Elder <elder@linaro.org>
Acked-by: Johan Hovold <johan@kernel.org>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Acked-by: Mark Greer <mgreer@animalcreek.com>
Acked-by: Rui Miguel Silva <rmfrfs@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 1cd5929a 23-Sep-2017 Arvind Yadav <arvind.yadav.cs@gmail.com>

staging: greybus: light: remove unnecessary error check

It is not necessary to check return value of gb_lights_channel_flash_config.
gb_lights_channel_config returns both successful and error value.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 04820da2 23-Sep-2017 Arvind Yadav <arvind.yadav.cs@gmail.com>

staging: greybus: light: Release memory obtained by kasprintf

Free memory region, if gb_lights_channel_config is not successful.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 503dd28a 18-Jul-2017 Sakari Ailus <sakari.ailus@linux.intel.com>

media: v4l2-flash-led-class: Create separate sub-devices for indicators

The V4L2 flash interface allows controlling multiple LEDs through a single
sub-devices if, and only if, these LEDs are of different types. This
approach scales badly for flash controllers that drive multiple flash LEDs
or for LED specific associations. Essentially, the original assumption of a
LED driver chip that drives a single flash LED and an indicator LED is no
longer valid.

Address the matter by registering one sub-device per LED.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com> (for greybus/light)
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>


# 428359cb 01-Aug-2017 Rui Miguel Silva <rmfrfs@gmail.com>

media: staging: greybus: light: fix memory leak in v4l2 register

We are allocating memory for the v4l2 flash configuration structure and
leak it in the normal path. Just use the stack for this as we do not
use it outside of this function.

Also use IS_ERR() instead of IS_ERR_OR_NULL() to check return value from
v4l2_flash_init() for it never returns NULL.

Fixes: 2870b52bae4c ("greybus: lights: add lights implementation")

Reported-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Rui Miguel Silva <rmfrfs@gmail.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>


# 85f7ff97 02-Jun-2017 Sakari Ailus <sakari.ailus@linux.intel.com>

media: v4l2-flash: Use led_classdev instead of led_classdev_flash for indicator

The V4L2 flash class initialisation expects struct led_classdev_flash that
describes an indicator but only uses struct led_classdev which is a field
iled_cdev in the struct. Use struct iled_cdev only.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>


# 3036d0e2 08-May-2017 Karthik Tummala <karthik@techveda.org>

Staging: greybus: light: Prefer kcalloc over kzalloc

Fixed following checkpatch.pl warning:
* WARNING: Prefer kcalloc over kzalloc with multiply

Instead of specifying no.of bytes * size as argument
in kzalloc, prefer kcalloc.

Signed-off-by: Karthik Tummala <karthik@techveda.org>
Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

Changes for v2:
- Changed subject line & fixed typo as suggested by
Rui Miguel Silva
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 6163904e 12-Apr-2017 Darryl T. Agostinelli <dagostinelli@gmail.com>

staging: greybus: light.c: Remove include linux/version.h

Fixes:
$ make versioncheck | grep staging
./drivers/staging/greybus/light.c: 15 linux/version.h not needed.

Signed-off-by: Darryl T. Agostinelli <dagostinelli@gmail.com>
Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com>
Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 5cf62679 30-Sep-2016 Rui Miguel Silva <rmfrfs@gmail.com>

staging: greybus: light: check the correct value of delay_on

When checking the value of delay_on to set the channel as active, it was
checked the pointer and not the value, as it should be.

Fixes: cc43368a3c ("greybus: lights: Control runtime pm suspend/resume on AP side")

Signed-off-by: Rui Miguel Silva <rmfrfs@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# dc875c77 30-Sep-2016 Rui Miguel Silva <rmfrfs@gmail.com>

staging: greybus: light: check delay_{on|off} before use

Even though we trust leds core that the pointers should be valid, we are
safer to check delay_{on|off} before use.

Also, this avoid a smatch warning:
drivers/staging/greybus/light.c:484 gb_blink_set()
warn: variable dereferenced before check 'delay_on' (see line 476)

Signed-off-by: Rui Miguel Silva <rmfrfs@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 3855eeec 30-Sep-2016 Rui Miguel Silva <rmfrfs@gmail.com>

staging: greybus: light: fix attributes allocation

Fix allocation of attributes with the correct size, this also fix smatch
warning:

drivers/staging/greybus/light.c:293 channel_attr_groups_set()
warn: double check that we're allocating correct size: 8 vs 16

Signed-off-by: Rui Miguel Silva <rmfrfs@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# a7af2fe6 08-Sep-2016 Rui Miguel Silva <rui.silva@linaro.org>

staging: greybus: light: remove KERNEL_VERSION checks

No need to support older kernel versions in the Greybus Light driver, so
remove the checks as needed, we can now rely on all of the correct LED
core apis being present. And compile only if flash and v4l2 flash is
reachable.

Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>


# cc43368a 25-Aug-2016 Kris Huang <huang_kris@projectara.com>

greybus: lights: Control runtime pm suspend/resume on AP side

According to runtime pm architecture, the kernel side driver should be
as smart as needed to know when the module is idle or active, so that it can
issue the suspend/resume operations to the firmware side at the right time.
To add logics prevents AP from issuing the suspend request to the firmware
when a channel turning to active state, and put it to suspend if the state
is going to inactive with still holding a reference.

Testing Done: Compiled and verified on EVT2 and gpbridge-test module
with device class daughter board.

Signed-off-by: Kris Huang <huang_kris@projectara.com>
Reviewed-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>


# 0e352343 22-Aug-2016 David Lin <dtwlin@google.com>

greybus: light: fix incorrect led attribute files allocation

Fix incorrect attribute size when the channel supports fader, as well as
fixing the issue that the attribute list is not null terminated.

Testing Done:
- Verified by setting brightness and color on red/green/blue leds
of the device class test board.

Signed-off-by: David Lin <dtwlin@google.com>
Reviewed-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>


# 811b1f58 08-Aug-2016 Kris Huang <huang_kris@projectara.com>

greybus: lights: enable multi color LED support

A backport (commit 79c4de08c0e5a26b04a4ac9e6543dad6379f0b40) was
applied in kernel which adding attribute-group support in led-class.
Remove the LED_HAVE_GROUPS flag check entirely that allow led
drivers to create custom attributes like color/fade_in/fade_out.

Testing Done: Compiled and verified on EVT2 and gpbridge-test module
with device class daughter board.

Signed-off-by: Kris Huang <huang_kris@projectara.com>
Reviewed-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>


# 9141ad87 04-Aug-2016 Kris Huang <huang_kris@projectara.com>

greybus: lights: Add runtime pm support

Modify Lights greybus driver to support runtime PM framework.
The suspend and resume function have been tested with gpbridge-test
image by sysfs. Lights functions work well on suspend/resume.

Testing Done: Compiled and verified on EVT2 and gpbridge-test module
with device class daughter board.

Signed-off-by: Kris Huang <huang_kris@projectara.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>


# 957ccca0 29-Jun-2016 Viresh Kumar <viresh.kumar@linaro.org>

greybus: light: Initialize mutex before using it

Light protocol driver is suffering from the same issue that was fixed in
camera driver earlier (commit a7c3b0c3c8da).

Big cleanup function is used instead of fine grained control in the
error path, and in one of the cases the mutex was found uninitialized
and so the oops seen in SW-6752.

Initialize the mutex before any code can access it.

Compile tested only.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>


# d97fca12 24-May-2016 Alex Elder <elder@linaro.org>

greybus: fix pointless null check

Coccinelle points out that a call in gb_lights_channel_free() to
flush_work() is passed which is always non-null. Prior to the
call, there is an unnecessary check to see if that address is null.
Get rid of the test.

Signed-off-by: Alex Elder <elder@linaro.org>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>


# 0ec30632 22-Mar-2016 Greg Kroah-Hartman <gregkh@google.com>

greybus: convert drivers to use connection->private set/get

This converts all drivers to use the gb_connection_get_data() and
gb_connection_set_data() functions to make it a bit more explicit as to
what is going on.

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>


# bf9deb29 25-Feb-2016 Rui Miguel Silva <rui.silva@linaro.org>

greybus: lights: remove unnecessary check

lights can never be NULL at that point since lights_count must be different than
zero, and we need only to validate the light_id.

Reported-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>


# c6ad27a9 17-Feb-2016 Rui Miguel Silva <rui.silva@linaro.org>

greybus: lights: fix check for configured lights

The validation for a complete configured light is wrong and it is
reworked to make sure that only when the light is ready, will handle
request events.

Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Reported-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>


# 137f7179 17-Feb-2016 Rui Miguel Silva <rui.silva@linaro.org>

greybus: lights: remove has_flash on failure

If register to v4l2 fails just mark the light as not having flash so in
release we do not try to unregister.

Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>


# 49233143 17-Feb-2016 Rui Miguel Silva <rui.silva@linaro.org>

greybus: lights: remove unnecessary checks

We do not need to check for channels and lights as they can never be
NULL as a big memory array elements.

Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Reported-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>


# 69564dfe 12-Feb-2016 Viresh Kumar <viresh.kumar@linaro.org>

greybus: lights: convert to bundle driver

Convert the legacy lights protocol driver to a bundle driver.

This also fixes a potential crash should a (malicious) module have sent
an early request before the private data had been initialised.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>


# 6ce0eed7 12-Feb-2016 Viresh Kumar <viresh.kumar@linaro.org>

greybus: lights: Break light setup into two parts

This breaks the light setup routine into two parts, the first one
allocates all the necessary resources and the second on registers lights
to the required frameworks.

This is required to enable only TX on the connection, until we have
allocated all the resources, otherwise the request handler might get
called for partially initialized structures.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Rui Miguel Silva <rui.silva@linaro.org>
Reviewed-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>


# 9c06c6a2 12-Jan-2016 Rui Miguel Silva <rui.silva@linaro.org>

greybus: lights: remove sync operation and work queue

In kernel v4.5 there is a change in LED api, which remove the need for
individual work queue and rename the set_sync operation to set_blocking.
This patch add the handling of this case and avoid compilation failure
for this kernel versions.

Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>


# 1700507d 03-Dec-2015 Rui Miguel Silva <rui.silva@linaro.org>

greybus: lights: default value for v4l2 flash controls

V4l2 flash will return erro ERANGE if val(which is the default value)
is not defined. Just set it to the max value reported by the module.

Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>


# d644181f 03-Dec-2015 Rui Miguel Silva <rui.silva@linaro.org>

greybus: lights: avoid channel torch double free

When attaching torch to a flash we release the channel torch resources,
but afterwards we do it again when releasing all the channels.
Just free all the resource at channel release.

Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>


# 3f85c787 03-Dec-2015 Rui Miguel Silva <rui.silva@linaro.org>

greybus: lights: add v4l2 flash operations

We do not implement any of the v4l2 flash operations, as the default
ones are ok for now, however the init needs anything define, if not it
will return an error. So, just define it and have an error free v4l2
flash init.

Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>


# f865734d 11-Nov-2015 Johan Hovold <johan@kernel.org>

greybus: light: fix class-device parent

Greybus bundle drivers should register their class devices as children
to the bundle device that they bind to.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>


# 5fd18b37 14-Oct-2015 Greg Kroah-Hartman <gregkh@google.com>

greybus: light : use the bundle struct device instead of the connector

We are removing struct device from the gb_connection structure in the
near future. The gb_bundle structure's struct device should be used as
a replacement.

This patch moves the light driver to use the bundle pointer instead of
the connection pointer.

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Reviewed-by: Alex Elder <elder@linaro.org>


# 2870b52b 14-Aug-2015 Rui Miguel Silva <rui.silva@linaro.org>

greybus: lights: add lights implementation

This patch adds lights implementation for Greybus Lights class, it
allows multiplexing of lights devices using the same connection. Also
adds two sysfs entries to led class (color, fade) which are commonly
used in several existing LED devices.

It support 2 major class of devices (normal LED and flash type), for
the first it registers to led_classdev, for the latest it registers in
the led_classdev_flash and v4l2_flash, depending on the support of the
kernel version.

Each Module can have N light devices attach and each light can have
multiple channel associated:
glights
|->light0
| |->channel0
| |->channel1
| | ....
| |->channeln
|->...
|->lightn
|->channel0
|->channel1
| ....
|->channeln

Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>