From mboxrd@z Thu Jan 1 00:00:00 1970 From: Charles Keepax Subject: Re: [PATCH v3 5/5] pinctrl: lochnagar: Add support for the Cirrus Logic Lochnagar Date: Tue, 30 Oct 2018 13:59:48 +0000 Message-ID: <20181030135948.GJ16508@imbe.wolfsonmicro.main> References: <20181019095003.26046-1-ckeepax@opensource.cirrus.com> <20181019095003.26046-5-ckeepax@opensource.cirrus.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Return-path: Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org To: Linus Walleij Cc: Lee Jones , Michael Turquette , Stephen Boyd , Mark Brown , Rob Herring , Mark Rutland , Liam Girdwood , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , "linux-kernel@vger.kernel.org" , patches@opensource.cirrus.com, linux-clk , "open list:GPIO SUBSYSTEM" List-Id: devicetree@vger.kernel.org On Tue, Oct 30, 2018 at 02:04:20PM +0100, Linus Walleij wrote: > On Fri, Oct 19, 2018 at 11:50 AM Charles Keepax > wrote: > > > Lochnagar is an evaluation and development board for Cirrus > > Logic Smart CODEC and Amp devices. It allows the connection of > > most Cirrus Logic devices on mini-cards, as well as allowing > > connection of various application processor systems to provide a > > full evaluation platform. This driver supports the board > > controller chip on the Lochnagar board. > > > > Lochnagar provides many pins which can generally be used for an > > audio function such as an AIF or a PDM interface, but also as > > GPIOs. > > > > Signed-off-by: Charles Keepax > > --- > > +static void lochnagar_gpio_set(struct gpio_chip *chip, > > + unsigned int offset, int value) > > +{ > > + struct lochnagar_pin_priv *priv = gpiochip_get_data(chip); > > + struct lochnagar *lochnagar = priv->lochnagar; > > + const struct lochnagar_pin *pin = priv->pins[offset].drv_data; > > + int ret; > > + > > + value = !!value; > > value = value ? BIT(pin->shift) : 0; > I think this will end up more complex because... > > + dev_dbg(priv->dev, "Set GPIO %s to %s\n", > > + pin->name, value ? "high" : "low"); > > + > > + switch (pin->type) { > > + case LN_PTYPE_MUX: > > + value |= LN2_OP_GPIO; I want the value to be in the lowest bit for this path. > > + > > + ret = lochnagar_pin_set_mux(priv, pin, value); > > + break; > > + case LN_PTYPE_GPIO: > > + if (pin->invert) > > + value = !value; And then I need to invert the value here. > > + > > + ret = regmap_update_bits(lochnagar->regmap, pin->reg, > > + 0x1 << pin->shift, > > BIT(pin->shift) > > > + value << pin->shift); > > Just value provided you used the construction above > to construct it. > All the other comments look good will fixup for the next spin. Thanks, Charles