OSDN Git Service

android-x86/kernel.git
9 years agoandroid-x86: update defconfig
Chih-Wei Huang [Wed, 29 Apr 2015 16:03:23 +0000 (00:03 +0800)]
android-x86: update defconfig

9 years agoRevert "staging: Remove the Android alarm-dev driver"
Chih-Wei Huang [Wed, 29 Apr 2015 15:47:38 +0000 (23:47 +0800)]
Revert "staging: Remove the Android alarm-dev driver"

This reverts commit 5da41e925656649fd970f0c205eee5fda887dc24.

Conflicts:
drivers/staging/android/Kconfig

9 years agoRevert "staging: Remove the Android logger driver"
Chih-Wei Huang [Wed, 29 Apr 2015 15:44:49 +0000 (23:44 +0800)]
Revert "staging: Remove the Android logger driver"

This reverts commit a0a23bbce7818c90c3d3370af966fefce07a8c9b.

9 years agoRevert "staging: Remove logger and alarm-dev from android Makefile"
Chih-Wei Huang [Wed, 29 Apr 2015 15:44:42 +0000 (23:44 +0800)]
Revert "staging: Remove logger and alarm-dev from android Makefile"

This reverts commit 71e365ed0ca893cae8d72cbd4b476a9589003098.

9 years agoMerge branch 'byt-fix' into android-4.0
Chih-Wei Huang [Tue, 28 Apr 2015 17:25:54 +0000 (01:25 +0800)]
Merge branch 'byt-fix' into android-4.0

9 years agodrm/i915: Backlight control using CRC PMIC based PWM driver
Shobhit Kumar [Tue, 7 Apr 2015 08:46:41 +0000 (14:16 +0530)]
drm/i915: Backlight control using CRC PMIC based PWM driver

Use the CRC PWM device in intel_panel.c and add new MIPI backlight
specififc callbacks

v2: Modify to use pwm_config callback

CC: Samuel Ortiz <sameo@linux.intel.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Alexandre Courbot <gnurou@gmail.com>
Cc: Thierry Reding <thierry.reding@gmail.com>
Signed-off-by: Shobhit Kumar <shobhit.kumar@intel.com>
9 years agodrm/i915: Use the CRC gpio for panel enable/disable
Shobhit Kumar [Tue, 17 Feb 2015 10:25:09 +0000 (15:55 +0530)]
drm/i915: Use the CRC gpio for panel enable/disable

The CRC (Crystal Cove) PMIC, controls the panel enable and disable
signals for BYT for dsi panels. This is indicated in the VBT fields. Use
that to initialize and use GPIO based control for these signals.

v2: Use the newer gpiod interface(Alexandre)
v3: Remove the redundant checks and unused code (Ville)

CC: Samuel Ortiz <sameo@linux.intel.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Alexandre Courbot <gnurou@gmail.com>
Cc: Thierry Reding <thierry.reding@gmail.com>
Signed-off-by: Shobhit Kumar <shobhit.kumar@intel.com>
9 years agodrivers/pwm: Add Crystalcove (CRC) PWM driver
Shobhit Kumar [Mon, 23 Feb 2015 05:51:31 +0000 (11:21 +0530)]
drivers/pwm: Add Crystalcove (CRC) PWM driver

The Crystalcove PMIC controls PWM signals and this driver exports that
capability as a PWM chip driver. This is platform device implementtaion
of the drivers/mfd cell device for CRC PMIC

v2: Use the existing config callback with duty_ns and period_ns(Thierry)

CC: Samuel Ortiz <sameo@linux.intel.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Alexandre Courbot <gnurou@gmail.com>
Cc: Thierry Reding <thierry.reding@gmail.com>
Signed-off-by: Shobhit Kumar <shobhit.kumar@intel.com>
9 years agodrivers/mfd: ADD PWM lookup table for CRC PMIC based PWM
Shobhit Kumar [Fri, 6 Mar 2015 09:40:52 +0000 (15:10 +0530)]
drivers/mfd: ADD PWM lookup table for CRC PMIC based PWM

On some BYT PLatform the PWM is controlled using CRC PMIC. Add a lookup
entry for the same to be used by the consumer (Intel GFX)

v2: Remove the lookup table on driver unload (Thierry)

CC: Samuel Ortiz <sameo@linux.intel.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Alexandre Courbot <gnurou@gmail.com>
Cc: Thierry Reding <thierry.reding@gmail.com>
Signed-off-by: Shobhit Kumar <shobhit.kumar@intel.com>
9 years agodrivers/mfd: Add PWM cell device for Crystalcove PMIC
Shobhit Kumar [Fri, 6 Mar 2015 15:21:11 +0000 (20:51 +0530)]
drivers/mfd: Add PWM cell device for Crystalcove PMIC

Needed for PWM control suuported by the PMIC

CC: Samuel Ortiz <sameo@linux.intel.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Alexandre Courbot <gnurou@gmail.com>
Cc: Thierry Reding <thierry.reding@gmail.com>
Signed-off-by: Shobhit Kumar <shobhit.kumar@intel.com>
9 years agodrivers/mfd: Add lookup table for Panel Control as GPIO signal
Shobhit Kumar [Wed, 4 Mar 2015 07:54:22 +0000 (13:24 +0530)]
drivers/mfd: Add lookup table for Panel Control as GPIO signal

On some Intel SoC platforms, the panel enable/disable signals are
controlled by CRC PMIC. Add those control as a new GPIO in a lookup
table for gpio-crystalcove chip during CRC driver load

v2: Make the lookup table static (Thierry)
    Remove the lookup table during driver remove (Thierry)

CC: Samuel Ortiz <sameo@linux.intel.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Alexandre Courbot <gnurou@gmail.com>
Cc: Thierry Reding <thierry.reding@gmail.com>
Signed-off-by: Shobhit Kumar <shobhit.kumar@intel.com>
9 years agodrivers/pwm/core: Add support to remove registered consumer lookup tables
Shobhit Kumar [Fri, 24 Apr 2015 14:49:15 +0000 (20:19 +0530)]
drivers/pwm/core: Add support to remove registered consumer lookup tables

In case some drivers are unloading, they can remove lookup tables which
they would have registered during their load time to avoid redundant
entries if loaded again

v2: Ccing maintainers

CC: Samuel Ortiz <sameo@linux.intel.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Alexandre Courbot <gnurou@gmail.com>
Cc: Thierry Reding <thierry.reding@gmail.com>
Signed-off-by: Shobhit Kumar <shobhit.kumar@intel.com>
9 years agodrivers/gpio/gpiolib: Add support for removing registered consumer lookup table
Shobhit Kumar [Fri, 10 Apr 2015 08:39:12 +0000 (14:09 +0530)]
drivers/gpio/gpiolib: Add support for removing registered consumer lookup table

In case we unload and load a driver module again that is registering a
lookup table, without this it will result in multiple entries. Provide
an option to remove the lookup table on driver unload

v2: Ccing maintainers

Cc: Samuel Ortiz <sameo@linux.intel.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Alexandre Courbot <gnurou@gmail.com>
Cc: Thierry Reding <thierry.reding@gmail.com>
Signed-off-by: Shobhit Kumar <shobhit.kumar@intel.com>
9 years agodrivers/pwm: Remove __init initializer for pwm_add_table
Shobhit Kumar [Thu, 12 Mar 2015 16:31:31 +0000 (22:01 +0530)]
drivers/pwm: Remove __init initializer for pwm_add_table

For platforms where there are DT, some early MFD modules can reguster
lookup tables. Remove __init initializer so that this works. This is
similar to gpio_add_lookup_table which allows later initializations

CC: Samuel Ortiz <sameo@linux.intel.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Alexandre Courbot <gnurou@gmail.com>
Cc: Thierry Reding <thierry.reding@gmail.com>
Signed-off-by: Shobhit Kumar <shobhit.kumar@intel.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
9 years agogpio/crystalcove: Add additional GPIO for Panel control
Shobhit Kumar [Thu, 12 Mar 2015 16:31:26 +0000 (22:01 +0530)]
gpio/crystalcove: Add additional GPIO for Panel control

Export PANEL_EN/DISABLE (offset 0x52) as additional GPIO. Needed
by display driver to enable the DSI panel on BYT platform where
the Panel EN/Disable control is routed thorugh CRC PMIC

CC: Samuel Ortiz <sameo@linux.intel.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Alexandre Courbot <gnurou@gmail.com>
Cc: Thierry Reding <thierry.reding@gmail.com>
Acked-by: Daniel Vetter <daniel@ffwll.ch>
Signed-off-by: Shobhit Kumar <shobhit.kumar@intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
9 years agobrcmfmac: Prevent re-tuning conflicting with 'wake-up'
Adrian Hunter [Tue, 28 Apr 2015 14:45:41 +0000 (17:45 +0300)]
brcmfmac: Prevent re-tuning conflicting with 'wake-up'

If the device is in a custom sleep state, then re-tuning
will fail. Add calls to sdio_retune_hold_now() and
sdio_retune_release() to prevent re-tuning before the
wake-up command. In the case re-tuning was needed, the
wake-up command might return an error, but the wake-up
is expected still to have happened, and the error is
anyway ignored.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
9 years agommc: core: Add functions for SDIO to hold re-tuning
Adrian Hunter [Tue, 28 Apr 2015 14:45:40 +0000 (17:45 +0300)]
mmc: core: Add functions for SDIO to hold re-tuning

Add sdio_retune_hold_now() and sdio_retune_release()
in order to allow SDIO function drivers to prevent
re-tuning in cases where it conflicts with the
device state.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
9 years agommc: sdhci-pci: Fix device hang on Intel BayTrail
Adrian Hunter [Tue, 24 Mar 2015 13:40:40 +0000 (15:40 +0200)]
mmc: sdhci-pci: Fix device hang on Intel BayTrail

Intel Baytrail has been observed sometimes to hang
if host controllers are using DMA while deep C-states
are used. Workaround that by specifying a maximum
DMA latency that will prevent deep C-states.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
9 years agommc: sdhci-acpi: Fix device hang on Intel BayTrail
Adrian Hunter [Tue, 24 Mar 2015 13:40:39 +0000 (15:40 +0200)]
mmc: sdhci-acpi: Fix device hang on Intel BayTrail

Intel Baytrail has been observed sometimes to hang
if host controllers are using DMA while deep C-states
are used. Workaround that by specifying a maximum
DMA latency that will prevent deep C-states.

Unfortunately, host controller ACPI HIDs are not unique
to Baytrail, so the CPU must be identified.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
9 years agommc: sdhci: Support maximum DMA latency request via PM QOS
Adrian Hunter [Tue, 24 Mar 2015 13:40:38 +0000 (15:40 +0200)]
mmc: sdhci: Support maximum DMA latency request via PM QOS

Add support for setting a maximum DMA latency via the
PM QOS framework.

Drivers can set host->dma_latency to the desired value
otherwise the initial value (PM_QOS_DEFAULT_VALUE)
will result in no PM QOS request being added.

It may be that there isn't time between consecutive
I/O requests to reach deeper C-states. To address
that the driver can set host->lat_cancel_delay which
is the delay before cancelling the DMA latency request
when it is known that there is another request on
the way.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
9 years agoPM / QoS: Add pm_qos_cancel_request_lazy() that doesn't sleep
Adrian Hunter [Tue, 24 Mar 2015 13:40:37 +0000 (15:40 +0200)]
PM / QoS: Add pm_qos_cancel_request_lazy() that doesn't sleep

Add pm_qos_cancel_request_lazy() which is convenient for
contexts that may not sleep.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
9 years agommc: sdhci-pci: Enable HS400 for some Intel host controllers
Adrian Hunter [Fri, 6 Feb 2015 12:13:01 +0000 (14:13 +0200)]
mmc: sdhci-pci: Enable HS400 for some Intel host controllers

Enable detection of HS400 support via capability bit-63
for some Intel host controllers.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
9 years agommc: sdhci-pci: Add support for drive strength selection for SPT
Adrian Hunter [Fri, 6 Feb 2015 12:13:00 +0000 (14:13 +0200)]
mmc: sdhci-pci: Add support for drive strength selection for SPT

Implement the select_drive_strength callback to provide
drive strength selection for Intel SPT.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
9 years agommc: sdhci: Add a callback to select drive strength
Adrian Hunter [Fri, 6 Feb 2015 12:12:59 +0000 (14:12 +0200)]
mmc: sdhci: Add a callback to select drive strength

Add a callbak to let host drivers select drive
strength.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
9 years agommc: mmc: Add driver strength selection
Adrian Hunter [Fri, 6 Feb 2015 12:12:58 +0000 (14:12 +0200)]
mmc: mmc: Add driver strength selection

Add the ability to set eMMC driver strength
for HS200 and HS400.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
9 years agommc: mmc: Read card's valid driver strength mask
Adrian Hunter [Fri, 6 Feb 2015 12:12:57 +0000 (14:12 +0200)]
mmc: mmc: Read card's valid driver strength mask

In preparation for supporing drive strength selection
for eMMC, read the card's valid driver strengths.

Note that though the SD spec uses the term "drive strength",
the JEDEC eMMC spec uses the term "driver strength".

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
9 years agommc: core: Record card drive strength
Adrian Hunter [Fri, 6 Feb 2015 12:12:56 +0000 (14:12 +0200)]
mmc: core: Record card drive strength

In preparation for adding drive strength support
for eMMC, add drive_strength to struct mmc_card
to record the card drive strength for UHS-I modes
and HS200 / HS400. For eMMC this will be needed
when switching between HS200 and HS400.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
9 years agommc: core: Factor out common code in drive strength selection
Adrian Hunter [Fri, 6 Feb 2015 12:12:55 +0000 (14:12 +0200)]
mmc: core: Factor out common code in drive strength selection

Make a new function out of common code used for drive
strength selection.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
9 years agommc: core: Add 'card' to drive strength selection callback
Adrian Hunter [Fri, 6 Feb 2015 12:12:54 +0000 (14:12 +0200)]
mmc: core: Add 'card' to drive strength selection callback

In preparation for supporting also eMMC drive strength,
add the 'card' as a parameter so that the callback can
distinguish different types of cards if necessary.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
9 years agommc: core: Simplify card drive strength mask
Adrian Hunter [Fri, 6 Feb 2015 12:12:53 +0000 (14:12 +0200)]
mmc: core: Simplify card drive strength mask

Card drive strength selection uses a callback to
which a mask of supported drive strengths is passed.
Currently, the bits are checked against the values
in the SD specifications. That is not necessary
because the callback will anyway match the mask
against a valid value. Simplify by taking the mask
as is but still ensuring that the default mandatory
value (type B) is always supported.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
9 years agommc: core: Allow card drive strength to be different to host
Adrian Hunter [Fri, 6 Feb 2015 12:12:52 +0000 (14:12 +0200)]
mmc: core: Allow card drive strength to be different to host

Initialization of UHS-I modes for SD and SDIO cards
employs a callback to allow the host driver to
choose a drive strength value. Currently that
assumes the card drive strength and host driver
type must be the same value. Change to let the
callback make that decision and return both the
card drive strength and host driver type.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
9 years agommc: core: Reset driver type to default
Adrian Hunter [Fri, 6 Feb 2015 12:12:51 +0000 (14:12 +0200)]
mmc: core: Reset driver type to default

IO state variable drv_type could be set during card
initialization. Consequently, it must be reset to the
default value when setting the initial state.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
9 years agommc: core: Don't print reset warning if reset is not supported
Adrian Hunter [Mon, 20 Apr 2015 12:09:56 +0000 (15:09 +0300)]
mmc: core: Don't print reset warning if reset is not supported

Check the error code for EOPNOTSUPP and do not print
reset warning in that case.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
9 years agommc: block: Retry errored data requests when re-tuning is needed
Adrian Hunter [Mon, 20 Apr 2015 12:09:55 +0000 (15:09 +0300)]
mmc: block: Retry errored data requests when re-tuning is needed

Retry errored data requests when re-tuning is needed and
add a flag to struct mmc_blk_request so that the retry
is only done once.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
9 years agommc: block: Check re-tuning in the recovery path
Adrian Hunter [Mon, 20 Apr 2015 12:09:54 +0000 (15:09 +0300)]
mmc: block: Check re-tuning in the recovery path

If re-tuning is needed, do it in the recovery path to
give recovery commands a better chance of success.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
9 years agommc: sdhci: Flag re-tuning is needed on CRC or End-Bit errors
Adrian Hunter [Mon, 20 Apr 2015 12:09:53 +0000 (15:09 +0300)]
mmc: sdhci: Flag re-tuning is needed on CRC or End-Bit errors

CRC or End-Bit errors could possibly be alleviated by
re-tuning so flag re-tuning needed in those cases.
Note this has no effect if re-tuning has not been
enabled.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
9 years agommc: sdhci: Change to new way of doing re-tuning
Adrian Hunter [Mon, 20 Apr 2015 12:09:52 +0000 (15:09 +0300)]
mmc: sdhci: Change to new way of doing re-tuning

Make use of mmc core support for re-tuning instead
of doing it all in the sdhci driver.

This patch also changes to flag the need for re-tuning
always after runtime suspend when tuning has been used
at initialization. Previously it was only done if
the re-tuning timer was in use.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
9 years agommc: core: Add support for HS400 re-tuning
Adrian Hunter [Mon, 20 Apr 2015 12:09:51 +0000 (15:09 +0300)]
mmc: core: Add support for HS400 re-tuning

HS400 re-tuning must be done in HS200 mode. Add
the ability to switch from HS400 mode to HS200
mode before re-tuning and switch back to HS400
after re-tuning.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
9 years agommc: core: Separate out the mmc_switch status check so it can be re-used
Adrian Hunter [Mon, 20 Apr 2015 12:09:50 +0000 (15:09 +0300)]
mmc: core: Separate out the mmc_switch status check so it can be re-used

Make a separate function to do the mmc_switch status check
so it can be re-used. This is preparation for adding support
for HS400 re-tuning.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
9 years agommc: mmc: Hold re-tuning if the card is put to sleep
Adrian Hunter [Mon, 20 Apr 2015 12:09:49 +0000 (15:09 +0300)]
mmc: mmc: Hold re-tuning if the card is put to sleep

Currently "mmc sleep" is used before power off and
is not paired with waking up. Nevertheless hold
re-tuning.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
9 years agommc: core: Hold re-tuning while bkops ongoing
Adrian Hunter [Mon, 20 Apr 2015 12:09:48 +0000 (15:09 +0300)]
mmc: core: Hold re-tuning while bkops ongoing

Hold re-tuning during bkops to prevent
it from conflicting with the busy state.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
9 years agommc: core: Hold re-tuning during erase commands
Adrian Hunter [Mon, 20 Apr 2015 12:09:47 +0000 (15:09 +0300)]
mmc: core: Hold re-tuning during erase commands

Hold re-tuning during erase commands to prevent
it from conflicting with the sequence of commands.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
9 years agommc: core: Hold re-tuning during switch commands
Adrian Hunter [Mon, 20 Apr 2015 12:09:46 +0000 (15:09 +0300)]
mmc: core: Hold re-tuning during switch commands

Hold re-tuning during switch commands to prevent
it from conflicting with the busy state or the CMD13
verification.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
9 years agommc: core: Check re-tuning before retrying
Adrian Hunter [Mon, 20 Apr 2015 12:09:45 +0000 (15:09 +0300)]
mmc: core: Check re-tuning before retrying

Possibly a command is failing because re-tuning is needed.
Use mmc_retune_recheck() to check re-tuning. At that point
re-tuning is held, at least by the request, so
mmc_retune_recheck() flags host->retune_now if the hold
count is 1.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
9 years agommc: core: Add support for re-tuning before each request
Adrian Hunter [Mon, 20 Apr 2015 12:09:44 +0000 (15:09 +0300)]
mmc: core: Add support for re-tuning before each request

At the start of each request, re-tune if needed and
then hold off re-tuning again until the request is done.

Note that though there is one function that starts
requests (mmc_start_request) there are two that wait for
the request to be done (mmc_wait_for_req_done and
mmc_wait_for_data_req_done).  Also note that
mmc_wait_for_data_req_done can return even when the
request is not done (which allows the block driver
to prepare a newly arrived request while still
waiting for the previous request).

This patch ensures re-tuning is held for the duration
of a request.  Subsequent patches will also hold
re-tuning at other times when it might cause a
conflict.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
9 years agommc: core: Enable / disable re-tuning
Adrian Hunter [Tue, 28 Apr 2015 13:18:14 +0000 (16:18 +0300)]
mmc: core: Enable / disable re-tuning

Enable re-tuning when tuning is executed and
disable re-tuning when card is no longer initialized.

In the case of SDIO suspend, the card can keep power.
In that case, re-tuning need not be disabled, but, if
a re-tuning timer is being used, ensure it is disabled
and assume that re-tuning will be needed upon resume
since it is not known how long the suspend will last.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
9 years agommc: host: Add facility to support re-tuning
Adrian Hunter [Mon, 20 Apr 2015 12:09:42 +0000 (15:09 +0300)]
mmc: host: Add facility to support re-tuning

Currently, there is core support for tuning during
initialization. There can also be a need to re-tune
periodically (e.g. sdhci) or to re-tune after the
host controller is powered off (e.g. after PM
runtime suspend / resume) or to re-tune in response
to CRC errors.

The main requirements for re-tuning are:
  - ability to enable / disable re-tuning
  - ability to flag that re-tuning is needed
  - ability to re-tune before any request
  - ability to hold off re-tuning if the card is busy
  - ability to hold off re-tuning if re-tuning is in
  progress
  - ability to run a re-tuning timer

To support those requirements 7 members are added to struct
mmc_host:

  unsigned int can_retune:1; /* re-tuning can be used */
  unsigned int doing_retune:1; /* re-tuning in progress */
  unsigned int retune_now:1;   /* do re-tuning at next req */
  int need_retune; /* re-tuning is needed */
  int hold_retune; /* hold off re-tuning */
  unsigned int retune_period;  /* re-tuning period in secs */
  struct timer_list retune_timer; /* for periodic re-tuning */

need_retune is an integer so it can be set without needing
synchronization. hold_retune is a integer to allow nesting.

Various simple functions are provided to set / clear those
variables.

Subsequent patches take those functions into use.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
9 years agoMerge commit 'mmc-fix' into byt-fix
Chih-Wei Huang [Tue, 28 Apr 2015 16:50:25 +0000 (00:50 +0800)]
Merge commit 'mmc-fix' into byt-fix

9 years agommc: card: not access RPMB partition for normal read and write
Chuanxiao Dong [Tue, 12 Aug 2014 04:01:30 +0000 (12:01 +0800)]
mmc: card: not access RPMB partition for normal read and write

During kernel boot, it will try to read some logical sectors
of each block device node for the possible partition table.

But since RPMB partition is special and can not be accessed
by normal eMMC read / write CMDs, it will cause below error
messages during kernel boot:
...
<3>[    4.890052] mmc0: Got data interrupt 0x00000002 even though no data operation was in progress.
<3>[    4.892160] mmcblk0rpmb: error -110 transferring data, sector 0, nr 32, cmd response 0x900, card status 0xb00
<4>[    4.892165] mmcblk0rpmb: retrying using single block read
<3>[    4.895727] mmcblk0rpmb: timed out sending r/w cmd command, card status 0x400900
<3>[    4.899269] mmcblk0rpmb: timed out sending r/w cmd command, card status 0x400900
<3>[    4.901466] mmcblk0rpmb: timed out sending r/w cmd command, card status 0x400900
<3>[    4.905106] mmcblk0rpmb: timed out sending r/w cmd command, card status 0x400900
<3>[    4.907166] mmcblk0rpmb: timed out sending r/w cmd command, card status 0x400900
<3>[    4.909235] mmcblk0rpmb: timed out sending r/w cmd command, card status 0x400900
<3>[    4.909241] end_request: I/O error, dev mmcblk0rpmb, sector 0
<3>[    4.909247] Buffer I/O error on device mmcblk0rpmb, logical block 0
<3>[    4.909263] end_request: I/O error, dev mmcblk0rpmb, sector 8
<3>[    4.909267] Buffer I/O error on device mmcblk0rpmb, logical block 1
<3>[    4.909272] end_request: I/O error, dev mmcblk0rpmb, sector 16
<3>[    4.909275] Buffer I/O error on device mmcblk0rpmb, logical block 2
<3>[    4.909280] end_request: I/O error, dev mmcblk0rpmb, sector 24
<3>[    4.909283] Buffer I/O error on device mmcblk0rpmb, logical block 3
...

This patch will discard the access request in eMMC queue if
it is RPMB partition access request. By this way, it avoids
trigger above error messages.

Signed-off-by: Yunpeng Gao <yunpeng.gao@intel.com>
Signed-off-by: Chuanxiao Dong <chuanxiao.dong@intel.com>
9 years agobrcmfmac: remove support for unreleased BCM4354 PCIe
Arend van Spriel [Wed, 18 Mar 2015 12:25:28 +0000 (13:25 +0100)]
brcmfmac: remove support for unreleased BCM4354 PCIe

There are no known BCM4354 PCIe devices released so removing
support from the driver until proven otherwise.

Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
9 years agobrcmfmac: only support the BCM43455/7 device
Arend van Spriel [Wed, 18 Mar 2015 12:25:27 +0000 (13:25 +0100)]
brcmfmac: only support the BCM43455/7 device

Recently support was added for the BCM4345 SDIO chipset by
commit 9c51026509d7 ("brcmfmac: Add support for BCM4345 SDIO chipset")
however this was verified using a BCM43455 device, which is
a more recent revision of the chip. This patch assure that
older revisions are not probed as they would fail.

Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Syed Asifful Dayyan <syedd@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
9 years agobrcmfmac: add support for BCM43430 SDIO chipset
Arend van Spriel [Wed, 18 Mar 2015 12:25:26 +0000 (13:25 +0100)]
brcmfmac: add support for BCM43430 SDIO chipset

This patch added support for the BCM43430 802.11n SDIO chipset.

Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
9 years agobrcmfmac: add MODULE_FIRMWARE() macros for bcm4356 PCIe device
Arend van Spriel [Wed, 18 Mar 2015 12:25:25 +0000 (13:25 +0100)]
brcmfmac: add MODULE_FIRMWARE() macros for bcm4356 PCIe device

The BCM4356 PCIe wireless device was added recently but overlooked
the fact that the MODULE_FIRMWARE() macros were missing for the
firmwares needed by this device.

Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
9 years agobrcmfmac: Remove unnecessary new-line in pcie console logging.
Hante Meuleman [Wed, 18 Mar 2015 12:25:24 +0000 (13:25 +0100)]
brcmfmac: Remove unnecessary new-line in pcie console logging.

Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
9 years agobrcmfmac: Update msgbuf commonring size for improved throughput.
Hante Meuleman [Wed, 18 Mar 2015 12:25:23 +0000 (13:25 +0100)]
brcmfmac: Update msgbuf commonring size for improved throughput.

Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
9 years agobrcmfmac: Add necessary memory barriers for SDIO.
Hante Meuleman [Wed, 18 Mar 2015 12:25:22 +0000 (13:25 +0100)]
brcmfmac: Add necessary memory barriers for SDIO.

SDIO uses a thread to handle all communication with the device,
for this data is exchanged between threads. This data needs proper
memory barriers to make sure that data "exchange" is going correct.

Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
9 years agobrcmfmac: avoid runtime-pm for sdio host controller
Arend van Spriel [Wed, 18 Mar 2015 12:25:21 +0000 (13:25 +0100)]
brcmfmac: avoid runtime-pm for sdio host controller

Several host controllers supporting runtime-pm are causing issues
with our sdio wireless cards because they disable the sdio interrupt
upon going into runtime suspend. This patch avoids that by doing
a pm_runtime_forbid() call during the probe. Tested with Sony Vaio
Duo 13 which uses sdhci-acpi host controller.

Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
9 years agobrcmfmac: fix watchdog timer regression
Arend van Spriel [Wed, 11 Mar 2015 15:11:33 +0000 (16:11 +0100)]
brcmfmac: fix watchdog timer regression

The watchdog timer is used to put the device in a low-power mode when
it is idle for some time. This timer is stopped during that mode and
should be restarted upon activity. This has been broken by commit
d4150fced0365 ("brcmfmac: Simplify watchdog sleep."). This patch
restores the behaviour as it was before that commit.

Reported-by: Pontus Fuchs <pontusf@broadcom.com>
Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
9 years agobrcmfmac: take save&restore memory into account for SDIO shared info
Arend van Spriel [Wed, 11 Mar 2015 15:11:32 +0000 (16:11 +0100)]
brcmfmac: take save&restore memory into account for SDIO shared info

The firmware provides pointer to SDIO shared information at end of
RAM during firmware initialization. End of RAM is obviously determined
by the actual ram size, but part of that may be used for save&restore
memory. In that case another location in RAM will hold the pointer.

Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
9 years agobrcmfmac: extract ram size info from internal memory registers
Arend van Spriel [Wed, 11 Mar 2015 15:11:31 +0000 (16:11 +0100)]
brcmfmac: extract ram size info from internal memory registers

Instead of hard-coded memory sizes it is possible to obtain that
information from the internal memory registers.

Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
9 years agobrcmfmac: assure device is ready for download after brcmf_chip_attach()
Arend van Spriel [Wed, 11 Mar 2015 15:11:30 +0000 (16:11 +0100)]
brcmfmac: assure device is ready for download after brcmf_chip_attach()

Make the brcmf_chip_attach() function responsible for putting the
device in a state where it is accessible for firmware download.

Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
9 years agobrcmfmac: rename chip download functions
Arend van Spriel [Wed, 11 Mar 2015 15:11:29 +0000 (16:11 +0100)]
brcmfmac: rename chip download functions

The functions brcmf_chip_[enter/exit]_download() are not exclusively
used for firmware download so rename these more appropriate.

Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
9 years agobrcmfmac: always perform cores checks
Arend van Spriel [Wed, 11 Mar 2015 15:11:28 +0000 (16:11 +0100)]
brcmfmac: always perform cores checks

Instead of checking the cores in the chip only if CONFIG_BRCMDBG
is selected perform the check always and extend it with more sanity
checking.

Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
9 years agobrcmfmac: remove duplication of ramsize info
Arend van Spriel [Wed, 11 Mar 2015 15:11:27 +0000 (16:11 +0100)]
brcmfmac: remove duplication of ramsize info

Removing the ramsize from the brcmf_sdio structure to avoid
duplication. The information is available in brcmf_chip
structure.

Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
9 years agobrcmfmac: Add support for BCM4345 SDIO chipset.
Syed Asifful Dayyan [Fri, 6 Mar 2015 17:40:42 +0000 (18:40 +0100)]
brcmfmac: Add support for BCM4345 SDIO chipset.

These changes add support for BCM4345 SDIO chipset.

Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
Signed-off-by: Syed Asifful Dayyan <syedd@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
9 years agobrcmfmac: Fix race condition in msgbuf ioctl processing.
Hante Meuleman [Fri, 6 Mar 2015 17:40:41 +0000 (18:40 +0100)]
brcmfmac: Fix race condition in msgbuf ioctl processing.

Msgbuf is using a wait_event_timeout to wait for the response on
an ioctl. The wakeup routine uses waitqueue_active to see if
wait_event_timeout has been called. There is a chance that the
response arrives before wait_event_timeout is called, this
will result in situation that wait_event_timeout never gets
woken again and assumed result will be a timeout. This patch
removes that errornous situation by always setting the
ctl_completed var before checking for queue active.

Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
9 years agobrcmfmac: Fix possible race-condition.
Hante Meuleman [Fri, 6 Mar 2015 17:40:40 +0000 (18:40 +0100)]
brcmfmac: Fix possible race-condition.

SDIO is using a "shared" variable to handoff ctl frames to DPC
and to see when they are done. In a timeout situation this can
lead to erroneous situation where DPC started to handle the ctl
frame while the timeout expired. This patch will fix this by
adding locking around the shared variable.

Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
9 years agobrcmfmac: Simplify watchdog sleep.
Hante Meuleman [Fri, 6 Mar 2015 17:40:39 +0000 (18:40 +0100)]
brcmfmac: Simplify watchdog sleep.

The watchdog thread is used to put the SDIO bus to sleep when the
system is idling. This patch simplifies the way it is determined
when sleep can be entered.

Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
9 years agobrcmfmac: Fix oops when SDIO device is removed.
Hante Meuleman [Fri, 6 Mar 2015 17:40:38 +0000 (18:40 +0100)]
brcmfmac: Fix oops when SDIO device is removed.

On removal of SDIO card both functions of card will be getting
a remove call. When the first is hanging in ctrl frame xmit then
the second will cause oops. This patch fixes the xmit ctrl
handling in case of serious errors and also limits the handling
for remove to function 1 only.

Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
9 years agobrcmfmac: Fix escan timer causing oops.
Hante Meuleman [Fri, 6 Feb 2015 17:36:47 +0000 (18:36 +0100)]
brcmfmac: Fix escan timer causing oops.

In some rare circumstances the escan protection timer can expire
before the setup completed (due to long timeouts on IOCTL). This
patch avoids this situation by setting the timer after the setup
completed correctly.

Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
9 years agobrcmfmac: Dont sleep when ctrl frames to transmit.
Hante Meuleman [Fri, 6 Feb 2015 17:36:46 +0000 (18:36 +0100)]
brcmfmac: Dont sleep when ctrl frames to transmit.

The SDIO watchdog will put the device in sleep mode when there is
no activity for some time and nothing to do anymore. This check
is incomplete and should also check if there is a control frame
to transmit.

Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
9 years agobrcmfmac: add debugfs file containing revision info
Arend van Spriel [Fri, 6 Feb 2015 17:36:44 +0000 (18:36 +0100)]
brcmfmac: add debugfs file containing revision info

Make the revision info visible in debugfs. The new debugfs
file is named 'revinfo'.

Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
9 years agobrcmfmac: Remove error print for invalid key index.
Hante Meuleman [Fri, 6 Feb 2015 17:36:43 +0000 (18:36 +0100)]
brcmfmac: Remove error print for invalid key index.

When a key is set or cleared with an unsupported key index then
brcmfmac will print an error. With most wpa_supplicants this is
happening a lot. The error print is confusing and not needed.

Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
9 years agobrcmfmac: use helper function for changing SDIO state
Arend van Spriel [Fri, 6 Feb 2015 17:36:42 +0000 (18:36 +0100)]
brcmfmac: use helper function for changing SDIO state

Changing the SDIO state of the driver involves changing the bus
interface state. Adding a helper function makes sure that knowledge
is in one place.

Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
9 years agoandroid-x86: add defconfig for android-x86 and android-x86_64
Chih-Wei Huang [Mon, 13 Apr 2015 17:54:17 +0000 (01:54 +0800)]
android-x86: add defconfig for android-x86 and android-x86_64

9 years agoMerge branch 'google' into android-4.0
Chih-Wei Huang [Mon, 13 Apr 2015 16:48:46 +0000 (00:48 +0800)]
Merge branch 'google' into android-4.0

9 years agoMerge branch 'iio-backport' into android-4.0
Chih-Wei Huang [Mon, 13 Apr 2015 16:48:32 +0000 (00:48 +0800)]
Merge branch 'iio-backport' into android-4.0

9 years agoMerge branch 'intel' into android-4.0
Chih-Wei Huang [Mon, 13 Apr 2015 16:48:25 +0000 (00:48 +0800)]
Merge branch 'intel' into android-4.0

9 years agoMerge branch 'fedora' into android-4.0
Chih-Wei Huang [Mon, 13 Apr 2015 16:48:16 +0000 (00:48 +0800)]
Merge branch 'fedora' into android-4.0

9 years agostaging: android: ashmem: add missing include
Rom Lemarchand [Sat, 24 Jan 2015 23:08:42 +0000 (15:08 -0800)]
staging: android: ashmem: add missing include

Include <linux/types.h> into ashmem.h to ensure referenced types are defined

Signed-off-by: Rom Lemarchand <romlem@android.com>
Change-Id: Iac18ed86dd47296d02a269607b1514724aaa9958

9 years agoandroid: binder: Change binder mutex to rtmutex.
Riley Andrews [Sat, 27 Sep 2014 00:36:36 +0000 (17:36 -0700)]
android: binder: Change binder mutex to rtmutex.

Surfaceflinger uses binder heavily to receive/send frames from applications
while compositing the screen. Change the binder mutex to an rt mutex to minimize
instances where high priority surfaceflinger binder work is blocked by lower
priority binder ipc.

Change-Id: If7429040641d6e463f20301ec14f02ecf6b0da36
Signed-off-by: Riley Andrews <riandrews@google.com>
9 years agoandroid: binder: More offset validation.
Arve Hjønnevåg [Fri, 14 Feb 2014 04:25:06 +0000 (20:25 -0800)]
android: binder: More offset validation.

Make sure offsets don't point to overlapping flat_binder_object
structs.

Change-Id: I85c759b9c6395492474b177625dc6b0b289fd6b0
Signed-off-by: Arve Hjønnevåg <arve@android.com>
9 years agopower: Avoids bogus error messages for the suspend aborts.
Ruchi Kandoi [Wed, 15 Oct 2014 00:43:21 +0000 (17:43 -0700)]
power: Avoids bogus error messages for the suspend aborts.

Avoids printing bogus error message "tasks refusing to freeze", in cases
where pending wakeup source caused the suspend abort.

Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
Change-Id: I913ad290f501b31cd536d039834c8d24c6f16928

9 years agoandroid: base-cfg: enable ARMV7_COMPAT
Greg Hackmann [Mon, 15 Sep 2014 22:34:55 +0000 (15:34 -0700)]
android: base-cfg: enable ARMV7_COMPAT

Enables backwards-compatibility features on arm64, and has no effect
(does not exist) on other architectures

Change-Id: I6fc2f6567437750a0032f8a39a9cde1fb92d4ef4
Signed-off-by: Greg Hackmann <ghackmann@google.com>
9 years agoandroid: base-cfg: enforce the needed XFRM_MODE_TUNNEL (for VPN)
JP Abgrall [Thu, 4 Sep 2014 00:36:44 +0000 (17:36 -0700)]
android: base-cfg: enforce the needed XFRM_MODE_TUNNEL (for VPN)

Change-Id: I587023d56877d32806079676790751155c768982
Signed-off-by: JP Abgrall <jpa@google.com>
9 years agostaging: android: ashmem: Avoid deadlock with mmap/shrink
Laura Abbott [Fri, 24 Jan 2014 23:19:49 +0000 (15:19 -0800)]
staging: android: ashmem: Avoid deadlock with mmap/shrink

Both ashmem_mmap and ashmem_shrink take the ashmem_lock. It may
be possible for ashmem_mmap to invoke ashmem_shrink:

-000|mutex_lock(lock = 0x0)
-001|ashmem_shrink(?, sc = 0x0) <--- try to take ashmem_mutex again
-002|shrink_slab(shrink = 0xDA5F1CC0, nr_pages_scanned = 0, lru_pages
-002|=
-002|124)
-003|try_to_free_pages(zonelist = 0x0, ?, ?, ?)
-004|__alloc_pages_nodemask(gfp_mask = 21200, order = 1, zonelist =
-004|0xC11D0940,
-005|new_slab(s = 0xE4841E80, ?, node = -1)
-006|__slab_alloc.isra.43.constprop.50(s = 0xE4841E80, gfpflags =
-006|2148925462, ad
-007|kmem_cache_alloc(s = 0xE4841E80, gfpflags = 208)
-008|shmem_alloc_inode(?)
-009|alloc_inode(sb = 0xE480E800)
-010|new_inode_pseudo(?)
-011|new_inode(?)
-012|shmem_get_inode(sb = 0xE480E800, dir = 0x0, ?, dev = 0, flags =
-012|187)
-013|shmem_file_setup(?, ?, flags = 187)
-014|ashmem_mmap(?, vma = 0xC5D64210) <---- Acquire ashmem_mutex
-015|mmap_region(file = 0xDF8E2C00, addr = 1772974080, len = 233472,
-015|flags = 57,
-016|sys_mmap_pgoff(addr = 0, len = 230400, prot = 3, flags = 1, fd =
-016|157, pgoff
-017|ret_fast_syscall(asm)
-->|exception
-018|NUR:0x40097508(asm)
---|end of frame

Avoid this deadlock by using mutex_trylock in ashmem_shrink; if the mutex
is already held, do not attempt to shrink.

Change-Id: I222bbf55856d5849da813b730de0636c80966c8e
Reported-by: Matt Wagantall <mattw@codeaurora.org>
Reported-by: Syed Rameez Mustafa <rameezmustafa@codeaurora.org>
Reported-by: Osvaldo Banuelos <osvaldob@codeaurora.org>
Reported-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
9 years agoext4: Add support for FIDTRIM, a best-effort ioctl for deep discard trim
JP Abgrall [Wed, 23 Jul 2014 23:55:07 +0000 (16:55 -0700)]
ext4: Add support for FIDTRIM, a best-effort ioctl for deep discard trim

* What
This provides an interface for issuing an FITRIM which uses the
secure discard instead of just a discard.
Only the eMMC command is "secure", and not how the FS uses it:
due to the fact that the FS might reassign a region somewhere else,
the original deleted data will not be affected by the "trim" which only
handles un-used regions.
So we'll just call it "deep discard", and note that this is a
"best effort" cleanup.

* Why
Once in a while, We want to be able to cleanup most of the unused blocks
after erasing a bunch of files.
We don't want to constantly secure-discard via a mount option.

From an eMMC spec perspective, it tells the device to really get rid of
all the data for the specified blocks and not just put them back into the
pool of free ones (unlike the normal TRIM). The eMMC spec says the
secure trim handling must make sure the data (and metadata) is not available
anymore. A simple TRIM doesn't clear the data, it just puts blocks in the
free pool.
JEDEC Standard No. 84-A441
  7.6.9 Secure Erase
  7.6.10 Secure Trim

From an FS perspective, it is acceptable to leave some data behind.
 - directory entries related to deleted files
 - databases entries related to deleted files
 - small-file data stored in inode extents
 - blocks held by the FS waiting to be re-used (mitigated by sync).
 - blocks reassigned by the FS prior to FIDTRIM.

Change-Id: I676a1404a80130d93930c84898360f2e6fb2f81e
Signed-off-by: Geremy Condra <gcondra@google.com>
Signed-off-by: JP Abgrall <jpa@google.com>
9 years agoinput: Made keyreset more robust
Daniel Rosenberg [Fri, 27 Jun 2014 23:39:35 +0000 (16:39 -0700)]
input: Made keyreset more robust

Switched do_restart to run in a seperate workqueue to  handle
cases where kernel_restart hangs.

Change-Id: I1ecd61f8d0859f1a86d37c692351d644b5db9c69
Signed-off-by: Daniel Rosenberg <drosen@google.com>
9 years agoSELinux: Enable setting security contexts on rootfs inodes.
Stephen Smalley [Tue, 23 Jul 2013 21:38:41 +0000 (17:38 -0400)]
SELinux: Enable setting security contexts on rootfs inodes.

rootfs (ramfs) can support setting of security contexts
by userspace due to the vfs fallback behavior of calling
the security module to set the in-core inode state
for security.* attributes when the filesystem does not
provide an xattr handler.  No xattr handler required
as the inodes are pinned in memory and have no backing
store.

This is useful in allowing early userspace to label individual
files within a rootfs while still providing a policy-defined
default via genfs.

Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
Signed-off-by: Paul Moore <pmoore@redhat.com>
Signed-off-by: Eric Paris <eparis@redhat.com>
9 years agoandroid: base-cfg: disable LOGGER
Mark Salyzyn [Fri, 6 Jun 2014 19:06:42 +0000 (12:06 -0700)]
android: base-cfg: disable LOGGER

Bug: 15384806
Change-Id: If8d324ffdb4ebd56e5d68876f8e229547e20eaf4
Signed-off-by: Mark Salyzyn <salyzyn@google.com>
9 years agoinput: Changed keyreset to act as a wrapper for keycombo.
Daniel Rosenberg [Wed, 7 May 2014 21:17:47 +0000 (14:17 -0700)]
input: Changed keyreset to act as a wrapper for keycombo.

keyreset now registers a keycombo driver that acts as the old
keyreset driver acted.

Change-Id: I08f5279e3a33b267571b699697f9f54508868983
Signed-off-by: Daniel Rosenberg <drosen@google.com>
9 years agoinput: add keycombo, a general key combo driver.
Daniel Rosenberg [Wed, 7 May 2014 23:52:10 +0000 (16:52 -0700)]
input: add keycombo, a general key combo driver.

Keycombo lets you provide a key up and key down function, and an
optional time delay for key down. The driver will call the key
down function after the specified key combo has been held for the
speicified time delay. After you release the combo, if the key down
has happened, it calls key up.

Change-Id: I6a9a94e96a8f58fadd908fd1dc7944b9102a089f
Signed-off-by: Daniel Rosenberg <drosen@google.com>
9 years agopstore/ram: Add ramoops_console_write_buf api
Arve Hjønnevåg [Sat, 3 May 2014 03:23:21 +0000 (20:23 -0700)]
pstore/ram: Add ramoops_console_write_buf api

Allow writing into the ramoops console buffer.

Change-Id: Iff0d69b562e4dae33ea7f8d19412227bebb17e47
Signed-off-by: Arve Hjønnevåg <arve@android.com>
9 years agoPower: Changes the permission to read only for sysfs file
Ruchi Kandoi [Thu, 24 Apr 2014 21:31:57 +0000 (14:31 -0700)]
Power: Changes the permission to read only for sysfs file
/sys/kernel/wakeup_reasons/last_resume_reason

Change-Id: I8ac568a7cb58c31decd379195de517ff3c6f9c65
Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
9 years agoof: fix CONFIG_CMDLINE_EXTEND
Colin Cross [Thu, 7 Mar 2013 03:10:29 +0000 (19:10 -0800)]
of: fix CONFIG_CMDLINE_EXTEND

strlcat takes the size of the buffer, not the number of characters
to concatenate.  If the size of the device tree command line p is
larger than the CONFIG_CMDLINE string data, then strcat(data, p, l)
will hit a BUG_ON because strlen(data) > l.

Replace the second strlcat with a strncpy plus a manual null
termination.

Also rearrange the code to reduce indent depth to make it more
readable, and replace data with a char *cmdline to avoid extra
casts.

Signed-off-by: Colin Cross <ccross@android.com>
9 years agoof: Support CONFIG_CMDLINE_EXTEND config option
Doug Anderson [Fri, 3 Feb 2012 06:58:28 +0000 (22:58 -0800)]
of: Support CONFIG_CMDLINE_EXTEND config option

The old logic assumes CMDLINE_FROM_BOOTLOADER vs. CMDLINE_FORCE and
ignores CMDLINE_EXTEND.  Here's the old logic:

- CONFIG_CMDLINE_FORCE=true
    CONFIG_CMDLINE
- dt bootargs=non-empty:
    dt bootargs
- dt bootargs=empty, @data is non-empty string
    @data is left unchanged
- dt bootargs=empty, @data is empty string
    CONFIG_CMDLINE (or "" if that's not defined)

The new logic is now documented in of_fdt.h and is copied here for
reference:

- CONFIG_CMDLINE_FORCE=true
    CONFIG_CMDLINE
- CONFIG_CMDLINE_EXTEND=true, @data is non-empty string
    @data + dt bootargs (even if dt bootargs are empty)
- CONFIG_CMDLINE_EXTEND=true, @data is empty string
    CONFIG_CMDLINE + dt bootargs (even if dt bootargs are empty)
- CMDLINE_FROM_BOOTLOADER=true, dt bootargs=non-empty:
    dt bootargs
- CMDLINE_FROM_BOOTLOADER=true, dt bootargs=empty, @data is non-empty string
    @data is left unchanged
- CMDLINE_FROM_BOOTLOADER=true, dt bootargs=empty, @data is empty string
    CONFIG_CMDLINE (or "" if that's not defined)

Signed-off-by: Doug Anderson <dianders@chromium.org>
CC: devicetree-discuss@lists.ozlabs.org
CC: Grant Likely <grant.likely@secretlab.ca>
CC: Benjamin Herrenschmidt <benh@kernel.crashing.org>
CC: Rob Herring <rob.herring@calxeda.com>
Change-Id: I40ace250847f813358125dfcaa8998fd32cf7ea3
Signed-off-by: Colin Cross <ccross@android.com>
9 years agopower: wakeup_reason: rename irq_count to irqcount
Greg Hackmann [Mon, 10 Mar 2014 21:21:30 +0000 (14:21 -0700)]
power: wakeup_reason: rename irq_count to irqcount

On x86, irq_count conflicts with a declaration in
arch/x86/include/asm/processor.h

Change-Id: I3e4fde0ff64ef59ff5ed2adc0ea3a644641ee0b7
Signed-off-by: Greg Hackmann <ghackmann@google.com>
9 years agoPower: Add guard condition for maximum wakeup reasons
Ruchi Kandoi [Fri, 7 Mar 2014 20:54:30 +0000 (12:54 -0800)]
Power: Add guard condition for maximum wakeup reasons

Ensure the array for the wakeup reason IRQs does not overflow.

Change-Id: Iddc57a3aeb1888f39d4e7b004164611803a4d37c
Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
(cherry picked from commit b5ea40cdfcf38296535f931a7e5e7bf47b6fad7f)

9 years agoandroid: base-cfg: enable DM_VERITY (used for secureboot)
JP Abgrall [Fri, 28 Feb 2014 03:38:14 +0000 (19:38 -0800)]
android: base-cfg: enable DM_VERITY (used for secureboot)

Change-Id: I68d769f97ffa76bb45e65d34a96dd7f558c02d08
Signed-off-by: JP Abgrall <jpa@google.com>
9 years agoPOWER: fix compile warnings in log_wakeup_reason
Ruchi Kandoi [Fri, 21 Feb 2014 03:47:38 +0000 (19:47 -0800)]
POWER: fix compile warnings in log_wakeup_reason

Change I81addaf420f1338255c5d0638b0d244a99d777d1 introduced compile
warnings, fix these.

Change-Id: I05482a5335599ab96c0a088a7d175c8d4cf1cf69
Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>