From patchwork Thu Jan 7 22:29:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaro Koskinen X-Patchwork-Id: 7980071 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E575E9F1CC for ; Thu, 7 Jan 2016 22:29:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A2D312013D for ; Thu, 7 Jan 2016 22:29:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C5B1120114 for ; Thu, 7 Jan 2016 22:29:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752189AbcAGW3n (ORCPT ); Thu, 7 Jan 2016 17:29:43 -0500 Received: from emh01.mail.saunalahti.fi ([62.142.5.107]:48312 "EHLO emh01.mail.saunalahti.fi" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752073AbcAGW3m (ORCPT ); Thu, 7 Jan 2016 17:29:42 -0500 Received: from localhost.localdomain (85-76-129-167-nat.elisa-mobile.fi [85.76.129.167]) by emh01.mail.saunalahti.fi (Postfix) with ESMTP id 399F090091; Fri, 8 Jan 2016 00:29:40 +0200 (EET) From: Aaro Koskinen To: Lee Jones , Tony Lindgren , linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org Cc: Aaro Koskinen Subject: [PATCH] mfd: tps65010: fix init when the driver is built-in Date: Fri, 8 Jan 2016 00:29:33 +0200 Message-Id: <1452205773-21962-1-git-send-email-aaro.koskinen@iki.fi> X-Mailer: git-send-email 2.4.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP tps65010 driver's initcall cannot succeed when the driver is built-in, because it expects that the I2C probe is completed at initcall time; this cannot happen as MFD is initialized before I2C. Also on systems where the chip is not present there is unnecessary 30 ms delay during the boot. Instead of waiting for probe to finish, just register the I2C device. If some boards need retry mechanism for startup glitches, that should be done in the actual probe function. Also move the driver banner message to the probe function, and make it print the chip model being probed. The patch allows to use tps65010 again with OMAP1 (where it's required to be built-in) and enables e.g. USB and LED functionality on OMAP5912 OSK. Signed-off-by: Aaro Koskinen --- drivers/mfd/tps65010.c | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/drivers/mfd/tps65010.c b/drivers/mfd/tps65010.c index 448f0a1..450c358 100644 --- a/drivers/mfd/tps65010.c +++ b/drivers/mfd/tps65010.c @@ -541,6 +541,8 @@ static int tps65010_probe(struct i2c_client *client, int status; struct tps65010_board *board = dev_get_platdata(&client->dev); + pr_info("%s: chip model %s\n", DRIVER_NAME, id->name); + if (the_tps) { dev_dbg(&client->dev, "only one tps6501x chip allowed\n"); return -ENODEV; @@ -1059,26 +1061,7 @@ EXPORT_SYMBOL(tps65013_set_low_pwr); static int __init tps_init(void) { - u32 tries = 3; - int status = -ENODEV; - - printk(KERN_INFO "%s: version %s\n", DRIVER_NAME, DRIVER_VERSION); - - /* some boards have startup glitches */ - while (tries--) { - status = i2c_add_driver(&tps65010_driver); - if (the_tps) - break; - i2c_del_driver(&tps65010_driver); - if (!tries) { - printk(KERN_ERR "%s: no chip?\n", DRIVER_NAME); - return -ENODEV; - } - pr_debug("%s: re-probe ...\n", DRIVER_NAME); - msleep(10); - } - - return status; + return i2c_add_driver(&tps65010_driver); } /* NOTE: this MUST be initialized before the other parts of the system * that rely on it ... but after the i2c bus on which this relies.