linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] media: i2c: lm3560: use conservative defaults
@ 2018-05-06  8:02 Pavel Machek
  2018-07-16  9:08 ` [PATCH v2] " Pavel Machek
  0 siblings, 1 reply; 4+ messages in thread
From: Pavel Machek @ 2018-05-06  8:02 UTC (permalink / raw)
  To: kernel list, linux-arm-kernel, linux-omap, tony, sre, nekit1000,
	mpartap, merlijn, gshark.jeong, m.chehab, sakari.ailus,
	linux-media

[-- Attachment #1: Type: text/plain, Size: 1394 bytes --]


If no pdata is found, we should use lowest current settings, not highest.

Signed-off-by: Pavel Machek <pavel@ucw.cz>

diff --git a/drivers/media/i2c/lm3560.c b/drivers/media/i2c/lm3560.c
index b600e03a..c4e5ed5 100644
--- a/drivers/media/i2c/lm3560.c
+++ b/drivers/media/i2c/lm3560.c
@@ -420,14 +434,14 @@ static int lm3560_probe(struct i2c_client *client,
 		pdata = devm_kzalloc(&client->dev, sizeof(*pdata), GFP_KERNEL);
 		if (pdata == NULL)
 			return -ENODEV;
-		pdata->peak = LM3560_PEAK_3600mA;
-		pdata->max_flash_timeout = LM3560_FLASH_TOUT_MAX;
+		pdata->peak = LM3560_PEAK_1600mA;
+		pdata->max_flash_timeout = LM3560_FLASH_TOUT_MIN;
 		/* led 1 */
-		pdata->max_flash_brt[LM3560_LED0] = LM3560_FLASH_BRT_MAX;
-		pdata->max_torch_brt[LM3560_LED0] = LM3560_TORCH_BRT_MAX;
+		pdata->max_flash_brt[LM3560_LED0] = LM3560_FLASH_BRT_MIN;
+		pdata->max_torch_brt[LM3560_LED0] = LM3560_TORCH_BRT_MIN;
 		/* led 2 */
-		pdata->max_flash_brt[LM3560_LED1] = LM3560_FLASH_BRT_MAX;
-		pdata->max_torch_brt[LM3560_LED1] = LM3560_TORCH_BRT_MAX;
+		pdata->max_flash_brt[LM3560_LED1] = LM3560_FLASH_BRT_MIN;
+		pdata->max_torch_brt[LM3560_LED1] = LM3560_TORCH_BRT_MIN;
 	}
 	flash->pdata = pdata;
 	flash->dev = &client->dev;

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

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

* [PATCH v2] media: i2c: lm3560: use conservative defaults
  2018-05-06  8:02 [PATCH] media: i2c: lm3560: use conservative defaults Pavel Machek
@ 2018-07-16  9:08 ` Pavel Machek
  2018-08-11  6:10   ` Daniel Jeong
  0 siblings, 1 reply; 4+ messages in thread
From: Pavel Machek @ 2018-07-16  9:08 UTC (permalink / raw)
  To: kernel list, linux-arm-kernel, linux-omap, tony, sre, nekit1000,
	mpartap, merlijn, gshark.jeong, m.chehab, sakari.ailus,
	linux-media

[-- Attachment #1: Type: text/plain, Size: 1503 bytes --]

If no pdata is found, we should use lowest current settings, not highest.

Signed-off-by: Pavel Machek <pavel@ucw.cz>

---

v2: I got notification from patchwork that patch no longer applies, so
I'm rediffing the patch.

diff --git a/drivers/media/i2c/lm3560.c b/drivers/media/i2c/lm3560.c
index b600e03a..c4e5ed5 100644
--- a/drivers/media/i2c/lm3560.c
+++ b/drivers/media/i2c/lm3560.c
@@ -420,14 +434,14 @@ static int lm3560_probe(struct i2c_client *client,
 		pdata = devm_kzalloc(&client->dev, sizeof(*pdata), GFP_KERNEL);
 		if (pdata == NULL)
 			return -ENODEV;
-		pdata->peak = LM3560_PEAK_3600mA;
-		pdata->max_flash_timeout = LM3560_FLASH_TOUT_MAX;
+		pdata->peak = LM3560_PEAK_1600mA;
+		pdata->max_flash_timeout = LM3560_FLASH_TOUT_MIN;
 		/* led 1 */
-		pdata->max_flash_brt[LM3560_LED0] = LM3560_FLASH_BRT_MAX;
-		pdata->max_torch_brt[LM3560_LED0] = LM3560_TORCH_BRT_MAX;
+		pdata->max_flash_brt[LM3560_LED0] = LM3560_FLASH_BRT_MIN;
+		pdata->max_torch_brt[LM3560_LED0] = LM3560_TORCH_BRT_MIN;
 		/* led 2 */
-		pdata->max_flash_brt[LM3560_LED1] = LM3560_FLASH_BRT_MAX;
-		pdata->max_torch_brt[LM3560_LED1] = LM3560_TORCH_BRT_MAX;
+		pdata->max_flash_brt[LM3560_LED1] = LM3560_FLASH_BRT_MIN;
+		pdata->max_torch_brt[LM3560_LED1] = LM3560_TORCH_BRT_MIN;
 	}
 	flash->pdata = pdata;
 	flash->dev = &client->dev;



-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

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

* Re: [PATCH v2] media: i2c: lm3560: use conservative defaults
  2018-07-16  9:08 ` [PATCH v2] " Pavel Machek
@ 2018-08-11  6:10   ` Daniel Jeong
  2018-08-11  9:44     ` Andy Shevchenko
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Jeong @ 2018-08-11  6:10 UTC (permalink / raw)
  To: Pavel Machek, kernel list, linux-arm-kernel, linux-omap, tony,
	sre, nekit1000, mpartap, merlijn, m.chehab, sakari.ailus,
	linux-media

Hi Pavel,

I think if there is not exist pdata, it should be set to the value of power on reset (POR) to sync with the chip.

According to the LM3560 datasheet, Flash Timeout is 512ms, Flash current is 875mA and Torch Current is 93.75mA.

Daniel Jeong.

On 07/016/2018 18:08 PM, Pavel Machek wrote:

> If no pdata is found, we should use lowest current settings, not highest.
>
> Signed-off-by: Pavel Machek <pavel@ucw.cz>
>
> ---
>
> v2: I got notification from patchwork that patch no longer applies, so
> I'm rediffing the patch.
>
> diff --git a/drivers/media/i2c/lm3560.c b/drivers/media/i2c/lm3560.c
> index b600e03a..c4e5ed5 100644
> --- a/drivers/media/i2c/lm3560.c
> +++ b/drivers/media/i2c/lm3560.c
> @@ -420,14 +434,14 @@ static int lm3560_probe(struct i2c_client *client,
>   		pdata = devm_kzalloc(&client->dev, sizeof(*pdata), GFP_KERNEL);
>   		if (pdata == NULL)
>   			return -ENODEV;
> -		pdata->peak = LM3560_PEAK_3600mA;
> -		pdata->max_flash_timeout = LM3560_FLASH_TOUT_MAX;
> +		pdata->peak = LM3560_PEAK_1600mA;
> +		pdata->max_flash_timeout = LM3560_FLASH_TOUT_MIN;
>   		/* led 1 */
> -		pdata->max_flash_brt[LM3560_LED0] = LM3560_FLASH_BRT_MAX;
> -		pdata->max_torch_brt[LM3560_LED0] = LM3560_TORCH_BRT_MAX;
> +		pdata->max_flash_brt[LM3560_LED0] = LM3560_FLASH_BRT_MIN;
> +		pdata->max_torch_brt[LM3560_LED0] = LM3560_TORCH_BRT_MIN;
>   		/* led 2 */
> -		pdata->max_flash_brt[LM3560_LED1] = LM3560_FLASH_BRT_MAX;
> -		pdata->max_torch_brt[LM3560_LED1] = LM3560_TORCH_BRT_MAX;
> +		pdata->max_flash_brt[LM3560_LED1] = LM3560_FLASH_BRT_MIN;
> +		pdata->max_torch_brt[LM3560_LED1] = LM3560_TORCH_BRT_MIN;
>   	}
>   	flash->pdata = pdata;
>   	flash->dev = &client->dev;
>
>
>

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

* Re: [PATCH v2] media: i2c: lm3560: use conservative defaults
  2018-08-11  6:10   ` Daniel Jeong
@ 2018-08-11  9:44     ` Andy Shevchenko
  0 siblings, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2018-08-11  9:44 UTC (permalink / raw)
  To: Daniel Jeong
  Cc: Pavel Machek, kernel list, linux-arm-kernel,
	Linux OMAP Mailing List, Tony Lindgren, Sebastian Reichel,
	nekit1000, mpartap, merlijn, Mauro Carvalho Chehab, Sakari Ailus,
	Linux Media Mailing List

On Sat, Aug 11, 2018 at 9:10 AM, Daniel Jeong <gshark.jeong@gmail.com> wrote:
> Hi Pavel,
>
> I think if there is not exist pdata, it should be set to the value of power
> on reset (POR) to sync with the chip.
>
> According to the LM3560 datasheet, Flash Timeout is 512ms, Flash current is
> 875mA and Torch Current is 93.75mA.

Can't we simple read back?

-- 
With Best Regards,
Andy Shevchenko

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

end of thread, other threads:[~2018-08-11 12:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-06  8:02 [PATCH] media: i2c: lm3560: use conservative defaults Pavel Machek
2018-07-16  9:08 ` [PATCH v2] " Pavel Machek
2018-08-11  6:10   ` Daniel Jeong
2018-08-11  9:44     ` Andy Shevchenko

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).