@@ -755,7 +755,15 @@ static int arizona_of_get_core_pdata(struct arizona *arizona)
int ret, i;
int count = 0;
+ ret = of_property_read_u32(arizona->dev->of_node,
+ "wlf,codec-number", &arizona->pdata.codec_num);
+ if (ret < 0) {
+ dev_info(arizona->dev, "No codec-number property in DT => single-codec mode\n");
+ arizona->pdata.codec_num = -1;
+ } else {
+ dev_info(arizona->dev, "codec-number from DT: %d\n", arizona->pdata.codec_num);
+ }
ret = of_property_read_u32_array(arizona->dev->of_node,
"wlf,gpio-defaults",
arizona->pdata.gpio_defaults,
@@ -925,7 +952,7 @@ int arizona_dev_init(struct arizona *arizona)
/* Mark DCVDD as external, LDO1 driver will clear if internal */
arizona->external_dcvdd = true;
- ret = mfd_add_devices(arizona->dev, -1, early_devs,
+ ret = mfd_add_devices(arizona->dev, arizona->pdata.codec_num, early_devs,
ARRAY_SIZE(early_devs), NULL, 0, NULL);
if (ret != 0) {
dev_err(dev, "Failed to add early children: %d\n", ret);
@@ -1259,9 +1286,12 @@ int arizona_dev_init(struct arizona *arizona)
arizona_request_irq(arizona, ARIZONA_IRQ_UNDERCLOCKED, "Underclocked",
arizona_underclocked, arizona);
+ // FIXME: multiple codec handling only added for WM5102
switch (arizona->type) {
case WM5102:
- ret = mfd_add_devices(arizona->dev, -1, wm5102_devs,
+ printk("arizona: wm5102, working with device %d\n", arizona->pdata.codec_num);
+
+ ret = mfd_add_devices(arizona->dev, arizona->pdata.codec_num, wm5102_devs,
ARRAY_SIZE(wm5102_devs), NULL, 0, NULL);
break;
case WM5110:
@@ -75,6 +75,8 @@ struct arizona_micd_range {
};
struct arizona_pdata {
+ int codec_num; // -1: n/a (=> single codec only) ; 1 or 2: codec #1 or #2 (=> two codecs)
+
int reset; /** GPIO controlling /RESET, if any */
int ldoena; /** GPIO controlling LODENA, if any */
Hi! Add support for than one arizona. We introduce codec_num and fill it based on device tree. If there's better way, let me know. (For v4.2, but I believe nothing changed there. And yes, I'd need to document the dt binding. Will do if the rest of patch is ok.) Signed-off-by: Pavel Machek <pavel@denx.de>