Commit graph

62 commits

Author SHA1 Message Date
Laurent Pinchart
24f9a6e494 greybus: camera: Hardcode the APB-A CSI-2 TX parameters
Camera modules will stop reporting the number of lines per second,
hardcode the parameter in the driver until the APB-A CSI-2 TX
configuration protocol gets updated as well to use a more appropriate
form of bandwidth information.

The number of data lanes is also hardcoded as it should not depend on
the module's CSI-2 bus configuration.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-07-17 10:31:21 +09:00
Jacopo Mondi
fdf73c00c8 greybus: camera: Add wrapper for sync operation with flags
The greybus operation core synchronous operation call doesn't support
operation flags. Create a new synchronous operation wrapper with flags,
and modify the capabilities operation implementation to use it.

The code could be later moved to the greybus core if other drivers have
a similar need.

Signed-off-by: Jacopo Mondi <jacopo.mondi@linaro.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-07-17 10:31:21 +09:00
Jacopo Mondi
6cc270483c greybus: camera: Add bpp to Greybus Format description
Add the bytes per pixel value to the structure describing a Greybus
Protocol Image Format.
The bpp information will be used to compute the length in bytes of a
line of pixel data

Signed-off-by: Jacopo Mondi <jacopo.mondi@linaro.org>
Reviewed-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-07-17 10:31:21 +09:00
David Lin
211634f2ca greybus: camera: add runtime pm support
Add runtime pm support to camera protocol device class driver.

Testing Done:
 - Make sure white camera module is able to runtime suspend and resume
   when the camera is being used

Signed-off-by: David Lin <dtwlin@google.com>
Signed-off-by: Axel Haslam <ahaslam@baylibre.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@linaro.org>
Signed-off-by: Alex Elder <elder@linaro.org>
2016-07-14 16:53:55 -05:00
Jacopo Mondi
80b3982b8d greybus: camera: Fix size of configure_streams(0)
When APB-A CSI-Tx configuration fails, it is necessary to unconfigure
the camera module issuesing a 0 stream configuration request.
Fix size of request and response to avoid Greybus core complain about
Response size differences.

Testing Done: Triggering the error condition after APB-A CSI-tx
              configuration does not make Greybus core complain anymore

Signed-off-by: Jacopo Mondi <jacopo.mondi@linaro.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@linaro.org>
Signed-off-by: Alex Elder <elder@linaro.org>
2016-07-05 21:18:05 -05:00
Jacopo Mondi
36ab1108b6 greybus: camera: Fix number of configured streams
Camera Module may report a lower number of configured streams than the
one requested by the AP.
All the non-supported stream configuration are zeroed.
Make the stream configuration inspection loop take only the valid stream
into account, to avoid unnecessarily accessing zeroed memory areas.

So far, inspecting non valid streams configuration has prove to be
harmless, but as we'll need to inspect stream characteristics as reported
image sizes and format, we have to take only valid configurations into
account.

Testing Done: White Camera Module preview and capture.

Signed-off-by: Jacopo Mondi <jacopo.mondi@linaro.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@linaro.org>
Signed-off-by: Alex Elder <elder@linaro.org>
2016-07-05 21:18:03 -05:00
Jacopo Mondi
7f93eab7c7 greybus: camera: Early update num_streams and flags
In configure_streams Operation, when returning from the greybus
operation call, we can assign the num_streams and flags variable earlier
so that if the following stream configuration inspection fails, the
caller receives the right number of configured streams anyway

Testing Done: White camera module preview and capture.
              Triggering failure during stream configuration inspection
              makes configuration fails, but avoid segfaulting as
              was previously happening

Signed-off-by: Jacopo Mondi <jacopo.mondi@linaro.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@linaro.org>
Signed-off-by: Alex Elder <elder@linaro.org>
2016-07-05 21:18:00 -05:00
Evgeniy Borisov
caad3090ab greybus: camera: Add RAW data format
Add support for greybus RAW data format.
Greybus RAW data formats starts from 0x80.

Signed-off-by: Evgeniy Borisov <eborisov@mm-sol.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@linaro.org>
Reviewed-by: Gjorgji Rosikopulos <grosikopulos@mm-sol.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-06-24 16:13:52 -07:00
Laurent Pinchart
9120b9060b greybus: camera: Create and destroy data connection on demand
Creating the data connection at probe time makes it impossible to
support multiple inserted camera modules as they would all try to
establish a data connection to the same CPort on the AP side. Create and
destroy the data connection when configuring the streams instead, as a
single module can be streaming at a time.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Gjorgji Rosikopulos <grosikopulos@mm-sol.com>
Tested-by: Gjorgji Rosikopulos <grosikopulos@mm-sol.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-06-15 05:05:47 -07:00
Laurent Pinchart
3b8ebfeb32 greybus: camera: Fix data connection setup
When the module is in the configured state, an attempt to change the
configuration must first tear down the data connection to update its
parameters, as the APB1 bridge doesn't support modifying the CSI
transmitter configuration when it is already started.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Gjorgji Rosikopulos <grosikopulos@mm-sol.com>
Tested-by: Gjorgji Rosikopulos <grosikopulos@mm-sol.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-06-15 05:05:47 -07:00
Laurent Pinchart
f3d5f6613f greybus: camera: Clean up on stream configuration failure
When the camera pipeline can't be configured due to a failure of one of
the components (failure to start the CSI transmitter for instance),
components that have already been setup for video streaming need to be
set back to a quiescient state. This is especially important to ensure
that a stream configuration failure won't keep the UniPro links in high
speed mode forever.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Gjorgji Rosikopulos <grosikopulos@mm-sol.com>
Tested-by: Gjorgji Rosikopulos <grosikopulos@mm-sol.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-06-15 05:05:47 -07:00
Viresh Kumar
d9e4c4ee12 greybus: camera: Initialize mutex before using it
We are using the mutex from gb_camera_cleanup(), which can get called
even before the mutex is initialized.

Fix it by initializing the mutex early enough.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@linaro.org>
Reviewed-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-06-13 11:10:09 -07:00
Eli Sennesh
8c2522d87a greybus: update UniPro Set Interface Power Mode operation to match spec
Bring the gb_svc_intf_set_power_mode() up-to-date with the current Greybus
specification.  This largely involves adding more members to the structure
sent across the wire.  Also change the camera code to use the new
operation properly, with default values passed for the new necessary
arguments.  The correctness of these default values is confirmed via testing
and by asking Rob Johnson.

We must make sure to zero the request structure sent across the wire, lest
bite us most cruelly, and we fix by changing the Set Power Mode
Response structure to use a __u8 rather than a __le16.

Testing Done: Took a picture with a camera module, received error code
when passing deliberately incorrect values for new parameters, got proper
-EIO and Greybus result code printed when operation stopped halfway
through.  Could induce error by initializing request struct with random
nonsense, and can stop it by initializing request struct with zeroes.

Associated Firmware Changes: 1669-1671 on Android N Gerrit for SW-2945

Signed-off-by: Eli Sennesh <esennesh@leaflabs.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-06-09 18:14:00 -07:00
Gjorgji Rosikopulos
cb14e97623 greybus: camera: Add debug data format
Add support for greybus debug data format.
Greybus debug data format id is 0x42.

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-06-09 12:15:06 -07:00
Evgeniy Borisov
17ca677018 greybus: camera-gb: Implement camera module reference counting as subject.
In explanation:

The main idea for implementing reference counting is to not block exit
until any other modules are in use. Camera responsibility is to handle
properly any additional calls after camera exit and that what this
patch is doing:

1. Free camera module when reference count is zero.
2. After camera cleanup handle properly any additional ongoing
   transaction. Return error if connection is destroyed.

Signed-off-by: Evgeniy Borisov <eborisov@mm-sol.com>
Reviewed-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-06-03 08:57:48 -07:00
Alex Elder
66394300c3 greybus: eliminate unneeded null check
Coccinelle points out that debugfs_remove_recursive() handles a null
argument properly, so there's no need to check for NULL before
making the call.  I have verified this is true of the kernel we're
now working with (arche-6.0).

Signed-off-by: Alex Elder <elder@linaro.org>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-05-27 11:28:16 -07:00
Alex Elder
f9340fc7dd greybus: report right error value
Running "make coccicheck" on the Greybus code discovered that
an error message in gb_camera_debugfs_init() was interpreting
the wrong value in reporting the error code.  Fix that.

Signed-off-by: Alex Elder <elder@linaro.org>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-05-27 11:28:16 -07:00
Jeffrey Carlyle
91a8030f78 greybus: Revert "update UniPro Set Interface Power Mode operation to match spec"
This reverts commit 29fee8c55b59bb6ac59b99a0563c89c514cba42b.

This change and its companion NuttX changes seem to be triggering a
storm of POWERMODEIND switch interrupts on the SVC.

Signed-off-by: Jeffrey Carlyle <jcarlyle@google.com>
Acked-by: Sandeep Patil <sspatil@google.com>
2016-05-25 17:20:34 -07:00
Eli Sennesh
0060636714 greybus: update UniPro Set Interface Power Mode operation to match spec
Bring the gb_svc_intf_set_power_mode() up-to-date with the current Greybus
specification.  This largely involves adding more members to the structure
sent across the wire.  Also change the camera code to use the new
operation properly, with default values passed for the new necessary
arguments.  The correctness of these default values is confirmed via testing
and by asking Rob Johnson.

Testing Done: Took a picture with a camera module, received error code
when passing deliberately incorrect values for new parameters, got proper
-EIO and Greybus result code printed when operation stopped halfway
through.

Associated Firmware Changes: 6810-6812 on Gerrit for SW-1239, 6870 and
5612-5613 on Gerrit for SW-2945

Signed-off-by: Eli Sennesh <esennesh@leaflabs.com>
Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-05-24 09:02:07 -07:00
Laurent Pinchart
68b66c2801 greybus: camera: Convert to bundle driver
Convert the legacy camera protocol driver to a bundle driver.

Modules now can (and must) declare the camera data cport in their
manifest as the data connection isn't hardcoded anymore.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Johan Hovold <johan@hovoldconsulting.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-05-20 16:47:30 -07:00
Johan Hovold
3ba9fa5c92 greybus: camera: fix data-connection handling
Now that core supports offloaded connections, we can remove the hack
that was used to setup the data connection.

Note that offloaded-resource management may need to be refined later,
but the current minimal implementation is enough to allow core to manage
the connections (e.g. needed for proper connection tear down and power
management).

This will also allow the camera driver to be converted to a bundle
driver.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-05-13 15:32:48 +02:00
Mitchell Tasman
ee2f2074fd greybus: svc: reconfig APBridgeA-Switch link to handle required load
SW-4894, SW-4389, and share a common root cause, namely that
the power-on reset configuration of the APBridgeA-Switch link of PWM
Gear 1, 1 Lane, Slow Auto, is insufficient to handle some required
traffic loads, such as 3 audio streams plus boot-over-UniPro or 4 audio
streams.

The correct long-term solution is to implement a UniPro Power Mode
Manager as in that considers the demands placed on the network,
and adjusts power modes accordingly.

The present commit implements a short-term, brute-force hack to allow
continued system testing:
- Upon receiving an SVC HELLO request, schedule deferred work to
  reconfigure the APB1-Switch link to PWM G2, 1 lane, Slow Auto
- When the Camera driver transitions a White Camera module from active to
  inactive, return the APB1-Switch link to PWM G2, 1 lane, Slow Auto

The Camera driver already steps up the APBridgeA-Camera link speed while a
camera module is active, which affords sufficient margin for simultaneous
audio and hotplug activity, and the Camera driver already steps down the
link speed thereafter: the change made by the present patch is simply to
tweak the stepped-down power mode to match the new baseline configuration.

Signed-off-by: Mitchell Tasman <tasman@leaflabs.com>
Tested-by: Mark Greer <mgreer@animalcreek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-05-04 18:41:05 -07:00
Evgeniy Borisov
698bdcbf87 greybus: camera-gb: Remove hardcode for CSI TX number of lanes
The number of CSI TX lanes is hardcoded to 4. Removing
this and start using value from configure stream response.

NOTE: The patch depends on the CSI init change:
"Use GB CSI params to init camera sub-devs"

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-21 11:19:28 +09:00
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
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
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
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
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
Fabien Parent
53f965065a greybus: camera: disable E2EFC on CSI connection
Following Toshiba's recommendation we shouldn't use E2EFC on a CSI connection.
Disable E2EFC on the CSI connection.

Signed-off-by: Fabien Parent <fparent@baylibre.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-03-04 18:32:00 -08:00
Johan Hovold
27f25c17ad greybus: connection: generalise CPortFlags handling
Generalise the svc connection-create helper to accept a cport-flags
argument and handle the flags in the connection code instead.

Note that the camera driver currently manages its data connection
directly. We keep E2EFC enabled for now even though it will soon need
to be disabled due to some pending firmware updates.

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-03-04 18:26:08 -08:00
Jacopo Mondi
27e18d8c69 greybus: camera: Rename clock_mode to flags
Rename the 'clock_mode' parameter to a more generic 'flags' in the csi
bus configuration structure.
Define flags value for continuous clock mode.

Signed-off-by: Jacopo Mondi <jacopo.mondi@linaro.org>
Acked-by: Laurent Pinchart <laurent.pinchart@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-02-23 22:39:20 -08:00
Jacopo Mondi
446091c999 greybus: camera: Add CSI configuration parameters
Add CSI configuration parameters to the configure_stream operation
response.
Currently, only the total number of lines in a second is used to configure the
the AP-Bridge CSI transmitter, all other parameters (number of CSI data
lanes, and CSI bus clock frequency) are kept hard-coded for two reasons:
1) We need to configure the CSI receiver on AP side accordingly to these
settings, before sending them to APB1 CSI transmitter.
2) We cannot use the camera module provided parameters as-is, but use
those information to compute the required bandwidth on the CSI bus, and
configure the # of CSI data lanes, and the CSI bus clock speed in a way that
satisfies that bandwidth requirement.

Signed-off-by: Jacopo Mondi <jacopo.mondi@linaro.org>
Acked-by: Laurent Pinchart <laurent.pinchart@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-02-23 22:39:20 -08:00
Laurent Pinchart
640924d217 greybus: camera: Don't configure CSI TX in test only mode
When the GB_CAMERA_CONFIGURE_STREAMS_TEST_ONLY flag is set by the caller
the configure streams operation should only test the requested settings
without modifying the hardware state. This applies for both the module,
the UniPro links power modes and the AP bridge settings. Return early
when the flag is set to avoid modifying the AP bridge CSI TX settings.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Gjorgji Rosikopulos <grosikopulos@mm-sol.com>
Tested-by: Jacopo Mondi <jacopo.mondi@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-02-15 14:55:17 -08:00
Laurent Pinchart
66c3607076 greybus: camera: Set power mode after configuring streams
There's no need to set the power mode before configuring streams, doing
it after simplifies code.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Gjorgji Rosikopulos <grosikopulos@mm-sol.com>
Tested-by: Jacopo Mondi <jacopo.mondi@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-02-15 14:55:17 -08:00
Laurent Pinchart
b573b0e656 greybus: camera: Clean up when AP link power mode configuration failed
Restore the module link power mode to the previous state in that case.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Gjorgji Rosikopulos <grosikopulos@mm-sol.com>
Tested-by: Jacopo Mondi <jacopo.mondi@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-02-15 14:55:17 -08:00
Laurent Pinchart
c161c0fc2f greybus: camera: Factorize link power mode configuration code into a function
Avoid duplicating the same code block multiple times.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Jacopo Mondi <jacopo.mondi@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-02-15 14:55:17 -08:00
Jacopo Mondi
db81b76970 greybus: camera: Add missing return value
Add missing return value assignement when changing unipro power mode to
PWM-G1.

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-02-05 16:37:34 -08:00
Jacopo Mondi
f121d79d8a greybus: camera: Reset link speed on failed config
Improve the management of unipro power mode changes in response
to a configure_stream operation.
When sending a "test only" request to camera module, do not change power
mode to HS-G2 as no frame will be actually transmitted.
When receiveing an "adjusted" configuration response, reset power
mode to PWM-G1.

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-02-05 16:37:34 -08:00
Jacopo Mondi
4fbf69c71c greybus: camera: Stream config change unipro speed
Unipro network speed was increased at camera initialization time and
never slowed down.
This unnecessary drains power during the entire time camera module is
plugged in.
Increasing/decreasing unipro link speed before issuing stream
configuration request to camera module prevents this from happening.

Signed-off-by: Jacopo Mondi <jacopo.mondi@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-01-25 19:36:13 -08:00
Gjorgji Rosikopulos
7c154711a6 greybus: camera: add semiplanar and planar formats
This change adds missing planar and semiplanar
formats from gb specification.

Mbus to Gb format map:
V4L2_MBUS_FMT_NV12_1x8 -> 0x12
V4L2_MBUS_FMT_NV21_1x8 -> 0x13
V4L2_MBUS_FMT_YV12_1x8 -> 0x16
V4L2_MBUS_FMT_YU12_1x8 -> 0x17

Change depends on:
"media: add new mediabus format enums for ara camera"

Signed-off-by: Gjorgji Rosikopulos <grosikopulos@mm-sol.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-01-22 15:47:27 -08:00
Gjorgji Rosikopulos
5b0327103f greybus: camera: Update configure stream based on new interface
Interface has been changed.
return code will not return number of configured streams but
just error code.
Number of streams is passed as pointer and if operation result
is changed number of streams will be updated.

Flags are also used for information regarding configure stream
operation result.

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-01-17 11:16:46 -08:00
Greg Kroah-Hartman
b55d9431d6 greybus: Revert "camera: Fix backword compatibility in configure streams"
This reverts commit 48cc91e52dba9abad4c9b56f911994c65071bfc4 as the
caller should be changed instead.

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-01-15 14:41:02 -08:00
Gjorgji Rosikopulos
11ca550c22 greybus: camera: Fix backword compatibility in configure streams
Configure streams ret code should be number of streams in
gb operation exported to HOST camera.
Until gb operation is migrated to new interface return
number of streams in ret code.

Signed-off-by: Gjorgji Rosikopulos <grosikopulos@mm-sol.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-01-15 14:32:00 -08:00
Laurent Pinchart
4068487ce3 greybus: camera: Return the result flags from the configure_streams response
And return the response num_streams field through a pointer variable
instead of using the return value of the function as both an error code
and a positive number of streams, it makes the API more consistent.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-01-14 16:53:10 -08:00
Gjorgji Rosikopulos
3a8dba4e57 greybus: camera: HACK: Register gb camera to the HOST camera
This change implements gb camera interface and register
gb camera to the HOST driver.
This implementation need to be reworked after the demo.

Tested with db3 with two camera modules.

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-01-13 15:29:59 -08:00
Greg Kroah-Hartman
e527338104 greybus: APBridge: move APBridge request protocol to a common .h file
This moves all of the APBridge request protocol commands that are
currently used to a common .h file for everyone to be able to use them
in the future, where needed.

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Tested-by: Mark Greer <mgreer@animalcreek.com>
Reviewed-by: Johan Hovold <johan@hovoldconsulting.com>
2016-01-12 11:12:25 -08:00
Greg Kroah-Hartman
ed4596e9b1 greybus: host: provide "generic" apbridge output calls
Provide a new function, gb_hd_output() to send data to the apbridge.
This is useful for the camera and audio drivers that need to do this
type of messaging.

The camera driver is converted to use this new function, the audio
driver can use it when it gets merged later.

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Tested-by: Mark Greer <mgreer@animalcreek.com>
Reviewed-by: Johan Hovold <johan@hovoldconsulting.com>
2016-01-12 11:11:49 -08:00
Jacopo Mondi
b787d413e0 greybus: camera: Add support for flags to stream_configure
Add support for the flags field of the stream configure request that was
recently added to the camera protocol and update the debugfs arguments
parsing accordingly. The stream configure response layout is also
updated to the latest protocol specification.

Signed-off-by: Jacopo Mondi <jacopo.mondi@linaro.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-01-08 22:47:07 -08:00