• Home
  • Raw
  • Download

Lines Matching refs:iface

92 #define ACBSDA		(iface->base + 0)
93 #define ACBST (iface->base + 1)
99 #define ACBCST (iface->base + 2)
101 #define ACBCTL1 (iface->base + 3)
107 #define ACBADDR (iface->base + 4)
108 #define ACBCTL2 (iface->base + 5)
113 static void scx200_acb_machine(struct scx200_acb_iface *iface, u8 status) in scx200_acb_machine() argument
117 dev_dbg(&iface->adapter.dev, "state %s, status = 0x%02x\n", in scx200_acb_machine()
118 scx200_acb_state_name[iface->state], status); in scx200_acb_machine()
129 dev_dbg(&iface->adapter.dev, "negative ack in state %s\n", in scx200_acb_machine()
130 scx200_acb_state_name[iface->state]); in scx200_acb_machine()
132 iface->state = state_idle; in scx200_acb_machine()
133 iface->result = -ENXIO; in scx200_acb_machine()
143 switch (iface->state) { in scx200_acb_machine()
145 dev_warn(&iface->adapter.dev, "interrupt in idle state\n"); in scx200_acb_machine()
150 outb(iface->address_byte & ~1, ACBSDA); in scx200_acb_machine()
152 iface->state = state_command; in scx200_acb_machine()
156 outb(iface->command, ACBSDA); in scx200_acb_machine()
158 if (iface->address_byte & 1) in scx200_acb_machine()
159 iface->state = state_repeat_start; in scx200_acb_machine()
161 iface->state = state_write; in scx200_acb_machine()
169 if (iface->address_byte & 1) { in scx200_acb_machine()
170 if (iface->len == 1) in scx200_acb_machine()
174 outb(iface->address_byte, ACBSDA); in scx200_acb_machine()
176 iface->state = state_read; in scx200_acb_machine()
178 outb(iface->address_byte, ACBSDA); in scx200_acb_machine()
180 iface->state = state_write; in scx200_acb_machine()
186 if (iface->len == 2) in scx200_acb_machine()
191 if (iface->len == 1) { in scx200_acb_machine()
192 iface->result = 0; in scx200_acb_machine()
193 iface->state = state_idle; in scx200_acb_machine()
197 *iface->ptr++ = inb(ACBSDA); in scx200_acb_machine()
198 --iface->len; in scx200_acb_machine()
203 if (iface->len == 0) { in scx200_acb_machine()
204 iface->result = 0; in scx200_acb_machine()
205 iface->state = state_idle; in scx200_acb_machine()
210 outb(*iface->ptr++, ACBSDA); in scx200_acb_machine()
211 --iface->len; in scx200_acb_machine()
219 dev_err(&iface->adapter.dev, in scx200_acb_machine()
221 scx200_acb_state_name[iface->state], iface->address_byte, in scx200_acb_machine()
222 iface->len, status); in scx200_acb_machine()
224 iface->state = state_idle; in scx200_acb_machine()
225 iface->result = -EIO; in scx200_acb_machine()
226 iface->needs_reset = 1; in scx200_acb_machine()
229 static void scx200_acb_poll(struct scx200_acb_iface *iface) in scx200_acb_poll() argument
242 scx200_acb_machine(iface, status); in scx200_acb_poll()
251 dev_err(&iface->adapter.dev, "timeout in state %s\n", in scx200_acb_poll()
252 scx200_acb_state_name[iface->state]); in scx200_acb_poll()
254 iface->state = state_idle; in scx200_acb_poll()
255 iface->result = -EIO; in scx200_acb_poll()
256 iface->needs_reset = 1; in scx200_acb_poll()
259 static void scx200_acb_reset(struct scx200_acb_iface *iface) in scx200_acb_reset() argument
285 struct scx200_acb_iface *iface = i2c_get_adapdata(adapter); in scx200_acb_smbus_xfer() local
333 mutex_lock(&iface->mutex); in scx200_acb_smbus_xfer()
335 iface->address_byte = (address << 1) | rw; in scx200_acb_smbus_xfer()
336 iface->command = command; in scx200_acb_smbus_xfer()
337 iface->ptr = buffer; in scx200_acb_smbus_xfer()
338 iface->len = len; in scx200_acb_smbus_xfer()
339 iface->result = -EINVAL; in scx200_acb_smbus_xfer()
340 iface->needs_reset = 0; in scx200_acb_smbus_xfer()
345 iface->state = state_quick; in scx200_acb_smbus_xfer()
347 iface->state = state_address; in scx200_acb_smbus_xfer()
349 while (iface->state != state_idle) in scx200_acb_smbus_xfer()
350 scx200_acb_poll(iface); in scx200_acb_smbus_xfer()
352 if (iface->needs_reset) in scx200_acb_smbus_xfer()
353 scx200_acb_reset(iface); in scx200_acb_smbus_xfer()
355 rc = iface->result; in scx200_acb_smbus_xfer()
357 mutex_unlock(&iface->mutex); in scx200_acb_smbus_xfer()
392 static int scx200_acb_probe(struct scx200_acb_iface *iface) in scx200_acb_probe() argument
430 struct scx200_acb_iface *iface; in scx200_create_iface() local
433 iface = kzalloc(sizeof(*iface), GFP_KERNEL); in scx200_create_iface()
434 if (!iface) { in scx200_create_iface()
439 adapter = &iface->adapter; in scx200_create_iface()
440 i2c_set_adapdata(adapter, iface); in scx200_create_iface()
447 mutex_init(&iface->mutex); in scx200_create_iface()
449 return iface; in scx200_create_iface()
452 static int scx200_acb_create(struct scx200_acb_iface *iface) in scx200_acb_create() argument
457 adapter = &iface->adapter; in scx200_acb_create()
459 rc = scx200_acb_probe(iface); in scx200_acb_create()
465 scx200_acb_reset(iface); in scx200_acb_create()
475 iface->next = scx200_acb_list; in scx200_acb_create()
476 scx200_acb_list = iface; in scx200_acb_create()
486 struct scx200_acb_iface *iface; in scx200_create_dev() local
489 iface = scx200_create_iface(text, dev, index); in scx200_create_dev()
491 if (iface == NULL) in scx200_create_dev()
494 if (!request_region(base, 8, iface->adapter.name)) { in scx200_create_dev()
499 iface->base = base; in scx200_create_dev()
500 rc = scx200_acb_create(iface); in scx200_create_dev()
503 return iface; in scx200_create_dev()
507 kfree(iface); in scx200_create_dev()
513 struct scx200_acb_iface *iface; in scx200_probe() local
522 iface = scx200_create_dev("CS5535", res->start, 0, &pdev->dev); in scx200_probe()
523 if (!iface) in scx200_probe()
527 iface->adapter.name); in scx200_probe()
528 platform_set_drvdata(pdev, iface); in scx200_probe()
533 static void scx200_cleanup_iface(struct scx200_acb_iface *iface) in scx200_cleanup_iface() argument
535 i2c_del_adapter(&iface->adapter); in scx200_cleanup_iface()
536 release_region(iface->base, 8); in scx200_cleanup_iface()
537 kfree(iface); in scx200_cleanup_iface()
542 struct scx200_acb_iface *iface; in scx200_remove() local
544 iface = platform_get_drvdata(pdev); in scx200_remove()
545 scx200_cleanup_iface(iface); in scx200_remove()
598 struct scx200_acb_iface *iface; in scx200_acb_cleanup() local
603 while ((iface = scx200_acb_list) != NULL) { in scx200_acb_cleanup()
604 scx200_acb_list = iface->next; in scx200_acb_cleanup()
607 scx200_cleanup_iface(iface); in scx200_acb_cleanup()