[PATCH v2] [media] staging: atomisp: use clock framework for camera clocks

2017-09-20 Thread Pierre-Louis Bossart
The Atom ISP driver initializes and configures PMC clocks which are
already handled by the clock framework.

Remove all legacy vlv2_platform_clock stuff and move to the clk API to
avoid conflicts, e.g. with audio machine drivers enabling the MCLK for
external codecs

Fixes: a49d25364dfb ("staging/atomisp: Add support for the Intel IPU v2")
Tested-by: Carlo Caione <ca...@endlessm.com>
Reviewed-by: Andy Shevchenko <andriy.shevche...@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.boss...@linux.intel.com>
---
v2: added Andy's Reviewed-by and Fixes tag

 drivers/staging/media/atomisp/Kconfig  |   1 +
 drivers/staging/media/atomisp/platform/Makefile|   1 -
 .../staging/media/atomisp/platform/clock/Makefile  |   6 -
 .../platform/clock/platform_vlv2_plat_clk.c|  40 
 .../platform/clock/platform_vlv2_plat_clk.h|  27 ---
 .../media/atomisp/platform/clock/vlv2_plat_clock.c | 247 -
 .../platform/intel-mid/atomisp_gmin_platform.c |  63 +-
 7 files changed, 52 insertions(+), 333 deletions(-)
 delete mode 100644 drivers/staging/media/atomisp/platform/clock/Makefile
 delete mode 100644 
drivers/staging/media/atomisp/platform/clock/platform_vlv2_plat_clk.c
 delete mode 100644 
drivers/staging/media/atomisp/platform/clock/platform_vlv2_plat_clk.h
 delete mode 100644 
drivers/staging/media/atomisp/platform/clock/vlv2_plat_clock.c

diff --git a/drivers/staging/media/atomisp/Kconfig 
b/drivers/staging/media/atomisp/Kconfig
index 8eb13c3ba29c..7cdebea35ccf 100644
--- a/drivers/staging/media/atomisp/Kconfig
+++ b/drivers/staging/media/atomisp/Kconfig
@@ -1,6 +1,7 @@
 menuconfig INTEL_ATOMISP
 bool "Enable support to Intel MIPI camera drivers"
 depends on X86 && EFI && MEDIA_CONTROLLER && PCI && ACPI
+   select COMMON_CLK
 help
   Enable support for the Intel ISP2 camera interfaces and MIPI
   sensor drivers.
diff --git a/drivers/staging/media/atomisp/platform/Makefile 
b/drivers/staging/media/atomisp/platform/Makefile
index df157630bda9..0e3b7e1c81c6 100644
--- a/drivers/staging/media/atomisp/platform/Makefile
+++ b/drivers/staging/media/atomisp/platform/Makefile
@@ -2,5 +2,4 @@
 # Makefile for camera drivers.
 #
 
-obj-$(CONFIG_INTEL_ATOMISP) += clock/
 obj-$(CONFIG_INTEL_ATOMISP) += intel-mid/
diff --git a/drivers/staging/media/atomisp/platform/clock/Makefile 
b/drivers/staging/media/atomisp/platform/clock/Makefile
deleted file mode 100644
index 82fbe8b6968a..
--- a/drivers/staging/media/atomisp/platform/clock/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-#
-# Makefile for clock devices.
-#
-
-obj-$(CONFIG_INTEL_ATOMISP)+= vlv2_plat_clock.o
-obj-$(CONFIG_INTEL_ATOMISP) += platform_vlv2_plat_clk.o
diff --git 
a/drivers/staging/media/atomisp/platform/clock/platform_vlv2_plat_clk.c 
b/drivers/staging/media/atomisp/platform/clock/platform_vlv2_plat_clk.c
deleted file mode 100644
index 0aae9b0283bb..
--- a/drivers/staging/media/atomisp/platform/clock/platform_vlv2_plat_clk.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * platform_vlv2_plat_clk.c - VLV2 platform clock driver
- * Copyright (C) 2013 Intel Corporation
- *
- * Author: Asutosh Pathak <asutosh.pat...@intel.com>
- * Author: Chandra Sekhar Anagani <chandra.sekhar.anag...@intel.com>
- * Author: Sergio Aguirre <sergio.a.aguirre.rodrig...@intel.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * 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.
- *
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-
-static int __init vlv2_plat_clk_init(void)
-{
-   struct platform_device *pdev;
-
-   pdev = platform_device_register_simple("vlv2_plat_clk", -1, NULL, 0);
-   if (IS_ERR(pdev)) {
-   pr_err("platform_vlv2_plat_clk:register failed: %ld\n",
-   PTR_ERR(pdev));
-   return PTR_ERR(pdev);
-   }
-
-   return 0;
-}
-
-device_initcall(vlv2_plat_clk_init);
diff --git 
a/drivers/staging/media/atomisp/platform/clock/platform_vlv2_plat_clk.h 
b/drivers/staging/media/atomisp/platform/clock/platform_vlv2_plat_clk.h
deleted file mode 100644
index b730ab0e8223..
--- a/drivers/staging/media/atomisp/platform/clock/platform_vlv2_plat_clk.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * platform_vlv2_plat_clk.h: platform clock driver library header file
- * Copyright (C) 2013 Intel Corporation
- *
- * Author: Asutosh Pathak <asutosh.pat...@intel.com>
- * Author: Chandra Sekhar Anagani <chandra.sek

Re: [PATCH] [media] staging: atomisp: use clock framework for camera clocks

2017-09-20 Thread Pierre-Louis Bossart



On 09/20/2017 04:12 AM, Andy Shevchenko wrote:

On Tue, 2017-09-19 at 15:45 -0500, Pierre-Louis Bossart wrote:

The Atom ISP driver initializes and configures PMC clocks which are
already handled by the clock framework.

Remove all legacy vlv2_platform_clock stuff and move to the clk API to
avoid conflicts, e.g. with audio machine drivers enabling the MCLK for
external codecs


I think it might have a Fixes: tag as well (though I dunno which commit
could be considered as anchor).
The initial integration of the atomisp driver already had this problem, 
i'll add a reference to

'a49d25364dfb9 ("staging/atomisp: Add support for the Intel IPU v2")'


(I doubt Git is so clever to remove files based on information out of
the diff, can you check it and if needed to resend without -D implied?)
Gee, I thought -C -M -D were the standard options to checkpatch, never 
realized it'd prevent patches from applying. Thanks for the tip.




Other than that - nice clean up!

Reviewed-by: Andy Shevchenko <andriy.shevche...@linux.intel.com>

I'll add your Reviewed-by in the v2. Thanks for the review.




Tested-by: Carlo Caione <ca...@endlessm.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.
com>
---
  drivers/staging/media/atomisp/Kconfig  |   1 +
  drivers/staging/media/atomisp/platform/Makefile|   1 -
  .../staging/media/atomisp/platform/clock/Makefile  |   6 -
  .../platform/clock/platform_vlv2_plat_clk.c|  40 
  .../platform/clock/platform_vlv2_plat_clk.h|  27 ---
  .../media/atomisp/platform/clock/vlv2_plat_clock.c | 247 
-
  .../platform/intel-mid/atomisp_gmin_platform.c |  63 +-
  7 files changed, 52 insertions(+), 333 deletions(-)
  delete mode 100644
drivers/staging/media/atomisp/platform/clock/Makefile
  delete mode 100644
drivers/staging/media/atomisp/platform/clock/platform_vlv2_plat_clk.c
  delete mode 100644
drivers/staging/media/atomisp/platform/clock/platform_vlv2_plat_clk.h
  delete mode 100644
drivers/staging/media/atomisp/platform/clock/vlv2_plat_clock.c

diff --git a/drivers/staging/media/atomisp/Kconfig
b/drivers/staging/media/atomisp/Kconfig
index 8eb13c3ba29c..7cdebea35ccf 100644
--- a/drivers/staging/media/atomisp/Kconfig
+++ b/drivers/staging/media/atomisp/Kconfig
@@ -1,6 +1,7 @@
  menuconfig INTEL_ATOMISP
  bool "Enable support to Intel MIPI camera drivers"
  depends on X86 && EFI && MEDIA_CONTROLLER && PCI && ACPI
+   select COMMON_CLK
  help
Enable support for the Intel ISP2 camera interfaces and
MIPI
sensor drivers.
diff --git a/drivers/staging/media/atomisp/platform/Makefile
b/drivers/staging/media/atomisp/platform/Makefile
index df157630bda9..0e3b7e1c81c6 100644
--- a/drivers/staging/media/atomisp/platform/Makefile
+++ b/drivers/staging/media/atomisp/platform/Makefile
@@ -2,5 +2,4 @@
  # Makefile for camera drivers.
  #
  
-obj-$(CONFIG_INTEL_ATOMISP) += clock/

  obj-$(CONFIG_INTEL_ATOMISP) += intel-mid/
diff --git a/drivers/staging/media/atomisp/platform/clock/Makefile
b/drivers/staging/media/atomisp/platform/clock/Makefile
deleted file mode 100644
index 82fbe8b6968a..
diff --git
a/drivers/staging/media/atomisp/platform/clock/platform_vlv2_plat_clk.
c
b/drivers/staging/media/atomisp/platform/clock/platform_vlv2_plat_clk.
c
deleted file mode 100644
index 0aae9b0283bb..
diff --git
a/drivers/staging/media/atomisp/platform/clock/platform_vlv2_plat_clk.
h
b/drivers/staging/media/atomisp/platform/clock/platform_vlv2_plat_clk.
h
deleted file mode 100644
index b730ab0e8223..
diff --git
a/drivers/staging/media/atomisp/platform/clock/vlv2_plat_clock.c
b/drivers/staging/media/atomisp/platform/clock/vlv2_plat_clock.c
deleted file mode 100644
index f96789a31819..
diff --git a/drivers/staging/media/atomisp/platform/intel-
mid/atomisp_gmin_platform.c
b/drivers/staging/media/atomisp/platform/intel-
mid/atomisp_gmin_platform.c
index edaae93af8f9..17b4cfae5abf 100644
--- a/drivers/staging/media/atomisp/platform/intel-
mid/atomisp_gmin_platform.c
+++ b/drivers/staging/media/atomisp/platform/intel-
mid/atomisp_gmin_platform.c
@@ -4,10 +4,10 @@
  #include 
  #include 
  #include 
+#include 
  #include 
  #include 
  #include 
-#include "../../include/linux/vlv2_plat_clock.h"
  #include 
  #include 
  #include 
@@ -17,11 +17,7 @@
  
  #define MAX_SUBDEVS 8
  
-/* Should be defined in vlv2_plat_clock API, isn't: */

-#define VLV2_CLK_PLL_19P2MHZ 1
-#define VLV2_CLK_XTAL_19P2MHZ 0
-#define VLV2_CLK_ON  1
-#define VLV2_CLK_OFF 2
+#define VLV2_CLK_PLL_19P2MHZ 1 /* XTAL on CHT */
  #define ELDO1_SEL_REG 0x19
  #define ELDO1_1P8V0x16
  #define ELDO1_CTRL_SHIFT 0x00
@@ -33,6 +29,7 @@ struct gmin_subdev {
struct v4l2_subdev *subdev;
int clock_num;
int clock_src;
+   struct clk *pmc_clk;
struct gpio_

[PATCH] [media] staging: atomisp: use clock framework for camera clocks

2017-09-19 Thread Pierre-Louis Bossart
The Atom ISP driver initializes and configures PMC clocks which are
already handled by the clock framework.

Remove all legacy vlv2_platform_clock stuff and move to the clk API to
avoid conflicts, e.g. with audio machine drivers enabling the MCLK for
external codecs

Tested-by: Carlo Caione <ca...@endlessm.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.boss...@linux.intel.com>
---
 drivers/staging/media/atomisp/Kconfig  |   1 +
 drivers/staging/media/atomisp/platform/Makefile|   1 -
 .../staging/media/atomisp/platform/clock/Makefile  |   6 -
 .../platform/clock/platform_vlv2_plat_clk.c|  40 
 .../platform/clock/platform_vlv2_plat_clk.h|  27 ---
 .../media/atomisp/platform/clock/vlv2_plat_clock.c | 247 -
 .../platform/intel-mid/atomisp_gmin_platform.c |  63 +-
 7 files changed, 52 insertions(+), 333 deletions(-)
 delete mode 100644 drivers/staging/media/atomisp/platform/clock/Makefile
 delete mode 100644 
drivers/staging/media/atomisp/platform/clock/platform_vlv2_plat_clk.c
 delete mode 100644 
drivers/staging/media/atomisp/platform/clock/platform_vlv2_plat_clk.h
 delete mode 100644 
drivers/staging/media/atomisp/platform/clock/vlv2_plat_clock.c

diff --git a/drivers/staging/media/atomisp/Kconfig 
b/drivers/staging/media/atomisp/Kconfig
index 8eb13c3ba29c..7cdebea35ccf 100644
--- a/drivers/staging/media/atomisp/Kconfig
+++ b/drivers/staging/media/atomisp/Kconfig
@@ -1,6 +1,7 @@
 menuconfig INTEL_ATOMISP
 bool "Enable support to Intel MIPI camera drivers"
 depends on X86 && EFI && MEDIA_CONTROLLER && PCI && ACPI
+   select COMMON_CLK
 help
   Enable support for the Intel ISP2 camera interfaces and MIPI
   sensor drivers.
diff --git a/drivers/staging/media/atomisp/platform/Makefile 
b/drivers/staging/media/atomisp/platform/Makefile
index df157630bda9..0e3b7e1c81c6 100644
--- a/drivers/staging/media/atomisp/platform/Makefile
+++ b/drivers/staging/media/atomisp/platform/Makefile
@@ -2,5 +2,4 @@
 # Makefile for camera drivers.
 #
 
-obj-$(CONFIG_INTEL_ATOMISP) += clock/
 obj-$(CONFIG_INTEL_ATOMISP) += intel-mid/
diff --git a/drivers/staging/media/atomisp/platform/clock/Makefile 
b/drivers/staging/media/atomisp/platform/clock/Makefile
deleted file mode 100644
index 82fbe8b6968a..
diff --git 
a/drivers/staging/media/atomisp/platform/clock/platform_vlv2_plat_clk.c 
b/drivers/staging/media/atomisp/platform/clock/platform_vlv2_plat_clk.c
deleted file mode 100644
index 0aae9b0283bb..
diff --git 
a/drivers/staging/media/atomisp/platform/clock/platform_vlv2_plat_clk.h 
b/drivers/staging/media/atomisp/platform/clock/platform_vlv2_plat_clk.h
deleted file mode 100644
index b730ab0e8223..
diff --git a/drivers/staging/media/atomisp/platform/clock/vlv2_plat_clock.c 
b/drivers/staging/media/atomisp/platform/clock/vlv2_plat_clock.c
deleted file mode 100644
index f96789a31819..
diff --git 
a/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c 
b/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c
index edaae93af8f9..17b4cfae5abf 100644
--- a/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c
+++ b/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c
@@ -4,10 +4,10 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
-#include "../../include/linux/vlv2_plat_clock.h"
 #include 
 #include 
 #include 
@@ -17,11 +17,7 @@
 
 #define MAX_SUBDEVS 8
 
-/* Should be defined in vlv2_plat_clock API, isn't: */
-#define VLV2_CLK_PLL_19P2MHZ 1
-#define VLV2_CLK_XTAL_19P2MHZ 0
-#define VLV2_CLK_ON  1
-#define VLV2_CLK_OFF 2
+#define VLV2_CLK_PLL_19P2MHZ 1 /* XTAL on CHT */
 #define ELDO1_SEL_REG  0x19
 #define ELDO1_1P8V 0x16
 #define ELDO1_CTRL_SHIFT 0x00
@@ -33,6 +29,7 @@ struct gmin_subdev {
struct v4l2_subdev *subdev;
int clock_num;
int clock_src;
+   struct clk *pmc_clk;
struct gpio_desc *gpio0;
struct gpio_desc *gpio1;
struct regulator *v1p8_reg;
@@ -344,6 +341,9 @@ static int gmin_platform_deinit(void)
return 0;
 }
 
+#define GMIN_PMC_CLK_NAME 14 /* "pmc_plt_clk_[0..5]" */
+static char gmin_pmc_clk_name[GMIN_PMC_CLK_NAME];
+
 static struct gmin_subdev *gmin_subdev_add(struct v4l2_subdev *subdev)
 {
int i, ret;
@@ -377,6 +377,37 @@ static struct gmin_subdev *gmin_subdev_add(struct 
v4l2_subdev *subdev)
gmin_subdevs[i].gpio0 = gpiod_get_index(dev, NULL, 0, GPIOD_OUT_LOW);
gmin_subdevs[i].gpio1 = gpiod_get_index(dev, NULL, 1, GPIOD_OUT_LOW);
 
+   /* get PMC clock with clock framework */
+   snprintf(gmin_pmc_clk_name,
+sizeof(gmin_pmc_clk_name),
+"%s_%d", "pmc_plt_clk", gmin_subdevs[i].clock_num);
+
+   gmin_subdevs[i].pmc_clk = devm_clk_g

waiting for your reply soon

2015-08-27 Thread Louis

Remember! It won't sell if nobody knows you have it.

You are receiving this email because we wish you to use our target email
marketing service.
We specialize in providing target email marketing services.
We have worked on a number of projects and campaigns,
all our packages are tailor made and designed according to your
requirements.

Increase your client base and market your product to millions or l
et us bring the buying leads for you!
Our goal is to increase your business sales 2-5 times than now.

If you would require more information please send us an email and
we would be glad to discuss the project requirements with you!

Kind Regards
Louis
Contact: vivian...@sina.com
Remember! It won't sell if nobody knows you have it.

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


our email marketing

2015-04-20 Thread Louis

Hope you are doing well!
We specialize in providing email marketing services to a number of
businesses.

We would like to be your marketing partners and help your business reach
the next level.
We can increase your business sales 2-4 times than before.

Please contact us if you would require more information about pricing or
proposal.
Looking forward to your positive response.

Thanks,
Louis
Email: swift...@tom.com


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


our email marketing

2015-04-20 Thread Louis

Hope you are doing well!
We specialize in providing email marketing services to a number of
businesses.

We would like to be your marketing partners and help your business reach
the next level.
We can increase your business sales 2-4 times than before.

Please contact us if you would require more information about pricing or
proposal.
Looking forward to your positive response.

Thanks,
Louis
Email: swift...@tom.com


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


we can bring you buying leads

2015-04-04 Thread Louis

Hope you are doing good today!
We are email marketing specialist.
We can increase your client base and bring the buying leads to you!
We can increase your business sales 2-4 times than now.

Pls contact for pricing and proposal in details.

Thanks,
Louis
Technical Director
Contact: cary...@aliyun.com

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel