Re: [PATCH v7 2/3] DMA: Freescale: Add new 8-channel DMA engine device tree nodes
On 08/23/2013 11:17 AM, Hongbo Zhang wrote: On 08/22/2013 07:16 AM, Stephen Warren wrote: On 08/21/2013 05:00 PM, Scott Wood wrote: On Wed, 2013-08-21 at 16:40 -0600, Stephen Warren wrote: On 07/29/2013 04:49 AM, hongbo.zh...@freescale.com wrote: +- reg : +- interrupts: IRQ> s/interrupts/specifier/ Do you mean s/interrupt mapping/interrupt specifier/? And probably s/registers mapping/register specifier/ as well. Yup. OK, I will update these descriptions. Since Scott has clarified all the doubts, and no further comment till now, so my next iteration will include this s/mapping/specifier only. I will sent it out this Tuesday, if there is still any comment/doubt, please let me know. -- 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 2/3] DMA: Freescale: Add new 8-channel DMA engine device tree nodes
On 08/23/2013 11:17 AM, Hongbo Zhang wrote: On 08/22/2013 07:16 AM, Stephen Warren wrote: On 08/21/2013 05:00 PM, Scott Wood wrote: On Wed, 2013-08-21 at 16:40 -0600, Stephen Warren wrote: On 07/29/2013 04:49 AM, hongbo.zh...@freescale.com wrote: +- reg : registers mapping for channel +- interrupts: interrupt mapping for DMA channel IRQ s/interrupts/specifier/ Do you mean s/interrupt mapping/interrupt specifier/? And probably s/registers mapping/register specifier/ as well. Yup. OK, I will update these descriptions. Since Scott has clarified all the doubts, and no further comment till now, so my next iteration will include this s/mapping/specifier only. I will sent it out this Tuesday, if there is still any comment/doubt, please let me know. -- 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 2/3] DMA: Freescale: Add new 8-channel DMA engine device tree nodes
On 08/22/2013 07:16 AM, Stephen Warren wrote: On 08/21/2013 05:00 PM, Scott Wood wrote: On Wed, 2013-08-21 at 16:40 -0600, Stephen Warren wrote: On 07/29/2013 04:49 AM, hongbo.zh...@freescale.com wrote: +- reg : +- interrupts: s/interrupts/specifier/ Do you mean s/interrupt mapping/interrupt specifier/? And probably s/registers mapping/register specifier/ as well. Yup. OK, I will update these descriptions. -- 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 2/3] DMA: Freescale: Add new 8-channel DMA engine device tree nodes
On 08/22/2013 07:16 AM, Stephen Warren wrote: On 08/21/2013 05:00 PM, Scott Wood wrote: On Wed, 2013-08-21 at 16:40 -0600, Stephen Warren wrote: On 07/29/2013 04:49 AM, hongbo.zh...@freescale.com wrote: +- reg : registers mapping for channel +- interrupts: interrupt mapping for DMA channel IRQ s/interrupts/specifier/ Do you mean s/interrupt mapping/interrupt specifier/? And probably s/registers mapping/register specifier/ as well. Yup. OK, I will update these descriptions. -- 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] DMA: Freescale: Add support for 8-channel DMA engine
Hi DT maintainers, Rob Herring, Pawel Moll, Mark Rutland, Stephen Warren, Ian Campbell, could you please have a look at [1/3] and [2/3] of these patch set. These patches have been fully reviewed by Scott Wood, and the DMA maintainer Vinod needs a Acted-by: from DT maintainers. Thanks. On 08/20/2013 04:15 PM, Vinod Koul wrote: On Tue, Aug 20, 2013 at 04:33:46PM +0800, Hongbo Zhang wrote: On 07/29/2013 06:59 PM, Vinod Koul wrote: On Mon, Jul 29, 2013 at 06:49:01PM +0800, hongbo.zh...@freescale.com wrote: From: Hongbo Zhang Hi Vinod, Dan, Scott and Leo, please have a look at these V7 patches. The dma relates changes look okay to me. I need someone to review and ACK the DT bindings. ~Vinod Vinod, Are you using this tree? http://git.infradead.org/users/vkoul/slave-dma.git Yes Did you merge these patches? No As I said I would like someone who know DT and dma binding to ack them. I see devicetree ML has been cced, can Arnd or someone else review these... ~Vinod -- 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] DMA: Freescale: Add support for 8-channel DMA engine
Hi DT maintainers, Rob Herring, Pawel Moll, Mark Rutland, Stephen Warren, Ian Campbell, could you please have a look at [1/3] and [2/3] of these patch set. These patches have been fully reviewed by Scott Wood, and the DMA maintainer Vinod needs a Acted-by: from DT maintainers. Thanks. On 08/20/2013 04:15 PM, Vinod Koul wrote: On Tue, Aug 20, 2013 at 04:33:46PM +0800, Hongbo Zhang wrote: On 07/29/2013 06:59 PM, Vinod Koul wrote: On Mon, Jul 29, 2013 at 06:49:01PM +0800, hongbo.zh...@freescale.com wrote: From: Hongbo Zhang hongbo.zh...@freescale.com Hi Vinod, Dan, Scott and Leo, please have a look at these V7 patches. The dma relates changes look okay to me. I need someone to review and ACK the DT bindings. ~Vinod Vinod, Are you using this tree? http://git.infradead.org/users/vkoul/slave-dma.git Yes Did you merge these patches? No As I said I would like someone who know DT and dma binding to ack them. I see devicetree ML has been cced, can Arnd or someone else review these... ~Vinod -- 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] DMA: Freescale: Add support for 8-channel DMA engine
On 07/29/2013 06:59 PM, Vinod Koul wrote: On Mon, Jul 29, 2013 at 06:49:01PM +0800, hongbo.zh...@freescale.com wrote: From: Hongbo Zhang Hi Vinod, Dan, Scott and Leo, please have a look at these V7 patches. The dma relates changes look okay to me. I need someone to review and ACK the DT bindings. ~Vinod Vinod, Are you using this tree? http://git.infradead.org/users/vkoul/slave-dma.git Did you merge these patches? Thanks. Freescale QorIQ T4 and B4 introduce new 8-channel DMA engines, this patch set adds support this DMA engine. V6->V7 changes: - only remove unnecessary "CHIP-dma" explanations in [1/3] V5->V6 changes: - minor updates of descriptions in binding document and Kconfig - remove [4/4], that should be another patch in future V4->V5 changes: - update description in the dt binding document, to make it more resonable - add new patch [4/4] to eliminate a compiling warning which already exists for a long time V3->V4 changes: - introduce new patch [1/3] to revise the legacy dma binding document - and then add new paragraph to describe new dt node binding in [2/3] - rebase to latest kernel v3.11-rc1 V2->V3 changes: - edit Documentation/devicetree/bindings/powerpc/fsl/dma.txt - edit text string in Kconfig and the driver files, using "elo series" to mention all the current "elo*" V1->V2 changes: - removed the codes handling the register dgsr1, since it isn't used currently - renamed the DMA DT compatible to "fsl,elo3-dma" - renamed the new dts files to "elo3-dma-.dtsi" Hongbo Zhang (3): DMA: Freescale: revise device tree binding document DMA: Freescale: Add new 8-channel DMA engine device tree nodes DMA: Freescale: update driver to support 8-channel DMA engine .../devicetree/bindings/powerpc/fsl/dma.txt| 114 +++- arch/powerpc/boot/dts/fsl/b4si-post.dtsi |4 +- arch/powerpc/boot/dts/fsl/elo3-dma-0.dtsi | 81 ++ arch/powerpc/boot/dts/fsl/elo3-dma-1.dtsi | 81 ++ arch/powerpc/boot/dts/fsl/t4240si-post.dtsi|4 +- drivers/dma/Kconfig|9 +- drivers/dma/fsldma.c |9 +- drivers/dma/fsldma.h |2 +- 8 files changed, 264 insertions(+), 40 deletions(-) create mode 100644 arch/powerpc/boot/dts/fsl/elo3-dma-0.dtsi create mode 100644 arch/powerpc/boot/dts/fsl/elo3-dma-1.dtsi -- 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: [PATCH v7 0/3] DMA: Freescale: Add support for 8-channel DMA engine
On 07/29/2013 06:59 PM, Vinod Koul wrote: On Mon, Jul 29, 2013 at 06:49:01PM +0800, hongbo.zh...@freescale.com wrote: From: Hongbo Zhang hongbo.zh...@freescale.com Hi Vinod, Dan, Scott and Leo, please have a look at these V7 patches. The dma relates changes look okay to me. I need someone to review and ACK the DT bindings. ~Vinod Vinod, Are you using this tree? http://git.infradead.org/users/vkoul/slave-dma.git Did you merge these patches? Thanks. Freescale QorIQ T4 and B4 introduce new 8-channel DMA engines, this patch set adds support this DMA engine. V6-V7 changes: - only remove unnecessary CHIP-dma explanations in [1/3] V5-V6 changes: - minor updates of descriptions in binding document and Kconfig - remove [4/4], that should be another patch in future V4-V5 changes: - update description in the dt binding document, to make it more resonable - add new patch [4/4] to eliminate a compiling warning which already exists for a long time V3-V4 changes: - introduce new patch [1/3] to revise the legacy dma binding document - and then add new paragraph to describe new dt node binding in [2/3] - rebase to latest kernel v3.11-rc1 V2-V3 changes: - edit Documentation/devicetree/bindings/powerpc/fsl/dma.txt - edit text string in Kconfig and the driver files, using elo series to mention all the current elo* V1-V2 changes: - removed the codes handling the register dgsr1, since it isn't used currently - renamed the DMA DT compatible to fsl,elo3-dma - renamed the new dts files to elo3-dma-n.dtsi Hongbo Zhang (3): DMA: Freescale: revise device tree binding document DMA: Freescale: Add new 8-channel DMA engine device tree nodes DMA: Freescale: update driver to support 8-channel DMA engine .../devicetree/bindings/powerpc/fsl/dma.txt| 114 +++- arch/powerpc/boot/dts/fsl/b4si-post.dtsi |4 +- arch/powerpc/boot/dts/fsl/elo3-dma-0.dtsi | 81 ++ arch/powerpc/boot/dts/fsl/elo3-dma-1.dtsi | 81 ++ arch/powerpc/boot/dts/fsl/t4240si-post.dtsi|4 +- drivers/dma/Kconfig|9 +- drivers/dma/fsldma.c |9 +- drivers/dma/fsldma.h |2 +- 8 files changed, 264 insertions(+), 40 deletions(-) create mode 100644 arch/powerpc/boot/dts/fsl/elo3-dma-0.dtsi create mode 100644 arch/powerpc/boot/dts/fsl/elo3-dma-1.dtsi -- 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: [PATCH v7 2/3] DMA: Freescale: Add new 8-channel DMA engine device tree nodes
On 07/30/2013 06:10 AM, Scott Wood wrote: On 07/29/2013 05:49:03 AM, hongbo.zh...@freescale.com wrote: From: Hongbo Zhang Freescale QorIQ T4 and B4 introduce new 8-channel DMA engines, this patch adds the device tree nodes for them. Signed-off-by: Hongbo Zhang --- .../devicetree/bindings/powerpc/fsl/dma.txt| 66 arch/powerpc/boot/dts/fsl/b4si-post.dtsi |4 +- arch/powerpc/boot/dts/fsl/elo3-dma-0.dtsi | 81 arch/powerpc/boot/dts/fsl/elo3-dma-1.dtsi | 81 arch/powerpc/boot/dts/fsl/t4240si-post.dtsi|4 +- 5 files changed, 232 insertions(+), 4 deletions(-) create mode 100644 arch/powerpc/boot/dts/fsl/elo3-dma-0.dtsi create mode 100644 arch/powerpc/boot/dts/fsl/elo3-dma-1.dtsi ACK Thank you Scott for all the review comments. -Scott -- 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] DMA: Freescale: Add support for 8-channel DMA engine
On 07/29/2013 06:59 PM, Vinod Koul wrote: On Mon, Jul 29, 2013 at 06:49:01PM +0800, hongbo.zh...@freescale.com wrote: From: Hongbo Zhang Hi Vinod, Dan, Scott and Leo, please have a look at these V7 patches. The dma relates changes look okay to me. I need someone to review and ACK the DT bindings. Scott Wood has ACKed the [1/3] and [2/3]. Thank you Vinod. ~Vinod Freescale QorIQ T4 and B4 introduce new 8-channel DMA engines, this patch set adds support this DMA engine. V6->V7 changes: - only remove unnecessary "CHIP-dma" explanations in [1/3] V5->V6 changes: - minor updates of descriptions in binding document and Kconfig - remove [4/4], that should be another patch in future V4->V5 changes: - update description in the dt binding document, to make it more resonable - add new patch [4/4] to eliminate a compiling warning which already exists for a long time V3->V4 changes: - introduce new patch [1/3] to revise the legacy dma binding document - and then add new paragraph to describe new dt node binding in [2/3] - rebase to latest kernel v3.11-rc1 V2->V3 changes: - edit Documentation/devicetree/bindings/powerpc/fsl/dma.txt - edit text string in Kconfig and the driver files, using "elo series" to mention all the current "elo*" V1->V2 changes: - removed the codes handling the register dgsr1, since it isn't used currently - renamed the DMA DT compatible to "fsl,elo3-dma" - renamed the new dts files to "elo3-dma-.dtsi" Hongbo Zhang (3): DMA: Freescale: revise device tree binding document DMA: Freescale: Add new 8-channel DMA engine device tree nodes DMA: Freescale: update driver to support 8-channel DMA engine .../devicetree/bindings/powerpc/fsl/dma.txt| 114 +++- arch/powerpc/boot/dts/fsl/b4si-post.dtsi |4 +- arch/powerpc/boot/dts/fsl/elo3-dma-0.dtsi | 81 ++ arch/powerpc/boot/dts/fsl/elo3-dma-1.dtsi | 81 ++ arch/powerpc/boot/dts/fsl/t4240si-post.dtsi|4 +- drivers/dma/Kconfig|9 +- drivers/dma/fsldma.c |9 +- drivers/dma/fsldma.h |2 +- 8 files changed, 264 insertions(+), 40 deletions(-) create mode 100644 arch/powerpc/boot/dts/fsl/elo3-dma-0.dtsi create mode 100644 arch/powerpc/boot/dts/fsl/elo3-dma-1.dtsi -- 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: [PATCH v7 0/3] DMA: Freescale: Add support for 8-channel DMA engine
On 07/29/2013 06:59 PM, Vinod Koul wrote: On Mon, Jul 29, 2013 at 06:49:01PM +0800, hongbo.zh...@freescale.com wrote: From: Hongbo Zhang hongbo.zh...@freescale.com Hi Vinod, Dan, Scott and Leo, please have a look at these V7 patches. The dma relates changes look okay to me. I need someone to review and ACK the DT bindings. Scott Wood has ACKed the [1/3] and [2/3]. Thank you Vinod. ~Vinod Freescale QorIQ T4 and B4 introduce new 8-channel DMA engines, this patch set adds support this DMA engine. V6-V7 changes: - only remove unnecessary CHIP-dma explanations in [1/3] V5-V6 changes: - minor updates of descriptions in binding document and Kconfig - remove [4/4], that should be another patch in future V4-V5 changes: - update description in the dt binding document, to make it more resonable - add new patch [4/4] to eliminate a compiling warning which already exists for a long time V3-V4 changes: - introduce new patch [1/3] to revise the legacy dma binding document - and then add new paragraph to describe new dt node binding in [2/3] - rebase to latest kernel v3.11-rc1 V2-V3 changes: - edit Documentation/devicetree/bindings/powerpc/fsl/dma.txt - edit text string in Kconfig and the driver files, using elo series to mention all the current elo* V1-V2 changes: - removed the codes handling the register dgsr1, since it isn't used currently - renamed the DMA DT compatible to fsl,elo3-dma - renamed the new dts files to elo3-dma-n.dtsi Hongbo Zhang (3): DMA: Freescale: revise device tree binding document DMA: Freescale: Add new 8-channel DMA engine device tree nodes DMA: Freescale: update driver to support 8-channel DMA engine .../devicetree/bindings/powerpc/fsl/dma.txt| 114 +++- arch/powerpc/boot/dts/fsl/b4si-post.dtsi |4 +- arch/powerpc/boot/dts/fsl/elo3-dma-0.dtsi | 81 ++ arch/powerpc/boot/dts/fsl/elo3-dma-1.dtsi | 81 ++ arch/powerpc/boot/dts/fsl/t4240si-post.dtsi|4 +- drivers/dma/Kconfig|9 +- drivers/dma/fsldma.c |9 +- drivers/dma/fsldma.h |2 +- 8 files changed, 264 insertions(+), 40 deletions(-) create mode 100644 arch/powerpc/boot/dts/fsl/elo3-dma-0.dtsi create mode 100644 arch/powerpc/boot/dts/fsl/elo3-dma-1.dtsi -- 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: [PATCH v7 2/3] DMA: Freescale: Add new 8-channel DMA engine device tree nodes
On 07/30/2013 06:10 AM, Scott Wood wrote: On 07/29/2013 05:49:03 AM, hongbo.zh...@freescale.com wrote: From: Hongbo Zhang hongbo.zh...@freescale.com Freescale QorIQ T4 and B4 introduce new 8-channel DMA engines, this patch adds the device tree nodes for them. Signed-off-by: Hongbo Zhang hongbo.zh...@freescale.com --- .../devicetree/bindings/powerpc/fsl/dma.txt| 66 arch/powerpc/boot/dts/fsl/b4si-post.dtsi |4 +- arch/powerpc/boot/dts/fsl/elo3-dma-0.dtsi | 81 arch/powerpc/boot/dts/fsl/elo3-dma-1.dtsi | 81 arch/powerpc/boot/dts/fsl/t4240si-post.dtsi|4 +- 5 files changed, 232 insertions(+), 4 deletions(-) create mode 100644 arch/powerpc/boot/dts/fsl/elo3-dma-0.dtsi create mode 100644 arch/powerpc/boot/dts/fsl/elo3-dma-1.dtsi ACK Thank you Scott for all the review comments. -Scott -- 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 4/4] DMA: Freescale: eliminate a compiling warning
On 07/25/2013 03:33 AM, Scott Wood wrote: On 07/24/2013 01:21:09 AM, hongbo.zh...@freescale.com wrote: From: Hongbo Zhang The variable cookie is initialized in a list_for_each_entry loop, if(unlikely) the list is empty, this variable will be used uninitialized, so we get a gcc compiling warning about this. This patch fixes this defect by setting an initial value to the varialble cookie. Signed-off-by: Hongbo Zhang --- drivers/dma/fsldma.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c index 16a9a48..14d68a4 100644 --- a/drivers/dma/fsldma.c +++ b/drivers/dma/fsldma.c @@ -406,7 +406,7 @@ static dma_cookie_t fsl_dma_tx_submit(struct dma_async_tx_descriptor *tx) struct fsl_desc_sw *desc = tx_to_fsl_desc(tx); struct fsl_desc_sw *child; unsigned long flags; -dma_cookie_t cookie; +dma_cookie_t cookie = 0; spin_lock_irqsave(>desc_lock, flags); This patch is unrelated to the rest of the patch series... What are the semantics of this function if there are multiple entries in the list? Returning the last cookie seems a bit odd. Is zero the proper error value? include/linux/dmaengine.h suggests that cookies should be < 0 to indicate error. I found this compiling warning since the beginning of this work, it is better somebody fixes it sooner or later, so I take it at last. Yes it was a bit hard to define the initial value, I saw the dmaengine.h, and I searched all the other DMA drivers with initial value before making the decision: drivers/dma/mv_xor.c:dma_cookie_t cookie = 0; drivers/dma/sh/shdma-base.c:dma_cookie_t cookie = 0; drivers/dma/mmp_pdma.c:dma_cookie_t cookie = -EBUSY; drivers/dma/ppc4xx/adma.c:dma_cookie_t cookie = 0; drivers/dma/iop-adma.c:dma_cookie_t cookie = 0; most of them using 0, and only one negative value, it seems better? but -EBUSY isn't so accurate I think. My thought is to drop this in the next iteration, and back to this after the first 3 get merged. -Scott -- 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 4/4] DMA: Freescale: eliminate a compiling warning
On 07/25/2013 03:33 AM, Scott Wood wrote: On 07/24/2013 01:21:09 AM, hongbo.zh...@freescale.com wrote: From: Hongbo Zhang hongbo.zh...@freescale.com The variable cookie is initialized in a list_for_each_entry loop, if(unlikely) the list is empty, this variable will be used uninitialized, so we get a gcc compiling warning about this. This patch fixes this defect by setting an initial value to the varialble cookie. Signed-off-by: Hongbo Zhang hongbo.zh...@freescale.com --- drivers/dma/fsldma.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c index 16a9a48..14d68a4 100644 --- a/drivers/dma/fsldma.c +++ b/drivers/dma/fsldma.c @@ -406,7 +406,7 @@ static dma_cookie_t fsl_dma_tx_submit(struct dma_async_tx_descriptor *tx) struct fsl_desc_sw *desc = tx_to_fsl_desc(tx); struct fsl_desc_sw *child; unsigned long flags; -dma_cookie_t cookie; +dma_cookie_t cookie = 0; spin_lock_irqsave(chan-desc_lock, flags); This patch is unrelated to the rest of the patch series... What are the semantics of this function if there are multiple entries in the list? Returning the last cookie seems a bit odd. Is zero the proper error value? include/linux/dmaengine.h suggests that cookies should be 0 to indicate error. I found this compiling warning since the beginning of this work, it is better somebody fixes it sooner or later, so I take it at last. Yes it was a bit hard to define the initial value, I saw the dmaengine.h, and I searched all the other DMA drivers with initial value before making the decision: drivers/dma/mv_xor.c:dma_cookie_t cookie = 0; drivers/dma/sh/shdma-base.c:dma_cookie_t cookie = 0; drivers/dma/mmp_pdma.c:dma_cookie_t cookie = -EBUSY; drivers/dma/ppc4xx/adma.c:dma_cookie_t cookie = 0; drivers/dma/iop-adma.c:dma_cookie_t cookie = 0; most of them using 0, and only one negative value, it seems better? but -EBUSY isn't so accurate I think. My thought is to drop this in the next iteration, and back to this after the first 3 get merged. -Scott -- 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/2] DMA: Freescale: Add new 8-channel DMA engine device tree nodes
On 07/15/2013 09:31 PM, Kumar Gala wrote: On Jul 5, 2013, at 1:27 AM, wrote: From: Hongbo Zhang Freescale QorIQ T4 and B4 introduce new 8-channel DMA engines, this patch add the device tree nodes for them. Signed-off-by: Hongbo Zhang --- arch/powerpc/boot/dts/fsl/elo3-dma-0.dtsi | 90 +++ arch/powerpc/boot/dts/fsl/elo3-dma-1.dtsi | 90 +++ arch/powerpc/boot/dts/fsl/t4240si-post.dtsi |4 +- 3 files changed, 182 insertions(+), 2 deletions(-) create mode 100644 arch/powerpc/boot/dts/fsl/elo3-dma-0.dtsi create mode 100644 arch/powerpc/boot/dts/fsl/elo3-dma-1.dtsi Why didn't you update b4si-post.dtsi as well? OK, will update it too, thanks. - k -- 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/2] DMA: Freescale: Add new 8-channel DMA engine device tree nodes
On 07/15/2013 09:31 PM, Kumar Gala wrote: On Jul 5, 2013, at 1:27 AM, hongbo.zh...@freescale.com hongbo.zh...@freescale.com wrote: From: Hongbo Zhang hongbo.zh...@freescale.com Freescale QorIQ T4 and B4 introduce new 8-channel DMA engines, this patch add the device tree nodes for them. Signed-off-by: Hongbo Zhang hongbo.zh...@freescale.com --- arch/powerpc/boot/dts/fsl/elo3-dma-0.dtsi | 90 +++ arch/powerpc/boot/dts/fsl/elo3-dma-1.dtsi | 90 +++ arch/powerpc/boot/dts/fsl/t4240si-post.dtsi |4 +- 3 files changed, 182 insertions(+), 2 deletions(-) create mode 100644 arch/powerpc/boot/dts/fsl/elo3-dma-0.dtsi create mode 100644 arch/powerpc/boot/dts/fsl/elo3-dma-1.dtsi Why didn't you update b4si-post.dtsi as well? OK, will update it too, thanks. - k -- 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/2] DMA: Freescale: Add new 8-channel DMA engine device tree nodes
On 07/10/2013 12:48 AM, Scott Wood wrote: On 07/05/2013 01:27:05 AM, hongbo.zh...@freescale.com wrote: From: Hongbo Zhang Freescale QorIQ T4 and B4 introduce new 8-channel DMA engines, this patch add the device tree nodes for them. Signed-off-by: Hongbo Zhang --- arch/powerpc/boot/dts/fsl/elo3-dma-0.dtsi | 90 +++ arch/powerpc/boot/dts/fsl/elo3-dma-1.dtsi | 90 +++ arch/powerpc/boot/dts/fsl/t4240si-post.dtsi |4 +- 3 files changed, 182 insertions(+), 2 deletions(-) create mode 100644 arch/powerpc/boot/dts/fsl/elo3-dma-0.dtsi create mode 100644 arch/powerpc/boot/dts/fsl/elo3-dma-1.dtsi Please update Documentation/devicetree/bindings/powerpc/fsl/dma.txt for the new compatible and dgsr1. OK, thanks. What's more, some text string in the driver and Kconfig files should be updated too, e.g. "Elo / Elo Plus DMA" may be changed to "Elo series DMA", will send out v3 patches soon. -Scott -- 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/2] DMA: Freescale: Add new 8-channel DMA engine device tree nodes
On 07/10/2013 12:48 AM, Scott Wood wrote: On 07/05/2013 01:27:05 AM, hongbo.zh...@freescale.com wrote: From: Hongbo Zhang hongbo.zh...@freescale.com Freescale QorIQ T4 and B4 introduce new 8-channel DMA engines, this patch add the device tree nodes for them. Signed-off-by: Hongbo Zhang hongbo.zh...@freescale.com --- arch/powerpc/boot/dts/fsl/elo3-dma-0.dtsi | 90 +++ arch/powerpc/boot/dts/fsl/elo3-dma-1.dtsi | 90 +++ arch/powerpc/boot/dts/fsl/t4240si-post.dtsi |4 +- 3 files changed, 182 insertions(+), 2 deletions(-) create mode 100644 arch/powerpc/boot/dts/fsl/elo3-dma-0.dtsi create mode 100644 arch/powerpc/boot/dts/fsl/elo3-dma-1.dtsi Please update Documentation/devicetree/bindings/powerpc/fsl/dma.txt for the new compatible and dgsr1. OK, thanks. What's more, some text string in the driver and Kconfig files should be updated too, e.g. Elo / Elo Plus DMA may be changed to Elo series DMA, will send out v3 patches soon. -Scott -- 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] DMA: Freescale: Add new 8-channel DMA engine device tree nodes
On 07/03/2013 11:53 AM, Hongbo Zhang wrote: hmm...add the devicetree-disc...@lists.ozlabs.org into list. Note that we are discussing a better naming for this new compatible property in the corresponding [PATCH 2/2], so I will resend a v2 of this patch. On 07/01/2013 11:46 AM, hongbo.zh...@freescale.com wrote: From: Hongbo Zhang Freescale QorIQ T4 and B4 introduce new 8-channel DMA engines, this patch add the device tree nodes for them. Signed-off-by: Hongbo Zhang --- arch/powerpc/boot/dts/fsl/qoriq-dma2-0.dtsi | 90 +++ arch/powerpc/boot/dts/fsl/qoriq-dma2-1.dtsi | 90 +++ arch/powerpc/boot/dts/fsl/t4240si-post.dtsi |4 +- 3 files changed, 182 insertions(+), 2 deletions(-) create mode 100644 arch/powerpc/boot/dts/fsl/qoriq-dma2-0.dtsi create mode 100644 arch/powerpc/boot/dts/fsl/qoriq-dma2-1.dtsi Scott, any comment of these two file names? diff --git a/arch/powerpc/boot/dts/fsl/qoriq-dma2-0.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-dma2-0.dtsi new file mode 100644 index 000..c626c49 --- /dev/null +++ b/arch/powerpc/boot/dts/fsl/qoriq-dma2-0.dtsi @@ -0,0 +1,90 @@ +/* + * QorIQ DMA device tree stub [ controller @ offset 0x10 ] + * + * Copyright 2011-2013 Freescale Semiconductor Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Freescale Semiconductor nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License ("GPL") as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +dma0: dma@100300 { +#address-cells = <1>; +#size-cells = <1>; +compatible = "fsl,eloplus-dma2"; +reg = <0x100300 0x4 0x100600 0x4>; +ranges = <0x0 0x100100 0x500>; +cell-index = <0>; +dma-channel@0 { +compatible = "fsl,eloplus-dma-channel"; +reg = <0x0 0x80>; +cell-index = <0>; +interrupts = <28 2 0 0>; +}; +dma-channel@80 { +compatible = "fsl,eloplus-dma-channel"; +reg = <0x80 0x80>; +cell-index = <1>; +interrupts = <29 2 0 0>; +}; +dma-channel@100 { +compatible = "fsl,eloplus-dma-channel"; +reg = <0x100 0x80>; +cell-index = <2>; +interrupts = <30 2 0 0>; +}; +dma-channel@180 { +compatible = "fsl,eloplus-dma-channel"; +reg = <0x180 0x80>; +cell-index = <3>; +interrupts = <31 2 0 0>; +}; +dma-channel@300 { +compatible = "fsl,eloplus-dma-channel"; +reg = <0x300 0x80>; +cell-index = <4>; +interrupts = <76 2 0 0>; +}; +dma-channel@380 { +compatible = "fsl,eloplus-dma-channel"; +reg = <0x380 0x80>; +cell-index = <5>; +interrupts = <77 2 0 0>; +}; +dma-channel@400 { +compatible = "fsl,eloplus-dma-channel"; +reg = <0x400 0x80>; +cell-index = <6>; +interrupts = <78 2 0 0>; +}; +dma-channel@480 { +compatible = "fsl,eloplus-dma-channel"; +reg = <0x480 0x80>; +cell-index = <7>; +interrupts = <79 2 0 0>; +}; +}; diff --git a/arch/powerpc/boot/dts/fsl/qoriq-dma2-1.dtsi b/a
Re: [PATCH 1/2] DMA: Freescale: Add new 8-channel DMA engine device tree nodes
On 07/03/2013 11:53 AM, Hongbo Zhang wrote: hmm...add the devicetree-disc...@lists.ozlabs.org into list. Note that we are discussing a better naming for this new compatible property in the corresponding [PATCH 2/2], so I will resend a v2 of this patch. On 07/01/2013 11:46 AM, hongbo.zh...@freescale.com wrote: From: Hongbo Zhang hongbo.zh...@freescale.com Freescale QorIQ T4 and B4 introduce new 8-channel DMA engines, this patch add the device tree nodes for them. Signed-off-by: Hongbo Zhang hongbo.zh...@freescale.com --- arch/powerpc/boot/dts/fsl/qoriq-dma2-0.dtsi | 90 +++ arch/powerpc/boot/dts/fsl/qoriq-dma2-1.dtsi | 90 +++ arch/powerpc/boot/dts/fsl/t4240si-post.dtsi |4 +- 3 files changed, 182 insertions(+), 2 deletions(-) create mode 100644 arch/powerpc/boot/dts/fsl/qoriq-dma2-0.dtsi create mode 100644 arch/powerpc/boot/dts/fsl/qoriq-dma2-1.dtsi Scott, any comment of these two file names? diff --git a/arch/powerpc/boot/dts/fsl/qoriq-dma2-0.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-dma2-0.dtsi new file mode 100644 index 000..c626c49 --- /dev/null +++ b/arch/powerpc/boot/dts/fsl/qoriq-dma2-0.dtsi @@ -0,0 +1,90 @@ +/* + * QorIQ DMA device tree stub [ controller @ offset 0x10 ] + * + * Copyright 2011-2013 Freescale Semiconductor Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Freescale Semiconductor nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License (GPL) as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +dma0: dma@100300 { +#address-cells = 1; +#size-cells = 1; +compatible = fsl,eloplus-dma2; +reg = 0x100300 0x4 0x100600 0x4; +ranges = 0x0 0x100100 0x500; +cell-index = 0; +dma-channel@0 { +compatible = fsl,eloplus-dma-channel; +reg = 0x0 0x80; +cell-index = 0; +interrupts = 28 2 0 0; +}; +dma-channel@80 { +compatible = fsl,eloplus-dma-channel; +reg = 0x80 0x80; +cell-index = 1; +interrupts = 29 2 0 0; +}; +dma-channel@100 { +compatible = fsl,eloplus-dma-channel; +reg = 0x100 0x80; +cell-index = 2; +interrupts = 30 2 0 0; +}; +dma-channel@180 { +compatible = fsl,eloplus-dma-channel; +reg = 0x180 0x80; +cell-index = 3; +interrupts = 31 2 0 0; +}; +dma-channel@300 { +compatible = fsl,eloplus-dma-channel; +reg = 0x300 0x80; +cell-index = 4; +interrupts = 76 2 0 0; +}; +dma-channel@380 { +compatible = fsl,eloplus-dma-channel; +reg = 0x380 0x80; +cell-index = 5; +interrupts = 77 2 0 0; +}; +dma-channel@400 { +compatible = fsl,eloplus-dma-channel; +reg = 0x400 0x80; +cell-index = 6; +interrupts = 78 2 0 0; +}; +dma-channel@480 { +compatible = fsl,eloplus-dma-channel; +reg = 0x480 0x80; +cell-index = 7; +interrupts = 79 2 0 0; +}; +}; diff --git a/arch/powerpc/boot/dts/fsl/qoriq-dma2-1.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-dma2-1.dtsi new file mode 100644 index 000..980ea77 --- /dev/null +++ b/arch/powerpc/boot/dts/fsl/qoriq-dma2-1.dtsi @@ -0,0 +1,90 @@ +/* + * QorIQ DMA device tree stub [ controller @ offset 0x101000 ] + * + * Copyright 2011-2013 Freescale Semiconductor Inc
Re: [PATCH 1/2] DMA: Freescale: Add new 8-channel DMA engine device tree nodes
hmm...add the devicetree-disc...@lists.ozlabs.org into list. Note that we are discussing a better naming for this new compatible property in the corresponding [PATCH 2/2], so I will resend a v2 of this patch. On 07/01/2013 11:46 AM, hongbo.zh...@freescale.com wrote: From: Hongbo Zhang Freescale QorIQ T4 and B4 introduce new 8-channel DMA engines, this patch add the device tree nodes for them. Signed-off-by: Hongbo Zhang --- arch/powerpc/boot/dts/fsl/qoriq-dma2-0.dtsi | 90 +++ arch/powerpc/boot/dts/fsl/qoriq-dma2-1.dtsi | 90 +++ arch/powerpc/boot/dts/fsl/t4240si-post.dtsi |4 +- 3 files changed, 182 insertions(+), 2 deletions(-) create mode 100644 arch/powerpc/boot/dts/fsl/qoriq-dma2-0.dtsi create mode 100644 arch/powerpc/boot/dts/fsl/qoriq-dma2-1.dtsi diff --git a/arch/powerpc/boot/dts/fsl/qoriq-dma2-0.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-dma2-0.dtsi new file mode 100644 index 000..c626c49 --- /dev/null +++ b/arch/powerpc/boot/dts/fsl/qoriq-dma2-0.dtsi @@ -0,0 +1,90 @@ +/* + * QorIQ DMA device tree stub [ controller @ offset 0x10 ] + * + * Copyright 2011-2013 Freescale Semiconductor Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Freescale Semiconductor nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License ("GPL") as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +dma0: dma@100300 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "fsl,eloplus-dma2"; + reg = <0x100300 0x4 0x100600 0x4>; + ranges = <0x0 0x100100 0x500>; + cell-index = <0>; + dma-channel@0 { + compatible = "fsl,eloplus-dma-channel"; + reg = <0x0 0x80>; + cell-index = <0>; + interrupts = <28 2 0 0>; + }; + dma-channel@80 { + compatible = "fsl,eloplus-dma-channel"; + reg = <0x80 0x80>; + cell-index = <1>; + interrupts = <29 2 0 0>; + }; + dma-channel@100 { + compatible = "fsl,eloplus-dma-channel"; + reg = <0x100 0x80>; + cell-index = <2>; + interrupts = <30 2 0 0>; + }; + dma-channel@180 { + compatible = "fsl,eloplus-dma-channel"; + reg = <0x180 0x80>; + cell-index = <3>; + interrupts = <31 2 0 0>; + }; + dma-channel@300 { + compatible = "fsl,eloplus-dma-channel"; + reg = <0x300 0x80>; + cell-index = <4>; + interrupts = <76 2 0 0>; + }; + dma-channel@380 { + compatible = "fsl,eloplus-dma-channel"; + reg = <0x380 0x80>; + cell-index = <5>; + interrupts = <77 2 0 0>; + }; + dma-channel@400 { + compatible = "fsl,eloplus-dma-channel"; + reg = <0x400 0x80>; + cell-index = <6>; + interrupts = <78 2 0 0>; + }; + dma-channel@480 { + compatible = "fsl,eloplus-dma-channel"; + reg = <0x480
Re: [PATCH 2/2] DMA: Freescale: update driver to support 8-channel DMA engine
On 07/03/2013 07:13 AM, Scott Wood wrote: On 06/30/2013 10:46:18 PM, hongbo.zh...@freescale.com wrote: From: Hongbo Zhang This patch adds support to 8-channel DMA engine, thus the driver works for both the new 8-channel and the legacy 4-channel DMA engines. Signed-off-by: Hongbo Zhang --- drivers/dma/fsldma.c | 48 ++-- drivers/dma/fsldma.h |4 ++-- 2 files changed, 36 insertions(+), 16 deletions(-) diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c index 4fc2980..0f453ea 100644 --- a/drivers/dma/fsldma.c +++ b/drivers/dma/fsldma.c @@ -1119,27 +1119,33 @@ static irqreturn_t fsldma_ctrl_irq(int irq, void *data) struct fsldma_device *fdev = data; struct fsldma_chan *chan; unsigned int handled = 0; -u32 gsr, mask; +u8 chan_sr[round_up(FSL_DMA_MAX_CHANS_PER_DEVICE, 4)]; +u32 gsr; int i; -gsr = (fdev->feature & FSL_DMA_BIG_ENDIAN) ? in_be32(fdev->regs) - : in_le32(fdev->regs); -mask = 0xff00; -dev_dbg(fdev->dev, "IRQ: gsr 0x%.8x\n", gsr); +memset(_sr, 0, sizeof(chan_sr)); +gsr = (fdev->feature & FSL_DMA_BIG_ENDIAN) ? in_be32(fdev->regs0) + : in_le32(fdev->regs0); +memcpy(_sr[0], , 4); +dev_dbg(fdev->dev, "IRQ: gsr0 0x%.8x\n", gsr); + +if (of_device_is_compatible(fdev->dev->of_node, "fsl,eloplus-dma2")) { NACK; Figure out what sort of device you've got when you first probe the device, and store the information for later. Do not call device tree stuff in an interrupt handler. +gsr = (fdev->feature & FSL_DMA_BIG_ENDIAN) ? +in_be32(fdev->regs1) : in_le32(fdev->regs1); +memcpy(_sr[4], , 4); +dev_dbg(fdev->dev, "IRQ: gsr1 0x%.8x\n", gsr); +} Do these memcpy()s get inlined? If not (and maybe even if they do), it'd be better to use a union instead. For this and the first comments: good catches, thank you. But it is very likely I will remove these codes, see the last comments of yours and mine. Wait a second -- how are we even getting into this code on these new DMA controllers? All 85xx-family DMA controllers use fsldma_chan_irq directly. Right, we are using fsldma_chan_irq, this code never run. I just see there is such code for elo/eloplus DMA controllers, so I update it for the new 8-channel DMA. @@ -1341,13 +1349,22 @@ static int fsldma_of_probe(struct platform_device *op) INIT_LIST_HEAD(>common.channels); /* ioremap the registers for use */ -fdev->regs = of_iomap(op->dev.of_node, 0); -if (!fdev->regs) { -dev_err(>dev, "unable to ioremap registers\n"); +fdev->regs0 = of_iomap(op->dev.of_node, 0); +if (!fdev->regs0) { +dev_err(>dev, "unable to ioremap register0\n"); err = -ENOMEM; goto out_free_fdev; } +if (of_device_is_compatible(op->dev.of_node, "fsl,eloplus-dma2")) { Not "fsl,eloplusplus-dma"? :-) More seriously, if we're sticking with this "elo" naming, maybe "fsl,elo3-dma" would be better. It would be odd to have "2" in the name of the third generation of this hardware. It was really hard for me to name this new controller. Yes "fsl,elo3-dma" seems better. diff --git a/drivers/dma/fsldma.h b/drivers/dma/fsldma.h index f5c3879..880664d 100644 --- a/drivers/dma/fsldma.h +++ b/drivers/dma/fsldma.h @@ -112,10 +112,10 @@ struct fsldma_chan_regs { }; struct fsldma_chan; -#define FSL_DMA_MAX_CHANS_PER_DEVICE 4 +#define FSL_DMA_MAX_CHANS_PER_DEVICE 8 struct fsldma_device { -void __iomem *regs;/* DGSR register base */ +void __iomem *regs0, *regs1;/* DGSR registers */ Either give these meaningful names, or use an array. Or both (dgsr[2]). Or just get rid of this, since I don't see why we need DGSR1 at all, as previously noted. I choose the names regs* just to follow the previous pattern. Here comes the key point: both the previous DGSR and the new DGSR0/DGSR1 are not actually used because we are using per channel irq. I see we had such codes to handle DGSR, so I just follow the same pattern to handle the new DGSR0/DGSR1. Since getting rid of this unused DGSR1 is permitted, I'd like to remove all the related codes, then this patch becomes simple :) -Scott -- 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] DMA: Freescale: update driver to support 8-channel DMA engine
On 07/03/2013 07:13 AM, Scott Wood wrote: On 06/30/2013 10:46:18 PM, hongbo.zh...@freescale.com wrote: From: Hongbo Zhang hongbo.zh...@freescale.com This patch adds support to 8-channel DMA engine, thus the driver works for both the new 8-channel and the legacy 4-channel DMA engines. Signed-off-by: Hongbo Zhang hongbo.zh...@freescale.com --- drivers/dma/fsldma.c | 48 ++-- drivers/dma/fsldma.h |4 ++-- 2 files changed, 36 insertions(+), 16 deletions(-) diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c index 4fc2980..0f453ea 100644 --- a/drivers/dma/fsldma.c +++ b/drivers/dma/fsldma.c @@ -1119,27 +1119,33 @@ static irqreturn_t fsldma_ctrl_irq(int irq, void *data) struct fsldma_device *fdev = data; struct fsldma_chan *chan; unsigned int handled = 0; -u32 gsr, mask; +u8 chan_sr[round_up(FSL_DMA_MAX_CHANS_PER_DEVICE, 4)]; +u32 gsr; int i; -gsr = (fdev-feature FSL_DMA_BIG_ENDIAN) ? in_be32(fdev-regs) - : in_le32(fdev-regs); -mask = 0xff00; -dev_dbg(fdev-dev, IRQ: gsr 0x%.8x\n, gsr); +memset(chan_sr, 0, sizeof(chan_sr)); +gsr = (fdev-feature FSL_DMA_BIG_ENDIAN) ? in_be32(fdev-regs0) + : in_le32(fdev-regs0); +memcpy(chan_sr[0], gsr, 4); +dev_dbg(fdev-dev, IRQ: gsr0 0x%.8x\n, gsr); + +if (of_device_is_compatible(fdev-dev-of_node, fsl,eloplus-dma2)) { NACK; Figure out what sort of device you've got when you first probe the device, and store the information for later. Do not call device tree stuff in an interrupt handler. +gsr = (fdev-feature FSL_DMA_BIG_ENDIAN) ? +in_be32(fdev-regs1) : in_le32(fdev-regs1); +memcpy(chan_sr[4], gsr, 4); +dev_dbg(fdev-dev, IRQ: gsr1 0x%.8x\n, gsr); +} Do these memcpy()s get inlined? If not (and maybe even if they do), it'd be better to use a union instead. For this and the first comments: good catches, thank you. But it is very likely I will remove these codes, see the last comments of yours and mine. Wait a second -- how are we even getting into this code on these new DMA controllers? All 85xx-family DMA controllers use fsldma_chan_irq directly. Right, we are using fsldma_chan_irq, this code never run. I just see there is such code for elo/eloplus DMA controllers, so I update it for the new 8-channel DMA. @@ -1341,13 +1349,22 @@ static int fsldma_of_probe(struct platform_device *op) INIT_LIST_HEAD(fdev-common.channels); /* ioremap the registers for use */ -fdev-regs = of_iomap(op-dev.of_node, 0); -if (!fdev-regs) { -dev_err(op-dev, unable to ioremap registers\n); +fdev-regs0 = of_iomap(op-dev.of_node, 0); +if (!fdev-regs0) { +dev_err(op-dev, unable to ioremap register0\n); err = -ENOMEM; goto out_free_fdev; } +if (of_device_is_compatible(op-dev.of_node, fsl,eloplus-dma2)) { Not fsl,eloplusplus-dma? :-) More seriously, if we're sticking with this elo naming, maybe fsl,elo3-dma would be better. It would be odd to have 2 in the name of the third generation of this hardware. It was really hard for me to name this new controller. Yes fsl,elo3-dma seems better. diff --git a/drivers/dma/fsldma.h b/drivers/dma/fsldma.h index f5c3879..880664d 100644 --- a/drivers/dma/fsldma.h +++ b/drivers/dma/fsldma.h @@ -112,10 +112,10 @@ struct fsldma_chan_regs { }; struct fsldma_chan; -#define FSL_DMA_MAX_CHANS_PER_DEVICE 4 +#define FSL_DMA_MAX_CHANS_PER_DEVICE 8 struct fsldma_device { -void __iomem *regs;/* DGSR register base */ +void __iomem *regs0, *regs1;/* DGSR registers */ Either give these meaningful names, or use an array. Or both (dgsr[2]). Or just get rid of this, since I don't see why we need DGSR1 at all, as previously noted. I choose the names regs* just to follow the previous pattern. Here comes the key point: both the previous DGSR and the new DGSR0/DGSR1 are not actually used because we are using per channel irq. I see we had such codes to handle DGSR, so I just follow the same pattern to handle the new DGSR0/DGSR1. Since getting rid of this unused DGSR1 is permitted, I'd like to remove all the related codes, then this patch becomes simple :) -Scott -- 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] DMA: Freescale: Add new 8-channel DMA engine device tree nodes
hmm...add the devicetree-disc...@lists.ozlabs.org into list. Note that we are discussing a better naming for this new compatible property in the corresponding [PATCH 2/2], so I will resend a v2 of this patch. On 07/01/2013 11:46 AM, hongbo.zh...@freescale.com wrote: From: Hongbo Zhang hongbo.zh...@freescale.com Freescale QorIQ T4 and B4 introduce new 8-channel DMA engines, this patch add the device tree nodes for them. Signed-off-by: Hongbo Zhang hongbo.zh...@freescale.com --- arch/powerpc/boot/dts/fsl/qoriq-dma2-0.dtsi | 90 +++ arch/powerpc/boot/dts/fsl/qoriq-dma2-1.dtsi | 90 +++ arch/powerpc/boot/dts/fsl/t4240si-post.dtsi |4 +- 3 files changed, 182 insertions(+), 2 deletions(-) create mode 100644 arch/powerpc/boot/dts/fsl/qoriq-dma2-0.dtsi create mode 100644 arch/powerpc/boot/dts/fsl/qoriq-dma2-1.dtsi diff --git a/arch/powerpc/boot/dts/fsl/qoriq-dma2-0.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-dma2-0.dtsi new file mode 100644 index 000..c626c49 --- /dev/null +++ b/arch/powerpc/boot/dts/fsl/qoriq-dma2-0.dtsi @@ -0,0 +1,90 @@ +/* + * QorIQ DMA device tree stub [ controller @ offset 0x10 ] + * + * Copyright 2011-2013 Freescale Semiconductor Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Freescale Semiconductor nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License (GPL) as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +dma0: dma@100300 { + #address-cells = 1; + #size-cells = 1; + compatible = fsl,eloplus-dma2; + reg = 0x100300 0x4 0x100600 0x4; + ranges = 0x0 0x100100 0x500; + cell-index = 0; + dma-channel@0 { + compatible = fsl,eloplus-dma-channel; + reg = 0x0 0x80; + cell-index = 0; + interrupts = 28 2 0 0; + }; + dma-channel@80 { + compatible = fsl,eloplus-dma-channel; + reg = 0x80 0x80; + cell-index = 1; + interrupts = 29 2 0 0; + }; + dma-channel@100 { + compatible = fsl,eloplus-dma-channel; + reg = 0x100 0x80; + cell-index = 2; + interrupts = 30 2 0 0; + }; + dma-channel@180 { + compatible = fsl,eloplus-dma-channel; + reg = 0x180 0x80; + cell-index = 3; + interrupts = 31 2 0 0; + }; + dma-channel@300 { + compatible = fsl,eloplus-dma-channel; + reg = 0x300 0x80; + cell-index = 4; + interrupts = 76 2 0 0; + }; + dma-channel@380 { + compatible = fsl,eloplus-dma-channel; + reg = 0x380 0x80; + cell-index = 5; + interrupts = 77 2 0 0; + }; + dma-channel@400 { + compatible = fsl,eloplus-dma-channel; + reg = 0x400 0x80; + cell-index = 6; + interrupts = 78 2 0 0; + }; + dma-channel@480 { + compatible = fsl,eloplus-dma-channel; + reg = 0x480 0x80; + cell-index = 7; + interrupts = 79 2 0 0; + }; +}; diff --git a/arch/powerpc/boot/dts/fsl/qoriq-dma2-1.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-dma2-1.dtsi new file mode 100644 index 000..980ea77 --- /dev/null +++ b/arch/powerpc/boot
[PATCH v8 4/5] ab8500: power: export abx500_res_to_temp tables for hwmon
This patch exports the thermistor resistance-to-temperature tables, so that the hwmon driver can access them, and also adds the corresponding table size variables. Signed-off-by: Hongbo Zhang --- drivers/power/ab8500_bmdata.c | 20 ++-- include/linux/power/ab8500.h | 16 2 files changed, 30 insertions(+), 6 deletions(-) create mode 100644 include/linux/power/ab8500.h diff --git a/drivers/power/ab8500_bmdata.c b/drivers/power/ab8500_bmdata.c index 3cdcdcf..d298645 100644 --- a/drivers/power/ab8500_bmdata.c +++ b/drivers/power/ab8500_bmdata.c @@ -11,7 +11,7 @@ * Note that the res_to_temp table must be strictly sorted by falling resistance * values to work. */ -static const struct abx500_res_to_temp temp_tbl_a_thermistor[] = { +const struct abx500_res_to_temp ab8500_temp_tbl_a_thermistor[] = { {-5, 53407}, { 0, 48594}, { 5, 43804}, @@ -28,8 +28,12 @@ static const struct abx500_res_to_temp temp_tbl_a_thermistor[] = { {60, 13437}, {65, 12500}, }; +EXPORT_SYMBOL(ab8500_temp_tbl_a_thermistor); -static const struct abx500_res_to_temp temp_tbl_b_thermistor[] = { +const int ab8500_temp_tbl_a_size = ARRAY_SIZE(ab8500_temp_tbl_a_thermistor); +EXPORT_SYMBOL(ab8500_temp_tbl_a_size); + +const struct abx500_res_to_temp ab8500_temp_tbl_b_thermistor[] = { {-5, 20}, { 0, 159024}, { 5, 151921}, @@ -46,6 +50,10 @@ static const struct abx500_res_to_temp temp_tbl_b_thermistor[] = { {60, 85461}, {65, 82869}, }; +EXPORT_SYMBOL(ab8500_temp_tbl_b_thermistor); + +const int ab8500_temp_tbl_b_size = ARRAY_SIZE(ab8500_temp_tbl_b_thermistor); +EXPORT_SYMBOL(ab8500_temp_tbl_b_size); static const struct abx500_v_to_cap cap_tbl_a_thermistor[] = { {4171, 100}, @@ -230,8 +238,8 @@ static struct abx500_battery_type bat_type_thermistor[] = { .maint_b_chg_timer_h = 200, .low_high_cur_lvl = 300, .low_high_vol_lvl = 4000, - .n_temp_tbl_elements = ARRAY_SIZE(temp_tbl_a_thermistor), - .r_to_t_tbl = temp_tbl_a_thermistor, + .n_temp_tbl_elements = ARRAY_SIZE(ab8500_temp_tbl_a_thermistor), + .r_to_t_tbl = ab8500_temp_tbl_a_thermistor, .n_v_cap_tbl_elements = ARRAY_SIZE(cap_tbl_a_thermistor), .v_to_cap_tbl = cap_tbl_a_thermistor, .n_batres_tbl_elements = ARRAY_SIZE(temp_to_batres_tbl_thermistor), @@ -258,8 +266,8 @@ static struct abx500_battery_type bat_type_thermistor[] = { .maint_b_chg_timer_h = 200, .low_high_cur_lvl = 300, .low_high_vol_lvl = 4000, - .n_temp_tbl_elements = ARRAY_SIZE(temp_tbl_b_thermistor), - .r_to_t_tbl = temp_tbl_b_thermistor, + .n_temp_tbl_elements = ARRAY_SIZE(ab8500_temp_tbl_b_thermistor), + .r_to_t_tbl = ab8500_temp_tbl_b_thermistor, .n_v_cap_tbl_elements = ARRAY_SIZE(cap_tbl_b_thermistor), .v_to_cap_tbl = cap_tbl_b_thermistor, .n_batres_tbl_elements = ARRAY_SIZE(temp_to_batres_tbl_thermistor), diff --git a/include/linux/power/ab8500.h b/include/linux/power/ab8500.h new file mode 100644 index 000..cdbb6c2 --- /dev/null +++ b/include/linux/power/ab8500.h @@ -0,0 +1,16 @@ +/* + * Copyright (C) ST-Ericsson 2013 + * Author: Hongbo Zhang + * License terms: GNU General Public License v2 + */ + +#ifndef PWR_AB8500_H +#define PWR_AB8500_H + +extern const struct abx500_res_to_temp ab8500_temp_tbl_a_thermistor[]; +extern const int ab8500_temp_tbl_a_size; + +extern const struct abx500_res_to_temp ab8500_temp_tbl_b_thermistor[]; +extern const int ab8500_temp_tbl_b_size; + +#endif /* PWR_AB8500_H */ -- 1.8.0 -- 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 v8 5/5] hwmon: add ST-Ericsson ABX500 hwmon driver
Each of ST-Ericsson X500 chip set series consists of both ABX500 and DBX500 chips. This is ABX500 hwmon driver, where the abx500.c is a common layer for all ABX500s, and the ab8500.c is specific for AB8500 chip. Under this designed structure, other chip specific files can be added simply using the same common layer abx500.c. Signed-off-by: Hongbo Zhang --- Documentation/hwmon/ab8500 | 22 ++ Documentation/hwmon/abx500 | 28 +++ drivers/hwmon/Kconfig | 13 ++ drivers/hwmon/Makefile | 1 + drivers/hwmon/ab8500.c | 206 +++ drivers/hwmon/abx500.c | 491 + drivers/hwmon/abx500.h | 69 +++ 7 files changed, 830 insertions(+) create mode 100644 Documentation/hwmon/ab8500 create mode 100644 Documentation/hwmon/abx500 create mode 100644 drivers/hwmon/ab8500.c create mode 100644 drivers/hwmon/abx500.c create mode 100644 drivers/hwmon/abx500.h diff --git a/Documentation/hwmon/ab8500 b/Documentation/hwmon/ab8500 new file mode 100644 index 000..cf169c8 --- /dev/null +++ b/Documentation/hwmon/ab8500 @@ -0,0 +1,22 @@ +Kernel driver ab8500 + + +Supported chips: + * ST-Ericsson AB8500 +Prefix: 'ab8500' +Addresses scanned: - +Datasheet: http://www.stericsson.com/developers/documentation.jsp + +Authors: +Martin Persson +Hongbo Zhang + +Description +--- + +See also Documentation/hwmon/abx500. This is the ST-Ericsson AB8500 specific +driver. + +Currently only the AB8500 internal sensor and one external sensor for battery +temperature are monitored. Other GPADC channels can also be monitored if needed +in future. diff --git a/Documentation/hwmon/abx500 b/Documentation/hwmon/abx500 new file mode 100644 index 000..319a058 --- /dev/null +++ b/Documentation/hwmon/abx500 @@ -0,0 +1,28 @@ +Kernel driver abx500 + + +Supported chips: + * ST-Ericsson ABx500 series +Prefix: 'abx500' +Addresses scanned: - +Datasheet: http://www.stericsson.com/developers/documentation.jsp + +Authors: +Martin Persson +Hongbo Zhang + +Description +--- + +Every ST-Ericsson Ux500 SOC consists of both ABx500 and DBx500 physically, +this is kernel hwmon driver for ABx500. + +There are some GPADCs inside ABx500 which are designed for connecting to +thermal sensors, and there is also a thermal sensor inside ABx500 too, which +raises interrupt when critical temperature reached. + +This abx500 is a common layer which can monitor all of the sensors, every +specific abx500 chip has its special configurations in its own file, e.g. some +sensors can be configured invisible if they are not available on that chip, and +the corresponding gpadc_addr should be set to 0, thus this sensor won't be +polled. diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index 89ac1cb..108e0c1 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig @@ -39,6 +39,19 @@ config HWMON_DEBUG_CHIP comment "Native drivers" +config SENSORS_AB8500 + tristate "AB8500 thermal monitoring" + depends on AB8500_GPADC && AB8500_BM + default n + help + If you say yes here you get support for the thermal sensor part + of the AB8500 chip. The driver includes thermal management for + AB8500 die and two GPADC channels. The GPADC channel are preferably + used to access sensors outside the AB8500 chip. + + This driver can also be built as a module. If so, the module + will be called abx500-temp. + config SENSORS_ABITUGURU tristate "Abit uGuru (rev 1 & 2)" depends on X86 && DMI diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile index 8d6d97e..526a37d 100644 --- a/drivers/hwmon/Makefile +++ b/drivers/hwmon/Makefile @@ -19,6 +19,7 @@ obj-$(CONFIG_SENSORS_W83795) += w83795.o obj-$(CONFIG_SENSORS_W83781D) += w83781d.o obj-$(CONFIG_SENSORS_W83791D) += w83791d.o +obj-$(CONFIG_SENSORS_AB8500) += abx500.o ab8500.o obj-$(CONFIG_SENSORS_ABITUGURU)+= abituguru.o obj-$(CONFIG_SENSORS_ABITUGURU3)+= abituguru3.o obj-$(CONFIG_SENSORS_AD7314) += ad7314.o diff --git a/drivers/hwmon/ab8500.c b/drivers/hwmon/ab8500.c new file mode 100644 index 000..ee0aa3e --- /dev/null +++ b/drivers/hwmon/ab8500.c @@ -0,0 +1,206 @@ +/* + * Copyright (C) ST-Ericsson 2010 - 2013 + * Author: Martin Persson + * Hongbo Zhang + * License Terms: GNU General Public License v2 + * + * When the AB8500 thermal warning temperature is reached (threshold cannot + * be changed by SW), an interrupt is set, and if no further action is taken + * within a certain time frame, pm_power off will be called. + * + * When AB8500 thermal shutdown temperature is reached a hardware shutdown of + * the AB8500 will occur. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#inc
[PATCH v8 3/5] ab8500: power: add const attributes to some data arrays
This patch adds const attributes to AB8500 power and temperature related read-only data arrays. Signed-off-by: Hongbo Zhang --- drivers/power/ab8500_bmdata.c | 20 ++-- drivers/power/ab8500_fg.c | 4 ++-- include/linux/mfd/abx500.h| 6 +++--- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/power/ab8500_bmdata.c b/drivers/power/ab8500_bmdata.c index 05ad966..3cdcdcf 100644 --- a/drivers/power/ab8500_bmdata.c +++ b/drivers/power/ab8500_bmdata.c @@ -11,7 +11,7 @@ * Note that the res_to_temp table must be strictly sorted by falling resistance * values to work. */ -static struct abx500_res_to_temp temp_tbl_a_thermistor[] = { +static const struct abx500_res_to_temp temp_tbl_a_thermistor[] = { {-5, 53407}, { 0, 48594}, { 5, 43804}, @@ -29,7 +29,7 @@ static struct abx500_res_to_temp temp_tbl_a_thermistor[] = { {65, 12500}, }; -static struct abx500_res_to_temp temp_tbl_b_thermistor[] = { +static const struct abx500_res_to_temp temp_tbl_b_thermistor[] = { {-5, 20}, { 0, 159024}, { 5, 151921}, @@ -47,7 +47,7 @@ static struct abx500_res_to_temp temp_tbl_b_thermistor[] = { {65, 82869}, }; -static struct abx500_v_to_cap cap_tbl_a_thermistor[] = { +static const struct abx500_v_to_cap cap_tbl_a_thermistor[] = { {4171, 100}, {4114, 95}, {4009, 83}, @@ -70,7 +70,7 @@ static struct abx500_v_to_cap cap_tbl_a_thermistor[] = { {3247,0}, }; -static struct abx500_v_to_cap cap_tbl_b_thermistor[] = { +static const struct abx500_v_to_cap cap_tbl_b_thermistor[] = { {4161, 100}, {4124, 98}, {4044, 90}, @@ -93,7 +93,7 @@ static struct abx500_v_to_cap cap_tbl_b_thermistor[] = { {3250,0}, }; -static struct abx500_v_to_cap cap_tbl[] = { +static const struct abx500_v_to_cap cap_tbl[] = { {4186, 100}, {4163, 99}, {4114, 95}, @@ -124,7 +124,7 @@ static struct abx500_v_to_cap cap_tbl[] = { * Note that the res_to_temp table must be strictly sorted by falling * resistance values to work. */ -static struct abx500_res_to_temp temp_tbl[] = { +static const struct abx500_res_to_temp temp_tbl[] = { {-5, 214834}, { 0, 162943}, { 5, 124820}, @@ -146,7 +146,7 @@ static struct abx500_res_to_temp temp_tbl[] = { * Note that the batres_vs_temp table must be strictly sorted by falling * temperature values to work. */ -static struct batres_vs_temp temp_to_batres_tbl_thermistor[] = { +static const struct batres_vs_temp temp_to_batres_tbl_thermistor[] = { { 40, 120}, { 30, 135}, { 20, 165}, @@ -160,7 +160,7 @@ static struct batres_vs_temp temp_to_batres_tbl_thermistor[] = { * Note that the batres_vs_temp table must be strictly sorted by falling * temperature values to work. */ -static struct batres_vs_temp temp_to_batres_tbl_ext_thermistor[] = { +static const struct batres_vs_temp temp_to_batres_tbl_ext_thermistor[] = { { 60, 300}, { 30, 300}, { 20, 300}, @@ -171,7 +171,7 @@ static struct batres_vs_temp temp_to_batres_tbl_ext_thermistor[] = { }; /* battery resistance table for LI ION 9100 battery */ -static struct batres_vs_temp temp_to_batres_tbl_9100[] = { +static const struct batres_vs_temp temp_to_batres_tbl_9100[] = { { 60, 180}, { 30, 180}, { 20, 180}, @@ -547,7 +547,7 @@ int ab8500_bm_of_probe(struct device *dev, struct device_node *np, struct abx500_bm_data *bm) { - struct batres_vs_temp *tmp_batres_tbl; + const struct batres_vs_temp *tmp_batres_tbl; struct device_node *battery_node; const char *btech; int i; diff --git a/drivers/power/ab8500_fg.c b/drivers/power/ab8500_fg.c index 1601d27..c5391f5 100644 --- a/drivers/power/ab8500_fg.c +++ b/drivers/power/ab8500_fg.c @@ -863,7 +863,7 @@ static int ab8500_fg_bat_voltage(struct ab8500_fg *di) static int ab8500_fg_volt_to_capacity(struct ab8500_fg *di, int voltage) { int i, tbl_size; - struct abx500_v_to_cap *tbl; + const struct abx500_v_to_cap *tbl; int cap = 0; tbl = di->bm->bat_type[di->bm->batt_id].v_to_cap_tbl, @@ -915,7 +915,7 @@ static int ab8500_fg_uncomp_volt_to_capacity(struct ab8500_fg *di) static int ab8500_fg_battery_resistance(struct ab8500_fg *di) { int i, tbl_size; - struct batres_vs_temp *tbl; + const struct batres_vs_temp *tbl; int resist = 0; tbl = di->bm->bat_type[di->bm->batt_id].batres_tbl; diff --git a/include/linux/mfd/abx500.h b/include/linux/mfd/abx500.h index 33b0253..3301b20 100644 --- a/include/linux/mfd/abx500.h +++ b/include/linux/mfd/abx500.h @@ -183,11 +183,11 @@ struct abx500_battery_type { int low_high_vol_lvl; int battery_resistance; int n_temp_tbl_elements; - struct abx500_res_to_temp *r
[PATCH v8 2/5] ab8500: power: eliminate CamelCase warning of some variables
Some AB8500 power related variable names don't comply with kernel coding rules, any new patch using these variables will result in CamelCase warnings from checkpatch.pl, this patch re-name these variables. Signed-off-by: Hongbo Zhang --- drivers/power/ab8500_bmdata.c | 24 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/power/ab8500_bmdata.c b/drivers/power/ab8500_bmdata.c index 85742a6..05ad966 100644 --- a/drivers/power/ab8500_bmdata.c +++ b/drivers/power/ab8500_bmdata.c @@ -11,7 +11,7 @@ * Note that the res_to_temp table must be strictly sorted by falling resistance * values to work. */ -static struct abx500_res_to_temp temp_tbl_A_thermistor[] = { +static struct abx500_res_to_temp temp_tbl_a_thermistor[] = { {-5, 53407}, { 0, 48594}, { 5, 43804}, @@ -29,7 +29,7 @@ static struct abx500_res_to_temp temp_tbl_A_thermistor[] = { {65, 12500}, }; -static struct abx500_res_to_temp temp_tbl_B_thermistor[] = { +static struct abx500_res_to_temp temp_tbl_b_thermistor[] = { {-5, 20}, { 0, 159024}, { 5, 151921}, @@ -47,7 +47,7 @@ static struct abx500_res_to_temp temp_tbl_B_thermistor[] = { {65, 82869}, }; -static struct abx500_v_to_cap cap_tbl_A_thermistor[] = { +static struct abx500_v_to_cap cap_tbl_a_thermistor[] = { {4171, 100}, {4114, 95}, {4009, 83}, @@ -70,7 +70,7 @@ static struct abx500_v_to_cap cap_tbl_A_thermistor[] = { {3247,0}, }; -static struct abx500_v_to_cap cap_tbl_B_thermistor[] = { +static struct abx500_v_to_cap cap_tbl_b_thermistor[] = { {4161, 100}, {4124, 98}, {4044, 90}, @@ -230,10 +230,10 @@ static struct abx500_battery_type bat_type_thermistor[] = { .maint_b_chg_timer_h = 200, .low_high_cur_lvl = 300, .low_high_vol_lvl = 4000, - .n_temp_tbl_elements = ARRAY_SIZE(temp_tbl_A_thermistor), - .r_to_t_tbl = temp_tbl_A_thermistor, - .n_v_cap_tbl_elements = ARRAY_SIZE(cap_tbl_A_thermistor), - .v_to_cap_tbl = cap_tbl_A_thermistor, + .n_temp_tbl_elements = ARRAY_SIZE(temp_tbl_a_thermistor), + .r_to_t_tbl = temp_tbl_a_thermistor, + .n_v_cap_tbl_elements = ARRAY_SIZE(cap_tbl_a_thermistor), + .v_to_cap_tbl = cap_tbl_a_thermistor, .n_batres_tbl_elements = ARRAY_SIZE(temp_to_batres_tbl_thermistor), .batres_tbl = temp_to_batres_tbl_thermistor, @@ -258,10 +258,10 @@ static struct abx500_battery_type bat_type_thermistor[] = { .maint_b_chg_timer_h = 200, .low_high_cur_lvl = 300, .low_high_vol_lvl = 4000, - .n_temp_tbl_elements = ARRAY_SIZE(temp_tbl_B_thermistor), - .r_to_t_tbl = temp_tbl_B_thermistor, - .n_v_cap_tbl_elements = ARRAY_SIZE(cap_tbl_B_thermistor), - .v_to_cap_tbl = cap_tbl_B_thermistor, + .n_temp_tbl_elements = ARRAY_SIZE(temp_tbl_b_thermistor), + .r_to_t_tbl = temp_tbl_b_thermistor, + .n_v_cap_tbl_elements = ARRAY_SIZE(cap_tbl_b_thermistor), + .v_to_cap_tbl = cap_tbl_b_thermistor, .n_batres_tbl_elements = ARRAY_SIZE(temp_to_batres_tbl_thermistor), .batres_tbl = temp_to_batres_tbl_thermistor, }, -- 1.8.0 -- 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 v8 1/5] ab8500_btemp: make ab8500_btemp_get* interfaces public
Make ab8500_btemp_get_temp interface public, export it and also export the ab8500_btemp_get, ab8500_btemp_get_batctrl_temp interfaces, so that the ab8500 hwmon driver can use them. Signed-off-by: Hongbo Zhang --- drivers/power/ab8500_btemp.c | 5 - include/linux/mfd/abx500/ab8500-bm.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/power/ab8500_btemp.c b/drivers/power/ab8500_btemp.c index a9486f1..d412d34 100644 --- a/drivers/power/ab8500_btemp.c +++ b/drivers/power/ab8500_btemp.c @@ -131,6 +131,7 @@ struct ab8500_btemp *ab8500_btemp_get(void) return btemp; } +EXPORT_SYMBOL(ab8500_btemp_get); /** * ab8500_btemp_batctrl_volt_to_res() - convert batctrl voltage to resistance @@ -815,7 +816,7 @@ static void ab8500_btemp_periodic(struct ab8500_btemp *di, * * Returns battery temperature */ -static int ab8500_btemp_get_temp(struct ab8500_btemp *di) +int ab8500_btemp_get_temp(struct ab8500_btemp *di) { int temp = 0; @@ -851,6 +852,7 @@ static int ab8500_btemp_get_temp(struct ab8500_btemp *di) } return temp; } +EXPORT_SYMBOL(ab8500_btemp_get_temp); /** * ab8500_btemp_get_batctrl_temp() - get the temperature @@ -862,6 +864,7 @@ int ab8500_btemp_get_batctrl_temp(struct ab8500_btemp *btemp) { return btemp->bat_temp * 1000; } +EXPORT_SYMBOL(ab8500_btemp_get_batctrl_temp); /** * ab8500_btemp_get_property() - get the btemp properties diff --git a/include/linux/mfd/abx500/ab8500-bm.h b/include/linux/mfd/abx500/ab8500-bm.h index f5214dc..cc892a8 100644 --- a/include/linux/mfd/abx500/ab8500-bm.h +++ b/include/linux/mfd/abx500/ab8500-bm.h @@ -465,6 +465,7 @@ void ab8500_fg_reinit(void); void ab8500_charger_usb_state_changed(u8 bm_usb_state, u16 mA); struct ab8500_btemp *ab8500_btemp_get(void); int ab8500_btemp_get_batctrl_temp(struct ab8500_btemp *btemp); +int ab8500_btemp_get_temp(struct ab8500_btemp *btemp); struct ab8500_fg *ab8500_fg_get(void); int ab8500_fg_inst_curr_blocking(struct ab8500_fg *dev); int ab8500_fg_inst_curr_start(struct ab8500_fg *di); -- 1.8.0 -- 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 v8 0/5] Add ST-Ericsson AB8500 HWMON driver
Guenter and Anton, As suggested by Anton, I rebased these patches to his latest battery-2.6 tree. Thanks. v7 -> v8 changes: - rebase these patches to Anton's latest battery-2.6 tree. v6 -> v7 changes: - move exporting symbols from [5/5] to [4/5], which was a mistake. v5 -> v6 changes: - add depend on AB8500_BM in Kconfig - fix wrong usage of clamp_val() - export symbols for module compiling v4 -> v5 changes: - split the old [2/3]-ab8500-re-arrange-ab8500-power-and-temperature-data into new three [2/5], [3/5] and [4/5] patches. - hwmon driver minor coding style clean ups: - {} usage in if-else statement in ab8500_read_sensor function - index error fix in gpadc_monitor function - fix issue of clamp_val() usage - remove unnecessary else in function abx500_attrs_visible - remove redundant print message about irq set up - return the calling function return value directly in probe function v3 -> v4 changes: for patch [3/3] - define delays in HZ - update ab8500_read_sensor function, returning temp by parameter - remove ab8500_is_visible function - use clamp_val in set_min and set_max callback - remove unnecessary locks in remove and suspend functions - let abx500 and ab8500 use its own data structure for patch [2/3] - move the data tables from driver/power/ab8500_bmdata.c to include/linux/power/ab8500.h - rename driver/power/ab8500_bmdata.c to driver/power/ab8500_bm.c - rename these variable names to eliminate CamelCase warnings - add const attribute to these data v2 -> v3 changes: - Add interface for converting voltage to temperature - Remove temp5 sensor since we cannot offer temperature read interface of it - Update hyst to use absolute temperature instead of a difference - Add the 3/3 patch v1 -> v2 changes: - Add Documentation/hwmon/abx500 and Documentation/hwmon/abx500 - Make devices which cannot report milli-Celsius invisible - Add temp5_crit interface - Re-work the old find_active_thresholds() to threshold_updated() - Reset updated_min_alarm and updated_max_alarm at the end of each loop - Update the hyst mechamisn to make it works as real hyst - Remove non-stand attributes - Re-order the operations sequence inside probe and remove functions - Update all the lock usages to eliminate race conditions - Make attibutes index starts from 0 also changes: - Since the old [1/2] "ARM: ux500: rename ab8500 to abx500 for hwmon driver" has been merged by Samuel, so won't send it again. - Add another new patch "ab8500_btemp: export two symblols" as [2/2] of this patch set. Hongbo Zhang (5): ab8500_btemp: make ab8500_btemp_get* interfaces public ab8500: power: eliminate CamelCase warning of some variables ab8500: power: add const attributes to some data arrays ab8500: power: export abx500_res_to_temp tables for hwmon hwmon: add ST-Ericsson ABX500 hwmon driver Documentation/hwmon/ab8500 | 22 ++ Documentation/hwmon/abx500 | 28 ++ drivers/hwmon/Kconfig| 13 + drivers/hwmon/Makefile | 1 + drivers/hwmon/ab8500.c | 206 +++ drivers/hwmon/abx500.c | 491 +++ drivers/hwmon/abx500.h | 69 + drivers/power/ab8500_bmdata.c| 44 ++-- drivers/power/ab8500_btemp.c | 5 +- drivers/power/ab8500_fg.c| 4 +- include/linux/mfd/abx500.h | 6 +- include/linux/mfd/abx500/ab8500-bm.h | 1 + include/linux/power/ab8500.h | 16 ++ 13 files changed, 882 insertions(+), 24 deletions(-) create mode 100644 Documentation/hwmon/ab8500 create mode 100644 Documentation/hwmon/abx500 create mode 100644 drivers/hwmon/ab8500.c create mode 100644 drivers/hwmon/abx500.c create mode 100644 drivers/hwmon/abx500.h create mode 100644 include/linux/power/ab8500.h -- 1.8.0 -- 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 v8 0/5] Add ST-Ericsson AB8500 HWMON driver
Guenter and Anton, As suggested by Anton, I rebased these patches to his latest battery-2.6 tree. Thanks. v7 - v8 changes: - rebase these patches to Anton's latest battery-2.6 tree. v6 - v7 changes: - move exporting symbols from [5/5] to [4/5], which was a mistake. v5 - v6 changes: - add depend on AB8500_BM in Kconfig - fix wrong usage of clamp_val() - export symbols for module compiling v4 - v5 changes: - split the old [2/3]-ab8500-re-arrange-ab8500-power-and-temperature-data into new three [2/5], [3/5] and [4/5] patches. - hwmon driver minor coding style clean ups: - {} usage in if-else statement in ab8500_read_sensor function - index error fix in gpadc_monitor function - fix issue of clamp_val() usage - remove unnecessary else in function abx500_attrs_visible - remove redundant print message about irq set up - return the calling function return value directly in probe function v3 - v4 changes: for patch [3/3] - define delays in HZ - update ab8500_read_sensor function, returning temp by parameter - remove ab8500_is_visible function - use clamp_val in set_min and set_max callback - remove unnecessary locks in remove and suspend functions - let abx500 and ab8500 use its own data structure for patch [2/3] - move the data tables from driver/power/ab8500_bmdata.c to include/linux/power/ab8500.h - rename driver/power/ab8500_bmdata.c to driver/power/ab8500_bm.c - rename these variable names to eliminate CamelCase warnings - add const attribute to these data v2 - v3 changes: - Add interface for converting voltage to temperature - Remove temp5 sensor since we cannot offer temperature read interface of it - Update hyst to use absolute temperature instead of a difference - Add the 3/3 patch v1 - v2 changes: - Add Documentation/hwmon/abx500 and Documentation/hwmon/abx500 - Make devices which cannot report milli-Celsius invisible - Add temp5_crit interface - Re-work the old find_active_thresholds() to threshold_updated() - Reset updated_min_alarm and updated_max_alarm at the end of each loop - Update the hyst mechamisn to make it works as real hyst - Remove non-stand attributes - Re-order the operations sequence inside probe and remove functions - Update all the lock usages to eliminate race conditions - Make attibutes index starts from 0 also changes: - Since the old [1/2] ARM: ux500: rename ab8500 to abx500 for hwmon driver has been merged by Samuel, so won't send it again. - Add another new patch ab8500_btemp: export two symblols as [2/2] of this patch set. Hongbo Zhang (5): ab8500_btemp: make ab8500_btemp_get* interfaces public ab8500: power: eliminate CamelCase warning of some variables ab8500: power: add const attributes to some data arrays ab8500: power: export abx500_res_to_temp tables for hwmon hwmon: add ST-Ericsson ABX500 hwmon driver Documentation/hwmon/ab8500 | 22 ++ Documentation/hwmon/abx500 | 28 ++ drivers/hwmon/Kconfig| 13 + drivers/hwmon/Makefile | 1 + drivers/hwmon/ab8500.c | 206 +++ drivers/hwmon/abx500.c | 491 +++ drivers/hwmon/abx500.h | 69 + drivers/power/ab8500_bmdata.c| 44 ++-- drivers/power/ab8500_btemp.c | 5 +- drivers/power/ab8500_fg.c| 4 +- include/linux/mfd/abx500.h | 6 +- include/linux/mfd/abx500/ab8500-bm.h | 1 + include/linux/power/ab8500.h | 16 ++ 13 files changed, 882 insertions(+), 24 deletions(-) create mode 100644 Documentation/hwmon/ab8500 create mode 100644 Documentation/hwmon/abx500 create mode 100644 drivers/hwmon/ab8500.c create mode 100644 drivers/hwmon/abx500.c create mode 100644 drivers/hwmon/abx500.h create mode 100644 include/linux/power/ab8500.h -- 1.8.0 -- 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 v8 1/5] ab8500_btemp: make ab8500_btemp_get* interfaces public
Make ab8500_btemp_get_temp interface public, export it and also export the ab8500_btemp_get, ab8500_btemp_get_batctrl_temp interfaces, so that the ab8500 hwmon driver can use them. Signed-off-by: Hongbo Zhang hongbo.zh...@linaro.org --- drivers/power/ab8500_btemp.c | 5 - include/linux/mfd/abx500/ab8500-bm.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/power/ab8500_btemp.c b/drivers/power/ab8500_btemp.c index a9486f1..d412d34 100644 --- a/drivers/power/ab8500_btemp.c +++ b/drivers/power/ab8500_btemp.c @@ -131,6 +131,7 @@ struct ab8500_btemp *ab8500_btemp_get(void) return btemp; } +EXPORT_SYMBOL(ab8500_btemp_get); /** * ab8500_btemp_batctrl_volt_to_res() - convert batctrl voltage to resistance @@ -815,7 +816,7 @@ static void ab8500_btemp_periodic(struct ab8500_btemp *di, * * Returns battery temperature */ -static int ab8500_btemp_get_temp(struct ab8500_btemp *di) +int ab8500_btemp_get_temp(struct ab8500_btemp *di) { int temp = 0; @@ -851,6 +852,7 @@ static int ab8500_btemp_get_temp(struct ab8500_btemp *di) } return temp; } +EXPORT_SYMBOL(ab8500_btemp_get_temp); /** * ab8500_btemp_get_batctrl_temp() - get the temperature @@ -862,6 +864,7 @@ int ab8500_btemp_get_batctrl_temp(struct ab8500_btemp *btemp) { return btemp-bat_temp * 1000; } +EXPORT_SYMBOL(ab8500_btemp_get_batctrl_temp); /** * ab8500_btemp_get_property() - get the btemp properties diff --git a/include/linux/mfd/abx500/ab8500-bm.h b/include/linux/mfd/abx500/ab8500-bm.h index f5214dc..cc892a8 100644 --- a/include/linux/mfd/abx500/ab8500-bm.h +++ b/include/linux/mfd/abx500/ab8500-bm.h @@ -465,6 +465,7 @@ void ab8500_fg_reinit(void); void ab8500_charger_usb_state_changed(u8 bm_usb_state, u16 mA); struct ab8500_btemp *ab8500_btemp_get(void); int ab8500_btemp_get_batctrl_temp(struct ab8500_btemp *btemp); +int ab8500_btemp_get_temp(struct ab8500_btemp *btemp); struct ab8500_fg *ab8500_fg_get(void); int ab8500_fg_inst_curr_blocking(struct ab8500_fg *dev); int ab8500_fg_inst_curr_start(struct ab8500_fg *di); -- 1.8.0 -- 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 v8 2/5] ab8500: power: eliminate CamelCase warning of some variables
Some AB8500 power related variable names don't comply with kernel coding rules, any new patch using these variables will result in CamelCase warnings from checkpatch.pl, this patch re-name these variables. Signed-off-by: Hongbo Zhang hongbo.zh...@linaro.org --- drivers/power/ab8500_bmdata.c | 24 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/power/ab8500_bmdata.c b/drivers/power/ab8500_bmdata.c index 85742a6..05ad966 100644 --- a/drivers/power/ab8500_bmdata.c +++ b/drivers/power/ab8500_bmdata.c @@ -11,7 +11,7 @@ * Note that the res_to_temp table must be strictly sorted by falling resistance * values to work. */ -static struct abx500_res_to_temp temp_tbl_A_thermistor[] = { +static struct abx500_res_to_temp temp_tbl_a_thermistor[] = { {-5, 53407}, { 0, 48594}, { 5, 43804}, @@ -29,7 +29,7 @@ static struct abx500_res_to_temp temp_tbl_A_thermistor[] = { {65, 12500}, }; -static struct abx500_res_to_temp temp_tbl_B_thermistor[] = { +static struct abx500_res_to_temp temp_tbl_b_thermistor[] = { {-5, 20}, { 0, 159024}, { 5, 151921}, @@ -47,7 +47,7 @@ static struct abx500_res_to_temp temp_tbl_B_thermistor[] = { {65, 82869}, }; -static struct abx500_v_to_cap cap_tbl_A_thermistor[] = { +static struct abx500_v_to_cap cap_tbl_a_thermistor[] = { {4171, 100}, {4114, 95}, {4009, 83}, @@ -70,7 +70,7 @@ static struct abx500_v_to_cap cap_tbl_A_thermistor[] = { {3247,0}, }; -static struct abx500_v_to_cap cap_tbl_B_thermistor[] = { +static struct abx500_v_to_cap cap_tbl_b_thermistor[] = { {4161, 100}, {4124, 98}, {4044, 90}, @@ -230,10 +230,10 @@ static struct abx500_battery_type bat_type_thermistor[] = { .maint_b_chg_timer_h = 200, .low_high_cur_lvl = 300, .low_high_vol_lvl = 4000, - .n_temp_tbl_elements = ARRAY_SIZE(temp_tbl_A_thermistor), - .r_to_t_tbl = temp_tbl_A_thermistor, - .n_v_cap_tbl_elements = ARRAY_SIZE(cap_tbl_A_thermistor), - .v_to_cap_tbl = cap_tbl_A_thermistor, + .n_temp_tbl_elements = ARRAY_SIZE(temp_tbl_a_thermistor), + .r_to_t_tbl = temp_tbl_a_thermistor, + .n_v_cap_tbl_elements = ARRAY_SIZE(cap_tbl_a_thermistor), + .v_to_cap_tbl = cap_tbl_a_thermistor, .n_batres_tbl_elements = ARRAY_SIZE(temp_to_batres_tbl_thermistor), .batres_tbl = temp_to_batres_tbl_thermistor, @@ -258,10 +258,10 @@ static struct abx500_battery_type bat_type_thermistor[] = { .maint_b_chg_timer_h = 200, .low_high_cur_lvl = 300, .low_high_vol_lvl = 4000, - .n_temp_tbl_elements = ARRAY_SIZE(temp_tbl_B_thermistor), - .r_to_t_tbl = temp_tbl_B_thermistor, - .n_v_cap_tbl_elements = ARRAY_SIZE(cap_tbl_B_thermistor), - .v_to_cap_tbl = cap_tbl_B_thermistor, + .n_temp_tbl_elements = ARRAY_SIZE(temp_tbl_b_thermistor), + .r_to_t_tbl = temp_tbl_b_thermistor, + .n_v_cap_tbl_elements = ARRAY_SIZE(cap_tbl_b_thermistor), + .v_to_cap_tbl = cap_tbl_b_thermistor, .n_batres_tbl_elements = ARRAY_SIZE(temp_to_batres_tbl_thermistor), .batres_tbl = temp_to_batres_tbl_thermistor, }, -- 1.8.0 -- 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 v8 3/5] ab8500: power: add const attributes to some data arrays
This patch adds const attributes to AB8500 power and temperature related read-only data arrays. Signed-off-by: Hongbo Zhang hongbo.zh...@linaro.org --- drivers/power/ab8500_bmdata.c | 20 ++-- drivers/power/ab8500_fg.c | 4 ++-- include/linux/mfd/abx500.h| 6 +++--- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/power/ab8500_bmdata.c b/drivers/power/ab8500_bmdata.c index 05ad966..3cdcdcf 100644 --- a/drivers/power/ab8500_bmdata.c +++ b/drivers/power/ab8500_bmdata.c @@ -11,7 +11,7 @@ * Note that the res_to_temp table must be strictly sorted by falling resistance * values to work. */ -static struct abx500_res_to_temp temp_tbl_a_thermistor[] = { +static const struct abx500_res_to_temp temp_tbl_a_thermistor[] = { {-5, 53407}, { 0, 48594}, { 5, 43804}, @@ -29,7 +29,7 @@ static struct abx500_res_to_temp temp_tbl_a_thermistor[] = { {65, 12500}, }; -static struct abx500_res_to_temp temp_tbl_b_thermistor[] = { +static const struct abx500_res_to_temp temp_tbl_b_thermistor[] = { {-5, 20}, { 0, 159024}, { 5, 151921}, @@ -47,7 +47,7 @@ static struct abx500_res_to_temp temp_tbl_b_thermistor[] = { {65, 82869}, }; -static struct abx500_v_to_cap cap_tbl_a_thermistor[] = { +static const struct abx500_v_to_cap cap_tbl_a_thermistor[] = { {4171, 100}, {4114, 95}, {4009, 83}, @@ -70,7 +70,7 @@ static struct abx500_v_to_cap cap_tbl_a_thermistor[] = { {3247,0}, }; -static struct abx500_v_to_cap cap_tbl_b_thermistor[] = { +static const struct abx500_v_to_cap cap_tbl_b_thermistor[] = { {4161, 100}, {4124, 98}, {4044, 90}, @@ -93,7 +93,7 @@ static struct abx500_v_to_cap cap_tbl_b_thermistor[] = { {3250,0}, }; -static struct abx500_v_to_cap cap_tbl[] = { +static const struct abx500_v_to_cap cap_tbl[] = { {4186, 100}, {4163, 99}, {4114, 95}, @@ -124,7 +124,7 @@ static struct abx500_v_to_cap cap_tbl[] = { * Note that the res_to_temp table must be strictly sorted by falling * resistance values to work. */ -static struct abx500_res_to_temp temp_tbl[] = { +static const struct abx500_res_to_temp temp_tbl[] = { {-5, 214834}, { 0, 162943}, { 5, 124820}, @@ -146,7 +146,7 @@ static struct abx500_res_to_temp temp_tbl[] = { * Note that the batres_vs_temp table must be strictly sorted by falling * temperature values to work. */ -static struct batres_vs_temp temp_to_batres_tbl_thermistor[] = { +static const struct batres_vs_temp temp_to_batres_tbl_thermistor[] = { { 40, 120}, { 30, 135}, { 20, 165}, @@ -160,7 +160,7 @@ static struct batres_vs_temp temp_to_batres_tbl_thermistor[] = { * Note that the batres_vs_temp table must be strictly sorted by falling * temperature values to work. */ -static struct batres_vs_temp temp_to_batres_tbl_ext_thermistor[] = { +static const struct batres_vs_temp temp_to_batres_tbl_ext_thermistor[] = { { 60, 300}, { 30, 300}, { 20, 300}, @@ -171,7 +171,7 @@ static struct batres_vs_temp temp_to_batres_tbl_ext_thermistor[] = { }; /* battery resistance table for LI ION 9100 battery */ -static struct batres_vs_temp temp_to_batres_tbl_9100[] = { +static const struct batres_vs_temp temp_to_batres_tbl_9100[] = { { 60, 180}, { 30, 180}, { 20, 180}, @@ -547,7 +547,7 @@ int ab8500_bm_of_probe(struct device *dev, struct device_node *np, struct abx500_bm_data *bm) { - struct batres_vs_temp *tmp_batres_tbl; + const struct batres_vs_temp *tmp_batres_tbl; struct device_node *battery_node; const char *btech; int i; diff --git a/drivers/power/ab8500_fg.c b/drivers/power/ab8500_fg.c index 1601d27..c5391f5 100644 --- a/drivers/power/ab8500_fg.c +++ b/drivers/power/ab8500_fg.c @@ -863,7 +863,7 @@ static int ab8500_fg_bat_voltage(struct ab8500_fg *di) static int ab8500_fg_volt_to_capacity(struct ab8500_fg *di, int voltage) { int i, tbl_size; - struct abx500_v_to_cap *tbl; + const struct abx500_v_to_cap *tbl; int cap = 0; tbl = di-bm-bat_type[di-bm-batt_id].v_to_cap_tbl, @@ -915,7 +915,7 @@ static int ab8500_fg_uncomp_volt_to_capacity(struct ab8500_fg *di) static int ab8500_fg_battery_resistance(struct ab8500_fg *di) { int i, tbl_size; - struct batres_vs_temp *tbl; + const struct batres_vs_temp *tbl; int resist = 0; tbl = di-bm-bat_type[di-bm-batt_id].batres_tbl; diff --git a/include/linux/mfd/abx500.h b/include/linux/mfd/abx500.h index 33b0253..3301b20 100644 --- a/include/linux/mfd/abx500.h +++ b/include/linux/mfd/abx500.h @@ -183,11 +183,11 @@ struct abx500_battery_type { int low_high_vol_lvl; int battery_resistance; int n_temp_tbl_elements; - struct abx500_res_to_temp *r_to_t_tbl
[PATCH v8 4/5] ab8500: power: export abx500_res_to_temp tables for hwmon
This patch exports the thermistor resistance-to-temperature tables, so that the hwmon driver can access them, and also adds the corresponding table size variables. Signed-off-by: Hongbo Zhang hongbo.zh...@linaro.org --- drivers/power/ab8500_bmdata.c | 20 ++-- include/linux/power/ab8500.h | 16 2 files changed, 30 insertions(+), 6 deletions(-) create mode 100644 include/linux/power/ab8500.h diff --git a/drivers/power/ab8500_bmdata.c b/drivers/power/ab8500_bmdata.c index 3cdcdcf..d298645 100644 --- a/drivers/power/ab8500_bmdata.c +++ b/drivers/power/ab8500_bmdata.c @@ -11,7 +11,7 @@ * Note that the res_to_temp table must be strictly sorted by falling resistance * values to work. */ -static const struct abx500_res_to_temp temp_tbl_a_thermistor[] = { +const struct abx500_res_to_temp ab8500_temp_tbl_a_thermistor[] = { {-5, 53407}, { 0, 48594}, { 5, 43804}, @@ -28,8 +28,12 @@ static const struct abx500_res_to_temp temp_tbl_a_thermistor[] = { {60, 13437}, {65, 12500}, }; +EXPORT_SYMBOL(ab8500_temp_tbl_a_thermistor); -static const struct abx500_res_to_temp temp_tbl_b_thermistor[] = { +const int ab8500_temp_tbl_a_size = ARRAY_SIZE(ab8500_temp_tbl_a_thermistor); +EXPORT_SYMBOL(ab8500_temp_tbl_a_size); + +const struct abx500_res_to_temp ab8500_temp_tbl_b_thermistor[] = { {-5, 20}, { 0, 159024}, { 5, 151921}, @@ -46,6 +50,10 @@ static const struct abx500_res_to_temp temp_tbl_b_thermistor[] = { {60, 85461}, {65, 82869}, }; +EXPORT_SYMBOL(ab8500_temp_tbl_b_thermistor); + +const int ab8500_temp_tbl_b_size = ARRAY_SIZE(ab8500_temp_tbl_b_thermistor); +EXPORT_SYMBOL(ab8500_temp_tbl_b_size); static const struct abx500_v_to_cap cap_tbl_a_thermistor[] = { {4171, 100}, @@ -230,8 +238,8 @@ static struct abx500_battery_type bat_type_thermistor[] = { .maint_b_chg_timer_h = 200, .low_high_cur_lvl = 300, .low_high_vol_lvl = 4000, - .n_temp_tbl_elements = ARRAY_SIZE(temp_tbl_a_thermistor), - .r_to_t_tbl = temp_tbl_a_thermistor, + .n_temp_tbl_elements = ARRAY_SIZE(ab8500_temp_tbl_a_thermistor), + .r_to_t_tbl = ab8500_temp_tbl_a_thermistor, .n_v_cap_tbl_elements = ARRAY_SIZE(cap_tbl_a_thermistor), .v_to_cap_tbl = cap_tbl_a_thermistor, .n_batres_tbl_elements = ARRAY_SIZE(temp_to_batres_tbl_thermistor), @@ -258,8 +266,8 @@ static struct abx500_battery_type bat_type_thermistor[] = { .maint_b_chg_timer_h = 200, .low_high_cur_lvl = 300, .low_high_vol_lvl = 4000, - .n_temp_tbl_elements = ARRAY_SIZE(temp_tbl_b_thermistor), - .r_to_t_tbl = temp_tbl_b_thermistor, + .n_temp_tbl_elements = ARRAY_SIZE(ab8500_temp_tbl_b_thermistor), + .r_to_t_tbl = ab8500_temp_tbl_b_thermistor, .n_v_cap_tbl_elements = ARRAY_SIZE(cap_tbl_b_thermistor), .v_to_cap_tbl = cap_tbl_b_thermistor, .n_batres_tbl_elements = ARRAY_SIZE(temp_to_batres_tbl_thermistor), diff --git a/include/linux/power/ab8500.h b/include/linux/power/ab8500.h new file mode 100644 index 000..cdbb6c2 --- /dev/null +++ b/include/linux/power/ab8500.h @@ -0,0 +1,16 @@ +/* + * Copyright (C) ST-Ericsson 2013 + * Author: Hongbo Zhang hongbo.zh...@linaro.com + * License terms: GNU General Public License v2 + */ + +#ifndef PWR_AB8500_H +#define PWR_AB8500_H + +extern const struct abx500_res_to_temp ab8500_temp_tbl_a_thermistor[]; +extern const int ab8500_temp_tbl_a_size; + +extern const struct abx500_res_to_temp ab8500_temp_tbl_b_thermistor[]; +extern const int ab8500_temp_tbl_b_size; + +#endif /* PWR_AB8500_H */ -- 1.8.0 -- 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 v8 5/5] hwmon: add ST-Ericsson ABX500 hwmon driver
Each of ST-Ericsson X500 chip set series consists of both ABX500 and DBX500 chips. This is ABX500 hwmon driver, where the abx500.c is a common layer for all ABX500s, and the ab8500.c is specific for AB8500 chip. Under this designed structure, other chip specific files can be added simply using the same common layer abx500.c. Signed-off-by: Hongbo Zhang hongbo.zh...@linaro.org --- Documentation/hwmon/ab8500 | 22 ++ Documentation/hwmon/abx500 | 28 +++ drivers/hwmon/Kconfig | 13 ++ drivers/hwmon/Makefile | 1 + drivers/hwmon/ab8500.c | 206 +++ drivers/hwmon/abx500.c | 491 + drivers/hwmon/abx500.h | 69 +++ 7 files changed, 830 insertions(+) create mode 100644 Documentation/hwmon/ab8500 create mode 100644 Documentation/hwmon/abx500 create mode 100644 drivers/hwmon/ab8500.c create mode 100644 drivers/hwmon/abx500.c create mode 100644 drivers/hwmon/abx500.h diff --git a/Documentation/hwmon/ab8500 b/Documentation/hwmon/ab8500 new file mode 100644 index 000..cf169c8 --- /dev/null +++ b/Documentation/hwmon/ab8500 @@ -0,0 +1,22 @@ +Kernel driver ab8500 + + +Supported chips: + * ST-Ericsson AB8500 +Prefix: 'ab8500' +Addresses scanned: - +Datasheet: http://www.stericsson.com/developers/documentation.jsp + +Authors: +Martin Persson martin.pers...@stericsson.com +Hongbo Zhang hongbo.zh...@linaro.org + +Description +--- + +See also Documentation/hwmon/abx500. This is the ST-Ericsson AB8500 specific +driver. + +Currently only the AB8500 internal sensor and one external sensor for battery +temperature are monitored. Other GPADC channels can also be monitored if needed +in future. diff --git a/Documentation/hwmon/abx500 b/Documentation/hwmon/abx500 new file mode 100644 index 000..319a058 --- /dev/null +++ b/Documentation/hwmon/abx500 @@ -0,0 +1,28 @@ +Kernel driver abx500 + + +Supported chips: + * ST-Ericsson ABx500 series +Prefix: 'abx500' +Addresses scanned: - +Datasheet: http://www.stericsson.com/developers/documentation.jsp + +Authors: +Martin Persson martin.pers...@stericsson.com +Hongbo Zhang hongbo.zh...@linaro.org + +Description +--- + +Every ST-Ericsson Ux500 SOC consists of both ABx500 and DBx500 physically, +this is kernel hwmon driver for ABx500. + +There are some GPADCs inside ABx500 which are designed for connecting to +thermal sensors, and there is also a thermal sensor inside ABx500 too, which +raises interrupt when critical temperature reached. + +This abx500 is a common layer which can monitor all of the sensors, every +specific abx500 chip has its special configurations in its own file, e.g. some +sensors can be configured invisible if they are not available on that chip, and +the corresponding gpadc_addr should be set to 0, thus this sensor won't be +polled. diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index 89ac1cb..108e0c1 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig @@ -39,6 +39,19 @@ config HWMON_DEBUG_CHIP comment Native drivers +config SENSORS_AB8500 + tristate AB8500 thermal monitoring + depends on AB8500_GPADC AB8500_BM + default n + help + If you say yes here you get support for the thermal sensor part + of the AB8500 chip. The driver includes thermal management for + AB8500 die and two GPADC channels. The GPADC channel are preferably + used to access sensors outside the AB8500 chip. + + This driver can also be built as a module. If so, the module + will be called abx500-temp. + config SENSORS_ABITUGURU tristate Abit uGuru (rev 1 2) depends on X86 DMI diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile index 8d6d97e..526a37d 100644 --- a/drivers/hwmon/Makefile +++ b/drivers/hwmon/Makefile @@ -19,6 +19,7 @@ obj-$(CONFIG_SENSORS_W83795) += w83795.o obj-$(CONFIG_SENSORS_W83781D) += w83781d.o obj-$(CONFIG_SENSORS_W83791D) += w83791d.o +obj-$(CONFIG_SENSORS_AB8500) += abx500.o ab8500.o obj-$(CONFIG_SENSORS_ABITUGURU)+= abituguru.o obj-$(CONFIG_SENSORS_ABITUGURU3)+= abituguru3.o obj-$(CONFIG_SENSORS_AD7314) += ad7314.o diff --git a/drivers/hwmon/ab8500.c b/drivers/hwmon/ab8500.c new file mode 100644 index 000..ee0aa3e --- /dev/null +++ b/drivers/hwmon/ab8500.c @@ -0,0 +1,206 @@ +/* + * Copyright (C) ST-Ericsson 2010 - 2013 + * Author: Martin Persson martin.pers...@stericsson.com + * Hongbo Zhang hongbo.zh...@linaro.org + * License Terms: GNU General Public License v2 + * + * When the AB8500 thermal warning temperature is reached (threshold cannot + * be changed by SW), an interrupt is set, and if no further action is taken + * within a certain time frame, pm_power off will be called. + * + * When AB8500 thermal shutdown temperature is reached a hardware shutdown of + * the AB8500 will occur. + */ + +#include
Re: [PATCH v7 5/5] hwmon: add ST-Ericsson ABX500 hwmon driver
On 28 March 2013 03:48, Guenter Roeck wrote: > On Wed, Mar 27, 2013 at 03:13:32PM +0800, Hongbo Zhang wrote: >> Each of ST-Ericsson X500 chip set series consists of both ABX500 and DBX500 >> chips. This is ABX500 hwmon driver, where the abx500.c is a common layer for >> all ABX500s, and the ab8500.c is specific for AB8500 chip. Under this >> designed >> structure, other chip specific files can be added simply using the same >> common >> layer abx500.c. >> >> Signed-off-by: Hongbo Zhang > > Reviewed-by: Guenter Roeck Thank you very much, Guenter. -- 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 v7 5/5] hwmon: add ST-Ericsson ABX500 hwmon driver
Each of ST-Ericsson X500 chip set series consists of both ABX500 and DBX500 chips. This is ABX500 hwmon driver, where the abx500.c is a common layer for all ABX500s, and the ab8500.c is specific for AB8500 chip. Under this designed structure, other chip specific files can be added simply using the same common layer abx500.c. Signed-off-by: Hongbo Zhang --- Documentation/hwmon/ab8500 | 22 ++ Documentation/hwmon/abx500 | 28 +++ drivers/hwmon/Kconfig | 13 ++ drivers/hwmon/Makefile | 1 + drivers/hwmon/ab8500.c | 206 +++ drivers/hwmon/abx500.c | 491 + drivers/hwmon/abx500.h | 69 +++ 7 files changed, 830 insertions(+) create mode 100644 Documentation/hwmon/ab8500 create mode 100644 Documentation/hwmon/abx500 create mode 100644 drivers/hwmon/ab8500.c create mode 100644 drivers/hwmon/abx500.c create mode 100644 drivers/hwmon/abx500.h diff --git a/Documentation/hwmon/ab8500 b/Documentation/hwmon/ab8500 new file mode 100644 index 000..cf169c8 --- /dev/null +++ b/Documentation/hwmon/ab8500 @@ -0,0 +1,22 @@ +Kernel driver ab8500 + + +Supported chips: + * ST-Ericsson AB8500 +Prefix: 'ab8500' +Addresses scanned: - +Datasheet: http://www.stericsson.com/developers/documentation.jsp + +Authors: +Martin Persson +Hongbo Zhang + +Description +--- + +See also Documentation/hwmon/abx500. This is the ST-Ericsson AB8500 specific +driver. + +Currently only the AB8500 internal sensor and one external sensor for battery +temperature are monitored. Other GPADC channels can also be monitored if needed +in future. diff --git a/Documentation/hwmon/abx500 b/Documentation/hwmon/abx500 new file mode 100644 index 000..319a058 --- /dev/null +++ b/Documentation/hwmon/abx500 @@ -0,0 +1,28 @@ +Kernel driver abx500 + + +Supported chips: + * ST-Ericsson ABx500 series +Prefix: 'abx500' +Addresses scanned: - +Datasheet: http://www.stericsson.com/developers/documentation.jsp + +Authors: +Martin Persson +Hongbo Zhang + +Description +--- + +Every ST-Ericsson Ux500 SOC consists of both ABx500 and DBx500 physically, +this is kernel hwmon driver for ABx500. + +There are some GPADCs inside ABx500 which are designed for connecting to +thermal sensors, and there is also a thermal sensor inside ABx500 too, which +raises interrupt when critical temperature reached. + +This abx500 is a common layer which can monitor all of the sensors, every +specific abx500 chip has its special configurations in its own file, e.g. some +sensors can be configured invisible if they are not available on that chip, and +the corresponding gpadc_addr should be set to 0, thus this sensor won't be +polled. diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index 32f238f..d0d6b52 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig @@ -39,6 +39,19 @@ config HWMON_DEBUG_CHIP comment "Native drivers" +config SENSORS_AB8500 + tristate "AB8500 thermal monitoring" + depends on AB8500_GPADC && AB8500_BM + default n + help + If you say yes here you get support for the thermal sensor part + of the AB8500 chip. The driver includes thermal management for + AB8500 die and two GPADC channels. The GPADC channel are preferably + used to access sensors outside the AB8500 chip. + + This driver can also be built as a module. If so, the module + will be called abx500-temp. + config SENSORS_ABITUGURU tristate "Abit uGuru (rev 1 & 2)" depends on X86 && DMI diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile index 5da2874..06dfe85 100644 --- a/drivers/hwmon/Makefile +++ b/drivers/hwmon/Makefile @@ -19,6 +19,7 @@ obj-$(CONFIG_SENSORS_W83795) += w83795.o obj-$(CONFIG_SENSORS_W83781D) += w83781d.o obj-$(CONFIG_SENSORS_W83791D) += w83791d.o +obj-$(CONFIG_SENSORS_AB8500) += abx500.o ab8500.o obj-$(CONFIG_SENSORS_ABITUGURU)+= abituguru.o obj-$(CONFIG_SENSORS_ABITUGURU3)+= abituguru3.o obj-$(CONFIG_SENSORS_AD7314) += ad7314.o diff --git a/drivers/hwmon/ab8500.c b/drivers/hwmon/ab8500.c new file mode 100644 index 000..ee0aa3e --- /dev/null +++ b/drivers/hwmon/ab8500.c @@ -0,0 +1,206 @@ +/* + * Copyright (C) ST-Ericsson 2010 - 2013 + * Author: Martin Persson + * Hongbo Zhang + * License Terms: GNU General Public License v2 + * + * When the AB8500 thermal warning temperature is reached (threshold cannot + * be changed by SW), an interrupt is set, and if no further action is taken + * within a certain time frame, pm_power off will be called. + * + * When AB8500 thermal shutdown temperature is reached a hardware shutdown of + * the AB8500 will occur. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#inc
[PATCH v7 4/5] ab8500: power: export abx500_res_to_temp tables for hwmon
This patch exports the thermistor resistance-to-temperature tables, so that the hwmon driver can access them, and also adds the corresponding table size variables. Signed-off-by: Hongbo Zhang --- drivers/power/ab8500_bmdata.c | 20 ++-- include/linux/power/ab8500.h | 16 2 files changed, 30 insertions(+), 6 deletions(-) create mode 100644 include/linux/power/ab8500.h diff --git a/drivers/power/ab8500_bmdata.c b/drivers/power/ab8500_bmdata.c index 9c25ca8..05a1077 100644 --- a/drivers/power/ab8500_bmdata.c +++ b/drivers/power/ab8500_bmdata.c @@ -11,7 +11,7 @@ * Note that the res_to_temp table must be strictly sorted by falling resistance * values to work. */ -static const struct abx500_res_to_temp temp_tbl_a_thermistor[] = { +const struct abx500_res_to_temp ab8500_temp_tbl_a_thermistor[] = { {-5, 53407}, { 0, 48594}, { 5, 43804}, @@ -28,8 +28,12 @@ static const struct abx500_res_to_temp temp_tbl_a_thermistor[] = { {60, 13437}, {65, 12500}, }; +EXPORT_SYMBOL(ab8500_temp_tbl_a_thermistor); -static const struct abx500_res_to_temp temp_tbl_b_thermistor[] = { +const int ab8500_temp_tbl_a_size = ARRAY_SIZE(ab8500_temp_tbl_a_thermistor); +EXPORT_SYMBOL(ab8500_temp_tbl_a_size); + +const struct abx500_res_to_temp ab8500_temp_tbl_b_thermistor[] = { {-5, 20}, { 0, 159024}, { 5, 151921}, @@ -46,6 +50,10 @@ static const struct abx500_res_to_temp temp_tbl_b_thermistor[] = { {60, 85461}, {65, 82869}, }; +EXPORT_SYMBOL(ab8500_temp_tbl_b_thermistor); + +const int ab8500_temp_tbl_b_size = ARRAY_SIZE(ab8500_temp_tbl_b_thermistor); +EXPORT_SYMBOL(ab8500_temp_tbl_b_size); static const struct abx500_v_to_cap cap_tbl_a_thermistor[] = { {4171, 100}, @@ -230,8 +238,8 @@ static struct abx500_battery_type bat_type_thermistor[] = { .maint_b_chg_timer_h = 200, .low_high_cur_lvl = 300, .low_high_vol_lvl = 4000, - .n_temp_tbl_elements = ARRAY_SIZE(temp_tbl_a_thermistor), - .r_to_t_tbl = temp_tbl_a_thermistor, + .n_temp_tbl_elements = ARRAY_SIZE(ab8500_temp_tbl_a_thermistor), + .r_to_t_tbl = ab8500_temp_tbl_a_thermistor, .n_v_cap_tbl_elements = ARRAY_SIZE(cap_tbl_a_thermistor), .v_to_cap_tbl = cap_tbl_a_thermistor, .n_batres_tbl_elements = ARRAY_SIZE(temp_to_batres_tbl_thermistor), @@ -258,8 +266,8 @@ static struct abx500_battery_type bat_type_thermistor[] = { .maint_b_chg_timer_h = 200, .low_high_cur_lvl = 300, .low_high_vol_lvl = 4000, - .n_temp_tbl_elements = ARRAY_SIZE(temp_tbl_b_thermistor), - .r_to_t_tbl = temp_tbl_b_thermistor, + .n_temp_tbl_elements = ARRAY_SIZE(ab8500_temp_tbl_b_thermistor), + .r_to_t_tbl = ab8500_temp_tbl_b_thermistor, .n_v_cap_tbl_elements = ARRAY_SIZE(cap_tbl_b_thermistor), .v_to_cap_tbl = cap_tbl_b_thermistor, .n_batres_tbl_elements = ARRAY_SIZE(temp_to_batres_tbl_thermistor), diff --git a/include/linux/power/ab8500.h b/include/linux/power/ab8500.h new file mode 100644 index 000..cdbb6c2 --- /dev/null +++ b/include/linux/power/ab8500.h @@ -0,0 +1,16 @@ +/* + * Copyright (C) ST-Ericsson 2013 + * Author: Hongbo Zhang + * License terms: GNU General Public License v2 + */ + +#ifndef PWR_AB8500_H +#define PWR_AB8500_H + +extern const struct abx500_res_to_temp ab8500_temp_tbl_a_thermistor[]; +extern const int ab8500_temp_tbl_a_size; + +extern const struct abx500_res_to_temp ab8500_temp_tbl_b_thermistor[]; +extern const int ab8500_temp_tbl_b_size; + +#endif /* PWR_AB8500_H */ -- 1.8.0 -- 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 v7 3/5] ab8500: power: add const attributes to some data arrays
This patch adds const attributes to AB8500 power and temperature related read-only data arrays. Signed-off-by: Hongbo Zhang --- drivers/power/ab8500_bmdata.c | 18 +- drivers/power/ab8500_fg.c | 4 ++-- include/linux/mfd/abx500.h| 6 +++--- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/power/ab8500_bmdata.c b/drivers/power/ab8500_bmdata.c index f836550..9c25ca8 100644 --- a/drivers/power/ab8500_bmdata.c +++ b/drivers/power/ab8500_bmdata.c @@ -11,7 +11,7 @@ * Note that the res_to_temp table must be strictly sorted by falling resistance * values to work. */ -static struct abx500_res_to_temp temp_tbl_a_thermistor[] = { +static const struct abx500_res_to_temp temp_tbl_a_thermistor[] = { {-5, 53407}, { 0, 48594}, { 5, 43804}, @@ -29,7 +29,7 @@ static struct abx500_res_to_temp temp_tbl_a_thermistor[] = { {65, 12500}, }; -static struct abx500_res_to_temp temp_tbl_b_thermistor[] = { +static const struct abx500_res_to_temp temp_tbl_b_thermistor[] = { {-5, 20}, { 0, 159024}, { 5, 151921}, @@ -47,7 +47,7 @@ static struct abx500_res_to_temp temp_tbl_b_thermistor[] = { {65, 82869}, }; -static struct abx500_v_to_cap cap_tbl_a_thermistor[] = { +static const struct abx500_v_to_cap cap_tbl_a_thermistor[] = { {4171, 100}, {4114, 95}, {4009, 83}, @@ -70,7 +70,7 @@ static struct abx500_v_to_cap cap_tbl_a_thermistor[] = { {3247,0}, }; -static struct abx500_v_to_cap cap_tbl_b_thermistor[] = { +static const struct abx500_v_to_cap cap_tbl_b_thermistor[] = { {4161, 100}, {4124, 98}, {4044, 90}, @@ -93,7 +93,7 @@ static struct abx500_v_to_cap cap_tbl_b_thermistor[] = { {3250,0}, }; -static struct abx500_v_to_cap cap_tbl[] = { +static const struct abx500_v_to_cap cap_tbl[] = { {4186, 100}, {4163, 99}, {4114, 95}, @@ -124,7 +124,7 @@ static struct abx500_v_to_cap cap_tbl[] = { * Note that the res_to_temp table must be strictly sorted by falling * resistance values to work. */ -static struct abx500_res_to_temp temp_tbl[] = { +static const struct abx500_res_to_temp temp_tbl[] = { {-5, 214834}, { 0, 162943}, { 5, 124820}, @@ -146,7 +146,7 @@ static struct abx500_res_to_temp temp_tbl[] = { * Note that the batres_vs_temp table must be strictly sorted by falling * temperature values to work. */ -static struct batres_vs_temp temp_to_batres_tbl_thermistor[] = { +static const struct batres_vs_temp temp_to_batres_tbl_thermistor[] = { { 40, 120}, { 30, 135}, { 20, 165}, @@ -160,7 +160,7 @@ static struct batres_vs_temp temp_to_batres_tbl_thermistor[] = { * Note that the batres_vs_temp table must be strictly sorted by falling * temperature values to work. */ -static struct batres_vs_temp temp_to_batres_tbl_ext_thermistor[] = { +static const struct batres_vs_temp temp_to_batres_tbl_ext_thermistor[] = { { 60, 300}, { 30, 300}, { 20, 300}, @@ -171,7 +171,7 @@ static struct batres_vs_temp temp_to_batres_tbl_ext_thermistor[] = { }; /* battery resistance table for LI ION 9100 battery */ -static struct batres_vs_temp temp_to_batres_tbl_9100[] = { +static const struct batres_vs_temp temp_to_batres_tbl_9100[] = { { 60, 180}, { 30, 180}, { 20, 180}, diff --git a/drivers/power/ab8500_fg.c b/drivers/power/ab8500_fg.c index b3bf178..d21456d 100644 --- a/drivers/power/ab8500_fg.c +++ b/drivers/power/ab8500_fg.c @@ -811,7 +811,7 @@ static int ab8500_fg_bat_voltage(struct ab8500_fg *di) static int ab8500_fg_volt_to_capacity(struct ab8500_fg *di, int voltage) { int i, tbl_size; - struct abx500_v_to_cap *tbl; + const struct abx500_v_to_cap *tbl; int cap = 0; tbl = di->bat->bat_type[di->bat->batt_id].v_to_cap_tbl, @@ -863,7 +863,7 @@ static int ab8500_fg_uncomp_volt_to_capacity(struct ab8500_fg *di) static int ab8500_fg_battery_resistance(struct ab8500_fg *di) { int i, tbl_size; - struct batres_vs_temp *tbl; + const struct batres_vs_temp *tbl; int resist = 0; tbl = di->bat->bat_type[di->bat->batt_id].batres_tbl; diff --git a/include/linux/mfd/abx500.h b/include/linux/mfd/abx500.h index 2138bd3..03fc0f1 100644 --- a/include/linux/mfd/abx500.h +++ b/include/linux/mfd/abx500.h @@ -173,11 +173,11 @@ struct abx500_battery_type { int low_high_vol_lvl; int battery_resistance; int n_temp_tbl_elements; - struct abx500_res_to_temp *r_to_t_tbl; + const struct abx500_res_to_temp *r_to_t_tbl; int n_v_cap_tbl_elements; - struct abx500_v_to_cap *v_to_cap_tbl; + const struct abx500_v_to_cap *v_to_cap_tbl; int n_batres_tbl_elements; - struct batres_vs_temp *batres_tbl; + const struct batres_vs_temp *batres_tbl; }; /** -- 1.8.0
[PATCH v7 2/5] ab8500: power: eliminate CamelCase warning of some variables
Some AB8500 power related variable names don't comply with kernel coding rules, any new patch using these variables will result in CamelCase warnings from checkpatch.pl, this patch re-name these variables. Signed-off-by: Hongbo Zhang --- drivers/power/ab8500_bmdata.c | 24 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/power/ab8500_bmdata.c b/drivers/power/ab8500_bmdata.c index f034ae4..f836550 100644 --- a/drivers/power/ab8500_bmdata.c +++ b/drivers/power/ab8500_bmdata.c @@ -11,7 +11,7 @@ * Note that the res_to_temp table must be strictly sorted by falling resistance * values to work. */ -static struct abx500_res_to_temp temp_tbl_A_thermistor[] = { +static struct abx500_res_to_temp temp_tbl_a_thermistor[] = { {-5, 53407}, { 0, 48594}, { 5, 43804}, @@ -29,7 +29,7 @@ static struct abx500_res_to_temp temp_tbl_A_thermistor[] = { {65, 12500}, }; -static struct abx500_res_to_temp temp_tbl_B_thermistor[] = { +static struct abx500_res_to_temp temp_tbl_b_thermistor[] = { {-5, 20}, { 0, 159024}, { 5, 151921}, @@ -47,7 +47,7 @@ static struct abx500_res_to_temp temp_tbl_B_thermistor[] = { {65, 82869}, }; -static struct abx500_v_to_cap cap_tbl_A_thermistor[] = { +static struct abx500_v_to_cap cap_tbl_a_thermistor[] = { {4171, 100}, {4114, 95}, {4009, 83}, @@ -70,7 +70,7 @@ static struct abx500_v_to_cap cap_tbl_A_thermistor[] = { {3247,0}, }; -static struct abx500_v_to_cap cap_tbl_B_thermistor[] = { +static struct abx500_v_to_cap cap_tbl_b_thermistor[] = { {4161, 100}, {4124, 98}, {4044, 90}, @@ -230,10 +230,10 @@ static struct abx500_battery_type bat_type_thermistor[] = { .maint_b_chg_timer_h = 200, .low_high_cur_lvl = 300, .low_high_vol_lvl = 4000, - .n_temp_tbl_elements = ARRAY_SIZE(temp_tbl_A_thermistor), - .r_to_t_tbl = temp_tbl_A_thermistor, - .n_v_cap_tbl_elements = ARRAY_SIZE(cap_tbl_A_thermistor), - .v_to_cap_tbl = cap_tbl_A_thermistor, + .n_temp_tbl_elements = ARRAY_SIZE(temp_tbl_a_thermistor), + .r_to_t_tbl = temp_tbl_a_thermistor, + .n_v_cap_tbl_elements = ARRAY_SIZE(cap_tbl_a_thermistor), + .v_to_cap_tbl = cap_tbl_a_thermistor, .n_batres_tbl_elements = ARRAY_SIZE(temp_to_batres_tbl_thermistor), .batres_tbl = temp_to_batres_tbl_thermistor, @@ -258,10 +258,10 @@ static struct abx500_battery_type bat_type_thermistor[] = { .maint_b_chg_timer_h = 200, .low_high_cur_lvl = 300, .low_high_vol_lvl = 4000, - .n_temp_tbl_elements = ARRAY_SIZE(temp_tbl_B_thermistor), - .r_to_t_tbl = temp_tbl_B_thermistor, - .n_v_cap_tbl_elements = ARRAY_SIZE(cap_tbl_B_thermistor), - .v_to_cap_tbl = cap_tbl_B_thermistor, + .n_temp_tbl_elements = ARRAY_SIZE(temp_tbl_b_thermistor), + .r_to_t_tbl = temp_tbl_b_thermistor, + .n_v_cap_tbl_elements = ARRAY_SIZE(cap_tbl_b_thermistor), + .v_to_cap_tbl = cap_tbl_b_thermistor, .n_batres_tbl_elements = ARRAY_SIZE(temp_to_batres_tbl_thermistor), .batres_tbl = temp_to_batres_tbl_thermistor, }, -- 1.8.0 -- 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 v7 1/5] ab8500_btemp: make ab8500_btemp_get* interfaces public
Make ab8500_btemp_get_temp interface public, export it and also export the ab8500_btemp_get, ab8500_btemp_get_batctrl_temp interfaces, so that the ab8500 hwmon driver can use them. Signed-off-by: Hongbo Zhang Acked-by: Anton Vorontsov --- drivers/power/ab8500_btemp.c | 5 - include/linux/mfd/abx500/ab8500-bm.h | 5 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/power/ab8500_btemp.c b/drivers/power/ab8500_btemp.c index 20e2a7d..3359075 100644 --- a/drivers/power/ab8500_btemp.c +++ b/drivers/power/ab8500_btemp.c @@ -123,6 +123,7 @@ struct ab8500_btemp *ab8500_btemp_get(void) return btemp; } +EXPORT_SYMBOL(ab8500_btemp_get); /** * ab8500_btemp_batctrl_volt_to_res() - convert batctrl voltage to resistance @@ -727,7 +728,7 @@ static void ab8500_btemp_periodic(struct ab8500_btemp *di, * * Returns battery temperature */ -static int ab8500_btemp_get_temp(struct ab8500_btemp *di) +int ab8500_btemp_get_temp(struct ab8500_btemp *di) { int temp = 0; @@ -763,6 +764,7 @@ static int ab8500_btemp_get_temp(struct ab8500_btemp *di) } return temp; } +EXPORT_SYMBOL(ab8500_btemp_get_temp); /** * ab8500_btemp_get_batctrl_temp() - get the temperature @@ -774,6 +776,7 @@ int ab8500_btemp_get_batctrl_temp(struct ab8500_btemp *btemp) { return btemp->bat_temp * 1000; } +EXPORT_SYMBOL(ab8500_btemp_get_batctrl_temp); /** * ab8500_btemp_get_property() - get the btemp properties diff --git a/include/linux/mfd/abx500/ab8500-bm.h b/include/linux/mfd/abx500/ab8500-bm.h index 44310c9..4dd79f6 100644 --- a/include/linux/mfd/abx500/ab8500-bm.h +++ b/include/linux/mfd/abx500/ab8500-bm.h @@ -427,6 +427,7 @@ void ab8500_fg_reinit(void); void ab8500_charger_usb_state_changed(u8 bm_usb_state, u16 mA); struct ab8500_btemp *ab8500_btemp_get(void); int ab8500_btemp_get_batctrl_temp(struct ab8500_btemp *btemp); +int ab8500_btemp_get_temp(struct ab8500_btemp *btemp); struct ab8500_fg *ab8500_fg_get(void); int ab8500_fg_inst_curr_blocking(struct ab8500_fg *dev); int ab8500_fg_inst_curr_start(struct ab8500_fg *di); @@ -451,6 +452,10 @@ static int ab8500_btemp_get_batctrl_temp(struct ab8500_btemp *btemp) { return 0; } +static int ab8500_btemp_get_temp(struct ab8500_btemp *btemp) +{ + return 0; +} struct ab8500_fg *ab8500_fg_get(void) { return NULL; -- 1.8.0 -- 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 v7 0/5] Add ST-Ericsson AB8500 HWMON driver
Guenter and Anton, Only one minor update as Guenter mentioned for v6, thank you. v6 -> v7 changes: - move exporting symbols from [5/5] to [4/5], which was a mistake. v5 -> v6 changes: - add depend on AB8500_BM in Kconfig - fix wrong usage of clamp_val() - export symbols for module compiling v4 -> v5 changes: - split the old [2/3]-ab8500-re-arrange-ab8500-power-and-temperature-data into new three [2/5], [3/5] and [4/5] patches. - hwmon driver minor coding style clean ups: - {} usage in if-else statement in ab8500_read_sensor function - index error fix in gpadc_monitor function - fix issue of clamp_val() usage - remove unnecessary else in function abx500_attrs_visible - remove redundant print message about irq set up - return the calling function return value directly in probe function v3 -> v4 changes: for patch [3/3] - define delays in HZ - update ab8500_read_sensor function, returning temp by parameter - remove ab8500_is_visible function - use clamp_val in set_min and set_max callback - remove unnecessary locks in remove and suspend functions - let abx500 and ab8500 use its own data structure for patch [2/3] - move the data tables from driver/power/ab8500_bmdata.c to include/linux/power/ab8500.h - rename driver/power/ab8500_bmdata.c to driver/power/ab8500_bm.c - rename these variable names to eliminate CamelCase warnings - add const attribute to these data v2 -> v3 changes: - Add interface for converting voltage to temperature - Remove temp5 sensor since we cannot offer temperature read interface of it - Update hyst to use absolute temperature instead of a difference - Add the 3/3 patch v1 -> v2 changes: - Add Documentation/hwmon/abx500 and Documentation/hwmon/abx500 - Make devices which cannot report milli-Celsius invisible - Add temp5_crit interface - Re-work the old find_active_thresholds() to threshold_updated() - Reset updated_min_alarm and updated_max_alarm at the end of each loop - Update the hyst mechamisn to make it works as real hyst - Remove non-stand attributes - Re-order the operations sequence inside probe and remove functions - Update all the lock usages to eliminate race conditions - Make attibutes index starts from 0 also changes: - Since the old [1/2] "ARM: ux500: rename ab8500 to abx500 for hwmon driver" has been merged by Samuel, so won't send it again. - Add another new patch "ab8500_btemp: export two symblols" as [2/2] of this patch set. Hongbo Zhang (5): ab8500_btemp: make ab8500_btemp_get* interfaces public ab8500: power: eliminate CamelCase warning of some variables ab8500: power: add const attributes to some data arrays ab8500: power: export abx500_res_to_temp tables for hwmon hwmon: add ST-Ericsson ABX500 hwmon driver Documentation/hwmon/ab8500 | 22 ++ Documentation/hwmon/abx500 | 28 ++ drivers/hwmon/Kconfig| 13 + drivers/hwmon/Makefile | 1 + drivers/hwmon/ab8500.c | 206 +++ drivers/hwmon/abx500.c | 491 +++ drivers/hwmon/abx500.h | 69 + drivers/power/ab8500_bmdata.c| 42 +-- drivers/power/ab8500_btemp.c | 5 +- drivers/power/ab8500_fg.c| 4 +- include/linux/mfd/abx500.h | 6 +- include/linux/mfd/abx500/ab8500-bm.h | 5 + include/linux/power/ab8500.h | 16 ++ 13 files changed, 885 insertions(+), 23 deletions(-) create mode 100644 Documentation/hwmon/ab8500 create mode 100644 Documentation/hwmon/abx500 create mode 100644 drivers/hwmon/ab8500.c create mode 100644 drivers/hwmon/abx500.c create mode 100644 drivers/hwmon/abx500.h create mode 100644 include/linux/power/ab8500.h -- 1.8.0 -- 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 v7 0/5] Add ST-Ericsson AB8500 HWMON driver
Guenter and Anton, Only one minor update as Guenter mentioned for v6, thank you. v6 - v7 changes: - move exporting symbols from [5/5] to [4/5], which was a mistake. v5 - v6 changes: - add depend on AB8500_BM in Kconfig - fix wrong usage of clamp_val() - export symbols for module compiling v4 - v5 changes: - split the old [2/3]-ab8500-re-arrange-ab8500-power-and-temperature-data into new three [2/5], [3/5] and [4/5] patches. - hwmon driver minor coding style clean ups: - {} usage in if-else statement in ab8500_read_sensor function - index error fix in gpadc_monitor function - fix issue of clamp_val() usage - remove unnecessary else in function abx500_attrs_visible - remove redundant print message about irq set up - return the calling function return value directly in probe function v3 - v4 changes: for patch [3/3] - define delays in HZ - update ab8500_read_sensor function, returning temp by parameter - remove ab8500_is_visible function - use clamp_val in set_min and set_max callback - remove unnecessary locks in remove and suspend functions - let abx500 and ab8500 use its own data structure for patch [2/3] - move the data tables from driver/power/ab8500_bmdata.c to include/linux/power/ab8500.h - rename driver/power/ab8500_bmdata.c to driver/power/ab8500_bm.c - rename these variable names to eliminate CamelCase warnings - add const attribute to these data v2 - v3 changes: - Add interface for converting voltage to temperature - Remove temp5 sensor since we cannot offer temperature read interface of it - Update hyst to use absolute temperature instead of a difference - Add the 3/3 patch v1 - v2 changes: - Add Documentation/hwmon/abx500 and Documentation/hwmon/abx500 - Make devices which cannot report milli-Celsius invisible - Add temp5_crit interface - Re-work the old find_active_thresholds() to threshold_updated() - Reset updated_min_alarm and updated_max_alarm at the end of each loop - Update the hyst mechamisn to make it works as real hyst - Remove non-stand attributes - Re-order the operations sequence inside probe and remove functions - Update all the lock usages to eliminate race conditions - Make attibutes index starts from 0 also changes: - Since the old [1/2] ARM: ux500: rename ab8500 to abx500 for hwmon driver has been merged by Samuel, so won't send it again. - Add another new patch ab8500_btemp: export two symblols as [2/2] of this patch set. Hongbo Zhang (5): ab8500_btemp: make ab8500_btemp_get* interfaces public ab8500: power: eliminate CamelCase warning of some variables ab8500: power: add const attributes to some data arrays ab8500: power: export abx500_res_to_temp tables for hwmon hwmon: add ST-Ericsson ABX500 hwmon driver Documentation/hwmon/ab8500 | 22 ++ Documentation/hwmon/abx500 | 28 ++ drivers/hwmon/Kconfig| 13 + drivers/hwmon/Makefile | 1 + drivers/hwmon/ab8500.c | 206 +++ drivers/hwmon/abx500.c | 491 +++ drivers/hwmon/abx500.h | 69 + drivers/power/ab8500_bmdata.c| 42 +-- drivers/power/ab8500_btemp.c | 5 +- drivers/power/ab8500_fg.c| 4 +- include/linux/mfd/abx500.h | 6 +- include/linux/mfd/abx500/ab8500-bm.h | 5 + include/linux/power/ab8500.h | 16 ++ 13 files changed, 885 insertions(+), 23 deletions(-) create mode 100644 Documentation/hwmon/ab8500 create mode 100644 Documentation/hwmon/abx500 create mode 100644 drivers/hwmon/ab8500.c create mode 100644 drivers/hwmon/abx500.c create mode 100644 drivers/hwmon/abx500.h create mode 100644 include/linux/power/ab8500.h -- 1.8.0 -- 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 v7 1/5] ab8500_btemp: make ab8500_btemp_get* interfaces public
Make ab8500_btemp_get_temp interface public, export it and also export the ab8500_btemp_get, ab8500_btemp_get_batctrl_temp interfaces, so that the ab8500 hwmon driver can use them. Signed-off-by: Hongbo Zhang hongbo.zh...@linaro.org Acked-by: Anton Vorontsov an...@enomsg.org --- drivers/power/ab8500_btemp.c | 5 - include/linux/mfd/abx500/ab8500-bm.h | 5 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/power/ab8500_btemp.c b/drivers/power/ab8500_btemp.c index 20e2a7d..3359075 100644 --- a/drivers/power/ab8500_btemp.c +++ b/drivers/power/ab8500_btemp.c @@ -123,6 +123,7 @@ struct ab8500_btemp *ab8500_btemp_get(void) return btemp; } +EXPORT_SYMBOL(ab8500_btemp_get); /** * ab8500_btemp_batctrl_volt_to_res() - convert batctrl voltage to resistance @@ -727,7 +728,7 @@ static void ab8500_btemp_periodic(struct ab8500_btemp *di, * * Returns battery temperature */ -static int ab8500_btemp_get_temp(struct ab8500_btemp *di) +int ab8500_btemp_get_temp(struct ab8500_btemp *di) { int temp = 0; @@ -763,6 +764,7 @@ static int ab8500_btemp_get_temp(struct ab8500_btemp *di) } return temp; } +EXPORT_SYMBOL(ab8500_btemp_get_temp); /** * ab8500_btemp_get_batctrl_temp() - get the temperature @@ -774,6 +776,7 @@ int ab8500_btemp_get_batctrl_temp(struct ab8500_btemp *btemp) { return btemp-bat_temp * 1000; } +EXPORT_SYMBOL(ab8500_btemp_get_batctrl_temp); /** * ab8500_btemp_get_property() - get the btemp properties diff --git a/include/linux/mfd/abx500/ab8500-bm.h b/include/linux/mfd/abx500/ab8500-bm.h index 44310c9..4dd79f6 100644 --- a/include/linux/mfd/abx500/ab8500-bm.h +++ b/include/linux/mfd/abx500/ab8500-bm.h @@ -427,6 +427,7 @@ void ab8500_fg_reinit(void); void ab8500_charger_usb_state_changed(u8 bm_usb_state, u16 mA); struct ab8500_btemp *ab8500_btemp_get(void); int ab8500_btemp_get_batctrl_temp(struct ab8500_btemp *btemp); +int ab8500_btemp_get_temp(struct ab8500_btemp *btemp); struct ab8500_fg *ab8500_fg_get(void); int ab8500_fg_inst_curr_blocking(struct ab8500_fg *dev); int ab8500_fg_inst_curr_start(struct ab8500_fg *di); @@ -451,6 +452,10 @@ static int ab8500_btemp_get_batctrl_temp(struct ab8500_btemp *btemp) { return 0; } +static int ab8500_btemp_get_temp(struct ab8500_btemp *btemp) +{ + return 0; +} struct ab8500_fg *ab8500_fg_get(void) { return NULL; -- 1.8.0 -- 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 v7 2/5] ab8500: power: eliminate CamelCase warning of some variables
Some AB8500 power related variable names don't comply with kernel coding rules, any new patch using these variables will result in CamelCase warnings from checkpatch.pl, this patch re-name these variables. Signed-off-by: Hongbo Zhang hongbo.zh...@linaro.org --- drivers/power/ab8500_bmdata.c | 24 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/power/ab8500_bmdata.c b/drivers/power/ab8500_bmdata.c index f034ae4..f836550 100644 --- a/drivers/power/ab8500_bmdata.c +++ b/drivers/power/ab8500_bmdata.c @@ -11,7 +11,7 @@ * Note that the res_to_temp table must be strictly sorted by falling resistance * values to work. */ -static struct abx500_res_to_temp temp_tbl_A_thermistor[] = { +static struct abx500_res_to_temp temp_tbl_a_thermistor[] = { {-5, 53407}, { 0, 48594}, { 5, 43804}, @@ -29,7 +29,7 @@ static struct abx500_res_to_temp temp_tbl_A_thermistor[] = { {65, 12500}, }; -static struct abx500_res_to_temp temp_tbl_B_thermistor[] = { +static struct abx500_res_to_temp temp_tbl_b_thermistor[] = { {-5, 20}, { 0, 159024}, { 5, 151921}, @@ -47,7 +47,7 @@ static struct abx500_res_to_temp temp_tbl_B_thermistor[] = { {65, 82869}, }; -static struct abx500_v_to_cap cap_tbl_A_thermistor[] = { +static struct abx500_v_to_cap cap_tbl_a_thermistor[] = { {4171, 100}, {4114, 95}, {4009, 83}, @@ -70,7 +70,7 @@ static struct abx500_v_to_cap cap_tbl_A_thermistor[] = { {3247,0}, }; -static struct abx500_v_to_cap cap_tbl_B_thermistor[] = { +static struct abx500_v_to_cap cap_tbl_b_thermistor[] = { {4161, 100}, {4124, 98}, {4044, 90}, @@ -230,10 +230,10 @@ static struct abx500_battery_type bat_type_thermistor[] = { .maint_b_chg_timer_h = 200, .low_high_cur_lvl = 300, .low_high_vol_lvl = 4000, - .n_temp_tbl_elements = ARRAY_SIZE(temp_tbl_A_thermistor), - .r_to_t_tbl = temp_tbl_A_thermistor, - .n_v_cap_tbl_elements = ARRAY_SIZE(cap_tbl_A_thermistor), - .v_to_cap_tbl = cap_tbl_A_thermistor, + .n_temp_tbl_elements = ARRAY_SIZE(temp_tbl_a_thermistor), + .r_to_t_tbl = temp_tbl_a_thermistor, + .n_v_cap_tbl_elements = ARRAY_SIZE(cap_tbl_a_thermistor), + .v_to_cap_tbl = cap_tbl_a_thermistor, .n_batres_tbl_elements = ARRAY_SIZE(temp_to_batres_tbl_thermistor), .batres_tbl = temp_to_batres_tbl_thermistor, @@ -258,10 +258,10 @@ static struct abx500_battery_type bat_type_thermistor[] = { .maint_b_chg_timer_h = 200, .low_high_cur_lvl = 300, .low_high_vol_lvl = 4000, - .n_temp_tbl_elements = ARRAY_SIZE(temp_tbl_B_thermistor), - .r_to_t_tbl = temp_tbl_B_thermistor, - .n_v_cap_tbl_elements = ARRAY_SIZE(cap_tbl_B_thermistor), - .v_to_cap_tbl = cap_tbl_B_thermistor, + .n_temp_tbl_elements = ARRAY_SIZE(temp_tbl_b_thermistor), + .r_to_t_tbl = temp_tbl_b_thermistor, + .n_v_cap_tbl_elements = ARRAY_SIZE(cap_tbl_b_thermistor), + .v_to_cap_tbl = cap_tbl_b_thermistor, .n_batres_tbl_elements = ARRAY_SIZE(temp_to_batres_tbl_thermistor), .batres_tbl = temp_to_batres_tbl_thermistor, }, -- 1.8.0 -- 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 v7 3/5] ab8500: power: add const attributes to some data arrays
This patch adds const attributes to AB8500 power and temperature related read-only data arrays. Signed-off-by: Hongbo Zhang hongbo.zh...@linaro.org --- drivers/power/ab8500_bmdata.c | 18 +- drivers/power/ab8500_fg.c | 4 ++-- include/linux/mfd/abx500.h| 6 +++--- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/power/ab8500_bmdata.c b/drivers/power/ab8500_bmdata.c index f836550..9c25ca8 100644 --- a/drivers/power/ab8500_bmdata.c +++ b/drivers/power/ab8500_bmdata.c @@ -11,7 +11,7 @@ * Note that the res_to_temp table must be strictly sorted by falling resistance * values to work. */ -static struct abx500_res_to_temp temp_tbl_a_thermistor[] = { +static const struct abx500_res_to_temp temp_tbl_a_thermistor[] = { {-5, 53407}, { 0, 48594}, { 5, 43804}, @@ -29,7 +29,7 @@ static struct abx500_res_to_temp temp_tbl_a_thermistor[] = { {65, 12500}, }; -static struct abx500_res_to_temp temp_tbl_b_thermistor[] = { +static const struct abx500_res_to_temp temp_tbl_b_thermistor[] = { {-5, 20}, { 0, 159024}, { 5, 151921}, @@ -47,7 +47,7 @@ static struct abx500_res_to_temp temp_tbl_b_thermistor[] = { {65, 82869}, }; -static struct abx500_v_to_cap cap_tbl_a_thermistor[] = { +static const struct abx500_v_to_cap cap_tbl_a_thermistor[] = { {4171, 100}, {4114, 95}, {4009, 83}, @@ -70,7 +70,7 @@ static struct abx500_v_to_cap cap_tbl_a_thermistor[] = { {3247,0}, }; -static struct abx500_v_to_cap cap_tbl_b_thermistor[] = { +static const struct abx500_v_to_cap cap_tbl_b_thermistor[] = { {4161, 100}, {4124, 98}, {4044, 90}, @@ -93,7 +93,7 @@ static struct abx500_v_to_cap cap_tbl_b_thermistor[] = { {3250,0}, }; -static struct abx500_v_to_cap cap_tbl[] = { +static const struct abx500_v_to_cap cap_tbl[] = { {4186, 100}, {4163, 99}, {4114, 95}, @@ -124,7 +124,7 @@ static struct abx500_v_to_cap cap_tbl[] = { * Note that the res_to_temp table must be strictly sorted by falling * resistance values to work. */ -static struct abx500_res_to_temp temp_tbl[] = { +static const struct abx500_res_to_temp temp_tbl[] = { {-5, 214834}, { 0, 162943}, { 5, 124820}, @@ -146,7 +146,7 @@ static struct abx500_res_to_temp temp_tbl[] = { * Note that the batres_vs_temp table must be strictly sorted by falling * temperature values to work. */ -static struct batres_vs_temp temp_to_batres_tbl_thermistor[] = { +static const struct batres_vs_temp temp_to_batres_tbl_thermistor[] = { { 40, 120}, { 30, 135}, { 20, 165}, @@ -160,7 +160,7 @@ static struct batres_vs_temp temp_to_batres_tbl_thermistor[] = { * Note that the batres_vs_temp table must be strictly sorted by falling * temperature values to work. */ -static struct batres_vs_temp temp_to_batres_tbl_ext_thermistor[] = { +static const struct batres_vs_temp temp_to_batres_tbl_ext_thermistor[] = { { 60, 300}, { 30, 300}, { 20, 300}, @@ -171,7 +171,7 @@ static struct batres_vs_temp temp_to_batres_tbl_ext_thermistor[] = { }; /* battery resistance table for LI ION 9100 battery */ -static struct batres_vs_temp temp_to_batres_tbl_9100[] = { +static const struct batres_vs_temp temp_to_batres_tbl_9100[] = { { 60, 180}, { 30, 180}, { 20, 180}, diff --git a/drivers/power/ab8500_fg.c b/drivers/power/ab8500_fg.c index b3bf178..d21456d 100644 --- a/drivers/power/ab8500_fg.c +++ b/drivers/power/ab8500_fg.c @@ -811,7 +811,7 @@ static int ab8500_fg_bat_voltage(struct ab8500_fg *di) static int ab8500_fg_volt_to_capacity(struct ab8500_fg *di, int voltage) { int i, tbl_size; - struct abx500_v_to_cap *tbl; + const struct abx500_v_to_cap *tbl; int cap = 0; tbl = di-bat-bat_type[di-bat-batt_id].v_to_cap_tbl, @@ -863,7 +863,7 @@ static int ab8500_fg_uncomp_volt_to_capacity(struct ab8500_fg *di) static int ab8500_fg_battery_resistance(struct ab8500_fg *di) { int i, tbl_size; - struct batres_vs_temp *tbl; + const struct batres_vs_temp *tbl; int resist = 0; tbl = di-bat-bat_type[di-bat-batt_id].batres_tbl; diff --git a/include/linux/mfd/abx500.h b/include/linux/mfd/abx500.h index 2138bd3..03fc0f1 100644 --- a/include/linux/mfd/abx500.h +++ b/include/linux/mfd/abx500.h @@ -173,11 +173,11 @@ struct abx500_battery_type { int low_high_vol_lvl; int battery_resistance; int n_temp_tbl_elements; - struct abx500_res_to_temp *r_to_t_tbl; + const struct abx500_res_to_temp *r_to_t_tbl; int n_v_cap_tbl_elements; - struct abx500_v_to_cap *v_to_cap_tbl; + const struct abx500_v_to_cap *v_to_cap_tbl; int n_batres_tbl_elements; - struct batres_vs_temp *batres_tbl; + const struct batres_vs_temp *batres_tbl; }; /** -- 1.8.0
[PATCH v7 4/5] ab8500: power: export abx500_res_to_temp tables for hwmon
This patch exports the thermistor resistance-to-temperature tables, so that the hwmon driver can access them, and also adds the corresponding table size variables. Signed-off-by: Hongbo Zhang hongbo.zh...@linaro.org --- drivers/power/ab8500_bmdata.c | 20 ++-- include/linux/power/ab8500.h | 16 2 files changed, 30 insertions(+), 6 deletions(-) create mode 100644 include/linux/power/ab8500.h diff --git a/drivers/power/ab8500_bmdata.c b/drivers/power/ab8500_bmdata.c index 9c25ca8..05a1077 100644 --- a/drivers/power/ab8500_bmdata.c +++ b/drivers/power/ab8500_bmdata.c @@ -11,7 +11,7 @@ * Note that the res_to_temp table must be strictly sorted by falling resistance * values to work. */ -static const struct abx500_res_to_temp temp_tbl_a_thermistor[] = { +const struct abx500_res_to_temp ab8500_temp_tbl_a_thermistor[] = { {-5, 53407}, { 0, 48594}, { 5, 43804}, @@ -28,8 +28,12 @@ static const struct abx500_res_to_temp temp_tbl_a_thermistor[] = { {60, 13437}, {65, 12500}, }; +EXPORT_SYMBOL(ab8500_temp_tbl_a_thermistor); -static const struct abx500_res_to_temp temp_tbl_b_thermistor[] = { +const int ab8500_temp_tbl_a_size = ARRAY_SIZE(ab8500_temp_tbl_a_thermistor); +EXPORT_SYMBOL(ab8500_temp_tbl_a_size); + +const struct abx500_res_to_temp ab8500_temp_tbl_b_thermistor[] = { {-5, 20}, { 0, 159024}, { 5, 151921}, @@ -46,6 +50,10 @@ static const struct abx500_res_to_temp temp_tbl_b_thermistor[] = { {60, 85461}, {65, 82869}, }; +EXPORT_SYMBOL(ab8500_temp_tbl_b_thermistor); + +const int ab8500_temp_tbl_b_size = ARRAY_SIZE(ab8500_temp_tbl_b_thermistor); +EXPORT_SYMBOL(ab8500_temp_tbl_b_size); static const struct abx500_v_to_cap cap_tbl_a_thermistor[] = { {4171, 100}, @@ -230,8 +238,8 @@ static struct abx500_battery_type bat_type_thermistor[] = { .maint_b_chg_timer_h = 200, .low_high_cur_lvl = 300, .low_high_vol_lvl = 4000, - .n_temp_tbl_elements = ARRAY_SIZE(temp_tbl_a_thermistor), - .r_to_t_tbl = temp_tbl_a_thermistor, + .n_temp_tbl_elements = ARRAY_SIZE(ab8500_temp_tbl_a_thermistor), + .r_to_t_tbl = ab8500_temp_tbl_a_thermistor, .n_v_cap_tbl_elements = ARRAY_SIZE(cap_tbl_a_thermistor), .v_to_cap_tbl = cap_tbl_a_thermistor, .n_batres_tbl_elements = ARRAY_SIZE(temp_to_batres_tbl_thermistor), @@ -258,8 +266,8 @@ static struct abx500_battery_type bat_type_thermistor[] = { .maint_b_chg_timer_h = 200, .low_high_cur_lvl = 300, .low_high_vol_lvl = 4000, - .n_temp_tbl_elements = ARRAY_SIZE(temp_tbl_b_thermistor), - .r_to_t_tbl = temp_tbl_b_thermistor, + .n_temp_tbl_elements = ARRAY_SIZE(ab8500_temp_tbl_b_thermistor), + .r_to_t_tbl = ab8500_temp_tbl_b_thermistor, .n_v_cap_tbl_elements = ARRAY_SIZE(cap_tbl_b_thermistor), .v_to_cap_tbl = cap_tbl_b_thermistor, .n_batres_tbl_elements = ARRAY_SIZE(temp_to_batres_tbl_thermistor), diff --git a/include/linux/power/ab8500.h b/include/linux/power/ab8500.h new file mode 100644 index 000..cdbb6c2 --- /dev/null +++ b/include/linux/power/ab8500.h @@ -0,0 +1,16 @@ +/* + * Copyright (C) ST-Ericsson 2013 + * Author: Hongbo Zhang hongbo.zh...@linaro.com + * License terms: GNU General Public License v2 + */ + +#ifndef PWR_AB8500_H +#define PWR_AB8500_H + +extern const struct abx500_res_to_temp ab8500_temp_tbl_a_thermistor[]; +extern const int ab8500_temp_tbl_a_size; + +extern const struct abx500_res_to_temp ab8500_temp_tbl_b_thermistor[]; +extern const int ab8500_temp_tbl_b_size; + +#endif /* PWR_AB8500_H */ -- 1.8.0 -- 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 v7 5/5] hwmon: add ST-Ericsson ABX500 hwmon driver
Each of ST-Ericsson X500 chip set series consists of both ABX500 and DBX500 chips. This is ABX500 hwmon driver, where the abx500.c is a common layer for all ABX500s, and the ab8500.c is specific for AB8500 chip. Under this designed structure, other chip specific files can be added simply using the same common layer abx500.c. Signed-off-by: Hongbo Zhang hongbo.zh...@linaro.org --- Documentation/hwmon/ab8500 | 22 ++ Documentation/hwmon/abx500 | 28 +++ drivers/hwmon/Kconfig | 13 ++ drivers/hwmon/Makefile | 1 + drivers/hwmon/ab8500.c | 206 +++ drivers/hwmon/abx500.c | 491 + drivers/hwmon/abx500.h | 69 +++ 7 files changed, 830 insertions(+) create mode 100644 Documentation/hwmon/ab8500 create mode 100644 Documentation/hwmon/abx500 create mode 100644 drivers/hwmon/ab8500.c create mode 100644 drivers/hwmon/abx500.c create mode 100644 drivers/hwmon/abx500.h diff --git a/Documentation/hwmon/ab8500 b/Documentation/hwmon/ab8500 new file mode 100644 index 000..cf169c8 --- /dev/null +++ b/Documentation/hwmon/ab8500 @@ -0,0 +1,22 @@ +Kernel driver ab8500 + + +Supported chips: + * ST-Ericsson AB8500 +Prefix: 'ab8500' +Addresses scanned: - +Datasheet: http://www.stericsson.com/developers/documentation.jsp + +Authors: +Martin Persson martin.pers...@stericsson.com +Hongbo Zhang hongbo.zh...@linaro.org + +Description +--- + +See also Documentation/hwmon/abx500. This is the ST-Ericsson AB8500 specific +driver. + +Currently only the AB8500 internal sensor and one external sensor for battery +temperature are monitored. Other GPADC channels can also be monitored if needed +in future. diff --git a/Documentation/hwmon/abx500 b/Documentation/hwmon/abx500 new file mode 100644 index 000..319a058 --- /dev/null +++ b/Documentation/hwmon/abx500 @@ -0,0 +1,28 @@ +Kernel driver abx500 + + +Supported chips: + * ST-Ericsson ABx500 series +Prefix: 'abx500' +Addresses scanned: - +Datasheet: http://www.stericsson.com/developers/documentation.jsp + +Authors: +Martin Persson martin.pers...@stericsson.com +Hongbo Zhang hongbo.zh...@linaro.org + +Description +--- + +Every ST-Ericsson Ux500 SOC consists of both ABx500 and DBx500 physically, +this is kernel hwmon driver for ABx500. + +There are some GPADCs inside ABx500 which are designed for connecting to +thermal sensors, and there is also a thermal sensor inside ABx500 too, which +raises interrupt when critical temperature reached. + +This abx500 is a common layer which can monitor all of the sensors, every +specific abx500 chip has its special configurations in its own file, e.g. some +sensors can be configured invisible if they are not available on that chip, and +the corresponding gpadc_addr should be set to 0, thus this sensor won't be +polled. diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index 32f238f..d0d6b52 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig @@ -39,6 +39,19 @@ config HWMON_DEBUG_CHIP comment Native drivers +config SENSORS_AB8500 + tristate AB8500 thermal monitoring + depends on AB8500_GPADC AB8500_BM + default n + help + If you say yes here you get support for the thermal sensor part + of the AB8500 chip. The driver includes thermal management for + AB8500 die and two GPADC channels. The GPADC channel are preferably + used to access sensors outside the AB8500 chip. + + This driver can also be built as a module. If so, the module + will be called abx500-temp. + config SENSORS_ABITUGURU tristate Abit uGuru (rev 1 2) depends on X86 DMI diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile index 5da2874..06dfe85 100644 --- a/drivers/hwmon/Makefile +++ b/drivers/hwmon/Makefile @@ -19,6 +19,7 @@ obj-$(CONFIG_SENSORS_W83795) += w83795.o obj-$(CONFIG_SENSORS_W83781D) += w83781d.o obj-$(CONFIG_SENSORS_W83791D) += w83791d.o +obj-$(CONFIG_SENSORS_AB8500) += abx500.o ab8500.o obj-$(CONFIG_SENSORS_ABITUGURU)+= abituguru.o obj-$(CONFIG_SENSORS_ABITUGURU3)+= abituguru3.o obj-$(CONFIG_SENSORS_AD7314) += ad7314.o diff --git a/drivers/hwmon/ab8500.c b/drivers/hwmon/ab8500.c new file mode 100644 index 000..ee0aa3e --- /dev/null +++ b/drivers/hwmon/ab8500.c @@ -0,0 +1,206 @@ +/* + * Copyright (C) ST-Ericsson 2010 - 2013 + * Author: Martin Persson martin.pers...@stericsson.com + * Hongbo Zhang hongbo.zh...@linaro.org + * License Terms: GNU General Public License v2 + * + * When the AB8500 thermal warning temperature is reached (threshold cannot + * be changed by SW), an interrupt is set, and if no further action is taken + * within a certain time frame, pm_power off will be called. + * + * When AB8500 thermal shutdown temperature is reached a hardware shutdown of + * the AB8500 will occur. + */ + +#include
Re: [PATCH v7 5/5] hwmon: add ST-Ericsson ABX500 hwmon driver
On 28 March 2013 03:48, Guenter Roeck li...@roeck-us.net wrote: On Wed, Mar 27, 2013 at 03:13:32PM +0800, Hongbo Zhang wrote: Each of ST-Ericsson X500 chip set series consists of both ABX500 and DBX500 chips. This is ABX500 hwmon driver, where the abx500.c is a common layer for all ABX500s, and the ab8500.c is specific for AB8500 chip. Under this designed structure, other chip specific files can be added simply using the same common layer abx500.c. Signed-off-by: Hongbo Zhang hongbo.zh...@linaro.org Reviewed-by: Guenter Roeck li...@roeck-us.net Thank you very much, Guenter. -- 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/5] hwmon: add ST-Ericsson ABX500 hwmon driver
On 26 March 2013 23:23, Guenter Roeck wrote: > On Tue, Mar 26, 2013 at 03:06:59PM +0800, Hongbo Zhang wrote: >> Each of ST-Ericsson X500 chip set series consists of both ABX500 and DBX500 >> chips. This is ABX500 hwmon driver, where the abx500.c is a common layer for >> all ABX500s, and the ab8500.c is specific for AB8500 chip. Under this >> designed >> structure, other chip specific files can be added simply using the same >> common >> layer abx500.c. >> >> Signed-off-by: Hongbo Zhang > > Looks good except ... > >> diff --git a/drivers/power/ab8500_bmdata.c b/drivers/power/ab8500_bmdata.c >> index d9f1f25..05a1077 100644 >> --- a/drivers/power/ab8500_bmdata.c >> +++ b/drivers/power/ab8500_bmdata.c >> @@ -28,8 +28,10 @@ const struct abx500_res_to_temp >> ab8500_temp_tbl_a_thermistor[] = { >> {60, 13437}, >> {65, 12500}, >> }; >> +EXPORT_SYMBOL(ab8500_temp_tbl_a_thermistor); >> > Those exports should be in the previous patch where you start exporting the > symbols, > not in this patch. > Sorry, This was really my carelessness, will update it. > Thanks, > Guenter -- 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 v6 5/5] hwmon: add ST-Ericsson ABX500 hwmon driver
Each of ST-Ericsson X500 chip set series consists of both ABX500 and DBX500 chips. This is ABX500 hwmon driver, where the abx500.c is a common layer for all ABX500s, and the ab8500.c is specific for AB8500 chip. Under this designed structure, other chip specific files can be added simply using the same common layer abx500.c. Signed-off-by: Hongbo Zhang --- Documentation/hwmon/ab8500| 22 ++ Documentation/hwmon/abx500| 28 +++ drivers/hwmon/Kconfig | 13 ++ drivers/hwmon/Makefile| 1 + drivers/hwmon/ab8500.c| 206 ++ drivers/hwmon/abx500.c| 491 ++ drivers/hwmon/abx500.h| 69 ++ drivers/power/ab8500_bmdata.c | 4 + 8 files changed, 834 insertions(+) create mode 100644 Documentation/hwmon/ab8500 create mode 100644 Documentation/hwmon/abx500 create mode 100644 drivers/hwmon/ab8500.c create mode 100644 drivers/hwmon/abx500.c create mode 100644 drivers/hwmon/abx500.h diff --git a/Documentation/hwmon/ab8500 b/Documentation/hwmon/ab8500 new file mode 100644 index 000..cf169c8 --- /dev/null +++ b/Documentation/hwmon/ab8500 @@ -0,0 +1,22 @@ +Kernel driver ab8500 + + +Supported chips: + * ST-Ericsson AB8500 +Prefix: 'ab8500' +Addresses scanned: - +Datasheet: http://www.stericsson.com/developers/documentation.jsp + +Authors: +Martin Persson +Hongbo Zhang + +Description +--- + +See also Documentation/hwmon/abx500. This is the ST-Ericsson AB8500 specific +driver. + +Currently only the AB8500 internal sensor and one external sensor for battery +temperature are monitored. Other GPADC channels can also be monitored if needed +in future. diff --git a/Documentation/hwmon/abx500 b/Documentation/hwmon/abx500 new file mode 100644 index 000..319a058 --- /dev/null +++ b/Documentation/hwmon/abx500 @@ -0,0 +1,28 @@ +Kernel driver abx500 + + +Supported chips: + * ST-Ericsson ABx500 series +Prefix: 'abx500' +Addresses scanned: - +Datasheet: http://www.stericsson.com/developers/documentation.jsp + +Authors: +Martin Persson +Hongbo Zhang + +Description +--- + +Every ST-Ericsson Ux500 SOC consists of both ABx500 and DBx500 physically, +this is kernel hwmon driver for ABx500. + +There are some GPADCs inside ABx500 which are designed for connecting to +thermal sensors, and there is also a thermal sensor inside ABx500 too, which +raises interrupt when critical temperature reached. + +This abx500 is a common layer which can monitor all of the sensors, every +specific abx500 chip has its special configurations in its own file, e.g. some +sensors can be configured invisible if they are not available on that chip, and +the corresponding gpadc_addr should be set to 0, thus this sensor won't be +polled. diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index 32f238f..d0d6b52 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig @@ -39,6 +39,19 @@ config HWMON_DEBUG_CHIP comment "Native drivers" +config SENSORS_AB8500 + tristate "AB8500 thermal monitoring" + depends on AB8500_GPADC && AB8500_BM + default n + help + If you say yes here you get support for the thermal sensor part + of the AB8500 chip. The driver includes thermal management for + AB8500 die and two GPADC channels. The GPADC channel are preferably + used to access sensors outside the AB8500 chip. + + This driver can also be built as a module. If so, the module + will be called abx500-temp. + config SENSORS_ABITUGURU tristate "Abit uGuru (rev 1 & 2)" depends on X86 && DMI diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile index 5da2874..06dfe85 100644 --- a/drivers/hwmon/Makefile +++ b/drivers/hwmon/Makefile @@ -19,6 +19,7 @@ obj-$(CONFIG_SENSORS_W83795) += w83795.o obj-$(CONFIG_SENSORS_W83781D) += w83781d.o obj-$(CONFIG_SENSORS_W83791D) += w83791d.o +obj-$(CONFIG_SENSORS_AB8500) += abx500.o ab8500.o obj-$(CONFIG_SENSORS_ABITUGURU)+= abituguru.o obj-$(CONFIG_SENSORS_ABITUGURU3)+= abituguru3.o obj-$(CONFIG_SENSORS_AD7314) += ad7314.o diff --git a/drivers/hwmon/ab8500.c b/drivers/hwmon/ab8500.c new file mode 100644 index 000..ee0aa3e --- /dev/null +++ b/drivers/hwmon/ab8500.c @@ -0,0 +1,206 @@ +/* + * Copyright (C) ST-Ericsson 2010 - 2013 + * Author: Martin Persson + * Hongbo Zhang + * License Terms: GNU General Public License v2 + * + * When the AB8500 thermal warning temperature is reached (threshold cannot + * be changed by SW), an interrupt is set, and if no further action is taken + * within a certain time frame, pm_power off will be called. + * + * When AB8500 thermal shutdown temperature is reached a hardware shutdown of + * the AB8500 will occur. + */ + +#include +#include +#include +#include +#include +#include +#i
[PATCH v6 4/5] ab8500: power: export abx500_res_to_temp tables for hwmon
This patch exports the thermistor resistance-to-temperature tables, so that the hwmon driver can access them, and also adds the corresponding table size variables. Signed-off-by: Hongbo Zhang --- drivers/power/ab8500_bmdata.c | 16 ++-- include/linux/power/ab8500.h | 16 2 files changed, 26 insertions(+), 6 deletions(-) create mode 100644 include/linux/power/ab8500.h diff --git a/drivers/power/ab8500_bmdata.c b/drivers/power/ab8500_bmdata.c index 9c25ca8..d9f1f25 100644 --- a/drivers/power/ab8500_bmdata.c +++ b/drivers/power/ab8500_bmdata.c @@ -11,7 +11,7 @@ * Note that the res_to_temp table must be strictly sorted by falling resistance * values to work. */ -static const struct abx500_res_to_temp temp_tbl_a_thermistor[] = { +const struct abx500_res_to_temp ab8500_temp_tbl_a_thermistor[] = { {-5, 53407}, { 0, 48594}, { 5, 43804}, @@ -29,7 +29,9 @@ static const struct abx500_res_to_temp temp_tbl_a_thermistor[] = { {65, 12500}, }; -static const struct abx500_res_to_temp temp_tbl_b_thermistor[] = { +const int ab8500_temp_tbl_a_size = ARRAY_SIZE(ab8500_temp_tbl_a_thermistor); + +const struct abx500_res_to_temp ab8500_temp_tbl_b_thermistor[] = { {-5, 20}, { 0, 159024}, { 5, 151921}, @@ -47,6 +49,8 @@ static const struct abx500_res_to_temp temp_tbl_b_thermistor[] = { {65, 82869}, }; +const int ab8500_temp_tbl_b_size = ARRAY_SIZE(ab8500_temp_tbl_b_thermistor); + static const struct abx500_v_to_cap cap_tbl_a_thermistor[] = { {4171, 100}, {4114, 95}, @@ -230,8 +234,8 @@ static struct abx500_battery_type bat_type_thermistor[] = { .maint_b_chg_timer_h = 200, .low_high_cur_lvl = 300, .low_high_vol_lvl = 4000, - .n_temp_tbl_elements = ARRAY_SIZE(temp_tbl_a_thermistor), - .r_to_t_tbl = temp_tbl_a_thermistor, + .n_temp_tbl_elements = ARRAY_SIZE(ab8500_temp_tbl_a_thermistor), + .r_to_t_tbl = ab8500_temp_tbl_a_thermistor, .n_v_cap_tbl_elements = ARRAY_SIZE(cap_tbl_a_thermistor), .v_to_cap_tbl = cap_tbl_a_thermistor, .n_batres_tbl_elements = ARRAY_SIZE(temp_to_batres_tbl_thermistor), @@ -258,8 +262,8 @@ static struct abx500_battery_type bat_type_thermistor[] = { .maint_b_chg_timer_h = 200, .low_high_cur_lvl = 300, .low_high_vol_lvl = 4000, - .n_temp_tbl_elements = ARRAY_SIZE(temp_tbl_b_thermistor), - .r_to_t_tbl = temp_tbl_b_thermistor, + .n_temp_tbl_elements = ARRAY_SIZE(ab8500_temp_tbl_b_thermistor), + .r_to_t_tbl = ab8500_temp_tbl_b_thermistor, .n_v_cap_tbl_elements = ARRAY_SIZE(cap_tbl_b_thermistor), .v_to_cap_tbl = cap_tbl_b_thermistor, .n_batres_tbl_elements = ARRAY_SIZE(temp_to_batres_tbl_thermistor), diff --git a/include/linux/power/ab8500.h b/include/linux/power/ab8500.h new file mode 100644 index 000..cdbb6c2 --- /dev/null +++ b/include/linux/power/ab8500.h @@ -0,0 +1,16 @@ +/* + * Copyright (C) ST-Ericsson 2013 + * Author: Hongbo Zhang + * License terms: GNU General Public License v2 + */ + +#ifndef PWR_AB8500_H +#define PWR_AB8500_H + +extern const struct abx500_res_to_temp ab8500_temp_tbl_a_thermistor[]; +extern const int ab8500_temp_tbl_a_size; + +extern const struct abx500_res_to_temp ab8500_temp_tbl_b_thermistor[]; +extern const int ab8500_temp_tbl_b_size; + +#endif /* PWR_AB8500_H */ -- 1.8.0 -- 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 v6 3/5] ab8500: power: add const attributes to some data arrays
This patch adds const attributes to AB8500 power and temperature related read-only data arrays. Signed-off-by: Hongbo Zhang --- drivers/power/ab8500_bmdata.c | 18 +- drivers/power/ab8500_fg.c | 4 ++-- include/linux/mfd/abx500.h| 6 +++--- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/power/ab8500_bmdata.c b/drivers/power/ab8500_bmdata.c index f836550..9c25ca8 100644 --- a/drivers/power/ab8500_bmdata.c +++ b/drivers/power/ab8500_bmdata.c @@ -11,7 +11,7 @@ * Note that the res_to_temp table must be strictly sorted by falling resistance * values to work. */ -static struct abx500_res_to_temp temp_tbl_a_thermistor[] = { +static const struct abx500_res_to_temp temp_tbl_a_thermistor[] = { {-5, 53407}, { 0, 48594}, { 5, 43804}, @@ -29,7 +29,7 @@ static struct abx500_res_to_temp temp_tbl_a_thermistor[] = { {65, 12500}, }; -static struct abx500_res_to_temp temp_tbl_b_thermistor[] = { +static const struct abx500_res_to_temp temp_tbl_b_thermistor[] = { {-5, 20}, { 0, 159024}, { 5, 151921}, @@ -47,7 +47,7 @@ static struct abx500_res_to_temp temp_tbl_b_thermistor[] = { {65, 82869}, }; -static struct abx500_v_to_cap cap_tbl_a_thermistor[] = { +static const struct abx500_v_to_cap cap_tbl_a_thermistor[] = { {4171, 100}, {4114, 95}, {4009, 83}, @@ -70,7 +70,7 @@ static struct abx500_v_to_cap cap_tbl_a_thermistor[] = { {3247,0}, }; -static struct abx500_v_to_cap cap_tbl_b_thermistor[] = { +static const struct abx500_v_to_cap cap_tbl_b_thermistor[] = { {4161, 100}, {4124, 98}, {4044, 90}, @@ -93,7 +93,7 @@ static struct abx500_v_to_cap cap_tbl_b_thermistor[] = { {3250,0}, }; -static struct abx500_v_to_cap cap_tbl[] = { +static const struct abx500_v_to_cap cap_tbl[] = { {4186, 100}, {4163, 99}, {4114, 95}, @@ -124,7 +124,7 @@ static struct abx500_v_to_cap cap_tbl[] = { * Note that the res_to_temp table must be strictly sorted by falling * resistance values to work. */ -static struct abx500_res_to_temp temp_tbl[] = { +static const struct abx500_res_to_temp temp_tbl[] = { {-5, 214834}, { 0, 162943}, { 5, 124820}, @@ -146,7 +146,7 @@ static struct abx500_res_to_temp temp_tbl[] = { * Note that the batres_vs_temp table must be strictly sorted by falling * temperature values to work. */ -static struct batres_vs_temp temp_to_batres_tbl_thermistor[] = { +static const struct batres_vs_temp temp_to_batres_tbl_thermistor[] = { { 40, 120}, { 30, 135}, { 20, 165}, @@ -160,7 +160,7 @@ static struct batres_vs_temp temp_to_batres_tbl_thermistor[] = { * Note that the batres_vs_temp table must be strictly sorted by falling * temperature values to work. */ -static struct batres_vs_temp temp_to_batres_tbl_ext_thermistor[] = { +static const struct batres_vs_temp temp_to_batres_tbl_ext_thermistor[] = { { 60, 300}, { 30, 300}, { 20, 300}, @@ -171,7 +171,7 @@ static struct batres_vs_temp temp_to_batres_tbl_ext_thermistor[] = { }; /* battery resistance table for LI ION 9100 battery */ -static struct batres_vs_temp temp_to_batres_tbl_9100[] = { +static const struct batres_vs_temp temp_to_batres_tbl_9100[] = { { 60, 180}, { 30, 180}, { 20, 180}, diff --git a/drivers/power/ab8500_fg.c b/drivers/power/ab8500_fg.c index b3bf178..d21456d 100644 --- a/drivers/power/ab8500_fg.c +++ b/drivers/power/ab8500_fg.c @@ -811,7 +811,7 @@ static int ab8500_fg_bat_voltage(struct ab8500_fg *di) static int ab8500_fg_volt_to_capacity(struct ab8500_fg *di, int voltage) { int i, tbl_size; - struct abx500_v_to_cap *tbl; + const struct abx500_v_to_cap *tbl; int cap = 0; tbl = di->bat->bat_type[di->bat->batt_id].v_to_cap_tbl, @@ -863,7 +863,7 @@ static int ab8500_fg_uncomp_volt_to_capacity(struct ab8500_fg *di) static int ab8500_fg_battery_resistance(struct ab8500_fg *di) { int i, tbl_size; - struct batres_vs_temp *tbl; + const struct batres_vs_temp *tbl; int resist = 0; tbl = di->bat->bat_type[di->bat->batt_id].batres_tbl; diff --git a/include/linux/mfd/abx500.h b/include/linux/mfd/abx500.h index 2138bd3..03fc0f1 100644 --- a/include/linux/mfd/abx500.h +++ b/include/linux/mfd/abx500.h @@ -173,11 +173,11 @@ struct abx500_battery_type { int low_high_vol_lvl; int battery_resistance; int n_temp_tbl_elements; - struct abx500_res_to_temp *r_to_t_tbl; + const struct abx500_res_to_temp *r_to_t_tbl; int n_v_cap_tbl_elements; - struct abx500_v_to_cap *v_to_cap_tbl; + const struct abx500_v_to_cap *v_to_cap_tbl; int n_batres_tbl_elements; - struct batres_vs_temp *batres_tbl; + const struct batres_vs_temp *batres_tbl; }; /** -- 1.8.0
[PATCH v6 2/5] ab8500: power: eliminate CamelCase warning of some variables
Some AB8500 power related variable names don't comply with kernel coding rules, any new patch using these variables will result in CamelCase warnings from checkpatch.pl, this patch re-name these variables. Signed-off-by: Hongbo Zhang --- drivers/power/ab8500_bmdata.c | 24 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/power/ab8500_bmdata.c b/drivers/power/ab8500_bmdata.c index f034ae4..f836550 100644 --- a/drivers/power/ab8500_bmdata.c +++ b/drivers/power/ab8500_bmdata.c @@ -11,7 +11,7 @@ * Note that the res_to_temp table must be strictly sorted by falling resistance * values to work. */ -static struct abx500_res_to_temp temp_tbl_A_thermistor[] = { +static struct abx500_res_to_temp temp_tbl_a_thermistor[] = { {-5, 53407}, { 0, 48594}, { 5, 43804}, @@ -29,7 +29,7 @@ static struct abx500_res_to_temp temp_tbl_A_thermistor[] = { {65, 12500}, }; -static struct abx500_res_to_temp temp_tbl_B_thermistor[] = { +static struct abx500_res_to_temp temp_tbl_b_thermistor[] = { {-5, 20}, { 0, 159024}, { 5, 151921}, @@ -47,7 +47,7 @@ static struct abx500_res_to_temp temp_tbl_B_thermistor[] = { {65, 82869}, }; -static struct abx500_v_to_cap cap_tbl_A_thermistor[] = { +static struct abx500_v_to_cap cap_tbl_a_thermistor[] = { {4171, 100}, {4114, 95}, {4009, 83}, @@ -70,7 +70,7 @@ static struct abx500_v_to_cap cap_tbl_A_thermistor[] = { {3247,0}, }; -static struct abx500_v_to_cap cap_tbl_B_thermistor[] = { +static struct abx500_v_to_cap cap_tbl_b_thermistor[] = { {4161, 100}, {4124, 98}, {4044, 90}, @@ -230,10 +230,10 @@ static struct abx500_battery_type bat_type_thermistor[] = { .maint_b_chg_timer_h = 200, .low_high_cur_lvl = 300, .low_high_vol_lvl = 4000, - .n_temp_tbl_elements = ARRAY_SIZE(temp_tbl_A_thermistor), - .r_to_t_tbl = temp_tbl_A_thermistor, - .n_v_cap_tbl_elements = ARRAY_SIZE(cap_tbl_A_thermistor), - .v_to_cap_tbl = cap_tbl_A_thermistor, + .n_temp_tbl_elements = ARRAY_SIZE(temp_tbl_a_thermistor), + .r_to_t_tbl = temp_tbl_a_thermistor, + .n_v_cap_tbl_elements = ARRAY_SIZE(cap_tbl_a_thermistor), + .v_to_cap_tbl = cap_tbl_a_thermistor, .n_batres_tbl_elements = ARRAY_SIZE(temp_to_batres_tbl_thermistor), .batres_tbl = temp_to_batres_tbl_thermistor, @@ -258,10 +258,10 @@ static struct abx500_battery_type bat_type_thermistor[] = { .maint_b_chg_timer_h = 200, .low_high_cur_lvl = 300, .low_high_vol_lvl = 4000, - .n_temp_tbl_elements = ARRAY_SIZE(temp_tbl_B_thermistor), - .r_to_t_tbl = temp_tbl_B_thermistor, - .n_v_cap_tbl_elements = ARRAY_SIZE(cap_tbl_B_thermistor), - .v_to_cap_tbl = cap_tbl_B_thermistor, + .n_temp_tbl_elements = ARRAY_SIZE(temp_tbl_b_thermistor), + .r_to_t_tbl = temp_tbl_b_thermistor, + .n_v_cap_tbl_elements = ARRAY_SIZE(cap_tbl_b_thermistor), + .v_to_cap_tbl = cap_tbl_b_thermistor, .n_batres_tbl_elements = ARRAY_SIZE(temp_to_batres_tbl_thermistor), .batres_tbl = temp_to_batres_tbl_thermistor, }, -- 1.8.0 -- 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 v6 1/5] ab8500_btemp: make ab8500_btemp_get* interfaces public
Make ab8500_btemp_get_temp interface public, export it and also export the ab8500_btemp_get, ab8500_btemp_get_batctrl_temp interfaces, so that the ab8500 hwmon driver can use them. Signed-off-by: Hongbo Zhang Acked-by: Anton Vorontsov --- drivers/power/ab8500_btemp.c | 5 - include/linux/mfd/abx500/ab8500-bm.h | 5 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/power/ab8500_btemp.c b/drivers/power/ab8500_btemp.c index 20e2a7d..3359075 100644 --- a/drivers/power/ab8500_btemp.c +++ b/drivers/power/ab8500_btemp.c @@ -123,6 +123,7 @@ struct ab8500_btemp *ab8500_btemp_get(void) return btemp; } +EXPORT_SYMBOL(ab8500_btemp_get); /** * ab8500_btemp_batctrl_volt_to_res() - convert batctrl voltage to resistance @@ -727,7 +728,7 @@ static void ab8500_btemp_periodic(struct ab8500_btemp *di, * * Returns battery temperature */ -static int ab8500_btemp_get_temp(struct ab8500_btemp *di) +int ab8500_btemp_get_temp(struct ab8500_btemp *di) { int temp = 0; @@ -763,6 +764,7 @@ static int ab8500_btemp_get_temp(struct ab8500_btemp *di) } return temp; } +EXPORT_SYMBOL(ab8500_btemp_get_temp); /** * ab8500_btemp_get_batctrl_temp() - get the temperature @@ -774,6 +776,7 @@ int ab8500_btemp_get_batctrl_temp(struct ab8500_btemp *btemp) { return btemp->bat_temp * 1000; } +EXPORT_SYMBOL(ab8500_btemp_get_batctrl_temp); /** * ab8500_btemp_get_property() - get the btemp properties diff --git a/include/linux/mfd/abx500/ab8500-bm.h b/include/linux/mfd/abx500/ab8500-bm.h index 44310c9..4dd79f6 100644 --- a/include/linux/mfd/abx500/ab8500-bm.h +++ b/include/linux/mfd/abx500/ab8500-bm.h @@ -427,6 +427,7 @@ void ab8500_fg_reinit(void); void ab8500_charger_usb_state_changed(u8 bm_usb_state, u16 mA); struct ab8500_btemp *ab8500_btemp_get(void); int ab8500_btemp_get_batctrl_temp(struct ab8500_btemp *btemp); +int ab8500_btemp_get_temp(struct ab8500_btemp *btemp); struct ab8500_fg *ab8500_fg_get(void); int ab8500_fg_inst_curr_blocking(struct ab8500_fg *dev); int ab8500_fg_inst_curr_start(struct ab8500_fg *di); @@ -451,6 +452,10 @@ static int ab8500_btemp_get_batctrl_temp(struct ab8500_btemp *btemp) { return 0; } +static int ab8500_btemp_get_temp(struct ab8500_btemp *btemp) +{ + return 0; +} struct ab8500_fg *ab8500_fg_get(void) { return NULL; -- 1.8.0 -- 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 v6 0/5] Add ST-Ericsson AB8500 HWMON driver
Guenter, Please check this v6 patches, thanks for all your reviews/comments for this patch set. Anton Vorontsov, for this v5 and v6 patches: I have add your Acked-by: into patch [1/5] (which was [1/3]); and split the old [2/3] into new [2/5], [3/5] and [4/5] patches, so please have a look them again, thank you. v5 -> v6 changes: - add depend on AB8500_BM in Kconfig - fix wrong usage of clamp_val() - export symbols for module compiling v4 -> v5 changes: - split the old [2/3]-ab8500-re-arrange-ab8500-power-and-temperature-data into new three [2/5], [3/5] and [4/5] patches. - hwmon driver minor coding style clean ups: - {} usage in if-else statement in ab8500_read_sensor function - index error fix in gpadc_monitor function - fix issue of clamp_val() usage - remove unnecessary else in function abx500_attrs_visible - remove redundant print message about irq set up - return the calling function return value directly in probe function v3 -> v4 changes: for patch [3/3] - define delays in HZ - update ab8500_read_sensor function, returning temp by parameter - remove ab8500_is_visible function - use clamp_val in set_min and set_max callback - remove unnecessary locks in remove and suspend functions - let abx500 and ab8500 use its own data structure for patch [2/3] - move the data tables from driver/power/ab8500_bmdata.c to include/linux/power/ab8500.h - rename driver/power/ab8500_bmdata.c to driver/power/ab8500_bm.c - rename these variable names to eliminate CamelCase warnings - add const attribute to these data v2 -> v3 changes: - Add interface for converting voltage to temperature - Remove temp5 sensor since we cannot offer temperature read interface of it - Update hyst to use absolute temperature instead of a difference - Add the 3/3 patch v1 -> v2 changes: - Add Documentation/hwmon/abx500 and Documentation/hwmon/abx500 - Make devices which cannot report milli-Celsius invisible - Add temp5_crit interface - Re-work the old find_active_thresholds() to threshold_updated() - Reset updated_min_alarm and updated_max_alarm at the end of each loop - Update the hyst mechamisn to make it works as real hyst - Remove non-stand attributes - Re-order the operations sequence inside probe and remove functions - Update all the lock usages to eliminate race conditions - Make attibutes index starts from 0 also changes: - Since the old [1/2] "ARM: ux500: rename ab8500 to abx500 for hwmon driver" has been merged by Samuel, so won't send it again. - Add another new patch "ab8500_btemp: export two symblols" as [2/2] of this patch set. Hongbo Zhang (5): ab8500_btemp: make ab8500_btemp_get* interfaces public ab8500: power: eliminate CamelCase warning of some variables ab8500: power: add const attributes to some data arrays ab8500: power: export abx500_res_to_temp tables for hwmon hwmon: add ST-Ericsson ABX500 hwmon driver Documentation/hwmon/ab8500 | 22 ++ Documentation/hwmon/abx500 | 28 ++ drivers/hwmon/Kconfig| 13 + drivers/hwmon/Makefile | 1 + drivers/hwmon/ab8500.c | 206 +++ drivers/hwmon/abx500.c | 491 +++ drivers/hwmon/abx500.h | 69 + drivers/power/ab8500_bmdata.c| 42 +-- drivers/power/ab8500_btemp.c | 5 +- drivers/power/ab8500_fg.c| 4 +- include/linux/mfd/abx500.h | 6 +- include/linux/mfd/abx500/ab8500-bm.h | 5 + include/linux/power/ab8500.h | 16 ++ 13 files changed, 885 insertions(+), 23 deletions(-) create mode 100644 Documentation/hwmon/ab8500 create mode 100644 Documentation/hwmon/abx500 create mode 100644 drivers/hwmon/ab8500.c create mode 100644 drivers/hwmon/abx500.c create mode 100644 drivers/hwmon/abx500.h create mode 100644 include/linux/power/ab8500.h -- 1.8.0 -- 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 v6 0/5] Add ST-Ericsson AB8500 HWMON driver
Guenter, Please check this v6 patches, thanks for all your reviews/comments for this patch set. Anton Vorontsov, for this v5 and v6 patches: I have add your Acked-by: into patch [1/5] (which was [1/3]); and split the old [2/3] into new [2/5], [3/5] and [4/5] patches, so please have a look them again, thank you. v5 - v6 changes: - add depend on AB8500_BM in Kconfig - fix wrong usage of clamp_val() - export symbols for module compiling v4 - v5 changes: - split the old [2/3]-ab8500-re-arrange-ab8500-power-and-temperature-data into new three [2/5], [3/5] and [4/5] patches. - hwmon driver minor coding style clean ups: - {} usage in if-else statement in ab8500_read_sensor function - index error fix in gpadc_monitor function - fix issue of clamp_val() usage - remove unnecessary else in function abx500_attrs_visible - remove redundant print message about irq set up - return the calling function return value directly in probe function v3 - v4 changes: for patch [3/3] - define delays in HZ - update ab8500_read_sensor function, returning temp by parameter - remove ab8500_is_visible function - use clamp_val in set_min and set_max callback - remove unnecessary locks in remove and suspend functions - let abx500 and ab8500 use its own data structure for patch [2/3] - move the data tables from driver/power/ab8500_bmdata.c to include/linux/power/ab8500.h - rename driver/power/ab8500_bmdata.c to driver/power/ab8500_bm.c - rename these variable names to eliminate CamelCase warnings - add const attribute to these data v2 - v3 changes: - Add interface for converting voltage to temperature - Remove temp5 sensor since we cannot offer temperature read interface of it - Update hyst to use absolute temperature instead of a difference - Add the 3/3 patch v1 - v2 changes: - Add Documentation/hwmon/abx500 and Documentation/hwmon/abx500 - Make devices which cannot report milli-Celsius invisible - Add temp5_crit interface - Re-work the old find_active_thresholds() to threshold_updated() - Reset updated_min_alarm and updated_max_alarm at the end of each loop - Update the hyst mechamisn to make it works as real hyst - Remove non-stand attributes - Re-order the operations sequence inside probe and remove functions - Update all the lock usages to eliminate race conditions - Make attibutes index starts from 0 also changes: - Since the old [1/2] ARM: ux500: rename ab8500 to abx500 for hwmon driver has been merged by Samuel, so won't send it again. - Add another new patch ab8500_btemp: export two symblols as [2/2] of this patch set. Hongbo Zhang (5): ab8500_btemp: make ab8500_btemp_get* interfaces public ab8500: power: eliminate CamelCase warning of some variables ab8500: power: add const attributes to some data arrays ab8500: power: export abx500_res_to_temp tables for hwmon hwmon: add ST-Ericsson ABX500 hwmon driver Documentation/hwmon/ab8500 | 22 ++ Documentation/hwmon/abx500 | 28 ++ drivers/hwmon/Kconfig| 13 + drivers/hwmon/Makefile | 1 + drivers/hwmon/ab8500.c | 206 +++ drivers/hwmon/abx500.c | 491 +++ drivers/hwmon/abx500.h | 69 + drivers/power/ab8500_bmdata.c| 42 +-- drivers/power/ab8500_btemp.c | 5 +- drivers/power/ab8500_fg.c| 4 +- include/linux/mfd/abx500.h | 6 +- include/linux/mfd/abx500/ab8500-bm.h | 5 + include/linux/power/ab8500.h | 16 ++ 13 files changed, 885 insertions(+), 23 deletions(-) create mode 100644 Documentation/hwmon/ab8500 create mode 100644 Documentation/hwmon/abx500 create mode 100644 drivers/hwmon/ab8500.c create mode 100644 drivers/hwmon/abx500.c create mode 100644 drivers/hwmon/abx500.h create mode 100644 include/linux/power/ab8500.h -- 1.8.0 -- 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 v6 1/5] ab8500_btemp: make ab8500_btemp_get* interfaces public
Make ab8500_btemp_get_temp interface public, export it and also export the ab8500_btemp_get, ab8500_btemp_get_batctrl_temp interfaces, so that the ab8500 hwmon driver can use them. Signed-off-by: Hongbo Zhang hongbo.zh...@linaro.org Acked-by: Anton Vorontsov an...@enomsg.org --- drivers/power/ab8500_btemp.c | 5 - include/linux/mfd/abx500/ab8500-bm.h | 5 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/power/ab8500_btemp.c b/drivers/power/ab8500_btemp.c index 20e2a7d..3359075 100644 --- a/drivers/power/ab8500_btemp.c +++ b/drivers/power/ab8500_btemp.c @@ -123,6 +123,7 @@ struct ab8500_btemp *ab8500_btemp_get(void) return btemp; } +EXPORT_SYMBOL(ab8500_btemp_get); /** * ab8500_btemp_batctrl_volt_to_res() - convert batctrl voltage to resistance @@ -727,7 +728,7 @@ static void ab8500_btemp_periodic(struct ab8500_btemp *di, * * Returns battery temperature */ -static int ab8500_btemp_get_temp(struct ab8500_btemp *di) +int ab8500_btemp_get_temp(struct ab8500_btemp *di) { int temp = 0; @@ -763,6 +764,7 @@ static int ab8500_btemp_get_temp(struct ab8500_btemp *di) } return temp; } +EXPORT_SYMBOL(ab8500_btemp_get_temp); /** * ab8500_btemp_get_batctrl_temp() - get the temperature @@ -774,6 +776,7 @@ int ab8500_btemp_get_batctrl_temp(struct ab8500_btemp *btemp) { return btemp-bat_temp * 1000; } +EXPORT_SYMBOL(ab8500_btemp_get_batctrl_temp); /** * ab8500_btemp_get_property() - get the btemp properties diff --git a/include/linux/mfd/abx500/ab8500-bm.h b/include/linux/mfd/abx500/ab8500-bm.h index 44310c9..4dd79f6 100644 --- a/include/linux/mfd/abx500/ab8500-bm.h +++ b/include/linux/mfd/abx500/ab8500-bm.h @@ -427,6 +427,7 @@ void ab8500_fg_reinit(void); void ab8500_charger_usb_state_changed(u8 bm_usb_state, u16 mA); struct ab8500_btemp *ab8500_btemp_get(void); int ab8500_btemp_get_batctrl_temp(struct ab8500_btemp *btemp); +int ab8500_btemp_get_temp(struct ab8500_btemp *btemp); struct ab8500_fg *ab8500_fg_get(void); int ab8500_fg_inst_curr_blocking(struct ab8500_fg *dev); int ab8500_fg_inst_curr_start(struct ab8500_fg *di); @@ -451,6 +452,10 @@ static int ab8500_btemp_get_batctrl_temp(struct ab8500_btemp *btemp) { return 0; } +static int ab8500_btemp_get_temp(struct ab8500_btemp *btemp) +{ + return 0; +} struct ab8500_fg *ab8500_fg_get(void) { return NULL; -- 1.8.0 -- 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 v6 2/5] ab8500: power: eliminate CamelCase warning of some variables
Some AB8500 power related variable names don't comply with kernel coding rules, any new patch using these variables will result in CamelCase warnings from checkpatch.pl, this patch re-name these variables. Signed-off-by: Hongbo Zhang hongbo.zh...@linaro.org --- drivers/power/ab8500_bmdata.c | 24 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/power/ab8500_bmdata.c b/drivers/power/ab8500_bmdata.c index f034ae4..f836550 100644 --- a/drivers/power/ab8500_bmdata.c +++ b/drivers/power/ab8500_bmdata.c @@ -11,7 +11,7 @@ * Note that the res_to_temp table must be strictly sorted by falling resistance * values to work. */ -static struct abx500_res_to_temp temp_tbl_A_thermistor[] = { +static struct abx500_res_to_temp temp_tbl_a_thermistor[] = { {-5, 53407}, { 0, 48594}, { 5, 43804}, @@ -29,7 +29,7 @@ static struct abx500_res_to_temp temp_tbl_A_thermistor[] = { {65, 12500}, }; -static struct abx500_res_to_temp temp_tbl_B_thermistor[] = { +static struct abx500_res_to_temp temp_tbl_b_thermistor[] = { {-5, 20}, { 0, 159024}, { 5, 151921}, @@ -47,7 +47,7 @@ static struct abx500_res_to_temp temp_tbl_B_thermistor[] = { {65, 82869}, }; -static struct abx500_v_to_cap cap_tbl_A_thermistor[] = { +static struct abx500_v_to_cap cap_tbl_a_thermistor[] = { {4171, 100}, {4114, 95}, {4009, 83}, @@ -70,7 +70,7 @@ static struct abx500_v_to_cap cap_tbl_A_thermistor[] = { {3247,0}, }; -static struct abx500_v_to_cap cap_tbl_B_thermistor[] = { +static struct abx500_v_to_cap cap_tbl_b_thermistor[] = { {4161, 100}, {4124, 98}, {4044, 90}, @@ -230,10 +230,10 @@ static struct abx500_battery_type bat_type_thermistor[] = { .maint_b_chg_timer_h = 200, .low_high_cur_lvl = 300, .low_high_vol_lvl = 4000, - .n_temp_tbl_elements = ARRAY_SIZE(temp_tbl_A_thermistor), - .r_to_t_tbl = temp_tbl_A_thermistor, - .n_v_cap_tbl_elements = ARRAY_SIZE(cap_tbl_A_thermistor), - .v_to_cap_tbl = cap_tbl_A_thermistor, + .n_temp_tbl_elements = ARRAY_SIZE(temp_tbl_a_thermistor), + .r_to_t_tbl = temp_tbl_a_thermistor, + .n_v_cap_tbl_elements = ARRAY_SIZE(cap_tbl_a_thermistor), + .v_to_cap_tbl = cap_tbl_a_thermistor, .n_batres_tbl_elements = ARRAY_SIZE(temp_to_batres_tbl_thermistor), .batres_tbl = temp_to_batres_tbl_thermistor, @@ -258,10 +258,10 @@ static struct abx500_battery_type bat_type_thermistor[] = { .maint_b_chg_timer_h = 200, .low_high_cur_lvl = 300, .low_high_vol_lvl = 4000, - .n_temp_tbl_elements = ARRAY_SIZE(temp_tbl_B_thermistor), - .r_to_t_tbl = temp_tbl_B_thermistor, - .n_v_cap_tbl_elements = ARRAY_SIZE(cap_tbl_B_thermistor), - .v_to_cap_tbl = cap_tbl_B_thermistor, + .n_temp_tbl_elements = ARRAY_SIZE(temp_tbl_b_thermistor), + .r_to_t_tbl = temp_tbl_b_thermistor, + .n_v_cap_tbl_elements = ARRAY_SIZE(cap_tbl_b_thermistor), + .v_to_cap_tbl = cap_tbl_b_thermistor, .n_batres_tbl_elements = ARRAY_SIZE(temp_to_batres_tbl_thermistor), .batres_tbl = temp_to_batres_tbl_thermistor, }, -- 1.8.0 -- 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 v6 3/5] ab8500: power: add const attributes to some data arrays
This patch adds const attributes to AB8500 power and temperature related read-only data arrays. Signed-off-by: Hongbo Zhang hongbo.zh...@linaro.org --- drivers/power/ab8500_bmdata.c | 18 +- drivers/power/ab8500_fg.c | 4 ++-- include/linux/mfd/abx500.h| 6 +++--- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/power/ab8500_bmdata.c b/drivers/power/ab8500_bmdata.c index f836550..9c25ca8 100644 --- a/drivers/power/ab8500_bmdata.c +++ b/drivers/power/ab8500_bmdata.c @@ -11,7 +11,7 @@ * Note that the res_to_temp table must be strictly sorted by falling resistance * values to work. */ -static struct abx500_res_to_temp temp_tbl_a_thermistor[] = { +static const struct abx500_res_to_temp temp_tbl_a_thermistor[] = { {-5, 53407}, { 0, 48594}, { 5, 43804}, @@ -29,7 +29,7 @@ static struct abx500_res_to_temp temp_tbl_a_thermistor[] = { {65, 12500}, }; -static struct abx500_res_to_temp temp_tbl_b_thermistor[] = { +static const struct abx500_res_to_temp temp_tbl_b_thermistor[] = { {-5, 20}, { 0, 159024}, { 5, 151921}, @@ -47,7 +47,7 @@ static struct abx500_res_to_temp temp_tbl_b_thermistor[] = { {65, 82869}, }; -static struct abx500_v_to_cap cap_tbl_a_thermistor[] = { +static const struct abx500_v_to_cap cap_tbl_a_thermistor[] = { {4171, 100}, {4114, 95}, {4009, 83}, @@ -70,7 +70,7 @@ static struct abx500_v_to_cap cap_tbl_a_thermistor[] = { {3247,0}, }; -static struct abx500_v_to_cap cap_tbl_b_thermistor[] = { +static const struct abx500_v_to_cap cap_tbl_b_thermistor[] = { {4161, 100}, {4124, 98}, {4044, 90}, @@ -93,7 +93,7 @@ static struct abx500_v_to_cap cap_tbl_b_thermistor[] = { {3250,0}, }; -static struct abx500_v_to_cap cap_tbl[] = { +static const struct abx500_v_to_cap cap_tbl[] = { {4186, 100}, {4163, 99}, {4114, 95}, @@ -124,7 +124,7 @@ static struct abx500_v_to_cap cap_tbl[] = { * Note that the res_to_temp table must be strictly sorted by falling * resistance values to work. */ -static struct abx500_res_to_temp temp_tbl[] = { +static const struct abx500_res_to_temp temp_tbl[] = { {-5, 214834}, { 0, 162943}, { 5, 124820}, @@ -146,7 +146,7 @@ static struct abx500_res_to_temp temp_tbl[] = { * Note that the batres_vs_temp table must be strictly sorted by falling * temperature values to work. */ -static struct batres_vs_temp temp_to_batres_tbl_thermistor[] = { +static const struct batres_vs_temp temp_to_batres_tbl_thermistor[] = { { 40, 120}, { 30, 135}, { 20, 165}, @@ -160,7 +160,7 @@ static struct batres_vs_temp temp_to_batres_tbl_thermistor[] = { * Note that the batres_vs_temp table must be strictly sorted by falling * temperature values to work. */ -static struct batres_vs_temp temp_to_batres_tbl_ext_thermistor[] = { +static const struct batres_vs_temp temp_to_batres_tbl_ext_thermistor[] = { { 60, 300}, { 30, 300}, { 20, 300}, @@ -171,7 +171,7 @@ static struct batres_vs_temp temp_to_batres_tbl_ext_thermistor[] = { }; /* battery resistance table for LI ION 9100 battery */ -static struct batres_vs_temp temp_to_batres_tbl_9100[] = { +static const struct batres_vs_temp temp_to_batres_tbl_9100[] = { { 60, 180}, { 30, 180}, { 20, 180}, diff --git a/drivers/power/ab8500_fg.c b/drivers/power/ab8500_fg.c index b3bf178..d21456d 100644 --- a/drivers/power/ab8500_fg.c +++ b/drivers/power/ab8500_fg.c @@ -811,7 +811,7 @@ static int ab8500_fg_bat_voltage(struct ab8500_fg *di) static int ab8500_fg_volt_to_capacity(struct ab8500_fg *di, int voltage) { int i, tbl_size; - struct abx500_v_to_cap *tbl; + const struct abx500_v_to_cap *tbl; int cap = 0; tbl = di-bat-bat_type[di-bat-batt_id].v_to_cap_tbl, @@ -863,7 +863,7 @@ static int ab8500_fg_uncomp_volt_to_capacity(struct ab8500_fg *di) static int ab8500_fg_battery_resistance(struct ab8500_fg *di) { int i, tbl_size; - struct batres_vs_temp *tbl; + const struct batres_vs_temp *tbl; int resist = 0; tbl = di-bat-bat_type[di-bat-batt_id].batres_tbl; diff --git a/include/linux/mfd/abx500.h b/include/linux/mfd/abx500.h index 2138bd3..03fc0f1 100644 --- a/include/linux/mfd/abx500.h +++ b/include/linux/mfd/abx500.h @@ -173,11 +173,11 @@ struct abx500_battery_type { int low_high_vol_lvl; int battery_resistance; int n_temp_tbl_elements; - struct abx500_res_to_temp *r_to_t_tbl; + const struct abx500_res_to_temp *r_to_t_tbl; int n_v_cap_tbl_elements; - struct abx500_v_to_cap *v_to_cap_tbl; + const struct abx500_v_to_cap *v_to_cap_tbl; int n_batres_tbl_elements; - struct batres_vs_temp *batres_tbl; + const struct batres_vs_temp *batres_tbl; }; /** -- 1.8.0
[PATCH v6 4/5] ab8500: power: export abx500_res_to_temp tables for hwmon
This patch exports the thermistor resistance-to-temperature tables, so that the hwmon driver can access them, and also adds the corresponding table size variables. Signed-off-by: Hongbo Zhang hongbo.zh...@linaro.org --- drivers/power/ab8500_bmdata.c | 16 ++-- include/linux/power/ab8500.h | 16 2 files changed, 26 insertions(+), 6 deletions(-) create mode 100644 include/linux/power/ab8500.h diff --git a/drivers/power/ab8500_bmdata.c b/drivers/power/ab8500_bmdata.c index 9c25ca8..d9f1f25 100644 --- a/drivers/power/ab8500_bmdata.c +++ b/drivers/power/ab8500_bmdata.c @@ -11,7 +11,7 @@ * Note that the res_to_temp table must be strictly sorted by falling resistance * values to work. */ -static const struct abx500_res_to_temp temp_tbl_a_thermistor[] = { +const struct abx500_res_to_temp ab8500_temp_tbl_a_thermistor[] = { {-5, 53407}, { 0, 48594}, { 5, 43804}, @@ -29,7 +29,9 @@ static const struct abx500_res_to_temp temp_tbl_a_thermistor[] = { {65, 12500}, }; -static const struct abx500_res_to_temp temp_tbl_b_thermistor[] = { +const int ab8500_temp_tbl_a_size = ARRAY_SIZE(ab8500_temp_tbl_a_thermistor); + +const struct abx500_res_to_temp ab8500_temp_tbl_b_thermistor[] = { {-5, 20}, { 0, 159024}, { 5, 151921}, @@ -47,6 +49,8 @@ static const struct abx500_res_to_temp temp_tbl_b_thermistor[] = { {65, 82869}, }; +const int ab8500_temp_tbl_b_size = ARRAY_SIZE(ab8500_temp_tbl_b_thermistor); + static const struct abx500_v_to_cap cap_tbl_a_thermistor[] = { {4171, 100}, {4114, 95}, @@ -230,8 +234,8 @@ static struct abx500_battery_type bat_type_thermistor[] = { .maint_b_chg_timer_h = 200, .low_high_cur_lvl = 300, .low_high_vol_lvl = 4000, - .n_temp_tbl_elements = ARRAY_SIZE(temp_tbl_a_thermistor), - .r_to_t_tbl = temp_tbl_a_thermistor, + .n_temp_tbl_elements = ARRAY_SIZE(ab8500_temp_tbl_a_thermistor), + .r_to_t_tbl = ab8500_temp_tbl_a_thermistor, .n_v_cap_tbl_elements = ARRAY_SIZE(cap_tbl_a_thermistor), .v_to_cap_tbl = cap_tbl_a_thermistor, .n_batres_tbl_elements = ARRAY_SIZE(temp_to_batres_tbl_thermistor), @@ -258,8 +262,8 @@ static struct abx500_battery_type bat_type_thermistor[] = { .maint_b_chg_timer_h = 200, .low_high_cur_lvl = 300, .low_high_vol_lvl = 4000, - .n_temp_tbl_elements = ARRAY_SIZE(temp_tbl_b_thermistor), - .r_to_t_tbl = temp_tbl_b_thermistor, + .n_temp_tbl_elements = ARRAY_SIZE(ab8500_temp_tbl_b_thermistor), + .r_to_t_tbl = ab8500_temp_tbl_b_thermistor, .n_v_cap_tbl_elements = ARRAY_SIZE(cap_tbl_b_thermistor), .v_to_cap_tbl = cap_tbl_b_thermistor, .n_batres_tbl_elements = ARRAY_SIZE(temp_to_batres_tbl_thermistor), diff --git a/include/linux/power/ab8500.h b/include/linux/power/ab8500.h new file mode 100644 index 000..cdbb6c2 --- /dev/null +++ b/include/linux/power/ab8500.h @@ -0,0 +1,16 @@ +/* + * Copyright (C) ST-Ericsson 2013 + * Author: Hongbo Zhang hongbo.zh...@linaro.com + * License terms: GNU General Public License v2 + */ + +#ifndef PWR_AB8500_H +#define PWR_AB8500_H + +extern const struct abx500_res_to_temp ab8500_temp_tbl_a_thermistor[]; +extern const int ab8500_temp_tbl_a_size; + +extern const struct abx500_res_to_temp ab8500_temp_tbl_b_thermistor[]; +extern const int ab8500_temp_tbl_b_size; + +#endif /* PWR_AB8500_H */ -- 1.8.0 -- 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 v6 5/5] hwmon: add ST-Ericsson ABX500 hwmon driver
Each of ST-Ericsson X500 chip set series consists of both ABX500 and DBX500 chips. This is ABX500 hwmon driver, where the abx500.c is a common layer for all ABX500s, and the ab8500.c is specific for AB8500 chip. Under this designed structure, other chip specific files can be added simply using the same common layer abx500.c. Signed-off-by: Hongbo Zhang hongbo.zh...@linaro.org --- Documentation/hwmon/ab8500| 22 ++ Documentation/hwmon/abx500| 28 +++ drivers/hwmon/Kconfig | 13 ++ drivers/hwmon/Makefile| 1 + drivers/hwmon/ab8500.c| 206 ++ drivers/hwmon/abx500.c| 491 ++ drivers/hwmon/abx500.h| 69 ++ drivers/power/ab8500_bmdata.c | 4 + 8 files changed, 834 insertions(+) create mode 100644 Documentation/hwmon/ab8500 create mode 100644 Documentation/hwmon/abx500 create mode 100644 drivers/hwmon/ab8500.c create mode 100644 drivers/hwmon/abx500.c create mode 100644 drivers/hwmon/abx500.h diff --git a/Documentation/hwmon/ab8500 b/Documentation/hwmon/ab8500 new file mode 100644 index 000..cf169c8 --- /dev/null +++ b/Documentation/hwmon/ab8500 @@ -0,0 +1,22 @@ +Kernel driver ab8500 + + +Supported chips: + * ST-Ericsson AB8500 +Prefix: 'ab8500' +Addresses scanned: - +Datasheet: http://www.stericsson.com/developers/documentation.jsp + +Authors: +Martin Persson martin.pers...@stericsson.com +Hongbo Zhang hongbo.zh...@linaro.org + +Description +--- + +See also Documentation/hwmon/abx500. This is the ST-Ericsson AB8500 specific +driver. + +Currently only the AB8500 internal sensor and one external sensor for battery +temperature are monitored. Other GPADC channels can also be monitored if needed +in future. diff --git a/Documentation/hwmon/abx500 b/Documentation/hwmon/abx500 new file mode 100644 index 000..319a058 --- /dev/null +++ b/Documentation/hwmon/abx500 @@ -0,0 +1,28 @@ +Kernel driver abx500 + + +Supported chips: + * ST-Ericsson ABx500 series +Prefix: 'abx500' +Addresses scanned: - +Datasheet: http://www.stericsson.com/developers/documentation.jsp + +Authors: +Martin Persson martin.pers...@stericsson.com +Hongbo Zhang hongbo.zh...@linaro.org + +Description +--- + +Every ST-Ericsson Ux500 SOC consists of both ABx500 and DBx500 physically, +this is kernel hwmon driver for ABx500. + +There are some GPADCs inside ABx500 which are designed for connecting to +thermal sensors, and there is also a thermal sensor inside ABx500 too, which +raises interrupt when critical temperature reached. + +This abx500 is a common layer which can monitor all of the sensors, every +specific abx500 chip has its special configurations in its own file, e.g. some +sensors can be configured invisible if they are not available on that chip, and +the corresponding gpadc_addr should be set to 0, thus this sensor won't be +polled. diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index 32f238f..d0d6b52 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig @@ -39,6 +39,19 @@ config HWMON_DEBUG_CHIP comment Native drivers +config SENSORS_AB8500 + tristate AB8500 thermal monitoring + depends on AB8500_GPADC AB8500_BM + default n + help + If you say yes here you get support for the thermal sensor part + of the AB8500 chip. The driver includes thermal management for + AB8500 die and two GPADC channels. The GPADC channel are preferably + used to access sensors outside the AB8500 chip. + + This driver can also be built as a module. If so, the module + will be called abx500-temp. + config SENSORS_ABITUGURU tristate Abit uGuru (rev 1 2) depends on X86 DMI diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile index 5da2874..06dfe85 100644 --- a/drivers/hwmon/Makefile +++ b/drivers/hwmon/Makefile @@ -19,6 +19,7 @@ obj-$(CONFIG_SENSORS_W83795) += w83795.o obj-$(CONFIG_SENSORS_W83781D) += w83781d.o obj-$(CONFIG_SENSORS_W83791D) += w83791d.o +obj-$(CONFIG_SENSORS_AB8500) += abx500.o ab8500.o obj-$(CONFIG_SENSORS_ABITUGURU)+= abituguru.o obj-$(CONFIG_SENSORS_ABITUGURU3)+= abituguru3.o obj-$(CONFIG_SENSORS_AD7314) += ad7314.o diff --git a/drivers/hwmon/ab8500.c b/drivers/hwmon/ab8500.c new file mode 100644 index 000..ee0aa3e --- /dev/null +++ b/drivers/hwmon/ab8500.c @@ -0,0 +1,206 @@ +/* + * Copyright (C) ST-Ericsson 2010 - 2013 + * Author: Martin Persson martin.pers...@stericsson.com + * Hongbo Zhang hongbo.zh...@linaro.org + * License Terms: GNU General Public License v2 + * + * When the AB8500 thermal warning temperature is reached (threshold cannot + * be changed by SW), an interrupt is set, and if no further action is taken + * within a certain time frame, pm_power off will be called. + * + * When AB8500 thermal shutdown temperature is reached a hardware
Re: [PATCH v6 5/5] hwmon: add ST-Ericsson ABX500 hwmon driver
On 26 March 2013 23:23, Guenter Roeck li...@roeck-us.net wrote: On Tue, Mar 26, 2013 at 03:06:59PM +0800, Hongbo Zhang wrote: Each of ST-Ericsson X500 chip set series consists of both ABX500 and DBX500 chips. This is ABX500 hwmon driver, where the abx500.c is a common layer for all ABX500s, and the ab8500.c is specific for AB8500 chip. Under this designed structure, other chip specific files can be added simply using the same common layer abx500.c. Signed-off-by: Hongbo Zhang hongbo.zh...@linaro.org Looks good except ... diff --git a/drivers/power/ab8500_bmdata.c b/drivers/power/ab8500_bmdata.c index d9f1f25..05a1077 100644 --- a/drivers/power/ab8500_bmdata.c +++ b/drivers/power/ab8500_bmdata.c @@ -28,8 +28,10 @@ const struct abx500_res_to_temp ab8500_temp_tbl_a_thermistor[] = { {60, 13437}, {65, 12500}, }; +EXPORT_SYMBOL(ab8500_temp_tbl_a_thermistor); Those exports should be in the previous patch where you start exporting the symbols, not in this patch. Sorry, This was really my carelessness, will update it. Thanks, Guenter -- 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] hwmon: add ST-Ericsson ABX500 hwmon driver
Guenter, Thank you so much for all the comments, will re-send a v2 iteration soon. On 31 January 2013 02:37, Guenter Roeck wrote: > On Wed, Jan 30, 2013 at 06:21:28PM +0800, Hongbo Zhang wrote: >> Each of ST-Ericsson X500 chip set series consists of both ABX500 and DBX500 >> chips. This is ABX500 hwmon driver, where the abx500.c is a common layer for >> all ABX500s, and the ab8500.c is specific for AB8500 chip. Under this >> designed >> structure, other chip specific files can be added simply using the same >> common >> layer abx500.c. >> >> Signed-off-by: Hongbo Zhang >> --- >> drivers/hwmon/Kconfig | 13 + >> drivers/hwmon/Makefile | 1 + >> drivers/hwmon/ab8500.c | 160 >> drivers/hwmon/abx500.c | 681 >> + >> drivers/hwmon/abx500.h | 88 +++ >> 5 files changed, 943 insertions(+) >> create mode 100644 drivers/hwmon/ab8500.c >> create mode 100644 drivers/hwmon/abx500.c >> create mode 100644 drivers/hwmon/abx500.h >> > Hi, > > we'll also need Documentation/hwmon/ab8500 to describe the driver, and > possibly > Documentation/hwmon/ab85xx to describe the common elements. > Sure, will add them. >> diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig >> index 32f238f..0a6fd21 100644 >> --- a/drivers/hwmon/Kconfig >> +++ b/drivers/hwmon/Kconfig >> @@ -39,6 +39,19 @@ config HWMON_DEBUG_CHIP >> >> comment "Native drivers" >> >> +config SENSORS_AB8500 >> + tristate "AB8500 thermal monitoring" >> + depends on AB8500_GPADC >> + default n >> + help >> + If you say yes here you get support for the thermal sensor part >> + of the AB8500 chip. The driver includes thermal management for >> + AB8500 die and two GPADC channels. The GPADC channel are preferably >> + used to access sensors outside the AB8500 chip. >> + >> + This driver can also be built as a module. If so, the module >> + will be called abx500-temp. >> + >> config SENSORS_ABITUGURU >> tristate "Abit uGuru (rev 1 & 2)" >> depends on X86 && DMI >> diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile >> index 5da2874..06dfe85 100644 >> --- a/drivers/hwmon/Makefile >> +++ b/drivers/hwmon/Makefile >> @@ -19,6 +19,7 @@ obj-$(CONFIG_SENSORS_W83795)+= w83795.o >> obj-$(CONFIG_SENSORS_W83781D)+= w83781d.o >> obj-$(CONFIG_SENSORS_W83791D)+= w83791d.o >> >> +obj-$(CONFIG_SENSORS_AB8500) += abx500.o ab8500.o >> obj-$(CONFIG_SENSORS_ABITUGURU) += abituguru.o >> obj-$(CONFIG_SENSORS_ABITUGURU3)+= abituguru3.o >> obj-$(CONFIG_SENSORS_AD7314) += ad7314.o >> diff --git a/drivers/hwmon/ab8500.c b/drivers/hwmon/ab8500.c >> new file mode 100644 >> index 000..426872c >> --- /dev/null >> +++ b/drivers/hwmon/ab8500.c >> @@ -0,0 +1,160 @@ >> +/* >> + * Copyright (C) ST-Ericsson SA 2010 >> + * Author: Martin Persson for >> + * ST-Ericsson. >> + * License Terms: GNU General Public License v2 >> + * >> + * If/when the AB8500 thermal warning temperature is reached (threshold >> cannot >> + * be changed by SW), an interrupt is set and the driver notifies user space >> + * via a sysfs event. If a shut down is not triggered by user space within a >> + * certain time frame, pm_power off is called. >> + * >> + * If/when AB8500 thermal shutdown temperature is reached a hardware >> shutdown >> + * of the AB8500 will occur. >> + */ >> + >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include "abx500.h" >> + >> +#define DEFAULT_POWER_OFF_DELAY 1 >> + >> +/* The driver monitors GPADC - ADC_AUX1, ADC_AUX2, BTEMP_BALL and BAT_CTRL >> */ >> +#define NUM_MONITORED_SENSORS 4 >> + >> +static int ab8500_read_sensor(struct abx500_temp *data, u8 sensor) >> +{ >> + int val; >> + /* >> + * Special treatment for the BAT_CTRL node, since this temperature >> + * measurement is more complex than just an ADC readout >> + */ >> + if (sensor == BAT_CTRL) >> + val = ab8500_btemp_get_batctrl_temp(data->ab8500_btemp); >> + else >> + val = ab8500_gpadc_convert(data->ab8500_gpadc, sensor); >> + >> + return val; >> +} >> + >> +static void ab8500
Re: [PATCH 1/2] ARM: ux500: rename ab8500 to abx500 for hwmon driver
On 30 January 2013 23:45, Samuel Ortiz wrote: > Hi Hongbo, > > On Wed, Jan 30, 2013 at 06:21:27PM +0800, Hongbo Zhang wrote: >> We are using a generic abx500 hwmon layer, so rename specific ab8500 to >> generic >> abx500 for hwmon device and driver matching. >> >> Signed-off-by: Hongbo Zhang >> --- >> drivers/mfd/ab8500-core.c | 6 +++--- >> 1 file changed, 3 insertions(+), 3 deletions(-) > I'll take it although this patch subject should be prefixed with mfd: and not > ARM: > Thanks. I have to resend 2/2 of this patch set, so I would like to update this prefix then. > Cheers, > Samuel. > > -- > Intel Open Source Technology Centre > http://oss.intel.com/ -- 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] ARM: ux500: rename ab8500 to abx500 for hwmon driver
On 30 January 2013 23:45, Samuel Ortiz sa...@linux.intel.com wrote: Hi Hongbo, On Wed, Jan 30, 2013 at 06:21:27PM +0800, Hongbo Zhang wrote: We are using a generic abx500 hwmon layer, so rename specific ab8500 to generic abx500 for hwmon device and driver matching. Signed-off-by: Hongbo Zhang hongbo.zh...@linaro.org --- drivers/mfd/ab8500-core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) I'll take it although this patch subject should be prefixed with mfd: and not ARM: Thanks. I have to resend 2/2 of this patch set, so I would like to update this prefix then. Cheers, Samuel. -- Intel Open Source Technology Centre http://oss.intel.com/ -- 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] hwmon: add ST-Ericsson ABX500 hwmon driver
Guenter, Thank you so much for all the comments, will re-send a v2 iteration soon. On 31 January 2013 02:37, Guenter Roeck li...@roeck-us.net wrote: On Wed, Jan 30, 2013 at 06:21:28PM +0800, Hongbo Zhang wrote: Each of ST-Ericsson X500 chip set series consists of both ABX500 and DBX500 chips. This is ABX500 hwmon driver, where the abx500.c is a common layer for all ABX500s, and the ab8500.c is specific for AB8500 chip. Under this designed structure, other chip specific files can be added simply using the same common layer abx500.c. Signed-off-by: Hongbo Zhang hongbo.zh...@linaro.org --- drivers/hwmon/Kconfig | 13 + drivers/hwmon/Makefile | 1 + drivers/hwmon/ab8500.c | 160 drivers/hwmon/abx500.c | 681 + drivers/hwmon/abx500.h | 88 +++ 5 files changed, 943 insertions(+) create mode 100644 drivers/hwmon/ab8500.c create mode 100644 drivers/hwmon/abx500.c create mode 100644 drivers/hwmon/abx500.h Hi, we'll also need Documentation/hwmon/ab8500 to describe the driver, and possibly Documentation/hwmon/ab85xx to describe the common elements. Sure, will add them. diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index 32f238f..0a6fd21 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig @@ -39,6 +39,19 @@ config HWMON_DEBUG_CHIP comment Native drivers +config SENSORS_AB8500 + tristate AB8500 thermal monitoring + depends on AB8500_GPADC + default n + help + If you say yes here you get support for the thermal sensor part + of the AB8500 chip. The driver includes thermal management for + AB8500 die and two GPADC channels. The GPADC channel are preferably + used to access sensors outside the AB8500 chip. + + This driver can also be built as a module. If so, the module + will be called abx500-temp. + config SENSORS_ABITUGURU tristate Abit uGuru (rev 1 2) depends on X86 DMI diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile index 5da2874..06dfe85 100644 --- a/drivers/hwmon/Makefile +++ b/drivers/hwmon/Makefile @@ -19,6 +19,7 @@ obj-$(CONFIG_SENSORS_W83795)+= w83795.o obj-$(CONFIG_SENSORS_W83781D)+= w83781d.o obj-$(CONFIG_SENSORS_W83791D)+= w83791d.o +obj-$(CONFIG_SENSORS_AB8500) += abx500.o ab8500.o obj-$(CONFIG_SENSORS_ABITUGURU) += abituguru.o obj-$(CONFIG_SENSORS_ABITUGURU3)+= abituguru3.o obj-$(CONFIG_SENSORS_AD7314) += ad7314.o diff --git a/drivers/hwmon/ab8500.c b/drivers/hwmon/ab8500.c new file mode 100644 index 000..426872c --- /dev/null +++ b/drivers/hwmon/ab8500.c @@ -0,0 +1,160 @@ +/* + * Copyright (C) ST-Ericsson SA 2010 + * Author: Martin Persson martin.pers...@stericsson.com for + * ST-Ericsson. + * License Terms: GNU General Public License v2 + * + * If/when the AB8500 thermal warning temperature is reached (threshold cannot + * be changed by SW), an interrupt is set and the driver notifies user space + * via a sysfs event. If a shut down is not triggered by user space within a + * certain time frame, pm_power off is called. + * + * If/when AB8500 thermal shutdown temperature is reached a hardware shutdown + * of the AB8500 will occur. + */ + +#include linux/err.h +#include linux/hwmon.h +#include linux/hwmon-sysfs.h +#include linux/mfd/abx500/ab8500-bm.h +#include linux/mfd/abx500/ab8500-gpadc.h +#include linux/platform_device.h +#include linux/slab.h +#include linux/sysfs.h +#include abx500.h + +#define DEFAULT_POWER_OFF_DELAY 1 + +/* The driver monitors GPADC - ADC_AUX1, ADC_AUX2, BTEMP_BALL and BAT_CTRL */ +#define NUM_MONITORED_SENSORS 4 + +static int ab8500_read_sensor(struct abx500_temp *data, u8 sensor) +{ + int val; + /* + * Special treatment for the BAT_CTRL node, since this temperature + * measurement is more complex than just an ADC readout + */ + if (sensor == BAT_CTRL) + val = ab8500_btemp_get_batctrl_temp(data-ab8500_btemp); + else + val = ab8500_gpadc_convert(data-ab8500_gpadc, sensor); + + return val; +} + +static void ab8500_thermal_power_off(struct work_struct *work) +{ + struct abx500_temp *data = container_of(work, struct abx500_temp, + power_off_work.work); + + dev_warn(data-pdev-dev, + Power off due to AB8500 thermal warning.\n); + pm_power_off(); +} + +static ssize_t ab8500_show_name(struct device *dev, + struct device_attribute *devattr, + char *buf) +{ + return sprintf(buf, ab8500\n); +} + +static ssize_t ab8500_show_label(struct device *dev, + struct device_attribute *devattr, + char *buf) +{ + char *name; + struct sensor_device_attribute *attr = to_sensor_dev_attr
[PATCH 2/2] hwmon: add ST-Ericsson ABX500 hwmon driver
Each of ST-Ericsson X500 chip set series consists of both ABX500 and DBX500 chips. This is ABX500 hwmon driver, where the abx500.c is a common layer for all ABX500s, and the ab8500.c is specific for AB8500 chip. Under this designed structure, other chip specific files can be added simply using the same common layer abx500.c. Signed-off-by: Hongbo Zhang --- drivers/hwmon/Kconfig | 13 + drivers/hwmon/Makefile | 1 + drivers/hwmon/ab8500.c | 160 drivers/hwmon/abx500.c | 681 + drivers/hwmon/abx500.h | 88 +++ 5 files changed, 943 insertions(+) create mode 100644 drivers/hwmon/ab8500.c create mode 100644 drivers/hwmon/abx500.c create mode 100644 drivers/hwmon/abx500.h diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index 32f238f..0a6fd21 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig @@ -39,6 +39,19 @@ config HWMON_DEBUG_CHIP comment "Native drivers" +config SENSORS_AB8500 + tristate "AB8500 thermal monitoring" + depends on AB8500_GPADC + default n + help + If you say yes here you get support for the thermal sensor part + of the AB8500 chip. The driver includes thermal management for + AB8500 die and two GPADC channels. The GPADC channel are preferably + used to access sensors outside the AB8500 chip. + + This driver can also be built as a module. If so, the module + will be called abx500-temp. + config SENSORS_ABITUGURU tristate "Abit uGuru (rev 1 & 2)" depends on X86 && DMI diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile index 5da2874..06dfe85 100644 --- a/drivers/hwmon/Makefile +++ b/drivers/hwmon/Makefile @@ -19,6 +19,7 @@ obj-$(CONFIG_SENSORS_W83795) += w83795.o obj-$(CONFIG_SENSORS_W83781D) += w83781d.o obj-$(CONFIG_SENSORS_W83791D) += w83791d.o +obj-$(CONFIG_SENSORS_AB8500) += abx500.o ab8500.o obj-$(CONFIG_SENSORS_ABITUGURU)+= abituguru.o obj-$(CONFIG_SENSORS_ABITUGURU3)+= abituguru3.o obj-$(CONFIG_SENSORS_AD7314) += ad7314.o diff --git a/drivers/hwmon/ab8500.c b/drivers/hwmon/ab8500.c new file mode 100644 index 000..426872c --- /dev/null +++ b/drivers/hwmon/ab8500.c @@ -0,0 +1,160 @@ +/* + * Copyright (C) ST-Ericsson SA 2010 + * Author: Martin Persson for + * ST-Ericsson. + * License Terms: GNU General Public License v2 + * + * If/when the AB8500 thermal warning temperature is reached (threshold cannot + * be changed by SW), an interrupt is set and the driver notifies user space + * via a sysfs event. If a shut down is not triggered by user space within a + * certain time frame, pm_power off is called. + * + * If/when AB8500 thermal shutdown temperature is reached a hardware shutdown + * of the AB8500 will occur. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include "abx500.h" + +#define DEFAULT_POWER_OFF_DELAY 1 + +/* The driver monitors GPADC - ADC_AUX1, ADC_AUX2, BTEMP_BALL and BAT_CTRL */ +#define NUM_MONITORED_SENSORS 4 + +static int ab8500_read_sensor(struct abx500_temp *data, u8 sensor) +{ + int val; + /* +* Special treatment for the BAT_CTRL node, since this temperature +* measurement is more complex than just an ADC readout +*/ + if (sensor == BAT_CTRL) + val = ab8500_btemp_get_batctrl_temp(data->ab8500_btemp); + else + val = ab8500_gpadc_convert(data->ab8500_gpadc, sensor); + + return val; +} + +static void ab8500_thermal_power_off(struct work_struct *work) +{ + struct abx500_temp *data = container_of(work, struct abx500_temp, + power_off_work.work); + + dev_warn(>pdev->dev, + "Power off due to AB8500 thermal warning.\n"); + pm_power_off(); +} + +static ssize_t ab8500_show_name(struct device *dev, + struct device_attribute *devattr, + char *buf) +{ + return sprintf(buf, "ab8500\n"); +} + +static ssize_t ab8500_show_label(struct device *dev, + struct device_attribute *devattr, + char *buf) +{ + char *name; + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + int index = attr->index; + + switch (index) { + case 1: + name = "ext_rtc_xtal"; + break; + case 2: + name = "ext_db8500"; + break; + case 3: + name = "bat_temp"; + break; + case 4: + name = "bat_ctrl"; + break; + case 5: + name = "ab8500"; + break; + default: + return -EINVAL; + } +
[PATCH 1/2] ARM: ux500: rename ab8500 to abx500 for hwmon driver
We are using a generic abx500 hwmon layer, so rename specific ab8500 to generic abx500 for hwmon device and driver matching. Signed-off-by: Hongbo Zhang --- drivers/mfd/ab8500-core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/mfd/ab8500-core.c b/drivers/mfd/ab8500-core.c index e1650ba..579753f 100644 --- a/drivers/mfd/ab8500-core.c +++ b/drivers/mfd/ab8500-core.c @@ -922,7 +922,7 @@ static struct resource ab8505_iddet_resources[] = { static struct resource ab8500_temp_resources[] = { { - .name = "AB8500_TEMP_WARM", + .name = "ABX500_TEMP_WARM", .start = AB8500_INT_TEMP_WARM, .end = AB8500_INT_TEMP_WARM, .flags = IORESOURCE_IRQ, @@ -998,8 +998,8 @@ static struct mfd_cell abx500_common_devs[] = { .of_compatible = "stericsson,ab8500-denc", }, { - .name = "ab8500-temp", - .of_compatible = "stericsson,ab8500-temp", + .name = "abx500-temp", + .of_compatible = "stericsson,abx500-temp", .num_resources = ARRAY_SIZE(ab8500_temp_resources), .resources = ab8500_temp_resources, }, -- 1.8.0 -- 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 0/2] Add ST-Ericsson AB8500 HWMON driver
These patches are against the v3.8-rc4. Guenter Roeck, Jean Delvare, Please help to have a look at this. Samuel Ortiz, Please review 1/2 and leave your Acked-by: if no problem, I think these patches should be merged into HWMON tree. Thanks for all. Hongbo Zhang (2): ARM: ux500: rename ab8500 to abx500 for hwmon driver hwmon: add ST-Ericsson ABX500 hwmon driver drivers/hwmon/Kconfig | 13 + drivers/hwmon/Makefile| 1 + drivers/hwmon/ab8500.c| 160 +++ drivers/hwmon/abx500.c| 681 ++ drivers/hwmon/abx500.h| 88 ++ drivers/mfd/ab8500-core.c | 6 +- 6 files changed, 946 insertions(+), 3 deletions(-) create mode 100644 drivers/hwmon/ab8500.c create mode 100644 drivers/hwmon/abx500.c create mode 100644 drivers/hwmon/abx500.h -- 1.8.0 -- 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 0/2] Add ST-Ericsson AB8500 HWMON driver
These patches are against the v3.8-rc4. Guenter Roeck, Jean Delvare, Please help to have a look at this. Samuel Ortiz, Please review 1/2 and leave your Acked-by: if no problem, I think these patches should be merged into HWMON tree. Thanks for all. Hongbo Zhang (2): ARM: ux500: rename ab8500 to abx500 for hwmon driver hwmon: add ST-Ericsson ABX500 hwmon driver drivers/hwmon/Kconfig | 13 + drivers/hwmon/Makefile| 1 + drivers/hwmon/ab8500.c| 160 +++ drivers/hwmon/abx500.c| 681 ++ drivers/hwmon/abx500.h| 88 ++ drivers/mfd/ab8500-core.c | 6 +- 6 files changed, 946 insertions(+), 3 deletions(-) create mode 100644 drivers/hwmon/ab8500.c create mode 100644 drivers/hwmon/abx500.c create mode 100644 drivers/hwmon/abx500.h -- 1.8.0 -- 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 1/2] ARM: ux500: rename ab8500 to abx500 for hwmon driver
We are using a generic abx500 hwmon layer, so rename specific ab8500 to generic abx500 for hwmon device and driver matching. Signed-off-by: Hongbo Zhang hongbo.zh...@linaro.org --- drivers/mfd/ab8500-core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/mfd/ab8500-core.c b/drivers/mfd/ab8500-core.c index e1650ba..579753f 100644 --- a/drivers/mfd/ab8500-core.c +++ b/drivers/mfd/ab8500-core.c @@ -922,7 +922,7 @@ static struct resource ab8505_iddet_resources[] = { static struct resource ab8500_temp_resources[] = { { - .name = AB8500_TEMP_WARM, + .name = ABX500_TEMP_WARM, .start = AB8500_INT_TEMP_WARM, .end = AB8500_INT_TEMP_WARM, .flags = IORESOURCE_IRQ, @@ -998,8 +998,8 @@ static struct mfd_cell abx500_common_devs[] = { .of_compatible = stericsson,ab8500-denc, }, { - .name = ab8500-temp, - .of_compatible = stericsson,ab8500-temp, + .name = abx500-temp, + .of_compatible = stericsson,abx500-temp, .num_resources = ARRAY_SIZE(ab8500_temp_resources), .resources = ab8500_temp_resources, }, -- 1.8.0 -- 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 2/2] hwmon: add ST-Ericsson ABX500 hwmon driver
Each of ST-Ericsson X500 chip set series consists of both ABX500 and DBX500 chips. This is ABX500 hwmon driver, where the abx500.c is a common layer for all ABX500s, and the ab8500.c is specific for AB8500 chip. Under this designed structure, other chip specific files can be added simply using the same common layer abx500.c. Signed-off-by: Hongbo Zhang hongbo.zh...@linaro.org --- drivers/hwmon/Kconfig | 13 + drivers/hwmon/Makefile | 1 + drivers/hwmon/ab8500.c | 160 drivers/hwmon/abx500.c | 681 + drivers/hwmon/abx500.h | 88 +++ 5 files changed, 943 insertions(+) create mode 100644 drivers/hwmon/ab8500.c create mode 100644 drivers/hwmon/abx500.c create mode 100644 drivers/hwmon/abx500.h diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index 32f238f..0a6fd21 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig @@ -39,6 +39,19 @@ config HWMON_DEBUG_CHIP comment Native drivers +config SENSORS_AB8500 + tristate AB8500 thermal monitoring + depends on AB8500_GPADC + default n + help + If you say yes here you get support for the thermal sensor part + of the AB8500 chip. The driver includes thermal management for + AB8500 die and two GPADC channels. The GPADC channel are preferably + used to access sensors outside the AB8500 chip. + + This driver can also be built as a module. If so, the module + will be called abx500-temp. + config SENSORS_ABITUGURU tristate Abit uGuru (rev 1 2) depends on X86 DMI diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile index 5da2874..06dfe85 100644 --- a/drivers/hwmon/Makefile +++ b/drivers/hwmon/Makefile @@ -19,6 +19,7 @@ obj-$(CONFIG_SENSORS_W83795) += w83795.o obj-$(CONFIG_SENSORS_W83781D) += w83781d.o obj-$(CONFIG_SENSORS_W83791D) += w83791d.o +obj-$(CONFIG_SENSORS_AB8500) += abx500.o ab8500.o obj-$(CONFIG_SENSORS_ABITUGURU)+= abituguru.o obj-$(CONFIG_SENSORS_ABITUGURU3)+= abituguru3.o obj-$(CONFIG_SENSORS_AD7314) += ad7314.o diff --git a/drivers/hwmon/ab8500.c b/drivers/hwmon/ab8500.c new file mode 100644 index 000..426872c --- /dev/null +++ b/drivers/hwmon/ab8500.c @@ -0,0 +1,160 @@ +/* + * Copyright (C) ST-Ericsson SA 2010 + * Author: Martin Persson martin.pers...@stericsson.com for + * ST-Ericsson. + * License Terms: GNU General Public License v2 + * + * If/when the AB8500 thermal warning temperature is reached (threshold cannot + * be changed by SW), an interrupt is set and the driver notifies user space + * via a sysfs event. If a shut down is not triggered by user space within a + * certain time frame, pm_power off is called. + * + * If/when AB8500 thermal shutdown temperature is reached a hardware shutdown + * of the AB8500 will occur. + */ + +#include linux/err.h +#include linux/hwmon.h +#include linux/hwmon-sysfs.h +#include linux/mfd/abx500/ab8500-bm.h +#include linux/mfd/abx500/ab8500-gpadc.h +#include linux/platform_device.h +#include linux/slab.h +#include linux/sysfs.h +#include abx500.h + +#define DEFAULT_POWER_OFF_DELAY 1 + +/* The driver monitors GPADC - ADC_AUX1, ADC_AUX2, BTEMP_BALL and BAT_CTRL */ +#define NUM_MONITORED_SENSORS 4 + +static int ab8500_read_sensor(struct abx500_temp *data, u8 sensor) +{ + int val; + /* +* Special treatment for the BAT_CTRL node, since this temperature +* measurement is more complex than just an ADC readout +*/ + if (sensor == BAT_CTRL) + val = ab8500_btemp_get_batctrl_temp(data-ab8500_btemp); + else + val = ab8500_gpadc_convert(data-ab8500_gpadc, sensor); + + return val; +} + +static void ab8500_thermal_power_off(struct work_struct *work) +{ + struct abx500_temp *data = container_of(work, struct abx500_temp, + power_off_work.work); + + dev_warn(data-pdev-dev, + Power off due to AB8500 thermal warning.\n); + pm_power_off(); +} + +static ssize_t ab8500_show_name(struct device *dev, + struct device_attribute *devattr, + char *buf) +{ + return sprintf(buf, ab8500\n); +} + +static ssize_t ab8500_show_label(struct device *dev, + struct device_attribute *devattr, + char *buf) +{ + char *name; + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + int index = attr-index; + + switch (index) { + case 1: + name = ext_rtc_xtal; + break; + case 2: + name = ext_db8500; + break; + case 3: + name = bat_temp; + break; + case 4: + name = bat_ctrl; + break; + case 5: + name = ab8500; + break; + default
Re: [PATCH 4/8] Thermal: Add Thermal_trip sysfs node
On 18 December 2012 17:29, Durgadoss R wrote: > This patch adds a thermal_trip directory under > /sys/class/thermal/zoneX. This directory contains > the trip point values for sensors bound to this > zone. > > Signed-off-by: Durgadoss R > --- > drivers/thermal/thermal_sys.c | 237 > - > include/linux/thermal.h | 37 +++ > 2 files changed, 272 insertions(+), 2 deletions(-) > > diff --git a/drivers/thermal/thermal_sys.c b/drivers/thermal/thermal_sys.c > index b39bf97..29ec073 100644 > --- a/drivers/thermal/thermal_sys.c > +++ b/drivers/thermal/thermal_sys.c > @@ -448,6 +448,22 @@ static void thermal_zone_device_check(struct work_struct > *work) > thermal_zone_device_update(tz); > } > > +static int get_sensor_indx_by_kobj(struct thermal_zone *tz, const char *name) > +{ > + int i, indx = -EINVAL; > + > + mutex_lock(_list_lock); > + for (i = 0; i < tz->sensor_indx; i++) { > + if (!strnicmp(name, kobject_name(tz->kobj_trip[i]), > + THERMAL_NAME_LENGTH)) { > + indx = i; > + break; > + } > + } > + mutex_unlock(_list_lock); > + return indx; > +} > + > static void remove_sensor_from_zone(struct thermal_zone *tz, > struct thermal_sensor *ts) > { > @@ -459,9 +475,15 @@ static void remove_sensor_from_zone(struct thermal_zone > *tz, > > sysfs_remove_link(>device.kobj, kobject_name(>device.kobj)); > > + /* Delete this sensor's trip Kobject */ > + kobject_del(tz->kobj_trip[indx]); > + > /* Shift the entries in the tz->sensors array */ > - for (j = indx; j < MAX_SENSORS_PER_ZONE - 1; j++) > + for (j = indx; j < MAX_SENSORS_PER_ZONE - 1; j++) { > tz->sensors[j] = tz->sensors[j + 1]; > + tz->sensor_trip[j] = tz->sensor_trip[j + 1]; > + tz->kobj_trip[j] = tz->kobj_trip[j + 1]; > + } > > tz->sensor_indx--; > } > @@ -875,6 +897,120 @@ policy_show(struct device *dev, struct device_attribute > *devattr, char *buf) > return sprintf(buf, "%s\n", tz->governor->name); > } > > +static ssize_t > +active_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) > +{ > + int i, indx, ret = 0; > + struct thermal_zone *tz; > + struct device *dev; > + > + /* In this function, for > +* /sys/class/thermal/zoneX/thermal_trip/sensorY: > +* attr points to sysfs node 'active' > +* kobj points to sensorY > +* kobj->parent points to thermal_trip > +* kobj->parent->parent points to zoneX > +*/ > + > + /* Get the zone pointer */ > + dev = container_of(kobj->parent->parent, struct device, kobj); > + tz = to_zone(dev); > + if (!tz) > + return -EINVAL; > + > + /* > +* We need this because in the sysfs tree, 'sensorY' is > +* not really the sensor pointer. It just has the name > +* 'sensorY'; whereas 'zoneX' is actually the zone pointer. > +* This means container_of(kobj, struct device, kobj) will not > +* provide the actual sensor pointer. > +*/ > + indx = get_sensor_indx_by_kobj(tz, kobject_name(kobj)); > + if (indx < 0) > + return indx; > + > + if (tz->sensor_trip[indx]->num_active_trips <= 0) > + return sprintf(buf, "\n"); > + > + ret += sprintf(buf, "0x%x", tz->sensor_trip[indx]->active_trip_mask); > + for (i = 0; i < tz->sensor_trip[indx]->num_active_trips; i++) { > + ret += sprintf(buf + ret, " %d", > + tz->sensor_trip[indx]->active_trips[i]); > + } > + > + ret += sprintf(buf + ret, "\n"); > + return ret; > +} > + > +static ssize_t > +ptrip_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) > +{ > + int i, indx, ret = 0; > + struct thermal_zone *tz; > + struct device *dev; > + > + /* Get the zone pointer */ > + dev = container_of(kobj->parent->parent, struct device, kobj); > + tz = to_zone(dev); > + if (!tz) > + return -EINVAL; > + > + indx = get_sensor_indx_by_kobj(tz, kobject_name(kobj)); > + if (indx < 0) > + return indx; > + > + if (tz->sensor_trip[indx]->num_passive_trips <= 0) > + return sprintf(buf, "\n"); > + > + for (i = 0; i < tz->sensor_trip[indx]->num_passive_trips; i++) { > + ret += sprintf(buf + ret, "%d ", > + tz->sensor_trip[indx]->passive_trips[i]); > + } > + > + ret += sprintf(buf + ret, "\n"); > + return ret; > +} > + > +static ssize_t > +hot_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) > +{ > + int indx; > + struct thermal_zone *tz; > + struct device *dev; > +
Re: [PATCH 4/8] Thermal: Add Thermal_trip sysfs node
On 18 December 2012 17:29, Durgadoss R durgados...@intel.com wrote: This patch adds a thermal_trip directory under /sys/class/thermal/zoneX. This directory contains the trip point values for sensors bound to this zone. Signed-off-by: Durgadoss R durgados...@intel.com --- drivers/thermal/thermal_sys.c | 237 - include/linux/thermal.h | 37 +++ 2 files changed, 272 insertions(+), 2 deletions(-) diff --git a/drivers/thermal/thermal_sys.c b/drivers/thermal/thermal_sys.c index b39bf97..29ec073 100644 --- a/drivers/thermal/thermal_sys.c +++ b/drivers/thermal/thermal_sys.c @@ -448,6 +448,22 @@ static void thermal_zone_device_check(struct work_struct *work) thermal_zone_device_update(tz); } +static int get_sensor_indx_by_kobj(struct thermal_zone *tz, const char *name) +{ + int i, indx = -EINVAL; + + mutex_lock(sensor_list_lock); + for (i = 0; i tz-sensor_indx; i++) { + if (!strnicmp(name, kobject_name(tz-kobj_trip[i]), + THERMAL_NAME_LENGTH)) { + indx = i; + break; + } + } + mutex_unlock(sensor_list_lock); + return indx; +} + static void remove_sensor_from_zone(struct thermal_zone *tz, struct thermal_sensor *ts) { @@ -459,9 +475,15 @@ static void remove_sensor_from_zone(struct thermal_zone *tz, sysfs_remove_link(tz-device.kobj, kobject_name(ts-device.kobj)); + /* Delete this sensor's trip Kobject */ + kobject_del(tz-kobj_trip[indx]); + /* Shift the entries in the tz-sensors array */ - for (j = indx; j MAX_SENSORS_PER_ZONE - 1; j++) + for (j = indx; j MAX_SENSORS_PER_ZONE - 1; j++) { tz-sensors[j] = tz-sensors[j + 1]; + tz-sensor_trip[j] = tz-sensor_trip[j + 1]; + tz-kobj_trip[j] = tz-kobj_trip[j + 1]; + } tz-sensor_indx--; } @@ -875,6 +897,120 @@ policy_show(struct device *dev, struct device_attribute *devattr, char *buf) return sprintf(buf, %s\n, tz-governor-name); } +static ssize_t +active_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) +{ + int i, indx, ret = 0; + struct thermal_zone *tz; + struct device *dev; + + /* In this function, for +* /sys/class/thermal/zoneX/thermal_trip/sensorY: +* attr points to sysfs node 'active' +* kobj points to sensorY +* kobj-parent points to thermal_trip +* kobj-parent-parent points to zoneX +*/ + + /* Get the zone pointer */ + dev = container_of(kobj-parent-parent, struct device, kobj); + tz = to_zone(dev); + if (!tz) + return -EINVAL; + + /* +* We need this because in the sysfs tree, 'sensorY' is +* not really the sensor pointer. It just has the name +* 'sensorY'; whereas 'zoneX' is actually the zone pointer. +* This means container_of(kobj, struct device, kobj) will not +* provide the actual sensor pointer. +*/ + indx = get_sensor_indx_by_kobj(tz, kobject_name(kobj)); + if (indx 0) + return indx; + + if (tz-sensor_trip[indx]-num_active_trips = 0) + return sprintf(buf, Not available\n); + + ret += sprintf(buf, 0x%x, tz-sensor_trip[indx]-active_trip_mask); + for (i = 0; i tz-sensor_trip[indx]-num_active_trips; i++) { + ret += sprintf(buf + ret, %d, + tz-sensor_trip[indx]-active_trips[i]); + } + + ret += sprintf(buf + ret, \n); + return ret; +} + +static ssize_t +ptrip_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) +{ + int i, indx, ret = 0; + struct thermal_zone *tz; + struct device *dev; + + /* Get the zone pointer */ + dev = container_of(kobj-parent-parent, struct device, kobj); + tz = to_zone(dev); + if (!tz) + return -EINVAL; + + indx = get_sensor_indx_by_kobj(tz, kobject_name(kobj)); + if (indx 0) + return indx; + + if (tz-sensor_trip[indx]-num_passive_trips = 0) + return sprintf(buf, Not available\n); + + for (i = 0; i tz-sensor_trip[indx]-num_passive_trips; i++) { + ret += sprintf(buf + ret, %d , + tz-sensor_trip[indx]-passive_trips[i]); + } + + ret += sprintf(buf + ret, \n); + return ret; +} + +static ssize_t +hot_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) +{ + int indx; + struct thermal_zone *tz; + struct device *dev; + + /* Get the zone pointer */ + dev = container_of(kobj-parent-parent, struct device, kobj); + tz =
Re: [PATCH 0/8] Thermal Framework Enhancements
On 21 December 2012 16:30, R, Durgadoss wrote: > Hi Ni, > >> -Original Message- >> From: Wei Ni [mailto:w...@nvidia.com] >> Sent: Friday, December 21, 2012 1:36 PM >> To: R, Durgadoss >> Cc: Zhang, Rui; linux...@vger.kernel.org; linux-kernel@vger.kernel.org; >> hongbo.zh...@linaro.org >> Subject: Re: [PATCH 0/8] Thermal Framework Enhancements >> >> On 12/18/2012 05:29 PM, Durgadoss R wrote: >> > This patch is a v1 based on the RFC submitted here: >> > https://patchwork.kernel.org/patch/1758921/ >> > >> > This patch set is based on Rui's -thermal tree, and is >> > tested on a Core-i5 and an Atom netbook. >> > >> > This series contains 8 patches: >> > Patch 1/8: Creates new sensor level APIs >> > Patch 2/8: Creates new zone level APIs. The existing tzd structure is >> >kept as such for clarity and compatibility purposes. >> > Patch 3/8: Creates functions to add/remove a cdev to/from a zone. The >> >existing tcd structure need not be modified. >> > Patch 4/8: Adds a thermal_trip sysfs node, which exposes various trip >> >points for all sensors present in a zone. >> > Patch 5/8: Adds a thermal_map sysfs node. It is a compact representation >> >of the binding relationship between a sensor and a cdev, >> >within a zone. >> > Patch 6/8: Creates Documentation for the new APIs. A new file is >> >created for clarity. Final goal is to merge with the existing >> >file or refactor the files, as whatever seems appropriate. >> > Patch 7/8: Make PER ZONE values configurable through Kconfig >> > Patch 8/8: A dummy driver that can be used for testing. This is not for >> merge. >> >> I read these patches, they create new APIs and sysfs, but it seems they >> didn't use the thermal_zone to handle the thermal_throttle issue, >> something like update thermal_zone, update temperature, handle >> governors >> when cross the trip temp. So will you send out next serial patches for >> these implementation? > > Yes, once these get into Rui's tree, we will start migrating the existing > drivers/ > and governors, to get things working. Durgadoss, See function psy_register_thermal() in power_supply_core.c, thermal_zone_device_register() is used here, what will this look like in future? Create thermal zone here? Or add sensor to thermal zone? if so, how do we know which zone to add sensor to? > > Thanks, > Durga -- 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 0/8] Thermal Framework Enhancements
On 21 December 2012 16:30, R, Durgadoss durgados...@intel.com wrote: Hi Ni, -Original Message- From: Wei Ni [mailto:w...@nvidia.com] Sent: Friday, December 21, 2012 1:36 PM To: R, Durgadoss Cc: Zhang, Rui; linux...@vger.kernel.org; linux-kernel@vger.kernel.org; hongbo.zh...@linaro.org Subject: Re: [PATCH 0/8] Thermal Framework Enhancements On 12/18/2012 05:29 PM, Durgadoss R wrote: This patch is a v1 based on the RFC submitted here: https://patchwork.kernel.org/patch/1758921/ This patch set is based on Rui's -thermal tree, and is tested on a Core-i5 and an Atom netbook. This series contains 8 patches: Patch 1/8: Creates new sensor level APIs Patch 2/8: Creates new zone level APIs. The existing tzd structure is kept as such for clarity and compatibility purposes. Patch 3/8: Creates functions to add/remove a cdev to/from a zone. The existing tcd structure need not be modified. Patch 4/8: Adds a thermal_trip sysfs node, which exposes various trip points for all sensors present in a zone. Patch 5/8: Adds a thermal_map sysfs node. It is a compact representation of the binding relationship between a sensor and a cdev, within a zone. Patch 6/8: Creates Documentation for the new APIs. A new file is created for clarity. Final goal is to merge with the existing file or refactor the files, as whatever seems appropriate. Patch 7/8: Make PER ZONE values configurable through Kconfig Patch 8/8: A dummy driver that can be used for testing. This is not for merge. I read these patches, they create new APIs and sysfs, but it seems they didn't use the thermal_zone to handle the thermal_throttle issue, something like update thermal_zone, update temperature, handle governors when cross the trip temp. So will you send out next serial patches for these implementation? Yes, once these get into Rui's tree, we will start migrating the existing drivers/ and governors, to get things working. Durgadoss, See function psy_register_thermal() in power_supply_core.c, thermal_zone_device_register() is used here, what will this look like in future? Create thermal zone here? Or add sensor to thermal zone? if so, how do we know which zone to add sensor to? Thanks, Durga -- 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 1/2] Thermal: Add ST-Ericsson DB8500 thermal driver.
On 15 November 2012 18:17, Viresh Kumar wrote: > On 15 November 2012 14:53, Hongbo Zhang wrote: >> this is a driver for ST-Ericsson u8500 board(Snowball), with a ARM core >> inside. >> so you should compile like this: >> make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- u8500_defconfig >> make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- uImage > > Then we must have a DEPENDS_ON in Kconfig entry for these. Sorry for the negligence. A V6 iteration has been sent out with "depends on ARCH_U8500" added. Thank all of you. > > > -- > viresh -- 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 1/2] Thermal: Add ST-Ericsson DB8500 thermal driver.
this is a driver for ST-Ericsson u8500 board(Snowball), with a ARM core inside. so you should compile like this: make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- u8500_defconfig make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- uImage On 15 November 2012 17:13, Zhang Rui wrote: > On Thu, 2012-11-15 at 16:32 +0800, Hongbo Zhang wrote: >> On 15 November 2012 16:13, Zhang Rui wrote: >> > On Fri, 2012-11-09 at 19:29 +0800, hongbo.zhang wrote: >> >> From: "hongbo.zhang" >> >> >> >> This driver is based on the thermal management framework in >> >> thermal_sys.c. A >> >> thermal zone device is created with the trip points to which cooling >> >> devices >> >> can be bound, the current cooling device is cpufreq, e.g. CPU frequency is >> >> clipped down to cool the CPU, and other cooling devices can be added and >> >> bound >> >> to the trip points dynamically. The platform specific PRCMU interrupts >> >> are >> >> used to active thermal update when trip points are reached. >> >> >> >> Signed-off-by: hongbo.zhang >> >> Reviewed-by: Viresh Kumar >> >> Reviewed-by: Francesco Lavra >> > >> >> diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig >> >> index e1cb6bd..54c8fd0 100644 >> >> --- a/drivers/thermal/Kconfig >> >> +++ b/drivers/thermal/Kconfig >> >> @@ -31,6 +31,26 @@ config CPU_THERMAL >> >> and not the ACPI interface. >> >> If you want this support, you should say Y here. >> >> >> >> +config DB8500_THERMAL >> >> + bool "DB8500 thermal management" >> > >> > why is this bool? >> >> platform specific PRCMU interfaces are used, and those interfaces are >> not exported, so my driver cannot be compiled as a module. >> > ok. > But I still alway get this error message when set DB8500_THERMAL, > include/linux/mfd/dbx500-prcmu.h:459:19: error: redefinition of > ‘prcmu_abb_read’ > include/linux/mfd/db8500-prcmu.h:673:19: note: previous definition of > ‘prcmu_abb_read’ was here > include/linux/mfd/dbx500-prcmu.h:464:19: error: redefinition of > ‘prcmu_abb_write’ > include/linux/mfd/db8500-prcmu.h:678:19: note: previous definition of > ‘prcmu_abb_write’ was here > include/linux/mfd/dbx500-prcmu.h:475:19: error: redefinition of > ‘prcmu_config_clkout’ > include/linux/mfd/db8500-prcmu.h:643:19: note: previous definition of > ‘prcmu_config_clkout’ was here > include/linux/mfd/dbx500-prcmu.h:537:19: error: redefinition of > ‘prcmu_ac_wake_req’ > include/linux/mfd/db8500-prcmu.h:683:19: note: previous definition of > ‘prcmu_ac_wake_req’ was here > include/linux/mfd/dbx500-prcmu.h:542:20: error: redefinition of > ‘prcmu_ac_sleep_req’ > include/linux/mfd/db8500-prcmu.h:688:20: note: previous definition of > ‘prcmu_ac_sleep_req’ was here > > $ grep prcmu_abb_read include/linux/mfd/* > include/linux/mfd/db8500-prcmu.h:int prcmu_abb_read(u8 slave, u8 reg, u8 > *value, u8 size); > include/linux/mfd/db8500-prcmu.h:static inline int prcmu_abb_read(u8 > slave, u8 reg, u8 *value, u8 size) > include/linux/mfd/dbx500-prcmu.h:int prcmu_abb_read(u8 slave, u8 reg, u8 > *value, u8 size); > include/linux/mfd/dbx500-prcmu.h:static inline int prcmu_abb_read(u8 > slave, u8 reg, u8 *value, u8 size) > > this functions are defined in both db8500-prmcu.h and dbx500-prcmu.h, > plus linux/mfd/dbx500-prcmu.h includes linux/mfd/db8500-prcmu.h. > > I do not know how it works before, but this is a bug to me. > > thanks, > rui > -- 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 1/2] Thermal: Add ST-Ericsson DB8500 thermal driver.
On 15 November 2012 16:13, Zhang Rui wrote: > On Fri, 2012-11-09 at 19:29 +0800, hongbo.zhang wrote: >> From: "hongbo.zhang" >> >> This driver is based on the thermal management framework in thermal_sys.c. A >> thermal zone device is created with the trip points to which cooling devices >> can be bound, the current cooling device is cpufreq, e.g. CPU frequency is >> clipped down to cool the CPU, and other cooling devices can be added and >> bound >> to the trip points dynamically. The platform specific PRCMU interrupts are >> used to active thermal update when trip points are reached. >> >> Signed-off-by: hongbo.zhang >> Reviewed-by: Viresh Kumar >> Reviewed-by: Francesco Lavra > >> diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig >> index e1cb6bd..54c8fd0 100644 >> --- a/drivers/thermal/Kconfig >> +++ b/drivers/thermal/Kconfig >> @@ -31,6 +31,26 @@ config CPU_THERMAL >> and not the ACPI interface. >> If you want this support, you should say Y here. >> >> +config DB8500_THERMAL >> + bool "DB8500 thermal management" > > why is this bool? platform specific PRCMU interfaces are used, and those interfaces are not exported, so my driver cannot be compiled as a module. > > thanks, > rui > > > -- > 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/ -- 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 1/2] Thermal: Add ST-Ericsson DB8500 thermal driver.
On 15 November 2012 16:13, Zhang Rui rui.zh...@intel.com wrote: On Fri, 2012-11-09 at 19:29 +0800, hongbo.zhang wrote: From: hongbo.zhang hongbo.zh...@linaro.com This driver is based on the thermal management framework in thermal_sys.c. A thermal zone device is created with the trip points to which cooling devices can be bound, the current cooling device is cpufreq, e.g. CPU frequency is clipped down to cool the CPU, and other cooling devices can be added and bound to the trip points dynamically. The platform specific PRCMU interrupts are used to active thermal update when trip points are reached. Signed-off-by: hongbo.zhang hongbo.zh...@linaro.com Reviewed-by: Viresh Kumar viresh.ku...@linaro.org Reviewed-by: Francesco Lavra francescolavra...@gmail.com diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig index e1cb6bd..54c8fd0 100644 --- a/drivers/thermal/Kconfig +++ b/drivers/thermal/Kconfig @@ -31,6 +31,26 @@ config CPU_THERMAL and not the ACPI interface. If you want this support, you should say Y here. +config DB8500_THERMAL + bool DB8500 thermal management why is this bool? platform specific PRCMU interfaces are used, and those interfaces are not exported, so my driver cannot be compiled as a module. thanks, rui -- 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/ -- 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 1/2] Thermal: Add ST-Ericsson DB8500 thermal driver.
this is a driver for ST-Ericsson u8500 board(Snowball), with a ARM core inside. so you should compile like this: make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- u8500_defconfig make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- uImage On 15 November 2012 17:13, Zhang Rui rui.zh...@intel.com wrote: On Thu, 2012-11-15 at 16:32 +0800, Hongbo Zhang wrote: On 15 November 2012 16:13, Zhang Rui rui.zh...@intel.com wrote: On Fri, 2012-11-09 at 19:29 +0800, hongbo.zhang wrote: From: hongbo.zhang hongbo.zh...@linaro.com This driver is based on the thermal management framework in thermal_sys.c. A thermal zone device is created with the trip points to which cooling devices can be bound, the current cooling device is cpufreq, e.g. CPU frequency is clipped down to cool the CPU, and other cooling devices can be added and bound to the trip points dynamically. The platform specific PRCMU interrupts are used to active thermal update when trip points are reached. Signed-off-by: hongbo.zhang hongbo.zh...@linaro.com Reviewed-by: Viresh Kumar viresh.ku...@linaro.org Reviewed-by: Francesco Lavra francescolavra...@gmail.com diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig index e1cb6bd..54c8fd0 100644 --- a/drivers/thermal/Kconfig +++ b/drivers/thermal/Kconfig @@ -31,6 +31,26 @@ config CPU_THERMAL and not the ACPI interface. If you want this support, you should say Y here. +config DB8500_THERMAL + bool DB8500 thermal management why is this bool? platform specific PRCMU interfaces are used, and those interfaces are not exported, so my driver cannot be compiled as a module. ok. But I still alway get this error message when set DB8500_THERMAL, include/linux/mfd/dbx500-prcmu.h:459:19: error: redefinition of ‘prcmu_abb_read’ include/linux/mfd/db8500-prcmu.h:673:19: note: previous definition of ‘prcmu_abb_read’ was here include/linux/mfd/dbx500-prcmu.h:464:19: error: redefinition of ‘prcmu_abb_write’ include/linux/mfd/db8500-prcmu.h:678:19: note: previous definition of ‘prcmu_abb_write’ was here include/linux/mfd/dbx500-prcmu.h:475:19: error: redefinition of ‘prcmu_config_clkout’ include/linux/mfd/db8500-prcmu.h:643:19: note: previous definition of ‘prcmu_config_clkout’ was here include/linux/mfd/dbx500-prcmu.h:537:19: error: redefinition of ‘prcmu_ac_wake_req’ include/linux/mfd/db8500-prcmu.h:683:19: note: previous definition of ‘prcmu_ac_wake_req’ was here include/linux/mfd/dbx500-prcmu.h:542:20: error: redefinition of ‘prcmu_ac_sleep_req’ include/linux/mfd/db8500-prcmu.h:688:20: note: previous definition of ‘prcmu_ac_sleep_req’ was here $ grep prcmu_abb_read include/linux/mfd/* include/linux/mfd/db8500-prcmu.h:int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size); include/linux/mfd/db8500-prcmu.h:static inline int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size) include/linux/mfd/dbx500-prcmu.h:int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size); include/linux/mfd/dbx500-prcmu.h:static inline int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size) this functions are defined in both db8500-prmcu.h and dbx500-prcmu.h, plus linux/mfd/dbx500-prcmu.h includes linux/mfd/db8500-prcmu.h. I do not know how it works before, but this is a bug to me. thanks, rui -- 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 1/2] Thermal: Add ST-Ericsson DB8500 thermal driver.
On 15 November 2012 18:17, Viresh Kumar viresh.ku...@linaro.org wrote: On 15 November 2012 14:53, Hongbo Zhang hongbo.zh...@linaro.org wrote: this is a driver for ST-Ericsson u8500 board(Snowball), with a ARM core inside. so you should compile like this: make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- u8500_defconfig make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- uImage Then we must have a DEPENDS_ON in Kconfig entry for these. Sorry for the negligence. A V6 iteration has been sent out with depends on ARCH_U8500 added. Thank all of you. -- viresh -- 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/2] Thermal: Add ST-Ericsson DB8500 thermal properties and platform data.
On 13 November 2012 04:46, Linus Walleij wrote: > On Mon, Nov 12, 2012 at 7:07 AM, Zhang Rui wrote: >> On Fri, 2012-11-09 at 19:29 +0800, hongbo.zhang wrote: >>> From: "hongbo.zhang" >>> >>> This patch adds device tree properties for ST-Ericsson DB8500 thermal >>> driver, >>> also adds the platform data to support the old fashion. >>> >>> Signed-off-by: hongbo.zhang >>> Reviewed-by: Viresh Kumar >> >> hmmm, >> >> who should take this patch? >> I'd like to see ACK from the maintainer of these code before applying >> them to thermal tree. > > I guess it needs to go through Thermal. > > Acked-by: Linus Walleij Thank you Linus Walleij. Hi Rui, I got it. > Let's hope it's not creating too much conflict... > > Yours, > Linus Walleij -- 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/2] Thermal: Add ST-Ericsson DB8500 thermal properties and platform data.
On 13 November 2012 04:46, Linus Walleij linus.wall...@linaro.org wrote: On Mon, Nov 12, 2012 at 7:07 AM, Zhang Rui rui.zh...@intel.com wrote: On Fri, 2012-11-09 at 19:29 +0800, hongbo.zhang wrote: From: hongbo.zhang hongbo.zh...@linaro.com This patch adds device tree properties for ST-Ericsson DB8500 thermal driver, also adds the platform data to support the old fashion. Signed-off-by: hongbo.zhang hongbo.zh...@linaro.com Reviewed-by: Viresh Kumar viresh.ku...@linaro.org hmmm, who should take this patch? I'd like to see ACK from the maintainer of these code before applying them to thermal tree. I guess it needs to go through Thermal. Acked-by: Linus Walleij linus.wall...@linaro.org Thank you Linus Walleij. Hi Rui, I got it. Let's hope it's not creating too much conflict... Yours, Linus Walleij -- 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/5] Thermal: Remove the cooling_cpufreq_list.
On 7 November 2012 14:54, Zhang Rui wrote: > On Tue, 2012-10-30 at 17:48 +0100, hongbo.zhang wrote: >> From: "hongbo.zhang" >> >> Problem of using this list is that the cpufreq_get_max_state callback will be >> called when register cooling device by thermal_cooling_device_register, but >> this list isn't ready at this moment. What's more, there is no need to >> maintain >> such a list, we can get cpufreq_cooling_device instance by the private >> thermal_cooling_device.devdata. >> >> Signed-off-by: hongbo.zhang >> Reviewed-by: Francesco Lavra >> Reviewed-by: Amit Daniel Kachhap > > applied to thermal-next. Thanks. I have sent the other updated 4/5 5/5 patches with Reviewed-by added in a new thread, please have a look there. > > thanks, > rui > >> --- >> drivers/thermal/cpu_cooling.c | 91 >> +-- >> 1 file changed, 19 insertions(+), 72 deletions(-) >> >> diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c >> index bfd62b7..392d57d 100644 >> --- a/drivers/thermal/cpu_cooling.c >> +++ b/drivers/thermal/cpu_cooling.c >> @@ -58,8 +58,9 @@ struct cpufreq_cooling_device { >> }; >> static LIST_HEAD(cooling_cpufreq_list); >> static DEFINE_IDR(cpufreq_idr); >> +static DEFINE_MUTEX(cooling_cpufreq_lock); >> >> -static struct mutex cooling_cpufreq_lock; >> +static unsigned int cpufreq_dev_count; >> >> /* notify_table passes value to the CPUFREQ_ADJUST callback function. */ >> #define NOTIFY_INVALID NULL >> @@ -240,28 +241,18 @@ static int cpufreq_thermal_notifier(struct >> notifier_block *nb, >> static int cpufreq_get_max_state(struct thermal_cooling_device *cdev, >>unsigned long *state) >> { >> - int ret = -EINVAL, i = 0; >> - struct cpufreq_cooling_device *cpufreq_device; >> - struct cpumask *maskPtr; >> + struct cpufreq_cooling_device *cpufreq_device = cdev->devdata; >> + struct cpumask *maskPtr = _device->allowed_cpus; >> unsigned int cpu; >> struct cpufreq_frequency_table *table; >> unsigned long count = 0; >> + int i = 0; >> >> - mutex_lock(_cpufreq_lock); >> - list_for_each_entry(cpufreq_device, _cpufreq_list, node) { >> - if (cpufreq_device && cpufreq_device->cool_dev == cdev) >> - break; >> - } >> - if (cpufreq_device == NULL) >> - goto return_get_max_state; >> - >> - maskPtr = _device->allowed_cpus; >> cpu = cpumask_any(maskPtr); >> table = cpufreq_frequency_get_table(cpu); >> if (!table) { >> *state = 0; >> - ret = 0; >> - goto return_get_max_state; >> + return 0; >> } >> >> for (i = 0; (table[i].frequency != CPUFREQ_TABLE_END); i++) { >> @@ -272,12 +263,10 @@ static int cpufreq_get_max_state(struct >> thermal_cooling_device *cdev, >> >> if (count > 0) { >> *state = --count; >> - ret = 0; >> + return 0; >> } >> >> -return_get_max_state: >> - mutex_unlock(_cpufreq_lock); >> - return ret; >> + return -EINVAL; >> } >> >> /** >> @@ -288,20 +277,10 @@ return_get_max_state: >> static int cpufreq_get_cur_state(struct thermal_cooling_device *cdev, >>unsigned long *state) >> { >> - int ret = -EINVAL; >> - struct cpufreq_cooling_device *cpufreq_device; >> + struct cpufreq_cooling_device *cpufreq_device = cdev->devdata; >> >> - mutex_lock(_cpufreq_lock); >> - list_for_each_entry(cpufreq_device, _cpufreq_list, node) { >> - if (cpufreq_device && cpufreq_device->cool_dev == cdev) { >> - *state = cpufreq_device->cpufreq_state; >> - ret = 0; >> - break; >> - } >> - } >> - mutex_unlock(_cpufreq_lock); >> - >> - return ret; >> + *state = cpufreq_device->cpufreq_state; >> + return 0; >> } >> >> /** >> @@ -312,22 +291,9 @@ static int cpufreq_get_cur_state(struct >> thermal_cooling_device *cdev, >> static int cpufreq_set_cur_state(struct thermal_cooling_device *cdev, >>unsigned long state) >> { >> - int ret = -EINVAL; >> - struct cpufreq_cooling_device *cpufreq_device; >> + struct cpufreq_cooling_device *cpufreq_device = cdev->devdata; >> >> - mutex_lock(_cpufreq_lock); >> - list_for_each_entry(cpufreq_device, _cpufreq_list, node) { >> - if (cpufreq_device && cpufreq_device->cool_dev == cdev) { >> - ret = 0; >> - break; >> - } >> - } >> - if (!ret) >> - ret = cpufreq_apply_cooling(cpufreq_device, state); >> - >> - mutex_unlock(_cpufreq_lock); >> - >> - return ret; >> + return cpufreq_apply_cooling(cpufreq_device, state); >> } >> >> /* Bind cpufreq callbacks to thermal cooling device ops */ >> @@ -351,14 +317,11 @@ struct thermal_cooling_device >>
Re: [PATCH V5 0/2] Upstream ST-Ericsson thermal driver
Hi Rui Zhang, Please have a look at this patch set. Since the previous 1/5, 2/5, 3/5 have been accepted, I'd like to send these last two updated patches with Reviewed-by added in this new thread. Thanks. On 9 November 2012 19:29, hongbo.zhang wrote: > From: "hongbo.zhang" > > V4->V5 Changes: > > In patch "Thermal: Add ST-Ericsson DB8500 thermal driver": > - use flush_work instead of flush_work_sync since the later is deprecated > now. > - parameter trip_points of db8500_thermal_match_cdev is renamed to > trip_point; > - re-order oprerations in function db8500_thermal_update_config; > > hongbo.zhang (2): > Thermal: Add ST-Ericsson DB8500 thermal driver. > Thermal: Add ST-Ericsson DB8500 thermal properties and platform data. > > .../devicetree/bindings/thermal/db8500-thermal.txt | 44 ++ > arch/arm/boot/dts/dbx5x0.dtsi | 14 + > arch/arm/boot/dts/snowball.dts | 31 ++ > arch/arm/configs/u8500_defconfig | 2 + > arch/arm/mach-ux500/board-mop500.c | 64 +++ > drivers/thermal/Kconfig| 20 + > drivers/thermal/Makefile | 2 + > drivers/thermal/db8500_cpufreq_cooling.c | 108 + > drivers/thermal/db8500_thermal.c | 531 > + > include/linux/platform_data/db8500_thermal.h | 38 ++ > 10 files changed, 854 insertions(+) > create mode 100644 > Documentation/devicetree/bindings/thermal/db8500-thermal.txt > create mode 100644 drivers/thermal/db8500_cpufreq_cooling.c > create mode 100644 drivers/thermal/db8500_thermal.c > create mode 100644 include/linux/platform_data/db8500_thermal.h > > -- > 1.7.11.3 > -- 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 0/2] Upstream ST-Ericsson thermal driver
Hi Rui Zhang, Please have a look at this patch set. Since the previous 1/5, 2/5, 3/5 have been accepted, I'd like to send these last two updated patches with Reviewed-by added in this new thread. Thanks. On 9 November 2012 19:29, hongbo.zhang hongbo.zh...@linaro.org wrote: From: hongbo.zhang hongbo.zh...@linaro.com V4-V5 Changes: In patch Thermal: Add ST-Ericsson DB8500 thermal driver: - use flush_work instead of flush_work_sync since the later is deprecated now. - parameter trip_points of db8500_thermal_match_cdev is renamed to trip_point; - re-order oprerations in function db8500_thermal_update_config; hongbo.zhang (2): Thermal: Add ST-Ericsson DB8500 thermal driver. Thermal: Add ST-Ericsson DB8500 thermal properties and platform data. .../devicetree/bindings/thermal/db8500-thermal.txt | 44 ++ arch/arm/boot/dts/dbx5x0.dtsi | 14 + arch/arm/boot/dts/snowball.dts | 31 ++ arch/arm/configs/u8500_defconfig | 2 + arch/arm/mach-ux500/board-mop500.c | 64 +++ drivers/thermal/Kconfig| 20 + drivers/thermal/Makefile | 2 + drivers/thermal/db8500_cpufreq_cooling.c | 108 + drivers/thermal/db8500_thermal.c | 531 + include/linux/platform_data/db8500_thermal.h | 38 ++ 10 files changed, 854 insertions(+) create mode 100644 Documentation/devicetree/bindings/thermal/db8500-thermal.txt create mode 100644 drivers/thermal/db8500_cpufreq_cooling.c create mode 100644 drivers/thermal/db8500_thermal.c create mode 100644 include/linux/platform_data/db8500_thermal.h -- 1.7.11.3 -- 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/5] Thermal: Remove the cooling_cpufreq_list.
On 7 November 2012 14:54, Zhang Rui rui.zh...@intel.com wrote: On Tue, 2012-10-30 at 17:48 +0100, hongbo.zhang wrote: From: hongbo.zhang hongbo.zh...@linaro.com Problem of using this list is that the cpufreq_get_max_state callback will be called when register cooling device by thermal_cooling_device_register, but this list isn't ready at this moment. What's more, there is no need to maintain such a list, we can get cpufreq_cooling_device instance by the private thermal_cooling_device.devdata. Signed-off-by: hongbo.zhang hongbo.zh...@linaro.com Reviewed-by: Francesco Lavra francescolavra...@gmail.com Reviewed-by: Amit Daniel Kachhap amit.kach...@linaro.org applied to thermal-next. Thanks. I have sent the other updated 4/5 5/5 patches with Reviewed-by added in a new thread, please have a look there. thanks, rui --- drivers/thermal/cpu_cooling.c | 91 +-- 1 file changed, 19 insertions(+), 72 deletions(-) diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c index bfd62b7..392d57d 100644 --- a/drivers/thermal/cpu_cooling.c +++ b/drivers/thermal/cpu_cooling.c @@ -58,8 +58,9 @@ struct cpufreq_cooling_device { }; static LIST_HEAD(cooling_cpufreq_list); static DEFINE_IDR(cpufreq_idr); +static DEFINE_MUTEX(cooling_cpufreq_lock); -static struct mutex cooling_cpufreq_lock; +static unsigned int cpufreq_dev_count; /* notify_table passes value to the CPUFREQ_ADJUST callback function. */ #define NOTIFY_INVALID NULL @@ -240,28 +241,18 @@ static int cpufreq_thermal_notifier(struct notifier_block *nb, static int cpufreq_get_max_state(struct thermal_cooling_device *cdev, unsigned long *state) { - int ret = -EINVAL, i = 0; - struct cpufreq_cooling_device *cpufreq_device; - struct cpumask *maskPtr; + struct cpufreq_cooling_device *cpufreq_device = cdev-devdata; + struct cpumask *maskPtr = cpufreq_device-allowed_cpus; unsigned int cpu; struct cpufreq_frequency_table *table; unsigned long count = 0; + int i = 0; - mutex_lock(cooling_cpufreq_lock); - list_for_each_entry(cpufreq_device, cooling_cpufreq_list, node) { - if (cpufreq_device cpufreq_device-cool_dev == cdev) - break; - } - if (cpufreq_device == NULL) - goto return_get_max_state; - - maskPtr = cpufreq_device-allowed_cpus; cpu = cpumask_any(maskPtr); table = cpufreq_frequency_get_table(cpu); if (!table) { *state = 0; - ret = 0; - goto return_get_max_state; + return 0; } for (i = 0; (table[i].frequency != CPUFREQ_TABLE_END); i++) { @@ -272,12 +263,10 @@ static int cpufreq_get_max_state(struct thermal_cooling_device *cdev, if (count 0) { *state = --count; - ret = 0; + return 0; } -return_get_max_state: - mutex_unlock(cooling_cpufreq_lock); - return ret; + return -EINVAL; } /** @@ -288,20 +277,10 @@ return_get_max_state: static int cpufreq_get_cur_state(struct thermal_cooling_device *cdev, unsigned long *state) { - int ret = -EINVAL; - struct cpufreq_cooling_device *cpufreq_device; + struct cpufreq_cooling_device *cpufreq_device = cdev-devdata; - mutex_lock(cooling_cpufreq_lock); - list_for_each_entry(cpufreq_device, cooling_cpufreq_list, node) { - if (cpufreq_device cpufreq_device-cool_dev == cdev) { - *state = cpufreq_device-cpufreq_state; - ret = 0; - break; - } - } - mutex_unlock(cooling_cpufreq_lock); - - return ret; + *state = cpufreq_device-cpufreq_state; + return 0; } /** @@ -312,22 +291,9 @@ static int cpufreq_get_cur_state(struct thermal_cooling_device *cdev, static int cpufreq_set_cur_state(struct thermal_cooling_device *cdev, unsigned long state) { - int ret = -EINVAL; - struct cpufreq_cooling_device *cpufreq_device; + struct cpufreq_cooling_device *cpufreq_device = cdev-devdata; - mutex_lock(cooling_cpufreq_lock); - list_for_each_entry(cpufreq_device, cooling_cpufreq_list, node) { - if (cpufreq_device cpufreq_device-cool_dev == cdev) { - ret = 0; - break; - } - } - if (!ret) - ret = cpufreq_apply_cooling(cpufreq_device, state); - - mutex_unlock(cooling_cpufreq_lock); - - return ret; + return cpufreq_apply_cooling(cpufreq_device, state); } /* Bind cpufreq callbacks to thermal cooling device ops */ @@ -351,14 +317,11 @@ struct thermal_cooling_device *cpufreq_cooling_register( { struct thermal_cooling_device *cool_dev; struct cpufreq_cooling_device
Re: [PATCH V3 4/5] Thermal: Add ST-Ericsson DB8500 thermal driver.
On 6 November 2012 18:17, Hongbo Zhang wrote: > On 1 November 2012 09:52, Zhang, Rui wrote: >> >> >>> -Original Message- >>> From: hongbo.zhang [mailto:hongbo.zh...@linaro.org] >>> Sent: Wednesday, October 31, 2012 12:49 AM >>> To: linaro-...@lists.linaro.org; linux-kernel@vger.kernel.org; linux- >>> p...@vger.kernel.org; Zhang, Rui; amit.kach...@linaro.org >>> Cc: patc...@linaro.org; linaro-ker...@lists.linaro.org; >>> stericsson_nomadik_li...@list.st.com; ker...@igloocommunity.org; >>> hongbo.zhang >>> Subject: [PATCH V3 4/5] Thermal: Add ST-Ericsson DB8500 thermal driver. >>> Importance: High >>> >>> From: "hongbo.zhang" >>> >>> This diver is based on the thermal management framework in >>> thermal_sys.c. A thermal zone device is created with the trip points to >>> which cooling devices can be bound, the current cooling device is >>> cpufreq, e.g. CPU frequency is clipped down to cool the CPU, and other >>> cooling devices can be added and bound to the trip points dynamically. >>> The platform specific PRCMU interrupts are used to active thermal >>> update when trip points are reached. >>> >>> Signed-off-by: hongbo.zhang >>> --- >>> .../devicetree/bindings/thermal/db8500-thermal.txt | 40 ++ >>> drivers/thermal/Kconfig| 20 + >>> drivers/thermal/Makefile | 2 + >>> drivers/thermal/db8500_cpufreq_cooling.c | 108 + >>> drivers/thermal/db8500_thermal.c | 531 >>> + >>> include/linux/platform_data/db8500_thermal.h | 38 ++ >>> 6 files changed, 739 insertions(+) >>> create mode 100644 Documentation/devicetree/bindings/thermal/db8500- >>> thermal.txt >>> create mode 100644 drivers/thermal/db8500_cpufreq_cooling.c >>> create mode 100644 drivers/thermal/db8500_thermal.c create mode >>> 100644 include/linux/platform_data/db8500_thermal.h >>> >>> diff --git a/Documentation/devicetree/bindings/thermal/db8500- >>> thermal.txt b/Documentation/devicetree/bindings/thermal/db8500- >>> thermal.txt >>> new file mode 100644 >>> index 000..cab6916 >>> --- /dev/null >>> +++ b/Documentation/devicetree/bindings/thermal/db8500-thermal.txt >>> @@ -0,0 +1,40 @@ >>> +* ST-Ericsson DB8500 Thermal >>> + >>> +** Thermal node properties: >>> + >>> +- compatible : "stericsson,db8500-thermal"; >>> +- reg : address range of the thermal sensor registers; >>> +- interrupts : interrupts generated from PRCMU; >>> +- interrupt-names : "IRQ_HOTMON_LOW" and "IRQ_HOTMON_HIGH"; >>> +- num-trips : number of total trip points; >>> +- tripN-temp : temperature of trip point N, should be in ascending >>> +order; >>> +- tripN-type : type of trip point N, should be one of "active" >>> +"passive" "hot" "critical"; >>> +- tripN-cdev-num : number of the cooling devices which can be bound to >>> +trip point N; >>> +- tripN-cdev-nameM : name of the No. M cooling device of trip point N; >>> + >>> +Usually the num-trips and tripN-*** are separated in board related dts >>> files. >>> + >>> +Example: >>> +thermal@801573c0 { >>> + compatible = "stericsson,db8500-thermal"; >>> + reg = <0x801573c0 0x40>; >>> + interrupts = <21 0x4>, <22 0x4>; >>> + interrupt-names = "IRQ_HOTMON_LOW", "IRQ_HOTMON_HIGH"; >>> + >>> + num-trips = <3>; >>> + >>> + trip0-temp = <7>; >>> + trip0-type = "active"; >>> + trip0-cdev-num = <1>; >>> + trip0-cdev-name0 = "thermal-cpufreq-0"; >>> + >>> + trip1-temp = <75000>; >>> + trip1-type = "active"; >>> + trip1-cdev-num = <2>; >>> + trip1-cdev-name0 = "thermal-cpufreq-0"; >>> + trip1-cdev-name1 = "thermal-fan"; >>> + >>> + trip2-temp = <85000>; >>> + trip2-type = "critical"; >>> + trip2-cdev-num = <0>; >>> +} >>> diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig index >>> e1cb6bd..54c8fd0 100644 >>> --- a/drivers/thermal/Kconfig >>> +++ b/drivers/thermal
Re: [PATCH V3 4/5] Thermal: Add ST-Ericsson DB8500 thermal driver.
; thermal >> + management framework. A thermal zone with several trip points >> will be >> + created. Cooling devices can be bound to the trip points to >> cool this >> + thermal zone if trip points reached. >> + >> +config DB8500_CPUFREQ_COOLING >> + tristate "DB8500 cpufreq cooling" >> + depends on CPU_THERMAL >> + default y >> + help >> + Adds DB8500 cpufreq cooling devices, and these cooling devices >> can be >> + bound to thermal zone trip points. When a trip point reached, >> the >> + bound cpufreq cooling device turns active to set CPU frequency >> low to >> + cool down the CPU. >> + >> config SPEAR_THERMAL >> bool "SPEAr thermal sensor driver" >> depends on THERMAL >> diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile index >> 885550d..c7a8dab 100644 >> --- a/drivers/thermal/Makefile >> +++ b/drivers/thermal/Makefile >> @@ -7,3 +7,5 @@ obj-$(CONFIG_CPU_THERMAL) += cpu_cooling.o >> obj-$(CONFIG_SPEAR_THERMAL) += spear_thermal.o >> obj-$(CONFIG_RCAR_THERMAL) += rcar_thermal.o >> obj-$(CONFIG_EXYNOS_THERMAL) += exynos_thermal.o >> +obj-$(CONFIG_DB8500_THERMAL) += db8500_thermal.o >> +obj-$(CONFIG_DB8500_CPUFREQ_COOLING) += db8500_cpufreq_cooling.o >> diff --git a/drivers/thermal/db8500_cpufreq_cooling.c >> b/drivers/thermal/db8500_cpufreq_cooling.c >> new file mode 100644 >> index 000..4cf8e72 >> --- /dev/null >> +++ b/drivers/thermal/db8500_cpufreq_cooling.c >> @@ -0,0 +1,108 @@ >> +/* >> + * db8500_cpufreq_cooling.c - DB8500 cpufreq works as cooling device. >> + * >> + * Copyright (C) 2012 ST-Ericsson >> + * Copyright (C) 2012 Linaro Ltd. >> + * >> + * Author: Hongbo Zhang >> + * >> + * This program is free software; you can redistribute it and/or >> modify >> + * it under the terms of the GNU General Public License as published >> by >> + * the Free Software Foundation; either version 2 of the License, or >> + * (at your option) any later version. >> + * >> + * This program is distributed in the hope that it will be useful, >> + * but WITHOUT ANY WARRANTY; without even the implied warranty of >> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >> + * GNU General Public License for more details. >> + */ >> + >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> + >> +static int db8500_cpufreq_cooling_probe(struct platform_device *pdev) >> { >> + struct thermal_cooling_device *cdev; >> + struct cpumask mask_val; >> + >> + /* make sure cpufreq driver has been initialized */ >> + if (!cpufreq_frequency_get_table(0)) >> + return -EPROBE_DEFER; >> + >> + cpumask_set_cpu(0, _val); >> + cdev = cpufreq_cooling_register(_val); >> + >> + if (IS_ERR_OR_NULL(cdev)) { >> + dev_err(>dev, "Failed to register cooling device\n"); >> + return PTR_ERR(cdev); >> + } >> + >> + platform_set_drvdata(pdev, cdev); >> + >> + dev_info(>dev, "Cooling device registered: %s\n", cdev- >> >type); >> + >> + return 0; >> +} >> + >> +static int db8500_cpufreq_cooling_remove(struct platform_device *pdev) >> +{ >> + struct thermal_cooling_device *cdev = platform_get_drvdata(pdev); >> + >> + cpufreq_cooling_unregister(cdev); >> + >> + return 0; >> +} >> + >> +static int db8500_cpufreq_cooling_suspend(struct platform_device *pdev, >> + pm_message_t state) >> +{ >> + return -ENOSYS; >> +} >> + >> +static int db8500_cpufreq_cooling_resume(struct platform_device *pdev) >> +{ >> + return -ENOSYS; >> +} >> + >> +#ifdef CONFIG_OF >> +static const struct of_device_id db8500_cpufreq_cooling_match[] = { >> + { .compatible = "stericsson,db8500-cpufreq-cooling" }, >> + {}, >> +}; >> +#else >> +#define db8500_cpufreq_cooling_match NULL #endif >> + >> +static struct platform_driver db8500_cpufreq_cooling_driver = { >> + .driver = { >> + .owner = THIS_MODULE, >> + .name = "db8500-cpufreq-cooling", >> + .of_match_table = db8500_cpufreq_cooling_match, >> + }, >> + .probe = db8500_cpufreq_c
Re: [PATCH V3 4/5] Thermal: Add ST-Ericsson DB8500 thermal driver.
) += exynos_thermal.o +obj-$(CONFIG_DB8500_THERMAL) += db8500_thermal.o +obj-$(CONFIG_DB8500_CPUFREQ_COOLING) += db8500_cpufreq_cooling.o diff --git a/drivers/thermal/db8500_cpufreq_cooling.c b/drivers/thermal/db8500_cpufreq_cooling.c new file mode 100644 index 000..4cf8e72 --- /dev/null +++ b/drivers/thermal/db8500_cpufreq_cooling.c @@ -0,0 +1,108 @@ +/* + * db8500_cpufreq_cooling.c - DB8500 cpufreq works as cooling device. + * + * Copyright (C) 2012 ST-Ericsson + * Copyright (C) 2012 Linaro Ltd. + * + * Author: Hongbo Zhang hongbo.zh...@linaro.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include linux/cpu_cooling.h +#include linux/cpufreq.h +#include linux/err.h +#include linux/module.h +#include linux/platform_device.h +#include linux/slab.h + +static int db8500_cpufreq_cooling_probe(struct platform_device *pdev) { + struct thermal_cooling_device *cdev; + struct cpumask mask_val; + + /* make sure cpufreq driver has been initialized */ + if (!cpufreq_frequency_get_table(0)) + return -EPROBE_DEFER; + + cpumask_set_cpu(0, mask_val); + cdev = cpufreq_cooling_register(mask_val); + + if (IS_ERR_OR_NULL(cdev)) { + dev_err(pdev-dev, Failed to register cooling device\n); + return PTR_ERR(cdev); + } + + platform_set_drvdata(pdev, cdev); + + dev_info(pdev-dev, Cooling device registered: %s\n, cdev- type); + + return 0; +} + +static int db8500_cpufreq_cooling_remove(struct platform_device *pdev) +{ + struct thermal_cooling_device *cdev = platform_get_drvdata(pdev); + + cpufreq_cooling_unregister(cdev); + + return 0; +} + +static int db8500_cpufreq_cooling_suspend(struct platform_device *pdev, + pm_message_t state) +{ + return -ENOSYS; +} + +static int db8500_cpufreq_cooling_resume(struct platform_device *pdev) +{ + return -ENOSYS; +} + +#ifdef CONFIG_OF +static const struct of_device_id db8500_cpufreq_cooling_match[] = { + { .compatible = stericsson,db8500-cpufreq-cooling }, + {}, +}; +#else +#define db8500_cpufreq_cooling_match NULL #endif + +static struct platform_driver db8500_cpufreq_cooling_driver = { + .driver = { + .owner = THIS_MODULE, + .name = db8500-cpufreq-cooling, + .of_match_table = db8500_cpufreq_cooling_match, + }, + .probe = db8500_cpufreq_cooling_probe, + .suspend = db8500_cpufreq_cooling_suspend, + .resume = db8500_cpufreq_cooling_resume, + .remove = db8500_cpufreq_cooling_remove, }; + +static int __init db8500_cpufreq_cooling_init(void) { + return platform_driver_register(db8500_cpufreq_cooling_driver); +} + +static void __exit db8500_cpufreq_cooling_exit(void) { + platform_driver_unregister(db8500_cpufreq_cooling_driver); +} + +/* Should be later than db8500_cpufreq_register */ +late_initcall(db8500_cpufreq_cooling_init); +module_exit(db8500_cpufreq_cooling_exit); + +MODULE_AUTHOR(Hongbo Zhang hongbo.zh...@stericsson.com); +MODULE_DESCRIPTION(DB8500 cpufreq cooling driver); +MODULE_LICENSE(GPL); diff --git a/drivers/thermal/db8500_thermal.c b/drivers/thermal/db8500_thermal.c new file mode 100644 index 000..023f7b4 --- /dev/null +++ b/drivers/thermal/db8500_thermal.c @@ -0,0 +1,531 @@ +/* + * db8500_thermal.c - DB8500 Thermal Management Implementation + * + * Copyright (C) 2012 ST-Ericsson + * Copyright (C) 2012 Linaro Ltd. + * + * Author: Hongbo Zhang hongbo.zh...@linaro.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include linux/cpu_cooling.h +#include linux/interrupt.h +#include linux/mfd/dbx500-prcmu.h +#include linux/module.h +#include linux/of.h +#include linux/platform_data/db8500_thermal.h +#include linux/platform_device.h +#include linux/slab.h +#include linux/thermal.h + +#define PRCMU_DEFAULT_MEASURE_TIME 0xFFF +#define PRCMU_DEFAULT_LOW_TEMP 0 + +struct
Re: [PATCH V3 4/5] Thermal: Add ST-Ericsson DB8500 thermal driver.
On 6 November 2012 18:17, Hongbo Zhang hongbo.zh...@linaro.org wrote: On 1 November 2012 09:52, Zhang, Rui rui.zh...@intel.com wrote: -Original Message- From: hongbo.zhang [mailto:hongbo.zh...@linaro.org] Sent: Wednesday, October 31, 2012 12:49 AM To: linaro-...@lists.linaro.org; linux-kernel@vger.kernel.org; linux- p...@vger.kernel.org; Zhang, Rui; amit.kach...@linaro.org Cc: patc...@linaro.org; linaro-ker...@lists.linaro.org; stericsson_nomadik_li...@list.st.com; ker...@igloocommunity.org; hongbo.zhang Subject: [PATCH V3 4/5] Thermal: Add ST-Ericsson DB8500 thermal driver. Importance: High From: hongbo.zhang hongbo.zh...@linaro.com This diver is based on the thermal management framework in thermal_sys.c. A thermal zone device is created with the trip points to which cooling devices can be bound, the current cooling device is cpufreq, e.g. CPU frequency is clipped down to cool the CPU, and other cooling devices can be added and bound to the trip points dynamically. The platform specific PRCMU interrupts are used to active thermal update when trip points are reached. Signed-off-by: hongbo.zhang hongbo.zh...@linaro.com --- .../devicetree/bindings/thermal/db8500-thermal.txt | 40 ++ drivers/thermal/Kconfig| 20 + drivers/thermal/Makefile | 2 + drivers/thermal/db8500_cpufreq_cooling.c | 108 + drivers/thermal/db8500_thermal.c | 531 + include/linux/platform_data/db8500_thermal.h | 38 ++ 6 files changed, 739 insertions(+) create mode 100644 Documentation/devicetree/bindings/thermal/db8500- thermal.txt create mode 100644 drivers/thermal/db8500_cpufreq_cooling.c create mode 100644 drivers/thermal/db8500_thermal.c create mode 100644 include/linux/platform_data/db8500_thermal.h diff --git a/Documentation/devicetree/bindings/thermal/db8500- thermal.txt b/Documentation/devicetree/bindings/thermal/db8500- thermal.txt new file mode 100644 index 000..cab6916 --- /dev/null +++ b/Documentation/devicetree/bindings/thermal/db8500-thermal.txt @@ -0,0 +1,40 @@ +* ST-Ericsson DB8500 Thermal + +** Thermal node properties: + +- compatible : stericsson,db8500-thermal; +- reg : address range of the thermal sensor registers; +- interrupts : interrupts generated from PRCMU; +- interrupt-names : IRQ_HOTMON_LOW and IRQ_HOTMON_HIGH; +- num-trips : number of total trip points; +- tripN-temp : temperature of trip point N, should be in ascending +order; +- tripN-type : type of trip point N, should be one of active +passive hot critical; +- tripN-cdev-num : number of the cooling devices which can be bound to +trip point N; +- tripN-cdev-nameM : name of the No. M cooling device of trip point N; + +Usually the num-trips and tripN-*** are separated in board related dts files. + +Example: +thermal@801573c0 { + compatible = stericsson,db8500-thermal; + reg = 0x801573c0 0x40; + interrupts = 21 0x4, 22 0x4; + interrupt-names = IRQ_HOTMON_LOW, IRQ_HOTMON_HIGH; + + num-trips = 3; + + trip0-temp = 7; + trip0-type = active; + trip0-cdev-num = 1; + trip0-cdev-name0 = thermal-cpufreq-0; + + trip1-temp = 75000; + trip1-type = active; + trip1-cdev-num = 2; + trip1-cdev-name0 = thermal-cpufreq-0; + trip1-cdev-name1 = thermal-fan; + + trip2-temp = 85000; + trip2-type = critical; + trip2-cdev-num = 0; +} diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig index e1cb6bd..54c8fd0 100644 --- a/drivers/thermal/Kconfig +++ b/drivers/thermal/Kconfig @@ -31,6 +31,26 @@ config CPU_THERMAL and not the ACPI interface. If you want this support, you should say Y here. +config DB8500_THERMAL + bool DB8500 thermal management + depends on THERMAL + default y + help + Adds DB8500 thermal management implementation according to the thermal + management framework. A thermal zone with several trip points will be + created. Cooling devices can be bound to the trip points to cool this + thermal zone if trip points reached. + +config DB8500_CPUFREQ_COOLING + tristate DB8500 cpufreq cooling + depends on CPU_THERMAL + default y + help + Adds DB8500 cpufreq cooling devices, and these cooling devices can be + bound to thermal zone trip points. When a trip point reached, the + bound cpufreq cooling device turns active to set CPU frequency low to + cool down the CPU. + config SPEAR_THERMAL bool SPEAr thermal sensor driver depends on THERMAL diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile index 885550d..c7a8dab 100644 --- a/drivers/thermal/Makefile +++ b/drivers/thermal/Makefile @@ -7,3 +7,5 @@ obj-$(CONFIG_CPU_THERMAL) += cpu_cooling.o obj-$(CONFIG_SPEAR_THERMAL) += spear_thermal.o obj
Re: [PATCH V3 5/5] Thermal: Add ST-Ericsson DB8500 thermal properties and platform data.
On 31 October 2012 10:18, viresh kumar wrote: > On Tue, Oct 30, 2012 at 10:19 PM, hongbo.zhang > wrote: >> From: "hongbo.zhang" > > Just a minor comment below. > >> This patch adds device tree properties for ST-Ericsson DB8500 thermal driver, >> also adds the platform data to support the old fashion. >> >> Signed-off-by: hongbo.zhang > > Reviewed-by: Viresh Kumar > >> --- >> arch/arm/boot/dts/dbx5x0.dtsi | 14 + >> arch/arm/boot/dts/snowball.dts | 31 ++ >> arch/arm/configs/u8500_defconfig | 4 +++ >> arch/arm/mach-ux500/board-mop500.c | 64 >> ++ >> 4 files changed, 113 insertions(+) > >> diff --git a/arch/arm/configs/u8500_defconfig >> b/arch/arm/configs/u8500_defconfig >> index cc5e7a8..34918c4 100644 >> --- a/arch/arm/configs/u8500_defconfig >> +++ b/arch/arm/configs/u8500_defconfig >> @@ -118,3 +118,7 @@ CONFIG_DEBUG_KERNEL=y >> CONFIG_DEBUG_INFO=y >> # CONFIG_FTRACE is not set >> CONFIG_DEBUG_USER=y >> +CONFIG_THERMAL=y >> +CONFIG_CPU_THERMAL=y >> +CONFIG_DB8500_THERMAL=y >> +CONFIG_DB8500_CPUFREQ_COOLING=y > > Have you entered these manually?? Or used make savedefconfig? Yes these are added manually, make savedefconfig should be better, but it seems the original defconfig file are not well generated by savedefconfig, this file will be changed too much if I use make savedefconfig. If this is an issue, I will inform the maintainer to update this. After consideration, for this time, I will use savedefconfig to find right places for my configs, discarding the other dis-order ones. -- 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 5/5] Thermal: Add ST-Ericsson DB8500 thermal properties and platform data.
On 31 October 2012 10:18, viresh kumar viresh.ku...@linaro.org wrote: On Tue, Oct 30, 2012 at 10:19 PM, hongbo.zhang hongbo.zh...@linaro.org wrote: From: hongbo.zhang hongbo.zh...@linaro.com Just a minor comment below. This patch adds device tree properties for ST-Ericsson DB8500 thermal driver, also adds the platform data to support the old fashion. Signed-off-by: hongbo.zhang hongbo.zh...@linaro.com Reviewed-by: Viresh Kumar viresh.ku...@linaro.org --- arch/arm/boot/dts/dbx5x0.dtsi | 14 + arch/arm/boot/dts/snowball.dts | 31 ++ arch/arm/configs/u8500_defconfig | 4 +++ arch/arm/mach-ux500/board-mop500.c | 64 ++ 4 files changed, 113 insertions(+) diff --git a/arch/arm/configs/u8500_defconfig b/arch/arm/configs/u8500_defconfig index cc5e7a8..34918c4 100644 --- a/arch/arm/configs/u8500_defconfig +++ b/arch/arm/configs/u8500_defconfig @@ -118,3 +118,7 @@ CONFIG_DEBUG_KERNEL=y CONFIG_DEBUG_INFO=y # CONFIG_FTRACE is not set CONFIG_DEBUG_USER=y +CONFIG_THERMAL=y +CONFIG_CPU_THERMAL=y +CONFIG_DB8500_THERMAL=y +CONFIG_DB8500_CPUFREQ_COOLING=y Have you entered these manually?? Or used make savedefconfig? Yes these are added manually, make savedefconfig should be better, but it seems the original defconfig file are not well generated by savedefconfig, this file will be changed too much if I use make savedefconfig. If this is an issue, I will inform the maintainer to update this. After consideration, for this time, I will use savedefconfig to find right places for my configs, discarding the other dis-order ones. -- 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 2/6] Thermal: make sure cpufreq cooling register after cpufreq driver
On 29 October 2012 12:42, Amit Kachhap wrote: > On 24 October 2012 17:28, hongbo.zhang wrote: >> From: "hongbo.zhang" >> >> The cpufreq works as a cooling device, so the cooling layer should check if >> the >> cpufreq driver is initialized or not. >> >> Signed-off-by: hongbo.zhang >> --- >> drivers/thermal/cpu_cooling.c | 4 >> 1 file changed, 4 insertions(+) >> >> diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c >> index b6b4c2a..7519a0b 100644 >> --- a/drivers/thermal/cpu_cooling.c >> +++ b/drivers/thermal/cpu_cooling.c >> @@ -354,6 +354,10 @@ struct thermal_cooling_device *cpufreq_cooling_register( >> int ret = 0, i; >> struct cpufreq_policy policy; >> >> + /* make sure cpufreq driver has been initialized */ >> + if (!cpufreq_frequency_get_table(cpumask_any(clip_cpus))) >> + return ERR_PTR(-EPROBE_DEFER); >> + > Hi Hongbo, > > I am not against this change but this might cause unnecessary delay in > probe thread. I also thought about it but have not put this > restriction. Actually you can put a check in platform_bind for this > condition and defer the binding till the time actual throttling > starts. So basically only after throttling cpufreq_table is needed. > (See my implementation exynos_thermal.c). In fact, this piece of checking code was in my db8500_cpufreq_cooling_probe() before, I will move it back there again, and the ST-E's policy is separating cooling devs and thermal zone, so cannot be in binding function on my platform, only in probe function instead. > > Thanks, > Amit Daniel >> list_for_each_entry(cpufreq_dev, _cpufreq_list, node) >> cpufreq_dev_count++; >> >> -- >> 1.7.11.3 >> >> >> ___ >> linaro-dev mailing list >> linaro-...@lists.linaro.org >> http://lists.linaro.org/mailman/listinfo/linaro-dev -- 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] Thermal: Remove the cooling_cpufreq_list.
On 30 October 2012 09:03, Amit Kachhap wrote: > On 26 October 2012 12:39, hongbo.zhang wrote: >> From: "hongbo.zhang" >> >> Problem of using this list is that the cpufreq_get_max_state callback will be >> called when register cooling device by thermal_cooling_device_register, but >> this list isn't ready at this moment. What's more, there is no need to >> maintain >> such a list, we can get cpufreq_cooling_device instance by the private >> thermal_cooling_device.devdata. > > Hi, > > Removing this list seems fine as most of frequency checks are moved > inside generic thermal layer. > Some minor review comments below, > > Reviewed-by: Amit Daniel Kachhap Thanks. >> >> Signed-off-by: hongbo.zhang >> --- >> drivers/thermal/cpu_cooling.c | 91 >> +-- >> 1 file changed, 19 insertions(+), 72 deletions(-) >> >> diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c >> index 415b041..2ffd12c 100644 >> --- a/drivers/thermal/cpu_cooling.c >> +++ b/drivers/thermal/cpu_cooling.c >> @@ -58,8 +58,9 @@ struct cpufreq_cooling_device { >> }; >> static LIST_HEAD(cooling_cpufreq_list); >> static DEFINE_IDR(cpufreq_idr); >> +static DEFINE_MUTEX(cooling_cpufreq_lock); >> >> -static struct mutex cooling_cpufreq_lock; >> +static unsigned int cpufreq_dev_count; >> >> /* notify_table passes value to the CPUFREQ_ADJUST callback function. */ >> #define NOTIFY_INVALID NULL >> @@ -240,28 +241,18 @@ static int cpufreq_thermal_notifier(struct >> notifier_block *nb, >> static int cpufreq_get_max_state(struct thermal_cooling_device *cdev, >> unsigned long *state) >> { >> - int ret = -EINVAL, i = 0; >> - struct cpufreq_cooling_device *cpufreq_device; >> - struct cpumask *maskPtr; >> + struct cpufreq_cooling_device *cpufreq_device = cdev->devdata; > check cdev is not null. >> + struct cpumask *maskPtr = _device->allowed_cpus; >> unsigned int cpu; >> struct cpufreq_frequency_table *table; >> unsigned long count = 0; >> + int i = 0; >> >> - mutex_lock(_cpufreq_lock); >> - list_for_each_entry(cpufreq_device, _cpufreq_list, node) { >> - if (cpufreq_device && cpufreq_device->cool_dev == cdev) >> - break; >> - } >> - if (cpufreq_device == NULL) >> - goto return_get_max_state; >> - >> - maskPtr = _device->allowed_cpus; >> cpu = cpumask_any(maskPtr); >> table = cpufreq_frequency_get_table(cpu); >> if (!table) { >> *state = 0; >> - ret = 0; >> - goto return_get_max_state; >> + return 0; >> } >> >> for (i = 0; (table[i].frequency != CPUFREQ_TABLE_END); i++) { >> @@ -272,12 +263,10 @@ static int cpufreq_get_max_state(struct >> thermal_cooling_device *cdev, >> >> if (count > 0) { >> *state = --count; >> - ret = 0; >> + return 0; >> } >> >> -return_get_max_state: >> - mutex_unlock(_cpufreq_lock); >> - return ret; >> + return -EINVAL; >> } >> >> /** >> @@ -288,20 +277,10 @@ return_get_max_state: >> static int cpufreq_get_cur_state(struct thermal_cooling_device *cdev, >> unsigned long *state) >> { >> - int ret = -EINVAL; >> - struct cpufreq_cooling_device *cpufreq_device; >> + struct cpufreq_cooling_device *cpufreq_device = cdev->devdata; >> >> - mutex_lock(_cpufreq_lock); >> - list_for_each_entry(cpufreq_device, _cpufreq_list, node) { >> - if (cpufreq_device && cpufreq_device->cool_dev == cdev) { >> - *state = cpufreq_device->cpufreq_state; >> - ret = 0; >> - break; >> - } >> - } >> - mutex_unlock(_cpufreq_lock); >> - >> - return ret; >> + *state = cpufreq_device->cpufreq_state; >> + return 0; >> } >> >> /** >> @@ -312,22 +291,9 @@ static int cpufreq_get_cur_state(struct >> thermal_cooling_device *cdev, >> static int cpufreq_set_cur_state(struct thermal_cooling_device *cdev, >> unsigned long state) >> { >> - int ret = -EINVAL; >> - struct cpufreq_cooling_device *cpufreq_device; >> + struct cpufreq_cooling_device *cpufreq_device = cdev->devdata; > check cdev is not null Such values are used in all the three static cpufreq_***_state callback functions, when these functions are called, cdev->devdata should have been set in the registration function, and cannot be null, no body can call these function before registration, so I think there is no need to add such a check here. >> >> - mutex_lock(_cpufreq_lock); >> - list_for_each_entry(cpufreq_device, _cpufreq_list, node) { >> - if (cpufreq_device && cpufreq_device->cool_dev == cdev) { >> - ret = 0; >>
Re: [PATCH V2 4/6] Thermal: Remove the cooling_cpufreq_list.
On 30 October 2012 09:03, Amit Kachhap amit.kach...@linaro.org wrote: On 26 October 2012 12:39, hongbo.zhang hongbo.zh...@linaro.org wrote: From: hongbo.zhang hongbo.zh...@linaro.com Problem of using this list is that the cpufreq_get_max_state callback will be called when register cooling device by thermal_cooling_device_register, but this list isn't ready at this moment. What's more, there is no need to maintain such a list, we can get cpufreq_cooling_device instance by the private thermal_cooling_device.devdata. Hi, Removing this list seems fine as most of frequency checks are moved inside generic thermal layer. Some minor review comments below, Reviewed-by: Amit Daniel Kachhap amit.kach...@linaro.org Thanks. Signed-off-by: hongbo.zhang hongbo.zh...@linaro.com --- drivers/thermal/cpu_cooling.c | 91 +-- 1 file changed, 19 insertions(+), 72 deletions(-) diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c index 415b041..2ffd12c 100644 --- a/drivers/thermal/cpu_cooling.c +++ b/drivers/thermal/cpu_cooling.c @@ -58,8 +58,9 @@ struct cpufreq_cooling_device { }; static LIST_HEAD(cooling_cpufreq_list); static DEFINE_IDR(cpufreq_idr); +static DEFINE_MUTEX(cooling_cpufreq_lock); -static struct mutex cooling_cpufreq_lock; +static unsigned int cpufreq_dev_count; /* notify_table passes value to the CPUFREQ_ADJUST callback function. */ #define NOTIFY_INVALID NULL @@ -240,28 +241,18 @@ static int cpufreq_thermal_notifier(struct notifier_block *nb, static int cpufreq_get_max_state(struct thermal_cooling_device *cdev, unsigned long *state) { - int ret = -EINVAL, i = 0; - struct cpufreq_cooling_device *cpufreq_device; - struct cpumask *maskPtr; + struct cpufreq_cooling_device *cpufreq_device = cdev-devdata; check cdev is not null. + struct cpumask *maskPtr = cpufreq_device-allowed_cpus; unsigned int cpu; struct cpufreq_frequency_table *table; unsigned long count = 0; + int i = 0; - mutex_lock(cooling_cpufreq_lock); - list_for_each_entry(cpufreq_device, cooling_cpufreq_list, node) { - if (cpufreq_device cpufreq_device-cool_dev == cdev) - break; - } - if (cpufreq_device == NULL) - goto return_get_max_state; - - maskPtr = cpufreq_device-allowed_cpus; cpu = cpumask_any(maskPtr); table = cpufreq_frequency_get_table(cpu); if (!table) { *state = 0; - ret = 0; - goto return_get_max_state; + return 0; } for (i = 0; (table[i].frequency != CPUFREQ_TABLE_END); i++) { @@ -272,12 +263,10 @@ static int cpufreq_get_max_state(struct thermal_cooling_device *cdev, if (count 0) { *state = --count; - ret = 0; + return 0; } -return_get_max_state: - mutex_unlock(cooling_cpufreq_lock); - return ret; + return -EINVAL; } /** @@ -288,20 +277,10 @@ return_get_max_state: static int cpufreq_get_cur_state(struct thermal_cooling_device *cdev, unsigned long *state) { - int ret = -EINVAL; - struct cpufreq_cooling_device *cpufreq_device; + struct cpufreq_cooling_device *cpufreq_device = cdev-devdata; - mutex_lock(cooling_cpufreq_lock); - list_for_each_entry(cpufreq_device, cooling_cpufreq_list, node) { - if (cpufreq_device cpufreq_device-cool_dev == cdev) { - *state = cpufreq_device-cpufreq_state; - ret = 0; - break; - } - } - mutex_unlock(cooling_cpufreq_lock); - - return ret; + *state = cpufreq_device-cpufreq_state; + return 0; } /** @@ -312,22 +291,9 @@ static int cpufreq_get_cur_state(struct thermal_cooling_device *cdev, static int cpufreq_set_cur_state(struct thermal_cooling_device *cdev, unsigned long state) { - int ret = -EINVAL; - struct cpufreq_cooling_device *cpufreq_device; + struct cpufreq_cooling_device *cpufreq_device = cdev-devdata; check cdev is not null Such values are used in all the three static cpufreq_***_state callback functions, when these functions are called, cdev-devdata should have been set in the registration function, and cannot be null, no body can call these function before registration, so I think there is no need to add such a check here. - mutex_lock(cooling_cpufreq_lock); - list_for_each_entry(cpufreq_device, cooling_cpufreq_list, node) { - if (cpufreq_device cpufreq_device-cool_dev == cdev) { - ret = 0; - break; - } - } - if (!ret)
Re: [PATCH V2 2/6] Thermal: make sure cpufreq cooling register after cpufreq driver
On 29 October 2012 12:42, Amit Kachhap amit.kach...@linaro.org wrote: On 24 October 2012 17:28, hongbo.zhang hongbo.zh...@linaro.org wrote: From: hongbo.zhang hongbo.zh...@linaro.com The cpufreq works as a cooling device, so the cooling layer should check if the cpufreq driver is initialized or not. Signed-off-by: hongbo.zhang hongbo.zh...@linaro.com --- drivers/thermal/cpu_cooling.c | 4 1 file changed, 4 insertions(+) diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c index b6b4c2a..7519a0b 100644 --- a/drivers/thermal/cpu_cooling.c +++ b/drivers/thermal/cpu_cooling.c @@ -354,6 +354,10 @@ struct thermal_cooling_device *cpufreq_cooling_register( int ret = 0, i; struct cpufreq_policy policy; + /* make sure cpufreq driver has been initialized */ + if (!cpufreq_frequency_get_table(cpumask_any(clip_cpus))) + return ERR_PTR(-EPROBE_DEFER); + Hi Hongbo, I am not against this change but this might cause unnecessary delay in probe thread. I also thought about it but have not put this restriction. Actually you can put a check in platform_bind for this condition and defer the binding till the time actual throttling starts. So basically only after throttling cpufreq_table is needed. (See my implementation exynos_thermal.c). In fact, this piece of checking code was in my db8500_cpufreq_cooling_probe() before, I will move it back there again, and the ST-E's policy is separating cooling devs and thermal zone, so cannot be in binding function on my platform, only in probe function instead. Thanks, Amit Daniel list_for_each_entry(cpufreq_dev, cooling_cpufreq_list, node) cpufreq_dev_count++; -- 1.7.11.3 ___ linaro-dev mailing list linaro-...@lists.linaro.org http://lists.linaro.org/mailman/listinfo/linaro-dev -- 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/