Commit graph

1820 commits

Author SHA1 Message Date
Evgeniy Borisov
b490503896 greybus: camera-gb: Extend the configure streams interface
Extending the configure streams interface with CSI params.
Getting CSI frequency data form configure streams response.
 * num_lanes - Number of CSI data lanes
 * clk_freq - CSI clock frequency in Hz
 * lines_per_second - Total number of lines in a second of
transmission (blanking included)

From the AP side we need to know for the CSI speed
configuration. This information is needed for dynamically
bandwidth calculations.

NOTE: Change should be along merged with corresponding
      interface change in kernel:
      "camera: Extend the configure streams
      interface with CSI params"

Signed-off-by: Evgeniy Borisov <eborisov@mm-sol.com>
Reviewed-by: Gjorgji Rosikopulos <grosikopulos@mm-sol.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-04-11 18:47:57 -07:00
David Lin
ddb10c8acc greybus: svc: add Interface power measurements support
This change implements the AP Power Monitor functions for obtaining
current/voltage/power on a specific rail of an Interface.

Testing Done:

$ cat /sys/bus/greybus/devices/1-3/current_now
103
$ cat /sys/bus/greybus/devices/1-3/power_now
303
$ cat /sys/bus/greybus/devices/1-3/voltage_now
203

Signed-off-by: David Lin <dtwlin@google.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-04-07 21:37:59 -07:00
Vaibhav Agarwal
89de9a0621 greybus: audio: Update device type based on widget types
Device type info shared to above HAL is currently hard coded
to SPK only. Actual device type is identifed while parsing
widget types from topology FW shared by codec module.

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-05 09:39:22 -04:00
Vaibhav Agarwal
a9234bfd6c greybus: audio_manager: Split device type into i/p & o/p devices
Currently, single field is used to report device type say SPK,
MIC, HS, HP, etc. However above HAL expects separate fields for
input & ouput device types.

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-05 09:39:22 -04:00
Gjorgji Rosikopulos
dc5cc72cc6 greybus: camera: Add metadata format
Add support for greybus metadata format.
Greybus metadata format id is 0x41.

Signed-off-by: Gjorgji Rosikopulos <grosikopulos@mm-sol.com>
Acked-by: Laurent Pinchart <laurent.pinchart@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-04-04 21:19:06 -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
Viresh Kumar
0c35631bce greybus: checkpatch.pl: Mark --no-tree as default option
Don't know why, but checkpatch checks if we are running it from top of a
kernel tree or not, but then it also provides an option to suppress the
warning using --no-tree.

Instead of forcing everyone to use this every time, lets make this
behavior default.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-04-02 19:44:30 -07:00
Akash Choudhari
f053f44c9f greybus: Revert "Added a sysfs entry to power down the SVC"
This reverts commit a1d8f2c3856804ed26157104bb203edf4c882a6c.
2016-04-01 20:10:01 -07:00
Georgi Dobrev
88a3011e91 greybus: Added a sysfs entry to power down the SVC
Added a sysfs entry called pwr_off. When a "1" is passed to it,
it sends a GB_SVC_TYPE_PWR_DOWN command to the SVC, powering it down
along with the switch and INA231 chips.

Testing Done: Tested on EVT1_5, works.

Signed-off-by: Georgi Dobrev <dobrev_georgi@projectara.com>
2016-04-01 14:41:49 -07:00
Greg Kroah-Hartman
d9984cf0f2 greybus: scripts: create subdir for checkpatch and spelling.txt
They belong in a subdir.

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-03-31 22:35:24 -07:00
Greg Kroah-Hartman
a4d11cee6f greybus: trivial: add checkpatch.pl to the tree
For those who are stuck using old kernel trees, let's include the latest
version of checkpatch.pl into our tree to help prevent coding style
mistakes from creeping in.

Also add spelling.txt to catch spelling errors in comments.

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-03-31 22:26:39 -07:00
Vaibhav Agarwal
094c4302c1 greybus: audio: Add I2S_RX path related settings
Capture path related settings during startup, perpare &
hwparams were earlier missing.

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-03-31 10:19:57 -07:00
Vaibhav Agarwal
64a7e2cceb greybus: audio: Added jack support to audio module
Register jack with ASoC sound card in case audio module
populates it via codec FW. Currently, only a single jack
with 4 buttons can be registered for each module.

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-03-31 10:19:57 -07:00
Vaibhav Agarwal
6da549ec85 greybus: audio: Fix widget pointer update during control parsing
widget pointer was incorrectly modfied while parsing kcontrol

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-03-31 10:19:57 -07:00
Gjorgji Rosikopulos
1472ec67f7 greybus: camera: Use pointer for gb camera module ops
No need to duplicate module ops on every registration.

NOTE: Change should be along merged with:
"msm: camera: Change gb_camera_module ops to pointer"

Signed-off-by: Gjorgji Rosikopulos <grosikopulos@mm-sol.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-03-31 10:07:59 -07:00
Johan Hovold
a7be84613a greybus: interface: add Ara serial-number support
Add support for reading the Ara serial-number attributes.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-03-30 14:23:19 -07:00
Johan Hovold
50ad4163a5 greybus: interface: clean up DME attribute handling
Move all DME defines to the interface code and rename them using common
prefixes (e.g. DME_T and DME_TOSHIBA).

The DDB L1 attributes are defined by MIPI and the Ara attributes are
currently Toshiba specific so move them all out of the Greybus protocol
header.

Also rename the Greybus init-status values using a GB_INIT prefix.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-03-30 14:23:19 -07:00
Johan Hovold
ac72cfbe69 greybus: interface: clean up ES2 VID/PID hack
Clean up the ES2 VID/PID hack using a new quirk flag.

Note that the hack is now used if and only if the interface is a Toshiba
ES2 bridge (and not if the attributes read zero).

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-03-30 14:23:19 -07:00
Johan Hovold
7d7acc06a0 greybus: interface: add ES2 init-status quirk flag
Add ES2 init-status quirk flag instead of checking MID/PID directly.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-03-30 14:23:19 -07:00
Johan Hovold
153ff7e76d greybus: interface: read DME attributes at activation
Read the DDBL1 and Ara DME attributes when activating an interface.

These values are currently provided by the SVC in the intf_hotplug
request, which is about to go away.

Note that there are currently no standard Ara VID and PID attributes and
that Toshiba uses attributes from the reserved space in ES3. For now, we
therefore refuse to enumerate any non-Toshiba bridges.

Also note that the Ara serial number is currently not supported.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-03-30 14:23:19 -07:00
Johan Hovold
af1471e7a9 greybus: greybus_protocols: rename NULL DME selector index
Add NULL suffix to the don't-care DME selector index.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-03-30 14:23:19 -07:00
Johan Hovold
e9f2f688d1 greybus: interface: clean up device-id handling
Clean up the device id-handling and make sure we never allocate invalid
device ids due to a missing upper bound.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-03-30 14:23:19 -07:00
Johan Hovold
984c9d38ae greybus: interface: deactivate interface on enumeration failure
Deactivate an interface immediately on enumeration failure.

Note that an interface is always registered.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-03-30 14:23:19 -07:00
Johan Hovold
4d5f621888 greybus: interface: move route creation to interface activation
Creating and destroying a route to an interface is arguably an interface
operation and belongs with the interface code.

Add new interface_activate and interface_deactivate helpers that will be
used to activate and deactivate an interface in the new interface boot
sequence.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-03-30 14:17:40 -07:00
Johan Hovold
ec199ccdd2 greybus: interface: clean up ES3-bootroom-quirk handling
Clean up handling of the ES3-bootrom quirks by adding an interface
quirk-flags field that is set appropriately when we detect that the ES3
bootrom is running.

Note that we need to reserve the DME_DIS_UNIPRO_BOOT_STARTED and
DME_DIS_FALLBACK_UNIPRO_BOOT_STARTED status values for the ES3 bootrom,
which does not support any CPort features (unlike later boot stages).
Add a BOOTROM infix to the defines to make this more clear.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-03-30 14:17:40 -07:00
Johan Hovold
133e366bbe greybus: interface: clean up and rename init-status helper
Clean up and rename the interface-init-status helper.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-03-30 14:17:40 -07:00
Johan Hovold
e12811eff7 greybus: interface: fix es2 boot-status mask
The ES2 boot status is stored in the least significant byte.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-03-30 14:17:40 -07:00
Johan Hovold
c2d80906fb greybus: interface: move boot-status clearing to interface enable
Reading and clearing the boot status of an interface is an interface
operation and belongs in the interface code.

As part of the reworked interface boot sequence, we also want to do this
when enabling (enumerating) a Greybus interface.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-03-30 14:17:40 -07:00
Johan Hovold
9ba486e319 greybus: svc: indent CPort flag defines properly
Use tabs to indent CPort-flag values.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-03-30 14:17:40 -07:00
Johan Hovold
601df8ff3a greybus: greybus_protocols: remove bogus comment about svc bundle
The SVC connection is special and does not belong to neither an
interface or a bundle.

Remove the unused SVC bundle-id define.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-03-30 14:17:40 -07:00
Johan Hovold
b5eebbf6a1 greybus: svc: remove bogus interface-reset helper
Remove unused, bogus interface-reset helper.

The interface-reset operation is initiated by the SVC, not the AP.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-03-30 14:17:40 -07:00
Johan Hovold
1b4c4e98eb greybus: greybus_protocols: align DME-attribute values
Align the DME-attribute values in the protocol header.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-03-30 14:17:40 -07:00
Johan Hovold
b77e3e5658 greybus: core: fix two container-of macros
Fix two greybus container-of macros that used the pointer name for the
member.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-03-30 14:13:05 -07:00
Vaibhav Agarwal
d764212f73 greybus: audio: fix to resolve multiple audio module playback issue
Cleanup APBridge sequence only in case of last module plugged-out.
For other modules, unregister cportid is sufficient.

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
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
Vaibhav Agarwal
6dd67645f2 greybus: audio: Use single codec driver registration
We have single I2S port via APB1 for communication with all
audio modules. Thus, we should register single codec driver
and manage all individual audio modules internally within
this 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
0ec3063244 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>
2016-03-22 16:47:28 -04:00
Greg Kroah-Hartman
418f3dab84 greybus: connection: add functions to get/set private data
Add gb_connection_get_data() and gb_connection_set_data() to get and set
the private data of a connection, instead of "open coding" it
everywhere.

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>
2016-03-22 16:47:28 -04:00
David Lin
30b442b385 greybus: greybus_trace: Fix broken greybus ftrace
Enabling greybus ftrace event causes null pointer access due to
that gb_message to SVC has no Bundle. Fix it by handling this in
the trace header.

Testing Done:
$ echo 1 > /d/tracing/event/greybus/enable
 [002] ...1    54.504426: gb_message_send: greybus:1-svc op=0023 if_id=0 hd_id=0 l=0
 [002] ...1    54.504461: gb_host_device_send: greybus:greybus1 if_id=0 l=8

Signed-off-by: David Lin <dtwlin@google.com>
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-03-22 00:31:31 -04:00
Mark Greer
309520ec93 greybus: audio: Use CSD instead of E2EFC for audio data connections
There is no reason to use end-to-end flow control for Greybus
audio data connections so disable it and enable Controlled
Segment Dropping (CSD).

Testing Done: Played music using audio modules on an EVT1.5.

CC: Vaibhav Agarwal <vaibhav.agarwal@linaro.org>
CC: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Mark Greer <mgreer@animalcreek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-03-17 15:42:44 -07:00
Gjorgji Rosikopulos
c3d77f7130 greybus: camera: Improve module registration mechanism
Registering more then one module at same time was not
possible with previous implementation. Also unregistering
of the module was missing leading to many instability issues
when camera module is ejected when camera is still active.

Signed-off-by: Gjorgji Rosikopulos <grosikopulos@mm-sol.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-03-17 15:17:59 -07:00
Jacopo Mondi
a883b0eb43 greybus: camera: Register capabilities operation
Register the greybus camera driver capabilities operation to the
ara_camera subdevice

Signed-off-by: Jacopo Mondi <jacopo.mondi@linaro.org>
Reviewed-by: Gjorgji Rosikopulos <grosikopulos@mm-sol.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-03-17 10:18:54 -07:00
Laurent Pinchart
48b15a9b11 greybus: camera: Implement the capabilities operation
The operation queries the camera module for its capabilities. The
debugfs interface just prints a hex dump of the binary message.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo.mondi@linaro.org>
Reviewed-by: Gjorgji Rosikopulos <grosikopulos@mm-sol.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-03-17 10:18:54 -07:00
Sandeep Patil
f8811c7630 greybus: power_supply: reverse version check for new psy API
Reversing the kernel version check for new power supply APIs will
easily allow us to use older kernels with backported power supply APIs
by defining "CORE_OWNS_PSY_STRUCT" in power supply core header

Testing Done:
- Build tested with arche kernel with backported power supply APIs
- Build tested also with current arche kernel to make sure we build with
  3.10 kernels

Signed-off-by: Sandeep Patil <sspatil@google.com>
Reviewed-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-03-16 21:49:31 -07:00
Axel Haslam
3b90040de8 greybus: loopback_test: handle SIGINT signal
Adding a default timeout may not be representative of every
usecase for gb_loopback. Also, tests may continue to run
on the driver in case of a timeout.

To avoid adding a default timeout, handle SIGINT so that when the user
presses ctrl-c the test are stoped. The user can still specify a timeout
value with the -O option.

Signed-off-by: Axel Haslam <ahaslam@baylibre.com>
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-03-16 21:49:31 -07:00
Bryan O'Donoghue
fece9c87cb greybus: Ensure gb->mutex is held when adding timer
Currently in loopback on the async path we issue an operation and then add
a timer to time-out that operation should it fail to complete. Looking at a
backtrace given in its feasible op_async->pending can be true and
del_timer() can run before add_timer() has run. In the callback handler we
already hold gb->mutex. This patch fixes that potential race by ensuring we
hold gb->mutex both when we are adding and when we are removing the
relevant timer.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Reported-and-tested-by: Axel Haslam <ahaslam@baylibre.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-03-16 21:49:31 -07:00
Alexandre Bailon
1dc8d3d7c5 greybus: loopback: Fix broken loopback min values
Currently, when a loopback test completely fail,
loopback will return 4294967295 for every min value.
Return 0 instead of 4294967295 in such case.

Signed-off-by: Alexandre Bailon <abailon@baylibre.com>
Reviewed-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-03-16 21:49:31 -07:00
Johan Hovold
d18da86b51 greybus: greybus_protocols: remove svc-eject timeout define
The SVC eject timeout is implementation specific and does not belong in
the protocol header so move it to the svc module.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-03-10 13:57:42 -08:00
Johan Hovold
e676ccd713 greybus: svc: print an error message on failed eject attempts
Print an error message when the SVC fails to eject an interface.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Reviewed-by: Jeffrey Carlyle <jcarlyle@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-03-10 13:57:42 -08:00
Johan Hovold
c80514a39a greybus: svc: unexport eject helper
Do no export the interface-eject helper, which is only supposed to be
used by core.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Reviewed-by: Jeffrey Carlyle <jcarlyle@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-03-10 13:57:42 -08:00