Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drivers: max77693: Move state container to common header

This prepares for merging some of the drivers between max77693 and
max77843 so the child MFD driver can be attached to any parent MFD main
driver.

Move the state container to common header file. Additionally add
consistent 'i2c' prefixes to its members (of 'struct i2c_client' type).

Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
Acked-by: Sebastian Reichel <sre@kernel.org>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Acked-by: Jacek Anaszewski <j.anaszewski@samsung.com>
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Krzysztof Kozlowski and committed by
Mark Brown
61b305cd 5b5e771f

+66 -41
+2 -1
drivers/extcon/extcon-max77693.c
··· 24 24 #include <linux/err.h> 25 25 #include <linux/platform_device.h> 26 26 #include <linux/mfd/max77693.h> 27 + #include <linux/mfd/max77693-common.h> 27 28 #include <linux/mfd/max77693-private.h> 28 29 #include <linux/extcon.h> 29 30 #include <linux/regmap.h> ··· 1078 1077 dev_dbg(&pdev->dev, "allocate register map\n"); 1079 1078 } else { 1080 1079 info->max77693->regmap_muic = devm_regmap_init_i2c( 1081 - info->max77693->muic, 1080 + info->max77693->i2c_muic, 1082 1081 &max77693_muic_regmap_config); 1083 1082 if (IS_ERR(info->max77693->regmap_muic)) { 1084 1083 ret = PTR_ERR(info->max77693->regmap_muic);
+1
drivers/input/misc/max77693-haptic.c
··· 24 24 #include <linux/workqueue.h> 25 25 #include <linux/regulator/consumer.h> 26 26 #include <linux/mfd/max77693.h> 27 + #include <linux/mfd/max77693-common.h> 27 28 #include <linux/mfd/max77693-private.h> 28 29 29 30 #define MAX_MAGNITUDE_SHIFT 16
+1
drivers/leds/leds-max77693.c
··· 13 13 14 14 #include <linux/led-class-flash.h> 15 15 #include <linux/mfd/max77693.h> 16 + #include <linux/mfd/max77693-common.h> 16 17 #include <linux/mfd/max77693-private.h> 17 18 #include <linux/module.h> 18 19 #include <linux/mutex.h>
+16 -15
drivers/mfd/max77693.c
··· 33 33 #include <linux/mutex.h> 34 34 #include <linux/mfd/core.h> 35 35 #include <linux/mfd/max77693.h> 36 + #include <linux/mfd/max77693-common.h> 36 37 #include <linux/mfd/max77693-private.h> 37 38 #include <linux/regulator/machine.h> 38 39 #include <linux/regmap.h> ··· 194 193 } else 195 194 dev_info(max77693->dev, "device ID: 0x%x\n", reg_data); 196 195 197 - max77693->muic = i2c_new_dummy(i2c->adapter, I2C_ADDR_MUIC); 198 - if (!max77693->muic) { 196 + max77693->i2c_muic = i2c_new_dummy(i2c->adapter, I2C_ADDR_MUIC); 197 + if (!max77693->i2c_muic) { 199 198 dev_err(max77693->dev, "Failed to allocate I2C device for MUIC\n"); 200 199 return -ENODEV; 201 200 } 202 - i2c_set_clientdata(max77693->muic, max77693); 201 + i2c_set_clientdata(max77693->i2c_muic, max77693); 203 202 204 - max77693->haptic = i2c_new_dummy(i2c->adapter, I2C_ADDR_HAPTIC); 205 - if (!max77693->haptic) { 203 + max77693->i2c_haptic = i2c_new_dummy(i2c->adapter, I2C_ADDR_HAPTIC); 204 + if (!max77693->i2c_haptic) { 206 205 dev_err(max77693->dev, "Failed to allocate I2C device for Haptic\n"); 207 206 ret = -ENODEV; 208 207 goto err_i2c_haptic; 209 208 } 210 - i2c_set_clientdata(max77693->haptic, max77693); 209 + i2c_set_clientdata(max77693->i2c_haptic, max77693); 211 210 212 - max77693->regmap_haptic = devm_regmap_init_i2c(max77693->haptic, 211 + max77693->regmap_haptic = devm_regmap_init_i2c(max77693->i2c_haptic, 213 212 &max77693_regmap_haptic_config); 214 213 if (IS_ERR(max77693->regmap_haptic)) { 215 214 ret = PTR_ERR(max77693->regmap_haptic); ··· 223 222 * instance of MUIC device when irq of max77693 is initialized 224 223 * before call max77693-muic probe() function. 225 224 */ 226 - max77693->regmap_muic = devm_regmap_init_i2c(max77693->muic, 225 + max77693->regmap_muic = devm_regmap_init_i2c(max77693->i2c_muic, 227 226 &max77693_regmap_muic_config); 228 227 if (IS_ERR(max77693->regmap_muic)) { 229 228 ret = PTR_ERR(max77693->regmap_muic); ··· 256 255 IRQF_ONESHOT | IRQF_SHARED | 257 256 IRQF_TRIGGER_FALLING, 0, 258 257 &max77693_charger_irq_chip, 259 - &max77693->irq_data_charger); 258 + &max77693->irq_data_chg); 260 259 if (ret) { 261 260 dev_err(max77693->dev, "failed to add irq chip: %d\n", ret); 262 261 goto err_irq_charger; ··· 297 296 err_intsrc: 298 297 regmap_del_irq_chip(max77693->irq, max77693->irq_data_muic); 299 298 err_irq_muic: 300 - regmap_del_irq_chip(max77693->irq, max77693->irq_data_charger); 299 + regmap_del_irq_chip(max77693->irq, max77693->irq_data_chg); 301 300 err_irq_charger: 302 301 regmap_del_irq_chip(max77693->irq, max77693->irq_data_topsys); 303 302 err_irq_topsys: 304 303 regmap_del_irq_chip(max77693->irq, max77693->irq_data_led); 305 304 err_regmap: 306 - i2c_unregister_device(max77693->haptic); 305 + i2c_unregister_device(max77693->i2c_haptic); 307 306 err_i2c_haptic: 308 - i2c_unregister_device(max77693->muic); 307 + i2c_unregister_device(max77693->i2c_muic); 309 308 return ret; 310 309 } 311 310 ··· 316 315 mfd_remove_devices(max77693->dev); 317 316 318 317 regmap_del_irq_chip(max77693->irq, max77693->irq_data_muic); 319 - regmap_del_irq_chip(max77693->irq, max77693->irq_data_charger); 318 + regmap_del_irq_chip(max77693->irq, max77693->irq_data_chg); 320 319 regmap_del_irq_chip(max77693->irq, max77693->irq_data_topsys); 321 320 regmap_del_irq_chip(max77693->irq, max77693->irq_data_led); 322 321 323 - i2c_unregister_device(max77693->muic); 324 - i2c_unregister_device(max77693->haptic); 322 + i2c_unregister_device(max77693->i2c_muic); 323 + i2c_unregister_device(max77693->i2c_haptic); 325 324 326 325 return 0; 327 326 }
+1
drivers/power/max77693_charger.c
··· 20 20 #include <linux/power_supply.h> 21 21 #include <linux/regmap.h> 22 22 #include <linux/mfd/max77693.h> 23 + #include <linux/mfd/max77693-common.h> 23 24 #include <linux/mfd/max77693-private.h> 24 25 25 26 #define MAX77693_CHARGER_NAME "max77693-charger"
+1
drivers/regulator/max77693.c
··· 29 29 #include <linux/regulator/driver.h> 30 30 #include <linux/regulator/machine.h> 31 31 #include <linux/mfd/max77693.h> 32 + #include <linux/mfd/max77693-common.h> 32 33 #include <linux/mfd/max77693-private.h> 33 34 #include <linux/regulator/of_regulator.h> 34 35 #include <linux/regmap.h>
+44
include/linux/mfd/max77693-common.h
··· 1 + /* 2 + * Common data shared between Maxim 77693 and 77843 drivers 3 + * 4 + * Copyright (C) 2015 Samsung Electronics 5 + * 6 + * This program is free software; you can redistribute it and/or modify 7 + * it under the terms of the GNU General Public License as published by 8 + * the Free Software Foundation; either version 2 of the License, or 9 + * (at your option) any later version. 10 + */ 11 + 12 + #ifndef __LINUX_MFD_MAX77693_COMMON_H 13 + #define __LINUX_MFD_MAX77693_COMMON_H 14 + 15 + enum max77693_types { 16 + TYPE_MAX77693_UNKNOWN, 17 + TYPE_MAX77693, 18 + }; 19 + 20 + /* 21 + * Shared also with max77843. 22 + */ 23 + struct max77693_dev { 24 + struct device *dev; 25 + struct i2c_client *i2c; /* 0xCC , PMIC, Charger, Flash LED */ 26 + struct i2c_client *i2c_muic; /* 0x4A , MUIC */ 27 + struct i2c_client *i2c_haptic; /* MAX77693: 0x90 , Haptic */ 28 + 29 + enum max77693_types type; 30 + 31 + struct regmap *regmap; 32 + struct regmap *regmap_muic; 33 + struct regmap *regmap_haptic; /* Only MAX77693 */ 34 + 35 + struct regmap_irq_chip_data *irq_data_led; 36 + struct regmap_irq_chip_data *irq_data_topsys; 37 + struct regmap_irq_chip_data *irq_data_chg; /* Only MAX77693 */ 38 + struct regmap_irq_chip_data *irq_data_muic; 39 + 40 + int irq; 41 + }; 42 + 43 + 44 + #endif /* __LINUX_MFD_MAX77693_COMMON_H */
-25
include/linux/mfd/max77693-private.h
··· 529 529 MAX77693_MUIC_IRQ_NR, 530 530 }; 531 531 532 - enum max77693_types { 533 - TYPE_MAX77693_UNKNOWN, 534 - TYPE_MAX77693, 535 - }; 536 - 537 - struct max77693_dev { 538 - struct device *dev; 539 - struct i2c_client *i2c; /* 0xCC , PMIC, Charger, Flash LED */ 540 - struct i2c_client *muic; /* 0x4A , MUIC */ 541 - struct i2c_client *haptic; /* 0x90 , Haptic */ 542 - 543 - enum max77693_types type; 544 - 545 - struct regmap *regmap; 546 - struct regmap *regmap_muic; 547 - struct regmap *regmap_haptic; 548 - 549 - struct regmap_irq_chip_data *irq_data_led; 550 - struct regmap_irq_chip_data *irq_data_topsys; 551 - struct regmap_irq_chip_data *irq_data_charger; 552 - struct regmap_irq_chip_data *irq_data_muic; 553 - 554 - int irq; 555 - }; 556 - 557 532 #endif /* __LINUX_MFD_MAX77693_PRIV_H */