Message ID | 20210127144930.2158242-1-robert.foss@linaro.org |
---|---|
Headers | show |
Series | Add support for the SDM845 Camera Subsystem | expand |
On Wed, Jan 27, 2021 at 10:56 PM Robert Foss <robert.foss@linaro.org> wrote: > > In order to support Qualcomm ISP hardware architectures that diverge > from older architectures, the VFE subdevice driver needs to be refactored > to better abstract the different ISP architectures. > > Gen1 represents the CAMSS ISP architecture. The ISP architecture developed > after CAMSS, Titan, will be referred to as Gen2. > > Signed-off-by: Robert Foss <robert.foss@linaro.org> > --- > [snip] > diff --git a/drivers/media/platform/qcom/camss/camss-vfe-4-8.c b/drivers/media/platform/qcom/camss/camss-vfe-4-8.c > new file mode 100644 > index 000000000000..153e0e20664e > --- /dev/null > +++ b/drivers/media/platform/qcom/camss/camss-vfe-4-8.c > [snip] > +/* > + * vfe_isr - VFE module interrupt handler > + * @irq: Interrupt line > + * @dev: VFE device > + * > + * Return IRQ_HANDLED on success > + */ > +static irqreturn_t vfe_isr(int irq, void *dev) > +{ > + struct vfe_device *vfe = dev; > + u32 value0, value1; > + int i, j; > + > + vfe->ops->isr_read(vfe, &value0, &value1); > + > + trace_printk("VFE: status0 = 0x%08x, status1 = 0x%08x\n", > + value0, value1); Please do not use trace_printk in production code [1,2], it is only meant for debug use. Consider using trace events, or dev_dbg. [1] https://elixir.bootlin.com/linux/v5.8/source/kernel/trace/trace.c#L3158 [2] https://elixir.bootlin.com/linux/v5.8/source/include/linux/kernel.h#L766 > [snip]
Hey Nicolas, Thanks for the review! On Thu, 28 Jan 2021 at 01:19, Nicolas Boichat <drinkcat@chromium.org> wrote: > > On Wed, Jan 27, 2021 at 10:56 PM Robert Foss <robert.foss@linaro.org> wrote: > > > > In order to support Qualcomm ISP hardware architectures that diverge > > from older architectures, the VFE subdevice driver needs to be refactored > > to better abstract the different ISP architectures. > > > > Gen1 represents the CAMSS ISP architecture. The ISP architecture developed > > after CAMSS, Titan, will be referred to as Gen2. > > > > Signed-off-by: Robert Foss <robert.foss@linaro.org> > > --- > > [snip] > > diff --git a/drivers/media/platform/qcom/camss/camss-vfe-4-8.c b/drivers/media/platform/qcom/camss/camss-vfe-4-8.c > > new file mode 100644 > > index 000000000000..153e0e20664e > > --- /dev/null > > +++ b/drivers/media/platform/qcom/camss/camss-vfe-4-8.c > > [snip] > > +/* > > + * vfe_isr - VFE module interrupt handler > > + * @irq: Interrupt line > > + * @dev: VFE device > > + * > > + * Return IRQ_HANDLED on success > > + */ > > +static irqreturn_t vfe_isr(int irq, void *dev) > > +{ > > + struct vfe_device *vfe = dev; > > + u32 value0, value1; > > + int i, j; > > + > > + vfe->ops->isr_read(vfe, &value0, &value1); > > + > > + trace_printk("VFE: status0 = 0x%08x, status1 = 0x%08x\n", > > + value0, value1); > > Please do not use trace_printk in production code [1,2], it is only > meant for debug use. Consider using trace events, or dev_dbg. Ack, this is a copy paste error, I'll add a commit fixing all occurrences of this in the driver > > [1] https://elixir.bootlin.com/linux/v5.8/source/kernel/trace/trace.c#L3158 > [2] https://elixir.bootlin.com/linux/v5.8/source/include/linux/kernel.h#L766 > > > [snip]
Hi Robert, On Wed, Jan 27, 2021 at 03:49:18PM +0100, Robert Foss wrote: > Add register definitions for version 170 of the Titan architecture > and implement support for the CSIPHY subdevice. > > Signed-off-by: Robert Foss <robert.foss@linaro.org> > --- > .../qcom/camss/camss-csiphy-3ph-1-0.c | 182 ++++++++++++++++-- > .../media/platform/qcom/camss/camss-csiphy.c | 66 +++++-- > drivers/media/platform/qcom/camss/camss.c | 74 +++++++ > 3 files changed, 290 insertions(+), 32 deletions(-) > > diff --git a/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c b/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c > index 97cb9de85031..8cf1440b7d70 100644 > --- a/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c > +++ b/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c > @@ -47,6 +47,105 @@ > #define CSIPHY_3PH_CMN_CSI_COMMON_CTRL6_SHOW_REV_ID BIT(1) > #define CSIPHY_3PH_CMN_CSI_COMMON_STATUSn(n) (0x8b0 + 0x4 * (n)) > > +#define CSIPHY_DEFAULT_PARAMS 0 > +#define CSIPHY_LANE_ENABLE 1 > +#define CSIPHY_SETTLE_CNT_LOWER_BYTE 2 > +#define CSIPHY_SETTLE_CNT_HIGHER_BYTE 3 > +#define CSIPHY_DNP_PARAMS 4 > +#define CSIPHY_2PH_REGS 5 > +#define CSIPHY_3PH_REGS 6 > + > +struct csiphy_reg_t { > + int32_t reg_addr; > + int32_t reg_data; > + int32_t delay; > + uint32_t csiphy_param_type; > +}; > + > +static struct This should be const. > +csiphy_reg_t lane_regs_sdm845[5][14] = { > + { > + {0x0004, 0x0C, 0x00, CSIPHY_DEFAULT_PARAMS}, > + {0x002C, 0x01, 0x00, CSIPHY_DEFAULT_PARAMS}, > + {0x0034, 0x0F, 0x00, CSIPHY_DEFAULT_PARAMS}, > + {0x001C, 0x0A, 0x00, CSIPHY_DEFAULT_PARAMS}, > + {0x0014, 0x60, 0x00, CSIPHY_DEFAULT_PARAMS}, > + {0x0028, 0x00, 0x00, CSIPHY_DNP_PARAMS}, > + {0x003C, 0xB8, 0x00, CSIPHY_DEFAULT_PARAMS}, > + {0x0000, 0x91, 0x00, CSIPHY_DEFAULT_PARAMS}, > + {0x0008, 0x00, 0x00, CSIPHY_SETTLE_CNT_LOWER_BYTE}, > + {0x000c, 0x00, 0x00, CSIPHY_DNP_PARAMS}, > + {0x0010, 0x52, 0x00, CSIPHY_DEFAULT_PARAMS}, > + {0x0038, 0xFE, 0x00, CSIPHY_DEFAULT_PARAMS}, > + {0x0060, 0x00, 0x00, CSIPHY_DEFAULT_PARAMS}, > + {0x0064, 0x7F, 0x00, CSIPHY_DEFAULT_PARAMS}, > + }, > + { > + {0x0704, 0x0C, 0x00, CSIPHY_DEFAULT_PARAMS}, > + {0x072C, 0x01, 0x00, CSIPHY_DEFAULT_PARAMS}, > + {0x0734, 0x0F, 0x00, CSIPHY_DEFAULT_PARAMS}, > + {0x071C, 0x0A, 0x00, CSIPHY_DEFAULT_PARAMS}, > + {0x0714, 0x60, 0x00, CSIPHY_DEFAULT_PARAMS}, > + {0x0728, 0x04, 0x00, CSIPHY_DEFAULT_PARAMS}, > + {0x073C, 0xB8, 0x00, CSIPHY_DEFAULT_PARAMS}, > + {0x0700, 0x80, 0x00, CSIPHY_DEFAULT_PARAMS}, > + {0x0708, 0x14, 0x00, CSIPHY_SETTLE_CNT_LOWER_BYTE}, > + {0x070C, 0xA5, 0x00, CSIPHY_DEFAULT_PARAMS}, > + {0x0710, 0x52, 0x00, CSIPHY_DEFAULT_PARAMS}, > + {0x0738, 0x1F, 0x00, CSIPHY_DEFAULT_PARAMS}, > + {0x0760, 0x00, 0x00, CSIPHY_DEFAULT_PARAMS}, > + {0x0764, 0x7F, 0x00, CSIPHY_DEFAULT_PARAMS}, > + }, > + { > + {0x0204, 0x0C, 0x00, CSIPHY_DEFAULT_PARAMS}, > + {0x022C, 0x01, 0x00, CSIPHY_DEFAULT_PARAMS}, > + {0x0234, 0x0F, 0x00, CSIPHY_DEFAULT_PARAMS}, > + {0x021C, 0x0A, 0x00, CSIPHY_DEFAULT_PARAMS}, > + {0x0214, 0x60, 0x00, CSIPHY_DEFAULT_PARAMS}, > + {0x0228, 0x00, 0x00, CSIPHY_DNP_PARAMS}, > + {0x023C, 0xB8, 0x00, CSIPHY_DEFAULT_PARAMS}, > + {0x0200, 0x91, 0x00, CSIPHY_DEFAULT_PARAMS}, > + {0x0208, 0x00, 0x00, CSIPHY_SETTLE_CNT_LOWER_BYTE}, > + {0x020C, 0x00, 0x00, CSIPHY_DNP_PARAMS}, > + {0x0210, 0x52, 0x00, CSIPHY_DEFAULT_PARAMS}, > + {0x0238, 0xFE, 0x00, CSIPHY_DEFAULT_PARAMS}, > + {0x0260, 0x00, 0x00, CSIPHY_DEFAULT_PARAMS}, > + {0x0264, 0x7F, 0x00, CSIPHY_DEFAULT_PARAMS}, > + }, > + { > + {0x0404, 0x0C, 0x00, CSIPHY_DEFAULT_PARAMS}, > + {0x042C, 0x01, 0x00, CSIPHY_DEFAULT_PARAMS}, > + {0x0434, 0x0F, 0x00, CSIPHY_DEFAULT_PARAMS}, > + {0x041C, 0x0A, 0x00, CSIPHY_DEFAULT_PARAMS}, > + {0x0414, 0x60, 0x00, CSIPHY_DEFAULT_PARAMS}, > + {0x0428, 0x00, 0x00, CSIPHY_DNP_PARAMS}, > + {0x043C, 0xB8, 0x00, CSIPHY_DEFAULT_PARAMS}, > + {0x0400, 0x91, 0x00, CSIPHY_DEFAULT_PARAMS}, > + {0x0408, 0x00, 0x00, CSIPHY_SETTLE_CNT_LOWER_BYTE}, > + {0x040C, 0x00, 0x00, CSIPHY_DNP_PARAMS}, > + {0x0410, 0x52, 0x00, CSIPHY_DEFAULT_PARAMS}, > + {0x0438, 0xFE, 0x00, CSIPHY_DEFAULT_PARAMS}, > + {0x0460, 0x00, 0x00, CSIPHY_DEFAULT_PARAMS}, > + {0x0464, 0x7F, 0x00, CSIPHY_DEFAULT_PARAMS}, > + }, > + { > + {0x0604, 0x0C, 0x00, CSIPHY_DEFAULT_PARAMS}, > + {0x062C, 0x01, 0x00, CSIPHY_DEFAULT_PARAMS}, > + {0x0634, 0x0F, 0x00, CSIPHY_DEFAULT_PARAMS}, > + {0x061C, 0x0A, 0x00, CSIPHY_DEFAULT_PARAMS}, > + {0x0614, 0x60, 0x00, CSIPHY_DEFAULT_PARAMS}, > + {0x0628, 0x00, 0x00, CSIPHY_DNP_PARAMS}, > + {0x063C, 0xB8, 0x00, CSIPHY_DEFAULT_PARAMS}, > + {0x0600, 0x91, 0x00, CSIPHY_DEFAULT_PARAMS}, > + {0x0608, 0x00, 0x00, CSIPHY_SETTLE_CNT_LOWER_BYTE}, > + {0x060C, 0x00, 0x00, CSIPHY_DNP_PARAMS}, > + {0x0610, 0x52, 0x00, CSIPHY_DEFAULT_PARAMS}, > + {0x0638, 0xFE, 0x00, CSIPHY_DEFAULT_PARAMS}, > + {0x0660, 0x00, 0x00, CSIPHY_DEFAULT_PARAMS}, > + {0x0664, 0x7F, 0x00, CSIPHY_DEFAULT_PARAMS}, > + }, > +};
On Wed 27 Jan 08:49 CST 2021, Robert Foss wrote: > Build camera ISP driver as a module. > Isn't this enabled since b47c5fc15d88 ("arm64: defconfig: Enable Qualcomm CAMCC, CAMSS and CCI drivers")? Regards, Bjorn > Signed-off-by: Robert Foss <robert.foss@linaro.org> > --- > arch/arm64/configs/defconfig | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig > index 838301650a79..cb224d2af6a0 100644 > --- a/arch/arm64/configs/defconfig > +++ b/arch/arm64/configs/defconfig > @@ -640,6 +640,7 @@ CONFIG_VIDEO_RENESAS_FDP1=m > CONFIG_VIDEO_RENESAS_FCP=m > CONFIG_VIDEO_RENESAS_VSP1=m > CONFIG_SDR_PLATFORM_DRIVERS=y > +CONFIG_VIDEO_QCOM_CAMSS=m > CONFIG_VIDEO_RCAR_DRIF=m > CONFIG_VIDEO_IMX219=m > CONFIG_VIDEO_OV5645=m > -- > 2.27.0 >
Hey Bjorn, On Tue, 2 Feb 2021 at 23:44, Bjorn Andersson <bjorn.andersson@linaro.org> wrote: > > On Wed 27 Jan 08:49 CST 2021, Robert Foss wrote: > > > Build camera ISP driver as a module. > > > > Isn't this enabled since b47c5fc15d88 ("arm64: defconfig: Enable > Qualcomm CAMCC, CAMSS and CCI drivers")? You are right, thanks for catching this! I'll drop this patch for v4. > > Regards, > Bjorn > > > Signed-off-by: Robert Foss <robert.foss@linaro.org> > > --- > > arch/arm64/configs/defconfig | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig > > index 838301650a79..cb224d2af6a0 100644 > > --- a/arch/arm64/configs/defconfig > > +++ b/arch/arm64/configs/defconfig > > @@ -640,6 +640,7 @@ CONFIG_VIDEO_RENESAS_FDP1=m > > CONFIG_VIDEO_RENESAS_FCP=m > > CONFIG_VIDEO_RENESAS_VSP1=m > > CONFIG_SDR_PLATFORM_DRIVERS=y > > +CONFIG_VIDEO_QCOM_CAMSS=m > > CONFIG_VIDEO_RCAR_DRIF=m > > CONFIG_VIDEO_IMX219=m > > CONFIG_VIDEO_OV5645=m > > -- > > 2.27.0 > >
Hey Sakari, On Mon, 1 Feb 2021 at 14:40, Sakari Ailus <sakari.ailus@iki.fi> wrote: > > Hi Robert, > > On Wed, Jan 27, 2021 at 03:49:18PM +0100, Robert Foss wrote: > > Add register definitions for version 170 of the Titan architecture > > and implement support for the CSIPHY subdevice. > > > > Signed-off-by: Robert Foss <robert.foss@linaro.org> > > --- > > .../qcom/camss/camss-csiphy-3ph-1-0.c | 182 ++++++++++++++++-- > > .../media/platform/qcom/camss/camss-csiphy.c | 66 +++++-- > > drivers/media/platform/qcom/camss/camss.c | 74 +++++++ > > 3 files changed, 290 insertions(+), 32 deletions(-) > > > > diff --git a/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c b/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c > > index 97cb9de85031..8cf1440b7d70 100644 > > --- a/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c > > +++ b/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c > > @@ -47,6 +47,105 @@ > > #define CSIPHY_3PH_CMN_CSI_COMMON_CTRL6_SHOW_REV_ID BIT(1) > > #define CSIPHY_3PH_CMN_CSI_COMMON_STATUSn(n) (0x8b0 + 0x4 * (n)) > > > > +#define CSIPHY_DEFAULT_PARAMS 0 > > +#define CSIPHY_LANE_ENABLE 1 > > +#define CSIPHY_SETTLE_CNT_LOWER_BYTE 2 > > +#define CSIPHY_SETTLE_CNT_HIGHER_BYTE 3 > > +#define CSIPHY_DNP_PARAMS 4 > > +#define CSIPHY_2PH_REGS 5 > > +#define CSIPHY_3PH_REGS 6 > > + > > +struct csiphy_reg_t { > > + int32_t reg_addr; > > + int32_t reg_data; > > + int32_t delay; > > + uint32_t csiphy_param_type; > > +}; > > + > > +static struct > > This should be const. Agreed. Thanks for catching this! > > > +csiphy_reg_t lane_regs_sdm845[5][14] = { > > + { > > + {0x0004, 0x0C, 0x00, CSIPHY_DEFAULT_PARAMS}, > > + {0x002C, 0x01, 0x00, CSIPHY_DEFAULT_PARAMS}, > > + {0x0034, 0x0F, 0x00, CSIPHY_DEFAULT_PARAMS}, > > + {0x001C, 0x0A, 0x00, CSIPHY_DEFAULT_PARAMS}, > > + {0x0014, 0x60, 0x00, CSIPHY_DEFAULT_PARAMS}, > > + {0x0028, 0x00, 0x00, CSIPHY_DNP_PARAMS}, > > + {0x003C, 0xB8, 0x00, CSIPHY_DEFAULT_PARAMS}, > > + {0x0000, 0x91, 0x00, CSIPHY_DEFAULT_PARAMS}, > > + {0x0008, 0x00, 0x00, CSIPHY_SETTLE_CNT_LOWER_BYTE}, > > + {0x000c, 0x00, 0x00, CSIPHY_DNP_PARAMS}, > > + {0x0010, 0x52, 0x00, CSIPHY_DEFAULT_PARAMS}, > > + {0x0038, 0xFE, 0x00, CSIPHY_DEFAULT_PARAMS}, > > + {0x0060, 0x00, 0x00, CSIPHY_DEFAULT_PARAMS}, > > + {0x0064, 0x7F, 0x00, CSIPHY_DEFAULT_PARAMS}, > > + }, > > + { > > + {0x0704, 0x0C, 0x00, CSIPHY_DEFAULT_PARAMS}, > > + {0x072C, 0x01, 0x00, CSIPHY_DEFAULT_PARAMS}, > > + {0x0734, 0x0F, 0x00, CSIPHY_DEFAULT_PARAMS}, > > + {0x071C, 0x0A, 0x00, CSIPHY_DEFAULT_PARAMS}, > > + {0x0714, 0x60, 0x00, CSIPHY_DEFAULT_PARAMS}, > > + {0x0728, 0x04, 0x00, CSIPHY_DEFAULT_PARAMS}, > > + {0x073C, 0xB8, 0x00, CSIPHY_DEFAULT_PARAMS}, > > + {0x0700, 0x80, 0x00, CSIPHY_DEFAULT_PARAMS}, > > + {0x0708, 0x14, 0x00, CSIPHY_SETTLE_CNT_LOWER_BYTE}, > > + {0x070C, 0xA5, 0x00, CSIPHY_DEFAULT_PARAMS}, > > + {0x0710, 0x52, 0x00, CSIPHY_DEFAULT_PARAMS}, > > + {0x0738, 0x1F, 0x00, CSIPHY_DEFAULT_PARAMS}, > > + {0x0760, 0x00, 0x00, CSIPHY_DEFAULT_PARAMS}, > > + {0x0764, 0x7F, 0x00, CSIPHY_DEFAULT_PARAMS}, > > + }, > > + { > > + {0x0204, 0x0C, 0x00, CSIPHY_DEFAULT_PARAMS}, > > + {0x022C, 0x01, 0x00, CSIPHY_DEFAULT_PARAMS}, > > + {0x0234, 0x0F, 0x00, CSIPHY_DEFAULT_PARAMS}, > > + {0x021C, 0x0A, 0x00, CSIPHY_DEFAULT_PARAMS}, > > + {0x0214, 0x60, 0x00, CSIPHY_DEFAULT_PARAMS}, > > + {0x0228, 0x00, 0x00, CSIPHY_DNP_PARAMS}, > > + {0x023C, 0xB8, 0x00, CSIPHY_DEFAULT_PARAMS}, > > + {0x0200, 0x91, 0x00, CSIPHY_DEFAULT_PARAMS}, > > + {0x0208, 0x00, 0x00, CSIPHY_SETTLE_CNT_LOWER_BYTE}, > > + {0x020C, 0x00, 0x00, CSIPHY_DNP_PARAMS}, > > + {0x0210, 0x52, 0x00, CSIPHY_DEFAULT_PARAMS}, > > + {0x0238, 0xFE, 0x00, CSIPHY_DEFAULT_PARAMS}, > > + {0x0260, 0x00, 0x00, CSIPHY_DEFAULT_PARAMS}, > > + {0x0264, 0x7F, 0x00, CSIPHY_DEFAULT_PARAMS}, > > + }, > > + { > > + {0x0404, 0x0C, 0x00, CSIPHY_DEFAULT_PARAMS}, > > + {0x042C, 0x01, 0x00, CSIPHY_DEFAULT_PARAMS}, > > + {0x0434, 0x0F, 0x00, CSIPHY_DEFAULT_PARAMS}, > > + {0x041C, 0x0A, 0x00, CSIPHY_DEFAULT_PARAMS}, > > + {0x0414, 0x60, 0x00, CSIPHY_DEFAULT_PARAMS}, > > + {0x0428, 0x00, 0x00, CSIPHY_DNP_PARAMS}, > > + {0x043C, 0xB8, 0x00, CSIPHY_DEFAULT_PARAMS}, > > + {0x0400, 0x91, 0x00, CSIPHY_DEFAULT_PARAMS}, > > + {0x0408, 0x00, 0x00, CSIPHY_SETTLE_CNT_LOWER_BYTE}, > > + {0x040C, 0x00, 0x00, CSIPHY_DNP_PARAMS}, > > + {0x0410, 0x52, 0x00, CSIPHY_DEFAULT_PARAMS}, > > + {0x0438, 0xFE, 0x00, CSIPHY_DEFAULT_PARAMS}, > > + {0x0460, 0x00, 0x00, CSIPHY_DEFAULT_PARAMS}, > > + {0x0464, 0x7F, 0x00, CSIPHY_DEFAULT_PARAMS}, > > + }, > > + { > > + {0x0604, 0x0C, 0x00, CSIPHY_DEFAULT_PARAMS}, > > + {0x062C, 0x01, 0x00, CSIPHY_DEFAULT_PARAMS}, > > + {0x0634, 0x0F, 0x00, CSIPHY_DEFAULT_PARAMS}, > > + {0x061C, 0x0A, 0x00, CSIPHY_DEFAULT_PARAMS}, > > + {0x0614, 0x60, 0x00, CSIPHY_DEFAULT_PARAMS}, > > + {0x0628, 0x00, 0x00, CSIPHY_DNP_PARAMS}, > > + {0x063C, 0xB8, 0x00, CSIPHY_DEFAULT_PARAMS}, > > + {0x0600, 0x91, 0x00, CSIPHY_DEFAULT_PARAMS}, > > + {0x0608, 0x00, 0x00, CSIPHY_SETTLE_CNT_LOWER_BYTE}, > > + {0x060C, 0x00, 0x00, CSIPHY_DNP_PARAMS}, > > + {0x0610, 0x52, 0x00, CSIPHY_DEFAULT_PARAMS}, > > + {0x0638, 0xFE, 0x00, CSIPHY_DEFAULT_PARAMS}, > > + {0x0660, 0x00, 0x00, CSIPHY_DEFAULT_PARAMS}, > > + {0x0664, 0x7F, 0x00, CSIPHY_DEFAULT_PARAMS}, > > + }, > > +}; > > -- > Sakari Ailus