aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Worsley <amworsley@gmail.com>2017-08-27 07:34:22 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-08-28 11:23:29 -0400
commit54865314f5a1bfade1555ca6b26653729a0f3e23 (patch)
treefed7ba3ff73cae80aad622d7131a3cc73966dbd4
parente5cf84e8224c49f335aec6b69b3e373bbbe4641a (diff)
drivers: w1: Extend 1W master driver DS2482 with module option to support PPM/SPU/1WS features
Extend the one wire DS2482 master driver with a module option that allows support for PPM/SPU/1WS interface modes to be requested. This allows support of chips that require one or more of these features such as the DS28E05. Signed-off-by: Andrew Worsley <amworsley@gmail.com> Acked-by: Evgeniy Polyakov <zbr@ioremap.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/w1/masters/ds2482.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/w1/masters/ds2482.c b/drivers/w1/masters/ds2482.c
index d49681cd29af..5b3e017d9276 100644
--- a/drivers/w1/masters/ds2482.c
+++ b/drivers/w1/masters/ds2482.c
@@ -70,6 +70,8 @@ MODULE_PARM_DESC(active_pullup, "Active pullup (apply to all buses): " \
70#define DS2482_REG_CFG_PPM 0x02 /* presence pulse masking */ 70#define DS2482_REG_CFG_PPM 0x02 /* presence pulse masking */
71#define DS2482_REG_CFG_APU 0x01 /* active pull-up */ 71#define DS2482_REG_CFG_APU 0x01 /* active pull-up */
72 72
73/* extra configurations - e.g. 1WS */
74int extra_config;
73 75
74/** 76/**
75 * Write and verify codes for the CHANNEL_SELECT command (DS2482-800 only). 77 * Write and verify codes for the CHANNEL_SELECT command (DS2482-800 only).
@@ -403,7 +405,7 @@ static u8 ds2482_w1_reset_bus(void *data)
403 /* If the chip did reset since detect, re-config it */ 405 /* If the chip did reset since detect, re-config it */
404 if (err & DS2482_REG_STS_RST) 406 if (err & DS2482_REG_STS_RST)
405 ds2482_send_cmd_data(pdev, DS2482_CMD_WRITE_CONFIG, 407 ds2482_send_cmd_data(pdev, DS2482_CMD_WRITE_CONFIG,
406 ds2482_calculate_config(0x00)); 408 ds2482_calculate_config(extra_config));
407 } 409 }
408 410
409 mutex_unlock(&pdev->access_lock); 411 mutex_unlock(&pdev->access_lock);
@@ -429,8 +431,7 @@ static u8 ds2482_w1_set_pullup(void *data, int delay)
429 ds2482_wait_1wire_idle(pdev); 431 ds2482_wait_1wire_idle(pdev);
430 /* note: it seems like both SPU and APU have to be set! */ 432 /* note: it seems like both SPU and APU have to be set! */
431 retval = ds2482_send_cmd_data(pdev, DS2482_CMD_WRITE_CONFIG, 433 retval = ds2482_send_cmd_data(pdev, DS2482_CMD_WRITE_CONFIG,
432 ds2482_calculate_config(DS2482_REG_CFG_SPU | 434 ds2482_calculate_config(extra_config|DS2482_REG_CFG_SPU|DS2482_REG_CFG_APU));
433 DS2482_REG_CFG_APU));
434 ds2482_wait_1wire_idle(pdev); 435 ds2482_wait_1wire_idle(pdev);
435 } 436 }
436 437
@@ -483,7 +484,7 @@ static int ds2482_probe(struct i2c_client *client,
483 484
484 /* Set all config items to 0 (off) */ 485 /* Set all config items to 0 (off) */
485 ds2482_send_cmd_data(data, DS2482_CMD_WRITE_CONFIG, 486 ds2482_send_cmd_data(data, DS2482_CMD_WRITE_CONFIG,
486 ds2482_calculate_config(0x00)); 487 ds2482_calculate_config(extra_config));
487 488
488 mutex_init(&data->access_lock); 489 mutex_init(&data->access_lock);
489 490
@@ -558,4 +559,7 @@ module_i2c_driver(ds2482_driver);
558 559
559MODULE_AUTHOR("Ben Gardner <bgardner@wabtec.com>"); 560MODULE_AUTHOR("Ben Gardner <bgardner@wabtec.com>");
560MODULE_DESCRIPTION("DS2482 driver"); 561MODULE_DESCRIPTION("DS2482 driver");
562module_param(extra_config, int, S_IRUGO | S_IWUSR);
563MODULE_PARM_DESC(extra_config, "Extra Configuration settings 1=APU,2=PPM,3=SPU,8=1WS");
564
561MODULE_LICENSE("GPL"); 565MODULE_LICENSE("GPL");