All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mfd: intel_soc_pmic_bxtwc: add bxt_wcove_usbc device
@ 2016-07-21  0:33 Bin Gao
  2016-08-09 15:06 ` Lee Jones
  0 siblings, 1 reply; 2+ messages in thread
From: Bin Gao @ 2016-07-21  0:33 UTC (permalink / raw)
  To: Lee Jones; +Cc: Bin Gao, Chandra Sekhar Anagani, linux-kernel

The Intel Whiskey Cove PMIC includes several function units, e.g.
ADC, thermal, USB Type-C, GPIO, etc. The corresponding device has
to be created in the mfd driver(intel_soc_pmic_bxtwc.c). This change
adds the USB Type-c device.

Signed-off-by: Bin Gao <bin.gao@intel.com>
---
 drivers/mfd/intel_soc_pmic_bxtwc.c | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/drivers/mfd/intel_soc_pmic_bxtwc.c b/drivers/mfd/intel_soc_pmic_bxtwc.c
index b942876..43e54b7 100644
--- a/drivers/mfd/intel_soc_pmic_bxtwc.c
+++ b/drivers/mfd/intel_soc_pmic_bxtwc.c
@@ -47,6 +47,8 @@
 #define BXTWC_MIRQLVL1		0x4E0E
 #define BXTWC_MPWRTNIRQ		0x4E0F
 
+#define BXTWC_MIRQLVL1_MCHGR	BIT(5)
+
 #define BXTWC_MTHRM0IRQ		0x4E12
 #define BXTWC_MTHRM1IRQ		0x4E13
 #define BXTWC_MTHRM2IRQ		0x4E14
@@ -109,7 +111,7 @@ static const struct regmap_irq bxtwc_regmap_irqs_level2[] = {
 	REGMAP_IRQ_REG(BXTWC_THRM2_IRQ, 2, 0xff),
 	REGMAP_IRQ_REG(BXTWC_BCU_IRQ, 3, 0x1f),
 	REGMAP_IRQ_REG(BXTWC_ADC_IRQ, 4, 0xff),
-	REGMAP_IRQ_REG(BXTWC_CHGR0_IRQ, 5, 0x1f),
+	REGMAP_IRQ_REG(BXTWC_CHGR0_IRQ, 5, 0x3f),
 	REGMAP_IRQ_REG(BXTWC_CHGR1_IRQ, 6, 0x1f),
 	REGMAP_IRQ_REG(BXTWC_GPIO0_IRQ, 7, 0xff),
 	REGMAP_IRQ_REG(BXTWC_GPIO1_IRQ, 8, 0x3f),
@@ -143,6 +145,10 @@ static struct resource adc_resources[] = {
 	DEFINE_RES_IRQ_NAMED(BXTWC_ADC_IRQ, "ADC"),
 };
 
+static struct resource usbc_resources[] = {
+	DEFINE_RES_IRQ_NAMED(BXTWC_CHGR0_IRQ, "USBC"),
+};
+
 static struct resource charger_resources[] = {
 	DEFINE_RES_IRQ_NAMED(BXTWC_CHGR0_IRQ, "CHARGER"),
 	DEFINE_RES_IRQ_NAMED(BXTWC_CHGR1_IRQ, "CHARGER1"),
@@ -170,6 +176,11 @@ static struct mfd_cell bxt_wc_dev[] = {
 		.resources = thermal_resources,
 	},
 	{
+		.name = "bxt_wcove_usbc",
+		.num_resources = ARRAY_SIZE(usbc_resources),
+		.resources = usbc_resources,
+	},
+	{
 		.name = "bxt_wcove_ext_charger",
 		.num_resources = ARRAY_SIZE(charger_resources),
 		.resources = charger_resources,
@@ -403,6 +414,16 @@ static int bxtwc_probe(struct platform_device *pdev)
 		goto err_sysfs;
 	}
 
+	/*
+	 * There is known hw bug. Upon reset BIT 5 of register
+	 * BXTWC_CHGR_LVL1_IRQ is 0 which is the expected value. However,
+	 * later it's set to 1(masked) automatically by hardware. So we
+	 * have the software workaround here to unmaksed it in order to let
+	 * charger interrutp work.
+	 */
+	regmap_update_bits(pmic->regmap, BXTWC_MIRQLVL1,
+				BXTWC_MIRQLVL1_MCHGR, 0);
+
 	return 0;
 
 err_sysfs:
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] mfd: intel_soc_pmic_bxtwc: add bxt_wcove_usbc device
  2016-07-21  0:33 [PATCH] mfd: intel_soc_pmic_bxtwc: add bxt_wcove_usbc device Bin Gao
@ 2016-08-09 15:06 ` Lee Jones
  0 siblings, 0 replies; 2+ messages in thread
From: Lee Jones @ 2016-08-09 15:06 UTC (permalink / raw)
  To: Bin Gao; +Cc: Bin Gao, Chandra Sekhar Anagani, linux-kernel

On Wed, 20 Jul 2016, Bin Gao wrote:

> The Intel Whiskey Cove PMIC includes several function units, e.g.
> ADC, thermal, USB Type-C, GPIO, etc. The corresponding device has
> to be created in the mfd driver(intel_soc_pmic_bxtwc.c). This change
> adds the USB Type-c device.
> 
> Signed-off-by: Bin Gao <bin.gao@intel.com>
> ---
>  drivers/mfd/intel_soc_pmic_bxtwc.c | 23 ++++++++++++++++++++++-
>  1 file changed, 22 insertions(+), 1 deletion(-)

Applied, thanks.

> diff --git a/drivers/mfd/intel_soc_pmic_bxtwc.c b/drivers/mfd/intel_soc_pmic_bxtwc.c
> index b942876..43e54b7 100644
> --- a/drivers/mfd/intel_soc_pmic_bxtwc.c
> +++ b/drivers/mfd/intel_soc_pmic_bxtwc.c
> @@ -47,6 +47,8 @@
>  #define BXTWC_MIRQLVL1		0x4E0E
>  #define BXTWC_MPWRTNIRQ		0x4E0F
>  
> +#define BXTWC_MIRQLVL1_MCHGR	BIT(5)
> +
>  #define BXTWC_MTHRM0IRQ		0x4E12
>  #define BXTWC_MTHRM1IRQ		0x4E13
>  #define BXTWC_MTHRM2IRQ		0x4E14
> @@ -109,7 +111,7 @@ static const struct regmap_irq bxtwc_regmap_irqs_level2[] = {
>  	REGMAP_IRQ_REG(BXTWC_THRM2_IRQ, 2, 0xff),
>  	REGMAP_IRQ_REG(BXTWC_BCU_IRQ, 3, 0x1f),
>  	REGMAP_IRQ_REG(BXTWC_ADC_IRQ, 4, 0xff),
> -	REGMAP_IRQ_REG(BXTWC_CHGR0_IRQ, 5, 0x1f),
> +	REGMAP_IRQ_REG(BXTWC_CHGR0_IRQ, 5, 0x3f),
>  	REGMAP_IRQ_REG(BXTWC_CHGR1_IRQ, 6, 0x1f),
>  	REGMAP_IRQ_REG(BXTWC_GPIO0_IRQ, 7, 0xff),
>  	REGMAP_IRQ_REG(BXTWC_GPIO1_IRQ, 8, 0x3f),
> @@ -143,6 +145,10 @@ static struct resource adc_resources[] = {
>  	DEFINE_RES_IRQ_NAMED(BXTWC_ADC_IRQ, "ADC"),
>  };
>  
> +static struct resource usbc_resources[] = {
> +	DEFINE_RES_IRQ_NAMED(BXTWC_CHGR0_IRQ, "USBC"),
> +};
> +
>  static struct resource charger_resources[] = {
>  	DEFINE_RES_IRQ_NAMED(BXTWC_CHGR0_IRQ, "CHARGER"),
>  	DEFINE_RES_IRQ_NAMED(BXTWC_CHGR1_IRQ, "CHARGER1"),
> @@ -170,6 +176,11 @@ static struct mfd_cell bxt_wc_dev[] = {
>  		.resources = thermal_resources,
>  	},
>  	{
> +		.name = "bxt_wcove_usbc",
> +		.num_resources = ARRAY_SIZE(usbc_resources),
> +		.resources = usbc_resources,
> +	},
> +	{
>  		.name = "bxt_wcove_ext_charger",
>  		.num_resources = ARRAY_SIZE(charger_resources),
>  		.resources = charger_resources,
> @@ -403,6 +414,16 @@ static int bxtwc_probe(struct platform_device *pdev)
>  		goto err_sysfs;
>  	}
>  
> +	/*
> +	 * There is known hw bug. Upon reset BIT 5 of register
> +	 * BXTWC_CHGR_LVL1_IRQ is 0 which is the expected value. However,
> +	 * later it's set to 1(masked) automatically by hardware. So we
> +	 * have the software workaround here to unmaksed it in order to let
> +	 * charger interrutp work.
> +	 */
> +	regmap_update_bits(pmic->regmap, BXTWC_MIRQLVL1,
> +				BXTWC_MIRQLVL1_MCHGR, 0);
> +
>  	return 0;
>  
>  err_sysfs:

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-08-09 15:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-21  0:33 [PATCH] mfd: intel_soc_pmic_bxtwc: add bxt_wcove_usbc device Bin Gao
2016-08-09 15:06 ` Lee Jones

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.