diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2020-04-02 15:54:13 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2020-04-02 15:54:13 -0700 |
commit | 5c8db3eb381745c010ba746373a279e92502bdc8 (patch) | |
tree | 69c1d8b8180635c6230fce57830e38e3f8d26cef /drivers/i2c/busses/i2c-qcom-geni.c | |
parent | 848960e576dafc8ed54c691b2f70b92e1fdea9ba (diff) | |
parent | df576beee53ac97fe0a413430e623e658805891d (diff) |
Merge branch 'i2c/for-5.7' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux
Pull i2c updates from Wolfram Sang:
"I2C has:
- using defines for bus speeds to avoid mistakes in hardcoded values;
lots of small driver updates because of that. Thanks, Andy!
- API change: i2c_setup_smbus_alert() was renamed to
i2c_new_smbus_alert_device() and returns ERRPTR now. All in-tree
users have been converted
- in the core, a rare race condition when deleting the cdev has been
fixed. Thanks, Kevin!
- lots of driver updates. Thanks, everyone!
I also want to mention: The amount of review and testing tags given
was quite high this time. Thank you to these people, too. I hope we
can keep it like this!"
* 'i2c/for-5.7' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: (34 commits)
i2c: rcar: clean up after refactoring i2c_timings
macintosh: convert to i2c_new_scanned_device
i2c: drivers: Use generic definitions for bus frequencies
i2c: algo: Use generic definitions for bus frequencies
i2c: stm32f7: switch to I²C generic property parsing
i2c: rcar: Consolidate timings calls in rcar_i2c_clock_calculate()
i2c: core: Allow override timing properties with 0
i2c: core: Provide generic definitions for bus frequencies
i2c: mxs: Use dma_request_chan() instead dma_request_slave_channel()
i2c: imx: remove duplicate print after platform_get_irq()
i2c: designware: Fix spelling typos in the comments
i2c: designware: Discard i2c_dw_read_comp_param() function
i2c: designware: Detect the FIFO size in the common code
i2c: dev: Fix the race between the release of i2c_dev and cdev
i2c: qcom-geni: Drop of_platform.h include
i2c: qcom-geni: Grow a dev pointer to simplify code
i2c: qcom-geni: Let firmware specify irq trigger flags
i2c: stm32f7: do not backup read-only PECR register
i2c: smbus: remove outdated references to irq level triggers
i2c: convert SMBus alert setup function to return an ERRPTR
...
Diffstat (limited to 'drivers/i2c/busses/i2c-qcom-geni.c')
-rw-r--r-- | drivers/i2c/busses/i2c-qcom-geni.c | 58 |
1 files changed, 26 insertions, 32 deletions
diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/i2c-qcom-geni.c index 17abf60c94aeb..18d1e4fd4cf34 100644 --- a/drivers/i2c/busses/i2c-qcom-geni.c +++ b/drivers/i2c/busses/i2c-qcom-geni.c @@ -10,7 +10,6 @@ #include <linux/io.h> #include <linux/module.h> #include <linux/of.h> -#include <linux/of_platform.h> #include <linux/platform_device.h> #include <linux/pm_runtime.h> #include <linux/qcom-geni-se.h> @@ -502,45 +501,40 @@ static int geni_i2c_probe(struct platform_device *pdev) struct resource *res; u32 proto, tx_depth; int ret; + struct device *dev = &pdev->dev; - gi2c = devm_kzalloc(&pdev->dev, sizeof(*gi2c), GFP_KERNEL); + gi2c = devm_kzalloc(dev, sizeof(*gi2c), GFP_KERNEL); if (!gi2c) return -ENOMEM; - gi2c->se.dev = &pdev->dev; - gi2c->se.wrapper = dev_get_drvdata(pdev->dev.parent); + gi2c->se.dev = dev; + gi2c->se.wrapper = dev_get_drvdata(dev->parent); res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - gi2c->se.base = devm_ioremap_resource(&pdev->dev, res); + gi2c->se.base = devm_ioremap_resource(dev, res); if (IS_ERR(gi2c->se.base)) return PTR_ERR(gi2c->se.base); - gi2c->se.clk = devm_clk_get(&pdev->dev, "se"); - if (IS_ERR(gi2c->se.clk) && !has_acpi_companion(&pdev->dev)) { - ret = PTR_ERR(gi2c->se.clk); - dev_err(&pdev->dev, "Err getting SE Core clk %d\n", ret); - return ret; - } + gi2c->se.clk = devm_clk_get(dev, "se"); + if (IS_ERR(gi2c->se.clk) && !has_acpi_companion(dev)) + return PTR_ERR(gi2c->se.clk); - ret = device_property_read_u32(&pdev->dev, "clock-frequency", - &gi2c->clk_freq_out); + ret = device_property_read_u32(dev, "clock-frequency", + &gi2c->clk_freq_out); if (ret) { - dev_info(&pdev->dev, - "Bus frequency not specified, default to 100kHz.\n"); + dev_info(dev, "Bus frequency not specified, default to 100kHz.\n"); gi2c->clk_freq_out = KHZ(100); } - if (has_acpi_companion(&pdev->dev)) - ACPI_COMPANION_SET(&gi2c->adap.dev, ACPI_COMPANION(&pdev->dev)); + if (has_acpi_companion(dev)) + ACPI_COMPANION_SET(&gi2c->adap.dev, ACPI_COMPANION(dev)); gi2c->irq = platform_get_irq(pdev, 0); - if (gi2c->irq < 0) { - dev_err(&pdev->dev, "IRQ error for i2c-geni\n"); + if (gi2c->irq < 0) return gi2c->irq; - } ret = geni_i2c_clk_map_idx(gi2c); if (ret) { - dev_err(&pdev->dev, "Invalid clk frequency %d Hz: %d\n", + dev_err(dev, "Invalid clk frequency %d Hz: %d\n", gi2c->clk_freq_out, ret); return ret; } @@ -549,29 +543,29 @@ static int geni_i2c_probe(struct platform_device *pdev) init_completion(&gi2c->done); spin_lock_init(&gi2c->lock); platform_set_drvdata(pdev, gi2c); - ret = devm_request_irq(&pdev->dev, gi2c->irq, geni_i2c_irq, - IRQF_TRIGGER_HIGH, "i2c_geni", gi2c); + ret = devm_request_irq(dev, gi2c->irq, geni_i2c_irq, 0, + dev_name(dev), gi2c); if (ret) { - dev_err(&pdev->dev, "Request_irq failed:%d: err:%d\n", + dev_err(dev, "Request_irq failed:%d: err:%d\n", gi2c->irq, ret); return ret; } /* Disable the interrupt so that the system can enter low-power mode */ disable_irq(gi2c->irq); i2c_set_adapdata(&gi2c->adap, gi2c); - gi2c->adap.dev.parent = &pdev->dev; - gi2c->adap.dev.of_node = pdev->dev.of_node; + gi2c->adap.dev.parent = dev; + gi2c->adap.dev.of_node = dev->of_node; strlcpy(gi2c->adap.name, "Geni-I2C", sizeof(gi2c->adap.name)); ret = geni_se_resources_on(&gi2c->se); if (ret) { - dev_err(&pdev->dev, "Error turning on resources %d\n", ret); + dev_err(dev, "Error turning on resources %d\n", ret); return ret; } proto = geni_se_read_proto(&gi2c->se); tx_depth = geni_se_get_tx_fifo_depth(&gi2c->se); if (proto != GENI_SE_I2C) { - dev_err(&pdev->dev, "Invalid proto %d\n", proto); + dev_err(dev, "Invalid proto %d\n", proto); geni_se_resources_off(&gi2c->se); return -ENXIO; } @@ -581,11 +575,11 @@ static int geni_i2c_probe(struct platform_device *pdev) true, true, true); ret = geni_se_resources_off(&gi2c->se); if (ret) { - dev_err(&pdev->dev, "Error turning off resources %d\n", ret); + dev_err(dev, "Error turning off resources %d\n", ret); return ret; } - dev_dbg(&pdev->dev, "i2c fifo/se-dma mode. fifo depth:%d\n", tx_depth); + dev_dbg(dev, "i2c fifo/se-dma mode. fifo depth:%d\n", tx_depth); gi2c->suspended = 1; pm_runtime_set_suspended(gi2c->se.dev); @@ -595,12 +589,12 @@ static int geni_i2c_probe(struct platform_device *pdev) ret = i2c_add_adapter(&gi2c->adap); if (ret) { - dev_err(&pdev->dev, "Error adding i2c adapter %d\n", ret); + dev_err(dev, "Error adding i2c adapter %d\n", ret); pm_runtime_disable(gi2c->se.dev); return ret; } - dev_dbg(&pdev->dev, "Geni-I2C adaptor successfully added\n"); + dev_dbg(dev, "Geni-I2C adaptor successfully added\n"); return 0; } |