aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2019-06-29i2c: core: Tidy up handling of init_irqCharles Keepax1-2/+3
Only set init_irq during i2c_device_new and only handle client->irq on the probe/remove paths. Suggested-by: Benjamin Tissoires <[email protected]> Reviewed-by: Mika Westerberg <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Charles Keepax <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2019-06-29i2c: core: Move ACPI gpio IRQ handling into i2c_acpi_get_irqCharles Keepax2-3/+3
It makes sense to contain all the ACPI IRQ handling in a single helper function. Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Charles Keepax <[email protected]> Reviewed-by: Mika Westerberg <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2019-06-29i2c: core: Move ACPI IRQ handling to probe timeCharles Keepax3-7/+21
Bring the ACPI path in sync with the device tree path and handle all the IRQ fetching at probe time. This leaves the only IRQ handling at device registration time being that which is passed directly through the board info as either a resource or an actual IRQ number. Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Charles Keepax <[email protected]> Reviewed-by: Mika Westerberg <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2019-06-29i2c: acpi: Factor out getting the IRQ from ACPICharles Keepax1-8/+21
In preparation for future refactoring factor out the fetch of the IRQ into its own helper function. Whilst we are at it update the handling to return the actual error code returned from acpi_dev_get_resources as well. Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Charles Keepax <[email protected]> Reviewed-by: Mika Westerberg <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2019-06-29i2c: acpi: Use available IRQ helper functionsCharles Keepax1-9/+13
Use the available IRQ helper functions, most of the functions have additional helpful side affects like configuring the trigger type of the IRQ. Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Charles Keepax <[email protected]> Reviewed-by: Mika Westerberg <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2019-06-29i2c: core: Allow whole core to use i2c_dev_irq_from_resourcesCharles Keepax2-2/+4
Remove the static from i2c_dev_irq_from _resources so that other parts of the core code can use this helper function. Reviewed-by: Mika Westerberg <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Charles Keepax <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2019-06-29Merge branch 'i2c-mux/for-next' of https://github.com/peda-r/i2c-mux into ↵Wolfram Sang7-159/+93
i2c/for-5.3 I realize that there are changes in drivers/i2c/busses/i2c-i801.c that strictly speaking don't belong here, but I hope you don't mind. These changes are all about the interaction with the i2c-mux-gpio code, and I did a test-merge a few days ago w/o conflicts. Anyway, the GPIO-work from Linus Walleij (with help from Serge Semin) in the i2c-mux-gpio and i2c-arb-gpio-challenge drivers is the main feature.
2019-06-29Merge tag 'at24-v5.3-updates-for-wolfram' of ↵Wolfram Sang1-58/+28
git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux into i2c/for-5.3 at24: updates for v5.3 - simplify the probing code by using devm_i2c_new_dummy_device() - simplify the code further by moving the code around a bit - use struct_size() instead of calculating the required structure size by hand - remove any references to now removed platform data from comments
2019-06-27eeprom: at24: modify a comment referring to platform dataBartosz Golaszewski1-2/+2
We no longer have platform data in at24, so this comment is invalid. Make it refer to device tree & properties instead. Signed-off-by: Bartosz Golaszewski <[email protected]> Acked-by: Wolfram Sang <[email protected]>
2019-06-26dt-bindings: i2c: omap: Add new compatible for J721E SoCsPeter Ujfalusi1-0/+1
J721E SoCs have same I2C IP as OMAP SoCs. Add new compatible to handle J721E SoCs. Signed-off-by: Peter Ujfalusi <[email protected]> Signed-off-by: Vignesh Raghavendra <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2019-06-26dt-bindings: i2c: mv64xxx: Add YAML schemasMaxime Ripard2-64/+124
Switch the DT binding to a YAML schema to enable the DT validation. Signed-off-by: Maxime Ripard <[email protected]> Reviewed-by: Rob Herring <[email protected]> Acked-by: Gregory CLEMENT <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2019-06-26dt-bindings: i2c: sun6i-p2wi: Add YAML schemasMaxime Ripard2-41/+65
Switch the DT binding to a YAML schema to enable the DT validation. Signed-off-by: Maxime Ripard <[email protected]> Reviewed-by: Rob Herring <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2019-06-26i2c: mt7621: Add MediaTek MT7621/7628/7688 I2C driverStefan Roese4-0/+372
This patch adds a driver for the I2C controller found on the MediaTek MT7621/7628/7688 SoC's. The base version of this driver was done by Steven Liu (according to the copyright and MODULE_AUTHOR lines). It can be found in the OpenWRT repositories (v4.14 at the time I looked). The base driver had many issues, which are disccussed here: https://en.forum.labs.mediatek.com/t/openwrt-15-05-loads-non-working-i2c-kernel-module-for-mt7688/1286/3 >From this link an enhanced driver version (complete rewrite, mayor changes: support clock stretching, repeated start, ACK handling and unlimited message length) from Jan Breuer can be found here: https://gist.github.com/j123b567/9b555b635c2b4069d716b24198546954 This patch now adds this enhanced I2C driver to mainline. Changes by Stefan Roese for upstreaming: - Add devicetree bindings - checkpatch clean - Use module_platform_driver() - Minor cosmetic enhancements - Removed IO warpped functions - Use readl_relaxed_poll_timeout() and drop poll_down_timeout() - Removed superfluous barrier() in mtk_i2c_reset() - Use i2c_8bit_addr_from_msg() - Added I2C_FUNC_PROTOCOL_MANGLING - Removed adap->class = I2C_CLASS_HWMON | I2C_CLASS_SPD; Signed-off-by: Stefan Roese <[email protected]> Tested-by: René van Dorst <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2019-06-26dt-bindings: i2c: i2c-mt7621: Add bindings for MediaTek MT7621/28/88 I2CStefan Roese1-0/+25
Add bindings for the I2C controller that can be found in the MediaTek MT7621/7628/7688 SoCs. Signed-off-by: Stefan Roese <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2019-06-26i2c: core: add sysfs headerWolfram Sang1-0/+1
We are using sysfs functions directly, so we should include the header. Signed-off-by: Wolfram Sang <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2019-06-26i2c: bcm2835: Ensure clock exists when probingAnnaliese McDermond1-4/+12
Probe function fails to recognize that upstream clock actually doesn't yet exist because clock driver has not been initialized. Actually try to go get the clock and test for its existence before trying to set up a downstream clock based upon it. This fixes a bug that causes the i2c driver not to work with monolithic kernels. Fixes: bebff81fb8b9 ("i2c: bcm2835: Model Divider in CCF") Signed-off-by: Annaliese McDermond <[email protected]> Acked-by: Stefan Wahren <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2019-06-26i2c: bcm2835: Move IRQ request after clock code in probeAnnaliese McDermond1-14/+14
If any of the clock code in the probe fails and returns, the IRQ will not be freed. Moving the IRQ request to last allows it to be freed on any errors further up in the probe function. devm_ calls can apparently not be used because there are some potential race conditions that will arise. Fixes: bebff81fb8b9 ("i2c: bcm2835: Model Divider in CCF") Signed-off-by: Annaliese McDermond <[email protected]> Acked-by: Stefan Wahren <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2019-06-26i2c: add newly exported functions to the header, tooWolfram Sang2-3/+8
Nobody (including me) noticed that these functions were exported but not added to the header :/ Fixes: 7159dbdae3c5 ("i2c: core: improve return value handling of i2c_new_device and i2c_new_dummy") Signed-off-by: Wolfram Sang <[email protected]> Reviewed-by: Bartosz Golaszewski <[email protected]> Reviewed-by: Kieran Bingham <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2019-06-22i2c: mux: demux-pinctrl: use proper email address for ABI requestsWolfram Sang1-2/+2
Use my commercial address, not my community one. Signed-off-by: Wolfram Sang <[email protected]> Reviewed-by: Simon Horman <[email protected]> [Removed a misplaced newline. /Peter] Signed-off-by: Peter Rosin <[email protected]>
2019-06-22i2c: mux: add sysfs headerWolfram Sang1-0/+1
We are using sysfs functions directly, so we should include the header. Signed-off-by: Wolfram Sang <[email protected]> Signed-off-by: Peter Rosin <[email protected]>
2019-06-22i2c: mux/i801: Switch to use descriptor passingLinus Walleij3-100/+60
This switches the i801 GPIO mux to use GPIO descriptors for handling the GPIO lines. The previous hack which was reaching inside the GPIO chips etc cannot live on. We pass descriptors along with the GPIO mux device at creation instead. The GPIO mux was only used by way of platform data with a platform device from one place in the kernel: the i801 i2c bus driver. Let's just associate the GPIO descriptor table with the actual device like everyone else and dynamically create a descriptor table passed along with the GPIO i2c mux. This enables simplification of the GPIO i2c mux driver to use only the descriptor API and the OF probe path gets simplified in the process. The i801 driver was registering the GPIO i2c mux with PLATFORM_DEVID_AUTO which would make it hard to predict the device name and assign the descriptor table properly, but this seems to be a mistake to begin with: all of the GPIO mux devices are hardcoded to look up GPIO lines from the "gpio_ich" GPIO chip. If there are more than one mux, there is certainly more than one gpio chip as well, and then we have more serious problems. Switch to PLATFORM_DEVID_NONE instead. There can be only one. Cc: Mika Westerberg <[email protected]> Cc: Andy Shevchenko <[email protected]> Cc: Peter Rosin <[email protected]> Cc: Jean Delvare <[email protected]> Signed-off-by: Serge Semin <[email protected]> Signed-off-by: Linus Walleij <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Reviewed-by: Mika Westerberg <[email protected]> [Removed a newline, suggested by Andy. /Peter] Signed-off-by: Peter Rosin <[email protected]>
2019-06-21i2c: tegra: remove BUG() macroBitan Biswas1-8/+39
The usage of BUG() macro is generally discouraged in kernel, unless it's a problem that results in a physical damage or loss of data. This patch removes unnecessary BUG() macros and replaces the rest with warning. Signed-off-by: Bitan Biswas <[email protected]> Reviewed-by: Dmitry Osipenko <[email protected]> Tested-by: Dmitry Osipenko <[email protected]> Acked-by: Thierry Reding <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2019-06-21i2c: i801: Add support for Intel Elkhart LakeJarkko Nikula3-0/+6
Add PCI ID for Intel Elkhart Lake PCH. Signed-off-by: Jarkko Nikula <[email protected]> Reviewed-by: Jean Delvare <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2019-06-21i2c: i801: Add Block Write-Block Read Process Call supportAlexander Sverdlin2-7/+38
Add SMBUS 2.0 Block Write-Block Read Process Call command support. Signed-off-by: Alexander Sverdlin <[email protected]> Reviewed-by: Jean Delvare <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2019-06-21i2c: stm32f7: fix the get_irq error casesFabrice Gasnier1-12/+14
During probe, return the "get_irq" error value instead of -EINVAL which allows the driver to be deferred probed if needed. Fix also the case where of_irq_get() returns a negative value. Note : On failure of_irq_get() returns 0 or a negative value while platform_get_irq() returns a negative value. Fixes: aeb068c57214 ("i2c: i2c-stm32f7: add driver") Reviewed-by: Pierre-Yves MORDRET <[email protected]> Signed-off-by: Fabien Dessenne <[email protected]> Signed-off-by: Fabrice Gasnier <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2019-06-21i2c: i801: Use match_string() helper to simplify the codeAndy Shevchenko1-7/+6
match_string() returns the array index of a matching string. Use it instead of the open-coded implementation. Signed-off-by: Andy Shevchenko <[email protected]> Reviewed-by: Pali Rohár <[email protected]> Reviewed-by: Jean Delvare <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2019-06-14i2c: qcom-geni: Provide support for ACPILee Jones1-1/+14
Add a match table to allow automatic probing of ACPI device QCOM0220. Ignore clock attainment errors. Set default clock frequency value. Signed-off-by: Lee Jones <[email protected]> Acked-by: Ard Biesheuvel <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2019-06-14i2c: qcom-geni: Signify successful driver probeLee Jones1-0/+2
The Qualcomm Geni I2C driver currently probes silently which can be confusing when debugging potential issues. Add a low level (INFO) print when each I2C controller is successfully initially set-up. Signed-off-by: Lee Jones <[email protected]> Acked-by: Ard Biesheuvel <[email protected]> Acked-by: Bjorn Andersson <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2019-06-14i2c: tegra: Add suspend-resume supportBitan Biswas1-0/+24
Post suspend I2C registers have power on reset values. Before any transfer initialize I2C registers to prevent I2C transfer timeout and implement suspend and resume callbacks needed. Fix below errors post suspend: 1) Tegra I2C transfer timeout during jetson tx2 resume: [ 27.520613] pca953x 1-0074: calling pca953x_resume+0x0/0x1b0 @ 2939, parent: i2c-1 [ 27.633623] tegra-i2c 3160000.i2c: i2c transfer timed out [ 27.639162] pca953x 1-0074: Unable to sync registers 0x3-0x5. -110 [ 27.645336] pca953x 1-0074: Failed to sync GPIO dir registers: -110 [ 27.651596] PM: dpm_run_callback(): pca953x_resume+0x0/0x1b0 returns -110 [ 27.658375] pca953x 1-0074: pca953x_resume+0x0/0x1b0 returned -110 after 127152 usecs [ 27.666194] PM: Device 1-0074 failed to resume: error -110 2) Tegra I2C transfer timeout error on jetson Xavier post resume. Remove i2c bus lock-unlock calls in resume callback as i2c_mark_adapter_* (suspended-resumed) help ensure i2c core calls from client are not executed before i2c-tegra resume. Signed-off-by: Bitan Biswas <[email protected]> Reviewed-by: Dmitry Osipenko <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2019-06-14i2c: headers: reformat header comment and update copyrightWolfram Sang1-11/+7
Let's stick to coding style. Signed-off-by: Wolfram Sang <[email protected]>
2019-06-14i2c: headers: update docs about I2C_CLIENT_*Wolfram Sang1-12/+10
Update kerneldoc for i2c client flags because they increased over time. Also, move them to a position where they can be more easily found. Signed-off-by: Wolfram Sang <[email protected]>
2019-06-14i2c: core: always have a named variable in argumentsWolfram Sang1-2/+2
Much better to read and understand. Signed-off-by: Wolfram Sang <[email protected]>
2019-06-14i2c: headers: always have a named variable in argumentsWolfram Sang1-19/+20
Much better to read and understand. Naming for i2c_adapter is not consistent (yet), so use the name which is also used in core code. Signed-off-by: Wolfram Sang <[email protected]>
2019-06-14i2c: headers: don't use 'dev' as adapter variableWolfram Sang1-4/+4
It is not a struct device, so 'dev' is confusing. Use 'adap', the most common name. Signed-off-by: Wolfram Sang <[email protected]>
2019-06-14i2c: ocores: add polling mode workaround for Sifive FU540-C000 SoCSagar Shrikant Kadam1-2/+22
The i2c-ocore driver already has a polling mode interface.But it needs a workaround for FU540 Chipset on HiFive unleashed board (RevA00). There is an erratum in FU540 chip that prevents interrupt driven i2c transfers from working, and also the I2C controller's interrupt bit cannot be cleared if set, due to this the existing i2c polling mode interface added in mainline earlier doesn't work, and CPU stall's infinitely, when-ever i2c transfer is initiated. Ref: commit dd7dbf0eb090 ("i2c: ocores: refactor setup for polling") The workaround / fix under OCORES_FLAG_BROKEN_IRQ is particularly for FU540-COOO SoC. The polling function identifies a SiFive device based on the device node and enables the workaround. Signed-off-by: Sagar Shrikant Kadam <[email protected]> Reviewed-by: Andrew Lunn <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2019-06-14i2c: ocores: add support for i2c device on Sifive FU540-c000 SoCSagar Shrikant Kadam1-0/+9
Update device id table for Opencore's I2C master based re-implementation used in FU540-c000 chipset on HiFive Unleashed platform. Device ID's include Sifive, soc-specific device for chip specific tweaks and sifive IP block specific device for generic programming model. Signed-off-by: Sagar Shrikant Kadam <[email protected]> Reviewed-by: Andrew Lunn <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2019-06-14dt-bindings: i2c: extend existing opencore bindingsSagar Shrikant Kadam1-2/+7
Reformatted compatibility strings to one valid combination on each line. Add FU540-C000 specific device tree bindings to already available i2-ocores file. This device is available on HiFive Unleashed Rev A00 board. Move interrupt under optional property list as this can be optional. The FU540-C000 SoC from sifive, has an Opencore's I2C block reimplementation. The DT compatibility string for this IP is present in HDL and available at. https://github.com/sifive/sifive-blocks/blob/master/src/main/scala/devices/i2c/I2C.scala#L73 Signed-off-by: Sagar Shrikant Kadam <[email protected]> Reviewed-by: Rob Herring <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2019-06-14i2c: tegra: Avoid error message on deferred probeThierry Reding1-1/+3
If the driver defers probe because of a missing clock, avoid outputting an error message. The clock will show up eventually. Signed-off-by: Thierry Reding <[email protected]> Acked-by: Jon Hunter <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2019-06-14i2c: i801: Fix kernel crash in is_dell_system_with_lis3lv02d()Andy Shevchenko1-1/+1
The commit 19b07cb4a187 ("i2c: i801: Register optional lis3lv02d I2C device on Dell machines") introduced a new check in order to enumerate some slave devices on Dell machines. Though, it brings a regression on machines where DMI vendor is not set. BUG: kernel NULL pointer dereference, address: 0000000000000000 #PF: supervisor read access in kernel mode #PF: error_code(0x0000) - not-present page PGD 0 P4D 0 Oops: 0000 [#1] SMP PTI CPU: 8 PID: 1 Comm: swapper/0 Not tainted 5.2.0-rc4-next-20190613+ #317 RIP: 0010:strcmp+0xc/0x20 To fix this crash, check if vendor field is present before accessing to it. Fixes: 19b07cb4a187 ("i2c: i801: Register optional lis3lv02d I2C device on Dell machines") Signed-off-by: Andy Shevchenko <[email protected]> Reviewed-by: Pali Rohár <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2019-06-12i2c: iop: Use GPIO descriptorsLinus Walleij10-11/+64
The IOP3xx has some elaborate code to directly slam the GPIO lines multiplexed with I2C down low before enablement, apparently a workaround for a hardware bug found in the early chips. After consulting the developer documentation for IOP80321 and IOP80331 I can clearly see that this may be useful for IOP80321 family (mach-iop32x) but it is highly dubious for any 80331 series or later chip: in these chips the lines are not multiplexed for UARTs. We convert the code to pass optional GPIO descriptors and register these only on the 80321-based boards where it makes sense, optionally obtain them in the driver and use the gpiod_set_raw_value() to ascertain the line gets driven low when needed. The GPIO driver does not give the GPIO chip a reasonable label so the patch also adds that so that these machine descriptor tables can be used. Signed-off-by: Linus Walleij <[email protected]> Acked-by: Arnd Bergmann <[email protected]> Acked-by: Dan Williams <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2019-06-12i2c: s3c2410: Convert to use GPIO descriptorsLinus Walleij1-38/+9
The S3C2410 does some funny dance around its pins: - First try to call back to the platform to get and control some GPIO pins - If this doesn't work, it tries to get a pin control handle - If this doesn't work, it retrieves two GPIOs from the device tree node and does nothing with them If we're gonna retrieve two GPIOs and do nothing with them, we might as well do it using the GPIO descriptor API. When we use the resource management API, the code gets smaller. Signed-off-by: Linus Walleij <[email protected]> Acked-by: Krzysztof Kozlowski <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2019-06-12i2c: bcm2835: Model Divider in CCFAnnaliese McDermond1-31/+114
Model the I2C bus clock divider as a part of the Core Clock Framework. Primarily this removes the clk_get_rate() call from each transfer. This call causes problems for slave drivers that themselves have internal clock components that are controlled by an I2C interface. When the slave's internal clock component is prepared, the prepare lock is obtained, and it makes calls to the I2C subsystem to command the hardware to activate the clock. In order to perform the I2C transfer, this driver sets the divider, which requires it to get the parent clock rate, which it does with clk_get_rate(). Unfortunately, this function will try to take the clock prepare lock, which is already held by the slave's internal clock calls creating a deadlock. Modeling the divider in the CCF natively removes this dependency and the divider value is only set upon changing the bus clock frequency or changes in the parent clock that cascade down to this divisor. This obviates the need to set the divider with every transfer and avoids the deadlock described above. It also should provide better clock debugging and save a few cycles on each transfer due to not having to recalcuate the divider value. Signed-off-by: Annaliese McDermond <[email protected]> Acked-by: Stefan Wahren <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2019-06-12i2c: tegra: fix msleep warningBitan Biswas1-1/+1
Fix checkpatch.pl WARNING for delay of approximately 1msec in flush i2c FIFO polling loop by using usleep_range(1000, 2000): WARNING: msleep < 20ms can sleep for up to 20ms; see ... Documentation/timers/timers-howto.txt + msleep(1); Signed-off-by: Bitan Biswas <[email protected]> Reviewed-by: Dmitry Osipenko <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2019-06-12i2c: tegra: add spinlock definition commentBitan Biswas1-0/+1
Fix checkpatch.pl CHECK as follows: CHECK: spinlock_t definition without comment + spinlock_t xfer_lock; Signed-off-by: Bitan Biswas <[email protected]> Reviewed-by: Dmitry Osipenko <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2019-06-12i2c: tegra: fix alignment and spacing violationsBitan Biswas1-16/+19
Fix checkpatch.pl alignment and blank line check(s) in i2c-tegra.c Signed-off-by: Bitan Biswas <[email protected]> Reviewed-by: Dmitry Osipenko <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2019-06-12i2c: tegra: remove unnecessary variable initBitan Biswas1-3/+3
Remove variable initializations in functions that are followed by assignments before use Signed-off-by: Bitan Biswas <[email protected]> Reviewed-by: Dmitry Osipenko <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2019-06-12i2c: tegra: clean up macrosBitan Biswas1-14/+3
Clean up macros by: 1) removing unused macros 2) replace constants by macro BIT() Signed-off-by: Bitan Biswas <[email protected]> Reviewed-by: Dmitry Osipenko <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2019-06-10i2c: mux: pinctrl: use flexible-array member and struct_size() helperGustavo A. R. Silva1-3/+2
Update the code to use a flexible array member instead of a pointer in structure i2c_mux_pinctrl and use the struct_size() helper. Also, make use of the struct_size() helper instead of an open-coded version in order to avoid any potential type mistakes, in particular in the context in which this code is being used. So, replace the following form: sizeof(*mux) + num_names * sizeof(*mux->states) with: struct_size(mux, states, num_names) This code was detected with the help of Coccinelle. Signed-off-by: Gustavo A. R. Silva <[email protected]> Signed-off-by: Peter Rosin <[email protected]>
2019-06-10i2c: mux: arb-gpio: Rewrite to use GPIO descriptorsLinus Walleij1-52/+27
Instead of complex code picking GPIOs out of the device tree and keeping track of polarity for each GPIO line, use descriptors and pull polarity handling into the gpiolib. We look for "our-claim" and "their-claim" since the gpiolib code will try e.g. "our-claim-gpios" and "our-claim-gpio" in turn to locate these GPIO lines from the device tree. Cc: Krzysztof Kozlowski <[email protected]> Cc: Marek Szyprowski <[email protected]> Cc: Doug Anderson <[email protected]> Signed-off-by: Linus Walleij <[email protected]> Tested-by: Marek Szyprowski <[email protected]> Reviewed-by: Douglas Anderson <[email protected]> Signed-off-by: Peter Rosin <[email protected]>
2019-06-10i2c: mux: Use struct_size() in devm_kzalloc()Gustavo A. R. Silva1-2/+1
One of the more common cases of allocation size calculations is finding the size of a structure that has a zero-sized array at the end, along with memory for some number of elements for that array. For example: struct foo { int stuff; struct boo entry[]; }; instance = devm_kzalloc(dev, sizeof(struct foo) + count * sizeof(struct boo), GFP_KERNEL); Instead of leaving these open-coded and prone to type mistakes, we can now use the new struct_size() helper: instance = devm_kzalloc(dev, struct_size(instance, entry, count), GFP_KERNEL); This code was detected with the help of Coccinelle. Signed-off-by: Gustavo A. R. Silva <[email protected]> Signed-off-by: Peter Rosin <[email protected]>