04 Jan, 2016

1 commit

  • Now the core implements the work queue, remove it from the drivers,
    and switch to using brightness_set_blocking op.

    Signed-off-by: Andrew Lunn
    Signed-off-by: Jacek Anaszewski
    Acked-by: Antonio Ospite
    Reviewed-by: Mark Brown

    Andrew Lunn
     

14 Mar, 2015

1 commit

  • Change the ownership of power_supply structure from each driver
    implementing the class to the power supply core.

    The patch changes power_supply_register() function thus all drivers
    implementing power supply class are adjusted.

    Each driver provides the implementation of power supply. However it
    should not be the owner of power supply class instance because it is
    exposed by core to other subsystems with power_supply_get_by_name().
    These other subsystems have no knowledge when the driver will unregister
    the power supply. This leads to several issues when driver is unbound -
    mostly because user of power supply accesses freed memory.

    Instead let the core own the instance of struct 'power_supply'. Other
    users of this power supply will still access valid memory because it
    will be freed when device reference count reaches 0. Currently this
    means "it will leak" but power_supply_put() call in next patches will
    solve it.

    This solves invalid memory references in following race condition
    scenario:

    Thread 1: charger manager
    Thread 2: power supply driver, used by charger manager

    THREAD 1 (charger manager) THREAD 2 (power supply driver)
    ========================== ==============================
    psy = power_supply_get_by_name()
    Driver unbind, .remove
    power_supply_unregister()
    Device fully removed
    psy->get_property()

    The 'get_property' call is executed in invalid context because the driver was
    unbound and struct 'power_supply' memory was freed.

    This could be observed easily with charger manager driver (here compiled
    with max17040 fuel gauge):

    $ cat /sys/devices/virtual/power_supply/cm-battery/capacity &
    $ echo "1-0036" > /sys/bus/i2c/drivers/max17040/unbind
    [ 55.725123] Unable to handle kernel NULL pointer dereference at virtual address 00000000
    [ 55.732584] pgd = d98d4000
    [ 55.734060] [00000000] *pgd=5afa2831, *pte=00000000, *ppte=00000000
    [ 55.740318] Internal error: Oops: 80000007 [#1] PREEMPT SMP ARM
    [ 55.746210] Modules linked in:
    [ 55.749259] CPU: 1 PID: 2936 Comm: cat Tainted: G W 3.19.0-rc1-next-20141226-00048-gf79f475f3c44-dirty #1496
    [ 55.760190] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
    [ 55.766270] task: d9b76f00 ti: daf54000 task.ti: daf54000
    [ 55.771647] PC is at 0x0
    [ 55.774182] LR is at charger_get_property+0x2f4/0x36c
    [ 55.779201] pc : [] lr : [] psr: 60000013
    [ 55.779201] sp : daf55e90 ip : 00000003 fp : 00000000
    [ 55.790657] r10: 00000000 r9 : c06e2878 r8 : d9b26c68
    [ 55.795865] r7 : dad81610 r6 : daec7410 r5 : daf55ebc r4 : 00000000
    [ 55.802367] r3 : 00000000 r2 : daf55ebc r1 : 0000002a r0 : d9b26c68
    [ 55.808879] Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user
    [ 55.815994] Control: 10c5387d Table: 598d406a DAC: 00000015
    [ 55.821723] Process cat (pid: 2936, stack limit = 0xdaf54210)
    [ 55.827451] Stack: (0xdaf55e90 to 0xdaf56000)
    [ 55.831795] 5e80: 60000013 c01459c4 0000002a c06f8ef8
    [ 55.839956] 5ea0: db651000 c06f8ef8 daebac00 c04cb668 daebac08 c0346864 00000000 c01459c4
    [ 55.848115] 5ec0: d99eaa80 c06f8ef8 00000fff 00001000 db651000 c027f25c c027f240 d99eaa80
    [ 55.856274] 5ee0: d9a06c00 c0146218 daf55f18 00001000 d99eaa80 db4c18c0 00000001 00000001
    [ 55.864468] 5f00: daf55f80 c0144c78 c0144c54 c0107f90 00015000 d99eaab0 00000000 00000000
    [ 55.872603] 5f20: 000051c7 00000000 db4c18c0 c04a9370 00015000 00001000 daf55f80 00001000
    [ 55.880763] 5f40: daf54000 00015000 00000000 c00e53dc db4c18c0 c00e548c 0000000d 00008124
    [ 55.888937] 5f60: 00000001 00000000 00000000 db4c18c0 db4c18c0 00001000 00015000 c00e5550
    [ 55.897099] 5f80: 00000000 00000000 00001000 00001000 00015000 00000003 00000003 c000f364
    [ 55.905239] 5fa0: 00000000 c000f1a0 00001000 00015000 00000003 00015000 00001000 0001333c
    [ 55.913399] 5fc0: 00001000 00015000 00000003 00000003 00000002 00000000 00000000 00000000
    [ 55.921560] 5fe0: 7fffe000 be999850 0000a225 b6f3c19c 60000010 00000003 00000000 00000000
    [ 55.929744] [] (charger_get_property) from [] (power_supply_show_property+0x48/0x20c)
    [ 55.939286] [] (power_supply_show_property) from [] (dev_attr_show+0x1c/0x48)
    [ 55.948130] [] (dev_attr_show) from [] (sysfs_kf_seq_show+0x84/0x104)
    [ 55.956298] [] (sysfs_kf_seq_show) from [] (kernfs_seq_show+0x24/0x28)
    [ 55.964536] [] (kernfs_seq_show) from [] (seq_read+0x1b0/0x484)
    [ 55.972172] [] (seq_read) from [] (__vfs_read+0x18/0x4c)
    [ 55.979188] [] (__vfs_read) from [] (vfs_read+0x7c/0x100)
    [ 55.986304] [] (vfs_read) from [] (SyS_read+0x40/0x8c)
    [ 55.993164] [] (SyS_read) from [] (ret_fast_syscall+0x0/0x48)
    [ 56.000626] Code: bad PC value
    [ 56.011652] ---[ end trace 7b64343fbdae8ef1 ]---

    Signed-off-by: Krzysztof Kozlowski
    Reviewed-by: Bartlomiej Zolnierkiewicz

    [for the nvec part]
    Reviewed-by: Marc Dietrich

    [for compal-laptop.c]
    Acked-by: Darren Hart

    [for the mfd part]
    Acked-by: Lee Jones

    [for the hid part]
    Acked-by: Jiri Kosina

    [for the acpi part]
    Acked-by: Rafael J. Wysocki

    Signed-off-by: Sebastian Reichel

    Krzysztof Kozlowski
     

09 Jul, 2012

2 commits

  • Since none of the users now reference the cache directly we can happily
    remove the custom cache code and rely on the regmap cache.

    For simplicity we don't bother with the register defaults tables but
    instead read the defaults from the device - regmap is capable of doing
    this, unlike our old cache infrastructure. This saves a lot of code and
    allows us to cache the device revision information too.

    Signed-off-by: Mark Brown
    Signed-off-by: Samuel Ortiz

    Mark Brown
     
  • Use the most simple possible transformation on the existing code so keep
    the table sitting around, further patches in this series will delete the
    existing cache code - the main purpose of this patch is to ensure that
    we always have a cache for bisection.

    Signed-off-by: Mark Brown
    Signed-off-by: Samuel Ortiz

    Mark Brown
     

07 May, 2012

1 commit


31 Mar, 2011

1 commit


10 Nov, 2010

1 commit

  • The WM8350 driver was using some custom constants to interpret the direction
    of the MCLK signal which had the opposite values to those used as standard
    by the ASoC core, causing confusion in machine drivers such as the 1133-EV1
    board.

    Reported-by: Tommy Zhu
    Signed-off-by: Mark Brown
    Acked-by: Liam Girdwood

    Mark Brown
     

17 Mar, 2010

1 commit


08 Mar, 2010

5 commits


18 Jan, 2010

1 commit

  • The constants used to specify ISINK ramp times for WM835x had the
    wrong shifts so that the on times applied to the off ramp and vice
    versa. The masks for the bitfields are correct.

    Signed-off-by: Mark Brown
    Cc: stable@kernel.org
    Signed-off-by: Samuel Ortiz

    Mark Brown
     

14 Dec, 2009

4 commits

  • This is done as simple code transformation, the semantics of the
    IRQ API provided by the core are are still very different to those
    of genirq (mainly with regard to masking).

    Signed-off-by: Mark Brown
    Signed-off-by: Samuel Ortiz

    Mark Brown
     
  • This is currently unused by the wm8350 drivers but getting it merged
    now will reduce merge issues in the future when implementing wm8350
    genirq support.

    Signed-off-by: Mark Brown
    Signed-off-by: Samuel Ortiz

    Mark Brown
     
  • Rather than open coding individual IRQs in each function which
    manipulates them store data for IRQs in a table which is then
    referenced in the users.

    This is a substantial code shrink and should be a performance win in
    cases where only a single IRQ goes off at once since instead of
    reading four of the second level IRQ registers for each interrupt
    we read only the sub-registers which have had an interrupt flagged.

    Signed-off-by: Mark Brown
    Signed-off-by: Samuel Ortiz

    Mark Brown
     
  • In preparation for refactoring - it's over 700 lines of well-isolated
    code and having it in a file by itself makes things more managable.

    While we're at it make sure that we clean up the IRQ if we fail after
    acquiring it on init.

    Signed-off-by: Mark Brown
    Signed-off-by: Samuel Ortiz

    Mark Brown
     

17 Sep, 2009

2 commits


05 Apr, 2009

1 commit


16 Jan, 2009

1 commit


09 Jan, 2009

1 commit


08 Jan, 2009

1 commit

  • The voltage and current regulators on the WM8350 AudioPlus PMIC can be
    used in concert to provide a power efficient LED driver. This driver
    implements support for this within the standard LED class.

    Platform initialisation code should configure the LED hardware in the
    init callback provided by the WM8350 core driver. The callback should
    use wm8350_isink_set_flash(), wm8350_dcdc25_set_mode() and
    wm8350_dcdc_set_slot() to configure the operating parameters of the
    regulators for their hardware and then then use wm8350_register_led() to
    instantiate the LED driver.

    This driver was originally written by Liam Girdwood, though it has been
    extensively modified since then.

    Signed-off-by: Mark Brown
    Signed-off-by: Richard Purdie

    Mark Brown
     

04 Jan, 2009

9 commits

  • The WM8351 is a WM8350 variant. As well as register default changes the
    WM8351 has fewer voltage and current regulators than the WM8350.

    Signed-off-by: Mark Brown
    Signed-off-by: Samuel Ortiz

    Mark Brown
     
  • Some WM8350 variants have fewer DCDCs and ISINKs. Identify these at
    probe and refuse to use the absent DCDCs when running on these chips.

    Signed-off-by: Mark Brown
    Signed-off-by: Samuel Ortiz

    Mark Brown
     
  • The WM8352 is a variant of the WM8350. Aside from the register defaults
    there are no software visible differences to the WM8350.

    Signed-off-by: Mark Brown
    Signed-off-by: Samuel Ortiz

    Mark Brown
     
  • Implement support for reporting battery health in the WM8350 battery
    interface. Since we are now able to report this via the classs remove
    the diagnostics from the interrupt handler.

    Signed-off-by: Mark Brown
    Acked-by: Anton Vorontsov
    Signed-off-by: Samuel Ortiz

    Mark Brown
     
  • Since the WM8350 driver was originally written the semantics for the
    identification registers of the chip have been clarified, allowing
    us to do an exact match on all the fields. This avoids mistakenly
    running on unsupported hardware.

    Also change to using the datasheet names more consistently for
    legibility and fix a printk() that should be dev_err().

    Signed-off-by: Mark Brown
    Signed-off-by: Samuel Ortiz

    Mark Brown
     
  • Rather than check for chip revisions in the WM8350 drivers have the core
    code set flags for relevant differences.

    Signed-off-by: Mark Brown
    Signed-off-by: Samuel Ortiz

    Mark Brown
     
  • This patch adds support for the PMU provided by the WM8350 which
    implements battery, line and USB supplies including a battery charger.
    The hardware functions largely autonomously, with minimal software
    control required to initiate fast charging.

    Support for configuration of the USB supply is not yet implemented.
    This means that the hardware will remain in the mode configured at
    startup, by default limiting the current drawn from USB to 100mA.

    This driver was originally written by Liam Girdwood with subsequent
    updates for submission by Mark Brown.

    Signed-off-by: Mark Brown
    Acked-by: Anton Vorontsov
    Signed-off-by: Samuel Ortiz

    Mark Brown
     
  • The auxiliary ADC in the WM8350 is shared between several subdevices
    so access to it needs to be arbitrated by the core driver.

    Signed-off-by: Mark Brown
    Signed-off-by: Samuel Ortiz

    Mark Brown
     
  • No other software changes are required.

    Signed-off-by: Mark Brown
    Signed-off-by: Samuel Ortiz

    Mark Brown
     

19 Dec, 2008

1 commit

  • The WM8350 is an integrated audio and power management subsystem which
    provides a single-chip solution for portable audio and multimedia systems.

    The integrated audio CODEC provides all the necessary functions for
    high-quality stereo recording and playback. Programmable on-chip
    amplifiers allow for the direct connection of headphones and microphones
    with a minimum of external components. A programmable low-noise bias
    voltage is available to feed one or more electret microphones.
    Additional audio features include programmable high-pass filter in the
    ADC input path.

    This driver was originally written by Liam Girdwood with further updates
    from me.

    Signed-off-by: Mark Brown

    Mark Brown
     

13 Nov, 2008

1 commit

  • This adds support for the RTC provided by the Wolfson Microelectronics
    WM8350.

    This driver was originally written by Graeme Gregory and Liam Girdwood,
    though it has been modified since then to update it to current mainline
    coding standards and for API completeness.

    [akpm@linux-foundation.org: s/schedule_timeout_interruptible/schedule_timeout_uninterruptible/ to prevent bogus timeout when signal_pending()]
    Signed-off-by: Mark Brown
    Cc: Alessandro Zummo
    Cc: David Brownell
    Cc: Liam Girdwood
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mark Brown
     

14 Oct, 2008

5 commits

  • In order to avoid merge problems further down the line add placeholders
    for several of the WM8350 client devices and register them, otherwise
    the patches adding the client devices will all try to update the same
    code.

    Also remove redundant checks for null regulator platform devices while
    we're at it.

    Signed-off-by: Mark Brown
    Acked-by: Samuel Ortiz
    Signed-off-by: Liam Girdwood

    Mark Brown
     
  • The WM8350 features six DCDC convertors (four buck and two boost), four
    LDO voltage regulators and two constant current sinks. This driver adds
    support for these through the regulator API.

    This driver was written by Liam Girdwood with updates for submission
    from Mark Brown.

    Signed-off-by: Mark Brown
    Signed-off-by: Liam Girdwood

    Mark Brown
     
  • The WM8350 has an interrupt line to the CPU which is shared by the
    devices on the CPU. This patch adds support for the interrupt
    controller within the WM8350 which identifies which identifies the
    interrupt cause. In common with other similar chips this is done
    outside the standard interrupt framework due to the need to access
    the interrupt controller over an interrupt-driven bus.

    This code was all originally written by Liam Girdwood with updates for
    submission by me.

    Signed-off-by: Mark Brown
    Acked-by: Samuel Ortiz
    Signed-off-by: Liam Girdwood

    Mark Brown
     
  • Some functions of the WM8350 require board-specific initialisation on
    startup. Provide a callback to the WM8350 driver in platform data
    for platforms to use to configure the chip. Use of a callback allows
    platforms to control the ordering of initialisation which can be
    important.

    Signed-off-by: Mark Brown
    Acked-by: Samuel Ortiz
    Signed-off-by: Liam Girdwood

    Mark Brown
     
  • The WM8350 provides a number of user-configurable pins providing access
    to various signals generated by the functions on the chip. These are
    referred to as GPIO pins in the device documentation but in Linux terms
    they are more general than that, providing configuration of alternate
    functions.

    This patch implements support for selecting the alternate functions for
    these pins. They can also be used as GPIOs in the normal Linux sense -
    a subsequent patch will add support for doing so.

    This code was all written by Liam Girdwood and has had minor updates
    and rearrangements by Mark Brown.

    Signed-off-by: Mark Brown
    Acked-by: Samuel Ortiz
    Signed-off-by: Liam Girdwood

    Mark Brown