Lines Matching refs:ec
38 static int yoga_c630_ec_request(struct yoga_c630_ec *ec, u8 *req, size_t req_len, in yoga_c630_ec_request() argument
43 lockdep_assert_held(&ec->lock); in yoga_c630_ec_request()
45 ret = i2c_smbus_write_i2c_block_data(ec->client, LENOVO_EC_REQUEST_REG, in yoga_c630_ec_request()
50 return i2c_smbus_read_i2c_block_data(ec->client, LENOVO_EC_RESPONSE_REG, in yoga_c630_ec_request()
54 int yoga_c630_ec_read8(struct yoga_c630_ec *ec, u8 addr) in yoga_c630_ec_read8() argument
60 guard(mutex)(&ec->lock); in yoga_c630_ec_read8()
63 ret = yoga_c630_ec_request(ec, req, sizeof(req), &val, 1); in yoga_c630_ec_read8()
71 int yoga_c630_ec_read16(struct yoga_c630_ec *ec, u8 addr) in yoga_c630_ec_read16() argument
82 guard(mutex)(&ec->lock); in yoga_c630_ec_read16()
85 ret = yoga_c630_ec_request(ec, req, sizeof(req), &lsb, 1); in yoga_c630_ec_read16()
90 ret = yoga_c630_ec_request(ec, req, sizeof(req), &msb, 1); in yoga_c630_ec_read16()
98 u16 yoga_c630_ec_ucsi_get_version(struct yoga_c630_ec *ec) in yoga_c630_ec_ucsi_get_version() argument
105 guard(mutex)(&ec->lock); in yoga_c630_ec_ucsi_get_version()
108 ret = yoga_c630_ec_request(ec, req, sizeof(req), &lsb, 1); in yoga_c630_ec_ucsi_get_version()
113 ret = yoga_c630_ec_request(ec, req, sizeof(req), &msb, 1); in yoga_c630_ec_ucsi_get_version()
121 int yoga_c630_ec_ucsi_write(struct yoga_c630_ec *ec, in yoga_c630_ec_ucsi_write() argument
126 mutex_lock(&ec->lock); in yoga_c630_ec_ucsi_write()
127 ret = i2c_smbus_write_i2c_block_data(ec->client, LENOVO_EC_UCSI_WRITE, in yoga_c630_ec_ucsi_write()
129 mutex_unlock(&ec->lock); in yoga_c630_ec_ucsi_write()
135 int yoga_c630_ec_ucsi_read(struct yoga_c630_ec *ec, in yoga_c630_ec_ucsi_read() argument
140 mutex_lock(&ec->lock); in yoga_c630_ec_ucsi_read()
141 ret = i2c_smbus_read_i2c_block_data(ec->client, LENOVO_EC_UCSI_READ, in yoga_c630_ec_ucsi_read()
143 mutex_unlock(&ec->lock); in yoga_c630_ec_ucsi_read()
152 struct yoga_c630_ec *ec = data; in yoga_c630_ec_thread_intr() local
156 mutex_lock(&ec->lock); in yoga_c630_ec_thread_intr()
157 ret = yoga_c630_ec_request(ec, req, sizeof(req), &event, 1); in yoga_c630_ec_thread_intr()
158 mutex_unlock(&ec->lock); in yoga_c630_ec_thread_intr()
162 blocking_notifier_call_chain(&ec->notifier_list, event, ec); in yoga_c630_ec_thread_intr()
174 int yoga_c630_ec_register_notify(struct yoga_c630_ec *ec, struct notifier_block *nb) in yoga_c630_ec_register_notify() argument
176 return blocking_notifier_chain_register(&ec->notifier_list, nb); in yoga_c630_ec_register_notify()
188 void yoga_c630_ec_unregister_notify(struct yoga_c630_ec *ec, struct notifier_block *nb) in yoga_c630_ec_unregister_notify() argument
190 blocking_notifier_chain_unregister(&ec->notifier_list, nb); in yoga_c630_ec_unregister_notify()
210 struct yoga_c630_ec *ec) in yoga_c630_aux_init() argument
223 adev->dev.platform_data = ec; in yoga_c630_aux_init()
243 struct yoga_c630_ec *ec; in yoga_c630_ec_probe() local
246 ec = devm_kzalloc(dev, sizeof(*ec), GFP_KERNEL); in yoga_c630_ec_probe()
247 if (!ec) in yoga_c630_ec_probe()
250 mutex_init(&ec->lock); in yoga_c630_ec_probe()
251 ec->client = client; in yoga_c630_ec_probe()
252 BLOCKING_INIT_NOTIFIER_HEAD(&ec->notifier_list); in yoga_c630_ec_probe()
256 IRQF_ONESHOT, "yoga_c630_ec", ec); in yoga_c630_ec_probe()
260 ret = yoga_c630_aux_init(dev, YOGA_C630_DEV_PSY, ec); in yoga_c630_ec_probe()
264 return yoga_c630_aux_init(dev, YOGA_C630_DEV_UCSI, ec); in yoga_c630_ec_probe()