Lines Matching +full:chip +full:- +full:id

1 // SPDX-License-Identifier: GPL-2.0-only
18 /* 88pm80x chips have same definition for chip id register. */
24 unsigned int id; member
29 /* 88PM800 chip id number */
31 /* 88PM805 chip id number */
33 /* 88PM860 chip id number */
40 * pm800 and pm805. would remove it after HW chip fixes the issue.
53 struct pm80x_chip *chip; in pm80x_init() local
58 chip = in pm80x_init()
59 devm_kzalloc(&client->dev, sizeof(struct pm80x_chip), GFP_KERNEL); in pm80x_init()
60 if (!chip) in pm80x_init()
61 return -ENOMEM; in pm80x_init()
66 dev_err(&client->dev, "Failed to allocate register map: %d\n", in pm80x_init()
71 chip->client = client; in pm80x_init()
72 chip->regmap = map; in pm80x_init()
74 chip->irq = client->irq; in pm80x_init()
76 chip->dev = &client->dev; in pm80x_init()
77 i2c_set_clientdata(chip->client, chip); in pm80x_init()
79 ret = regmap_read(chip->regmap, PM80X_CHIP_ID, &val); in pm80x_init()
81 dev_err(chip->dev, "Failed to read CHIP ID: %d\n", ret); in pm80x_init()
86 if (chip_mapping[i].id == PM80X_CHIP_ID_NUM(val)) { in pm80x_init()
87 chip->type = chip_mapping[i].type; in pm80x_init()
93 dev_err(chip->dev, in pm80x_init()
95 return -EINVAL; in pm80x_init()
98 device_init_wakeup(&client->dev, 1); in pm80x_init()
101 * workaround: set g_pm80x_chip to the first probed chip. if the in pm80x_init()
102 * second chip is probed, just point to the companion to each in pm80x_init()
104 * remove it after HW chip fixes the issue. in pm80x_init()
107 g_pm80x_chip = chip; in pm80x_init()
109 chip->companion = g_pm80x_chip->client; in pm80x_init()
110 g_pm80x_chip->companion = chip->client; in pm80x_init()
121 * would remove it after HW chip fixes the issue. in pm80x_deinit()
123 if (g_pm80x_chip->companion) in pm80x_deinit()
124 g_pm80x_chip->companion = NULL; in pm80x_deinit()
134 struct pm80x_chip *chip = i2c_get_clientdata(client); in pm80x_suspend() local
136 if (chip && chip->wu_flag) in pm80x_suspend()
137 if (device_may_wakeup(chip->dev)) in pm80x_suspend()
138 enable_irq_wake(chip->irq); in pm80x_suspend()
146 struct pm80x_chip *chip = i2c_get_clientdata(client); in pm80x_resume() local
148 if (chip && chip->wu_flag) in pm80x_resume()
149 if (device_may_wakeup(chip->dev)) in pm80x_resume()
150 disable_irq_wake(chip->irq); in pm80x_resume()