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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Separate interface disable from interface removal.
Disabling an interface means tearing down its control connection and
destroying (i.e. deregistering and releasing) its bundles, while
removing it means deregistering and releasing the interface itself.
This is needed to implement controlled module removal, where the module
interfaces are disabled before being physically ejected.
Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Reviewed-by: Jeffrey Carlyle <jcarlyle@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Rename the interface-initialisation function gb_interface_enable(),
which is more descriptive.
Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Jeffrey Carlyle <jcarlyle@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>