23 Jul, 2020

1 commit

  • This makes the driver use the irqchip template to assign
    properties to the gpio_irq_chip instead of using the
    explicit call to gpiochip_irqchip_add().

    The irqchip is instead added while adding the gpiochip.
    Also move the IRQ initialization to the special .init_hw()
    callback.

    Signed-off-by: Linus Walleij
    Acked-by: William Breathitt Gray
    Cc: William Breathitt Gray
    Link: https://lore.kernel.org/r/20200722103915.162156-1-linus.walleij@linaro.org

    Linus Walleij
     

05 Dec, 2019

1 commit

  • Replace verbose implementation in get_multiple/set_multiple callbacks
    with for_each_set_clump8 macro to simplify code and improve clarity.

    Link: http://lkml.kernel.org/r/08b9c9a3e75ef1ab0d172223d10a1661f2b43fe2.1570641097.git.vilhelm.gray@gmail.com
    Signed-off-by: William Breathitt Gray
    Reviewed-by: Linus Walleij
    Cc: Andy Shevchenko
    Cc: Arnd Bergmann
    Cc: Bartosz Golaszewski
    Cc: Geert Uytterhoeven
    Cc: Geert Uytterhoeven
    Cc: Lukas Wunner
    Cc: Masahiro Yamada
    Cc: Mathias Duckeck
    Cc: Morten Hein Tiljeset
    Cc: Phil Reid
    Cc: Rasmus Villemoes
    Cc: Sean Nyekjaer
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    William Breathitt Gray
     

07 Nov, 2019

1 commit

  • It's hard for occasional GPIO code reader/writer to know if values 0/1
    equal to IN or OUT. Use defined GPIO_LINE_DIRECTION_IN and
    GPIO_LINE_DIRECTION_OUT to help them out.

    NOTE - for gpio-amd-fch and gpio-bd9571mwv:
    This commit also changes the return value for direction get to equal 1
    for direction INPUT. Prior this commit these drivers might have
    returned some other positive value but 1 for INPUT.

    Signed-off-by: Matti Vaittinen
    Acked-by: Scott Branden
    Reviewed-by: Grygorii Strashko
    Reviewed-by: Michal Simek
    Reviewed-by: Geert Uytterhoeven
    Acked-by: Andy Shevchenko
    Acked-by: William Breathitt Gray
    Acked-by: Kuppuswamy Sathyanarayanan
    Signed-off-by: Linus Walleij

    Matti Vaittinen
     

31 May, 2019

1 commit

  • Based on 1 normalized pattern(s):

    this program is free software you can redistribute it and or modify
    it under the terms of the gnu general public license version 2 as
    published by the free software foundation this program is
    distributed in the hope that it will be useful but without any
    warranty without even the implied warranty of merchantability or
    fitness for a particular purpose see the gnu general public license
    for more details

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-only

    has been chosen to replace the boilerplate/reference in 655 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Allison Randal
    Reviewed-by: Kate Stewart
    Reviewed-by: Richard Fontana
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190527070034.575739538@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

05 Nov, 2018

1 commit


16 May, 2018

1 commit

  • Don't populate the const read-only array 'ports' on the stack but instead
    make it static. Makes the object code smaller by over 100 buytes:

    Before:
    text data bss dec hex filename
    10959 4952 832 16743 4167 drivers/gpio/gpio-104-dio-48e.o

    After:
    text data bss dec hex filename
    10790 5008 832 16630 40f6 drivers/gpio/gpio-104-dio-48e.o

    (gcc version 7.2.0 x86_64)

    Signed-off-by: Colin Ian King
    Acked-by: William Breathitt Gray
    Signed-off-by: Linus Walleij

    Colin Ian King
     

26 Mar, 2018

1 commit

  • The ACCES I/O 104-DIO-48E series of devices contain two Programmable
    Peripheral Interface (PPI) chips of type 82C55, which each feature three
    8-bit ports of I/O. Since eight input lines are acquired on a single
    port input read, the 104-DIO-48E GPIO driver may improve multiple input
    reads by utilizing a get_multiple callback. This patch implements the
    dio48e_gpio_get_multiple function which serves as the respective
    get_multiple callback.

    Signed-off-by: William Breathitt Gray
    Signed-off-by: Linus Walleij

    William Breathitt Gray
     

08 Nov, 2017

1 commit


11 May, 2017

1 commit

  • Pull hw lockdown support from David Howells:
    "Annotation of module parameters that configure hardware resources
    including ioports, iomem addresses, irq lines and dma channels.

    This allows a future patch to prohibit the use of such module
    parameters to prevent that hardware from being abused to gain access
    to the running kernel image as part of locking the kernel down under
    UEFI secure boot conditions.

    Annotations are made by changing:

    module_param(n, t, p)
    module_param_named(n, v, t, p)
    module_param_array(n, t, m, p)

    to:

    module_param_hw(n, t, hwtype, p)
    module_param_hw_named(n, v, t, hwtype, p)
    module_param_hw_array(n, t, hwtype, m, p)

    where the module parameter refers to a hardware setting

    hwtype specifies the type of the resource being configured. This can
    be one of:

    ioport Module parameter configures an I/O port
    iomem Module parameter configures an I/O mem address
    ioport_or_iomem Module parameter could be either (runtime set)
    irq Module parameter configures an I/O port
    dma Module parameter configures a DMA channel
    dma_addr Module parameter configures a DMA buffer address
    other Module parameter configures some other value

    Note that the hwtype is compile checked, but not currently stored (the
    lockdown code probably won't require it). It is, however, there for
    future use.

    A bonus is that the hwtype can also be used for grepping.

    The intention is for the kernel to ignore or reject attempts to set
    annotated module parameters if lockdown is enabled. This applies to
    options passed on the boot command line, passed to insmod/modprobe or
    direct twiddling in /sys/module/ parameter files.

    The module initialisation then needs to handle the parameter not being
    set, by (1) giving an error, (2) probing for a value or (3) using a
    reasonable default.

    What I can't do is just reject a module out of hand because it may
    take a hardware setting in the module parameters. Some important
    modules, some ipmi stuff for instance, both probe for hardware and
    allow hardware to be manually specified; if the driver is aborts with
    any error, you don't get any ipmi hardware.

    Further, trying to do this entirely in the module initialisation code
    doesn't protect against sysfs twiddling.

    [!] Note that in and of itself, this series of patches should have no
    effect on the the size of the kernel or code execution - that is
    left to a patch in the next series to effect. It does mark
    annotated kernel parameters with a KERNEL_PARAM_FL_HWPARAM flag in
    an already existing field"

    * tag 'hwparam-20170420' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs: (38 commits)
    Annotate hardware config module parameters in sound/pci/
    Annotate hardware config module parameters in sound/oss/
    Annotate hardware config module parameters in sound/isa/
    Annotate hardware config module parameters in sound/drivers/
    Annotate hardware config module parameters in fs/pstore/
    Annotate hardware config module parameters in drivers/watchdog/
    Annotate hardware config module parameters in drivers/video/
    Annotate hardware config module parameters in drivers/tty/
    Annotate hardware config module parameters in drivers/staging/vme/
    Annotate hardware config module parameters in drivers/staging/speakup/
    Annotate hardware config module parameters in drivers/staging/media/
    Annotate hardware config module parameters in drivers/scsi/
    Annotate hardware config module parameters in drivers/pcmcia/
    Annotate hardware config module parameters in drivers/pci/hotplug/
    Annotate hardware config module parameters in drivers/parport/
    Annotate hardware config module parameters in drivers/net/wireless/
    Annotate hardware config module parameters in drivers/net/wan/
    Annotate hardware config module parameters in drivers/net/irda/
    Annotate hardware config module parameters in drivers/net/hamradio/
    Annotate hardware config module parameters in drivers/net/ethernet/
    ...

    Linus Torvalds
     

20 Apr, 2017

1 commit

  • When the kernel is running in secure boot mode, we lock down the kernel to
    prevent userspace from modifying the running kernel image. Whilst this
    includes prohibiting access to things like /dev/mem, it must also prevent
    access by means of configuring driver modules in such a way as to cause a
    device to access or modify the kernel image.

    To this end, annotate module_param* statements that refer to hardware
    configuration and indicate for future reference what type of parameter they
    specify. The parameter parser in the core sees this information and can
    skip such parameters with an error message if the kernel is locked down.
    The module initialisation then runs as normal, but just sees whatever the
    default values for those parameters is.

    Note that we do still need to do the module initialisation because some
    drivers have viable defaults set in case parameters aren't specified and
    some drivers support automatic configuration (e.g. PNP or PCI) in addition
    to manually coded parameters.

    This patch annotates drivers in drivers/gpio/.

    Suggested-by: Alan Cox
    Signed-off-by: David Howells
    Acked-by: William Breathitt Gray
    Acked-by: Linus Walleij
    cc: Alexandre Courbot
    cc: linux-gpio@vger.kernel.org

    David Howells
     

17 Mar, 2017

1 commit

  • The 104-dio-48e gpio driver currently implements an irq_chip for
    handling interrupts; due to how irq_chip handling is done, it's
    necessary for the irq_chip methods to be invoked from hardirq context,
    even on a a real-time kernel. Because the spinlock_t type becomes a
    "sleeping" spinlock w/ RT kernels, it is not suitable to be used with
    irq_chips.

    A quick audit of the operations under the lock reveal that they do only
    minimal, bounded work, and are therefore safe to do under a raw spinlock.

    Signed-off-by: Julia Cartwright
    Acked-by: William Breathitt Gray
    Signed-off-by: Linus Walleij

    Julia Cartwright
     

01 Feb, 2017

2 commits


26 Jan, 2017

2 commits

  • The devm_ resource manager functions allow memory to be automatically
    released when a device is unbound. This patch takes advantage of the
    resource manager functions and replaces the gpiochip_add_data call and
    request_irq call with the devm_gpiochip_add_data call and
    devm_request_irq call respectively. In addition, the dio48e_remove
    function has been removed as no longer necessary due to the use of the
    relevant devm_ resource manager functions.

    Signed-off-by: William Breathitt Gray
    Signed-off-by: Linus Walleij

    William Breathitt Gray
     
  • The ACCES 104-DIO-48E series provides registers where 8 lines of GPIO
    may be set at a time. This patch add support for the set_multiple
    callback function, thus allowing multiple GPIO output lines to be set
    more efficiently in groups.

    Signed-off-by: William Breathitt Gray
    Signed-off-by: Linus Walleij

    William Breathitt Gray
     

08 Jun, 2016

1 commit

  • There are only two control ports, each controlling three distinct I/O
    ports. To compute the control port address offset for a respective I/O
    port, the I/O port address offset should be divided by 3; dividing by 2
    may result in not only the wrong address offset but possibly also an
    out-of-bounds array memory access for a non-existent third control port.

    Fixes: 1b06d64f7374 ("gpio: Add GPIO support for the ACCES 104-DIO-48E")
    Signed-off-by: William Breathitt Gray
    Signed-off-by: Linus Walleij

    William Breathitt Gray
     

03 May, 2016

1 commit

  • The ACCES 104-DIO-48E series communicates via the ISA bus. As such, it
    is more appropriate to use the ISA bus driver over the platform driver
    to control the ACCES 104-DIO-48E GPIO driver.

    This patch also adds support for multiple devices via the base and irq
    module array parameters. Each element of the base array corresponds to a
    discrete device; each element of the irq array corresponds to the
    respective device addressed in the respective base array element.

    Acked-by: Linus Walleij
    Cc: Alexandre Courbot
    Signed-off-by: William Breathitt Gray
    Signed-off-by: Greg Kroah-Hartman

    William Breathitt Gray
     

16 Feb, 2016

2 commits


28 Jan, 2016

1 commit

  • The ACCES 104-DIO-48E device provides 48 lines digital I/O via two
    Programmable Peripheral Interface (PPI) chips of type 82C55. Bit C3 at
    each 24-bit Group can be used as an external interrupt, triggered by a
    rising edge.

    This driver provides GPIO and IRQ support for these 48 channels of
    digital I/O. The base port address for the device may be configured via
    the dio_48e_base module parameter. The interrupt line number for the
    device may be configured via the dio_48e_irq module parameter.

    Signed-off-by: William Breathitt Gray
    Signed-off-by: Linus Walleij

    William Breathitt Gray