diff options
author | James Maki <jmaki@multitech.com> | 2010-09-17 12:30:57 -0500 |
---|---|---|
committer | James Maki <jmaki@multitech.com> | 2010-09-17 12:30:57 -0500 |
commit | f1a969fb65c508304f041a673a82477d1cf337f9 (patch) | |
tree | baf0a377c46a3ceda80cf0f696c8ed6f0dd84218 | |
parent | ffc136c90d46b865287b474136c7b1c974997e5f (diff) | |
download | mts-io-f1a969fb65c508304f041a673a82477d1cf337f9.tar.gz mts-io-f1a969fb65c508304f041a673a82477d1cf337f9.tar.bz2 mts-io-f1a969fb65c508304f041a673a82477d1cf337f9.zip |
make max_speed_hz configurable as module params for the spi devices.
-rw-r--r-- | io-module/mts_io.c | 40 |
1 files changed, 36 insertions, 4 deletions
diff --git a/io-module/mts_io.c b/io-module/mts_io.c index d98ed59..f6566e6 100644 --- a/io-module/mts_io.c +++ b/io-module/mts_io.c @@ -314,14 +314,38 @@ static int mts_id_eeprom_load(void) static struct spi_device *spi_sout_dev; static u8 spi_sout_value; static DEFINE_MUTEX(spi_sout_mutex); +static unsigned int sout_max_speed_hz = 1 * 1000 * 1000; +module_param(sout_max_speed_hz, uint, S_IRUGO); +MODULE_PARM_DESC( + sout_max_speed_hz, + "Maximum clock rate to be used with this device (default: 1 MHz)" +); static struct spi_device *spi_dout_dev; static u8 spi_dout_value; static DEFINE_MUTEX(spi_dout_mutex); +static unsigned int dout_max_speed_hz = 1 * 1000 * 1000; +module_param(dout_max_speed_hz, uint, S_IRUGO); +MODULE_PARM_DESC( + dout_max_speed_hz, + "Maximum clock rate to be used with this device (default: 1 MHz)" +); static struct spi_device *spi_din_dev; +static unsigned int din_max_speed_hz = 1 * 1000 * 1000; +module_param(din_max_speed_hz, uint, S_IRUGO); +MODULE_PARM_DESC( + din_max_speed_hz, + "Maximum clock rate to be used with this device (default: 1 MHz)" +); static struct spi_device *spi_board_temp_dev; +static unsigned int board_temp_max_speed_hz = 1 * 1000 * 1000; +module_param(board_temp_max_speed_hz, uint, S_IRUGO); +MODULE_PARM_DESC( + board_temp_max_speed_hz, + "Maximum clock rate to be used with this device (default: 1 MHz)" +); static inline int spi_writen(struct spi_device *spi, const u8 *buf, size_t len) { @@ -1485,9 +1509,11 @@ static int __devinit mts_spi_sout_probe(struct spi_device *spi) { int tmp; - spi->max_speed_hz = 1 * 1000 * 1000; + spi->max_speed_hz = sout_max_speed_hz; spi->mode = 0; + log_debug("sout_max_speed_hz: %d", sout_max_speed_hz); + tmp = spi_setup(spi); if (tmp < 0) { log_error("spi_setup sout failed"); @@ -1529,9 +1555,11 @@ static int __devinit mts_spi_dout_probe(struct spi_device *spi) return -ENODEV; } - spi->max_speed_hz = 1 * 1000 * 1000; + spi->max_speed_hz = dout_max_speed_hz; spi->mode = 0; + log_debug("dout_max_speed_hz: %d", dout_max_speed_hz); + tmp = spi_setup(spi); if (tmp < 0) { log_error("spi_setup dout failed"); @@ -1573,9 +1601,11 @@ static int __devinit mts_spi_din_probe(struct spi_device *spi) return -ENODEV; } - spi->max_speed_hz = 1 * 1000 * 1000; + spi->max_speed_hz = din_max_speed_hz; spi->mode = SPI_CPOL; + log_debug("din_max_speed_hz: %d", din_max_speed_hz); + tmp = spi_setup(spi); if (tmp < 0) { log_error("spi_setup din failed"); @@ -1609,9 +1639,11 @@ static int __devinit mts_spi_board_temp_probe(struct spi_device *spi) { int tmp; - spi->max_speed_hz = 1 * 1000 * 1000; + spi->max_speed_hz = board_temp_max_speed_hz; spi->mode = SPI_CPOL | SPI_CPHA; + log_debug("board_temp_max_speed_hz: %d", board_temp_max_speed_hz); + tmp = spi_setup(spi); if (tmp < 0) { log_error("spi_setup board-temp failed"); |