Lines Matching +full:flip +full:- +full:chip
1 // SPDX-License-Identifier: GPL-2.0-only
2 /* display7seg.c - Driver implementation for the 7-segment display
32 /* Solaris compatibility flag -
34 * documented driver features (ref Sun doc 806-0180-03).
38 * 1) Device ALWAYS reverts to OBP-specified FLIPPED mode
41 * FLIP bit
44 * omitting above features, set this parameter to non-zero.
51 MODULE_DESCRIPTION("7-Segment Display driver for Sun Microsystems CP1400/1500");
61 * Register block address- see header for details
62 * -----------------------------------------
63 * | DP | ALARM | FLIP | 4 | 3 | 2 | 1 | 0 |
64 * -----------------------------------------
66 * DP - Toggles decimal point on/off
67 * ALARM - Toggles "Alarm" LED green/red
68 * FLIP - Inverts display for upside-down mounted board
69 * bits 0-4 - 7-segment display contents
76 return -ENODEV; in d7s_open()
85 * are not operating in solaris-compat mode in d7s_release()
91 regval = readb(p->regs); in d7s_release()
92 if (p->flipped) in d7s_release()
96 writeb(regval, p->regs); in d7s_release()
105 u8 regs = readb(p->regs); in d7s_ioctl()
110 return -ENODEV; in d7s_ioctl()
115 /* assign device register values we mask-out D7S_FLIP in d7s_ioctl()
119 error = -EFAULT; in d7s_ioctl()
128 writeb(ireg, p->regs); in d7s_ioctl()
139 error = -EFAULT; in d7s_ioctl()
145 /* toggle device mode-- flip display orientation */ in d7s_ioctl()
147 writeb(regs, p->regs); in d7s_ioctl()
173 int err = -EINVAL; in d7s_probe()
180 p = devm_kzalloc(&op->dev, sizeof(*p), GFP_KERNEL); in d7s_probe()
181 err = -ENOMEM; in d7s_probe()
185 p->regs = of_ioremap(&op->resource[0], 0, sizeof(u8), "d7s"); in d7s_probe()
186 if (!p->regs) { in d7s_probe()
187 printk(KERN_ERR PFX "Cannot map chip registers\n"); in d7s_probe()
198 /* OBP option "d7s-flipped?" is honored as default for the in d7s_probe()
201 regs = readb(p->regs); in d7s_probe()
204 p->flipped = of_property_read_bool(opts, "d7s-flipped?"); in d7s_probe()
206 if (p->flipped) in d7s_probe()
211 writeb(regs, p->regs); in d7s_probe()
213 printk(KERN_INFO PFX "7-Segment Display%pOF at [%s:0x%llx] %s\n", in d7s_probe()
214 op->dev.of_node, in d7s_probe()
216 op->resource[0].start, in d7s_probe()
219 dev_set_drvdata(&op->dev, p); in d7s_probe()
228 of_iounmap(&op->resource[0], p->regs, sizeof(u8)); in d7s_probe()
234 struct d7s *p = dev_get_drvdata(&op->dev); in d7s_remove()
235 u8 regs = readb(p->regs); in d7s_remove()
237 /* Honor OBP d7s-flipped? unless operating in solaris-compat mode */ in d7s_remove()
239 if (p->flipped) in d7s_remove()
243 writeb(regs, p->regs); in d7s_remove()
247 of_iounmap(&op->resource[0], p->regs, sizeof(u8)); in d7s_remove()