| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
| |
This patch renames the gpio-generic.c into gpio-mmio.c.
This is because currently the file only contains code
for a memory-mapped GPIO driver. There isn't any support
for ioports or other resource type.
Signed-off-by: Christian Lamparter <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
|
| |
|
|
|
|
|
|
|
| |
GPIO_GENERIC_PLATFORM is a tristate. If the module option is
selected the resulting gpio-generic.ko will lack most of the
module initialzation and probe code.
Signed-off-by: Christian Lamparter <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
|
| |
|
|
|
|
|
| |
Use devm_gpiochip_add_data() for GPIO registration and remove the
need of driver callback .remove.
Signed-off-by: Laxman Dewangan <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The separate struct bgpio_chip has been a pain to handle, both
by being confusingly similar in name to struct gpio_chip and
for being contained inside a struct so that struct gpio_chip
is contained in a struct contained in a struct, making several
steps of dereferencing necessary.
Make things simpler: include the fields directly into
<linux/gpio/driver.h>, #ifdef:ed for CONFIG_GENERIC_GPIO, and
get rid of the <linux/basic_mmio_gpio.h> altogether. Prefix
some of the member variables with bgpio_* and add proper
kerneldoc while we're at it.
Modify all users to handle the change and use a struct
gpio_chip directly. And while we're at it: replace all
container_of() dereferencing by gpiochip_get_data() and
registering the gpio_chip with gpiochip_add_data().
Cc: [email protected]
Cc: Alexander Shiyan <[email protected]>
Cc: Shawn Guo <[email protected]>
Cc: Sascha Hauer <[email protected]>
Cc: Kukjin Kim <[email protected]>
Cc: Alexandre Courbot <[email protected]>
Cc: Brian Norris <[email protected]>
Cc: Florian Fainelli <[email protected]>
Cc: Sudeep Holla <[email protected]>
Cc: Lorenzo Pieralisi <[email protected]>
Cc: Nicolas Pitre <[email protected]>
Cc: Olof Johansson <[email protected]>
Cc: Vladimir Zapolskiy <[email protected]>
Cc: Rabin Vincent <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Acked-by: Gregory Fong <[email protected]>
Acked-by: Liviu Dudau <[email protected]>
Acked-by: H Hartley Sweeten <[email protected]>
Acked-by: Tony Lindgren <[email protected]>
Acked-by: Krzysztof Kozlowski <[email protected]>
Acked-by: Lee Jones <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
cppcheck reports this:
(style) int result is returned as long value. If the return
value is long to avoid loss of information, then you have
loss of information.
This can be fixed with (1UL << pin) but that is the same
as using <linux/bitops.h> that already use 1UL so take
this approach.
Reported-by: David Binderman <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
|
| |\
| |
| |
| | |
Linux 4.4-rc6
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The bgpio_get_set() call should return a value clamped to [0,1],
the current code will return a negative value if reading
bit 31, which turns the value negative as this is a signed value
and thus gets interpreted as an error by the gpiolib core.
Found on the gpio-mxc but applies to any MMIO driver.
Cc: [email protected] # 4.3+
Cc: [email protected]
Cc: Vladimir Zapolskiy <[email protected]>
Fixes: e20538b82f1f ("gpio: Propagate errors from chip->get()")
Reported-by: Clemens Gruber <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
|
| |/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The name .dev in a struct is normally reserved for a struct device
that is let us say a superclass to the thing described by the struct.
struct gpio_chip stands out by confusingly using a struct device *dev
to point to the parent device (such as a platform_device) that
represents the hardware. As we want to give gpio_chip:s real devices,
this is not working. We need to rename this member to parent.
This was done by two coccinelle scripts, I guess it is possible to
combine them into one, but I don't know such stuff. They look like
this:
@@
struct gpio_chip *var;
@@
-var->dev
+var->parent
and:
@@
struct gpio_chip var;
@@
-var.dev
+var.parent
and:
@@
struct bgpio_chip *var;
@@
-var->gc.dev
+var->gc.parent
Plus a few instances of bgpio that I couldn't figure out how
to teach Coccinelle to rewrite.
This patch hits all over the place, but I *strongly* prefer this
solution to any piecemal approaches that just exercise patch
mechanics all over the place. It mainly hits drivers/gpio and
drivers/pinctrl which is my own backyard anyway.
Cc: Haavard Skinnemoen <[email protected]>
Cc: Rafał Miłecki <[email protected]>
Cc: Richard Purdie <[email protected]>
Cc: Mauro Carvalho Chehab <[email protected]>
Cc: Alek Du <[email protected]>
Cc: Jaroslav Kysela <[email protected]>
Cc: Takashi Iwai <[email protected]>
Acked-by: Dmitry Torokhov <[email protected]>
Acked-by: Greg Kroah-Hartman <[email protected]>
Acked-by: Lee Jones <[email protected]>
Acked-by: Jiri Kosina <[email protected]>
Acked-by: Hans-Christian Egtvedt <[email protected]>
Acked-by: Jacek Anaszewski <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Returning an error instead of NULL in bgpio_map if
platform_get_resource_byname does not find a resource was introduced with
commit cf3f2a2c8bae ("gpio: generic: improve error handling in bgpio_map").
This results in several qemu runtime failures with default and non-default
configurations, if attempts are made to boot from mmcblk0. Examples for
failures with multi_v7_defconfig are
Machine: vexpress-a9 dtb: vexpress-v2p-ca9
Machine: vexpress-a15 dtb: vexpress-v2p-ca15-tc1
Crash:
VFS: Cannot open root device "mmcblk0" or unknown-block(0,0): error -6
Please append a correct "root=" boot option; here are the available partitions:
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
Looking into the code, always returning an error if bgpio_map fails
does not appear to make much sense, since the code in bgpio_setup_io
specifically supports some of the resources to be NULL.
Fixes: cf3f2a2c8bae ("gpio: generic: improve error handling in bgpio_map")
Cc: Heiner Kallweit <[email protected]>
Signed-off-by: Guenter Roeck <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
|
| |
|
|
|
|
|
|
| |
Use the ERRPTR standard way to return an error code in a pointer
thus simplifiying the code.
Signed-off-by: Heiner Kallweit <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
|
| |
|
|
|
|
|
| |
Replace devm_request_mem_region / devm_ioremap with devm_ioremap_resource.
Signed-off-by: Heiner Kallweit <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
|
| |
|
|
|
|
|
| |
If bgpio_map returns NULL then err should always be set.
Signed-off-by: Heiner Kallweit <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
|
| |
|
|
|
|
|
|
| |
Allow chips to indicates that they are input-only and thus cannot set
the output value. This will be used by the gpio-etraxfs driver.
Signed-off-by: Rabin Vincent <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
|
| |
|
|
|
|
|
|
|
| |
Allow to determine the current direction configuration by
reading back from the direction register.
Signed-off-by: Philipp Zabel <[email protected]>
Acked-by: Alexandre Courbot <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
|
| |
|
|
|
|
|
|
|
| |
The change introduces BGPIOF_READ_OUTPUT_REG_SET flag for gpio-generic
GPIO chip implementation, which allows to get correct configured value
from reg_set register, input value is still get from reg_dat.
Signed-off-by: Vladimir Zapolskiy <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
|
| |
|
|
|
|
|
|
|
| |
Add set_multiple functions to the generic driver for memory-mapped GPIO
controllers to improve performance when setting multiple outputs
simultaneously.
Signed-off-by: Rojhalat Ibrahim <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
|
| |
|
|
|
| |
Signed-off-by: abdoulaye berthe <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
| |
gpiolib will require all gpio drivers to expicitly set the request
function pointer in the future. To encourage gpio driver developers
to adhere to this standard gpio-generic.c now sets this function
pointer.
Signed-off-by: Anthony Fee <[email protected]>
Acked-by: Alexandre Courbot <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
|
| |
|
|
|
|
| |
Signed-off-by: Alexander Shiyan <[email protected]>
Reviewed-by: Alexandre Courbot <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
|
| |
|
|
|
|
|
|
|
|
| |
The generic GPIO would return 0 for low generic GPIO, and
something != 0 for high GPIO. Let's make this sane by clamping
the returned value to [0,1].
Reported-by: Evgeny Boger <[email protected]>
Reviewed-by: Alexandre Courbot <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
|
| |
|
|
|
|
|
|
| |
When registering more than one platform device, it is
useful to set the gpio chip label in the platform data.
Signed-off-by: Pawel Moll <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
| |
Memory for basic-mmio-gpio driver is allocated by the driver
using it, whether it's the generic GPIO driver itself or another
driver. In either case, the owner shall allocate and free the
struct bgpio_chip it is using, preferably using a managed
resource.
Signed-off-by: Alexander Shiyan <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
|
| |
|
|
|
|
|
|
|
| |
There is no general support for 64-bit big endian accesses, so that is
left unsupported.
Signed-off-by: Andreas Larsson <[email protected]>
Acked-by: Anton Vorontsov <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
| |
CONFIG_HOTPLUG is going away as an option so __devexit is no
longer needed.
Signed-off-by: Bill Pemberton <[email protected]>
Cc: Grant Likely <[email protected]>
Acked-by: Linus Walleij <[email protected]>
Cc: Peter Tyser <[email protected]>
Acked-by: Mark Brown <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
CONFIG_HOTPLUG is going away as an option so __devinit is no longer
needed.
Signed-off-by: Bill Pemberton <[email protected]>
Cc: Grant Likely <[email protected]>
Cc: Peter Tyser <[email protected]>
Cc: Santosh Shilimkar <[email protected]>
Cc: Kevin Hilman <[email protected]>
Acked-by: Linus Walleij <[email protected]>
Acked-by: Mark Brown <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
| |
CONFIG_HOTPLUG is going away as an option so __devexit_p is no longer
needed.
Signed-off-by: Bill Pemberton <[email protected]>
Cc: Grant Likely <[email protected]>
Cc: Peter Tyser <[email protected]>
Acked-by: Linus Walleij <[email protected]>
Acked-by: Mark Brown <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It fixes the issue in gpio-generic that commit fb14921 (gpio/mxc: add
missing initialization of basic_mmio_gpio shadow variables) manged to
fix in gpio-mxc driver, so that other platform specific drivers do not
suffer from the same problem over and over again.
Changes since v1:
* Turn the last parameter of bgpio_init() "bool big_endian" into
"unsigned long flags" and give those really quirky hardwares a
chance to tell that reg_set and reg_dir are unreadable.
Signed-off-by: Shawn Guo <[email protected]>
[grant.likely: Fix big-endian usage to explicitly set BBGPIOF_BIG_ENDIAN]
Signed-off-by: Grant Likely <[email protected]>
|
| |
|
|
|
|
|
|
|
| |
Where appropriate factor out some boilerplate code for platform device
registration into module_platform_driver. Drivers that don't use the
standard module_init initcall haven't been converted.
Signed-off-by: Mark Brown <[email protected]>
Signed-off-by: Grant Likely <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Building a kernel with hotplug disabled results in a link failure:
`bgpio_remove' referenced in section `___ksymtab_gpl+bgpio_remove' of drivers/built-in.o: defined in discarded section `.devexit.text' of drivers/built-in.o
This is because of bgpio_remove() is exported. It is illegal to export
symbols which are discarded either at link time or as part of an
init/exit section.
Fix this by dropping the __devexit attributation from bgpio_remove().
Also drop the __devinit attributation from bgpio_init().
Signed-off-by: Russell King <[email protected]>
Cc: Grant Likely <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
|
|
|
Sort the gpio makefile and enforce the naming convention gpio-*.c for
gpio drivers.
v2: cleaned up filenames in Kconfig and comment blocks
v3: fixup use of BASIC_MMIO to GENERIC_GPIO for mxc
Signed-off-by: Grant Likely <[email protected]>
|