Re: [PATCH] i2c-mux-pca954x: allow downstream bus numbers to be specified in the dts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thursday 17 April 2014 09:16 PM, Laurent Pinchart wrote:
+       u32 fixed_bus_numbers[PCA954X_MAX_NCHANS] = { 0 };
          int ret;

          if (!i2c_check_functionality(adap, I2C_FUNC_SMBUS_BYTE))
@@ -214,6 +215,17 @@ static int pca954x_probe(struct i2c_client *client,
                          if (ret < 0)
                                  return ret;
                  }
+
+               /* Get fixed bus numbers */
+               ret = of_property_read_u32_array(np, "fixed-bus-numbers",
+                       fixed_bus_numbers, chips[id->driver_data].nchans);
+               if (ret == -EINVAL)
+                       ret = 0;        /* missing dtb node is not an error
*/ +               if (ret < 0) {
+                       dev_err(&client->dev, "fixed-bus-numbers: "
+                       "invalid format\n");
+                       return ret;
+               }
          }


Hi Frank,
Why not you use aliases on DTS instead of changing driver?
You can alias the bus number with the child node name. On the following, the bus will be registerd as 6, 7, 8 and 9.
i2c-core already support this.

        aliases {
                i2c6 = &pca9546_i2c0;
                i2c7 = &pca9546_i2c1;
                i2c8 = &pca9546_i2c2;
                i2c9 = &pca9546_i2c3;
        };


-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information.  Any unauthorized review, use, disclosure or distribution
is prohibited.  If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux