Modify return statement to use the value being returned directly instead of
assigning it first to 'ret' and returning this variable. Coccinelle semantic
patch used:
@@
expression e;
local idexpression ret;
@@
-ret =
+return
e;
-return ret;
Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Eliminate unneeded parentheses around the right hand side of an assignment.
Coccinelle semantic patch used:
@@
expression e1, e2;
identifier v;
@@
(
v = (e1 == e2)
|
v = (e1 != e2)
|
v = (e1 <= e2)
|
v = (e1 >= e2)
|
v =
- (
e1
- )
)
Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
CONFIG_MEDIA is not a thing, but CONFIG_MEDIA_SUPPORT is, so use that.
Reported-by: Valentin Rothberg <valentinrothberg@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
As suggested by checkpatch.pl:
CHECK: Prefer kernel type 'u16' over 'uint16_t'
Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
As suggested by checkpatch.pl:
CHECK: Prefer kernel type 'u8' over 'uint8_t'
Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The last thing remaining in kernel_ver.h was the setting of
CONFIG_PM_RUNTIME, which isn't needed in a in-tree implementation. So
remove the setting of this value, and the .h file entirely as that was
the last thing left in it.
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Remove BROKEN keyword to allow the light driver to be select now that
we fixed the kernel version dependencies. Also fix the module name in
the help section.
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Greybus SPI driver depends on gb-spilib and we need to state that at
makefile to make it link correctly.
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
No need to support older kernel versions in the Greybus Power Supply
driver, so remove the checks as needed, we can now rely on all of the
correct Power Supply core apis being present. Also move some properties
definitions to the power supply greybus code.
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
No need to support older kernel versions in the Greybus SDIO driver, so
remove the checks as needed, we can now rely on all of the correct SDIO
core apis being present.
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
No need to support older kernel versions in the Greybus Light driver, so
remove the checks as needed, we can now rely on all of the correct LED
core apis being present. And compile only if flash and v4l2 flash is
reachable.
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
The 0-day bot pointed out a type difference in one min() call, so fix it
up by being explicit about the type being compared.
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
No need to support older kernel versions in the Greybus SPI and spilib
driver, so remove the checks as needed, we can now rely on all of the
correct SPI core apis being present.
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
No need to support older kernel versions in the Greybus GPIO driver, so
remove the checks as needed, we can now rely on all of the correct
GPIO core apis being present.
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
No need to support older kernel versions in the Greybus Vibrator driver,
so remove the checks as needed, we can now rely on all of the correct
driver core apis being present.
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
No need to support older kernel versions in the Greybus HID driver, so
remove the checks as needed, we can now rely on all of the "new" apis
being present.
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Now that we do not care about the kernel version we are building
against, we can strip out lots of backward compatibilty that was added
to kernel_ver.h in order to write semi-portable driver code.
To start with, remove the functions and #defines that are now in the
kernel tree, no need to have duplicate copies of them all.
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This adds a proper Kconfig file for drivers/staging/greybus and fixes up
the Makefile to work correctly within the kernel build system (modules
depend on the .config options, etc.)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
The Toshiba ES1 chip is no longer around, so remove the USB descriptor
documentation for it as no one cares anymore.
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Only the tools subdirectory needs a .gitignore entry, so move it there
and fix it up to only list the needed file.
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
We don't need yet-another-copy of the GPLv2 in the tree, and the README
is now pointless, so remove both of these files.
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
We do not need an example of the sysfs tree in the kernel code itself,
so remove these files, as they are now pointless.
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
When the greybus tree was external, it contained a copy of checkpatch.pl
to keep everyone "in line". This is no longer needed and can now be
removed.
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
gb_phy runtime functions use struct gbphy_device *gbphy_dev,
and not struct device. When CONFIG_PM_RUNTIME is not enabled
a compile error will show.
Fix this by passing struct gbphy_device * as parameter
Testing Done: compile with CONFIG_PM_RUNTIME disabled
Signed-off-by: Axel Haslam <ahaslam@baylibre.com>
Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
If a gpio line is getting used for an irq, gpio core will create
/proc/irq/X/gpiolib/ directory for it. This directory gets removed while
the gpio controller is unregistered.
In case of greybus, gb_gpio_irqchip_add() creates an irqdomain and
creates irq mappings for the gpio lines. Currently they are added after
registering the gpio controller and removed before the gpio controller
is removed. On the removal path, while the core tries to remove the irq
directory (/proc/irq/X), it finds that the irq is still getting used and
a "gpiolib" directory is present within it and so it gives this warning:
Steps to reproduce:
$ cd /sys/class/gpio
$ echo X > export
$ echo both > gpioX/edge
$ echo <interface-number> > /sys/bus/greybus/devices/1-svc/intf_eject
[ 139.171436] ------------[ cut here ]------------
[ 139.171468] WARNING: at /home/vireshk/all/work/repos/ara/arche/kernel/arche/fs/proc/generic.c:552 remove_proc_entry+0x154/0x188()
[ 139.171476] remove_proc_entry: removing non-empty directory 'irq/683', leaking at least 'gpiolib'
[ 139.171589] Modules linked in: gb_vibrator(O) gb_usb(O) gb_uart(O) gb_spi(O) gb_sdio(O) gb_raw(O) gb_pwm(O) gb_power_supply(O) gb_loopback(O) gb_log(O) gb_light(O) gb_i2c(O) gb_hid(O) gb_gpio(O) gb_gbphy(O) gb_firmware(O) gb_spilib(O) gb_es2(O) gb_camera(O) gb_bootrom(O) gb_audio_module(O) gb_audio_manager(O) gb_audio_codec(O) gb_audio_gb(O) gb_audio_apbridgea(O) gb_arche(O) greybus(O)
[ 139.171605] CPU: 1 PID: 280 Comm: kworker/u16:4 Tainted: G W O 3.10.83-g9771b10cbeed #107
[ 139.171652] Workqueue: greybus1:svc gb_svc_intf_set_power_mode [greybus]
[ 139.171657] Call trace:
[ 139.171677] [<ffffffc000207b40>] dump_backtrace+0x0/0x268
[ 139.171689] [<ffffffc000207db8>] show_stack+0x10/0x1c
[ 139.171707] [<ffffffc000ccad78>] dump_stack+0x1c/0x28
[ 139.171723] [<ffffffc00021f9dc>] warn_slowpath_common+0x74/0x9c
[ 139.171735] [<ffffffc00021fa60>] warn_slowpath_fmt+0x5c/0x80
[ 139.171747] [<ffffffc00035fa38>] remove_proc_entry+0x150/0x188
[ 139.171763] [<ffffffc00027464c>] unregister_irq_proc+0xb4/0xdc
[ 139.171779] [<ffffffc00026e3f4>] free_desc+0x2c/0x70
[ 139.171791] [<ffffffc00026e48c>] irq_free_descs+0x54/0x9c
[ 139.171802] [<ffffffc000273448>] irq_dispose_mapping+0x54/0x64
[ 139.171814] [<ffffffbffc0621e8>] 0xffffffbffc0621e8
[ 139.171825] [<ffffffbffc05e01c>] 0xffffffbffc05e01c
[ 139.171843] [<ffffffc0005d4e30>] __device_release_driver+0x90/0xe4
[ 139.171854] [<ffffffc0005d4ea4>] device_release_driver+0x20/0x38
[ 139.171867] [<ffffffc0005d4634>] bus_remove_device+0x12c/0x148
[ 139.171878] [<ffffffc0005d1cb0>] device_del+0x108/0x16c
[ 139.171888] [<ffffffc0005d1d64>] device_unregister+0x50/0x68
[ 139.171901] [<ffffffbffc05e2bc>] gb_gbphy_deregister_driver+0xf0/0x4ec [gb_gbphy]
[ 139.171924] [<ffffffbffc0014c4>] greybus_disabled+0x14c4/0x1760 [greybus]
[ 139.171936] [<ffffffc0005d4e30>] __device_release_driver+0x90/0xe4
[ 139.171948] [<ffffffc0005d4ea4>] device_release_driver+0x20/0x38
[ 139.171959] [<ffffffc0005d4634>] bus_remove_device+0x12c/0x148
[ 139.171969] [<ffffffc0005d1cb0>] device_del+0x108/0x16c
[ 139.171992] [<ffffffbffc004cec>] gb_bundle_destroy+0x7c/0x1b0 [greybus]
[ 139.172017] [<ffffffbffc004074>] gb_interface_disable+0xb4/0x178 [greybus]
[ 139.172040] [<ffffffbffc002ae4>] gb_module_del+0x5c/0xf8 [greybus]
[ 139.172063] [<ffffffbffc008418>] gb_svc_intf_set_power_mode+0xea0/0xfe8 [greybus]
[ 139.172078] [<ffffffc00023888c>] process_one_work+0x268/0x3c8
[ 139.172089] [<ffffffc000239a64>] worker_thread+0x204/0x358
[ 139.172108] [<ffffffc00023f43c>] kthread+0xb8/0xc4
[ 139.172114] ---[ end trace 6fa3314e8c6157ca ]---
Also note that registering the gpio controller before creating irqdomain
is incorrect as well and may lead to kernel panic, as a gpio may get
requested as an interrupt source right after the controller is
registered, and the greybus gpio driver wouldn't be fully ready by then.
This patch changes the sequence in both probe() and remove() to fix it.
Fixes: 426e88a47d39 ("greybus: gpio: add interrupt handling support")
Reported-by: David Hsu <davidhsu@google.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Properly report which endpoints are being ignored and which ones are
"unknown" to the driver.
Reviewed-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
usb_kill_urb() and usb_free_urb() can be called with NULL pointers, so
no need to check before calling them.
Reviewed-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
We don't need the defines for the number of bulk in or out endpoints
anymore, as the driver just grabs the first ones it finds and runs with
it.
Reviewed-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
We only care about one bulk IN endpoint for cports, and one for ARPC, so
drop the array of bulk IN endpoints to simplify things.
Reviewed-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
We only care about one bulk out endpoint, the first one, so remove
the pretense of keeping an array of these things. Just grab the first
one in the list and run away!
Reviewed-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
We were not really using this structure at all, it was only returning
'0' when asked what cport matched to what pair, so remove it all.
Reviewed-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
These functions were never used, and we are about to remove the
structures it was trying to reference, so let's remove it to get it out
of the way.
Reviewed-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This matches a corresponding firmware change to declare a single
BULK EP pair for all greybus traffic and 1 BULK IN ep for ARPC.
Thus, avoiding URB submittions for all the other unused BULK IN
endpoints on the HOST side that took considerable amount
of bus time.
Testing Done:
Tested with modified AP<->APB1 loopback test and also with GPBridge
modules to ensure there are no regressions
Signed-off-by: Sandeep Patil <sspatil@google.com>
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Reviewed-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Remove the deprecated svc key-event type, which has already been removed
from the specification.
Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Modify Power_supply greybus driver to support runtime PM framework.
During charging state, the driver will block remote device of suspending,
and then enables runtime suspend when remote device is in none chargin
state.
Testing Done: Compiled and verified on EVT2, EVT2 1x2 GPB test module
and Device class daughter board.
Signed-off-by: Philip Yang <yang_philip@projectara.com>
Reviewed-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Now jack-button are registered to snd framework based on capabilities
populated by codec module's topology data. Thus, valid ids for button
events can also vary for different modules. This patch modifies existing
button reporting mechanism to avoid reporting spurious button events for
invalid button ids.
Signed-off-by: Vaibhav Agarwal <vaibhav.agarwal@linaro.org>
Reviewed-by: Mark Greer <mgreer@animalcreek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Now jack & jack-buttons are registered to snd_jack framework based on
the capability shared by module's topology data. Thus, jack events
should be reported to above snd framework only in case corresponding
jack type is registered. This patch adds additional checks to avoid
reporting fake jack events.
Signed-off-by: Vaibhav Agarwal <vaibhav.agarwal@linaro.org>
Reviewed-by: Mark Greer <mgreer@animalcreek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Added extra fields namely jack_mask & button_mask for each module_info.
These fields are required while registering jack & reporting jack
events.
Earlier, these were hard coded values assuming fixed capabilities say
HEADSET, LINEOUT, etc. supported by GB-codec driver. Now these are
computed dynamically based on module's jack capability shared via
topology data.
Signed-off-by: Vaibhav Agarwal <vaibhav.agarwal@linaro.org>
Reviewed-by: Mark Greer <mgreer@animalcreek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This patch adds extra field jack_type to gb_audio_topology struct. Also,
it defines bit fields to be used by module while defining it's jack and
jack-button capabilities.
Currently, module can populate a single jack and associated buttons. In
case multiple jacks are supported data routing (say duplicating, etc.)
should be handled within module's FW. It can populate additional mixer
controls to do so.
Signed-off-by: Vaibhav Agarwal <vaibhav.agarwal@linaro.org>
Reviewed-by: Mark Greer <mgreer@animalcreek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
snd_jack will be registered based on real capabilities shared by
module's FW instead of parsing widgets and register it with fixed
capabilities. Remove module_info->num_jack, since it is no more
required.
Signed-off-by: Vaibhav Agarwal <vaibhav.agarwal@linaro.org>
Reviewed-by: Mark Greer <mgreer@animalcreek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Make sure the timeout values are aligned.
Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Remove the now obsolete and redundant cport-reset ARPC, along with the
consequently unused cport_disable callback.
Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Remove the now obsolete ping and cport_features_enable/disable
callbacks.
Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Implement the new connection setup and tear-down sequences for control
connections and bundle connections (offloaded and non-offloaded).
Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Implement the shutdown callback which is used to execute shutdown
operations on offloaded connections.
This adds a new shutdown ARPC.
Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Implement the flush callback which is called as part of connection tear
down to flush host-device queues and stop any ongoing transfers.
Note that this should be considered an optimisation of sort since if
the CPort is stuck waiting for credit, the CPort is likely still stuck
when we try to send the cport_shutdown request over it after the
callback returns.
Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
We were checking for existing power supply names in the wrong place,
i.e, we were checking before any of the module power supply were
registered, because of that of course no name collision was detected.
Move the check to the register loop and with that we guarantee that this
mechanism works for greybus power supply naming.
Tested: using gbsim and using power supply with the same name and check
that: 1. no problems creating sysfs entries; 2. naming is done following
the desired rules.
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
According to runtime pm architecture, the kernel side driver should be
as smart as needed to know when the module is idle or active, so that it can
issue the suspend/resume operations to the firmware side at the right time.
To add logics prevents AP from issuing the suspend request to the firmware
when a channel turning to active state, and put it to suspend if the state
is going to inactive with still holding a reference.
Testing Done: Compiled and verified on EVT2 and gpbridge-test module
with device class daughter board.
Signed-off-by: Kris Huang <huang_kris@projectara.com>
Reviewed-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>