Make sure to register also the control device along with any bundles
when registering an interface.
Note that we currently ignore failures to register the control device
just as we do for bundle devices.
Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Make the control object be a greybus device.
The control device will be used to expose attributes specific to
greybus-type interfaces.
Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Move the timesync-operation functions above the control-object
management functions, which is where all other operation implementations
reside.
Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Add control devices to the example sysfs tree.
Control devices are named
<bus_id>-<module_id>.<intf_id>.ctrl
and expose attributes that are specific to the greybus interface type.
Specifically, dummy interfaces do not have a control device.
Currently, only the vendor and product strings extracted from the
manifest are exported.
A subtree of the example tree now looks as follows:
greybus1/
├── 1-5
│ ├── 1-5.5
│ │ ├── 1-5.5.2
│ │ │ ├── bundle_class
│ │ │ ├── bundle_id
│ │ │ └── state
│ │ ├── 1-5.5.ctrl
│ │ │ ├── product_string
│ │ │ └── vendor_string
│ │ ├── ddbl1_manufacturer_id
│ │ ├── ddbl1_product_id
│ │ ├── interface_id
│ │ ├── product_id
│ │ ├── serial_number
│ │ └── vendor_id
│ ├── 1-5.6
│ │ └── interface_id
│ ├── eject
│ ├── module_id
│ └── num_interfaces
└── 1-svc
Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
The svc eject attribute was added as an interim solution and is still
used to implement a form of forced ejection.
This will soon be superseded by the module eject attribute, which will
provide an interface for clean eject. We may keep the forced-eject
mechanism around indefinitely, albeit possibly with a different name
(e.g. forced_intf_eject). Either way, update the example tree to reflect
the actual name, intf_eject, which currently used for this svc attribute.
Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Remove the interface unique_id attribute, which there is currently no
plan to ever implement.
Note that the Ara serial numbers are already exposed through the
serial_number attribute.
Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Move the interface power attributes after the other interface attributes
to keep the attributes grouped by device type.
Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
The manifest-parsing code could end up leaving the interface
vendor_string set to an error pointer that we'd eventually try to free
when destroying the interface.
Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
When transfer speed is too slow (less than 17Khz) the operation can take
longer than the default greybus timeout. Because of this we need to use
the request_send_sync_timeout and calculate the correct timeout for each
operation.
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Tested-by: Philip Yang <philipy@bsquare.com>
Tested-by: Axel Haslam <ahaslam@baylibre.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
The actual implementation of transfer_one_message have problems with
some cases in the possible transfer options. We try to maximize the
number of spi transfers in one greybus operation and need to save state
until the full message is dispatch over greybus.
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Tested-by: Philip Yang <philipy@bsquare.com>
Tested-by: Axel Haslam <ahaslam@baylibre.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
SVC watchdog should be disabled when device is entering suspend mode.
Testing done:
- Sanity tested on EVT1.5
- Check no SVC ping during the suspend process
- Check SVC watchdog is back on pinging once device is resumed
Signed-off-by: David Lin <dtwlin@google.com>
Signed-off-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
[vaibhav.hiremath@linaro.org: Removed unwanted check in notifier callback and
Updated commit description]
Tested-by: Sandeep Patil <sspatil@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Switch off APBs/SVC/Switch in the suspend call notifier. Note that
this is an interim solution to enable fishfooding.
Testing done:
- Passed QA sanity test on EVT1.5
- Suspend current measured at ~70mW
Signed-off-by: David Lin <dtwlin@google.com>
Signed-off-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
[vaibhav.hiremath@linaro.org: Updated commit description]
Tested-by: Sandeep Patil <sspatil@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
A number of data in TimeSync command structures are declared __u64/__u32
instead of __le64/__le32, I forgot to put this through an x86_64 compile
before presentation for merge and as a result didn't catch this error. This
patch fixes.
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Earlier during boot sequence implementation, we had seen race between
USb3613 and APB boot, and since APB boot time is ~2sec, we delayed
USb3613 configuration for 2sec after APB deassertion of reset.
This obviously won't work in the case of suspend/resume, where we would
like to put APB into OFF state and coldboot in resume.
With the latest FW changes, we do not see any race issue. I have done
regression testing (> 50 iteration of reboot + unipro link up and down)
without any issues.
So lets get rid of the 2sec delay with this patch.
Testing Done: Tested on EVT 1.5 platform.
Signed-off-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
Tested-by: David Lin <dtwlin@google.com>
Reviewed-by: David Lin <dtwlin@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
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>
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>
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>