aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c/busses
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-07-03 14:48:03 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-07-03 14:48:03 -0400
commit3dbde57ad941c55345fd7fac0ee3f70f204b02d8 (patch)
tree237c6de64d05da3f61b9ac1724e37a5c1f014b71 /drivers/i2c/busses
parenta6e6d863cf68bba886acfe47dbdc8f245cce588f (diff)
parent2207a4e1ca6a1bb126360b6d0c236af6664532f2 (diff)
Merge tag 'pinctrl-for-v3.11-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl
Pull pin control changes from Linus Walleij: - A large slew of improvements of the Genric pin configuration support, and deployment in four different platforms: Rockchip, Super-H PFC, ABx500 and TZ1090. Support BIAS_BUS_HOLD, get device tree parsing and debugfs support into shape. - We also have device tree support with generic naming conventions for the generic pin configuration. - Delete the unused and confusing direct pinconf API. Now state transitions is *the* way to control pins and multiplexing. - New drivers for Rockchip, TZ1090, and TZ1090 PDC. - Two pin control states related to power management are now handled in the device core: "sleep" and "idle", removing a lot of boilerplate code in drivers. We do not yet know if this is the final word for pin PM, but it already make things a lot easier to handle. - Handle sparse GPIO ranges passing a list of disparate pins, and utilize these in the new BayTrail (x86 Atom SoC) driver. - Make the sunxi (AllWinner) driver handle external interrupts. - Make it possible for pinctrl-single to handle the case where several pins are managed by a single register, and augment it to handle sleep modes. - Cleanups and improvements for the abx500 drivers. - Move Sirf pin control drivers to their own directory, support save/restore of context and add support for the SiRFatlas6 SoC. - PMU muxing for the Dove pinctrl driver. - Finalization and support for VF610 in the i.MX6 pinctrl driver. - Smoothen out various Exynos rough edges. - Generic cleanups of various kinds. * tag 'pinctrl-for-v3.11-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl: (82 commits) pinctrl: vt8500: wmt: remove redundant dev_err call in wmt_pinctrl_probe() pinctrl: remove bindings for pinconf options needing more thought pinctrl: remove slew-rate parameter from tz1090 pinctrl: set unit for debounce time pinconfig to usec pinctrl: more clarifications for generic pull configs pinctrl: rip out the direct pinconf API pinctrl-tz1090-pdc: add TZ1090 PDC pinctrl driver pinctrl-tz1090: add TZ1090 pinctrl driver pinctrl: samsung: Staticize drvdata_list pinctrl: rockchip: Add missing irq_gc_unlock() call before return error pinctrl: abx500: rework error path pinctrl: abx500: suppress hardcoded value pinctrl: abx500: factorize code pinctrl: abx500: fix abx500_gpio_get() pinctrl: abx500: fix abx500_pin_config_set() pinctrl: abx500: Add device tree support sh-pfc: Guard DT parsing with #ifdef CONFIG_OF pinctrl: add Intel BayTrail GPIO/pinctrl support pinctrl: fix pinconf_ops::pin_config_dbg_parse_modify kerneldoc pinctrl: Staticize local symbols ... Conflicts: drivers/net/ethernet/ti/davinci_mdio.c drivers/pinctrl/Makefile
Diffstat (limited to 'drivers/i2c/busses')
-rw-r--r--drivers/i2c/busses/i2c-nomadik.c90
1 files changed, 10 insertions, 80 deletions
diff --git a/drivers/i2c/busses/i2c-nomadik.c b/drivers/i2c/busses/i2c-nomadik.c
index 650293ff4d62..c7e3b0c1a1ca 100644
--- a/drivers/i2c/busses/i2c-nomadik.c
+++ b/drivers/i2c/busses/i2c-nomadik.c
@@ -148,10 +148,6 @@ struct i2c_nmk_client {
148 * @stop: stop condition. 148 * @stop: stop condition.
149 * @xfer_complete: acknowledge completion for a I2C message. 149 * @xfer_complete: acknowledge completion for a I2C message.
150 * @result: controller propogated result. 150 * @result: controller propogated result.
151 * @pinctrl: pinctrl handle.
152 * @pins_default: default state for the pins.
153 * @pins_idle: idle state for the pins.
154 * @pins_sleep: sleep state for the pins.
155 * @busy: Busy doing transfer. 151 * @busy: Busy doing transfer.
156 */ 152 */
157struct nmk_i2c_dev { 153struct nmk_i2c_dev {
@@ -165,11 +161,6 @@ struct nmk_i2c_dev {
165 int stop; 161 int stop;
166 struct completion xfer_complete; 162 struct completion xfer_complete;
167 int result; 163 int result;
168 /* Three pin states - default, idle & sleep */
169 struct pinctrl *pinctrl;
170 struct pinctrl_state *pins_default;
171 struct pinctrl_state *pins_idle;
172 struct pinctrl_state *pins_sleep;
173 bool busy; 164 bool busy;
174}; 165};
175 166
@@ -645,13 +636,7 @@ static int nmk_i2c_xfer(struct i2c_adapter *i2c_adap,
645 } 636 }
646 637
647 /* Optionaly enable pins to be muxed in and configured */ 638 /* Optionaly enable pins to be muxed in and configured */
648 if (!IS_ERR(dev->pins_default)) { 639 pinctrl_pm_select_default_state(&dev->adev->dev);
649 status = pinctrl_select_state(dev->pinctrl,
650 dev->pins_default);
651 if (status)
652 dev_err(&dev->adev->dev,
653 "could not set default pins\n");
654 }
655 640
656 status = init_hw(dev); 641 status = init_hw(dev);
657 if (status) 642 if (status)
@@ -681,13 +666,7 @@ out:
681 clk_disable_unprepare(dev->clk); 666 clk_disable_unprepare(dev->clk);
682out_clk: 667out_clk:
683 /* Optionally let pins go into idle state */ 668 /* Optionally let pins go into idle state */
684 if (!IS_ERR(dev->pins_idle)) { 669 pinctrl_pm_select_idle_state(&dev->adev->dev);
685 status = pinctrl_select_state(dev->pinctrl,
686 dev->pins_idle);
687 if (status)
688 dev_err(&dev->adev->dev,
689 "could not set pins to idle state\n");
690 }
691 670
692 pm_runtime_put_sync(&dev->adev->dev); 671 pm_runtime_put_sync(&dev->adev->dev);
693 672
@@ -882,41 +861,22 @@ static int nmk_i2c_suspend(struct device *dev)
882{ 861{
883 struct amba_device *adev = to_amba_device(dev); 862 struct amba_device *adev = to_amba_device(dev);
884 struct nmk_i2c_dev *nmk_i2c = amba_get_drvdata(adev); 863 struct nmk_i2c_dev *nmk_i2c = amba_get_drvdata(adev);
885 int ret;
886 864
887 if (nmk_i2c->busy) 865 if (nmk_i2c->busy)
888 return -EBUSY; 866 return -EBUSY;
889 867
890 if (!IS_ERR(nmk_i2c->pins_sleep)) { 868 pinctrl_pm_select_sleep_state(dev);
891 ret = pinctrl_select_state(nmk_i2c->pinctrl,
892 nmk_i2c->pins_sleep);
893 if (ret)
894 dev_err(dev, "could not set pins to sleep state\n");
895 }
896 869
897 return 0; 870 return 0;
898} 871}
899 872
900static int nmk_i2c_resume(struct device *dev) 873static int nmk_i2c_resume(struct device *dev)
901{ 874{
902 struct amba_device *adev = to_amba_device(dev);
903 struct nmk_i2c_dev *nmk_i2c = amba_get_drvdata(adev);
904 int ret;
905
906 /* First go to the default state */ 875 /* First go to the default state */
907 if (!IS_ERR(nmk_i2c->pins_default)) { 876 pinctrl_pm_select_default_state(dev);
908 ret = pinctrl_select_state(nmk_i2c->pinctrl,
909 nmk_i2c->pins_default);
910 if (ret)
911 dev_err(dev, "could not set pins to default state\n");
912 }
913 /* Then let's idle the pins until the next transfer happens */ 877 /* Then let's idle the pins until the next transfer happens */
914 if (!IS_ERR(nmk_i2c->pins_idle)) { 878 pinctrl_pm_select_idle_state(dev);
915 ret = pinctrl_select_state(nmk_i2c->pinctrl, 879
916 nmk_i2c->pins_idle);
917 if (ret)
918 dev_err(dev, "could not set pins to idle state\n");
919 }
920 return 0; 880 return 0;
921} 881}
922#else 882#else
@@ -1004,39 +964,10 @@ static int nmk_i2c_probe(struct amba_device *adev, const struct amba_id *id)
1004 dev->adev = adev; 964 dev->adev = adev;
1005 amba_set_drvdata(adev, dev); 965 amba_set_drvdata(adev, dev);
1006 966
1007 dev->pinctrl = devm_pinctrl_get(&adev->dev); 967 /* Select default pin state */
1008 if (IS_ERR(dev->pinctrl)) { 968 pinctrl_pm_select_default_state(&adev->dev);
1009 ret = PTR_ERR(dev->pinctrl); 969 /* If possible, let's go to idle until the first transfer */
1010 goto err_pinctrl; 970 pinctrl_pm_select_idle_state(&adev->dev);
1011 }
1012
1013 dev->pins_default = pinctrl_lookup_state(dev->pinctrl,
1014 PINCTRL_STATE_DEFAULT);
1015 if (IS_ERR(dev->pins_default)) {
1016 dev_err(&adev->dev, "could not get default pinstate\n");
1017 } else {
1018 ret = pinctrl_select_state(dev->pinctrl,
1019 dev->pins_default);
1020 if (ret)
1021 dev_dbg(&adev->dev, "could not set default pinstate\n");
1022 }
1023
1024 dev->pins_idle = pinctrl_lookup_state(dev->pinctrl,
1025 PINCTRL_STATE_IDLE);
1026 if (IS_ERR(dev->pins_idle)) {
1027 dev_dbg(&adev->dev, "could not get idle pinstate\n");
1028 } else {
1029 /* If possible, let's go to idle until the first transfer */
1030 ret = pinctrl_select_state(dev->pinctrl,
1031 dev->pins_idle);
1032 if (ret)
1033 dev_dbg(&adev->dev, "could not set idle pinstate\n");
1034 }
1035
1036 dev->pins_sleep = pinctrl_lookup_state(dev->pinctrl,
1037 PINCTRL_STATE_SLEEP);
1038 if (IS_ERR(dev->pins_sleep))
1039 dev_dbg(&adev->dev, "could not get sleep pinstate\n");
1040 971
1041 dev->virtbase = ioremap(adev->res.start, resource_size(&adev->res)); 972 dev->virtbase = ioremap(adev->res.start, resource_size(&adev->res));
1042 if (!dev->virtbase) { 973 if (!dev->virtbase) {
@@ -1106,7 +1037,6 @@ static int nmk_i2c_probe(struct amba_device *adev, const struct amba_id *id)
1106 iounmap(dev->virtbase); 1037 iounmap(dev->virtbase);
1107 err_no_ioremap: 1038 err_no_ioremap:
1108 kfree(dev); 1039 kfree(dev);
1109 err_pinctrl:
1110 err_no_mem: 1040 err_no_mem:
1111 1041
1112 return ret; 1042 return ret;