xref: /openbmc/linux/drivers/input/misc/sparcspkr.c (revision dbce1a7d)
109c434b8SThomas Gleixner // SPDX-License-Identifier: GPL-2.0-only
21da177e4SLinus Torvalds /*
31da177e4SLinus Torvalds  *  Driver for PC-speaker like devices found on various Sparc systems.
41da177e4SLinus Torvalds  *
51da177e4SLinus Torvalds  *  Copyright (c) 2002 Vojtech Pavlik
69c1a5077SDavid S. Miller  *  Copyright (c) 2002, 2006, 2008 David S. Miller (davem@davemloft.net)
71da177e4SLinus Torvalds  */
81da177e4SLinus Torvalds #include <linux/kernel.h>
91da177e4SLinus Torvalds #include <linux/module.h>
101da177e4SLinus Torvalds #include <linux/init.h>
111da177e4SLinus Torvalds #include <linux/input.h>
12*dbce1a7dSRob Herring #include <linux/of.h>
13*dbce1a7dSRob Herring #include <linux/platform_device.h>
145a0e3ad6STejun Heo #include <linux/slab.h>
151da177e4SLinus Torvalds 
161da177e4SLinus Torvalds #include <asm/io.h>
171da177e4SLinus Torvalds 
18a2bd4fd1SDavid S. Miller MODULE_AUTHOR("David S. Miller <davem@davemloft.net>");
1976b7cddfSDmitry Torokhov MODULE_DESCRIPTION("Sparc Speaker beeper driver");
201da177e4SLinus Torvalds MODULE_LICENSE("GPL");
211da177e4SLinus Torvalds 
229c1a5077SDavid S. Miller struct grover_beep_info {
239c1a5077SDavid S. Miller 	void __iomem	*freq_regs;
249c1a5077SDavid S. Miller 	void __iomem	*enable_reg;
259c1a5077SDavid S. Miller };
269c1a5077SDavid S. Miller 
279c1a5077SDavid S. Miller struct bbc_beep_info {
289c1a5077SDavid S. Miller 	u32		clock_freq;
299c1a5077SDavid S. Miller 	void __iomem	*regs;
309c1a5077SDavid S. Miller };
319c1a5077SDavid S. Miller 
32a2bd4fd1SDavid S. Miller struct sparcspkr_state {
33a2bd4fd1SDavid S. Miller 	const char		*name;
34a2bd4fd1SDavid S. Miller 	int (*event)(struct input_dev *dev, unsigned int type, unsigned int code, int value);
35a2bd4fd1SDavid S. Miller 	spinlock_t		lock;
36a2bd4fd1SDavid S. Miller 	struct input_dev	*input_dev;
379c1a5077SDavid S. Miller 	union {
389c1a5077SDavid S. Miller 		struct grover_beep_info grover;
399c1a5077SDavid S. Miller 		struct bbc_beep_info bbc;
409c1a5077SDavid S. Miller 	} u;
41a2bd4fd1SDavid S. Miller };
421da177e4SLinus Torvalds 
bbc_count_to_reg(struct bbc_beep_info * info,unsigned int count)439c1a5077SDavid S. Miller static u32 bbc_count_to_reg(struct bbc_beep_info *info, unsigned int count)
449c1a5077SDavid S. Miller {
459c1a5077SDavid S. Miller 	u32 val, clock_freq = info->clock_freq;
469c1a5077SDavid S. Miller 	int i;
479c1a5077SDavid S. Miller 
489c1a5077SDavid S. Miller 	if (!count)
499c1a5077SDavid S. Miller 		return 0;
509c1a5077SDavid S. Miller 
519c1a5077SDavid S. Miller 	if (count <= clock_freq >> 20)
529c1a5077SDavid S. Miller 		return 1 << 18;
539c1a5077SDavid S. Miller 
549c1a5077SDavid S. Miller 	if (count >= clock_freq >> 12)
559c1a5077SDavid S. Miller 		return 1 << 10;
569c1a5077SDavid S. Miller 
579c1a5077SDavid S. Miller 	val = 1 << 18;
589c1a5077SDavid S. Miller 	for (i = 19; i >= 11; i--) {
599c1a5077SDavid S. Miller 		val >>= 1;
609c1a5077SDavid S. Miller 		if (count <= clock_freq >> i)
619c1a5077SDavid S. Miller 			break;
629c1a5077SDavid S. Miller 	}
639c1a5077SDavid S. Miller 
649c1a5077SDavid S. Miller 	return val;
659c1a5077SDavid S. Miller }
669c1a5077SDavid S. Miller 
bbc_spkr_event(struct input_dev * dev,unsigned int type,unsigned int code,int value)679c1a5077SDavid S. Miller static int bbc_spkr_event(struct input_dev *dev, unsigned int type, unsigned int code, int value)
681da177e4SLinus Torvalds {
69293e6392SDmitry Torokhov 	struct sparcspkr_state *state = dev_get_drvdata(dev->dev.parent);
709c1a5077SDavid S. Miller 	struct bbc_beep_info *info = &state->u.bbc;
711da177e4SLinus Torvalds 	unsigned int count = 0;
721da177e4SLinus Torvalds 	unsigned long flags;
731da177e4SLinus Torvalds 
741da177e4SLinus Torvalds 	if (type != EV_SND)
751da177e4SLinus Torvalds 		return -1;
761da177e4SLinus Torvalds 
771da177e4SLinus Torvalds 	switch (code) {
781da177e4SLinus Torvalds 		case SND_BELL: if (value) value = 1000;
791da177e4SLinus Torvalds 		case SND_TONE: break;
801da177e4SLinus Torvalds 		default: return -1;
811da177e4SLinus Torvalds 	}
821da177e4SLinus Torvalds 
831da177e4SLinus Torvalds 	if (value > 20 && value < 32767)
841da177e4SLinus Torvalds 		count = 1193182 / value;
851da177e4SLinus Torvalds 
869c1a5077SDavid S. Miller 	count = bbc_count_to_reg(info, count);
879c1a5077SDavid S. Miller 
88a2bd4fd1SDavid S. Miller 	spin_lock_irqsave(&state->lock, flags);
891da177e4SLinus Torvalds 
909c1a5077SDavid S. Miller 	if (count) {
91d650471aSSam Ravnborg 		sbus_writeb(0x01,                 info->regs + 0);
92d650471aSSam Ravnborg 		sbus_writeb(0x00,                 info->regs + 2);
93d650471aSSam Ravnborg 		sbus_writeb((count >> 16) & 0xff, info->regs + 3);
94d650471aSSam Ravnborg 		sbus_writeb((count >>  8) & 0xff, info->regs + 4);
95d650471aSSam Ravnborg 		sbus_writeb(0x00,                 info->regs + 5);
969c1a5077SDavid S. Miller 	} else {
97d650471aSSam Ravnborg 		sbus_writeb(0x00,                 info->regs + 0);
989c1a5077SDavid S. Miller 	}
991da177e4SLinus Torvalds 
100a2bd4fd1SDavid S. Miller 	spin_unlock_irqrestore(&state->lock, flags);
1011da177e4SLinus Torvalds 
1021da177e4SLinus Torvalds 	return 0;
1031da177e4SLinus Torvalds }
1041da177e4SLinus Torvalds 
grover_spkr_event(struct input_dev * dev,unsigned int type,unsigned int code,int value)1059c1a5077SDavid S. Miller static int grover_spkr_event(struct input_dev *dev, unsigned int type, unsigned int code, int value)
1061da177e4SLinus Torvalds {
107293e6392SDmitry Torokhov 	struct sparcspkr_state *state = dev_get_drvdata(dev->dev.parent);
1089c1a5077SDavid S. Miller 	struct grover_beep_info *info = &state->u.grover;
1091da177e4SLinus Torvalds 	unsigned int count = 0;
1101da177e4SLinus Torvalds 	unsigned long flags;
1111da177e4SLinus Torvalds 
1121da177e4SLinus Torvalds 	if (type != EV_SND)
1131da177e4SLinus Torvalds 		return -1;
1141da177e4SLinus Torvalds 
1151da177e4SLinus Torvalds 	switch (code) {
1161da177e4SLinus Torvalds 		case SND_BELL: if (value) value = 1000;
1171da177e4SLinus Torvalds 		case SND_TONE: break;
1181da177e4SLinus Torvalds 		default: return -1;
1191da177e4SLinus Torvalds 	}
1201da177e4SLinus Torvalds 
1211da177e4SLinus Torvalds 	if (value > 20 && value < 32767)
1221da177e4SLinus Torvalds 		count = 1193182 / value;
1231da177e4SLinus Torvalds 
124a2bd4fd1SDavid S. Miller 	spin_lock_irqsave(&state->lock, flags);
1251da177e4SLinus Torvalds 
1261da177e4SLinus Torvalds 	if (count) {
1271da177e4SLinus Torvalds 		/* enable counter 2 */
128d650471aSSam Ravnborg 		sbus_writeb(sbus_readb(info->enable_reg) | 3, info->enable_reg);
1291da177e4SLinus Torvalds 		/* set command for counter 2, 2 byte write */
130d650471aSSam Ravnborg 		sbus_writeb(0xB6, info->freq_regs + 1);
1311da177e4SLinus Torvalds 		/* select desired HZ */
132d650471aSSam Ravnborg 		sbus_writeb(count & 0xff, info->freq_regs + 0);
133d650471aSSam Ravnborg 		sbus_writeb((count >> 8) & 0xff, info->freq_regs + 0);
1341da177e4SLinus Torvalds 	} else {
1351da177e4SLinus Torvalds 		/* disable counter 2 */
136d650471aSSam Ravnborg 		sbus_writeb(sbus_readb(info->enable_reg) & 0xFC, info->enable_reg);
1371da177e4SLinus Torvalds 	}
1381da177e4SLinus Torvalds 
139a2bd4fd1SDavid S. Miller 	spin_unlock_irqrestore(&state->lock, flags);
1401da177e4SLinus Torvalds 
1411da177e4SLinus Torvalds 	return 0;
1421da177e4SLinus Torvalds }
1431da177e4SLinus Torvalds 
sparcspkr_probe(struct device * dev)1445298cc4cSBill Pemberton static int sparcspkr_probe(struct device *dev)
1451da177e4SLinus Torvalds {
146a2bd4fd1SDavid S. Miller 	struct sparcspkr_state *state = dev_get_drvdata(dev);
147f5b64078SDmitry Torokhov 	struct input_dev *input_dev;
148f5b64078SDmitry Torokhov 	int error;
1491da177e4SLinus Torvalds 
150f5b64078SDmitry Torokhov 	input_dev = input_allocate_device();
151f5b64078SDmitry Torokhov 	if (!input_dev)
15276b7cddfSDmitry Torokhov 		return -ENOMEM;
15376b7cddfSDmitry Torokhov 
154a2bd4fd1SDavid S. Miller 	input_dev->name = state->name;
155f5b64078SDmitry Torokhov 	input_dev->phys = "sparc/input0";
156f5b64078SDmitry Torokhov 	input_dev->id.bustype = BUS_ISA;
157f5b64078SDmitry Torokhov 	input_dev->id.vendor = 0x001f;
158f5b64078SDmitry Torokhov 	input_dev->id.product = 0x0001;
159f5b64078SDmitry Torokhov 	input_dev->id.version = 0x0100;
160293e6392SDmitry Torokhov 	input_dev->dev.parent = dev;
1611da177e4SLinus Torvalds 
1627b19ada2SJiri Slaby 	input_dev->evbit[0] = BIT_MASK(EV_SND);
1637b19ada2SJiri Slaby 	input_dev->sndbit[0] = BIT_MASK(SND_BELL) | BIT_MASK(SND_TONE);
1641da177e4SLinus Torvalds 
165a2bd4fd1SDavid S. Miller 	input_dev->event = state->event;
166f5b64078SDmitry Torokhov 
167f5b64078SDmitry Torokhov 	error = input_register_device(input_dev);
168f5b64078SDmitry Torokhov 	if (error) {
169f5b64078SDmitry Torokhov 		input_free_device(input_dev);
170f5b64078SDmitry Torokhov 		return error;
171f5b64078SDmitry Torokhov 	}
172f5b64078SDmitry Torokhov 
173a2bd4fd1SDavid S. Miller 	state->input_dev = input_dev;
1741da177e4SLinus Torvalds 
1751da177e4SLinus Torvalds 	return 0;
1761da177e4SLinus Torvalds }
177f5b64078SDmitry Torokhov 
sparcspkr_shutdown(struct platform_device * dev)1784ebb24f7SGrant Likely static void sparcspkr_shutdown(struct platform_device *dev)
179f5b64078SDmitry Torokhov {
18035c4b122SJingoo Han 	struct sparcspkr_state *state = platform_get_drvdata(dev);
181a2bd4fd1SDavid S. Miller 	struct input_dev *input_dev = state->input_dev;
182a2bd4fd1SDavid S. Miller 
183f5b64078SDmitry Torokhov 	/* turn off the speaker */
184a2bd4fd1SDavid S. Miller 	state->event(input_dev, EV_SND, SND_BELL, 0);
185f5b64078SDmitry Torokhov }
186f5b64078SDmitry Torokhov 
bbc_beep_probe(struct platform_device * op)1875298cc4cSBill Pemberton static int bbc_beep_probe(struct platform_device *op)
188a2bd4fd1SDavid S. Miller {
189a2bd4fd1SDavid S. Miller 	struct sparcspkr_state *state;
1909c1a5077SDavid S. Miller 	struct bbc_beep_info *info;
1919c1a5077SDavid S. Miller 	struct device_node *dp;
1929c1a5077SDavid S. Miller 	int err = -ENOMEM;
193a2bd4fd1SDavid S. Miller 
194a2bd4fd1SDavid S. Miller 	state = kzalloc(sizeof(*state), GFP_KERNEL);
195a2bd4fd1SDavid S. Miller 	if (!state)
1969c1a5077SDavid S. Miller 		goto out_err;
197a2bd4fd1SDavid S. Miller 
1989c1a5077SDavid S. Miller 	state->name = "Sparc BBC Speaker";
1999c1a5077SDavid S. Miller 	state->event = bbc_spkr_event;
200a2bd4fd1SDavid S. Miller 	spin_lock_init(&state->lock);
201a2bd4fd1SDavid S. Miller 
2029c1a5077SDavid S. Miller 	dp = of_find_node_by_path("/");
2039c1a5077SDavid S. Miller 	err = -ENODEV;
2049c1a5077SDavid S. Miller 	if (!dp)
2059c1a5077SDavid S. Miller 		goto out_free;
206a2bd4fd1SDavid S. Miller 
2079c1a5077SDavid S. Miller 	info = &state->u.bbc;
2089c1a5077SDavid S. Miller 	info->clock_freq = of_getintprop_default(dp, "clock-frequency", 0);
209c8994b30SMiaoqian Lin 	of_node_put(dp);
2109c1a5077SDavid S. Miller 	if (!info->clock_freq)
2119c1a5077SDavid S. Miller 		goto out_free;
2129c1a5077SDavid S. Miller 
2139c1a5077SDavid S. Miller 	info->regs = of_ioremap(&op->resource[0], 0, 6, "bbc beep");
2149c1a5077SDavid S. Miller 	if (!info->regs)
2159c1a5077SDavid S. Miller 		goto out_free;
2169c1a5077SDavid S. Miller 
21735c4b122SJingoo Han 	platform_set_drvdata(op, state);
2189c1a5077SDavid S. Miller 
2199c1a5077SDavid S. Miller 	err = sparcspkr_probe(&op->dev);
2209c1a5077SDavid S. Miller 	if (err)
2219c1a5077SDavid S. Miller 		goto out_clear_drvdata;
2229c1a5077SDavid S. Miller 
2239c1a5077SDavid S. Miller 	return 0;
2249c1a5077SDavid S. Miller 
2259c1a5077SDavid S. Miller out_clear_drvdata:
2269c1a5077SDavid S. Miller 	of_iounmap(&op->resource[0], info->regs, 6);
2279c1a5077SDavid S. Miller 
2289c1a5077SDavid S. Miller out_free:
229a2bd4fd1SDavid S. Miller 	kfree(state);
2309c1a5077SDavid S. Miller out_err:
2319c1a5077SDavid S. Miller 	return err;
232a2bd4fd1SDavid S. Miller }
233a2bd4fd1SDavid S. Miller 
bbc_remove(struct platform_device * op)234e2619cf7SBill Pemberton static int bbc_remove(struct platform_device *op)
2359c1a5077SDavid S. Miller {
23635c4b122SJingoo Han 	struct sparcspkr_state *state = platform_get_drvdata(op);
2379c1a5077SDavid S. Miller 	struct input_dev *input_dev = state->input_dev;
2389c1a5077SDavid S. Miller 	struct bbc_beep_info *info = &state->u.bbc;
2399c1a5077SDavid S. Miller 
2409c1a5077SDavid S. Miller 	/* turn off the speaker */
2419c1a5077SDavid S. Miller 	state->event(input_dev, EV_SND, SND_BELL, 0);
2429c1a5077SDavid S. Miller 
2439c1a5077SDavid S. Miller 	input_unregister_device(input_dev);
2449c1a5077SDavid S. Miller 
2459c1a5077SDavid S. Miller 	of_iounmap(&op->resource[0], info->regs, 6);
2469c1a5077SDavid S. Miller 
2479c1a5077SDavid S. Miller 	kfree(state);
2489c1a5077SDavid S. Miller 
249a2bd4fd1SDavid S. Miller 	return 0;
250a2bd4fd1SDavid S. Miller }
251a2bd4fd1SDavid S. Miller 
252fd098316SDavid S. Miller static const struct of_device_id bbc_beep_match[] = {
253a2bd4fd1SDavid S. Miller 	{
254a2bd4fd1SDavid S. Miller 		.name = "beep",
2559c1a5077SDavid S. Miller 		.compatible = "SUNW,bbc-beep",
256f5b64078SDmitry Torokhov 	},
257a2bd4fd1SDavid S. Miller 	{},
258a2bd4fd1SDavid S. Miller };
25926492f19SLuis de Bethencourt MODULE_DEVICE_TABLE(of, bbc_beep_match);
260a2bd4fd1SDavid S. Miller 
2614ebb24f7SGrant Likely static struct platform_driver bbc_beep_driver = {
2624018294bSGrant Likely 	.driver = {
2639c1a5077SDavid S. Miller 		.name = "bbcbeep",
2644018294bSGrant Likely 		.of_match_table = bbc_beep_match,
2654018294bSGrant Likely 	},
2669c1a5077SDavid S. Miller 	.probe		= bbc_beep_probe,
2671cb0aa88SBill Pemberton 	.remove		= bbc_remove,
268f5b64078SDmitry Torokhov 	.shutdown	= sparcspkr_shutdown,
269f5b64078SDmitry Torokhov };
270f5b64078SDmitry Torokhov 
grover_beep_probe(struct platform_device * op)2715298cc4cSBill Pemberton static int grover_beep_probe(struct platform_device *op)
272f5b64078SDmitry Torokhov {
273a2bd4fd1SDavid S. Miller 	struct sparcspkr_state *state;
2749c1a5077SDavid S. Miller 	struct grover_beep_info *info;
2759c1a5077SDavid S. Miller 	int err = -ENOMEM;
276f5b64078SDmitry Torokhov 
277a2bd4fd1SDavid S. Miller 	state = kzalloc(sizeof(*state), GFP_KERNEL);
278a2bd4fd1SDavid S. Miller 	if (!state)
2799c1a5077SDavid S. Miller 		goto out_err;
280f5b64078SDmitry Torokhov 
2819c1a5077SDavid S. Miller 	state->name = "Sparc Grover Speaker";
2829c1a5077SDavid S. Miller 	state->event = grover_spkr_event;
283a2bd4fd1SDavid S. Miller 	spin_lock_init(&state->lock);
284a2bd4fd1SDavid S. Miller 
2859c1a5077SDavid S. Miller 	info = &state->u.grover;
2869c1a5077SDavid S. Miller 	info->freq_regs = of_ioremap(&op->resource[2], 0, 2, "grover beep freq");
2879c1a5077SDavid S. Miller 	if (!info->freq_regs)
2889c1a5077SDavid S. Miller 		goto out_free;
289a2bd4fd1SDavid S. Miller 
2909c1a5077SDavid S. Miller 	info->enable_reg = of_ioremap(&op->resource[3], 0, 1, "grover beep enable");
2919c1a5077SDavid S. Miller 	if (!info->enable_reg)
2929c1a5077SDavid S. Miller 		goto out_unmap_freq_regs;
2939c1a5077SDavid S. Miller 
29435c4b122SJingoo Han 	platform_set_drvdata(op, state);
2959c1a5077SDavid S. Miller 
2969c1a5077SDavid S. Miller 	err = sparcspkr_probe(&op->dev);
2979c1a5077SDavid S. Miller 	if (err)
2989c1a5077SDavid S. Miller 		goto out_clear_drvdata;
2999c1a5077SDavid S. Miller 
3009c1a5077SDavid S. Miller 	return 0;
3019c1a5077SDavid S. Miller 
3029c1a5077SDavid S. Miller out_clear_drvdata:
3039c1a5077SDavid S. Miller 	of_iounmap(&op->resource[3], info->enable_reg, 1);
3049c1a5077SDavid S. Miller 
3059c1a5077SDavid S. Miller out_unmap_freq_regs:
3069c1a5077SDavid S. Miller 	of_iounmap(&op->resource[2], info->freq_regs, 2);
3079c1a5077SDavid S. Miller out_free:
308a2bd4fd1SDavid S. Miller 	kfree(state);
3099c1a5077SDavid S. Miller out_err:
3109c1a5077SDavid S. Miller 	return err;
311f5b64078SDmitry Torokhov }
312f5b64078SDmitry Torokhov 
grover_remove(struct platform_device * op)313e2619cf7SBill Pemberton static int grover_remove(struct platform_device *op)
3149c1a5077SDavid S. Miller {
31535c4b122SJingoo Han 	struct sparcspkr_state *state = platform_get_drvdata(op);
3169c1a5077SDavid S. Miller 	struct grover_beep_info *info = &state->u.grover;
3179c1a5077SDavid S. Miller 	struct input_dev *input_dev = state->input_dev;
3189c1a5077SDavid S. Miller 
3199c1a5077SDavid S. Miller 	/* turn off the speaker */
3209c1a5077SDavid S. Miller 	state->event(input_dev, EV_SND, SND_BELL, 0);
3219c1a5077SDavid S. Miller 
3229c1a5077SDavid S. Miller 	input_unregister_device(input_dev);
3239c1a5077SDavid S. Miller 
3249c1a5077SDavid S. Miller 	of_iounmap(&op->resource[3], info->enable_reg, 1);
3259c1a5077SDavid S. Miller 	of_iounmap(&op->resource[2], info->freq_regs, 2);
3269c1a5077SDavid S. Miller 
3279c1a5077SDavid S. Miller 	kfree(state);
3289c1a5077SDavid S. Miller 
329f5b64078SDmitry Torokhov 	return 0;
330f5b64078SDmitry Torokhov }
3311da177e4SLinus Torvalds 
332fd098316SDavid S. Miller static const struct of_device_id grover_beep_match[] = {
333a2bd4fd1SDavid S. Miller 	{
3349c1a5077SDavid S. Miller 		.name = "beep",
3359c1a5077SDavid S. Miller 		.compatible = "SUNW,smbus-beep",
336a2bd4fd1SDavid S. Miller 	},
337a2bd4fd1SDavid S. Miller 	{},
338a2bd4fd1SDavid S. Miller };
33926492f19SLuis de Bethencourt MODULE_DEVICE_TABLE(of, grover_beep_match);
340a2bd4fd1SDavid S. Miller 
3414ebb24f7SGrant Likely static struct platform_driver grover_beep_driver = {
3424018294bSGrant Likely 	.driver = {
3439c1a5077SDavid S. Miller 		.name = "groverbeep",
3444018294bSGrant Likely 		.of_match_table = grover_beep_match,
3454018294bSGrant Likely 	},
3469c1a5077SDavid S. Miller 	.probe		= grover_beep_probe,
3471cb0aa88SBill Pemberton 	.remove		= grover_remove,
348a2bd4fd1SDavid S. Miller 	.shutdown	= sparcspkr_shutdown,
349a2bd4fd1SDavid S. Miller };
350a2bd4fd1SDavid S. Miller 
351d352c0e1SThierry Reding static struct platform_driver * const drivers[] = {
352d352c0e1SThierry Reding 	&bbc_beep_driver,
353d352c0e1SThierry Reding 	&grover_beep_driver,
354d352c0e1SThierry Reding };
355d352c0e1SThierry Reding 
sparcspkr_init(void)3561da177e4SLinus Torvalds static int __init sparcspkr_init(void)
3571da177e4SLinus Torvalds {
358d352c0e1SThierry Reding 	return platform_register_drivers(drivers, ARRAY_SIZE(drivers));
3591da177e4SLinus Torvalds }
3601da177e4SLinus Torvalds 
sparcspkr_exit(void)3611da177e4SLinus Torvalds static void __exit sparcspkr_exit(void)
3621da177e4SLinus Torvalds {
363d352c0e1SThierry Reding 	platform_unregister_drivers(drivers, ARRAY_SIZE(drivers));
3641da177e4SLinus Torvalds }
3651da177e4SLinus Torvalds 
3661da177e4SLinus Torvalds module_init(sparcspkr_init);
3671da177e4SLinus Torvalds module_exit(sparcspkr_exit);
368