diff mbox

[PATCHv3,1/2] drm/omap: use regmap_update_bit() when muxing DSI pads

Message ID 1502368185-15386-1-git-send-email-tomi.valkeinen@ti.com (mailing list archive)
State New, archived
Headers show

Commit Message

Tomi Valkeinen Aug. 10, 2017, 12:29 p.m. UTC
Use regmap_update_bits instead of regmap_read/write, which simplifies
the code.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/dss/dsi.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

Comments

Laurent Pinchart Aug. 10, 2017, 1:22 p.m. UTC | #1
Hi Tomi,

Thank you for the patch.

On Thursday 10 Aug 2017 15:29:44 Tomi Valkeinen wrote:
> Use regmap_update_bits instead of regmap_read/write, which simplifies
> the code.
> 
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  drivers/gpu/drm/omapdrm/dss/dsi.c | 15 +++------------
>  1 file changed, 3 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c
> b/drivers/gpu/drm/omapdrm/dss/dsi.c index a66d2b1a6c74..1855d69b211d 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -2107,7 +2107,6 @@ static int dsi_omap4_mux_pads(struct dsi_data *dsi,
> unsigned int lanes) {
>  	u32 enable_mask, enable_shift;
>  	u32 pipd_mask, pipd_shift;
> -	u32 reg;
> 
>  	if (!dsi->syscon)
>  		return 0;
> @@ -2126,17 +2125,9 @@ static int dsi_omap4_mux_pads(struct dsi_data *dsi,
> unsigned int lanes) return -ENODEV;
>  	}
> 
> -	regmap_read(dsi->syscon, OMAP4_DSIPHY_SYSCON_OFFSET, &reg);
> -
> -	reg &= ~enable_mask;
> -	reg &= ~pipd_mask;
> -
> -	reg |= (lanes << enable_shift) & enable_mask;
> -	reg |= (lanes << pipd_shift) & pipd_mask;
> -
> -	regmap_write(dsi->syscon, OMAP4_DSIPHY_SYSCON_OFFSET, reg);
> -
> -	return 0;
> +	return regmap_update_bits(dsi->syscon, OMAP4_DSIPHY_SYSCON_OFFSET,
> +		enable_mask | pipd_mask,
> +		(lanes << enable_shift) | (lanes << pipd_shift));
>  }
> 
>  static int dsi_enable_pads(struct dsi_data *dsi, unsigned int lane_mask)
diff mbox

Patch

diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
index a66d2b1a6c74..1855d69b211d 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -2107,7 +2107,6 @@  static int dsi_omap4_mux_pads(struct dsi_data *dsi, unsigned int lanes)
 {
 	u32 enable_mask, enable_shift;
 	u32 pipd_mask, pipd_shift;
-	u32 reg;
 
 	if (!dsi->syscon)
 		return 0;
@@ -2126,17 +2125,9 @@  static int dsi_omap4_mux_pads(struct dsi_data *dsi, unsigned int lanes)
 		return -ENODEV;
 	}
 
-	regmap_read(dsi->syscon, OMAP4_DSIPHY_SYSCON_OFFSET, &reg);
-
-	reg &= ~enable_mask;
-	reg &= ~pipd_mask;
-
-	reg |= (lanes << enable_shift) & enable_mask;
-	reg |= (lanes << pipd_shift) & pipd_mask;
-
-	regmap_write(dsi->syscon, OMAP4_DSIPHY_SYSCON_OFFSET, reg);
-
-	return 0;
+	return regmap_update_bits(dsi->syscon, OMAP4_DSIPHY_SYSCON_OFFSET,
+		enable_mask | pipd_mask,
+		(lanes << enable_shift) | (lanes << pipd_shift));
 }
 
 static int dsi_enable_pads(struct dsi_data *dsi, unsigned int lane_mask)