linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: usb251xb: add boost-up property support
@ 2022-01-21 23:26 Tommaso Merciai
  2022-01-24  7:03 ` Richard Leitner - SKIDATA
  2022-01-28 15:31 ` Sergei Shtylyov
  0 siblings, 2 replies; 6+ messages in thread
From: Tommaso Merciai @ 2022-01-21 23:26 UTC (permalink / raw)
  Cc: tomm.merciai, linuxfancy, Richard Leitner, Greg Kroah-Hartman,
	linux-usb, linux-kernel

Add u8 property to support boost-up register of usb251xb hub.
boost-up property control USB electrical drive strenght
This register can be set:

 - Normal mode -> 0x00
 - Low         -> 0x01
 - Medium      -> 0x10
 - High        -> 0x11

(Normal Default)

References:
 - http://www.mouser.com/catalog/specsheets/2514.pdf p29

Signed-off-by: Tommaso Merciai <tomm.merciai@gmail.com>
---
 drivers/usb/misc/usb251xb.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/misc/usb251xb.c b/drivers/usb/misc/usb251xb.c
index 507deef1f709..74fd8ac0c303 100644
--- a/drivers/usb/misc/usb251xb.c
+++ b/drivers/usb/misc/usb251xb.c
@@ -402,6 +402,7 @@ static int usb251xb_get_ofdata(struct usb251xb *hub,
 	struct device_node *np = dev->of_node;
 	int len, err;
 	u32 property_u32 = 0;
+	u8 property_u8 = 0;
 	const char *cproperty_char;
 	char str[USB251XB_STRING_BUFSIZE / 2];
 
@@ -543,6 +544,12 @@ static int usb251xb_get_ofdata(struct usb251xb *hub,
 	if (of_property_read_u16_array(np, "language-id", &hub->lang_id, 1))
 		hub->lang_id = USB251XB_DEF_LANGUAGE_ID;
 
+	if (!of_property_read_u8(np, "boost-up", &property_u8)){
+		hub->boost_up = property_u8;
+	} else {
+		hub->boost_up = USB251XB_DEF_BOOST_UP;
+	}
+
 	cproperty_char = of_get_property(np, "manufacturer", NULL);
 	strlcpy(str, cproperty_char ? : USB251XB_DEF_MANUFACTURER_STRING,
 		sizeof(str));
@@ -584,7 +591,6 @@ static int usb251xb_get_ofdata(struct usb251xb *hub,
 	 * may be as soon as needed.
 	 */
 	hub->bat_charge_en = USB251XB_DEF_BATTERY_CHARGING_ENABLE;
-	hub->boost_up = USB251XB_DEF_BOOST_UP;
 	hub->boost_57 = USB251XB_DEF_BOOST_57;
 	hub->boost_14 = USB251XB_DEF_BOOST_14;
 	hub->port_map12 = USB251XB_DEF_PORT_MAP_12;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] usb: usb251xb: add boost-up property support
  2022-01-21 23:26 [PATCH] usb: usb251xb: add boost-up property support Tommaso Merciai
@ 2022-01-24  7:03 ` Richard Leitner - SKIDATA
  2022-01-25 21:42   ` Tommaso Merciai
  2022-01-28 15:31 ` Sergei Shtylyov
  1 sibling, 1 reply; 6+ messages in thread
From: Richard Leitner - SKIDATA @ 2022-01-24  7:03 UTC (permalink / raw)
  To: Tommaso Merciai
  Cc: linuxfancy, Greg Kroah-Hartman, linux-usb, linux-kernel, richard.leitner

Hi Tommaso,

thanks for implementing the boost up register.

On Sat, Jan 22, 2022 at 12:26:12AM +0100, Tommaso Merciai wrote:
> Add u8 property to support boost-up register of usb251xb hub.
> boost-up property control USB electrical drive strenght
> This register can be set:
> 
>  - Normal mode -> 0x00
>  - Low         -> 0x01
>  - Medium      -> 0x10
>  - High        -> 0x11
> 
> (Normal Default)
> 
> References:
>  - http://www.mouser.com/catalog/specsheets/2514.pdf p29
> 
> Signed-off-by: Tommaso Merciai <tomm.merciai@gmail.com>
> ---
>  drivers/usb/misc/usb251xb.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/misc/usb251xb.c b/drivers/usb/misc/usb251xb.c
> index 507deef1f709..74fd8ac0c303 100644
> --- a/drivers/usb/misc/usb251xb.c
> +++ b/drivers/usb/misc/usb251xb.c
> @@ -402,6 +402,7 @@ static int usb251xb_get_ofdata(struct usb251xb *hub,
>  	struct device_node *np = dev->of_node;
>  	int len, err;
>  	u32 property_u32 = 0;
> +	u8 property_u8 = 0;
>  	const char *cproperty_char;
>  	char str[USB251XB_STRING_BUFSIZE / 2];
>  
> @@ -543,6 +544,12 @@ static int usb251xb_get_ofdata(struct usb251xb *hub,
>  	if (of_property_read_u16_array(np, "language-id", &hub->lang_id, 1))
>  		hub->lang_id = USB251XB_DEF_LANGUAGE_ID;
>  
> +	if (!of_property_read_u8(np, "boost-up", &property_u8)){
> +		hub->boost_up = property_u8;

IMHO we don't need the property_u8 var here as you could pass
&hub->boost_up directly to of_property_read_u8() ?

regards;rl

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] usb: usb251xb: add boost-up property support
  2022-01-24  7:03 ` Richard Leitner - SKIDATA
@ 2022-01-25 21:42   ` Tommaso Merciai
  2022-01-26  7:08     ` Richard Leitner
  0 siblings, 1 reply; 6+ messages in thread
From: Tommaso Merciai @ 2022-01-25 21:42 UTC (permalink / raw)
  To: Richard Leitner - SKIDATA
  Cc: linuxfancy, Greg Kroah-Hartman, linux-usb, linux-kernel, richard.leitner

On Mon, Jan 24, 2022 at 07:03:57AM +0000, Richard Leitner - SKIDATA wrote:
> Hi Tommaso,
> 
> thanks for implementing the boost up register.
> 
> On Sat, Jan 22, 2022 at 12:26:12AM +0100, Tommaso Merciai wrote:
> > Add u8 property to support boost-up register of usb251xb hub.
> > boost-up property control USB electrical drive strenght
> > This register can be set:
> > 
> >  - Normal mode -> 0x00
> >  - Low         -> 0x01
> >  - Medium      -> 0x10
> >  - High        -> 0x11
> > 
> > (Normal Default)
> > 
> > References:
> >  - http://www.mouser.com/catalog/specsheets/2514.pdf p29
> > 
> > Signed-off-by: Tommaso Merciai <tomm.merciai@gmail.com>
> > ---
> >  drivers/usb/misc/usb251xb.c | 8 +++++++-
> >  1 file changed, 7 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/usb/misc/usb251xb.c b/drivers/usb/misc/usb251xb.c
> > index 507deef1f709..74fd8ac0c303 100644
> > --- a/drivers/usb/misc/usb251xb.c
> > +++ b/drivers/usb/misc/usb251xb.c
> > @@ -402,6 +402,7 @@ static int usb251xb_get_ofdata(struct usb251xb *hub,
> >  	struct device_node *np = dev->of_node;
> >  	int len, err;
> >  	u32 property_u32 = 0;
> > +	u8 property_u8 = 0;
> >  	const char *cproperty_char;
> >  	char str[USB251XB_STRING_BUFSIZE / 2];
> >  
> > @@ -543,6 +544,12 @@ static int usb251xb_get_ofdata(struct usb251xb *hub,
> >  	if (of_property_read_u16_array(np, "language-id", &hub->lang_id, 1))
> >  		hub->lang_id = USB251XB_DEF_LANGUAGE_ID;
> >  
> > +	if (!of_property_read_u8(np, "boost-up", &property_u8)){
> > +		hub->boost_up = property_u8;
> 
> IMHO we don't need the property_u8 var here as you could pass
> &hub->boost_up directly to of_property_read_u8() ?

Hi Richard,
Thanks for your reply. You mean like:

if (!of_property_read_u8(np, "boost-up", &hub->boost_up))

Let me know. I'll fix that in v2.

Thanks,
Tommaso
> 
> regards;rl

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] usb: usb251xb: add boost-up property support
  2022-01-25 21:42   ` Tommaso Merciai
@ 2022-01-26  7:08     ` Richard Leitner
  2022-01-27 17:53       ` Tommaso Merciai
  0 siblings, 1 reply; 6+ messages in thread
From: Richard Leitner @ 2022-01-26  7:08 UTC (permalink / raw)
  To: Tommaso Merciai
  Cc: Richard Leitner - SKIDATA, linuxfancy, Greg Kroah-Hartman,
	linux-usb, linux-kernel

On Tue, Jan 25, 2022 at 10:42:45PM +0100, Tommaso Merciai wrote:
> On Mon, Jan 24, 2022 at 07:03:57AM +0000, Richard Leitner - SKIDATA wrote:
> > On Sat, Jan 22, 2022 at 12:26:12AM +0100, Tommaso Merciai wrote:
> > >  
> > > +	if (!of_property_read_u8(np, "boost-up", &property_u8)){
> > > +		hub->boost_up = property_u8;
> > 
> > IMHO we don't need the property_u8 var here as you could pass
> > &hub->boost_up directly to of_property_read_u8() ?
> 
> Hi Richard,
> Thanks for your reply. You mean like:
> 
> if (!of_property_read_u8(np, "boost-up", &hub->boost_up))

exactly.

> 
> Let me know. I'll fix that in v2.
> 

great!

thanks & regards;rl

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] usb: usb251xb: add boost-up property support
  2022-01-26  7:08     ` Richard Leitner
@ 2022-01-27 17:53       ` Tommaso Merciai
  0 siblings, 0 replies; 6+ messages in thread
From: Tommaso Merciai @ 2022-01-27 17:53 UTC (permalink / raw)
  To: Richard Leitner
  Cc: Richard Leitner - SKIDATA, linuxfancy, Greg Kroah-Hartman,
	linux-usb, linux-kernel

On Wed, Jan 26, 2022 at 08:08:48AM +0100, Richard Leitner wrote:
> On Tue, Jan 25, 2022 at 10:42:45PM +0100, Tommaso Merciai wrote:
> > On Mon, Jan 24, 2022 at 07:03:57AM +0000, Richard Leitner - SKIDATA wrote:
> > > On Sat, Jan 22, 2022 at 12:26:12AM +0100, Tommaso Merciai wrote:
> > > >  
> > > > +	if (!of_property_read_u8(np, "boost-up", &property_u8)){
> > > > +		hub->boost_up = property_u8;
> > > 
> > > IMHO we don't need the property_u8 var here as you could pass
> > > &hub->boost_up directly to of_property_read_u8() ?
> > 
> > Hi Richard,
> > Thanks for your reply. You mean like:
> > 
> > if (!of_property_read_u8(np, "boost-up", &hub->boost_up))
> 
> exactly.

Thanks Richard,
I'll send v2.

Thanks,
Tommaso

> 
> > 
> > Let me know. I'll fix that in v2.
> > 
> 
> great!
> 
> thanks & regards;rl

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] usb: usb251xb: add boost-up property support
  2022-01-21 23:26 [PATCH] usb: usb251xb: add boost-up property support Tommaso Merciai
  2022-01-24  7:03 ` Richard Leitner - SKIDATA
@ 2022-01-28 15:31 ` Sergei Shtylyov
  1 sibling, 0 replies; 6+ messages in thread
From: Sergei Shtylyov @ 2022-01-28 15:31 UTC (permalink / raw)
  To: Tommaso Merciai
  Cc: linuxfancy, Richard Leitner, Greg Kroah-Hartman, linux-usb, linux-kernel

Hello!

On 1/22/22 2:26 AM, Tommaso Merciai wrote:

> Add u8 property to support boost-up register of usb251xb hub.
> boost-up property control USB electrical drive strenght

  Strength.

> This register can be set:
> 
>  - Normal mode -> 0x00
>  - Low         -> 0x01
>  - Medium      -> 0x10
>  - High        -> 0x11
> 
> (Normal Default)
> 
> References:
>  - http://www.mouser.com/catalog/specsheets/2514.pdf p29
> 
> Signed-off-by: Tommaso Merciai <tomm.merciai@gmail.com>
> ---
>  drivers/usb/misc/usb251xb.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/misc/usb251xb.c b/drivers/usb/misc/usb251xb.c
> index 507deef1f709..74fd8ac0c303 100644
> --- a/drivers/usb/misc/usb251xb.c
> +++ b/drivers/usb/misc/usb251xb.c
> @@ -543,6 +544,12 @@ static int usb251xb_get_ofdata(struct usb251xb *hub,
>  	if (of_property_read_u16_array(np, "language-id", &hub->lang_id, 1))
>  		hub->lang_id = USB251XB_DEF_LANGUAGE_ID;
>  
> +	if (!of_property_read_u8(np, "boost-up", &property_u8)){
> +		hub->boost_up = property_u8;
> +	} else {
> +		hub->boost_up = USB251XB_DEF_BOOST_UP;
> +	}

   No need for {} here at all.

[...]

MBR, Sergey

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-01-28 15:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-21 23:26 [PATCH] usb: usb251xb: add boost-up property support Tommaso Merciai
2022-01-24  7:03 ` Richard Leitner - SKIDATA
2022-01-25 21:42   ` Tommaso Merciai
2022-01-26  7:08     ` Richard Leitner
2022-01-27 17:53       ` Tommaso Merciai
2022-01-28 15:31 ` Sergei Shtylyov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).