1
0
Fork 0
Commit Graph

1337 Commits (fc25d9068e80659ea2b3a4516c63c523bdafc20b)

Author SHA1 Message Date
Sachin Pandhare fc25d9068e greybus: manifest: simplify descriptor address calculation
This patch doesn't change any functionality. It just improves the
readability of the code.
Current code to get 'descriptors' pointer looks as if we are forcing the
pointer type change. To simplify the address calculations, use
'descriptors' member directly from greybus_manifest structure.

Signed-off-by: Sachin Pandhare <sachin.pandhare@linaro.org>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-11-23 19:23:47 -08:00
Johan Hovold bfe2c99c1c greybus: hd: fix cport-count check
Fix off-by-one error when checking the number of cports a host-device
supports.

The CPORT_ID_MAX is the largest valid cport id so the maximum number of
cports a host-device can use is CPORT_ID_MAX + 1.

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>
2015-11-23 19:23:27 -08:00
Johan Hovold 39f36c8f9f greybus: connection: fix cport-id range
Fix cport-id allocation that failed to include the highest port id in the
available cport-id range.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-11-23 19:23:27 -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
Johan Hovold 3823c61479 greybus: add class matching macro
Add matching macro for bundle class.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-11-21 17:15:35 -08:00
Johan Hovold 700001af96 greybus: move id-matching back to core
Move id-matching back to core and the bus code where it belongs.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-11-21 17:15:35 -08:00
Johan Hovold f65fa47f28 greybus: fix vendor and product matching
Fix vendor and product matching by matching on the 32-bit Ara vendor and
product ids.

Remove the "fake" 16-bit vendor and product ids and export the Ara ids
using the "vendor" and "product" interface attributes instead.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-11-21 17:15:35 -08:00
Johan Hovold 8034bd561d greybus: interface: remove unique id
Remove the unimplemented interface unique-id.

There will eventually be an interface-serial-number attribute provided,
but let's not export it or commit to a name for this attribute until we
need it.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-11-21 17:15:35 -08:00
Johan Hovold 9784a591f0 greybus: remove unique-id matching
Remove unique-id matching as it does not make much sense to have a
driver match a specific device serial number.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-11-21 17:15:35 -08:00
Johan Hovold 358e9400f4 greybus: fix bundle-id match macros
The matching flags were renamed over a year ago but the so far unused
id-macros were never updated.

Also rename the GREYBUS_ID_MATCH_DEVICE mask to use the common
GREYBUS_ID_MATCH-prefix.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-11-21 17:15:35 -08:00
Johan Hovold 55510843c1 greybus: svc: fix missing version-request sanity checks
Add missing sanity checks on version-request payload size.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-11-19 16:07:48 -08:00
Johan Hovold 87f6c976f4 greybus: firmware: break long lines
Break lines longer than 80 cols, and clean up an error message while at
it.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-11-19 16:07:48 -08:00
Johan Hovold 98645a9c69 greybus: firmware: fix information leak
Add missing sanity checks on get_firmware-request offset and size
parameters to fix potential information leaks.

This prevents remotely controlled information leaks as the requestor
currently controls both the 32-bit firmware-image offset and the amount
of data that is returned (up to host-device MTU).

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-11-19 16:07:48 -08:00
Bartosz Golaszewski 81ad699461 greybus: loopback: allocate a response even for a 0-byte request
If payload length of a transfer packet is 0, no response is allocated.
Send a well-formed response even in that case.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Reviewed-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-11-19 16:02:41 -08:00
Alexandre Bailon 9864756be7 greybus: loopback: fix invalid response size
The size of timestamps is not taken into account, which makes the
loopback driver in the firmware drop invalid packages.

Signed-off-by: Alexandre Bailon <abailon@baylibre.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Reviewed-by: Johan Hovold <johan@hovoldconsulting.com>
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-11-19 16:02:41 -08:00
Rui Miguel Silva 5c864e775d greybus: manifest: fix bundle descriptor parse
The descriptor list is walked in two points, in the bundle parsing and
cport parsing, this can make the next descriptor pointer in bundle to be
already removed by the cport remove descriptor and become invalid.

So, just get the next bundle until there no more left.

Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-11-16 22:26:43 -08:00
Mark Greer 80ee842825 greybus: audio: Allocate protocol and class values
Allocate protocol and class values for the Audio Device Class
Protocol.  Two values of each type are allocated: one for Audio
Management Connections and one for Audio Data Connections.

Signed-off-by: Mark Greer <mgreer@animalcreek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-11-16 22:18:52 -08:00
Viresh Kumar e3c25930d9 greybus: es1: Remove the (now) unused es1 driver
This was used by gbsim earlier, but not anymore. Lets remove it.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-11-16 22:18:52 -08:00
Viresh Kumar bf6a61bd2f greybus: es2: remove fake vendor/product ids
These aren't used anymore, remove them.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-11-16 22:18:52 -08:00
Rui Miguel Silva ffe2e2487a greybus: power_supply: rework and operation changes
This is a major rework and changes to the current implementation of the
battery protocol. The previous implementation lack the support of a more
dynamic handle of power supply properties and updating of status. Also,
reflect the actual state of the greybus specification

So, with this new approach a set of operations to fetch the battery
module configuration and properties is add, new methods to cache and
update the values of properties, new operation to set properties if
declared writable and an event operation that can be triggered by the
module to force an update read on the properties values.

Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-11-12 16:12:55 -08:00
Rui Miguel Silva 783e373a9f greybus: makefile: add power_supply config check
Add check for POWER_SUPPLY config option to guarantee that it is enabled.

Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-11-12 16:09:32 -08:00
Rui Miguel Silva 2724be0305 greybus: battery: move implementation to power_supply
Rename protocol to POWER_SUPPLY and implementation details from battery
to power_supply.

Also fix some tabs between define and macro name.

Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-11-12 16:08:40 -08:00
Rui Miguel Silva 464888410d greybus: battery: move battery file to power_supply
Rename the battery.c to power_supply.c and update the makefile as the
Greybus protocol is being renamed from battery to power_supply.

Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-11-12 16:06:49 -08:00
Viresh Kumar 69166d2525 greybus: es2: Send cport-id in wValue field to usb_control_msg()
wIndex field has a special meaning, as that can be used by the core to
index into the possible USB interfaces. And that specifically broke with
gbsim, as it has a single USB interface.

Other similar requests (REQUEST_LATENCY_TAG_{EN|DIS}) are already using
wValue field for passing cport-id.

Fix cport_reset() by sending the cport-id in wValue field instead of
wIndex.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Tested-by: Fabien Parent <fparent@baylibre.com>
Reviewed-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-11-12 15:49:12 -08:00
Johan Hovold f6c6c1388a greybus: svc: use bit-macro for cport flags
Use BIT-macro for cport flags.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-11-11 09:18:28 -08:00
Johan Hovold 35a84ba7f9 greybus: use decimal notation for interface and cport ids
Fix up the few places where hexadecimal rather than decimal notation was
used for interface and cport ids.

Note that this includes the endo sysfs-attribute for the AP interface
id.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-11-11 09:18:28 -08:00
Johan Hovold febe252179 greybus: interface: fix obsolete comment
Fix obsolete comment that was referring to "module" rather than
"interface".

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-11-11 09:18:28 -08:00
Johan Hovold eeb6a6ff59 greybus: interface: fix potential use-after-free at remove
Fix resources (accessible through sysfs) being released before interface
is deregistered.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-11-11 09:18:28 -08:00
Johan Hovold f865734d3c 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>
2015-11-11 09:18:28 -08:00
Johan Hovold cd414d4726 greybus: battery: 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>
2015-11-11 09:18:28 -08:00
Johan Hovold 0d1d6ee209 greybus: loopback: fix layer violation
A bundle (protocol) driver has no business creating sysfs entries for an
ancestor device.

Move the sysfs entries to the bundle device for now.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-11-11 09:18:28 -08:00
Greg Kroah-Hartman c9e9de26f9 greybus: hid: hid should not be part of the bridged-phy driver.
HID is a stand-alone greybus protocol, not part of the bridged-phy
protocols, so make it a stand-alone kernel module.

Note, some hard-coded android init script might need to be changed to
load the gb-hid.ko kernel module now.

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
2015-11-05 18:00:29 -08:00
Johan Hovold a52028626a greybus: es2: clean up es2 destructor
Now that the host-device is deregistered separately from deallocation,
we can simplify the cport_to_ep-array deallocation.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-11-04 20:35:18 -08:00
Johan Hovold c170047984 greybus: hd: fix host-device life time issues
Fix host-device life time issues by separating host-device allocation
from registration.

This is needed both to make sure that all host-device resources are
available before registering the device and to prevent such resources
from being deallocated while the device is still in use during device
removal.

This specifically fixes the following warnings during es1 and es2
disconnect:

usb 1-1.1: No free CPort OUT urbs, having to dynamically allocate one!

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-11-04 20:35:18 -08:00
Johan Hovold b4bd3617ed greybus: es1: add more structure to probe error handling
Add more structure to probe error handling rather than use the big
hammer and call disconnect directly.

This is needed to fix some host-device life-time issues.

Note that there was never any need to clear the USB interface data as
this will be done by driver core.

Compile-only tested.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-11-04 20:35:18 -08:00
Johan Hovold 57bc17ffc5 greybus: es2: add more structure to probe error handling
Add more structure to probe error handling rather than use the big
hammer and call disconnect directly.

This is needed to fix some host-device life-time issues.

Note that there was never any need to clear the USB interface data as
this will be done by driver core.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-11-04 20:35:18 -08:00
Johan Hovold fb7a4ea22b greybus: es1: fix debugfs dentry leak
Fix dentry leak due to failure to remove debugfs file.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-11-04 20:35:18 -08:00
Johan Hovold 74cd6503e5 greybus: es2: fix debugfs dentry leak
Fix dentry leak due to failure to remove debugfs file.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-11-04 20:35:18 -08:00
Johan Hovold 715d7a7280 greybus: es1: separate stopping and deallocating urbs
Separate stopping and deallocating our in-urbs.

This will facilitate implementing proper host-device life-time management.

Compile-only tested.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-11-04 20:35:18 -08:00
Johan Hovold f6624ca77c greybus: es2: separate stopping and deallocating urbs
Separate stopping and deallocating our in-urbs.

This will facilitate implementing proper host-device life-time management.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-11-04 20:35:18 -08:00
Johan Hovold 8dfd3fe564 greybus: es1: separate urb allocation and submission
Separate in-urb allocation and submission.

This is needed for the driver-model rework.

Compile-tested only.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-11-04 20:35:18 -08:00
Johan Hovold 0ce68ce417 greybus: es2: separate urb allocation and submission
Refactor in-urb submission, and make sure to separate allocation and
submission.

Eventually we'll be submitting the urbs at cport enable rather than at
probe, and this is also needed for the driver-model rework.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-11-04 20:35:18 -08:00
Johan Hovold b6d808525a greybus: es2: fix endpoint requirement check
The current es2 implementation only checks for no IN or OUT bulk
endpoints, but still assumes there are precisely NUM_BULKS of each.

Specifically, urbs could be allocated and initialised to default values,
which amounts to bulk urbs being submitted to the control endpoint.

We should be able to handle any number of endpoints, but for now let's
just require NUM_BULKS of each.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-11-04 20:35:18 -08:00
Johan Hovold a51e8551e2 greybus: es2: fix use-after-free at disconnect
The interface private data is released as part of host-device removal
and must not be accessed afterwards.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-11-04 20:35:18 -08:00
Mark Greer 357499df45 greybus: i2s: Remove deprecated I2S Bridged-PHY Protocol
The Greybus I2S Bridged-PHY Protocol is deprecated so remove
all support for it from the Greybus code.

CC: Vaibhav Agarwal <vaibhav.agarwal@linaro.org>
Signed-off-by: Mark Greer <mgreer@animalcreek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-11-04 20:30:47 -08:00
Mark Greer ddc88eff2b greybus: audio: Remove I2S Bridged-PHY Protcol based audio driver
The Greybus I2S Bridged-PHY Protocol is now deprecated so remove
the audio driver that is based on it.

CC: Vaibhav Agarwal <vaibhav.agarwal@linaro.org>
Signed-off-by: Mark Greer <mgreer@animalcreek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-11-04 20:30:47 -08:00
Johan Hovold d6e139bc15 greybus: hd: use common prefix for exported functions
Rename the exported functions using the common gb_-prefix.

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>
2015-11-04 20:25:57 -08:00
Johan Hovold a8cc020f3f greybus: hd: rename host-driver structure
Rename host-driver structure to gb_hd_driver to more clearly separate it
from the host-device structure.

Also remove an outdated description of the struct.

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>
2015-11-04 20:25:57 -08:00
Johan Hovold 2537636aba greybus: hd: rename host-device structure
Rename host-device structure gb_host_device to match our other
structures.

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>
2015-11-04 20:25:57 -08:00
Johan Hovold 7bc6faaca7 greybus: create host-device compilation unit
Move everything host-device related to hd.c and hd.h.

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>
2015-11-04 20:25:57 -08:00