diff mbox series

[U-Boot,v3,4/8] dm: pinctrl: Add pinctrl_decode_pin_config_dm().

Message ID 20181217133006.16208-5-christoph.muellner@theobroma-systems.com
State Superseded
Delegated to: Philipp Tomsich
Headers show
Series rk3399-puma: Enable PWM regulator for RK3399-Q7 | expand

Commit Message

Christoph Muellner Dec. 17, 2018, 1:30 p.m. UTC
pinctrl_decode_pin_config_dm() is basically a feature-equivalent
implementation of pinctrl_decode_pin_config(), which operates
on struct udevice devices and uses the dev_read_*() API.

Signed-off-by: Christoph Muellner <christoph.muellner@theobroma-systems.com>
---

Changes in v3: None
Changes in v2: None

 drivers/pinctrl/pinctrl-uclass.c | 15 +++++++++++++++
 include/dm/pinctrl.h             | 12 ++++++++++++
 2 files changed, 27 insertions(+)

Comments

Simon Glass Dec. 20, 2018, 9:16 p.m. UTC | #1
Hi Christoph,

On Mon, 17 Dec 2018 at 06:30, Christoph Muellner
<christoph.muellner@theobroma-systems.com> wrote:
>
> pinctrl_decode_pin_config_dm() is basically a feature-equivalent
> implementation of pinctrl_decode_pin_config(), which operates
> on struct udevice devices and uses the dev_read_*() API.

So is it possible to remove the old function and avoid the _dm suffix here?
>

> Signed-off-by: Christoph Muellner <christoph.muellner@theobroma-systems.com>
> ---
>
> Changes in v3: None
> Changes in v2: None
>
>  drivers/pinctrl/pinctrl-uclass.c | 15 +++++++++++++++
>  include/dm/pinctrl.h             | 12 ++++++++++++
>  2 files changed, 27 insertions(+)

Regards,
Simon
Philipp Tomsich Dec. 20, 2018, 9:22 p.m. UTC | #2
Simon,

> On 20.12.2018, at 22:16, Simon Glass <sjg@chromium.org> wrote:
> 
> Hi Christoph,
> 
> On Mon, 17 Dec 2018 at 06:30, Christoph Muellner
> <christoph.muellner@theobroma-systems.com> wrote:
>> 
>> pinctrl_decode_pin_config_dm() is basically a feature-equivalent
>> implementation of pinctrl_decode_pin_config(), which operates
>> on struct udevice devices and uses the dev_read_*() API.
> 
> So is it possible to remove the old function and avoid the _dm suffix here?

Assuming we get this sorted this week or over the weekend: would it be ok
with you if I pull this into the current cycle?

I would like to see the vdd_log fix for the RK3399-Q7 merged into 2019.1
before we go to the longer release cycles (as this will have to wait until 2019.4
otherwise) … especially, as my own insistence of doing it the right way
(i.e. using autoset for the regulator) has delayed this since before the 
merge-window closed.

Thanks,
Philipp.
Simon Glass Dec. 21, 2018, 9:16 p.m. UTC | #3
Hi Philipp,

On Thu, 20 Dec 2018 at 14:22, Philipp Tomsich
<philipp.tomsich@theobroma-systems.com> wrote:
>
> Simon,
>
> > On 20.12.2018, at 22:16, Simon Glass <sjg@chromium.org> wrote:
> >
> > Hi Christoph,
> >
> > On Mon, 17 Dec 2018 at 06:30, Christoph Muellner
> > <christoph.muellner@theobroma-systems.com> wrote:
> >>
> >> pinctrl_decode_pin_config_dm() is basically a feature-equivalent
> >> implementation of pinctrl_decode_pin_config(), which operates
> >> on struct udevice devices and uses the dev_read_*() API.
> >
> > So is it possible to remove the old function and avoid the _dm suffix here?
>
> Assuming we get this sorted this week or over the weekend: would it be ok
> with you if I pull this into the current cycle?

Yes, fine with me.

>
> I would like to see the vdd_log fix for the RK3399-Q7 merged into 2019.1
> before we go to the longer release cycles (as this will have to wait until 2019.4
> otherwise) … especially, as my own insistence of doing it the right way
> (i.e. using autoset for the regulator) has delayed this since before the
> merge-window closed.

Yes, I am not looking forward to the longer cycles.

>
> Thanks,
> Philipp.
>

Regards,
Simon
Christoph Muellner Dec. 25, 2018, 9:48 p.m. UTC | #4
On 12/20/18 10:16 PM, Simon Glass wrote:
> Hi Christoph,
> 
> On Mon, 17 Dec 2018 at 06:30, Christoph Muellner
> <christoph.muellner@theobroma-systems.com> wrote:
>>
>> pinctrl_decode_pin_config_dm() is basically a feature-equivalent
>> implementation of pinctrl_decode_pin_config(), which operates
>> on struct udevice devices and uses the dev_read_*() API.
> 
> So is it possible to remove the old function and avoid the _dm suffix here?

Seems like the right way to go for me.
But I don't have the option to test on devices, which
need this function (RK3188 and RK3288) and I don't want
to risk touching drivers, which I cannot test outside
of the regular merge window.

My plan was to do this early during the next merge window
(together with dropping the old RK3399 pinctrl driver and
the refactoring of the RK3399 pinctrl driver into a generic
RK pinctrl driver and a RK3399 mini-driver).

Acceptable?

Thank's,
Christoph


>>
> 
>> Signed-off-by: Christoph Muellner <christoph.muellner@theobroma-systems.com>
>> ---
>>
>> Changes in v3: None
>> Changes in v2: None
>>
>>  drivers/pinctrl/pinctrl-uclass.c | 15 +++++++++++++++
>>  include/dm/pinctrl.h             | 12 ++++++++++++
>>  2 files changed, 27 insertions(+)
> 
> Regards,
> Simon
>
Simon Glass Dec. 29, 2018, 1:39 p.m. UTC | #5
Hi Christoph,

On Tue, 25 Dec 2018 at 14:49, Christoph Müllner
<christoph.muellner@theobroma-systems.com> wrote:
>
> On 12/20/18 10:16 PM, Simon Glass wrote:
> > Hi Christoph,
> >
> > On Mon, 17 Dec 2018 at 06:30, Christoph Muellner
> > <christoph.muellner@theobroma-systems.com> wrote:
> >>
> >> pinctrl_decode_pin_config_dm() is basically a feature-equivalent
> >> implementation of pinctrl_decode_pin_config(), which operates
> >> on struct udevice devices and uses the dev_read_*() API.
> >
> > So is it possible to remove the old function and avoid the _dm suffix here?
>
> Seems like the right way to go for me.
> But I don't have the option to test on devices, which
> need this function (RK3188 and RK3288) and I don't want
> to risk touching drivers, which I cannot test outside
> of the regular merge window.
>
> My plan was to do this early during the next merge window
> (together with dropping the old RK3399 pinctrl driver and
> the refactoring of the RK3399 pinctrl driver into a generic
> RK pinctrl driver and a RK3399 mini-driver).
>
> Acceptable?

Yes that's fine with me. Could you add a comment saying that this
function is temporary for this release and will be removed in patches
by February?

Regards,
Simon
diff mbox series

Patch

diff --git a/drivers/pinctrl/pinctrl-uclass.c b/drivers/pinctrl/pinctrl-uclass.c
index 6db0445067..cebba12b4a 100644
--- a/drivers/pinctrl/pinctrl-uclass.c
+++ b/drivers/pinctrl/pinctrl-uclass.c
@@ -27,6 +27,21 @@  int pinctrl_decode_pin_config(const void *blob, int node)
 	return flags;
 }
 
+int pinctrl_decode_pin_config_dm(struct udevice *dev)
+{
+	int pinconfig = 0;
+
+	if (dev->uclass->uc_drv->id != UCLASS_PINCONFIG)
+		return -EINVAL;
+
+	if (dev_read_bool(dev, "bias-pull-up"))
+		pinconfig |= 1 << PIN_CONFIG_BIAS_PULL_UP;
+	else if (dev_read_bool(dev, "bias-pull-down"))
+		pinconfig |= 1 << PIN_CONFIG_BIAS_PULL_DOWN;
+
+	return pinconfig;
+}
+
 #if CONFIG_IS_ENABLED(PINCTRL_FULL)
 /**
  * pinctrl_config_one() - apply pinctrl settings for a single node
diff --git a/include/dm/pinctrl.h b/include/dm/pinctrl.h
index 63a7d55b88..ff2b82e7c2 100644
--- a/include/dm/pinctrl.h
+++ b/include/dm/pinctrl.h
@@ -355,6 +355,18 @@  int pinctrl_get_periph_id(struct udevice *dev, struct udevice *periph);
 int pinctrl_decode_pin_config(const void *blob, int node);
 
 /**
+ * pinctrl_decode_pin_config_dm() - decode pin configuration flags
+ *
+ * This decodes some of the PIN_CONFIG values into flags, with each value
+ * being (1 << pin_cfg). This does not support things with values like the
+ * slew rate.
+ *
+ * @pinconfig:	Pinconfig udevice
+ * @return decoded flag value, or -ve on error
+ */
+int pinctrl_decode_pin_config_dm(struct udevice *dev);
+
+/**
  * pinctrl_get_gpio_mux() - get the mux value for a particular GPIO
  *
  * This allows the raw mux value for a GPIO to be obtained. It is