Received: by 10.223.164.202 with SMTP id h10csp1009344wrb; Fri, 17 Nov 2017 12:17:54 -0800 (PST) X-Google-Smtp-Source: AGs4zMay6BDF7wfxnBTxpV+NkoU1QreFdEqU8l3CcKdMruBNNHTci6gBEFR+ee6VXm/EOz5xpeIg X-Received: by 10.159.234.75 with SMTP id c11mr6629635plr.422.1510949874275; Fri, 17 Nov 2017 12:17:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510949874; cv=none; d=google.com; s=arc-20160816; b=jkZ/Xeo2zDjGBzJGOCMbqdYYp3Rx2oZdeQo5yZs4G8c7y448ZOeo7IxDwYu605HjD/ DjuxTsxGc5bDqD5Lh2QHVayBp6xAwLzFVtw+qDXs1GVrpWTo01hMh4aNop0MmZKbUi84 2zYExeTrve4FHJ7wrscJcrGkAdqvRlvsz7XI4dgsBzS4ASWmZjD9Bi0pI5DA1YYdaA2o ArAhr/O3lktASL9SolF8YXeKOzIJBnnEhVqgeAYoOgRzSqRYueI/YphBYhOmbnrL6VUB Dt6/pKJPRU9DOv2bp/HsPJZbgCRwWJA9nkvIK50L/8cBXOLUGSW7N3IBoTmQA4AtDdGZ k6VA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature:dkim-signature :arc-authentication-results; bh=aVBNERPx7WrB1EQHo9/q8v6f6lWJhw0F6uwm0jtiqHc=; b=Aqv0SrzWTq1UpsXI4oBGTGAj/QDFAaHC3anOwKN3I/2Pu7PlSHWoJR4wAg0quPryW2 IzMZix4U9yXmqf13TcJk31sxnkUz/eZiWw2QShXA5dZUe/XAF/I5DCJxC6pVsJXQSimh /fZgkKUWAqfmh1vU3/MmaX7Zj55WIEHiIgjeTp2FflLq0zt28c2vZg5xLRZnhHoFomV9 87pXRtP3SKkjU9Hr5c3gadeqdhUs2WQLJDxvS4sjPCX30bhq7yILE6J0csgwT117TL4y wNvFrADWRCpDXfkplOBLGg3Sn9mtjcDRBAAmYTgRKotjlPhQQR1Ix0AEOSQ3+m7dYDLj 1xJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=KOrRivMm; dkim=pass header.i=@codeaurora.org header.s=default header.b=h6cLFRUf; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w63si3193338pgb.612.2017.11.17.12.17.40; Fri, 17 Nov 2017 12:17:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=KOrRivMm; dkim=pass header.i=@codeaurora.org header.s=default header.b=h6cLFRUf; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753306AbdKQLBd (ORCPT + 91 others); Fri, 17 Nov 2017 06:01:33 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:39728 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753223AbdKQLBY (ORCPT ); Fri, 17 Nov 2017 06:01:24 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 9BAE8606DB; Fri, 17 Nov 2017 11:01:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1510916483; bh=wCX1/MWZa77F2j5JCRwfdcVeSLgoGri9BmgUSwbA62w=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=KOrRivMmiXADi9U7PzYJCDYBR4bgCU9M4/8mkwxufjW9ao39/yVr+6VXY73Cnu9IZ 1rDSBU8YUUQ1qNz9G3bFI1B+RlD5/BLqlgR23aTALZ5o89iUbVe5ObhjA/PhMd/aLY O0DLBRPynOGhjITZIAAd3P68Pl6Bu+bpvO9aQkBU= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id 74F9560159; Fri, 17 Nov 2017 11:01:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1510916482; bh=wCX1/MWZa77F2j5JCRwfdcVeSLgoGri9BmgUSwbA62w=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=h6cLFRUfAA/bIIFw5RJclWnmaCx8v9hni9EfQSZWbym2JsAmekgz7aw0JneZIiZjN 5DIwnH+uY+DfF1Ub+Uj8aWI7Cns0B7F/N1R8ppmy/x++L7fAl8sLyJ/byZ0EL6B3JO mp5/WfiE7PNuSooxG5aPTTAQvE66jsKFfzjG/hmc= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 17 Nov 2017 16:31:22 +0530 From: kgunda@codeaurora.org To: Lee Jones Cc: Bjorn Andersson , linux-arm-msm@vger.kernel.org, Daniel Thompson , Jingoo Han , Richard Purdie , Jacek Anaszewski , Pavel Machek , Rob Herring , Mark Rutland , Bartlomiej Zolnierkiewicz , linux-leds@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fbdev@vger.kernel.org, linux-arm-msm-owner@vger.kernel.org Subject: Re: [PATCH V1 1/4] qcom: spmi-wled: Add support for qcom wled driver In-Reply-To: <20171117083342.usr4t7olsgarn4kp@dell> References: <1510834717-21765-1-git-send-email-kgunda@codeaurora.org> <1510834717-21765-2-git-send-email-kgunda@codeaurora.org> <20171116165510.GP28761@minitux> <208c7332234581909f159ddb33ede32b@codeaurora.org> <20171117065640.GU28761@minitux> <20171117083342.usr4t7olsgarn4kp@dell> Message-ID: X-Sender: kgunda@codeaurora.org User-Agent: Roundcube Webmail/1.2.5 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2017-11-17 14:03, Lee Jones wrote: > On Thu, 16 Nov 2017, Bjorn Andersson wrote: > >> On Thu 16 Nov 22:36 PST 2017, kgunda@codeaurora.org wrote: >> >> > On 2017-11-16 22:25, Bjorn Andersson wrote: >> > > On Thu 16 Nov 04:18 PST 2017, Kiran Gunda wrote: >> > > >> > > > WLED driver provides the interface to the display driver to >> > > > adjust the brightness of the display backlight. >> > > > >> > > >> > > Hi Kiran, >> > > >> > > This driver has a lot in common with the already upstream pm8941-wled.c, >> > > because it's just a new revision of the same block. >> > > >> > > Please extend the existing driver rather than providing a new one >> > > (and yes, renaming the file is okay). >> > > >> > > Regards, >> > > Bjorn >> > >> > Hi Bjorn, >> > >> > Yes this driver design is similar to pm8941, however the WLED HW block >> > has undergone quite a few changes in analog and digital from PM8941 to >> > PM8998. >> >> I can see that, looking at the documentation. >> >> > Few of them include splitting one module into wled-ctrl and wled-sink >> > peripherals, changes in the register offsets and the bit >> > interpretation. >> >> This is typical and something we need to handle in all these drivers, >> to >> avoid having one driver per platform. >> >> > Hence we concluded that it was better to have a new driver to support >> > this new gen WELD module and decouple it from the pm8941. >> >> Okay, I can see how it's easier to not have to case about anything but >> pmi8998 in this driver, but where do you add the support for other >> WLED >> versions? What about PMI8994? Will there not be similar differences >> (registers that has moved around) in the future? >> >> > Also, going forward this driver will support AMOLED AVDD rail (not >> > supported by pm8941) touching a few more registers/configuration and >> > newer PMICs. >> >> Is this a feature that was introduced in PMI8998? Will this support >> not >> be dependent on the pmic version? >> >> > So spinning off a new driver would make it cleaner and easier to >> > extend further. >> > >> >> It's for sure easier at this point in time, but your argumentation >> implies that PMI8998+1 should go into it's own driver as well. >> >> I suspect that if you're going to reuse this driver for future PMIC >> versions you will have to deal with register layout differences and >> new >> feature set, and as such I'm not convinced that a new driver is >> needed. >> >> Can you give any concrete examples of where it is not possible or >> undesirable to maintain the pm8941 support in the same driver? > > I agree with Bjorn. If you can support multiple devices in a single > driver with a couple of simple ddata struct differences and a slightly > different regmap, you should. Hi Lee, Thanks for the feedback! The regmap difference is not confined to couple of registers. Except the one register all the registers have some difference in offset or bitmap or config values as compared to the pm8941. Below is the table for the reference. The below table covers only the registers those exist in the pm8941 driver, if we keep adding the other features the changes may be huge. Apart from this I have mentioned other feature differences between pm8941 and pm8998 as well in response to Bjorn. Please refer that as well. Register Compatibility between 8998 Vs 8941 ======== =================================================== WLED_MODULE_ENABLE Register address offset is same and config values match WLED1_ILED_SYNC_BIT Register address offset and config values not matching. WLED1_SWITCHING_FREQUENCY Register address offset and config values are matching. But there is an extra override bit in pm8998. WLED1_WLED_OVP Register address offset same. But config values are not matching. WLED1_WLED_ILIM Register address offset is same. But config values are not matching WLED1_EN_CURRENT_SINK Both register address offset and config values are not matching. WLED1_LED1_MODULATOR_EN Both register address offset and config values are not matching. WLED1_LED1_FULL_SCALE_CURRENT Both register address offset and config values are not matching. WLED1_LED1_MODULATOR_SRC_SE Register address offset not matching, but the config values are matching WLED1_LED1_CABC_EN Register address offset not matching, but the config values are not matching. Thanks, Kiran From 1584337940662244087@xxx Fri Nov 17 18:13:22 +0000 2017 X-GM-THRID: 1584234060306084166 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread