Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3473805imu; Sun, 11 Nov 2018 15:56:02 -0800 (PST) X-Google-Smtp-Source: AJdET5fC+i8oxZBODWOCjpqy+lt1yDqgoh4ZJohxeD9Z802WfdxiQ8X8xPNK0Bqc4efAVsxR+7xF X-Received: by 2002:a17:902:bc83:: with SMTP id bb3-v6mr17074507plb.223.1541980562906; Sun, 11 Nov 2018 15:56:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541980562; cv=none; d=google.com; s=arc-20160816; b=T6RKvNSOsy8+N0Bkefzzzna2z2udV3iRqy62LF9KtRGtyGWe84e22V06G/lNrdlM72 +5j8PT7nBcNcebTltotdOfZvFpG3P2lR68PI1OJQbAFUAuvWygjFYGgeXRgeSBw8tFqt BJhyec818MbrJrxtOMjMK1F4uhZS/PUaV3nBZ/UXSW6h+baOsAr+YZ4zDym0+uy2pMA8 FF1EfkCgJU+GcRtCvI91ciOwF7v6DRSPTN3peAV+sgASak+nATLInm11sF+LPquKj/8/ KRBWlwxKd6Y1DXwLqWpjDL4Oz5yJUGnO5e4BlFvY/MsjkbCo2DhtWeravvDx84DgbtAP zM1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=SQrG1em5wlmrXGgAOtJ92ckDgGJB3MjQUEjHzLoxX1c=; b=QcrVIik68QQqscBix8HuXyLjlcdzO/nAmGtjZST6kFqiMk3C6S9Sqi8imEHe5QlH1g gKgfRNmeON3lpf3FoBswI83VGfSevK7UepJ4pJAxr7LUQQLlRdjJIXShJpb7UZ2OGigu J0ULHiTxyHBzrsKLfyNIQ6aQSFD5D34AY3fK2QoKBlUzEfJs6gcPc4SFfp1p+KM4v0FL SWt3/m78WGKEUwvt0ZT3RpdIyQz+nvOe8D3fMk3PMRCr/dF/FRFOI8pjQ0G5b6REfkgY Xra4zKWF4yVxEXUgoyr6njNmN80GVTxH+8J+1GZXXO8z4HIlFTA9WEqM+QlU25HV0KWJ HBzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=C53u16zR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 69si15132501pgd.290.2018.11.11.15.55.48; Sun, 11 Nov 2018 15:56:02 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=C53u16zR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732968AbeKLJo0 (ORCPT + 99 others); Mon, 12 Nov 2018 04:44:26 -0500 Received: from mail.kernel.org ([198.145.29.99]:37518 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732717AbeKLISX (ORCPT ); Mon, 12 Nov 2018 03:18:23 -0500 Received: from localhost (unknown [206.108.79.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 897D221508; Sun, 11 Nov 2018 22:28:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541975307; bh=gDAOY9NwoGUOskBvwDs4HdlbDz+vF+8/CjDkFmP8xq0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C53u16zR+pqyg+RP/TlH/wH5tbvoT2vd/BZFKpk+37ge1vQuPuhufBSjMbR0TcCSy erhKN2/VG/veIOabb7iMXFq85l3Orws6XRN/VrQR4NO9gZ8woOc2XC/UQ1kSY5rCHY a/EPmaF9JKsPUFr6tkqeq14ahUvxigZyZbQ+7xEQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lubomir Rintel , Sakari Ailus , Mauro Carvalho Chehab Subject: [PATCH 4.19 278/361] media: ov7670: make "xclk" clock optional Date: Sun, 11 Nov 2018 14:20:25 -0800 Message-Id: <20181111221655.586919466@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181111221619.915519183@linuxfoundation.org> References: <20181111221619.915519183@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Lubomir Rintel commit 786fa584eda86d6598db3b87c61dc81f68808d11 upstream. When the "xclk" clock was added, it was made mandatory. This broke the driver on an OLPC plaform which doesn't know such clock. Make it optional. Tested on a OLPC XO-1 laptop. Fixes: 0a024d634cee ("[media] ov7670: get xclk") Cc: stable@vger.kernel.org # 4.11+ Signed-off-by: Lubomir Rintel Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman --- drivers/media/i2c/ov7670.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) --- a/drivers/media/i2c/ov7670.c +++ b/drivers/media/i2c/ov7670.c @@ -1808,17 +1808,24 @@ static int ov7670_probe(struct i2c_clien info->pclk_hb_disable = true; } - info->clk = devm_clk_get(&client->dev, "xclk"); - if (IS_ERR(info->clk)) - return PTR_ERR(info->clk); - ret = clk_prepare_enable(info->clk); - if (ret) - return ret; + info->clk = devm_clk_get(&client->dev, "xclk"); /* optional */ + if (IS_ERR(info->clk)) { + ret = PTR_ERR(info->clk); + if (ret == -ENOENT) + info->clk = NULL; + else + return ret; + } + if (info->clk) { + ret = clk_prepare_enable(info->clk); + if (ret) + return ret; - info->clock_speed = clk_get_rate(info->clk) / 1000000; - if (info->clock_speed < 10 || info->clock_speed > 48) { - ret = -EINVAL; - goto clk_disable; + info->clock_speed = clk_get_rate(info->clk) / 1000000; + if (info->clock_speed < 10 || info->clock_speed > 48) { + ret = -EINVAL; + goto clk_disable; + } } ret = ov7670_init_gpio(client, info);