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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 83629C636CD for ; Fri, 10 Feb 2023 11:35:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231846AbjBJLfS (ORCPT ); Fri, 10 Feb 2023 06:35:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47158 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231701AbjBJLfR (ORCPT ); Fri, 10 Feb 2023 06:35:17 -0500 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B00271F07 for ; Fri, 10 Feb 2023 03:35:16 -0800 (PST) Received: from pendragon.ideasonboard.com (213-243-189-158.bb.dnainternet.fi [213.243.189.158]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 0AF7927C; Fri, 10 Feb 2023 12:35:14 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1676028915; bh=BCCOHpkCVGThX6ksdJ6uABjuM8PelMmC6tLHGzcCA54=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=lerfKsljU4GprnNsU2CAdwoWU31Ejq50+ry83cQgCiE9x4LiwzZFxwgcqEodSlFPw QM+Ft/1r6sZLK5ZOFi5JKNUH5KsLUlOrVbJgjJKRLhX9k8Ln5wVwoI03pP9bR8N+Op bFRxmdHvaWhcdypLkOHWnGX/rbd9OYmmtC35RTHg= Date: Fri, 10 Feb 2023 13:35:13 +0200 From: Laurent Pinchart To: Hans de Goede Cc: Andy Shevchenko , Sakari Ailus , Mauro Carvalho Chehab , Tsuchiya Yuto , Yury Luneff , Nable , andrey.i.trufanov@gmail.com, Fabio Aiuto , linux-media@vger.kernel.org, linux-staging@lists.linux.dev Subject: Re: [PATCH 28/57] media: Add ovxxxx_16bit_addr_reg_helpers.h Message-ID: References: <20230123125205.622152-1-hdegoede@redhat.com> <20230123125205.622152-29-hdegoede@redhat.com> <026272d3-88d7-a67f-4942-5cba6c3eab86@redhat.com> <974597c0-1614-97d5-d933-e52bb1a062ab@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <974597c0-1614-97d5-d933-e52bb1a062ab@redhat.com> Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org On Fri, Feb 10, 2023 at 12:19:30PM +0100, Hans de Goede wrote: > Hi, > > On 2/10/23 11:53, Andy Shevchenko wrote: > > On Fri, Feb 10, 2023 at 12:47:55PM +0200, Sakari Ailus wrote: > >> On Fri, Feb 10, 2023 at 12:29:19PM +0200, Laurent Pinchart wrote: > >>> On Fri, Feb 10, 2023 at 12:21:15PM +0200, Sakari Ailus wrote: > >>>> On Thu, Feb 09, 2023 at 06:11:12PM +0200, Laurent Pinchart wrote: > > > > ... > > > >>>> I took a look at this some time ago, too, and current regmap API is a poor > >>>> fit for CCI devices. CCI works on top of e.g. both I²C and I3C so something > >>>> on top of regmap is a better approach indeed. > >>> > >>> I'm confused, is regmap a poor fit, or a better approach ? > >> > >> I'm proposing having something on top of regmap, but not changing regmap > >> itself. > > > > I don't understand why we can't change regmap? regmap has a facility called > > regmap bus which we can provide specifically for these types of devices. What's > > wrong to see it done? > > It is fairly easy to layer the few 16 and 24 bit register accesses over > a standard regmap with 16 bit reg-address and 8 bit reg-data width using > regmap_bulk_write() to still do the write in e.g. a single i2c-transfer. I think we could also use regmap_raw_write(). > So if we want regmap for underlying physical layer independence, e.g. > spi / i2c / i3c. we can just use standard regmap with a > cci_write_reg helper on top. Agreed. We can start experimenting with this, and if somebody has use cases outside of the camera sensor drivers space, we could later move those helpers to regmap. > I think that would be the most KISS solution here. One thing to also keep > in mind is the amount of work necessary to convert existing sensor drivers. > Also keeping in mind that it is not just the in tree sensor drivers, but > also all out of tree sensor drivers which I have seen use similar constructs. If this was the only issue to handle when porting drivers to mainline and upstreaming them, I'd be happy :-) > Requiring drivers to have a list / array of structs of all used register > addresses + specifying the width per register address is not going to scale > very poorly wrt converting all the code out there and I'm afraid that > letting regmap somehow deal with the register-width issue is going to > require something like this. Did you mean "not going to scale very well" ? I'm not sure to understand what you mean here. -- Regards, Laurent Pinchart