Re: [PATCH v2 bluetooth-next] cc2520: set the default fifo pin value from platform data

2015-08-10 Thread Varka Bhadram

On 08/11/2015 08:13 AM, sdliy...@gmail.com wrote:

From: Yong Li 

When the device tree support is disabled, the fifo_pin is uninitialized,
this patch will set the fifo_pin value based on platform data

Signed-off-by: Yong Li 


Acked-by: Varka Bhadram 


---
  drivers/net/ieee802154/cc2520.c | 1 +
  1 file changed, 1 insertion(+)

diff --git a/drivers/net/ieee802154/cc2520.c b/drivers/net/ieee802154/cc2520.c
index 613dae5..c5b54a1 100644
--- a/drivers/net/ieee802154/cc2520.c
+++ b/drivers/net/ieee802154/cc2520.c
@@ -833,6 +833,7 @@ static int cc2520_get_platform_data(struct spi_device *spi,
if (!spi_pdata)
return -ENOENT;
*pdata = *spi_pdata;
+   priv->fifo_pin = pdata->fifo;
return 0;
}
  


--
Varka Bhadram.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCHv1 bluetooth-next] cc2520: set the default fifo pin value from platform data

2015-08-10 Thread Varka Bhadram

Yup...  :-)  Your name in the From (LIYONG) address is different from SOB (Yong 
Li) address.
It should be same, please fix your email-client.

On 08/10/2015 12:59 PM, LIYONG wrote:


In case of the device tree support is disabled, the fifo_pin is uninitialized, 
this
patch will set the fifo_pin value based on platform data

Signed-off-by: Yong Li
---
  drivers/net/ieee802154/cc2520.c | 1 +
  1 file changed, 1 insertion(+)

diff --git a/drivers/net/ieee802154/cc2520.c b/drivers/net/ieee802154/cc2520.c
index 613dae5..c5b54a1 100644
--- a/drivers/net/ieee802154/cc2520.c
+++ b/drivers/net/ieee802154/cc2520.c
@@ -833,6 +833,7 @@ static int cc2520_get_platform_data(struct spi_device *spi,
 if (!spi_pdata)
 return -ENOENT;
 *pdata = *spi_pdata;
+   priv->fifo_pin = pdata->fifo;
 return 0;
 }

--
2.1.0




This patch is not applying.

Please use 'git format-patch' to generate the patch. And send it by 'git 
send-email'

In your case:
git commit -am -s "cc2520: set the default fifo pin value from platform 
data"
git format-patch --subject-prefix="PATCH v2 bluetooth-next" -1
git send-email 0001-


--
Varka Bhadram.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCHv1 bluetooth-next] cc2520: set the default fifo pin value from platform data

2015-08-10 Thread Varka Bhadram

Yup...  :-)  Your name in the From (LIYONG) address is different from SOB (Yong 
Li) address.
It should be same, please fix your email-client.

On 08/10/2015 12:59 PM, LIYONG wrote:


In case of the device tree support is disabled, the fifo_pin is uninitialized, 
this
patch will set the fifo_pin value based on platform data

Signed-off-by: Yong Lisdliy...@gmail.com
---
  drivers/net/ieee802154/cc2520.c | 1 +
  1 file changed, 1 insertion(+)

diff --git a/drivers/net/ieee802154/cc2520.c b/drivers/net/ieee802154/cc2520.c
index 613dae5..c5b54a1 100644
--- a/drivers/net/ieee802154/cc2520.c
+++ b/drivers/net/ieee802154/cc2520.c
@@ -833,6 +833,7 @@ static int cc2520_get_platform_data(struct spi_device *spi,
 if (!spi_pdata)
 return -ENOENT;
 *pdata = *spi_pdata;
+   priv-fifo_pin = pdata-fifo;
 return 0;
 }

--
2.1.0




This patch is not applying.

Please use 'git format-patch' to generate the patch. And send it by 'git 
send-email'

In your case:
git commit -am -s cc2520: set the default fifo pin value from platform 
data
git format-patch --subject-prefix=PATCH v2 bluetooth-next -1
git send-email 0001-


--
Varka Bhadram.

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


Re: [PATCH v2 bluetooth-next] cc2520: set the default fifo pin value from platform data

2015-08-10 Thread Varka Bhadram

On 08/11/2015 08:13 AM, sdliy...@gmail.com wrote:

From: Yong Li sdliy...@gmail.com

When the device tree support is disabled, the fifo_pin is uninitialized,
this patch will set the fifo_pin value based on platform data

Signed-off-by: Yong Li sdliy...@gmail.com


Acked-by: Varka Bhadram varkabhad...@gmail.com


---
  drivers/net/ieee802154/cc2520.c | 1 +
  1 file changed, 1 insertion(+)

diff --git a/drivers/net/ieee802154/cc2520.c b/drivers/net/ieee802154/cc2520.c
index 613dae5..c5b54a1 100644
--- a/drivers/net/ieee802154/cc2520.c
+++ b/drivers/net/ieee802154/cc2520.c
@@ -833,6 +833,7 @@ static int cc2520_get_platform_data(struct spi_device *spi,
if (!spi_pdata)
return -ENOENT;
*pdata = *spi_pdata;
+   priv-fifo_pin = pdata-fifo;
return 0;
}
  


--
Varka Bhadram.

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


Re: [v3 5/7] pwm: crc: Add Crystalcove (CRC) PWM driver

2015-06-26 Thread Varka Bhadram

On 06/26/2015 02:32 PM, Shobhit Kumar wrote:

The Crystalcove PMIC provides three PWM signals and this driver exports
one of them on the BYT platform which is used to control backlight for
DSI panel. This is platform device implementation of the drivers/mfd
cell device for CRC PMIC.

CC: Samuel Ortiz 
Cc: Linus Walleij 
Cc: Alexandre Courbot 
Cc: Thierry Reding 
Cc: Paul Bolle 
Cc: Paul Gortmaker 
Tested-by: Ville Syrjälä 
Signed-off-by: Shobhit Kumar 
---
v2: Use the existing config callback with duty_ns and period_ns(Thierry)

v3: Correct the subject line (Lee jones)

v4: Address comment by Thierry & Paul
 - Commit message update and fixes for few syntax errors
 - Add PWM_CRC in Kconfig and Makefile sorted alphabetically
 - Use the PWM_BASE_CLK as 600 for better code readability
 - Remove the redundant rule of three while calculating pwm level
 - Use the platform_device in pwm_chip
 - Use builin_platform_driver

v5: Address comments by Varka
 - Make the bit definition using BIT macro
 - reorder probe and remove code to directly return from pwmchip_add/remove

  drivers/pwm/Kconfig   |   7 +++
  drivers/pwm/Makefile  |   1 +
  drivers/pwm/pwm-crc.c | 143 ++
  3 files changed, 151 insertions(+)
  create mode 100644 drivers/pwm/pwm-crc.c


Reviewed-by: Varka Bhadram 

--
Best regards,
Varka Bhadram.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [v3 5/7] pwm: crc: Add Crystalcove (CRC) PWM driver

2015-06-26 Thread Varka Bhadram

On 06/26/2015 02:32 PM, Shobhit Kumar wrote:

The Crystalcove PMIC provides three PWM signals and this driver exports
one of them on the BYT platform which is used to control backlight for
DSI panel. This is platform device implementation of the drivers/mfd
cell device for CRC PMIC.

CC: Samuel Ortiz sa...@linux.intel.com
Cc: Linus Walleij linus.wall...@linaro.org
Cc: Alexandre Courbot gnu...@gmail.com
Cc: Thierry Reding thierry.red...@gmail.com
Cc: Paul Bolle pebo...@tiscali.nl
Cc: Paul Gortmaker paul.gortma...@windriver.com
Tested-by: Ville Syrjälä ville.syrj...@linux.intel.com
Signed-off-by: Shobhit Kumar shobhit.ku...@intel.com
---
v2: Use the existing config callback with duty_ns and period_ns(Thierry)

v3: Correct the subject line (Lee jones)

v4: Address comment by Thierry  Paul
 - Commit message update and fixes for few syntax errors
 - Add PWM_CRC in Kconfig and Makefile sorted alphabetically
 - Use the PWM_BASE_CLK as 600 for better code readability
 - Remove the redundant rule of three while calculating pwm level
 - Use the platform_device in pwm_chip
 - Use builin_platform_driver

v5: Address comments by Varka
 - Make the bit definition using BIT macro
 - reorder probe and remove code to directly return from pwmchip_add/remove

  drivers/pwm/Kconfig   |   7 +++
  drivers/pwm/Makefile  |   1 +
  drivers/pwm/pwm-crc.c | 143 ++
  3 files changed, 151 insertions(+)
  create mode 100644 drivers/pwm/pwm-crc.c


Reviewed-by: Varka Bhadram varkabhad...@gmail.com

--
Best regards,
Varka Bhadram.

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


Re: [PATCH 4/6] net: ieee802154: Remove redundant spi driver bus initialization

2015-06-23 Thread Varka Bhadram

Hi Antonio Borneo,

On Tuesday 23 June 2015 08:22 PM, Antonio Borneo wrote:


In ancient times it was necessary to manually initialize the bus
field of an spi_driver to spi_bus_type. These days this is done in
spi_register_driver(), so we can drop the manual assignment.

Signed-off-by: Antonio Borneo 
To: Alan Ott 
To: Alexander Aring 
To: Varka Bhadram 
To: linux-w...@vger.kernel.org
To: net...@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
  drivers/net/ieee802154/cc2520.c   | 1 -
  drivers/net/ieee802154/mrf24j40.c | 1 -
  2 files changed, 2 deletions(-)

diff --git a/drivers/net/ieee802154/cc2520.c b/drivers/net/ieee802154/cc2520.c
index f833b8b..bd957f1 100644
--- a/drivers/net/ieee802154/cc2520.c
+++ b/drivers/net/ieee802154/cc2520.c
@@ -1046,7 +1046,6 @@ MODULE_DEVICE_TABLE(of, cc2520_of_ids);
  static struct spi_driver cc2520_driver = {
.driver = {
.name = "cc2520",
-   .bus = _bus_type,
.owner = THIS_MODULE,
.of_match_table = of_match_ptr(cc2520_of_ids),
},


Acked-by: Varka Bhadram 


diff --git a/drivers/net/ieee802154/mrf24j40.c 
b/drivers/net/ieee802154/mrf24j40.c
index fba2dfd..bc8fb26 100644
--- a/drivers/net/ieee802154/mrf24j40.c
+++ b/drivers/net/ieee802154/mrf24j40.c
@@ -812,7 +812,6 @@ MODULE_DEVICE_TABLE(spi, mrf24j40_ids);
  static struct spi_driver mrf24j40_driver = {
.driver = {
.name = "mrf24j40",
-   .bus = _bus_type,
.owner = THIS_MODULE,
},
.id_table = mrf24j40_ids,


--
Best regards,
Varka Bhadram.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 4/6] net: ieee802154: Remove redundant spi driver bus initialization

2015-06-23 Thread Varka Bhadram

Hi Antonio Borneo,

On Tuesday 23 June 2015 08:22 PM, Antonio Borneo wrote:


In ancient times it was necessary to manually initialize the bus
field of an spi_driver to spi_bus_type. These days this is done in
spi_register_driver(), so we can drop the manual assignment.

Signed-off-by: Antonio Borneo borneo.anto...@gmail.com
To: Alan Ott a...@signal11.us
To: Alexander Aring alex.ar...@gmail.com
To: Varka Bhadram varkabhad...@gmail.com
To: linux-w...@vger.kernel.org
To: net...@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
  drivers/net/ieee802154/cc2520.c   | 1 -
  drivers/net/ieee802154/mrf24j40.c | 1 -
  2 files changed, 2 deletions(-)

diff --git a/drivers/net/ieee802154/cc2520.c b/drivers/net/ieee802154/cc2520.c
index f833b8b..bd957f1 100644
--- a/drivers/net/ieee802154/cc2520.c
+++ b/drivers/net/ieee802154/cc2520.c
@@ -1046,7 +1046,6 @@ MODULE_DEVICE_TABLE(of, cc2520_of_ids);
  static struct spi_driver cc2520_driver = {
.driver = {
.name = cc2520,
-   .bus = spi_bus_type,
.owner = THIS_MODULE,
.of_match_table = of_match_ptr(cc2520_of_ids),
},


Acked-by: Varka Bhadram varkabhad...@gmail.com


diff --git a/drivers/net/ieee802154/mrf24j40.c 
b/drivers/net/ieee802154/mrf24j40.c
index fba2dfd..bc8fb26 100644
--- a/drivers/net/ieee802154/mrf24j40.c
+++ b/drivers/net/ieee802154/mrf24j40.c
@@ -812,7 +812,6 @@ MODULE_DEVICE_TABLE(spi, mrf24j40_ids);
  static struct spi_driver mrf24j40_driver = {
.driver = {
.name = mrf24j40,
-   .bus = spi_bus_type,
.owner = THIS_MODULE,
},
.id_table = mrf24j40_ids,


--
Best regards,
Varka Bhadram.

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


Re: [v2 5/7] pwm: crc: Add Crystalcove (CRC) PWM driver

2015-06-22 Thread Varka Bhadram

Hi Shobhit Kumar,

On 06/22/2015 04:24 PM, Shobhit Kumar wrote:


The Crystalcove PMIC provides three PWM signals and this driver exports
one of them on the BYT platform which is used to control backlight for
DSI panel. This is platform device implementation of the drivers/mfd
cell device for CRC PMIC.

v2: Use the existing config callback with duty_ns and period_ns(Thierry)

v3: Correct the subject line (Lee jones)

v4: Address comment by Thierry & Paul
 - Commit message update and fixes for few syntax errors
 - Add PWM_CRC in Kconfig and Makefile sorted alphabetically
 - Use the PWM_BASE_CLK as 600 for better code readability
 - Remove the redundant rule of three while calculating pwm level
 - Use the platform_device in pwm_chip
 - Use builin_platform_driver

CC: Samuel Ortiz 
Cc: Linus Walleij 
Cc: Alexandre Courbot 
Cc: Thierry Reding 
Cc: Paul Bolle 
Cc: Paul Gortmaker 
Signed-off-by: Shobhit Kumar 


(...)


+
+#include 
+#include 
+#include 
+#include 
+
+#define PWM0_CLK_DIV   0x4B
+#define  PWM_OUTPUT_ENABLE (1 << 7)


Can't be BIT() macro ?


+#define  PWM_DIV_CLK_0 0x00 /* DIVIDECLK = BASECLK */
+#define  PWM_DIV_CLK_100   0x63 /* DIVIDECLK = BASECLK/100 */
+#define  PWM_DIV_CLK_128   0x7F /* DIVIDECLK = BASECLK/128 */
+
+#define PWM0_DUTY_CYCLE0x4E
+#define BACKLIGHT_EN   0x51


(...)


+static int crystalcove_pwm_probe(struct platform_device *pdev)
+{
+   struct crystalcove_pwm *pwm;
+   int retval;
+   struct device *dev = pdev->dev.parent;
+   struct intel_soc_pmic *pmic = dev_get_drvdata(dev);
+
+   pwm = devm_kzalloc(>dev, sizeof(*pwm), GFP_KERNEL);
+   if (!pwm)
+   return -ENOMEM;
+
+   pwm->chip.dev = >dev;
+   pwm->chip.ops = _pwm_ops;
+   pwm->chip.base = -1;
+   pwm->chip.npwm = 1;
+
+   /* get the PMIC regmap */
+   pwm->regmap = pmic->regmap;
+
+   retval = pwmchip_add(>chip);
+   if (retval < 0)
+   return retval;
+
+   platform_set_drvdata(pdev, pwm);
+


If you can change this oder we can simply do something like this:

platform_set_drvdata(pdev, pwm);

return pwmchip_add(>chip);


+   return 0;
+}
+
+static int crystalcove_pwm_remove(struct platform_device *pdev)
+{
+   struct crystalcove_pwm *pwm = platform_get_drvdata(pdev);
+   int retval;
+
+   retval = pwmchip_remove(>chip);
+   if (retval < 0)
+   return retval;
+
+   dev_dbg(>dev, "crc-pwm driver removed\n");


This debug message may not be required  :-)

you can directly do:

return pwmchip_remove(>chip);


+
+   return 0;
+}
+
+static struct platform_driver crystalcove_pwm_driver = {
+   .probe = crystalcove_pwm_probe,
+   .remove = crystalcove_pwm_remove,
+   .driver = {
+   .name = "crystal_cove_pwm",
+   },
+};
+
+builtin_platform_driver(crystalcove_pwm_driver);



--
Best regards,
Varka Bhadram.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
Please read the FAQ at  http://www.tux.org/lkml/


Re: [v2 4/7] mfd: intel_soc_pmic_core: ADD PWM lookup table for CRC PMIC based PWM

2015-06-22 Thread Varka Bhadram

Hi Shobhit Kumar,

On 06/22/2015 04:24 PM, Shobhit Kumar wrote:


On some BYT PLatform the PWM is controlled using CRC PMIC. Add a lookup
entry for the same to be used by the consumer (Intel GFX)

v2: Remove the lookup table on driver unload (Thierry)

v3: Correct the subject line (Lee jones)


This part should only describe what this is about..

Don't put this patch change history over here.
Include this change history after
...
Signed-off-by: Author 
---


CC: Samuel Ortiz 
Cc: Linus Walleij 
Cc: Alexandre Courbot 
Cc: Thierry Reding 
Acked-by: Lee Jones 
Signed-off-by: Shobhit Kumar 
---


Here you add this change history so that after applying this
will not be the part of your commit description.

This comment is applicable for all of your patches.


--
Best regards,
Varka Bhadram.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
Please read the FAQ at  http://www.tux.org/lkml/


Re: [v2 5/7] pwm: crc: Add Crystalcove (CRC) PWM driver

2015-06-22 Thread Varka Bhadram

Hi Shobhit Kumar,

On 06/22/2015 04:24 PM, Shobhit Kumar wrote:


The Crystalcove PMIC provides three PWM signals and this driver exports
one of them on the BYT platform which is used to control backlight for
DSI panel. This is platform device implementation of the drivers/mfd
cell device for CRC PMIC.

v2: Use the existing config callback with duty_ns and period_ns(Thierry)

v3: Correct the subject line (Lee jones)

v4: Address comment by Thierry  Paul
 - Commit message update and fixes for few syntax errors
 - Add PWM_CRC in Kconfig and Makefile sorted alphabetically
 - Use the PWM_BASE_CLK as 600 for better code readability
 - Remove the redundant rule of three while calculating pwm level
 - Use the platform_device in pwm_chip
 - Use builin_platform_driver

CC: Samuel Ortiz sa...@linux.intel.com
Cc: Linus Walleij linus.wall...@linaro.org
Cc: Alexandre Courbot gnu...@gmail.com
Cc: Thierry Reding thierry.red...@gmail.com
Cc: Paul Bolle pebo...@tiscali.nl
Cc: Paul Gortmaker paul.gortma...@windriver.com
Signed-off-by: Shobhit Kumar shobhit.ku...@intel.com


(...)


+
+#include linux/platform_device.h
+#include linux/regmap.h
+#include linux/mfd/intel_soc_pmic.h
+#include linux/pwm.h
+
+#define PWM0_CLK_DIV   0x4B
+#define  PWM_OUTPUT_ENABLE (1  7)


Can't be BIT() macro ?


+#define  PWM_DIV_CLK_0 0x00 /* DIVIDECLK = BASECLK */
+#define  PWM_DIV_CLK_100   0x63 /* DIVIDECLK = BASECLK/100 */
+#define  PWM_DIV_CLK_128   0x7F /* DIVIDECLK = BASECLK/128 */
+
+#define PWM0_DUTY_CYCLE0x4E
+#define BACKLIGHT_EN   0x51


(...)


+static int crystalcove_pwm_probe(struct platform_device *pdev)
+{
+   struct crystalcove_pwm *pwm;
+   int retval;
+   struct device *dev = pdev-dev.parent;
+   struct intel_soc_pmic *pmic = dev_get_drvdata(dev);
+
+   pwm = devm_kzalloc(pdev-dev, sizeof(*pwm), GFP_KERNEL);
+   if (!pwm)
+   return -ENOMEM;
+
+   pwm-chip.dev = pdev-dev;
+   pwm-chip.ops = crc_pwm_ops;
+   pwm-chip.base = -1;
+   pwm-chip.npwm = 1;
+
+   /* get the PMIC regmap */
+   pwm-regmap = pmic-regmap;
+
+   retval = pwmchip_add(pwm-chip);
+   if (retval  0)
+   return retval;
+
+   platform_set_drvdata(pdev, pwm);
+


If you can change this oder we can simply do something like this:

platform_set_drvdata(pdev, pwm);

return pwmchip_add(pwm-chip);


+   return 0;
+}
+
+static int crystalcove_pwm_remove(struct platform_device *pdev)
+{
+   struct crystalcove_pwm *pwm = platform_get_drvdata(pdev);
+   int retval;
+
+   retval = pwmchip_remove(pwm-chip);
+   if (retval  0)
+   return retval;
+
+   dev_dbg(pdev-dev, crc-pwm driver removed\n);


This debug message may not be required  :-)

you can directly do:

return pwmchip_remove(pwm-chip);


+
+   return 0;
+}
+
+static struct platform_driver crystalcove_pwm_driver = {
+   .probe = crystalcove_pwm_probe,
+   .remove = crystalcove_pwm_remove,
+   .driver = {
+   .name = crystal_cove_pwm,
+   },
+};
+
+builtin_platform_driver(crystalcove_pwm_driver);



--
Best regards,
Varka Bhadram.

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
Please read the FAQ at  http://www.tux.org/lkml/


Re: [v2 4/7] mfd: intel_soc_pmic_core: ADD PWM lookup table for CRC PMIC based PWM

2015-06-22 Thread Varka Bhadram

Hi Shobhit Kumar,

On 06/22/2015 04:24 PM, Shobhit Kumar wrote:


On some BYT PLatform the PWM is controlled using CRC PMIC. Add a lookup
entry for the same to be used by the consumer (Intel GFX)

v2: Remove the lookup table on driver unload (Thierry)

v3: Correct the subject line (Lee jones)


This part should only describe what this is about..

Don't put this patch change history over here.
Include this change history after
...
Signed-off-by: Author email
---


CC: Samuel Ortiz sa...@linux.intel.com
Cc: Linus Walleij linus.wall...@linaro.org
Cc: Alexandre Courbot gnu...@gmail.com
Cc: Thierry Reding thierry.red...@gmail.com
Acked-by: Lee Jones lee.jo...@linaro.org
Signed-off-by: Shobhit Kumar shobhit.ku...@intel.com
---


Here you add this change history so that after applying this
will not be the part of your commit description.

This comment is applicable for all of your patches.


--
Best regards,
Varka Bhadram.

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] usb: image: mdc800: fixed various style issues

2015-04-24 Thread Varka Bhadram
if (mdc800_usb_waitForIRQ(1, 
> TO_READ_FROM_IRQ)) {
> + dev_err(>dev->dev, 
> "requesting answer from irq fails\n");
> + mutex_unlock(>io_lock);
> + return -EIO;
> + }
>  
> - /* This is the interpreted 
> answer */
> - memcpy (>out[8], 
> mdc800->camera_response,8);
> + /* Write dummy data, (this is ugly but 
> part of the USB Protocol */
> + /* if you use endpoint 1 as bulk and 
> not as irq) */
> + memcpy(mdc800->out, 
> mdc800->camera_response, 8);
>  
> - mdc800->out_ptr=0;
> - mdc800->out_count=16;
> + /* This is the interpreted answer */
> + memcpy(>out[8], 
> mdc800->camera_response, 8);
>  
> - /* Cache the Imagesize, if 
> command was getImageSize */
> - if (mdc800->in [1] == (char) 
> 0x07)
> - {
> - mdc800->pic_len=(int) 
> 65536*(unsigned char) mdc800->camera_response[0]+256*(unsigned char) 
> mdc800->camera_response[1]+(unsigned char) mdc800->camera_response[2];
> + mdc800->out_ptr = 0;
> + mdc800->out_count = 16;
>  
> - 
> dev_dbg(>dev->dev, "cached imagesize = %i\n", mdc800->pic_len);
> - }
> + /* Cache the Imagesize, if command was 
> getImageSize */
> + if (mdc800->in[1] == (char) 0x07) {
> + mdc800->pic_len = (int) 
> 65536*(unsigned char) mdc800->camera_response[0]+256*(unsigned char) 
> mdc800->camera_response[1]+(unsigned char) mdc800->camera_response[2];
>  
> + dev_dbg(>dev->dev, 
> "cached imagesize = %i\n", mdc800->pic_len);
>   }
> - else
> - {
> - if (mdc800_usb_waitForIRQ 
> (0,TO_DEFAULT_COMMAND))
> - {
> - 
> dev_err(>dev->dev, "Command Timeout.\n");
> - 
> mutex_unlock(>io_lock);
> - return -EIO;
> - }
> +
> + } else {
> + if (mdc800_usb_waitForIRQ(0, 
> TO_DEFAULT_COMMAND)) {
> + dev_err(>dev->dev, 
> "Command Timeout.\n");
> + mutex_unlock(>io_lock);
> + return -EIO;
>   }
> - mdc800->state=READY;
> - break;
> + }
> +     mdc800->state = READY;
> + break;
>   }
>   }
>   i++;
> @@ -956,8 +865,7 @@ static ssize_t mdc800_device_write (struct file *file, 
> const char __user *buf

Re: [PATCH v7 0/3] Add ktd2692 Flash LED driver using LED Flash class

2015-04-24 Thread Varka Bhadram
On 04/23/2015 06:48 PM, Ingi Kim wrote:
> This patch adds ktd2692 Flash LED driver with LED Flash class
>
> Change in v7:
>   - Add flash-max-microamp property for Flash LED
>   - Change gpio-legacy interface to gpio consumer interface
>
> Change in v6 resend:
>   - Adjust indent using checkpatch.pl script with strict option
>
> Change in v6:
>   - Change goto label to if-else
>   - Change DT binding style for LED device binding
>
> Change in v5:
>   - Clean up the code
>   - Fix help message of Kconfig
>   - Fix issue related with regulator and mutex usage
>   - Remove tab spaces in bindings
>
> Change in v4:
>   - Clean up the code
>   - Modify binding documentation of ktd2692
>
> Change in v3:
>   - Clean up the code
>   - Add aux gpio pin to control Flash LED
>
> Change in v2:
>   - Introduction of LED Flash class as Jacek's comment
>   - Supplement of binding documentation
>   - Rename gpio control pin and remove unused pin
>   - Add regulator for the Flash LED
>
> Ingi Kim (3):
>   of: Add vendor prefix for Kinetic technologies
>   leds: ktd2692: add device tree bindings for ktd2692
>   leds: Add ktd2692 flash LED driver
>
>  .../devicetree/bindings/leds/leds-ktd2692.txt  |  47 +++
>  .../devicetree/bindings/vendor-prefixes.txt|   1 +
>  drivers/leds/Kconfig   |   9 +
>  drivers/leds/Makefile  |   1 +
>  drivers/leds/leds-ktd2692.c| 435 
> +
>  5 files changed, 493 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/leds/leds-ktd2692.txt
>  create mode 100644 drivers/leds/leds-ktd2692.c
>
Reviewed-by: Varka Bhadram 

Thanks

-- 
Varka Bhadram

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v7 0/3] Add ktd2692 Flash LED driver using LED Flash class

2015-04-24 Thread Varka Bhadram
On 04/23/2015 06:48 PM, Ingi Kim wrote:
 This patch adds ktd2692 Flash LED driver with LED Flash class

 Change in v7:
   - Add flash-max-microamp property for Flash LED
   - Change gpio-legacy interface to gpio consumer interface

 Change in v6 resend:
   - Adjust indent using checkpatch.pl script with strict option

 Change in v6:
   - Change goto label to if-else
   - Change DT binding style for LED device binding

 Change in v5:
   - Clean up the code
   - Fix help message of Kconfig
   - Fix issue related with regulator and mutex usage
   - Remove tab spaces in bindings

 Change in v4:
   - Clean up the code
   - Modify binding documentation of ktd2692

 Change in v3:
   - Clean up the code
   - Add aux gpio pin to control Flash LED

 Change in v2:
   - Introduction of LED Flash class as Jacek's comment
   - Supplement of binding documentation
   - Rename gpio control pin and remove unused pin
   - Add regulator for the Flash LED

 Ingi Kim (3):
   of: Add vendor prefix for Kinetic technologies
   leds: ktd2692: add device tree bindings for ktd2692
   leds: Add ktd2692 flash LED driver

  .../devicetree/bindings/leds/leds-ktd2692.txt  |  47 +++
  .../devicetree/bindings/vendor-prefixes.txt|   1 +
  drivers/leds/Kconfig   |   9 +
  drivers/leds/Makefile  |   1 +
  drivers/leds/leds-ktd2692.c| 435 
 +
  5 files changed, 493 insertions(+)
  create mode 100644 Documentation/devicetree/bindings/leds/leds-ktd2692.txt
  create mode 100644 drivers/leds/leds-ktd2692.c

Reviewed-by: Varka Bhadram varkabhad...@gmail.com

Thanks

-- 
Varka Bhadram

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


Re: [PATCH] usb: image: mdc800: fixed various style issues

2015-04-24 Thread Varka Bhadram
, GFP_KERNEL);
 + mdc800-write_urb_buffer = kmalloc(8, GFP_KERNEL);
   if (!mdc800-write_urb_buffer)
   goto cleanup_on_fail;
 - mdc800-download_urb_buffer=kmalloc (64, GFP_KERNEL);
 + mdc800-download_urb_buffer = kmalloc(64, GFP_KERNEL);
   if (!mdc800-download_urb_buffer)
   goto cleanup_on_fail;
  
 - mdc800-irq_urb=usb_alloc_urb (0, GFP_KERNEL);
 + mdc800-irq_urb = usb_alloc_urb(0, GFP_KERNEL);
   if (!mdc800-irq_urb)
   goto cleanup_on_fail;
 - mdc800-download_urb=usb_alloc_urb (0, GFP_KERNEL);
 + mdc800-download_urb = usb_alloc_urb(0, GFP_KERNEL);
   if (!mdc800-download_urb)
   goto cleanup_on_fail;
 - mdc800-write_urb=usb_alloc_urb (0, GFP_KERNEL);
 + mdc800-write_urb = usb_alloc_urb(0, GFP_KERNEL);
   if (!mdc800-write_urb)
   goto cleanup_on_fail;
  
 @@ -1045,8 +950,7 @@ static int __init usb_mdc800_init (void)
  
  cleanup_on_fail:
  
 - if (mdc800 != NULL)
 - {
 + if (mdc800 != NULL) {
   printk(KERN_ERR mdc800: can't alloc memory!\n);
  
   kfree(mdc800-download_urb_buffer);
 @@ -1057,33 +961,32 @@ cleanup_on_fail:
   usb_free_urb(mdc800-download_urb);
   usb_free_urb(mdc800-irq_urb);
  
 - kfree (mdc800);
 + kfree(mdc800);
   }
   mdc800 = NULL;
   return retval;
  }
  
  
 -static void __exit usb_mdc800_cleanup (void)
 +static void __exit usb_mdc800_cleanup(void)
  {
 - usb_deregister (mdc800_usb_driver);
 + usb_deregister(mdc800_usb_driver);
  
 - usb_free_urb (mdc800-irq_urb);
 - usb_free_urb (mdc800-download_urb);
 - usb_free_urb (mdc800-write_urb);
 + usb_free_urb(mdc800-irq_urb);
 + usb_free_urb(mdc800-download_urb);
 + usb_free_urb(mdc800-write_urb);
  
 - kfree (mdc800-irq_urb_buffer);
 - kfree (mdc800-write_urb_buffer);
 - kfree (mdc800-download_urb_buffer);
 + kfree(mdc800-irq_urb_buffer);
 + kfree(mdc800-write_urb_buffer);
 + kfree(mdc800-download_urb_buffer);
  
 - kfree (mdc800);
 + kfree(mdc800);
   mdc800 = NULL;
  }
  
 -module_init (usb_mdc800_init);
 -module_exit (usb_mdc800_cleanup);
 +module_init(usb_mdc800_init);
 +module_exit(usb_mdc800_cleanup);
  
 -MODULE_AUTHOR( DRIVER_AUTHOR );
 -MODULE_DESCRIPTION( DRIVER_DESC );
 +MODULE_AUTHOR(DRIVER_AUTHOR);
 +MODULE_DESCRIPTION(DRIVER_DESC);
  MODULE_LICENSE(GPL);
 -

Ran checkpatch on this.

Result:

total: 0 errors, 28 warnings, 1231 lines checked

0001-usb-image-mdc800-fixed-various-style-issues.patch has style problems, 
please review.

Thanks

-- 
Varka Bhadram

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


Re: [PATCH v4 2/3] leds: ktd2692: add device tree bindings for ktd2692

2015-03-24 Thread Varka Bhadram

On 03/25/2015 07:00 AM, Ingi Kim wrote:

This patch adds the device tree bindings for ktd2692 flash LEDs.
Add optional properties 'flash-timeout-us' to control flash timeout
and 'vin-supply' for flash-led regulator

Signed-off-by: Ingi Kim 
---
  .../devicetree/bindings/leds/leds-ktd2692.txt  | 33 ++
  1 file changed, 33 insertions(+)
  create mode 100644 Documentation/devicetree/bindings/leds/leds-ktd2692.txt

diff --git a/Documentation/devicetree/bindings/leds/leds-ktd2692.txt 
b/Documentation/devicetree/bindings/leds/leds-ktd2692.txt
new file mode 100644
index 000..f78512f
--- /dev/null
+++ b/Documentation/devicetree/bindings/leds/leds-ktd2692.txt
@@ -0,0 +1,33 @@
+* Kinetic Technologies - KTD2692 Flash LED Driver
+
+KTD2692 is the ideal power solution for high-power flash LEDs.
+It uses ExpressWire single-wire programming for maximum flexibility.
+
+The ExpressWire interface through CTRL pin can control LED on/off and
+enable/disable the IC, Movie(max 1/3 of Flash current) / Flash mode current,
+Flash timeout, LVP(low voltage protection).
+
+Also, When the AUX pin is pulled high while CTRL pin is high,
+LED current will be ramped up to the flash-mode current level.
+
+Required properties:
+   - compatible: "kinetic,ktd2692"
+   - ctrl-gpio, aux-gpio : gpio pins in order control ktd2692 flash led.
+   There is an internal 300kOhm pull-down resistor at each pin
+   - vin-supply : "vin" LED supply (2.7V to 5.5V)
+   See Documentation/devicetree/bindings/regulator/regulator.txt
+


Above bindings are not that readable to me. Remove the tab spaces before 
properties.


+Optional property:
+   - flash-timeout-us : Maximum flash timeout in microseconds.
+   flash timeout ranges from 0 to 1835000us and
+   default is 1049000us.
+
+Example:
+
+flash-led {
+   compatible = "kinetic,ktd2692";
+   ctrl-gpio = < 1 0>;
+   aux-gpio = < 2 0>;
+   flash-timeout-us = <1835000>;
+   vin-supply = <>;
+};



--
Varka Bhadram

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v4 3/3] leds: Add ktd2692 flash LED driver

2015-03-24 Thread Varka Bhadram
 = ktd2692_match,
+   },
+   .probe  = ktd2692_probe,
+   .remove = ktd2692_remove,
+};
+
+module_platform_driver(ktd2692_driver);
+
+MODULE_AUTHOR("Ingi Kim ");
+MODULE_DESCRIPTION("Kinetic KTD2692 LED driver");
+MODULE_LICENSE("GPL v2");



--
Varka Bhadram

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v4 2/3] leds: ktd2692: add device tree bindings for ktd2692

2015-03-24 Thread Varka Bhadram

On 03/25/2015 07:00 AM, Ingi Kim wrote:

This patch adds the device tree bindings for ktd2692 flash LEDs.
Add optional properties 'flash-timeout-us' to control flash timeout
and 'vin-supply' for flash-led regulator

Signed-off-by: Ingi Kim ingi2@samsung.com
---
  .../devicetree/bindings/leds/leds-ktd2692.txt  | 33 ++
  1 file changed, 33 insertions(+)
  create mode 100644 Documentation/devicetree/bindings/leds/leds-ktd2692.txt

diff --git a/Documentation/devicetree/bindings/leds/leds-ktd2692.txt 
b/Documentation/devicetree/bindings/leds/leds-ktd2692.txt
new file mode 100644
index 000..f78512f
--- /dev/null
+++ b/Documentation/devicetree/bindings/leds/leds-ktd2692.txt
@@ -0,0 +1,33 @@
+* Kinetic Technologies - KTD2692 Flash LED Driver
+
+KTD2692 is the ideal power solution for high-power flash LEDs.
+It uses ExpressWire single-wire programming for maximum flexibility.
+
+The ExpressWire interface through CTRL pin can control LED on/off and
+enable/disable the IC, Movie(max 1/3 of Flash current) / Flash mode current,
+Flash timeout, LVP(low voltage protection).
+
+Also, When the AUX pin is pulled high while CTRL pin is high,
+LED current will be ramped up to the flash-mode current level.
+
+Required properties:
+   - compatible: kinetic,ktd2692
+   - ctrl-gpio, aux-gpio : gpio pins in order control ktd2692 flash led.
+   There is an internal 300kOhm pull-down resistor at each pin
+   - vin-supply : vin LED supply (2.7V to 5.5V)
+   See Documentation/devicetree/bindings/regulator/regulator.txt
+


Above bindings are not that readable to me. Remove the tab spaces before 
properties.


+Optional property:
+   - flash-timeout-us : Maximum flash timeout in microseconds.
+   flash timeout ranges from 0 to 1835000us and
+   default is 1049000us.
+
+Example:
+
+flash-led {
+   compatible = kinetic,ktd2692;
+   ctrl-gpio = gpc0 1 0;
+   aux-gpio = gpc0 2 0;
+   flash-timeout-us = 1835000;
+   vin-supply = vbat;
+};



--
Varka Bhadram

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


Re: [PATCH v4 3/3] leds: Add ktd2692 flash LED driver

2015-03-24 Thread Varka Bhadram
);
+MODULE_DESCRIPTION(Kinetic KTD2692 LED driver);
+MODULE_LICENSE(GPL v2);



--
Varka Bhadram

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


Re: [PATCH v8] media: i2c: add support for omnivision's ov2659 sensor

2015-03-20 Thread Varka Bhadram

On 03/20/2015 05:18 PM, Lad Prabhakar wrote:


From: Benoit Parrot 

this patch adds support for omnivision's ov2659
sensor, the driver supports following features:
1: Asynchronous probing
2: DT support
3: Media controller support

Signed-off-by: Benoit Parrot 
Signed-off-by: Lad, Prabhakar 
Acked-by: Sakari Ailus 
---
  Changes for v8:
  --
  a. Now setting the link_frequency control in set_fmt
 callback instead of implementing g_volatile_ctrl()
 for it and setting it there.

  v7: https://patchwork.kernel.org/patch/6034651/
  v6: https://patchwork.kernel.org/patch/6012751/
  v5: https://patchwork.kernel.org/patch/6000161/
  v4: https://patchwork.kernel.org/patch/5961661/
  v3: https://patchwork.kernel.org/patch/5959401/
  v2: https://patchwork.kernel.org/patch/5859801/
  v1: https://patchwork.linuxtv.org/patch/27919/

  .../devicetree/bindings/media/i2c/ov2659.txt   |   38 +
  MAINTAINERS|   10 +
  drivers/media/i2c/Kconfig  |   11 +
  drivers/media/i2c/Makefile |1 +
  drivers/media/i2c/ov2659.c | 1528 
  include/media/ov2659.h |   33 +
  6 files changed, 1621 insertions(+)
  create mode 100644 Documentation/devicetree/bindings/media/i2c/ov2659.txt
  create mode 100644 drivers/media/i2c/ov2659.c
  create mode 100644 include/media/ov2659.h


(...)


+static struct ov2659_platform_data *
+ov2659_get_pdata(struct i2c_client *client)
+{
+   struct ov2659_platform_data *pdata;
+   struct device_node *endpoint;
+   int ret;
+
+   if (!IS_ENABLED(CONFIG_OF) || !client->dev.of_node) {
+   dev_err(>dev, "ov2659_get_pdata: DT Node found\n");


ov2659_get_pdata: DT Node *not* found...?

--
Varka Bhadram

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v4] add support for Freescale's MMA8653FC 10 bit accelerometer

2015-03-20 Thread Varka Bhadram
_RANGE_4G:
+   byte |= RANGE4G;
+   dev_dbg(>dev, "use 4g range\n");
+   break;
+   case DYN_RANGE_8G:
+   byte |= RANGE8G;
+   dev_dbg(>dev, "use 8g range\n");
+   break;
+   default:
+   dev_err(>dev, "wrong range mode value\n");
+   goto err_free_irq;
+   }
+   if (mma->write(mma, MMA8653FC_XYZ_DATA_CFG, byte))
+   goto err_free_irq;
+
+   /* data calibration offsets */
+   if (pdata->x_axis_offset) {
+   if (mma->write(mma, MMA8653FC_OFF_X, pdata->x_axis_offset))
+   goto err_free_irq;
+   }
+   if (pdata->y_axis_offset) {
+   if (mma->write(mma, MMA8653FC_OFF_Y, pdata->y_axis_offset))
+   goto err_free_irq;
+   }
+   if (pdata->z_axis_offset) {
+   if (mma->write(mma, MMA8653FC_OFF_Z, pdata->z_axis_offset))
+   goto err_free_irq;
+   }
+
+   /* if autosleep, wake on both landscape and motion changes */
+   if (pdata->auto_wake_sleep) {
+   byte = 0;
+   byte |= WAKE_LNDPRT;
+   byte |= WAKE_FF_MT;
+   if (mma->write(mma, MMA8653FC_CTRL_REG3, byte))
+   goto err_free_irq;
+   if (mma->write(mma, MMA8653FC_CTRL_REG2, SLPE))
+   goto err_free_irq;
+   dev_dbg(>dev, "auto sleep enabled\n");
+   }
+
+   /* data rates */
+   byte = 0;
+   byte = mma->read(mma, MMA8653FC_CTRL_REG1);
+   if (byte < 0)
+   goto err_free_irq;
+   byte &= ~ODR_MASK;
+   byte |= ODR_DEFAULT;
+   byte &= ~ASLP_RATE_MASK;
+   byte |= ASLP_RATE_DEFAULT;
+   if (mma->write(mma, MMA8653FC_CTRL_REG1, byte))
+   goto err_free_irq;
+
+   /* freefall / motion config */
+   byte = 0;
+   if (pdata->motion_mode) {
+   byte |= FF_MT_CFG_OAE;
+   dev_dbg(>dev, "detect motion instead of freefall\n");
+   }
+   byte |= FF_MT_CFG_ELE;
+   if (pdata->int_src_ff_mt_x)
+   byte |= FF_MT_CFG_XEFE;
+   if (pdata->int_src_ff_mt_y)
+   byte |= FF_MT_CFG_YEFE;
+   if (pdata->int_src_ff_mt_z)
+   byte |= FF_MT_CFG_ZEFE;
+   if (mma->write(mma, MMA8653FC_FF_MT_CFG, byte))
+   goto err_free_irq;
+
+   if (pdata->freefall_motion_thr) {
+   if (mma->write(mma, MMA8653FC_FF_MT_THS,
+pdata->freefall_motion_thr))
+   goto err_free_irq;
+   /* calculate back to mg */
+   dev_dbg(>dev, "threshold set to %dmg\n",
+(63 * pdata->freefall_motion_thr) - 1);
+   }
+
+   byte = mma->read(mma, MMA8653FC_WHO_AM_I);
+   if (byte != MMA8653FC_DEVICE_ID) {
+   dev_err(>dev, "wrong device for driver\n");
+   goto err_free_irq;
+   }
+   dev_info(>dev,
+"accelerometer driver loaded. device id %x\n", byte);
+
+   return 0;
+
+ err_free_irq:
+   if (mma->irq)
+   free_irq(mma->irq, mma);
+ err_free_mem:
+   kfree(mma);


If we use devm_* API's above steps are not required


+ err_out:
+   return err;
+}
+
+static int mma8653fc_remove(struct i2c_client *client)
+{
+   struct mma8653fc *mma = i2c_get_clientdata(client);
+
+   free_irq(mma->irq, mma);
+   dev_dbg(>dev, "unregistered accelerometer\n");
+   kfree(mma);


same as above..



--
Varka Bhadram

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v4] add support for Freescale's MMA8653FC 10 bit accelerometer

2015-03-20 Thread Varka Bhadram
(client-dev, use 4g range\n);
+   break;
+   case DYN_RANGE_8G:
+   byte |= RANGE8G;
+   dev_dbg(client-dev, use 8g range\n);
+   break;
+   default:
+   dev_err(client-dev, wrong range mode value\n);
+   goto err_free_irq;
+   }
+   if (mma-write(mma, MMA8653FC_XYZ_DATA_CFG, byte))
+   goto err_free_irq;
+
+   /* data calibration offsets */
+   if (pdata-x_axis_offset) {
+   if (mma-write(mma, MMA8653FC_OFF_X, pdata-x_axis_offset))
+   goto err_free_irq;
+   }
+   if (pdata-y_axis_offset) {
+   if (mma-write(mma, MMA8653FC_OFF_Y, pdata-y_axis_offset))
+   goto err_free_irq;
+   }
+   if (pdata-z_axis_offset) {
+   if (mma-write(mma, MMA8653FC_OFF_Z, pdata-z_axis_offset))
+   goto err_free_irq;
+   }
+
+   /* if autosleep, wake on both landscape and motion changes */
+   if (pdata-auto_wake_sleep) {
+   byte = 0;
+   byte |= WAKE_LNDPRT;
+   byte |= WAKE_FF_MT;
+   if (mma-write(mma, MMA8653FC_CTRL_REG3, byte))
+   goto err_free_irq;
+   if (mma-write(mma, MMA8653FC_CTRL_REG2, SLPE))
+   goto err_free_irq;
+   dev_dbg(client-dev, auto sleep enabled\n);
+   }
+
+   /* data rates */
+   byte = 0;
+   byte = mma-read(mma, MMA8653FC_CTRL_REG1);
+   if (byte  0)
+   goto err_free_irq;
+   byte = ~ODR_MASK;
+   byte |= ODR_DEFAULT;
+   byte = ~ASLP_RATE_MASK;
+   byte |= ASLP_RATE_DEFAULT;
+   if (mma-write(mma, MMA8653FC_CTRL_REG1, byte))
+   goto err_free_irq;
+
+   /* freefall / motion config */
+   byte = 0;
+   if (pdata-motion_mode) {
+   byte |= FF_MT_CFG_OAE;
+   dev_dbg(client-dev, detect motion instead of freefall\n);
+   }
+   byte |= FF_MT_CFG_ELE;
+   if (pdata-int_src_ff_mt_x)
+   byte |= FF_MT_CFG_XEFE;
+   if (pdata-int_src_ff_mt_y)
+   byte |= FF_MT_CFG_YEFE;
+   if (pdata-int_src_ff_mt_z)
+   byte |= FF_MT_CFG_ZEFE;
+   if (mma-write(mma, MMA8653FC_FF_MT_CFG, byte))
+   goto err_free_irq;
+
+   if (pdata-freefall_motion_thr) {
+   if (mma-write(mma, MMA8653FC_FF_MT_THS,
+pdata-freefall_motion_thr))
+   goto err_free_irq;
+   /* calculate back to mg */
+   dev_dbg(client-dev, threshold set to %dmg\n,
+(63 * pdata-freefall_motion_thr) - 1);
+   }
+
+   byte = mma-read(mma, MMA8653FC_WHO_AM_I);
+   if (byte != MMA8653FC_DEVICE_ID) {
+   dev_err(client-dev, wrong device for driver\n);
+   goto err_free_irq;
+   }
+   dev_info(client-dev,
+accelerometer driver loaded. device id %x\n, byte);
+
+   return 0;
+
+ err_free_irq:
+   if (mma-irq)
+   free_irq(mma-irq, mma);
+ err_free_mem:
+   kfree(mma);


If we use devm_* API's above steps are not required


+ err_out:
+   return err;
+}
+
+static int mma8653fc_remove(struct i2c_client *client)
+{
+   struct mma8653fc *mma = i2c_get_clientdata(client);
+
+   free_irq(mma-irq, mma);
+   dev_dbg(client-dev, unregistered accelerometer\n);
+   kfree(mma);


same as above..



--
Varka Bhadram

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


Re: [PATCH v8] media: i2c: add support for omnivision's ov2659 sensor

2015-03-20 Thread Varka Bhadram

On 03/20/2015 05:18 PM, Lad Prabhakar wrote:


From: Benoit Parrot bpar...@ti.com

this patch adds support for omnivision's ov2659
sensor, the driver supports following features:
1: Asynchronous probing
2: DT support
3: Media controller support

Signed-off-by: Benoit Parrot bpar...@ti.com
Signed-off-by: Lad, Prabhakar prabhakar.cse...@gmail.com
Acked-by: Sakari Ailus sakari.ai...@linux.intel.com
---
  Changes for v8:
  --
  a. Now setting the link_frequency control in set_fmt
 callback instead of implementing g_volatile_ctrl()
 for it and setting it there.

  v7: https://patchwork.kernel.org/patch/6034651/
  v6: https://patchwork.kernel.org/patch/6012751/
  v5: https://patchwork.kernel.org/patch/6000161/
  v4: https://patchwork.kernel.org/patch/5961661/
  v3: https://patchwork.kernel.org/patch/5959401/
  v2: https://patchwork.kernel.org/patch/5859801/
  v1: https://patchwork.linuxtv.org/patch/27919/

  .../devicetree/bindings/media/i2c/ov2659.txt   |   38 +
  MAINTAINERS|   10 +
  drivers/media/i2c/Kconfig  |   11 +
  drivers/media/i2c/Makefile |1 +
  drivers/media/i2c/ov2659.c | 1528 
  include/media/ov2659.h |   33 +
  6 files changed, 1621 insertions(+)
  create mode 100644 Documentation/devicetree/bindings/media/i2c/ov2659.txt
  create mode 100644 drivers/media/i2c/ov2659.c
  create mode 100644 include/media/ov2659.h


(...)


+static struct ov2659_platform_data *
+ov2659_get_pdata(struct i2c_client *client)
+{
+   struct ov2659_platform_data *pdata;
+   struct device_node *endpoint;
+   int ret;
+
+   if (!IS_ENABLED(CONFIG_OF) || !client-dev.of_node) {
+   dev_err(client-dev, ov2659_get_pdata: DT Node found\n);


ov2659_get_pdata: DT Node *not* found...?

--
Varka Bhadram

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


Re: [PATCH 3/3] leds: Add ktd2692 flash LED driver

2015-02-26 Thread Varka Bhadram
On 02/27/2015 06:31 AM, Ingi Kim wrote:
> This patch adds a driver to support the ktd2692 flash LEDs.
> ktd2692 can control flash current by ExpressWire interface.
>
> Signed-off-by: Ingi Kim 
> ---
>   drivers/leds/Kconfig|8 ++
>   drivers/leds/Makefile   |1 +
>   drivers/leds/leds-ktd2692.c |  245 
> +++
>   3 files changed, 254 insertions(+)
>   create mode 100644 drivers/leds/leds-ktd2692.c
>
(...)

> +static struct ktd2692_context *ktd2692_parse_dt(struct device *dev)
> +{
> + struct device_node *np = dev->of_node;
> + struct ktd2692_context *led;
> +
> + led = devm_kzalloc(dev, sizeof(struct ktd2692_context), GFP_KERNEL);
> + if (!led)
> + return ERR_PTR((long)led);

What about using sizeof(*led) in place of sizeof(struct ktd2692_context)..?

Also the error return for devm_kzalloc() should be -ENOMEM.

> +
> + led->strobe_gpio = of_get_named_gpio(np, "strobe-gpio", 0);
> + if (!gpio_is_valid(led->strobe_gpio)) {
> + dev_err(dev, "no strobe_gpio property found\n");
> + return ERR_PTR(led->strobe_gpio);
> + }
> +
> + return led;
> +}
> +
> +static int ktd2692_probe(struct platform_device *pdev)
> +{
> + struct device *dev = >dev;
> + struct ktd2692_context *led;
> + int ret;
> +
> + if (!dev->of_node)
> + return -ENODEV;
> +
> + led = ktd2692_parse_dt(dev);
> + if (IS_ERR(led))
> + return PTR_ERR(led);
> +
> + led->cdev.name = KTD2692_DEFAULT_NAME;
> + led->cdev.brightness = LED_OFF;
> + led->cdev.max_brightness = LED_FULL;
> + led->cdev.flags |= LED_CORE_SUSPENDRESUME;
> + led->cdev.brightness_set = ktd2692_brightness_set;
> + led->cdev.brightness_get = ktd2692_brightness_get;
> + led->mode = KTD2692_REG_MODE_BASE | KTD2692_MODE_DISABLE;
> +
> + platform_set_drvdata(pdev, led);
> +
> + ret = led_classdev_register(>dev, >cdev);
> + if (ret) {
> + dev_err(dev, "couldn't register LED %s\n", led->cdev.name);
> + return ret;
> + }
> +
> + ret = ktd2692_brightness_set_gpio(led);
> + if (ret) {
> + led_classdev_unregister(>cdev);
> + return ret;
> + }
> +
> + ktd2692_expresswire_reset(led);
> +
> + return ret;

return 0 instead of ret...?



-- 
Thanks,
Varka Bhadram.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 3/3] leds: Add ktd2692 flash LED driver

2015-02-26 Thread Varka Bhadram
On 02/27/2015 06:31 AM, Ingi Kim wrote:
 This patch adds a driver to support the ktd2692 flash LEDs.
 ktd2692 can control flash current by ExpressWire interface.

 Signed-off-by: Ingi Kim ingi2@samsung.com
 ---
   drivers/leds/Kconfig|8 ++
   drivers/leds/Makefile   |1 +
   drivers/leds/leds-ktd2692.c |  245 
 +++
   3 files changed, 254 insertions(+)
   create mode 100644 drivers/leds/leds-ktd2692.c

(...)

 +static struct ktd2692_context *ktd2692_parse_dt(struct device *dev)
 +{
 + struct device_node *np = dev-of_node;
 + struct ktd2692_context *led;
 +
 + led = devm_kzalloc(dev, sizeof(struct ktd2692_context), GFP_KERNEL);
 + if (!led)
 + return ERR_PTR((long)led);

What about using sizeof(*led) in place of sizeof(struct ktd2692_context)..?

Also the error return for devm_kzalloc() should be -ENOMEM.

 +
 + led-strobe_gpio = of_get_named_gpio(np, strobe-gpio, 0);
 + if (!gpio_is_valid(led-strobe_gpio)) {
 + dev_err(dev, no strobe_gpio property found\n);
 + return ERR_PTR(led-strobe_gpio);
 + }
 +
 + return led;
 +}
 +
 +static int ktd2692_probe(struct platform_device *pdev)
 +{
 + struct device *dev = pdev-dev;
 + struct ktd2692_context *led;
 + int ret;
 +
 + if (!dev-of_node)
 + return -ENODEV;
 +
 + led = ktd2692_parse_dt(dev);
 + if (IS_ERR(led))
 + return PTR_ERR(led);
 +
 + led-cdev.name = KTD2692_DEFAULT_NAME;
 + led-cdev.brightness = LED_OFF;
 + led-cdev.max_brightness = LED_FULL;
 + led-cdev.flags |= LED_CORE_SUSPENDRESUME;
 + led-cdev.brightness_set = ktd2692_brightness_set;
 + led-cdev.brightness_get = ktd2692_brightness_get;
 + led-mode = KTD2692_REG_MODE_BASE | KTD2692_MODE_DISABLE;
 +
 + platform_set_drvdata(pdev, led);
 +
 + ret = led_classdev_register(pdev-dev, led-cdev);
 + if (ret) {
 + dev_err(dev, couldn't register LED %s\n, led-cdev.name);
 + return ret;
 + }
 +
 + ret = ktd2692_brightness_set_gpio(led);
 + if (ret) {
 + led_classdev_unregister(led-cdev);
 + return ret;
 + }
 +
 + ktd2692_expresswire_reset(led);
 +
 + return ret;

return 0 instead of ret...?



-- 
Thanks,
Varka Bhadram.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] drivers: isdn: icn: icn.h Clean up trivial checkpatch errors.

2015-02-07 Thread Varka Bhadram

Hi,

On Saturday 07 February 2015 09:26 PM, Bas Peters wrote:

Missed Signed-off-by line...


---
  drivers/isdn/icn/icn.h | 5 ++---
  1 file changed, 2 insertions(+), 3 deletions(-)
  


--
Thanks,
Varka Bhadram.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/2] drivers: isdn: icn: icn.c: clean up all checkpatch errors

2015-02-07 Thread Varka Bhadram

Hi,

On Saturday 07 February 2015 09:26 PM, Bas Peters wrote:

This patch cleans up various trivial checkpatch errors such as variable
declarations in if statements, return values in parenthesis and a
wrongly placed brace.


Missed Signed-off-by line.


---
  drivers/isdn/icn/icn.c | 52 ++
  1 file changed, 31 insertions(+), 21 deletions(-)


--
Thanks,
Varka Bhadram.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/2] drivers: isdn: icn: icn.c: clean up all checkpatch errors

2015-02-07 Thread Varka Bhadram

Hi,

On Saturday 07 February 2015 09:26 PM, Bas Peters wrote:

This patch cleans up various trivial checkpatch errors such as variable
declarations in if statements, return values in parenthesis and a
wrongly placed brace.


Missed Signed-off-by line.


---
  drivers/isdn/icn/icn.c | 52 ++
  1 file changed, 31 insertions(+), 21 deletions(-)


--
Thanks,
Varka Bhadram.

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


Re: [PATCH 2/2] drivers: isdn: icn: icn.h Clean up trivial checkpatch errors.

2015-02-07 Thread Varka Bhadram

Hi,

On Saturday 07 February 2015 09:26 PM, Bas Peters wrote:

Missed Signed-off-by line...


---
  drivers/isdn/icn/icn.h | 5 ++---
  1 file changed, 2 insertions(+), 3 deletions(-)
  


--
Thanks,
Varka Bhadram.

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


Re: [PATCH v10 2/2] tty/serial: Add Spreadtrum sc9836-uart driver support

2015-01-29 Thread Varka Bhadram

On Thursday 29 January 2015 08:56 PM, Varka Bhadram wrote:

Hi,

On Wednesday 28 January 2015 04:38 PM, Chunyan Zhang wrote:

Add a full sc9836-uart driver for SC9836 SoC which is based on the
spreadtrum sharkl64 platform.
This driver also support earlycon.

Originally-by: Lanqing Liu 
Signed-off-by: Orson Zhai 
Signed-off-by: Chunyan Zhang 
Acked-by: Arnd Bergmann 
Reviewed-by: Peter Hurley 
---
  drivers/tty/serial/Kconfig   |   18 +
  drivers/tty/serial/Makefile  |1 +
  drivers/tty/serial/sprd_serial.c |  793 
++

  include/uapi/linux/serial_core.h |3 +
  4 files changed, 815 insertions(+)
  create mode 100644 drivers/tty/serial/sprd_serial.c


(...)


+static int sprd_probe(struct platform_device *pdev)
+{
+struct resource *res;
+struct uart_port *up;
+struct clk *clk;
+int irq;
+int index;
+int ret;
+
+for (index = 0; index < ARRAY_SIZE(sprd_port); index++)
+if (sprd_port[index] == NULL)
+break;
+
+if (index == ARRAY_SIZE(sprd_port))
+return -EBUSY;
+
+index = sprd_probe_dt_alias(index, >dev);
+
+sprd_port[index] = devm_kzalloc(>dev,
+sizeof(*sprd_port[index]), GFP_KERNEL);
+if (!sprd_port[index])
+return -ENOMEM;
+
+up = _port[index]->port;
+up->dev = >dev;
+up->line = index;
+up->type = PORT_SPRD;
+up->iotype = SERIAL_IO_PORT;
+up->uartclk = SPRD_DEF_RATE;
+up->fifosize = SPRD_FIFO_SIZE;
+up->ops = _sprd_ops;
+up->flags = UPF_BOOT_AUTOCONF;
+
+clk = devm_clk_get(>dev, NULL);
+if (!IS_ERR(clk))
+up->uartclk = clk_get_rate(clk);
+
+res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+if (!res) {
+dev_err(>dev, "not provide mem resource\n");
+return -ENODEV;
+}


This check is not required. It will be done by devm_ioremap_resource()


+up->mapbase = res->start;


Accessing of 'res' has to be done after devm_ioremap_resource()


+up->membase = devm_ioremap_resource(>dev, res);
+if (IS_ERR(up->membase))
+return PTR_ERR(up->membase);
+





--
Thanks,
Varka Bhadram.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v10 2/2] tty/serial: Add Spreadtrum sc9836-uart driver support

2015-01-29 Thread Varka Bhadram

Hi,

On Wednesday 28 January 2015 04:38 PM, Chunyan Zhang wrote:

Add a full sc9836-uart driver for SC9836 SoC which is based on the
spreadtrum sharkl64 platform.
This driver also support earlycon.

Originally-by: Lanqing Liu 
Signed-off-by: Orson Zhai 
Signed-off-by: Chunyan Zhang 
Acked-by: Arnd Bergmann 
Reviewed-by: Peter Hurley 
---
  drivers/tty/serial/Kconfig   |   18 +
  drivers/tty/serial/Makefile  |1 +
  drivers/tty/serial/sprd_serial.c |  793 ++
  include/uapi/linux/serial_core.h |3 +
  4 files changed, 815 insertions(+)
  create mode 100644 drivers/tty/serial/sprd_serial.c


(...)


+static int sprd_probe(struct platform_device *pdev)
+{
+   struct resource *res;
+   struct uart_port *up;
+   struct clk *clk;
+   int irq;
+   int index;
+   int ret;
+
+   for (index = 0; index < ARRAY_SIZE(sprd_port); index++)
+   if (sprd_port[index] == NULL)
+   break;
+
+   if (index == ARRAY_SIZE(sprd_port))
+   return -EBUSY;
+
+   index = sprd_probe_dt_alias(index, >dev);
+
+   sprd_port[index] = devm_kzalloc(>dev,
+   sizeof(*sprd_port[index]), GFP_KERNEL);
+   if (!sprd_port[index])
+   return -ENOMEM;
+
+   up = _port[index]->port;
+   up->dev = >dev;
+   up->line = index;
+   up->type = PORT_SPRD;
+   up->iotype = SERIAL_IO_PORT;
+   up->uartclk = SPRD_DEF_RATE;
+   up->fifosize = SPRD_FIFO_SIZE;
+   up->ops = _sprd_ops;
+   up->flags = UPF_BOOT_AUTOCONF;
+
+   clk = devm_clk_get(>dev, NULL);
+   if (!IS_ERR(clk))
+   up->uartclk = clk_get_rate(clk);
+
+   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+   if (!res) {
+   dev_err(>dev, "not provide mem resource\n");
+   return -ENODEV;
+   }


This check is not required. It will be done by devm_ioremap_resource()


+   up->mapbase = res->start;
+   up->membase = devm_ioremap_resource(>dev, res);
+   if (IS_ERR(up->membase))
+   return PTR_ERR(up->membase);
+



--
Thanks,
Varka Bhadram.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v4 3/7] misc: Add cros_ec_lpc driver for x86 devices

2015-01-29 Thread Varka Bhadram
On Thu, Jan 29, 2015 at 7:07 PM, Javier Martinez Canillas
 wrote:
> From: Bill Richardson 
>
> Chromebooks have an Embedded Controller (EC) that is used to
> implement various functions such as keyboard, power and battery.
>
> The AP can communicate with the EC through different bus types
> such as I2C, SPI or LPC.
>
> The cros_ec mfd driver is then composed of a core driver that
> register the sub-devices as mfd cells and provide a high level
> communication interface that is used by the rest of the kernel
> and bus specific interfaces modules.
>
> Each connection method then has its own driver, which register
> with the EC driver interface-agnostic interface.
>
> Currently, there are drivers to communicate with the EC over
> I2C and SPI and this driver adds support for LPC.
>
> Signed-off-by: Bill Richardson 
> Signed-off-by: Javier Martinez Canillas 
> ---
>
> Changes since v3:
>  - Rename MYNAME to DRV_NAME
>  - Use devm_request_region() instead of request_region.
>Suggested by Varka Bhadram.
>  - Remove release_region from cleanup handle logic by using devres API.
>Suggested by Varka Bhadram.
>  - Use {dev,pr}_err() instead of {dev,pr}_warn() to log errors.
>

Addressed all of my comments... Thanks

Reviewed-by: Varka Bhadram 

-- 
Regards,
Varka Bhadram.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v10 2/2] tty/serial: Add Spreadtrum sc9836-uart driver support

2015-01-29 Thread Varka Bhadram

Hi,

On Wednesday 28 January 2015 04:38 PM, Chunyan Zhang wrote:

Add a full sc9836-uart driver for SC9836 SoC which is based on the
spreadtrum sharkl64 platform.
This driver also support earlycon.

Originally-by: Lanqing Liu lanqing@spreadtrum.com
Signed-off-by: Orson Zhai orson.z...@spreadtrum.com
Signed-off-by: Chunyan Zhang chunyan.zh...@spreadtrum.com
Acked-by: Arnd Bergmann a...@arndb.de
Reviewed-by: Peter Hurley pe...@hurleysoftware.com
---
  drivers/tty/serial/Kconfig   |   18 +
  drivers/tty/serial/Makefile  |1 +
  drivers/tty/serial/sprd_serial.c |  793 ++
  include/uapi/linux/serial_core.h |3 +
  4 files changed, 815 insertions(+)
  create mode 100644 drivers/tty/serial/sprd_serial.c


(...)


+static int sprd_probe(struct platform_device *pdev)
+{
+   struct resource *res;
+   struct uart_port *up;
+   struct clk *clk;
+   int irq;
+   int index;
+   int ret;
+
+   for (index = 0; index  ARRAY_SIZE(sprd_port); index++)
+   if (sprd_port[index] == NULL)
+   break;
+
+   if (index == ARRAY_SIZE(sprd_port))
+   return -EBUSY;
+
+   index = sprd_probe_dt_alias(index, pdev-dev);
+
+   sprd_port[index] = devm_kzalloc(pdev-dev,
+   sizeof(*sprd_port[index]), GFP_KERNEL);
+   if (!sprd_port[index])
+   return -ENOMEM;
+
+   up = sprd_port[index]-port;
+   up-dev = pdev-dev;
+   up-line = index;
+   up-type = PORT_SPRD;
+   up-iotype = SERIAL_IO_PORT;
+   up-uartclk = SPRD_DEF_RATE;
+   up-fifosize = SPRD_FIFO_SIZE;
+   up-ops = serial_sprd_ops;
+   up-flags = UPF_BOOT_AUTOCONF;
+
+   clk = devm_clk_get(pdev-dev, NULL);
+   if (!IS_ERR(clk))
+   up-uartclk = clk_get_rate(clk);
+
+   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+   if (!res) {
+   dev_err(pdev-dev, not provide mem resource\n);
+   return -ENODEV;
+   }


This check is not required. It will be done by devm_ioremap_resource()


+   up-mapbase = res-start;
+   up-membase = devm_ioremap_resource(pdev-dev, res);
+   if (IS_ERR(up-membase))
+   return PTR_ERR(up-membase);
+



--
Thanks,
Varka Bhadram.

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


Re: [PATCH v10 2/2] tty/serial: Add Spreadtrum sc9836-uart driver support

2015-01-29 Thread Varka Bhadram

On Thursday 29 January 2015 08:56 PM, Varka Bhadram wrote:

Hi,

On Wednesday 28 January 2015 04:38 PM, Chunyan Zhang wrote:

Add a full sc9836-uart driver for SC9836 SoC which is based on the
spreadtrum sharkl64 platform.
This driver also support earlycon.

Originally-by: Lanqing Liu lanqing@spreadtrum.com
Signed-off-by: Orson Zhai orson.z...@spreadtrum.com
Signed-off-by: Chunyan Zhang chunyan.zh...@spreadtrum.com
Acked-by: Arnd Bergmann a...@arndb.de
Reviewed-by: Peter Hurley pe...@hurleysoftware.com
---
  drivers/tty/serial/Kconfig   |   18 +
  drivers/tty/serial/Makefile  |1 +
  drivers/tty/serial/sprd_serial.c |  793 
++

  include/uapi/linux/serial_core.h |3 +
  4 files changed, 815 insertions(+)
  create mode 100644 drivers/tty/serial/sprd_serial.c


(...)


+static int sprd_probe(struct platform_device *pdev)
+{
+struct resource *res;
+struct uart_port *up;
+struct clk *clk;
+int irq;
+int index;
+int ret;
+
+for (index = 0; index  ARRAY_SIZE(sprd_port); index++)
+if (sprd_port[index] == NULL)
+break;
+
+if (index == ARRAY_SIZE(sprd_port))
+return -EBUSY;
+
+index = sprd_probe_dt_alias(index, pdev-dev);
+
+sprd_port[index] = devm_kzalloc(pdev-dev,
+sizeof(*sprd_port[index]), GFP_KERNEL);
+if (!sprd_port[index])
+return -ENOMEM;
+
+up = sprd_port[index]-port;
+up-dev = pdev-dev;
+up-line = index;
+up-type = PORT_SPRD;
+up-iotype = SERIAL_IO_PORT;
+up-uartclk = SPRD_DEF_RATE;
+up-fifosize = SPRD_FIFO_SIZE;
+up-ops = serial_sprd_ops;
+up-flags = UPF_BOOT_AUTOCONF;
+
+clk = devm_clk_get(pdev-dev, NULL);
+if (!IS_ERR(clk))
+up-uartclk = clk_get_rate(clk);
+
+res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+if (!res) {
+dev_err(pdev-dev, not provide mem resource\n);
+return -ENODEV;
+}


This check is not required. It will be done by devm_ioremap_resource()


+up-mapbase = res-start;


Accessing of 'res' has to be done after devm_ioremap_resource()


+up-membase = devm_ioremap_resource(pdev-dev, res);
+if (IS_ERR(up-membase))
+return PTR_ERR(up-membase);
+





--
Thanks,
Varka Bhadram.

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


Re: [PATCH v4 3/7] misc: Add cros_ec_lpc driver for x86 devices

2015-01-29 Thread Varka Bhadram
On Thu, Jan 29, 2015 at 7:07 PM, Javier Martinez Canillas
javier.marti...@collabora.co.uk wrote:
 From: Bill Richardson wfric...@chromium.org

 Chromebooks have an Embedded Controller (EC) that is used to
 implement various functions such as keyboard, power and battery.

 The AP can communicate with the EC through different bus types
 such as I2C, SPI or LPC.

 The cros_ec mfd driver is then composed of a core driver that
 register the sub-devices as mfd cells and provide a high level
 communication interface that is used by the rest of the kernel
 and bus specific interfaces modules.

 Each connection method then has its own driver, which register
 with the EC driver interface-agnostic interface.

 Currently, there are drivers to communicate with the EC over
 I2C and SPI and this driver adds support for LPC.

 Signed-off-by: Bill Richardson wfric...@chromium.org
 Signed-off-by: Javier Martinez Canillas javier.marti...@collabora.co.uk
 ---

 Changes since v3:
  - Rename MYNAME to DRV_NAME
  - Use devm_request_region() instead of request_region.
Suggested by Varka Bhadram.
  - Remove release_region from cleanup handle logic by using devres API.
Suggested by Varka Bhadram.
  - Use {dev,pr}_err() instead of {dev,pr}_warn() to log errors.


Addressed all of my comments... Thanks

Reviewed-by: Varka Bhadram varkabhad...@gmail.com

-- 
Regards,
Varka Bhadram.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] gpio: mmp: add GPIO driver for Marvell MMP series

2015-01-27 Thread Varka Bhadram
On Wed, Jan 28, 2015 at 8:00 AM, Chao Xie  wrote:
> From: Chao Xie 
>
> For some old PXA series, they used PXA GPIO driver.
> The IP of GPIO changes since PXA988 which is Marvell MMP
> series.
> It will use new way to control the GPIO level, direction
> and edge status.
>
> Signed-off-by: Chao Xie 
> ---
>  drivers/gpio/Kconfig|   7 +
>  drivers/gpio/Makefile   |   1 +
>  drivers/gpio/gpio-mmp.c | 444 
> 
>  3 files changed, 452 insertions(+)
>  create mode 100644 drivers/gpio/gpio-mmp.c

(...)

> +static int mmp_gpio_probe(struct platform_device *pdev)
> +{
> +   struct device *dev = >dev;
> +   struct mmp_gpio_platform_data *pdata;
> +   struct device_node *np;
> +   struct mmp_gpio_chip *mmp_chip;
> +   struct mmp_gpio_bank *bank;
> +   struct resource *res;
> +   struct irq_domain *domain;
> +   struct clk *clk;
> +   int irq, i, ret;
> +   void __iomem *base;
> +
> +   pdata = dev_get_platdata(dev);
> +   np = pdev->dev.of_node;
> +   if (!np && !pdata)
> +   return -EINVAL;
> +
> +   mmp_chip = devm_kzalloc(dev, sizeof(*mmp_chip), GFP_KERNEL);
> +   if (mmp_chip == NULL)
> +   return -ENOMEM;
> +

Using ! operator preffred instead of comparing with NULL.

> +   irq = platform_get_irq(pdev, 0);
> +   if (irq < 0)
> +   return irq;
> +
> +   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> +   if (!res)
> +   return -EINVAL;

This check is not required.. Check on resource happenning with
devm_ioremap_resource.

> +   base = devm_ioremap_resource(dev, res);
> +   if (!base)
> +   return -EINVAL;

I dont think this the correct return value.. return PTR_ERR(base)

> +
> +   mmp_chip->irq = irq;
> +   mmp_chip->reg_base = base;
> +
> +   if (pdata)
> +   ret = mmp_gpio_probe_pdata(pdev, mmp_chip, pdata);
> +   else
> +   ret = mmp_gpio_probe_dt(pdev, mmp_chip);
> +
> +   if (ret) {
> +   dev_err(dev, "Fail to initialize gpio unit, error %d.\n", 
> ret);
> +   return ret;
> +   }
> +
> +   clk = devm_clk_get(dev, NULL);
> +   if (IS_ERR(clk)) {
> +   dev_err(dev, "Fail to get gpio clock, error %ld.\n",
> +   PTR_ERR(clk));
> +   return PTR_ERR(clk);
> +   }
> +   ret = clk_prepare_enable(clk);
> +   if (ret) {
> +   dev_err(dev, "Fail to enable gpio clock, error %d.\n", ret);
> +   return ret;
> +   }
> +
> +   domain = irq_domain_add_linear(np, mmp_chip->ngpio,
> +   _gpio_irq_domain_ops, mmp_chip);
> +   if (domain == NULL)

Using ! operator preferred instead of comparing with NULL.




-- 
Thanks and Regards,
Varka Bhadram.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] gpio: mmp: add GPIO driver for Marvell MMP series

2015-01-27 Thread Varka Bhadram
On Wed, Jan 28, 2015 at 8:00 AM, Chao Xie chao@marvell.com wrote:
 From: Chao Xie chao@marvell.com

 For some old PXA series, they used PXA GPIO driver.
 The IP of GPIO changes since PXA988 which is Marvell MMP
 series.
 It will use new way to control the GPIO level, direction
 and edge status.

 Signed-off-by: Chao Xie chao@marvell.com
 ---
  drivers/gpio/Kconfig|   7 +
  drivers/gpio/Makefile   |   1 +
  drivers/gpio/gpio-mmp.c | 444 
 
  3 files changed, 452 insertions(+)
  create mode 100644 drivers/gpio/gpio-mmp.c

(...)

 +static int mmp_gpio_probe(struct platform_device *pdev)
 +{
 +   struct device *dev = pdev-dev;
 +   struct mmp_gpio_platform_data *pdata;
 +   struct device_node *np;
 +   struct mmp_gpio_chip *mmp_chip;
 +   struct mmp_gpio_bank *bank;
 +   struct resource *res;
 +   struct irq_domain *domain;
 +   struct clk *clk;
 +   int irq, i, ret;
 +   void __iomem *base;
 +
 +   pdata = dev_get_platdata(dev);
 +   np = pdev-dev.of_node;
 +   if (!np  !pdata)
 +   return -EINVAL;
 +
 +   mmp_chip = devm_kzalloc(dev, sizeof(*mmp_chip), GFP_KERNEL);
 +   if (mmp_chip == NULL)
 +   return -ENOMEM;
 +

Using ! operator preffred instead of comparing with NULL.

 +   irq = platform_get_irq(pdev, 0);
 +   if (irq  0)
 +   return irq;
 +
 +   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 +   if (!res)
 +   return -EINVAL;

This check is not required.. Check on resource happenning with
devm_ioremap_resource.

 +   base = devm_ioremap_resource(dev, res);
 +   if (!base)
 +   return -EINVAL;

I dont think this the correct return value.. return PTR_ERR(base)

 +
 +   mmp_chip-irq = irq;
 +   mmp_chip-reg_base = base;
 +
 +   if (pdata)
 +   ret = mmp_gpio_probe_pdata(pdev, mmp_chip, pdata);
 +   else
 +   ret = mmp_gpio_probe_dt(pdev, mmp_chip);
 +
 +   if (ret) {
 +   dev_err(dev, Fail to initialize gpio unit, error %d.\n, 
 ret);
 +   return ret;
 +   }
 +
 +   clk = devm_clk_get(dev, NULL);
 +   if (IS_ERR(clk)) {
 +   dev_err(dev, Fail to get gpio clock, error %ld.\n,
 +   PTR_ERR(clk));
 +   return PTR_ERR(clk);
 +   }
 +   ret = clk_prepare_enable(clk);
 +   if (ret) {
 +   dev_err(dev, Fail to enable gpio clock, error %d.\n, ret);
 +   return ret;
 +   }
 +
 +   domain = irq_domain_add_linear(np, mmp_chip-ngpio,
 +   mmp_gpio_irq_domain_ops, mmp_chip);
 +   if (domain == NULL)

Using ! operator preferred instead of comparing with NULL.




-- 
Thanks and Regards,
Varka Bhadram.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH bluetooth-next] ieee802154: cc2520: Fix space before , coding style issue

2015-01-26 Thread Varka Bhadram

Hi Jamal,

On Friday 23 January 2015 07:25 PM, Mohammad Jamal wrote:

This patch removes the warnings (space before , ) shown by
checkpatch.pl


Thanks for the patch.

Acked-by: Varka Bhadram 



Signed-off-by: Mohammad Jamal 
---
  drivers/net/ieee802154/cc2520.c |4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ieee802154/cc2520.c b/drivers/net/ieee802154/cc2520.c
index a43c8ac..665a3db 100644
--- a/drivers/net/ieee802154/cc2520.c
+++ b/drivers/net/ieee802154/cc2520.c
@@ -549,14 +549,14 @@ cc2520_ed(struct ieee802154_hw *hw, u8 *level)
u8 rssi;
int ret;
  
-	ret = cc2520_read_register(priv , CC2520_RSSISTAT, );

+   ret = cc2520_read_register(priv, CC2520_RSSISTAT, );
if (ret)
return ret;
  
  	if (status != RSSI_VALID)

return -EINVAL;
  
-	ret = cc2520_read_register(priv , CC2520_RSSI, );

+   ret = cc2520_read_register(priv, CC2520_RSSI, );
if (ret)
return ret;
  


--
Thanks and Regards,
Varka Bhadram.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH bluetooth-next] ieee802154: cc2520: Replace shift operations by BIT macro

2015-01-26 Thread Varka Bhadram

Hi Jamal,

On Friday 23 January 2015 07:28 PM, Mohammad Jamal wrote:

This patch replaces the shifting operations by BIT macro


Thanks for the patch.

Acked-by: Varka Bhadram 


Signed-off-by: Mohammad Jamal 
---
  drivers/net/ieee802154/cc2520.c |6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ieee802154/cc2520.c b/drivers/net/ieee802154/cc2520.c
index 665a3db..181b349 100644
--- a/drivers/net/ieee802154/cc2520.c
+++ b/drivers/net/ieee802154/cc2520.c
@@ -44,9 +44,9 @@
  #define   CC2520_FREG_MASK0x3F
  
  /* status byte values */

-#defineCC2520_STATUS_XOSC32M_STABLE(1 << 7)
-#defineCC2520_STATUS_RSSI_VALID(1 << 6)
-#defineCC2520_STATUS_TX_UNDERFLOW  (1 << 3)
+#defineCC2520_STATUS_XOSC32M_STABLEBIT(7)
+#defineCC2520_STATUS_RSSI_VALIDBIT(6)
+#defineCC2520_STATUS_TX_UNDERFLOW  BIT(3)
  
  /* IEEE-802.15.4 defined constants (2.4 GHz logical channels) */

  #define   CC2520_MINCHANNEL   11


--
Thanks and Regards,
Varka Bhadram.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH bluetooth-next] ieee802154: cc2520: Replace shift operations by BIT macro

2015-01-26 Thread Varka Bhadram

Hi Jamal,

On Friday 23 January 2015 07:28 PM, Mohammad Jamal wrote:

This patch replaces the shifting operations by BIT macro


Thanks for the patch.

Acked-by: Varka Bhadram varkabhad...@gmail.com


Signed-off-by: Mohammad Jamal md.jamalmohiud...@gmail.com
---
  drivers/net/ieee802154/cc2520.c |6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ieee802154/cc2520.c b/drivers/net/ieee802154/cc2520.c
index 665a3db..181b349 100644
--- a/drivers/net/ieee802154/cc2520.c
+++ b/drivers/net/ieee802154/cc2520.c
@@ -44,9 +44,9 @@
  #define   CC2520_FREG_MASK0x3F
  
  /* status byte values */

-#defineCC2520_STATUS_XOSC32M_STABLE(1  7)
-#defineCC2520_STATUS_RSSI_VALID(1  6)
-#defineCC2520_STATUS_TX_UNDERFLOW  (1  3)
+#defineCC2520_STATUS_XOSC32M_STABLEBIT(7)
+#defineCC2520_STATUS_RSSI_VALIDBIT(6)
+#defineCC2520_STATUS_TX_UNDERFLOW  BIT(3)
  
  /* IEEE-802.15.4 defined constants (2.4 GHz logical channels) */

  #define   CC2520_MINCHANNEL   11


--
Thanks and Regards,
Varka Bhadram.

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


Re: [PATCH bluetooth-next] ieee802154: cc2520: Fix space before , coding style issue

2015-01-26 Thread Varka Bhadram

Hi Jamal,

On Friday 23 January 2015 07:25 PM, Mohammad Jamal wrote:

This patch removes the warnings (space before , ) shown by
checkpatch.pl


Thanks for the patch.

Acked-by: Varka Bhadram varkabhad...@gmail.com



Signed-off-by: Mohammad Jamal md.jamalmohiud...@gmail.com
---
  drivers/net/ieee802154/cc2520.c |4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ieee802154/cc2520.c b/drivers/net/ieee802154/cc2520.c
index a43c8ac..665a3db 100644
--- a/drivers/net/ieee802154/cc2520.c
+++ b/drivers/net/ieee802154/cc2520.c
@@ -549,14 +549,14 @@ cc2520_ed(struct ieee802154_hw *hw, u8 *level)
u8 rssi;
int ret;
  
-	ret = cc2520_read_register(priv , CC2520_RSSISTAT, status);

+   ret = cc2520_read_register(priv, CC2520_RSSISTAT, status);
if (ret)
return ret;
  
  	if (status != RSSI_VALID)

return -EINVAL;
  
-	ret = cc2520_read_register(priv , CC2520_RSSI, rssi);

+   ret = cc2520_read_register(priv, CC2520_RSSI, rssi);
if (ret)
return ret;
  


--
Thanks and Regards,
Varka Bhadram.

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


Re: [PATCH] net: ieee802154: cc2520: fix coding style issue

2015-01-23 Thread Varka Bhadram
Hi Mohammad Jamal,

On Fri, Jan 23, 2015 at 3:06 PM, Mohammad Jamal
 wrote:
> This patch solves the coding style issue warning
> by replacing the shifting operations by BIT macro
>
> Signed-off-by: Mohammad Jamal 
> ---
>  drivers/net/ieee802154/cc2520.c |6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ieee802154/cc2520.c b/drivers/net/ieee802154/cc2520.c
> index dd129be..b9b2a49 100644
> --- a/drivers/net/ieee802154/cc2520.c
> +++ b/drivers/net/ieee802154/cc2520.c
> @@ -45,9 +45,9 @@
>  #defineCC2520_FREG_MASK0x3F
>
>  /* status byte values */
> -#defineCC2520_STATUS_XOSC32M_STABLE(1 << 7)
> -#defineCC2520_STATUS_RSSI_VALID(1 << 6)
> -#defineCC2520_STATUS_TX_UNDERFLOW  (1 << 3)
> +#defineCC2520_STATUS_XOSC32M_STABLEBIT(7)
> +#defineCC2520_STATUS_RSSI_VALIDBIT(6)
> +#defineCC2520_STATUS_TX_UNDERFLOW  BIT(3)
>
>  /* IEEE-802.15.4 defined constants (2.4 GHz logical channels) */
>  #defineCC2520_MINCHANNEL   11
> --
> 1.7.9.5
>

Please work on bluetooth-next[1] tree and also include
'bluetooth-next' tag for the patch.

[1]: http://git.kernel.org/cgit/linux/kernel/git/bluetooth/bluetooth-next.git/

-- 
Thanks and Regards,
Varka Bhadram.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] net: ieee802154: cc2520: Fix coding style issues

2015-01-23 Thread Varka Bhadram
Hi Mohammad Jamal,

These changes already there in the current bluetooth-next tree.

On Fri, Jan 23, 2015 at 2:56 PM, Mohammad Jamal
 wrote:
> This patch solves the coding style issues such as space after ,
> and removes the blank lines
>
> Signed-off-by: Mohammad Jamal 
> ---
>  drivers/net/ieee802154/cc2520.c |6 ++
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/ieee802154/cc2520.c b/drivers/net/ieee802154/cc2520.c
> index f9df9fa..dd129be 100644
> --- a/drivers/net/ieee802154/cc2520.c
> +++ b/drivers/net/ieee802154/cc2520.c
> @@ -513,7 +513,6 @@ err_tx:
> return rc;
>  }
>
> -
>  static int cc2520_rx(struct cc2520_private *priv)
>  {
> u8 len = 0, lqi = 0, bytes = 1;
> @@ -551,14 +550,14 @@ cc2520_ed(struct ieee802154_hw *hw, u8 *level)
> u8 rssi;
> int ret;
>
> -   ret = cc2520_read_register(priv , CC2520_RSSISTAT, );
> +   ret = cc2520_read_register(priv, CC2520_RSSISTAT, );
> if (ret)
> return ret;
>
> if (status != RSSI_VALID)
> return -EINVAL;
>
> -   ret = cc2520_read_register(priv , CC2520_RSSI, );
> +   ret = cc2520_read_register(priv, CC2520_RSSI, );
> if (ret)
> return ret;
>
> @@ -947,7 +946,6 @@ static int cc2520_probe(struct spi_device *spi)
> if (ret)
> goto err_hw_init;
>
> -
>     gpio_set_value(pdata->vreg, HIGH);
> usleep_range(100, 150);
>
> --
> 1.7.9.5
>

-- 
Thanks and Regards,
Varka Bhadram.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] net: ieee802154: cc2520: Fix coding style issues

2015-01-23 Thread Varka Bhadram
Hi Mohammad Jamal,

These changes already there in the current bluetooth-next tree.

On Fri, Jan 23, 2015 at 2:56 PM, Mohammad Jamal
md.jamalmohiud...@gmail.com wrote:
 This patch solves the coding style issues such as space after ,
 and removes the blank lines

 Signed-off-by: Mohammad Jamal md.jamalmohiud...@gmail.com
 ---
  drivers/net/ieee802154/cc2520.c |6 ++
  1 file changed, 2 insertions(+), 4 deletions(-)

 diff --git a/drivers/net/ieee802154/cc2520.c b/drivers/net/ieee802154/cc2520.c
 index f9df9fa..dd129be 100644
 --- a/drivers/net/ieee802154/cc2520.c
 +++ b/drivers/net/ieee802154/cc2520.c
 @@ -513,7 +513,6 @@ err_tx:
 return rc;
  }

 -
  static int cc2520_rx(struct cc2520_private *priv)
  {
 u8 len = 0, lqi = 0, bytes = 1;
 @@ -551,14 +550,14 @@ cc2520_ed(struct ieee802154_hw *hw, u8 *level)
 u8 rssi;
 int ret;

 -   ret = cc2520_read_register(priv , CC2520_RSSISTAT, status);
 +   ret = cc2520_read_register(priv, CC2520_RSSISTAT, status);
 if (ret)
 return ret;

 if (status != RSSI_VALID)
 return -EINVAL;

 -   ret = cc2520_read_register(priv , CC2520_RSSI, rssi);
 +   ret = cc2520_read_register(priv, CC2520_RSSI, rssi);
 if (ret)
 return ret;

 @@ -947,7 +946,6 @@ static int cc2520_probe(struct spi_device *spi)
 if (ret)
 goto err_hw_init;

 -
 gpio_set_value(pdata-vreg, HIGH);
 usleep_range(100, 150);

 --
 1.7.9.5


-- 
Thanks and Regards,
Varka Bhadram.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] net: ieee802154: cc2520: fix coding style issue

2015-01-23 Thread Varka Bhadram
Hi Mohammad Jamal,

On Fri, Jan 23, 2015 at 3:06 PM, Mohammad Jamal
md.jamalmohiud...@gmail.com wrote:
 This patch solves the coding style issue warning
 by replacing the shifting operations by BIT macro

 Signed-off-by: Mohammad Jamal md.jamalmohiud...@gmail.com
 ---
  drivers/net/ieee802154/cc2520.c |6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

 diff --git a/drivers/net/ieee802154/cc2520.c b/drivers/net/ieee802154/cc2520.c
 index dd129be..b9b2a49 100644
 --- a/drivers/net/ieee802154/cc2520.c
 +++ b/drivers/net/ieee802154/cc2520.c
 @@ -45,9 +45,9 @@
  #defineCC2520_FREG_MASK0x3F

  /* status byte values */
 -#defineCC2520_STATUS_XOSC32M_STABLE(1  7)
 -#defineCC2520_STATUS_RSSI_VALID(1  6)
 -#defineCC2520_STATUS_TX_UNDERFLOW  (1  3)
 +#defineCC2520_STATUS_XOSC32M_STABLEBIT(7)
 +#defineCC2520_STATUS_RSSI_VALIDBIT(6)
 +#defineCC2520_STATUS_TX_UNDERFLOW  BIT(3)

  /* IEEE-802.15.4 defined constants (2.4 GHz logical channels) */
  #defineCC2520_MINCHANNEL   11
 --
 1.7.9.5


Please work on bluetooth-next[1] tree and also include
'bluetooth-next' tag for the patch.

[1]: http://git.kernel.org/cgit/linux/kernel/git/bluetooth/bluetooth-next.git/

-- 
Thanks and Regards,
Varka Bhadram.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 3/7] misc: Add cros_ec_lpc driver for x86 devices

2015-01-22 Thread Varka Bhadram
On Fri, Jan 23, 2015 at 12:46 AM, Javier Martinez Canillas
 wrote:
> From: Bill Richardson 
>
> Chromebooks have an Embedded Controller (EC) that is used to
> implement various functions such as keyboard, power and battery.
>
> The AP can communicate with the EC through different bus types
> such as I2C, SPI or LPC.
>
> The cros_ec mfd driver is then composed of a core driver that
> register the sub-devices as mfd cells and provide a high level
> communication interface that is used by the rest of the kernel
> and bus specific interfaces modules.
>
> Each connection method then has its own driver, which register
> with the EC driver interface-agnostic interface.
>
> Currently, there are drivers to communicate with the EC over
> I2C and SPI and this driver adds support for LPC.
>
> Signed-off-by: Bill Richardson 
> Signed-off-by: Javier Martinez Canillas 
> ---
>
> Changes since v2:
>  - Move out from drivers/mfd to drivers/misc. Suggested by Lee Jones.
>
> Changes since v1: None, new patch.
> ---
>  drivers/misc/Kconfig   |  10 ++
>  drivers/misc/Makefile  |   1 +
>  drivers/misc/cros_ec_lpc.c | 306 
> +
>  3 files changed, 317 insertions(+)
>  create mode 100644 drivers/misc/cros_ec_lpc.c
(...)
> +static int cros_ec_lpc_probe(struct platform_device *pdev)
> +{
> +   struct device *dev = >dev;
> +   struct cros_ec_device *ec_dev;
> +   int err = -ENOTTY;
> +
> +   if (!request_region(EC_LPC_ADDR_MEMMAP, EC_MEMMAP_SIZE, MYNAME)) {

Why dont you use devres API for request_region()... Then maximum of
your goto label regarding
release region will gone...

> +   dev_warn(dev, "couldn't reserve memmap region\n");
> +   goto failed_memmap;
> +   }
> +
> +   if ((inb(EC_LPC_ADDR_MEMMAP + EC_MEMMAP_ID) != 'E') ||
> +   (inb(EC_LPC_ADDR_MEMMAP + EC_MEMMAP_ID + 1) != 'C')) {
> +   dev_warn(dev, "EC ID not detected\n");
> +   goto failed_ec_probe;
> +   }
> +
> +   if (!request_region(EC_HOST_CMD_REGION0, EC_HOST_CMD_REGION_SIZE,
> +   MYNAME)) {

same...

> +   dev_warn(dev, "couldn't reserve region0\n");
> +   goto failed_region0;
> +   }
> +   if (!request_region(EC_HOST_CMD_REGION1, EC_HOST_CMD_REGION_SIZE,
> +   MYNAME)) {

same ...

> +   dev_warn(dev, "couldn't reserve region1\n");
> +   goto failed_region1;
> +   }
> +
> +   ec_dev = devm_kzalloc(dev, sizeof(*ec_dev), GFP_KERNEL);
> +   if (!ec_dev) {
> +   err = -ENOMEM;
> +   goto failed_ec_dev;
> +   }
> +
> +   platform_set_drvdata(pdev, ec_dev);
> +   ec_dev->dev = dev;
> +   ec_dev->ec_name = pdev->name;
> +   ec_dev->phys_name = dev_name(dev);
> +   ec_dev->parent = dev;
> +   ec_dev->cmd_xfer = cros_ec_cmd_xfer_lpc;
> +   ec_dev->cmd_readmem = cros_ec_lpc_readmem;
> +
> +   err = cros_ec_register(ec_dev);
> +   if (err) {
> +   dev_warn(dev, "couldn't register ec_dev\n");
> +   goto failed_ec_dev;
> +   }
> +
> +   return 0;
> +
> +failed_ec_dev:
> +   release_region(EC_HOST_CMD_REGION1, EC_HOST_CMD_REGION_SIZE);
> +failed_region1:
> +   release_region(EC_HOST_CMD_REGION0, EC_HOST_CMD_REGION_SIZE);
> +failed_region0:
> +failed_ec_probe:
> +   release_region(EC_LPC_ADDR_MEMMAP, EC_MEMMAP_SIZE);

All these goto labels will be gone if you use devres API..

> +failed_memmap:
> +   return err;
> +}
> +
> +static int cros_ec_lpc_remove(struct platform_device *pdev)
> +{
> +   struct cros_ec_device *ec_dev;
> +
> +   ec_dev = platform_get_drvdata(pdev);
> +   cros_ec_remove(ec_dev);
> +
> +   release_region(EC_HOST_CMD_REGION1, EC_HOST_CMD_REGION_SIZE);
> +   release_region(EC_HOST_CMD_REGION0, EC_HOST_CMD_REGION_SIZE);
> +   release_region(EC_LPC_ADDR_MEMMAP, EC_MEMMAP_SIZE);
> +

These also will be gone


-- 
Thanks and Regards,
Varka Bhadram.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 3/7] misc: Add cros_ec_lpc driver for x86 devices

2015-01-22 Thread Varka Bhadram
On Fri, Jan 23, 2015 at 12:46 AM, Javier Martinez Canillas
javier.marti...@collabora.co.uk wrote:
 From: Bill Richardson wfric...@chromium.org

 Chromebooks have an Embedded Controller (EC) that is used to
 implement various functions such as keyboard, power and battery.

 The AP can communicate with the EC through different bus types
 such as I2C, SPI or LPC.

 The cros_ec mfd driver is then composed of a core driver that
 register the sub-devices as mfd cells and provide a high level
 communication interface that is used by the rest of the kernel
 and bus specific interfaces modules.

 Each connection method then has its own driver, which register
 with the EC driver interface-agnostic interface.

 Currently, there are drivers to communicate with the EC over
 I2C and SPI and this driver adds support for LPC.

 Signed-off-by: Bill Richardson wfric...@chromium.org
 Signed-off-by: Javier Martinez Canillas javier.marti...@collabora.co.uk
 ---

 Changes since v2:
  - Move out from drivers/mfd to drivers/misc. Suggested by Lee Jones.

 Changes since v1: None, new patch.
 ---
  drivers/misc/Kconfig   |  10 ++
  drivers/misc/Makefile  |   1 +
  drivers/misc/cros_ec_lpc.c | 306 
 +
  3 files changed, 317 insertions(+)
  create mode 100644 drivers/misc/cros_ec_lpc.c
(...)
 +static int cros_ec_lpc_probe(struct platform_device *pdev)
 +{
 +   struct device *dev = pdev-dev;
 +   struct cros_ec_device *ec_dev;
 +   int err = -ENOTTY;
 +
 +   if (!request_region(EC_LPC_ADDR_MEMMAP, EC_MEMMAP_SIZE, MYNAME)) {

Why dont you use devres API for request_region()... Then maximum of
your goto label regarding
release region will gone...

 +   dev_warn(dev, couldn't reserve memmap region\n);
 +   goto failed_memmap;
 +   }
 +
 +   if ((inb(EC_LPC_ADDR_MEMMAP + EC_MEMMAP_ID) != 'E') ||
 +   (inb(EC_LPC_ADDR_MEMMAP + EC_MEMMAP_ID + 1) != 'C')) {
 +   dev_warn(dev, EC ID not detected\n);
 +   goto failed_ec_probe;
 +   }
 +
 +   if (!request_region(EC_HOST_CMD_REGION0, EC_HOST_CMD_REGION_SIZE,
 +   MYNAME)) {

same...

 +   dev_warn(dev, couldn't reserve region0\n);
 +   goto failed_region0;
 +   }
 +   if (!request_region(EC_HOST_CMD_REGION1, EC_HOST_CMD_REGION_SIZE,
 +   MYNAME)) {

same ...

 +   dev_warn(dev, couldn't reserve region1\n);
 +   goto failed_region1;
 +   }
 +
 +   ec_dev = devm_kzalloc(dev, sizeof(*ec_dev), GFP_KERNEL);
 +   if (!ec_dev) {
 +   err = -ENOMEM;
 +   goto failed_ec_dev;
 +   }
 +
 +   platform_set_drvdata(pdev, ec_dev);
 +   ec_dev-dev = dev;
 +   ec_dev-ec_name = pdev-name;
 +   ec_dev-phys_name = dev_name(dev);
 +   ec_dev-parent = dev;
 +   ec_dev-cmd_xfer = cros_ec_cmd_xfer_lpc;
 +   ec_dev-cmd_readmem = cros_ec_lpc_readmem;
 +
 +   err = cros_ec_register(ec_dev);
 +   if (err) {
 +   dev_warn(dev, couldn't register ec_dev\n);
 +   goto failed_ec_dev;
 +   }
 +
 +   return 0;
 +
 +failed_ec_dev:
 +   release_region(EC_HOST_CMD_REGION1, EC_HOST_CMD_REGION_SIZE);
 +failed_region1:
 +   release_region(EC_HOST_CMD_REGION0, EC_HOST_CMD_REGION_SIZE);
 +failed_region0:
 +failed_ec_probe:
 +   release_region(EC_LPC_ADDR_MEMMAP, EC_MEMMAP_SIZE);

All these goto labels will be gone if you use devres API..

 +failed_memmap:
 +   return err;
 +}
 +
 +static int cros_ec_lpc_remove(struct platform_device *pdev)
 +{
 +   struct cros_ec_device *ec_dev;
 +
 +   ec_dev = platform_get_drvdata(pdev);
 +   cros_ec_remove(ec_dev);
 +
 +   release_region(EC_HOST_CMD_REGION1, EC_HOST_CMD_REGION_SIZE);
 +   release_region(EC_HOST_CMD_REGION0, EC_HOST_CMD_REGION_SIZE);
 +   release_region(EC_LPC_ADDR_MEMMAP, EC_MEMMAP_SIZE);
 +

These also will be gone


-- 
Thanks and Regards,
Varka Bhadram.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v6 5/7] power: Add support for DA9150 Charger

2015-01-21 Thread Varka Bhadram


On Wednesday 21 January 2015 09:16 PM, Adam Thomson wrote:

This patch adds support for DA9150 Charger & Fuel-Gauge IC Charger.

Signed-off-by: Adam Thomson 
---


(...)


+static int da9150_charger_register_irq(struct platform_device *pdev,
+  irq_handler_t handler,
+  const char *irq_name)
+{
+   struct device *dev = >dev;
+   struct da9150_charger *charger = platform_get_drvdata(pdev);
+   int irq, ret;
+
+   irq = platform_get_irq_byname(pdev, irq_name);
+   if (irq < 0) {
+   dev_err(dev, "Failed to get IRQ CHG_STATUS: %d\n", irq);
+   return irq;
+   }
+
+   ret = request_threaded_irq(irq, NULL, handler, IRQF_ONESHOT, irq_name,
+  charger);


Why don you use devm_* API..?


+   if (ret)
+   dev_err(dev, "Failed to request IRQ %d: %d\n", irq, ret);
+
+   return ret;
+}
+
+static void da9150_charger_unregister_irq(struct platform_device *pdev,
+ const char *irq_name)
+{
+   struct device *dev = >dev;
+   struct da9150_charger *charger = platform_get_drvdata(pdev);
+   int irq;
+
+   irq = platform_get_irq_byname(pdev, irq_name);
+   if (irq < 0) {
+   dev_err(dev, "Failed to get IRQ CHG_STATUS: %d\n", irq);
+   return;
+   }
+
+   free_irq(irq, charger);
+}
+
+static int da9150_charger_probe(struct platform_device *pdev)
+{
+   struct device *dev = >dev;
+   struct da9150 *da9150 = dev_get_drvdata(dev->parent);
+   struct da9150_charger *charger;
+   struct power_supply *usb, *battery;
+   u8 reg;
+   int ret;
+
+   charger = devm_kzalloc(dev, sizeof(struct da9150_charger), GFP_KERNEL);
+   if (charger == NULL)
+   return -ENOMEM;


sizeof(struct da9150_charger) can be replaced with sizeof(*charger)...

*!* operator can be used in comparison with NULL...

(...)

--
Thanks and Regards,
Varka Bhadram.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v6 3/7] iio: Add support for DA9150 GPADC

2015-01-21 Thread Varka Bhadram


On Wednesday 21 January 2015 09:16 PM, Adam Thomson wrote:

This patch adds support for DA9150 Charger & Fuel-Gauge IC GPADC.

Signed-off-by: Adam Thomson 
Reviewed-by: Hartmut Knaack 
Acked-by: Jonathan Cameron 


(...)


+
+static int da9150_gpadc_probe(struct platform_device *pdev)
+{
+   struct device *dev = >dev;
+   struct da9150 *da9150 = dev_get_drvdata(dev->parent);
+   struct da9150_gpadc *gpadc;
+   struct iio_dev *indio_dev;
+   int irq, ret;
+
+   indio_dev = devm_iio_device_alloc(>dev, sizeof(*gpadc));


 You can directly use *dev* instead of *>dev*


--
Thanks and Regards,
Varka Bhadram.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v6 5/7] power: Add support for DA9150 Charger

2015-01-21 Thread Varka Bhadram


On Wednesday 21 January 2015 09:16 PM, Adam Thomson wrote:

This patch adds support for DA9150 Charger  Fuel-Gauge IC Charger.

Signed-off-by: Adam Thomson adam.thomson.opensou...@diasemi.com
---


(...)


+static int da9150_charger_register_irq(struct platform_device *pdev,
+  irq_handler_t handler,
+  const char *irq_name)
+{
+   struct device *dev = pdev-dev;
+   struct da9150_charger *charger = platform_get_drvdata(pdev);
+   int irq, ret;
+
+   irq = platform_get_irq_byname(pdev, irq_name);
+   if (irq  0) {
+   dev_err(dev, Failed to get IRQ CHG_STATUS: %d\n, irq);
+   return irq;
+   }
+
+   ret = request_threaded_irq(irq, NULL, handler, IRQF_ONESHOT, irq_name,
+  charger);


Why don you use devm_* API..?


+   if (ret)
+   dev_err(dev, Failed to request IRQ %d: %d\n, irq, ret);
+
+   return ret;
+}
+
+static void da9150_charger_unregister_irq(struct platform_device *pdev,
+ const char *irq_name)
+{
+   struct device *dev = pdev-dev;
+   struct da9150_charger *charger = platform_get_drvdata(pdev);
+   int irq;
+
+   irq = platform_get_irq_byname(pdev, irq_name);
+   if (irq  0) {
+   dev_err(dev, Failed to get IRQ CHG_STATUS: %d\n, irq);
+   return;
+   }
+
+   free_irq(irq, charger);
+}
+
+static int da9150_charger_probe(struct platform_device *pdev)
+{
+   struct device *dev = pdev-dev;
+   struct da9150 *da9150 = dev_get_drvdata(dev-parent);
+   struct da9150_charger *charger;
+   struct power_supply *usb, *battery;
+   u8 reg;
+   int ret;
+
+   charger = devm_kzalloc(dev, sizeof(struct da9150_charger), GFP_KERNEL);
+   if (charger == NULL)
+   return -ENOMEM;


sizeof(struct da9150_charger) can be replaced with sizeof(*charger)...

*!* operator can be used in comparison with NULL...

(...)

--
Thanks and Regards,
Varka Bhadram.

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


Re: [PATCH v6 3/7] iio: Add support for DA9150 GPADC

2015-01-21 Thread Varka Bhadram


On Wednesday 21 January 2015 09:16 PM, Adam Thomson wrote:

This patch adds support for DA9150 Charger  Fuel-Gauge IC GPADC.

Signed-off-by: Adam Thomson adam.thomson.opensou...@diasemi.com
Reviewed-by: Hartmut Knaack knaac...@gmx.de
Acked-by: Jonathan Cameron ji...@kernel.org


(...)


+
+static int da9150_gpadc_probe(struct platform_device *pdev)
+{
+   struct device *dev = pdev-dev;
+   struct da9150 *da9150 = dev_get_drvdata(dev-parent);
+   struct da9150_gpadc *gpadc;
+   struct iio_dev *indio_dev;
+   int irq, ret;
+
+   indio_dev = devm_iio_device_alloc(pdev-dev, sizeof(*gpadc));


 You can directly use *dev* instead of *pdev-dev*


--
Thanks and Regards,
Varka Bhadram.

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


Re: [PATCH 3/6] btwilink: add minimal device tree support

2015-01-08 Thread Varka Bhadram
Hi,

On Fri, Jan 9, 2015 at 9:17 AM, Gigi Joseph  wrote:
> Add minimal device tree support to the btwilink driver that is used
> for binding bluetooth with the ti-st shared transport driver.
>
> Signed-off-by: Eyal Reizer 
> Signed-off-by: bvijay 
> Signed-off-by: Gigi Joseph 
> ---
>  drivers/bluetooth/btwilink.c | 11 +++
>  1 file changed, 11 insertions(+)
>
> diff --git a/drivers/bluetooth/btwilink.c b/drivers/bluetooth/btwilink.c
> index 55c135b..95adec3 100644
> --- a/drivers/bluetooth/btwilink.c
> +++ b/drivers/bluetooth/btwilink.c
> @@ -30,6 +30,7 @@
>
>  #include 
>  #include 
> +#include 
>
>  /* Bluetooth Driver Version */
>  #define VERSION   "1.0"
> @@ -286,6 +287,14 @@ static int ti_st_send_frame(struct hci_dev *hdev, struct 
> sk_buff *skb)
> return 0;
>  }
>
> +static const struct of_device_id btwilink_of_match[] = {
> +{
> +   .compatible = "btwilink",
compatible property include the manufacturer name also...
compatible=","
> +   },
> +   {}
> +};
> +MODULE_DEVICE_TABLE(of, btwilink_of_match);
> +
>  static int bt_ti_probe(struct platform_device *pdev)
>  {
> static struct ti_st *hst;
> @@ -349,6 +358,8 @@ static struct platform_driver btwilink_driver = {
> .remove = bt_ti_remove,
> .driver = {
> .name = "btwilink",
> +   .owner = THIS_MODULE,
No need to update this field. It will be updated by driver core.
> +   .of_match_table = of_match_ptr(btwilink_of_match),
> },
>  };
>
> --
> 1.9.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe devicetree" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
Thanks and Regards,
Varka Bhadram.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 3/6] btwilink: add minimal device tree support

2015-01-08 Thread Varka Bhadram
Hi,

On Fri, Jan 9, 2015 at 9:17 AM, Gigi Joseph gigi.jos...@gmail.com wrote:
 Add minimal device tree support to the btwilink driver that is used
 for binding bluetooth with the ti-st shared transport driver.

 Signed-off-by: Eyal Reizer ey...@ti.com
 Signed-off-by: bvijay bvi...@ti.com
 Signed-off-by: Gigi Joseph gigi.jos...@ti.com
 ---
  drivers/bluetooth/btwilink.c | 11 +++
  1 file changed, 11 insertions(+)

 diff --git a/drivers/bluetooth/btwilink.c b/drivers/bluetooth/btwilink.c
 index 55c135b..95adec3 100644
 --- a/drivers/bluetooth/btwilink.c
 +++ b/drivers/bluetooth/btwilink.c
 @@ -30,6 +30,7 @@

  #include linux/ti_wilink_st.h
  #include linux/module.h
 +#include linux/of.h

  /* Bluetooth Driver Version */
  #define VERSION   1.0
 @@ -286,6 +287,14 @@ static int ti_st_send_frame(struct hci_dev *hdev, struct 
 sk_buff *skb)
 return 0;
  }

 +static const struct of_device_id btwilink_of_match[] = {
 +{
 +   .compatible = btwilink,
compatible property include the manufacturer name also...
compatible=manufacturer,model
 +   },
 +   {}
 +};
 +MODULE_DEVICE_TABLE(of, btwilink_of_match);
 +
  static int bt_ti_probe(struct platform_device *pdev)
  {
 static struct ti_st *hst;
 @@ -349,6 +358,8 @@ static struct platform_driver btwilink_driver = {
 .remove = bt_ti_remove,
 .driver = {
 .name = btwilink,
 +   .owner = THIS_MODULE,
No need to update this field. It will be updated by driver core.
 +   .of_match_table = of_match_ptr(btwilink_of_match),
 },
  };

 --
 1.9.1

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



-- 
Thanks and Regards,
Varka Bhadram.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCHv5 3/9] devfreq: event: Add exynos-ppmu devfreq-event driver

2014-12-22 Thread Varka Bhadram
  .owner  = THIS_MODULE,
remove owner field. It will be populate by driver core.
> +   .of_match_table = exynos_ppmu_id_match,
> +   },
> +};
> +module_platform_driver(exynos_ppmu_driver);
> +
> +MODULE_DESCRIPTION("Exynos PPMU(Platform Performance Monitoring Unit) 
> driver");
> +MODULE_AUTHOR("Chanwoo Choi ");
> +MODULE_LICENSE("GPL");
> +MODULE_ALIAS("platform:exynos-ppmu");
> --
> 1.8.5.5
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" 
> in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
Thanks and Regards,
Varka Bhadram.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 3/3] net: ieee802154: don't use devm_pinctrl_get_select_default() in probe

2014-12-22 Thread Varka Bhadram
Thanks for the patch.

Acked-by: Varka Bhadram 

On Tue, Dec 23, 2014 at 5:40 AM, Varka Bhadram  wrote:
>
> Thanks for the patch.
>
> Acked-by: Varka Bhadram 
>
> On Tue, Dec 23, 2014 at 3:46 AM, Wolfram Sang  wrote:
>>
>> Since commit ab78029ecc34 (drivers/pinctrl: grab default handles from device
>> core), we can rely on device core for setting the default pins.
>>
>> Signed-off-by: Wolfram Sang 
>> ---
>>  drivers/net/ieee802154/cc2520.c | 7 ---
>>  1 file changed, 7 deletions(-)
>>
>> diff --git a/drivers/net/ieee802154/cc2520.c 
>> b/drivers/net/ieee802154/cc2520.c
>> index c2b7da3da183..033473448d9f 100644
>> --- a/drivers/net/ieee802154/cc2520.c
>> +++ b/drivers/net/ieee802154/cc2520.c
>> @@ -19,7 +19,6 @@
>>  #include 
>>  #include 
>>  #include 
>> -#include 
>>  #include 
>>  #include 
>>
>> @@ -841,7 +840,6 @@ done:
>>  static int cc2520_probe(struct spi_device *spi)
>>  {
>> struct cc2520_private *priv;
>> -   struct pinctrl *pinctrl;
>> struct cc2520_platform_data *pdata;
>> int ret;
>>
>> @@ -854,11 +852,6 @@ static int cc2520_probe(struct spi_device *spi)
>>
>> spi_set_drvdata(spi, priv);
>>
>> -   pinctrl = devm_pinctrl_get_select_default(>dev);
>> -   if (IS_ERR(pinctrl))
>> -   dev_warn(>dev,
>> -    "pinctrl pins are not configured\n");
>> -
>> pdata = cc2520_get_platform_data(spi);
>> if (!pdata) {
>> dev_err(>dev, "no platform data\n");
>> --
>> 2.1.3
>>
>
>
>
> --
> Thanks and Regards,
> Varka Bhadram.




-- 
Thanks and Regards,
Varka Bhadram.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCHv5 3/9] devfreq: event: Add exynos-ppmu devfreq-event driver

2014-12-22 Thread Varka Bhadram
On Tue, Dec 23, 2014 at 8:48 AM, Chanwoo Choi cw00.c...@samsung.com wrote:
 This patch adds exynos-ppmu devfreq-event driver to get performance data
 of each IP for Samsung Exynos SoC. These event from Exynos PPMU provide
 useful information about the behavior of the SoC that you can use when
 analyzing system performance, and made visible and can be counted using
 logic in each IP.

 This patch is based on existing drivers/devfreq/exynos/exynos-ppmu.c

 Cc: MyungJoo Ham myungjoo@samsung.com
 Cc: Kyungmin Park kyungmin.p...@samsung.com
 Signed-off-by: Chanwoo Choi cw00.c...@samsung.com

(...)
 +static int exynos_ppmu_parse_dt(struct exynos_ppmu_data *data)
 +{
 +   struct device *dev = data-dev;
 +   struct device_node *np = dev-of_node;
 +   int ret = 0;
 +
 +   if (!np) {
 +   dev_err(dev, failed to find devicetree node\n);
 +   return -EINVAL;
 +   }
 +
 +   /* Maps the memory mapped IO to control PPMU register */
 +   data-ppmu.base = of_iomap(np, 0);
 +   if (IS_ERR_OR_NULL(data-ppmu.base)) {
 +   dev_err(dev, failed to map memory region\n);
 +   return -EINVAL;
-ENOMEM or -ENXIO is the proper error return value..?

 +   }
 +
 +   data-clk_ppmu = devm_clk_get(dev, ppmu);
 +   if (IS_ERR(data-clk_ppmu)) {
 +   data-clk_ppmu = NULL;
 +   dev_warn(dev, failed to get PPMU clock\n);
 +   }
If PPMU clk get fails..?  return PTR_ERR(data-clk_ppmu)
 +
 +   ret = of_get_devfreq_events(np, data);
 +   if (ret  0) {
 +   dev_err(dev, failed to parse exynos ppmu dt node\n);
 +   goto err;
 +   }
 +
 +   return 0;
 +
 +err:
 +   iounmap(data-ppmu.base);
 +
 +   return ret;
 +}
 +
 +static int exynos_ppmu_probe(struct platform_device *pdev)
 +{
 +   struct exynos_ppmu_data *data;
 +   struct devfreq_event_dev **edev;
 +   struct devfreq_event_desc *desc;
 +   int i, ret = 0, size;
 +
 +   data = devm_kzalloc(pdev-dev, sizeof(*data), GFP_KERNEL);
 +   if (!data)
 +   return -ENOMEM;
 +
 +   mutex_init(data-lock);
 +   data-dev = pdev-dev;
 +
 +   /* Parse dt data to get resource */
 +   ret = exynos_ppmu_parse_dt(data);
 +   if (ret  0) {
 +   dev_err(pdev-dev,
 +   failed to parse devicetree for resource\n);
 +   return ret;
 +   }
 +   desc = data-desc;
 +
 +   size = sizeof(struct devfreq_event_dev *) * data-num_events;
 +   data-edev = devm_kzalloc(pdev-dev, size, GFP_KERNEL);
 +   if (!data-edev) {
 +   dev_err(pdev-dev,
 +   failed to allocate memory devfreq-event devices\n);
 +   return -ENOMEM;
 +   }
 +   edev = data-edev;
 +   platform_set_drvdata(pdev, data);
 +
 +   for (i = 0; i  data-num_events; i++) {
 +   edev[i] = devfreq_event_add_edev(pdev-dev, desc[i]);
 +   if (IS_ERR(edev)) {
 +   ret = PTR_ERR(edev);
 +   dev_err(pdev-dev,
 +   failed to add devfreq-event device\n);
 +   goto err;
 +   }
 +   }
 +
 +   clk_prepare_enable(data-clk_ppmu);
 +
 +   return 0;
 +err:
 +   iounmap(data-ppmu.base);
 +
 +   return ret;
 +}
 +
 +static int exynos_ppmu_remove(struct platform_device *pdev)
 +{
 +   struct exynos_ppmu_data *data = platform_get_drvdata(pdev);
 +   int i, ret = 0;
 +
 +   for (i = 0; i  data-num_events; i++) {
 +   ret = devfreq_event_remove_edev(data-edev[i]);
 +   if (ret  0) {
 +   dev_err(pdev-dev,
 +   failed to remove devfreq-event device\n);
 +   goto err;
 +   }
 +   }
 +
 +err:
 +   clk_disable_unprepare(data-clk_ppmu);
 +   iounmap(data-ppmu.base);
 +
 +   return ret;
 +}
 +
 +static struct of_device_id exynos_ppmu_id_match[] = {
 +   { .compatible = samsung,exynos-ppmu, },
 +   { /* sentinel */ },
 +};
 +
 +static struct platform_driver exynos_ppmu_driver = {
 +   .probe  = exynos_ppmu_probe,
 +   .remove = exynos_ppmu_remove,
 +   .driver = {
 +   .name   = exynos-ppmu,
 +   .owner  = THIS_MODULE,
remove owner field. It will be populate by driver core.
 +   .of_match_table = exynos_ppmu_id_match,
 +   },
 +};
 +module_platform_driver(exynos_ppmu_driver);
 +
 +MODULE_DESCRIPTION(Exynos PPMU(Platform Performance Monitoring Unit) 
 driver);
 +MODULE_AUTHOR(Chanwoo Choi cw00.c...@samsung.com);
 +MODULE_LICENSE(GPL);
 +MODULE_ALIAS(platform:exynos-ppmu);
 --
 1.8.5.5

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



-- 
Thanks and Regards,
Varka Bhadram

Re: [PATCH 3/3] net: ieee802154: don't use devm_pinctrl_get_select_default() in probe

2014-12-22 Thread Varka Bhadram
Thanks for the patch.

Acked-by: Varka Bhadram varkabhad...@gmail.com

On Tue, Dec 23, 2014 at 5:40 AM, Varka Bhadram varkabhad...@gmail.com wrote:

 Thanks for the patch.

 Acked-by: Varka Bhadram varkabhad...@gmail.com

 On Tue, Dec 23, 2014 at 3:46 AM, Wolfram Sang w...@the-dreams.de wrote:

 Since commit ab78029ecc34 (drivers/pinctrl: grab default handles from device
 core), we can rely on device core for setting the default pins.

 Signed-off-by: Wolfram Sang w...@the-dreams.de
 ---
  drivers/net/ieee802154/cc2520.c | 7 ---
  1 file changed, 7 deletions(-)

 diff --git a/drivers/net/ieee802154/cc2520.c 
 b/drivers/net/ieee802154/cc2520.c
 index c2b7da3da183..033473448d9f 100644
 --- a/drivers/net/ieee802154/cc2520.c
 +++ b/drivers/net/ieee802154/cc2520.c
 @@ -19,7 +19,6 @@
  #include linux/workqueue.h
  #include linux/interrupt.h
  #include linux/skbuff.h
 -#include linux/pinctrl/consumer.h
  #include linux/of_gpio.h
  #include linux/ieee802154.h

 @@ -841,7 +840,6 @@ done:
  static int cc2520_probe(struct spi_device *spi)
  {
 struct cc2520_private *priv;
 -   struct pinctrl *pinctrl;
 struct cc2520_platform_data *pdata;
 int ret;

 @@ -854,11 +852,6 @@ static int cc2520_probe(struct spi_device *spi)

 spi_set_drvdata(spi, priv);

 -   pinctrl = devm_pinctrl_get_select_default(spi-dev);
 -   if (IS_ERR(pinctrl))
 -   dev_warn(spi-dev,
 -pinctrl pins are not configured\n);
 -
 pdata = cc2520_get_platform_data(spi);
 if (!pdata) {
 dev_err(spi-dev, no platform data\n);
 --
 2.1.3




 --
 Thanks and Regards,
 Varka Bhadram.




-- 
Thanks and Regards,
Varka Bhadram.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v5 2/3] i2c: add support for Cypress CYUSBS234 USB-I2C adapter

2014-12-13 Thread Varka Bhadram
lue = scb_index | cy_i2c->is_stop_bit | cy_i2c->is_nak_bit << 1;
+   wValue |= (slave_addr << 8);
+   wIndex = length;
+
+   dev_dbg(_i2c->i2c_adapter.dev,
+   "%s, cmd=0x%x, val=0x%x, idx=0x%x\n",
+   __func__, command, wValue, wIndex);
+
+   ret = usb_control_msg(cyusbs->usb_dev,
+   usb_sndctrlpipe(cyusbs->usb_dev, 0),
+   command, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT,
+   wValue, wIndex, NULL, 0, CY_USBS_CTRL_XFER_TIMEOUT);
+
+   return ret;
+}
+
+static int cy_i2c_read(struct i2c_adapter *adapter, struct i2c_msg *msgs)
+{
+   int ret;
+   int actual_read_len = 0;
+   struct cyusbs23x *cyusbs = (struct cyusbs23x *)adapter->algo_data;
+
+   dev_dbg(>dev, "%s\n", __func__);
+
+   ret = usb_bulk_msg(cyusbs->usb_dev,
+   usb_rcvbulkpipe(cyusbs->usb_dev, cyusbs->bulk_in_ep_num),
+   msgs[0].buf,
+   msgs[0].len,
+   _read_len, CY_USBS_BULK_XFER_TIMEOUT);
+   if (ret)
+   dev_err(>dev,
+   "read %d/%d returned %d\n",
+   actual_read_len, msgs[0].len, ret);
+
+   ret = cy_i2c_recv_status(adapter);
+
+   return ret;
+}
+
+static int cy_i2c_write(struct i2c_adapter *adapter, struct i2c_msg *msgs)
+{
+   int ret;
+   int actual_write_len = 0;
+   struct cyusbs23x *cyusbs = (struct cyusbs23x *)adapter->algo_data;
+
+   dev_dbg(>dev, "%s\n", __func__);
+
+   ret = usb_bulk_msg(cyusbs->usb_dev,
+   usb_sndbulkpipe(cyusbs->usb_dev, cyusbs->bulk_out_ep_num),
+   msgs[0].buf,
+   msgs[0].len,
+   _write_len, CY_USBS_BULK_XFER_TIMEOUT);
+   if (ret)
+   dev_err(>dev,
+   "write %d/%d returned %d\n",
+   actual_write_len, msgs[0].len, ret);
+
+   ret = cy_i2c_recv_status(adapter);
+
+   return ret;
+}
+
+static int cy_i2c_xfer(struct i2c_adapter *adapter,
+  struct i2c_msg *msgs, int num)
+{
+   int ret = 0;
+   struct cyusbs_i2c *cy_i2c;
+   struct cyusbs23x *cyusbs = (struct cyusbs23x *)adapter->algo_data;
+
+   dev_dbg(>dev, "%s\n", __func__);
+
+   if (num > 1) {
+   dev_err(>dev, "i2c_msg number is > 1\n");
+   return -EIO;
+   }
+
+   cy_i2c = to_cyusbs_i2c(adapter);
+
+   mutex_lock(_i2c->lock);
+   if (msgs[0].flags & I2C_M_RD) {
+   dev_dbg(>dev,
+   "I2C read requested for addr 0x%02x, data length %d\n",
+   msgs[0].addr, msgs[0].len);
+
+   ret = cy_i2c_set_data_config(cyusbs, cy_i2c, msgs[0].addr,
+   msgs[0].len, CY_I2C_READ_CMD);
+   if (ret < 0) {
+   dev_err(>dev,
+   "Set Config (read) failed with %d\n", ret);
+   goto io_error;
+   }
+
+   ret = cy_i2c_read(adapter, msgs);
+   if (ret) {
+   dev_err(>dev,
+   "Read failed with error code %d\n", ret);
+   goto io_error;
+   }
+   } else {
+   dev_dbg(>dev,
+   "I2C write requested for addr 0x%02x, data length %d\n",
+   msgs[0].addr, msgs[0].len);
+
+   ret = cy_i2c_set_data_config(cyusbs, cy_i2c, msgs[0].addr,
+   msgs[0].len, CY_I2C_WRITE_CMD);
+   if (ret < 0) {
+   dev_err(>dev,
+   "Set Config (write) failed with %d\n", ret);
+   goto io_error;
+   }
+
+   ret = cy_i2c_write(adapter, msgs);
+   if (ret) {
+   dev_err(>dev,
+   "Write failed with error code %d\n", ret);
+   goto io_error;
+   }
+   }
+   mutex_unlock(_i2c->lock);
+   return ret;
+
+io_error:
+   mutex_unlock(_i2c->lock);
+   return ret;
+}
+
+static u32 cy_i2c_func(struct i2c_adapter *adapter)
+{
+   return I2C_FUNC_I2C;
+}
+
+static const struct i2c_algorithm i2c_cyusbs23x_algorithm = {
+   .master_xfer= cy_i2c_xfer,
+   .functionality  = cy_i2c_func,
+};
+
+static int cyusbs23x_i2c_probe(struct platform_device *pdev)
+{
+   struct cyusbs23x *cyusbs;
+   struct cyusbs_i2c *cy_i2c;
+   int ret = 0;
+
+   dev_dbg(>dev, "%s\n", __func__);
+
+   cyusbs = dev_get_drvdata(pdev->dev.parent);
+
+   cy_i2c = devm_kzalloc(>dev, sizeof(*cy_i2c), GFP_KERNEL);
+   if (cy_i2c == NULL)
+   return -ENOMEM;
+


dto...


+   cy_i2c->i2c_config = devm_kzalloc(>dev,
+   sizeof(struct cyusbs_i2c_config),
+   GFP_KERNEL);
+   if (cy_i2c->i2c_config == NULL)
+   return -ENOMEM;
+


dto...

--
Thanks and Regards,
Varka Bhadram.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v5 3/3] gpio: add support for Cypress CYUSBS234 USB-GPIO adapter

2014-12-13 Thread Varka Bhadram
et = usb_control_msg(cyusbs->usb_dev,
+   usb_sndctrlpipe(cyusbs->usb_dev, 0),
+   CY_DEV_ENABLE_CONFIG_READ_CMD,
+   USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT,
+   CY_USBS_READ_CONFIG, CY_USBS_DISABLE_READ, NULL, 0,
+   CY_USBS_CTRL_XFER_TIMEOUT);
+   if (ret) {
+   dev_err(>usb_dev->dev,
+   "%s: disable config read status %d\n", __func__, ret);
+   return -ENODEV;
+   }
+
+   return 0;
+}
+
+static int cy_gpio_retrieve_gpio_details(struct cyusbs_gpio *gpio)
+{
+   int ret;
+   u32 drive0, drive1;
+   u8 *buf;
+   struct cyusbs23x *cyusbs = gpio->cyusbs;
+
+   buf = kzalloc(CY_DEVICE_CONFIG_SIZE, GFP_KERNEL);
+   if (buf == NULL)
+   return -ENOMEM;
+


Using '!' operator is preferred!
if(!buf)
return -ENOMEM;


+   ret = cy_get_device_config(cyusbs, buf);
+   if (ret) {
+   dev_err(>usb_dev->dev,
+   "could not retrieve device configuration\n");
+   goto error;
+   }
+
+   /* Retrieve the GPIO configuration details */
+   drive0 = le32_to_cpu(*((u32 *)[CY_CFG_DRIVE0_GPIO_OFFSET]));
+   drive1 = le32_to_cpu(*((u32 *)[CY_CFG_DRIVE1_GPIO_OFFSET]));
+   gpio->out_gpio = drive0 | drive1;
+   gpio->out_value = drive1;
+   gpio->in_gpio = le32_to_cpu(*((u32 *)[CY_CFG_INPUT_GPIO_OFFSET]));
+
+error:
+   kfree(buf);
+   return ret;
+}
+
+static int cyusbs23x_gpio_probe(struct platform_device *pdev)
+{
+   struct cyusbs23x *cyusbs;
+   struct cyusbs_gpio *cy_gpio;
+   int ret = 0;
+
+   dev_dbg(>dev, "%s\n", __func__);
+
+   cyusbs = dev_get_drvdata(pdev->dev.parent);
+
+   cy_gpio = devm_kzalloc(>dev, sizeof(*cy_gpio), GFP_KERNEL);
+   if (cy_gpio == NULL)
+   return -ENOMEM;
+


Using '!' operator is preferred!
if(!cy_gpio)
return -ENOMEM;


+   cy_gpio->cyusbs = cyusbs;
+   /* retrieve GPIO configuration info */
+   ret = cy_gpio_retrieve_gpio_details(cy_gpio);
+   if (ret) {
+   dev_err(>dev, "could not retrieve gpio details\n");
+   return -ENODEV;
+   }
+
+   /* registering gpio */
+   cy_gpio->gpio.label = dev_name(>dev);
+   cy_gpio->gpio.dev = >dev;
+   cy_gpio->gpio.owner = THIS_MODULE;
+   cy_gpio->gpio.base = -1;
+   cy_gpio->gpio.ngpio = CYUSBS234_GPIO_NUM;
+   cy_gpio->gpio.can_sleep = true;
+   cy_gpio->gpio.request = cy_gpio_request;
+   cy_gpio->gpio.set = cy_gpio_set;
+   cy_gpio->gpio.get = cy_gpio_get;
+   cy_gpio->gpio.get_direction = cy_gpio_get_direction;


One line space...

--
Thanks and Regards,
Varka Bhadram.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v5 3/3] gpio: add support for Cypress CYUSBS234 USB-GPIO adapter

2014-12-13 Thread Varka Bhadram
,
+   USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT,
+   CY_USBS_READ_CONFIG, CY_USBS_DISABLE_READ, NULL, 0,
+   CY_USBS_CTRL_XFER_TIMEOUT);
+   if (ret) {
+   dev_err(cyusbs-usb_dev-dev,
+   %s: disable config read status %d\n, __func__, ret);
+   return -ENODEV;
+   }
+
+   return 0;
+}
+
+static int cy_gpio_retrieve_gpio_details(struct cyusbs_gpio *gpio)
+{
+   int ret;
+   u32 drive0, drive1;
+   u8 *buf;
+   struct cyusbs23x *cyusbs = gpio-cyusbs;
+
+   buf = kzalloc(CY_DEVICE_CONFIG_SIZE, GFP_KERNEL);
+   if (buf == NULL)
+   return -ENOMEM;
+


Using '!' operator is preferred!
if(!buf)
return -ENOMEM;


+   ret = cy_get_device_config(cyusbs, buf);
+   if (ret) {
+   dev_err(cyusbs-usb_dev-dev,
+   could not retrieve device configuration\n);
+   goto error;
+   }
+
+   /* Retrieve the GPIO configuration details */
+   drive0 = le32_to_cpu(*((u32 *)buf[CY_CFG_DRIVE0_GPIO_OFFSET]));
+   drive1 = le32_to_cpu(*((u32 *)buf[CY_CFG_DRIVE1_GPIO_OFFSET]));
+   gpio-out_gpio = drive0 | drive1;
+   gpio-out_value = drive1;
+   gpio-in_gpio = le32_to_cpu(*((u32 *)buf[CY_CFG_INPUT_GPIO_OFFSET]));
+
+error:
+   kfree(buf);
+   return ret;
+}
+
+static int cyusbs23x_gpio_probe(struct platform_device *pdev)
+{
+   struct cyusbs23x *cyusbs;
+   struct cyusbs_gpio *cy_gpio;
+   int ret = 0;
+
+   dev_dbg(pdev-dev, %s\n, __func__);
+
+   cyusbs = dev_get_drvdata(pdev-dev.parent);
+
+   cy_gpio = devm_kzalloc(pdev-dev, sizeof(*cy_gpio), GFP_KERNEL);
+   if (cy_gpio == NULL)
+   return -ENOMEM;
+


Using '!' operator is preferred!
if(!cy_gpio)
return -ENOMEM;


+   cy_gpio-cyusbs = cyusbs;
+   /* retrieve GPIO configuration info */
+   ret = cy_gpio_retrieve_gpio_details(cy_gpio);
+   if (ret) {
+   dev_err(pdev-dev, could not retrieve gpio details\n);
+   return -ENODEV;
+   }
+
+   /* registering gpio */
+   cy_gpio-gpio.label = dev_name(pdev-dev);
+   cy_gpio-gpio.dev = pdev-dev;
+   cy_gpio-gpio.owner = THIS_MODULE;
+   cy_gpio-gpio.base = -1;
+   cy_gpio-gpio.ngpio = CYUSBS234_GPIO_NUM;
+   cy_gpio-gpio.can_sleep = true;
+   cy_gpio-gpio.request = cy_gpio_request;
+   cy_gpio-gpio.set = cy_gpio_set;
+   cy_gpio-gpio.get = cy_gpio_get;
+   cy_gpio-gpio.get_direction = cy_gpio_get_direction;


One line space...

--
Thanks and Regards,
Varka Bhadram.

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


Re: [PATCH v5 2/3] i2c: add support for Cypress CYUSBS234 USB-I2C adapter

2014-12-13 Thread Varka Bhadram
-i2c_adapter.dev,
+   %s, cmd=0x%x, val=0x%x, idx=0x%x\n,
+   __func__, command, wValue, wIndex);
+
+   ret = usb_control_msg(cyusbs-usb_dev,
+   usb_sndctrlpipe(cyusbs-usb_dev, 0),
+   command, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT,
+   wValue, wIndex, NULL, 0, CY_USBS_CTRL_XFER_TIMEOUT);
+
+   return ret;
+}
+
+static int cy_i2c_read(struct i2c_adapter *adapter, struct i2c_msg *msgs)
+{
+   int ret;
+   int actual_read_len = 0;
+   struct cyusbs23x *cyusbs = (struct cyusbs23x *)adapter-algo_data;
+
+   dev_dbg(adapter-dev, %s\n, __func__);
+
+   ret = usb_bulk_msg(cyusbs-usb_dev,
+   usb_rcvbulkpipe(cyusbs-usb_dev, cyusbs-bulk_in_ep_num),
+   msgs[0].buf,
+   msgs[0].len,
+   actual_read_len, CY_USBS_BULK_XFER_TIMEOUT);
+   if (ret)
+   dev_err(adapter-dev,
+   read %d/%d returned %d\n,
+   actual_read_len, msgs[0].len, ret);
+
+   ret = cy_i2c_recv_status(adapter);
+
+   return ret;
+}
+
+static int cy_i2c_write(struct i2c_adapter *adapter, struct i2c_msg *msgs)
+{
+   int ret;
+   int actual_write_len = 0;
+   struct cyusbs23x *cyusbs = (struct cyusbs23x *)adapter-algo_data;
+
+   dev_dbg(adapter-dev, %s\n, __func__);
+
+   ret = usb_bulk_msg(cyusbs-usb_dev,
+   usb_sndbulkpipe(cyusbs-usb_dev, cyusbs-bulk_out_ep_num),
+   msgs[0].buf,
+   msgs[0].len,
+   actual_write_len, CY_USBS_BULK_XFER_TIMEOUT);
+   if (ret)
+   dev_err(adapter-dev,
+   write %d/%d returned %d\n,
+   actual_write_len, msgs[0].len, ret);
+
+   ret = cy_i2c_recv_status(adapter);
+
+   return ret;
+}
+
+static int cy_i2c_xfer(struct i2c_adapter *adapter,
+  struct i2c_msg *msgs, int num)
+{
+   int ret = 0;
+   struct cyusbs_i2c *cy_i2c;
+   struct cyusbs23x *cyusbs = (struct cyusbs23x *)adapter-algo_data;
+
+   dev_dbg(adapter-dev, %s\n, __func__);
+
+   if (num  1) {
+   dev_err(adapter-dev, i2c_msg number is  1\n);
+   return -EIO;
+   }
+
+   cy_i2c = to_cyusbs_i2c(adapter);
+
+   mutex_lock(cy_i2c-lock);
+   if (msgs[0].flags  I2C_M_RD) {
+   dev_dbg(adapter-dev,
+   I2C read requested for addr 0x%02x, data length %d\n,
+   msgs[0].addr, msgs[0].len);
+
+   ret = cy_i2c_set_data_config(cyusbs, cy_i2c, msgs[0].addr,
+   msgs[0].len, CY_I2C_READ_CMD);
+   if (ret  0) {
+   dev_err(adapter-dev,
+   Set Config (read) failed with %d\n, ret);
+   goto io_error;
+   }
+
+   ret = cy_i2c_read(adapter, msgs);
+   if (ret) {
+   dev_err(adapter-dev,
+   Read failed with error code %d\n, ret);
+   goto io_error;
+   }
+   } else {
+   dev_dbg(adapter-dev,
+   I2C write requested for addr 0x%02x, data length %d\n,
+   msgs[0].addr, msgs[0].len);
+
+   ret = cy_i2c_set_data_config(cyusbs, cy_i2c, msgs[0].addr,
+   msgs[0].len, CY_I2C_WRITE_CMD);
+   if (ret  0) {
+   dev_err(adapter-dev,
+   Set Config (write) failed with %d\n, ret);
+   goto io_error;
+   }
+
+   ret = cy_i2c_write(adapter, msgs);
+   if (ret) {
+   dev_err(adapter-dev,
+   Write failed with error code %d\n, ret);
+   goto io_error;
+   }
+   }
+   mutex_unlock(cy_i2c-lock);
+   return ret;
+
+io_error:
+   mutex_unlock(cy_i2c-lock);
+   return ret;
+}
+
+static u32 cy_i2c_func(struct i2c_adapter *adapter)
+{
+   return I2C_FUNC_I2C;
+}
+
+static const struct i2c_algorithm i2c_cyusbs23x_algorithm = {
+   .master_xfer= cy_i2c_xfer,
+   .functionality  = cy_i2c_func,
+};
+
+static int cyusbs23x_i2c_probe(struct platform_device *pdev)
+{
+   struct cyusbs23x *cyusbs;
+   struct cyusbs_i2c *cy_i2c;
+   int ret = 0;
+
+   dev_dbg(pdev-dev, %s\n, __func__);
+
+   cyusbs = dev_get_drvdata(pdev-dev.parent);
+
+   cy_i2c = devm_kzalloc(pdev-dev, sizeof(*cy_i2c), GFP_KERNEL);
+   if (cy_i2c == NULL)
+   return -ENOMEM;
+


dto...


+   cy_i2c-i2c_config = devm_kzalloc(pdev-dev,
+   sizeof(struct cyusbs_i2c_config),
+   GFP_KERNEL);
+   if (cy_i2c-i2c_config == NULL)
+   return -ENOMEM;
+


dto...

--
Thanks and Regards,
Varka Bhadram

Re: [PATCH 2/4] i2c: iproc: Add Broadcom iProc I2C Driver

2014-12-09 Thread Varka Bhadram
atic void bcm_iproc_i2c_enable(struct bcm_iproc_i2c_dev *dev)
+{
+   u32 val;
+
+   val = readl(dev->base + CFG_OFFSET);
+   val |= 1 << CFG_EN_SHIFT;
+   writel(val, dev->base + CFG_OFFSET);
+}
+
+static void bcm_iproc_i2c_disable(struct bcm_iproc_i2c_dev *dev)
+{
+   u32 val;
+
+   val = readl(dev->base + CFG_OFFSET);
+   val &= ~(1 << CFG_EN_SHIFT);
+   writel(val, dev->base + CFG_OFFSET);
+}
+
+static int bcm_iproc_i2c_probe(struct platform_device *pdev)
+{
+   int irq, ret = 0;
+   struct bcm_iproc_i2c_dev *dev;
+   struct i2c_adapter *adap;
+   struct resource *res;
+
+   dev = devm_kzalloc(>dev, sizeof(*dev), GFP_KERNEL);
+   if (!dev)
+   return -ENOMEM;
+
+   platform_set_drvdata(pdev, dev);
+   dev->device = >dev;
+   init_completion(>done);
+
+   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+   if (!res)
+   return -ENODEV;


We can remove this resource check. This checking will happen with 
devm_ioremap_resource()


+   dev->base = devm_ioremap_resource(dev->device, res);
+   if (IS_ERR(dev->base))
+   return -ENOMEM;
+
+   ret = bcm_iproc_i2c_init(dev);
+   if (ret)
+   return ret;
+
+   ret = bcm_iproc_i2c_cfg_speed(dev);
+   if (ret)
+   return ret;
+
+   irq = platform_get_irq(pdev, 0);
+   if (irq < 0) {
+   dev_err(dev->device, "no irq resource\n");
+   return irq;
+   }
+
+   ret = devm_request_irq(>dev, irq, bcm_iproc_i2c_isr,
+   IRQF_SHARED, pdev->name, dev);
+   if (ret) {
+   dev_err(dev->device, "unable to request irq %i\n", irq);
+   return ret;
+   }
+
+   bcm_iproc_i2c_enable(dev);
+
+   adap = >adapter;
+   i2c_set_adapdata(adap, dev);
+   strlcpy(adap->name, "Broadcom iProc I2C adapter", sizeof(adap->name));
+   adap->algo = _iproc_algo;
+   adap->dev.parent = >dev;
+   adap->dev.of_node = pdev->dev.of_node;
+
+   ret = i2c_add_adapter(adap);
+   if (ret) {
+   dev_err(dev->device, "failed to add adapter\n");
+   return ret;
+   }
+
+   dev_info(dev->device, "device registered successfully\n");
+
+   return 0;
+}
+
+static int bcm_iproc_i2c_remove(struct platform_device *pdev)
+{
+   struct bcm_iproc_i2c_dev *dev = platform_get_drvdata(pdev);
+
+   i2c_del_adapter(>adapter);
+   bcm_iproc_i2c_disable(dev);
+
+   return 0;
+}
+
+static const struct of_device_id bcm_iproc_i2c_of_match[] = {
+   {.compatible = "brcm,iproc-i2c",},
+   {},
+};
+MODULE_DEVICE_TABLE(of, bcm_iproc_i2c_of_match);
+
+static struct platform_driver bcm_iproc_i2c_driver = {
+   .driver = {
+  .name = "bcm-iproc-i2c",
+  .owner = THIS_MODULE,


No need to update this field. Its updated by module_platform_driver().


+  .of_match_table = bcm_iproc_i2c_of_match,
+  },
+   .probe = bcm_iproc_i2c_probe,
+   .remove = bcm_iproc_i2c_remove,
+};
+module_platform_driver(bcm_iproc_i2c_driver);
+
+MODULE_AUTHOR("Ray Jui ");
+MODULE_DESCRIPTION("Broadcom iProc I2C Driver");
+MODULE_LICENSE("GPL v2");


--
Thanks and Regards,
Varka Bhadram.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/4] i2c: iProc: define Broadcom iProc I2C binding

2014-12-09 Thread Varka Bhadram

Hi,

On Wednesday 10 December 2014 06:24 AM, Ray Jui wrote:

Document the I2C device tree binding for Broadcom iProc family of
SoCs

Signed-off-by: Ray Jui 
Reviewed-by: Scott Branden 
---
  .../devicetree/bindings/i2c/brcm,iproc-i2c.txt |   37 
  1 file changed, 37 insertions(+)
  create mode 100644 Documentation/devicetree/bindings/i2c/brcm,iproc-i2c.txt

diff --git a/Documentation/devicetree/bindings/i2c/brcm,iproc-i2c.txt 
b/Documentation/devicetree/bindings/i2c/brcm,iproc-i2c.txt
new file mode 100644
index 000..81f982c
--- /dev/null
+++ b/Documentation/devicetree/bindings/i2c/brcm,iproc-i2c.txt
@@ -0,0 +1,37 @@
+Broadcom iProc I2C controller
+
+Required properties:
+
+- compatible:
+Must be "brcm,iproc-i2c"
+
+- reg:
+Define the base and range of the I/O address space that contain the iProc
+I2C controller registers
+
+- interrupts:
+Should contain the I2C interrupt
+
+- clock-frequency:
+This is the I2C bus clock. Need to be either 10 or 40
+
+- #address-cells:
+Always 1 (for I2C addresses)
+
+- #size-cells:
+Always 0
+


All the properties defined with two lines of statements.

Why cant they be with single line statement, like:

compatible: Must be "brcm,iproc-i2c"
reg:Define the base and range of the I/O address space that
contain the iProc I2C controller registers




--
Thanks and Regards,
Varka Bhadram.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/4] i2c: iProc: define Broadcom iProc I2C binding

2014-12-09 Thread Varka Bhadram

Hi,

On Wednesday 10 December 2014 06:24 AM, Ray Jui wrote:

Document the I2C device tree binding for Broadcom iProc family of
SoCs

Signed-off-by: Ray Jui r...@broadcom.com
Reviewed-by: Scott Branden sbran...@broadcom.com
---
  .../devicetree/bindings/i2c/brcm,iproc-i2c.txt |   37 
  1 file changed, 37 insertions(+)
  create mode 100644 Documentation/devicetree/bindings/i2c/brcm,iproc-i2c.txt

diff --git a/Documentation/devicetree/bindings/i2c/brcm,iproc-i2c.txt 
b/Documentation/devicetree/bindings/i2c/brcm,iproc-i2c.txt
new file mode 100644
index 000..81f982c
--- /dev/null
+++ b/Documentation/devicetree/bindings/i2c/brcm,iproc-i2c.txt
@@ -0,0 +1,37 @@
+Broadcom iProc I2C controller
+
+Required properties:
+
+- compatible:
+Must be brcm,iproc-i2c
+
+- reg:
+Define the base and range of the I/O address space that contain the iProc
+I2C controller registers
+
+- interrupts:
+Should contain the I2C interrupt
+
+- clock-frequency:
+This is the I2C bus clock. Need to be either 10 or 40
+
+- #address-cells:
+Always 1 (for I2C addresses)
+
+- #size-cells:
+Always 0
+


All the properties defined with two lines of statements.

Why cant they be with single line statement, like:

compatible: Must be brcm,iproc-i2c
reg:Define the base and range of the I/O address space that
contain the iProc I2C controller registers




--
Thanks and Regards,
Varka Bhadram.

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


Re: [PATCH 2/4] i2c: iproc: Add Broadcom iProc I2C Driver

2014-12-09 Thread Varka Bhadram
 *res;
+
+   dev = devm_kzalloc(pdev-dev, sizeof(*dev), GFP_KERNEL);
+   if (!dev)
+   return -ENOMEM;
+
+   platform_set_drvdata(pdev, dev);
+   dev-device = pdev-dev;
+   init_completion(dev-done);
+
+   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+   if (!res)
+   return -ENODEV;


We can remove this resource check. This checking will happen with 
devm_ioremap_resource()


+   dev-base = devm_ioremap_resource(dev-device, res);
+   if (IS_ERR(dev-base))
+   return -ENOMEM;
+
+   ret = bcm_iproc_i2c_init(dev);
+   if (ret)
+   return ret;
+
+   ret = bcm_iproc_i2c_cfg_speed(dev);
+   if (ret)
+   return ret;
+
+   irq = platform_get_irq(pdev, 0);
+   if (irq  0) {
+   dev_err(dev-device, no irq resource\n);
+   return irq;
+   }
+
+   ret = devm_request_irq(pdev-dev, irq, bcm_iproc_i2c_isr,
+   IRQF_SHARED, pdev-name, dev);
+   if (ret) {
+   dev_err(dev-device, unable to request irq %i\n, irq);
+   return ret;
+   }
+
+   bcm_iproc_i2c_enable(dev);
+
+   adap = dev-adapter;
+   i2c_set_adapdata(adap, dev);
+   strlcpy(adap-name, Broadcom iProc I2C adapter, sizeof(adap-name));
+   adap-algo = bcm_iproc_algo;
+   adap-dev.parent = pdev-dev;
+   adap-dev.of_node = pdev-dev.of_node;
+
+   ret = i2c_add_adapter(adap);
+   if (ret) {
+   dev_err(dev-device, failed to add adapter\n);
+   return ret;
+   }
+
+   dev_info(dev-device, device registered successfully\n);
+
+   return 0;
+}
+
+static int bcm_iproc_i2c_remove(struct platform_device *pdev)
+{
+   struct bcm_iproc_i2c_dev *dev = platform_get_drvdata(pdev);
+
+   i2c_del_adapter(dev-adapter);
+   bcm_iproc_i2c_disable(dev);
+
+   return 0;
+}
+
+static const struct of_device_id bcm_iproc_i2c_of_match[] = {
+   {.compatible = brcm,iproc-i2c,},
+   {},
+};
+MODULE_DEVICE_TABLE(of, bcm_iproc_i2c_of_match);
+
+static struct platform_driver bcm_iproc_i2c_driver = {
+   .driver = {
+  .name = bcm-iproc-i2c,
+  .owner = THIS_MODULE,


No need to update this field. Its updated by module_platform_driver().


+  .of_match_table = bcm_iproc_i2c_of_match,
+  },
+   .probe = bcm_iproc_i2c_probe,
+   .remove = bcm_iproc_i2c_remove,
+};
+module_platform_driver(bcm_iproc_i2c_driver);
+
+MODULE_AUTHOR(Ray Jui r...@broadcom.com);
+MODULE_DESCRIPTION(Broadcom iProc I2C Driver);
+MODULE_LICENSE(GPL v2);


--
Thanks and Regards,
Varka Bhadram.

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


Re: [PATCH] mtd: remove .owner field for driver using module_platform_driver

2014-11-11 Thread Varka Bhadram

Hi Sanjeev Sharma,

On 11/11/2014 03:57 PM, Sanjeev Sharma wrote:

This patch removes the .owner field for drivers which use the
platform_driver_register api because this is overriden in
_platform_driver_register.

Signed-off-by: Sanjeev Sharma 
---
  drivers/mtd/nand/ams-delta.c | 1 -
  drivers/mtd/nand/atmel_nand.c| 2 --
  drivers/mtd/nand/au1550nd.c  | 1 -
  drivers/mtd/nand/bf5xx_nand.c| 1 -
  drivers/mtd/nand/davinci_nand.c  | 1 -
  drivers/mtd/nand/denali_dt.c | 1 -
  drivers/mtd/nand/docg4.c | 1 -
  drivers/mtd/nand/fsl_elbc_nand.c | 1 -
  drivers/mtd/nand/fsl_ifc_nand.c  | 1 -
  drivers/mtd/nand/fsl_upm.c   | 1 -
  drivers/mtd/nand/fsmc_nand.c | 1 -
  drivers/mtd/nand/gpio.c  | 1 -
  drivers/mtd/nand/jz4740_nand.c   | 1 -
  drivers/mtd/nand/lpc32xx_mlc.c   | 1 -
  drivers/mtd/nand/lpc32xx_slc.c   | 1 -
  drivers/mtd/nand/mpc5121_nfc.c   | 1 -
  drivers/mtd/nand/mxc_nand.c  | 1 -
  drivers/mtd/nand/ndfc.c  | 1 -
  drivers/mtd/nand/nuc900_nand.c   | 1 -
  drivers/mtd/nand/omap2.c | 1 -
  drivers/mtd/nand/omap_elm.c  | 1 -
  drivers/mtd/nand/orion_nand.c| 1 -
  drivers/mtd/nand/pasemi_nand.c   | 1 -
  drivers/mtd/nand/plat_nand.c | 1 -
  drivers/mtd/nand/s3c2410.c   | 1 -
  drivers/mtd/nand/sh_flctl.c  | 1 -
  drivers/mtd/nand/sharpsl.c   | 1 -
  drivers/mtd/nand/socrates_nand.c | 1 -
  drivers/mtd/nand/tmio_nand.c | 1 -
  drivers/mtd/nand/txx9ndfmc.c | 1 -
  30 files changed, 31 deletions(-)


This removal of .owner field should be done for all the platform drivers which 
are using
module_platform_driver().

Wolfram Sang  working on this change on the all the 
drivers. Please see [1].


[1]:https://git.kernel.org/cgit/linux/kernel/git/wsa/linux.git/log/?h=platform/remove_owner

--
Thanks and Regards,
Varka Bhadram.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] mtd: remove .owner field for driver using module_platform_driver

2014-11-11 Thread Varka Bhadram

Hi Sanjeev Sharma,

On 11/11/2014 03:57 PM, Sanjeev Sharma wrote:

This patch removes the .owner field for drivers which use the
platform_driver_register api because this is overriden in
_platform_driver_register.

Signed-off-by: Sanjeev Sharma sanjeev_sha...@mentor.com
---
  drivers/mtd/nand/ams-delta.c | 1 -
  drivers/mtd/nand/atmel_nand.c| 2 --
  drivers/mtd/nand/au1550nd.c  | 1 -
  drivers/mtd/nand/bf5xx_nand.c| 1 -
  drivers/mtd/nand/davinci_nand.c  | 1 -
  drivers/mtd/nand/denali_dt.c | 1 -
  drivers/mtd/nand/docg4.c | 1 -
  drivers/mtd/nand/fsl_elbc_nand.c | 1 -
  drivers/mtd/nand/fsl_ifc_nand.c  | 1 -
  drivers/mtd/nand/fsl_upm.c   | 1 -
  drivers/mtd/nand/fsmc_nand.c | 1 -
  drivers/mtd/nand/gpio.c  | 1 -
  drivers/mtd/nand/jz4740_nand.c   | 1 -
  drivers/mtd/nand/lpc32xx_mlc.c   | 1 -
  drivers/mtd/nand/lpc32xx_slc.c   | 1 -
  drivers/mtd/nand/mpc5121_nfc.c   | 1 -
  drivers/mtd/nand/mxc_nand.c  | 1 -
  drivers/mtd/nand/ndfc.c  | 1 -
  drivers/mtd/nand/nuc900_nand.c   | 1 -
  drivers/mtd/nand/omap2.c | 1 -
  drivers/mtd/nand/omap_elm.c  | 1 -
  drivers/mtd/nand/orion_nand.c| 1 -
  drivers/mtd/nand/pasemi_nand.c   | 1 -
  drivers/mtd/nand/plat_nand.c | 1 -
  drivers/mtd/nand/s3c2410.c   | 1 -
  drivers/mtd/nand/sh_flctl.c  | 1 -
  drivers/mtd/nand/sharpsl.c   | 1 -
  drivers/mtd/nand/socrates_nand.c | 1 -
  drivers/mtd/nand/tmio_nand.c | 1 -
  drivers/mtd/nand/txx9ndfmc.c | 1 -
  30 files changed, 31 deletions(-)


This removal of .owner field should be done for all the platform drivers which 
are using
module_platform_driver().

Wolfram Sang w...@the-dreams.de working on this change on the all the 
drivers. Please see [1].


[1]:https://git.kernel.org/cgit/linux/kernel/git/wsa/linux.git/log/?h=platform/remove_owner

--
Thanks and Regards,
Varka Bhadram.

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


Re: [RESUBMIT PATCH v5 2/8] backlight: Add support Skyworks SKY81452 backlight driver

2014-10-27 Thread Varka Bhadram
);
+}
+
+static int sky81452_bl_get_brightness(struct backlight_device *bd)
+{
+   return bd->props.brightness;
+}
+
+static const struct backlight_ops sky81452_bl_ops = {
+   .update_status = sky81452_bl_update_status,
+   .get_brightness = sky81452_bl_get_brightness,
+};
+
+static ssize_t sky81452_bl_store_enable(struct device *dev,
+   struct device_attribute *attr, const char *buf, size_t count)
+{
+   struct regmap *regmap = bl_get_data(to_backlight_device(dev));
+   unsigned long value;
+   int ret;
+
+   ret = kstrtoul(buf, 16, );
+   if (IS_ERR_VALUE(ret))
+   return ret;
+
+   ret = regmap_update_bits(regmap, SKY81452_REG1, SKY81452_EN,
+   value << CTZ(SKY81452_EN));
+   if (IS_ERR_VALUE(ret))
+   return ret;
+
+   return count;
+}
+
+static ssize_t sky81452_bl_show_open_short(struct device *dev,
+   struct device_attribute *attr, char *buf)
+{
+   struct regmap *regmap = bl_get_data(to_backlight_device(dev));
+   unsigned int reg, value = 0;
+   char tmp[3];
+   int i, ret;
+
+   reg = !strcmp(attr->attr.name, "open") ? SKY81452_REG5 : SKY81452_REG4;
+   ret = regmap_read(regmap, reg, );
+   if (IS_ERR_VALUE(ret))
+   return ret;
+
+   if (value & SKY81452_SHRT) {
+   *buf = 0;
+   for (i = 0; i < 6; i++) {
+   if (value & 0x01) {
+   sprintf(tmp, "%d ", i + 1);
+   strcat(buf, tmp);
+   }
+   value >>= 1;
+   }
+   strcat(buf, "\n");
+   } else {
+   strcpy(buf, "none\n");
+   }
+
+   return strlen(buf);
+}
+
+static ssize_t sky81452_bl_show_fault(struct device *dev,
+   struct device_attribute *attr, char *buf)
+{
+   struct regmap *regmap = bl_get_data(to_backlight_device(dev));
+   unsigned int value = 0;
+   int ret;
+
+   ret = regmap_read(regmap, SKY81452_REG4, );
+   if (IS_ERR_VALUE(ret))
+   return ret;
+
+   *buf = 0;
+
+   if (value & SKY81452_OCP)
+   strcat(buf, "over-current ");
+
+   if (value & SKY81452_OTMP)
+   strcat(buf, "over-temperature");
+
+   strcat(buf, "\n");
+   return strlen(buf);
+}
+
+static DEVICE_ATTR(enable, S_IWGRP | S_IWUSR, NULL, sky81452_bl_store_enable);
+static DEVICE_ATTR(open, S_IRUGO, sky81452_bl_show_open_short, NULL);
+static DEVICE_ATTR(short, S_IRUGO, sky81452_bl_show_open_short, NULL);
+static DEVICE_ATTR(fault, S_IRUGO, sky81452_bl_show_fault, NULL);
+
+static struct attribute *sky81452_bl_attribute[] = {
+   _attr_enable.attr,
+   _attr_open.attr,
+   _attr_short.attr,
+   _attr_fault.attr,
+   NULL
+};
+
+static const struct attribute_group sky81452_bl_attr_group = {
+   .attrs = sky81452_bl_attribute,
+};
+
+#ifdef CONFIG_OF
+static struct sky81452_bl_platform_data *sky81452_bl_parse_dt(
+   struct device *dev)
+{
+   struct device_node *np = of_node_get(dev->of_node);
+   struct sky81452_bl_platform_data *pdata;
+   int ret;
+
+   if (!np) {
+   dev_err(dev, "backlight node not found");


Missed terminating new line all over the driver for debug error messages..

--
Regards,
Varka Bhadram.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RESUBMIT PATCH v5 2/8] backlight: Add support Skyworks SKY81452 backlight driver

2014-10-27 Thread Varka Bhadram
, SKY81452_REG1, SKY81452_EN,
+   pdata-enable  CTZ(SKY81452_EN));
+   }
+
+   return regmap_update_bits(regmap, SKY81452_REG1, SKY81452_EN, 0);
+}
+
+static int sky81452_bl_get_brightness(struct backlight_device *bd)
+{
+   return bd-props.brightness;
+}
+
+static const struct backlight_ops sky81452_bl_ops = {
+   .update_status = sky81452_bl_update_status,
+   .get_brightness = sky81452_bl_get_brightness,
+};
+
+static ssize_t sky81452_bl_store_enable(struct device *dev,
+   struct device_attribute *attr, const char *buf, size_t count)
+{
+   struct regmap *regmap = bl_get_data(to_backlight_device(dev));
+   unsigned long value;
+   int ret;
+
+   ret = kstrtoul(buf, 16, value);
+   if (IS_ERR_VALUE(ret))
+   return ret;
+
+   ret = regmap_update_bits(regmap, SKY81452_REG1, SKY81452_EN,
+   value  CTZ(SKY81452_EN));
+   if (IS_ERR_VALUE(ret))
+   return ret;
+
+   return count;
+}
+
+static ssize_t sky81452_bl_show_open_short(struct device *dev,
+   struct device_attribute *attr, char *buf)
+{
+   struct regmap *regmap = bl_get_data(to_backlight_device(dev));
+   unsigned int reg, value = 0;
+   char tmp[3];
+   int i, ret;
+
+   reg = !strcmp(attr-attr.name, open) ? SKY81452_REG5 : SKY81452_REG4;
+   ret = regmap_read(regmap, reg, value);
+   if (IS_ERR_VALUE(ret))
+   return ret;
+
+   if (value  SKY81452_SHRT) {
+   *buf = 0;
+   for (i = 0; i  6; i++) {
+   if (value  0x01) {
+   sprintf(tmp, %d , i + 1);
+   strcat(buf, tmp);
+   }
+   value = 1;
+   }
+   strcat(buf, \n);
+   } else {
+   strcpy(buf, none\n);
+   }
+
+   return strlen(buf);
+}
+
+static ssize_t sky81452_bl_show_fault(struct device *dev,
+   struct device_attribute *attr, char *buf)
+{
+   struct regmap *regmap = bl_get_data(to_backlight_device(dev));
+   unsigned int value = 0;
+   int ret;
+
+   ret = regmap_read(regmap, SKY81452_REG4, value);
+   if (IS_ERR_VALUE(ret))
+   return ret;
+
+   *buf = 0;
+
+   if (value  SKY81452_OCP)
+   strcat(buf, over-current );
+
+   if (value  SKY81452_OTMP)
+   strcat(buf, over-temperature);
+
+   strcat(buf, \n);
+   return strlen(buf);
+}
+
+static DEVICE_ATTR(enable, S_IWGRP | S_IWUSR, NULL, sky81452_bl_store_enable);
+static DEVICE_ATTR(open, S_IRUGO, sky81452_bl_show_open_short, NULL);
+static DEVICE_ATTR(short, S_IRUGO, sky81452_bl_show_open_short, NULL);
+static DEVICE_ATTR(fault, S_IRUGO, sky81452_bl_show_fault, NULL);
+
+static struct attribute *sky81452_bl_attribute[] = {
+   dev_attr_enable.attr,
+   dev_attr_open.attr,
+   dev_attr_short.attr,
+   dev_attr_fault.attr,
+   NULL
+};
+
+static const struct attribute_group sky81452_bl_attr_group = {
+   .attrs = sky81452_bl_attribute,
+};
+
+#ifdef CONFIG_OF
+static struct sky81452_bl_platform_data *sky81452_bl_parse_dt(
+   struct device *dev)
+{
+   struct device_node *np = of_node_get(dev-of_node);
+   struct sky81452_bl_platform_data *pdata;
+   int ret;
+
+   if (!np) {
+   dev_err(dev, backlight node not found);


Missed terminating new line all over the driver for debug error messages..

--
Regards,
Varka Bhadram.

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


Re: [PATCH v3 4/6] uio: Add X-Gene QMTM UIO driver

2014-10-21 Thread Varka Bhadram

On 10/21/2014 11:46 AM, Ankit Jindal wrote:

On 21 October 2014 11:34, Varka Bhadram  wrote:

On 10/21/2014 11:26 AM, Ankit Jindal wrote:

The Applied Micro X-Gene SOC has on-chip QMTM (Queue manager
and Traffic manager) which is hardware based Queue or Ring
manager. This QMTM device can be used in conjunction with
other devices such as DMA Engine, Ethernet, Security Engine,
etc to assign work based on queues or rings.

This patch allows user space access to X-Gene QMTM device.

Signed-off-by: Ankit Jindal 
Signed-off-by: Tushar Jagad 


(...)



+
+static int qmtm_probe(struct platform_device *pdev)
+{
+   struct uio_info *info;
+   struct uio_qmtm_dev *qmtm_dev;
+   struct resource *csr;
+   struct resource *fabric;
+   struct resource qpool;
+   unsigned int num_queues;
+   unsigned int devid;
+   phandle qpool_phandle;
+   struct device_node *qpool_node;
+   int ret;
+
+   qmtm_dev = devm_kzalloc(>dev, sizeof(struct uio_qmtm_dev),
+   GFP_KERNEL);
+   if (!qmtm_dev)
+   return -ENOMEM;
+
+   qmtm_dev->info = devm_kzalloc(>dev, sizeof(*info),
GFP_KERNEL);
+   if (!qmtm_dev->info)
+   return -ENOMEM;
+
+   /* Power on qmtm in case its not done as part of boot-loader */
+   qmtm_dev->qmtm_clk = devm_clk_get(>dev, NULL);
+   if (IS_ERR(qmtm_dev->qmtm_clk)) {
+   dev_err(>dev, "Failed to get clock\n");
+   ret = PTR_ERR(qmtm_dev->qmtm_clk);
+   return ret;
+   }
+
+   csr = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+   if (!csr) {
+   ret = -ENODEV;
+   dev_err(>dev, "No QMTM CSR resource specified\n");
+   goto out_err;
+   }
+


This error check is not required. *csr* is checked in
devm_ioremap_resource().

I think its better to do sanity check before calling any function.


It will be the duplication of code for sanity check. This sanity check is 
happening
with devm_ioremap_resource(). No need to check it explicitly.


+   if (!csr->start) {
+   ret = -EINVAL;
+   dev_err(>dev, "Invalid CSR resource\n");
+   goto out_err;
+   }
+
+   fabric = platform_get_resource(pdev, IORESOURCE_MEM, 1);
+   if (!fabric) {
+   ret = -ENODEV;
+   dev_err(>dev, "No QMTM Fabric resource
specified\n");
+   goto out_err;
+   }
+


same

We do not ioremap this address.


Ok..

--
Regards,
Varka Bhadram.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 4/6] uio: Add X-Gene QMTM UIO driver

2014-10-21 Thread Varka Bhadram
ize = resource_size();
+   info->mem[2].memtype = UIO_MEM_PHYS_CACHE;
+
+   info->name = devm_kasprintf(>dev, GFP_KERNEL, "qmtm%d", devid);
+   info->version = DRV_VERSION;
+
+   info->priv = qmtm_dev;
+
+   /* enable the clock */
+   clk_prepare_enable(qmtm_dev->qmtm_clk);
+
+   /* get the qmtm out of reset */
+   ret = qmtm_reset(qmtm_dev);
+   if (ret < 0) {
+   dev_err(>dev, "Failed to reset QMTM\n");
+   goto out_clk;
+   }
+
+   /* register with uio framework */
+   ret = uio_register_device(>dev, info);
+   if (ret < 0)
+   goto out_clk;
+
+   platform_set_drvdata(pdev, qmtm_dev);
+   return 0;
+
+out_clk:
+   clk_disable_unprepare(qmtm_dev->qmtm_clk);
+
+out_err:
+   return ret;
+}




--
Regards,
Varka Bhadram.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 4/6] uio: Add X-Gene QMTM UIO driver

2014-10-21 Thread Varka Bhadram
 */
+   clk_prepare_enable(qmtm_dev-qmtm_clk);
+
+   /* get the qmtm out of reset */
+   ret = qmtm_reset(qmtm_dev);
+   if (ret  0) {
+   dev_err(pdev-dev, Failed to reset QMTM\n);
+   goto out_clk;
+   }
+
+   /* register with uio framework */
+   ret = uio_register_device(pdev-dev, info);
+   if (ret  0)
+   goto out_clk;
+
+   platform_set_drvdata(pdev, qmtm_dev);
+   return 0;
+
+out_clk:
+   clk_disable_unprepare(qmtm_dev-qmtm_clk);
+
+out_err:
+   return ret;
+}




--
Regards,
Varka Bhadram.

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


Re: [PATCH v3 4/6] uio: Add X-Gene QMTM UIO driver

2014-10-21 Thread Varka Bhadram

On 10/21/2014 11:46 AM, Ankit Jindal wrote:

On 21 October 2014 11:34, Varka Bhadram varkabhad...@gmail.com wrote:

On 10/21/2014 11:26 AM, Ankit Jindal wrote:

The Applied Micro X-Gene SOC has on-chip QMTM (Queue manager
and Traffic manager) which is hardware based Queue or Ring
manager. This QMTM device can be used in conjunction with
other devices such as DMA Engine, Ethernet, Security Engine,
etc to assign work based on queues or rings.

This patch allows user space access to X-Gene QMTM device.

Signed-off-by: Ankit Jindal ankit.jin...@linaro.org
Signed-off-by: Tushar Jagad tushar.ja...@linaro.org


(...)



+
+static int qmtm_probe(struct platform_device *pdev)
+{
+   struct uio_info *info;
+   struct uio_qmtm_dev *qmtm_dev;
+   struct resource *csr;
+   struct resource *fabric;
+   struct resource qpool;
+   unsigned int num_queues;
+   unsigned int devid;
+   phandle qpool_phandle;
+   struct device_node *qpool_node;
+   int ret;
+
+   qmtm_dev = devm_kzalloc(pdev-dev, sizeof(struct uio_qmtm_dev),
+   GFP_KERNEL);
+   if (!qmtm_dev)
+   return -ENOMEM;
+
+   qmtm_dev-info = devm_kzalloc(pdev-dev, sizeof(*info),
GFP_KERNEL);
+   if (!qmtm_dev-info)
+   return -ENOMEM;
+
+   /* Power on qmtm in case its not done as part of boot-loader */
+   qmtm_dev-qmtm_clk = devm_clk_get(pdev-dev, NULL);
+   if (IS_ERR(qmtm_dev-qmtm_clk)) {
+   dev_err(pdev-dev, Failed to get clock\n);
+   ret = PTR_ERR(qmtm_dev-qmtm_clk);
+   return ret;
+   }
+
+   csr = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+   if (!csr) {
+   ret = -ENODEV;
+   dev_err(pdev-dev, No QMTM CSR resource specified\n);
+   goto out_err;
+   }
+


This error check is not required. *csr* is checked in
devm_ioremap_resource().

I think its better to do sanity check before calling any function.


It will be the duplication of code for sanity check. This sanity check is 
happening
with devm_ioremap_resource(). No need to check it explicitly.


+   if (!csr-start) {
+   ret = -EINVAL;
+   dev_err(pdev-dev, Invalid CSR resource\n);
+   goto out_err;
+   }
+
+   fabric = platform_get_resource(pdev, IORESOURCE_MEM, 1);
+   if (!fabric) {
+   ret = -ENODEV;
+   dev_err(pdev-dev, No QMTM Fabric resource
specified\n);
+   goto out_err;
+   }
+


same

We do not ioremap this address.


Ok..

--
Regards,
Varka Bhadram.

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


Re: [PATCH v6 1/2] mtd: nand: add sunxi NAND flash controller support

2014-10-20 Thread Varka Bhadram

On 10/20/2014 05:15 PM, Boris Brezillon wrote:

Add support for the sunxi NAND Flash Controller (NFC).


(...)


+
+static int sunxi_nfc_dev_ready(struct mtd_info *mtd)
+{
+   struct nand_chip *nand = mtd->priv;
+   struct sunxi_nand_chip *sunxi_nand = to_sunxi_nand(nand);
+   struct sunxi_nfc *nfc = to_sunxi_nfc(sunxi_nand->nand.controller);
+   struct sunxi_nand_rb *rb;
+   unsigned long timeo = (sunxi_nand->nand.state == FL_ERASING ? 400 : 20);
+   int ret;
+
+   if (sunxi_nand->selected < 0)
+   return 0;
+
+   rb = _nand->sels[sunxi_nand->selected].rb;
+
+   switch (rb->type) {
+   case RB_NATIVE:
+   ret = !!(readl(nfc->regs + NFC_REG_ST) &
+(NFC_RB_STATE0 << rb->info.nativeid));
+   if (ret)
+   break;
+
+   sunxi_nfc_wait_int(nfc, NFC_RB_B2R, timeo);
+   ret = !!(readl(nfc->regs + NFC_REG_ST) &
+(NFC_RB_STATE0 << rb->info.nativeid));
+   break;
+   case RB_GPIO:
+   ret = gpio_get_value(rb->info.gpio);
+   break;
+   case RB_NONE:
+   default:
+   ret = 0;
+   pr_err("cannot check R/B NAND status!");


Missed terminating  new line...  :-)


+   break;
+   }
+
+   return ret;
+}
+
+


(...)


+static struct platform_driver sunxi_nfc_driver = {
+   .driver = {
+   .name = "sunxi_nand",
+   .owner = THIS_MODULE,


This field updated by module_platform_driver()..


+   .of_match_table = sunxi_nfc_ids,
+   },
+   .probe = sunxi_nfc_probe,
+   .remove = sunxi_nfc_remove,
+};
+module_platform_driver(sunxi_nfc_driver);
+
+MODULE_LICENSE("GPL v2");
+MODULE_AUTHOR("Boris BREZILLON");
+MODULE_DESCRIPTION("Allwinner NAND Flash Controller driver");
+MODULE_ALIAS("platform:sunxi_nand");


--
Regards,
Varka Bhadram.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v4 1/3] power-domain: add power domain drivers for Rockchip platform

2014-10-20 Thread Varka Bhadram

On 10/20/2014 02:33 PM, jinkun.hong wrote:

From: "jinkun.hong" 

Add power domain drivers based on generic power domain for Rockchip platform,
and support RK3288.

Signed-off-by: Jack Dai 
Signed-off-by: jinkun.hong 

---


(...)


+static int rockchip_pd_power(struct rockchip_domain *pd, bool power_on)
+{
+   int i = 0;
+   int ret = 0;
+   struct rockchip_dev_entry *de;
+
+   spin_lock_irq(>dev_lock);
+
+   list_for_each_entry(de, >dev_list, node) {
+   i += 1;
+   pm_clk_resume(pd->dev);
+   }
+
+   /* no clk, set power domain will fail */
+   if (i == 0) {
+   pr_err("%s: failed to on/off power domain!", __func__);


Missed terminating new line  :-)


+   spin_unlock_irq(>dev_lock);
+   return ret;
+   }
+
+   ret = rockchip_pmu_set_power_domain(pd, power_on);
+
+   list_for_each_entry(de, >dev_list, node) {
+   pm_clk_suspend(pd->dev);
+   }
+
+   spin_unlock_irq(>dev_lock);
+
+   return ret;
+}
+


(...)


+static int rockchip_pm_domain_probe(struct platform_device *pdev)
+{
+   struct device_node *node;
+   struct regmap *regmap_pmu;
+   struct rockchip_domain *pd;
+   const struct of_device_id *match;
+
+   match = of_match_node(rockchip_pm_domain_dt_match, pdev->dev.of_node);
+   pd = (struct rockchip_domain *)match->data;
+


Unnecessary one line space..


+   if (!pd)
+   return -ENOMEM;
+
+   node = of_parse_phandle(pdev->dev.of_node, "rockchip,pmu", 0);
+   regmap_pmu = syscon_node_to_regmap(node);
+   of_node_put(node);
+   if (IS_ERR(regmap_pmu)) {
+   pr_err("%s: failed to get regmap_pmu", __func__);


Terminating new line missed...  :-)


+   return PTR_ERR(regmap_pmu);
+   }
+
+   pd->regmap_pmu = regmap_pmu;
+   pd->dev = >dev;
+
+   INIT_LIST_HEAD(>dev_list);
+
+   spin_lock_init(>idle_lock);
+   spin_lock_init(>pmu_lock);
+   spin_lock_init(>dev_lock);
+
+   pm_genpd_init(>base, NULL, false);
+
+   return of_genpd_add_provider_simple(pdev->dev.of_node, >base);
+}
+


--
Thanks and Regards,
Varka Bhadram.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v4 1/3] power-domain: add power domain drivers for Rockchip platform

2014-10-20 Thread Varka Bhadram

On 10/20/2014 02:33 PM, jinkun.hong wrote:

From: jinkun.hong jinkun.h...@rock-chips.com

Add power domain drivers based on generic power domain for Rockchip platform,
and support RK3288.

Signed-off-by: Jack Dai jack@rock-chips.com
Signed-off-by: jinkun.hong jinkun.h...@rock-chips.com

---


(...)


+static int rockchip_pd_power(struct rockchip_domain *pd, bool power_on)
+{
+   int i = 0;
+   int ret = 0;
+   struct rockchip_dev_entry *de;
+
+   spin_lock_irq(pd-dev_lock);
+
+   list_for_each_entry(de, pd-dev_list, node) {
+   i += 1;
+   pm_clk_resume(pd-dev);
+   }
+
+   /* no clk, set power domain will fail */
+   if (i == 0) {
+   pr_err(%s: failed to on/off power domain!, __func__);


Missed terminating new line  :-)


+   spin_unlock_irq(pd-dev_lock);
+   return ret;
+   }
+
+   ret = rockchip_pmu_set_power_domain(pd, power_on);
+
+   list_for_each_entry(de, pd-dev_list, node) {
+   pm_clk_suspend(pd-dev);
+   }
+
+   spin_unlock_irq(pd-dev_lock);
+
+   return ret;
+}
+


(...)


+static int rockchip_pm_domain_probe(struct platform_device *pdev)
+{
+   struct device_node *node;
+   struct regmap *regmap_pmu;
+   struct rockchip_domain *pd;
+   const struct of_device_id *match;
+
+   match = of_match_node(rockchip_pm_domain_dt_match, pdev-dev.of_node);
+   pd = (struct rockchip_domain *)match-data;
+


Unnecessary one line space..


+   if (!pd)
+   return -ENOMEM;
+
+   node = of_parse_phandle(pdev-dev.of_node, rockchip,pmu, 0);
+   regmap_pmu = syscon_node_to_regmap(node);
+   of_node_put(node);
+   if (IS_ERR(regmap_pmu)) {
+   pr_err(%s: failed to get regmap_pmu, __func__);


Terminating new line missed...  :-)


+   return PTR_ERR(regmap_pmu);
+   }
+
+   pd-regmap_pmu = regmap_pmu;
+   pd-dev = pdev-dev;
+
+   INIT_LIST_HEAD(pd-dev_list);
+
+   spin_lock_init(pd-idle_lock);
+   spin_lock_init(pd-pmu_lock);
+   spin_lock_init(pd-dev_lock);
+
+   pm_genpd_init(pd-base, NULL, false);
+
+   return of_genpd_add_provider_simple(pdev-dev.of_node, pd-base);
+}
+


--
Thanks and Regards,
Varka Bhadram.

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


Re: [PATCH v6 1/2] mtd: nand: add sunxi NAND flash controller support

2014-10-20 Thread Varka Bhadram

On 10/20/2014 05:15 PM, Boris Brezillon wrote:

Add support for the sunxi NAND Flash Controller (NFC).


(...)


+
+static int sunxi_nfc_dev_ready(struct mtd_info *mtd)
+{
+   struct nand_chip *nand = mtd-priv;
+   struct sunxi_nand_chip *sunxi_nand = to_sunxi_nand(nand);
+   struct sunxi_nfc *nfc = to_sunxi_nfc(sunxi_nand-nand.controller);
+   struct sunxi_nand_rb *rb;
+   unsigned long timeo = (sunxi_nand-nand.state == FL_ERASING ? 400 : 20);
+   int ret;
+
+   if (sunxi_nand-selected  0)
+   return 0;
+
+   rb = sunxi_nand-sels[sunxi_nand-selected].rb;
+
+   switch (rb-type) {
+   case RB_NATIVE:
+   ret = !!(readl(nfc-regs + NFC_REG_ST) 
+(NFC_RB_STATE0  rb-info.nativeid));
+   if (ret)
+   break;
+
+   sunxi_nfc_wait_int(nfc, NFC_RB_B2R, timeo);
+   ret = !!(readl(nfc-regs + NFC_REG_ST) 
+(NFC_RB_STATE0  rb-info.nativeid));
+   break;
+   case RB_GPIO:
+   ret = gpio_get_value(rb-info.gpio);
+   break;
+   case RB_NONE:
+   default:
+   ret = 0;
+   pr_err(cannot check R/B NAND status!);


Missed terminating  new line...  :-)


+   break;
+   }
+
+   return ret;
+}
+
+


(...)


+static struct platform_driver sunxi_nfc_driver = {
+   .driver = {
+   .name = sunxi_nand,
+   .owner = THIS_MODULE,


This field updated by module_platform_driver()..


+   .of_match_table = sunxi_nfc_ids,
+   },
+   .probe = sunxi_nfc_probe,
+   .remove = sunxi_nfc_remove,
+};
+module_platform_driver(sunxi_nfc_driver);
+
+MODULE_LICENSE(GPL v2);
+MODULE_AUTHOR(Boris BREZILLON);
+MODULE_DESCRIPTION(Allwinner NAND Flash Controller driver);
+MODULE_ALIAS(platform:sunxi_nand);


--
Regards,
Varka Bhadram.

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


Re: [PATCHv3 3/3] gpio: sch: Enable IRQ support for Quark X1000

2014-10-15 Thread Varka Bhadram

On 10/16/2014 09:21 AM, Chang Rebecca Swee Fun wrote:

Intel Quark X1000 GPIO controller supports interrupt handling for
both core power well and resume power well. This patch is to enable
the IRQ support and provide IRQ handling for Intel Quark X1000
GPIO-SCH device driver.


(...)


  static int sch_gpio_probe(struct platform_device *pdev)
  {
struct sch_gpio *sch;
-   struct resource *res;
+   struct resource *res, *irq;
+   int err;
  
  	sch = devm_kzalloc(>dev, sizeof(*sch), GFP_KERNEL);

if (!sch)
@@ -203,6 +376,17 @@ static int sch_gpio_probe(struct platform_device *pdev)
 pdev->name))
return -EBUSY;
  
+	irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);

+   sch->irq_support = !!irq;
+   if (sch->irq_support) {
+   sch->irq_num = irq->start;
+   if (sch->irq_num < 0) {
+   dev_warn(>dev,
+"failed to obtain irq number for device\n");
+   sch->irq_support = false;
+   }
+   }
+
spin_lock_init(>lock);
sch->iobase = res->start;
sch->chip = sch_gpio_chip;
@@ -251,15 +435,64 @@ static int sch_gpio_probe(struct platform_device *pdev)
return -ENODEV;
}
  
+	err = gpiochip_add(>chip);

+   if (err < 0)
+   goto err_sch_gpio;
+
+   if (sch->irq_support) {
+   sch->irq_base = irq_alloc_descs(-1, 0, sch->chip.ngpio,
+   NUMA_NO_NODE);
+   if (sch->irq_base < 0) {
+   dev_err(>dev,
+   "failed to allocate GPIO IRQ descs\n");
+   goto err_sch_intr_chip;
+   }
+
+   /* disable interrupts */
+   sch_gpio_irq_disable_all(sch, sch->chip.ngpio);
+
+   err = request_irq(sch->irq_num, sch_gpio_irq_handler,
+ IRQF_SHARED, KBUILD_MODNAME, sch);
+   if (err) {
+   dev_err(>dev,
+   "%s failed to request IRQ\n", __func__);
+   goto err_sch_request_irq;
+   }
+
+   sch_gpio_irqs_init(sch, sch->chip.ngpio);
+   }
+
platform_set_drvdata(pdev, sch);
  
-	return gpiochip_add(>chip);

+   return 0;
+
+err_sch_request_irq:
+   irq_free_descs(sch->irq_base, sch->chip.ngpio);
+
+err_sch_intr_chip:
+   if (gpiochip_remove(>chip))


gpiochip_remove() return 'void' [0].


+   dev_err(>dev,
+   "%s gpiochip_remove() failed\n", __func__);
+
+err_sch_gpio:
+   release_region(res->start, resource_size(res));
+
+   return err;
  }


[0]:https://git.kernel.org/cgit/linux/kernel/git/linusw/linux-gpio.git/tree/drivers/gpio/gpiolib.c#n311


--
Regards,
Varka Bhadram.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCHv3 3/3] gpio: sch: Enable IRQ support for Quark X1000

2014-10-15 Thread Varka Bhadram

On 10/16/2014 09:21 AM, Chang Rebecca Swee Fun wrote:

Intel Quark X1000 GPIO controller supports interrupt handling for
both core power well and resume power well. This patch is to enable
the IRQ support and provide IRQ handling for Intel Quark X1000
GPIO-SCH device driver.


(...)


  static int sch_gpio_probe(struct platform_device *pdev)
  {
struct sch_gpio *sch;
-   struct resource *res;
+   struct resource *res, *irq;
+   int err;
  
  	sch = devm_kzalloc(pdev-dev, sizeof(*sch), GFP_KERNEL);

if (!sch)
@@ -203,6 +376,17 @@ static int sch_gpio_probe(struct platform_device *pdev)
 pdev-name))
return -EBUSY;
  
+	irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);

+   sch-irq_support = !!irq;
+   if (sch-irq_support) {
+   sch-irq_num = irq-start;
+   if (sch-irq_num  0) {
+   dev_warn(pdev-dev,
+failed to obtain irq number for device\n);
+   sch-irq_support = false;
+   }
+   }
+
spin_lock_init(sch-lock);
sch-iobase = res-start;
sch-chip = sch_gpio_chip;
@@ -251,15 +435,64 @@ static int sch_gpio_probe(struct platform_device *pdev)
return -ENODEV;
}
  
+	err = gpiochip_add(sch-chip);

+   if (err  0)
+   goto err_sch_gpio;
+
+   if (sch-irq_support) {
+   sch-irq_base = irq_alloc_descs(-1, 0, sch-chip.ngpio,
+   NUMA_NO_NODE);
+   if (sch-irq_base  0) {
+   dev_err(pdev-dev,
+   failed to allocate GPIO IRQ descs\n);
+   goto err_sch_intr_chip;
+   }
+
+   /* disable interrupts */
+   sch_gpio_irq_disable_all(sch, sch-chip.ngpio);
+
+   err = request_irq(sch-irq_num, sch_gpio_irq_handler,
+ IRQF_SHARED, KBUILD_MODNAME, sch);
+   if (err) {
+   dev_err(pdev-dev,
+   %s failed to request IRQ\n, __func__);
+   goto err_sch_request_irq;
+   }
+
+   sch_gpio_irqs_init(sch, sch-chip.ngpio);
+   }
+
platform_set_drvdata(pdev, sch);
  
-	return gpiochip_add(sch-chip);

+   return 0;
+
+err_sch_request_irq:
+   irq_free_descs(sch-irq_base, sch-chip.ngpio);
+
+err_sch_intr_chip:
+   if (gpiochip_remove(sch-chip))


gpiochip_remove() return 'void' [0].


+   dev_err(pdev-dev,
+   %s gpiochip_remove() failed\n, __func__);
+
+err_sch_gpio:
+   release_region(res-start, resource_size(res));
+
+   return err;
  }


[0]:https://git.kernel.org/cgit/linux/kernel/git/linusw/linux-gpio.git/tree/drivers/gpio/gpiolib.c#n311


--
Regards,
Varka Bhadram.

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


Re: [PATCH] drivers/net/can/m_can/Kconfig: Let CAN_M_CAN depend on HAS_IOMEM

2014-10-04 Thread Varka Bhadram

Hi Chen Gang


I think commit message should be short and proper.

We can remove *drivers/net/can/m_can/Kconfig* in the commit, just
give *can: Kconfig: *

commit message like : *can: Kconfig: Fix CAN_M_CAN dependency*

On Saturday 04 October 2014 03:30 PM, Chen Gang wrote:

CAN_M_CAN needs HAS_IOMEM, so depend on it, the related error (with
allmodconfig under um):

 MODPOST 1205 modules
   ERROR: "devm_ioremap" [drivers/net/can/m_can/m_can.ko] undefined!
   ERROR: "devm_ioremap_resource" [drivers/net/can/m_can/m_can.ko] undefined!

Signed-off-by: Chen Gang 
---
  drivers/net/can/m_can/Kconfig | 1 +
  1 file changed, 1 insertion(+)

diff --git a/drivers/net/can/m_can/Kconfig b/drivers/net/can/m_can/Kconfig
index fca5482..14c9fcf 100644
--- a/drivers/net/can/m_can/Kconfig
+++ b/drivers/net/can/m_can/Kconfig
@@ -1,4 +1,5 @@
  config CAN_M_CAN
tristate "Bosch M_CAN devices"
+   depends on HAS_IOMEM
---help---
  Say Y here if you want to support for Bosch M_CAN controller.


--
Thanks and Regards,
Varka Bhadram.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] drivers/net/can/m_can/Kconfig: Let CAN_M_CAN depend on HAS_IOMEM

2014-10-04 Thread Varka Bhadram

Hi Chen Gang


I think commit message should be short and proper.

We can remove *drivers/net/can/m_can/Kconfig* in the commit, just
give *can: Kconfig: *

commit message like : *can: Kconfig: Fix CAN_M_CAN dependency*

On Saturday 04 October 2014 03:30 PM, Chen Gang wrote:

CAN_M_CAN needs HAS_IOMEM, so depend on it, the related error (with
allmodconfig under um):

 MODPOST 1205 modules
   ERROR: devm_ioremap [drivers/net/can/m_can/m_can.ko] undefined!
   ERROR: devm_ioremap_resource [drivers/net/can/m_can/m_can.ko] undefined!

Signed-off-by: Chen Gang gang.chen.5...@gmail.com
---
  drivers/net/can/m_can/Kconfig | 1 +
  1 file changed, 1 insertion(+)

diff --git a/drivers/net/can/m_can/Kconfig b/drivers/net/can/m_can/Kconfig
index fca5482..14c9fcf 100644
--- a/drivers/net/can/m_can/Kconfig
+++ b/drivers/net/can/m_can/Kconfig
@@ -1,4 +1,5 @@
  config CAN_M_CAN
tristate Bosch M_CAN devices
+   depends on HAS_IOMEM
---help---
  Say Y here if you want to support for Bosch M_CAN controller.


--
Thanks and Regards,
Varka Bhadram.

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


Re: [PATCH v2 4/6] drivers: uio: Add X-Gene QMTM UIO driver

2014-09-30 Thread Varka Bhadram
ct of_device_id qmtm_match[] = {
+   {.compatible = "apm,xgene-qmtm",},
+   {},
+};
+
+MODULE_DEVICE_TABLE(of, qmtm_match);
+
+static struct platform_driver qmtm_driver = {
+   .driver = {
+   .name = DRV_NAME,
+   .owner = THIS_MODULE,


Its not required. It will be updated by *module_platform_driver()*


+   .of_match_table = qmtm_match,
+   },
+   .probe = qmtm_probe,
+   .remove = qmtm_remove,
+};
+
+module_platform_driver(qmtm_driver);



--
Regards,
Varka Bhadram.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 4/6] drivers: uio: Add X-Gene QMTM UIO driver

2014-09-30 Thread Varka Bhadram
 = {
+   .driver = {
+   .name = DRV_NAME,
+   .owner = THIS_MODULE,


Its not required. It will be updated by *module_platform_driver()*


+   .of_match_table = qmtm_match,
+   },
+   .probe = qmtm_probe,
+   .remove = qmtm_remove,
+};
+
+module_platform_driver(qmtm_driver);



--
Regards,
Varka Bhadram.

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


Re: [PATCH v2] i2c: axxia: Add I2C driver for AXM55xx

2014-09-29 Thread Varka Bhadram

On 09/29/2014 04:43 PM, Anders Berg wrote:

On Mon, Sep 29, 2014 at 12:07 PM, Varka Bhadram  wrote:

On 09/29/2014 03:02 PM, Anders Berg wrote:

Add I2C bus driver for the controller found in the LSI Axxia family SoCs.
The
driver implements 10-bit addressing and SMBus transfer modes via emulation
(including SMBus block data read).

Signed-off-by: Anders Berg 
---


(...)

+
+   if (!idev->msg) {
+   dev_warn(idev->dev, "unexpected interrupt");


Missed terminating new line '\n'


Right, I'll fix that (all occurrences)


+   goto out;
+   }
+
+   /* RX FIFO needs service? */
+   if (i2c_m_rd(idev->msg) && (status & MST_STATUS_RFL))
+   axxia_i2c_empty_rx_fifo(idev);
+
+   /* TX FIFO needs service? */
+   if (!i2c_m_rd(idev->msg) && (status & MST_STATUS_TFL)) {
+   if (axxia_i2c_fill_tx_fifo(idev) == 0)
+   i2c_int_disable(idev, MST_STATUS_TFL);
+   }
+
+   if (status & MST_STATUS_SCC) {
+   /* Stop completed */
+   i2c_int_disable(idev, ~0);
+   complete(>msg_complete);
+   } else if (status & MST_STATUS_SNS) {
+   /* Transfer done */
+   i2c_int_disable(idev, ~0);
+   if (i2c_m_rd(idev->msg) && idev->msg_xfrd <
idev->msg->len)
+   axxia_i2c_empty_rx_fifo(idev);
+   complete(>msg_complete);
+   } else if (unlikely(status & MST_STATUS_ERR)) {
+   /* Transfer error */
+   i2c_int_disable(idev, ~0);
+   if (status & MST_STATUS_AL)
+   idev->msg_err = -EAGAIN;
+   else if (status & MST_STATUS_NAK)
+   idev->msg_err = -ENXIO;
+   else
+   idev->msg_err = -EIO;
+   dev_dbg(idev->dev, "error %#x, addr=%#x rx=%u/%u
tx=%u/%u\n",
+   status,
+   idev->msg->addr,
+   readl(idev->base + MST_RX_BYTES_XFRD),
+   readl(idev->base + MST_RX_XFER),
+   readl(idev->base + MST_TX_BYTES_XFRD),
+   readl(idev->base + MST_TX_XFER));
+   complete(>msg_complete);
+   }
+
+out:
+   /* Clear interrupt */
+   writel(INT_MST, idev->base + INTERRUPT_STATUS);
+
+   return IRQ_HANDLED;
+}
+


Its looks good if we move the entire ISR above probe/remove
functionalities...


Not sure what you mean here... The ISR _is_ above probe/remove.


I mean ISR should immediately above probe functionality. So that we can see
devm_request_irq(..,isr_name,..) ISR directly with isr name..

--
Regards,
Varka Bhadram.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2] i2c: axxia: Add I2C driver for AXM55xx

2014-09-29 Thread Varka Bhadram

On 09/29/2014 03:43 PM, Wolfram Sang wrote:

+   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);

Error checking on *res*...?

We should *return* on platform_get_resource() failure..


+   base = devm_ioremap_resource(>dev, res);

Nope. devm_ioremap_resource does that.


Yes it will [1]. Thanks for the clarification.

[1]:http://lxr.free-electrons.com/source/lib/devres.c#L117

--
Regards,
Varka Bhadram.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2] i2c: axxia: Add I2C driver for AXM55xx

2014-09-29 Thread Varka Bhadram
.functionality = axxia_i2c_func,
+};
+
+static int axxia_i2c_probe(struct platform_device *pdev)
+{
+   struct device_node *np = pdev->dev.of_node;
+   struct axxia_i2c_dev *idev = NULL;
+   struct resource *res;
+   void __iomem *base;
+   int irq;
+   int ret = 0;
+
+   idev = devm_kzalloc(>dev, sizeof(*idev), GFP_KERNEL);
+   if (!idev)
+   return -ENOMEM;
+
+   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);


Error checking on *res*...?

We should *return* on platform_get_resource() failure..


+   base = devm_ioremap_resource(>dev, res);
+   if (IS_ERR(base))
+   return PTR_ERR(base);
+
+   irq = platform_get_irq(pdev, 0);
+   if (irq < 0) {
+   dev_err(>dev, "missing interrupt resource\n");
+   return irq;
+   }
+
+   idev->i2c_clk = devm_clk_get(>dev, "i2c");
+   if (IS_ERR(idev->i2c_clk)) {
+   dev_err(>dev, "missing clock");


Missed terminating new line '\n'


+   return PTR_ERR(idev->i2c_clk);
+   }
+
+   idev->base = base;
+   idev->dev = >dev;
+   init_completion(>msg_complete);
+
+   of_property_read_u32(np, "clock-frequency", >bus_clk_rate);
+   if (idev->bus_clk_rate == 0)
+   idev->bus_clk_rate = 10; /* default clock rate */
+
+   ret = axxia_i2c_init(idev);
+   if (ret) {
+   dev_err(>dev, "failed to initialize");


Missed terminating new line '\n'


+   return ret;
+   }
+
+   ret = devm_request_irq(>dev, irq, axxia_i2c_isr, 0,
+  pdev->name, idev);
+   if (ret) {
+   dev_err(>dev, "failed to claim IRQ%d\n", irq);
+   return ret;
+   }
+
+   clk_prepare_enable(idev->i2c_clk);
+
+   i2c_set_adapdata(>adapter, idev);
+   strlcpy(idev->adapter.name, pdev->name, sizeof(idev->adapter.name));
+   idev->adapter.owner = THIS_MODULE;
+   idev->adapter.class = I2C_CLASS_HWMON;
+   idev->adapter.algo = _i2c_algo;
+   idev->adapter.dev.parent = >dev;
+   idev->adapter.dev.of_node = pdev->dev.of_node;
+
+   platform_set_drvdata(pdev, idev);
+
+   ret = i2c_add_adapter(>adapter);
+   if (ret) {
+   dev_err(>dev, "failed to add adapter\n");
+       return ret;
+   }
+
+   return 0;
+}
+
+static int axxia_i2c_remove(struct platform_device *pdev)
+{
+   struct axxia_i2c_dev *idev = platform_get_drvdata(pdev);
+
+   clk_disable_unprepare(idev->i2c_clk);
+   i2c_del_adapter(>adapter);
+
+   return 0;
+}
+
+/* Match table for of_platform binding */
+static const struct of_device_id axxia_i2c_of_match[] = {
+   { .compatible = "lsi,api2c", },
+   {},
+};
+
+MODULE_DEVICE_TABLE(of, axxia_i2c_of_match);
+
+static struct platform_driver axxia_i2c_driver = {
+   .probe = axxia_i2c_probe,
+   .remove = axxia_i2c_remove,
+   .driver = {
+   .name = "axxia-i2c",
+   .of_match_table = axxia_i2c_of_match,
+   },
+};
+
+module_platform_driver(axxia_i2c_driver);
+
+MODULE_DESCRIPTION("Axxia I2C Bus driver");
+MODULE_AUTHOR("Anders Berg ");
+MODULE_LICENSE("GPL v2");



--
Regards,
Varka Bhadram.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2] i2c: axxia: Add I2C driver for AXM55xx

2014-09-29 Thread Varka Bhadram
) {
+   dev_err(pdev-dev, missing interrupt resource\n);
+   return irq;
+   }
+
+   idev-i2c_clk = devm_clk_get(pdev-dev, i2c);
+   if (IS_ERR(idev-i2c_clk)) {
+   dev_err(pdev-dev, missing clock);


Missed terminating new line '\n'


+   return PTR_ERR(idev-i2c_clk);
+   }
+
+   idev-base = base;
+   idev-dev = pdev-dev;
+   init_completion(idev-msg_complete);
+
+   of_property_read_u32(np, clock-frequency, idev-bus_clk_rate);
+   if (idev-bus_clk_rate == 0)
+   idev-bus_clk_rate = 10; /* default clock rate */
+
+   ret = axxia_i2c_init(idev);
+   if (ret) {
+   dev_err(pdev-dev, failed to initialize);


Missed terminating new line '\n'


+   return ret;
+   }
+
+   ret = devm_request_irq(pdev-dev, irq, axxia_i2c_isr, 0,
+  pdev-name, idev);
+   if (ret) {
+   dev_err(pdev-dev, failed to claim IRQ%d\n, irq);
+   return ret;
+   }
+
+   clk_prepare_enable(idev-i2c_clk);
+
+   i2c_set_adapdata(idev-adapter, idev);
+   strlcpy(idev-adapter.name, pdev-name, sizeof(idev-adapter.name));
+   idev-adapter.owner = THIS_MODULE;
+   idev-adapter.class = I2C_CLASS_HWMON;
+   idev-adapter.algo = axxia_i2c_algo;
+   idev-adapter.dev.parent = pdev-dev;
+   idev-adapter.dev.of_node = pdev-dev.of_node;
+
+   platform_set_drvdata(pdev, idev);
+
+   ret = i2c_add_adapter(idev-adapter);
+   if (ret) {
+   dev_err(pdev-dev, failed to add adapter\n);
+   return ret;
+   }
+
+   return 0;
+}
+
+static int axxia_i2c_remove(struct platform_device *pdev)
+{
+   struct axxia_i2c_dev *idev = platform_get_drvdata(pdev);
+
+   clk_disable_unprepare(idev-i2c_clk);
+   i2c_del_adapter(idev-adapter);
+
+   return 0;
+}
+
+/* Match table for of_platform binding */
+static const struct of_device_id axxia_i2c_of_match[] = {
+   { .compatible = lsi,api2c, },
+   {},
+};
+
+MODULE_DEVICE_TABLE(of, axxia_i2c_of_match);
+
+static struct platform_driver axxia_i2c_driver = {
+   .probe = axxia_i2c_probe,
+   .remove = axxia_i2c_remove,
+   .driver = {
+   .name = axxia-i2c,
+   .of_match_table = axxia_i2c_of_match,
+   },
+};
+
+module_platform_driver(axxia_i2c_driver);
+
+MODULE_DESCRIPTION(Axxia I2C Bus driver);
+MODULE_AUTHOR(Anders Berg anders.b...@lsi.com);
+MODULE_LICENSE(GPL v2);



--
Regards,
Varka Bhadram.

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


Re: [PATCH v2] i2c: axxia: Add I2C driver for AXM55xx

2014-09-29 Thread Varka Bhadram

On 09/29/2014 03:43 PM, Wolfram Sang wrote:

+   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);

Error checking on *res*...?

We should *return* on platform_get_resource() failure..


+   base = devm_ioremap_resource(pdev-dev, res);

Nope. devm_ioremap_resource does that.


Yes it will [1]. Thanks for the clarification.

[1]:http://lxr.free-electrons.com/source/lib/devres.c#L117

--
Regards,
Varka Bhadram.

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


Re: [PATCH v2] i2c: axxia: Add I2C driver for AXM55xx

2014-09-29 Thread Varka Bhadram

On 09/29/2014 04:43 PM, Anders Berg wrote:

On Mon, Sep 29, 2014 at 12:07 PM, Varka Bhadram varkabhad...@gmail.com wrote:

On 09/29/2014 03:02 PM, Anders Berg wrote:

Add I2C bus driver for the controller found in the LSI Axxia family SoCs.
The
driver implements 10-bit addressing and SMBus transfer modes via emulation
(including SMBus block data read).

Signed-off-by: Anders Berg anders.b...@avagotech.com
---


(...)

+
+   if (!idev-msg) {
+   dev_warn(idev-dev, unexpected interrupt);


Missed terminating new line '\n'


Right, I'll fix that (all occurrences)


+   goto out;
+   }
+
+   /* RX FIFO needs service? */
+   if (i2c_m_rd(idev-msg)  (status  MST_STATUS_RFL))
+   axxia_i2c_empty_rx_fifo(idev);
+
+   /* TX FIFO needs service? */
+   if (!i2c_m_rd(idev-msg)  (status  MST_STATUS_TFL)) {
+   if (axxia_i2c_fill_tx_fifo(idev) == 0)
+   i2c_int_disable(idev, MST_STATUS_TFL);
+   }
+
+   if (status  MST_STATUS_SCC) {
+   /* Stop completed */
+   i2c_int_disable(idev, ~0);
+   complete(idev-msg_complete);
+   } else if (status  MST_STATUS_SNS) {
+   /* Transfer done */
+   i2c_int_disable(idev, ~0);
+   if (i2c_m_rd(idev-msg)  idev-msg_xfrd 
idev-msg-len)
+   axxia_i2c_empty_rx_fifo(idev);
+   complete(idev-msg_complete);
+   } else if (unlikely(status  MST_STATUS_ERR)) {
+   /* Transfer error */
+   i2c_int_disable(idev, ~0);
+   if (status  MST_STATUS_AL)
+   idev-msg_err = -EAGAIN;
+   else if (status  MST_STATUS_NAK)
+   idev-msg_err = -ENXIO;
+   else
+   idev-msg_err = -EIO;
+   dev_dbg(idev-dev, error %#x, addr=%#x rx=%u/%u
tx=%u/%u\n,
+   status,
+   idev-msg-addr,
+   readl(idev-base + MST_RX_BYTES_XFRD),
+   readl(idev-base + MST_RX_XFER),
+   readl(idev-base + MST_TX_BYTES_XFRD),
+   readl(idev-base + MST_TX_XFER));
+   complete(idev-msg_complete);
+   }
+
+out:
+   /* Clear interrupt */
+   writel(INT_MST, idev-base + INTERRUPT_STATUS);
+
+   return IRQ_HANDLED;
+}
+


Its looks good if we move the entire ISR above probe/remove
functionalities...


Not sure what you mean here... The ISR _is_ above probe/remove.


I mean ISR should immediately above probe functionality. So that we can see
devm_request_irq(..,isr_name,..) ISR directly with isr name..

--
Regards,
Varka Bhadram.

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


Re: [PATCH v5] spi: spi-imx: add DMA support

2014-09-09 Thread Varka Bhadram

On 09/10/2014 07:00 AM, Robin Gong wrote:

Enable DMA support on i.mx6. The read speed can increase from 600KB/s
to 1.2MB/s on i.mx6q. You can disable or enable dma function in dts.


(...)


+
+static int spi_imx_sdma_init(struct device *dev, struct spi_imx_data *spi_imx,
+struct spi_master *master,
+const struct resource *res)
+{
+   struct dma_slave_config slave_config = {};
+   int ret;
+
+   /* Prepare for TX DMA: */
+   master->dma_tx = dma_request_slave_channel(dev, "tx");
+   if (!master->dma_tx) {
+   dev_err(dev, "cannot get the TX DMA channel!\n");
+   ret = -EINVAL;
+   goto err;
+   }
+
+   slave_config.direction = DMA_MEM_TO_DEV;
+   slave_config.dst_addr = res->start + MXC_CSPITXDATA;
+   slave_config.dst_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE;
+   slave_config.dst_maxburst = spi_imx_get_fifosize(spi_imx) / 2;
+   ret = dmaengine_slave_config(master->dma_tx, _config);
+   if (ret) {
+   dev_err(dev, "error in TX dma configuration.");
+   


Missed terminating new line..

--
Regards,
Varka Bhadram.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v5] spi: spi-imx: add DMA support

2014-09-09 Thread Varka Bhadram

On 09/10/2014 07:00 AM, Robin Gong wrote:

Enable DMA support on i.mx6. The read speed can increase from 600KB/s
to 1.2MB/s on i.mx6q. You can disable or enable dma function in dts.


(...)


+
+static int spi_imx_sdma_init(struct device *dev, struct spi_imx_data *spi_imx,
+struct spi_master *master,
+const struct resource *res)
+{
+   struct dma_slave_config slave_config = {};
+   int ret;
+
+   /* Prepare for TX DMA: */
+   master-dma_tx = dma_request_slave_channel(dev, tx);
+   if (!master-dma_tx) {
+   dev_err(dev, cannot get the TX DMA channel!\n);
+   ret = -EINVAL;
+   goto err;
+   }
+
+   slave_config.direction = DMA_MEM_TO_DEV;
+   slave_config.dst_addr = res-start + MXC_CSPITXDATA;
+   slave_config.dst_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE;
+   slave_config.dst_maxburst = spi_imx_get_fifosize(spi_imx) / 2;
+   ret = dmaengine_slave_config(master-dma_tx, slave_config);
+   if (ret) {
+   dev_err(dev, error in TX dma configuration.);
+   


Missed terminating new line..

--
Regards,
Varka Bhadram.

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


[PATCH net-next] ethernet: ti: remove unwanted THIS_MODULE macro

2014-09-07 Thread Varka Bhadram
It removes the owner field updation of driver structure.
It will be automatically updated by module_platform_driver()

Signed-off-by: Varka Bhadram 
---
 drivers/net/ethernet/ti/cpmac.c|1 -
 drivers/net/ethernet/ti/cpsw-phy-sel.c |1 -
 drivers/net/ethernet/ti/cpsw.c |1 -
 drivers/net/ethernet/ti/davinci_emac.c |1 -
 drivers/net/ethernet/ti/davinci_mdio.c |1 -
 5 files changed, 5 deletions(-)

diff --git a/drivers/net/ethernet/ti/cpmac.c b/drivers/net/ethernet/ti/cpmac.c
index f9bcf7a..dd94300 100644
--- a/drivers/net/ethernet/ti/cpmac.c
+++ b/drivers/net/ethernet/ti/cpmac.c
@@ -1207,7 +1207,6 @@ static int cpmac_remove(struct platform_device *pdev)
 static struct platform_driver cpmac_driver = {
.driver = {
.name   = "cpmac",
-   .owner  = THIS_MODULE,
},
.probe  = cpmac_probe,
.remove = cpmac_remove,
diff --git a/drivers/net/ethernet/ti/cpsw-phy-sel.c 
b/drivers/net/ethernet/ti/cpsw-phy-sel.c
index aa8bf45..0ea7832 100644
--- a/drivers/net/ethernet/ti/cpsw-phy-sel.c
+++ b/drivers/net/ethernet/ti/cpsw-phy-sel.c
@@ -211,7 +211,6 @@ static struct platform_driver cpsw_phy_sel_driver = {
.probe  = cpsw_phy_sel_probe,
.driver = {
.name   = "cpsw-phy-sel",
-   .owner  = THIS_MODULE,
.of_match_table = cpsw_phy_sel_id_table,
},
 };
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index 03b4099..6d20e24 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -2359,7 +2359,6 @@ MODULE_DEVICE_TABLE(of, cpsw_of_mtable);
 static struct platform_driver cpsw_driver = {
.driver = {
.name= "cpsw",
-   .owner   = THIS_MODULE,
.pm  = _pm_ops,
.of_match_table = cpsw_of_mtable,
},
diff --git a/drivers/net/ethernet/ti/davinci_emac.c 
b/drivers/net/ethernet/ti/davinci_emac.c
index 35a139e..ea71251 100644
--- a/drivers/net/ethernet/ti/davinci_emac.c
+++ b/drivers/net/ethernet/ti/davinci_emac.c
@@ -2083,7 +2083,6 @@ MODULE_DEVICE_TABLE(of, davinci_emac_of_match);
 static struct platform_driver davinci_emac_driver = {
.driver = {
.name= "davinci_emac",
-   .owner   = THIS_MODULE,
.pm  = _emac_pm_ops,
.of_match_table = of_match_ptr(davinci_emac_of_match),
},
diff --git a/drivers/net/ethernet/ti/davinci_mdio.c 
b/drivers/net/ethernet/ti/davinci_mdio.c
index 2791f6f..98655b4 100644
--- a/drivers/net/ethernet/ti/davinci_mdio.c
+++ b/drivers/net/ethernet/ti/davinci_mdio.c
@@ -481,7 +481,6 @@ MODULE_DEVICE_TABLE(of, davinci_mdio_of_mtable);
 static struct platform_driver davinci_mdio_driver = {
.driver = {
.name= "davinci_mdio",
-   .owner   = THIS_MODULE,
.pm  = _mdio_pm_ops,
.of_match_table = of_match_ptr(davinci_mdio_of_mtable),
},
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH net-next] ethernet: ti: remove unwanted THIS_MODULE macro

2014-09-07 Thread Varka Bhadram
It removes the owner field updation of driver structure.
It will be automatically updated by module_platform_driver()

Signed-off-by: Varka Bhadram var...@cdac.in
---
 drivers/net/ethernet/ti/cpmac.c|1 -
 drivers/net/ethernet/ti/cpsw-phy-sel.c |1 -
 drivers/net/ethernet/ti/cpsw.c |1 -
 drivers/net/ethernet/ti/davinci_emac.c |1 -
 drivers/net/ethernet/ti/davinci_mdio.c |1 -
 5 files changed, 5 deletions(-)

diff --git a/drivers/net/ethernet/ti/cpmac.c b/drivers/net/ethernet/ti/cpmac.c
index f9bcf7a..dd94300 100644
--- a/drivers/net/ethernet/ti/cpmac.c
+++ b/drivers/net/ethernet/ti/cpmac.c
@@ -1207,7 +1207,6 @@ static int cpmac_remove(struct platform_device *pdev)
 static struct platform_driver cpmac_driver = {
.driver = {
.name   = cpmac,
-   .owner  = THIS_MODULE,
},
.probe  = cpmac_probe,
.remove = cpmac_remove,
diff --git a/drivers/net/ethernet/ti/cpsw-phy-sel.c 
b/drivers/net/ethernet/ti/cpsw-phy-sel.c
index aa8bf45..0ea7832 100644
--- a/drivers/net/ethernet/ti/cpsw-phy-sel.c
+++ b/drivers/net/ethernet/ti/cpsw-phy-sel.c
@@ -211,7 +211,6 @@ static struct platform_driver cpsw_phy_sel_driver = {
.probe  = cpsw_phy_sel_probe,
.driver = {
.name   = cpsw-phy-sel,
-   .owner  = THIS_MODULE,
.of_match_table = cpsw_phy_sel_id_table,
},
 };
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index 03b4099..6d20e24 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -2359,7 +2359,6 @@ MODULE_DEVICE_TABLE(of, cpsw_of_mtable);
 static struct platform_driver cpsw_driver = {
.driver = {
.name= cpsw,
-   .owner   = THIS_MODULE,
.pm  = cpsw_pm_ops,
.of_match_table = cpsw_of_mtable,
},
diff --git a/drivers/net/ethernet/ti/davinci_emac.c 
b/drivers/net/ethernet/ti/davinci_emac.c
index 35a139e..ea71251 100644
--- a/drivers/net/ethernet/ti/davinci_emac.c
+++ b/drivers/net/ethernet/ti/davinci_emac.c
@@ -2083,7 +2083,6 @@ MODULE_DEVICE_TABLE(of, davinci_emac_of_match);
 static struct platform_driver davinci_emac_driver = {
.driver = {
.name= davinci_emac,
-   .owner   = THIS_MODULE,
.pm  = davinci_emac_pm_ops,
.of_match_table = of_match_ptr(davinci_emac_of_match),
},
diff --git a/drivers/net/ethernet/ti/davinci_mdio.c 
b/drivers/net/ethernet/ti/davinci_mdio.c
index 2791f6f..98655b4 100644
--- a/drivers/net/ethernet/ti/davinci_mdio.c
+++ b/drivers/net/ethernet/ti/davinci_mdio.c
@@ -481,7 +481,6 @@ MODULE_DEVICE_TABLE(of, davinci_mdio_of_mtable);
 static struct platform_driver davinci_mdio_driver = {
.driver = {
.name= davinci_mdio,
-   .owner   = THIS_MODULE,
.pm  = davinci_mdio_pm_ops,
.of_match_table = of_match_ptr(davinci_mdio_of_mtable),
},
-- 
1.7.9.5

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


Re: [PATCHv2 1/4] ASoC: simple-card: add asoc_simple_card_fmt_master() to simplify the code.

2014-09-02 Thread Varka Bhadram

On 09/02/2014 04:08 PM, Jean-Francois Moine wrote:

On Tue, 02 Sep 2014 15:51:41 +0530
Varka Bhadram  wrote:


+   switch (((np == bitclkmaster) << 4) | (np == framemaster)) {
+   case 0x11:
+   return SND_SOC_DAIFMT_CBS_CFS;
+   case 0x10:
+   return SND_SOC_DAIFMT_CBS_CFM;
+   case 0x01:
+   return SND_SOC_DAIFMT_CBM_CFS;
+   default:
+   return SND_SOC_DAIFMT_CBM_CFM;
+   }
+
+   /* Shouldn't be here */
+   return -EINVAL;
+}

It will be nice if we declare the switch case numbers as macros (specific 
name)...

I don't see which macros: the values are just 2 booleans.


I am talking about 0x11, 0x10, 0x01 values.. We can give any understandable
names to those...?


--
Regards,
Varka Bhadram.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCHv2 1/4] ASoC: simple-card: add asoc_simple_card_fmt_master() to simplify the code.

2014-09-02 Thread Varka Bhadram

On 09/02/2014 02:56 PM, Xiubo Li wrote:

Signed-off-by: Xiubo Li 
---
  sound/soc/generic/simple-card.c | 61 -
  1 file changed, 29 insertions(+), 32 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 986d2c7..cad2b30 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -163,6 +163,26 @@ asoc_simple_card_sub_parse_of(struct device_node *np,
return 0;
  }
  
+static inline unsigned int

+asoc_simple_card_fmt_master(struct device_node *np,
+   struct device_node *bitclkmaster,
+   struct device_node *framemaster)
+{
+   switch (((np == bitclkmaster) << 4) | (np == framemaster)) {
+   case 0x11:
+   return SND_SOC_DAIFMT_CBS_CFS;
+   case 0x10:
+   return SND_SOC_DAIFMT_CBS_CFM;
+   case 0x01:
+   return SND_SOC_DAIFMT_CBM_CFS;
+   default:
+   return SND_SOC_DAIFMT_CBM_CFM;
+   }
+
+   /* Shouldn't be here */
+   return -EINVAL;
+}


It will be nice if we declare the switch case numbers as macros (specific 
name)...



--
Regards,
Varka Bhadram.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCHv2 1/4] ASoC: simple-card: add asoc_simple_card_fmt_master() to simplify the code.

2014-09-02 Thread Varka Bhadram

On 09/02/2014 02:56 PM, Xiubo Li wrote:

Signed-off-by: Xiubo Li li.xi...@freescale.com
---
  sound/soc/generic/simple-card.c | 61 -
  1 file changed, 29 insertions(+), 32 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 986d2c7..cad2b30 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -163,6 +163,26 @@ asoc_simple_card_sub_parse_of(struct device_node *np,
return 0;
  }
  
+static inline unsigned int

+asoc_simple_card_fmt_master(struct device_node *np,
+   struct device_node *bitclkmaster,
+   struct device_node *framemaster)
+{
+   switch (((np == bitclkmaster)  4) | (np == framemaster)) {
+   case 0x11:
+   return SND_SOC_DAIFMT_CBS_CFS;
+   case 0x10:
+   return SND_SOC_DAIFMT_CBS_CFM;
+   case 0x01:
+   return SND_SOC_DAIFMT_CBM_CFS;
+   default:
+   return SND_SOC_DAIFMT_CBM_CFM;
+   }
+
+   /* Shouldn't be here */
+   return -EINVAL;
+}


It will be nice if we declare the switch case numbers as macros (specific 
name)...



--
Regards,
Varka Bhadram.

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


Re: [PATCHv2 1/4] ASoC: simple-card: add asoc_simple_card_fmt_master() to simplify the code.

2014-09-02 Thread Varka Bhadram

On 09/02/2014 04:08 PM, Jean-Francois Moine wrote:

On Tue, 02 Sep 2014 15:51:41 +0530
Varka Bhadram varkabhad...@gmail.com wrote:


+   switch (((np == bitclkmaster)  4) | (np == framemaster)) {
+   case 0x11:
+   return SND_SOC_DAIFMT_CBS_CFS;
+   case 0x10:
+   return SND_SOC_DAIFMT_CBS_CFM;
+   case 0x01:
+   return SND_SOC_DAIFMT_CBM_CFS;
+   default:
+   return SND_SOC_DAIFMT_CBM_CFM;
+   }
+
+   /* Shouldn't be here */
+   return -EINVAL;
+}

It will be nice if we declare the switch case numbers as macros (specific 
name)...

I don't see which macros: the values are just 2 booleans.


I am talking about 0x11, 0x10, 0x01 values.. We can give any understandable
names to those...?


--
Regards,
Varka Bhadram.

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


Re: [PATCH v2 1/7] mfd: Add support for DA9150 combined charger & fuel-gauge device

2014-08-28 Thread Varka Bhadram

On 08/28/2014 04:18 PM, Adam Thomson wrote:

(...)


+static int da9150_probe(struct i2c_client *client,
+   const struct i2c_device_id *id)
+{
+   struct da9150 *da9150;
+   int ret;
+
+   da9150 = devm_kzalloc(>dev, sizeof(struct da9150), GFP_KERNEL);
+   if (da9150 == NULL)
+   return -ENOMEM;


da9150 = devm_kzalloc(>dev, sizeof(*da9150), GFP_KERNEL);
if (!da9150)
return -ENOMEM;


+   da9150->dev = >dev;
+   da9150->irq = client->irq;
+   i2c_set_clientdata(client, da9150);
+   dev_set_drvdata(da9150->dev, da9150);
+
+   da9150->regmap = devm_regmap_init_i2c(client, _regmap_config);
+   if (IS_ERR(da9150->regmap)) {
+   ret = PTR_ERR(da9150->regmap);
+   dev_err(da9150->dev, "Failed to allocate register map: %d\n",
+   ret);
+   return ret;
+   }
+
+   return da9150_device_init(da9150);
+}
+
+static int da9150_remove(struct i2c_client *client)
+{
+   struct da9150 *da9150 = i2c_get_clientdata(client);
+
+   da9150_device_exit(da9150);
+
+   return 0;
+}
+
+static void da9150_shutdown(struct i2c_client *client)
+{
+   struct da9150 *da9150 = i2c_get_clientdata(client);
+
+   da9150_device_shutdown(da9150);
+}
+
+static const struct i2c_device_id da9150_i2c_id[] = {
+   { "da9150", 0 },
+   { }
+};
+MODULE_DEVICE_TABLE(i2c, da9150_i2c_id);
+
+static const struct of_device_id da9150_of_match[] = {
+   { .compatible = "dlg,da9150", },
+   { }
+};
+


missed MODULE_DEVICE_TABLE(of, ...)   ?


+static struct i2c_driver da9150_driver = {
+   .driver = {
+   .name   = "da9150",
+   .owner  = THIS_MODULE,


No need to update this field...


+   .of_match_table = of_match_ptr(da9150_of_match),
+   },
+   .probe  = da9150_probe,
+   .remove = da9150_remove,
+   .shutdown   = da9150_shutdown,
+   .id_table   = da9150_i2c_id,
+};
+
+module_i2c_driver(da9150_driver);
+
+MODULE_DESCRIPTION("I2C Driver for DA9150");
+MODULE_AUTHOR("Adam Thomson 
--
Regards,
Varka Bhadram.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 1/7] mfd: Add support for DA9150 combined charger fuel-gauge device

2014-08-28 Thread Varka Bhadram

On 08/28/2014 04:18 PM, Adam Thomson wrote:

(...)


+static int da9150_probe(struct i2c_client *client,
+   const struct i2c_device_id *id)
+{
+   struct da9150 *da9150;
+   int ret;
+
+   da9150 = devm_kzalloc(client-dev, sizeof(struct da9150), GFP_KERNEL);
+   if (da9150 == NULL)
+   return -ENOMEM;


da9150 = devm_kzalloc(client-dev, sizeof(*da9150), GFP_KERNEL);
if (!da9150)
return -ENOMEM;


+   da9150-dev = client-dev;
+   da9150-irq = client-irq;
+   i2c_set_clientdata(client, da9150);
+   dev_set_drvdata(da9150-dev, da9150);
+
+   da9150-regmap = devm_regmap_init_i2c(client, da9150_regmap_config);
+   if (IS_ERR(da9150-regmap)) {
+   ret = PTR_ERR(da9150-regmap);
+   dev_err(da9150-dev, Failed to allocate register map: %d\n,
+   ret);
+   return ret;
+   }
+
+   return da9150_device_init(da9150);
+}
+
+static int da9150_remove(struct i2c_client *client)
+{
+   struct da9150 *da9150 = i2c_get_clientdata(client);
+
+   da9150_device_exit(da9150);
+
+   return 0;
+}
+
+static void da9150_shutdown(struct i2c_client *client)
+{
+   struct da9150 *da9150 = i2c_get_clientdata(client);
+
+   da9150_device_shutdown(da9150);
+}
+
+static const struct i2c_device_id da9150_i2c_id[] = {
+   { da9150, 0 },
+   { }
+};
+MODULE_DEVICE_TABLE(i2c, da9150_i2c_id);
+
+static const struct of_device_id da9150_of_match[] = {
+   { .compatible = dlg,da9150, },
+   { }
+};
+


missed MODULE_DEVICE_TABLE(of, ...)   ?


+static struct i2c_driver da9150_driver = {
+   .driver = {
+   .name   = da9150,
+   .owner  = THIS_MODULE,


No need to update this field...


+   .of_match_table = of_match_ptr(da9150_of_match),
+   },
+   .probe  = da9150_probe,
+   .remove = da9150_remove,
+   .shutdown   = da9150_shutdown,
+   .id_table   = da9150_i2c_id,
+};
+
+module_i2c_driver(da9150_driver);
+
+MODULE_DESCRIPTION(I2C Driver for DA9150);
+MODULE_AUTHOR(Adam Thomson adam.thomson.opensou...@diasemi.com);
+MODULE_LICENSE(GPL);


--
Regards,
Varka Bhadram.

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


  1   2   3   4   >