aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c
diff options
context:
space:
mode:
authorBen Dooks <ben-linux@fluff.org>2008-07-28 07:04:06 -0400
committerBen Dooks <ben-linux@fluff.org>2008-07-28 07:05:26 -0400
commit399dee2371787825a1845de87c0cbee7b7c30ad6 (patch)
tree4593e986826f9a798e9d9c7bb399bcaa67e1d3a7 /drivers/i2c
parentc9272c4f9fbe2087beb3392f526dc5b19efaa56b (diff)
i2c: S3C2410: Pass the I2C bus number via drivers platform data
Allow the platform data to specify the bus bumber that the new I2C bus will be given. This is to allow the use of the board registration mechanism to specify the new style of I2C device registration which allows boards to provide a list of attached devices. Note, as discussed on the mailing list, we have dropped backwards compatibility of adding an dynamic bus number as it should not affect most boards to have the bus pinned to 0 if they have either not specified platform data for driver. Any board supplying platform data will automatically have the bus_num field set to 0, and anyone who needs the driver on a different bus number can supply platform data to set bus_num. Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/busses/i2c-s3c2410.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
index 007390ad9810..eef35d3f6073 100644
--- a/drivers/i2c/busses/i2c-s3c2410.c
+++ b/drivers/i2c/busses/i2c-s3c2410.c
@@ -752,9 +752,12 @@ static int s3c24xx_i2c_init(struct s3c24xx_i2c *i2c)
752static int s3c24xx_i2c_probe(struct platform_device *pdev) 752static int s3c24xx_i2c_probe(struct platform_device *pdev)
753{ 753{
754 struct s3c24xx_i2c *i2c = &s3c24xx_i2c; 754 struct s3c24xx_i2c *i2c = &s3c24xx_i2c;
755 struct s3c2410_platform_i2c *pdata;
755 struct resource *res; 756 struct resource *res;
756 int ret; 757 int ret;
757 758
759 pdata = s3c24xx_i2c_get_platformdata(&pdev->dev);
760
758 /* find the clock and enable it */ 761 /* find the clock and enable it */
759 762
760 i2c->dev = &pdev->dev; 763 i2c->dev = &pdev->dev;
@@ -832,7 +835,15 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)
832 dev_dbg(&pdev->dev, "irq resource %p (%lu)\n", res, 835 dev_dbg(&pdev->dev, "irq resource %p (%lu)\n", res,
833 (unsigned long)res->start); 836 (unsigned long)res->start);
834 837
835 ret = i2c_add_adapter(&i2c->adap); 838 /* Note, previous versions of the driver used i2c_add_adapter()
839 * to add the bus at any number. We now pass the bus number via
840 * the platform data, so if unset it will now default to always
841 * being bus 0.
842 */
843
844 i2c->adap.nr = pdata->bus_num;
845
846 ret = i2c_add_numbered_adapter(&i2c->adap);
836 if (ret < 0) { 847 if (ret < 0) {
837 dev_err(&pdev->dev, "failed to add bus to i2c core\n"); 848 dev_err(&pdev->dev, "failed to add bus to i2c core\n");
838 goto err_irq; 849 goto err_irq;