Re: [PATCH 3/4] fix module autoloading for ACPI enumerated devices

2014-01-16 Thread Zhang Rui
On Wed, 2014-01-15 at 17:08 +0200, Mika Westerberg wrote:
 On Tue, Jan 14, 2014 at 04:46:37PM +0800, Zhang Rui wrote:
  diff --git a/drivers/base/platform.c b/drivers/base/platform.c
  index 3a94b79..2f4aea2 100644
  --- a/drivers/base/platform.c
  +++ b/drivers/base/platform.c
  @@ -677,7 +677,13 @@ static ssize_t modalias_show(struct device *dev, 
  struct device_attribute *a,
   char *buf)
   {
  struct platform_device  *pdev = to_platform_device(dev);
  -   int len = snprintf(buf, PAGE_SIZE, platform:%s\n, pdev-name);
  +   int len;
  +
  +   len = acpi_device_modalias(dev, buf, PAGE_SIZE -1);
 
 Here you have PAGE_SIZE -1...
 
  +   if (len != -ENODEV)
  +   return len;
  +
  +   len = snprintf(buf, PAGE_SIZE, platform:%s\n, pdev-name);
   
  return (len = PAGE_SIZE) ? (PAGE_SIZE - 1) : len;
   }
  @@ -699,6 +705,10 @@ static int platform_uevent(struct device *dev, struct 
  kobj_uevent_env *env)
  if (rc != -ENODEV)
  return rc;
   
  +   rc = acpi_device_uevent_modalias(dev, env);
  +   if (rc != -ENODEV)
  +   return rc;
  +
  add_uevent_var(env, MODALIAS=%s%s, PLATFORM_MODULE_PREFIX,
  pdev-name);
  return 0;
  diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
  index d74c0b3..c4c5588 100644
  --- a/drivers/i2c/i2c-core.c
  +++ b/drivers/i2c/i2c-core.c
  @@ -104,6 +104,11 @@ static int i2c_device_match(struct device *dev, struct 
  device_driver *drv)
   static int i2c_device_uevent(struct device *dev, struct kobj_uevent_env 
  *env)
   {
  struct i2c_client   *client = to_i2c_client(dev);
  +   int rc;
  +
  +   rc = acpi_device_uevent_modalias(dev, env);
  +   if (rc != -ENODEV)
  +   return rc;
   
  if (add_uevent_var(env, MODALIAS=%s%s,
 I2C_MODULE_PREFIX, client-name))
  @@ -409,6 +414,12 @@ static ssize_t
   show_modalias(struct device *dev, struct device_attribute *attr, char *buf)
   {
  struct i2c_client *client = to_i2c_client(dev);
  +   int len;
  +
  +   len = acpi_device_modalias(dev, buf, PAGE_SIZE -1);
 
 and here
 
  +   if (len != -ENODEV)
  +   return len;
  +
  return sprintf(buf, %s%s\n, I2C_MODULE_PREFIX, client-name);
   }
   
  diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
  index 349ebba..ab70eda 100644
  --- a/drivers/spi/spi.c
  +++ b/drivers/spi/spi.c
  @@ -58,6 +58,11 @@ static ssize_t
   modalias_show(struct device *dev, struct device_attribute *a, char *buf)
   {
  const struct spi_device *spi = to_spi_device(dev);
  +   int len;
  +
  +   len = acpi_device_modalias(dev, buf, PAGE_SIZE);
 
 but here it is PAGE_SIZE.
 
good catch.

 Perhaps it should be PAGE_SIZE in all sites?

dev_attr_show() will give a warning message if modalias_show() returns
PAGE_SIZE, thus I'd prefer to use PAGE_SIZE - 1 for all sites.

thanks,
rui


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


Re: [PATCH repost] at91: dt: i2c: add a new compatibility string for the at91sam9261

2014-01-16 Thread Wolfram Sang
On Wed, Jan 15, 2014 at 02:17:13PM +0100, Jean-Jacques Hiblot wrote:
 Signed-off-by: Jean-Jacques Hiblot jjhib...@traphandler.com

Applied to for-next, thanks!



signature.asc
Description: Digital signature


Re: [PATCH V3] i2c: pnx: Use devm_*() functions

2014-01-16 Thread Wolfram Sang
On Tue, Jan 14, 2014 at 09:19:30AM +0900, Jingoo Han wrote:
 Use devm_*() functions to make cleanup paths simpler,
 and remove redundant return value check of platform_get_resource()
 because the value is checked by devm_ioremap_resource().
 
 Signed-off-by: Jingoo Han jg1@samsung.com

Applied to for-next, thanks!



signature.asc
Description: Digital signature


Re: [PATCH v2] drivers: i2c: silence a compile warning in i2c-s3c2410.c

2014-01-16 Thread Wolfram Sang
On Wed, Jan 15, 2014 at 10:42:42AM +0900, y...@samsung.com wrote:

Note that your email address is wrong here. I also fixed the description
to i2c: s3c2410: fix quirk usage for 64-bit which is more apropriate.

Other than that: Applied to for-next, thanks!



signature.asc
Description: Digital signature


Re: [lm-sensors] I2C support for AMD Hudson-1

2014-01-16 Thread Jean Delvare
Hi Christian,

On Thu, 9 Jan 2014 17:24:22 +0100, Christian Herzog wrote:
 sorry to bother you again, but this might save you some work: I just compiled
 3.13.0-rc7 on the apu board and i2c works out of the box. I'm pretty stumped
 as I'm pretty sure it didn't work OOTB on -rc3, but now it does.. Are you
 aware of any Hudson-1 specific changes recently?

I am not aware of anything related to Hudson-1. I don't even know the
PCI IDs for that device.

The git history tells that there was no change to the i2c-piix4 driver
since kernel version 3.12-rc1. This is when support for secondary SMBus
on AMD SB800 and AMD FCH chipsets was added. I think FCH and Hudson-2
are the same thing, not sure how Hudson-1 fits into the picture.

Are you certain that the kernel version change fixed it? A BIOS update
could have helped as well, or even just changing some BIOS settings.

Another possibility is that some PCI or architecture quirk was added
meanwhile. However a quick search did not reveal anything between
3.13-rc3 and 3.13-rc7.

If you are really sure that 3.13-rc3 didn't work and 3.13-rc7 does
work, and you really want to understand why, then you can bisect the
git kernel tree between both points and it'll point you to the commit
that fixed it.

As for me, if things work for you now, I see no point in investigating
further. As Wolfram already pointed out, your contribution came in a
format we can't do anything with. The patch is huge, reversed, based on
a source file which had indentation changes, mixes actual changes with
(mostly unjustified) white-space changes, etc. If you ever need to get
changes into the kernel, please follow the rules listed in
Documentation/SubmittingPatches, otherwise nobody will review your
work, no matter how needed you think it is.

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


Re: [PATCH 3/4] fix module autoloading for ACPI enumerated devices

2014-01-16 Thread Wolfram Sang

 diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
 index d74c0b3..c4c5588 100644
 --- a/drivers/i2c/i2c-core.c
 +++ b/drivers/i2c/i2c-core.c
 @@ -104,6 +104,11 @@ static int i2c_device_match(struct device *dev, struct 
 device_driver *drv)
  static int i2c_device_uevent(struct device *dev, struct kobj_uevent_env *env)
  {
   struct i2c_client   *client = to_i2c_client(dev);
 + int rc;
 +
 + rc = acpi_device_uevent_modalias(dev, env);
 + if (rc != -ENODEV)
 + return rc;
  
   if (add_uevent_var(env, MODALIAS=%s%s,
  I2C_MODULE_PREFIX, client-name))

I wonder why we don't have/need that with CONFIG_OF? Because probably
nobody is using modules with i2c devices there?



signature.asc
Description: Digital signature


Re: [PATCH 3/4] fix module autoloading for ACPI enumerated devices

2014-01-16 Thread Mark Brown
On Tue, Jan 14, 2014 at 04:46:37PM +0800, Zhang Rui wrote:
 ACPI enumerated devices has ACPI style _HID and _CID strings,
 all of these strings can be used for both driver loading and matching.
 
 Currently, in Platform, I2C and SPI bus, the ACPI style driver matching
 is supported by invoking acpi_driver_match_device() in bus .match() callback.
 But, the module autoloading is still broken.

Acked-by: Mark Brown broo...@linaro.org

modulo the PAGE_SIZE stuff Mika noted - unless this changes radically
please just assume I'm OK with it.


signature.asc
Description: Digital signature


Re: [PATCH 3/4] fix module autoloading for ACPI enumerated devices

2014-01-16 Thread Zhang Rui
On Thu, 2014-01-16 at 12:28 +, Mark Brown wrote:
 On Tue, Jan 14, 2014 at 04:46:37PM +0800, Zhang Rui wrote:
  ACPI enumerated devices has ACPI style _HID and _CID strings,
  all of these strings can be used for both driver loading and matching.
  
  Currently, in Platform, I2C and SPI bus, the ACPI style driver matching
  is supported by invoking acpi_driver_match_device() in bus .match() 
  callback.
  But, the module autoloading is still broken.
 
 Acked-by: Mark Brown broo...@linaro.org
 
 modulo the PAGE_SIZE stuff Mika noted - unless this changes radically
 please just assume I'm OK with it.

thanks.

-rui


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


Re: [PATCH 3/4] fix module autoloading for ACPI enumerated devices

2014-01-16 Thread Zhang Rui
On Thu, 2014-01-16 at 13:27 +0100, Wolfram Sang wrote:
  diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
  index d74c0b3..c4c5588 100644
  --- a/drivers/i2c/i2c-core.c
  +++ b/drivers/i2c/i2c-core.c
  @@ -104,6 +104,11 @@ static int i2c_device_match(struct device *dev, struct 
  device_driver *drv)
   static int i2c_device_uevent(struct device *dev, struct kobj_uevent_env 
  *env)
   {
  struct i2c_client   *client = to_i2c_client(dev);
  +   int rc;
  +
  +   rc = acpi_device_uevent_modalias(dev, env);
  +   if (rc != -ENODEV)
  +   return rc;
   
  if (add_uevent_var(env, MODALIAS=%s%s,
 I2C_MODULE_PREFIX, client-name))
 
 I wonder why we don't have/need that with CONFIG_OF? Because probably
 nobody is using modules with i2c devices there?
 
This seems a gap to me but I'm not 100% sure.
I saw Grant Likely introduced the OF style MODALIAS to platform bus, and
OF style registration/binding to i2c bus, maybe he has an answer for
this.

thanks,
rui


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


Re: [PATCH v2 2/2] i2c: New bus driver for the QUP I2C controller

2014-01-16 Thread Ivan T. Ivanov

Hi,

On Wed, 2014-01-15 at 08:46 -0800, Stephen Boyd wrote: 
 On 01/13, Bjorn Andersson wrote:
  +/*
  + * QUP driver for Qualcomm MSM platforms
  + *
  + */
 
 This comment seems redundant, we know what file we're looking at.
 
  +
  +struct qup_i2c_dev {
  +   struct device   *dev;
  +   void __iomem*base;
  +   struct pinctrl  *pctrl;
 
 This is unused.
 
  +   int irq;
  +   struct clk  *clk;
  +   struct clk  *pclk;
  +   struct i2c_adapter  adap;
  +
  +   int clk_freq;
 
 This is only ever used in probe, so why do we need to store it
 away?
 
  +   int clk_ctl;
  +   int one_bit_t;
  +   int out_fifo_sz;
  +   int in_fifo_sz;
  +   int out_blk_sz;
  +   int in_blk_sz;
  +   unsigned long   xfer_time;
  +   unsigned long   wait_idle;
  +
  +   struct i2c_msg  *msg;
  +   /* Current possion in user message buffer */
 
 s/possion/position/?
 
  +   int pos;
  +   /* Keep number of bytes left to be transmitted */
  +   int cnt;
  +   /* I2C protocol errors */
  +   u32 bus_err;
  +   /* QUP core errors */
  +   u32 qup_err;
  +   /*
  +* maximum bytes that could be send (per iterration). could be
 
 s/iterration/iteration/?
 
  +* equal of fifo size or block size (in block mode)
  +*/
  +   int chunk_sz;
  +   struct completion   xfer;
  +};
  +
  +static irqreturn_t qup_i2c_interrupt(int irq, void *dev)
  +{
  +   struct qup_i2c_dev *qup = dev;
  +   u32 bus_err;
  +   u32 qup_err;
  +   u32 opflags;
  +
 [...]
  +
  +   if (opflags  QUP_OUT_SVC_FLAG)
  +   writel(QUP_OUT_SVC_FLAG, qup-base + QUP_OPERATIONAL);
  +
  +   if (!(qup-msg-flags == I2C_M_RD))
 
 Should this be?
 
   if (!(qup-msg-flags  I2C_M_RD))
 
 Otherwise it should be
 
   if (qup-msg-flags != I2C_M_RD)
 

This check is actually broken. Intention was that if this is read
transaction and there is no QUP_MX_INPUT_DONE or QUP_IN_SVC_FLAG
to exit without wakeup transfer thread. As is it now it will never
complete write transactions.

Regards,
Ivan

  +   return IRQ_HANDLED;
  +
  +   if ((opflags  QUP_MX_INPUT_DONE) || (opflags  QUP_IN_SVC_FLAG))
  +   writel(QUP_IN_SVC_FLAG, qup-base + QUP_OPERATIONAL);
  +
  +done:
  +   qup-qup_err = qup_err;
  +   qup-bus_err = bus_err;
  +   complete(qup-xfer);
  +   return IRQ_HANDLED;
  +}
  +


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


Re: [PATCH] i2c: Re-instate body of i2c_parent_is_i2c_adapter()

2014-01-16 Thread Stephen Warren
On 01/14/2014 09:12 AM, Wolfram Sang wrote:
 On Mon, Jan 13, 2014 at 02:29:04PM -0700, Stephen Warren wrote:
 From: Stephen Warren swar...@nvidia.com

 The body of i2c_parent_is_i2c_adapter() is currently guarded by
 CONFIG_I2C_MUX instead.
 
 This paragraph sounds strange to me. I'll update it a little. After that
 I'll go looking for a brown paper bag...
 
 Among potentially other problems, this resulted in i2c_lock_adapter()
 only locking I2C mux child adapters, and not the parent adapter. In
 turn, this could allow inter-mingling of mux child selection and I2C
 transactions, which could result in I2C transactions being directed to
 the wrong I2C bus, and possibly even switching between busses in the
 middle of a transaction.

 One concrete issue caused by this bug was corrupted HDMI EDID reads
 during boot on the NVIDIA Tegra Seaboard system, although this only
 became apparent in recent linux-next, when the boot timing was changed
 just enough to trigger the race condition.

 Fixes: 3923172b3d70 (i2c: reduce parent checking to a NOOP in non-I2C_MUX 
 case)
 Cc: Phil Carmody phil.carm...@partner.samsung.com
 Cc: sta...@vger.kernel.org
 Signed-off-by: Stephen Warren swar...@nvidia.com
 
 Applied to for-current, thanks for catching this one!

I do see this in for-current, but it looks like that branch isn't part
of linux-next. Should it be, or perhaps for-current should be merged
into for-next?
--
To unsubscribe from this list: send the line unsubscribe linux-i2c in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] i2c: Re-instate body of i2c_parent_is_i2c_adapter()

2014-01-16 Thread Wolfram Sang
 I do see this in for-current, but it looks like that branch isn't part
 of linux-next. Should it be, or perhaps for-current should be merged
 into for-next?

It is upstream already.



signature.asc
Description: Digital signature


Re: [PATCH 3/4] fix module autoloading for ACPI enumerated devices

2014-01-16 Thread Wolfram Sang
On Thu, Jan 16, 2014 at 12:28:19PM +, Mark Brown wrote:
 On Tue, Jan 14, 2014 at 04:46:37PM +0800, Zhang Rui wrote:
  ACPI enumerated devices has ACPI style _HID and _CID strings,
  all of these strings can be used for both driver loading and matching.
  
  Currently, in Platform, I2C and SPI bus, the ACPI style driver matching
  is supported by invoking acpi_driver_match_device() in bus .match() 
  callback.
  But, the module autoloading is still broken.
 
 Acked-by: Mark Brown broo...@linaro.org
 
 modulo the PAGE_SIZE stuff Mika noted - unless this changes radically
 please just assume I'm OK with it.

Ditto

Acked-by: Wolfram Sang w...@the-dreams.de



signature.asc
Description: Digital signature


Re: [PATCH 2/2] i2c designware add support of I2C standard mode

2014-01-16 Thread Wolfram Sang
On Tue, Oct 08, 2013 at 05:00:55PM +0200, Romain Baeriswyl wrote:
 Some legacy devices support ony I2C standard mode at 100kHz. 
 This patch allows to select the standard mode through the DTS 
 with the use of the existing clock-frequency parameter.
 
 When clock-frequency parameter is not set, the fast mode is selected.
 Only when the parameter is set at 10, the standard mode is selected.
 
 Signed-off-by: Romain Baeriswyl romai...@abilis.com
 Reviewed-by: Christian Ruppert christian.rupp...@abilis.com

Pretty much OK. One change needed, though:

 ---
  .../devicetree/bindings/i2c/i2c-designware.txt |1 +
  drivers/i2c/busses/i2c-designware-platdrv.c|   17 +++--
  2 files changed, 16 insertions(+), 2 deletions(-)
 
 diff --git a/Documentation/devicetree/bindings/i2c/i2c-designware.txt 
 b/Documentation/devicetree/bindings/i2c/i2c-designware.txt
 index 5199b0c..16d0bef 100644
 --- a/Documentation/devicetree/bindings/i2c/i2c-designware.txt
 +++ b/Documentation/devicetree/bindings/i2c/i2c-designware.txt
 @@ -9,6 +9,7 @@ Required properties :
  Recommended properties :
  
   - clock-frequency : desired I2C bus clock frequency in Hz.
 +   Only standard mode at 100kHz and fast mode at 400kHz are supported.

This should not go the bindings doc, since this is a linux specific
detail. It should go...

 + if (clk_freq != 10  clk_freq != 40)
 + return -EINVAL;

... here as an dev_err message Only x and y supported.

Rest looks good, thanks!



signature.asc
Description: Digital signature


Re: [PATCH 1/2] i2c designware make SCL and SDA falling time configurable

2014-01-16 Thread Wolfram Sang

 You can also use the gcc-ism, which is a bit more concise:
 
  sda_falling_time = dev-sda_falling_time ?: 300;
 
 +1

ditto



signature.asc
Description: Digital signature


Re: [PATCH 3/4] fix module autoloading for ACPI enumerated devices

2014-01-16 Thread Mark Brown
On Thu, Jan 16, 2014 at 09:05:09PM +0800, Zhang Rui wrote:
 On Thu, 2014-01-16 at 13:27 +0100, Wolfram Sang wrote:

  I wonder why we don't have/need that with CONFIG_OF? Because probably
  nobody is using modules with i2c devices there?

 This seems a gap to me but I'm not 100% sure.
 I saw Grant Likely introduced the OF style MODALIAS to platform bus, and
 OF style registration/binding to i2c bus, maybe he has an answer for
 this.

This is needed for ACPI because we rewrite the device names to give us
stable names.  With OF for I2C and SPI nothing bus specific is done that 
affects this stuff so the default behaviour works.


signature.asc
Description: Digital signature


Re: [PATCH 2/2] i2c-designware-pci: Index Haswell ULT bus names from 0

2014-01-16 Thread Wolfram Sang

 Our devices and our platforms have some other requirements which
 turned me away from using i2c_register_board_info.

Okay, so I'll drop these patches.



signature.asc
Description: Digital signature


Re: [PATCH 4/4] OF: introduce OF style 'modalias' support for platform bus.

2014-01-16 Thread Rob Herring
On Thu, Jan 16, 2014 at 1:04 AM, Zhang, Rui rui.zh...@intel.com wrote:


 -Original Message-
 From: Rob Herring [mailto:robherri...@gmail.com]
 Sent: Wednesday, January 15, 2014 9:45 PM
 To: Zhang, Rui
 Cc: linux-ker...@vger.kernel.org; linux-a...@vger.kernel.org; linux-
 i...@vger.kernel.org; linux-...@vger.kernel.org; w...@the-dreams.de; Mark
 Brown; Greg Kroah-Hartman; Wysocki, Rafael J; Grant Likely; Rob Herring;
 jarkko.nik...@linux.intel.com; mika.westerb...@linux.intel.com;
 devicet...@vger.kernel.org
 Subject: Re: [PATCH 4/4] OF: introduce OF style 'modalias' support for
 platform bus.
 Importance: High

 On Tue, Jan 14, 2014 at 2:46 AM, Zhang Rui rui.zh...@intel.com wrote:
  Fix a problem that, the platform bus supports the OF style modalias
 in
  .uevent() call, but not in its device 'modalias' sysfs attribute.
 
  cc: devicet...@vger.kernel.org
  Signed-off-by: Zhang Rui rui.zh...@intel.com

 Acked-by: Rob Herring r...@kernel.org

 As there doesn't appear any dependency with the rest of this series, I
 can take this.

 Thanks.


Looks like there is actually a dependency in modalias_show, and the
comment about PAGE_SIZE would apply here too I think. So the whole
series should be taken together.

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


Re: [PATCH v2 1/2] i2c: qup: Add device tree bindings information

2014-01-16 Thread Bjorn Andersson
On Tue 14 Jan 00:57 PST 2014, Ivan T. Ivanov wrote:

 
 Thanks Bjorn, 
 
 I have prepared second version, but never send it out :-).
 One thing suggested by Mark was missed in this version.

Yeah, Mattew told me you we're assigned to other things and asked me to send
out an update as I had gotten it to work on our boards.

I did modify the wording of most of these to match how it is written in the
other Qualcomm definitions.

@Mark, would you rather have me change this to your suggested wording?

 
 
 On Mon, 2014-01-13 at 16:30 -0800, Bjorn Andersson wrote: 
  From: Ivan T. Ivanov iiva...@mm-sol.com
  
[snip]
  + - clocks: Should contain the core clock and the AHB clock.
 
 + - clocks: a list of phandle + clock-specifier pairs for each entry in
 +   clock-names
 

This is in line with how it's written in other drivers, so if the DT
maintainers doesn't disagree I would like to keep phandles out of the
description. This specific line is a verbatime copy of the msm_serial
documentation (same block, different mode)...

  + - clock-names: Should be core for the core clock and iface for the
  +AHB clock.
  +
  + - #address-cells: Should be 1 Address cells for i2c device address
  + - #size-cells: Should be 0 as i2c addresses have no size component
  +
  +Optional properties:
  + - clock-frequency: Should specify the desired i2c bus clock frequency in 
  Hz,
  +default is 100kHz if omitted.
  +
  +Child nodes should conform to i2c bus binding.
  +
  +Example:
  +
  + i2c2: i2c@f9924000 {
  +   compatible = qcom,i2c-qup;
  +   reg = 0xf9924000 0x1000;
  +   interrupts = 0 96 0;
  +
  +   clocks = gcc_blsp1_qup2_i2c_apps_clk, gcc_blsp1_ahb_clk;
 
 In the light of the latest patches from Stephen, this could be 
 
 + clocks = gcc GCC_BLSP1_QUP2_I2C_APPS_CLK, gcc GCC_BLSP1_AHB_CLK;

Yes, that's exactly what I have in my dts. However as this is just an example
I didn't feel it was worth tainting the documentation with all those capital
letters ;)
So unless DT maintainers disagree I would like to just keep it as an example.

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


Re: [PATCH 3/4] fix module autoloading for ACPI enumerated devices

2014-01-16 Thread Rafael J. Wysocki
On Thursday, January 16, 2014 04:04:35 PM Zhang Rui wrote:
 On Wed, 2014-01-15 at 17:08 +0200, Mika Westerberg wrote:
  On Tue, Jan 14, 2014 at 04:46:37PM +0800, Zhang Rui wrote:
   diff --git a/drivers/base/platform.c b/drivers/base/platform.c
   index 3a94b79..2f4aea2 100644
   --- a/drivers/base/platform.c
   +++ b/drivers/base/platform.c
   @@ -677,7 +677,13 @@ static ssize_t modalias_show(struct device *dev, 
   struct device_attribute *a,
  char *buf)
{
 struct platform_device  *pdev = to_platform_device(dev);
   - int len = snprintf(buf, PAGE_SIZE, platform:%s\n, pdev-name);
   + int len;
   +
   + len = acpi_device_modalias(dev, buf, PAGE_SIZE -1);
  
  Here you have PAGE_SIZE -1...
  
   + if (len != -ENODEV)
   + return len;
   +
   + len = snprintf(buf, PAGE_SIZE, platform:%s\n, pdev-name);

 return (len = PAGE_SIZE) ? (PAGE_SIZE - 1) : len;
}
   @@ -699,6 +705,10 @@ static int platform_uevent(struct device *dev, 
   struct kobj_uevent_env *env)
 if (rc != -ENODEV)
 return rc;

   + rc = acpi_device_uevent_modalias(dev, env);
   + if (rc != -ENODEV)
   + return rc;
   +
 add_uevent_var(env, MODALIAS=%s%s, PLATFORM_MODULE_PREFIX,
 pdev-name);
 return 0;
   diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
   index d74c0b3..c4c5588 100644
   --- a/drivers/i2c/i2c-core.c
   +++ b/drivers/i2c/i2c-core.c
   @@ -104,6 +104,11 @@ static int i2c_device_match(struct device *dev, 
   struct device_driver *drv)
static int i2c_device_uevent(struct device *dev, struct kobj_uevent_env 
   *env)
{
 struct i2c_client   *client = to_i2c_client(dev);
   + int rc;
   +
   + rc = acpi_device_uevent_modalias(dev, env);
   + if (rc != -ENODEV)
   + return rc;

 if (add_uevent_var(env, MODALIAS=%s%s,
I2C_MODULE_PREFIX, client-name))
   @@ -409,6 +414,12 @@ static ssize_t
show_modalias(struct device *dev, struct device_attribute *attr, char 
   *buf)
{
 struct i2c_client *client = to_i2c_client(dev);
   + int len;
   +
   + len = acpi_device_modalias(dev, buf, PAGE_SIZE -1);
  
  and here
  
   + if (len != -ENODEV)
   + return len;
   +
 return sprintf(buf, %s%s\n, I2C_MODULE_PREFIX, client-name);
}

   diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
   index 349ebba..ab70eda 100644
   --- a/drivers/spi/spi.c
   +++ b/drivers/spi/spi.c
   @@ -58,6 +58,11 @@ static ssize_t
modalias_show(struct device *dev, struct device_attribute *a, char *buf)
{
 const struct spi_device *spi = to_spi_device(dev);
   + int len;
   +
   + len = acpi_device_modalias(dev, buf, PAGE_SIZE);
  
  but here it is PAGE_SIZE.
  
 good catch.
 
  Perhaps it should be PAGE_SIZE in all sites?
 
 dev_attr_show() will give a warning message if modalias_show() returns
 PAGE_SIZE, thus I'd prefer to use PAGE_SIZE - 1 for all sites.

So I changed the PAGE_SIZE to PAGE_SIZE - 1 in the last instance and queued
up the whole series for 3.14 in linux-pm.git/linux-next.  Please have a look
at that and let me know if there's anything wrong with it.

Thanks!

-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
--
To unsubscribe from this list: send the line unsubscribe linux-i2c in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/4] fix module autoloading for ACPI enumerated devices

2014-01-16 Thread Zhang Rui
On Fri, 2014-01-17 at 02:28 +0100, Rafael J. Wysocki wrote:
 On Thursday, January 16, 2014 04:04:35 PM Zhang Rui wrote:
  On Wed, 2014-01-15 at 17:08 +0200, Mika Westerberg wrote:
   On Tue, Jan 14, 2014 at 04:46:37PM +0800, Zhang Rui wrote:
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index 3a94b79..2f4aea2 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -677,7 +677,13 @@ static ssize_t modalias_show(struct device *dev, 
struct device_attribute *a,
 char *buf)
 {
struct platform_device  *pdev = to_platform_device(dev);
-   int len = snprintf(buf, PAGE_SIZE, platform:%s\n, pdev-name);
+   int len;
+
+   len = acpi_device_modalias(dev, buf, PAGE_SIZE -1);
   
   Here you have PAGE_SIZE -1...
   
+   if (len != -ENODEV)
+   return len;
+
+   len = snprintf(buf, PAGE_SIZE, platform:%s\n, pdev-name);
 
return (len = PAGE_SIZE) ? (PAGE_SIZE - 1) : len;
 }
@@ -699,6 +705,10 @@ static int platform_uevent(struct device *dev, 
struct kobj_uevent_env *env)
if (rc != -ENODEV)
return rc;
 
+   rc = acpi_device_uevent_modalias(dev, env);
+   if (rc != -ENODEV)
+   return rc;
+
add_uevent_var(env, MODALIAS=%s%s, PLATFORM_MODULE_PREFIX,
pdev-name);
return 0;
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index d74c0b3..c4c5588 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -104,6 +104,11 @@ static int i2c_device_match(struct device *dev, 
struct device_driver *drv)
 static int i2c_device_uevent(struct device *dev, struct 
kobj_uevent_env *env)
 {
struct i2c_client   *client = to_i2c_client(dev);
+   int rc;
+
+   rc = acpi_device_uevent_modalias(dev, env);
+   if (rc != -ENODEV)
+   return rc;
 
if (add_uevent_var(env, MODALIAS=%s%s,
   I2C_MODULE_PREFIX, client-name))
@@ -409,6 +414,12 @@ static ssize_t
 show_modalias(struct device *dev, struct device_attribute *attr, char 
*buf)
 {
struct i2c_client *client = to_i2c_client(dev);
+   int len;
+
+   len = acpi_device_modalias(dev, buf, PAGE_SIZE -1);
   
   and here
   
+   if (len != -ENODEV)
+   return len;
+
return sprintf(buf, %s%s\n, I2C_MODULE_PREFIX, client-name);
 }
 
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 349ebba..ab70eda 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -58,6 +58,11 @@ static ssize_t
 modalias_show(struct device *dev, struct device_attribute *a, char 
*buf)
 {
const struct spi_device *spi = to_spi_device(dev);
+   int len;
+
+   len = acpi_device_modalias(dev, buf, PAGE_SIZE);
   
   but here it is PAGE_SIZE.
   
  good catch.
  
   Perhaps it should be PAGE_SIZE in all sites?
  
  dev_attr_show() will give a warning message if modalias_show() returns
  PAGE_SIZE, thus I'd prefer to use PAGE_SIZE - 1 for all sites.
 
 So I changed the PAGE_SIZE to PAGE_SIZE - 1 in the last instance and queued
 up the whole series for 3.14 in linux-pm.git/linux-next.  Please have a look
 at that and let me know if there's anything wrong with it.
 
the change looks okay to me.

thanks,
rui
 Thanks!
 


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


Re: [lm-sensors] I2C support for AMD Hudson-1

2014-01-16 Thread Christian Herzog
Dear Jean,

thanks for your reply.

 The git history tells that there was no change to the i2c-piix4 driver
 since kernel version 3.12-rc1. This is when support for secondary SMBus
 on AMD SB800 and AMD FCH chipsets was added. I think FCH and Hudson-2
 are the same thing, not sure how Hudson-1 fits into the picture.
as far as I understand it, both Hudsons are FCHs in AMD speak.
It is very reasonable to assume that indeed 3.12-rc1 did add Hudson-1
support if that's when secondary SMBus support was introduced. I think it
was mainly this 2nd channel that was missing in the 'old' driver.

 Are you certain that the kernel version change fixed it? A BIOS update
 could have helped as well, or even just changing some BIOS settings.
nope, since the apu board has a very minimal BIOS and I didn't do anything in
this regard.

 If you are really sure that 3.13-rc3 didn't work and 3.13-rc7 does
 work, and you really want to understand why, then you can bisect the
 git kernel tree between both points and it'll point you to the commit
 that fixed it.
I thought so, but with the above it is very likely that it started working as
of 3.12-rc1 and I somehow missed it in 3.13-rc3. Unfortunately I can't check
now since the board is being used elsewhere.

 As for me, if things work for you now, I see no point in investigating
 further. As Wolfram already pointed out, your contribution came in a
I second this pragmatic approach. Goal was to add support and support we have.


 format we can't do anything with. The patch is huge, reversed, based on
 a source file which had indentation changes, mixes actual changes with
 (mostly unjustified) white-space changes, etc. If you ever need to get
 changes into the kernel, please follow the rules listed in
 Documentation/SubmittingPatches, otherwise nobody will review your
 work, no matter how needed you think it is.
I apologize. As stated before, I'm not the author of the patch and simply felt
not comfortable enough in the code to clean it up more than just make it
compile on a new kernel. Next time I'll try harder.

thanks for you work, we have support and are happy. I'll inform the author of
the patch.

cheers,
-Christian


-- 
Dr. Christian Herzog her...@phys.ethz.ch  support: +41 44 633 26 68
IT Services Group, HPT H 8voice: +41 44 633 39 50
Department of Physics, ETH Zurich   
8093 Zurich, Switzerland http://nic.phys.ethz.ch/
--
To unsubscribe from this list: send the line unsubscribe linux-i2c in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/4] fix module autoloading for ACPI enumerated devices

2014-01-16 Thread Jarkko Nikula

On 01/16/2014 09:46 PM, Mark Brown wrote:

On Thu, Jan 16, 2014 at 09:05:09PM +0800, Zhang Rui wrote:

On Thu, 2014-01-16 at 13:27 +0100, Wolfram Sang wrote:
This seems a gap to me but I'm not 100% sure.
I saw Grant Likely introduced the OF style MODALIAS to platform bus, and
OF style registration/binding to i2c bus, maybe he has an answer for
this.

This is needed for ACPI because we rewrite the device names to give us
stable names.  With OF for I2C and SPI nothing bus specific is done that
affects this stuff so the default behaviour works.
Sidenote: actually this modalias/module loading issue is different and 
not related to stable ACPI i2c/spi slave device names.


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


Re: [PATCH v2 1/2] i2c: qup: Add device tree bindings information

2014-01-16 Thread Ivan T. Ivanov

Hi, 

On Thu, 2014-01-16 at 15:20 -0800, Bjorn Andersson wrote: 
 On Tue 14 Jan 00:57 PST 2014, Ivan T. Ivanov wrote:
 
  
  Thanks Bjorn, 
  
  I have prepared second version, but never send it out :-).
  One thing suggested by Mark was missed in this version.
 
 Yeah, Mattew told me you we're assigned to other things and asked me to send
 out an update as I had gotten it to work on our boards.
 
 I did modify the wording of most of these to match how it is written in the
 other Qualcomm definitions.
 
 @Mark, would you rather have me change this to your suggested wording?
 
  
  
  On Mon, 2014-01-13 at 16:30 -0800, Bjorn Andersson wrote: 
   From: Ivan T. Ivanov iiva...@mm-sol.com
   
 [snip]
   + - clocks: Should contain the core clock and the AHB clock.
  
  + - clocks: a list of phandle + clock-specifier pairs for each entry in
  +   clock-names
  
 
 This is in line with how it's written in other drivers, so if the DT
 maintainers doesn't disagree I would like to keep phandles out of the
 description. This specific line is a verbatime copy of the msm_serial
 documentation (same block, different mode)...
 
   + - clock-names: Should be core for the core clock and iface for the
   +AHB clock.
   +
   + - #address-cells: Should be 1 Address cells for i2c device address
   + - #size-cells: Should be 0 as i2c addresses have no size component
   +
   +Optional properties:
   + - clock-frequency: Should specify the desired i2c bus clock frequency 
   in Hz,
   +default is 100kHz if omitted.
   +
   +Child nodes should conform to i2c bus binding.
   +
   +Example:
   +
   + i2c2: i2c@f9924000 {
   + compatible = qcom,i2c-qup;
   + reg = 0xf9924000 0x1000;
   + interrupts = 0 96 0;
   +
   + clocks = gcc_blsp1_qup2_i2c_apps_clk, gcc_blsp1_ahb_clk;
  
  In the light of the latest patches from Stephen, this could be 
  
  +   clocks = gcc GCC_BLSP1_QUP2_I2C_APPS_CLK, gcc GCC_BLSP1_AHB_CLK;
 
 Yes, that's exactly what I have in my dts. However as this is just an example
 I didn't feel it was worth tainting the documentation with all those capital
 letters ;)
 So unless DT maintainers disagree I would like to just keep it as an example.

Until, we get some meaningful board DTS files for Qualcomm platforms, it
is easy for people which will like to test or use drivers to just copy
and paste these definitions.

Regards,
Ivan

 
 Regards,
 Bjorn
 
 ___
 linux-arm-kernel mailing list
 linux-arm-ker...@lists.infradead.org
 http://lists.infradead.org/mailman/listinfo/linux-arm-kernel


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