]> git.karo-electronics.de Git - linux-beck.git/commitdiff
gpu: ipu-v3: Add ipu_get_num()
authorSteve Longerbeam <slongerbeam@gmail.com>
Wed, 20 Jul 2016 01:11:02 +0000 (18:11 -0700)
committerPhilipp Zabel <p.zabel@pengutronix.de>
Mon, 8 Aug 2016 09:44:20 +0000 (11:44 +0200)
Adds of-alias id to ipu_soc and retrieve with ipu_get_num().

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
drivers/gpu/ipu-v3/ipu-common.c
drivers/gpu/ipu-v3/ipu-prv.h
include/video/imx-ipu-v3.h

index 99dcacf05b9986f97c44dbb1b962d47db85bf818..d697cd505289568b3f040878a1465379ff2de8c3 100644 (file)
@@ -45,6 +45,12 @@ static inline void ipu_cm_write(struct ipu_soc *ipu, u32 value, unsigned offset)
        writel(value, ipu->cm_reg + offset);
 }
 
+int ipu_get_num(struct ipu_soc *ipu)
+{
+       return ipu->id;
+}
+EXPORT_SYMBOL_GPL(ipu_get_num);
+
 void ipu_srm_dp_sync_update(struct ipu_soc *ipu)
 {
        u32 val;
@@ -1209,6 +1215,7 @@ static int ipu_probe(struct platform_device *pdev)
 {
        const struct of_device_id *of_id =
                        of_match_device(imx_ipu_dt_ids, &pdev->dev);
+       struct device_node *np = pdev->dev.of_node;
        struct ipu_soc *ipu;
        struct resource *res;
        unsigned long ipu_base;
@@ -1237,6 +1244,7 @@ static int ipu_probe(struct platform_device *pdev)
                ipu->channel[i].ipu = ipu;
        ipu->devtype = devtype;
        ipu->ipu_type = devtype->type;
+       ipu->id = of_alias_get_id(np, "ipu");
 
        spin_lock_init(&ipu->lock);
        mutex_init(&ipu->channel_lock);
index bfb1e8a4483fdbf7afbcc15311b90e3be986ffb1..fd47f8f555cde285bf62b60633fa5f9775c01786 100644 (file)
@@ -152,6 +152,7 @@ struct ipu_soc {
        void __iomem            *cm_reg;
        void __iomem            *idmac_reg;
 
+       int                     id;
        int                     usecount;
 
        struct clk              *clk;
index 8c4312ddc46cabd488ca70b5e6e9a80473ff35b0..ef54634652e9eda72a2b288ad225e95f2343d748 100644 (file)
@@ -138,6 +138,7 @@ int ipu_idmac_channel_irq(struct ipu_soc *ipu, struct ipuv3_channel *channel,
 /*
  * IPU Common functions
  */
+int ipu_get_num(struct ipu_soc *ipu);
 void ipu_set_csi_src_mux(struct ipu_soc *ipu, int csi_id, bool mipi_csi2);
 void ipu_set_ic_src_mux(struct ipu_soc *ipu, int csi_id, bool vdi);
 void ipu_dump(struct ipu_soc *ipu);