From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.4 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4AF96C4CECE for ; Wed, 18 Sep 2019 13:03:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 20E12207FC for ; Wed, 18 Sep 2019 13:03:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="UQBGw2zF" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729228AbfIRNDo (ORCPT ); Wed, 18 Sep 2019 09:03:44 -0400 Received: from perceval.ideasonboard.com ([213.167.242.64]:36036 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726257AbfIRNDn (ORCPT ); Wed, 18 Sep 2019 09:03:43 -0400 Received: from pendragon.ideasonboard.com (126.92.103.87.rev.vodafone.pt [87.103.92.126]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 35E4B325; Wed, 18 Sep 2019 15:03:41 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1568811821; bh=Bd/SwyG0H1MmBai0JFG0Y2O/9j+qimtkExgKIEyutN4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=UQBGw2zF2DMetIvPGfASDFUK+z2+czuQ8xOWA2Tntr2PP1ZLHdwNIHGfiykKn+zE2 ZJju+HHXrE+Xd7vU71iLimj0WXIyYxp51fsEyz3XwN/IVTF7MsWBYU5wH0gzbOTFbg bxqO/nc4GY6asCAmu2o7EybYuyH1p18Ct30KTuDM= Date: Wed, 18 Sep 2019 16:03:31 +0300 From: Laurent Pinchart To: Gareth Williams Cc: Yoshihiro Shimoda , "dri-devel@lists.freedesktop.org" , "linux-kernel@vger.kernel.org" , "linux-renesas-soc@vger.kernel.org" , Geert Uytterhoeven , Phil Edworthy , Fabrizio Castro , "kieran.bingham+renesas@ideasonboard.com" Subject: Re: DRM Driver implementation question Message-ID: <20190918130331.GD6306@pendragon.ideasonboard.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Gareth, Sorry for the delayed response, I was travelling for the Linux Plumbers Conference followed by a code camp. On Tue, Sep 17, 2019 at 03:27:34PM +0000, Gareth Williams wrote: > Hi Yoshihiro, > > This looks like an elegant solution that I can implement. > Many thanks for pointing me in a good direction. > > > From: Yoshihiro Shimoda, Sent: Tuesday, September 17, 2019 05:39 PM > > > > Hi Gareth, > > > > > From: Gareth Williams, Sent: Monday, September 16, 2019 10:56 PM > > > > > > Hi Laurent/Kieran, > > > > > > I need to upstream a driver for a display controller that within its > > > registers memory region contains registers related to a PWM > > > device. The PWM device is for controlling the backlight of the > > > display. > > > > > > Ideally, I would like to create a separated driver for the PWM, so > > > that I can re-use "pwm-backlight", but since the registers for the PWM > > > are right in the middle of the registers for the display > > > controller I would need to ioremap the memory region for the PWM > > > registers region twice, once from the display controller driver, > > > and once from the PWM driver. > > > > > > Do you think that the double ioremap would be acceptable upstream? > > > > I think that an MFD driver can support such hardware. I checked > > Documentation/devicetree/bindings/mfd roughly, and then atmel-hlcdc.txt > > seems to have a display controller and a PWM device. While MFD should technically work, I think it's quite overkill. You could instead bundle both the display controller and the PWM controller in the same driver. The driver would create both a DRM/KMS device and a PWM device. The DT node for your device would contain a #pwm-cells property and could thus be referenced as a PWM controller by the backlight using the pwms property. -- Regards, Laurent Pinchart