1 /* linux/drivers/i2c/busses/i2c-s3c2410.c
3 * Copyright (C) 2004,2005 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
6 * S3C2410 I2C Controller
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #include <linux/kernel.h>
24 #include <linux/module.h>
26 #include <linux/i2c.h>
27 #include <linux/i2c-id.h>
28 #include <linux/init.h>
29 #include <linux/time.h>
30 #include <linux/interrupt.h>
31 #include <linux/delay.h>
32 #include <linux/errno.h>
33 #include <linux/err.h>
34 #include <linux/platform_device.h>
35 #include <linux/clk.h>
36 #include <linux/cpufreq.h>
41 #include <plat/regs-iic.h>
44 /* i2c controller state */
46 enum s3c24xx_i2c_state {
56 wait_queue_head_t wait;
57 unsigned int suspended:1;
64 unsigned int tx_setup;
67 enum s3c24xx_i2c_state state;
68 unsigned long clkrate;
73 struct resource *ioarea;
74 struct i2c_adapter adap;
76 #ifdef CONFIG_CPU_FREQ
77 struct notifier_block freq_transition;
81 /* default platform data removed, dev should always carry data. */
83 /* s3c24xx_i2c_is2440()
85 * return true is this is an s3c2440
88 static inline int s3c24xx_i2c_is2440(struct s3c24xx_i2c *i2c)
90 struct platform_device *pdev = to_platform_device(i2c->dev);
92 return !strcmp(pdev->name, "s3c2440-i2c");
95 /* s3c24xx_i2c_master_complete
97 * complete the message and wake up the caller, using the given return code,
101 static inline void s3c24xx_i2c_master_complete(struct s3c24xx_i2c *i2c, int ret)
103 dev_dbg(i2c->dev, "master_complete %d\n", ret);
115 static inline void s3c24xx_i2c_disable_ack(struct s3c24xx_i2c *i2c)
119 tmp = readl(i2c->regs + S3C2410_IICCON);
120 writel(tmp & ~S3C2410_IICCON_ACKEN, i2c->regs + S3C2410_IICCON);
123 static inline void s3c24xx_i2c_enable_ack(struct s3c24xx_i2c *i2c)
127 tmp = readl(i2c->regs + S3C2410_IICCON);
128 writel(tmp | S3C2410_IICCON_ACKEN, i2c->regs + S3C2410_IICCON);
131 /* irq enable/disable functions */
133 static inline void s3c24xx_i2c_disable_irq(struct s3c24xx_i2c *i2c)
137 tmp = readl(i2c->regs + S3C2410_IICCON);
138 writel(tmp & ~S3C2410_IICCON_IRQEN, i2c->regs + S3C2410_IICCON);
141 static inline void s3c24xx_i2c_enable_irq(struct s3c24xx_i2c *i2c)
145 tmp = readl(i2c->regs + S3C2410_IICCON);
146 writel(tmp | S3C2410_IICCON_IRQEN, i2c->regs + S3C2410_IICCON);
150 /* s3c24xx_i2c_message_start
152 * put the start of a message onto the bus
155 static void s3c24xx_i2c_message_start(struct s3c24xx_i2c *i2c,
158 unsigned int addr = (msg->addr & 0x7f) << 1;
160 unsigned long iiccon;
163 stat |= S3C2410_IICSTAT_TXRXEN;
165 if (msg->flags & I2C_M_RD) {
166 stat |= S3C2410_IICSTAT_MASTER_RX;
169 stat |= S3C2410_IICSTAT_MASTER_TX;
171 if (msg->flags & I2C_M_REV_DIR_ADDR)
174 /* todo - check for wether ack wanted or not */
175 s3c24xx_i2c_enable_ack(i2c);
177 iiccon = readl(i2c->regs + S3C2410_IICCON);
178 writel(stat, i2c->regs + S3C2410_IICSTAT);
180 dev_dbg(i2c->dev, "START: %08lx to IICSTAT, %02x to DS\n", stat, addr);
181 writeb(addr, i2c->regs + S3C2410_IICDS);
183 /* delay here to ensure the data byte has gotten onto the bus
184 * before the transaction is started */
186 ndelay(i2c->tx_setup);
188 dev_dbg(i2c->dev, "iiccon, %08lx\n", iiccon);
189 writel(iiccon, i2c->regs + S3C2410_IICCON);
191 stat |= S3C2410_IICSTAT_START;
192 writel(stat, i2c->regs + S3C2410_IICSTAT);
195 static inline void s3c24xx_i2c_stop(struct s3c24xx_i2c *i2c, int ret)
197 unsigned long iicstat = readl(i2c->regs + S3C2410_IICSTAT);
199 dev_dbg(i2c->dev, "STOP\n");
201 /* stop the transfer */
202 iicstat &= ~S3C2410_IICSTAT_START;
203 writel(iicstat, i2c->regs + S3C2410_IICSTAT);
205 i2c->state = STATE_STOP;
207 s3c24xx_i2c_master_complete(i2c, ret);
208 s3c24xx_i2c_disable_irq(i2c);
211 /* helper functions to determine the current state in the set of
212 * messages we are sending */
216 * returns TRUE if the current message is the last in the set
219 static inline int is_lastmsg(struct s3c24xx_i2c *i2c)
221 return i2c->msg_idx >= (i2c->msg_num - 1);
226 * returns TRUE if we this is the last byte in the current message
229 static inline int is_msglast(struct s3c24xx_i2c *i2c)
231 return i2c->msg_ptr == i2c->msg->len-1;
236 * returns TRUE if we reached the end of the current message
239 static inline int is_msgend(struct s3c24xx_i2c *i2c)
241 return i2c->msg_ptr >= i2c->msg->len;
244 /* i2s_s3c_irq_nextbyte
246 * process an interrupt and work out what to do
249 static int i2s_s3c_irq_nextbyte(struct s3c24xx_i2c *i2c, unsigned long iicstat)
255 switch (i2c->state) {
258 dev_err(i2c->dev, "%s: called in STATE_IDLE\n", __func__);
263 dev_err(i2c->dev, "%s: called in STATE_STOP\n", __func__);
264 s3c24xx_i2c_disable_irq(i2c);
268 /* last thing we did was send a start condition on the
269 * bus, or started a new i2c message
272 if (iicstat & S3C2410_IICSTAT_LASTBIT &&
273 !(i2c->msg->flags & I2C_M_IGNORE_NAK)) {
274 /* ack was not received... */
276 dev_dbg(i2c->dev, "ack was not received\n");
277 s3c24xx_i2c_stop(i2c, -ENXIO);
281 if (i2c->msg->flags & I2C_M_RD)
282 i2c->state = STATE_READ;
284 i2c->state = STATE_WRITE;
286 /* terminate the transfer if there is nothing to do
287 * as this is used by the i2c probe to find devices. */
289 if (is_lastmsg(i2c) && i2c->msg->len == 0) {
290 s3c24xx_i2c_stop(i2c, 0);
294 if (i2c->state == STATE_READ)
297 /* fall through to the write state, as we will need to
298 * send a byte as well */
301 /* we are writing data to the device... check for the
302 * end of the message, and if so, work out what to do
305 if (!(i2c->msg->flags & I2C_M_IGNORE_NAK)) {
306 if (iicstat & S3C2410_IICSTAT_LASTBIT) {
307 dev_dbg(i2c->dev, "WRITE: No Ack\n");
309 s3c24xx_i2c_stop(i2c, -ECONNREFUSED);
316 if (!is_msgend(i2c)) {
317 byte = i2c->msg->buf[i2c->msg_ptr++];
318 writeb(byte, i2c->regs + S3C2410_IICDS);
320 /* delay after writing the byte to allow the
321 * data setup time on the bus, as writing the
322 * data to the register causes the first bit
323 * to appear on SDA, and SCL will change as
324 * soon as the interrupt is acknowledged */
326 ndelay(i2c->tx_setup);
328 } else if (!is_lastmsg(i2c)) {
329 /* we need to go to the next i2c message */
331 dev_dbg(i2c->dev, "WRITE: Next Message\n");
337 /* check to see if we need to do another message */
338 if (i2c->msg->flags & I2C_M_NOSTART) {
340 if (i2c->msg->flags & I2C_M_RD) {
341 /* cannot do this, the controller
342 * forces us to send a new START
343 * when we change direction */
345 s3c24xx_i2c_stop(i2c, -EINVAL);
350 /* send the new start */
351 s3c24xx_i2c_message_start(i2c, i2c->msg);
352 i2c->state = STATE_START;
358 s3c24xx_i2c_stop(i2c, 0);
363 /* we have a byte of data in the data register, do
364 * something with it, and then work out wether we are
365 * going to do any more read/write
368 byte = readb(i2c->regs + S3C2410_IICDS);
369 i2c->msg->buf[i2c->msg_ptr++] = byte;
372 if (is_msglast(i2c)) {
373 /* last byte of buffer */
376 s3c24xx_i2c_disable_ack(i2c);
378 } else if (is_msgend(i2c)) {
379 /* ok, we've read the entire buffer, see if there
380 * is anything else we need to do */
382 if (is_lastmsg(i2c)) {
383 /* last message, send stop and complete */
384 dev_dbg(i2c->dev, "READ: Send Stop\n");
386 s3c24xx_i2c_stop(i2c, 0);
388 /* go to the next transfer */
389 dev_dbg(i2c->dev, "READ: Next Transfer\n");
400 /* acknowlegde the IRQ and get back on with the work */
403 tmp = readl(i2c->regs + S3C2410_IICCON);
404 tmp &= ~S3C2410_IICCON_IRQPEND;
405 writel(tmp, i2c->regs + S3C2410_IICCON);
412 * top level IRQ servicing routine
415 static irqreturn_t s3c24xx_i2c_irq(int irqno, void *dev_id)
417 struct s3c24xx_i2c *i2c = dev_id;
418 unsigned long status;
421 status = readl(i2c->regs + S3C2410_IICSTAT);
423 if (status & S3C2410_IICSTAT_ARBITR) {
424 /* deal with arbitration loss */
425 dev_err(i2c->dev, "deal with arbitration loss\n");
428 if (i2c->state == STATE_IDLE) {
429 dev_dbg(i2c->dev, "IRQ: error i2c->state == IDLE\n");
431 tmp = readl(i2c->regs + S3C2410_IICCON);
432 tmp &= ~S3C2410_IICCON_IRQPEND;
433 writel(tmp, i2c->regs + S3C2410_IICCON);
437 /* pretty much this leaves us with the fact that we've
438 * transmitted or received whatever byte we last sent */
440 i2s_s3c_irq_nextbyte(i2c, status);
447 /* s3c24xx_i2c_set_master
449 * get the i2c bus for a master transaction
452 static int s3c24xx_i2c_set_master(struct s3c24xx_i2c *i2c)
454 unsigned long iicstat;
457 while (timeout-- > 0) {
458 iicstat = readl(i2c->regs + S3C2410_IICSTAT);
460 if (!(iicstat & S3C2410_IICSTAT_BUSBUSY))
469 /* s3c24xx_i2c_doxfer
471 * this starts an i2c transfer
474 static int s3c24xx_i2c_doxfer(struct s3c24xx_i2c *i2c,
475 struct i2c_msg *msgs, int num)
477 unsigned long timeout;
483 ret = s3c24xx_i2c_set_master(i2c);
485 dev_err(i2c->dev, "cannot get bus (error %d)\n", ret);
490 spin_lock_irq(&i2c->lock);
496 i2c->state = STATE_START;
498 s3c24xx_i2c_enable_irq(i2c);
499 s3c24xx_i2c_message_start(i2c, msgs);
500 spin_unlock_irq(&i2c->lock);
502 timeout = wait_event_timeout(i2c->wait, i2c->msg_num == 0, HZ * 5);
506 /* having these next two as dev_err() makes life very
507 * noisy when doing an i2cdetect */
510 dev_dbg(i2c->dev, "timeout\n");
512 dev_dbg(i2c->dev, "incomplete xfer (%d)\n", ret);
514 /* ensure the stop has been through the bus */
524 * first port of call from the i2c bus code when an message needs
525 * transferring across the i2c bus.
528 static int s3c24xx_i2c_xfer(struct i2c_adapter *adap,
529 struct i2c_msg *msgs, int num)
531 struct s3c24xx_i2c *i2c = (struct s3c24xx_i2c *)adap->algo_data;
535 for (retry = 0; retry < adap->retries; retry++) {
537 ret = s3c24xx_i2c_doxfer(i2c, msgs, num);
542 dev_dbg(i2c->dev, "Retrying transmission (%d)\n", retry);
550 /* declare our i2c functionality */
551 static u32 s3c24xx_i2c_func(struct i2c_adapter *adap)
553 return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL | I2C_FUNC_PROTOCOL_MANGLING;
556 /* i2c bus registration info */
558 static const struct i2c_algorithm s3c24xx_i2c_algorithm = {
559 .master_xfer = s3c24xx_i2c_xfer,
560 .functionality = s3c24xx_i2c_func,
563 /* s3c24xx_i2c_calcdivisor
565 * return the divisor settings for a given frequency
568 static int s3c24xx_i2c_calcdivisor(unsigned long clkin, unsigned int wanted,
569 unsigned int *div1, unsigned int *divs)
571 unsigned int calc_divs = clkin / wanted;
572 unsigned int calc_div1;
574 if (calc_divs > (16*16))
579 calc_divs += calc_div1-1;
580 calc_divs /= calc_div1;
590 return clkin / (calc_divs * calc_div1);
595 * test wether a frequency is within the acceptable range of error
598 static inline int freq_acceptable(unsigned int freq, unsigned int wanted)
600 int diff = freq - wanted;
602 return diff >= -2 && diff <= 2;
605 /* s3c24xx_i2c_clockrate
607 * work out a divisor for the user requested frequency setting,
608 * either by the requested frequency, or scanning the acceptable
609 * range of frequencies until something is found
612 static int s3c24xx_i2c_clockrate(struct s3c24xx_i2c *i2c, unsigned int *got)
614 struct s3c2410_platform_i2c *pdata = i2c->dev->platform_data;
615 unsigned long clkin = clk_get_rate(i2c->clk);
616 unsigned int divs, div1;
621 i2c->clkrate = clkin;
622 clkin /= 1000; /* clkin now in KHz */
624 dev_dbg(i2c->dev, "pdata %p, freq %lu %lu..%lu\n",
625 pdata, pdata->bus_freq, pdata->min_freq, pdata->max_freq);
627 if (pdata->bus_freq != 0) {
628 freq = s3c24xx_i2c_calcdivisor(clkin, pdata->bus_freq/1000,
630 if (freq_acceptable(freq, pdata->bus_freq/1000))
634 /* ok, we may have to search for something suitable... */
636 start = (pdata->max_freq == 0) ? pdata->bus_freq : pdata->max_freq;
637 end = pdata->min_freq;
644 for (; start > end; start--) {
645 freq = s3c24xx_i2c_calcdivisor(clkin, start, &div1, &divs);
646 if (freq_acceptable(freq, start))
650 /* cannot find frequency spec */
657 iiccon = readl(i2c->regs + S3C2410_IICCON);
658 iiccon &= ~(S3C2410_IICCON_SCALEMASK | S3C2410_IICCON_TXDIV_512);
662 iiccon |= S3C2410_IICCON_TXDIV_512;
664 writel(iiccon, i2c->regs + S3C2410_IICCON);
669 #ifdef CONFIG_CPU_FREQ
671 #define freq_to_i2c(_n) container_of(_n, struct s3c24xx_i2c, freq_transition)
673 static int s3c24xx_i2c_cpufreq_transition(struct notifier_block *nb,
674 unsigned long val, void *data)
676 struct s3c24xx_i2c *i2c = freq_to_i2c(nb);
682 delta_f = clk_get_rate(i2c->clk) - i2c->clkrate;
684 /* if we're post-change and the input clock has slowed down
685 * or at pre-change and the clock is about to speed up, then
686 * adjust our clock rate. <0 is slow, >0 speedup.
689 if ((val == CPUFREQ_POSTCHANGE && delta_f < 0) ||
690 (val == CPUFREQ_PRECHANGE && delta_f > 0)) {
691 spin_lock_irqsave(&i2c->lock, flags);
692 ret = s3c24xx_i2c_clockrate(i2c, &got);
693 spin_unlock_irqrestore(&i2c->lock, flags);
696 dev_err(i2c->dev, "cannot find frequency\n");
698 dev_info(i2c->dev, "setting freq %d\n", got);
704 static inline int s3c24xx_i2c_register_cpufreq(struct s3c24xx_i2c *i2c)
706 i2c->freq_transition.notifier_call = s3c24xx_i2c_cpufreq_transition;
708 return cpufreq_register_notifier(&i2c->freq_transition,
709 CPUFREQ_TRANSITION_NOTIFIER);
712 static inline void s3c24xx_i2c_deregister_cpufreq(struct s3c24xx_i2c *i2c)
714 cpufreq_unregister_notifier(&i2c->freq_transition,
715 CPUFREQ_TRANSITION_NOTIFIER);
719 static inline int s3c24xx_i2c_register_cpufreq(struct s3c24xx_i2c *i2c)
724 static inline void s3c24xx_i2c_deregister_cpufreq(struct s3c24xx_i2c *i2c)
731 * initialise the controller, set the IO lines and frequency
734 static int s3c24xx_i2c_init(struct s3c24xx_i2c *i2c)
736 unsigned long iicon = S3C2410_IICCON_IRQEN | S3C2410_IICCON_ACKEN;
737 struct s3c2410_platform_i2c *pdata;
740 /* get the plafrom data */
742 pdata = i2c->dev->platform_data;
744 /* inititalise the gpio */
747 pdata->cfg_gpio(to_platform_device(i2c->dev));
749 /* write slave address */
751 writeb(pdata->slave_addr, i2c->regs + S3C2410_IICADD);
753 dev_info(i2c->dev, "slave address 0x%02x\n", pdata->slave_addr);
755 writel(iicon, i2c->regs + S3C2410_IICCON);
757 /* we need to work out the divisors for the clock... */
759 if (s3c24xx_i2c_clockrate(i2c, &freq) != 0) {
760 writel(0, i2c->regs + S3C2410_IICCON);
761 dev_err(i2c->dev, "cannot meet bus frequency required\n");
765 /* todo - check that the i2c lines aren't being dragged anywhere */
767 dev_info(i2c->dev, "bus frequency set to %d KHz\n", freq);
768 dev_dbg(i2c->dev, "S3C2410_IICCON=0x%02lx\n", iicon);
770 /* check for s3c2440 i2c controller */
772 if (s3c24xx_i2c_is2440(i2c)) {
773 dev_dbg(i2c->dev, "S3C2440_IICLC=%08x\n", pdata->sda_delay);
775 writel(pdata->sda_delay, i2c->regs + S3C2440_IICLC);
783 * called by the bus driver when a suitable device is found
786 static int s3c24xx_i2c_probe(struct platform_device *pdev)
788 struct s3c24xx_i2c *i2c;
789 struct s3c2410_platform_i2c *pdata;
790 struct resource *res;
793 pdata = pdev->dev.platform_data;
795 dev_err(&pdev->dev, "no platform data\n");
799 i2c = kzalloc(sizeof(struct s3c24xx_i2c), GFP_KERNEL);
801 dev_err(&pdev->dev, "no memory for state\n");
805 strlcpy(i2c->adap.name, "s3c2410-i2c", sizeof(i2c->adap.name));
806 i2c->adap.owner = THIS_MODULE;
807 i2c->adap.algo = &s3c24xx_i2c_algorithm;
808 i2c->adap.retries = 2;
809 i2c->adap.class = I2C_CLASS_HWMON | I2C_CLASS_SPD;
812 spin_lock_init(&i2c->lock);
813 init_waitqueue_head(&i2c->wait);
815 /* find the clock and enable it */
817 i2c->dev = &pdev->dev;
818 i2c->clk = clk_get(&pdev->dev, "i2c");
819 if (IS_ERR(i2c->clk)) {
820 dev_err(&pdev->dev, "cannot get clock\n");
825 dev_dbg(&pdev->dev, "clock source %p\n", i2c->clk);
827 clk_enable(i2c->clk);
829 /* map the registers */
831 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
833 dev_err(&pdev->dev, "cannot find IO resource\n");
838 i2c->ioarea = request_mem_region(res->start, (res->end-res->start)+1,
841 if (i2c->ioarea == NULL) {
842 dev_err(&pdev->dev, "cannot request IO\n");
847 i2c->regs = ioremap(res->start, (res->end-res->start)+1);
849 if (i2c->regs == NULL) {
850 dev_err(&pdev->dev, "cannot map IO\n");
855 dev_dbg(&pdev->dev, "registers %p (%p, %p)\n",
856 i2c->regs, i2c->ioarea, res);
858 /* setup info block for the i2c core */
860 i2c->adap.algo_data = i2c;
861 i2c->adap.dev.parent = &pdev->dev;
863 /* initialise the i2c controller */
865 ret = s3c24xx_i2c_init(i2c);
869 /* find the IRQ for this unit (note, this relies on the init call to
870 * ensure no current IRQs pending
873 i2c->irq = ret = platform_get_irq(pdev, 0);
875 dev_err(&pdev->dev, "cannot find IRQ\n");
879 ret = request_irq(i2c->irq, s3c24xx_i2c_irq, IRQF_DISABLED,
880 dev_name(&pdev->dev), i2c);
883 dev_err(&pdev->dev, "cannot claim IRQ %d\n", i2c->irq);
887 ret = s3c24xx_i2c_register_cpufreq(i2c);
889 dev_err(&pdev->dev, "failed to register cpufreq notifier\n");
893 /* Note, previous versions of the driver used i2c_add_adapter()
894 * to add the bus at any number. We now pass the bus number via
895 * the platform data, so if unset it will now default to always
899 i2c->adap.nr = pdata->bus_num;
901 ret = i2c_add_numbered_adapter(&i2c->adap);
903 dev_err(&pdev->dev, "failed to add bus to i2c core\n");
907 platform_set_drvdata(pdev, i2c);
909 dev_info(&pdev->dev, "%s: S3C I2C adapter\n", dev_name(&i2c->adap.dev));
913 s3c24xx_i2c_deregister_cpufreq(i2c);
916 free_irq(i2c->irq, i2c);
922 release_resource(i2c->ioarea);
926 clk_disable(i2c->clk);
934 /* s3c24xx_i2c_remove
936 * called when device is removed from the bus
939 static int s3c24xx_i2c_remove(struct platform_device *pdev)
941 struct s3c24xx_i2c *i2c = platform_get_drvdata(pdev);
943 s3c24xx_i2c_deregister_cpufreq(i2c);
945 i2c_del_adapter(&i2c->adap);
946 free_irq(i2c->irq, i2c);
948 clk_disable(i2c->clk);
953 release_resource(i2c->ioarea);
961 static int s3c24xx_i2c_suspend_late(struct platform_device *dev,
964 struct s3c24xx_i2c *i2c = platform_get_drvdata(dev);
969 static int s3c24xx_i2c_resume(struct platform_device *dev)
971 struct s3c24xx_i2c *i2c = platform_get_drvdata(dev);
974 s3c24xx_i2c_init(i2c);
980 #define s3c24xx_i2c_suspend_late NULL
981 #define s3c24xx_i2c_resume NULL
984 /* device driver for platform bus bits */
986 static struct platform_driver s3c2410_i2c_driver = {
987 .probe = s3c24xx_i2c_probe,
988 .remove = s3c24xx_i2c_remove,
989 .suspend_late = s3c24xx_i2c_suspend_late,
990 .resume = s3c24xx_i2c_resume,
992 .owner = THIS_MODULE,
993 .name = "s3c2410-i2c",
997 static struct platform_driver s3c2440_i2c_driver = {
998 .probe = s3c24xx_i2c_probe,
999 .remove = s3c24xx_i2c_remove,
1000 .suspend_late = s3c24xx_i2c_suspend_late,
1001 .resume = s3c24xx_i2c_resume,
1003 .owner = THIS_MODULE,
1004 .name = "s3c2440-i2c",
1008 static int __init i2c_adap_s3c_init(void)
1012 ret = platform_driver_register(&s3c2410_i2c_driver);
1014 ret = platform_driver_register(&s3c2440_i2c_driver);
1016 platform_driver_unregister(&s3c2410_i2c_driver);
1022 static void __exit i2c_adap_s3c_exit(void)
1024 platform_driver_unregister(&s3c2410_i2c_driver);
1025 platform_driver_unregister(&s3c2440_i2c_driver);
1028 module_init(i2c_adap_s3c_init);
1029 module_exit(i2c_adap_s3c_exit);
1031 MODULE_DESCRIPTION("S3C24XX I2C Bus driver");
1032 MODULE_AUTHOR("Ben Dooks, <ben@simtec.co.uk>");
1033 MODULE_LICENSE("GPL");
1034 MODULE_ALIAS("platform:s3c2410-i2c");
1035 MODULE_ALIAS("platform:s3c2440-i2c");