Lines Matching +full:op +full:- +full:mode
1 // SPDX-License-Identifier: GPL-2.0-only
2 /* display7seg.c - Driver implementation for the 7-segment display
30 static int sol_compat = 0; /* Solaris compatibility mode */
32 /* Solaris compatibility flag -
34 * documented driver features (ref Sun doc 806-0180-03).
38 * 1) Device ALWAYS reverts to OBP-specified FLIPPED mode
44 * omitting above features, set this parameter to non-zero.
51 MODULE_DESCRIPTION("7-Segment Display driver for Sun Microsystems CP1400/1500");
62 * Register block address- see header for details
63 * -----------------------------------------
65 * -----------------------------------------
67 * DP - Toggles decimal point on/off
68 * ALARM - Toggles "Alarm" LED green/red
69 * FLIP - Inverts display for upside-down mounted board
70 * bits 0-4 - 7-segment display contents
77 return -ENODEV; in d7s_open()
86 * are not operating in solaris-compat mode in d7s_release()
92 regval = readb(p->regs); in d7s_release()
93 if (p->flipped) in d7s_release()
97 writeb(regval, p->regs); in d7s_release()
106 u8 regs = readb(p->regs); in d7s_ioctl()
111 return -ENODEV; in d7s_ioctl()
116 /* assign device register values we mask-out D7S_FLIP in d7s_ioctl()
117 * if in sol_compat mode in d7s_ioctl()
120 error = -EFAULT; in d7s_ioctl()
129 writeb(ireg, p->regs); in d7s_ioctl()
137 * of your hardware while in sol_compat mode in d7s_ioctl()
140 error = -EFAULT; in d7s_ioctl()
146 /* toggle device mode-- flip display orientation */ in d7s_ioctl()
148 writeb(regs, p->regs); in d7s_ioctl()
171 static int d7s_probe(struct platform_device *op) in d7s_probe() argument
174 int err = -EINVAL; in d7s_probe()
181 p = devm_kzalloc(&op->dev, sizeof(*p), GFP_KERNEL); in d7s_probe()
182 err = -ENOMEM; in d7s_probe()
186 p->regs = of_ioremap(&op->resource[0], 0, sizeof(u8), "d7s"); in d7s_probe()
187 if (!p->regs) { in d7s_probe()
199 /* OBP option "d7s-flipped?" is honored as default for the in d7s_probe()
202 regs = readb(p->regs); in d7s_probe()
205 of_get_property(opts, "d7s-flipped?", NULL)) in d7s_probe()
206 p->flipped = true; in d7s_probe()
208 if (p->flipped) in d7s_probe()
213 writeb(regs, p->regs); in d7s_probe()
215 printk(KERN_INFO PFX "7-Segment Display%pOF at [%s:0x%llx] %s\n", in d7s_probe()
216 op->dev.of_node, in d7s_probe()
218 op->resource[0].start, in d7s_probe()
219 sol_compat ? "in sol_compat mode" : ""); in d7s_probe()
221 dev_set_drvdata(&op->dev, p); in d7s_probe()
230 of_iounmap(&op->resource[0], p->regs, sizeof(u8)); in d7s_probe()
236 static int d7s_remove(struct platform_device *op) in d7s_remove() argument
238 struct d7s *p = dev_get_drvdata(&op->dev); in d7s_remove()
239 u8 regs = readb(p->regs); in d7s_remove()
241 /* Honor OBP d7s-flipped? unless operating in solaris-compat mode */ in d7s_remove()
243 if (p->flipped) in d7s_remove()
247 writeb(regs, p->regs); in d7s_remove()
251 of_iounmap(&op->resource[0], p->regs, sizeof(u8)); in d7s_remove()