From patchwork Fri Oct 14 07:53:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 9376159 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2AA9960779 for ; Fri, 14 Oct 2016 07:57:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1FAF32A4D7 for ; Fri, 14 Oct 2016 07:57:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 129BC2A4E6; Fri, 14 Oct 2016 07:57:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 90B192A4D7 for ; Fri, 14 Oct 2016 07:57:39 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1buxLq-0004Xj-Ce; Fri, 14 Oct 2016 07:56:22 +0000 Received: from mx1.redhat.com ([209.132.183.28]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1buxK8-0002Fi-7P for linux-arm-kernel@lists.infradead.org; Fri, 14 Oct 2016 07:54:37 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6BF137DD34; Fri, 14 Oct 2016 07:54:19 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-112-53.ams2.redhat.com [10.36.112.53]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u9E7rdoP016706; Fri, 14 Oct 2016 03:54:12 -0400 From: Hans de Goede To: Rob Herring , Mark Rutland , Arnd Bergmann , Greg Kroah-Hartman Subject: [PATCH 6/6] misc: q8-hardwaremgr: Add quirk handling Date: Fri, 14 Oct 2016 09:53:37 +0200 Message-Id: <20161014075337.10452-7-hdegoede@redhat.com> In-Reply-To: <20161014075337.10452-1-hdegoede@redhat.com> References: <20161014075337.10452-1-hdegoede@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Fri, 14 Oct 2016 07:54:19 +0000 (UTC) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161014_005436_402222_1EEC5F89 X-CRM114-Status: GOOD ( 12.65 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree , Maxime Ripard , Chen-Yu Tsai , linux-arm-kernel@lists.infradead.org, Hans de Goede MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Some models require some special handling, e.g. one q8 tablet I've needs esp,crystal-26M-en = <1> in the sdio_wifi dt node for the wifi to work properly. Add a q8_hardwaremgr_apply_quirks() helper function which identifies the tablet based on the detected soc, touchscreen, accelerometer combo and applies model specific quirks where necessary. Signed-off-by: Hans de Goede --- drivers/misc/q8-hardwaremgr.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/misc/q8-hardwaremgr.c b/drivers/misc/q8-hardwaremgr.c index 95cdaf2..cbf4f61 100644 --- a/drivers/misc/q8-hardwaremgr.c +++ b/drivers/misc/q8-hardwaremgr.c @@ -715,6 +715,28 @@ static void q8_hardwaremgr_apply_accelerometer(struct q8_hardwaremgr_data *data) of_node_put(np); } +static void q8_hardwaremgr_apply_quirks(struct q8_hardwaremgr_data *data) +{ + struct device_node *np; + struct of_changeset cset; + + /* This A33 tzx-723q4 PCB tablet with esp8089 needs crystal_26M_en=1 */ + if (data->soc == a33 && data->touchscreen.model == gsl1680_b482 && + data->accelerometer.model == dmard09 && !data->has_rda599x) { + dev_info(data->dev, "Applying crystal_26M_en=1 sdio_wifi quirk\n"); + np = of_find_node_by_name(of_root, "sdio_wifi"); + if (!np) { + dev_warn(data->dev, "Could not find sdio_wifi dt node\n"); + return; + } + of_changeset_init(&cset); + of_changeset_add_property_u32(&cset, np, + "esp,crystal-26M-en", 1); + of_changeset_apply(&cset); + of_node_put(np); + } +} + static int q8_hardwaremgr_do_probe(struct q8_hardwaremgr_data *data, struct q8_hardwaremgr_device *dev, const char *prefix, bus_probe_func func) @@ -846,6 +868,7 @@ static int q8_hardwaremgr_probe(struct platform_device *pdev) q8_hardwaremgr_apply_touchscreen(data); q8_hardwaremgr_apply_accelerometer(data); + q8_hardwaremgr_apply_quirks(data); error: kfree(data);