diff options
author | Ben Dooks <ben-linux@fluff.org> | 2008-07-03 06:24:23 -0400 |
---|---|---|
committer | Ben Dooks <ben-linux@fluff.org> | 2008-07-03 11:51:18 -0400 |
commit | ea304e394f78af6bafee07e0ed916af9c38abf48 (patch) | |
tree | e8ecc7ba1638e1d1a67446ee65bbf0dd6eef1bbe /drivers/serial/s3c2410.c | |
parent | 9cf345e3991623d4b7e4df2624b898d7f20ec37f (diff) |
[ARM] S3C2410: Add sysfs attribute for serial driver clock source
Add attribute to show the current clock source for the serial
driver and remove old and annoying debug output.
Note, this only currently shows the current source with a
"* " prefix to indicate that it is the current source. Future
code will list all the clock sources, with the non-selected
one with " " prefix.
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
PATCH FOLLOWS
KernelVersion: 2.6.26-rc3
Diffstat (limited to 'drivers/serial/s3c2410.c')
-rw-r--r-- | drivers/serial/s3c2410.c | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/drivers/serial/s3c2410.c b/drivers/serial/s3c2410.c index e284af8071de..b87c0b55aa22 100644 --- a/drivers/serial/s3c2410.c +++ b/drivers/serial/s3c2410.c | |||
@@ -685,11 +685,6 @@ static unsigned int s3c24xx_serial_getclk(struct uart_port *port, | |||
685 | int calc_deviation; | 685 | int calc_deviation; |
686 | 686 | ||
687 | for (sptr = res; sptr < resptr; sptr++) { | 687 | for (sptr = res; sptr < resptr; sptr++) { |
688 | printk(KERN_DEBUG | ||
689 | "found clk %p (%s) quot %d, calc %d\n", | ||
690 | sptr->clksrc, sptr->clksrc->name, | ||
691 | sptr->quot, sptr->calc); | ||
692 | |||
693 | calc_deviation = baud - sptr->calc; | 688 | calc_deviation = baud - sptr->calc; |
694 | if (calc_deviation < 0) | 689 | if (calc_deviation < 0) |
695 | calc_deviation = -calc_deviation; | 690 | calc_deviation = -calc_deviation; |
@@ -699,13 +694,8 @@ static unsigned int s3c24xx_serial_getclk(struct uart_port *port, | |||
699 | deviation = calc_deviation; | 694 | deviation = calc_deviation; |
700 | } | 695 | } |
701 | } | 696 | } |
702 | |||
703 | printk(KERN_DEBUG "best %p (deviation %d)\n", best, deviation); | ||
704 | } | 697 | } |
705 | 698 | ||
706 | printk(KERN_DEBUG "selected clock %p (%s) quot %d, calc %d\n", | ||
707 | best->clksrc, best->clksrc->name, best->quot, best->calc); | ||
708 | |||
709 | /* store results to pass back */ | 699 | /* store results to pass back */ |
710 | 700 | ||
711 | *clksrc = best->clksrc; | 701 | *clksrc = best->clksrc; |
@@ -1058,6 +1048,18 @@ static int s3c24xx_serial_init_port(struct s3c24xx_uart_port *ourport, | |||
1058 | return 0; | 1048 | return 0; |
1059 | } | 1049 | } |
1060 | 1050 | ||
1051 | static ssize_t s3c24xx_serial_show_clksrc(struct device *dev, | ||
1052 | struct device_attribute *attr, | ||
1053 | char *buf) | ||
1054 | { | ||
1055 | struct uart_port *port = s3c24xx_dev_to_port(dev); | ||
1056 | struct s3c24xx_uart_port *ourport = to_ourport(port); | ||
1057 | |||
1058 | return snprintf(buf, PAGE_SIZE, "* %s\n", ourport->clksrc->name); | ||
1059 | } | ||
1060 | |||
1061 | static DEVICE_ATTR(clock_source, S_IRUGO, s3c24xx_serial_show_clksrc, NULL); | ||
1062 | |||
1061 | /* Device driver serial port probe */ | 1063 | /* Device driver serial port probe */ |
1062 | 1064 | ||
1063 | static int probe_index = 0; | 1065 | static int probe_index = 0; |
@@ -1083,6 +1085,11 @@ static int s3c24xx_serial_probe(struct platform_device *dev, | |||
1083 | uart_add_one_port(&s3c24xx_uart_drv, &ourport->port); | 1085 | uart_add_one_port(&s3c24xx_uart_drv, &ourport->port); |
1084 | platform_set_drvdata(dev, &ourport->port); | 1086 | platform_set_drvdata(dev, &ourport->port); |
1085 | 1087 | ||
1088 | ret = device_create_file(&dev->dev, &dev_attr_clock_source); | ||
1089 | if (ret < 0) { | ||
1090 | printk(KERN_ERR "%s: failed to add clksrc attr.\n", __func__); | ||
1091 | } | ||
1092 | |||
1086 | return 0; | 1093 | return 0; |
1087 | 1094 | ||
1088 | probe_err: | 1095 | probe_err: |
@@ -1093,8 +1100,10 @@ static int s3c24xx_serial_remove(struct platform_device *dev) | |||
1093 | { | 1100 | { |
1094 | struct uart_port *port = s3c24xx_dev_to_port(&dev->dev); | 1101 | struct uart_port *port = s3c24xx_dev_to_port(&dev->dev); |
1095 | 1102 | ||
1096 | if (port) | 1103 | if (port) { |
1104 | device_remove_file(&dev->dev, &dev_attr_clock_source); | ||
1097 | uart_remove_one_port(&s3c24xx_uart_drv, port); | 1105 | uart_remove_one_port(&s3c24xx_uart_drv, port); |
1106 | } | ||
1098 | 1107 | ||
1099 | return 0; | 1108 | return 0; |
1100 | } | 1109 | } |