Lines Matching +full:ec +full:- +full:pwm

1 // SPDX-License-Identifier: GPL-2.0-or-later
4 * e-book readers designed by the original design manufacturer Netronix, Inc.
5 * It contains RTC, battery monitoring, system power management, and PWM
9 * power-off/reset.
43 .addr = poweroff_restart_client->addr, in ntxec_poweroff()
52 res = i2c_transfer(poweroff_restart_client->adapter, msgs, ARRAY_SIZE(msgs)); in ntxec_poweroff()
54 dev_warn(&poweroff_restart_client->dev, in ntxec_poweroff()
73 * does send the full two-byte value, but doesn't check the result). in ntxec_restart()
77 .addr = poweroff_restart_client->addr, in ntxec_restart()
79 .len = sizeof(buf) - 1, in ntxec_restart()
86 res = i2c_transfer(poweroff_restart_client->adapter, msgs, ARRAY_SIZE(msgs)); in ntxec_restart()
88 dev_warn(&poweroff_restart_client->dev, in ntxec_restart()
140 { .name = "ntxec-rtc" },
141 { .name = "ntxec-pwm" },
145 { .name = "ntxec-pwm" },
150 struct ntxec *ec; in ntxec_probe() local
156 ec = devm_kmalloc(&client->dev, sizeof(*ec), GFP_KERNEL); in ntxec_probe()
157 if (!ec) in ntxec_probe()
158 return -ENOMEM; in ntxec_probe()
160 ec->dev = &client->dev; in ntxec_probe()
162 ec->regmap = devm_regmap_init_i2c(client, &regmap_config); in ntxec_probe()
163 if (IS_ERR(ec->regmap)) { in ntxec_probe()
164 dev_err(ec->dev, "Failed to set up regmap for device\n"); in ntxec_probe()
165 return PTR_ERR(ec->regmap); in ntxec_probe()
169 res = regmap_read(ec->regmap, NTXEC_REG_VERSION, &version); in ntxec_probe()
171 dev_err(ec->dev, "Failed to read firmware version number\n"); in ntxec_probe()
186 ec->regmap = devm_regmap_init(ec->dev, NULL, in ntxec_probe()
187 ec->regmap, in ntxec_probe()
189 if (IS_ERR(ec->regmap)) in ntxec_probe()
190 return PTR_ERR(ec->regmap); in ntxec_probe()
193 dev_err(ec->dev, in ntxec_probe()
196 return -ENODEV; in ntxec_probe()
199 dev_info(ec->dev, in ntxec_probe()
202 if (of_device_is_system_power_controller(ec->dev->of_node)) { in ntxec_probe()
207 res = regmap_write(ec->regmap, NTXEC_REG_POWERKEEP, in ntxec_probe()
217 dev_err(ec->dev, "poweroff_restart_client already assigned\n"); in ntxec_probe()
223 dev_err(ec->dev, "pm_power_off already assigned\n"); in ntxec_probe()
229 dev_err(ec->dev, in ntxec_probe()
233 i2c_set_clientdata(client, ec); in ntxec_probe()
235 res = devm_mfd_add_devices(ec->dev, PLATFORM_DEVID_NONE, in ntxec_probe()
238 dev_err(ec->dev, "Failed to add subdevices: %d\n", res); in ntxec_probe()
269 MODULE_DESCRIPTION("Core driver for Netronix EC");