1
0
Fork 0
Commit Graph

128 Commits (8465def499c70d041a234087eff380108da7e830)

Author SHA1 Message Date
Greg Kroah-Hartman 8465def499 staging: greybus: move the greybus core to drivers/greybus
The Greybus core code has been stable for a long time, and has been
shipping for many years in millions of phones.  With the advent of a
recent Google Summer of Code project, and a number of new devices in the
works from various companies, it is time to get the core greybus code
out of staging as it really is going to be with us for a while.

Cc: Johan Hovold <johan@kernel.org>
Cc: linux-kernel@vger.kernel.org
Cc: greybus-dev@lists.linaro.org
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Acked-by: Alex Elder <elder@kernel.org>
Link: https://lore.kernel.org/r/20190825055429.18547-9-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-08-27 19:03:04 +02:00
Greg Kroah-Hartman b24413180f License cleanup: add SPDX GPL-2.0 license identifier to files with no license
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.

By default all files without license information are under the default
license of the kernel, which is GPL version 2.

Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier.  The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.

This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.

How this work was done:

Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
 - file had no licensing information it it.
 - file was a */uapi/* one with no licensing information in it,
 - file was a */uapi/* one with existing licensing information,

Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.

The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne.  Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.

The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed.  Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.

Criteria used to select files for SPDX license identifier tagging was:
 - Files considered eligible had to be source code files.
 - Make and config files were included as candidates if they contained >5
   lines of source
 - File already had some variant of a license header in it (even if <5
   lines).

All documentation files were explicitly excluded.

The following heuristics were used to determine which SPDX license
identifiers to apply.

 - when both scanners couldn't find any license traces, file was
   considered to have no license information in it, and the top level
   COPYING file license applied.

   For non */uapi/* files that summary was:

   SPDX license identifier                            # files
   ---------------------------------------------------|-------
   GPL-2.0                                              11139

   and resulted in the first patch in this series.

   If that file was a */uapi/* path one, it was "GPL-2.0 WITH
   Linux-syscall-note" otherwise it was "GPL-2.0".  Results of that was:

   SPDX license identifier                            # files
   ---------------------------------------------------|-------
   GPL-2.0 WITH Linux-syscall-note                        930

   and resulted in the second patch in this series.

 - if a file had some form of licensing information in it, and was one
   of the */uapi/* ones, it was denoted with the Linux-syscall-note if
   any GPL family license was found in the file or had no licensing in
   it (per prior point).  Results summary:

   SPDX license identifier                            # files
   ---------------------------------------------------|------
   GPL-2.0 WITH Linux-syscall-note                       270
   GPL-2.0+ WITH Linux-syscall-note                      169
   ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause)    21
   ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)    17
   LGPL-2.1+ WITH Linux-syscall-note                      15
   GPL-1.0+ WITH Linux-syscall-note                       14
   ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause)    5
   LGPL-2.0+ WITH Linux-syscall-note                       4
   LGPL-2.1 WITH Linux-syscall-note                        3
   ((GPL-2.0 WITH Linux-syscall-note) OR MIT)              3
   ((GPL-2.0 WITH Linux-syscall-note) AND MIT)             1

   and that resulted in the third patch in this series.

 - when the two scanners agreed on the detected license(s), that became
   the concluded license(s).

 - when there was disagreement between the two scanners (one detected a
   license but the other didn't, or they both detected different
   licenses) a manual inspection of the file occurred.

 - In most cases a manual inspection of the information in the file
   resulted in a clear resolution of the license that should apply (and
   which scanner probably needed to revisit its heuristics).

 - When it was not immediately clear, the license identifier was
   confirmed with lawyers working with the Linux Foundation.

 - If there was any question as to the appropriate license identifier,
   the file was flagged for further research and to be revisited later
   in time.

In total, over 70 hours of logged manual review was done on the
spreadsheet to determine the SPDX license identifiers to apply to the
source files by Kate, Philippe, Thomas and, in some cases, confirmation
by lawyers working with the Linux Foundation.

Kate also obtained a third independent scan of the 4.13 code base from
FOSSology, and compared selected files where the other two scanners
disagreed against that SPDX file, to see if there was new insights.  The
Windriver scanner is based on an older version of FOSSology in part, so
they are related.

Thomas did random spot checks in about 500 files from the spreadsheets
for the uapi headers and agreed with SPDX license identifier in the
files he inspected. For the non-uapi files Thomas did random spot checks
in about 15000 files.

In initial set of patches against 4.14-rc6, 3 files were found to have
copy/paste license identifier errors, and have been fixed to reflect the
correct identifier.

Additionally Philippe spent 10 hours this week doing a detailed manual
inspection and review of the 12,461 patched files from the initial patch
version early this week with:
 - a full scancode scan run, collecting the matched texts, detected
   license ids and scores
 - reviewing anything where there was a license detected (about 500+
   files) to ensure that the applied SPDX license was correct
 - reviewing anything where there was no detection but the patch license
   was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
   SPDX license was correct

This produced a worksheet with 20 files needing minor correction.  This
worksheet was then exported into 3 different .csv files for the
different types of files to be modified.

These .csv files were then reviewed by Greg.  Thomas wrote a script to
parse the csv files and add the proper SPDX tag to the file, in the
format that the file expected.  This script was further refined by Greg
based on the output to detect more types of files automatically and to
distinguish between header and source .c files (which need different
comment types.)  Finally Greg ran the script using the .csv files to
generate the patches.

Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-02 11:10:55 +01:00
Johan Hovold 2eccd4aa19 staging: greybus: enable compile testing of arche driver
Add Arche platform-driver config option and allow the driver to be
compile tested also without the out-of-tree usb3613 driver.

Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-16 13:39:16 +02:00
Greg Kroah-Hartman bdfb95c4ba staging: greybus: remove timesync protocol support
While the timesync protocol was a great idea, it never ended up getting
implemented by any known hardware devices.  It's also a bit
"interesting" in how it ties into the platform controller.

So, just remove it for now.  It's not needed, no one uses it, and it's a
stumbling block in getting the greybus core code merged out of the
staging tree.  If anyone wants it in the future, reverting this patch is
a great place to start from.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Johan Hovold <johan@kernel.org>
Reviewed-by: Alex Elder <elder@kernel.org>
Acked-by: Bryan O'Donoghue <pure.logic@nexus-software.ie>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-07 17:00:57 +01:00
Rui Miguel Silva b04f56c6e7 staging: greybus: makefile: fix dependency of spi to spilib
Greybus SPI driver depends on gb-spilib and we need to state that at
makefile to make it link correctly.

Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-09-19 16:49:53 +02:00
Greg Kroah-Hartman d4f56b47a8 staging: greybus: Add drivers/staging/greybus to the build
This adds a proper Kconfig file for drivers/staging/greybus and fixes up
the Makefile to work correctly within the kernel build system (modules
depend on the .config options, etc.)

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-09-19 16:30:37 +02:00
Viresh Kumar e3eda54d0b greybus: Add Component Authentication Protocol support
This patch adds Component Authentication Protocol support in greybus.
The purpose of the CAP protocol is to authenticate the Module hardware,
and it can only be used when it is present as part of the
firmware-management bundle, on a separate CPort.

Compile tested only.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Jun Li <li_jun@projectara.com>
Tested-by: Jun Li <li_jun@projectara.com>
Signed-off-by: Alex Elder <elder@linaro.org>
2016-07-06 17:51:32 -05:00
Joel Porquet c0e65d026c greybus: add support for the log protocol
Add support for the new Log class/protocol. This protocol allows modules
to send their internal logging messages to the AP in order to make
module debugging easier.

The protocol is, for now, composed a single module-initiated request.
This request contains a message and associated length. The message is
integrated in the kernel log with dev_dbg(). In order to be displayed
with 'dmesg', the following command needs to be entered first:

$ echo "file log.c +p" > /sys/kernel/debug/dynamic_debug/control

The major portion of this file was initially written by Greg KH.

Signed-off-by: Joel Porquet <porquet_joel@projectara.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-06-24 15:46:52 -07:00
Viresh Kumar aa62b5e49a greybus: bootrom: Compile as a separate module
User space doesn't break anymore with new greybus modules and its time
to make bootrom a separate module.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-06-09 17:28:02 -07:00
Bryan O'Donoghue 970dc85bd9 greybus: timesync: Add timesync core driver
This patch adds the core timesync functionality.

0. arche-platform.c/arche-apb-ctrl.c
   Modifies the platform layer to hook the incoming TIME_SYNC signal up to
   the timesync strobe IRQ handler. If the arche-platform driver can't
   satisfy the request for the wake-detect line, it will return -EAGAIN and
   the calling work-queue must reschedule the attempt to get exclusive
   access to the wake-detect pin logic. A private data field is added to
   the arche-platform driver to enable passing of a timesync pointer to the
   ISR responsible for synchronizing time.

1. timesync.c
   A new file added which contains all of the logic associated with sending
   greybus commands to SVC, APBx or Interfaces to enable, disable and
   disseminate timing information.

2. timesync_platform.c
   Any platform/arch specific code goes into timesync_platform.c.
   Originally the idea was to keep the x86 and ARM arch dependencies in a
   timesync_platform_arch.c file - however with further refinement that's
   currently not necessary however just-in-case it becomes necessary to
   resuscitate arch or platform specific methods for accessing timer
   resources that access shouldn't be part of the core timesync.c logic and
   so for the moment we access these timer resources through a thin access
   layer in timesync_platform.c. Expect this to go away long term ideally.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Acked-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-06-06 20:37:47 -07:00
David Lin 038405db98 greybus: legacy: remove protocol.o from the makefile
Commit 0917cba11 ("legacy: remove legacy driver support")
removed protocol.c, however, the corresponding target in the Makefile
was not removed therefore broken the build.

Testing Done:
- Build & boot on EVT1.5

Signed-off-by: David Lin <dtwlin@google.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-05-20 19:45:50 -07:00
David Lin 428888a2b6 greybus: legacy: remove legacy driver support
This patch removes the greybus legacy driver support

Signed-off-by: David Lin <dtwlin@google.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-05-20 16:47:30 -07:00
Sandeep Patil e54b106dd1 greybus: gpbridge: rename 'gpbridge' to 'gbphy' everywhere
The 'gpbridge' name didn't relaly reflect what the bus is; which
is a bus for bridged-phy devices. So, rename all instances
of 'gpbridge' to more appropriate 'gbphy'

Testing Done:
Build and boot tested. 'lsgb' will stop displaying 'GPBridge' devices
until I change the library to reflect this change.

Signed-off-by: Sandeep Patil <patil_sandeep@projectara.com>
Suggested-by: Greg Kroah-Hartman <gregkh@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-05-19 10:09:13 -07:00
Viresh Kumar 013e665372 greybus: fw-management: Add firmware-management protocol driver
This patch adds Firmware Management Protocol support to firmware core,
which allows the AP to manage firmware on an Interface.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Jun Li <li_jun@projectara.com>
Tested-by: Karthik Ravi Shankar <karthikrs@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-05-15 00:23:52 +02:00
Viresh Kumar 8888b96374 greybus: spi: Separate out spilib from spi bridged PHY bundle driver
spilib can be used by multiple bridge drivers implementing different
bundle classes. Separate out bridged PHY bundle drivers parts.

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>
2016-05-14 23:18:32 +02:00
Viresh Kumar 4c412921c7 greybus: spi: Restructure spi.c to share it with other bundle drivers
This patch restructures spi.c as spilib core, so that the same logic can
be reused for SPI connections implemented as part of different bundle
types. This is required for Firmware Management Bundle.

Note that the 'struct gb_protocol' and its callback aren't moved to
a separate file in this commit to make its reviews easier. That will be
done by a following patch.

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>
2016-05-14 23:18:32 +02:00
Viresh Kumar a4b9a098f2 greybus: gpbridge: Rename gb-phy.ko module
Rename gb-phy.ko module as gb-gpbridge.ko.

Tested on EVT 1.5 by inserting GP test module, all the devices were
enumerated correctly.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-05-14 19:13:57 +02:00
Viresh Kumar ea7c47771b greybus: usb: Create separate module
Create separate module for usb gpbridge driver.

Tested on EVT 1.5 by inserting GP test module, all the devices were
enumerated correctly.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-05-14 19:13:57 +02:00
Viresh Kumar 66b9e09e28 greybus: uart: Create separate module
Create separate module for uart gpbridge driver.

Tested on EVT 1.5 by inserting GP test module, all the devices were
enumerated correctly.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-05-14 19:13:57 +02:00
Viresh Kumar bebc013baf greybus: spi: Create separate module
Create separate module for spi gpbridge driver.

Tested on EVT 1.5 by inserting GP test module, all the devices were
enumerated correctly.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-05-14 19:13:57 +02:00
Viresh Kumar 3d64730e11 greybus: sdio: Create separate module
Create separate module for sdio gpbridge driver.

Tested on EVT 1.5 by inserting GP test module, all the devices were
enumerated correctly.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-05-14 19:13:57 +02:00
Viresh Kumar dca8060db8 greybus: pwm: Create separate module
Create separate module for pwm gpbridge driver.

Tested on EVT 1.5 by inserting GP test module, all the devices were
enumerated correctly.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-05-14 19:13:57 +02:00
Viresh Kumar d6046b44a5 greybus: i2c : Create separate module
Create separate module for i2c gpbridge driver.

Tested on EVT 1.5 by inserting GP test module, all the devices were
enumerated correctly.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-05-14 19:13:57 +02:00
Viresh Kumar 7c0925eb57 greybus: gpio: Create separate module
Create separate module for gpio gpbridge driver.

Tested on EVT 1.5 by inserting GP test module, all the devices were
enumerated correctly.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-05-14 19:13:57 +02:00
Viresh Kumar cca2220767 greybus: firmware: Add firmware-download protocol driver
This patch adds Firmware Download Protocol support to firmware core,
which allows an Interface to download a firmware package over Unipro.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Jun Li <li_jun@projectara.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-04-29 14:34:32 -07:00
Viresh Kumar 9e04fb7b16 greybus: firmware: Add firmware management bundle driver
All firmware packages on the Modules or Interfaces are now managed by a
special Firmware Management Protocol. The Interface Manifest shall
at least contain the Firmware Management Bundle and a Firmware
Management Protocol CPort within it.

The bundle may contain additional CPorts based on the extra
functionality required to manage firmware packages.

For example, this is how the Firmware Management Bundle of the Interface
Manifest may look like:

	; Firmware Management Bundle (Bundle 1):
	[bundle-descriptor 1]
	class = 0x16

	; (Mandatory) Firmware Management Protocol on CPort 1
	[cport-descriptor 1]
	bundle = 1
	protocol = 0x18

	; (Optional) Firmware Download Protocol on CPort 2
	[cport-descriptor 2]
	bundle = 1
	protocol = 0x17

	; (Optional) SPI protocol on CPort 3
	[cport-descriptor 3]
	bundle = 1
	protocol = 0x0b

	; (Optional) Component Authentication Protocol (CAP) on CPort 4
	[cport-descriptor 4]
	bundle = 1
	protocol = 0xXX //TBD

This patch adds the basic firmware-management bundle driver, which just
creates a firmware-management connection. Support for individual
protocols will be added separately.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-04-27 11:10:44 -07:00
Vaibhav Agarwal 2b8c2b5100 greybus: audio: Changes in response to ASoC cleanup
Update Makefile in response to SND_SOC_DYNAMIC_DAILINK cflag
removal.

Update files for msm-dynamic-dailink.h header file removal.

Update in response to API name changes. Also, acquire sound card
controls_rwsem before adding kcontrols to avoid deadlock.

Signed-off-by: Vaibhav Agarwal <vaibhav.agarwal@linaro.org>
Reviewed-by: Mark Greer <mgreer@animalcreek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-04-25 17:37:10 -07:00
Johan Hovold b15d97d770 greybus: core: add module abstraction
Add Greybus module abstraction that will be used to implement controlled
module removal (eject) and represent module geometry.

Greybus module devices correspond to physical modules and have one or
more interfaces. Modules have an id that is identical to the id of their
primary interface, which in turn is the interface with lowest numbered
id. The module name is constructed from the bus and module id:

        <bus_id>-<module_id>

Interfaces, bundles, and control devices are consequently renamed as

        <bus_id>-<module_id>.<interface_id>
        <bus_id>-<module_id>.<interface_id>.<bundle_id>
        <bus_id>-<module_id>.<interface_id>.ctrl

As before, interface ids (and therefore in a sense now also module ids)
correspond to physical interface positions on the frame.

Modules have the following attributes:

        module_id
        num_interfaces

where module_id is the id of the module and num_interface the number of
interfaces the module has.

Note that until SVC module-size detection has been implemented, all
interfaces are considered to be part of 1x2 modules. Specifically, the
two interfaces of a 2x2 module will be presented as two 1x2 modules for
now.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-04-25 11:08:30 -07:00
Viresh Kumar 5a53e02eaf greybus: firmware: Rename to bootrom protocol
Align with Greybus specifications and rename Firmware Protocol driver as
Bootrom Protocol driver.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-04-04 21:19:06 -07:00
Vaibhav Agarwal 5793227cb0 greybus: audio: Add module specific driver
Use seperate driver to process GB Audio modules plugged-in.
It'll use helper function register_module to attach itself
to gbaudio-codec driver.

Signed-off-by: Vaibhav Agarwal <vaibhav.agarwal@linaro.org>
Reviewed-by: Mark Greer <mark.greer@animalcreek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-03-29 11:15:14 -07:00
Greg Kroah-Hartman 7d0493d191 greybus: only build arche platform driver if usb3613 is enabled
The build is broken if you try to build the arche platform driver
without the usb3163 driver enabled at the same time, so specify that
dependency in the greybus Makefile.

Testing done: 	built inside and outside of the build system against
		many different kernel versions.

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Reviewed-by: Michael Scott <michael.scott@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-02-15 14:43:59 -08:00
Greg Kroah-Hartman 7030f9246b greybus: camera: only build module against msm kernel
The camera driver currently does not build against anything other than
the msm kernel, due to cross-dependancies, so enable that here so that
we can build against other kernels without failing the build.

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Tested-by: Marti Bolivar <mbolivar@leaflabs.com>
Acked-by: Laurent Pinchart <laurent.pinchart@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-01-26 09:52:20 -08:00
Greg Kroah-Hartman ed7279ae31 greybus: svc: add a "watchdog" to check the network health
Now that we have a svc ping command, let's add a watchdog to call it
every so often (1 second at the moment.)  If it finds something went
wrong, post a stern message to the kernel log and call:
	start unipro_reset
to reset the whole greybus hardware subsystem.

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Reviewed-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-01-23 17:38:33 -08:00
Johan Hovold 5dda7e5a48 greybus: legacy: add legacy-protocol bundle driver
Add the first Greybus bundle driver that will be used when transitioning
from legacy Greybus protocols to bundle drivers.

The legacy-protocol driver initially binds to all current bundle classes.

In order to avoid having to update current module-loading scripts, keep
this driver internal to greybus core at least until modalias support is
added. Note that this prevents unloading any protocol drivers without
first tearing down the host device due to a circular module dependency.

Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-01-19 12:12:40 -08:00
Vaibhav Agarwal 6339d2322c greybus: audio: Add topology parser for GB codec
For each GB codec module inserted, DAPM widgets, kcontrols, routes
and DAIs can be fetched through greybus in a binary chunk and parsed
locally to create & populate DAPM graph for the specific module.

It is required by each codec module to populate a minimum set of
kcontrols with fixed names to support basic audio usecase.
To support advanced features of codec module, the same can be polpulated
with existing topology parser. However, to use them for different usecase
separate mechanism (may be via MSP) is required to inform userspace about
their configuration value & enable/disable sequence.

ToDos:
Currently, support for enumerated kcontrol/dapm control is hardcoded.
Need to add complete logic within the parser.

Signed-off-by: Vaibhav Agarwal <vaibhav.agarwal@linaro.org>
Signed-off-by: Mark Greer <mgreer@animalcreek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-01-13 16:41:36 -08:00
Greg Kroah-Hartman 86a685dd45 greybus: Makefile: fix up build test for gb-audio-codec.ko
We really only want to build the module if the config is set, not all
the time like the current code does.

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-01-13 16:18:36 -08:00
Vaibhav Agarwal 7885342cc2 greybus: audio: Build audio module conditionally
Added CONFIG_XXX flag check before compiling audio module.
Once we add dynamic DAI link registration from audio driver,
this check wil be required to avoid compilation failures with
other kernel revisions.

Also, renamed header file to better align with .c file name.

Signed-off-by: Vaibhav Agarwal <vaibhav.agarwal@linaro.org>
Signed-off-by: Mark Greer <mgreer@animalcreek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-01-13 16:15:57 -08:00
Svetlin Ankov 8db00736d3 greybus: audio: Add Audio Manager
This is a simple module that keeps a list of connected GB audio
modules.

Whenever a device is attached, an appropriate uevent is sent to
userspace:

    UDEV  [4941.803215] add      /kernel/gb_audio_manager/0 (gb_audio_manager)
    ACTION=add
    CPORT=99
    DEVICES=0x10
    DEVPATH=/kernel/gb_audio_manager/0
    NAME=naim
    PID=64
    SEQNUM=1828
    SLOT=2
    SUBSYSTEM=gb_audio_manager
    USEC_INITIALIZED=802416
    VID=128

And whenever removed:

    UDEV  [4941.836588] remove   /kernel/gb_audio_manager/0 (gb_audio_manager)
    ACTION=remove
    DEVPATH=/kernel/gb_audio_manager/0
    SEQNUM=1833
    SUBSYSTEM=gb_audio_manager
    USEC_INITIALIZED=835681

The API consists of functions for adding, removing and inspecting
added device module descriptions (struct gb_audio_module):

    int                         gb_audio_manager_add(struct gb_audio_module_descriptor *desc);
    int                         gb_audio_manager_remove(int id);
    int                         gb_audio_manager_remove_all(void);
    struct  gb_audio_module*    gb_audio_manager_get_module(int id);
    void                        gb_audio_manager_put_module(struct gb_audio_module *module);
    int                         gb_audio_manager_dump_module(int id);
    void                        gb_audio_manager_dump_all(void);

Devices can be inspected through sysfs in /sys/kernel/gb_audio_manager/{id}/*

If GB_AUDIO_MANAGER_SYSFS is exported as 'true', managing devices can be done
via the SYSFS as well. For instance:

    echo name=naim slot=2 vid=128 pid=64 cport=99 devices=0x10 > /sys/kernel/gb_audio_manager/add
    echo all > /sys/kernel/gb_audio_manager/dump
    echo 2 > /sys/kernel/gb_audio_manager/dump
    echo 2 > /sys/kernel/gb_audio_manager/remove

Signed-off-by: Svetlin Ankov <ankov_svetlin@projectara.com>
Signed-off-by: Mark Greer <mgreer@animalcreek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-01-13 16:12:56 -08:00
Mark Greer 4dbf505640 greybus: audio: Add direct audio streaming control for APBridgeA
The latest audio architecture does not stream audio data over the
USB link between the AP and APBridgeA.  Instead, audio data is
streamed directly over the I2S link between the two.

To support the Greybus audio driver in setting up the I2S port and
controling packeting/depacketizing of audio data to/from Greybus
audio messages, define a set of commands and their parameters.
These commands and parameters will be placed into a request and sent
over the USB control channel to APBridgeA.  A corresponding driver
on APBridgeA will receive and process the requests.

Signed-off-by: Mark Greer <mgreer@animalcreek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-01-13 16:02:04 -08:00
Mark Greer 184992e305 greybus: audio: Add Greybus Audio Device Class Protocol helper routines
Add helper routines to make communicating with audio modules easier.

Signed-off-by: Mark Greer <mgreer@animalcreek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-01-13 16:00:32 -08:00
Mark Greer fd8f9e12e2 greybus: audio: Use underscore in file name
For consistency with most other files in the Greybus repository,
change 'audio-codec.c' to use an underscore instead of a hyphen
in its name.

Signed-off-by: Mark Greer <mgreer@animalcreek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-01-13 16:00:32 -08:00
Rui Miguel Silva 14006ab2f5 greybus: makefile: add requirement for CONFIG_INPUT
To support key events coming from the svc (ara key) it is needed to add
the input core as an required config option.

Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-01-13 12:06:08 -08:00
Greg Kroah-Hartman 1e5dd1f827 greybus: arche-platform: merge arche-apb-ctrl and arche-platform
No need to have two separate arche platform drivers, that's just crazy,
so merge them both together to be only one kernel module.

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Reviewed-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
Tested-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
2016-01-04 16:05:25 -08:00
Vaibhav Hiremath 5a78178718 greybus: arche-apb-ctrl: Add APB control driver
It was messy to integrate both SVC, APB (and any other arche
platform specific control) into one single driver. Especially
due to cross-dependency.

AP first needs to bringup SVC, as SVC should enable clock to APB.
APB should come up before HUB, as due to some reason HUB wouldn't
enumerate APB's is APB comes up later.
And on top of that we should have clean picture of hardware description
in DT file.

So this patch introduces APB control driver. Mostly copied from original
arche-platform driver + fixed boot sequence.

Signed-off-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-12-22 17:40:43 -08:00
Vaibhav Hiremath 7fa6065475 greybus: arche-platform: Rename db3-platform to arche-platform
With multiple platforms getting rolled into ara,
db3 name is confusing. And this driver is applicable
to all arche platforms, so make sense to rename it to
arche-platform.c. Also rename all internal functions
accordingly.

Signed-off-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-12-22 17:40:43 -08:00
Greg Kroah-Hartman 70b3b3e77a greybus: tools: don't always build them.
This breaks the kernel-only build as it can't find any userspace headers
with the cross-compiler, so don't build the tools by "default" unless
you ask for them.

Reported-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-12-17 22:32:03 -08:00
Greg Kroah-Hartman 6b0658f687 greybus: tools: Add tools directory to greybus repo and add loopback
Move the loopback test to the greybus main repo, as we will be adding
more tests over time and it doesn't need to be burried in the gbsim
repo.

This moves the latest version from gbsim to this repo and fixes up the
Makefile to be a bit more "smart" when building the code.

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-12-17 18:17:07 -08:00
Laurent Pinchart 3265edaf0d greybus: Add driver for the camera class protocol
Integration with the V4L2 camera drivers isn't available yet, a debugfs
interface is exposed instead to call the camera Greybus operations.

The debugfs interface will be kept for module testing purpose in order
to exercise all the protocol operations with various valid and invalid
parameters.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo.mondi@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-12-14 18:12:30 -08:00
Johan Hovold 0f37860de9 greybus: kill the endo
Remove the now unused endo and module code.

Note that the never-implemented serial and version attributes of the
endo can be implemented as svc attributes if needed.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-11-25 15:35:59 -08:00
Vaibhav Agarwal d3d2af51f9 greybus: Audio: Add skeleton code for GB virtual codec driver
This patch adds gb-codec driver with static information for
DAPM widgets, controls & dapm_routes.

Including some changes in kernel code(machine driver):
- Able to register codec and glue it with existing sound card successfully.
- Able to view & modify mixer controls:
        (volume/mute[left/right][input/output])
- Able to view DAPM widgets registered via /debug interface.
- Able to establish DAPM path for playback.

Since, FE<->BE path not yet verified with default jetson build,
registering GB DAI as normal DAI link to verify GB virtual codec
specific DAPM path.

Signed-off-by: Vaibhav Agarwal <vaibhav.agarwal@linaro.org>
Reviewed-by: Mark Greer <mgreer@animalcreek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-11-23 16:38:22 -08:00