Mailing List Archive

[GIT PULL] Greybus driver subsystem for 4.9-rc1
"'tis but a scratch" - The Black Knight

Hi all,

As many of you know, I, and lots of other developers, have been working
on a new application level protocol for the Unipro hardware transport
called "Greybus". It has shown up in numerous demos from Google for the
Ara Phone platform, and an older version of the codebase is currently
shipping in a phone from Motorola any-day-now. There is a
semi-up-to-date version of the protocol specification available at:
https://github.com/projectara/greybus-spec
A newer version should be available soon, matching the code
implementation here, as soon as I work through a few final details with
some lawyers on the wording of the license.

Many other software packages to help out with greybus devices are on
that github project page (manfest generator, emulator, firmware
examples, etc.), if people are interested.

Given that it's never a good idea to keep subsystems out of the mainline
kernel, I've put together this pull request that adds the greybus driver
layer to drivers/greybus/. Because this was 2 1/2 years of work, with
many many developers contributing, I didn't want to flatten all of their
effort into a few small patches, as that wouldn't be very fair. So I've
built a git tree with all of the changes going back to the first commit,
and merged it into the kernel tree, just like btrfs was merged into the
kernel.

The protocol design, and implementation, was a group effort, and it would
not have turned out well at all without the contributions of all of
these talented developers.

I'll send out a follow-up set of "simple" patches that just add the
files to the kernel tree, to give people an idea of the code involved.
Overall, it's a tiny stand-alone driver subsystem, only 37k lines, that
implements a protocol which allows for "generic" cameras, audio devices,
and other class type devices, as well as a bridged "physical" layer
protocol to talk to serial, spi, uart, pwm, gpio, i2c, and even USB host
controllers. Included here is a USB bridge host controller driver that
interacts with a USB device that converts USB data to Unipro data,
allowing any system to talk to a Unipro platform (no special SoC
interface required.)

Unless people point out some major problems with this, I'd like to get
it merged into 4.9-rc1.

The shortlog and diffstat can be seen below.

If anyone has any questions about this, please let us know.

thanks,

greg k-h

---------------

The following changes since commit c6935931c1894ff857616ff8549b61236a19148f:

Linux 4.8-rc5 (2016-09-04 14:31:46 -0700)

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git/ greybus

for you to fetch changes up to f86bfc90a401681838866b5f6826d86cc4c7010c:

greybus: remove CONFIG_PM_RUNTIME from kernel_ver.h (2016-09-09 13:27:19 +0200)

----------------------------------------------------------------
Akash Choudhari (1):
greybus: Revert "Added a sysfs entry to power down the SVC"

Alex Elder (345):
greybus: uart-gb: improve minor device number error checking
greybus: uart-gb: a few minor bug fixes
greybus: switch to the term "manifest"
greybus: define struct greybus_manifest
greybus: call put_device() on error
greybus: interpret descriptor type properly
greybus: validate descriptor sizes
greybus: fix manifest parsing size bug
greybus: simple fixes
greybus: rename struct greybus_device
greybus: quick fix for sysfs serial number
greybus: get rid of a weird idiom
greybus: embed workqueue structure in struct gbuf
greybus: encapsulate URB status checking
greybus: some more renames
greybus: update a few header file comments
greybus: fix document version number
greybus: fix the guard in "greybus_manifest.h"
greybus: descriptor type is 1 byte
greybus: fix version check
greybus: reorder greybus_svc_in() arguments
greybus: kill struct gmod_cport
greybus: clarify device vs module
greybus: descriptor type updates
greybus: isolate greybus module code
greybus: define greybus interface abstraction
greybus: define greybus function abstraction
greybus: introduce a connection abstraction
greybus: introduce an operation abstraction
greybus: start improving manifest parsing
greybus: manifest interface descriptor parsing
greybus: manifest cport descriptor parsing
greybus: kill off old manifest code
greybus: fix connection header declarations
greybus: October 1 updates
greybus: create host device cport id map
greybus: allocate connection host cport id
greybus: get rid of functions now...
greybus: record connection protocol
greybus: fix some hasty bugs
greybus: fix greybus_class_type symbol names
greybus: use ida for cport id allocation
greybus: fix module setup
greybus: gbuf: have caller set actual_length
greybus: specify type when creating an operation
greybus: add a connection->private field
greybus: define gb_connection_err()
greybus: fix two misnamed functions
greybus: bury some dead code
greybus: add bg_hd_connection_find()
greybus: look up connection for recevied messages
greybus: allocate gbufs using the connection
greybus: use alloc_gbuf_data() for both directions
greybus: kill __alloc_gbuf()
greybus: get rid of gbuf->hdpriv
greybus: don't assume subdevs are valid
greybus: unlock gbuf mutex on free
greybus: unlock hd mutex on free
greybus: don't restrict input buffer size
greybus: zero all data buffers
greybus: drop hd arg from submit_gbuf method
greybus: stop init_subdevs stuff
greybus: add response buffer to an operation
greybus: add gb_operation_find()
greybus: let operation layer examine incoming data
greybus: move receive handling to operation layer
greybus: add device initialization
greybus: kill off gbuf work queue
greybus: kill old cport handlers
greybus: add i2c driver
greybus: initial operations-based GPIO driver
greybus: add write retry support for i2c
greybus: update gbuf status for completion handlers
greybus: report gbuf errors
greybus: properly drop device reference
greybus: create a slab cache for operations
greybus: drop gb_* device fields from gb_module
greybus: remove cports and strings from gb_module
greybus: move ap_disconnect()
greybus: leverage ap_disconnect() in ap_probe()
greybus: fix op_cycle logic
greybus: stash power supply pointer in connection
greybus: improve module cleanup code
greybus: time out operation requests
greybus: define operation_cancel()
greybus: define connection state
greybus: make svc_set_route_send() public
greybus: only initialize interfaces when up
greybus: set route before sending packets
greybus: update AP id service message
greybus: fix repeated input errors
greybus: gpio: kill gpio_controller->gpio
greybus: embed the i2c adapter struct
greybus: begin abstracting connection operations
greybus: drop the cport id on error
greybus: use protocol_id for numeric values
greybus: introduce protocol abstraction
greybus: fix a bug in gb_operation_gbuf_complete()
greybus: drop a redundant assignment
greybus: make _gb_protocol_find() static
greybus: control printing message
greybus: improve some error messages
greybus: identify protocol by id *and* version
greybus: count rather than list protocol users
greybus: order the protocols list
greybus: register preallocated protocols
greybus: move methods into protocol
greybus: add an incoming request receive method
greybus: kill test_sink.c
greybus: kill old cport handler code
greybus: get rid of gbuf->actual_length
greybus: record gbuf->operation
greybus: remove gbuf->context
greybus: get rid of greybus_gbuf_finished()
greybus: move gb_operation_gbuf_complete()
greybus: kill gbuf->complete
greybus: don't assume PAGE_SIZE for URB size
greybus: fix request timeout bug
greybus: move timeout out of gb_operation_insert()
greybus: simplify pending operations tracking
greybus: op_cycle doesn't need to be atomic
greybus: pass operation type on request receive
greybus: move operation timeout teardown
greybus: delete some lines in "greybus.h"
greybus: kill gb_operation_gbuf_complete()
greybus: clean up gb_connection_operation_recv()
greybus: reference count operations
greybus: record a gbuf's destination CPort id
greybus: use gbuf's destination cport id
greybus: record the host device in a gbuf
greybus: use a simple list of hd connections
greybus: get rid of cport_id_map_lock
greybus: kill greybus_{get,put}_gbuf()
greybus: kill gbuf->kref
greybus: move the definition of struct gbuf
greybus: define struct gb_message
greybus: start using struct gb_message
greybus: move gbuf initialization to caller
greybus: use null gbuf->transfer_buffer
greybus: embed gbufs into operation message structure
greybus: kill the gbuf slab cache
greybus: kill off the last of gbuf.c
greybus: fix an allocation flag bug
greybus: prepend cport byte for all gbufs
greybus: improve data buffer alignment
greybus: fill in destination data at send time
greybus: allocate space without gbufs
greybus: free space without gbufs
greybus: cancel buffers via magic cookie
greybus: stash hd as context for all URBs
greybus: send buffers without gbufs
greybus: rework message initialization
greybus: send messages, not gbufs
greybus: cancel messages, not gbufs
greybus: rework receve handling
greybus: kill the last gbuf remnants
greybus: stop storing hd in message
greybus: stop storing dest_cport_id in message
greybus: pass gfp_flags for message allocation
greybus: explicitly mark cookies as opaque
greybus: tidy up svc_in_callback() and cport_in_callback()
greybus: get rid of message status
greybus: use "operation_id" for certain values
greybus: refactor gb_connection_recv()
greybus: fix battery_operation()
greybus: fix uart request_operation()
greybus: fix vibrator request_operation()
greybus: get rid of uart request_operation()
greybus: distinguish incoming from outgoing requests
greybus: send operation result in response message header
greybus: define gb_operation_status_map()
greybus: remove status from all responses
greybus: drop a now-empty structure
greybus: fix a timeout race
greybus: complete overflow responses
greybus: have greybus allocate its own buffers
greybus: rename message buffer fields
greybus: dynamically allocate requests and responses
greybus: embed message buffer into message structure
greybus: define greybus_data_sent()
greybus: rename greybus_cport_in()
greybus: use errno for operation result
greybus: abandon incoming requests for now
greybus: handle data send errors in workqueue
greybus: add a reference to pending operations
greybus: minor tweak in gb_connection_recv_response()
greybus: cancel operation on timeout
greybus: cancel whole operation on interrupt
greybus: kill gb_operation_wait()
greybus: rework synchronous operation completion
greybus: encapsulate operation result access
greybus: first operation error prevails
greybus: use special operation result valus
greybus: fix some error codes
greybus: enforce receive buffer size
greybus: update operation result atomically
greybus: ignore a null cookie when canceling buffer
greybus: protect cookie with a mutex
greybus: use outgoing flag when creating operation
greybus: enforce max representable message size
greybus: define -EILSEQ to mean implementation error
greybus: renumber operation result values
greybus: drop gfp_mask from gb_message_send()
greybus: always drop reference in gb_operation_work()
greybus: move copy of incoming request data
greybus: short message is OK for errors
greybus: pass result in gb_connection_recv_response()
greybus: enforce non-zero operation type requirement
greybus: use operation type 0 to signal incoming data
greybus: introduce gb_operation_message_init()
greybus: enforce a buffer headroom maximum size
greybus: create a slab cache for simple messages
greybus: set result in gb_operation_response_send()
greybus: activate incoming request handling
greybus: introduce gb_operation_errno_map()
greybus: send operation response messages
greybus: use little-endian in PWM requests
greybus: fix a bug in gb_operation_sync()
greybus: define the invalid operation type symbolically
greybus: don't use 0 as an operation id
greybus: get rid of pending operations list
greybus: make op_cycle atomic (again)
greybus: introduce gb_operation_request_send_sync()
greybus: fix an error message
greybus: set up connection->private properly
greybus: don't let i2c code assume non-null payload pointer
greybus: only record message payload size
greybus: use null pointer for empty payload
greybus: record type in operation structure
greybus: define GB_OP_NONEXISTENT
greybus: ENODEV can be an expected error too
greybus: switch cport id used for sends
greybus: add Linaro copyrights
greybus: clean up some small messes
greybus: get rid of {conceal,reveal}_urb()
greybus: manifest: use size_t for a size variable
greybus: es1: test apb1_log_task safely
greybus: es2: test apb1_log_task safely
greybus: reduce the ranting
greybus: bundle: use kstrdup() for state file
greybus: battery: free struct on error in caller
greybus: battery: use feature tag rather than kernel version
greybus: eliminate extra response flag definitions
greybus: loopback: fix the type attribute check
greybus: loopback: return the right error value
greybus: loopback: fix an incorrect comment
greybus: loopback: symbolically define max wait time
greybus: loopback: define loopback functions symbolically
greybus: loopback: support module-initiated requests
greybus: endo: rename gb_svc
greybus: endo: pass endo_id to gb_endo_create()
greybus: core: return error code when creating endo
greybus: core: return error code when creating host device
greybus: include "gpbridge.h" from "greybus.h"
greybus: rename "gpbridge.h"
greybus: endo: encapsulate computing the max interface id
greybus: endo: rework some attributes
greybus: endo: record AP interface id
greybus: core: don't set up endo until host device is initialized
greybus: add copyright statements
greybus: update copyrights
greybus: introduce SVC protocol
greybus: greybus_protocols: fix guard tag
greybus: add documentation for Endo sysfs files
greybus: update sysfs documentation files
greybus: endo: drop redundant prefixes from sysfs basenames
greybus: endo: delete "0xXXXX" portion in sysfs "endo" directory
greybus: svc: driver is basic to Greybus (not GP Bridge)
greybus: connection: make gb_connection_hd_find() private
greybus: uart: properly interpret receive data size
greybus: core: rename greybus_deregister()
greybus: manifest: clean up a few pr_err() calls
greybus: drop some unnecessary headers
greybus: tag core init and exit functions
greybus: endo: define endo_init() and endo_exit()
greybus: endo: clean up id assignment code
greybus: manifest: really minor cleanups
greybus: manifest: use bundle's embedded interface pointer
greybus: manifest: rework cport parsing
greybus: manifest: rework bundle parsing
greybus: bundle: check for duplicate bundle ids
greybus: connection: check for duplicate cport ids
greybus: connection: remove extra kfree() call
greybus: connection: drop unneeded gb_protocol_put() calls
greybus: connection: un-abstract host cport id allocation
greybus: manifest: clean up properly when parsing cports
greybus: bundle: refactor gb_bundle_find()
greybus: bundle: fix gb_bundle_destroy()
greybus: manifest: clean up properly when parsing bundles
greybus: introduce cport_id_valid()
greybus: esX: encapsulate packing cport id into header
greybus: rename HOST_DEV_CPORT_ID_MAX
greybus: reserve host cport id 0
greybus: esX: use one byte to encode cport ids in header
greybus: interface: declare gb_interface_destroy()
greybus: looback: fix two typos
greybus: loopback: drop unneeded casts for void pointers
greybus: loopback: use U64_MAX for initialization
greybus: loopback: use u32 for stats update
greybus: loopback: record 32-bit min and max
greybus: loopback: use a 32-bit count
greybus: loopback: error is an unsigned attribute
greybus: loopback: all read-only attributes are unsigned
greybus: loopback: use separate attribute macro for average
greybus: loopback: compute average stats on demand only
greybus: loopback: fix connection cleanup paths
greybus: kernel_ver.h: define U32_MAX and U64_MAX
greybus: db3-platform: fix code that fetches reset GPIO
greybus: db3-platform: fix some typos
greybus: db3-platform: get rid of redundant gpio tests
greybus: es2: rename es2 data structures
greybus: es2: move APB log task into the es2_ap_dev struct
greybus: es2: move logging fifo into es2 struct
greybus: es2: move logging dentries into es2 struct
greybus: es2: don't assume just one AP bridge
greybus: connection: verify disabled when destroyed
greybus: add operation traces
greybus: tracing: define events using macros
greybus: tracing: eliminate "location" comments
greybus: tracing: refine comments
greybus: tracing: fix a bad tracepoint
greybus: tracing: fix hd traces
greybus: tracing: add module traces
greybus: tracing: define interface traces
greybus: report right error value
greybus: fix unbalanced mutex
greybus: eliminate unneeded null check
greybus: fix pointless null check
greybus: use PTR_ERR_OR_ZERO()
greybus: drop a bogus semicolon
greybus: tracing: fix "make check" warnings
greybus: define BUNDLE_ID_NONE
greybus: tracing: fix host device num_cports
greybus: tracing: reorder trace definitions
greybus: tracing: fix module num_interfaces
greybus: tracing: assign "parent" id first
greybus: tracing: add interface mode_switch
greybus: tracing: define bundle traces
greybus: tracing: define connection traces
greybus: tracing: add timing traces
greybus: tracing: fix message traces
greybus: don't key on an enumerated constant
greybus: tracing: drop "greybus" prefix
greybus: get rid of a compile warning
greybus: use memdup_user()

Alexandre Bailon (29):
greybus: i2c-gb: fix bad message size in gb_i2c
greybus: protocol.c: fix a kernel panic caused by __gb_protocol_register
greybus: gpio.c: fix a bad irq number
greybus: Export greybus debugfs folder
greybus: Dump log from APB1
greybus: Add loopback protocol
greybus: es1.c: Don't use magic value for USB control request
greybus: es2.c: Don't use magic value for USB control request
greybus: es2.c: create dedicated struct for cport_in and cport_out
greybus: es2.c: Increase the number of bulk endpoints
greybus: es2.c: add a control request for endpoints mapping
greybus: es1/es2: set transfer flag to send a zero-length packet
greybus: Greybus driver: add a new callbacks to driver
greybus: es2: update the bulk_ep_set value accepted by map_to_cpor_ep()
greybus: es2: rename misnamed variables and methods
greybus: es2: change (un)map methods to static
greybus: es2: add some documentation about endpoints mapping
greybus: loopback: fix invalid response size
greybus: gb_loopback: Fix throughput calculations
greybus: loopback: Fix calculations error for ping transfers
greybus: loopback: Fix incoherency in calculations in the case of error
greybus: loopback: Fix throughput calculations
greybus: loopback: Fix averaging
greybus: loopback: Fix warning on 32-bit build
greybus: loopback: round closest the sixth decimal
greybus: loopback: Fix broken synchonous test
greybus: loopback: Fix broken loopback min values
greybus: es2: Add a new bulk in endpoint for APBridgeA RPC
greybus: es2: Implement APBridgeA RPC (ARPC)

Ann Chen (2):
greybus: vibrator: integrate runtime pm
greybus: Add workqueue to handle vibrator timeout

Axel Haslam (24):
greybus: greybus/loopback: remove mask attribute
greybus: greybus/loopback: register a struct device.
greybus: loopback_test: make output to csv file a parameter option
greybus: loopback_test: Decrease the max number of devices
greybus: greybus/loopback: Add reserved fields to transfer request
greybus: Notify user space only when the test finished.
greybus: Loopback_test: use poll instead of inotify
greybus: loopback_test: Use timeout argument
greybus: loopback_test: handle SIGINT signal
greybus: uart: Update line coding settings only when needed
greybus: uart fix missing negation on DTR setting
greybus: Fix loopback app after rename to gpphy
greybus: uart: Handle CRTSCTS flag in termios
greybus: uart: Implement dtr_rts callback.
greybus: uart: Use a fifo to send data to the modules
greybus: uart: Add credits based tracking for transmit path
greybus: uart: Implement flush_buffer
greybus: uart: wait for credits on shutdown
greybus: uart: Add runtime pm support
greybus: gpio: Add runtime_pm suppourt
greybus: pwm: Add runtime_pm support
greybus: spi: Add runtime_pm support
greybus: loopback: add runtime pm support
greybus: gbphy: fix compile error with CONFIG_PM_RUNTIME disabled

Bartosz Golaszewski (4):
greybus: loopback: allocate a response even for a 0-byte request
greybus: legacy: fix a null pointer dereference
greybus: audio_manager: add missing header
greybus: pm: add error handling to bundle activation

Bill Pemberton (3):
greybus: gb-vibrator: remove useless if in timeout_store()
greybus: Add FIXME warnings for possible NULL dereferences
greybus: gpio-gb: remove checks for negative offset variable

Bryan O'Donoghue (132):
greybus: Support building greybus on host PC
greybus: uart: Move UART protocol structs/defines to greybus_protocols.h
greybus: uart: Tidy naming convention to more closely match spec
greybus: uart: Reduce UART count from 255 to 16
greybus: uart: Update uart.c to register tty ports
greybus: uart: send_data should return size or error
greybus: uart: kmalloc for send_data once only
greybus: uart: Add gb_uart_request_recv for receiving async UART data
greybus: uart: Remove magic numbers make struct gb_tty variable names consistent
greybus: uart: Latch modem control signals for tciomget
greybus: greybus/uart: Fix sparse warning
greybus: greybus/uart: Relocate UART parity/overrun/framing/break signals
greybus: greybus/uart: Add support for UART error signals
greybus: greybus/uart: Update UART to reflect field size changes
greybus: greybus/loopback: Move loopback operation definitions
greybus: greybus/loopback: remove magic number in state-machine
greybus: greybus/loopback: remove spurious pr_err in sysfs store
greybus: greybus/loopback: make loopback type input equivalent to protocol type
greybus: greybus/loopback: add sink to loopback protocol
greybus: greybus/loopback: truncate maximum loop data to link size
greybus: greybus/loopback: update throughput metrics to improve granularity
greybus: greybus/loopback: fix broken tabs in greybus_protocols.h
greybus: greybus/loopback: fix 64bit printf format error
greybus: greybus/uart: fix typo in defintion
greybus: greybus/manifest: reserve control connection cport/bundle ids
greybus: greybus/manifest: convert pr_err to dev_err
greybus: greybus/loopback: timestamp seeding should not drop metrics
greybus: greybus/loopback: update loopback operation description comment
greybus: greybus/loopback: run operations a set number of times
greybus: greybus/loopback: add commentary to sysfs variables
greybus: greybus/loopback: rename frequency to requests
greybus: greybus/loopback: convert loopback wake/sleep to a waitqueue
greybus: greybus/loopback: remove redundant timestamping
greybus: greybus/loopback: make loopback code thread safe
greybus: greybus/loopback: provide interface to read all latency data-points
greybus: greybus/loopback: warn user if kfifo cannot log all data
greybus: greybus/connection: fix jump label on device_add failure
greybus: greybus/connection: add a timestamp kfifo to track connection handoff
greybus: greybus/es-drivers: add outbound timestamp to connection
greybus: greybus/loopback: functionally decompose calculation of turn-around times
greybus: greybus/loopback: handle timestamp roll-over
greybus: greybus/interface: change typo replicable => replaceable
greybus: greybus/loopback: add ability to graph greybus latency
greybus: greybus/loopback: convert sample report interface to debugfs
greybus: greybus/loopback: support synchronized tests over multiple cports
greybus: greybus/loopback: add gb_loopback_nsec_to_usec_latency
greybus: greybus/loopback: functionally decompose gb_loopback_calc_latency
greybus: greybus/loopback: graph round-trip time for all threads
greybus: greybus/loopback: add bitmask of connections to include in test
greybus: greybus/loopback: initialized ms_wait negate warning
greybus: greybus/loopback: remove checkpatch error causing macro
greybus: greybus/loopback: add module level sys/debug fs data points
greybus: greybus/loopback: fix typo in comment
greybus: greybus/loopback: make sure to list_del on connection_exit
greybus: greybus/loopback: ensure count decrement happens before sysfs_remove_groups
greybus: greybus/loopback: hold a coarse lock while init/exit run
greybus: greybus/loopback: exit kfree after mutex release
greybus: greybus/loopback: ensure debugfs entires are cleaned up on exit
greybus: greybus/loopback: ensure sysfs entries are cleaned up on exit
greybus: greybus/loopback: convert pr_info to dev_err
greybus: greybus/loopback: add response len to loopback protocol
greybus: greybus/loopback: sort list of connections for masking purposes
greybus: greybus/loopback: add gb_loopback_operation_sync
greybus: greybus/loopback: use dev_name to populate sysfsname
greybus: greybus/tracepoints: add tracepoint definitions
greybus: greybus/operation, core: hook tracepoints into message opertions
greybus: greybus/loopback: drop dependency on internal timestamps
greybus: greybus/tracepoints: add tracepoints for host_device tx/rx
greybus: greybus/es1, es2: hook tracepoints to hardware send/recv operations
greybus: greybus/loopback: move sysfs entries to /sys/bus/greybus/devices/endo0
greybus: greybus/loopback: masked out threads should sleep
greybus: greybus/loopback: drop redundant endo0 string from debugfs entry name
greybus: greybus/loopback: remove module specific identifier from debugfs name
greybus: greybus/loopback: add reserved fields to track firmware latencies
greybus: greybus/es1,es2: add USB vendor command to timestamp
greybus: greybus/connection: add latency tag enable/disable callbacks
greybus: greybus/loopback: send command to APBridge to tag throughput
greybus: greybus/loopback: add tracker variables to hold firmware timestamps
greybus: greybus/loopback: capture and present firmware supplied latencies
greybus: greybus/manifest: fix the placement of arguments to pr_err
greybus: greybus/audio-pcm: fix use of variable unitialized
greybus: greybus/loopback: Relax locking during loopback operations
greybus: greybus/loopback: Move latency_ts initialization to transfer routine
greybus: greybus/loopback: Drop unused timeval variables
greybus: greybus/loopback: drop bus aggregate calculation
greybus: greybus/loopback: Convert cross-thread mutex to spinlock while relaxing connect locks
greybus: greybus/loopback: Add asynchronous bi-directional support
greybus: greybus/loopback: Convert thread delay to microseconds
greybus: greybus/loopback: Ensure we reset stats once and once only
greybus: greybus/loopback: Drop NULL check on container_of pointer
greybus: greybus/loopback: Retrun -ENOMEM if operation allocation fails
greybus: greybus/loopback: Wait for all async operations to complete on exit
greybus: greybus/loopback: Add asynchronous backoff
greybus: svc: Change GB_SVC_TYPE_LINK_CONFIG to 0x10
greybus: greybus/timesync: Add Control and SVC TimeSync command/response data definitions
greybus: greybus/timesync: Add Control and SVC protocol TimeSync operation definitions
greybus: greybus/control: Add TimeSync control commands
greybus: Ensure gb->mutex is held when adding timer
greybus: Fixup __u64, __u32 to __le64, __le32 in timesync declarations
greybus: greybus_trace.h: Fix dodgy indentation
greybus: greybus_protocols.h Add SVC_TIMESYNC_WAKE_PINS_ACQUIRE/RELEASE
greybus: greybus_protocols.h Add SVC_TIMESYNC_PING
greybus: arche-platform: Rework platform/wd-line state transition logic
greybus: svc: Add TimeSync SVC commands
greybus: control: Add TimeSync get-last-event logic
greybus: control: Drop unused parameter from timesync_authoritative
greybus: hd: Add TimeSync APBridge commands
greybus: interface: Extract and store Interface feature byte
greybus: es2.c: Declare local __le64 not u64
greybus: Fix unbalanced irq_enable() backtrace
greybus: timesync: Add timesync core driver
greybus: timesync: Bind TimeSync into Greybus
greybus: tracepoints: Add standard Linux tracepoint for TimeSync event
greybus: timesync: Add gb_timesync_frame_time_to_timespec()
greybus: timesync: Add debugfs entry to display frame-ping in ktime
greybus: uart: Fix minor number leak
greybus: timesync: Do 64 bit divisions in a 32 friendly way
greybus: timesync: Do not hold mutex on cancel_delayed_work_sync
greybus: timesync: Fix transitions to the INACTIVE state
greybus: timesync: Rework timesync removal serialization logic
greybus: timesync: Enforce TimeSync locks as subordinate to Interface locks
greybus: timesync: Initialize the timesync ping fields to zero
greybus: timesync: Make printout consitent with other greybus messages
greybus: timesync/pm: Make synchronous call to restore FrameTime
greybus: greybus_protocols.h/es2: Ensure __le32 is used not u32
greybus: greybus_protocols.h: convert __u32 to __le32
greybus: timesync: Bugfix ping should not result in -EAGAIN
greybus: timesync: reduce initial startup time
greybus: timesync: probe shouldn't complete until FrameTime sync does
greybus: timesync: Implement a retry mechanism
greybus: timesync: Ensure parallel synchronous calls succeed
greybus: timesync: Printout strobe count on sync failure

David Lin (40):
greybus: arche-platform: fix incorrect gpio variable type
greybus: greybus_trace: Fix broken greybus ftrace
greybus: svc: add Interface power measurements support
greybus: arche-platform: Power-off unipro subsystem upon suspend
greybus: svc watchdog: Disable watchdog upon entering suspend
greybus: es2: Fix apb_log null pointer exception
greybus: svc: add AP power measurements debugfs support
greybus: svc: clean up gb_svc struct for pwrmon
greybus: svc: free pwrmon_rails memory upon exit
greybus: operation: fix an inconsistent indent
greybus: legacy: remove legacy driver support
greybus: legacy: remove protocol.o from the makefile
greybus: svc: pwrmon: validate svc protocol op status when getting rail names
greybus: audio: remove the unnecessary return statement
greybus: control: add bundle suspend and resume preparations
greybus: control: add bundle deactivate and activate operation
greybus: control: add interface suspend prepare operation
greybus: control: add interface deactivate prepare operation
greybus: control: add interface hibernate abort operation
greybus: svc: add interface resume operation
greybus: svc: add power mode call for link hibernation
greybus: interface: implement unipro link hibernate call
greybus: control: add connection suspend and resume calls
greybus: interface: send deactivate prepare when interface is disabled
greybus: bundle: add activate and deactivate
greybus: interface: add runtime pm support
greybus: bundle: add runtime pm support
greybus: audio: add runtime pm support
greybus: camera: add runtime pm support
greybus: gbphy: add gbphy runtime pm support
greybus: i2c: add runtime pm support
greybus: hd: arche-platform: implement greybus shutdown
greybus: timesync: do not print frametime by default
greybus: operation: print id when synchronous operation timeout
greybus: svc_watchdog: Add sysfs file to change the behavior of bite
greybus: audio: add runtime pm to enumerated control and DAPM widget
greybus: interface: delete control device upon enable failure
greybus: svc_watchdog: use schedule_delayed_work helper
greybus: interface: fix timesync registration sequencing
greybus: light: fix incorrect led attribute files allocation

Dinko Mironov (1):
greybus: audio: Fix incorrect counting of 'ida'

Eli Sennesh (5):
greybus: firmware and svc: detect the difference between ES2 and ES3 chips
greybus: firmware/bootrom: debug output from bootrom protocol
greybus: operation: rate-limit dev_err printing on the receive path
greybus: update UniPro Set Interface Power Mode operation to match spec
greybus: update UniPro Set Interface Power Mode operation to match spec

Evgeniy Borisov (6):
greybus: camera-gb: Extend the configure streams interface
greybus: camera-gb: Remove hardcode for CSI TX number of lanes
greybus: camera-gb: Add description of interface header
greybus: camera-gb: Extend gb camera module structure
greybus: camera-gb: Implement camera module reference counting as subject.
greybus: camera: Add RAW data format

Fabien Parent (15):
greybus: es2: rename misnamed CPORT_MAX into CPORT_COUNT
greybus: add num_cports field to greybus hd
greybus: es2: dynamically allocate array for cport <-> ep mapping
greybus: es2: get cport count from apb1 usb device
greybus: es{1,2}: remove control endpoint field
greybus: connection: fail to bind if connection init fails
greybus: es{1,2}: remove obselete define
greybus: es2: implement cport reset control request
greybus: connection: destroy connection on failing to bind it
greybus: connection: add api to {en,dis}able unipro fct flow
greybus: apba: add fct flow usb control requests
greybus: es2: implement the fct flow control requests
greybus: connection: {en,dis}able fct flow in connection management
greybus: camera: disable E2EFC on CSI connection
greybus: connection: remove CDSI1 hack

Georgi Dobrev (2):
greybus: Added a sysfs entry to power down the SVC
greybus: greybus-driver: Add intf_oops operation

Gjorgji Rosikopulos (11):
greybus: camera: HACK: Export GB camera interface
greybus: camera: HACK: Register gb camera to the HOST camera
greybus: camera: Fix backword compatibility in configure streams
greybus: camera: Add support for configure streams flag in gb interface
greybus: camera: Update configure stream based on new interface
greybus: camera: add semiplanar and planar formats
greybus: camera: Improve module registration mechanism
greybus: camera: Use pointer for gb camera module ops
greybus: camera: Add metadata format
greybus: camera: Add debug data format
greybus: camera: Rename debug and metadata mbus formats

Greg KH (8):
greybus: battery: update for 4.1 power supply api changes
greybus: gb-audio: fix build warning
greybus: gb-audio: fix build breakage on 4.1-rc1
greybus: es2: comment out unused functions
greybus: audio_codec: Don't be tricky with the driver model
greybus: add bundle class to the bundle uevent
greybus: svc: double the ping delay timeout
greybus: camera: only build module against msm kernel

Greg Kroah-Hartman (376):
greybus: Initial commit
greybus: Import most recent greybus code to new repo.
greybus: README and .gitignore updates
greybus: update README with info on how to build and contact me.
greybus: i2c-gb: actually add the i2c adapter properly...
greybus: greybus.h: tiny coding style cleanups
greybus: Greybus SD/MMC host driver
greybus: add framework for 'struct gbuf'
greybus: gpio driver
greybus: gpio-gb.c: it now builds properly
greybus: uart framework added, doesn't build
greybus: uart-gb: more work on tty functions
greybus: more uart work
greybus: uart-gb: now builds, more framework added
greybus: start moving the function types into the greybus core
greybus: static module_init/exit functions
greybus: hook up sdio, gpio, and tty into the greybus core.
greybus: i2c: tie to the proper place on the greybus_device
greybus: i2c: use same naming convention everywhere
greybus: gpio: tie into gb core properly
greybus: sdio: tie into gb core properly
greybus: uart: tie into gb core properly
greybus: initial framework for ES1 usb AP driver
greybus: can't use devm anymore, we aren't tieing into the driver model lifecycle :(
greybus: actually get the devm() change to build...
greybus: first framework for the es1 ap controller
greybus: es1-ap-usb: more init framework added.
greybus: register the bus with the driver core and add framework for debugfs files.
greybus: ap message loop added.
greybus: structures added
greybus: more structure definitions added
greybus: split svc msg out into separate header file
greybus: greybus_desc.h created
greybus: header file s/u8/__u8/g
greybus: greybus.h: tiny movement around
greybus: more changes due to name changes in the greybus document
greybus: s/greybus_device_id/greybus_module_id/g
greybus: get field names right for descriptors
greybus: turn off warnings for es1-ap-usb.c to make it easier to build for now...
greybus: export gb_new_ap_msg so that the es1 module can use it
greybus: start parsing descriptor structures
greybus: start parsing descriptor fields
greybus: sysfs attributes for functions and more driver core integration.
greybus: serial number attribute added
greybus: module id attributes
greybus: greybus_string()
greybus: split sysfs functions out to separate file.
greybus: minor checkpatch cleanups
greybus: add proper packing to all greybus message types
greybus: uart-gb: remove unneeded THIS_MODULE setting
greybus: add es1_ap_desc.c to describe the ES1 USB device descriptors
greybus: host controller additions
greybus: more hd work
greybus: first cut at parsing svc messages sent to the AP
greybus: add battery module
greybus: battery FIXME added
greybus: minor whitespace cleanups to make checkpatch.pl happy
greybus: es1_ap_desc.c: updated ES1 USB device descriptor
greybus: es1: finialized USB device structure
greybus: es1: forgot to free our urb on disconnect
greybus: pass appropriate type to create function
greybus: fix endian issue in sysfs.c
greybus: Fix build errors on older kernels.
greybus: Merge branch 'master' of github.com:gregkh/greybus
greybus: AP: move a bunch of svc message handling logic into ap.c
greybus: es1: add the start of cport urb handling.
greybus: es1: allocate cport out urbs properly
greybus: es1: handle cport data in and out
greybus: ap: convert to workqueue from thread
greybus: ap: cleanup of process ap message loop
greybus: Makefile: add 'check' option to run sparse with endian checks enabled
greybus: es1 endpoint descriptor: minor fixes to get the config right
greybus: tty driver fixes to get init working properly
greybus: uart-gb: let the core dynamically allocate the major number
greybus: core: verify major/minor number of greybus protocol
greybus: es1: functionally complete
greybus: devices: endpoint description of device
greybus: gbuf recieve path work, not done, dinner time...
greybus: gbuf: cport in buffer stream logic
greybus: add test_sink driver
greybus: fix hd init sequence of setting up parent and driver pointers properly
greybus: es1: set buffer sizes for messages based on email discussions
greybus: gbuf: implement submission logic
greybus: gbuf: clean up logic of who owns what "part" of the gbuf
greybus: svc_msg.h: add data for hotplug message
greybus: greybus.h: add function prototype for add/remove a module
greybus: core.c: create empty functions to keep linking working for hotplug/remove
greybus: ap: start validating the message better
greybus: ap: validate the rest of the svc message buffer sizes
greybus: core: hook up the hotplug message
greybus: fix up coding style issue I caused with the last patch...
greybus: es1: no BUG_ON() code, report an error and recover.
greybus: operation: fix endian issue in the operation message header size field.
greybus: manifest: some minor sparse warning fixups.
greybus: manifest.c: minor sparse cleanup
greybus: connection: properly lock idr
greybus: greybus.h: remove transfer_flags
greybus: greybus_id.h: checkpatch cleanup
greybus: svc_msg.h: add bsd license to file so that firmware can use it.
greybus: greybus_manifest.h: add BSD license so that firmware can share it.
greybus: greybus_manifest.h: fix up class protocol numbers to match the spec.
greybus: gpio-gb: allow it to build properly for all current kernel versions.
greybus: battery-gb: provide accessors for a few more functions
greybus: battery: some hooking up to the greybus core
greybus: add LED protocol numbers
greybus: battery-gb: Add battery communication with the module
greybus: Merge branch 'gregkh_work' into master
greybus: battery-gb.c: fix memory leak found by Viresh
greybus: battery-gb: Allow kernel values to get out of sync with greybus spec
greybus: module: fix double free of module
greybus: hook up greybus to the driver model
greybus: module: enable all sysfs attributes
greybus: i2c: point to the proper parent device
greybus: module: don't create duplicate module ids
greybus: operation: fix some sparse warnings
greybus: gpio-gb: fix some endian sparse warnings that were real.
greybus: gbuf: implement gbuf_kill_gbuf()
greybus: core: check for valid hcd callbacks
greybus: core: make greybus_kill_gbuf not return a value
greybus: operation: make the timeout a per-operation thing, not per-connection
greybus: uart-gb: convert over to the connection interface
greybus: uart-gb: remove global init functions
greybus: FIXME/XXX removals: We have proper reference counting now
greybus: module: remove unneeded XXX comment about module id values
greybus: kernel_ver.h: add ATTRIBUTE_GROUPS() macro for older kernels
greybus: uart-gb: mark some functions static
greybus: battery-gb: remove some #if 0 code
greybus: sdio-gb: convert to the connection interface.
greybus: Merge branch 'master' into driver_model_rework
greybus: #if 0 cleanups
greybus: Remove id_table usages
greybus: es1-ap-usb: document the lack of callback for the outgoing bulk urbs
greybus: connection: fix up error patch logic in gb_connection_create()
greybus: Revert "manifest: improve print message"
greybus: Revert "manifest: remove extra loop for finding module descriptor"
greybus: skeleton for future uevents.
greybus: Greybus UART connection driver
greybus: uart: handle NULL size requests in request_operation()
greybus: greybus_manifest.h: update with full list of protocols
greybus: vibrator-gb: add vibrator driver
greybus: vibrator-gb: fixes based on Marti's review comments.
greybus: vibrator-gb: proper allocate minor numbers
greybus: Merge branch 'master' into vibrator-gb
greybus: vibrator-gb: fix up api changes
greybus: Merge branch 'master' into vibrator-gb
greybus: vibrator-gb.c: fix up incorrect comment
greybus: uart-gb: handle throttle/unthrottle properly
greybus: uart-gb: fix up typo from previous patch moving the status variable around.
greybus: pwm-gb.c: fix up missing { } for else
greybus: add -Wall to the build flags
greybus: operation: create gb_operation_sync for sending "simple" messages
greybus: battery-gb: convert to use gb_operation_sync
greybus: vibrator-gb: convert to use gb_operation_sync
greybus: uart-gb: convert to use gb_operation_sync
greybus: gpio-gb: convert to use gb_operation_sync
greybus: i2c-gb: convert to use gb_operation_sync
greybus: pwm-gb: convert to use gb_operation_sync
greybus: uart-gb: clean up send_line_coding
greybus: usb-gb: import a "buildable" version of the usb-gb.c driver
greybus: operation: fix up sparse warning
greybus: battery-gb.c: add new functions from Greybus spec document.
greybus: greybus_manifest.h: add FIXME for version
greybus: uart-gb.c: don't include module.h
greybus: module versions: remove them
greybus: module: remove obsolete gb_tty pointer
greybus: interface_block: rename module.[c|h] to interface_block.[c|h]
greybus: interface_block: s/gb_module/gb_interface_block/
greybus: interface_block: rename the sysfs files to not have 'module' in them
greybus: sysfs documentation: Document the greybus interface block sysfs files.
greybus: interface_block: move sysfs files into the interface_block.c file
greybus: connection: document the sysfs files
greybus: interface: document sysfs files
greybus: driver matching: Greybus drivers bind to interface blocks, not modules
greybus: bundle: rename interface.[c|h] to bundle.[c|h]
greybus: es1-ap-usb: don't protest when getting -EPROTO USB errors
greybus: bundle: s/gb_interface/gb_bundle/g
greybus: interface_block.c: rename the "interfaces" list "bundles"
greybus: rename interface_block.[c|h] -> interface.[c|h]
greybus: interface: s/gb_interface_block/gb_interface/g
greybus: interface: rename greybus_interface_block_id to greybus_interface_id
greybus: interface.h: remove unused #defines
greybus: greybus_id.h: minor typo fixes
greybus: interface: we really are creating/destroying interfaces not modules.
greybus: greybus_host_device: rename modules -> interfaces
greybus: interface: rename gb_modules_lock -> gb_interfaces_lock
greybus: add module support
greybus: interface: remove global manifest_descs list
greybus: protocol: switch gb_protocol_register() to return an int
greybus: export needed symbols for protocols
greybus: protocol: split binding of prototcols to connections out of init
greybus: i2c-gb: split out into a stand-alone kernel module.
greybus: bundle: create GB_DEVICE_ID_BAD
greybus: protocol: add a module owner to a protocol
greybus: vibrator-gb: move vibrator protocol to a stand-alone module.
greybus: battery-gb: move the battery protocol out to a stand-alone module
greybus: gpb: Create a "GP Bridge" kernel module
greybus: i2c-gb: move i2c protocol into the gpbridge driver
greybus: module: get rid of global list of modules
greybus: protocol: name protocols.
greybus: protocol: fix oops when no protocol is assigned
greybus: sysfs: put a \n at the end of all sysfs files
greybus: Makefile: provide install target
greybus: rename gpbridge.ko to gb-phy.ko
greybus: rename vibrator-gb.ko to gb-vibrator.ko
greybus: rename battery-gb.c to gb-battery.c
greybus: rename es1-ap-usb.ko to gb-es1.ko
greybus: Move the es1_ap_desc.c file to Documentation directory
greybus: es1: no need to assign a variable we return directly
greybus: es2: add ES2 Greybus Host driver
greybus: Revert "protocol.c: fix a kernel panic caused by __gb_protocol_register"
greybus: Revert "protocol: dedup protocol find code"
greybus: ap.c: our workqueue should be ordered
greybus: es1.c: wait until the last possible minute to start the svc messages
greybus: es2: fix USB id to not be the same as ES1
greybus: es1: fix build warning for apb1_log_enable_write
greybus: es1: fix tiny whitespace issues
greybus: es1: use <linux/uaccess.h> and not <asm/uaccess.h>
greybus: es1: no need to check for NULL on debugfs_remove()
greybus: es1: struct file_operations needs to be const
greybus: es1: decimal modes are not what are wanted for debugfs
greybus: es1: move debugfs function to use kstrotoint_from_user()
greybus: es1: fix checkpatch warning about blank lines needed
greybus: es1: separate usb_log enable/disable logic into different functions
greybus: es1: allow the debug log to be stopped
greybus: Merge branch 'es1-fixes' into master
greybus: debugfs: we shouldn't care if debugfs is working or not
greybus: es2: sync up with recent es1.c changes
greybus: loopback: fix build breakage about SZ_4K
greybus: loopback: use the attribute groups, not group
greybus: kernel_ver.h: add sysfs_create_groups() and sysfs_remove_groups()
greybus: Documentation/sysfs: add a proposed sysfs tree for greybus
greybus: module.c: add attributes
greybus: endo: add endo structures and logic
greybus: endo: hook up endos into the device tree
greybus: Documentation/sysfs-bus-greybus: update kernel version and date
greybus: Documentation/sysfs-bus-greybus: document the endo and SVC
greybus: Documentation/sysfs-bus-greybus: document module sysfs files
greybus: gpbridge.h: whitespace cleanups
greybus: gpbridge.h: remove BIT() define
greybus: bundle: add state sysfs file
greybus: MODULE_LICENSE cleanup
greybus: kernel_ver.h: fix leading space coding style issues
greybus: kernel_ver.h: add a ' ' character to KERNEL_VERSION()
greybus: kernel_ver.h: add a blank line after a variable definition
greybus: protocol.h: macros should not have a trailing ';'
greybus: protocol.h: fix up long lines in define_get_version()
greybus: audio: fix some sparse static warnings
greybus: audio: fix a bunch of endian issues
greybus: vibrator: convert idr to be an ida
greybus: connection: remove lock around ida_simple_* functions
greybus: raw: add raw greybus kernel driver
greybus: Merge branch 'master' of github.com:gregkh/greybus
greybus: Merge branch 'master' of github.com:gregkh/greybus
greybus: es?: decrease buffer size to 2k
greybus: remove __init from .h files
greybus: Merge branch alex into Alexandre
greybus: Revert "greybus: reserve host cport id 0"
greybus: Revert "examples: add manifest file for sdio"
greybus: properly cleanup ida and idr structures when shutting down
greybus: connection: prevent oops for protocol_id sysfs file
greybus: loopback: add poll support to the iteration_count sysfs file
greybus: es1: remove svc endpoint message handling
greybus: es2: remove svc endpoint message handling
greybus: greybus.h: remove greybus_svc_in()
greybus: remove submit_svc from the host driver
greybus: interface: make gb_interface_destroy() static
greybus: core: clean up ida memory for host controller
greybus: svc: revert svc changes to keep things working for a while.
greybus: es1: remove svc endpoint message handling
greybus: es2: remove svc endpoint message handling
greybus: greybus.h: remove greybus_svc_in()
greybus: remove submit_svc from the host driver
greybus: interface: make gb_interface_destroy() static
greybus: Merge branch 'master' into svc to keep it up to date.
greybus: Revert "connection: remove special check for svc cport id"
greybus: Merge branch 'master' into svc
greybus: Merge branch 'master' into svc
greybus: Merge branch 'master' into svc
greybus: Merge branch 'master' into branch 'svc'.
greybus: Merge branch 'master' into branch 'svc'.
greybus: gpio: handle api change in generic_handle_irq_desc()
greybus: vibrator: use the bundle struct device instead of the connector
greybus: uart: use the bundle struct device instead of the connector
greybus: spi: use the bundle struct device instead of the connector
greybus: hid: use the bundle struct device instead of the connector
greybus: audio: use the bundle struct device instead of the connector
greybus: firmware: use the bundle struct device instead of the connector
greybus: gpio: use the bundle struct device instead of the connector
greybus: i2c: use the bundle struct device instead of the connector
greybus: pwm: use the bundle struct device instead of the connector
greybus: light : use the bundle struct device instead of the connector
greybus: sdio: use the bundle struct device instead of the connector
greybus: usb: use the bundle struct device instead of the connector
greybus: operation: use the bundle struct device instead of the connector
greybus: control: use the bundle struct device instead of the connector
greybus: raw: use the bundle struct device instead of the connector
greybus: connection: remove 'struct device' from 'struct gb_connection'
greybus: connection: use the bundle struct device instead of the connector
greybus: loopback: use the bundle struct device instead of the connector
greybus: greybus_trace: use the bundle struct device instead of the connector
greybus: protocol: use the bundle struct device instead of the connector
greybus: bundle.h: add a private field to struct gb_bundle
greybus: core: remove uevent handling for gb_connection
greybus: svc: don't trust any struct devices
greybus: es2: use official USB vendor/device id
greybus: hid: hid should not be part of the bridged-phy driver.
greybus: Camera: remove f_dentry usage
greybus: tools: Add tools directory to greybus repo and add loopback
greybus: loopback_test: fix warning about signed/unsigned comparison
greybus: loopback_test: null terminate the dict structure
greybus: tools: don't always build them.
greybus: arche-platform: merge arche-apb-ctrl and arche-platform
greybus: host: provide "generic" apbridge output calls
greybus: APBridge: move APBridge request protocol to a common .h file
greybus: uevent: add GREYBUS_ID to uevent
greybus: Makefile: fix up build test for gb-audio-codec.ko
greybus: Revert "camera: Fix backword compatibility in configure streams"
greybus: firmware: log the name of the firmware being requested
greybus: svc: add ping command
greybus: lsgb: add lsgb shell script
greybus: lsgb: Minor tweaks
greybus: svc: add a "watchdog" to check the network health
greybus: svc: return proper error code on watchdog create error
greybus: svc watchdog: allow it to be enabled/disabled from userspace
greybus: audio_manager: use an 'ida' for the module id
greybus: lsgb: remove it, it's in the gb-utils repo
greybus: fix sparse warning in manifest.c
greybus: only build arche platform driver if usb3613 is enabled
greybus: Revert "gb_loopback: Fix throughput calculations"
greybus: uart: properly calculate max buffer size
greybus: gpio: use bundle device for error messages
greybus: gpio: handle api changes for 4.5 kernel release
greybus: expose full 32 bits of vid/pid to userspace
greybus: gpbridge.h: move protocol init/exit prototypes
greybus: manifest: reserve the Bridged PHY class
greybus: properly annotate struct gb_control_timesync_enable_request
greybus: connection: add functions to get/set private data
greybus: convert drivers to use connection->private set/get
greybus: trivial: add checkpatch.pl to the tree
greybus: scripts: create subdir for checkpatch and spelling.txt
greybus: gpbridge: implement gpbridge "bus" logic
greybus: UART: convert to a gpbridge driver
greybus: PWM: convert to a gpbridge driver
greybus: I2C: convert to a gpbridge driver
greybus: GPIO: convert to a gpbridge driver
greybus: SDIO: convert to a gpbridge driver
greybus: SPI: convert to a gpbridge driver
greybus: USB: convert to a gpbridge driver
greybus: make greybus_gpbdev_type static
greybus: kernel_ver.h: provide pwm_is_enabled()
greybus: Revert "greybus: don't use spin_lock_irq()"
greybus: move all firmware prefix strings to one place
greybus: fix up copyright dates on arpc.h
greybus: Revert "svc: drop all symbol exports"
greybus: es2: remove #if 0 code
greybus: es2: remove struct cport_to_ep
greybus: es2: remove bulk_out array
greybus: es2: remove bulk_in array
greybus: es2: remove unneeded BULK_* #defines
greybus: es2: No need to check before freeing an urb
greybus: es2: fix up usb probe error messages
Merge greybus driver tree into 4.8-rc5
greybus: Add drivers/greybus to the build
greybus: remove local checkpatch.pl copy
greybus: kernel_ver.h: remove lots of stuff
greybus: Documentation: remove sysfs tree
greybus: remove README and LICENSE
greybus: remove .gitignore file
greybus: move the sysfs documentation to Documentation/ABI/testing
greybus: remove old es1 endpoint description
greybus: hid: remove KERNEL_VERSION checks
greybus: vibrator: remove KERNEL_VERSION checks
greybus: gpio: remove KERNEL_VERSION checks
greybus: spi: remove KERNEL_VERSION checks
greybus: sdio: fix min() type check
greybus: remove CONFIG_PM_RUNTIME from kernel_ver.h

Jackson Chang (1):
greybus: SDIO: Add runtime pm support

Jacopo Mondi (17):
greybus: camera: Add support for flags to stream_configure
greybus: camera: Stream config change unipro speed
greybus: camera: Reset link speed on failed config
greybus: camera: Add missing return value
greybus: camera: Add CSI configuration parameters
greybus: camera: Rename clock_mode to flags
greybus: camera: Register capabilities operation
greybus: camera: Early update num_streams and flags
greybus: camera: Fix number of configured streams
greybus: camera: Fix size of configure_streams(0)
greybus: camera: Add bpp to Greybus Format description
greybus: camera: Add wrapper for sync operation with flags
greybus: camera: Update Configure Streams Response
greybus: camera: Configure APB-A with new params
greybus: camera: Update CSI config parameters
greybus: camera: Remove reference to ara subdevice
greybus: camera: Remove support for legacy modules

Jeffrey Carlyle (8):
greybus: Revert "bootrom: Implement timeouts to detect Module failures"
greybus: svc: implement svc_intf_{vsys,refclk,unipro}_{enable,disable} operations
greybus: svc: implement svc_intf_activate
greybus: svc: support status in svc_intf_activate response
greybus: interface: retry enumeration of UniPro-only modules
greybus: Revert "update UniPro Set Interface Power Mode operation to match spec"
greybus: svc: implement connection_quiescing call
greybus: connection: switch to using spin_lock_irqsave/spin_lock_irqrestore excluisvely

Joel Porquet (2):
greybus: add support for the log protocol
greybus: firmware.h: rename TFTF firmware filenames

Johan Hovold (547):
greybus: connection: fix non-atomic allocations under spin lock
greybus: bundle: fix sleep-while-atomic in gb_bundle_destroy
greybus: gpio: fix memory leaks at init and exit
greybus: operation: fix locking issues
greybus: connection: fix locking in gb_hd_connection_find
greybus: pwm: fix memory leak in error path
greybus: vibrator: fix memory leak in error path
greybus: connection: fix oops after failed init
greybus: gpio: fix set-debounce request alignment
greybus: pwm: fix config-request alignment
greybus: uart: remove packed-attribute from line-coding struct
greybus: usb: silence compiler warning
greybus: ap: fix svc handshake protocol check
greybus: ap: fix typo in comment
greybus: ap: clean up svc link management error path
greybus: connection: replace custom error function with dev_err
greybus: operation: use dev_err in gb_operation_sync
greybus: operation: remove unnecessary cast
greybus: gpio: fix truncated debounce times
greybus: gpio: remove incorrect todo comments
greybus: gpio: remove redundant argument verification
greybus: gpio: remove overly defensive argument verification
greybus: gpio: remove unnecessary explicit cast
greybus: gpio: make gb_gpio_controller pointer naming consistent
greybus: gpio: fix error handling
greybus: gpio: use dev_err and dev_warn
greybus: gpio: clean up line-state allocation
greybus: gpio: refuse to set value of input pins
greybus: gpio: add error messages to callbacks not propagating errors
greybus: operation: fix missing symbol exports
greybus: operation: fix typo in comment
greybus: operation: fix callback handling and documentation
greybus: operation: fix use-after-free when sending responses
greybus: operation: fix memory leak in request_send error path
greybus: operation: fix use-after-free and infinite loop on unhandled requests
greybus: operation: fix null-deref on operation cancel
greybus: operation: fix null-deref on operation destroy
greybus: operation: fix incoming request payload size
greybus: operation: replace pr_err with dev_err
greybus: operation: make incomplete-message errors more informative
greybus: gpio: fix null-deref on short irq requests
greybus: gpio: fix null-deref on unexpected irq requests
greybus: gpio: fix missing response on request errors
greybus: hid: replace pr_err with dev_err
greybus: hid: fix success response being sent on errors
greybus: hid: fix null-deref on short report requests
greybus: hid: fix missing input verification of report events
greybus: hid: fix missing response on request errors
greybus: operation: refactor response handling
greybus: es1: drop unnecessary casts
greybus: es1: fix DMA-buffer on stack
greybus: es1: fix buffer-size limit
greybus: es2: sync up with recent es1 changes
greybus: operation: fix unaligned memory accesses in receive path
greybus: remove obsolete buffer-alignment requirement
greybus: operation: move message-header definition to header file
greybus: pass messages to host drivers
greybus: operation: fix potential message corruption
greybus: operation: add explicit padding to message header
greybus: es1: fix transfer-buffer alignment
greybus: es2: sync up with recent es1 changes
greybus: drop host-driver buffer headroom
greybus: loopback: fix 64-bit divisions
greybus: remove unnecessary greybus.h includes
greybus: remove unused prototypes from header
greybus: fix host-device buffer constraints
greybus: operation: allow maximum-sized messages
greybus: core: add lower-limit for host-device buffers
greybus: operation: add helper to retrieve max payload size
greybus: gpbridge: fix section mismatches
greybus: operation: add support for incoming unidirectional operations
greybus: gpio: fix debugfs output
greybus: gpio: remove unused irq-ack operation
greybus: gpio: don't call irq-flow handler directly
greybus: gpio: use irq-domain lookups
greybus: gpio: rename irq mask and unmask callbacks
greybus: gpio: fix atomic sleep when using interrupts
greybus: gpio: fix interrupt protocol
greybus: gpio: update operation types
greybus: gpio: remove unused debounce define
greybus: gpio: add irq-type defines
greybus: esx: fix null-deref on hotplug events
greybus: operation/esx: fix message-cancellation lifetime bugs
greybus: operation: allow atomic operation allocations
greybus: operation: allow atomic request submissions
greybus: operation: make response helper static
greybus: operation: fix cancellation use-after-free
greybus: operation: add incoming-operation flag
greybus: operation: add unidirectional-operation flag
greybus: operation: remove obsolete operation-field comments
greybus: operation: drop redundant oom message
greybus: operation: allocate response before setting result
greybus: operation: fix cancellation of responses
greybus: operation: fix operation-destroy race
greybus: operation: fix use-after-free in response receive path
greybus: operation: fix outgoing-response corruption
greybus: operation: fix incoming-response corruption
greybus: operation: fix another cancellation use-after-free
greybus: operation: clean up create-incoming error path
greybus: operation: add active counter
greybus: operation: make cancellation synchronous
greybus: operation: complete operations on cancellation
greybus: operation: clean up operation work function
greybus: operation: suppress response submission on connection tear down
greybus: connection: add connection-state locking
greybus: operation: fix connection tear down
greybus: connection: fix protocol tear-down race
greybus: operation: fix operation look-up race
greybus: operation: fix response-cancellation race
greybus: operation: split incoming and outgoing cancellation
greybus: operation: allow drivers to define custom timeouts
greybus: operation: add gb_operation_sync_timeout helper
greybus: kernel_ver: add list_last_entry for old kernels
greybus: operation: fix atomic response allocation
greybus: operation: fix atomic message submission
greybus: operation: fix operation ordering
greybus: operation: clean up greybus_message_sent
greybus: connection: fix connection initialisation
greybus: connection: clean up connection creation
greybus: connection: clean up creation error paths
greybus: operation: use per-connection work queues
greybus: operation: add completion work queue
greybus: usb: clean up driver
greybus: usb: renumber operation types
greybus: usb: fix hcd allocation, deregistration and deallocation
greybus: usb: fix hc_driver fields
greybus: usb: implement hub_control callback
greybus: usb: disable protocol driver
greybus: greybus_protocols: fix typo in comment
greybus: svc: fix message packing
greybus: uart: fix message packing
greybus: sdio: fix message packing
greybus: greybus_protocols: use only type attributes for message packing
greybus: firmware: fix potential stack corruption
greybus: endo: fix endo-id allocation flag
greybus: svc: fix device-id allocation flag
greybus: svc: fix hot-plug-state allocation flag
greybus: interface: fix potential attribute-buffer overflow
greybus: pwm: replace pr_err with dev_err
greybus: core: fix hd-creation error path
greybus: es1: fix build-time cport constraint
greybus: fix cport-id defines
greybus: vibrator: fix tear-down race
greybus: sdio: fix tear-down use-after-free
greybus: sdio: fix work-queue leak and use-after-free
greybus: svc: fix ida memory leak
greybus: svc: fix version response
greybus: greybus_protocols: add missing version-request definition
greybus: connection: clean up svc-connection creation
greybus: connection: clean up init error paths
greybus: connection: clean up control-disconnected helper
greybus: connection: add control-connected helper
greybus: connection: add protocol-version helper
greybus: hd: add optional cport enable and disable callbacks
greybus: hd: remove connection-create/destroy callbacks
greybus: es1/2: fix use-after-free in completion callback
greybus: operation: remove gb_operation_destroy
greybus: es1/es2: clean up error messages
greybus: connection: replace pr_err with dev_err
greybus: operation: drop OOM-response FIXME
greybus: operation: clean up error messages
greybus: protocol: warn on bad deregistration
greybus: protocol: warn on protocol put errors
greybus: protocol: make version debug message more informative
greybus: vibrator: add missing protocol-register error handling
greybus: protocol: make protocol-lookup error message more informative
greybus: connection: remove duplicate protocol lookup error message
greybus: build: add pwm to config options to enable
greybus: gpio: handle set_irq_flags api change
greybus: endo: fix use-after-free in error path
greybus: endo: fix device-id allocation
greybus: connection: remove unused time-stamp defines
greybus: control: remove unused request handler
greybus: es2: update obsolete bridge-device comments
greybus: remove unused host-device id
greybus: remove unused connection device type
greybus: connection: use bundle device for bundle error messages
greybus: connection: fix potential null-deref in hd_cport_enable
greybus: connection: fix potential null-deref in connection create
greybus: connection: fix potential null-deref when binding protocol
greybus: connection: kill gb_hd_connections_exit
greybus: endo: fix ida memory leak
greybus: remove obsolete comment
greybus: create host-device compilation unit
greybus: hd: rename host-device structure
greybus: hd: rename host-driver structure
greybus: hd: use common prefix for exported functions
greybus: es2: fix use-after-free at disconnect
greybus: es2: fix endpoint requirement check
greybus: es2: separate urb allocation and submission
greybus: es1: separate urb allocation and submission
greybus: es2: separate stopping and deallocating urbs
greybus: es1: separate stopping and deallocating urbs
greybus: es2: fix debugfs dentry leak
greybus: es1: fix debugfs dentry leak
greybus: es2: add more structure to probe error handling
greybus: es1: add more structure to probe error handling
greybus: hd: fix host-device life time issues
greybus: es2: clean up es2 destructor
greybus: loopback: fix layer violation
greybus: battery: fix class-device parent
greybus: light: fix class-device parent
greybus: interface: fix potential use-after-free at remove
greybus: interface: fix obsolete comment
greybus: use decimal notation for interface and cport ids
greybus: svc: use bit-macro for cport flags
greybus: firmware: fix information leak
greybus: firmware: break long lines
greybus: svc: fix missing version-request sanity checks
greybus: fix bundle-id match macros
greybus: remove unique-id matching
greybus: interface: remove unique id
greybus: fix vendor and product matching
greybus: move id-matching back to core
greybus: add class matching macro
greybus: connection: fix cport-id range
greybus: hd: fix cport-count check
greybus: Documentation/sysfs: update the example sysfs tree
greybus: Documentation/sysfs-bus-greybus: update the bus ABI documentation
greybus: interface: rename vendor and product attributes
greybus: interface: remove device_id attribute
greybus: interface: add interface_id attribute
greybus: bundle: rename class attribute
greybus: bundle: use hexadecimal notation for class attribute
greybus: bundle: add bundle_id attribute
greybus: hd: make host device a device
greybus: connection: drop parent parameter from connection create
greybus: interface: make interfaces children of host devices
greybus: bundle: rename bundle devices
greybus: svc: make svc a device
greybus: svc: clean up svc initialisation
greybus: svc: register svc device at hello
greybus: svc: move endo id and ap interface id to svc
greybus: interface: kill gb_create_bundle_connection
greybus: connection: clean up connection-creation interface
greybus: connection: fix potential null-deref on create
greybus: connection: kill GB_PROTOCOL_SKIP_SVC_CONNECTION
greybus: connection: add name field
greybus: connection: handle static connections
greybus: operation: handle static connections
greybus: protocol: handle static connections
greybus: hd: fix svc-connection handling
greybus: svc: clean up log messages
greybus: loopback: remove endo reference
greybus: kill the endo
greybus: connection: handle bundle-less connections in svc helpers
greybus: control: do not assume a control bundle
greybus: connection: unconditionally enable connections
greybus: manifest: refactor cport-descriptor release
greybus: interface: drop the control bundle
greybus: Documentation/sysfs: rename interface and bundle attributes
greybus: svc: clean up hotplug/unplug request handlers
greybus: svc: clean up deferred hotplug handler
greybus: svc: clean up interface-remove helper
greybus: svc: generalise deferred request handling
greybus: svc: defer processing of hot-unplug requests
greybus: svc: fix racy hotplug handling
greybus: svc: flush workqueue at connection exit
greybus: core: add bus id to uevents
greybus: core: add interface id to interface and bundle uevents
greybus: core: add bundle id to bundle uevents
greybus: svc: add missing boot-status error message
greybus: bundle: remove obsolete function prototype
greybus: bundle: kill gb_bundle_bind_protocols
greybus: connection: fail on missing protocol
greybus: connection: bind protocol at init
greybus: connection: unbind protocol at exit
greybus: connection: separate connection creation and enabling
greybus: hd: initialise device last
greybus: hd: make svc-connection life time coincide with host-device
greybus: svc: create svc along with host device
greybus: use decimal notation for interfaces, bundles and cports
greybus: interface: remove defensive WARN_ON
greybus: bundle: kill the bundle lock
greybus: bundle: use dev_err for bundle-creation errors
greybus: bundle: separate connection disabling and destruction
greybus: bundle: separate bundle creation and registration
greybus: interface: separate manifest parsing from bundle registration
greybus: interface: fix interface-registration race
greybus: interface: clean up error messages
greybus: es2: demote dynamic-urb error message
greybus: interface: clean up control-connection handling
greybus: interface: fix hot-unplug control-connection timeouts
greybus: svc: drop copy-pasted function header
greybus: es2: clean up csi-config request
greybus: camera: fix memory leak in configure-streams error path
greybus: camera: fix memory leak in capture-request handler
greybus: camera: destroy data connection on link-config errors
greybus: core: add drvdata accessors
greybus: core: fix greybus driver registration
greybus: core: fix greybus device matching
greybus: connection: fix version-request error handling
greybus: power_supply: fix lock imbalance in init error path
greybus: connection: fix connection-state handling
greybus: connection: refactor connection enable and disable
greybus: legacy: add legacy-protocol bundle driver
greybus: connection: rename legacy init and exit functions
greybus: connection: remove disable from destructor
greybus: connection: add per-connection request handlers
greybus: connection: always cancel operations on connection disable
greybus: connection: clean up operation cancellation on disable
greybus: connection: disable operations on enable errors
greybus: connection: make connection enable/disable thread safe
greybus: connection: add unidirectional enabled state
greybus: connection: add helper to disable incoming operations
greybus: core: disable incoming operations pre disconnect
greybus: core: add defensive connection disable post disconnect
greybus: firmware: remove skip-disconnected flag
greybus: connection: remove skip-connected legacy protocol flags
greybus: greybus_protocols: remove control-protocol version
greybus: control: drop legacy-protocol dependency
greybus: svc: drop legacy-protocol dependency
greybus: connection: move legacy-protocol handling to legacy driver
greybus: legacy: use protocol pointer to determine state
greybus: core: disable bundle connections on hot-unplug
greybus: svc: store protocol version
greybus: connection: remove broken protocol-version handling
greybus: control: add bundle-version operation
greybus: connection: remove WARN_ON from destroy
greybus: connection: destroy workqueue at unregister
greybus: connection: drop the connection_mutex
greybus: connection: fix lookup race
greybus: connection: serialise connection creation
greybus: connection: make cport lookup thread-safe
greybus: legacy: add private driver data
greybus: core: defer connection creation to driver probe
greybus: manifest: check for duplicate CPort descriptors when parsing
greybus: connection: drop protocol parameter from static interface
greybus: connection: add helper to create control connections
greybus: connection: drop the legacy protocol-id parameter
greybus: connection: simplify connection-creation interface
greybus: connection: rename connection-create interface
greybus: connection: return error-valued pointer on creation errors
greybus: legacy: refactor legacy-connection handling
greybus: legacy: add initialized flag
greybus: connection: remove legacy protocol id from core
greybus: legacy: look up protocol at connection creation
greybus: connection: set request handlers at creation
greybus: hid: clean up init error paths
greybus: hid: convert to bundle driver
greybus: vibrator: convert to bundle driver
greybus: firmware: abort if AP_READY fails
greybus: hd: fix host-device-removal race
greybus: legacy: remove unimplemented classes from id table
greybus: firmware: convert to bundle driver
greybus: manifest: add interface-device prefix to messages
greybus: core: add device prefix to error messages
greybus: i2c: add bundle-device prefix to error messages
greybus: loopback: add missing pr_fmt
greybus: spi: add bundle-device prefix to error messages
greybus: bundle: remove private data field
greybus: raw: fix memory leak on disconnect
greybus: es2: fix cport-count error handling
greybus: Documentation: remove svc unique_id attribute
greybus: uart: add max-payload sanity check
greybus: uart: add missing serial-state sanity check
greybus: uart: fix incomplete receive-data sanity checks
greybus: Documentation/sysfs: add module devices
greybus: Documentation/sysfs: move module 1-4 to position 5
greybus: Documentation/sysfs: make 1-5 a 2x2 module
greybus: operation: add temporary pointer to response handler
greybus: operation: add support for short responses
greybus: loopback: fix double error count
greybus: raw: use hexadecimal notation for request types
greybus: connection: add connection-flag interface
greybus: svc: clean up CPortFlags handling
greybus: connection: generalise CPortFlags handling
greybus: connection: add CSD connection flag
greybus: hd: rename CPort-features callbacks
greybus: greybus_manifest: remove unused AP class and protocol
greybus: greybus_manifest: remove unused SVC class
greybus: interface: remove unused function prototype
greybus: interface: remove unused drvdata helpers
greybus: interface: add comment about early control-connection disable
greybus: svc: refactor interface-route creation
greybus: svc: refactor interface-route destruction
greybus: interface: separate initialisation and registration
greybus: interface: free bundles on initialisation errors
greybus: svc: always register interfaces at hotplug
greybus: interface: disable control connection on initialisation errors
greybus: interface: remove useless spinlock
greybus: interface: move interface-removal helper
greybus: interface: rename initialisation function
greybus: interface: separate disabling from removal
greybus: svc: unexport eject helper
greybus: svc: print an error message on failed eject attempts
greybus: greybus_protocols: remove svc-eject timeout define
greybus: core: fix two container-of macros
greybus: greybus_protocols: align DME-attribute values
greybus: svc: remove bogus interface-reset helper
greybus: greybus_protocols: remove bogus comment about svc bundle
greybus: svc: indent CPort flag defines properly
greybus: interface: move boot-status clearing to interface enable
greybus: interface: fix es2 boot-status mask
greybus: interface: clean up and rename init-status helper
greybus: interface: clean up ES3-bootroom-quirk handling
greybus: interface: move route creation to interface activation
greybus: interface: deactivate interface on enumeration failure
greybus: interface: clean up device-id handling
greybus: greybus_protocols: rename NULL DME selector index
greybus: interface: read DME attributes at activation
greybus: interface: add ES2 init-status quirk flag
greybus: interface: clean up ES2 VID/PID hack
greybus: interface: clean up DME attribute handling
greybus: interface: add Ara serial-number support
greybus: manifest: fix illegal free in error path
greybus: Documentation: move the interface power attributes
greybus: Documentation/sysfs: remove interface unique_id attribute
greybus: Documentation/sysfs: rename the svc eject attribute
greybus: Documentation/sysfs: add example control devices
greybus: interface: disable interface on registration failures
greybus: control: move timesync-operation functions
greybus: core: make the control object be a device
greybus: interface: register control device at hotplug
greybus: interface: move vendor and product strings to control device
greybus: control: return error pointer when failing to create control device
greybus: interface: reduce control-device lifetime
greybus: svc: make sure to deactivate all interfaces on disconnect
greybus: svc: keep interfaces registered during mode switch
greybus: svc: remove interface-remove helper
greybus: svc: keep error messages uniform
greybus: svc: fix pwrmon return value
greybus: svc: fix function-parameter indentation
greybus: svc: use a common prefix for debugfs functions
greybus: Documentation/sysfs: add entry for control device
greybus: Documentation/sysfs: sort entries alphabetically
greybus: svc: refactor interface re-enable
greybus: core: add module abstraction
greybus: module: implement controlled module removal
greybus: interface: add active state flag
greybus: svc: add stub functions for v_sys, refclk and unipro
greybus: svc: add stub interface-activate function
greybus: interface: implement interface activation and power down
greybus: svc: implement module inserted and removed operations
greybus: svc: implement interface mailbox event
greybus: interface: fix broken UniPro flow control
greybus: interface: remove unused prototype
greybus: fix outdated kernel-doc comment
greybus: operation: update gb_operation_request_send() documentation
greybus: operation: add support for initiating unidirectional operations
greybus: operation: add helper functions for unidirectional operations
greybus: control: implement mode-switch operation
greybus: loopback: remove unsupported version request
greybus: svc: define the version request
greybus: operation: fix definition of the invalid type
greybus: interface: fix type in enable error message
greybus: interface: remove unused interface-version quirk
greybus: connection: add no-flow-control connection flag
greybus: connection: add offloaded connection flag
greybus: connection: add helper for creating offloaded connection
greybus: audio: mark the data connection as offloaded
greybus: hd: move CPort allocation to host-device code
greybus: es2: fix probe error handling
greybus: es2: clean up CDSI CPort reservation
greybus: hd: generalise cport allocation
greybus: es2: clean up cport-reset handling
greybus: es2: add support for CDSI1 allocation
greybus: connection: add camera-data connected workaround
greybus: camera: fix data-connection handling
greybus: operation: fix broken activation logic
greybus: svc: fix another pwrmon return value
greybus: audio_apbridgea: fix two return values
greybus: svc: use EREMOTEIO for remote errors
greybus: interface: fix svc-resource error messages
greybus: remove redundant latency-tag sanity checks
greybus: core: avoid I/O to disconnected interfaces
greybus: interface: clean up bootrom quirk handling
greybus: interface: avoid I/O to bootrom during removal
greybus: connection: add control connection flag
greybus: control: implement disconnecting operation
greybus: svc: add stub connection-quiescing operation
greybus: connection: log cport-enable error messages
greybus: es2: reset cports at disable
greybus: connection: rename an error label
greybus: connection: move CPort Buffer configuration out of svc helpers
greybus: connection: remove unused invalid state
greybus: operation: clean up early connection-state check
greybus: operation: restructure activation state handling
greybus: operation: add helper for creating core operations
greybus: connection: implement proper connection closure
greybus: connection: add flush host-device callback
greybus: kernel_ver: backport reinit_completion to pre-3.13
greybus: control: add error message to mode-switch helper
greybus: interface: implement generic mode-switch functionality
greybus: svc: remove deprecated hotplug operations
greybus: fix tracepoint-related whitespace issues
greybus: hd: fix gb_hd_release tracepoint
greybus: fix forced disable of offloaded connections
greybus: hd: add flag argument to cport_enable callback
greybus: connection: prevent drivers from specifying core flags
greybus: connection: add support for high-priority connections
greybus: es2: add support for greybus cport flags
greybus: Revert "connection: switch to using spin_lock_irqsave/spin_lock_irqrestore excluisvely"
greybus: Revert "greybus: gb_connections_lock: don't use spin_lock_irq()"
greybus: Revert "greybus: es2.c: don't use spin_lock_irq()"
greybus: Revert "greybus: uart: don't use spin_lock_irq()"
greybus: es2: fix arpc return value
greybus: es2: fix arpc response lookups
greybus: connection: drop the svc quiescing operation
greybus: interface: add interface-type attribute
greybus: interface: partition attribute group
greybus: interface: make attributes type dependent
greybus: interface: amend interface registration message
greybus: module: suppress activation error message for dummy interfaces
greybus: interface: use an enum for interface type
greybus: interface: do not read DME during reactivation
greybus: interface: clean up ES3 activation-retry hack
greybus: interface: make sure type is invariant during reactivation
greybus: interface: prevent reactivation during removal
greybus: interface: fix power_state documentation
greybus: interface: hibernate UniPro link in activation error path
greybus: interface: fix interface_id attribute group
greybus: control: suppress bundle_activate() for bootrom
greybus: operation: fix broken response error messages
greybus: operation: fix broken response tracepoint
greybus: operation: clean up request handler
greybus: Documentation/sysfs: replace Ara references
greybus: replace Ara references
greybus: es2: fix arpc response-allocation error handling
greybus: es2: fix arpc error message
greybus: es2: fix arpc active-list corruption
greybus: remove unused protocol-version messages
greybus: control: remove some braces
greybus: connection: fix offloaded-connection ping cport id
greybus: es2: clean up ARPC symbol names
greybus: es2: always set result value
greybus: es2: allow ARPC result to be ignored
greybus: es2: add define for ARPC CPort requests
greybus: es2: rename USB vendor-request timeout define
greybus: greybus_protocols: fix apba vendor-request comment
greybus: es2: fix USB vendor-request prefixes
greybus: arpc: move arpc definitions to their own header
greybus: hd/es2: add cport_connected callback and ARPC
greybus: hd/es2: add cport_quiesce callback and ARPC
greybus: hd/es2: add cport_clear callback and ARPC
greybus: hd: add cport_shutdown callback
greybus: control: make disconnecting a core operation
greybus: es2: fix memory leak in probe error path
greybus: svc: drop all symbol exports
greybus: svc: drop unnecessary symbol exports
greybus: es2: implement flush callback
greybus: es2: implement shutdown callback
greybus: connection: implement new connection handling
greybus: hd/es2: remove obsolete callbacks
greybus: es2: remove obsolete cport-reset ARPC
greybus: svc: fix timeout indentation
greybus: greybus_protocols: remove svc key-event type

John Stultz (4):
greybus: Changes required for integrating into the Android build
greybus: build: Add -fno-pic for 32bit arm as well
greybus: Move briged phy structure definitions into gpbridge.h
greybus: gb-audio: Add integrated greybus audio driver

Kris Huang (3):
greybus: lights: Add runtime pm support
greybus: lights: enable multi color LED support
greybus: lights: Control runtime pm suspend/resume on AP side

Laurent Pinchart (25):
greybus: es2: Reserve CPorts 16 and 17
greybus: Add camera protocol definition
greybus: Add driver for the camera class protocol
greybus: camera: Fix endian conversion issues
greybus: svc: Add support for the link config operation
greybus: camera: Configure link speed for the data connection
greybus: es2: Add support for CSI transmitter configuration
greybus: camera: Configure the bridge CSI transmitter
greybus: camera: Set link power mode to HS-G2 with 2 lanes
greybus: camera: Fix remaining endian conversion issues
greybus: es2: Fix endian conversion issues
greybus: es2: Don't use stack memory as USB request data
greybus: camera: Raise the CSI-2 bandwidth
greybus: svc: Replace link config hack with standard operation
greybus: camera: Return the result flags from the configure_streams response
greybus: camera: Factorize link power mode configuration code into a function
greybus: camera: Clean up when AP link power mode configuration failed
greybus: camera: Set power mode after configuring streams
greybus: camera: Don't configure CSI TX in test only mode
greybus: camera: Implement the capabilities operation
greybus: camera: Convert to bundle driver
greybus: camera: Clean up on stream configuration failure
greybus: camera: Fix data connection setup
greybus: camera: Create and destroy data connection on demand
greybus: camera: Hardcode the APB-A CSI-2 TX parameters

Mark A. Greer (11):
greybus: gb-audio: Set clock edges to match rt5647 codec requirements
greybus: gb-audio: Allocate space for 20 configurations
greybus: gb-audio: Clean up codec name generation
greybus: gb-audio: Fix DAI formats and master/slave settings
greybus: gb-audio: cpu_dai.fmt does not exist in v4.1
greybus: gb-audio: Add I2C device for rt5647 codec
greybus: gb-audio: Remove useless comment
greybus: gb-audio: Activate TX CPort in PCM workqueue
greybus: gb-audio: Activate TX connection Bundle CPort ID
greybus: gb-audio: Set I2S Configuration according to ASOC requests
greybus: gb-audio: Set samples per message during init

Mark Greer (16):
greybus: Initial I2S definitions
greybus: gb-audio: Reset sample count when CPort deactivated
greybus: gb-audio: Ensure i2c adapter struct exists before using
greybus: audio: Remove I2S Bridged-PHY Protcol based audio driver
greybus: i2s: Remove deprecated I2S Bridged-PHY Protocol
greybus: audio: Allocate protocol and class values
greybus: audio: Use underscore in file name
greybus: audio: Add Audio Device Class Protocol definitions
greybus: audio: Add Greybus Audio Device Class Protocol helper routines
greybus: audio: Add direct audio streaming control for APBridgeA
greybus: audio: Register CPorts for specific directions
greybus: audio: Split start and stop APBridgeA requests
greybus: audio: Use CSD instead of E2EFC for audio data connections
greybus: audio: apbridgea: Remove GET_TX/RX_DELAY message types
greybus: audio: Remove GET_TX/RX_DELAY message types
greybus: audio: Fix incorrect direction value when enabling RX

Marti Bolivar (4):
greybus: uart-gb.c: replace alloc_tty_driver with tty_alloc_driver
greybus: uart-gb.c: dynamically allocate device numbers
greybus: gb_hd_connection_find(): fix "not found" case
greybus: remove obsolete SVC result codes

Matt Porter (33):
greybus: update svc_msg_header fields and users to match spec
greybus: move versioning from svc message header to handshake function
greybus: update GREYBUS_VERSION_[MAJOR|MINOR] to match spec
greybus: es1-ap-usb: fix svc control pipe flags
greybus: initialize all fields in an SVC handshake message
greybus: update descriptor module_id->module to match spec
greybus: remove serial number descriptor to match spec
greybus: remove unused function descriptor fields and change class->function_type
greybus: update string descriptor length field to __u8 type to match spec
greybus: update descriptor type enums to match renumbering in spec
greybus: es1-ap-usb: adjust SVC buffer size to handle worst case
greybus: remove additional unused fields from the cport descriptor
greybus: fix error message on parse of cport descriptor size
greybus: fix gb_add_module() by enabling the device_add()
greybus: implement core module removal path
greybus: fix manifest parsing problem with descriptor payload
greybus: fix gb_manifest_parse() successful return path
greybus: es1-ap-usb: handle -EPROTO in check_urb_status()
greybus: gpio-gb: remove unused status field from struct gb_gpio_get_value_request
greybus: gpio-gb: fix offset error checking and usage
greybus: ap: add support for the AP Device ID unipro management function message
greybus: module: add gb_module_find()
greybus: interface: add gb_interface_find()
greybus: ap: process the UniPro link up message
greybus: svc: remove unneeded fields from the unipro set route message payload
greybus: ap: add svc_set_route_send() command and use it on a link up event
greybus: svc: remove the DDB function message support
greybus: module: set device_id when initializing an interface
greybus: connection: call connection_init hook after setting the handler
greybus: add pwm protocol driver
greybus: remove unused gb_connection_handler externs
greybus: operation: add missing gb_operation_response_send() export
greybus: gpio: add interrupt handling support

Michael Mogenson (2):
greybus: remove gb_i2c_timeout_operation
greybus: remove gb_i2c_retries_operation

Michael Scott (13):
greybus: build: android: replace hard-coded build destination with variable
greybus: build: android: add all greybus modules to the build
greybus: build: android: Fix script which locates .ko files and moves them into ramdisk
greybus: build: android: replace Linaro build specific logic with AOSP equivalents
greybus: build: android: fix strip module build step
greybus: build: remove Android makefile
greybus: firmware: replace colons with underscore in firmware file request
greybus: arche-platform: ensure wake-detect pin is deasserted
greybus: arche-platform: bring SVC out of reset later in probe
greybus: arche-platform: assert wake-detect to complete WAKE_OUT event
greybus: arche-platform: reduce wait between WAKE_OUT checks
greybus: interface: clear upper 16-bits of version_id and product_id
greybus: adjust kernel version check for led_sysfs_is_disabled

Mitchell Tasman (1):
greybus: svc: reconfig APBridgeA-Switch link to handle required load

Perry Hung (13):
greybus: gb_operation: replace timeout workqueue
greybus: gb_operation: drop operation refcount on cancel
greybus: makefile: fix unused cflags
greybus: battery: fix panic on operation error
greybus: connection: silence warning on unbound protocols
greybus: svc: add route create operation
greybus: svc: create bidirectional routes on hotplug request
greybus: svc: connection: ask SVC to create connections
greybus: svc: add flags and traffic class parameter to connection create op
greybus: svc: add route create operation
greybus: svc: create bidirectional routes on hotplug request
greybus: svc: connection: ask SVC to create connections
greybus: svc: add flags and traffic class parameter to connection create op

Philip Yang (2):
greybus: HID: Add runtime pm support
greybus: power_supply: Add runtime pm support

Phong Tran (12):
greybus: loopback: add more clean up when init connection fails
greybus: svc: Fix endian of hotplug request data
greybus: svc: use macro for init and exit protocol
greybus: audio: Fix typo for macro I2S data version minor
greybus: audio: Remove the MODULE_LICENSE()
greybus: uart: Fix the memory leak in connection init
greybus: endo: move endo id map declaration to endo.h
greybus: uart: remove the redundant unregister chrdev
greybus: uart: fix the clean up while uart initiates connection unsucessfully
greybus: sdio: remove the redefine of sdio major and minor
greybus: sdio: change the order of remove and free mmc host
greybus: sdio: correct the usage of mmc request in work queues handler

Rob Herring (1):
greybus: es2: fix driver name collision with es1

Rui Miguel Silva (90):
greybus: es1: remove useless statement
greybus: es1: release urb on error path
greybus: protocol: dedup protocol find code
greybus: manifest: be coherent with protocol name
greybus: make: check kernel configuration options
greybus: makefile: add MMC to the required option list
greybus: sdio: extend sdio implementation
greybus: sdio: fix defines for older kernels
greybus: kernel_ver: add sg copy operations for kernel < 3.11
greybus: examples: add manifest file for sdio
greybus: sdio: split cmd_flags to there meaning
greybus: sdio: rework of event handler
greybus: sdio: fix return of get_cd and get_ro
greybus: sdio: fix call to stop command if no data exist
greybus: sdio: pass only data pointer to tranfer funtion
greybus: sdio: check number of blocks in transfer
greybus: sdio: add need poll to host caps
greybus: sdio: fix transfer buffer handling and blocks counting
greybus: makefile: add needed config options for lights
greybus: lights: add lights implementation
greybus: makefile: use POSIX functions for kernel cmp
greybus: greybus_protocol: remove unused lights macros
greybus: sdio: fix command type defines
greybus: svc: fix endianness for svc message
greybus: gpio: fix generic_handle_irq_desc api change
greybus: sdio: add field to get_caps response
greybus: sdio: fix card removable detection
greybus: sdio: convert greybus ocr values to mmc ones
greybus: sdio: clarify operator precedence
greybus: sdio: send data block details at command request
greybus: sdio: some cleanups in command function
greybus: battery: move battery file to power_supply
greybus: battery: move implementation to power_supply
greybus: makefile: add power_supply config check
greybus: power_supply: rework and operation changes
greybus: manifest: fix bundle descriptor parse
greybus: spi: add rdwr field to transfer descriptor
greybus: spi: add master and device config operations
greybus: spi: fix transfers bigger than greybus payload
greybus: lights: add v4l2 flash operations
greybus: lights: avoid channel torch double free
greybus: lights: default value for v4l2 flash controls
greybus: spi: move chipselect to one byte size
greybus: spi: rename label to undo operation
greybus: spi: validate spi master register
greybus: spi: unregister master on device add fail
greybus: spi: fix and cleanup spi devices handling
greybus: camera: fix data types of operations
greybus: power_supply: do not release failed supply alloc
greybus: power_supply: fix unregister on error path
greybus: power_supply: free supplies at release
greybus: power_supply: fix error path at supplies setup
greybus: power_supply: fix leak getting string properties
greybus: power_supply: fix use after free of power supply
greybus: power_supply: fix check for configured supply
greybus: svc: add interface eject operation
greybus: svc: add intf_eject attribute
greybus: makefile: add requirement for CONFIG_INPUT
greybus: kernel_ver: add handle for lights in 4.5
greybus: lights: remove sync operation and work queue
greybus: svc: add key event handling
greybus: power_supply: rework get descriptors
greybus: uart: fix double free of tty port
greybus: spi: add device_type field to device config
greybus: lights: remove unnecessary checks
greybus: lights: remove has_flash on failure
greybus: lights: fix check for configured lights
greybus: lights: remove unnecessary check
greybus: spi: fix message transfer over greybus
greybus: spi: use timeout request send operation
greybus: spi: rename rdwr field to xfer_flags
greybus: spi: add inprogress bit to xfer_flags
greybus: sdio: avoid extra memory operation at data transfer
greybus: power_supply: change property values to integer
greybus: power_supply: convert greybus properties to power supply properties
greybus: power_supply: remove references to kernel header
greybus: power_supply: add missing defines present in the specification
greybus: sdio: convert vdd kernel values to greybus
greybus: sdio: add switch voltage operation
greybus: greybus_protocol: fix order of sdio get caps response
greybus: sdio: increase maximum segment size
greybus: power_supply: add callback to handle power supply changes
greybus: power_supply: fix update interval check at request handler
greybus: power_supply: invalidate cache at update request
greybus: power_supply: fix name setting location
greybus: light: remove KERNEL_VERSION checks
greybus: sdio: remove KERNEL_VERSION checks
greybus: power_supply: remove KERNEL_VERSION checks
greybus: makefile: fix dependency of spi to spilib
greybus: Kconfig: enable possibility to select light driver

Ryan Lim (3):
greybus: loopback_test: Cancel only the tests running on selected devices
greybus: loopback_test: Fix -z argument bug
greybus: loopback_test: Add -f argument to cancel all tests

Sachin Pandhare (1):
greybus: manifest: simplify descriptor address calculation

Sandeep Patil (12):
greybus: power_supply: reverse version check for new psy API
greybus: hd: add bus_id attribute
greybus: Documentation/sysfs: add entry for host device bus_id
greybus: Documentation/sysfs: fix sysfs paths
greybus: greybus/core: add MODULE uevent var for all control devices
greybus: gpbridge: add gpbridge device type
greybus: gpbridge: make gpbridge device ids start with 1
greybus: gpbridge: add uevent vars for gpbridge devices
greybus: arche-platform: Fix the MODULE_LICENSE to match with header
greybus: gpbridge: rename 'gpbridge' to 'gbphy' everywhere
greybus: svc: remove input device handling in SVC protocol
greybus: es2: use a single bulk ep pair for all greybus data

Svetlin Ankov (1):
greybus: audio: Add Audio Manager

Vaibhav Agarwal (72):
greybus: Audio: Add skeleton code for GB virtual codec driver
greybus: audio: Build audio module conditionally
greybus: audio: Use greybus connection device for codec registration
greybus: audio: Add topology parser for GB codec
greybus: audio: Add GB Audio class protocol functionality in GB codec DAI ops
greybus: audio: Report uevent on GB codec module insertion/removal
greybus: audio: cleanup unnecessary dev_err messages
greybus: audio: Cleanup GB protocol connections in case of abrupt codec removal
greybus: audio: Enable codec module detection on different slots
greybus: audio_codec: update codec_name as per driver->name
greybus: audio: codec driver cleanup
greybus: audio: use variable 'is_connected' to maintain module state
greybus: audio: Enable support for multiple codec modules
greybus: audio: schedule workqueue to perform codec cleanup on module removal
greybus: audio: return success for stop trigger if device removed
greybus: audio: Use single codec driver registration
greybus: audio: Add module specific driver
greybus: audio: fix to resolve multiple audio module playback issue
greybus: audio: Fix widget pointer update during control parsing
greybus: audio: Added jack support to audio module
greybus: audio: Add I2S_RX path related settings
greybus: audio_manager: Split device type into i/p & o/p devices
greybus: audio: Update device type based on widget types
greybus: audio: acquire wakelock during active playback
greybus: audio: acquire wakelock during active playback
greybus: audio: Changes in response to ASoC cleanup
greybus: audio: Reorder gb_deactivate sequence to avoid protocol error
greybus: audio: Rename widget_type to jack_attrubute
greybus: audio: Identify jack type based on attributes reported
greybus: audio:gb_manager: Use proper locking around kobject_xxx
greybus: audio: Cleanup GB Audio bundle driver.
greybus: audio: Remove redundant lock protection & is_connected field
greybus: audio: Reorganize sequence in GB audio bundle & codec driver
greybus: audio: Reduce codec->lock granularity
greybus: audio: Use standard API to set connections' private data
greybus: audio: gb_manager: Use valid argument while removing ida allocated id.
greybus: audio: Fix memory leak
greybus: hd: Add API to release reserved CPorts
greybus: es2: Release reserved cports CDSI0 and CDSI1
greybus: audio: Report warning in case module is already removed
greybus: audio: Report DISCONNECT event after resource cleanup.
greybus: audio: Ratelimit err messages
greybus: Use mute_stream callback to initiate GB data xfer
greybus: Remove apbridgea_shutdown_xx sequence if already done
greybus: audio: Ratelimit err messages in bundle, topology driver
greybus: audio: topology: Add helper API to map controlid with widget name
greybus: added warning message in case of missing widget
greybus: audio: topology: Use csize while computing next_ptr in parser
greybus: audio: topology: Enable enumerated control support
greybus: audio: Fix incorrect codec state modification
greybus: audio: Maintain proper codec state during shutdown sequence.
greybus: audio: Avoid using ARA keyword
greybus: audio: Remove un-necessary goto statement
greybus: audio: Enable audio path based on control switch state only
greybus: audio: Split helper APIs based on stream direction
greybus: audio: Update dai_driver table with appropriate fields
greybus: audio: Update parameters for gbaudio_module_update API
greybus: audio: Use AIF widget to enable path between module & APB
greybus: audio: Add id to identify data connection
greybus: audio: Find data connection based on id
greybus: Remove unused field from data_connection
greybus: audio: Update pm runtime support in dai_ops callback
greybus: audio: Maintain runtime stream params for each DAI
greybus: audio: Maintain module stream state for each data connection
greybus: audio: Report jack removal along with module removal
greybus: audio: Add check for invalid index while mapping control
greybus: Use valid control pointer while freeing memory
greybus: audio: Remove unnecessary num_jack field from module_info
greybus: audio: Added jack_type support in topology struct
greybus: audio: Fetch jack_mask, button_mask from module's topology data
greybus: audio: Report jack events conditionally
greybus: audio: Avoid reporting spurious button events

Vaibhav Hiremath (67):
greybus: platform: Add platform driver for DB3 AP bridge
greybus: db3(arche)-platform: Remove all APB control code
greybus: arche-platform: Rename db3-platform to arche-platform
greybus: arche-apb-ctrl: Add APB control driver
greybus: arche-apb-ctrl: Assert reset to APB at the end of probe
greybus: arche_platform: Remove child's platform device as part of _remove() fn
greybus: arche-platform: Export gpio (reset & sys_boot) to user
greybus: arche-apb-ctrl: Set wake_detect gpio to low initially
greybus: arche-apb-ctrl: Do not bring APB out of reset in probe
greybus: arche-apb-ctrl: Remove wake_detect gpio and related code
greybus: arche-apb-ctrl: deassert reset at the end of probe
greybus: arche-platform: Add wake/detect support along with handshaking with AP
greybus: arche-apb-ctrl: Enable the clocks after regulator enable
greybus: arche-platform: Disable clock as part of driver remove
greybus: arche-apb-ctrl: Remove extra delay in APB reset
greybus: Revert "arche-apb-ctrl: Remove extra delay in APB reset"
greybus: arche-platform: make apb_state common to both platform drivers
greybus: arche-platform: Introduce coldboot_seq fn
greybus: arche-platform: Cancel delayed_work in driver remove fn
greybus: arche-platform: Rename cleanup fn to poweroff_seq
greybus: arche-platform: Add state variable to driver data
greybus: arche-platform: Pull wake/detect low in poweroff
greybus: arche_platform: Add sysfs to allow user to change state
greybus: arche-platform: Introduce FW_FLASHING state
greybus: arche-apb-ctrl: Re-arrange init sequence
greybus: arche-apb-ctrl: Rename init_seq and cleanup fn
greybus: arche-apb-ctrl: Set default state value to OFF
greybus: arche-apb-ctrl: Pass only platform_device to _seq fns
greybus: arche-apb-ctrl: Add sysfs to allow user to change state
greybus: arche-apb-ctrl: Introduce ara,init-disable property for APB
greybus: arche-apb-ctrl: Rename internal operational state fns
greybus: arche-apb-ctrl: Export operational fns from driver
greybus: arche-platform: Fix boot, poweroff and fw_flashing seq with APBs
greybus: arche-platform: Do not export any gpios
greybus: arche-apb-ctrl: Do not export any gpios
greybus: arche-platform: Control usb3613 from arche-platform
greybus: arche-apb-ctrl: Do not coldboot APBs in probe
greybus: arche-platform: Return immediately if in same state from state change fns
greybus: arche-platform: Avoid doing same thing again in poweroff fn
greybus: arche-apb-ctrl: Return immediately if in same state from state change fns
greybus: arche-platform: Fix exit path in probe fn
greybus: arche-apb-ctrl: Remove extra delay in APB reset
greybus: arche-platform: Convert delayed work to do only hub3613 configuration
greybus: arche-platform: Add wake detect state based on functionality
greybus: arche-platform: Enable interrupt support on wake/detect line
greybus: arche-platform: Assert wake/detect after SVC reset without delay
greybus: arche-platform: Set direction of wake/detect gpio in poweroff fn
greybus: arche-platform: Disable wake/detect interrupt in poweroff
greybus: arche-platform: Make sure APB power cycles on coldboot
greybus: arche-platform: Disable HUB3613 only in APB poweroff fn
greybus: arche-platfrom: Get rid of 2sec delay in USB3613 configuration
greybus: gpbridge: Add gpbridge driver init/exit helper macros
greybus: connection: export gb_connection_disable_rx() fn
greybus: Documentation: Add sysfs information about bridged-phy device
greybus: arche-platform: Rename spinlock variable lock => wake_detect_lock
greybus: arche-platform: Export fn to allow timesync driver to change the state
greybus: arche-platform: Do not assert wake/detect signal to SVC
greybus: arche-platform: Rename assert_wakedetect=>arche_platform_wd_irq_en
greybus: arche-platform: Make fw_flashing_seq() return error
greybus: arche-platform: Enter ACTIVE state only from OFF state
greybus: arche-platform: Enable SVC clock during FW_FLASHING state
greybus: svc: Pass the correct pointer to input_free_device()
greybus: ratelimit errors usually seen on unipro_reset
greybus: arche-platform: Add support for init-off feature
greybus: arche-apb-ctrl: Rename ara,init-disable => arche,init-disable
greybus: arche-platform: Reset SVC & APB only if turned off by SUSPEND_PREPARE
greybus: arche-platform: Add support for SPI bus sharing for Mihi

Viresh Kumar (410):
greybus: Fix parameters of core_param()
greybus: .gitignore: minor updates
greybus: gitignore: few more additions
greybus: manifest: no need to initialize 'result'
greybus: manifest: initialize variable during definition
greybus: manifest: don't free unallocated resources
greybus: Fix missing gb_protocol_exit() on gb_exit()
greybus: don't set ->dev.driver to NULL when it is already NULL
greybus: debug: mark debug messages with pr_debug() instead of printk
greybus: sysfs: generalize gb_module_attr() to capture more cases
greybus: module: free resources properly on failures
greybus: interface: free resources properly on failures
greybus: connection: free resources properly on failures
greybus: manifest: remove extra loop for finding module descriptor
greybus: manifest: improve print message
greybus: core: remove unnecessary braces
greybus: core: use 'drv' instead of dev->driver
greybus: operation: free resources in the reverse order of allocation
greybus: nullify dangling pointers
greybus: connection: try cancelling operations only if list isn't empty
greybus: manifest: make sure manifest_descs list is empty before parsing manifest
greybus: connection: fix duplicating naming in _gb_hd_connection_insert()
greybus: core: re-use gb_module_find() in gb_remove_module()
greybus: module: move gb_module_find() to a more logical location
greybus: module: move module specific code to module.c
greybus: interface: move gb_module_interface_init() to interface.c
greybus: ap: remove extra parameter to convert_ap_message()
greybus: ap: keep all svc function routines together
greybus: Pass '*ptr' to sizeof() wherever possible
greybus: ap: function_id is already set by svc_msg_alloc()
greybus: operation: don't complete operation twice
greybus: Random spell fixes
greybus: es1-ap-usb: don't use 'es1' after it is freed
greybus: Remove "-gb" suffix from .c files
greybus: Remove "gb-" prefix from .c files
greybus: uart: s/REQ/TYPE
greybus: create get_version() routines with the help of a macro
greybus: remove unused version-response structs
greybus: i2c: fix name conflict between function and struct: gb_i2c_transfer_response
greybus: i2c: fix name conflict between function and struct: gb_i2c_transfer_request
greybus: spi: add bridged-PHY spi protocol driver
greybus: spi:fix sparse warnings
greybus: gpb: Fix print mistakes
greybus: hid: add HID class driver
greybus: operation: s/status/result to match field name
greybus: operation: Fix comment mistake
greybus: interface: remove double underscore from fn name
greybus: core: place module_{init|exit}() right below the routines
greybus: hid: don't support OUTPUT report over interrupt channel
greybus: core: Don't initialize greybus if it is disabled
greybus: manifest: descriptor size should be >= header size
greybus: manifest: don't need to check for desc_size == 0 anymore
greybus: Greybus: Place module_init/exit() right after respective routines
greybus: interface: put module->dev on failures
greybus: kernel_ver.h: include <linux/kernel.h> to fix warning
greybus: Unregister devices to get them freed
greybus: interface: Fetch interface id instead of module id during setup
greybus: Add bundle descriptor type
greybus: hid: Use payload-size to get report size
greybus: bundle: Create bundles using bundle descriptors
greybus: bundle: Initialize all bundles on link-up
greybus: manifest: Use interface descriptor instead of module descriptor to get information
greybus: drop module descriptors
greybus: driver corresponds to a bundle, not interface
greybus: bundle: s/class_type/class
greybus: endo: Use a real endo id
greybus: endo: Rename endo's 'type' as 'id'
greybus: Explicitly mark structures as packed
greybus: manifest: Account for padding in string descriptor
greybus: manifest: Warn if descriptor size > expected size
greybus: manifest: Remove vendor, product and unique-id from interface descriptor
greybus: manifest: drop interface-version field
greybus: Remove class descriptor
greybus: Explicitly add pad-bytes to manifest descriptors
greybus: Move id-field before bundle-field in CPort Descriptor.
greybus: endo: Add code to validate Endo ID
greybus: endo: Create modules after validating Endo ID
greybus: raw: include uaccess.h to fix warning
greybus: gpio: fix tab/space mistake
greybus: spi: Move structure definitions into gpbridge.h
greybus: protocol: remove leading underscore from _gb_protocol_find()
greybus: connection: name routines consistently
greybus: endo: name routines consistently
greybus: interface: name routines consistently
greybus: module: name routines consistently
greybus: raw: move module_{init|exit} to the end of functions
greybus: gpbridge: rename gpb.c to gpbridge.c
greybus: protocol: Add gb_gpbridge_protocol_driver()
greybus: Use gb_gpbridge_protocol_init()
greybus: endo: Add missing '\n' sprintf() for sysfs files
greybus: operation: Remove unused variable 'buffer'
greybus: s/bundle_cport_id/intf_cport_id
greybus: Generate greybus wide unique ids for endo devices
greybus: Prefix module-id with endo id
greybus: Tear down devices in the reverse order
greybus: endo: Fix compilation warning
greybus: manifest: Allow bundles/connections list to be non-empty at manifest parsing
greybus: Add control protocol support
greybus: interface: Get manifest using Control protocol
greybus: hotplug function doesn't need to contain manifest now
greybus: connection: send [dis]connected events over control CPort
greybus: control: Warn if non-control cport/bundles have control protocol/classes
greybus: define more greybus classes
greybus: svc: Fix doc-style comment
greybus: svc: Use macro's for major/minor numbers
greybus: Rename gb_gpbridge_protocol_driver() as gb_builtin_protocol_driver()
greybus: control: Use gb_builtin_protocol_driver()
greybus: connection: bind protocol after the connection is operational
greybus: connection: intf_cport_id is local to an interface
greybus: svc: Drop svc_set_route_send()
greybus: interface: device_id belongs to the interface
greybus: bundles: remove gb_bundle(s)_init()
greybus: connection: Exit connection before destroying it
greybus: interface: Fix comment mistake (s/add/init)
greybus: connection: Use connection->dev for printing messages
greybus: svc: SVC is part of greybus core
greybus: svc: save pointer to struct gb_svc in struct gb_interface
greybus: Cleanup connection leftovers
greybus: connections: comment style fix
greybus: interface: drop stale comment
greybus: sync protocol and class definitions
greybus: protocol: move version_response structure to greybus_protocols.h
greybus: Define device ids for AP/SVC/modules
greybus: Define cport/bundle for SVC protocol
greybus: connection: don't send connected/disconnected events for SVC connection
greybus: connection: Create gb_connection_create_range() to specify hd-cport-id range
greybus: connection: Allow a bundle-less connection
greybus: interface: Update gb_create_control_connection() to support SVC protocol
greybus: svc: Add helpers to create AP<->SVC connection
greybus: svc: Implement SVC requests
greybus: svc: No need of a separate version request
greybus: svc: Fix build warning on 64bit systems
greybus: svc: fully initialize the partially initialized connection
greybus: svc: connection is created only once now
greybus: svc: remove interface->svc pointer
greybus: interface: localize gb_interface_destroy()
greybus: connection: compare hd_cport_id for matching SVC protocol
greybus: es1/2: Lets start using svc protocol
greybus: Switch to Cport 0 for svc and control protocol
greybus: get rid of old svc-protocol
greybus: es1: create svc connection early enough
greybus: remove svc_msg.h
greybus: initialize svc connection while creating hd
greybus: es1/2: Lets start using svc protocol
greybus: Switch to Cport 0 for svc and control protocol
greybus: get rid of old svc-protocol
greybus: es1: create svc connection early enough
greybus: remove svc_msg.h
greybus: initialize svc connection while creating hd
greybus: connection: remove special check for svc cport id
greybus: operation: Drop alignment attribute from operation message header
greybus: operation: Move operation header to greybus_protocols.h
greybus: svc: Move '{' to a new line in function definitions
greybus: raw: Print expected/actual payload size on mismatch
greybus: gpio: Print expected/actual payload size on mismatch
greybus: svc: Print expected/actual payload size on mismatch
greybus: svc: Handle hotplug request from a workqueue
greybus: sdio: error out only for smaller payloads received
greybus: hid: spell fix (s/infomation/information)
greybus: battery: Use (already defined) major/minor macros
greybus: gpio: Use (already defined) major/minor macros
greybus: hid: Use (already defined) major/minor macros
greybus: i2c: Use (already defined) major/minor macros
greybus: pwm: Use (already defined) major/minor macros
greybus: spi: Use (already defined) major/minor macros
greybus: uart: Use (already defined) major/minor macros
greybus: usb: Use (already defined) major/minor macros
greybus: vibrator: Use (already defined) major/minor macros
greybus: svc: Remove FIXME for firmware download
greybus: audio: Add '<' to the print message for short messages
greybus: svc: error out only for smaller payloads received
greybus: connection: disconnect connection on failures during initialization
greybus: define greybus wide protocol request numbers
greybus: connection: Save major/minor supported by module
greybus: connection: request protocol version before initializing connection
greybus: audio: Drop get_version support
greybus: battery: Drop get_version support
greybus: control: Drop get_version support
greybus: gpio: Drop get_version support
greybus: hid: Drop get_version support
greybus: i2c: Drop get_version support
greybus: loopback: Drop get_version support
greybus: pwm: Drop get_version support
greybus: raw: Drop get_version support
greybus: sdio: Drop get_version support
greybus: spi: Drop get_version support
greybus: uart: Drop get_version support
greybus: usb: Drop get_version support
greybus: vibrator: Drop get_version support
greybus: svc: preserve major/minor of protocol supported by SVC
greybus: protocol: Drop define_get_version support
greybus: protocol: Remove unnecessary params of gb_protocol_get_version()
greybus: interface: Preserve data received during hotplug event
greybus: protocol: Create request structure from within gb_protocol_get_version()
greybus: Add firmware protocol driver
greybus: connection: Send protocol version for firmware protocol
greybus: protocol: send own protocol version while requesting it
greybus: battery: Move request/response structure/definitions to greybus_protocols.h
greybus: hid: Move request/response structure/definitions to greybus_protocols.h
greybus: raw: Move request/response structure/definitions to greybus_protocols.h
greybus: connection: Destroy wq on failure
greybus: connection: Don't free resources freed by gb_connection_release()
greybus: Drop protocol specific _PROTOCOL_VERSION and _INVALID macros
greybus: operation: print message type on errors
greybus: loopback: Send some sensible data
greybus: loopback: Print error on data mismatch
greybus: operation: Fix wrong order of arguments
greybus: svc: get hd directly from connection
greybus: svc: Include system headers at the top
greybus: svc: reject invalid state requests
greybus: greybus_protocols: svc: Add missing comment
greybus: greybus_protocols: Pack structure as required by the module firmware
greybus: greybus_protocols: Pack all request/response structure
greybus: svc: No need to return errors from [gb_]svc_connection_destroy()
greybus: svc: Kill unnecessary wrapper functions
greybus: svc: unexport few internal functions
greybus: bundle: kill unnecessary forward declaration of routine
greybus: connection: staticize gb_connection_init()
greybus: connection: convert connected dev_warn() to dev_err()
greybus: connection: no need to verify connection->protocol
greybus: connection: Propagate error properly
greybus: connection: call gb_connection_exit() from gb_connection_destroy()
greybus: connection: protocol can be NULL in gb_connection_exit()
greybus: spi: Allow spi-core to allocate bus numbers dynamically
greybus: manifest: don't reject the interface on failing to initialize a cport
greybus: manifest: release cport descriptors to avoid 'excess descriptors' warning
greybus: connection: call gb_svc_connection_create() from gb_connection_init()
greybus: connection: destroy svc connection on connection exit or errors
greybus: connection: Call connection_destroy() from gb_connection_svc_connection_destroy()
greybus: Add flags to struct gb_protocol
greybus: svc: No need of per-direction route-create requests
greybus: svc: destroy the route on module hot-unplug
greybus: connection: Add sysfs 'ap_cport_id' file for connections
greybus: svc: Implement DME peer get/set attributes helpers
greybus: firmware: firmware's file name is 32 characters long
greybus: firmware: Fix incorrect firmware file's name
greybus: firmware: firmware image name has .tftf instead of .fw
greybus: firmware: Send AP-ready operation
greybus: Documentation: Update sysfs-bus-greybus
greybus: svc: Use 'dev' instead '&op->connection->dev'
greybus: svc: Allow consecutive hotplug events for the same module
greybus: svc: Read and clear module's boot status
greybus: interface: Pass interface pointer to gb_interface_remove()
greybus: interface: gb_interface_create() isn't called for existing interfaces
greybus: firmware: drop 'stage' from ready-to-boot request
greybus: firmware: Don't send control-disconnected event for firmware protocol
greybus: svc: skip setting flags for boot over unipro
greybus: bundle: fix double freeing of bundle structure
greybus: interface: fix double freeing of interface structure
greybus: module: fix double freeing of module structure
greybus: endo: move greybus_endo_setup() to endo.c
greybus: db3-platform: Use dev_info for success messages
greybus: es2: Send cport-id in wValue field to usb_control_msg()
greybus: es2: remove fake vendor/product ids
greybus: es1: Remove the (now) unused es1 driver
greybus: firmware: Fetch es2 VID/PID to distinguish module vendors
greybus: Documentation: Fix N-svc directory name
greybus: Documentation: Arrange entries in alphabetical order
greybus: svc: Use -EIO instead of -EINVAL for unipro errors
greybus: don't use %h and %hh for printing short and char variables
greybus: Prefix hexadecimal values with 0x while printing them
greybus: interface: Prefix hexadecimal values with '0x'
greybus: interface: Prefix DDBL1 attributes with ddbl1_ instead of unipro_
greybus: interface: Expose DDBL1 manufacturing and production id in sysfs
greybus: control: Use Macro's instead of direct values for major/minor
greybus: svc: Set interface's hotplug attributes before using them
greybus: interface: Receive serial-number on hotplug event
greybus: interface: Fetch and expose version of interface's firmware
greybus: arche-platform: arche_pdata is guaranteed to be valid
greybus: arche-platform: Export GPIOs after populating APBs
greybus: arche-platform: Put APB in reset if of_platform_populate() fails
greybus: arche-platform: svc_reset_gpio can't be invalid in arche_platform_cleanup()
greybus: arche-platform: propagate errors returned by gpiolib
greybus: arche-apb: Spelling and whitespace fixes
greybus: arche-apb: platform data 'apb' is guaranteed to be valid
greybus: arche-apb: Replace gpio_is_valid() with gpio < 0 checks
greybus: arche-apb: devm_regulator_get() doesn't return NULL
greybus: arche-apb: NULL is a valid regulator
greybus: arche-apb: Properly use dev_err/info/warn
greybus: arche-apb: Don't use gpio after failing to request it
greybus: arche-apb: Do cleanup within apb_ctrl_init_seq() for error cases
greybus: arche-apb: Drop unnecessary checks
greybus: arche: Remove unwanted headers and rearrange others
greybus: svc: Expose and retain VID/PID received from bootrom for ES2
greybus: audio_codec: Free gccodec on codec probe failure
greybus: audio_codec: Free gccodec on dia probe failure
greybus: audio_codec: convert to bundle driver
greybus: audio: Rename Audio class and remove the unused one
greybus: audio: Fix sparse warnings
greybus: control: Fix sparse warnings
greybus: connection: Fix sparse warnings around locking
greybus: raw: Use consistent label names in connection_init()
greybus: raw: Don't use (possibly) uninitialized raw->device in gb_raw_receive()
greybus: raw: convert to bundle driver
greybus: loopback: convert to bundle driver
greybus: lights: Break light setup into two parts
greybus: lights: convert to bundle driver
greybus: power_supply: Break supply setup into two parts
greybus: power_supply: convert to bundle driver
greybus: manifest: Parse cports (within a bundle) in the order from manifest blob
greybus: interface: Add print messages on interface initialization/removal
greybus: hid: Don't disable connection-tx before destroying hid-device
greybus: hid: Replace WARN_ON() with dev_err()
greybus: checkpatch.pl: Mark --no-tree as default option
greybus: firmware: Rename to bootrom protocol
greybus: bootrom: fix typo
greybus: audio-codec: Staticize few routines to fix build warnings
greybus: es2: Allow proper release of greybus host device
greybus: es2: disable cport-in after remove greybus host device
greybus: es2: don't protest when getting -ENOENT/ESHUTDOWN USB errors
greybus: es2: move ap_disconnect() below ap_probe()
greybus: arche-ctrl: Don't expose driver internals to arche-platform driver
greybus: Bundle: Initialize dma_mask for bundle device
greybus: firmware: Add firmware management bundle driver
greybus: firmware: Add firmware-download protocol driver
greybus: fw-download: Create a macro for length of firmware file's name
greybus: bootrom: Implement timeouts to detect Module failures
greybus: Revert "interface: Fetch and expose version of interface's firmware"
greybus: uart: Kill reference_count hack
greybus: fw-download: Manage firmware requests with kref
greybus: fw-download: Introduce timeouts for firmware downloads
greybus: bootrom: Implement timeouts to detect Module failures
greybus: fw-download: Replace timer with delayed-work
greybus: gpbridge: Expose protocol_id in sysfs
greybus: core: Rename greybus_module_match()
greybus: Fix probing of gpbridge devices
greybus: gpbridge: Export few routines
greybus: gpbridge: Create module_gpbridge_driver()
greybus: gpio: Create separate module
greybus: i2c : Create separate module
greybus: pwm: Create separate module
greybus: sdio: Create separate module
greybus: spi: Create separate module
greybus: uart: Create separate module
greybus: usb: Create separate module
greybus: gpbridge: Rename gb-phy.ko module
greybus: gpbridge: Remove (now) unused macro gb_gpbridge_builtin_driver()
greybus: Remove bridge PHY protocol specific classes
greybus: spi: Restructure spi.c to share it with other bundle drivers
greybus: spi: Separate out spilib from spi bridged PHY bundle driver
greybus: fw-management: Add firmware-management protocol driver
greybus: fw-management: Add ioctl to initiate mode-switch
greybus: fw-management: Free fw-mgmt only after all users are gone
greybus: firmware: Add SPI protocol support
greybus: Documentation: Document firmware-management interfaces
greybus: fw-management: Replace double-tabs with space for structures
greybus: fw-management: Fix 'make check' warnings
greybus: fw-management: Update header's license
greybus: fw-core: destroy connections on error
greybus: fw-management: Fix error message's text
greybus: Documentation/sysfs: Rename gpbridge to gbphy
greybus: Documentation/sysfs: gbphy0 is an invalid name
greybus: Remove unused VERSION specific macros
greybus: gbphy: Remove protocol specific version handling
greybus: fw-mgmt: Add hooks to do mode-switch
greybus: control: Mode-switch is a 'core' operation
greybus: interface: Mode switch takes over a second
greybus: Add comment about the mode_switch_started flag
greybus: pwm: Fix compilation with v4.3 kernel
greybus: bootrom: Compile as a separate module
greybus: core: Make greybus_match_one_id() return bool
greybus: Use BIT(2) for GREYBUS_ID_MATCH_CLASS
greybus: Remove legacy suspend/resume callbacks
greybus: hd: Export host device tracepoint from hd.c
greybus: connection: Avoid unnecessary line breaks
greybus: firmware: Fix spelling mistake
greybus: Remove extra blank lines
greybus: connection: Return bool from gb_connection_intf_find()
greybus: camera: Initialize mutex before using it
greybus: svc: disable connection after all its users are gone
greybus: manifest: Disallow reuse of control cport
greybus: firmware: Add license and copyright header to application
greybus: firmware: prefix char-device with 'gb-'
greybus: connection: add trace events before disabling connection
greybus: Revert "greybus: ratelimit errors usually seen on unipro_reset"
greybus: don't use spin_lock_irq()
greybus: uart: don't use spin_lock_irq()
greybus: es2.c: don't use spin_lock_irq()
greybus: gb_connections_lock: don't use spin_lock_irq()
greybus: bootrom: Enhance timeout error message
greybus: bootrom: send timeout in milliseconds to gb_bootrom_set_timeout()
greybus: bootrom: Wait for 10 seconds for mode-switch
greybus: kernel_ver: Add kstrtobool()
greybus: light: Initialize mutex before using it
greybus: Add Component Authentication Protocol support
greybus: Documentation: Document Authentication interfaces
greybus: es2: Fix 'make check' warnings with arpc
greybus: audio_topology: Fix compile warning
greybus: bootrom: Use "s2l" instead of boot stage in package name
greybus: interface: add power_state attribute
greybus: firmware: Improve test application
greybus: spilib: make spilib independent of gbphy
greybus: control: Print bundle-id in print messages
greybus: bootrom: Skip setting timeout in failure path of size request
greybus: bootrom: Don't print duplicate error messages
greybus: bootrom: Set timeout before sending AP_READY
greybus: bootrom: Create gb_bootrom_cancel_timeout()
greybus: bootrom: Rename download_firmware() as find_firmware()
greybus: firmware: Add runtime PM support
greybus: interface: Rename *_NO_PM as *_NO_BUNDLE_ACTIVATE
greybus: interface: Add quirk for no PM for S2 Loader
greybus: firmware: Add new status types for backend updated request
greybus: firmware: Add 'status' byte to backend fw version response
greybus: firmware: Update Documentation and sample application
greybus: firmware: use 'tag' instead of 'firmware_tag'
greybus: firmware: Fix typo in documentation
greybus: firmware: Remove extra parenthesis
greybus: firmware: s/_LEN/_SIZE
greybus: firmware: s/should/must
greybus: firmware: add comment to show size calculations

Vishal Bhoj (1):
greybus: build: android: avoid building for targets that don't have kernel binary

Documentation/ABI/testing/sysfs-bus-greybus | 275 +++
drivers/Kconfig | 2 +
drivers/Makefile | 1 +
.../greybus/Documentation/firmware/authenticate.c | 139 ++
.../Documentation/firmware/firmware-management | 333 +++
drivers/greybus/Documentation/firmware/firmware.c | 262 +++
drivers/greybus/Kconfig | 219 ++
drivers/greybus/Makefile | 96 +
drivers/greybus/arche-apb-ctrl.c | 522 +++++
drivers/greybus/arche-platform.c | 828 +++++++
drivers/greybus/arche_platform.h | 39 +
drivers/greybus/arpc.h | 109 +
drivers/greybus/audio_apbridgea.c | 207 ++
drivers/greybus/audio_apbridgea.h | 156 ++
drivers/greybus/audio_codec.c | 1132 ++++++++++
drivers/greybus/audio_codec.h | 283 +++
drivers/greybus/audio_gb.c | 228 ++
drivers/greybus/audio_manager.c | 184 ++
drivers/greybus/audio_manager.h | 83 +
drivers/greybus/audio_manager_module.c | 258 +++
drivers/greybus/audio_manager_private.h | 28 +
drivers/greybus/audio_manager_sysfs.c | 102 +
drivers/greybus/audio_module.c | 482 +++++
drivers/greybus/audio_topology.c | 1442 +++++++++++++
drivers/greybus/authentication.c | 429 ++++
drivers/greybus/bootrom.c | 524 +++++
drivers/greybus/bundle.c | 253 +++
drivers/greybus/bundle.h | 90 +
drivers/greybus/camera.c | 1400 ++++++++++++
drivers/greybus/connection.c | 938 ++++++++
drivers/greybus/connection.h | 129 ++
drivers/greybus/control.c | 635 ++++++
drivers/greybus/control.h | 65 +
drivers/greybus/core.c | 361 ++++
drivers/greybus/debugfs.c | 31 +
drivers/greybus/devices | 11 +
drivers/greybus/es2.c | 1597 ++++++++++++++
drivers/greybus/firmware.h | 42 +
drivers/greybus/fw-core.c | 312 +++
drivers/greybus/fw-download.c | 465 ++++
drivers/greybus/fw-management.c | 721 +++++++
drivers/greybus/gb-camera.h | 127 ++
drivers/greybus/gbphy.c | 360 ++++
drivers/greybus/gbphy.h | 110 +
drivers/greybus/gpio.c | 767 +++++++
drivers/greybus/greybus.h | 154 ++
drivers/greybus/greybus_authentication.h | 120 ++
drivers/greybus/greybus_firmware.h | 120 ++
drivers/greybus/greybus_id.h | 26 +
drivers/greybus/greybus_manifest.h | 177 ++
drivers/greybus/greybus_protocols.h | 2268 ++++++++++++++++++++
drivers/greybus/greybus_trace.h | 531 +++++
drivers/greybus/hd.c | 257 +++
drivers/greybus/hd.h | 90 +
drivers/greybus/hid.c | 536 +++++
drivers/greybus/i2c.c | 343 +++
drivers/greybus/interface.c | 1316 ++++++++++++
drivers/greybus/interface.h | 88 +
drivers/greybus/light.c | 1359 ++++++++++++
drivers/greybus/log.c | 132 ++
drivers/greybus/loopback.c | 1365 ++++++++++++
drivers/greybus/manifest.c | 535 +++++
drivers/greybus/manifest.h | 16 +
drivers/greybus/module.c | 238 ++
drivers/greybus/module.h | 34 +
drivers/greybus/operation.c | 1239 +++++++++++
drivers/greybus/operation.h | 210 ++
drivers/greybus/power_supply.c | 1141 ++++++++++
drivers/greybus/pwm.c | 338 +++
drivers/greybus/raw.c | 381 ++++
drivers/greybus/sdio.c | 884 ++++++++
drivers/greybus/spi.c | 79 +
drivers/greybus/spilib.c | 565 +++++
drivers/greybus/spilib.h | 24 +
drivers/greybus/svc.c | 1486 +++++++++++++
drivers/greybus/svc.h | 109 +
drivers/greybus/svc_watchdog.c | 198 ++
drivers/greybus/timesync.c | 1357 ++++++++++++
drivers/greybus/timesync.h | 45 +
drivers/greybus/timesync_platform.c | 77 +
drivers/greybus/tools/.gitignore | 1 +
drivers/greybus/tools/Android.mk | 10 +
drivers/greybus/tools/Makefile | 31 +
drivers/greybus/tools/README.loopback | 198 ++
drivers/greybus/tools/lbtest | 168 ++
drivers/greybus/tools/loopback_test.c | 1000 +++++++++
drivers/greybus/uart.c | 1075 ++++++++++
drivers/greybus/usb.c | 247 +++
drivers/greybus/vibrator.c | 249 +++
89 files changed, 37594 insertions(+)
create mode 100644 Documentation/ABI/testing/sysfs-bus-greybus
create mode 100644 drivers/greybus/Documentation/firmware/authenticate.c
create mode 100644 drivers/greybus/Documentation/firmware/firmware-management
create mode 100644 drivers/greybus/Documentation/firmware/firmware.c
create mode 100644 drivers/greybus/Kconfig
create mode 100644 drivers/greybus/Makefile
create mode 100644 drivers/greybus/arche-apb-ctrl.c
create mode 100644 drivers/greybus/arche-platform.c
create mode 100644 drivers/greybus/arche_platform.h
create mode 100644 drivers/greybus/arpc.h
create mode 100644 drivers/greybus/audio_apbridgea.c
create mode 100644 drivers/greybus/audio_apbridgea.h
create mode 100644 drivers/greybus/audio_codec.c
create mode 100644 drivers/greybus/audio_codec.h
create mode 100644 drivers/greybus/audio_gb.c
create mode 100644 drivers/greybus/audio_manager.c
create mode 100644 drivers/greybus/audio_manager.h
create mode 100644 drivers/greybus/audio_manager_module.c
create mode 100644 drivers/greybus/audio_manager_private.h
create mode 100644 drivers/greybus/audio_manager_sysfs.c
create mode 100644 drivers/greybus/audio_module.c
create mode 100644 drivers/greybus/audio_topology.c
create mode 100644 drivers/greybus/authentication.c
create mode 100644 drivers/greybus/bootrom.c
create mode 100644 drivers/greybus/bundle.c
create mode 100644 drivers/greybus/bundle.h
create mode 100644 drivers/greybus/camera.c
create mode 100644 drivers/greybus/connection.c
create mode 100644 drivers/greybus/connection.h
create mode 100644 drivers/greybus/control.c
create mode 100644 drivers/greybus/control.h
create mode 100644 drivers/greybus/core.c
create mode 100644 drivers/greybus/debugfs.c
create mode 100644 drivers/greybus/devices
create mode 100644 drivers/greybus/es2.c
create mode 100644 drivers/greybus/firmware.h
create mode 100644 drivers/greybus/fw-core.c
create mode 100644 drivers/greybus/fw-download.c
create mode 100644 drivers/greybus/fw-management.c
create mode 100644 drivers/greybus/gb-camera.h
create mode 100644 drivers/greybus/gbphy.c
create mode 100644 drivers/greybus/gbphy.h
create mode 100644 drivers/greybus/gpio.c
create mode 100644 drivers/greybus/greybus.h
create mode 100644 drivers/greybus/greybus_authentication.h
create mode 100644 drivers/greybus/greybus_firmware.h
create mode 100644 drivers/greybus/greybus_id.h
create mode 100644 drivers/greybus/greybus_manifest.h
create mode 100644 drivers/greybus/greybus_protocols.h
create mode 100644 drivers/greybus/greybus_trace.h
create mode 100644 drivers/greybus/hd.c
create mode 100644 drivers/greybus/hd.h
create mode 100644 drivers/greybus/hid.c
create mode 100644 drivers/greybus/i2c.c
create mode 100644 drivers/greybus/interface.c
create mode 100644 drivers/greybus/interface.h
create mode 100644 drivers/greybus/light.c
create mode 100644 drivers/greybus/log.c
create mode 100644 drivers/greybus/loopback.c
create mode 100644 drivers/greybus/manifest.c
create mode 100644 drivers/greybus/manifest.h
create mode 100644 drivers/greybus/module.c
create mode 100644 drivers/greybus/module.h
create mode 100644 drivers/greybus/operation.c
create mode 100644 drivers/greybus/operation.h
create mode 100644 drivers/greybus/power_supply.c
create mode 100644 drivers/greybus/pwm.c
create mode 100644 drivers/greybus/raw.c
create mode 100644 drivers/greybus/sdio.c
create mode 100644 drivers/greybus/spi.c
create mode 100644 drivers/greybus/spilib.c
create mode 100644 drivers/greybus/spilib.h
create mode 100644 drivers/greybus/svc.c
create mode 100644 drivers/greybus/svc.h
create mode 100644 drivers/greybus/svc_watchdog.c
create mode 100644 drivers/greybus/timesync.c
create mode 100644 drivers/greybus/timesync.h
create mode 100644 drivers/greybus/timesync_platform.c
create mode 100644 drivers/greybus/tools/.gitignore
create mode 100644 drivers/greybus/tools/Android.mk
create mode 100644 drivers/greybus/tools/Makefile
create mode 100644 drivers/greybus/tools/README.loopback
create mode 100755 drivers/greybus/tools/lbtest
create mode 100644 drivers/greybus/tools/loopback_test.c
create mode 100644 drivers/greybus/uart.c
create mode 100644 drivers/greybus/usb.c
create mode 100644 drivers/greybus/vibrator.c
Re: [GIT PULL] Greybus driver subsystem for 4.9-rc1 [ In reply to ]
Hi Greg,

On Wed, Sep 14, 2016 at 12:09:49PM +0200, Greg KH wrote:
> Given that it's never a good idea to keep subsystems out of the mainline
> kernel, I've put together this pull request that adds the greybus driver
> layer to drivers/greybus/. Because this was 2 1/2 years of work, with
> many many developers contributing, I didn't want to flatten all of their
> effort into a few small patches, as that wouldn't be very fair. So I've
> built a git tree with all of the changes going back to the first commit,
> and merged it into the kernel tree, just like btrfs was merged into the
> kernel.

> Unless people point out some major problems with this, I'd like to get
> it merged into 4.9-rc1.

I'm extremely concerned that these patches have *never* seen upstream
review, and this pull request gives no real opportunity for people to
make a judgement regarding the code, as many relevant parties have not
been Cc'd.

From a quick scan of the git tree, I can see code (that isn't even
placed under staging/) for which I have fundamental objections to as a
maintainer, and has not been Cc'd to a relevant list.

For example, I see commit 5a450477311fbfe2 ("greybus: timesync: Add
timesync core driver"). This states that it directly accesses the ARMv7
architected timer, though it's unclear as to precisely what it's doing
since it introduces an (undocumented) compatible string, and what should
be an unnecessary devicetree property.

That's never gone to the linux-arm-kernel mainline list, myself or Marc
(as maintainers of the arch timer driver), nor has the binding seen any
review on the devicetree mailing list.

Given that, for at least that patch, NAK.

Thanks,
Mark.
Re: [GIT PULL] Greybus driver subsystem for 4.9-rc1 [ In reply to ]
On Wed, Sep 14, 2016 at 06:36:26PM +0100, Mark Rutland wrote:
> Hi Greg,
>
> On Wed, Sep 14, 2016 at 12:09:49PM +0200, Greg KH wrote:
> > Given that it's never a good idea to keep subsystems out of the mainline
> > kernel, I've put together this pull request that adds the greybus driver
> > layer to drivers/greybus/. Because this was 2 1/2 years of work, with
> > many many developers contributing, I didn't want to flatten all of their
> > effort into a few small patches, as that wouldn't be very fair. So I've
> > built a git tree with all of the changes going back to the first commit,
> > and merged it into the kernel tree, just like btrfs was merged into the
> > kernel.
>
> > Unless people point out some major problems with this, I'd like to get
> > it merged into 4.9-rc1.
>
> I'm extremely concerned that these patches have *never* seen upstream
> review, and this pull request gives no real opportunity for people to
> make a judgement regarding the code, as many relevant parties have not
> been Cc'd.

As I said, I will send a set of simple patches, I wanted to get this out
as soon as possible and other things came up today. Will do it in the
morning, sorry.

> From a quick scan of the git tree, I can see code (that isn't even
> placed under staging/) for which I have fundamental objections to as a
> maintainer, and has not been Cc'd to a relevant list.
>
> For example, I see commit 5a450477311fbfe2 ("greybus: timesync: Add
> timesync core driver"). This states that it directly accesses the ARMv7
> architected timer, though it's unclear as to precisely what it's doing
> since it introduces an (undocumented) compatible string, and what should
> be an unnecessary devicetree property.
>
> That's never gone to the linux-arm-kernel mainline list, myself or Marc
> (as maintainers of the arch timer driver), nor has the binding seen any
> review on the devicetree mailing list.

Hm, odd, I thought we had Rob review all of the device tree bindings,
but maybe the timesync stuff missed him. And timesync is "odd" to say
the least, wait until you see the firmware side of it :)

Let me post the patches tomorrow and then we can review them.

thanks,

greg k-h
Re: [GIT PULL] Greybus driver subsystem for 4.9-rc1 [ In reply to ]
On Wed, Sep 14, 2016 at 08:07:54PM +0200, Greg KH wrote:
> On Wed, Sep 14, 2016 at 06:36:26PM +0100, Mark Rutland wrote:
> > Hi Greg,
> >
> > On Wed, Sep 14, 2016 at 12:09:49PM +0200, Greg KH wrote:
> > > Given that it's never a good idea to keep subsystems out of the mainline
> > > kernel, I've put together this pull request that adds the greybus driver
> > > layer to drivers/greybus/. Because this was 2 1/2 years of work, with
> > > many many developers contributing, I didn't want to flatten all of their
> > > effort into a few small patches, as that wouldn't be very fair. So I've
> > > built a git tree with all of the changes going back to the first commit,
> > > and merged it into the kernel tree, just like btrfs was merged into the
> > > kernel.
> >
> > > Unless people point out some major problems with this, I'd like to get
> > > it merged into 4.9-rc1.
> >
> > I'm extremely concerned that these patches have *never* seen upstream
> > review, and this pull request gives no real opportunity for people to
> > make a judgement regarding the code, as many relevant parties have not
> > been Cc'd.
>
> As I said, I will send a set of simple patches, I wanted to get this out
> as soon as possible and other things came up today. Will do it in the
> morning, sorry.

Here's the timesync code pulled out into a simple patch if you want to
see it.

Bryan, any explanations you want to provide that would help in
clarifying Mark's issues?

thanks,

greg k-h


---
drivers/greybus/timesync.c | 1357 ++++++++++++++++++++++++++++++++++++
drivers/greybus/timesync.h | 45 +
drivers/greybus/timesync_platform.c | 77 ++
3 files changed, 1479 insertions(+)

--- /dev/null
+++ b/drivers/greybus/timesync.c
@@ -0,0 +1,1357 @@
+/*
+ * TimeSync API driver.
+ *
+ * Copyright 2016 Google Inc.
+ * Copyright 2016 Linaro Ltd.
+ *
+ * Released under the GPLv2 only.
+ */
+#include <linux/debugfs.h>
+#include <linux/hrtimer.h>
+#include "greybus.h"
+#include "timesync.h"
+#include "greybus_trace.h"
+
+/*
+ * Minimum inter-strobe value of one millisecond is chosen because it
+ * just-about fits the common definition of a jiffy.
+ *
+ * Maximum value OTOH is constrained by the number of bits the SVC can fit
+ * into a 16 bit up-counter. The SVC configures the timer in microseconds
+ * so the maximum allowable value is 65535 microseconds. We clip that value
+ * to 10000 microseconds for the sake of using nice round base 10 numbers
+ * and since right-now there's no imaginable use-case requiring anything
+ * other than a one millisecond inter-strobe time, let alone something
+ * higher than ten milliseconds.
+ */
+#define GB_TIMESYNC_STROBE_DELAY_US 1000
+#define GB_TIMESYNC_DEFAULT_OFFSET_US 1000
+
+/* Work queue timers long, short and SVC strobe timeout */
+#define GB_TIMESYNC_DELAYED_WORK_LONG msecs_to_jiffies(10)
+#define GB_TIMESYNC_DELAYED_WORK_SHORT msecs_to_jiffies(1)
+#define GB_TIMESYNC_MAX_WAIT_SVC msecs_to_jiffies(5000)
+#define GB_TIMESYNC_KTIME_UPDATE msecs_to_jiffies(1000)
+#define GB_TIMESYNC_MAX_KTIME_CONVERSION 15
+
+/* Maximum number of times we'll retry a failed synchronous sync */
+#define GB_TIMESYNC_MAX_RETRIES 5
+
+/* Reported nanoseconds/femtoseconds per clock */
+static u64 gb_timesync_ns_per_clock;
+static u64 gb_timesync_fs_per_clock;
+
+/* Maximum difference we will accept converting FrameTime to ktime */
+static u32 gb_timesync_max_ktime_diff;
+
+/* Reported clock rate */
+static unsigned long gb_timesync_clock_rate;
+
+/* Workqueue */
+static void gb_timesync_worker(struct work_struct *work);
+
+/* List of SVCs with one FrameTime per SVC */
+static LIST_HEAD(gb_timesync_svc_list);
+
+/* Synchronize parallel contexts accessing a valid timesync_svc pointer */
+static DEFINE_MUTEX(gb_timesync_svc_list_mutex);
+
+/* Structure to convert from FrameTime to timespec/ktime */
+struct gb_timesync_frame_time_data {
+ u64 frame_time;
+ struct timespec ts;
+};
+
+struct gb_timesync_svc {
+ struct list_head list;
+ struct list_head interface_list;
+ struct gb_svc *svc;
+ struct gb_timesync_host_device *timesync_hd;
+
+ spinlock_t spinlock; /* Per SVC spinlock to sync with ISR */
+ struct mutex mutex; /* Per SVC mutex for regular synchronization */
+
+ struct dentry *frame_time_dentry;
+ struct dentry *frame_ktime_dentry;
+ struct workqueue_struct *work_queue;
+ wait_queue_head_t wait_queue;
+ struct delayed_work delayed_work;
+ struct timer_list ktime_timer;
+
+ /* The current local FrameTime */
+ u64 frame_time_offset;
+ struct gb_timesync_frame_time_data strobe_data[GB_TIMESYNC_MAX_STROBES];
+ struct gb_timesync_frame_time_data ktime_data;
+
+ /* The SVC FrameTime and relative AP FrameTime @ last TIMESYNC_PING */
+ u64 svc_ping_frame_time;
+ u64 ap_ping_frame_time;
+
+ /* Transitory settings */
+ u32 strobe_mask;
+ bool offset_down;
+ bool print_ping;
+ bool capture_ping;
+ int strobe;
+
+ /* Current state */
+ int state;
+};
+
+struct gb_timesync_host_device {
+ struct list_head list;
+ struct gb_host_device *hd;
+ u64 ping_frame_time;
+};
+
+struct gb_timesync_interface {
+ struct list_head list;
+ struct gb_interface *interface;
+ u64 ping_frame_time;
+};
+
+enum gb_timesync_state {
+ GB_TIMESYNC_STATE_INVALID = 0,
+ GB_TIMESYNC_STATE_INACTIVE = 1,
+ GB_TIMESYNC_STATE_INIT = 2,
+ GB_TIMESYNC_STATE_WAIT_SVC = 3,
+ GB_TIMESYNC_STATE_AUTHORITATIVE = 4,
+ GB_TIMESYNC_STATE_PING = 5,
+ GB_TIMESYNC_STATE_ACTIVE = 6,
+};
+
+static void gb_timesync_ktime_timer_fn(unsigned long data);
+
+static u64 gb_timesync_adjust_count(struct gb_timesync_svc *timesync_svc,
+ u64 counts)
+{
+ if (timesync_svc->offset_down)
+ return counts - timesync_svc->frame_time_offset;
+ else
+ return counts + timesync_svc->frame_time_offset;
+}
+
+/*
+ * This function provides the authoritative FrameTime to a calling function. It
+ * is designed to be lockless and should remain that way the caller is assumed
+ * to be state-aware.
+ */
+static u64 __gb_timesync_get_frame_time(struct gb_timesync_svc *timesync_svc)
+{
+ u64 clocks = gb_timesync_platform_get_counter();
+
+ return gb_timesync_adjust_count(timesync_svc, clocks);
+}
+
+static void gb_timesync_schedule_svc_timeout(struct gb_timesync_svc
+ *timesync_svc)
+{
+ queue_delayed_work(timesync_svc->work_queue,
+ &timesync_svc->delayed_work,
+ GB_TIMESYNC_MAX_WAIT_SVC);
+}
+
+static void gb_timesync_set_state(struct gb_timesync_svc *timesync_svc,
+ int state)
+{
+ switch (state) {
+ case GB_TIMESYNC_STATE_INVALID:
+ timesync_svc->state = state;
+ wake_up(&timesync_svc->wait_queue);
+ break;
+ case GB_TIMESYNC_STATE_INACTIVE:
+ timesync_svc->state = state;
+ wake_up(&timesync_svc->wait_queue);
+ break;
+ case GB_TIMESYNC_STATE_INIT:
+ if (timesync_svc->state != GB_TIMESYNC_STATE_INVALID) {
+ timesync_svc->strobe = 0;
+ timesync_svc->frame_time_offset = 0;
+ timesync_svc->state = state;
+ cancel_delayed_work(&timesync_svc->delayed_work);
+ queue_delayed_work(timesync_svc->work_queue,
+ &timesync_svc->delayed_work,
+ GB_TIMESYNC_DELAYED_WORK_LONG);
+ }
+ break;
+ case GB_TIMESYNC_STATE_WAIT_SVC:
+ if (timesync_svc->state == GB_TIMESYNC_STATE_INIT)
+ timesync_svc->state = state;
+ break;
+ case GB_TIMESYNC_STATE_AUTHORITATIVE:
+ if (timesync_svc->state == GB_TIMESYNC_STATE_WAIT_SVC) {
+ timesync_svc->state = state;
+ cancel_delayed_work(&timesync_svc->delayed_work);
+ queue_delayed_work(timesync_svc->work_queue,
+ &timesync_svc->delayed_work, 0);
+ }
+ break;
+ case GB_TIMESYNC_STATE_PING:
+ if (timesync_svc->state == GB_TIMESYNC_STATE_ACTIVE) {
+ timesync_svc->state = state;
+ queue_delayed_work(timesync_svc->work_queue,
+ &timesync_svc->delayed_work,
+ GB_TIMESYNC_DELAYED_WORK_SHORT);
+ }
+ break;
+ case GB_TIMESYNC_STATE_ACTIVE:
+ if (timesync_svc->state == GB_TIMESYNC_STATE_AUTHORITATIVE ||
+ timesync_svc->state == GB_TIMESYNC_STATE_PING) {
+ timesync_svc->state = state;
+ wake_up(&timesync_svc->wait_queue);
+ }
+ break;
+ }
+
+ if (WARN_ON(timesync_svc->state != state)) {
+ pr_err("Invalid state transition %d=>%d\n",
+ timesync_svc->state, state);
+ }
+}
+
+static void gb_timesync_set_state_atomic(struct gb_timesync_svc *timesync_svc,
+ int state)
+{
+ unsigned long flags;
+
+ spin_lock_irqsave(&timesync_svc->spinlock, flags);
+ gb_timesync_set_state(timesync_svc, state);
+ spin_unlock_irqrestore(&timesync_svc->spinlock, flags);
+}
+
+static u64 gb_timesync_diff(u64 x, u64 y)
+{
+ if (x > y)
+ return x - y;
+ else
+ return y - x;
+}
+
+static void gb_timesync_adjust_to_svc(struct gb_timesync_svc *svc,
+ u64 svc_frame_time, u64 ap_frame_time)
+{
+ if (svc_frame_time > ap_frame_time) {
+ svc->frame_time_offset = svc_frame_time - ap_frame_time;
+ svc->offset_down = false;
+ } else {
+ svc->frame_time_offset = ap_frame_time - svc_frame_time;
+ svc->offset_down = true;
+ }
+}
+
+/*
+ * Associate a FrameTime with a ktime timestamp represented as struct timespec
+ * Requires the calling context to hold timesync_svc->mutex
+ */
+static void gb_timesync_store_ktime(struct gb_timesync_svc *timesync_svc,
+ struct timespec ts, u64 frame_time)
+{
+ timesync_svc->ktime_data.ts = ts;
+ timesync_svc->ktime_data.frame_time = frame_time;
+}
+
+/*
+ * Find the two pulses that best-match our expected inter-strobe gap and
+ * then calculate the difference between the SVC time at the second pulse
+ * to the local time at the second pulse.
+ */
+static void gb_timesync_collate_frame_time(struct gb_timesync_svc *timesync_svc,
+ u64 *frame_time)
+{
+ int i = 0;
+ u64 delta, ap_frame_time;
+ u64 strobe_delay_ns = GB_TIMESYNC_STROBE_DELAY_US * NSEC_PER_USEC;
+ u64 least = 0;
+
+ for (i = 1; i < GB_TIMESYNC_MAX_STROBES; i++) {
+ delta = timesync_svc->strobe_data[i].frame_time -
+ timesync_svc->strobe_data[i - 1].frame_time;
+ delta *= gb_timesync_ns_per_clock;
+ delta = gb_timesync_diff(delta, strobe_delay_ns);
+
+ if (!least || delta < least) {
+ least = delta;
+ gb_timesync_adjust_to_svc(timesync_svc, frame_time[i],
+ timesync_svc->strobe_data[i].frame_time);
+
+ ap_frame_time = timesync_svc->strobe_data[i].frame_time;
+ ap_frame_time = gb_timesync_adjust_count(timesync_svc,
+ ap_frame_time);
+ gb_timesync_store_ktime(timesync_svc,
+ timesync_svc->strobe_data[i].ts,
+ ap_frame_time);
+
+ pr_debug("adjust %s local %llu svc %llu delta %llu\n",
+ timesync_svc->offset_down ? "down" : "up",
+ timesync_svc->strobe_data[i].frame_time,
+ frame_time[i], delta);
+ }
+ }
+}
+
+static void gb_timesync_teardown(struct gb_timesync_svc *timesync_svc)
+{
+ struct gb_timesync_interface *timesync_interface;
+ struct gb_svc *svc = timesync_svc->svc;
+ struct gb_interface *interface;
+ struct gb_host_device *hd;
+ int ret;
+
+ list_for_each_entry(timesync_interface,
+ &timesync_svc->interface_list, list) {
+ interface = timesync_interface->interface;
+ ret = gb_interface_timesync_disable(interface);
+ if (ret) {
+ dev_err(&interface->dev,
+ "interface timesync_disable %d\n", ret);
+ }
+ }
+
+ hd = timesync_svc->timesync_hd->hd;
+ ret = hd->driver->timesync_disable(hd);
+ if (ret < 0) {
+ dev_err(&hd->dev, "host timesync_disable %d\n",
+ ret);
+ }
+
+ gb_svc_timesync_wake_pins_release(svc);
+ gb_svc_timesync_disable(svc);
+ gb_timesync_platform_unlock_bus();
+
+ gb_timesync_set_state_atomic(timesync_svc, GB_TIMESYNC_STATE_INACTIVE);
+}
+
+static void gb_timesync_platform_lock_bus_fail(struct gb_timesync_svc
+ *timesync_svc, int ret)
+{
+ if (ret == -EAGAIN) {
+ gb_timesync_set_state(timesync_svc, timesync_svc->state);
+ } else {
+ pr_err("Failed to lock timesync bus %d\n", ret);
+ gb_timesync_set_state(timesync_svc, GB_TIMESYNC_STATE_INACTIVE);
+ }
+}
+
+static void gb_timesync_enable(struct gb_timesync_svc *timesync_svc)
+{
+ struct gb_svc *svc = timesync_svc->svc;
+ struct gb_host_device *hd;
+ struct gb_timesync_interface *timesync_interface;
+ struct gb_interface *interface;
+ u64 init_frame_time;
+ unsigned long clock_rate = gb_timesync_clock_rate;
+ int ret;
+
+ /*
+ * Get access to the wake pins in the AP and SVC
+ * Release these pins either in gb_timesync_teardown() or in
+ * gb_timesync_authoritative()
+ */
+ ret = gb_timesync_platform_lock_bus(timesync_svc);
+ if (ret < 0) {
+ gb_timesync_platform_lock_bus_fail(timesync_svc, ret);
+ return;
+ }
+ ret = gb_svc_timesync_wake_pins_acquire(svc, timesync_svc->strobe_mask);
+ if (ret) {
+ dev_err(&svc->dev,
+ "gb_svc_timesync_wake_pins_acquire %d\n", ret);
+ gb_timesync_teardown(timesync_svc);
+ return;
+ }
+
+ /* Choose an initial time in the future */
+ init_frame_time = __gb_timesync_get_frame_time(timesync_svc) + 100000UL;
+
+ /* Send enable command to all relevant participants */
+ list_for_each_entry(timesync_interface, &timesync_svc->interface_list,
+ list) {
+ interface = timesync_interface->interface;
+ ret = gb_interface_timesync_enable(interface,
+ GB_TIMESYNC_MAX_STROBES,
+ init_frame_time,
+ GB_TIMESYNC_STROBE_DELAY_US,
+ clock_rate);
+ if (ret) {
+ dev_err(&interface->dev,
+ "interface timesync_enable %d\n", ret);
+ }
+ }
+
+ hd = timesync_svc->timesync_hd->hd;
+ ret = hd->driver->timesync_enable(hd, GB_TIMESYNC_MAX_STROBES,
+ init_frame_time,
+ GB_TIMESYNC_STROBE_DELAY_US,
+ clock_rate);
+ if (ret < 0) {
+ dev_err(&hd->dev, "host timesync_enable %d\n",
+ ret);
+ }
+
+ gb_timesync_set_state_atomic(timesync_svc, GB_TIMESYNC_STATE_WAIT_SVC);
+ ret = gb_svc_timesync_enable(svc, GB_TIMESYNC_MAX_STROBES,
+ init_frame_time,
+ GB_TIMESYNC_STROBE_DELAY_US,
+ clock_rate);
+ if (ret) {
+ dev_err(&svc->dev,
+ "gb_svc_timesync_enable %d\n", ret);
+ gb_timesync_teardown(timesync_svc);
+ return;
+ }
+
+ /* Schedule a timeout waiting for SVC to complete strobing */
+ gb_timesync_schedule_svc_timeout(timesync_svc);
+}
+
+static void gb_timesync_authoritative(struct gb_timesync_svc *timesync_svc)
+{
+ struct gb_svc *svc = timesync_svc->svc;
+ struct gb_host_device *hd;
+ struct gb_timesync_interface *timesync_interface;
+ struct gb_interface *interface;
+ u64 svc_frame_time[GB_TIMESYNC_MAX_STROBES];
+ int ret;
+
+ /* Get authoritative time from SVC and adjust local clock */
+ ret = gb_svc_timesync_authoritative(svc, svc_frame_time);
+ if (ret) {
+ dev_err(&svc->dev,
+ "gb_svc_timesync_authoritative %d\n", ret);
+ gb_timesync_teardown(timesync_svc);
+ return;
+ }
+ gb_timesync_collate_frame_time(timesync_svc, svc_frame_time);
+
+ /* Transmit authoritative time to downstream slaves */
+ hd = timesync_svc->timesync_hd->hd;
+ ret = hd->driver->timesync_authoritative(hd, svc_frame_time);
+ if (ret < 0)
+ dev_err(&hd->dev, "host timesync_authoritative %d\n", ret);
+
+ list_for_each_entry(timesync_interface,
+ &timesync_svc->interface_list, list) {
+ interface = timesync_interface->interface;
+ ret = gb_interface_timesync_authoritative(
+ interface,
+ svc_frame_time);
+ if (ret) {
+ dev_err(&interface->dev,
+ "interface timesync_authoritative %d\n", ret);
+ }
+ }
+
+ /* Release wake pins */
+ gb_svc_timesync_wake_pins_release(svc);
+ gb_timesync_platform_unlock_bus();
+
+ /* Transition to state ACTIVE */
+ gb_timesync_set_state_atomic(timesync_svc, GB_TIMESYNC_STATE_ACTIVE);
+
+ /* Schedule a ping to verify the synchronized system time */
+ timesync_svc->print_ping = true;
+ gb_timesync_set_state_atomic(timesync_svc, GB_TIMESYNC_STATE_PING);
+}
+
+static int __gb_timesync_get_status(struct gb_timesync_svc *timesync_svc)
+{
+ int ret = -EINVAL;
+
+ switch (timesync_svc->state) {
+ case GB_TIMESYNC_STATE_INVALID:
+ case GB_TIMESYNC_STATE_INACTIVE:
+ ret = -ENODEV;
+ break;
+ case GB_TIMESYNC_STATE_INIT:
+ case GB_TIMESYNC_STATE_WAIT_SVC:
+ case GB_TIMESYNC_STATE_AUTHORITATIVE:
+ ret = -EAGAIN;
+ break;
+ case GB_TIMESYNC_STATE_PING:
+ case GB_TIMESYNC_STATE_ACTIVE:
+ ret = 0;
+ break;
+ }
+ return ret;
+}
+
+/*
+ * This routine takes a FrameTime and derives the difference with-respect
+ * to a reference FrameTime/ktime pair. It then returns the calculated
+ * ktime based on the difference between the supplied FrameTime and
+ * the reference FrameTime.
+ *
+ * The time difference is calculated to six decimal places. Taking 19.2MHz
+ * as an example this means we have 52.083333~ nanoseconds per clock or
+ * 52083333~ femtoseconds per clock.
+ *
+ * Naively taking the count difference and converting to
+ * seconds/nanoseconds would quickly see the 0.0833 component produce
+ * noticeable errors. For example a time difference of one second would
+ * loose 19200000 * 0.08333x nanoseconds or 1.59 seconds.
+ *
+ * In contrast calculating in femtoseconds the same example of 19200000 *
+ * 0.000000083333x nanoseconds per count of error is just 1.59 nanoseconds!
+ *
+ * Continuing the example of 19.2 MHz we cap the maximum error difference
+ * at a worst-case 0.3 microseconds over a potential calculation window of
+ * abount 15 seconds, meaning you can convert a FrameTime that is <= 15
+ * seconds older/younger than the reference time with a maximum error of
+ * 0.2385 useconds. Note 19.2MHz is an example frequency not a requirement.
+ */
+static int gb_timesync_to_timespec(struct gb_timesync_svc *timesync_svc,
+ u64 frame_time, struct timespec *ts)
+{
+ unsigned long flags;
+ u64 delta_fs, counts, sec, nsec;
+ bool add;
+ int ret = 0;
+
+ memset(ts, 0x00, sizeof(*ts));
+ mutex_lock(&timesync_svc->mutex);
+ spin_lock_irqsave(&timesync_svc->spinlock, flags);
+
+ ret = __gb_timesync_get_status(timesync_svc);
+ if (ret)
+ goto done;
+
+ /* Support calculating ktime upwards or downwards from the reference */
+ if (frame_time < timesync_svc->ktime_data.frame_time) {
+ add = false;
+ counts = timesync_svc->ktime_data.frame_time - frame_time;
+ } else {
+ add = true;
+ counts = frame_time - timesync_svc->ktime_data.frame_time;
+ }
+
+ /* Enforce the .23 of a usecond boundary @ 19.2MHz */
+ if (counts > gb_timesync_max_ktime_diff) {
+ ret = -EINVAL;
+ goto done;
+ }
+
+ /* Determine the time difference in femtoseconds */
+ delta_fs = counts * gb_timesync_fs_per_clock;
+
+ /* Convert to seconds */
+ sec = delta_fs;
+ do_div(sec, NSEC_PER_SEC);
+ do_div(sec, 1000000UL);
+
+ /* Get the nanosecond remainder */
+ nsec = do_div(delta_fs, sec);
+ do_div(nsec, 1000000UL);
+
+ if (add) {
+ /* Add the calculated offset - overflow nanoseconds upwards */
+ ts->tv_sec = timesync_svc->ktime_data.ts.tv_sec + sec;
+ ts->tv_nsec = timesync_svc->ktime_data.ts.tv_nsec + nsec;
+ if (ts->tv_nsec >= NSEC_PER_SEC) {
+ ts->tv_sec++;
+ ts->tv_nsec -= NSEC_PER_SEC;
+ }
+ } else {
+ /* Subtract the difference over/underflow as necessary */
+ if (nsec > timesync_svc->ktime_data.ts.tv_nsec) {
+ sec++;
+ nsec = nsec + timesync_svc->ktime_data.ts.tv_nsec;
+ nsec = do_div(nsec, NSEC_PER_SEC);
+ } else {
+ nsec = timesync_svc->ktime_data.ts.tv_nsec - nsec;
+ }
+ /* Cannot return a negative second value */
+ if (sec > timesync_svc->ktime_data.ts.tv_sec) {
+ ret = -EINVAL;
+ goto done;
+ }
+ ts->tv_sec = timesync_svc->ktime_data.ts.tv_sec - sec;
+ ts->tv_nsec = nsec;
+ }
+done:
+ spin_unlock_irqrestore(&timesync_svc->spinlock, flags);
+ mutex_unlock(&timesync_svc->mutex);
+ return ret;
+}
+
+static size_t gb_timesync_log_frame_time(struct gb_timesync_svc *timesync_svc,
+ char *buf, size_t buflen)
+{
+ struct gb_svc *svc = timesync_svc->svc;
+ struct gb_host_device *hd;
+ struct gb_timesync_interface *timesync_interface;
+ struct gb_interface *interface;
+ unsigned int len;
+ size_t off;
+
+ /* AP/SVC */
+ off = snprintf(buf, buflen, "%s frametime: ap=%llu %s=%llu ",
+ greybus_bus_type.name,
+ timesync_svc->ap_ping_frame_time, dev_name(&svc->dev),
+ timesync_svc->svc_ping_frame_time);
+ len = buflen - off;
+
+ /* APB/GPB */
+ if (len < buflen) {
+ hd = timesync_svc->timesync_hd->hd;
+ off += snprintf(&buf[off], len, "%s=%llu ", dev_name(&hd->dev),
+ timesync_svc->timesync_hd->ping_frame_time);
+ len = buflen - off;
+ }
+
+ list_for_each_entry(timesync_interface,
+ &timesync_svc->interface_list, list) {
+ if (len < buflen) {
+ interface = timesync_interface->interface;
+ off += snprintf(&buf[off], len, "%s=%llu ",
+ dev_name(&interface->dev),
+ timesync_interface->ping_frame_time);
+ len = buflen - off;
+ }
+ }
+ if (len < buflen)
+ off += snprintf(&buf[off], len, "\n");
+ return off;
+}
+
+static size_t gb_timesync_log_frame_ktime(struct gb_timesync_svc *timesync_svc,
+ char *buf, size_t buflen)
+{
+ struct gb_svc *svc = timesync_svc->svc;
+ struct gb_host_device *hd;
+ struct gb_timesync_interface *timesync_interface;
+ struct gb_interface *interface;
+ struct timespec ts;
+ unsigned int len;
+ size_t off;
+
+ /* AP */
+ gb_timesync_to_timespec(timesync_svc, timesync_svc->ap_ping_frame_time,
+ &ts);
+ off = snprintf(buf, buflen, "%s frametime: ap=%lu.%lu ",
+ greybus_bus_type.name, ts.tv_sec, ts.tv_nsec);
+ len = buflen - off;
+ if (len >= buflen)
+ goto done;
+
+ /* SVC */
+ gb_timesync_to_timespec(timesync_svc, timesync_svc->svc_ping_frame_time,
+ &ts);
+ off += snprintf(&buf[off], len, "%s=%lu.%lu ", dev_name(&svc->dev),
+ ts.tv_sec, ts.tv_nsec);
+ len = buflen - off;
+ if (len >= buflen)
+ goto done;
+
+ /* APB/GPB */
+ hd = timesync_svc->timesync_hd->hd;
+ gb_timesync_to_timespec(timesync_svc,
+ timesync_svc->timesync_hd->ping_frame_time,
+ &ts);
+ off += snprintf(&buf[off], len, "%s=%lu.%lu ",
+ dev_name(&hd->dev),
+ ts.tv_sec, ts.tv_nsec);
+ len = buflen - off;
+ if (len >= buflen)
+ goto done;
+
+ list_for_each_entry(timesync_interface,
+ &timesync_svc->interface_list, list) {
+ interface = timesync_interface->interface;
+ gb_timesync_to_timespec(timesync_svc,
+ timesync_interface->ping_frame_time,
+ &ts);
+ off += snprintf(&buf[off], len, "%s=%lu.%lu ",
+ dev_name(&interface->dev),
+ ts.tv_sec, ts.tv_nsec);
+ len = buflen - off;
+ if (len >= buflen)
+ goto done;
+ }
+ off += snprintf(&buf[off], len, "\n");
+done:
+ return off;
+}
+
+/*
+ * Send an SVC initiated wake 'ping' to each TimeSync participant.
+ * Get the FrameTime from each participant associated with the wake
+ * ping.
+ */
+static void gb_timesync_ping(struct gb_timesync_svc *timesync_svc)
+{
+ struct gb_svc *svc = timesync_svc->svc;
+ struct gb_host_device *hd;
+ struct gb_timesync_interface *timesync_interface;
+ struct gb_control *control;
+ u64 *ping_frame_time;
+ int ret;
+
+ /* Get access to the wake pins in the AP and SVC */
+ ret = gb_timesync_platform_lock_bus(timesync_svc);
+ if (ret < 0) {
+ gb_timesync_platform_lock_bus_fail(timesync_svc, ret);
+ return;
+ }
+ ret = gb_svc_timesync_wake_pins_acquire(svc, timesync_svc->strobe_mask);
+ if (ret) {
+ dev_err(&svc->dev,
+ "gb_svc_timesync_wake_pins_acquire %d\n", ret);
+ gb_timesync_teardown(timesync_svc);
+ return;
+ }
+
+ /* Have SVC generate a timesync ping */
+ timesync_svc->capture_ping = true;
+ timesync_svc->svc_ping_frame_time = 0;
+ ret = gb_svc_timesync_ping(svc, &timesync_svc->svc_ping_frame_time);
+ timesync_svc->capture_ping = false;
+ if (ret) {
+ dev_err(&svc->dev,
+ "gb_svc_timesync_ping %d\n", ret);
+ gb_timesync_teardown(timesync_svc);
+ return;
+ }
+
+ /* Get the ping FrameTime from each APB/GPB */
+ hd = timesync_svc->timesync_hd->hd;
+ timesync_svc->timesync_hd->ping_frame_time = 0;
+ ret = hd->driver->timesync_get_last_event(hd,
+ &timesync_svc->timesync_hd->ping_frame_time);
+ if (ret)
+ dev_err(&hd->dev, "host timesync_get_last_event %d\n", ret);
+
+ list_for_each_entry(timesync_interface,
+ &timesync_svc->interface_list, list) {
+ control = timesync_interface->interface->control;
+ timesync_interface->ping_frame_time = 0;
+ ping_frame_time = &timesync_interface->ping_frame_time;
+ ret = gb_control_timesync_get_last_event(control,
+ ping_frame_time);
+ if (ret) {
+ dev_err(&timesync_interface->interface->dev,
+ "gb_control_timesync_get_last_event %d\n", ret);
+ }
+ }
+
+ /* Ping success - move to timesync active */
+ gb_svc_timesync_wake_pins_release(svc);
+ gb_timesync_platform_unlock_bus();
+ gb_timesync_set_state_atomic(timesync_svc, GB_TIMESYNC_STATE_ACTIVE);
+}
+
+static void gb_timesync_log_ping_time(struct gb_timesync_svc *timesync_svc)
+{
+ char *buf;
+
+ if (!timesync_svc->print_ping)
+ return;
+
+ buf = kzalloc(PAGE_SIZE, GFP_KERNEL);
+ if (buf) {
+ gb_timesync_log_frame_time(timesync_svc, buf, PAGE_SIZE);
+ dev_dbg(&timesync_svc->svc->dev, "%s", buf);
+ kfree(buf);
+ }
+}
+
+/*
+ * Perform the actual work of scheduled TimeSync logic.
+ */
+static void gb_timesync_worker(struct work_struct *work)
+{
+ struct delayed_work *delayed_work = to_delayed_work(work);
+ struct gb_timesync_svc *timesync_svc =
+ container_of(delayed_work, struct gb_timesync_svc, delayed_work);
+
+ mutex_lock(&timesync_svc->mutex);
+
+ switch (timesync_svc->state) {
+ case GB_TIMESYNC_STATE_INIT:
+ gb_timesync_enable(timesync_svc);
+ break;
+
+ case GB_TIMESYNC_STATE_WAIT_SVC:
+ dev_err(&timesync_svc->svc->dev,
+ "timeout SVC strobe completion %d/%d\n",
+ timesync_svc->strobe, GB_TIMESYNC_MAX_STROBES);
+ gb_timesync_teardown(timesync_svc);
+ break;
+
+ case GB_TIMESYNC_STATE_AUTHORITATIVE:
+ gb_timesync_authoritative(timesync_svc);
+ break;
+
+ case GB_TIMESYNC_STATE_PING:
+ gb_timesync_ping(timesync_svc);
+ gb_timesync_log_ping_time(timesync_svc);
+ break;
+
+ default:
+ pr_err("Invalid state %d for delayed work\n",
+ timesync_svc->state);
+ break;
+ }
+
+ mutex_unlock(&timesync_svc->mutex);
+}
+
+/*
+ * Schedule a new TimeSync INIT or PING operation serialized w/r to
+ * gb_timesync_worker().
+ */
+static int gb_timesync_schedule(struct gb_timesync_svc *timesync_svc, int state)
+{
+ int ret = 0;
+
+ if (state != GB_TIMESYNC_STATE_INIT && state != GB_TIMESYNC_STATE_PING)
+ return -EINVAL;
+
+ mutex_lock(&timesync_svc->mutex);
+ if (timesync_svc->state != GB_TIMESYNC_STATE_INVALID) {
+ gb_timesync_set_state_atomic(timesync_svc, state);
+ } else {
+ ret = -ENODEV;
+ }
+ mutex_unlock(&timesync_svc->mutex);
+ return ret;
+}
+
+static int __gb_timesync_schedule_synchronous(
+ struct gb_timesync_svc *timesync_svc, int state)
+{
+ unsigned long flags;
+ int ret;
+
+ ret = gb_timesync_schedule(timesync_svc, state);
+ if (ret)
+ return ret;
+
+ ret = wait_event_interruptible(timesync_svc->wait_queue,
+ (timesync_svc->state == GB_TIMESYNC_STATE_ACTIVE ||
+ timesync_svc->state == GB_TIMESYNC_STATE_INACTIVE ||
+ timesync_svc->state == GB_TIMESYNC_STATE_INVALID));
+ if (ret)
+ return ret;
+
+ mutex_lock(&timesync_svc->mutex);
+ spin_lock_irqsave(&timesync_svc->spinlock, flags);
+
+ ret = __gb_timesync_get_status(timesync_svc);
+
+ spin_unlock_irqrestore(&timesync_svc->spinlock, flags);
+ mutex_unlock(&timesync_svc->mutex);
+
+ return ret;
+}
+
+static struct gb_timesync_svc *gb_timesync_find_timesync_svc(
+ struct gb_host_device *hd)
+{
+ struct gb_timesync_svc *timesync_svc;
+
+ list_for_each_entry(timesync_svc, &gb_timesync_svc_list, list) {
+ if (timesync_svc->svc == hd->svc)
+ return timesync_svc;
+ }
+ return NULL;
+}
+
+static struct gb_timesync_interface *gb_timesync_find_timesync_interface(
+ struct gb_timesync_svc *timesync_svc,
+ struct gb_interface *interface)
+{
+ struct gb_timesync_interface *timesync_interface;
+
+ list_for_each_entry(timesync_interface, &timesync_svc->interface_list, list) {
+ if (timesync_interface->interface == interface)
+ return timesync_interface;
+ }
+ return NULL;
+}
+
+int gb_timesync_schedule_synchronous(struct gb_interface *interface)
+{
+ int ret;
+ struct gb_timesync_svc *timesync_svc;
+ int retries;
+
+ if (!(interface->features & GREYBUS_INTERFACE_FEATURE_TIMESYNC))
+ return 0;
+
+ mutex_lock(&gb_timesync_svc_list_mutex);
+ for (retries = 0; retries < GB_TIMESYNC_MAX_RETRIES; retries++) {
+ timesync_svc = gb_timesync_find_timesync_svc(interface->hd);
+ if (!timesync_svc) {
+ ret = -ENODEV;
+ goto done;
+ }
+
+ ret = __gb_timesync_schedule_synchronous(timesync_svc,
+ GB_TIMESYNC_STATE_INIT);
+ if (!ret)
+ break;
+ }
+ if (ret && retries == GB_TIMESYNC_MAX_RETRIES)
+ ret = -ETIMEDOUT;
+done:
+ mutex_unlock(&gb_timesync_svc_list_mutex);
+ return ret;
+}
+EXPORT_SYMBOL_GPL(gb_timesync_schedule_synchronous);
+
+void gb_timesync_schedule_asynchronous(struct gb_interface *interface)
+{
+ struct gb_timesync_svc *timesync_svc;
+
+ if (!(interface->features & GREYBUS_INTERFACE_FEATURE_TIMESYNC))
+ return;
+
+ mutex_lock(&gb_timesync_svc_list_mutex);
+ timesync_svc = gb_timesync_find_timesync_svc(interface->hd);
+ if (!timesync_svc)
+ goto done;
+
+ gb_timesync_schedule(timesync_svc, GB_TIMESYNC_STATE_INIT);
+done:
+ mutex_unlock(&gb_timesync_svc_list_mutex);
+ return;
+}
+EXPORT_SYMBOL_GPL(gb_timesync_schedule_asynchronous);
+
+static ssize_t gb_timesync_ping_read(struct file *file, char __user *ubuf,
+ size_t len, loff_t *offset, bool ktime)
+{
+ struct gb_timesync_svc *timesync_svc = file->f_inode->i_private;
+ char *buf;
+ ssize_t ret = 0;
+
+ mutex_lock(&gb_timesync_svc_list_mutex);
+ mutex_lock(&timesync_svc->mutex);
+ if (list_empty(&timesync_svc->interface_list))
+ ret = -ENODEV;
+ timesync_svc->print_ping = false;
+ mutex_unlock(&timesync_svc->mutex);
+ if (ret)
+ goto done;
+
+ ret = __gb_timesync_schedule_synchronous(timesync_svc,
+ GB_TIMESYNC_STATE_PING);
+ if (ret)
+ goto done;
+
+ buf = kzalloc(PAGE_SIZE, GFP_KERNEL);
+ if (!buf) {
+ ret = -ENOMEM;
+ goto done;
+ }
+
+ if (ktime)
+ ret = gb_timesync_log_frame_ktime(timesync_svc, buf, PAGE_SIZE);
+ else
+ ret = gb_timesync_log_frame_time(timesync_svc, buf, PAGE_SIZE);
+ if (ret > 0)
+ ret = simple_read_from_buffer(ubuf, len, offset, buf, ret);
+ kfree(buf);
+done:
+ mutex_unlock(&gb_timesync_svc_list_mutex);
+ return ret;
+}
+
+static ssize_t gb_timesync_ping_read_frame_time(struct file *file,
+ char __user *buf,
+ size_t len, loff_t *offset)
+{
+ return gb_timesync_ping_read(file, buf, len, offset, false);
+}
+
+static ssize_t gb_timesync_ping_read_frame_ktime(struct file *file,
+ char __user *buf,
+ size_t len, loff_t *offset)
+{
+ return gb_timesync_ping_read(file, buf, len, offset, true);
+}
+
+static const struct file_operations gb_timesync_debugfs_frame_time_ops = {
+ .read = gb_timesync_ping_read_frame_time,
+};
+
+static const struct file_operations gb_timesync_debugfs_frame_ktime_ops = {
+ .read = gb_timesync_ping_read_frame_ktime,
+};
+
+static int gb_timesync_hd_add(struct gb_timesync_svc *timesync_svc,
+ struct gb_host_device *hd)
+{
+ struct gb_timesync_host_device *timesync_hd;
+
+ timesync_hd = kzalloc(sizeof(*timesync_hd), GFP_KERNEL);
+ if (!timesync_hd)
+ return -ENOMEM;
+
+ WARN_ON(timesync_svc->timesync_hd);
+ timesync_hd->hd = hd;
+ timesync_svc->timesync_hd = timesync_hd;
+
+ return 0;
+}
+
+static void gb_timesync_hd_remove(struct gb_timesync_svc *timesync_svc,
+ struct gb_host_device *hd)
+{
+ if (timesync_svc->timesync_hd->hd == hd) {
+ kfree(timesync_svc->timesync_hd);
+ timesync_svc->timesync_hd = NULL;
+ return;
+ }
+ WARN_ON(1);
+}
+
+int gb_timesync_svc_add(struct gb_svc *svc)
+{
+ struct gb_timesync_svc *timesync_svc;
+ int ret;
+
+ timesync_svc = kzalloc(sizeof(*timesync_svc), GFP_KERNEL);
+ if (!timesync_svc)
+ return -ENOMEM;
+
+ timesync_svc->work_queue =
+ create_singlethread_workqueue("gb-timesync-work_queue");
+
+ if (!timesync_svc->work_queue) {
+ kfree(timesync_svc);
+ return -ENOMEM;
+ }
+
+ mutex_lock(&gb_timesync_svc_list_mutex);
+ INIT_LIST_HEAD(&timesync_svc->interface_list);
+ INIT_DELAYED_WORK(&timesync_svc->delayed_work, gb_timesync_worker);
+ mutex_init(&timesync_svc->mutex);
+ spin_lock_init(&timesync_svc->spinlock);
+ init_waitqueue_head(&timesync_svc->wait_queue);
+
+ timesync_svc->svc = svc;
+ timesync_svc->frame_time_offset = 0;
+ timesync_svc->capture_ping = false;
+ gb_timesync_set_state_atomic(timesync_svc, GB_TIMESYNC_STATE_INACTIVE);
+
+ timesync_svc->frame_time_dentry =
+ debugfs_create_file("frame-time", S_IRUGO, svc->debugfs_dentry,
+ timesync_svc,
+ &gb_timesync_debugfs_frame_time_ops);
+ timesync_svc->frame_ktime_dentry =
+ debugfs_create_file("frame-ktime", S_IRUGO, svc->debugfs_dentry,
+ timesync_svc,
+ &gb_timesync_debugfs_frame_ktime_ops);
+
+ list_add(&timesync_svc->list, &gb_timesync_svc_list);
+ ret = gb_timesync_hd_add(timesync_svc, svc->hd);
+ if (ret) {
+ list_del(&timesync_svc->list);
+ debugfs_remove(timesync_svc->frame_ktime_dentry);
+ debugfs_remove(timesync_svc->frame_time_dentry);
+ destroy_workqueue(timesync_svc->work_queue);
+ kfree(timesync_svc);
+ goto done;
+ }
+
+ init_timer(&timesync_svc->ktime_timer);
+ timesync_svc->ktime_timer.function = gb_timesync_ktime_timer_fn;
+ timesync_svc->ktime_timer.expires = jiffies + GB_TIMESYNC_KTIME_UPDATE;
+ timesync_svc->ktime_timer.data = (unsigned long)timesync_svc;
+ add_timer(&timesync_svc->ktime_timer);
+done:
+ mutex_unlock(&gb_timesync_svc_list_mutex);
+ return ret;
+}
+EXPORT_SYMBOL_GPL(gb_timesync_svc_add);
+
+void gb_timesync_svc_remove(struct gb_svc *svc)
+{
+ struct gb_timesync_svc *timesync_svc;
+ struct gb_timesync_interface *timesync_interface;
+ struct gb_timesync_interface *next;
+
+ mutex_lock(&gb_timesync_svc_list_mutex);
+ timesync_svc = gb_timesync_find_timesync_svc(svc->hd);
+ if (!timesync_svc)
+ goto done;
+
+ cancel_delayed_work_sync(&timesync_svc->delayed_work);
+
+ mutex_lock(&timesync_svc->mutex);
+
+ gb_timesync_set_state_atomic(timesync_svc, GB_TIMESYNC_STATE_INVALID);
+ del_timer_sync(&timesync_svc->ktime_timer);
+ gb_timesync_teardown(timesync_svc);
+
+ gb_timesync_hd_remove(timesync_svc, svc->hd);
+ list_for_each_entry_safe(timesync_interface, next,
+ &timesync_svc->interface_list, list) {
+ list_del(&timesync_interface->list);
+ kfree(timesync_interface);
+ }
+ debugfs_remove(timesync_svc->frame_ktime_dentry);
+ debugfs_remove(timesync_svc->frame_time_dentry);
+ destroy_workqueue(timesync_svc->work_queue);
+ list_del(&timesync_svc->list);
+
+ mutex_unlock(&timesync_svc->mutex);
+
+ kfree(timesync_svc);
+done:
+ mutex_unlock(&gb_timesync_svc_list_mutex);
+}
+EXPORT_SYMBOL_GPL(gb_timesync_svc_remove);
+
+/*
+ * Add a Greybus Interface to the set of TimeSync Interfaces.
+ */
+int gb_timesync_interface_add(struct gb_interface *interface)
+{
+ struct gb_timesync_svc *timesync_svc;
+ struct gb_timesync_interface *timesync_interface;
+ int ret = 0;
+
+ if (!(interface->features & GREYBUS_INTERFACE_FEATURE_TIMESYNC))
+ return 0;
+
+ mutex_lock(&gb_timesync_svc_list_mutex);
+ timesync_svc = gb_timesync_find_timesync_svc(interface->hd);
+ if (!timesync_svc) {
+ ret = -ENODEV;
+ goto done;
+ }
+
+ timesync_interface = kzalloc(sizeof(*timesync_interface), GFP_KERNEL);
+ if (!timesync_interface) {
+ ret = -ENOMEM;
+ goto done;
+ }
+
+ mutex_lock(&timesync_svc->mutex);
+ timesync_interface->interface = interface;
+ list_add(&timesync_interface->list, &timesync_svc->interface_list);
+ timesync_svc->strobe_mask |= 1 << interface->interface_id;
+ mutex_unlock(&timesync_svc->mutex);
+
+done:
+ mutex_unlock(&gb_timesync_svc_list_mutex);
+ return ret;
+}
+EXPORT_SYMBOL_GPL(gb_timesync_interface_add);
+
+/*
+ * Remove a Greybus Interface from the set of TimeSync Interfaces.
+ */
+void gb_timesync_interface_remove(struct gb_interface *interface)
+{
+ struct gb_timesync_svc *timesync_svc;
+ struct gb_timesync_interface *timesync_interface;
+
+ if (!(interface->features & GREYBUS_INTERFACE_FEATURE_TIMESYNC))
+ return;
+
+ mutex_lock(&gb_timesync_svc_list_mutex);
+ timesync_svc = gb_timesync_find_timesync_svc(interface->hd);
+ if (!timesync_svc)
+ goto done;
+
+ timesync_interface = gb_timesync_find_timesync_interface(timesync_svc,
+ interface);
+ if (!timesync_interface)
+ goto done;
+
+ mutex_lock(&timesync_svc->mutex);
+ timesync_svc->strobe_mask &= ~(1 << interface->interface_id);
+ list_del(&timesync_interface->list);
+ kfree(timesync_interface);
+ mutex_unlock(&timesync_svc->mutex);
+done:
+ mutex_unlock(&gb_timesync_svc_list_mutex);
+}
+EXPORT_SYMBOL_GPL(gb_timesync_interface_remove);
+
+/*
+ * Give the authoritative FrameTime to the calling function. Returns zero if we
+ * are not in GB_TIMESYNC_STATE_ACTIVE.
+ */
+static u64 gb_timesync_get_frame_time(struct gb_timesync_svc *timesync_svc)
+{
+ unsigned long flags;
+ u64 ret;
+
+ spin_lock_irqsave(&timesync_svc->spinlock, flags);
+ if (timesync_svc->state == GB_TIMESYNC_STATE_ACTIVE)
+ ret = __gb_timesync_get_frame_time(timesync_svc);
+ else
+ ret = 0;
+ spin_unlock_irqrestore(&timesync_svc->spinlock, flags);
+ return ret;
+}
+
+u64 gb_timesync_get_frame_time_by_interface(struct gb_interface *interface)
+{
+ struct gb_timesync_svc *timesync_svc;
+ u64 ret = 0;
+
+ mutex_lock(&gb_timesync_svc_list_mutex);
+ timesync_svc = gb_timesync_find_timesync_svc(interface->hd);
+ if (!timesync_svc)
+ goto done;
+
+ ret = gb_timesync_get_frame_time(timesync_svc);
+done:
+ mutex_unlock(&gb_timesync_svc_list_mutex);
+ return ret;
+}
+EXPORT_SYMBOL_GPL(gb_timesync_get_frame_time_by_interface);
+
+u64 gb_timesync_get_frame_time_by_svc(struct gb_svc *svc)
+{
+ struct gb_timesync_svc *timesync_svc;
+ u64 ret = 0;
+
+ mutex_lock(&gb_timesync_svc_list_mutex);
+ timesync_svc = gb_timesync_find_timesync_svc(svc->hd);
+ if (!timesync_svc)
+ goto done;
+
+ ret = gb_timesync_get_frame_time(timesync_svc);
+done:
+ mutex_unlock(&gb_timesync_svc_list_mutex);
+ return ret;
+}
+EXPORT_SYMBOL_GPL(gb_timesync_get_frame_time_by_svc);
+
+/* Incrementally updates the conversion base from FrameTime to ktime */
+static void gb_timesync_ktime_timer_fn(unsigned long data)
+{
+ struct gb_timesync_svc *timesync_svc =
+ (struct gb_timesync_svc *)data;
+ unsigned long flags;
+ u64 frame_time;
+ struct timespec ts;
+
+ spin_lock_irqsave(&timesync_svc->spinlock, flags);
+
+ if (timesync_svc->state != GB_TIMESYNC_STATE_ACTIVE)
+ goto done;
+
+ ktime_get_ts(&ts);
+ frame_time = __gb_timesync_get_frame_time(timesync_svc);
+ gb_timesync_store_ktime(timesync_svc, ts, frame_time);
+
+done:
+ spin_unlock_irqrestore(&timesync_svc->spinlock, flags);
+ mod_timer(&timesync_svc->ktime_timer,
+ jiffies + GB_TIMESYNC_KTIME_UPDATE);
+}
+
+int gb_timesync_to_timespec_by_svc(struct gb_svc *svc, u64 frame_time,
+ struct timespec *ts)
+{
+ struct gb_timesync_svc *timesync_svc;
+ int ret = 0;
+
+ mutex_lock(&gb_timesync_svc_list_mutex);
+ timesync_svc = gb_timesync_find_timesync_svc(svc->hd);
+ if (!timesync_svc) {
+ ret = -ENODEV;
+ goto done;
+ }
+ ret = gb_timesync_to_timespec(timesync_svc, frame_time, ts);
+done:
+ mutex_unlock(&gb_timesync_svc_list_mutex);
+ return ret;
+}
+EXPORT_SYMBOL_GPL(gb_timesync_to_timespec_by_svc);
+
+int gb_timesync_to_timespec_by_interface(struct gb_interface *interface,
+ u64 frame_time, struct timespec *ts)
+{
+ struct gb_timesync_svc *timesync_svc;
+ int ret = 0;
+
+ mutex_lock(&gb_timesync_svc_list_mutex);
+ timesync_svc = gb_timesync_find_timesync_svc(interface->hd);
+ if (!timesync_svc) {
+ ret = -ENODEV;
+ goto done;
+ }
+
+ ret = gb_timesync_to_timespec(timesync_svc, frame_time, ts);
+done:
+ mutex_unlock(&gb_timesync_svc_list_mutex);
+ return ret;
+}
+EXPORT_SYMBOL_GPL(gb_timesync_to_timespec_by_interface);
+
+void gb_timesync_irq(struct gb_timesync_svc *timesync_svc)
+{
+ unsigned long flags;
+ u64 strobe_time;
+ bool strobe_is_ping = true;
+ struct timespec ts;
+
+ ktime_get_ts(&ts);
+ strobe_time = __gb_timesync_get_frame_time(timesync_svc);
+
+ spin_lock_irqsave(&timesync_svc->spinlock, flags);
+
+ if (timesync_svc->state == GB_TIMESYNC_STATE_PING) {
+ if (!timesync_svc->capture_ping)
+ goto done_nolog;
+ timesync_svc->ap_ping_frame_time = strobe_time;
+ goto done_log;
+ } else if (timesync_svc->state != GB_TIMESYNC_STATE_WAIT_SVC) {
+ goto done_nolog;
+ }
+
+ timesync_svc->strobe_data[timesync_svc->strobe].frame_time = strobe_time;
+ timesync_svc->strobe_data[timesync_svc->strobe].ts = ts;
+
+ if (++timesync_svc->strobe == GB_TIMESYNC_MAX_STROBES) {
+ gb_timesync_set_state(timesync_svc,
+ GB_TIMESYNC_STATE_AUTHORITATIVE);
+ }
+ strobe_is_ping = false;
+done_log:
+ trace_gb_timesync_irq(strobe_is_ping, timesync_svc->strobe,
+ GB_TIMESYNC_MAX_STROBES, strobe_time);
+done_nolog:
+ spin_unlock_irqrestore(&timesync_svc->spinlock, flags);
+}
+EXPORT_SYMBOL(gb_timesync_irq);
+
+int __init gb_timesync_init(void)
+{
+ int ret = 0;
+
+ ret = gb_timesync_platform_init();
+ if (ret) {
+ pr_err("timesync platform init fail!\n");
+ return ret;
+ }
+
+ gb_timesync_clock_rate = gb_timesync_platform_get_clock_rate();
+
+ /* Calculate nanoseconds and femtoseconds per clock */
+ gb_timesync_fs_per_clock = FSEC_PER_SEC;
+ do_div(gb_timesync_fs_per_clock, gb_timesync_clock_rate);
+ gb_timesync_ns_per_clock = NSEC_PER_SEC;
+ do_div(gb_timesync_ns_per_clock, gb_timesync_clock_rate);
+
+ /* Calculate the maximum number of clocks we will convert to ktime */
+ gb_timesync_max_ktime_diff =
+ GB_TIMESYNC_MAX_KTIME_CONVERSION * gb_timesync_clock_rate;
+
+ pr_info("Time-Sync @ %lu Hz max ktime conversion +/- %d seconds\n",
+ gb_timesync_clock_rate, GB_TIMESYNC_MAX_KTIME_CONVERSION);
+ return 0;
+}
+
+void gb_timesync_exit(void)
+{
+ gb_timesync_platform_exit();
+}
--- /dev/null
+++ b/drivers/greybus/timesync.h
@@ -0,0 +1,45 @@
+/*
+ * TimeSync API driver.
+ *
+ * Copyright 2016 Google Inc.
+ * Copyright 2016 Linaro Ltd.
+ *
+ * Released under the GPLv2 only.
+ */
+
+#ifndef __TIMESYNC_H
+#define __TIMESYNC_H
+
+struct gb_svc;
+struct gb_interface;
+struct gb_timesync_svc;
+
+/* Platform */
+u64 gb_timesync_platform_get_counter(void);
+u32 gb_timesync_platform_get_clock_rate(void);
+int gb_timesync_platform_lock_bus(struct gb_timesync_svc *pdata);
+void gb_timesync_platform_unlock_bus(void);
+
+int gb_timesync_platform_init(void);
+void gb_timesync_platform_exit(void);
+
+/* Core API */
+int gb_timesync_interface_add(struct gb_interface *interface);
+void gb_timesync_interface_remove(struct gb_interface *interface);
+int gb_timesync_svc_add(struct gb_svc *svc);
+void gb_timesync_svc_remove(struct gb_svc *svc);
+
+u64 gb_timesync_get_frame_time_by_interface(struct gb_interface *interface);
+u64 gb_timesync_get_frame_time_by_svc(struct gb_svc *svc);
+int gb_timesync_to_timespec_by_svc(struct gb_svc *svc, u64 frame_time,
+ struct timespec *ts);
+int gb_timesync_to_timespec_by_interface(struct gb_interface *interface,
+ u64 frame_time, struct timespec *ts);
+
+int gb_timesync_schedule_synchronous(struct gb_interface *intf);
+void gb_timesync_schedule_asynchronous(struct gb_interface *intf);
+void gb_timesync_irq(struct gb_timesync_svc *timesync_svc);
+int gb_timesync_init(void);
+void gb_timesync_exit(void);
+
+#endif /* __TIMESYNC_H */
--- /dev/null
+++ b/drivers/greybus/timesync_platform.c
@@ -0,0 +1,77 @@
+/*
+ * TimeSync API driver.
+ *
+ * Copyright 2016 Google Inc.
+ * Copyright 2016 Linaro Ltd.
+ *
+ * Released under the GPLv2 only.
+ *
+ * This code reads directly from an ARMv7 memory-mapped timer that lives in
+ * MMIO space. Since this counter lives inside of MMIO space its shared between
+ * cores and that means we don't have to worry about issues like TSC on x86
+ * where each time-stamp-counter (TSC) is local to a particular core.
+ *
+ * Register-level access code is based on
+ * drivers/clocksource/arm_arch_timer.c
+ */
+#include <linux/cpufreq.h>
+#include <linux/of_platform.h>
+
+#include "greybus.h"
+#include "arche_platform.h"
+
+static u32 gb_timesync_clock_frequency;
+int (*arche_platform_change_state_cb)(enum arche_platform_state state,
+ struct gb_timesync_svc *pdata);
+EXPORT_SYMBOL_GPL(arche_platform_change_state_cb);
+
+u64 gb_timesync_platform_get_counter(void)
+{
+ return (u64)get_cycles();
+}
+
+u32 gb_timesync_platform_get_clock_rate(void)
+{
+ if (unlikely(!gb_timesync_clock_frequency))
+ return cpufreq_get(0);
+
+ return gb_timesync_clock_frequency;
+}
+
+int gb_timesync_platform_lock_bus(struct gb_timesync_svc *pdata)
+{
+ return arche_platform_change_state_cb(ARCHE_PLATFORM_STATE_TIME_SYNC,
+ pdata);
+}
+
+void gb_timesync_platform_unlock_bus(void)
+{
+ arche_platform_change_state_cb(ARCHE_PLATFORM_STATE_ACTIVE, NULL);
+}
+
+static const struct of_device_id arch_timer_of_match[] = {
+ { .compatible = "google,greybus-frame-time-counter", },
+ {},
+};
+
+int __init gb_timesync_platform_init(void)
+{
+ struct device_node *np;
+
+ np = of_find_matching_node(NULL, arch_timer_of_match);
+ if (!np) {
+ /* Tolerate not finding to allow BBB etc to continue */
+ pr_warn("Unable to find a compatible ARMv7 timer\n");
+ return 0;
+ }
+
+ if (of_property_read_u32(np, "clock-frequency",
+ &gb_timesync_clock_frequency)) {
+ pr_err("Unable to find timer clock-frequency\n");
+ return -ENODEV;
+ }
+
+ return 0;
+}
+
+void gb_timesync_platform_exit(void) {}
Re: [GIT PULL] Greybus driver subsystem for 4.9-rc1 [ In reply to ]
On Wed, 2016-09-14 at 20:29 +0200, Greg KH wrote:

trivial note:

> +static size_t gb_timesync_log_frame_time(struct gb_timesync_svc *timesync_svc,
> + char *buf, size_t buflen)
> +{
> + struct gb_svc *svc = timesync_svc->svc;
> + struct gb_host_device *hd;
> + struct gb_timesync_interface *timesync_interface;
> + struct gb_interface *interface;
> + unsigned int len;
> + size_t off;
> +
> + /* AP/SVC */
> + off = snprintf(buf, buflen, "%s frametime: ap=%llu %s=%llu ",
> + greybus_bus_type.name,
> + timesync_svc->ap_ping_frame_time, dev_name(&svc->dev),
> + timesync_svc->svc_ping_frame_time);
> + len = buflen - off;
> +
> + /* APB/GPB */
> + if (len < buflen) {
> + hd = timesync_svc->timesync_hd->hd;
> + off += snprintf(&buf[off], len, "%s=%llu ", dev_name(&hd->dev),
> + timesync_svc->timesync_hd->ping_frame_time);
> + len = buflen - off;
> + }
> +
> + list_for_each_entry(timesync_interface,
> + &timesync_svc->interface_list, list) {
> + if (len < buflen) {
> + interface = timesync_interface->interface;
> + off += snprintf(&buf[off], len, "%s=%llu ",
> + dev_name(&interface->dev),
> + timesync_interface->ping_frame_time);
> + len = buflen - off;
> + }
> + }
> + if (len < buflen)
> + off += snprintf(&buf[off], len, "\n");
> + return off;
> +}

The unnecessary trailing blank can be avoided by converting

snprintf(, "format ', ...);
for (...)
snprintf(, "format ", ...);
snprintf(, "\n");

to

snprintf(, "format', ...);
for (...)
snprintf(, " format", ...);
snprintf(, "\n");

>
Re: [GIT PULL] Greybus driver subsystem for 4.9-rc1 [ In reply to ]
On Wed, Sep 14, 2016 at 1:07 PM, Greg KH <gregkh@linuxfoundation.org> wrote:
> On Wed, Sep 14, 2016 at 06:36:26PM +0100, Mark Rutland wrote:
>> Hi Greg,
>>
>> On Wed, Sep 14, 2016 at 12:09:49PM +0200, Greg KH wrote:
>> > Given that it's never a good idea to keep subsystems out of the mainline
>> > kernel, I've put together this pull request that adds the greybus driver
>> > layer to drivers/greybus/. Because this was 2 1/2 years of work, with
>> > many many developers contributing, I didn't want to flatten all of their
>> > effort into a few small patches, as that wouldn't be very fair. So I've
>> > built a git tree with all of the changes going back to the first commit,
>> > and merged it into the kernel tree, just like btrfs was merged into the
>> > kernel.
>>
>> > Unless people point out some major problems with this, I'd like to get
>> > it merged into 4.9-rc1.
>>
>> I'm extremely concerned that these patches have *never* seen upstream
>> review, and this pull request gives no real opportunity for people to
>> make a judgement regarding the code, as many relevant parties have not
>> been Cc'd.
>
> As I said, I will send a set of simple patches, I wanted to get this out
> as soon as possible and other things came up today. Will do it in the
> morning, sorry.
>
>> From a quick scan of the git tree, I can see code (that isn't even
>> placed under staging/) for which I have fundamental objections to as a
>> maintainer, and has not been Cc'd to a relevant list.
>>
>> For example, I see commit 5a450477311fbfe2 ("greybus: timesync: Add
>> timesync core driver"). This states that it directly accesses the ARMv7
>> architected timer, though it's unclear as to precisely what it's doing
>> since it introduces an (undocumented) compatible string, and what should
>> be an unnecessary devicetree property.
>>
>> That's never gone to the linux-arm-kernel mainline list, myself or Marc
>> (as maintainers of the arch timer driver), nor has the binding seen any
>> review on the devicetree mailing list.
>
> Hm, odd, I thought we had Rob review all of the device tree bindings,
> but maybe the timesync stuff missed him. And timesync is "odd" to say
> the least, wait until you see the firmware side of it :)

I have not. There weren't any when I was involved (other than SOC
related bindings). Some like USB devices were discussed at least, but
at the time there was no common definition of how to deal with
soldered, on-board USB devices. And that was also what's good enough
to move forward with development, not ready for mainline. There's a
binding now for USB, but what's there for arche predates it IIRC. This
is the first I've heard of timesync having a binding. I can't imagine
why it needs one.

I was going to stay out of this, but now that I'm here...

I'm not all that worried about the quality of the code, but do
question whether this really makes sense to merge at this time. While
I worked on Ara and would like to see all this code be used, I'm
pretty doubtful it will be. Yes, Motorola is using a version of it,
but they forked it some time back and changed who knows what. So what
is upstream won't likely even work with any publicly available device.
And how long that Motorola phone lasts is unknown. Sure it is self
contained, but maintenance to keep it in tree is not 0.

There's also things that never got solved. Like how do you describe
devices on I2C, SPI, UART, etc. behind a greybus device? The plan was
to use DT overlays, but that was never solved and brings a whole set
of problems to solve upstream.

Rob
Re: [GIT PULL] Greybus driver subsystem for 4.9-rc1 [ In reply to ]
On Wed, 2016-09-14 at 20:29 +0200, Greg KH wrote:
> On Wed, Sep 14, 2016 at 08:07:54PM +0200, Greg KH wrote:
> >
> > On Wed, Sep 14, 2016 at 06:36:26PM +0100, Mark Rutland wrote:
> > >
> > > Hi Greg,
> > >
> > > On Wed, Sep 14, 2016 at 12:09:49PM +0200, Greg KH wrote:
> > > >
> > > > Given that it's never a good idea to keep subsystems out of the
> > > > mainline
> > > > kernel, I've put together this pull request that adds the
> > > > greybus driver
> > > > layer to drivers/greybus/.  Because this was 2 1/2 years of
> > > > work, with
> > > > many many developers contributing, I didn't want to flatten all
> > > > of their
> > > > effort into a few small patches, as that wouldn't be very
> > > > fair.  So I've
> > > > built a git tree with all of the changes going back to the
> > > > first commit,
> > > > and merged it into the kernel tree, just like btrfs was merged
> > > > into the
> > > > kernel.
> > > >
> > > > Unless people point out some major problems with this, I'd like
> > > > to get
> > > > it merged into 4.9-rc1.
> > > I'm extremely concerned that these patches have *never* seen
> > > upstream
> > > review, and this pull request gives no real opportunity for
> > > people to
> > > make a judgement regarding the code, as many relevant parties
> > > have not
> > > been Cc'd.
> > As I said, I will send a set of simple patches, I wanted to get
> > this out
> > as soon as possible and other things came up today.  Will do it in
> > the
> > morning, sorry.
> Here's the timesync code pulled out into a simple patch if you want
> to
> see it.
>
> Bryan, any explanations you want to provide that would help in
> clarifying Mark's issues?

As Douglas Adams would say - "don't panic".

If you look at the final state the code ends up in - we're doing
get_cycles(); as opposed to reading an architectural timer directly.

u64 gb_timesync_platform_get_counter(void)
{
        return (u64)get_cycles();
}

You have the entire git history - from the early days where we were reading one of the unused ARMv8 timers the MSM8994 has to the later days where we just do get_cycles()...

At the time when we first started writing the code it wasn't 100% clear if get_cycles() would do, so it was safer to allocate an unused architectural timer and read it directly. Later on and with some experimentation it was possible to switch to get_cycles().

---
bod
Re: [GIT PULL] Greybus driver subsystem for 4.9-rc1 [ In reply to ]
On Thu, Sep 15, 2016 at 10:35:33AM +0100, Bryan O'Donoghue wrote:
> On Wed, 2016-09-14 at 20:29 +0200, Greg KH wrote:
> > Bryan, any explanations you want to provide that would help in
> > clarifying Mark's issues?
>
> As Douglas Adams would say - "don't panic".
>
> If you look at the final state the code ends up in - we're doing
> get_cycles(); as opposed to reading an architectural timer directly.
>
> u64 gb_timesync_platform_get_counter(void)
> {
>         return (u64)get_cycles();
> }

I did in fact notice this, though my wording was somewhat unclear on
that part.

> You have the entire git history - from the early days where we were
> reading one of the unused ARMv8 timers the MSM8994 has to the later
> days where we just do get_cycles()...
>
> At the time when we first started writing the code it wasn't 100%
> clear if get_cycles() would do, so it was safer to allocate an unused
> architectural timer and read it directly. Later on and with some
> experimentation it was possible to switch to get_cycles().

I don't think the history matters, and I don't think that one can rely
on get_cycles() in this manner outside of arch code. Looking at the
state of the tree [1] as of the final commit [2] in the greybus branch,
my points still stand:

* The "google,greybus-frame-time-counter" node is superfluous. It does
not describe a particular device, and duplicates information we have
elsewhere. It does not explicitly define the relationship with the
underlying clocksource.

* The clock-frequency property isn't necessary. The architected timer
drivers know the frequency of the architected timers (MMIO or sysreg),
and they should be queried as to the frequency.

* In general, get_cycles() isn't guaranteed to be any clocksource or
cycle counter in particular, so even if the clock-frequency property
matches the architected timer, that doesn't help.

Beyond that, the fallback code using cpufreq and presumably an actual
cycle counter will be broken in a number of cases -- cycle counts will
not match across CPUs, and on CPUs whic gate clocks in WFI/WFE, they'll
drift randomly.

Per the comment at the top of the file, it looks like you want a
system-wide stable clocksource. If you want that, you need to use a
generic API that allows drivers and arch code to actually provide that,
rather than building one yourself that doesn't work.

If you're trying to synchronise with other agents in the system that are
reading from the MMIO arch timers, then that relationship should be
described explicitly in the DT.

Thanks,
Mark.

[1] https://git.kernel.org/cgit/linux/kernel/git/gregkh/char-misc.git/tree/drivers/greybus/timesync_platform.c?h=greybus&id=f86bfc90a401681838866b5f6826d86cc4c7010c
[2] https://git.kernel.org/cgit/linux/kernel/git/gregkh/char-misc.git/commit/?h=greybus&id=f86bfc90a401681838866b5f6826d86cc4c7010c
Re: [GIT PULL] Greybus driver subsystem for 4.9-rc1 [ In reply to ]
On Wed, Sep 14, 2016 at 03:07:22PM -0500, Rob Herring wrote:
> On Wed, Sep 14, 2016 at 1:07 PM, Greg KH <gregkh@linuxfoundation.org> wrote:
> > On Wed, Sep 14, 2016 at 06:36:26PM +0100, Mark Rutland wrote:
> >> Hi Greg,
> >>
> >> On Wed, Sep 14, 2016 at 12:09:49PM +0200, Greg KH wrote:
> >> > Given that it's never a good idea to keep subsystems out of the mainline
> >> > kernel, I've put together this pull request that adds the greybus driver
> >> > layer to drivers/greybus/. Because this was 2 1/2 years of work, with
> >> > many many developers contributing, I didn't want to flatten all of their
> >> > effort into a few small patches, as that wouldn't be very fair. So I've
> >> > built a git tree with all of the changes going back to the first commit,
> >> > and merged it into the kernel tree, just like btrfs was merged into the
> >> > kernel.
> >>
> >> > Unless people point out some major problems with this, I'd like to get
> >> > it merged into 4.9-rc1.
> >>
> >> I'm extremely concerned that these patches have *never* seen upstream
> >> review, and this pull request gives no real opportunity for people to
> >> make a judgement regarding the code, as many relevant parties have not
> >> been Cc'd.
> >
> > As I said, I will send a set of simple patches, I wanted to get this out
> > as soon as possible and other things came up today. Will do it in the
> > morning, sorry.
> >
> >> From a quick scan of the git tree, I can see code (that isn't even
> >> placed under staging/) for which I have fundamental objections to as a
> >> maintainer, and has not been Cc'd to a relevant list.
> >>
> >> For example, I see commit 5a450477311fbfe2 ("greybus: timesync: Add
> >> timesync core driver"). This states that it directly accesses the ARMv7
> >> architected timer, though it's unclear as to precisely what it's doing
> >> since it introduces an (undocumented) compatible string, and what should
> >> be an unnecessary devicetree property.
> >>
> >> That's never gone to the linux-arm-kernel mainline list, myself or Marc
> >> (as maintainers of the arch timer driver), nor has the binding seen any
> >> review on the devicetree mailing list.
> >
> > Hm, odd, I thought we had Rob review all of the device tree bindings,
> > but maybe the timesync stuff missed him. And timesync is "odd" to say
> > the least, wait until you see the firmware side of it :)
>
> I have not. There weren't any when I was involved (other than SOC
> related bindings). Some like USB devices were discussed at least, but
> at the time there was no common definition of how to deal with
> soldered, on-board USB devices. And that was also what's good enough
> to move forward with development, not ready for mainline. There's a
> binding now for USB, but what's there for arche predates it IIRC. This
> is the first I've heard of timesync having a binding. I can't imagine
> why it needs one.

Ah, I'll let Bryan answer that one :)

> I was going to stay out of this, but now that I'm here...
>
> I'm not all that worried about the quality of the code, but do
> question whether this really makes sense to merge at this time. While
> I worked on Ara and would like to see all this code be used, I'm
> pretty doubtful it will be. Yes, Motorola is using a version of it,
> but they forked it some time back and changed who knows what. So what
> is upstream won't likely even work with any publicly available device.
> And how long that Motorola phone lasts is unknown. Sure it is self
> contained, but maintenance to keep it in tree is not 0.

We have people who are willing to maintain it (me and Johan) and others
on the cc: have expressed interest in doing things with it (Rui has
great ideas about extending gbsim in ways to make it easier to test and
use).

And there is never a restriction on accepting kernel code for "publicly
availble devices only", remember, we have ripped CPU code out of the
kernel for chips that never shipped. It just has to not affect others
in ways that would affect them.

I merge new driver subsystems to the kernel every release that are much
larger than this, and have almost no users out there, so this shouldn't
be a surprise to anyone (who here has a most-bus device? A unisys
visorbus device? MCB device? I can go on :)

And with gbsim, you can run this code today on your laptop, or directly
on a target system like a beagle bone black or minnowboard. There's a
talk about how to use greybus over IP at ELC in a few weeks, and someone
is working on porting the firmware side to an arduino to make it simper
to control the devices on such a target from a host computer using the
greybus protocol.

And getting Motorola to merge back in with this upstream code is a good
goal, having it upstream is a neutral place where everyone can work
together on it. Keeping it in a random github project makes forks
almost inevitable, as we all know.

> There's also things that never got solved. Like how do you describe
> devices on I2C, SPI, UART, etc. behind a greybus device? The plan was
> to use DT overlays, but that was never solved and brings a whole set
> of problems to solve upstream.

That is only an issue if you want to bind a kernel driver for an
existing i2c/spi chip to an i2c/spi greybus device. With the code we
have today, we do it for a specific SPI chip (for firmware download),
but rely on everything to be userspace-only accesses to make it simpler
at this point in time.

When DT overlays get more settled down, yes, I want to revisit this idea
of how to do it for greybus devices, but that's a long-term goal and is
not required at all right now to have a working system and devices.

thanks,

greg k-h
Re: [GIT PULL] Greybus driver subsystem for 4.9-rc1 [ In reply to ]
On Thu, 2016-09-15 at 11:13 +0100, Mark Rutland wrote:
> On Thu, Sep 15, 2016 at 10:35:33AM +0100, Bryan O'Donoghue wrote:
> > 
> I don't think the history matters,

Your comment seemed to indicate you thought we were reading a
architectural timer directly - which we aren't.

> and I don't think that one can rely
> on get_cycles() in this manner outside of arch code.

I don't follow your meaning. What's wrong with get_cycles() ? You've
already said you don't think reading an architectural timer directly is
correct.

The objective is to read one of the free-running counters in MSM8994,
clocked by the PMIC. The refclk provided by PMIC is distributed to each
processor in the system.

> Looking at the
> state of the tree [1] as of the final commit [2] in the greybus
> branch,
> my points still stand:
>
> * The "google,greybus-frame-time-counter" node is superfluous. It
> does
>   not describe a particular device,

It describes a timer running @ 19.2MHz, clocked by PMIC refclk.

> and duplicates information we have
>   elsewhere.

Can you give an example ?

> It does not explicitly define the relationship with the
>   underlying clocksource.


> * The clock-frequency property isn't necessary. The architected timer
>   drivers know the frequency of the architected timers (MMIO or
> sysreg),
>   and they should be queried as to the frequency.

OK so if I'm understanding you. You think get_cycles() is fine but that
instead of encoding a "greybus-frame-time-counter" the platform code
should interrogate the frequency provided - is that correct ?

> Beyond that, the fallback code using cpufreq and presumably an actual
> cycle counter will be broken in a number of cases

Of course the fallback will be broken... it's not supposed to work if
you don't have a timer that can be used - just compile, run and print a
complaint - i.e., this won't really do FrameTime on an x86... then
again since so much of the underlying greybus/unipro hardware -
requires a 19.2MHz refclk - if you were to try to do greybus on x86
you'd need to solve that problem.

>
> Per the comment at the top of the file, it looks like you want a
> system-wide stable clocksource. If you want that, you need to use a
> generic API that allows drivers and arch code to actually provide
> that,
> rather than building one yourself that doesn't work.

Hmm. The objective is to read one of the timers clocked by the PMIC
refclk input. refclk is provided to each processor in the system - and
on MSM8994 clocks the MMIO timers. It's used to drive the PLL on the
other processors - which in turn drive the timers that the Modules use
to read their own local counters. We want to read that counter on MSM
directly - get_cycles() has worked nicely so far.

>
> If you're trying to synchronise with other agents in the system that
> are
> reading from the MMIO arch timers,

No. The MMIO timers are useful only to the MSM. We don't have any type
of parallel (or serial) bus that can access that on-chip resource.

MSM8994 -- > USB
             APBridge (timer) -> UniPro bus
                                            -> Module with a UART
                                            -> Module with a GPIO
                                            -> Module with an etc, etc
                              -> SPI bus
                                            -> SVC
                                               Owns FrameTime

So the SVC owns FrameTime and diseminates that to other entities in the
system by way of a GPIO and greybus. It's up to the MSM8994 to select a
timer that works for it - the other processors in the system are
responsible for their own timers.

---
bod
Re: [GIT PULL] Greybus driver subsystem for 4.9-rc1 [ In reply to ]
On Thu, 2016-09-15 at 11:35 +0100, Bryan O'Donoghue wrote:
>

Here's a slightly better diagram.

PMIC -> refclk provided to each (timer) element below.

MSM8994(timer) -- > USB
WD8a
               APBridgeA (timer) -> UniPro bus
               WD8a
                                            -> Module(timer) with UART
                                               WD1
                                            -> Module(timer) with GPIO
                                               WD2
                                            -> Module(timer) with blah
                                               WD3
                              -> SPI bus
                                            -> SVC(timer)
                                               Owns FrameTime
                                               GPIO {WD0...WDn}

So yes, each processor has it's own timer. We aren't trying to read the
MSM's FrameTime.

---
bod
Re: [GIT PULL] Greybus driver subsystem for 4.9-rc1 [ In reply to ]
On Thu, 2016-09-15 at 12:17 +0200, Greg KH wrote:
> This
> > is the first I've heard of timesync having a binding. I can't
> imagine
> > why it needs one.
>
> Ah, I'll let Bryan answer that one :)

It's possible we could drop the binding. It was needed to describe the
register location of the MMIO architectural register on MSM8994. I have
this binding ATM the describe fact that get_cycles() on MSM8994 returns
a free-running counter, clocked by refclk and that refclk is provided
to each processor that want to do FrameTime - i.e. the clock driving
get_cycles() comes from PMIC and drives the relevant PLLs on the
downstream processors clocking their respective TMR blocks.

static const struct of_device_id arch_timer_of_match[] = {
        { .compatible   = "google,greybus-frame-time-counter", },
        {},
};

I'm not aware of a corresponding kernel API that describes the
frequency get_cycles() operates at but if there is one then there's no
need for this binding.
Re: [GIT PULL] Greybus driver subsystem for 4.9-rc1 [ In reply to ]
Hi,

More questions below. Perhaps some of these will be implicitly answered
when the linearised patches appear, and I'm happy to wait until then to
continue the discussion, as I suspect otherwise we're all likely to end
up exasperated.

Please do Cc me on those.

Regardless, until those appear and a reasonable time has been given for
replies, my comments regarding the lack of review stand, as does my NAK
for the series.

On Thu, Sep 15, 2016 at 11:35:56AM +0100, Bryan O'Donoghue wrote:
> On Thu, 2016-09-15 at 11:13 +0100, Mark Rutland wrote:
> > On Thu, Sep 15, 2016 at 10:35:33AM +0100, Bryan O'Donoghue wrote:
> > > 
> > I don't think the history matters,
>
> Your comment seemed to indicate you thought we were reading a
> architectural timer directly - which we aren't.

Sure, and as I pointed out, the comment in the HEAD commit still claims
it does, even if the code doesn't. This is at best, confusing, and the
history of how it came to be there doesn't really matter...

> > and I don't think that one can rely
> > on get_cycles() in this manner outside of arch code.
>
> I don't follow your meaning. What's wrong with get_cycles() ? You've
> already said you don't think reading an architectural timer directly is
> correct.

I pointed out a number of issues in my previous reply.

For example, you have absolutely no guarantee as to what backs
get_cycles(). Despite this, the code assumes that get_cycles() is backed
by something running at the frequency described in a
"google,greybus-frame-time-counter" node.

Even if this *happens* to match what some piece of arch code provides
today on some platform, it is in no way *guaranteed*.

> The objective is to read one of the free-running counters in MSM8994,
> clocked by the PMIC. The refclk provided by PMIC is distributed to each
> processor in the system.
>
> > Looking at the
> > state of the tree [1] as of the final commit [2] in the greybus
> > branch,
> > my points still stand:
> >
> > * The "google,greybus-frame-time-counter" node is superfluous. It
> > does
> >   not describe a particular device,
>
> It describes a timer running @ 19.2MHz, clocked by PMIC refclk.

... which you assume is whatever backs get_cycles(), which you in
practice assume is the architected timer. For which we *already* have a
binding and driver.

Given that, as far as I can tell, "google,greybus-frame-time-counter"
describes a software construct that uses this, not an actual piece of
hardware.

> > and duplicates information we have   elsewhere.
>
> Can you give an example ?

Trivially, the CNTFRQ register in the architected timer (which is common
across MMIO/sysreg), which you can query with arch_timer_get_rate().

Note that isn't guaranteed to match get_cycles() either. You need a
better API to call.

> > * The clock-frequency property isn't necessary. The architected timer
> >   drivers know the frequency of the architected timers (MMIO or
> > sysreg),
> >   and they should be queried as to the frequency.
>
> OK so if I'm understanding you. You think get_cycles() is fine but that
> instead of encoding a "greybus-frame-time-counter" the platform code
> should interrogate the frequency provided - is that correct ?

You should definitely interrogate the relevant driver, somehow.

Without a higher-level view of what you're trying to achieve, it's not
clear to me whether get_cycles() is the right interface.

> > Beyond that, the fallback code using cpufreq and presumably an actual
> > cycle counter will be broken in a number of cases
>
> Of course the fallback will be broken... it's not supposed to work if
> you don't have a timer that can be used - just compile, run and print a
> complaint - i.e., this won't really do FrameTime on an x86... then
> again since so much of the underlying greybus/unipro hardware -
> requires a 19.2MHz refclk - if you were to try to do greybus on x86
> you'd need to solve that problem.

If it's never going to work, why give the illusion that it might?

If you don't have the necessary prerequisites, fail to probe entirely.
Prevent drivers that depend on the non-existent functionality from
probing, or have them avoid the facility which is not available.

Don't provide them with something that can appear to work for a while,
yet will fall over in a breeze.

> > Per the comment at the top of the file, it looks like you want a
> > system-wide stable clocksource. If you want that, you need to use a
> > generic API that allows drivers and arch code to actually provide
> > that, rather than building one yourself that doesn't work.
>
> Hmm. The objective is to read one of the timers clocked by the PMIC
> refclk input. refclk is provided to each processor in the system - and
> on MSM8994 clocks the MMIO timers. It's used to drive the PLL on the
> other processors - which in turn drive the timers that the Modules use
> to read their own local counters. We want to read that counter on MSM
> directly - get_cycles() has worked nicely so far.

This is too low-level for me to see what you're actually trying to
achieve. The fact that you want to read a specific timer is an
implementation detail.

Why can't you use any other timer? Correctness? Performance? (Why) is
the fact that the PLL drives module timers important?

> > If you're trying to synchronise with other agents in the system that
> > are reading from the MMIO arch timers,
>
> No. The MMIO timers are useful only to the MSM. We don't have any type
> of parallel (or serial) bus that can access that on-chip resource.

To be clear, by "other agents in the system", I'm also asking about
other devices within the SoC (e.g. anything other than the CPUs running
this instance of Linux).

> MSM8994 -- > USB
>              APBridge (timer) -> UniPro bus
>                                             -> Module with a UART
>                                             -> Module with a GPIO
>                                             -> Module with an etc, etc
>                               -> SPI bus
>                                             -> SVC
>                                                Owns FrameTime
>
> So the SVC owns FrameTime and diseminates that to other entities in the
> system by way of a GPIO and greybus. It's up to the MSM8994 to select a
> timer that works for it - the other processors in the system are
> responsible for their own timers.

Sorry, but this doesn't clarify much from my PoV.

* What are the requirements for that timer?

* Is there_any_ implicit relationship with the module timers derived
from the fact they share a parent PLL? Is that a requirement somehow?

Thanks,
Mark.
Re: [GIT PULL] Greybus driver subsystem for 4.9-rc1 [ In reply to ]
On Thu, 2016-09-15 at 12:20 +0100, Mark Rutland wrote:
> Hi,
>
> More questions below. Perhaps some of these will be implicitly
> answered
> when the linearised patches appear, and I'm happy to wait until then
> to
> continue the discussion, as I suspect otherwise we're all likely to
> end
> up exasperated.
>
> Please do Cc me on those.
>
> Regardless, until those appear and a reasonable time has been given
> for
> replies, my comments regarding the lack of review stand, as does my
> NAK
> for the series.
>
> On Thu, Sep 15, 2016 at 11:35:56AM +0100, Bryan O'Donoghue wrote:
> >
> > On Thu, 2016-09-15 at 11:13 +0100, Mark Rutland wrote:
> > >
> > > On Thu, Sep 15, 2016 at 10:35:33AM +0100, Bryan O'Donoghue wrote:
> > > >
> > > >  
> > > I don't think the history matters, 
> > Your comment seemed to indicate you thought we were reading a
> > architectural timer directly - which we aren't.
> Sure, and as I pointed out, the comment in the HEAD commit still
> claims
> it does, even if the code doesn't. This is at best, confusing, and
> the
> history of how it came to be there doesn't really matter...

TBH a whole git history will invariably contain things developers did,
thought better of and then backed out as is the case here.

>
> >
> > >
> > > and I don't think that one can rely
> > > on get_cycles() in this manner outside of arch code.
> > I don't follow your meaning. What's wrong with get_cycles() ?
> > You've
> > already said you don't think reading an architectural timer
> > directly is
> > correct.
> I pointed out a number of issues in my previous reply.

On MSM8994 the timer backing get_cycles() is one of the MMIO
architectural timers (which is why I switched over in the end). There's
not much else that can be done bar custom silicon - this particular
timer is as good as it gets, more of a "how do we synchronise time with
the hardware we have" than a "lets design in a feature to synchronise
time" - which was something we were focusing in on for later
silicon... 

>
> For example, you have absolutely no guarantee as to what backs
> get_cycles(). Despite this, the code assumes that get_cycles() is
> backed
> by something running at the frequency described in a
> "google,greybus-frame-time-counter" node.
>
> Even if this *happens* to match what some piece of arch code provides
> today on some platform, it is in no way *guaranteed*.

That's the point though, if you declare "google,greybus-frame-time-
counter" in your platform code - then you can use 'get_cycles()' in
this manner - if not - then you need to take steps in your own new
platform to provide that same level of functionality. You could switch
to an MSM8996 or an MSM8998 declare this node and bob's your uncle.

OTOH declaring this node on x86 would be a bit pointless. You'd be
better off providing a timer on a PCI bar, and binding that into
greybus with some x86/x86-platform code...

>
> >
> > The objective is to read one of the free-running counters in
> > MSM8994,
> > clocked by the PMIC. The refclk provided by PMIC is distributed to
> > each
> > processor in the system.
> >
> > >
> > >  Looking at the
> > > state of the tree [1] as of the final commit [2] in the greybus
> > > branch,
> > > my points still stand:
> > >
> > > * The "google,greybus-frame-time-counter" node is superfluous. It
> > > does
> > >   not describe a particular device,
> > It describes a timer running @ 19.2MHz, clocked by PMIC refclk.
> ... which you assume is whatever backs get_cycles(), which you in
> practice assume is the architected timer. For which we *already* have
> a
> binding and driver.

It's a requirement rather than assumption. If you declare that node,
it's assumed the timer driving get_cycles() does what it says on the
greybus-frame-time-counter tin.

> > >  and duplicates information we have   elsewhere.
> > Can you give an example ?
> Trivially, the CNTFRQ register in the architected timer (which is
> common
> across MMIO/sysreg), which you can query with arch_timer_get_rate().
>
> Note that isn't guaranteed to match get_cycles() either. You need a
> better API to call.

In that case a DT entry makes sense I'd say.

> You should definitely interrogate the relevant driver, somehow.

Hrmm. TBH if we are ruling out arch_timer_get_rate() then I think a DT
entry (which BTW is greybus specific) is the more intelligent way
forward. The greybus platform implementer needs to understand the
dependencies and take action to meet those dependencies should he or
she wish to support this feature.

I'm not opposed necessarily to calling arch_timer_get_rate() instead of
a DT binding, assuming it works, and drawing a line under it for
MSM8994. As I've said it's up to a system architect for other platforms
to go and do the necessary design to support this feature and this will
almost certainly require new platform code both here and in other
places anyway.

>
> Without a higher-level view of what you're trying to achieve, it's
> not
> clear to me whether get_cycles() is the right interface.

I appreciate that.

---
bod
Re: [GIT PULL] Greybus driver subsystem for 4.9-rc1 [ In reply to ]
On Thu, Sep 15, 2016 at 12:48:08PM +0100, Bryan O'Donoghue wrote:
> On Thu, 2016-09-15 at 12:20 +0100, Mark Rutland wrote:
> > For example, you have absolutely no guarantee as to what backs
> > get_cycles(). Despite this, the code assumes that get_cycles() is
> > backed by something running at the frequency described in a
> > "google,greybus-frame-time-counter" node.
> >
> > Even if this *happens* to match what some piece of arch code provides
> > today on some platform, it is in no way *guaranteed*.
>
> That's the point though, if you declare "google,greybus-frame-time-
> counter" in your platform code - then you can use 'get_cycles()' in
> this manner

To be clear, *some* properties (and perhaps additional nodes) may need
to be in the DT, in order to capture the hardware property or
relationship that you are reliant upon.

However, the DT cannot possibly know anything about get_cycles(), as
get_cycles() is a kernel implementation details that's subject to
arbitrary change at any point in time, independent of the DT.

The "google,greybus-frame-time-counter" node, as it stands, does not
capture any relevant hardware detail, and does not belong in the DT.

> > Without a higher-level view of what you're trying to achieve, it's
> > not clear to me whether get_cycles() is the right interface.
>
> I appreciate that.

Until that's clarified, we won't make any progress here.

Thanks,
Mark.
Re: [GIT PULL] Greybus driver subsystem for 4.9-rc1 [ In reply to ]
On Wed, Sep 14, 2016 at 12:09:49PM +0200, Greg KH wrote:

> I'll send out a follow-up set of "simple" patches that just add the
> files to the kernel tree, to give people an idea of the code involved.
> Overall, it's a tiny stand-alone driver subsystem, only 37k lines, that
> implements a protocol which allows for "generic" cameras, audio devices,
> and other class type devices, as well as a bridged "physical" layer
> protocol to talk to serial, spi, uart, pwm, gpio, i2c, and even USB host

Just emphasizing what Mark Rutland said complete NACK, in particular the
drivers for functions have not been posted upstream at all (and it's
concerning that they're all being added under drivers/greybus rather
than within the relevant subsystem like we do normally). I've not
looked at the code as it has not been submitted but given that and that
the reason I found this pull request was an ASoC contributor who had
seen it and looked at the code going "oh dear, greybus..." on IRC I'm
very concerned.

Sending a pull request for code that's never been seen upstream seems
completely premature.
Re: [GIT PULL] Greybus driver subsystem for 4.9-rc1 [ In reply to ]
On Thu, 2016-09-15 at 13:46 +0100, Mark Rutland wrote:
> On Thu, Sep 15, 2016 at 12:48:08PM +0100, Bryan O'Donoghue wrote:
> >
> > On Thu, 2016-09-15 at 12:20 +0100, Mark Rutland wrote:
> > >
> > > For example, you have absolutely no guarantee as to what backs
> > > get_cycles(). Despite this, the code assumes that get_cycles() is
> > > backed by something running at the frequency described in a
> > > "google,greybus-frame-time-counter" node.
> > >
> > > Even if this *happens* to match what some piece of arch code
> > > provides
> > > today on some platform, it is in no way *guaranteed*.
> > That's the point though, if you declare "google,greybus-frame-time-
> > counter" in your platform code - then you can use 'get_cycles()' in
> > this manner
> To be clear, *some* properties (and perhaps additional nodes) may
> need
> to be in the DT, in order to capture the hardware property or
> relationship that you are reliant upon.

Sure but on the relevant platform we know 

1. get_cycles() is derived from an architectured MMIO timer
2. What is clocking that timer

So any platform that declares that property must be aware of what its
doing.

For clarity this is the alternative to reading another register
directly bypassing get_cycles().


> >
> > >
> > > Without a higher-level view of what you're trying to achieve,
> > > it's
> > > not clear to me whether get_cycles() is the right interface.
> > I appreciate that.
> Until that's clarified, we won't make any progress here.

Let's see. We're synchronizing a set of distributed timers via a GPIO
pulse. Each processor on the system has at least one timer block
directly driven by the refclk@19.2MHz or a PLL driven by refclk@19.2MHz

FrameTime is a 64 bit free-running counter running @19.2MHz that is
used as a common source of reference for events. On the MSM side this
implies reading one of the timers driven by that refclk directly.

The choices on MSM8994 to access one of those timer blocks are

1. Read the register directly as is done in earlier patches or
2. Read get_cycles() as is done in later patches.

It's no more complex than that.

---
bod
Re: [GIT PULL] Greybus driver subsystem for 4.9-rc1 [ In reply to ]
On Thu, Sep 15, 2016 at 04:40:00PM +0100, Bryan O'Donoghue wrote:
> On Thu, 2016-09-15 at 13:46 +0100, Mark Rutland wrote:
> > On Thu, Sep 15, 2016 at 12:48:08PM +0100, Bryan O'Donoghue wrote:
> > > On Thu, 2016-09-15 at 12:20 +0100, Mark Rutland wrote:
> > > > For example, you have absolutely no guarantee as to what backs
> > > > get_cycles(). Despite this, the code assumes that get_cycles() is
> > > > backed by something running at the frequency described in a
> > > > "google,greybus-frame-time-counter" node.
> > > >
> > > > Even if this *happens* to match what some piece of arch code
> > > > provides
> > > > today on some platform, it is in no way *guaranteed*.
> > > That's the point though, if you declare "google,greybus-frame-time-
> > > counter" in your platform code - then you can use 'get_cycles()' in
> > > this manner
> > To be clear, *some* properties (and perhaps additional nodes) may
> > need
> > to be in the DT, in order to capture the hardware property or
> > relationship that you are reliant upon.
>
> Sure but on the relevant platform we know 
>
> 1. get_cycles() is derived from an architectured MMIO timer
> 2. What is clocking that timer
>
> So any platform that declares that property must be aware of what its
> doing.

I can't say this any more explicitly:

****************************************************
* The DT *cannot* know anything about get_cycles() *
****************************************************

It's no more complex than that.

Thanks,
Mark.
Re: [GIT PULL] Greybus driver subsystem for 4.9-rc1 [ In reply to ]
On Thu, 2016-09-15 at 16:47 +0100, Mark Rutland wrote:
> On 
> I can't say this any more explicitly:
>
> ****************************************************
> * The DT *cannot* know anything about get_cycles() *
> ****************************************************
>
> It's no more complex than that.

Sure think Mark I understand your point.

I think to satisfy your objection the most sensible change to make is
using arch_timer_get_rate() compared to a desired rate of 19200000.

---
bod
Re: [GIT PULL] Greybus driver subsystem for 4.9-rc1 [ In reply to ]
On Thu, Sep 15, 2016 at 03:45:53PM +0100, Mark Brown wrote:
> On Wed, Sep 14, 2016 at 12:09:49PM +0200, Greg KH wrote:
>
> > I'll send out a follow-up set of "simple" patches that just add the
> > files to the kernel tree, to give people an idea of the code involved.
> > Overall, it's a tiny stand-alone driver subsystem, only 37k lines, that
> > implements a protocol which allows for "generic" cameras, audio devices,
> > and other class type devices, as well as a bridged "physical" layer
> > protocol to talk to serial, spi, uart, pwm, gpio, i2c, and even USB host
>
> Just emphasizing what Mark Rutland said complete NACK, in particular the
> drivers for functions have not been posted upstream at all (and it's
> concerning that they're all being added under drivers/greybus rather
> than within the relevant subsystem like we do normally). I've not
> looked at the code as it has not been submitted but given that and that
> the reason I found this pull request was an ASoC contributor who had
> seen it and looked at the code going "oh dear, greybus..." on IRC I'm
> very concerned.
>
> Sending a pull request for code that's never been seen upstream seems
> completely premature.

Hey, how does code get upstream then? :)

Anyway, as vger seems to be marking all of the greybus patches I send
out as "spam" according to a filter, it's making it a bit hard to send
patches out, but I'll try it again "by hand" later today...

As for the drivers all living under drivers/greybus/ I understand, but
we need the greybus core present first before we can get the drivers in.
How about we do what happened with IIO, we take the greybus core code in
drivers/greybus/ and put the drivers in staging, and then move them out
of staging into the "real" portion of the kernel as they get reviewed
and accepted?

Any objections to that workflow?

thanks,

greg k-h
Re: [GIT PULL] Greybus driver subsystem for 4.9-rc1 [ In reply to ]
On Fri, Sep 16, 2016 at 08:05:19AM +0200, Greg KH wrote:
> On Thu, Sep 15, 2016 at 03:45:53PM +0100, Mark Brown wrote:

> > Sending a pull request for code that's never been seen upstream seems
> > completely premature.

> Hey, how does code get upstream then? :)

By having the actual code to the mailing list.

> As for the drivers all living under drivers/greybus/ I understand, but
> we need the greybus core present first before we can get the drivers in.
> How about we do what happened with IIO, we take the greybus core code in
> drivers/greybus/ and put the drivers in staging, and then move them out
> of staging into the "real" portion of the kernel as they get reviewed
> and accepted?

Yes, staging would be appropriate for unreviewed code.
Re: [GIT PULL] Greybus driver subsystem for 4.9-rc1 [ In reply to ]
On Friday, September 16, 2016 8:05:19 AM CEST Greg KH wrote:
> On Thu, Sep 15, 2016 at 03:45:53PM +0100, Mark Brown wrote:
> > On Wed, Sep 14, 2016 at 12:09:49PM +0200, Greg KH wrote:
> >
> > > I'll send out a follow-up set of "simple" patches that just add the
> > > files to the kernel tree, to give people an idea of the code involved.
> > > Overall, it's a tiny stand-alone driver subsystem, only 37k lines, that
> > > implements a protocol which allows for "generic" cameras, audio devices,
> > > and other class type devices, as well as a bridged "physical" layer
> > > protocol to talk to serial, spi, uart, pwm, gpio, i2c, and even USB host
> >
> > Just emphasizing what Mark Rutland said complete NACK, in particular the
> > drivers for functions have not been posted upstream at all (and it's
> > concerning that they're all being added under drivers/greybus rather
> > than within the relevant subsystem like we do normally). I've not
> > looked at the code as it has not been submitted but given that and that
> > the reason I found this pull request was an ASoC contributor who had
> > seen it and looked at the code going "oh dear, greybus..." on IRC I'm
> > very concerned.
> >
> > Sending a pull request for code that's never been seen upstream seems
> > completely premature.
>
> Hey, how does code get upstream then? :)
>
> Anyway, as vger seems to be marking all of the greybus patches I send
> out as "spam" according to a filter, it's making it a bit hard to send
> patches out, but I'll try it again "by hand" later today...
>
> As for the drivers all living under drivers/greybus/ I understand, but
> we need the greybus core present first before we can get the drivers in.
> How about we do what happened with IIO, we take the greybus core code in
> drivers/greybus/ and put the drivers in staging, and then move them out
> of staging into the "real" portion of the kernel as they get reviewed
> and accepted?
>
> Any objections to that workflow?

I think that will work fine. If we can review just the core code,
the patch series probably gets small enough that more people
are inclined to take a closer look. At least speaking for me
personally, reviewing 32 nontrivial patches at once is unlikely
to happen.

From a brief look, I found that at least the smaller device drivers
should be uncontroversial and won't have a problem getting merged
into the subsystem directories once they have be reviewed by the
respective maintainers.

Some drivers are larger (audio sticks out by quite a bit) and are
more likely to be controversial. Some other drivers (e.g. vibrator
or bootrom) don't have an obvious subsystem they belong into,
which can also cause problems, but having them in staging in the
meantime seems fine.

Arnd
Re: [GIT PULL] Greybus driver subsystem for 4.9-rc1 [ In reply to ]
On Fri, Sep 16, 2016 at 11:18:07AM +0100, Mark Brown wrote:
> On Fri, Sep 16, 2016 at 08:05:19AM +0200, Greg KH wrote:
> > On Thu, Sep 15, 2016 at 03:45:53PM +0100, Mark Brown wrote:
>
> > > Sending a pull request for code that's never been seen upstream seems
> > > completely premature.
>
> > Hey, how does code get upstream then? :)
>
> By having the actual code to the mailing list.

Ugh, vger keeps blocking the patches, I'm going to try for a third time
now...

> > As for the drivers all living under drivers/greybus/ I understand, but
> > we need the greybus core present first before we can get the drivers in.
> > How about we do what happened with IIO, we take the greybus core code in
> > drivers/greybus/ and put the drivers in staging, and then move them out
> > of staging into the "real" portion of the kernel as they get reviewed
> > and accepted?
>
> Yes, staging would be appropriate for unreviewed code.

Sounds good.

thanks,

greg k-h
Re: [GIT PULL] Greybus driver subsystem for 4.9-rc1 [ In reply to ]
On Fri, Sep 16, 2016 at 03:22:08PM +0200, Greg KH wrote:
> On Fri, Sep 16, 2016 at 11:18:07AM +0100, Mark Brown wrote:
> > On Fri, Sep 16, 2016 at 08:05:19AM +0200, Greg KH wrote:
> > > On Thu, Sep 15, 2016 at 03:45:53PM +0100, Mark Brown wrote:
> >
> > > > Sending a pull request for code that's never been seen upstream seems
> > > > completely premature.
> >
> > > Hey, how does code get upstream then? :)
> >
> > By having the actual code to the mailing list.
>
> Ugh, vger keeps blocking the patches, I'm going to try for a third time
> now...

third time seems to have worked, except for patch 01/32, which was only
a single .h file. That file can be seen here if people are curious:
https://git.kernel.org/cgit/linux/kernel/git/gregkh/char-misc.git/tree/drivers/greybus/greybus_protocols.h?h=greybus

I'll now respin the series, moving everything into
drivers/staging/greybus/ and leave it there for 4.9. Then we can work
on moving the core out, and then the drivers to the needed locations.

thanks,

greg k-h
Re: [GIT PULL] Greybus driver subsystem for 4.9-rc1 [ In reply to ]
On Fri, Sep 16, 2016 at 04:24:59PM +0200, Greg KH wrote:
> On Fri, Sep 16, 2016 at 03:22:08PM +0200, Greg KH wrote:
> > On Fri, Sep 16, 2016 at 11:18:07AM +0100, Mark Brown wrote:
> > > On Fri, Sep 16, 2016 at 08:05:19AM +0200, Greg KH wrote:
> > > > On Thu, Sep 15, 2016 at 03:45:53PM +0100, Mark Brown wrote:
> > >
> > > > > Sending a pull request for code that's never been seen upstream seems
> > > > > completely premature.
> > >
> > > > Hey, how does code get upstream then? :)
> > >
> > > By having the actual code to the mailing list.
> >
> > Ugh, vger keeps blocking the patches, I'm going to try for a third time
> > now...
>
> third time seems to have worked, except for patch 01/32, which was only
> a single .h file. That file can be seen here if people are curious:
> https://git.kernel.org/cgit/linux/kernel/git/gregkh/char-misc.git/tree/drivers/greybus/greybus_protocols.h?h=greybus
>
> I'll now respin the series, moving everything into
> drivers/staging/greybus/ and leave it there for 4.9. Then we can work
> on moving the core out, and then the drivers to the needed locations.

This is now all in drivers/staging/greybus/ and will show up in the next
linux-next.

And because of this, we already have a checkpatch.pl cleanup patch sent
to us for the code for things we missed :)

thanks,

greg k-h

1 2  View All