Re: input_polldev interval (was Re: [sur40] Debugging a race condition)?

2015-03-27 Thread Florian Echtler
Hello Antonio,

On 26.03.2015 22:10, Antonio Ospite wrote:
 On Wed, 25 Mar 2015 15:10:44 +0100
 Florian Echtler f...@butterbrot.org wrote:

 Thanks - any other suggestions how to debug such a complete freeze? I
 have the following options enabled in my kernel config:

 Unfortunately, even after the system is frozen for several minutes, I
 never get to see a panic message. Maybe it's there on the console
 somewhere, but the screen never switches away from X (and as mentioned
 earlier, I think this bug can only be triggered from within X). Network
 also freezes, so I don't think netconsole will help?
 
 PSTORE + some EFI/ACPI mechanism, maybe?
 http://lwn.net/Articles/434821/
 
 However I have never tried that myself and I don't know if all the
 needed bits are in linux already.
 
 JFTR, on some embedded system I worked on in the past the RAM content
 was preserved across resets and, after a crash, we used to dump the RAM
 from a second stage bootloader (i.e. before lading another linux
 instance) and then scrape the dump to look for the kernel messages, but
 AFAIK this is not going to be reliable —or even possible— on a more
 complex system.

thanks for your suggestions - however, this is a regular x86 system, so
what I will try next is to reproduce the crash in a Virtualbox instance
with the SUR40 device routed to the guest using USB passthrough and the
serial console routed to the host. Hope this will give some clues.

One more general question: what are possible reasons for a complete
freeze? Only a spinlock being held with interrupts disabled, or are
there other possibilities?

Best, Florian
-- 
SENT FROM MY DEC VT50 TERMINAL



signature.asc
Description: OpenPGP digital signature


Re: RFC: New format V4L2_PIX_FMT_Y16_BE ?

2015-03-27 Thread Ricardo Ribalda Delgado
Hi Hans

On Thu, Mar 26, 2015 at 5:46 PM, Hans Verkuil hverk...@xs4all.nl wrote:

 Yes, but you might want to wait 1-2 weeks: I'm going to make a patch
 that moves the ENUMFMT description into the v4l2 core. So you want to be on
 top of that patch. I posted an RFC patch for that earlier (last week I
 think).

Absolutely no hurry.

My main worry is now this patch:

libv4lconvert: Fix support for Y16 pixel format
https://patchwork.linuxtv.org/patch/28989/

That fixes the implementation in v4lconvert. I introduced the original
bug and I don't want that anybody uses that library as a reference of
how the format should be.



Thanks!!



-- 
Ricardo Ribalda
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] add Android makefile for libv4l2 and libv4lconvert

2015-03-27 Thread Benjamin Gaignard
Hello,

On behalf of Paramanand, I would have to have your opinion on this patch.
The goal is to enable more v4l2 lib features on Android to be able to
do video decoding using v4l2 devices.

Regards,
Benjamin

commit 85f40dcc5248b5fb03464fe25fd2d1acb30f9722
Author: Paramanand SINGH paramanand.si...@linaro.org
Date:   Wed Mar 11 15:41:28 2015 +0530

libv4l2: Changes for compilation in Android 5.0

Added Android makefiles for libv4l2 and
libv4lconvert. Minor changes to include
android-config.h. Changed the plugin
loading mechanism to avoid using
unsupported glob.h header. Current mechanism
supports a list of plugin search paths
including /system/lib and /vendor/lib.

Signed-off-by: Paramanand Singh paramanand.si...@linaro.org

diff --git a/android-config.h b/android-config.h
index f474330..9f12b8f 100644
--- a/android-config.h
+++ b/android-config.h
@@ -1,3 +1,5 @@
+#ifndef __V4L_ANDROID_CONFIG_H__
+#define __V4L_ANDROID_CONFIG_H__
 /* config.h.  Generated from config.h.in by configure.  */
 /* config.h.in.  Generated from configure.ac by autoheader.  */

@@ -358,3 +360,4 @@ getsubopt (char **optionp, char *const *tokens,
char **valuep)

   return -1;
 }
+#endif
diff --git a/lib/Android.mk b/lib/Android.mk
new file mode 100644
index 000..2e43120
--- /dev/null
+++ b/lib/Android.mk
@@ -0,0 +1,4 @@
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/lib/libv4l2/Android.mk b/lib/libv4l2/Android.mk
new file mode 100644
index 000..7d723fb
--- /dev/null
+++ b/lib/libv4l2/Android.mk
@@ -0,0 +1,31 @@
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := \
+log.c \
+libv4l2.c \
+v4l2convert.c \
+v4l2-plugin-android.c
+
+LOCAL_CFLAGS += -Wno-missing-field-initializers
+LOCAL_CFLAGS += -Wno-sign-compare
+
+LOCAL_C_INCLUDES := \
+$(LOCAL_PATH)/../include \
+$(LOCAL_PATH)/../../include \
+$(LOCAL_PATH)/../.. \
+ $(TOP)/bionic/libc/upstream-openbsd/lib/libc/gen
+
+LOCAL_SHARED_LIBRARIES := \
+libutils \
+libcutils \
+libdl \
+libssl \
+libz
+
+LOCAL_STATIC_LIBRARIES := libv4l_convert
+LOCAL_MODULE := libv4l2
+LOCAL_MODULE_TAGS := optional
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/lib/libv4l2/libv4l2.c b/lib/libv4l2/libv4l2.c
index 966a000..70a6fd2 100644
--- a/lib/libv4l2/libv4l2.c
+++ b/lib/libv4l2/libv4l2.c
@@ -55,7 +55,11 @@
When modifications are made, one should be careful that this behavior is
preserved.
  */
+#ifdef ANDROID
+#include android-config.h
+#else
 #include config.h
+#endif
 #include errno.h
 #include stdarg.h
 #include stdio.h
diff --git a/lib/libv4l2/log.c b/lib/libv4l2/log.c
index d1042ed..9d3eab1 100644
--- a/lib/libv4l2/log.c
+++ b/lib/libv4l2/log.c
@@ -18,7 +18,11 @@
 # Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA  02110-1335  USA
  */

+#ifdef ANDROID
+#include android-config.h
+#else
 #include config.h
+#endif
 #include stdio.h
 #include stdlib.h
 #include string.h
diff --git a/lib/libv4l2/v4l2-plugin-android.c
b/lib/libv4l2/v4l2-plugin-android.c
new file mode 100644
index 000..af7f4ae
--- /dev/null
+++ b/lib/libv4l2/v4l2-plugin-android.c
@@ -0,0 +1,153 @@
+/*
+* Copyright (C) 2010 Nokia Corporation multime...@maemo.org
+
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License as published by
+* the Free Software Foundation; either version 2.1 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+#ifdef ANDROID
+#include android-config.h
+#else
+#include config.h
+#endif
+#include stdarg.h
+#include dlfcn.h
+#include fcntl.h
+#include glob.h
+#include sys/stat.h
+#include sys/mman.h
+#include sys/types.h
+#include dirent.h
+#include stdlib.h
+#include string.h
+#include libv4l2.h
+#include libv4l2-priv.h
+#include libv4l-plugin.h
+
+/* libv4l plugin support:
+   it is provided by functions v4l2_plugin_[open,close,etc].
+
+   When open() is called libv4l dlopens files in /usr/lib[64]/libv4l/plugins
+   1 at a time and call open callback passing through the applications
+   parameters unmodified.
+
+   If a plugin is relevant for the specified device node, it can indicate so
+   by returning a value other then -1 (the actual file descriptor).
+   As soon as a plugin returns another value then -1 plugin loading stops and
+   information about it (fd and corresponding library handle) is stored. For
+   each function 

Re: [PATCH 5/5] saa7164: Hauppauge HVR-2205 and HVR-2215 DVB-C/T/T2 tuners

2015-03-27 Thread Steven Toth
 The HVR-2215 is sold in Australia, it's not a prototype card:
 http://www.pccasegear.com/index.php?main_page=product_infoproducts_id=28385cPath=172

Thanks for the URL. I've ordered a card. I'll look into the gapped
clock. If it's not required on the HVR2205 (using 2168) then it
shouldn't be required for the HVR2215 (using 2168), but that's
speculation at this point.

I also have the hardware schematics so I'll check those when the board
arrives also.

Thanks for the heads up.

-- 
Steven Toth - Kernel Labs
http://www.kernellabs.com
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 5/5] saa7164: Hauppauge HVR-2205 and HVR-2215 DVB-C/T/T2 tuners

2015-03-27 Thread Steven Toth
 I did not require any 2168/2157 driver changes to make these devices
 work. (Antti please note).


 There seems to be only minor TS config change (which is not even needed if
 you set that bit to existing TS mode config value) for gapped/variable
 length TS clock (which is in my understanding to leave TS valid line
 unconnected).

Its not required for the HVR2205 or the HVR2255, these are the only
two models of the hardware shipping in production volumes to
customers. Any other cards were advanced prototypes, that's my
understanding.

I'm not suggesting the gapped clock 2168 patch isn't useful for other
bridges, you might want to pull Olli's patch for that, but its not
required for the HVR2205/2255 support.

-- 
Steven Toth - Kernel Labs
http://www.kernellabs.com
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[GIT PULL] Adding HVR2205/HVR2255 support / misc cleanup

2015-03-27 Thread Steven Toth
Mauro,

Thank you for taking care of the git.linuxtv.org ssh issues earlier this week.

Long awaited patches for the Hauppauge HVR2205 and HVR2255 in this patchset.
Along with a fix for the querycap warning being thrown on newer kernels.

Thanks,

- Steve

The following changes since commit 4708e452aa3109fc23e0c6b5a658ccc1b720dfa6:
  [media] saa7164: I2C improvements for upcoming HVR2255/2205 boards
(2015-03-23 14:37:32 -0400)


are available in the git repository at:
  git://git.linuxtv.org/stoth/media_tree.git saa7164-dev

for you to fetch changes up to f40a40d48a9cacefd900314984cce887ddc23142:
  [media] saa7164: Copyright update (2015-03-23 15:08:15 -0400)




Steven Toth (5):

  [media] saa7164: Adding additional I2C debug.
  [media] saa7164: Improvements for I2C handling
  [media] saa7164: Add Digital TV support for the HVR2255 and HVR2205
  [media] saa7164: Fixup recent querycap warnings
  [media] saa7164: Copyright update

 drivers/media/pci/saa7164/saa7164-api.c |  21 +++--
 drivers/media/pci/saa7164/saa7164-buffer.c  |   2 +-
 drivers/media/pci/saa7164/saa7164-bus.c |   2 +-
 drivers/media/pci/saa7164/saa7164-cards.c   | 188
+++-

 drivers/media/pci/saa7164/saa7164-cmd.c |   2 +-
 drivers/media/pci/saa7164/saa7164-core.c|   2 +-
 drivers/media/pci/saa7164/saa7164-dvb.c | 232
+++
 drivers/media/pci/saa7164/saa7164-encoder.c |   5 +-
 drivers/media/pci/saa7164/saa7164-fw.c  |   2 +-
 drivers/media/pci/saa7164/saa7164-i2c.c |   2 +-
 drivers/media/pci/saa7164/saa7164-reg.h |   2 +-
 drivers/media/pci/saa7164/saa7164-types.h   |   2 +-
 drivers/media/pci/saa7164/saa7164-vbi.c |   5 +-
 drivers/media/pci/saa7164/saa7164.h |   7 +-
 14 files changed, 440 insertions(+), 34 deletions(-)

-- 
Steven Toth - Kernel Labs
http://www.kernellabs.com
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/5] saa7164: Hauppauge HVR-2205 and HVR-2215 DVB-C/T/T2 tuners

2015-03-27 Thread Olli Salonen
Hauppauge HVR-2205 and HVR-2215 are PCIe dual tuner cards that support
DVB-C, DVB-T and DVB-T2.

PCIe bridge: SAA7164
Demodulator: Si2168-B40
Tuner: SI2157-A20

I know there's parallel activity ongoing regarding these devices, but I 
thought I'll submit my own version here as well. The maintainers of each 
module can then make the call what to merge.

Signed-off-by: Olli Salonen olli.salo...@iki.fi
---
 drivers/media/pci/saa7164/Kconfig |   2 +
 drivers/media/pci/saa7164/saa7164-cards.c | 101 ++
 drivers/media/pci/saa7164/saa7164-dvb.c   |  67 
 drivers/media/pci/saa7164/saa7164.h   |   2 +
 4 files changed, 172 insertions(+)

diff --git a/drivers/media/pci/saa7164/Kconfig 
b/drivers/media/pci/saa7164/Kconfig
index a53db7d..5ebe930 100644
--- a/drivers/media/pci/saa7164/Kconfig
+++ b/drivers/media/pci/saa7164/Kconfig
@@ -8,7 +8,9 @@ config VIDEO_SAA7164
select VIDEOBUF_DVB
select DVB_TDA10048 if MEDIA_SUBDRV_AUTOSELECT
select DVB_S5H1411 if MEDIA_SUBDRV_AUTOSELECT
+   select DVB_SI2168 if MEDIA_SUBDRV_AUTOSELECT
select MEDIA_TUNER_TDA18271 if MEDIA_SUBDRV_AUTOSELECT
+   select MEDIA_TUNER_SI2157 if MEDIA_SUBDRV_AUTOSELECT
---help---
  This is a video4linux driver for NXP SAA7164 based
  TV cards.
diff --git a/drivers/media/pci/saa7164/saa7164-cards.c 
b/drivers/media/pci/saa7164/saa7164-cards.c
index 5b72da5..5ebd312 100644
--- a/drivers/media/pci/saa7164/saa7164-cards.c
+++ b/drivers/media/pci/saa7164/saa7164-cards.c
@@ -499,6 +499,90 @@ struct saa7164_board saa7164_boards[] = {
.i2c_reg_len= REGLEN_8bit,
} },
},
+   [SAA7164_BOARD_HAUPPAUGE_HVR2205] = {
+   .name   = Hauppauge WinTV-HVR2205,
+   .porta  = SAA7164_MPEG_DVB,
+   .portb  = SAA7164_MPEG_DVB,
+   .chiprev= SAA7164_CHIP_REV3,
+   .unit = {{
+   .id = 0x28,
+   .type = SAA7164_UNIT_EEPROM,
+   .name = 4K EEPROM,
+   .i2c_bus_nr = SAA7164_I2C_BUS_0,
+   .i2c_bus_addr   = 0xa0  1,
+   .i2c_reg_len= REGLEN_8bit,
+   }, {
+   .id = 0x04,
+   .type   = SAA7164_UNIT_TUNER,
+   .name   = SI2157-1,
+   .i2c_bus_nr = SAA7164_I2C_BUS_1,
+   .i2c_bus_addr   = 0xc0  1,
+   .i2c_reg_len= 0,
+   }, {
+   .id = 0x05,
+   .type   = SAA7164_UNIT_DIGITAL_DEMODULATOR,
+   .name   = SI2168-1,
+   .i2c_bus_nr = SAA7164_I2C_BUS_1,
+   .i2c_bus_addr   = 0xc8  1,
+   .i2c_reg_len= 0,
+   }, {
+   .id = 0x25,
+   .type   = SAA7164_UNIT_TUNER,
+   .name   = SI2157-2,
+   .i2c_bus_nr = SAA7164_I2C_BUS_2,
+   .i2c_bus_addr   = 0xc0  1,
+   .i2c_reg_len= 0,
+   }, {
+   .id = 0x26,
+   .type   = SAA7164_UNIT_DIGITAL_DEMODULATOR,
+   .name   = SI2168-2,
+   .i2c_bus_nr = SAA7164_I2C_BUS_2,
+   .i2c_bus_addr   = 0xcc  1,
+   .i2c_reg_len= 0,
+   } },
+   },
+   [SAA7164_BOARD_HAUPPAUGE_HVR2215] = {
+   .name   = Hauppauge WinTV-HVR2215,
+   .porta  = SAA7164_MPEG_DVB,
+   .portb  = SAA7164_MPEG_DVB,
+   .chiprev= SAA7164_CHIP_REV3,
+   .unit = {{
+   .id = 0x28,
+   .type = SAA7164_UNIT_EEPROM,
+   .name = 4K EEPROM,
+   .i2c_bus_nr = SAA7164_I2C_BUS_0,
+   .i2c_bus_addr   = 0xa0  1,
+   .i2c_reg_len= REGLEN_8bit,
+   }, {
+   .id = 0x04,
+   .type   = SAA7164_UNIT_TUNER,
+   .name   = SI2157-1,
+   .i2c_bus_nr = SAA7164_I2C_BUS_1,
+   .i2c_bus_addr   = 0xc0  1,
+   .i2c_reg_len= 0,
+   }, {
+   .id = 0x05,
+   .type   = SAA7164_UNIT_DIGITAL_DEMODULATOR,
+   .name   = SI2168-1,
+   .i2c_bus_nr = SAA7164_I2C_BUS_1,
+   .i2c_bus_addr   = 0xc8  1,
+   .i2c_reg_len  

[PATCH 3/5] saa7164: store i2c_client for demod and tuner in state

2015-03-27 Thread Olli Salonen
In order to support demodulators and tuners that have their drivers
implemented as I2C drivers, the i2c_client should be stored in state for
both.

Signed-off-by: Olli Salonen olli.salo...@iki.fi
---
 drivers/media/pci/saa7164/saa7164-dvb.c | 16 
 drivers/media/pci/saa7164/saa7164.h |  3 +++
 2 files changed, 19 insertions(+)

diff --git a/drivers/media/pci/saa7164/saa7164-dvb.c 
b/drivers/media/pci/saa7164/saa7164-dvb.c
index 16ae715..6b9e8f6 100644
--- a/drivers/media/pci/saa7164/saa7164-dvb.c
+++ b/drivers/media/pci/saa7164/saa7164-dvb.c
@@ -425,6 +425,7 @@ int saa7164_dvb_unregister(struct saa7164_port *port)
struct saa7164_dev *dev = port-dev;
struct saa7164_buffer *b;
struct list_head *c, *n;
+   struct i2c_client *client;
 
dprintk(DBGLVL_DVB, %s()\n, __func__);
 
@@ -451,6 +452,21 @@ int saa7164_dvb_unregister(struct saa7164_port *port)
dvb_unregister_frontend(dvb-frontend);
dvb_frontend_detach(dvb-frontend);
dvb_unregister_adapter(dvb-adapter);
+
+   /* remove I2C client for tuner */
+   client = port-i2c_client_tuner;
+   if (client) {
+   module_put(client-dev.driver-owner);
+   i2c_unregister_device(client);
+   }
+
+   /* remove I2C client for demodulator */
+   client = port-i2c_client_demod;
+   if (client) {
+   module_put(client-dev.driver-owner);
+   i2c_unregister_device(client);
+   }
+
return 0;
 }
 
diff --git a/drivers/media/pci/saa7164/saa7164.h 
b/drivers/media/pci/saa7164/saa7164.h
index cd1a07c..37e450a 100644
--- a/drivers/media/pci/saa7164/saa7164.h
+++ b/drivers/media/pci/saa7164/saa7164.h
@@ -422,6 +422,9 @@ struct saa7164_port {
u8 last_v_cc;
u8 last_a_cc;
u32 done_first_interrupt;
+
+   struct i2c_client *i2c_client_demod;
+   struct i2c_client *i2c_client_tuner;
 };
 
 struct saa7164_dev {
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/5] dvbsky: use si2168 config option ts_clock_gapped

2015-03-27 Thread Olli Salonen
Change the dvbsky driver to support gapped clock instead of the current
hack.

Signed-off-by: Olli Salonen olli.salo...@iki.fi
---
 drivers/media/usb/dvb-usb-v2/dvbsky.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/media/usb/dvb-usb-v2/dvbsky.c 
b/drivers/media/usb/dvb-usb-v2/dvbsky.c
index 9b5add4..a8495cd 100644
--- a/drivers/media/usb/dvb-usb-v2/dvbsky.c
+++ b/drivers/media/usb/dvb-usb-v2/dvbsky.c
@@ -619,7 +619,8 @@ static int dvbsky_t330_attach(struct dvb_usb_adapter *adap)
memset(si2168_config, 0, sizeof(si2168_config));
si2168_config.i2c_adapter = i2c_adapter;
si2168_config.fe = adap-fe[0];
-   si2168_config.ts_mode = SI2168_TS_PARALLEL | 0x40;
+   si2168_config.ts_mode = SI2168_TS_PARALLEL;
+   si2168_config.ts_clock_gapped = true;
memset(info, 0, sizeof(struct i2c_board_info));
strlcpy(info.type, si2168, I2C_NAME_SIZE);
info.addr = 0x64;
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/5] saa7164: add support for i2c read

2015-03-27 Thread Olli Salonen
Add support for pure I2C reads. Needed by si2157 tuner driver.

Signed-off-by: Olli Salonen olli.salo...@iki.fi
---
 drivers/media/pci/saa7164/saa7164-i2c.c | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/media/pci/saa7164/saa7164-i2c.c 
b/drivers/media/pci/saa7164/saa7164-i2c.c
index 4f7e3b4..e30e206 100644
--- a/drivers/media/pci/saa7164/saa7164-i2c.c
+++ b/drivers/media/pci/saa7164/saa7164-i2c.c
@@ -39,9 +39,12 @@ static int i2c_xfer(struct i2c_adapter *i2c_adap, struct 
i2c_msg *msgs, int num)
dprintk(DBGLVL_I2C, %s(num = %d) addr = 0x%02x  len = 0x%x\n,
__func__, num, msgs[i].addr, msgs[i].len);
if (msgs[i].flags  I2C_M_RD) {
-   /* Unsupported - Yet*/
-   printk(KERN_ERR %s() Unsupported - Yet\n, __func__);
-   continue;
+   /* dummy write before read */
+   retval = saa7164_api_i2c_read(bus, msgs[i].addr,
+   0, NULL, msgs[i].len, msgs[i].buf);
+
+   if (retval  0)
+   goto err;
} else if (i + 1  num  (msgs[i + 1].flags  I2C_M_RD) 
   msgs[i].addr == msgs[i + 1].addr) {
/* write then read from same address */
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/5] si2168: add support for gapped clock

2015-03-27 Thread Olli Salonen
Add a parameter in si2168_config to support gapped clock.

Signed-off-by: Olli Salonen olli.salo...@iki.fi
---
 drivers/media/dvb-frontends/si2168.c  | 3 +++
 drivers/media/dvb-frontends/si2168.h  | 3 +++
 drivers/media/dvb-frontends/si2168_priv.h | 1 +
 3 files changed, 7 insertions(+)

diff --git a/drivers/media/dvb-frontends/si2168.c 
b/drivers/media/dvb-frontends/si2168.c
index 5db588e..29a5936 100644
--- a/drivers/media/dvb-frontends/si2168.c
+++ b/drivers/media/dvb-frontends/si2168.c
@@ -508,6 +508,8 @@ static int si2168_init(struct dvb_frontend *fe)
/* set ts mode */
memcpy(cmd.args, \x14\x00\x01\x10\x10\x00, 6);
cmd.args[4] |= dev-ts_mode;
+   if (dev-ts_clock_gapped)
+   cmd.args[4] |= 0x40;
cmd.wlen = 6;
cmd.rlen = 4;
ret = si2168_cmd_execute(client, cmd);
@@ -688,6 +690,7 @@ static int si2168_probe(struct i2c_client *client,
*config-fe = dev-fe;
dev-ts_mode = config-ts_mode;
dev-ts_clock_inv = config-ts_clock_inv;
+   dev-ts_clock_gapped = config-ts_clock_gapped;
dev-fw_loaded = false;
 
i2c_set_clientdata(client, dev);
diff --git a/drivers/media/dvb-frontends/si2168.h 
b/drivers/media/dvb-frontends/si2168.h
index 70d702a..3225d0c 100644
--- a/drivers/media/dvb-frontends/si2168.h
+++ b/drivers/media/dvb-frontends/si2168.h
@@ -42,6 +42,9 @@ struct si2168_config {
 
/* TS clock inverted */
bool ts_clock_inv;
+
+   /* TS clock gapped */
+   bool ts_clock_gapped;
 };
 
 #endif
diff --git a/drivers/media/dvb-frontends/si2168_priv.h 
b/drivers/media/dvb-frontends/si2168_priv.h
index aadd136..953af7b 100644
--- a/drivers/media/dvb-frontends/si2168_priv.h
+++ b/drivers/media/dvb-frontends/si2168_priv.h
@@ -38,6 +38,7 @@ struct si2168_dev {
bool fw_loaded;
u8 ts_mode;
bool ts_clock_inv;
+   bool ts_clock_gapped;
 };
 
 /* firmare command struct */
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 5/5] saa7164: Hauppauge HVR-2205 and HVR-2215 DVB-C/T/T2 tuners

2015-03-27 Thread Steven Toth
 I know there's parallel activity ongoing regarding these devices, but I
 thought I'll submit my own version here as well. The maintainers of each
 module can then make the call what to merge.

http://git.linuxtv.org/cgit.cgi/stoth/media_tree.git/log/?h=saa7164-dev

As mentioned previously, I've added support for the HVR2205 and
HVR2255. I moved those patches from bitbucket.org into linuxtv.org a
couple of days ago pending a pull request. It took a couple of days to
get my git.linuxtv.org account back up and running.

You've seen and commented on the patches when they were in bitbucket
earlier this week, so your need to push our your own patches only
confuses and concerns me.

I did not require any 2168/2157 driver changes to make these devices
work. (Antti please note).

I plan to issue a pull request for my tree shortly.

- Steve

-- 
Steven Toth - Kernel Labs
http://www.kernellabs.com
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 5/5] saa7164: Hauppauge HVR-2205 and HVR-2215 DVB-C/T/T2 tuners

2015-03-27 Thread Olli Salonen
Hi,

Feel free to ignore the patches I sent. Just thought that since I made
the work to get the devices working anyway I'll post my code in case
someone can benefit from that somehow.

The HVR-2215 is sold in Australia, it's not a prototype card:
http://www.pccasegear.com/index.php?main_page=product_infoproducts_id=28385cPath=172

I also know a user in AU who has tested my code with HVR-2215 and it works ok.

My understanding is that the Windows driver does set the gapped clock,
the below is from Hauppauge's own Windows driver INF files for
HVR-2205 (I assume the parameters pointing to Si2164 apply also to
Si2168):

;gapped clock
HKR,Parameters,Si2164_ts_clk_gapped_en,0x00010001, 1

However, it is true that the device seems to work with or without this
setting. That was the case with TechnoTrend CT2-4400 earlier as well.
Only when TT made another version of the same device (with the same
USB IDs etc.) it stopped working and the change was necessary.

Cheers,
-olli


On 27 March 2015 at 14:08, Steven Toth st...@kernellabs.com wrote:
 I know there's parallel activity ongoing regarding these devices, but I
 thought I'll submit my own version here as well. The maintainers of each
 module can then make the call what to merge.

 http://git.linuxtv.org/cgit.cgi/stoth/media_tree.git/log/?h=saa7164-dev

 As mentioned previously, I've added support for the HVR2205 and
 HVR2255. I moved those patches from bitbucket.org into linuxtv.org a
 couple of days ago pending a pull request. It took a couple of days to
 get my git.linuxtv.org account back up and running.

 You've seen and commented on the patches when they were in bitbucket
 earlier this week, so your need to push our your own patches only
 confuses and concerns me.

 I did not require any 2168/2157 driver changes to make these devices
 work. (Antti please note).

 I plan to issue a pull request for my tree shortly.

 - Steve

 --
 Steven Toth - Kernel Labs
 http://www.kernellabs.com
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 5/5] saa7164: Hauppauge HVR-2205 and HVR-2215 DVB-C/T/T2 tuners

2015-03-27 Thread Antti Palosaari

On 03/27/2015 02:08 PM, Steven Toth wrote:

I know there's parallel activity ongoing regarding these devices, but I
thought I'll submit my own version here as well. The maintainers of each
module can then make the call what to merge.


http://git.linuxtv.org/cgit.cgi/stoth/media_tree.git/log/?h=saa7164-dev

As mentioned previously, I've added support for the HVR2205 and
HVR2255. I moved those patches from bitbucket.org into linuxtv.org a
couple of days ago pending a pull request. It took a couple of days to
get my git.linuxtv.org account back up and running.

You've seen and commented on the patches when they were in bitbucket
earlier this week, so your need to push our your own patches only
confuses and concerns me.

I did not require any 2168/2157 driver changes to make these devices
work. (Antti please note).


There seems to be only minor TS config change (which is not even needed 
if you set that bit to existing TS mode config value) for 
gapped/variable length TS clock (which is in my understanding to leave 
TS valid line unconnected).



I plan to issue a pull request for my tree shortly.

- Steve



Antti
--
http://palosaari.fi/
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] libv4lconvert: Fix support for Y16 pixel format

2015-03-27 Thread Hans de Goede

Hi,

On 26-03-15 17:17, Ricardo Ribalda Delgado wrote:

Y16 is a little-endian format. The original implementation assumed that
it was big-endian.

Signed-off-by: Ricardo Ribalda Delgado ricardo.riba...@gmail.com


Thanks merged upstream, both into master and stable-1.6 branches.

Regards,

Hans


---
  lib/libv4lconvert/rgbyuv.c | 5 +
  1 file changed, 5 insertions(+)

diff --git a/lib/libv4lconvert/rgbyuv.c b/lib/libv4lconvert/rgbyuv.c
index 0f30192..75c42aa 100644
--- a/lib/libv4lconvert/rgbyuv.c
+++ b/lib/libv4lconvert/rgbyuv.c
@@ -591,6 +591,9 @@ void v4lconvert_y16_to_rgb24(const unsigned char *src, 
unsigned char *dest,
int width, int height)
  {
int j;
+
+   src++; /*Y16 is little endian*/
+
while (--height = 0) {
for (j = 0; j  width; j++) {
*dest++ = *src;
@@ -606,6 +609,8 @@ void v4lconvert_y16_to_yuv420(const unsigned char *src, 
unsigned char *dest,
  {
int x, y;

+   src++; /*Y16 is little endian*/
+
/* Y */
for (y = 0; y  src_fmt-fmt.pix.height; y++)
for (x = 0; x  src_fmt-fmt.pix.width; x++){


--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] add Android makefile for libv4l2 and libv4lconvert

2015-03-27 Thread Benjamin Gaignard
Yes we would like to have it merge upstream :-)

2015-03-27 14:37 GMT+01:00 Hans de Goede hdego...@redhat.com:
 Hi,

 On 27-03-15 09:29, Benjamin Gaignard wrote:

 Hello,

 On behalf of Paramanand, I would have to have your opinion on this patch.
 The goal is to enable more v4l2 lib features on Android to be able to
 do video decoding using v4l2 devices.


 This looks fine to me, you say that
 I would have to have your opinion on this patch.

 So I've not merged it yet, let me know if you want to have this patch merged
 upstream.

 Regards,

 Hans





 Regards,
 Benjamin

 commit 85f40dcc5248b5fb03464fe25fd2d1acb30f9722
 Author: Paramanand SINGH paramanand.si...@linaro.org
 Date:   Wed Mar 11 15:41:28 2015 +0530

  libv4l2: Changes for compilation in Android 5.0

  Added Android makefiles for libv4l2 and
  libv4lconvert. Minor changes to include
  android-config.h. Changed the plugin
  loading mechanism to avoid using
  unsupported glob.h header. Current mechanism
  supports a list of plugin search paths
  including /system/lib and /vendor/lib.

  Signed-off-by: Paramanand Singh paramanand.si...@linaro.org

 diff --git a/android-config.h b/android-config.h
 index f474330..9f12b8f 100644
 --- a/android-config.h
 +++ b/android-config.h
 @@ -1,3 +1,5 @@
 +#ifndef __V4L_ANDROID_CONFIG_H__
 +#define __V4L_ANDROID_CONFIG_H__
   /* config.h.  Generated from config.h.in by configure.  */
   /* config.h.in.  Generated from configure.ac by autoheader.  */

 @@ -358,3 +360,4 @@ getsubopt (char **optionp, char *const *tokens,
 char **valuep)

 return -1;
   }
 +#endif
 diff --git a/lib/Android.mk b/lib/Android.mk
 new file mode 100644
 index 000..2e43120
 --- /dev/null
 +++ b/lib/Android.mk
 @@ -0,0 +1,4 @@
 +LOCAL_PATH:= $(call my-dir)
 +include $(CLEAR_VARS)
 +
 +include $(call all-makefiles-under,$(LOCAL_PATH))
 diff --git a/lib/libv4l2/Android.mk b/lib/libv4l2/Android.mk
 new file mode 100644
 index 000..7d723fb
 --- /dev/null
 +++ b/lib/libv4l2/Android.mk
 @@ -0,0 +1,31 @@
 +LOCAL_PATH:= $(call my-dir)
 +
 +include $(CLEAR_VARS)
 +
 +LOCAL_SRC_FILES := \
 +log.c \
 +libv4l2.c \
 +v4l2convert.c \
 +v4l2-plugin-android.c
 +
 +LOCAL_CFLAGS += -Wno-missing-field-initializers
 +LOCAL_CFLAGS += -Wno-sign-compare
 +
 +LOCAL_C_INCLUDES := \
 +$(LOCAL_PATH)/../include \
 +$(LOCAL_PATH)/../../include \
 +$(LOCAL_PATH)/../.. \
 + $(TOP)/bionic/libc/upstream-openbsd/lib/libc/gen
 +
 +LOCAL_SHARED_LIBRARIES := \
 +libutils \
 +libcutils \
 +libdl \
 +libssl \
 +libz
 +
 +LOCAL_STATIC_LIBRARIES := libv4l_convert
 +LOCAL_MODULE := libv4l2
 +LOCAL_MODULE_TAGS := optional
 +
 +include $(BUILD_SHARED_LIBRARY)
 diff --git a/lib/libv4l2/libv4l2.c b/lib/libv4l2/libv4l2.c
 index 966a000..70a6fd2 100644
 --- a/lib/libv4l2/libv4l2.c
 +++ b/lib/libv4l2/libv4l2.c
 @@ -55,7 +55,11 @@
  When modifications are made, one should be careful that this behavior
 is
  preserved.
*/
 +#ifdef ANDROID
 +#include android-config.h
 +#else
   #include config.h
 +#endif
   #include errno.h
   #include stdarg.h
   #include stdio.h
 diff --git a/lib/libv4l2/log.c b/lib/libv4l2/log.c
 index d1042ed..9d3eab1 100644
 --- a/lib/libv4l2/log.c
 +++ b/lib/libv4l2/log.c
 @@ -18,7 +18,11 @@
   # Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA
 02110-1335  USA
*/

 +#ifdef ANDROID
 +#include android-config.h
 +#else
   #include config.h
 +#endif
   #include stdio.h
   #include stdlib.h
   #include string.h
 diff --git a/lib/libv4l2/v4l2-plugin-android.c
 b/lib/libv4l2/v4l2-plugin-android.c
 new file mode 100644
 index 000..af7f4ae
 --- /dev/null
 +++ b/lib/libv4l2/v4l2-plugin-android.c
 @@ -0,0 +1,153 @@
 +/*
 +* Copyright (C) 2010 Nokia Corporation multime...@maemo.org
 +
 +* This program is free software; you can redistribute it and/or modify
 +* it under the terms of the GNU Lesser General Public License as
 published by
 +* the Free Software Foundation; either version 2.1 of the License, or
 +* (at your option) any later version.
 +*
 +* This program is distributed in the hope that it will be useful,
 +* but WITHOUT ANY WARRANTY; without even the implied warranty of
 +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 +* Lesser General Public License for more details.
 +*
 +* You should have received a copy of the GNU Lesser General Public
 License
 +* along with this program; if not, write to the Free Software
 +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
 USA
 +*/
 +
 +#ifdef ANDROID
 +#include android-config.h
 +#else
 +#include config.h
 +#endif
 +#include stdarg.h
 +#include dlfcn.h
 +#include fcntl.h
 +#include glob.h
 +#include sys/stat.h
 +#include sys/mman.h
 +#include sys/types.h
 +#include dirent.h
 +#include stdlib.h
 +#include string.h
 +#include libv4l2.h
 +#include libv4l2-priv.h
 +#include libv4l-plugin.h
 +
 +/* libv4l plugin support:
 +   it is provided by functions 

Re: [PATCH] add Android makefile for libv4l2 and libv4lconvert

2015-03-27 Thread Hans de Goede

Hi,

On 27-03-15 09:29, Benjamin Gaignard wrote:

Hello,

On behalf of Paramanand, I would have to have your opinion on this patch.
The goal is to enable more v4l2 lib features on Android to be able to
do video decoding using v4l2 devices.


This looks fine to me, you say that
I would have to have your opinion on this patch.

So I've not merged it yet, let me know if you want to have this patch merged
upstream.

Regards,

Hans






Regards,
Benjamin

commit 85f40dcc5248b5fb03464fe25fd2d1acb30f9722
Author: Paramanand SINGH paramanand.si...@linaro.org
Date:   Wed Mar 11 15:41:28 2015 +0530

 libv4l2: Changes for compilation in Android 5.0

 Added Android makefiles for libv4l2 and
 libv4lconvert. Minor changes to include
 android-config.h. Changed the plugin
 loading mechanism to avoid using
 unsupported glob.h header. Current mechanism
 supports a list of plugin search paths
 including /system/lib and /vendor/lib.

 Signed-off-by: Paramanand Singh paramanand.si...@linaro.org

diff --git a/android-config.h b/android-config.h
index f474330..9f12b8f 100644
--- a/android-config.h
+++ b/android-config.h
@@ -1,3 +1,5 @@
+#ifndef __V4L_ANDROID_CONFIG_H__
+#define __V4L_ANDROID_CONFIG_H__
  /* config.h.  Generated from config.h.in by configure.  */
  /* config.h.in.  Generated from configure.ac by autoheader.  */

@@ -358,3 +360,4 @@ getsubopt (char **optionp, char *const *tokens,
char **valuep)

return -1;
  }
+#endif
diff --git a/lib/Android.mk b/lib/Android.mk
new file mode 100644
index 000..2e43120
--- /dev/null
+++ b/lib/Android.mk
@@ -0,0 +1,4 @@
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/lib/libv4l2/Android.mk b/lib/libv4l2/Android.mk
new file mode 100644
index 000..7d723fb
--- /dev/null
+++ b/lib/libv4l2/Android.mk
@@ -0,0 +1,31 @@
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := \
+log.c \
+libv4l2.c \
+v4l2convert.c \
+v4l2-plugin-android.c
+
+LOCAL_CFLAGS += -Wno-missing-field-initializers
+LOCAL_CFLAGS += -Wno-sign-compare
+
+LOCAL_C_INCLUDES := \
+$(LOCAL_PATH)/../include \
+$(LOCAL_PATH)/../../include \
+$(LOCAL_PATH)/../.. \
+ $(TOP)/bionic/libc/upstream-openbsd/lib/libc/gen
+
+LOCAL_SHARED_LIBRARIES := \
+libutils \
+libcutils \
+libdl \
+libssl \
+libz
+
+LOCAL_STATIC_LIBRARIES := libv4l_convert
+LOCAL_MODULE := libv4l2
+LOCAL_MODULE_TAGS := optional
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/lib/libv4l2/libv4l2.c b/lib/libv4l2/libv4l2.c
index 966a000..70a6fd2 100644
--- a/lib/libv4l2/libv4l2.c
+++ b/lib/libv4l2/libv4l2.c
@@ -55,7 +55,11 @@
 When modifications are made, one should be careful that this behavior is
 preserved.
   */
+#ifdef ANDROID
+#include android-config.h
+#else
  #include config.h
+#endif
  #include errno.h
  #include stdarg.h
  #include stdio.h
diff --git a/lib/libv4l2/log.c b/lib/libv4l2/log.c
index d1042ed..9d3eab1 100644
--- a/lib/libv4l2/log.c
+++ b/lib/libv4l2/log.c
@@ -18,7 +18,11 @@
  # Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA  02110-1335  USA
   */

+#ifdef ANDROID
+#include android-config.h
+#else
  #include config.h
+#endif
  #include stdio.h
  #include stdlib.h
  #include string.h
diff --git a/lib/libv4l2/v4l2-plugin-android.c
b/lib/libv4l2/v4l2-plugin-android.c
new file mode 100644
index 000..af7f4ae
--- /dev/null
+++ b/lib/libv4l2/v4l2-plugin-android.c
@@ -0,0 +1,153 @@
+/*
+* Copyright (C) 2010 Nokia Corporation multime...@maemo.org
+
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License as published by
+* the Free Software Foundation; either version 2.1 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+#ifdef ANDROID
+#include android-config.h
+#else
+#include config.h
+#endif
+#include stdarg.h
+#include dlfcn.h
+#include fcntl.h
+#include glob.h
+#include sys/stat.h
+#include sys/mman.h
+#include sys/types.h
+#include dirent.h
+#include stdlib.h
+#include string.h
+#include libv4l2.h
+#include libv4l2-priv.h
+#include libv4l-plugin.h
+
+/* libv4l plugin support:
+   it is provided by functions v4l2_plugin_[open,close,etc].
+
+   When open() is called libv4l dlopens files in /usr/lib[64]/libv4l/plugins
+   1 at a time and call open callback passing through the applications
+   parameters unmodified.
+
+   If a plugin is relevant for the specified device node, it can 

[PATCH v2 05/11] leds: Add driver for AAT1290 flash LED controller

2015-03-27 Thread Jacek Anaszewski
This patch adds a driver for the 1.5A Step-Up Current Regulator
for Flash LEDs. The device is programmed through a Skyworks proprietary
AS2Cwire serial digital interface.

Signed-off-by: Jacek Anaszewski j.anaszew...@samsung.com
Acked-by: Kyungmin Park kyungmin.p...@samsung.com
Cc: Bryan Wu coolo...@gmail.com
Cc: Richard Purdie rpur...@rpsys.net
---
 drivers/leds/Kconfig|8 +
 drivers/leds/Makefile   |1 +
 drivers/leds/leds-aat1290.c |  372 +++
 3 files changed, 381 insertions(+)
 create mode 100644 drivers/leds/leds-aat1290.c

diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
index f9fbeb5..c3b5b027 100644
--- a/drivers/leds/Kconfig
+++ b/drivers/leds/Kconfig
@@ -42,6 +42,14 @@ config LEDS_88PM860X
  This option enables support for on-chip LED drivers found on Marvell
  Semiconductor 88PM8606 PMIC.
 
+config LEDS_AAT1290
+   tristate LED support for the AAT1290
+   depends on LEDS_CLASS_FLASH
+   depends on GPIOLIB
+   depends on OF
+   help
+This option enables support for the LEDs on the AAT1290.
+
 config LEDS_LM3530
tristate LCD Backlight driver for LM3530
depends on LEDS_CLASS
diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile
index 9413fdb..0b3fd0e 100644
--- a/drivers/leds/Makefile
+++ b/drivers/leds/Makefile
@@ -7,6 +7,7 @@ obj-$(CONFIG_LEDS_TRIGGERS) += led-triggers.o
 
 # LED Platform Drivers
 obj-$(CONFIG_LEDS_88PM860X)+= leds-88pm860x.o
+obj-$(CONFIG_LEDS_AAT1290) += leds-aat1290.o
 obj-$(CONFIG_LEDS_BD2802)  += leds-bd2802.o
 obj-$(CONFIG_LEDS_LOCOMO)  += leds-locomo.o
 obj-$(CONFIG_LEDS_LM3530)  += leds-lm3530.o
diff --git a/drivers/leds/leds-aat1290.c b/drivers/leds/leds-aat1290.c
new file mode 100644
index 000..acfae35
--- /dev/null
+++ b/drivers/leds/leds-aat1290.c
@@ -0,0 +1,372 @@
+/*
+ * LED Flash class driver for the AAT1290
+ * 1.5A Step-Up Current Regulator for Flash LEDs
+ *
+ * Copyright (C) 2015, Samsung Electronics Co., Ltd.
+ * Author: Jacek Anaszewski j.anaszew...@samsung.com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ */
+
+#include linux/delay.h
+#include linux/gpio/consumer.h
+#include linux/led-class-flash.h
+#include linux/leds.h
+#include linux/module.h
+#include linux/mutex.h
+#include linux/of.h
+#include linux/platform_device.h
+#include linux/slab.h
+#include linux/workqueue.h
+
+#define AAT1290_MOVIE_MODE_CURRENT_ADDR17
+#define AAT1290_MAX_MM_CURR_PERCENT_0  16
+#define AAT1290_MAX_MM_CURR_PERCENT_1001
+
+#define AAT1290_FLASH_SAFETY_TIMER_ADDR18
+
+#define AAT1290_MOVIE_MODE_CONFIG_ADDR 19
+#define AAT1290_MOVIE_MODE_OFF 1
+#define AAT1290_MOVIE_MODE_ON  3
+
+#define AAT1290_MM_CURRENT_RATIO_ADDR  20
+#define AAT1290_MM_TO_FL_1_92  1
+
+#define AAT1290_MM_TO_FL_RATIO 1000 / 1920
+#define AAT1290_MAX_MM_CURRENT(fl_max) (fl_max * AAT1290_MM_TO_FL_RATIO)
+
+#define AAT1290_LATCH_TIME_MIN_US  500
+#define AAT1290_LATCH_TIME_MAX_US  1000
+#define AAT1290_EN_SET_TICK_TIME_US1
+#define AAT1290_FLEN_OFF_DELAY_TIME_US 10
+#define AAT1290_FLASH_TM_NUM_LEVELS16
+#define AAT1290_MM_CURRENT_SCALE_SIZE  15
+
+
+struct aat1290_led {
+   /* platform device data */
+   struct platform_device *pdev;
+   /* secures access to the device */
+   struct mutex lock;
+
+   /* corresponding LED Flash class device */
+   struct led_classdev_flash fled_cdev;
+
+   /* FLEN pin */
+   struct gpio_desc *gpio_fl_en;
+   /* EN|SET pin  */
+   struct gpio_desc *gpio_en_set;
+
+   /* maximum flash timeout */
+   u32 max_flash_tm;
+   /* maximum LED current in flash mode */
+   u32 max_flash_current;
+   /* device mode */
+   bool movie_mode;
+
+   /* brightness cache */
+   unsigned int torch_brightness;
+   /* assures led-triggers compatibility */
+   struct work_struct work_brightness_set;
+};
+
+static struct aat1290_led *fled_cdev_to_led(
+   struct led_classdev_flash *fled_cdev)
+{
+   return container_of(fled_cdev, struct aat1290_led, fled_cdev);
+}
+
+static void aat1290_as2cwire_write(struct aat1290_led *led, int addr, int 
value)
+{
+   int i;
+
+   gpiod_direction_output(led-gpio_fl_en, 0);
+   gpiod_direction_output(led-gpio_en_set, 0);
+
+   udelay(AAT1290_FLEN_OFF_DELAY_TIME_US);
+
+   /* write address */
+   for (i = 0; i  addr; ++i) {
+   udelay(AAT1290_EN_SET_TICK_TIME_US);
+   gpiod_direction_output(led-gpio_en_set, 0);
+   udelay(AAT1290_EN_SET_TICK_TIME_US);
+   gpiod_direction_output(led-gpio_en_set, 1);
+   }
+
+   

[PATCH v2 08/11] media: Add registration helpers for V4L2 flash sub-devices

2015-03-27 Thread Jacek Anaszewski
This patch adds helper functions for registering/unregistering
LED Flash class devices as V4L2 sub-devices. The functions should
be called from the LED subsystem device driver. In case the
support for V4L2 Flash sub-devices is disabled in the kernel
config the functions' empty versions will be used.

Signed-off-by: Jacek Anaszewski j.anaszew...@samsung.com
Acked-by: Kyungmin Park kyungmin.p...@samsung.com
Cc: Sakari Ailus sakari.ai...@iki.fi
Cc: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/v4l2-core/Kconfig  |   11 +
 drivers/media/v4l2-core/Makefile |2 +
 drivers/media/v4l2-core/v4l2-flash.c |  619 ++
 include/media/v4l2-flash.h   |  144 
 4 files changed, 776 insertions(+)
 create mode 100644 drivers/media/v4l2-core/v4l2-flash.c
 create mode 100644 include/media/v4l2-flash.h

diff --git a/drivers/media/v4l2-core/Kconfig b/drivers/media/v4l2-core/Kconfig
index ba7e21a..f034f1a 100644
--- a/drivers/media/v4l2-core/Kconfig
+++ b/drivers/media/v4l2-core/Kconfig
@@ -44,6 +44,17 @@ config V4L2_MEM2MEM_DEV
 tristate
 depends on VIDEOBUF2_CORE
 
+# Used by LED subsystem flash drivers
+config V4L2_FLASH_LED_CLASS
+   tristate Enable support for Flash sub-devices
+   depends on VIDEO_V4L2_SUBDEV_API
+   depends on LEDS_CLASS_FLASH
+   ---help---
+ Say Y here to enable support for Flash sub-devices, which allow
+ to control LED class devices with use of V4L2 Flash controls.
+
+ When in doubt, say N.
+
 # Used by drivers that need Videobuf modules
 config VIDEOBUF_GEN
tristate
diff --git a/drivers/media/v4l2-core/Makefile b/drivers/media/v4l2-core/Makefile
index 63d29f2..44e858c 100644
--- a/drivers/media/v4l2-core/Makefile
+++ b/drivers/media/v4l2-core/Makefile
@@ -22,6 +22,8 @@ obj-$(CONFIG_VIDEO_TUNER) += tuner.o
 
 obj-$(CONFIG_V4L2_MEM2MEM_DEV) += v4l2-mem2mem.o
 
+obj-$(CONFIG_V4L2_FLASH_LED_CLASS) += v4l2-flash.o
+
 obj-$(CONFIG_VIDEOBUF_GEN) += videobuf-core.o
 obj-$(CONFIG_VIDEOBUF_DMA_SG) += videobuf-dma-sg.o
 obj-$(CONFIG_VIDEOBUF_DMA_CONTIG) += videobuf-dma-contig.o
diff --git a/drivers/media/v4l2-core/v4l2-flash.c 
b/drivers/media/v4l2-core/v4l2-flash.c
new file mode 100644
index 000..bed2036
--- /dev/null
+++ b/drivers/media/v4l2-core/v4l2-flash.c
@@ -0,0 +1,619 @@
+/*
+ * V4L2 Flash LED sub-device registration helpers.
+ *
+ * Copyright (C) 2015 Samsung Electronics Co., Ltd
+ * Author: Jacek Anaszewski j.anaszew...@samsung.com
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include linux/led-class-flash.h
+#include linux/module.h
+#include linux/mutex.h
+#include linux/of.h
+#include linux/slab.h
+#include linux/types.h
+#include media/v4l2-flash.h
+
+#define has_flash_op(v4l2_flash, op)   \
+   (v4l2_flash  v4l2_flash-ops-op)
+
+#define call_flash_op(v4l2_flash, op, arg) \
+   (has_flash_op(v4l2_flash, op) ? \
+   v4l2_flash-ops-op(v4l2_flash, arg) :  \
+   -EINVAL)
+
+static enum led_brightness __intensity_to_led_brightness(
+   struct v4l2_ctrl *ctrl,
+   s32 intensity)
+{
+   s64 intensity64 = intensity - ctrl-minimum;
+
+   do_div(intensity64, ctrl-step);
+
+   /*
+* Indicator LEDs, unlike torch LEDs, are turned on/off basing on
+* the state of V4L2_CID_FLASH_INDICATOR_INTENSITY control only.
+* Therefore it must be possible to set it to 0 level which in
+* the LED subsystem reflects LED_OFF state.
+*/
+   if (ctrl-id != V4L2_CID_FLASH_INDICATOR_INTENSITY)
+   ++intensity64;
+
+   return intensity64;
+}
+
+static s32 __led_brightness_to_intensity(struct v4l2_ctrl *ctrl,
+enum led_brightness brightness)
+{
+   /*
+* Indicator LEDs, unlike torch LEDs, are turned on/off basing on
+* the state of V4L2_CID_FLASH_INDICATOR_INTENSITY control only.
+* Do not decrement brightness read from the LED subsystem for
+* indicator LED as it may equal 0. For torch LEDs this function
+* is called only when V4L2_FLASH_LED_MODE_TORCH is set and the
+* brightness read is guaranteed to be greater than 0. In the mode
+* V4L2_FLASH_LED_MODE_NONE the cached torch intensity value is used.
+*/
+   if (ctrl-id != V4L2_CID_FLASH_INDICATOR_INTENSITY)
+   --brightness;
+
+   return (brightness * ctrl-step) + ctrl-minimum;
+}
+
+static void v4l2_flash_set_led_brightness(struct v4l2_flash *v4l2_flash,
+   struct v4l2_ctrl *ctrl)
+{
+   struct v4l2_ctrl **ctrls = v4l2_flash-ctrls;
+   enum led_brightness 

[PATCH v2 06/11] of: Add Skyworks Solutions, Inc. vendor prefix

2015-03-27 Thread Jacek Anaszewski
Use skyworks as the vendor prefix for the Skyworks Solutions, Inc.

Signed-off-by: Jacek Anaszewski j.anaszew...@samsung.com
Acked-by: Kyungmin Park kyungmin.p...@samsung.com
---
 .../devicetree/bindings/vendor-prefixes.txt|1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt 
b/Documentation/devicetree/bindings/vendor-prefixes.txt
index 42b3dab..4cd18bb 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@ -163,6 +163,7 @@ ricoh   Ricoh Co. Ltd.
 rockchip   Fuzhou Rockchip Electronics Co., Ltd
 samsungSamsung Semiconductor
 sandiskSandisk Corporation
+skyworks   Skyworks Solutions, Inc.
 sbsSmart Battery System
 schindler  Schindler
 seagateSeagate Technology PLC
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 03/11] leds: Add support for max77693 mfd flash cell

2015-03-27 Thread Jacek Anaszewski
This patch adds led-flash support to Maxim max77693 chipset.
A device can be exposed to user space through LED subsystem
sysfs interface. Device supports up to two leds which can
work in flash and torch mode. The leds can be triggered
externally or by software.

Signed-off-by: Jacek Anaszewski j.anaszew...@samsung.com
Signed-off-by: Andrzej Hajda a.ha...@samsung.com
Acked-by: Kyungmin Park kyungmin.p...@samsung.com
Cc: Bryan Wu coolo...@gmail.com
Cc: Richard Purdie rpur...@rpsys.net
Cc: Lee Jones lee.jo...@linaro.org
Cc: Chanwoo Choi cw00.c...@samsung.com
---
 drivers/leds/Kconfig |   10 +
 drivers/leds/Makefile|1 +
 drivers/leds/leds-max77693.c |  973 ++
 3 files changed, 984 insertions(+)
 create mode 100644 drivers/leds/leds-max77693.c

diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
index 966b960..f9fbeb5 100644
--- a/drivers/leds/Kconfig
+++ b/drivers/leds/Kconfig
@@ -467,6 +467,16 @@ config LEDS_TCA6507
  LED driver chips accessed via the I2C bus.
  Driver support brightness control and hardware-assisted blinking.
 
+config LEDS_MAX77693
+   tristate LED support for MAX77693 Flash
+   depends on LEDS_CLASS_FLASH
+   depends on MFD_MAX77693
+   depends on OF
+   help
+ This option enables support for the flash part of the MAX77693
+ multifunction device. It has build in control for two leds in flash
+ and torch mode.
+
 config LEDS_MAX8997
tristate LED support for MAX8997 PMIC
depends on LEDS_CLASS  MFD_MAX8997
diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile
index bf46093..9413fdb 100644
--- a/drivers/leds/Makefile
+++ b/drivers/leds/Makefile
@@ -52,6 +52,7 @@ obj-$(CONFIG_LEDS_MC13783)+= leds-mc13783.o
 obj-$(CONFIG_LEDS_NS2) += leds-ns2.o
 obj-$(CONFIG_LEDS_NETXBIG) += leds-netxbig.o
 obj-$(CONFIG_LEDS_ASIC3)   += leds-asic3.o
+obj-$(CONFIG_LEDS_MAX77693)+= leds-max77693.o
 obj-$(CONFIG_LEDS_MAX8997) += leds-max8997.o
 obj-$(CONFIG_LEDS_LM355x)  += leds-lm355x.o
 obj-$(CONFIG_LEDS_BLINKM)  += leds-blinkm.o
diff --git a/drivers/leds/leds-max77693.c b/drivers/leds/leds-max77693.c
new file mode 100644
index 000..65c910d
--- /dev/null
+++ b/drivers/leds/leds-max77693.c
@@ -0,0 +1,973 @@
+/*
+ * LED Flash class driver for the flash cell of max77693 mfd.
+ *
+ * Copyright (C) 2015, Samsung Electronics Co., Ltd.
+ *
+ * Authors: Jacek Anaszewski j.anaszew...@samsung.com
+ *  Andrzej Hajda a.ha...@samsung.com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ */
+
+#include asm/div64.h
+#include linux/led-class-flash.h
+#include linux/mfd/max77693.h
+#include linux/mfd/max77693-private.h
+#include linux/module.h
+#include linux/mutex.h
+#include linux/platform_device.h
+#include linux/regmap.h
+#include linux/slab.h
+#include linux/workqueue.h
+#include uapi/linux/leds.h
+
+#define MODE_OFF   0
+#define MODE_FLASH(a)  (1  (a))
+#define MODE_TORCH(a)  (1  (2 + (a)))
+#define MODE_FLASH_EXTERNAL(a) (1  (4 + (a)))
+
+#define MODE_FLASH_MASK(MODE_FLASH(FLED1) | MODE_FLASH(FLED2) 
| \
+MODE_FLASH_EXTERNAL(FLED1) | \
+MODE_FLASH_EXTERNAL(FLED2))
+#define MODE_TORCH_MASK(MODE_TORCH(FLED1) | MODE_TORCH(FLED2))
+
+#define FLED1_IOUT (1  0)
+#define FLED2_IOUT (1  1)
+
+enum max77693_fled {
+   FLED1,
+   FLED2,
+};
+
+enum max77693_led_mode {
+   FLASH,
+   TORCH,
+};
+
+struct max77693_led_config_data {
+   const char *label[2];
+   u32 iout_torch_max[2];
+   u32 iout_flash_max[2];
+   u32 flash_timeout[2];
+   u32 num_leds;
+   u32 boost_mode;
+   u32 boost_vout;
+   u32 low_vsys;
+   u32 trigger_type;
+};
+
+struct max77693_sub_led {
+   /* corresponding FLED output identifier */
+   int fled_id;
+   /* corresponding LED Flash class device */
+   struct led_classdev_flash fled_cdev;
+   /* assures led-triggers compatibility */
+   struct work_struct work_brightness_set;
+
+   /* brightness cache */
+   unsigned int torch_brightness;
+   /* flash timeout cache */
+   unsigned int flash_timeout;
+   /* flash faults that may have occurred */
+   u32 flash_faults;
+};
+
+struct max77693_led_device {
+   /* parent mfd regmap */
+   struct regmap *regmap;
+   /* platform device data */
+   struct platform_device *pdev;
+   /* secures access to the device */
+   struct mutex lock;
+
+   /* sub led data */
+   struct max77693_sub_led sub_leds[2];
+
+   /* maximum torch current values for FLED outputs */
+   u32 

[PATCH v2 02/11] leds: add uapi header file

2015-03-27 Thread Jacek Anaszewski
This patch adds header file for LED subsystem definitions and
declarations. The initial need for the header is allowing the
user space to discover the semantics of flash fault bits.

Signed-off-by: Jacek Anaszewski j.anaszew...@samsung.com
Acked-by: Kyungmin Park kyungmin.p...@samsung.com
Cc: Bryan Wu coolo...@gmail.com
Cc: Sakari Ailus sakari.ai...@iki.fi
---
 include/linux/led-class-flash.h |   16 +---
 include/uapi/linux/leds.h   |   34 ++
 2 files changed, 35 insertions(+), 15 deletions(-)
 create mode 100644 include/uapi/linux/leds.h

diff --git a/include/linux/led-class-flash.h b/include/linux/led-class-flash.h
index e97966d..3cf58c4 100644
--- a/include/linux/led-class-flash.h
+++ b/include/linux/led-class-flash.h
@@ -13,25 +13,11 @@
 #define __LINUX_FLASH_LEDS_H_INCLUDED
 
 #include linux/leds.h
+#include uapi/linux/leds.h
 
 struct device_node;
 struct led_classdev_flash;
 
-/*
- * Supported led fault bits - must be kept in synch
- * with V4L2_FLASH_FAULT bits.
- */
-#define LED_FAULT_OVER_VOLTAGE (1  0)
-#define LED_FAULT_TIMEOUT  (1  1)
-#define LED_FAULT_OVER_TEMPERATURE (1  2)
-#define LED_FAULT_SHORT_CIRCUIT(1  3)
-#define LED_FAULT_OVER_CURRENT (1  4)
-#define LED_FAULT_INDICATOR(1  5)
-#define LED_FAULT_UNDER_VOLTAGE(1  6)
-#define LED_FAULT_INPUT_VOLTAGE(1  7)
-#define LED_FAULT_LED_OVER_TEMPERATURE (1  8)
-#define LED_NUM_FLASH_FAULTS   9
-
 #define LED_FLASH_SYSFS_GROUPS_SIZE5
 
 struct led_flash_ops {
diff --git a/include/uapi/linux/leds.h b/include/uapi/linux/leds.h
new file mode 100644
index 000..f657f78
--- /dev/null
+++ b/include/uapi/linux/leds.h
@@ -0,0 +1,34 @@
+/*
+ * include/uapi/linux/leds.h
+ *
+ * LED subsystem specific definitions and declarations.
+ *
+ * Copyright (C) 2015 Samsung Electronics Co., Ltd.
+ * Author: Jacek Anaszewski j.anaszew...@samsung.com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef __UAPI_LINUX_LEDS_H_
+#define __UAPI_LINUX_LEDS_H_
+
+#define LED_FAULT_OVER_VOLTAGE (1  0)
+#define LED_FAULT_TIMEOUT  (1  1)
+#define LED_FAULT_OVER_TEMPERATURE (1  2)
+#define LED_FAULT_SHORT_CIRCUIT(1  3)
+#define LED_FAULT_OVER_CURRENT (1  4)
+#define LED_FAULT_INDICATOR(1  5)
+#define LED_FAULT_UNDER_VOLTAGE(1  6)
+#define LED_FAULT_INPUT_VOLTAGE(1  7)
+#define LED_FAULT_LED_OVER_TEMPERATURE (1  8)
+#define LED_NUM_FLASH_FAULTS   9
+
+#endif /* __UAPI_LINUX_LEDS_H_ */
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 04/11] DT: Add documentation for the mfd Maxim max77693

2015-03-27 Thread Jacek Anaszewski
This patch adds device tree binding documentation for
the flash cell of the Maxim max77693 multifunctional device.

Signed-off-by: Jacek Anaszewski j.anaszew...@samsung.com
Signed-off-by: Andrzej Hajda a.ha...@samsung.com
Acked-by: Kyungmin Park kyungmin.p...@samsung.com
Acked-by: Sakari Ailus sakari.ai...@linux.intel.com
Cc: Lee Jones lee.jo...@linaro.org
Cc: Chanwoo Choi cw00.c...@samsung.com
Cc: Bryan Wu coolo...@gmail.com
Cc: Richard Purdie rpur...@rpsys.net
---
 Documentation/devicetree/bindings/mfd/max77693.txt |   61 
 1 file changed, 61 insertions(+)

diff --git a/Documentation/devicetree/bindings/mfd/max77693.txt 
b/Documentation/devicetree/bindings/mfd/max77693.txt
index 38e6440..15c546ea 100644
--- a/Documentation/devicetree/bindings/mfd/max77693.txt
+++ b/Documentation/devicetree/bindings/mfd/max77693.txt
@@ -76,7 +76,53 @@ Optional properties:
 Valid values: 430, 470, 480, 490
 Default: 430
 
+- led : the LED submodule device node
+
+There are two LED outputs available - FLED1 and FLED2. Each of them can
+control a separate LED or they can be connected together to double
+the maximum current for a single connected LED. One LED is represented
+by one child node.
+
+Required properties:
+- compatible : Must be maxim,max77693-led.
+
+Optional properties:
+- maxim,trigger-type : Flash trigger type.
+   Possible trigger types:
+   LEDS_TRIG_TYPE_EDGE (0) - Rising edge of the signal triggers
+   the flash,
+   LEDS_TRIG_TYPE_LEVEL (1) - Strobe pulse length controls duration
+   of the flash.
+- maxim,boost-mode :
+   In boost mode the device can produce up to 1.2A of total current
+   on both outputs. The maximum current on each output is reduced
+   to 625mA then. If not enabled explicitly, boost setting defaults to
+   LEDS_BOOST_FIXED in case both current sources are used.
+   Possible values:
+   LEDS_BOOST_OFF (0) - no boost,
+   LEDS_BOOST_ADAPTIVE (1) - adaptive mode,
+   LEDS_BOOST_FIXED (2) - fixed mode.
+- maxim,boost-mvout : Output voltage of the boost module in millivolts.
+- maxim,mvsys-min : Low input voltage level in millivolts. Flash is not fired
+   if chip estimates that system voltage could drop below this level due
+   to flash power consumption.
+
+Required properties of the LED child node:
+- led-sources : see Documentation/devicetree/bindings/leds/common.txt;
+   device current output identifiers: 0 - FLED1, 1 - FLED2
+
+Optional properties of the LED child node:
+- label : see Documentation/devicetree/bindings/leds/common.txt
+- max-microamp : see Documentation/devicetree/bindings/leds/common.txt
+   Range: 15625 - 25
+- flash-max-microamp : see Documentation/devicetree/bindings/leds/common.txt
+   Range: 15625 - 100
+- flash-timeout-us : see Documentation/devicetree/bindings/leds/common.txt
+   Range: 62500 - 100
+
 Example:
+#include dt-bindings/leds/common.h
+
max77693@66 {
compatible = maxim,max77693;
reg = 0x66;
@@ -117,5 +163,20 @@ Example:
maxim,thermal-regulation-celsius = 75;
maxim,battery-overcurrent-microamp = 300;
maxim,charge-input-threshold-microvolt = 430;
+
+   led {
+   compatible = maxim,max77693-led;
+   maxim,trigger-type = LEDS_TRIG_TYPE_LEVEL;
+   maxim,boost-mode = LEDS_BOOST_FIXED;
+   maxim,boost-mvout = 5000;
+   maxim,mvsys-min = 2400;
+
+   camera_flash: flash-led {
+   label = max77693-flash;
+   led-sources = 0, 1;
+   max-microamp = 50;
+   flash-max-microamp = 125;
+   flash-timeout-us = 100;
+   };
};
};
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 01/11] leds: unify the location of led-trigger API

2015-03-27 Thread Jacek Anaszewski
Part of led-trigger API was in the private drivers/leds/leds.h header.
Move it to the include/linux/leds.h header to unify the API location
and announce it as public. It has been already exported from
led-triggers.c with EXPORT_SYMBOL_GPL macro.

Signed-off-by: Jacek Anaszewski j.anaszew...@samsung.com
Acked-by: Kyungmin Park kyungmin.p...@samsung.com
Cc: Bryan Wu coolo...@gmail.com
Cc: Richard Purdie rpur...@rpsys.net
---
 drivers/leds/leds.h  |   24 
 include/linux/leds.h |   24 
 2 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/drivers/leds/leds.h b/drivers/leds/leds.h
index 79efe57..bc89d7a 100644
--- a/drivers/leds/leds.h
+++ b/drivers/leds/leds.h
@@ -13,7 +13,6 @@
 #ifndef __LEDS_H_INCLUDED
 #define __LEDS_H_INCLUDED
 
-#include linux/device.h
 #include linux/rwsem.h
 #include linux/leds.h
 
@@ -50,27 +49,4 @@ void led_stop_software_blink(struct led_classdev *led_cdev);
 extern struct rw_semaphore leds_list_lock;
 extern struct list_head leds_list;
 
-#ifdef CONFIG_LEDS_TRIGGERS
-void led_trigger_set_default(struct led_classdev *led_cdev);
-void led_trigger_set(struct led_classdev *led_cdev,
-   struct led_trigger *trigger);
-void led_trigger_remove(struct led_classdev *led_cdev);
-
-static inline void *led_get_trigger_data(struct led_classdev *led_cdev)
-{
-   return led_cdev-trigger_data;
-}
-
-#else
-#define led_trigger_set_default(x) do {} while (0)
-#define led_trigger_set(x, y) do {} while (0)
-#define led_trigger_remove(x) do {} while (0)
-#define led_get_trigger_data(x) (NULL)
-#endif
-
-ssize_t led_trigger_store(struct device *dev, struct device_attribute *attr,
-   const char *buf, size_t count);
-ssize_t led_trigger_show(struct device *dev, struct device_attribute *attr,
-   char *buf);
-
 #endif /* __LEDS_H_INCLUDED */
diff --git a/include/linux/leds.h b/include/linux/leds.h
index 9a2b000..0579708 100644
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
@@ -12,6 +12,7 @@
 #ifndef __LINUX_LEDS_H_INCLUDED
 #define __LINUX_LEDS_H_INCLUDED
 
+#include linux/device.h
 #include linux/list.h
 #include linux/mutex.h
 #include linux/rwsem.h
@@ -222,6 +223,29 @@ struct led_trigger {
struct list_head  next_trig;
 };
 
+#ifdef CONFIG_LEDS_TRIGGERS
+void led_trigger_set_default(struct led_classdev *led_cdev);
+void led_trigger_set(struct led_classdev *led_cdev,
+   struct led_trigger *trigger);
+void led_trigger_remove(struct led_classdev *led_cdev);
+
+static inline void *led_get_trigger_data(struct led_classdev *led_cdev)
+{
+   return led_cdev-trigger_data;
+}
+
+#else
+#define led_trigger_set_default(x) do {} while (0)
+#define led_trigger_set(x, y) do {} while (0)
+#define led_trigger_remove(x) do {} while (0)
+#define led_get_trigger_data(x) (NULL)
+#endif
+
+ssize_t led_trigger_store(struct device *dev, struct device_attribute *attr,
+   const char *buf, size_t count);
+ssize_t led_trigger_show(struct device *dev, struct device_attribute *attr,
+   char *buf);
+
 /* Registration functions for complex triggers */
 extern int led_trigger_register(struct led_trigger *trigger);
 extern void led_trigger_unregister(struct led_trigger *trigger);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 09/11] Documentation: leds: Add description of v4l2-flash sub-device

2015-03-27 Thread Jacek Anaszewski
This patch extends LED Flash class documention by
the description of interactions with v4l2-flash sub-device.

Signed-off-by: Jacek Anaszewski j.anaszew...@samsung.com
Acked-by: Kyungmin Park kyungmin.p...@samsung.com
Acked-by: Sakari Ailus sakari.ai...@linux.intel.com
Cc: Bryan Wu coolo...@gmail.com
Cc: Richard Purdie rpur...@rpsys.net
---
 Documentation/leds/leds-class-flash.txt |   13 +
 1 file changed, 13 insertions(+)

diff --git a/Documentation/leds/leds-class-flash.txt 
b/Documentation/leds/leds-class-flash.txt
index 19bb673..8623413 100644
--- a/Documentation/leds/leds-class-flash.txt
+++ b/Documentation/leds/leds-class-flash.txt
@@ -20,3 +20,16 @@ Following sysfs attributes are exposed for controlling flash 
LED devices:
- max_flash_timeout
- flash_strobe
- flash_fault
+
+A LED subsystem driver can be controlled also from the level of VideoForLinux2
+subsystem. In order to enable this CONFIG_V4L2_FLASH_LED_CLASS symbol has to
+be defined in the kernel config. The driver must call the v4l2_flash_init
+function to get registered in the V4L2 subsystem. On remove the
+v4l2_flash_release function has to be called (see media/v4l2-flash.h).
+
+After proper initialization a V4L2 Flash sub-device is created. The sub-device
+exposes a number of V4L2 controls, which allow for controlling a LED Flash 
class
+device with use of its internal kernel API.
+Opening the V4L2 Flash sub-device makes the LED subsystem sysfs interface
+unavailable. The interface is re-enabled after the V4L2 Flash sub-device
+is closed.
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 10/11] leds: max77693: add support for V4L2 Flash sub-device

2015-03-27 Thread Jacek Anaszewski
Add support for V4L2 Flash sub-device to the max77693 LED Flash class
driver. The support allows for V4L2 Flash sub-device to take the control
of the LED Flash class device.

Signed-off-by: Jacek Anaszewski j.anaszew...@samsung.com
Acked-by: Kyungmin Park kyungmin.p...@samsung.com
Cc: Bryan Wu coolo...@gmail.com
Cc: Richard Purdie rpur...@rpsys.net
Cc: Sakari Ailus sakari.ai...@iki.fi
---
 drivers/leds/leds-max77693.c |  125 --
 1 file changed, 119 insertions(+), 6 deletions(-)

diff --git a/drivers/leds/leds-max77693.c b/drivers/leds/leds-max77693.c
index 65c910d..91a4ec9 100644
--- a/drivers/leds/leds-max77693.c
+++ b/drivers/leds/leds-max77693.c
@@ -21,6 +21,7 @@
 #include linux/regmap.h
 #include linux/slab.h
 #include linux/workqueue.h
+#include media/v4l2-flash.h
 #include uapi/linux/leds.h
 
 #define MODE_OFF   0
@@ -65,6 +66,8 @@ struct max77693_sub_led {
struct led_classdev_flash fled_cdev;
/* assures led-triggers compatibility */
struct work_struct work_brightness_set;
+   /* V4L2 Flash device */
+   struct v4l2_flash *v4l2_flash;
 
/* brightness cache */
unsigned int torch_brightness;
@@ -642,7 +645,8 @@ static int max77693_led_flash_timeout_set(
 }
 
 static int max77693_led_parse_dt(struct max77693_led_device *led,
-   struct max77693_led_config_data *cfg)
+   struct max77693_led_config_data *cfg,
+   struct device_node **sub_nodes)
 {
struct device *dev = led-pdev-dev;
struct max77693_sub_led *sub_leds = led-sub_leds;
@@ -688,6 +692,13 @@ static int max77693_led_parse_dt(struct 
max77693_led_device *led,
return -EINVAL;
}
 
+   if (sub_nodes[fled_id]) {
+   dev_err(dev,
+   Conflicting \led-sources\ DT properties\n);
+   return -EINVAL;
+   }
+
+   sub_nodes[fled_id] = child_node;
sub_leds[fled_id].fled_id = fled_id;
 
cfg-label[fled_id] =
@@ -776,11 +787,12 @@ static void max77693_led_validate_configuration(struct 
max77693_led_device *led,
 }
 
 static int max77693_led_get_configuration(struct max77693_led_device *led,
-   struct max77693_led_config_data *cfg)
+   struct max77693_led_config_data *cfg,
+   struct device_node **sub_nodes)
 {
int ret;
 
-   ret = max77693_led_parse_dt(led, cfg);
+   ret = max77693_led_parse_dt(led, cfg, sub_nodes);
if (ret  0)
return ret;
 
@@ -828,6 +840,66 @@ static void max77693_init_flash_settings(struct 
max77693_sub_led *sub_led,
setting-val = setting-max;
 }
 
+#if IS_ENABLED(CONFIG_V4L2_FLASH_LED_CLASS)
+
+static int max77693_led_external_strobe_set(
+   struct v4l2_flash *v4l2_flash,
+   bool enable)
+{
+   struct max77693_sub_led *sub_led =
+   flcdev_to_sub_led(v4l2_flash-fled_cdev);
+   struct max77693_led_device *led = sub_led_to_led(sub_led);
+   int fled_id = sub_led-fled_id;
+   int ret;
+
+   mutex_lock(led-lock);
+
+   if (enable)
+   ret = max77693_add_mode(led, MODE_FLASH_EXTERNAL(fled_id));
+   else
+   ret = max77693_clear_mode(led, MODE_FLASH_EXTERNAL(fled_id));
+
+   mutex_unlock(led-lock);
+
+   return ret;
+}
+
+static void max77693_init_v4l2_flash_config(struct max77693_sub_led *sub_led,
+   struct max77693_led_config_data *led_cfg,
+   struct v4l2_flash_config *v4l2_sd_cfg)
+{
+   struct max77693_led_device *led = sub_led_to_led(sub_led);
+   struct device *dev = led-pdev-dev;
+   struct max77693_dev *iodev = dev_get_drvdata(dev-parent);
+   struct i2c_client *i2c = iodev-i2c;
+   struct led_flash_setting *s;
+
+   snprintf(v4l2_sd_cfg-dev_name, sizeof(v4l2_sd_cfg-dev_name),
+%s %d-%04x, sub_led-fled_cdev.led_cdev.name,
+i2c_adapter_id(i2c-adapter), i2c-addr);
+
+   s = v4l2_sd_cfg-intensity;
+   s-min = TORCH_IOUT_MIN;
+   s-max = sub_led-fled_cdev.led_cdev.max_brightness * TORCH_IOUT_STEP;
+   s-step = TORCH_IOUT_STEP;
+   s-val = s-max;
+
+   /* Init flash faults config */
+   v4l2_sd_cfg-flash_faults = LED_FAULT_OVER_VOLTAGE |
+   LED_FAULT_SHORT_CIRCUIT |
+   LED_FAULT_OVER_CURRENT;
+
+   v4l2_sd_cfg-has_external_strobe = true;
+}
+
+static const struct v4l2_flash_ops v4l2_flash_ops = {
+   .external_strobe_set = max77693_led_external_strobe_set,
+};
+
+#else
+#define max77693_init_v4l2_flash_config(sub_led, led_cfg, v4l2_sd_cfg)
+#endif
+
 static void max77693_init_fled_cdev(struct 

[PATCH v2 11/11] leds: aat1290: add support for V4L2 Flash sub-device

2015-03-27 Thread Jacek Anaszewski
Add support for V4L2 Flash sub-device to the aat1290 LED Flash class
driver. The support allows for V4L2 Flash sub-device to take the control
of the LED Flash class device.

Signed-off-by: Jacek Anaszewski j.anaszew...@samsung.com
Acked-by: Kyungmin Park kyungmin.p...@samsung.com
Cc: Bryan Wu coolo...@gmail.com
Cc: Richard Purdie rpur...@rpsys.net
Cc: Sakari Ailus sakari.ai...@iki.fi
---
 drivers/leds/Kconfig|1 +
 drivers/leds/leds-aat1290.c |  150 ++-
 2 files changed, 149 insertions(+), 2 deletions(-)

diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
index c3b5b027..d73f43f 100644
--- a/drivers/leds/Kconfig
+++ b/drivers/leds/Kconfig
@@ -47,6 +47,7 @@ config LEDS_AAT1290
depends on LEDS_CLASS_FLASH
depends on GPIOLIB
depends on OF
+   depends on PINCTRL
help
 This option enables support for the LEDs on the AAT1290.
 
diff --git a/drivers/leds/leds-aat1290.c b/drivers/leds/leds-aat1290.c
index acfae35..34fd5c4 100644
--- a/drivers/leds/leds-aat1290.c
+++ b/drivers/leds/leds-aat1290.c
@@ -17,9 +17,11 @@
 #include linux/module.h
 #include linux/mutex.h
 #include linux/of.h
+#include linux/pinctrl/consumer.h
 #include linux/platform_device.h
 #include linux/slab.h
 #include linux/workqueue.h
+#include media/v4l2-flash.h
 
 #define AAT1290_MOVIE_MODE_CURRENT_ADDR17
 #define AAT1290_MAX_MM_CURR_PERCENT_0  16
@@ -53,11 +55,17 @@ struct aat1290_led {
 
/* corresponding LED Flash class device */
struct led_classdev_flash fled_cdev;
+   /* V4L2 Flash device */
+   struct v4l2_flash *v4l2_flash;
 
/* FLEN pin */
struct gpio_desc *gpio_fl_en;
/* EN|SET pin  */
struct gpio_desc *gpio_en_set;
+#if IS_ENABLED(CONFIG_V4L2_FLASH_LED_CLASS)
+   /* movie mode current scale */
+   int *mm_current_scale;
+#endif
 
/* maximum flash timeout */
u32 max_flash_tm;
@@ -224,11 +232,16 @@ static int aat1290_led_flash_timeout_set(struct 
led_classdev_flash *fled_cdev,
return 0;
 }
 
-static int aat1290_led_parse_dt(struct aat1290_led *led)
+static int aat1290_led_parse_dt(struct aat1290_led *led,
+   struct device_node **sub_node,
+   struct v4l2_flash_config *v4l2_sd_cfg)
 {
struct led_classdev *led_cdev = led-fled_cdev.led_cdev;
struct device *dev = led-pdev-dev;
struct device_node *child_node;
+#if IS_ENABLED(CONFIG_V4L2_FLASH_LED_CLASS)
+   struct pinctrl *pinctrl;
+#endif
int ret = 0;
 
led-gpio_fl_en = devm_gpiod_get(dev, flen);
@@ -245,6 +258,17 @@ static int aat1290_led_parse_dt(struct aat1290_led *led)
return ret;
}
 
+#if IS_ENABLED(CONFIG_V4L2_FLASH_LED_CLASS)
+   pinctrl = devm_pinctrl_get_select_default(led-pdev-dev);
+   if (IS_ERR(pinctrl)) {
+   v4l2_sd_cfg-has_external_strobe = false;
+   dev_info(dev,
+No support for external strobe detected.\n);
+   } else {
+   v4l2_sd_cfg-has_external_strobe = true;
+   }
+#endif
+
child_node = of_get_next_available_child(dev-of_node, NULL);
if (!child_node) {
dev_err(dev, No DT child node found for connected LED.\n);
@@ -270,6 +294,8 @@ static int aat1290_led_parse_dt(struct aat1290_led *led)
return ret;
}
 
+   *sub_node = child_node;
+
return ret;
 }
 
@@ -286,6 +312,100 @@ static void aat1290_init_flash_timeout(struct aat1290_led 
*led)
setting-val = setting-max;
 }
 
+#if IS_ENABLED(CONFIG_V4L2_FLASH_LED_CLASS)
+enum led_brightness aat1290_intensity_to_brightness(
+   struct v4l2_flash *v4l2_flash,
+   s32 intensity)
+{
+   struct led_classdev_flash *fled_cdev = v4l2_flash-fled_cdev;
+   struct aat1290_led *led = fled_cdev_to_led(fled_cdev);
+   int i;
+
+   for (i = AAT1290_MM_CURRENT_SCALE_SIZE - 1; i = 0; --i)
+   if (intensity = led-mm_current_scale[i])
+   return i + 1;
+
+   return 1;
+}
+
+s32 aat1290_brightness_to_intensity(struct v4l2_flash *v4l2_flash,
+   enum led_brightness brightness)
+{
+   struct led_classdev_flash *fled_cdev = v4l2_flash-fled_cdev;
+   struct aat1290_led *led = fled_cdev_to_led(fled_cdev);
+
+   return led-mm_current_scale[brightness - 1];
+}
+
+static int aat1290_led_external_strobe_set(struct v4l2_flash *v4l2_flash,
+   bool enable)
+{
+   struct aat1290_led *led = fled_cdev_to_led(v4l2_flash-fled_cdev);
+   struct led_classdev_flash *fled_cdev = v4l2_flash-fled_cdev;
+   struct led_classdev *led_cdev = fled_cdev-led_cdev;
+   struct pinctrl *pinctrl;
+
+   gpiod_direction_output(led-gpio_fl_en, 0);
+   gpiod_direction_output(led-gpio_en_set, 0);
+
+

[PATCH v2 07/11] DT: Add documentation for the Skyworks AAT1290

2015-03-27 Thread Jacek Anaszewski
This patch adds device tree binding documentation for
1.5A Step-Up Current Regulator for Flash LEDs.

Signed-off-by: Jacek Anaszewski j.anaszew...@samsung.com
Acked-by: Kyungmin Park kyungmin.p...@samsung.com
Cc: Bryan Wu coolo...@gmail.com
Cc: Richard Purdie rpur...@rpsys.net
---
 .../devicetree/bindings/leds/leds-aat1290.txt  |   70 
 1 file changed, 70 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/leds/leds-aat1290.txt

diff --git a/Documentation/devicetree/bindings/leds/leds-aat1290.txt 
b/Documentation/devicetree/bindings/leds/leds-aat1290.txt
new file mode 100644
index 000..c3df4e9
--- /dev/null
+++ b/Documentation/devicetree/bindings/leds/leds-aat1290.txt
@@ -0,0 +1,70 @@
+* Skyworks Solutions, Inc. AAT1290 Current Regulator for Flash LEDs
+
+The device is controlled through two pins: FL_EN and EN_SET. The pins when,
+asserted high, enable flash strobe and movie mode (max 1/2 of flash current)
+respectively. In order to add a capability of selecting the strobe signal 
source
+(e.g. GPIO or ISP) there is an additional switch required, independent of the
+flash chip. The switch is controlled with pin control.
+
+Required properties:
+
+- compatible : Must be skyworks,aat1290.
+- flen-gpios : Must be device tree identifier of the flash device FL_EN pin.
+- enset-gpios : Must be device tree identifier of the flash device EN_SET pin.
+
+Optional properties:
+- pinctrl-names : Must contain entries: default, host, isp. Entries
+   default and host must refer to the same pin configuration
+   node, which sets the host as a strobe signal provider. Entry
+   isp must refer to the pin configuration node, which sets the
+   ISP as a strobe signal provider.
+
+A discrete LED element connected to the device must be represented by a child
+node - see Documentation/devicetree/bindings/leds/common.txt.
+
+Required properties of the LED child node:
+- flash-max-microamp : Maximum intensity in microamperes of the flash LED -
+  it can be calculated using following formula:
+  I = 1A * 162kohm / Rset.
+- flash-timeout-us : Maximum flash timeout in microseconds -
+it can be calculated using following formula:
+T = 8.82 * 10^9 * Ct.
+
+Optional properties of the LED child node:
+- label : see Documentation/devicetree/bindings/leds/common.txt
+
+Example (by Ct = 220nF, Rset = 160kohm and exynos4412-trats2 board with
+a switch that allows for routing strobe signal either from host or from ISP):
+
+#include exynos4412.dtsi
+
+aat1290 {
+   compatible = skyworks,aat1290;
+   flen-gpios = gpj1 1 GPIO_ACTIVE_HIGH;
+   enset-gpios = gpj1 2 GPIO_ACTIVE_HIGH;
+
+   pinctrl-names = default, host, isp;
+   pinctrl-0 = camera_flash_host;
+   pinctrl-1 = camera_flash_host;
+   pinctrl-2 = camera_flash_isp;
+
+   camera_flash: flash-led {
+   label = aat1290-flash;
+   flash-max-microamp = 1012500;
+   flash-timeout-us = 194;
+   };
+};
+
+pinctrl_0 {
+   camera_flash_host: camera-flash-host {
+   samsung,pins = gpj1-0;
+   samsung,pin-function = 1;
+   samsung,pin-val = 0;
+   };
+
+   camera_flash_isp: camera-flash-isp {
+   samsung,pins = gpj1-0;
+   samsung,pin-function = 1;
+   samsung,pin-val = 1;
+   };
+};
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 00/11] LED / flash API integration

2015-03-27 Thread Jacek Anaszewski
This is a second non-RFC version of LED / flash API integration
series [1]. It is based on linux-next_20150327.


Changes since v1


- excluded exynos4-is media device related patches, as there is
  consenus required related to flash devices handling in media device
  DT bindings
- modifications around LED Flash class settings and v4l2 flash config
  initialization in LED Flash class drivers and v4l2-flash wrapper
- switched to using DT node name as a device name for leds-max77693
  and leds-aat1290 drivers, in case DT 'label' property is absent
- dropped OF dependecy for v4l2-flash wrapper
- moved LED_FAULTS definitions from led-class-flash.h to uapi/linux/leds.h
- allowed for multiple clients of v4l2-flash sub-device

==
Changes since RFC v13:
==

- reduced number of patches - some of them have been merged
- slightly modified max77693-led device naming
- fixed issues in v4l2-flash helpers detected with yavta
- cleaned up AAT1290 device tree documentation
- added GPIOLIB dependecy to AAT1290 related entry in Kconfig

Thanks,
Jacek Anaszewski

[1] http://www.spinics.net/lists/kernel/msg1944538.html

Jacek Anaszewski (11):
  leds: unify the location of led-trigger API
  leds: add uapi header file
  leds: Add support for max77693 mfd flash cell
  DT: Add documentation for the mfd Maxim max77693
  leds: Add driver for AAT1290 flash LED controller
  of: Add Skyworks Solutions, Inc. vendor prefix
  DT: Add documentation for the Skyworks AAT1290
  media: Add registration helpers for V4L2 flash sub-devices
  Documentation: leds: Add description of v4l2-flash sub-device
  leds: max77693: add support for V4L2 Flash sub-device
  leds: aat1290: add support for V4L2 Flash sub-device

 .../devicetree/bindings/leds/leds-aat1290.txt  |   70 ++
 Documentation/devicetree/bindings/mfd/max77693.txt |   61 ++
 .../devicetree/bindings/vendor-prefixes.txt|1 +
 Documentation/leds/leds-class-flash.txt|   13 +
 drivers/leds/Kconfig   |   19 +
 drivers/leds/Makefile  |2 +
 drivers/leds/leds-aat1290.c|  518 ++
 drivers/leds/leds-max77693.c   | 1086 
 drivers/leds/leds.h|   24 -
 drivers/media/v4l2-core/Kconfig|   11 +
 drivers/media/v4l2-core/Makefile   |2 +
 drivers/media/v4l2-core/v4l2-flash.c   |  619 +++
 include/linux/led-class-flash.h|   16 +-
 include/linux/leds.h   |   24 +
 include/media/v4l2-flash.h |  144 +++
 include/uapi/linux/leds.h  |   34 +
 16 files changed, 2605 insertions(+), 39 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/leds/leds-aat1290.txt
 create mode 100644 drivers/leds/leds-aat1290.c
 create mode 100644 drivers/leds/leds-max77693.c
 create mode 100644 drivers/media/v4l2-core/v4l2-flash.c
 create mode 100644 include/media/v4l2-flash.h
 create mode 100644 include/uapi/linux/leds.h

-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 04/11] DT: Add documentation for the mfd Maxim max77693

2015-03-27 Thread Jacek Anaszewski

Hi Rob,

This patch has been around for a long time already and has
undergone several modifications in response to review
remarks. It lacks only DT maintainer's Ack.

Could you express your opinion, please?


On 03/27/2015 02:49 PM, Jacek Anaszewski wrote:

This patch adds device tree binding documentation for
the flash cell of the Maxim max77693 multifunctional device.

Signed-off-by: Jacek Anaszewski j.anaszew...@samsung.com
Signed-off-by: Andrzej Hajda a.ha...@samsung.com
Acked-by: Kyungmin Park kyungmin.p...@samsung.com
Acked-by: Sakari Ailus sakari.ai...@linux.intel.com
Cc: Lee Jones lee.jo...@linaro.org
Cc: Chanwoo Choi cw00.c...@samsung.com
Cc: Bryan Wu coolo...@gmail.com
Cc: Richard Purdie rpur...@rpsys.net
---
  Documentation/devicetree/bindings/mfd/max77693.txt |   61 
  1 file changed, 61 insertions(+)

diff --git a/Documentation/devicetree/bindings/mfd/max77693.txt 
b/Documentation/devicetree/bindings/mfd/max77693.txt
index 38e6440..15c546ea 100644
--- a/Documentation/devicetree/bindings/mfd/max77693.txt
+++ b/Documentation/devicetree/bindings/mfd/max77693.txt
@@ -76,7 +76,53 @@ Optional properties:
  Valid values: 430, 470, 480, 490
  Default: 430

+- led : the LED submodule device node
+
+There are two LED outputs available - FLED1 and FLED2. Each of them can
+control a separate LED or they can be connected together to double
+the maximum current for a single connected LED. One LED is represented
+by one child node.
+
+Required properties:
+- compatible : Must be maxim,max77693-led.
+
+Optional properties:
+- maxim,trigger-type : Flash trigger type.
+   Possible trigger types:
+   LEDS_TRIG_TYPE_EDGE (0) - Rising edge of the signal triggers
+   the flash,
+   LEDS_TRIG_TYPE_LEVEL (1) - Strobe pulse length controls duration
+   of the flash.
+- maxim,boost-mode :
+   In boost mode the device can produce up to 1.2A of total current
+   on both outputs. The maximum current on each output is reduced
+   to 625mA then. If not enabled explicitly, boost setting defaults to
+   LEDS_BOOST_FIXED in case both current sources are used.
+   Possible values:
+   LEDS_BOOST_OFF (0) - no boost,
+   LEDS_BOOST_ADAPTIVE (1) - adaptive mode,
+   LEDS_BOOST_FIXED (2) - fixed mode.
+- maxim,boost-mvout : Output voltage of the boost module in millivolts.
+- maxim,mvsys-min : Low input voltage level in millivolts. Flash is not fired
+   if chip estimates that system voltage could drop below this level due
+   to flash power consumption.
+
+Required properties of the LED child node:
+- led-sources : see Documentation/devicetree/bindings/leds/common.txt;
+   device current output identifiers: 0 - FLED1, 1 - FLED2
+
+Optional properties of the LED child node:
+- label : see Documentation/devicetree/bindings/leds/common.txt
+- max-microamp : see Documentation/devicetree/bindings/leds/common.txt
+   Range: 15625 - 25
+- flash-max-microamp : see Documentation/devicetree/bindings/leds/common.txt
+   Range: 15625 - 100
+- flash-timeout-us : see Documentation/devicetree/bindings/leds/common.txt
+   Range: 62500 - 100
+
  Example:
+#include dt-bindings/leds/common.h
+
max77693@66 {
compatible = maxim,max77693;
reg = 0x66;
@@ -117,5 +163,20 @@ Example:
maxim,thermal-regulation-celsius = 75;
maxim,battery-overcurrent-microamp = 300;
maxim,charge-input-threshold-microvolt = 430;
+
+   led {
+   compatible = maxim,max77693-led;
+   maxim,trigger-type = LEDS_TRIG_TYPE_LEVEL;
+   maxim,boost-mode = LEDS_BOOST_FIXED;
+   maxim,boost-mvout = 5000;
+   maxim,mvsys-min = 2400;
+
+   camera_flash: flash-led {
+   label = max77693-flash;
+   led-sources = 0, 1;
+   max-microamp = 50;
+   flash-max-microamp = 125;
+   flash-timeout-us = 100;
+   };
};
};




--
Best Regards,
Jacek Anaszewski
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: cx23885: DVBSky S952 dvb_register failed err = -22

2015-03-27 Thread Ole Ernst
Hi Antti,

I was able to test your current tree (8a56b6b..754594d) without SCR and
the frontends still run into a timeout. There seems to be an issue with
the patch in general. Is there something else I can test/try or do you
require some debug output?

Thanks,
Ole

Am 24.03.2015 um 20:51 schrieb Ole Ernst:
 Am 24.03.2015 um 16:22 schrieb Antti Palosaari:
 Someone has reported SCR/Unicable does not work with that demod driver,
 but I have no personal experience from whole thing... Could you try
 direct connection to LNB?
 
 I will test a direct connection over Easter, as I don't have physical
 access to the htpc right now. I will try to get someone else to test
 your patch, who hopefully doesn't use SCR.
 
 Ole
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: cx23885: DVBSky S952 dvb_register failed err = -22

2015-03-27 Thread Antti Palosaari

On 03/27/2015 07:24 PM, Ole Ernst wrote:

Hi Antti,

I was able to test your current tree (8a56b6b..754594d) without SCR and
the frontends still run into a timeout. There seems to be an issue with
the patch in general. Is there something else I can test/try or do you
require some debug output?


It is a bit hard to debug remotely... Somehow it must be find out where 
it starts failing. Is there some I/O communication problem with chips or 
tuning is failing for some other reason.


I have only old DS3000/TS2020 USB device and newer DS3103/TS2022 USB 
device, but no DS3103/TS2020 combination.


Could you try w_scan for example? Or szap? Some simple commandline tool.

regards
Antti





Thanks,
Ole

Am 24.03.2015 um 20:51 schrieb Ole Ernst:

Am 24.03.2015 um 16:22 schrieb Antti Palosaari:

Someone has reported SCR/Unicable does not work with that demod driver,
but I have no personal experience from whole thing... Could you try
direct connection to LNB?


I will test a direct connection over Easter, as I don't have physical
access to the htpc right now. I will try to get someone else to test
your patch, who hopefully doesn't use SCR.

Ole


--
http://palosaari.fi/
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] saa7164: fix querycap warning

2015-03-27 Thread Hans Verkuil
Hi Steve,

Please use this patch to fix the querycap warning in saa7164, this is the
correct fix. In the past drivers were all over the place in how they filled
in the capabilities field: it was either just the caps for the device node, or
the caps for the full driver capabilities. Now capabilities reports the
full driver caps and device_caps that of just the device node. Best of both
worlds. The warning was added to warn about drivers that didn't set device_caps
correctly, and it is a mystery to me how I missed saa7164. Anyway, the warning
did its job.

Regards,

Hans

--

Fix the VIDIOC_QUERYCAP warning due to the missing device_caps. Don't fill
in the version field, the V4L2 core will do that for you.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com

diff --git a/drivers/media/pci/saa7164/saa7164-encoder.c 
b/drivers/media/pci/saa7164/saa7164-encoder.c
index 9266965..7a0a651 100644
--- a/drivers/media/pci/saa7164/saa7164-encoder.c
+++ b/drivers/media/pci/saa7164/saa7164-encoder.c
@@ -721,13 +721,14 @@ static int vidioc_querycap(struct file *file, void  *priv,
sizeof(cap-card));
sprintf(cap-bus_info, PCI:%s, pci_name(dev-pci));

-   cap-capabilities =
+   cap-device_caps =
V4L2_CAP_VIDEO_CAPTURE |
-   V4L2_CAP_READWRITE |
-   0;
+   V4L2_CAP_READWRITE |
+   V4L2_CAP_TUNER;

-   cap-capabilities |= V4L2_CAP_TUNER;
-   cap-version = 0;
+   cap-capabilities = cap-device_caps |
+   V4L2_CAP_VBI_CAPTURE |
+   V4L2_CAP_DEVICE_CAPS;

return 0;
 }
diff --git a/drivers/media/pci/saa7164/saa7164-vbi.c 
b/drivers/media/pci/saa7164/saa7164-vbi.c
index 6e025fe..06117e6 100644
--- a/drivers/media/pci/saa7164/saa7164-vbi.c
+++ b/drivers/media/pci/saa7164/saa7164-vbi.c
@@ -660,13 +660,14 @@ static int vidioc_querycap(struct file *file, void  *priv,
sizeof(cap-card));
sprintf(cap-bus_info, PCI:%s, pci_name(dev-pci));

-   cap-capabilities =
+   cap-device_caps =
V4L2_CAP_VBI_CAPTURE |
-   V4L2_CAP_READWRITE |
-   0;
+   V4L2_CAP_READWRITE |
+   V4L2_CAP_TUNER;

-   cap-capabilities |= V4L2_CAP_TUNER;
-   cap-version = 0;
+   cap-capabilities = cap-device_caps |
+   V4L2_CAP_VIDEO_CAPTURE |
+   V4L2_CAP_DEVICE_CAPS;

return 0;
 }
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] [media] coda: drop dma_sync_single_for_device in coda_bitstream_queue

2015-03-27 Thread Ian Molton

On 25/03/15 16:45, Philipp Zabel wrote:

Issuing a cache flush for the whole bitstream buffer is not optimal in the first
place when only a part of it was written. But given that the buffer is mapped in
writecombine mode, it is not needed at all.

Signed-off-by: Philipp Zabel p.za...@pengutronix.de


Tested-by: Ian Molton imol...@ad-holdings.co.uk


---
  drivers/media/platform/coda/coda-bit.c | 4 
  1 file changed, 4 deletions(-)

diff --git a/drivers/media/platform/coda/coda-bit.c 
b/drivers/media/platform/coda/coda-bit.c
index d39789d..d336cb6 100644
--- a/drivers/media/platform/coda/coda-bit.c
+++ b/drivers/media/platform/coda/coda-bit.c
@@ -181,10 +181,6 @@ static int coda_bitstream_queue(struct coda_ctx *ctx,
if (n  src_size)
return -ENOSPC;

-   dma_sync_single_for_device(ctx-dev-plat_dev-dev,
-  ctx-bitstream.paddr, ctx-bitstream.size,
-  DMA_TO_DEVICE);
-
src_buf-v4l2_buf.sequence = ctx-qsequence++;

return 0;



--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] [media] usbvision: fix leak of usb_dev on failure paths in usbvision_probe()

2015-03-27 Thread Alexey Khoroshilov
There is no usb_put_dev() on failure paths in usbvision_probe().

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov khoroshi...@ispras.ru
---
 drivers/media/usb/usbvision/usbvision-video.c | 24 +---
 1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/drivers/media/usb/usbvision/usbvision-video.c 
b/drivers/media/usb/usbvision/usbvision-video.c
index cd2fbf11e3b4..239d0e0ca087 100644
--- a/drivers/media/usb/usbvision/usbvision-video.c
+++ b/drivers/media/usb/usbvision/usbvision-video.c
@@ -1525,7 +1525,7 @@ static int usbvision_probe(struct usb_interface *intf,
const struct usb_host_interface *interface;
struct usb_usbvision *usbvision = NULL;
const struct usb_endpoint_descriptor *endpoint;
-   int model, i;
+   int model, i, ret;
 
PDEBUG(DBG_PROBE, VID=%#04x, PID=%#04x, ifnum=%u,
dev-descriptor.idVendor,
@@ -1534,7 +1534,8 @@ static int usbvision_probe(struct usb_interface *intf,
model = devid-driver_info;
if (model  0 || model = usbvision_device_data_size) {
PDEBUG(DBG_PROBE, model out of bounds %d, model);
-   return -ENODEV;
+   ret = -ENODEV;
+   goto err_usb;
}
printk(KERN_INFO %s: %s found\n, __func__,
usbvision_device_data[model].model_string);
@@ -1549,18 +1550,21 @@ static int usbvision_probe(struct usb_interface *intf,
__func__, ifnum);
dev_err(intf-dev, %s: Endpoint attributes %d,
__func__, endpoint-bmAttributes);
-   return -ENODEV;
+   ret = -ENODEV;
+   goto err_usb;
}
if (usb_endpoint_dir_out(endpoint)) {
dev_err(intf-dev, %s: interface %d. has ISO OUT endpoint!\n,
__func__, ifnum);
-   return -ENODEV;
+   ret = -ENODEV;
+   goto err_usb;
}
 
usbvision = usbvision_alloc(dev, intf);
if (usbvision == NULL) {
dev_err(intf-dev, %s: couldn't allocate USBVision struct\n, 
__func__);
-   return -ENOMEM;
+   ret = -ENOMEM;
+   goto err_usb;
}
 
if (dev-descriptor.bNumConfigurations  1)
@@ -1579,8 +1583,8 @@ static int usbvision_probe(struct usb_interface *intf,
usbvision-alt_max_pkt_size = kmalloc(32 * usbvision-num_alt, 
GFP_KERNEL);
if (usbvision-alt_max_pkt_size == NULL) {
dev_err(intf-dev, usbvision: out of memory!\n);
-   usbvision_release(usbvision);
-   return -ENOMEM;
+   ret = -ENOMEM;
+   goto err_pkt;
}
 
for (i = 0; i  usbvision-num_alt; i++) {
@@ -1615,6 +1619,12 @@ static int usbvision_probe(struct usb_interface *intf,
 
PDEBUG(DBG_PROBE, success);
return 0;
+
+err_pkt:
+   usbvision_release(usbvision);
+err_usb:
+   usb_put_dev(dev);
+   return ret;
 }
 
 
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[GIT PULL 4.1] TS2020 / TS2022

2015-03-27 Thread Antti Palosaari

Add TS2022 support to TS2020 driver. Relative small changes were
needed. Add I2C binding to TS2020. Switch TS2022 users to TS2020
and finally drop obsolete TS2022.

Antti

The following changes since commit 8a56b6b5fd6ff92b7e27d870b803b11b751660c2:

  [media] v4l2-subdev: remove enum_framesizes/intervals (2015-03-23 
12:02:41 -0700)


are available in the git repository at:

  git://linuxtv.org/anttip/media_tree.git ts2020_pull

for you to fetch changes up to 23e73a15c8056b6a2a923a8fe6b9a20141b6274d:

  ts2020: do not use i2c_transfer() on sleep() (2015-03-27 02:17:23 +0200)


Antti Palosaari (8):
  ts2020: add support for TS2022
  ts2020: implement I2C client bindings
  em28xx: switch PCTV 461e to ts2020 driver
  cx23885: switch ts2022 to ts2020 driver
  smipcie: switch ts2022 to ts2020 driver
  dvbsky: switch ts2022 to ts2020 driver
  m88ts2022: remove obsolete driver
  ts2020: do not use i2c_transfer() on sleep()

 MAINTAINERS |  10 ---
 drivers/media/dvb-frontends/ts2020.c| 302 
+++--

 drivers/media/dvb-frontends/ts2020.h|  25 ++-
 drivers/media/pci/cx23885/Kconfig   |   1 -
 drivers/media/pci/cx23885/cx23885-dvb.c |  30 -
 drivers/media/pci/smipcie/Kconfig   |   2 +-
 drivers/media/pci/smipcie/smipcie.c |  12 ++--
 drivers/media/tuners/Kconfig|   8 ---
 drivers/media/tuners/m88ts2022.c| 579 
---

 drivers/media/tuners/m88ts2022.h|  54 
 drivers/media/tuners/m88ts2022_priv.h   |  35 --
 drivers/media/usb/dvb-usb-v2/Kconfig|   2 +-
 drivers/media/usb/dvb-usb-v2/dvbsky.c   |  26 
 drivers/media/usb/em28xx/Kconfig|   2 +-
 drivers/media/usb/em28xx/em28xx-dvb.c   |  13 ++--
 15 files changed, 331 insertions(+), 770 deletions(-)
 delete mode 100644 drivers/media/tuners/m88ts2022.c
 delete mode 100644 drivers/media/tuners/m88ts2022.h
 delete mode 100644 drivers/media/tuners/m88ts2022_priv.h
[
--
http://palosaari.fi/
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


cron job: media_tree daily build: WARNINGS

2015-03-27 Thread Hans Verkuil
This message is generated daily by a cron job that builds media_tree for
the kernels and architectures in the list below.

Results of the daily build of media_tree:

date:   Sat Mar 28 04:00:14 CET 2015
git branch: test
git hash:   8a56b6b5fd6ff92b7e27d870b803b11b751660c2
gcc version:i686-linux-gcc (GCC) 4.9.1
sparse version: v0.5.0-44-g40791b9
smatch version: 0.4.1-3153-g7d56ab3
host hardware:  x86_64
host os:3.19.0-1.slh.1-amd64

linux-git-arm-at91: OK
linux-git-arm-davinci: OK
linux-git-arm-exynos: OK
linux-git-arm-mx: OK
linux-git-arm-omap: OK
linux-git-arm-omap1: OK
linux-git-arm-pxa: OK
linux-git-blackfin: OK
linux-git-i686: OK
linux-git-m32r: OK
linux-git-mips: OK
linux-git-powerpc64: OK
linux-git-sh: OK
linux-git-x86_64: OK
linux-2.6.32.27-i686: OK
linux-2.6.33.7-i686: OK
linux-2.6.34.7-i686: OK
linux-2.6.35.9-i686: OK
linux-2.6.36.4-i686: OK
linux-2.6.37.6-i686: OK
linux-2.6.38.8-i686: OK
linux-2.6.39.4-i686: OK
linux-3.0.60-i686: OK
linux-3.1.10-i686: OK
linux-3.2.37-i686: OK
linux-3.3.8-i686: OK
linux-3.4.27-i686: OK
linux-3.5.7-i686: OK
linux-3.6.11-i686: OK
linux-3.7.4-i686: OK
linux-3.8-i686: WARNINGS
linux-3.9.2-i686: WARNINGS
linux-3.10.1-i686: OK
linux-3.11.1-i686: OK
linux-3.12.23-i686: OK
linux-3.13.11-i686: OK
linux-3.14.9-i686: OK
linux-3.15.2-i686: OK
linux-3.16.7-i686: OK
linux-3.17.8-i686: OK
linux-3.18.7-i686: OK
linux-3.19-i686: OK
linux-4.0-rc1-i686: OK
linux-2.6.32.27-x86_64: OK
linux-2.6.33.7-x86_64: OK
linux-2.6.34.7-x86_64: OK
linux-2.6.35.9-x86_64: OK
linux-2.6.36.4-x86_64: OK
linux-2.6.37.6-x86_64: OK
linux-2.6.38.8-x86_64: OK
linux-2.6.39.4-x86_64: OK
linux-3.0.60-x86_64: OK
linux-3.1.10-x86_64: OK
linux-3.2.37-x86_64: OK
linux-3.3.8-x86_64: OK
linux-3.4.27-x86_64: OK
linux-3.5.7-x86_64: OK
linux-3.6.11-x86_64: OK
linux-3.7.4-x86_64: OK
linux-3.8-x86_64: WARNINGS
linux-3.9.2-x86_64: WARNINGS
linux-3.10.1-x86_64: OK
linux-3.11.1-x86_64: OK
linux-3.12.23-x86_64: OK
linux-3.13.11-x86_64: OK
linux-3.14.9-x86_64: OK
linux-3.15.2-x86_64: OK
linux-3.16.7-x86_64: OK
linux-3.17.8-x86_64: OK
linux-3.18.7-x86_64: OK
linux-3.19-x86_64: OK
linux-4.0-rc1-x86_64: OK
apps: OK
spec-git: OK
sparse: WARNINGS
smatch: ERRORS

Detailed results are available here:

http://www.xs4all.nl/~hverkuil/logs/Saturday.log

Full logs are available here:

http://www.xs4all.nl/~hverkuil/logs/Saturday.tar.bz2

The Media Infrastructure API from this daily build is here:

http://www.xs4all.nl/~hverkuil/spec/media.html
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html