static int arizona_i2c_probe(struct i2c_client *i2c, const struct i2c_device_id *id) { struct arizona *arizona; const struct regmap_config *regmap_config; int ret, type; if (i2c->dev.of_node) type = arizona_of_get_type(&i2c->dev); else type = id->driver_data; switch (type) { #ifdef CONFIG_MFD_WM5102 case WM5102: regmap_config = &wm5102_i2c_regmap; break; #endif #ifdef CONFIG_MFD_FLORIDA case WM8280: case WM5110: regmap_config = &florida_i2c_regmap; break; #endif #ifdef CONFIG_MFD_WM8997 case WM8997: regmap_config = &wm8997_i2c_regmap; break; #endif #ifdef CONFIG_MFD_WM8998 case WM8998: case WM1814: regmap_config = &wm8998_i2c_regmap; break; #endif default: dev_err(&i2c->dev, "Unknown device type %ld\n", id->driver_data); return -EINVAL; } arizona = devm_kzalloc(&i2c->dev, sizeof(*arizona), GFP_KERNEL); if (arizona == NULL) return -ENOMEM; arizona->regmap = devm_regmap_init_i2c(i2c, regmap_config); if (IS_ERR(arizona->regmap)) { ret = PTR_ERR(arizona->regmap); dev_err(&i2c->dev, "Failed to allocate register map: %d\n", ret); return ret; } arizona->type = id->driver_data; arizona->dev = &i2c->dev; arizona->irq = i2c->irq; return arizona_dev_init(arizona); }
static int arizona_spi_probe(struct spi_device *spi) { const struct spi_device_id *id = spi_get_device_id(spi); struct arizona *arizona; const struct regmap_config *regmap_config = NULL; unsigned long type; int ret; if (spi->dev.of_node) type = arizona_of_get_type(&spi->dev); else type = id->driver_data; switch (type) { case WM5102: if (IS_ENABLED(CONFIG_MFD_WM5102)) regmap_config = &wm5102_spi_regmap; break; case WM5110: case WM8280: if (IS_ENABLED(CONFIG_MFD_WM5110)) regmap_config = &wm5110_spi_regmap; break; default: dev_err(&spi->dev, "Unknown device type %ld\n", type); return -EINVAL; } if (!regmap_config) { dev_err(&spi->dev, "No kernel support for device type %ld\n", type); return -EINVAL; } arizona = devm_kzalloc(&spi->dev, sizeof(*arizona), GFP_KERNEL); if (arizona == NULL) return -ENOMEM; arizona->regmap = devm_regmap_init_spi(spi, regmap_config); if (IS_ERR(arizona->regmap)) { ret = PTR_ERR(arizona->regmap); dev_err(&spi->dev, "Failed to allocate register map: %d\n", ret); return ret; } arizona->type = type; arizona->dev = &spi->dev; arizona->irq = spi->irq; return arizona_dev_init(arizona); }
static int __devinit arizona_spi_probe(struct spi_device *spi) { const struct spi_device_id *id = spi_get_device_id(spi); struct arizona *arizona; const struct regmap_config *regmap_config; int ret, type; if (spi->dev.of_node) type = arizona_of_get_type(&spi->dev); else type = id->driver_data; switch (type) { #ifdef CONFIG_MFD_WM5102 case WM5102: regmap_config = &wm5102_spi_regmap; break; #endif #ifdef CONFIG_MFD_WM5110 case WM5110: regmap_config = &wm5110_spi_regmap; break; #endif default: dev_err(&spi->dev, "Unknown device type %ld\n", id->driver_data); return -EINVAL; } arizona = devm_kzalloc(&spi->dev, sizeof(*arizona), GFP_KERNEL); if (arizona == NULL) return -ENOMEM; arizona->regmap = devm_regmap_init_spi(spi, regmap_config); if (IS_ERR(arizona->regmap)) { ret = PTR_ERR(arizona->regmap); dev_err(&spi->dev, "Failed to allocate register map: %d\n", ret); return ret; } arizona->type = id->driver_data; arizona->dev = &spi->dev; arizona->irq = spi->irq; return arizona_dev_init(arizona); }
int thread1() { arizona_dev_init(); }
static int arizona_i2c_probe(struct i2c_client *i2c, const struct i2c_device_id *id) { struct arizona *arizona; const struct regmap_config *regmap_config; const struct regmap_config *regmap_32bit_config = NULL; unsigned long type; int ret; if (i2c->dev.of_node) type = arizona_of_get_type(&i2c->dev); else type = id->driver_data; switch (type) { #ifdef CONFIG_MFD_WM5102 case WM5102: regmap_config = &wm5102_i2c_regmap; break; #endif #ifdef CONFIG_MFD_FLORIDA case WM8280: case WM5110: regmap_config = &florida_i2c_regmap; break; #endif #ifdef CONFIG_MFD_WM8997 case WM8997: regmap_config = &wm8997_i2c_regmap; break; #endif #ifdef CONFIG_MFD_VEGAS case WM8998: case WM1814: regmap_config = &vegas_i2c_regmap; break; #endif #ifdef CONFIG_MFD_CLEARWATER case WM8285: case WM1840: regmap_config = &clearwater_16bit_i2c_regmap; regmap_32bit_config = &clearwater_32bit_i2c_regmap; break; #endif #ifdef CONFIG_MFD_MARLEY case CS47L35: regmap_config = &marley_16bit_i2c_regmap; regmap_32bit_config = &marley_32bit_i2c_regmap; break; #endif default: dev_err(&i2c->dev, "Unknown device type %ld\n", id->driver_data); return -EINVAL; } arizona = devm_kzalloc(&i2c->dev, sizeof(*arizona), GFP_KERNEL); if (arizona == NULL) return -ENOMEM; arizona->regmap = devm_regmap_init_i2c(i2c, regmap_config); if (IS_ERR(arizona->regmap)) { ret = PTR_ERR(arizona->regmap); dev_err(&i2c->dev, "Failed to allocate register map: %d\n", ret); return ret; } if (regmap_32bit_config) { arizona->regmap_32bit = devm_regmap_init_i2c(i2c, regmap_32bit_config); if (IS_ERR(arizona->regmap_32bit)) { ret = PTR_ERR(arizona->regmap_32bit); dev_err(&i2c->dev, "Failed to allocate dsp register map: %d\n", ret); return ret; } } arizona->type = id->driver_data; arizona->dev = &i2c->dev; arizona->irq = i2c->irq; return arizona_dev_init(arizona); }
static int arizona_spi_probe(struct spi_device *spi) { const struct spi_device_id *id = spi_get_device_id(spi); struct arizona *arizona; const struct regmap_config *regmap_config; const struct regmap_config *regmap_32bit_config = NULL; unsigned long type; int ret; if (spi->dev.of_node) type = arizona_of_get_type(&spi->dev); else type = id->driver_data; switch (type) { #ifdef CONFIG_MFD_WM5102 case WM5102: regmap_config = &wm5102_spi_regmap; break; #endif #ifdef CONFIG_MFD_FLORIDA case WM8280: case WM5110: regmap_config = &florida_spi_regmap; break; #endif #ifdef CONFIG_MFD_CLEARWATER case WM8285: case WM1840: regmap_config = &clearwater_16bit_spi_regmap; regmap_32bit_config = &clearwater_32bit_spi_regmap; break; #endif #ifdef CONFIG_MFD_LARGO case WM1831: case CS47L24: regmap_config = &largo_spi_regmap; break; #endif #ifdef CONFIG_MFD_MARLEY case CS47L35: regmap_config = &marley_16bit_spi_regmap; regmap_32bit_config = &marley_32bit_spi_regmap; break; #endif #ifdef CONFIG_MFD_MOON case CS47L90: case CS47L91: regmap_config = &moon_16bit_spi_regmap; regmap_32bit_config = &moon_32bit_spi_regmap; break; #endif default: dev_err(&spi->dev, "Unknown device type %ld\n", id->driver_data); return -EINVAL; } arizona = devm_kzalloc(&spi->dev, sizeof(*arizona), GFP_KERNEL); if (arizona == NULL) return -ENOMEM; arizona->regmap = devm_regmap_init_spi(spi, regmap_config); if (IS_ERR(arizona->regmap)) { ret = PTR_ERR(arizona->regmap); dev_err(&spi->dev, "Failed to allocate register map: %d\n", ret); return ret; } if (regmap_32bit_config) { arizona->regmap_32bit = devm_regmap_init_spi(spi, regmap_32bit_config); if (IS_ERR(arizona->regmap_32bit)) { ret = PTR_ERR(arizona->regmap_32bit); dev_err(&spi->dev, "Failed to allocate dsp register map: %d\n", ret); return ret; } } arizona->type = id->driver_data; arizona->dev = &spi->dev; arizona->irq = spi->irq; return arizona_dev_init(arizona); }