Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp1545258lqt; Wed, 20 Mar 2024 07:14:11 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXacJB2C6lN1NLQjEFflb+bjzH31Y3QzvAUCTvHtLSzzjC6aHJSTek6+h6fqB5u48bzRgT9JisNfjU7vDTdoaruNPEhmyEXHx1TvRT+GQ== X-Google-Smtp-Source: AGHT+IG2xS9pJLNM6+lFedq1fedv1dPPrZPz42wqMKj3OQRbnuI/PtIj3UHw25nIOGqSMAU3YeM5 X-Received: by 2002:a17:902:7d92:b0:1dc:3e49:677d with SMTP id a18-20020a1709027d9200b001dc3e49677dmr5472460plm.26.1710944050800; Wed, 20 Mar 2024 07:14:10 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710944050; cv=pass; d=google.com; s=arc-20160816; b=hoOJcYJPQseXEfcIa9Q0a5A8+dJ0m7u8srajTWuBT/L0WhmHyDFwKNV/KmQCRvgODv zJWGTLPP82Aj2sb1Y0b3bFeSYMD+hHaSDWquxeHHtugtXwlTQRP6Q+xW6RvNUcGBDQLk ZFWV2XQVsTWCZhVPChxisKS4q++7ZkreSUs0GG74ZDCT63/eMPpIJ3Ryz0oS2DKNJNV9 Ymn2k2Cw9CXtyxqMP/GiS529pQw0B2auDRvyYVTS9ANw7ZiTcwuspgrtgFvLXb3yeRj2 882Jq0cJYU0obiNOnsg4RTBs5Y9vMYOW5TRzZL06zwwwVKeDBTq7/MO10V9NjxsuoloJ BcyA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=zXa8AY6dgeHMO6qUp4Hmrmjqvg1owoNbUEMfj2Pg8i8=; fh=DgbO6CrQ0AhNBWU0rW/Fp+Fb1ZyIxjqkiUk3ndlrcHw=; b=s1FJ7ZP8m66JeCtwvPlpT/ke0Y826vLgRfvifFqW2x31mt5nvb2LRnEAj35zBbhLBp HJCE0VQSrGyA0W/RZJLU5pX0/A4yzjkn/sruitx3F1ztuQI50vQhw/ioQvo84rhxovbF gmWNJp2XfPe4MMunSH5pbW1Z8jggWXH0CMlwvQdptlHO0UfR+w+mmz+eFZEgOKmk3bzY mbc4qCl23LE95DdrnFHWMfj0Gj9WdD5cI6Bvy5T+5N8HpmbEPU4PozrZ6nbazewATcuR cuwACK//u7g0v1X0fZmPQyAW0kbe6me47/tKVuNAPoxt3Ue9XBl6/PRRM1g4cdsw17xV t+hQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=E2VJrVZZ; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-108986-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-108986-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id lv13-20020a1709032a8d00b001dde19b26cbsi13336573plb.650.2024.03.20.07.14.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Mar 2024 07:14:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-108986-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=E2VJrVZZ; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-108986-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-108986-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 2E1B3B2422F for ; Wed, 20 Mar 2024 14:12:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CFD89482DB; Wed, 20 Mar 2024 14:12:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="E2VJrVZZ" Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5FD503EA98; Wed, 20 Mar 2024 14:12:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710943927; cv=none; b=OFfTMw4NQ+NcZlgSxYg/q6joMjd8KYAS1CojYoMo9AP8AM18AJMebC+ivpTKCzUa3xYOqO/DGJl65b+qVb/mcc3uNu4I1YpRs1vOfKOlGKXHceQz6WdGMbPLII3c+P+vXaS0Nnfvdsdzmd0ZjG/J5rR/K8uOgGwwC6bbea1xHiU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710943927; c=relaxed/simple; bh=s2/vULG5iS+dEBSt33YSQwB7/yLX65wOU1yR3yAm0aY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Mn+Jtup6+SjJ8rl1rBseS2n1z8KztQtlbBxHPRqa3+36JSozrswm/05UT0MVCXCzSvFSfD4BIAm5dMtKegBwXJKY+LYbeImNjc7kT//8DyDsBKP7Ahp9hQOpi/arMnBkw3x/VU2/iYRMz+LH8ZFtD6Id97AtfFwXL1wN+oy+K3g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=E2VJrVZZ; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 42K7ek7m000798; Wed, 20 Mar 2024 14:12:01 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type; s=qcppdkim1; bh=zXa8AY6dgeHMO6qUp4Hm rmjqvg1owoNbUEMfj2Pg8i8=; b=E2VJrVZZjFdFjUR7bPVr1knm4OgfJHvfQSFb ik9CK5VTCennEbPjiemn354+q4HzKdonHswGJ7RV8PXteXgbmH8JPkHjy8ef62PI goCTi6oHy6X0zn2qtnDiAeDNn/tK91sghpekjI9jdoro1GV1yv0MKV0ZUSFoZfGM D3OFbCQ3Dsf89ApoHrho2UsSiaXXP94PXBIpeBOb5OEu4JmM15ws2U2qB+jNtICV l8+7AY7nvI3OstsZY+cuFhjf9uET/Ynu9HjpygvF4l5VruVeXtA5eEaCwktX9OgM gxu92WN3pRCCbYs71G+U99iVcIr4WNHg56GRFtA5JLorwqSw6g== Received: from nasanppmta02.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3wyqh61ar9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 20 Mar 2024 14:12:01 +0000 (GMT) Received: from nasanex01b.na.qualcomm.com (nasanex01b.na.qualcomm.com [10.46.141.250]) by NASANPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 42KEC0F7022290 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 20 Mar 2024 14:12:00 GMT Received: from hu-depengs-sha.qualcomm.com (10.80.80.8) by nasanex01b.na.qualcomm.com (10.46.141.250) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Wed, 20 Mar 2024 07:11:58 -0700 From: Depeng Shao To: , , , , , , CC: , , , Subject: [PATCH v2 2/8] media: qcom: camss: Add subdev notify support Date: Wed, 20 Mar 2024 19:41:30 +0530 Message-ID: <20240320141136.26827-3-quic_depengs@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240320141136.26827-1-quic_depengs@quicinc.com> References: <20240320141136.26827-1-quic_depengs@quicinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nasanex01b.na.qualcomm.com (10.46.141.250) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: SEN65laiMssUQ5vPcjKMc2e2YwEBeBXx X-Proofpoint-GUID: SEN65laiMssUQ5vPcjKMc2e2YwEBeBXx X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-20_09,2024-03-18_03,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 bulkscore=0 mlxlogscore=999 malwarescore=0 spamscore=0 clxscore=1015 priorityscore=1501 lowpriorityscore=0 adultscore=0 phishscore=0 impostorscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2403140001 definitions=main-2403200112 From: Yongsheng Li The buf done irq and register update register are moved to CSID in SM8550, so but the write master configuration in VFE, in case adapt existing code logic. So add buf done and register related subdev event, and use the notify interface in the v4l2_device structure to communicate between CSID and VFE driver. Signed-off-by: Yongsheng Li --- .../media/platform/qcom/camss/camss-csid.h | 7 +++ .../media/platform/qcom/camss/camss-csiphy.h | 2 + drivers/media/platform/qcom/camss/camss-vfe.h | 2 + drivers/media/platform/qcom/camss/camss.c | 50 +++++++++++++++++++ drivers/media/platform/qcom/camss/camss.h | 7 +++ 5 files changed, 68 insertions(+) diff --git a/drivers/media/platform/qcom/camss/camss-csid.h b/drivers/media/platform/qcom/camss/camss-csid.h index fddccb69da13..4a9e5a2d1f92 100644 --- a/drivers/media/platform/qcom/camss/camss-csid.h +++ b/drivers/media/platform/qcom/camss/camss-csid.h @@ -147,6 +147,13 @@ struct csid_hw_ops { * @csid: CSID device */ void (*subdev_init)(struct csid_device *csid); + + /* + * event - receive event from parent v4l2 device + * @csid: CSID device + */ + void (*event)(struct csid_device *csid, + unsigned int evt_type, void *arg); }; struct csid_device { diff --git a/drivers/media/platform/qcom/camss/camss-csiphy.h b/drivers/media/platform/qcom/camss/camss-csiphy.h index c9b7fe82b1f0..ffe1b95eea98 100644 --- a/drivers/media/platform/qcom/camss/camss-csiphy.h +++ b/drivers/media/platform/qcom/camss/camss-csiphy.h @@ -61,6 +61,8 @@ struct csiphy_hw_ops { void (*lanes_disable)(struct csiphy_device *csiphy, struct csiphy_config *cfg); irqreturn_t (*isr)(int irq, void *dev); + void (*event)(struct csiphy_device *csiphy, + unsigned int evt_type, void *arg); }; struct csiphy_device { diff --git a/drivers/media/platform/qcom/camss/camss-vfe.h b/drivers/media/platform/qcom/camss/camss-vfe.h index 0572c9b08e11..9919fe0ff101 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe.h +++ b/drivers/media/platform/qcom/camss/camss-vfe.h @@ -115,6 +115,8 @@ struct vfe_hw_ops { int (*vfe_halt)(struct vfe_device *vfe); void (*violation_read)(struct vfe_device *vfe); void (*vfe_wm_stop)(struct vfe_device *vfe, u8 wm); + void (*event)(struct vfe_device *vfe, + unsigned int evt_type, void *arg); }; struct vfe_isr_ops { diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/platform/qcom/camss/camss.c index 1923615f0eea..b57cd25bf6c7 100644 --- a/drivers/media/platform/qcom/camss/camss.c +++ b/drivers/media/platform/qcom/camss/camss.c @@ -1904,6 +1904,55 @@ static void camss_genpd_cleanup(struct camss *camss) dev_pm_domain_detach(camss->genpd, true); } +static void camss_v4l2_subdev_notify(struct v4l2_subdev *sd, + unsigned int cmd, void *arg) +{ + struct v4l2_device *v4l2_dev = sd->v4l2_dev; + struct camss *camss = to_camss(v4l2_dev); + struct vfe_device *vfe; + struct vfe_line *vfe_line; + struct csid_device *csid; + int evt_data = *(int *)arg; + + if (camss->res->version != CAMSS_8550) + return; + + switch (cmd) { + case NOTIFY_BUF_DONE: + csid = v4l2_get_subdevdata(sd); + vfe = &(camss->vfe[csid->id]); + if (vfe->ops->event) + vfe->ops->event(vfe, + NOTIFY_BUF_DONE, (void *)&evt_data); + break; + + case NOTIFY_RUP: + vfe_line = v4l2_get_subdevdata(sd); + vfe = to_vfe(vfe_line); + csid = &(camss->csid[vfe->id]); + + if (csid->ops->event) + csid->ops->event(csid, + NOTIFY_RUP, (void *)&evt_data); + break; + + case NOTIFY_RUP_CLEAR: + vfe_line = v4l2_get_subdevdata(sd); + vfe = to_vfe(vfe_line); + csid = &(camss->csid[vfe->id]); + + if (csid->ops->event) + csid->ops->event(csid, + NOTIFY_RUP_CLEAR, (void *)&evt_data); + + break; + + default: + dev_err(camss->dev, "Not supported evt type\n"); + break; + } +} + /* * camss_probe - Probe CAMSS platform device * @pdev: Pointer to CAMSS platform device @@ -1974,6 +2023,7 @@ static int camss_probe(struct platform_device *pdev) media_device_init(&camss->media_dev); camss->v4l2_dev.mdev = &camss->media_dev; + camss->v4l2_dev.notify = camss_v4l2_subdev_notify; ret = v4l2_device_register(camss->dev, &camss->v4l2_dev); if (ret < 0) { dev_err(dev, "Failed to register V4L2 device: %d\n", ret); diff --git a/drivers/media/platform/qcom/camss/camss.h b/drivers/media/platform/qcom/camss/camss.h index 2f63206a8463..f1fe68dedd9e 100644 --- a/drivers/media/platform/qcom/camss/camss.h +++ b/drivers/media/platform/qcom/camss/camss.h @@ -86,6 +86,13 @@ enum icc_count { ICC_SM8250_COUNT = 4, }; +enum subdev_notify_evt { + NOTIFY_BUF_DONE = 0, + NOTIFY_RUP, + NOTIFY_RUP_CLEAR, + NOTIFY_MAX, +}; + struct camss_resources { enum camss_version version; const char *pd_name; -- 2.17.1