Age | Commit message (Collapse) | Author | Files | Lines |
|
For logging in device contexts, dev_*() functions are preferred over
raw printk(), which also print out device name.
Signed-off-by: Enrico Weigelt, metux IT consult <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Linus Walleij <[email protected]>
|
|
The idea to create a debugfs to replace the aging and
dangerous sysfs ABI for hacking and tinkering came up
on the list.
Signed-off-by: Linus Walleij <[email protected]>
Reviewed-by: Geert Uytterhoeven <[email protected]>
Cc: Geert Uytterhoeven <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
|
|
When trying to export an nonexisting gpio ID, the kernel prints out a
big warning w/ stacktrace, sounding like a huge problem. In fact it's
a pretty normal situation, like file or device not found.
So, just print a more relaxed warning instead.
changes v2: drop defining pr_fmt()
Signed-off-by: Enrico Weigelt <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Linus Walleij <[email protected]>
|
|
Using CLOCK_REALTIME as the source for event timestamps is crucial for
some specific applications, particularly those requiring timetamps
relative to a PTP clock, so provide an option to switch the event
timestamp source from the default CLOCK_MONOTONIC to CLOCK_REALTIME.
Note that CLOCK_REALTIME was the default source clock for GPIO until
Linux 5.7 when it was changed to CLOCK_MONOTONIC due to issues with the
shifting of the realtime clock.
Providing this option maintains the CLOCK_MONOTONIC as the default,
while also providing a path forward for those dependent on the pre-5.7
behaviour.
Suggested-by: Jack Winch <[email protected]>
Signed-off-by: Kent Gibson <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Linus Walleij <[email protected]>
|
|
This adds a driver that supports the GPIO block found in
MStar/SigmaStar ARMv7 SoCs.
The controller seems to have enough register for 128 lines
but where they are wired up differs between chips and
no currently known chip uses anywhere near 128 lines so there
needs to be some per-chip data to collect together what lines
actually have physical pins attached and map the right names to them.
The core peripherals seem to use the same lines on the
currently known chips but the lines used for the sensor
interface, lcd controller etc pins seem to be totally
different between the infinity and mercury chips
The code tries to collect all of the re-usable names,
offsets etc together so that it's easy to build the extra
per-chip data for other chips in the future.
So far this only supports the MSC313 and MSC313E chips.
Support for the SSC8336N (mercury5) is trivial to add once
all of the lines have been mapped out.
Signed-off-by: Daniel Palmer <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Linus Walleij <[email protected]>
|
|
mxs is a devicetree-only platform and hence it does not make use
of the id_table mechanism.
Get rid of the .id_table as it is unused.
Signed-off-by: Fabio Estevam <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Linus Walleij <[email protected]>
|
|
This assigns the .irq_set_affinity to the parent callback.
I assume the Tegra186 is an SMP system so this would be
beneficial.
I used the pattern making the hirerarchy tolerant for missing
parent as in Marc's earlier patch.
Suggested-by: Marc Zyngier <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
Cc: Thierry Reding <[email protected]>
Cc: Vidya Sagar <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
|
|
This assigns the .irq_set_affinity to the parent callback.
I assume the sifive GPIO can be used in systems with
SMP.
I used the pattern making the hirerarchy tolerant for missing
parent as in Marc's earlier patches.
Suggested-by: Marc Zyngier <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
Cc: Yash Shah <[email protected]>
Cc: Wesley W. Terpstra <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
|
|
If users select sysfs support they get the character device
as well so that end-users cannot complain that they
"only have sysfs on my system". They should have the
character device at all times.
If someone is in so dire need of stripping out the
character device while still enabling the sysfs ABI they
can very well patch the kernel.
Also only show this obsolete option to expert users.
Signed-off-by: Linus Walleij <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
|
|
Commit 2233bf7a92e ("gpio: mvebu: switch to regmap for register access")
changed most readl/writel registers access calls to the regmap API in
preparation for Armada 7K/8K support. PWM duration registers were left using
readl/writel, as the driver does not support PWM for Armada 7K/8K.
Switch PWM duration registers to regmap as first step in adding Armada 7K/8K
PWM functionality support.
Reviewed-by: Andrew Lunn <[email protected]>
Signed-off-by: Baruch Siach <[email protected]>
Signed-off-by: Bartosz Golaszewski <[email protected]>
|
|
Commit 2233bf7a92e ("gpio: mvebu: switch to regmap for register access")
introduced percpu_regs to replace percpu_membase. Update the comment to
match.
Cc: Thomas Petazzoni <[email protected]>
Fixes: 2233bf7a92e7 ("gpio: mvebu: switch to regmap for register access")
Reviewed-by: Andrew Lunn <[email protected]>
Signed-off-by: Baruch Siach <[email protected]>
Signed-off-by: Bartosz Golaszewski <[email protected]>
|
|
When mvebu_pwm_probe() fails IRQ domain is not released. Move pwm probe
before IRQ domain allocation. Add pwm cleanup code to the failure path.
Fixes: 757642f9a584 ("gpio: mvebu: Add limited PWM support")
Reported-by: Andrew Lunn <[email protected]>
Signed-off-by: Baruch Siach <[email protected]>
Signed-off-by: Bartosz Golaszewski <[email protected]>
|
|
pm_runtime_get_sync will increment pm usage counter even it
failed. Forgetting to putting operation will result in a
reference leak here.
A new function pm_runtime_resume_and_get is introduced in
[0] to keep usage counter balanced. So We fix the reference
leak by replacing it with new funtion.
[0] dd8088d5a896 ("PM: runtime: Add pm_runtime_resume_and_get to deal with usage counter")
Fixes: c2df3de0d07e ("gpio: zynq: properly support runtime PM for GPIO used as interrupts")
Reported-by: Hulk Robot <[email protected]>
Signed-off-by: Qinglang Miao <[email protected]>
Signed-off-by: Bartosz Golaszewski <[email protected]>
|
|
A similar check was added in gpiochip_generic_request, but not in free.
This has caused an imbalance count of request vs. free calls to the
pinctrl driver. This patch is targeted to fix that issue.
Fixes: 2ab73c6d8323 ("gpio: Support GPIO controllers without pin-ranges")
Signed-off-by: Edmond Chung <[email protected]>
Signed-off-by: Andrew Chant <[email protected]>
Signed-off-by: Will McVicker <[email protected]>
Signed-off-by: Bartosz Golaszewski <[email protected]>
|
|
Following Calltrace is found when running echo freeze > /sys/power/state.
[ 272.755506] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000010
[ 272.755585] Call trace:
[ 272.755587] dwapb_gpio_suspend+0x18/0x318
[ 272.755588] pm_generic_suspend+0x2c/0x48
[ 272.755595] acpi_subsys_suspend+0x60/0x70
[ 272.755599] dpm_run_callback.isra.18+0x40/0xe0
[ 272.755601] __device_suspend+0xf4/0x360
The reason is platform_set_drvdata() is deleted, and dwapb_gpio_suspend()
get *gpio by dev_get_drvdata().
Fixes: feeaefd378ca ("gpio: dwapb: Use resource managed GPIO-chip add data method")
Signed-off-by: Luo Jiaxing <[email protected]>
Acked-by: Serge Semin <[email protected]>
Reviewed-by: Andy Shevchenko <[email protected]>
Signed-off-by: Bartosz Golaszewski <[email protected]>
|
|
pm_runtime_enable will increase power disable depth. Thus a
pairing decrement is needed on the error handling path to keep
it balanced.
Fixes:27a49ed17e224(gpio: arizona: Add support for GPIOs that)
Reported-by: Hulk Robot <[email protected]>
Signed-off-by: Zheng Liang <[email protected]>
Signed-off-by: Bartosz Golaszewski <[email protected]>
|
|
The gpiochip may have dependencies from pinmux and so got deferred. Now it
will print error message every time -EPROBE_DEFER is returned which is
unnecessary:
"gpiochip_add_data_with_key: GPIOs 0..31 (gpio-0-31) failed to register, -517"
Hence, do suppress error message for -EPROBE_DEFER case.
Signed-off-by: Grygorii Strashko <[email protected]>
Signed-off-by: Bartosz Golaszewski <[email protected]>
|
|
In preparation to enable -Wimplicit-fallthrough for Clang, fix a
warning by explicitly adding a fallthrough pseudo-keyword to indicate
that the code is intended to fall through to the next case.
Link: https://github.com/KSPP/linux/issues/115
Signed-off-by: Gustavo A. R. Silva <[email protected]>
Signed-off-by: Bartosz Golaszewski <[email protected]>
|
|
In preparation to enable -Wimplicit-fallthrough for Clang, fix a warning
by explicitly adding a break statement instead of letting the code fall
through to the next case.
Link: https://github.com/KSPP/linux/issues/115
Signed-off-by: Gustavo A. R. Silva <[email protected]>
Reviewed-by: Andy Shevchenko <[email protected]>
Signed-off-by: Bartosz Golaszewski <[email protected]>
|
|
The gpiochip_add_data() may return -EPROBE_DEFER which is not handled
properly by TI GPIO driver and causes unnecessary boot log messages.
Hence, add proper deferred probe handling with new dev_err_probe() API.
Signed-off-by: Grygorii Strashko <[email protected]>
Acked-by: Tony Lindgren <[email protected]>
Signed-off-by: Bartosz Golaszewski <[email protected]>
|
|
There is no matching spi_get_drvdata() call in the driver, so there is no
need to do spi_set_drvdata(). This looks like it probably was copied from a
driver that used both spi_set_drvdata() & spi_get_drvdata().
Signed-off-by: Alexandru Ardelean <[email protected]>
Reviewed-by: Andy Shevchenko <[email protected]>
Signed-off-by: Bartosz Golaszewski <[email protected]>
|
|
In dwapb_get_reset(), if devm_reset_control_get_optional_shared() fails,
an error message is printed even if the failure is the benign
EPROBE_DEFER error due to the reset controller not yet being
initialized. Use dev_err_probe() to handle
devm_reset_control_get_optional_shared() errors to avoid unnecessarilly
printing an error message for the deferred probe error.
Signed-off-by: Damien Le Moal <[email protected]>
Signed-off-by: Bartosz Golaszewski <[email protected]>
|
|
We can simplify the error path in probe() and drop remove() entirely if
we provide a devm action for freeing the device ID.
Signed-off-by: Bartosz Golaszewski <[email protected]>
Reviewed-by: Andy Shevchenko <[email protected]>
|
|
We can simplify the code in gpio-exar by using regmap. This allows us to
drop the mutex (regmap provides its own locking) and we can also reuse
regmap's bit operations instead of implementing our own update function.
Signed-off-by: Bartosz Golaszewski <[email protected]>
Reviewed-by: Andy Shevchenko <[email protected]>
|
|
Provide and use helpers for calculating the register address and bit
offset instead of hand coding it in every function.
Signed-off-by: Bartosz Golaszewski <[email protected]>
Reviewed-by: Andy Shevchenko <[email protected]>
|
|
It's more elegant to use a helper local variable to store the address
of the underlying struct device than to dereference pdev everywhere. It
also has the benefit of avoiding unnecessary line breaks.
Signed-off-by: Bartosz Golaszewski <[email protected]>
Reviewed-by: Andy Shevchenko <[email protected]>
|
|
We don't need to specify any ranges when allocating IDs so we can switch
to ida_alloc() and ida_free() instead of the ida_simple_ counterparts.
ida_simple_get(ida, 0, 0, gfp) is equivalent to
ida_alloc_range(ida, 0, UINT_MAX, gfp) which is equivalent to
ida_alloc(ida, gfp). Note: IDR will never actually allocate an ID
larger than INT_MAX.
Signed-off-by: Bartosz Golaszewski <[email protected]>
Reviewed-by: Andy Shevchenko <[email protected]>
|
|
This driver uses IDA APIs but doesn't include the relevant header. This
fixes it.
Signed-off-by: Bartosz Golaszewski <[email protected]>
Reviewed-by: Andy Shevchenko <[email protected]>
|
|
It's customary to have a newline between the copyright header and the
includes. Add one to gpio-exar.
Signed-off-by: Bartosz Golaszewski <[email protected]>
Reviewed-by: Andy Shevchenko <[email protected]>
|
|
Use regmap accessors directly for register manipulation - removing one
layer of abstraction.
Signed-off-by: Michał Mirosław <[email protected]>
Acked-by: Bartosz Golaszewski <[email protected]>
Acked-by: Linus Walleij <[email protected]>
Signed-off-by: Lee Jones <[email protected]>
|
|
We can get hwirq number of the gpio by its irq_data->hwirq so that we don't
need to add more macros for different platforms. This patch is tested in
SiFive Unleashed board and SiFive Unmatched board.
Signed-off-by: Greentime Hu <[email protected]>
Signed-off-by: Bartosz Golaszewski <[email protected]>
|
|
Since 5.10-rc1 i.MX is a devicetree-only platform, so simplify the code
by removing the unused non-DT support.
Signed-off-by: Fabio Estevam <[email protected]>
Reviewed-by: Andy Shevchenko <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Linus Walleij <[email protected]>
|
|
In two different instances the return value of "of_property_read_u32"
API was neither captured nor checked.
Fixed it by capturing the return value and then checking for any error.
Signed-off-by: Srinivas Neeli <[email protected]>
Acked-by: Michal Simek <[email protected]>
Addresses-Coverity: "check_return"
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Linus Walleij <[email protected]>
|
|
Added remove function support.
Signed-off-by: Srinivas Neeli <[email protected]>
Acked-by: Michal Simek <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
[dropped pm disable call]
Signed-off-by: Linus Walleij <[email protected]>
|
|
Adds clock support to the Xilinx GPIO driver.
Signed-off-by: Srinivas Neeli <[email protected]>
Acked-by: Michal Simek <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Linus Walleij <[email protected]>
|
|
Arrange header files in sorted order.
Signed-off-by: Srinivas Neeli <[email protected]>
Acked-by: Michal Simek <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Linus Walleij <[email protected]>
|
|
We may use BIT() macro to increase readability in
acpi_gpio_adr_space_handler().
Signed-off-by: Andy Shevchenko <[email protected]>
Acked-by: Linus Walleij <[email protected]>
Reviewed-by: Hans de Goede <[email protected]>
Reviewed-by: Mika Westerberg <[email protected]>
|
|
As specified by ACPI the pin index is 16-bit unsigned integer.
Define the variable, which holds it, accordingly.
Signed-off-by: Andy Shevchenko <[email protected]>
Acked-by: Linus Walleij <[email protected]>
Reviewed-by: Hans de Goede <[email protected]>
Reviewed-by: Mika Westerberg <[email protected]>
|
|
It appears that we are using similar code excerpts for ACPI OpRegion
and event handling. Deduplicate those excerpts by extracting a new
acpi_request_own_gpiod() helper.
Signed-off-by: Andy Shevchenko <[email protected]>
Acked-by: Linus Walleij <[email protected]>
Reviewed-by: Hans de Goede <[email protected]>
Reviewed-by: Mika Westerberg <[email protected]>
|
|
GpioInt() implies input configuration of the pin. Add this to
the acpi_gpio_to_gpiod_flags() and make usable for GpioInt().
Signed-off-by: Andy Shevchenko <[email protected]>
Acked-by: Linus Walleij <[email protected]>
Reviewed-by: Hans de Goede <[email protected]>
Reviewed-by: Mika Westerberg <[email protected]>
|
|
GpioIo() resources don't contain an initial value for the output pin.
Therefore instead of deducting its value solely based on bias field
we should deduce that value from the polarity and the bias fields.
Typical scenario is, when pin is defined in the table and its polarity,
specified in _DSD or via platform code, is defined as active low,
in the following call chain:
-> acpi_populate_gpio_lookup()
-> acpi_gpio_to_gpiod_flags()
it will return GPIOD_OUT_HIGH if bias is set no matter if polarity
is GPIO_ACTIVE_LOW, so it will return the current level instead of
the logical level.
Cc: Hans de Goede <[email protected]>
Signed-off-by: Vasile-Laurentiu Stanimir <[email protected]>
Signed-off-by: Andy Shevchenko <[email protected]>
Acked-by: Linus Walleij <[email protected]>
Reviewed-by: Mika Westerberg <[email protected]>
|
|
Move acpi_gpio_to_gpiod_flags() upper in the code to allow further refactoring.
Signed-off-by: Andy Shevchenko <[email protected]>
Acked-by: Linus Walleij <[email protected]>
Reviewed-by: Hans de Goede <[email protected]>
Reviewed-by: Mika Westerberg <[email protected]>
|
|
Mika noticed that some code is run under mutex when it doesn't require
the lock, like an error code assignment.
Move non-critical code outside of critical section.
Suggested-by: Mika Westerberg <[email protected]>
Cc: Hans de Goede <[email protected]>
Signed-off-by: Andy Shevchenko <[email protected]>
Acked-by: Linus Walleij <[email protected]>
Reviewed-by: Mika Westerberg <[email protected]>
|
|
We didn't take into account the debounce settings supplied by ACPI.
This change is targeting the mentioned gap.
Reported-by: Coiby Xu <[email protected]>
Signed-off-by: Andy Shevchenko <[email protected]>
Acked-by: Linus Walleij <[email protected]>
Reviewed-by: Hans de Goede <[email protected]>
Reviewed-by: Mika Westerberg <[email protected]>
|
|
Use named item instead of plain integer for enum gpiod_flags
to make it clear that even 0 has its own meaning.
Signed-off-by: Andy Shevchenko <[email protected]>
Acked-by: Linus Walleij <[email protected]>
Reviewed-by: Hans de Goede <[email protected]>
Reviewed-by: Mika Westerberg <[email protected]>
|
|
In some cases the GpioInt() resource is coming with bias settings
which may affect system functioning. Respect bias settings for
GpioInt() resource by calling acpi_gpio_update_gpiod_*flags() API
in acpi_dev_gpio_irq_get().
Reported-by: Jamie McClymont <[email protected]>
Signed-off-by: Andy Shevchenko <[email protected]>
Acked-by: Linus Walleij <[email protected]>
Reviewed-by: Hans de Goede <[email protected]>
Reviewed-by: Mika Westerberg <[email protected]>
|
|
In some cases we would like to have debounce setter which doesn't fail
when a feature is not supported by a controller.
Cc: Mika Westerberg <[email protected]>
Signed-off-by: Andy Shevchenko <[email protected]>
Acked-by: Linus Walleij <[email protected]>
Reviewed-by: Hans de Goede <[email protected]>
|
|
This function is useful for internal use in the GPIO library.
There will be new user coming, prepare a helper for the new comer
and the existing ones.
Signed-off-by: Andy Shevchenko <[email protected]>
Acked-by: Linus Walleij <[email protected]>
Reviewed-by: Hans de Goede <[email protected]>
Reviewed-by: Mika Westerberg <[email protected]>
|
|
Move bias related code from gpio_set_config() to gpio_set_bias().
Signed-off-by: Andy Shevchenko <[email protected]>
Acked-by: Linus Walleij <[email protected]>
Reviewed-by: Hans de Goede <[email protected]>
Reviewed-by: Mika Westerberg <[email protected]>
|
|
In the future we will need to have a separate function
that takes an arbitrary argument value.
Extract gpio_set_config_with_argument() for that purpose.
Signed-off-by: Andy Shevchenko <[email protected]>
Acked-by: Linus Walleij <[email protected]>
Reviewed-by: Hans de Goede <[email protected]>
Reviewed-by: Mika Westerberg <[email protected]>
|