X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=drivers%2Fw1%2Fw1_io.c;h=8e8b64cfafb69a417bded8e6f3f745ca3a7e44a1;hb=56aa53391059e3730a304da4dd96b7b123b9fb75;hp=3ebe9726a9e55471ae9383fe262fc61de2727200;hpb=ae6e59caefd8d4097ccb096c95df95ec7e52fe88;p=mirror_ubuntu-eoan-kernel.git diff --git a/drivers/w1/w1_io.c b/drivers/w1/w1_io.c index 3ebe9726a9e5..8e8b64cfafb6 100644 --- a/drivers/w1/w1_io.c +++ b/drivers/w1/w1_io.c @@ -389,6 +389,32 @@ int w1_reset_select_slave(struct w1_slave *sl) } EXPORT_SYMBOL_GPL(w1_reset_select_slave); +/** + * When the workflow with a slave amongst many requires several + * successive commands a reset between each, this function is similar + * to doing a reset then a match ROM for the last matched ROM. The + * advantage being that the matched ROM step is skipped in favor of the + * resume command. The slave must support the command of course. + * + * If the bus has only one slave, traditionnaly the match ROM is skipped + * and a "SKIP ROM" is done for efficiency. On multi-slave busses, this + * doesn't work of course, but the resume command is the next best thing. + * + * The w1 master lock must be held. + * + * @param dev the master device + */ +int w1_reset_resume_command(struct w1_master *dev) +{ + if (w1_reset_bus(dev)) + return -1; + + /* This will make only the last matched slave perform a skip ROM. */ + w1_write_8(dev, W1_RESUME_CMD); + return 0; +} +EXPORT_SYMBOL_GPL(w1_reset_resume_command); + /** * Put out a strong pull-up of the specified duration after the next write * operation. Not all hardware supports strong pullups. Hardware that